diff --git a/code/.DESeq2.r.swp b/code/.DESeq2.r.swp deleted file mode 100644 index 4e418b0..0000000 Binary files a/code/.DESeq2.r.swp and /dev/null differ diff --git a/code/By_Sample b/code/By_Sample index 00d9e2d..e879d59 100755 --- a/code/By_Sample +++ b/code/By_Sample @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc CWD=`pwd` @@ -11,6 +11,10 @@ fi params=$1 SAMPLE=$2 + +if [ `cat $CWD/${SAMPLE}.out | wc -l` -eq 1 ]; then exec >> $CWD/$SAMPLE.out;else exec > $CWD/$SAMPLE.out; fi +exec 2>&1 + FLAG=0 if [ ! -z `qstat -j $JOB_ID | grep "tmp_free" | sed 's/ +//g' | cut -d ' ' -f1` ] then diff --git a/code/Summarize b/code/Summarize index 238360a..e3a35b7 100755 --- a/code/Summarize +++ b/code/Summarize @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -ne 4 ] && [ "$#" -ne 3 ] then @@ -20,6 +20,9 @@ group_sheet=`basename $group_info | sed 's/\.txt$//g'` params=`cat $PARAMS | grep "^DESeq2" | cut -f2` +if [ `cat ${GROUP}.out | wc -l` -eq 1 ]; then exec >> $GROUP.out;else exec > $GROUP.out; fi +exec 2>&1 + cd $OUT_DIR mkdir -p $group_sheet diff --git a/code/align_summary b/code/align_summary index 5374bff..117a942 100755 --- a/code/align_summary +++ b/code/align_summary @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 1 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/custom-bashrc b/code/custom-bashrc new file mode 100755 index 0000000..2228153 --- /dev/null +++ b/code/custom-bashrc @@ -0,0 +1,20 @@ +#!/bin/bash + + +PS1="[\u@\h \W]\$ " + + +PATH=code/:code/bin/:code/utilities/:code/utilities/STAR/:code/utilities/sratoolkit/:code/utilities/cufflinks/:code/utilities/CPAT/:code/utilities/fastqc/:code/utilities/subread:$PATH + +PYTHONPATH=code/utilities/utilities/CPAT/lib/:$PYTHONPATH + +export LC_ALL=C +export PATH +export PYTHONPATH + +export PERL5LIB=$HOME/lib +export EDITOR="/usr/local/bin/mate -w" + +module load samtools/0.1.19 +module load r/3.3.0 +module load python/2.7 diff --git a/code/custom_bash_profile b/code/custom_bash_profile deleted file mode 100755 index c033211..0000000 --- a/code/custom_bash_profile +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - - -PS1="[\u@\h \W]\$ " - - -PATH=code/:code/bin/:code/utilities/STAR/:code/utilities/sratoolkit/:code/utilities/cufflinks/:code:code/bin:code/utilities:code/utilities/CPAT/:code/utilities/fastqc/:code/utilities/subread:$PATH - - -PYTHONPATH=$HOME/utilities/python_software/local/apps/python/2.7.3/lib/python2.7/site-packages:$PYTHONPATH - -export LC_ALL=C -export PATH -export PYTHONPATH - -export PERL5LIB=$HOME/lib -export EDITOR="/usr/local/bin/mate -w" - -module load samtools/0.1.19 -module load r/3.3.0 diff --git a/code/generate_STAR-Index b/code/generate_STAR-Index index df51380..2df3978 100755 --- a/code/generate_STAR-Index +++ b/code/generate_STAR-Index @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 2 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/generate_rnaseq_tracks b/code/generate_rnaseq_tracks index 4158488..9c7c792 100755 --- a/code/generate_rnaseq_tracks +++ b/code/generate_rnaseq_tracks @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -ne 4 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/gtf_id2name b/code/gtf_id2name index dfc52be..1449a95 100755 --- a/code/gtf_id2name +++ b/code/gtf_id2name @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -ne 1 ]; then printf "\n\n###### Usage\n\n" @@ -12,10 +12,12 @@ INP=$1 TEMP1=$(mktemp) TEMP2=$(mktemp) -cat $1 | awk '$3~/exon/'| perl -F/\\t/ -lane '@des=split(/ \"|\";\s{0,1}/,$F[8]);for($i=0;$i<@des;$i=$i+2){if($des[$i]=~/gene_id/){$gene_id=$des[$i+1]}elsif($des[$i]=~/gene_name/){$gene_name=$des[$i+1]}else{}}print "$gene_name\t$gene_id"' | sort | uniq | mergeuniq -merge > $TEMP1 +cat $INP | grep -v "^#" | awk '{if($1!~/^chr/){print "chr"$0}else{print $0}}' | awk '$3~/exon/'| perl -F/\\t/ -lane '@des=split(/ \"|\";\s{0,1}/,$F[8]);for($i=0;$i<@des;$i=$i+2){if($des[$i]=~/gene_id/){$gene_id=$des[$i+1]}elsif($des[$i]=~/gene_name/){$gene_name=$des[$i+1]}else{}}print "$gene_name\t$gene_id"' | sort | uniq | mergeuniq -merge > $TEMP1 cat $TEMP1 | grep " " | key-expand | cols -t 1 0 | awk '{print $1"\t"$1":"$2}' > $TEMP2 cat $TEMP1 | grep -v " " | cols -t 1 0 >> $TEMP2 cat $TEMP2 | sort -k1,1 | mergeuniq -merge | tr ' ' '|' > ${INP%.*}.id2name.txt + +rm -rf $TEMP1 $TEMP2 diff --git a/code/job_submitter.bash b/code/job_submitter.bash new file mode 100755 index 0000000..a13eb6f --- /dev/null +++ b/code/job_submitter.bash @@ -0,0 +1,8 @@ +#!/bin/bash + +source code/custom-bashrc + +NSLOTS=$1 +shift + +qsub -b Y -cwd -pe threaded $NSLOTS -l tmp_free=120G -l tmp_token=30G -hard $@ diff --git a/code/run_alignment b/code/run_alignment index cc491cb..50f07d9 100755 --- a/code/run_alignment +++ b/code/run_alignment @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -ne 5 ] && [ "$#" -ne 4 ] && [ "$#" -ne 3 ] diff --git a/code/run_assembly b/code/run_assembly index 979af97..e356c39 100755 --- a/code/run_assembly +++ b/code/run_assembly @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 3 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/run_fastq-download b/code/run_fastq-download index 482a576..d5e8c7e 100755 --- a/code/run_fastq-download +++ b/code/run_fastq-download @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 2 ]; then @@ -87,9 +87,9 @@ then cd $OUT_DIR/$name_sample/ printf "\n\n***** Downloading $id_sample/${id_file} into $OUT_DIR/$name_sample Using fastq-dump.2...\n" -echo "../code/utilities/sratoolkit/fastq-dump.2 --tries 10 --split-files -A "$id_file" -gzip" >> run.bash +echo "../code/utilities/sratoolkit/fastq-dump.2.4.2 --tries 10 --split-files -A "$id_file" -gzip" >> run.bash pwd -../code/utilities/sratoolkit/fastq-dump.2 --tries 10 --split-files -A $id_file -gzip +../code/utilities/sratoolkit/fastq-dump.2.4.2 --tries 10 --split-files -A $id_file -gzip cd $CWD done diff --git a/code/run_fastq-link b/code/run_fastq-link index 1c59553..7d3da8b 100755 --- a/code/run_fastq-link +++ b/code/run_fastq-link @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 3 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/run_fastqc b/code/run_fastqc index e75f622..102fc67 100755 --- a/code/run_fastqc +++ b/code/run_fastqc @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc if [ "$#" -lt 2 ]; then printf "\n\n###### Usage\n\n" diff --git a/code/setup_waiting.bash b/code/setup_waiting.bash new file mode 100755 index 0000000..0aefd36 --- /dev/null +++ b/code/setup_waiting.bash @@ -0,0 +1,10 @@ +#!/bin/bash + +source code/custom-bashrc + +INPUT=$@ + +for element in ${INPUT[@]} +do + echo "###### START ######" > ${element}.out +done diff --git a/code/summarize_raw_count b/code/summarize_raw_count index b13dd44..a14ca04 100755 --- a/code/summarize_raw_count +++ b/code/summarize_raw_count @@ -1,6 +1,6 @@ #!/bin/bash -if [ -f code/custom_bash_profile ]; then source code/custom_bash_profile; fi # shell settings +source code/custom-bashrc TEMP="$#" FILE_COUNT=$((TEMP*2)) diff --git a/code/utilities b/code/utilities deleted file mode 120000 index 2fdea1f..0000000 --- a/code/utilities +++ /dev/null @@ -1 +0,0 @@ -/ifs/home/gongy05/utilities/yixiao_scripts/RNA-Seq_Standard/code/utilities \ No newline at end of file diff --git a/code/utilities/CPAT b/code/utilities/CPAT new file mode 120000 index 0000000..fa4bda9 --- /dev/null +++ b/code/utilities/CPAT @@ -0,0 +1 @@ +CPAT-1.2.2/ \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/MANIFEST.in b/code/utilities/CPAT-1.2.2/MANIFEST.in new file mode 100755 index 0000000..dcb7c57 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/MANIFEST.in @@ -0,0 +1,53 @@ +include distribute_setup.py +recursive-include src *.h +recursive-include src *.c +recursive-include lib *.h +recursive-include lib *.c +recursive-include lib *.pyx +recursive-include doc * + +#include MANIFEST.in +#include KNOWN_BUGS +#include ez_setup.py +include dat/* +include test/* +include lib/pysam/csamtools.pxd +include lib/pysam/csamtools.pyx +include lib/pysam/csamtools.c +include lib/pysam/ctabix.pxd +include lib/pysam/ctabix.c +include lib/pysam/ctabix.pyx +include lib/pysam/TabProxies.c +include lib/pysam/TabProxies.pyx +include lib/pysam/TabProxies.pxd +include lib/pysam/cvcf.pyx +include lib/pysam/cvcf.pxd +include lib/pysam/cvcf.c +include lib/pysam/pysam_util.h +include lib/samtools/*.h +include lib/samtools/*/*.h +include lib/tabix/*.h + +# pysam tests +include lib/tests/00README.txt +include lib/tests/Makefile +include lib/tests/ex1.fa +include lib/tests/ex1.sam.gz +include lib/tests/ex3.sam +include lib/tests/ex4.sam +include lib/tests/ex5.sam +include lib/tests/ex6.sam +include lib/tests/ex7.sam +include lib/tests/ex8.sam +include lib/tests/ex9_fail.bam +include lib/tests/ex9_nofail.bam +include lib/tests/ex10.sam +include lib/tests/example.py +include lib/tests/pysam_test.py +include lib/tests/segfault_tests.py + +# tabix tests +include lib/tests/tabix_test.py +include lib/tests/example.gtf.gz +include lib/tests/example.gtf.gz.tbi + diff --git a/code/utilities/CPAT-1.2.2/PKG-INFO b/code/utilities/CPAT-1.2.2/PKG-INFO new file mode 100755 index 0000000..359f037 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/PKG-INFO @@ -0,0 +1,11 @@ +Metadata-Version: 1.0 +Name: CPAT +Version: 1.2.2 +Summary: Coding Potential Assessment Tool +Home-page: http://rna-cpat.sourceforge.net/ +Author: Liguo Wang +Author-email: wangliguo78@gmail.com +License: UNKNOWN +Description: UNKNOWN +Platform: Linux +Platform: MacOS diff --git a/code/utilities/CPAT-1.2.2/bin/cpat.py b/code/utilities/CPAT-1.2.2/bin/cpat.py new file mode 100755 index 0000000..b1f7813 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/bin/cpat.py @@ -0,0 +1,244 @@ +#!/usr/bin/env python +'''--------------------------------------------------------------------------------------- +CPAT: Coding Potential Assessing Tool +------------------------------------------------------------------------------------------''' + +#import built-in modules +import os,sys + +import os,sys +if sys.version_info[0] != 2 or sys.version_info[1] != 7: + print >>sys.stderr, "\nYou are using python" + str(sys.version_info[0]) + '.' + str(sys.version_info[1]) + " CPAT needs python2.7!\n" + sys.exit() + + + +import string +from optparse import OptionParser +import warnings +import string +import collections +import sets +import signal +from numpy import mean,median,std,nansum +from string import maketrans +import subprocess + +#import 3rd party modules +import pysam +#from bx.bbi.bigwig_file import BigWigFile +import numpy as np + +#import my own modules +from cpmodule import fickett +from cpmodule import orf +from cpmodule import fasta +from cpmodule import annoGene +from cpmodule import FrameKmer +from cpmodule import ireader + +__author__ = "Liguo Wang" +__contributor__="Liguo Wang, Hyun Jung Park, Wei Li" +__copyright__ = "Copyright 2012, Mayo Clinic" +__credits__ = [] +__license__ = "GPL" +__version__="1.2.2" +__maintainer__ = "Liguo Wang" +__email__ = "wang.liguo@mayo.edu; wangliguo78@gmail.com" +__status__ = "Production" + + +def coding_prediction(rdata,idata,outfile): + '''rdata stored the linear regression model, idata is data matrix containing features''' + RCMD = open(outfile + '.r','w') + print >>RCMD, 'load(\"%s\")' % (rdata) + print >>RCMD, 'test <- read.table(file=\"%s\",sep="\\t",col.names=c("ID","mRNA","ORF","Fickett","Hexamer"))' % (idata) + print >>RCMD, 'test$prob <- predict(mylogit,newdata=test,type="response")' + print >>RCMD, 'attach(test)' + print >>RCMD, 'output <- cbind("mRNA_size"=mRNA,"ORF_size"=ORF,"Fickett_score"=Fickett,"Hexamer_score"=Hexamer,"coding_prob"=test$prob)' + print >>RCMD, 'write.table(output,file=\"%s\",quote=F,sep="\\t",row.names=ID)' % (outfile) + RCMD.close() + try: + subprocess.call("Rscript " + outfile + '.r', shell=True) + except: + pass + #os.remove(idata) + +def sum_bwfile(inbedline,bwfile): + '''retrieve sum of conservation score for all exons from input bed line''' + line = inbedline + bw_signal = [] + try: + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr, "Incorrect bed format." + try: + for st,end in zip(exon_start,exon_end): + #print chrom +'\t'+ str(st) +'\t'+ str(end) + bw_signal.extend(bwfile.get_as_array(chrom,st,end)) + wigsum = nansum(bw_signal) + except: + wigsum = 0 + wigsum=np.nan_to_num(wigsum) + return wigsum + + +def bed_or_fasta(infile): + '''determine if the input file is bed or fasta format''' + format = "UNKNOWN" + for line in ireader.reader(infile): + #line = line.strip() + if line.startswith('#'): + continue + if line.startswith('>'): + format="FASTA" + return format + elif len(line.split())==12: + format='BED' + return format + return format + +def index_fasta(infile): + '''index fasta file using samTools''' + if os.path.isfile(infile): + pass + else: + print >>sys.stderr, "Indexing " + infile + ' ...', + pysam.faidx(infile) + print >>sys.stderr, "Done!" + +def extract_feature_from_bed(inbed,refgenome,stt,stp,c_tab,g_tab): + '''extract features of sequence from bed line''' + + stt_coden = stt.strip().split(',') + stp_coden = stp.strip().split(',') + transtab = maketrans("ACGTNX","TGCANX") + mRNA_seq = '' + mRNA_size = 0 + if inbed.strip(): + try: + fields = inbed.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + exon_num = int(fields[9]) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_starts = exon_ends[:-1] + intron_ends = exon_starts[1:] + except: + print >>sys.stderr,"Wrong format!" + inbed + return None + mRNA_size = sum(exon_sizes) + for st,end in zip(exon_starts, exon_ends): + exon_coord = chrom + ':' + str(st +1) + '-' + str(end) + tmp = pysam.faidx(refgenome,exon_coord) + mRNA_seq += ''.join([i.rstrip('\n\r') for i in tmp[1:]]) + if strand =='-': + mRNA_seq = mRNA_seq.upper().translate(transtab)[::-1] + tmp = orf.ORFFinder(mRNA_seq) + (CDS_size, CDS_frame, CDS_seq) = tmp.longest_orf(direction="+",start_coden=stt_coden, stop_coden=stp_coden) + fickett_score = fickett.fickett_value(CDS_seq) + hexamer = FrameKmer.kmer_ratio(CDS_seq,6,3,c_tab,g_tab) + #print CDS_seq + return (geneName, mRNA_size, CDS_size, fickett_score,hexamer) + +def extract_feature_from_seq(seq,stt,stp,c_tab,g_tab): + '''extract features of sequence from fasta entry''' + + stt_coden = stt.strip().split(',') + stp_coden = stp.strip().split(',') + transtab = maketrans("ACGTNX","TGCANX") + mRNA_seq = seq.upper() + mRNA_size = len(seq) + tmp = orf.ORFFinder(mRNA_seq) + (CDS_size1, CDS_frame1, CDS_seq1) = tmp.longest_orf(direction="+",start_coden=stt_coden, stop_coden=stp_coden) + fickett_score1 = fickett.fickett_value(CDS_seq1) + hexamer = FrameKmer.kmer_ratio(CDS_seq1,6,3,c_tab,g_tab) + return (mRNA_size, CDS_size1, fickett_score1,hexamer) + +def main(): + usage = "\n%prog [options]" + parser = OptionParser(usage,version="%prog " + __version__) + parser.add_option("-g","--gene",action="store",dest="gene_file",help="Transcripts either in BED format or mRNA sequences in FASTA format: If this is BED format file, '-r' must be specified; if this is mRNA sequence file in FASTA format, ignore the '-r' option. The input BED or FASTA file could be regular text file or compressed file (*.gz, *.bz2) or accessible url.") + parser.add_option("-o","--outfile",action="store",dest="out_file",help="output file. Tab separated text file: geneID mRNA size ORF size Fickett Score Hexamer ScoreCoding Probability.") + parser.add_option("-x","--hex",action="store",dest="hexamer_dat",help="Prebuilt hexamer frequency table (Human, Mouse, Fly, Zebrafish). Run 'make_hexamer_tab.py' to make this table out of your own training dataset.") + parser.add_option("-d","--logitModel",action="store",dest="logit_model",help="Prebuilt training model (Human, Mouse, Fly, Zebrafish). Run 'make_logitModel.py' to build logit model out of your own training datset") + parser.add_option("-r","--ref",action="store",dest="ref_genome",help="Reference genome sequences in FASTA format. Ignore this option if mRNA sequences file was provided to '-g'. Reference genome file will be indexed automatically (produce *.fai file along with the original *.fa file within the same directory) if hasn't been done.") + parser.add_option("-s","--start",action="store",dest="start_codons",default='ATG',help="Start codon (DNA sequence, so use 'T' instead of 'U') used to define open reading frame (ORF). default=%default") + parser.add_option("-t","--stop",action="store",dest="stop_codons",default='TAG,TAA,TGA',help="Stop codon (DNA sequence, so use 'T' instead of 'U') used to define open reading frame (ORF). Multiple stop codons should be separated by ','. default=%default") + + (options,args)=parser.parse_args() + + #check input and output files + for file in ([options.gene_file,options.out_file,options.logit_model,options.hexamer_dat]): + if not (file): + parser.print_help() + sys.exit(0) + #build hexamer table from hexamer frequency file + coding={} + noncoding={} + for line in open(options.hexamer_dat): + line = line.strip() + fields = line.split() + if fields[0] == 'hexamer':continue + coding[fields[0]] = float(fields[1]) + noncoding[fields[0]] = float(fields[2]) + + count=0 + TMP = open(options.out_file + '.dat', 'w') + + file_format = bed_or_fasta(options.gene_file) + if file_format == 'UNKNOWN': + print >>sys.stderr, "\nError: unknown file format of '-g'\n" + parser.print_help() + sys.exit(0) + elif file_format == 'BED': + print >>sys.stderr, "Input gene file is in BED format" + if not options.ref_genome: + print >>sys.stderr, "\nError: Reference genome file must be provided\n" + parser.print_help() + sys.exit(0) + index_fasta(options.ref_genome) + + for line in ireader.reader(options.gene_file): + count +=1 + if line.startswith('track'):continue + if line.startswith('#'):continue + if line.startswith('browser'):continue + #if not line.strip(): continue + (gene_id, mRNA_size, CDS_size, fickett_score,hexamer)=extract_feature_from_bed(line, options.ref_genome, options.start_codons, options.stop_codons,coding,noncoding) + + print >>TMP, '\t'.join([str(i) for i in [gene_id, mRNA_size, CDS_size, fickett_score,hexamer]]) + print >>sys.stderr, "%d genes finished\r" % count, + + elif file_format == 'FASTA': + if options.ref_genome: + print >>sys.stderr, "Reference genome sequence [-r] and conservation score [-c] will be ignored when input genes are fasta format." + print >>sys.stderr, "Input gene file is in FASTA format" + #fa = fasta.Fasta(options.gene_file) + for sname,seq in FrameKmer.seq_generator(options.gene_file): + count +=1 + #geneSeq = fa.getSeq(seqID = geneID) + (mRNA_size, CDS_size, fickett_score,hexamer) = extract_feature_from_seq(seq = seq, stt = options.start_codons,stp = options.stop_codons,c_tab=coding,g_tab=noncoding) + print >>TMP, '\t'.join(str(i) for i in (sname, mRNA_size, CDS_size, fickett_score,hexamer)) + print >>sys.stderr, "%d genes finished\r" % count, + TMP.close() + coding_prediction(options.logit_model, options.out_file + '.dat', options.out_file) + +if __name__ == '__main__': + main() diff --git a/code/utilities/CPAT-1.2.2/bin/make_hexamer_tab.py b/code/utilities/CPAT-1.2.2/bin/make_hexamer_tab.py new file mode 100755 index 0000000..a112c6e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/bin/make_hexamer_tab.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +'''--------------------------------------------------------------------------------------- +Make Hexamer frequency table +------------------------------------------------------------------------------------------''' + +import os,sys +import string +from optparse import OptionParser +import warnings +import string +from cpmodule.FrameKmer import kmer_freq_file +__author__ = "Liguo Wang" +__contributor__="Liguo Wang, Hyun Jung Park, Wei Li" +__copyright__ = "Copyright 2012, Mayo Clinic" +__credits__ = [] +__license__ = "GPL" +__version__="1.2.2" +__maintainer__ = "Liguo Wang" +__email__ = "wang.liguo@mayo.edu;wangliguo78@gmail.com" +__status__ = "Production" + +def main(): + usage = "\n%prog [options]" + parser = OptionParser(usage,version="%prog " + __version__) + parser.add_option("-c","--cod",action="store",dest="coding_file",help="Coding sequence (must be CDS without UTR, i.e. from start coden to stop coden) in fasta format") + parser.add_option("-n","--noncod",action="store",dest="noncoding_file",help="Noncoding sequences in fasta format") + (options,args)=parser.parse_args() + + if not options.coding_file and not options.noncoding_file: + parser.print_help() + sys.exit(0) + cod = kmer_freq_file(fastafile = options.coding_file, word_size = 6, step_size = 3, frame = 0) + noncod = kmer_freq_file(fastafile = options.noncoding_file, word_size = 6, step_size = 1, frame = 0) + + #for i,j in cod.items(): + # print str(i) + '\t' + str(j) + + cod_sum = 0.0 + cod_sum += sum(cod.values()) + noncod_sum = 0.0 + noncod_sum += sum(noncod.values()) + + print 'hexamer' + '\t' + 'coding' + '\t' + 'noncoding' + for kmer in cod: + if 'N' in kmer: + continue + print kmer + '\t' + str(float(cod[kmer]/cod_sum)) + '\t' + str(float(noncod[kmer]/noncod_sum)) + +if __name__ == '__main__': + main() diff --git a/code/utilities/CPAT-1.2.2/bin/make_logitModel.py b/code/utilities/CPAT-1.2.2/bin/make_logitModel.py new file mode 100755 index 0000000..32bb3df --- /dev/null +++ b/code/utilities/CPAT-1.2.2/bin/make_logitModel.py @@ -0,0 +1,305 @@ +#!/usr/bin/env python +'''--------------------------------------------------------------------------------------- +build logit model from training datasets +------------------------------------------------------------------------------------------''' + +#import built-in modules +import os,sys + +import os,sys +if sys.version_info[0] != 2 or sys.version_info[1] != 7: + print >>sys.stderr, "\nYou are using python" + str(sys.version_info[0]) + '.' + str(sys.version_info[1]) + " Needs python2.7!\n" + sys.exit() + + + +import string +from optparse import OptionParser +import warnings +import string +import collections +import sets +import signal +from numpy import mean,median,std,nansum +from string import maketrans +import subprocess + +#import 3rd party modules +import pysam +#from bx.bbi.bigwig_file import BigWigFile +import numpy as np + +#import my own modules +from cpmodule import fickett +from cpmodule import orf +from cpmodule import fasta +from cpmodule import annoGene +from cpmodule import FrameKmer +from cpmodule import ireader + +__author__ = "Liguo Wang" +__contributor__="Liguo Wang, Hyun Jung Park, Wei Li" +__copyright__ = "Copyright 2012, Mayo Clinic" +__credits__ = [] +__license__ = "GPL" +__version__="1.2.2" +__maintainer__ = "Liguo Wang" +__email__ = "wang.liguo@mayo.edu; wangliguo78@gmail.com" +__status__ = "Production" + + +def make_logit(infile,rscript, outfile,head): + '''make logit model''' + RCMD = open(rscript,'w') + print >>RCMD, 'data <- read.table(file=\"%s\",sep="\\t",header=T)' % (infile) + print >>RCMD, 'attach(data)' + print >>RCMD, 'mylogit <- glm(%s ~ %s + %s + %s + %s, family=binomial(link=\"logit\"), na.action=na.pass)' % ("Label","mRNA","ORF","Fickett","Hexamer") + print >>RCMD, 'save.image(\"%s\")' % (outfile) + RCMD.close() + try: + subprocess.call("Rscript " + rscript, shell=True) + except: + pass + #os.remove("") + +def sum_bwfile(inbedline,bwfile): + '''retrieve sum of conservation score for all exons from input bed line''' + line = inbedline + bw_signal = [] + try: + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr, "Incorrect bed format." + try: + for st,end in zip(exon_start,exon_end): + #print chrom +'\t'+ str(st) +'\t'+ str(end) + bw_signal.extend(bwfile.get_as_array(chrom,st,end)) + wigsum = nansum(bw_signal) + except: + wigsum = 0 + wigsum=np.nan_to_num(wigsum) + return wigsum + + +def bed_or_fasta(infile): + '''determine if the input file is bed or fasta format''' + format = "UNKNOWN" + for line in ireader.reader(infile): + #line = line.strip() + if line.startswith('#'): + continue + if line.startswith('>'): + format="FASTA" + return format + elif len(line.split())==12: + format='BED' + return format + return format + +def index_fasta(infile): + '''index fasta file using samTools''' + if os.path.isfile(infile): + pass + else: + print >>sys.stderr, "Indexing " + infile + ' ...', + pysam.faidx(infile) + print >>sys.stderr, "Done!" + +def extract_feature_from_bed(inbed,refgenome,stt,stp,c_tab,g_tab): + '''extract features of sequence from bed line''' + + stt_coden = stt.strip().split(',') + stp_coden = stp.strip().split(',') + transtab = maketrans("ACGTNX","TGCANX") + mRNA_seq = '' + mRNA_size = 0 + if inbed.strip(): + try: + fields = inbed.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + exon_num = int(fields[9]) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_starts = exon_ends[:-1] + intron_ends = exon_starts[1:] + except: + print >>sys.stderr,"Wrong format!" + inbed + return None + mRNA_size = sum(exon_sizes) + for st,end in zip(exon_starts, exon_ends): + exon_coord = chrom + ':' + str(st +1) + '-' + str(end) + tmp = pysam.faidx(refgenome,exon_coord) + mRNA_seq += ''.join([i.rstrip('\n\r') for i in tmp[1:]]) + if strand =='-': + mRNA_seq = mRNA_seq.upper().translate(transtab)[::-1] + tmp = orf.ORFFinder(mRNA_seq) + (CDS_size, CDS_frame, CDS_seq) = tmp.longest_orf(direction="+",start_coden=stt_coden, stop_coden=stp_coden) + fickett_score = fickett.fickett_value(CDS_seq) + hexamer = FrameKmer.kmer_ratio(CDS_seq,6,3,c_tab,g_tab) + #print CDS_seq + return (geneName, mRNA_size, CDS_size, fickett_score,hexamer) + +def extract_feature_from_seq(seq,stt,stp,c_tab,g_tab): + '''extract features of sequence from fasta entry''' + + stt_coden = stt.strip().split(',') + stp_coden = stp.strip().split(',') + transtab = maketrans("ACGTNX","TGCANX") + mRNA_seq = seq.upper() + mRNA_size = len(seq) + tmp = orf.ORFFinder(mRNA_seq) + (CDS_size1, CDS_frame1, CDS_seq1) = tmp.longest_orf(direction="+",start_coden=stt_coden, stop_coden=stp_coden) + fickett_score1 = fickett.fickett_value(CDS_seq1) + hexamer = FrameKmer.kmer_ratio(CDS_seq1,6,3,c_tab,g_tab) + return (mRNA_size, CDS_size1, fickett_score1,hexamer) + +def main(): + usage = "\n%prog [options]" + parser = OptionParser(usage,version="%prog " + __version__) + parser.add_option("-c","--cgene",action="store",dest="coding_file",help="Protein coding transcripts (used to build logit model) either in BED format or mRNA sequences in FASTA format: If this is BED format file, '-r' must be specified; if this is mRNA sequence file in FASTA format, ignore the '-r' option. The input BED or FASTA file could be regular text file or compressed file (*.gz, *.bz2) or accessible url. NOTE: transcript ID should be unique.") + parser.add_option("-n","--ngene",action="store",dest="noncoding_file",help="Non protein coding transcripts (used to build logit model) either in BED format or mRNA sequences in FASTA format: If this is BED format file, '-r' must be specified; if this is mRNA sequence file in FASTA format, ignore the '-r' option. The input BED or FASTA file could be regular text file or compressed file (*.gz, *.bz2) or accessible url. NOTE: transcript ID should be unique.") + parser.add_option("-o","--outfile",action="store",dest="out_file",help="output prefix.") + parser.add_option("-x","--hex",action="store",dest="hexamer_dat",help="Prebuilt hexamer frequency table (Human, Mouse, Fly, Zebrafish). Run 'make_hexamer_tab.py' to generate this table.") + parser.add_option("-r","--ref",action="store",dest="ref_genome",help="Reference genome sequences in FASTA format. Ignore this option if mRNA sequences file was provided to '-g'. Reference genome file will be indexed automatically (produce *.fai file along with the original *.fa file within the same directory) if hasn't been done.") + parser.add_option("-s","--start",action="store",dest="start_codons",default='ATG',help="Start codon (DNA sequence, so use 'T' instead of 'U') used to define open reading frame (ORF). default=%default") + parser.add_option("-t","--stop",action="store",dest="stop_codons",default='TAG,TAA,TGA',help="Stop codon (DNA sequence, so use 'T' instead of 'U') used to define open reading frame (ORF). Multiple stop codons should be separated by ','. default=%default") + + (options,args)=parser.parse_args() + + #check input and output files + for file in ([options.coding_file,options.noncoding_file,options.out_file,options.hexamer_dat]): + if not (file): + parser.print_help() + sys.exit(0) + + #data used to build logit model + train_data=[] + coding_label = 1 + noncoding_label = 0 + header = ['ID','mRNA','ORF','Fickett','Hexamer','Label'] + + #build hexamer table from hexamer frequency file + coding={} + noncoding={} + for line in open(options.hexamer_dat): + line = line.strip() + fields = line.split() + if fields[0] == 'hexamer':continue + coding[fields[0]] = float(fields[1]) + noncoding[fields[0]] = float(fields[2]) + + + TMP = open(options.out_file + '.feature.xls', 'w') + + ###################################################################################### + # process protein coding transcripts + ###################################################################################### + count=0 + print >>sys.stderr, "Process protein coding transcripts: " + options.coding_file + file_format = bed_or_fasta(options.coding_file) + if file_format == 'UNKNOWN': + print >>sys.stderr, "\nError: unknown file format of '-g'\n" + parser.print_help() + sys.exit(0) + elif file_format == 'BED': + print >>sys.stderr, "Input gene file is in BED format" + if not options.ref_genome: + print >>sys.stderr, "\nError: Reference genome file must be provided\n" + parser.print_help() + sys.exit(0) + index_fasta(options.ref_genome) + + for line in ireader.reader(options.coding_file): + count +=1 + if line.startswith('track'):continue + if line.startswith('#'):continue + if line.startswith('browser'):continue + #if not line.strip(): continue + (gene_id, mRNA_size, CDS_size, fickett_score,hexamer)=extract_feature_from_bed(line, options.ref_genome, options.start_codons, options.stop_codons,coding,noncoding) + + train_data.append([gene_id, mRNA_size, CDS_size, fickett_score,hexamer,coding_label]) + print >>sys.stderr, "%d genes finished\r" % count, + + elif file_format == 'FASTA': + if options.ref_genome: + print >>sys.stderr, "Reference genome sequence [-r] and conservation score [-c] will be ignored when input genes are fasta format." + print >>sys.stderr, "Input gene file is in FASTA format" + #fa = fasta.Fasta(options.gene_file) + for sname,seq in FrameKmer.seq_generator(options.coding_file): + count +=1 + #geneSeq = fa.getSeq(seqID = geneID) + (mRNA_size, CDS_size, fickett_score,hexamer) = extract_feature_from_seq(seq = seq, stt = options.start_codons,stp = options.stop_codons,c_tab=coding,g_tab=noncoding) + train_data.append([sname, mRNA_size, CDS_size, fickett_score,hexamer,coding_label]) + print >>sys.stderr, "%d genes finished\r" % count, + + ###################################################################################### + # process Non-protein coding transcripts + ###################################################################################### + count=0 + print >>sys.stderr, "Process non coding transcripts: " + options.noncoding_file + file_format = bed_or_fasta(options.noncoding_file) + if file_format == 'UNKNOWN': + print >>sys.stderr, "\nError: unknown file format of '-g'\n" + parser.print_help() + sys.exit(0) + elif file_format == 'BED': + print >>sys.stderr, "Input gene file is in BED format" + if not options.ref_genome: + print >>sys.stderr, "\nError: Reference genome file must be provided\n" + parser.print_help() + sys.exit(0) + index_fasta(options.ref_genome) + + for line in ireader.reader(options.noncoding_file): + count +=1 + if line.startswith('track'):continue + if line.startswith('#'):continue + if line.startswith('browser'):continue + #if not line.strip(): continue + (gene_id, mRNA_size, CDS_size, fickett_score,hexamer)=extract_feature_from_bed(line, options.ref_genome, options.start_codons, options.stop_codons,coding,noncoding) + + train_data.append([gene_id, mRNA_size, CDS_size, fickett_score,hexamer,noncoding_label]) + print >>sys.stderr, "%d genes finished\r" % count, + + elif file_format == 'FASTA': + if options.ref_genome: + print >>sys.stderr, "Reference genome sequence [-r] and conservation score [-c] will be ignored when input genes are fasta format." + print >>sys.stderr, "Input gene file is in FASTA format" + #fa = fasta.Fasta(options.gene_file) + for sname,seq in FrameKmer.seq_generator(options.noncoding_file): + count +=1 + #geneSeq = fa.getSeq(seqID = geneID) + (mRNA_size, CDS_size, fickett_score,hexamer) = extract_feature_from_seq(seq = seq, stt = options.start_codons,stp = options.stop_codons,c_tab=coding,g_tab=noncoding) + train_data.append([sname, mRNA_size, CDS_size, fickett_score,hexamer,noncoding_label]) + print >>sys.stderr, "%d genes finished\r" % count, + + ###################################################################################### + # writing data + ###################################################################################### + print >>TMP, '\t'.join(header) + for i in train_data: + print >>TMP, '\t'.join([str(j) for j in i]) + TMP.close() + + print >>sys.stderr, "build logi model ..." + make_logit(options.out_file + '.feature.xls',options.out_file + '.make_logitModel.r', options.out_file + '.logit.RData',header) + + +if __name__ == '__main__': + main() diff --git a/code/utilities/CPAT-1.2.2/dat/Fly_logitModel.RData b/code/utilities/CPAT-1.2.2/dat/Fly_logitModel.RData new file mode 100755 index 0000000..27c8533 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/dat/Fly_logitModel.RData differ diff --git a/code/utilities/CPAT-1.2.2/dat/Human_Hexamer.tsv b/code/utilities/CPAT-1.2.2/dat/Human_Hexamer.tsv new file mode 100755 index 0000000..4bc31f8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/Human_Hexamer.tsv @@ -0,0 +1,4097 @@ +hexamer coding noncoding +AAAAAA 0.000647111 0.002072893 +AAAAAC 0.000420924 0.000538157 +AAAAAG 0.000813362 0.000715402 +AAAAAT 0.000591729 0.001095402 +AAAACA 0.00049346 0.00071723 +AAAACC 0.000400381 0.000358763 +AAAACG 9.06442E-05 9.25067E-05 +AAAACT 0.00040684 0.00052149 +AAAAGA 0.000428654 0.000712875 +AAAAGC 0.000310583 0.00041253 +AAAAGG 0.000309525 0.000463018 +AAAAGT 0.000318843 0.000510709 +AAAATA 0.000363318 0.000998998 +AAAATC 0.000417429 0.000432128 +AAAATG 0.000541959 0.000788041 +AAAATT 0.000547677 0.000806376 +AAACAA 0.000453645 0.000607679 +AAACAC 0.000303912 0.000338976 +AAACAG 0.000608777 0.000446807 +AAACAT 0.000338221 0.000473502 +AAACCA 0.000454492 0.0004121 +AAACCC 0.000401016 0.000297844 +AAACCG 6.9148E-05 5.72891E-05 +AAACCT 0.000451421 0.000343815 +AAACGA 0.000140626 6.96018E-05 +AAACGC 0.000138825 6.02732E-05 +AAACGG 0.000153862 6.5865E-05 +AAACGT 0.000119977 8.7372E-05 +AAACTA 0.000228517 0.000309888 +AAACTC 0.000359082 0.000304431 +AAACTG 0.000583046 0.00045541 +AAACTT 0.000408958 0.000456243 +AAAGAA 0.001359981 0.000846137 +AAAGAC 0.000616296 0.000333169 +AAAGAG 0.000941281 0.000473153 +AAAGAT 0.000819716 0.000428741 +AAAGCA 0.000594906 0.000507671 +AAAGCC 0.000666171 0.000334299 +AAAGCG 0.000103563 7.55431E-05 +AAAGCT 0.000581351 0.000383953 +AAAGGA 0.000603589 0.000541007 +AAAGGC 0.00044189 0.000299054 +AAAGGG 0.000326256 0.000345643 +AAAGGT 0.000317467 0.000287628 +AAAGTA 0.000288134 0.000383334 +AAAGTC 0.000363742 0.000272762 +AAAGTG 0.000599141 0.000459415 +AAAGTT 0.000406522 0.000447506 +AAATAA 2.42494E-05 0.000959237 +AAATAC 0.000370836 0.000411455 +AAATAG 1.21777E-05 0.000358709 +AAATAT 0.000398792 0.000731102 +AAATCA 0.000351035 0.000448205 +AAATCC 0.000303595 0.000283246 +AAATCG 5.99353E-05 5.30146E-05 +AAATCT 0.000382379 0.000420246 +AAATGA 2.4673E-05 0.000609023 +AAATGC 0.000225657 0.000402045 +AAATGG 0.000247048 0.000450651 +AAATGT 0.000410334 0.0006904 +AAATTA 0.000288664 0.000618083 +AAATTC 0.000293535 0.00038777 +AAATTG 0.000274686 0.000432505 +AAATTT 0.000408322 0.000697497 +AACAAA 0.000557631 0.000593108 +AACAAC 0.000568432 0.000229829 +AACAAG 0.000752898 0.000298167 +AACAAT 0.000365224 0.0002915 +AACACA 0.000381743 0.000355295 +AACACC 0.000448985 0.000198563 +AACACG 0.000165722 6.41713E-05 +AACACT 0.000292582 0.000291984 +AACAGA 0.000320855 0.000406831 +AACAGC 0.000586964 0.000280934 +AACAGG 0.000257214 0.000269455 +AACAGT 0.000327209 0.000283004 +AACATA 0.000178218 0.000265127 +AACATC 0.000699951 0.00023698 +AACATG 0.000558902 0.000338224 +AACATT 0.000417959 0.000435274 +AACCAA 0.000267273 0.000300801 +AACCAC 0.000363 0.000237571 +AACCAG 0.000719012 0.00029486 +AACCAT 0.000212103 0.000235367 +AACCCA 0.000341716 0.000289806 +AACCCC 0.000460422 0.000232598 +AACCCG 0.000142743 7.29354E-05 +AACCCT 0.000330809 0.000245475 +AACCGA 0.000135225 4.5998E-05 +AACCGC 0.000251495 4.78529E-05 +AACCGG 0.000221845 4.73959E-05 +AACCGT 9.22326E-05 4.71002E-05 +AACCTA 0.000149626 0.000166813 +AACCTC 0.000523746 0.000269805 +AACCTG 0.000896806 0.000316609 +AACCTT 0.000277757 0.000266498 +AACGAA 0.000130566 5.7316E-05 +AACGAC 0.000199926 3.22335E-05 +AACGAG 0.000309101 6.13217E-05 +AACGAT 0.000111399 3.71264E-05 +AACGCA 8.89499E-05 5.33641E-05 +AACGCC 0.0002408 5.15629E-05 +AACGCG 7.93137E-05 2.6588E-05 +AACGCT 8.37612E-05 5.40093E-05 +AACGGA 0.00010081 5.46276E-05 +AACGGC 0.000212103 4.71809E-05 +AACGGG 0.000184995 5.66439E-05 +AACGGT 6.17355E-05 3.90082E-05 +AACGTA 3.83332E-05 4.2288E-05 +AACGTC 0.000181288 4.72615E-05 +AACGTG 0.00036353 8.18339E-05 +AACGTT 6.92539E-05 6.87416E-05 +AACTAA 1.30248E-05 0.000243405 +AACTAC 0.000417747 0.000162216 +AACTAG 9.63624E-06 0.000154501 +AACTAT 0.000283793 0.000220419 +AACTCA 0.000241435 0.000280316 +AACTCC 0.000366601 0.000281687 +AACTCG 0.000101869 5.11059E-05 +AACTCT 0.000266003 0.000297441 +AACTGA 2.38259E-05 0.000356047 +AACTGC 0.000351882 0.000261175 +AACTGG 0.000344893 0.000286768 +AACTGT 0.000266638 0.000337202 +AACTTA 0.000143802 0.000244803 +AACTTC 0.000552972 0.000282736 +AACTTG 0.000320643 0.000309996 +AACTTT 0.000366283 0.000456458 +AAGAAA 0.001381901 0.000933939 +AAGAAC 0.000735531 0.000321771 +AAGAAG 0.00180706 0.000545228 +AAGAAT 0.000622014 0.000461109 +AAGACA 0.000485624 0.000413579 +AAGACC 0.000597341 0.000261121 +AAGACG 0.000221845 7.62421E-05 +AAGACT 0.000394451 0.000325911 +AAGAGA 0.000475141 0.000525737 +AAGAGC 0.00054503 0.000303678 +AAGAGG 0.000535182 0.000417665 +AAGAGT 0.000349234 0.000291365 +AAGATA 0.000263249 0.000299188 +AAGATC 0.000718482 0.000217596 +AAGATG 0.000774817 0.000417477 +AAGATT 0.00048573 0.000356531 +AAGCAA 0.000423147 0.000414788 +AAGCAC 0.00045068 0.0002519 +AAGCAG 0.001078941 0.000432155 +AAGCAT 0.000324879 0.000311421 +AAGCCA 0.000556678 0.000400486 +AAGCCC 0.000635886 0.00028451 +AAGCCG 0.000204373 8.99259E-05 +AAGCCT 0.000475247 0.000330562 +AAGCGA 0.000166675 7.98983E-05 +AAGCGC 0.000306665 6.37143E-05 +AAGCGG 0.000375496 8.55707E-05 +AAGCGT 0.000124742 5.42244E-05 +AAGCTA 0.000219304 0.000208537 +AAGCTC 0.000539735 0.000247491 +AAGCTG 0.00126616 0.000414842 +AAGCTT 0.000355482 0.000307711 +AAGGAA 0.00113517 0.000623567 +AAGGAC 0.000910466 0.000276337 +AAGGAG 0.001627889 0.000445328 +AAGGAT 0.0007224 0.000282386 +AAGGCA 0.000492719 0.000357096 +AAGGCC 0.000903795 0.000270853 +AAGGCG 0.000224493 8.60009E-05 +AAGGCT 0.0005427 0.000301285 +AAGGGA 0.000342351 0.000388953 +AAGGGC 0.000578704 0.000250314 +AAGGGG 0.000366071 0.000300828 +AAGGGT 0.000256578 0.000201628 +AAGGTA 0.000170276 0.00018582 +AAGGTC 0.000425159 0.000190175 +AAGGTG 0.000875204 0.000296688 +AAGGTT 0.000306348 0.000245851 +AAGTAA 2.11786E-05 0.000333169 +AAGTAC 0.000484248 0.000170684 +AAGTAG 1.84253E-05 0.000230232 +AAGTAT 0.000337798 0.000293489 +AAGTCA 0.000369672 0.000314566 +AAGTCC 0.000409276 0.000209505 +AAGTCG 0.000114682 4.54603E-05 +AAGTCT 0.000345105 0.000278972 +AAGTGA 4.2463E-05 0.000389625 +AAGTGC 0.000328691 0.000294107 +AAGTGG 0.000349658 0.000317469 +AAGTGT 0.000301265 0.000317093 +AAGTTA 0.000210621 0.000284833 +AAGTTC 0.00052724 0.000239883 +AAGTTG 0.000302959 0.000289349 +AAGTTT 0.00047747 0.000456458 +AATAAA 0.000497378 0.001106586 +AATAAC 0.000229576 0.000235125 +AATAAG 0.000336315 0.000289591 +AATAAT 0.000327526 0.000491891 +AATACA 0.000234658 0.000373549 +AATACC 0.000178747 0.000166948 +AATACG 4.05569E-05 4.2073E-05 +AATACT 0.000201937 0.000278354 +AATAGA 0.000153545 0.000284241 +AATAGC 0.000174299 0.00017547 +AATAGG 9.33974E-05 0.000172701 +AATAGT 0.000162651 0.000219667 +AATATA 0.000180018 0.000445812 +AATATC 0.000256896 0.000227732 +AATATG 0.000262085 0.000335186 +AATATT 0.000358447 0.000614023 +AATCAA 0.000259331 0.000298113 +AATCAC 0.000165828 0.000230097 +AATCAG 0.000372848 0.000287198 +AATCAT 0.000208079 0.000301312 +AATCCA 0.000321173 0.000258433 +AATCCC 0.000209985 0.000274536 +AATCCG 4.3416E-05 4.30945E-05 +AATCCT 0.000310372 0.000271014 +AATCGA 9.22326E-05 3.82017E-05 +AATCGC 7.59251E-05 4.54872E-05 +AATCGG 8.09021E-05 3.66425E-05 +AATCGT 6.45946E-05 4.1831E-05 +AATCTA 0.000125695 0.000212032 +AATCTC 0.000227246 0.000249534 +AATCTG 0.000334092 0.000307092 +AATCTT 0.000276698 0.000331261 +AATGAA 0.001003334 0.000563589 +AATGAC 0.000571715 0.000249507 +AATGAG 0.00080002 0.000330857 +AATGAT 0.000601471 0.000331906 +AATGCA 0.000437549 0.000342632 +AATGCC 0.000555937 0.000234506 +AATGCG 8.28081E-05 3.67231E-05 +AATGCT 0.000445173 0.000327336 +AATGGA 0.000594376 0.000373441 +AATGGC 0.000496531 0.000239829 +AATGGG 0.000420924 0.00026182 +AATGGT 0.000317255 0.000247169 +AATGTA 0.000230423 0.000399223 +AATGTC 0.000374437 0.000262734 +AATGTG 0.00057108 0.000417557 +AATGTT 0.000345846 0.000498343 +AATTAA 1.35543E-05 0.000460491 +AATTAC 0.000208079 0.000232409 +AATTAG 6.77714E-06 0.000267923 +AATTAT 0.000241435 0.000447506 +AATTCA 0.000279557 0.00037043 +AATTCC 0.000230423 0.000263675 +AATTCG 2.84852E-05 3.70995E-05 +AATTCT 0.000318314 0.000415595 +AATTGA 7.94196E-06 0.000294887 +AATTGC 0.00010081 0.000221979 +AATTGG 0.000108646 0.000231952 +AATTGT 0.000125906 0.000359085 +AATTTA 0.000209562 0.000495923 +AATTTC 0.000234764 0.000388147 +AATTTG 0.000257531 0.000423525 +AATTTT 0.000328373 0.000844416 +ACAAAA 0.000346163 0.000617518 +ACAAAC 0.000198337 0.000273649 +ACAAAG 0.000329221 0.000355832 +ACAAAT 0.000295547 0.000383872 +ACAACA 0.000254566 0.000266014 +ACAACC 0.000177582 0.000163076 +ACAACG 5.08285E-05 4.30945E-05 +ACAACT 0.000221104 0.000219613 +ACAAGA 0.000196537 0.000315104 +ACAAGC 0.000173664 0.000200149 +ACAAGG 0.000148568 0.000240367 +ACAAGT 0.000189548 0.000220769 +ACAATA 0.000133531 0.000239991 +ACAATC 0.000138296 0.000152484 +ACAATG 0.000220786 0.000248244 +ACAATT 0.000206914 0.000266498 +ACACAA 0.000190713 0.000292037 +ACACAC 0.000192301 0.000484578 +ACACAG 0.000381426 0.000397179 +ACACAT 0.000170805 0.000303329 +ACACCA 0.000321808 0.000264643 +ACACCC 0.000264308 0.00022335 +ACACCG 7.33837E-05 6.39563E-05 +ACACCT 0.0002965 0.000272654 +ACACGA 5.64408E-05 5.16973E-05 +ACACGC 6.88303E-05 7.03546E-05 +ACACGG 9.50917E-05 7.62152E-05 +ACACGT 4.59575E-05 7.29354E-05 +ACACTA 0.000102398 0.000155495 +ACACTC 0.000182453 0.000200337 +ACACTG 0.000406946 0.000338412 +ACACTT 0.000176311 0.000280047 +ACAGAA 0.00070874 0.000496999 +ACAGAC 0.000509874 0.000268649 +ACAGAG 0.000736908 0.000470034 +ACAGAT 0.000555196 0.000311098 +ACAGCA 0.000441255 0.000375538 +ACAGCC 0.000536453 0.000340079 +ACAGCG 0.00010621 9.16733E-05 +ACAGCT 0.000443267 0.000339622 +ACAGGA 0.000424206 0.000350456 +ACAGGC 0.000357918 0.000329271 +ACAGGG 0.000304442 0.000311259 +ACAGGT 0.000231376 0.000241684 +ACAGTA 0.000183406 0.000229022 +ACAGTC 0.000252448 0.000207811 +ACAGTG 0.00053137 0.000365215 +ACAGTT 0.000259967 0.000309915 +ACATAA 6.24767E-06 0.000260019 +ACATAC 0.000142638 0.000175954 +ACATAG 8.68321E-06 0.000182271 +ACATAT 0.000152274 0.000279536 +ACATCA 0.000237306 0.000262277 +ACATCC 0.00022481 0.000212193 +ACATCG 4.97696E-05 4.64819E-05 +ACATCT 0.000261449 0.000294134 +ACATGA 9.63624E-06 0.000276902 +ACATGC 0.000108646 0.000216172 +ACATGG 0.000144332 0.000296177 +ACATGT 0.000135649 0.000297549 +ACATTA 0.000147191 0.000257599 +ACATTC 0.000183406 0.0002676 +ACATTG 0.000159792 0.000269778 +ACATTT 0.000293535 0.000619239 +ACCAAA 0.000481812 0.000332712 +ACCAAC 0.000561761 0.000173453 +ACCAAG 0.000864085 0.000276633 +ACCAAT 0.000332397 0.000175712 +ACCACA 0.000396357 0.000311179 +ACCACC 0.000629109 0.000278219 +ACCACG 0.000199396 9.38509E-05 +ACCACT 0.000320749 0.000249749 +ACCAGA 0.000217186 0.000294054 +ACCAGC 0.000595329 0.000341745 +ACCAGG 0.00027278 0.000304135 +ACCAGT 0.000309313 0.000209316 +ACCATA 0.000143802 0.000158587 +ACCATC 0.00078403 0.00021386 +ACCATG 0.00056875 0.00028908 +ACCATT 0.000385238 0.000249427 +ACCCAA 0.000193784 0.000223323 +ACCCAC 0.000333245 0.000267251 +ACCCAG 0.000702598 0.000447694 +ACCCAT 0.000178641 0.000196197 +ACCCCA 0.000389262 0.000360725 +ACCCCC 0.000320432 0.000265584 +ACCCCG 0.000165934 0.00013251 +ACCCCT 0.000318843 0.000282198 +ACCCGA 9.7739E-05 5.58912E-05 +ACCCGC 0.00019929 0.000100679 +ACCCGG 0.00021888 0.000125977 +ACCCGT 6.99951E-05 5.21006E-05 +ACCCTA 0.000111717 0.000135225 +ACCCTC 0.000408852 0.000270934 +ACCCTG 0.000840789 0.000374275 +ACCCTT 0.000212633 0.000235259 +ACCGAA 0.000105893 4.82562E-05 +ACCGAC 0.000196431 3.87125E-05 +ACCGAG 0.000316302 8.11081E-05 +ACCGAT 9.33974E-05 2.86042E-05 +ACCGCA 7.52898E-05 6.72092E-05 +ACCGCC 0.000206703 9.55715E-05 +ACCGCG 7.29601E-05 6.05958E-05 +ACCGCT 7.22189E-05 6.11066E-05 +ACCGGA 7.61369E-05 6.09184E-05 +ACCGGC 0.000176523 7.01664E-05 +ACCGGG 0.000145497 7.96295E-05 +ACCGGT 4.82871E-05 3.3282E-05 +ACCGTA 3.8545E-05 3.1669E-05 +ACCGTC 0.000171017 5.46008E-05 +ACCGTG 0.000343622 9.57597E-05 +ACCGTT 6.42769E-05 4.5756E-05 +ACCTAA 8.7891E-06 0.000178131 +ACCTAC 0.000466669 0.000133531 +ACCTAG 8.36553E-06 0.000148317 +ACCTAT 0.000233811 0.000142215 +ACCTCA 0.000274474 0.000335589 +ACCTCC 0.000399851 0.000362957 +ACCTCG 0.000136602 9.33401E-05 +ACCTCT 0.000284216 0.000330293 +ACCTGA 1.75782E-05 0.000294538 +ACCTGC 0.000405993 0.000339218 +ACCTGG 0.000323714 0.000396507 +ACCTGT 0.000253295 0.000317953 +ACCTTA 0.000123577 0.0001759 +ACCTTC 0.000650393 0.000263702 +ACCTTG 0.000306348 0.000284483 +ACCTTT 0.000326467 0.000328787 +ACGAAA 7.12658E-05 5.71547E-05 +ACGAAC 4.37337E-05 3.26368E-05 +ACGAAG 9.68919E-05 6.21819E-05 +ACGAAT 4.08746E-05 4.0218E-05 +ACGACA 5.87705E-05 4.05675E-05 +ACGACC 7.07364E-05 3.63736E-05 +ACGACG 3.32503E-05 1.97595E-05 +ACGACT 4.60634E-05 3.91158E-05 +ACGAGA 4.36278E-05 5.97624E-05 +ACGAGC 5.95117E-05 4.75303E-05 +ACGAGG 5.53819E-05 8.42266E-05 +ACGAGT 4.01334E-05 3.93846E-05 +ACGATA 2.31905E-05 2.39534E-05 +ACGATC 6.0253E-05 3.24217E-05 +ACGATG 8.53496E-05 5.06757E-05 +ACGATT 5.17816E-05 3.86587E-05 +ACGCAA 3.75919E-05 3.89813E-05 +ACGCAC 9.54094E-05 6.09991E-05 +ACGCAG 0.000193572 9.00334E-05 +ACGCAT 3.86509E-05 4.23149E-05 +ACGCCA 9.7739E-05 7.35537E-05 +ACGCCC 0.000193678 9.65124E-05 +ACGCCG 8.40789E-05 5.55417E-05 +ACGCCT 9.53035E-05 9.78566E-05 +ACGCGA 2.12844E-05 2.15338E-05 +ACGCGC 7.32778E-05 5.20737E-05 +ACGCGG 9.12796E-05 5.32835E-05 +ACGCGT 1.69428E-05 2.29587E-05 +ACGCTA 4.25689E-05 2.69374E-05 +ACGCTC 0.000133954 5.45739E-05 +ACGCTG 0.000420924 0.000103879 +ACGCTT 5.92999E-05 5.09177E-05 +ACGGAA 0.00013046 6.79082E-05 +ACGGAC 0.000175676 4.95466E-05 +ACGGAG 0.000332821 0.000105169 +ACGGAT 0.000113729 4.08094E-05 +ACGGCA 0.000108434 6.2854E-05 +ACGGCC 0.000273203 8.03553E-05 +ACGGCG 9.2868E-05 5.16704E-05 +ACGGCT 0.000106634 6.65102E-05 +ACGGGA 8.83146E-05 7.34193E-05 +ACGGGC 0.00020162 7.09998E-05 +ACGGGG 0.000143908 0.000103126 +ACGGGT 6.50182E-05 4.35247E-05 +ACGGTA 3.8545E-05 2.64535E-05 +ACGGTC 0.000112035 3.87394E-05 +ACGGTG 0.000300418 8.67536E-05 +ACGGTT 5.96176E-05 4.38473E-05 +ACGTAA 2.64732E-06 4.21805E-05 +ACGTAC 8.01608E-05 2.91688E-05 +ACGTAG 3.07089E-06 4.03255E-05 +ACGTAT 5.12521E-05 4.46E-05 +ACGTCA 6.25826E-05 5.73698E-05 +ACGTCC 0.000105893 5.77193E-05 +ACGTCG 5.06167E-05 2.16951E-05 +ACGTCT 7.03128E-05 6.55155E-05 +ACGTGA 4.4475E-06 8.07586E-05 +ACGTGC 8.52437E-05 7.79896E-05 +ACGTGG 9.99628E-05 0.000116406 +ACGTGT 6.42769E-05 8.74526E-05 +ACGTTA 3.16619E-05 4.10514E-05 +ACGTTC 8.60908E-05 5.1079E-05 +ACGTTG 6.59712E-05 6.05152E-05 +ACGTTT 8.87381E-05 9.31251E-05 +ACTAAA 0.000229152 0.000316717 +ACTAAC 0.000109493 0.000119821 +ACTAAG 0.000158627 0.000158883 +ACTAAT 0.000143908 0.000187836 +ACTACA 0.000178112 0.000218806 +ACTACC 0.000125271 0.000119713 +ACTACG 3.53682E-05 2.9572E-05 +ACTACT 0.000144014 0.000168937 +ACTAGA 8.8844E-05 0.000165872 +ACTAGC 8.4926E-05 9.71038E-05 +ACTAGG 5.22051E-05 0.000124687 +ACTAGT 9.63624E-05 0.000113664 +ACTATA 8.81028E-05 0.000164663 +ACTATC 0.0001204 0.000105922 +ACTATG 0.000140414 0.00016977 +ACTATT 0.000181712 0.000236039 +ACTCAA 0.000192089 0.000228027 +ACTCAC 0.000190819 0.000205176 +ACTCAG 0.000379096 0.00032669 +ACTCAT 0.000187854 0.000215526 +ACTCCA 0.000330597 0.000341692 +ACTCCC 0.000219939 0.000250502 +ACTCCG 7.03128E-05 8.23985E-05 +ACTCCT 0.000304971 0.000332363 +ACTCGA 9.32915E-05 3.89276E-05 +ACTCGC 8.09021E-05 5.91172E-05 +ACTCGG 0.000109175 8.82322E-05 +ACTCGT 5.83469E-05 4.47076E-05 +ACTCTA 0.00012273 0.000164017 +ACTCTC 0.000195372 0.000217408 +ACTCTG 0.000408005 0.000373387 +ACTCTT 0.000194207 0.000299968 +ACTGAA 0.000540159 0.00041374 +ACTGAC 0.000344151 0.000212489 +ACTGAG 0.000568326 0.000347848 +ACTGAT 0.000401439 0.000245797 +ACTGCA 0.000352411 0.00042444 +ACTGCC 0.000392968 0.000288865 +ACTGCG 8.12197E-05 7.93875E-05 +ACTGCT 0.000362894 0.000319405 +ACTGGA 0.000557102 0.000342794 +ACTGGC 0.000333033 0.000242356 +ACTGGG 0.000310372 0.000326717 +ACTGGT 0.000240059 0.000211548 +ACTGTA 0.000191348 0.000291043 +ACTGTC 0.000308889 0.000239614 +ACTGTG 0.000583363 0.000405003 +ACTGTT 0.00028824 0.000332524 +ACTTAA 6.67124E-06 0.000288838 +ACTTAC 0.000174511 0.000158291 +ACTTAG 3.49446E-06 0.00017547 +ACTTAT 0.000126118 0.00019703 +ACTTCA 0.000245565 0.000323706 +ACTTCC 0.00020935 0.000308436 +ACTTCG 4.97696E-05 5.21543E-05 +ACTTCT 0.000266956 0.000361559 +ACTTGA 6.24767E-06 0.000313168 +ACTTGC 0.000107163 0.000215715 +ACTTGG 0.00012633 0.000300318 +ACTTGT 0.000135437 0.000264804 +ACTTTA 0.00016011 0.000335159 +ACTTTC 0.000238576 0.000307065 +ACTTTG 0.00025319 0.000438392 +ACTTTT 0.000257319 0.000579316 +AGAAAA 0.000467517 0.000933912 +AGAAAC 0.00026452 0.000449791 +AGAAAG 0.000399639 0.00059257 +AGAAAT 0.00037486 0.000630637 +AGAACA 0.000221422 0.000384437 +AGAACC 0.000148462 0.000257465 +AGAACG 4.65928E-05 6.64565E-05 +AGAACT 0.000208503 0.000349138 +AGAAGA 0.000317572 0.000618298 +AGAAGC 0.000218774 0.000402395 +AGAAGG 0.000184359 0.000459281 +AGAAGT 0.00021761 0.000375807 +AGAATA 0.000163075 0.000350563 +AGAATC 0.000181077 0.000290075 +AGAATG 0.000218033 0.000405621 +AGAATT 0.000320643 0.000447559 +AGACAA 0.000204055 0.00031712 +AGACAC 0.000156615 0.000288811 +AGACAG 0.000282628 0.000427477 +AGACAT 0.000174935 0.000294618 +AGACCA 0.000187113 0.000330266 +AGACCC 0.000176629 0.000281822 +AGACCG 3.64271E-05 6.53811E-05 +AGACCT 0.00019749 0.000280854 +AGACGA 7.73017E-05 5.91172E-05 +AGACGC 6.6183E-05 8.19683E-05 +AGACGG 7.42308E-05 0.000117966 +AGACGT 4.94519E-05 6.91179E-05 +AGACTA 8.6938E-05 0.000166894 +AGACTC 0.000151533 0.000261713 +AGACTG 0.000231482 0.000347714 +AGACTT 0.000169534 0.000322443 +AGAGAA 0.000565679 0.000631632 +AGAGAC 0.000322655 0.000371721 +AGAGAG 0.000490072 0.000554315 +AGAGAT 0.000404722 0.000365941 +AGAGCA 0.000262826 0.000394787 +AGAGCC 0.000287287 0.00036543 +AGAGCG 4.64869E-05 0.00011275 +AGAGCT 0.000267591 0.000380485 +AGAGGA 0.000309101 0.000527485 +AGAGGC 0.000227775 0.000418149 +AGAGGG 0.00016551 0.000405728 +AGAGGT 0.000161486 0.000294161 +AGAGTA 0.000121247 0.000203214 +AGAGTC 0.000157674 0.000232141 +AGAGTG 0.000232858 0.00032618 +AGAGTT 0.000193043 0.000307845 +AGATAA 9.95392E-06 0.000304619 +AGATAC 0.000168793 0.000181734 +AGATAG 4.87107E-06 0.000171518 +AGATAT 0.000139461 0.000257922 +AGATCA 0.00013999 0.000262492 +AGATCC 0.000111082 0.000183911 +AGATCG 2.52025E-05 6.08378E-05 +AGATCT 0.000150685 0.000242141 +AGATGA 1.26012E-05 0.000382716 +AGATGC 8.87381E-05 0.000267116 +AGATGG 0.00011034 0.000392367 +AGATGT 0.000114576 0.000331099 +AGATTA 0.000113517 0.000234022 +AGATTC 0.000120188 0.000240582 +AGATTG 0.000121035 0.000253836 +AGATTT 0.000200773 0.000464711 +AGCAAA 0.000502991 0.000422692 +AGCAAC 0.00048986 0.000218403 +AGCAAG 0.000688091 0.00034188 +AGCAAT 0.000326467 0.000262331 +AGCACA 0.000372637 0.000321878 +AGCACC 0.000547995 0.000263648 +AGCACG 0.000146556 7.33387E-05 +AGCACT 0.000285381 0.000328384 +AGCAGA 0.000264626 0.000446726 +AGCAGC 0.000949964 0.00047568 +AGCAGG 0.00028591 0.000431214 +AGCAGT 0.00044655 0.000330938 +AGCATA 0.000124636 0.000179906 +AGCATC 0.000583681 0.000247088 +AGCATG 0.000446126 0.000277332 +AGCATT 0.000320008 0.000339783 +AGCCAA 0.000259967 0.000324137 +AGCCAC 0.000404193 0.000390459 +AGCCAG 0.000836659 0.000522861 +AGCCAT 0.000219304 0.000303248 +AGCCCA 0.000357812 0.000401239 +AGCCCC 0.000633239 0.000435946 +AGCCCG 0.000192407 0.000156866 +AGCCCT 0.000417641 0.000396023 +AGCCGA 0.000145708 0.000105949 +AGCCGC 0.000362683 0.0001652 +AGCCGG 0.0003001 0.000187191 +AGCCGT 0.000114364 7.62421E-05 +AGCCTA 0.000115847 0.000171599 +AGCCTC 0.000553607 0.000502214 +AGCCTG 0.000931009 0.000572972 +AGCCTT 0.000264944 0.000351155 +AGCGAA 0.000107587 5.57568E-05 +AGCGAC 0.000272462 5.72891E-05 +AGCGAG 0.000387568 0.000125816 +AGCGAT 0.000131307 6.22357E-05 +AGCGCA 8.1961E-05 7.8124E-05 +AGCGCC 0.000300206 0.000132483 +AGCGCG 9.46681E-05 8.68074E-05 +AGCGCT 9.29738E-05 8.54094E-05 +AGCGGA 8.31258E-05 9.05711E-05 +AGCGGC 0.000302959 0.000159743 +AGCGGG 0.000196219 0.000137618 +AGCGGT 7.35955E-05 6.44939E-05 +AGCGTA 2.74262E-05 2.82547E-05 +AGCGTC 0.000172923 6.89835E-05 +AGCGTG 0.00029057 9.52489E-05 +AGCGTT 5.69703E-05 6.04883E-05 +AGCTAA 1.23895E-05 0.000222812 +AGCTAC 0.000366707 0.0002123 +AGCTAG 9.63624E-06 0.000164824 +AGCTAT 0.000200879 0.00019281 +AGCTCA 0.000278392 0.000320588 +AGCTCC 0.000526816 0.000360107 +AGCTCG 0.00012813 7.49786E-05 +AGCTCT 0.000335362 0.000376264 +AGCTGA 2.8591E-05 0.000399034 +AGCTGC 0.000401439 0.000444737 +AGCTGG 0.000311113 0.000548239 +AGCTGT 0.000248954 0.000394061 +AGCTTA 0.000104516 0.000181572 +AGCTTC 0.000531582 0.000327201 +AGCTTG 0.000239424 0.000273703 +AGCTTT 0.000315666 0.000405621 +AGGAAA 0.000492825 0.000683867 +AGGAAC 0.000312913 0.000286526 +AGGAAG 0.000656747 0.00063838 +AGGAAT 0.000248107 0.000362419 +AGGACA 0.00021168 0.000360403 +AGGACC 0.000246518 0.000259777 +AGGACG 8.47142E-05 0.000100518 +AGGACT 0.000186583 0.000303624 +AGGAGA 0.000242389 0.000550228 +AGGAGC 0.000269179 0.000403013 +AGGAGG 0.000259331 0.000620368 +AGGAGT 0.000143802 0.000324862 +AGGATA 0.000105575 0.000196197 +AGGATC 0.00021761 0.000199369 +AGGATG 0.000272886 0.000342175 +AGGATT 0.000186583 0.000298355 +AGGCAA 0.000159369 0.000277466 +AGGCAC 0.000188383 0.000272762 +AGGCAG 0.000431513 0.000585446 +AGGCAT 0.000131201 0.000278004 +AGGCCA 0.000202785 0.000394276 +AGGCCC 0.000272674 0.000371882 +AGGCCG 8.50319E-05 0.000173884 +AGGCCT 0.000239424 0.000369919 +AGGCGA 7.75135E-05 8.00058E-05 +AGGCGC 0.000117329 0.000138075 +AGGCGG 0.000151744 0.000216091 +AGGCGT 5.15698E-05 0.000101136 +AGGCTA 8.42906E-05 0.000162727 +AGGCTC 0.000206597 0.000295828 +AGGCTG 0.000472176 0.000684136 +AGGCTT 0.000151638 0.000304995 +AGGGAA 0.00032795 0.000454119 +AGGGAC 0.000323502 0.000278542 +AGGGAG 0.000477259 0.000517753 +AGGGAT 0.000223751 0.000242249 +AGGGCA 0.000173982 0.000345939 +AGGGCC 0.000298088 0.000329594 +AGGGCG 6.89362E-05 0.000126918 +AGGGCT 0.000177582 0.00034188 +AGGGGA 0.000127389 0.000391265 +AGGGGC 0.000232223 0.00035188 +AGGGGG 9.29738E-05 0.000288946 +AGGGGT 0.000105152 0.000230393 +AGGGTA 6.65007E-05 0.000146167 +AGGGTC 0.000162757 0.00021558 +AGGGTG 0.000203314 0.000303302 +AGGGTT 9.03265E-05 0.000228162 +AGGTAA 5.08285E-06 0.000191654 +AGGTAC 0.000128342 0.000119686 +AGGTAG 5.8241E-06 0.000176007 +AGGTAT 0.00010314 0.000162055 +AGGTCA 0.000118176 0.000266821 +AGGTCC 0.00013586 0.000187137 +AGGTCG 3.99216E-05 5.53535E-05 +AGGTCT 0.000123471 0.000235851 +AGGTGA 1.05893E-05 0.000309216 +AGGTGC 9.73154E-05 0.000253164 +AGGTGG 0.000119977 0.000418794 +AGGTGT 9.35033E-05 0.000269563 +AGGTTA 7.6984E-05 0.00016348 +AGGTTC 0.000160428 0.000193804 +AGGTTG 0.00010261 0.000248244 +AGGTTT 0.000173241 0.000327416 +AGTAAA 0.000287605 0.000352418 +AGTAAC 0.000182136 0.000167835 +AGTAAG 0.000177476 0.000186976 +AGTAAT 0.000193996 0.000244749 +AGTACA 0.000149732 0.000186976 +AGTACC 0.000131307 0.000118449 +AGTACG 2.63673E-05 2.47868E-05 +AGTACT 0.00013586 0.000164985 +AGTAGA 9.41387E-05 0.000239345 +AGTAGC 0.000146026 0.000209693 +AGTAGG 6.25826E-05 0.000163587 +AGTAGT 0.000144332 0.00016305 +AGTATA 8.6938E-05 0.000209988 +AGTATC 0.000126965 0.000140575 +AGTATG 0.000131731 0.000181438 +AGTATT 0.000178218 0.000330589 +AGTCAA 0.000187113 0.000212032 +AGTCAC 0.000149944 0.000232813 +AGTCAG 0.000308042 0.000275853 +AGTCAT 0.000159792 0.000245717 +AGTCCA 0.000195478 0.000224344 +AGTCCC 0.000210091 0.000264509 +AGTCCG 4.12982E-05 5.39287E-05 +AGTCCT 0.000274368 0.000275128 +AGTCGA 7.15835E-05 3.45724E-05 +AGTCGC 8.1008E-05 4.93316E-05 +AGTCGG 8.55614E-05 6.95481E-05 +AGTCGT 6.26885E-05 4.10783E-05 +AGTCTA 7.94196E-05 0.000144795 +AGTCTC 0.000166569 0.000276875 +AGTCTG 0.000245459 0.000293193 +AGTCTT 0.000173982 0.000302065 +AGTGAA 0.000643087 0.000376049 +AGTGAC 0.000554666 0.000254588 +AGTGAG 0.00062032 0.000393093 +AGTGAT 0.000513898 0.000293543 +AGTGCA 0.000271509 0.000293758 +AGTGCC 0.000458516 0.000267062 +AGTGCG 7.4019E-05 6.32573E-05 +AGTGCT 0.00032975 0.000342471 +AGTGGA 0.000388203 0.000324378 +AGTGGC 0.000439561 0.000322174 +AGTGGG 0.000344151 0.000321529 +AGTGGT 0.000272356 0.000257573 +AGTGTA 0.000130883 0.00020601 +AGTGTC 0.000249272 0.000229775 +AGTGTG 0.00040504 0.000332309 +AGTGTT 0.0002372 0.000344326 +AGTTAA 8.25964E-06 0.000275531 +AGTTAC 0.000146767 0.000173749 +AGTTAG 3.91803E-06 0.000157296 +AGTTAT 0.000143591 0.000249158 +AGTTCA 0.000210197 0.000285989 +AGTTCC 0.000202679 0.000235044 +AGTTCG 3.44151E-05 4.97348E-05 +AGTTCT 0.000259014 0.000335293 +AGTTGA 6.67124E-06 0.000244641 +AGTTGC 6.53358E-05 0.000196439 +AGTTGG 9.10678E-05 0.000245045 +AGTTGT 0.00010314 0.000266337 +AGTTTA 0.000149732 0.000312738 +AGTTTC 0.000193148 0.000345993 +AGTTTG 0.000200031 0.000364946 +AGTTTT 0.000230529 0.000564046 +ATAAAA 0.000320114 0.00082963 +ATAAAC 0.000135225 0.000319728 +ATAAAG 0.000258167 0.000440758 +ATAAAT 0.000223857 0.000644509 +ATAACA 0.000147403 0.000241496 +ATAACC 9.65742E-05 0.000137376 +ATAACG 2.61555E-05 3.19109E-05 +ATAACT 0.000139249 0.000233619 +ATAAGA 0.000119977 0.000257841 +ATAAGC 8.37612E-05 0.00016227 +ATAAGG 7.43367E-05 0.000176303 +ATAAGT 0.000102187 0.000196493 +ATAATA 9.5833E-05 0.000375699 +ATAATC 0.000101233 0.00019125 +ATAATG 0.000163922 0.000297011 +ATAATT 0.000176629 0.000439064 +ATACAA 0.000128766 0.000292817 +ATACAC 7.5078E-05 0.000174287 +ATACAG 0.000206173 0.000242787 +ATACAT 0.00011267 0.000297791 +ATACCA 0.000131413 0.000181277 +ATACCC 8.60908E-05 0.000115385 +ATACCG 1.8743E-05 2.48674E-05 +ATACCT 0.000132048 0.000193132 +ATACGA 3.90744E-05 3.09162E-05 +ATACGC 2.38259E-05 2.29855E-05 +ATACGG 4.27807E-05 2.9814E-05 +ATACGT 2.41435E-05 4.35247E-05 +ATACTA 5.48525E-05 0.000164851 +ATACTC 5.85587E-05 0.000131864 +ATACTG 0.000132154 0.000237571 +ATACTT 0.000102187 0.000276122 +ATAGAA 0.000398686 0.000320749 +ATAGAC 0.000186477 0.000126004 +ATAGAG 0.000251284 0.000195337 +ATAGAT 0.000255519 0.000207488 +ATAGCA 0.00018976 0.00020316 +ATAGCC 0.000155556 0.000125574 +ATAGCG 2.61555E-05 2.54588E-05 +ATAGCT 0.000166252 0.000186008 +ATAGGA 0.000144861 0.000194127 +ATAGGC 9.06442E-05 0.000112078 +ATAGGG 7.76194E-05 0.000117455 +ATAGGT 7.59251E-05 0.000130574 +ATAGTA 9.19149E-05 0.000176411 +ATAGTC 7.68781E-05 0.000111944 +ATAGTG 0.000156192 0.000167727 +ATAGTT 0.000119447 0.000226119 +ATATAA 6.56535E-06 0.000384921 +ATATAC 7.03128E-05 0.000211628 +ATATAG 2.965E-06 0.000195928 +ATATAT 0.000124636 0.00059999 +ATATCA 0.000119871 0.00022671 +ATATCC 9.45622E-05 0.000151113 +ATATCG 1.78959E-05 2.45179E-05 +ATATCT 0.000126436 0.000246093 +ATATGA 7.83606E-06 0.000262573 +ATATGC 6.20532E-05 0.000184987 +ATATGG 8.30199E-05 0.000190417 +ATATGT 0.000106105 0.000350025 +ATATTA 0.000107058 0.000351343 +ATATTC 0.000124106 0.000273972 +ATATTG 9.48799E-05 0.000290639 +ATATTT 0.000244295 0.000808634 +ATCAAA 0.00048393 0.000314647 +ATCAAC 0.000584846 0.000148263 +ATCAAG 0.00076857 0.000225635 +ATCAAT 0.000378884 0.000201063 +ATCACA 0.000389685 0.000272493 +ATCACC 0.000614707 0.000207085 +ATCACG 0.000172499 6.22895E-05 +ATCACT 0.000352941 0.000264293 +ATCAGA 0.000231587 0.000294403 +ATCAGC 0.000525546 0.000217059 +ATCAGG 0.000213268 0.00020937 +ATCAGT 0.000301477 0.000233243 +ATCATA 0.000156298 0.000198536 +ATCATC 0.00076624 0.000199154 +ATCATG 0.000570233 0.000245448 +ATCATT 0.000411817 0.000322389 +ATCCAA 0.000230634 0.000208295 +ATCCAC 0.000436172 0.000195122 +ATCCAG 0.000905383 0.000292736 +ATCCAT 0.000257743 0.000231307 +ATCCCA 0.000325408 0.000348197 +ATCCCC 0.000430984 0.000207273 +ATCCCG 0.000136813 6.57037E-05 +ATCCCT 0.000325091 0.000257223 +ATCCGA 0.000183618 3.54327E-05 +ATCCGC 0.000331974 5.13747E-05 +ATCCGG 0.000311748 4.95197E-05 +ATCCGT 0.000118494 4.30139E-05 +ATCCTA 0.000154815 0.000164555 +ATCCTC 0.000515592 0.000250663 +ATCCTG 0.001014559 0.000331987 +ATCCTT 0.000261343 0.000280719 +ATCGAA 0.000129825 3.5352E-05 +ATCGAC 0.00028231 2.32275E-05 +ATCGAG 0.000379308 4.57291E-05 +ATCGAT 0.000144014 3.15346E-05 +ATCGCA 0.00010314 4.09976E-05 +ATCGCC 0.000327738 4.98961E-05 +ATCGCG 8.41847E-05 2.57277E-05 +ATCGCT 0.000117753 6.51123E-05 +ATCGGA 7.82548E-05 3.80135E-05 +ATCGGC 0.000202361 3.79329E-05 +ATCGGG 0.000155662 4.31214E-05 +ATCGGT 5.97235E-05 2.70719E-05 +ATCGTA 4.61692E-05 2.83892E-05 +ATCGTC 0.00021295 3.71801E-05 +ATCGTG 0.000384603 5.79343E-05 +ATCGTT 7.42308E-05 4.25569E-05 +ATCTAA 9.95392E-06 0.000196412 +ATCTAC 0.000451844 0.000141596 +ATCTAG 9.84803E-06 0.000147591 +ATCTAT 0.000278922 0.000204074 +ATCTCA 0.000236988 0.00032091 +ATCTCC 0.000491025 0.000256632 +ATCTCG 9.74213E-05 7.27472E-05 +ATCTCT 0.000298618 0.000357015 +ATCTGA 1.8743E-05 0.000297737 +ATCTGC 0.000401016 0.000271256 +ATCTGG 0.000308677 0.000276472 +ATCTGT 0.000279663 0.000353682 +ATCTTA 0.00014645 0.000235286 +ATCTTC 0.000623391 0.000285747 +ATCTTG 0.00029004 0.000296742 +ATCTTT 0.000361836 0.000431994 +ATGAAA 0.00058654 0.0005541 +ATGAAC 0.000458092 0.000228834 +ATGAAG 0.000847777 0.000391695 +ATGAAT 0.000436914 0.000381668 +ATGACA 0.000318843 0.000271633 +ATGACC 0.000381002 0.000175819 +ATGACG 0.000111293 4.41968E-05 +ATGACT 0.000294382 0.000256847 +ATGAGA 0.000269603 0.000333707 +ATGAGC 0.000331338 0.000210177 +ATGAGG 0.000280086 0.000284537 +ATGAGT 0.000240377 0.000224936 +ATGATA 0.000144014 0.000226361 +ATGATC 0.000369778 0.000179583 +ATGATG 0.000524699 0.000293758 +ATGATT 0.000321702 0.000319808 +ATGCAA 0.000250754 0.000269697 +ATGCAC 0.000263567 0.000191089 +ATGCAG 0.000657382 0.000309135 +ATGCAT 0.000208397 0.000275988 +ATGCCA 0.00032202 0.000287171 +ATGCCC 0.00035707 0.000216521 +ATGCCG 0.000109281 5.19662E-05 +ATGCCT 0.000330385 0.000319862 +ATGCGA 8.00549E-05 3.33895E-05 +ATGCGC 0.000150474 4.41699E-05 +ATGCGG 0.000203844 4.86057E-05 +ATGCGT 7.25365E-05 4.25569E-05 +ATGCTA 0.000145603 0.000185551 +ATGCTC 0.000299782 0.000190094 +ATGCTG 0.000857414 0.000370376 +ATGCTT 0.000246518 0.000309861 +ATGGAA 0.000771005 0.000427504 +ATGGAC 0.000632074 0.000193804 +ATGGAG 0.001106791 0.000357042 +ATGGAT 0.000603377 0.000258218 +ATGGCA 0.000487848 0.000287897 +ATGGCC 0.000696774 0.00021058 +ATGGCG 0.000296182 7.33387E-05 +ATGGCT 0.000546407 0.000278327 +ATGGGA 0.000343516 0.000310211 +ATGGGC 0.000454492 0.000185067 +ATGGGG 0.000320643 0.000289134 +ATGGGT 0.000226505 0.000177782 +ATGGTA 0.000157886 0.000191062 +ATGGTC 0.000277651 0.000155468 +ATGGTG 0.000652405 0.000317254 +ATGGTT 0.000243236 0.000245125 +ATGTAA 1.32366E-05 0.000375189 +ATGTAC 0.000299465 0.00019488 +ATGTAG 8.57731E-06 0.000206413 +ATGTAT 0.000242283 0.000387797 +ATGTCA 0.000238788 0.000287225 +ATGTCC 0.000314925 0.00019453 +ATGTCG 0.000110976 3.4196E-05 +ATGTCT 0.000318525 0.000294054 +ATGTGA 2.0755E-05 0.000377904 +ATGTGC 0.00019929 0.000247061 +ATGTGG 0.000252342 0.000323088 +ATGTGT 0.000190078 0.000404976 +ATGTTA 0.000155133 0.000312469 +ATGTTC 0.000340975 0.000263299 +ATGTTG 0.000256049 0.000341073 +ATGTTT 0.00037359 0.000580499 +ATTAAA 0.000411076 0.000617169 +ATTAAC 0.00017737 0.00018703 +ATTAAG 0.0002965 0.000241173 +ATTAAT 0.000257637 0.000347445 +ATTACA 0.000203738 0.000346907 +ATTACC 0.00013226 0.000145091 +ATTACG 3.12384E-05 3.0056E-05 +ATTACT 0.000174088 0.000240743 +ATTAGA 0.0001186 0.000229963 +ATTAGC 9.93274E-05 0.000181062 +ATTAGG 6.62889E-05 0.000161141 +ATTAGT 0.000119447 0.000179422 +ATTATA 0.000123153 0.00034895 +ATTATC 0.000162863 0.000190148 +ATTATG 0.000185101 0.000261041 +ATTATT 0.000273945 0.000539098 +ATTCAA 0.000276168 0.000307388 +ATTCAC 0.000259755 0.00022757 +ATTCAG 0.00051951 0.000337498 +ATTCAT 0.000357918 0.00035594 +ATTCCA 0.000347011 0.000334756 +ATTCCC 0.000237306 0.00024155 +ATTCCG 5.30523E-05 4.68851E-05 +ATTCCT 0.000376978 0.000363199 +ATTCGA 0.000142108 3.52983E-05 +ATTCGC 0.000101869 2.89806E-05 +ATTCGG 0.000119023 3.99223E-05 +ATTCGT 9.55153E-05 4.12933E-05 +ATTCTA 0.000129083 0.000276687 +ATTCTC 0.000257214 0.000338815 +ATTCTG 0.000401122 0.000413068 +ATTCTT 0.000302112 0.000445328 +ATTGAA 0.00073066 0.000340428 +ATTGAC 0.000496425 0.000158291 +ATTGAG 0.00062625 0.000228458 +ATTGAT 0.000567585 0.000243028 +ATTGCA 0.000376661 0.000267977 +ATTGCC 0.000448562 0.000192326 +ATTGCG 6.04648E-05 3.31207E-05 +ATTGCT 0.000463069 0.000310668 +ATTGGA 0.000393709 0.000251604 +ATTGGC 0.000335786 0.000176814 +ATTGGG 0.000285275 0.00018504 +ATTGGT 0.000268544 0.000198966 +ATTGTA 0.000203314 0.000312496 +ATTGTC 0.000291205 0.000209236 +ATTGTG 0.000493778 0.000313276 +ATTGTT 0.00031429 0.000386587 +ATTTAA 1.30248E-05 0.000600393 +ATTTAC 0.000182241 0.000275128 +ATTTAG 7.09482E-06 0.000287602 +ATTTAT 0.000255519 0.000643165 +ATTTCA 0.000252025 0.000519796 +ATTTCC 0.000227775 0.000398013 +ATTTCG 3.22973E-05 4.33903E-05 +ATTTCT 0.000327103 0.000628675 +ATTTGA 1.00598E-05 0.000439978 +ATTTGC 0.00011214 0.000305936 +ATTTGG 0.000139461 0.000380673 +ATTTGT 0.000154921 0.000506435 +ATTTTA 0.000236353 0.000823474 +ATTTTC 0.000243765 0.000609749 +ATTTTG 0.000305183 0.000655343 +ATTTTT 0.000280616 0.00129582 +CAAAAA 0.000373801 0.00062803 +CAAAAC 0.000229681 0.000338519 +CAAAAG 0.000388415 0.000377259 +CAAAAT 0.000329009 0.000487831 +CAAACA 0.00023667 0.000346907 +CAAACC 0.00016371 0.000233108 +CAAACG 4.76517E-05 5.81225E-05 +CAAACT 0.00019156 0.000305829 +CAAAGA 0.000273945 0.000407288 +CAAAGC 0.000201196 0.000307711 +CAAAGG 0.000190078 0.000331099 +CAAAGT 0.000190819 0.000362903 +CAAATA 0.000158733 0.000382474 +CAAATC 0.000170699 0.000232383 +CAAATG 0.000265791 0.000378737 +CAAATT 0.000233917 0.000364247 +CAACAA 0.000264626 0.000269321 +CAACAC 0.00013459 0.000194638 +CAACAG 0.000421241 0.000280746 +CAACAT 0.000191772 0.000277843 +CAACCA 0.000185842 0.000217677 +CAACCC 0.000142955 0.000193993 +CAACCG 3.53682E-05 4.16966E-05 +CAACCT 0.000178323 0.00026475 +CAACGA 5.85587E-05 4.03255E-05 +CAACGC 5.17816E-05 4.57023E-05 +CAACGG 5.88764E-05 4.42774E-05 +CAACGT 4.73341E-05 5.24769E-05 +CAACTA 0.000106528 0.000135548 +CAACTC 0.000162016 0.000202649 +CAACTG 0.000289511 0.000236953 +CAACTT 0.000199714 0.000257788 +CAAGAA 0.000737331 0.000426536 +CAAGAC 0.000346163 0.000256201 +CAAGAG 0.000571927 0.000339837 +CAAGAT 0.000460739 0.000278972 +CAAGCA 0.000318737 0.000300479 +CAAGCC 0.000338221 0.000257357 +CAAGCG 5.62291E-05 8.00865E-05 +CAAGCT 0.000312913 0.000259508 +CAAGGA 0.000370095 0.000361048 +CAAGGC 0.000293641 0.000276095 +CAAGGG 0.0002408 0.000260583 +CAAGGT 0.000207444 0.00022835 +CAAGTA 0.000155662 0.000211091 +CAAGTC 0.000202679 0.000201628 +CAAGTG 0.000360459 0.000297011 +CAAGTT 0.0002354 0.000268138 +CAATAA 1.00598E-05 0.000339487 +CAATAC 9.98569E-05 0.00011724 +CAATAG 4.55339E-06 0.000134902 +CAATAT 0.000154074 0.000227651 +CAATCA 0.00010314 0.000194261 +CAATCC 8.70439E-05 0.000141919 +CAATCG 1.32366E-05 2.70987E-05 +CAATCT 0.000106634 0.000189933 +CAATGA 7.09482E-06 0.000237598 +CAATGC 7.24306E-05 0.000159689 +CAATGG 9.59388E-05 0.000200149 +CAATGT 0.000120506 0.000230877 +CAATTA 9.66801E-05 0.000198294 +CAATTC 0.000110764 0.000193536 +CAATTG 8.79969E-05 0.00015614 +CAATTT 0.000155662 0.000330427 +CACAAA 0.000318949 0.000353977 +CACAAC 0.000350187 0.000173857 +CACAAG 0.000526393 0.000249077 +CACAAT 0.000241965 0.000222839 +CACACA 0.000316619 0.000580956 +CACACC 0.000344893 0.000305291 +CACACG 0.000198655 9.84749E-05 +CACACT 0.000297029 0.000282171 +CACAGA 0.000231058 0.000443796 +CACAGC 0.000484248 0.000405863 +CACAGG 0.000264097 0.000385861 +CACAGT 0.000275851 0.000326207 +CACATA 0.000119341 0.000221414 +CACATC 0.000485412 0.000242975 +CACATG 0.000410758 0.000294269 +CACATT 0.000261767 0.000344756 +CACCAA 0.000166781 0.000263702 +CACCAC 0.000363953 0.000352364 +CACCAG 0.000653147 0.000364139 +CACCAT 0.000194737 0.00031306 +CACCCA 0.000258696 0.000394867 +CACCCC 0.000328479 0.000401723 +CACCCG 0.000167522 0.000124014 +CACCCT 0.000254884 0.000339218 +CACCGA 0.000112035 6.85534E-05 +CACCGC 0.000232858 0.000139311 +CACCGG 0.000226822 9.42004E-05 +CACCGT 7.8996E-05 9.80448E-05 +CACCTA 0.000109493 0.000167378 +CACCTC 0.000376978 0.000396427 +CACCTG 0.000816327 0.00048767 +CACCTT 0.000221634 0.000318357 +CACGAA 9.64683E-05 5.6617E-05 +CACGAC 0.000169958 4.37129E-05 +CACGAG 0.00029004 7.74788E-05 +CACGAT 9.15972E-05 4.82562E-05 +CACGCA 8.01608E-05 8.86086E-05 +CACGCC 0.000209879 0.00014985 +CACGCG 8.23846E-05 4.93584E-05 +CACGCT 7.57133E-05 8.506E-05 +CACGGA 8.79969E-05 8.93613E-05 +CACGGC 0.000215704 0.000100787 +CACGGG 0.000164663 9.5222E-05 +CACGGT 5.7288E-05 7.75863E-05 +CACGTA 3.87568E-05 4.58367E-05 +CACGTC 0.000150474 7.20483E-05 +CACGTG 0.00033208 0.000139473 +CACGTT 5.66526E-05 7.76669E-05 +CACTAA 8.04785E-06 0.000181008 +CACTAC 0.000305924 0.000129794 +CACTAG 8.68321E-06 0.000128692 +CACTAT 0.0001833 0.000154742 +CACTCA 0.000183618 0.000268299 +CACTCC 0.000244506 0.000328949 +CACTCG 0.000109175 6.82308E-05 +CACTCT 0.000168264 0.000292226 +CACTGA 2.6685E-05 0.000349595 +CACTGC 0.00034214 0.000447183 +CACTGG 0.000285169 0.000362849 +CACTGT 0.000218774 0.000381237 +CACTTA 0.000104198 0.000206951 +CACTTC 0.000401439 0.000290908 +CACTTG 0.000226293 0.000293059 +CACTTT 0.000246307 0.000446995 +CAGAAA 0.000882616 0.000611308 +CAGAAC 0.00069561 0.000303651 +CAGAAG 0.001308093 0.000517242 +CAGAAT 0.000596706 0.000389141 +CAGACA 0.000456186 0.000361128 +CAGACC 0.000563985 0.000279617 +CAGACG 0.000218457 9.04905E-05 +CAGACT 0.000369778 0.000297065 +CAGAGA 0.00052957 0.000542324 +CAGAGC 0.000701857 0.000484229 +CAGAGG 0.000591517 0.00054141 +CAGAGT 0.000423571 0.000354676 +CAGATA 0.000246095 0.00023499 +CAGATC 0.000675702 0.000220903 +CAGATG 0.000750991 0.000380861 +CAGATT 0.000467411 0.000320238 +CAGCAA 0.000534653 0.000356531 +CAGCAC 0.000604436 0.000381936 +CAGCAG 0.001754749 0.000593215 +CAGCAT 0.000370942 0.00033411 +CAGCCA 0.000576057 0.00050087 +CAGCCC 0.000809338 0.000587301 +CAGCCG 0.000286758 0.000188508 +CAGCCT 0.000615661 0.000743253 +CAGCGA 0.000200031 9.93621E-05 +CAGCGC 0.000418594 0.000152699 +CAGCGG 0.000465187 0.000176706 +CAGCGT 0.000157145 0.000102723 +CAGCTA 0.000263991 0.000278999 +CAGCTC 0.000791443 0.000445651 +CAGCTG 0.001692166 0.000580096 +CAGCTT 0.000463916 0.000404438 +CAGGAA 0.000947211 0.000534824 +CAGGAC 0.000887064 0.000330965 +CAGGAG 0.001733041 0.000648515 +CAGGAT 0.000633451 0.000303732 +CAGGCA 0.000539418 0.000461163 +CAGGCC 0.001043361 0.000450167 +CAGGCG 0.000304865 0.000192568 +CAGGCT 0.000618837 0.000518774 +CAGGGA 0.00038132 0.000473207 +CAGGGC 0.000751309 0.00044393 +CAGGGG 0.000370095 0.000380485 +CAGGGT 0.000317149 0.000315507 +CAGGTA 0.000162969 0.000177728 +CAGGTC 0.000429501 0.000229076 +CAGGTG 0.000948376 0.000429064 +CAGGTT 0.000287075 0.000268434 +CAGTAA 1.32366E-05 0.000251443 +CAGTAC 0.000486895 0.000134203 +CAGTAG 1.23895E-05 0.000194208 +CAGTAT 0.000392862 0.000240582 +CAGTCA 0.000326467 0.000270934 +CAGTCC 0.000421136 0.000259454 +CAGTCG 0.000117859 6.13486E-05 +CAGTCT 0.000383861 0.000317335 +CAGTGA 4.20394E-05 0.000447237 +CAGTGC 0.000402181 0.000310291 +CAGTGG 0.000451527 0.000463797 +CAGTGT 0.00037899 0.000378952 +CAGTTA 0.000210515 0.000226683 +CAGTTC 0.000566314 0.000271283 +CAGTTG 0.000356753 0.000267331 +CAGTTT 0.000542489 0.000449925 +CATAAA 0.000238047 0.000313706 +CATAAC 0.000109705 0.000128827 +CATAAG 0.000214115 0.000160334 +CATAAT 0.000163604 0.000233619 +CATACA 0.000140414 0.000201305 +CATACC 0.00011267 0.000120358 +CATACG 3.03912E-05 3.13195E-05 +CATACT 0.00024133 0.00017262 +CATAGA 9.3821E-05 0.000188051 +CATAGC 0.000100386 0.000142188 +CATAGG 6.07824E-05 0.00013786 +CATAGT 0.000110658 0.000160092 +CATATA 7.52898E-05 0.000234291 +CATATC 0.000112776 0.000141274 +CATATG 0.000134696 0.000205096 +CATATT 0.0001761 0.000322792 +CATCAA 0.000183089 0.000227248 +CATCAC 0.000177053 0.000236765 +CATCAG 0.000442632 0.000288946 +CATCAT 0.000184677 0.00026838 +CATCCA 0.000208291 0.000290021 +CATCCC 0.000170593 0.000302441 +CATCCG 4.28866E-05 5.9171E-05 +CATCCT 0.000237835 0.0003436 +CATCGA 8.79969E-05 3.77716E-05 +CATCGC 7.15835E-05 6.34186E-05 +CATCGG 0.000103034 5.16973E-05 +CATCGT 6.52299E-05 5.78537E-05 +CATCTA 9.31856E-05 0.000185471 +CATCTC 0.000191242 0.000366236 +CATCTG 0.000312913 0.000392098 +CATCTT 0.000192089 0.000388173 +CATGAA 0.000491342 0.000339514 +CATGAC 0.00030836 0.000180228 +CATGAG 0.000446232 0.000274375 +CATGAT 0.000305289 0.000241335 +CATGCA 0.000236988 0.000259024 +CATGCC 0.00032615 0.000286795 +CATGCG 5.59114E-05 5.80956E-05 +CATGCT 0.000284852 0.000266014 +CATGGA 0.000315137 0.000322255 +CATGGC 0.000315772 0.000259616 +CATGGG 0.000244824 0.000260422 +CATGGT 0.000201937 0.000271014 +CATGTA 0.000120718 0.000246604 +CATGTC 0.000212633 0.000201063 +CATGTG 0.000376661 0.000350187 +CATGTT 0.000203844 0.000372688 +CATTAA 9.00088E-06 0.000301124 +CATTAC 0.000145497 0.00014614 +CATTAG 5.71821E-06 0.000172432 +CATTAT 0.000172923 0.000269993 +CATTCA 0.000185101 0.000324862 +CATTCC 0.000169852 0.000295774 +CATTCG 3.25091E-05 4.31483E-05 +CATTCT 0.000198125 0.000386372 +CATTGA 5.18875E-06 0.000236576 +CATTGC 8.47142E-05 0.000230312 +CATTGG 7.59251E-05 0.000209827 +CATTGT 9.02206E-05 0.000320695 +CATTTA 0.000137449 0.000421778 +CATTTC 0.000186371 0.000451888 +CATTTG 0.000194207 0.000436403 +CATTTT 0.000237623 0.000797719 +CCAAAA 0.000325408 0.000388415 +CCAAAC 0.000230634 0.000245609 +CCAAAG 0.000425054 0.000422934 +CCAAAT 0.000323608 0.000333385 +CCAACA 0.000267909 0.000269401 +CCAACC 0.000211997 0.000221602 +CCAACG 6.23708E-05 5.23694E-05 +CCAACT 0.00021168 0.000223269 +CCAAGA 0.000218033 0.000367796 +CCAAGC 0.000226505 0.000272869 +CCAAGG 0.000184253 0.000383254 +CCAAGT 0.000210621 0.000286177 +CCAATA 0.000105363 0.000168023 +CCAATC 0.000119871 0.000136354 +CCAATG 0.000212527 0.000178642 +CCAATT 0.000179171 0.000184852 +CCACAA 0.00018383 0.000254266 +CCACAC 0.0001797 0.000303893 +CCACAG 0.000492719 0.000447049 +CCACAT 0.000159475 0.00027873 +CCACCA 0.000530523 0.000449011 +CCACCC 0.00049399 0.000500601 +CCACCG 0.000166569 0.000153613 +CCACCT 0.000526711 0.000472588 +CCACGA 8.09021E-05 7.24515E-05 +CCACGC 9.09619E-05 0.000129606 +CCACGG 0.000132578 0.000126972 +CCACGT 5.77116E-05 0.000112401 +CCACTA 9.57271E-05 0.000150898 +CCACTC 0.00020702 0.000280182 +CCACTG 0.000450256 0.000449173 +CCACTT 0.000187536 0.000293865 +CCAGAA 0.000764546 0.000453393 +CCAGAC 0.00052544 0.00029529 +CCAGAG 0.000940116 0.000522431 +CCAGAT 0.000562396 0.000281284 +CCAGCA 0.000454492 0.000514258 +CCAGCC 0.000677502 0.00073664 +CCAGCG 0.000138614 0.00016641 +CCAGCT 0.000494731 0.000568375 +CCAGGA 0.000514639 0.000585338 +CCAGGC 0.000532323 0.000648784 +CCAGGG 0.00047387 0.000522807 +CCAGGT 0.000286863 0.000350617 +CCAGTA 0.000174405 0.000177728 +CCAGTC 0.000241435 0.000261229 +CCAGTG 0.000497272 0.000388469 +CCAGTT 0.000284852 0.000299081 +CCATAA 6.45946E-06 0.000179717 +CCATAC 0.000148568 0.000113557 +CCATAG 6.56535E-06 0.000145978 +CCATAT 0.000196113 0.000183777 +CCATCA 0.00025446 0.000277063 +CCATCC 0.000275427 0.000326422 +CCATCG 6.54417E-05 6.48703E-05 +CCATCT 0.000309736 0.000397556 +CCATGA 1.27071E-05 0.000260557 +CCATGC 9.51976E-05 0.000256443 +CCATGG 0.000144014 0.000304458 +CCATGT 0.000112246 0.000328761 +CCATTA 0.000102928 0.000185229 +CCATTC 0.000172393 0.000266901 +CCATTG 0.000164028 0.000234802 +CCATTT 0.000271191 0.000436698 +CCCAAA 0.000517922 0.000409196 +CCCAAC 0.000556572 0.000230124 +CCCAAG 0.000875627 0.000372446 +CCCAAT 0.000310901 0.000158506 +CCCACA 0.000388521 0.000356182 +CCCACC 0.000621591 0.000554073 +CCCACG 0.000245142 0.000134956 +CCCACT 0.000311748 0.000337874 +CCCAGA 0.000252025 0.000496999 +CCCAGC 0.000863767 0.000778524 +CCCAGG 0.000404404 0.000770379 +CCCAGT 0.000375708 0.000345912 +CCCATA 0.000101339 0.000138317 +CCCATC 0.000611319 0.00032091 +CCCATG 0.000510721 0.000277923 +CCCATT 0.000280086 0.000268944 +CCCCAA 0.00021168 0.000343923 +CCCCAC 0.000333456 0.000471728 +CCCCAG 0.000885475 0.000627438 +CCCCAT 0.000178112 0.00031091 +CCCCCA 0.000567585 0.000472884 +CCCCCC 0.000311325 0.000270423 +CCCCCG 0.000320008 0.000194799 +CCCCCT 0.000421665 0.000349327 +CCCCGA 0.000156827 0.000129095 +CCCCGC 0.000252025 0.00029685 +CCCCGG 0.00035707 0.00024077 +CCCCGT 8.6938E-05 0.000124176 +CCCCTA 8.84205E-05 0.000158103 +CCCCTC 0.00035347 0.00051208 +CCCCTG 0.000796314 0.000458662 +CCCCTT 0.000173241 0.000359704 +CCCGAA 0.000131731 7.06234E-05 +CCCGAC 0.000281992 8.89312E-05 +CCCGAG 0.000525652 0.000178696 +CCCGAT 0.000105257 4.13471E-05 +CCCGCA 0.000114364 0.000121326 +CCCGCC 0.000339069 0.000353305 +CCCGCG 0.000177159 0.00016891 +CCCGCT 0.00010261 0.000143156 +CCCGGA 0.000122518 0.000149527 +CCCGGC 0.000317361 0.000303947 +CCCGGG 0.000269815 0.000300264 +CCCGGT 7.16894E-05 8.73182E-05 +CCCGTA 3.12384E-05 3.45186E-05 +CCCGTC 0.000142743 0.000122482 +CCCGTG 0.000333456 0.000122858 +CCCGTT 4.79694E-05 6.36337E-05 +CCCTAA 1.02716E-05 0.000172163 +CCCTAC 0.000454809 0.000154931 +CCCTAG 1.0907E-05 0.000169233 +CCCTAT 0.000297876 0.000130574 +CCCTCA 0.000272992 0.00035723 +CCCTCC 0.000455551 0.000650397 +CCCTCG 0.000187642 0.000141059 +CCCTCT 0.000305183 0.000459361 +CCCTGA 3.08148E-05 0.00038285 +CCCTGC 0.000375813 0.000563132 +CCCTGG 0.000364165 0.000580123 +CCCTGT 0.00020342 0.00039925 +CCCTTA 9.11737E-05 0.000165227 +CCCTTC 0.000547148 0.000436107 +CCCTTG 0.000282734 0.000304243 +CCCTTT 0.000294064 0.000406051 +CCGAAA 6.21591E-05 5.987E-05 +CCGAAC 5.54878E-05 4.00298E-05 +CCGAAG 0.000129189 8.65923E-05 +CCGAAT 4.92401E-05 4.16428E-05 +CCGACA 4.73341E-05 5.09446E-05 +CCGACC 8.61967E-05 7.93875E-05 +CCGACG 4.0451E-05 3.80404E-05 +CCGACT 4.56398E-05 6.29347E-05 +CCGAGA 4.53221E-05 0.000123235 +CCGAGC 0.000113623 0.000147403 +CCGAGG 8.06903E-05 0.000190148 +CCGAGT 5.62291E-05 9.56521E-05 +CCGATA 1.8743E-05 1.81196E-05 +CCGATC 4.59575E-05 3.34971E-05 +CCGATG 6.85126E-05 4.6912E-05 +CCGATT 3.78037E-05 3.91964E-05 +CCGCAA 3.86509E-05 5.14285E-05 +CCGCAC 0.000121671 9.12432E-05 +CCGCAG 0.000283793 0.000176411 +CCGCAT 3.98157E-05 5.20199E-05 +CCGCCA 0.000162016 0.00015407 +CCGCCC 0.000337268 0.000328787 +CCGCCG 0.000271509 0.000248728 +CCGCCT 0.000165299 0.000231684 +CCGCGA 3.01794E-05 5.86333E-05 +CCGCGC 0.000133954 0.000192138 +CCGCGG 0.000145708 0.000187567 +CCGCGT 2.35082E-05 5.76924E-05 +CCGCTA 3.11325E-05 3.6293E-05 +CCGCTC 0.000159686 0.000135682 +CCGCTG 0.000429289 0.00017762 +CCGCTT 5.18875E-05 8.32588E-05 +CCGGAA 0.000131519 0.000100249 +CCGGAC 0.000207656 9.0141E-05 +CCGGAG 0.00036893 0.00018297 +CCGGAT 0.000121353 5.24769E-05 +CCGGCA 0.000113411 0.000110599 +CCGGCC 0.000352623 0.000267197 +CCGGCG 0.00014052 0.000153775 +CCGGCT 0.000130672 0.000165039 +CCGGGA 0.000117647 0.000189422 +CCGGGC 0.000286016 0.000268165 +CCGGGG 0.000215915 0.000222893 +CCGGGT 8.84205E-05 0.000127644 +CCGGTA 2.54143E-05 3.03786E-05 +CCGGTC 9.91156E-05 6.98707E-05 +CCGGTG 0.000240377 0.000102696 +CCGGTT 4.84989E-05 5.44932E-05 +CCGTAA 1.37661E-06 3.41423E-05 +CCGTAC 8.05844E-05 2.51362E-05 +CCGTAG 2.22375E-06 4.16966E-05 +CCGTAT 5.7288E-05 3.29863E-05 +CCGTCA 5.5276E-05 6.1698E-05 +CCGTCC 0.000142532 0.000120089 +CCGTCG 6.13119E-05 4.51646E-05 +CCGTCT 6.53358E-05 0.000122455 +CCGTGA 4.87107E-06 8.6216E-05 +CCGTGC 7.65605E-05 0.000106056 +CCGTGG 8.81028E-05 0.000151516 +CCGTGT 4.6381E-05 0.000104873 +CCGTTA 2.20257E-05 3.25561E-05 +CCGTTC 7.85724E-05 5.88484E-05 +CCGTTG 5.24169E-05 5.6402E-05 +CCGTTT 5.77116E-05 8.08661E-05 +CCTAAA 0.000251178 0.000246443 +CCTAAC 0.000127813 0.000129526 +CCTAAG 0.000224704 0.000176653 +CCTAAT 0.000169428 0.00017426 +CCTACA 0.000165193 0.000178427 +CCTACC 0.000172817 0.000182782 +CCTACG 4.14041E-05 3.74221E-05 +CCTACT 0.000180759 0.000173937 +CCTAGA 0.000101445 0.000207891 +CCTAGC 0.000123047 0.000151678 +CCTAGG 8.12197E-05 0.000200176 +CCTAGT 0.000122094 0.000134902 +CCTATA 8.25964E-05 0.000129284 +CCTATC 0.00012866 0.000115869 +CCTATG 0.000157039 0.000152108 +CCTATT 0.000161592 0.000189046 +CCTCAA 0.000222798 0.000284806 +CCTCAC 0.000212844 0.000336234 +CCTCAG 0.000565997 0.000589935 +CCTCAT 0.000218245 0.000302038 +CCTCCA 0.000593847 0.000501407 +CCTCCC 0.000464446 0.00086345 +CCTCCG 0.000147509 0.000189987 +CCTCCT 0.000590458 0.000677092 +CCTCGA 0.00013999 6.98438E-05 +CCTCGC 0.000116058 0.000152215 +CCTCGG 0.000198655 0.000192245 +CCTCGT 8.22787E-05 8.98453E-05 +CCTCTA 0.000115105 0.000202864 +CCTCTC 0.000248424 0.000493154 +CCTCTG 0.000520463 0.000591952 +CCTCTT 0.00023667 0.000433795 +CCTGAA 0.000678137 0.00038191 +CCTGAC 0.000494943 0.000320077 +CCTGAG 0.000976649 0.000522189 +CCTGAT 0.000524381 0.000249185 +CCTGCA 0.00043416 0.000457506 +CCTGCC 0.000667866 0.00071766 +CCTGCG 0.000143908 0.00017176 +CCTGCT 0.00052131 0.000521409 +CCTGGA 0.000566314 0.000543749 +CCTGGC 0.000604542 0.000596388 +CCTGGG 0.000587493 0.00077218 +CCTGGT 0.000354635 0.000335051 +CCTGTA 0.000210621 0.000323169 +CCTGTC 0.000355482 0.000374382 +CCTGTG 0.00074845 0.000502268 +CCTGTT 0.00032382 0.000360994 +CCTTAA 1.03775E-05 0.000232141 +CCTTAC 0.00021295 0.000146059 +CCTTAG 6.77714E-06 0.000181922 +CCTTAT 0.000239847 0.000203993 +CCTTCA 0.000320749 0.000362043 +CCTTCC 0.000345634 0.000578537 +CCTTCG 6.95715E-05 8.44685E-05 +CCTTCT 0.000373378 0.000482508 +CCTTGA 1.12246E-05 0.000295882 +CCTTGC 0.000119447 0.000278972 +CCTTGG 0.000138084 0.000399545 +CCTTGT 0.000126754 0.000306877 +CCTTTA 0.000149626 0.000279483 +CCTTTC 0.000266638 0.000430461 +CCTTTG 0.000259967 0.000402718 +CCTTTT 0.000255837 0.000547513 +CGAAAA 0.000152486 5.69665E-05 +CGAAAC 0.000108117 4.56485E-05 +CGAAAG 0.000171334 5.65633E-05 +CGAAAT 0.000122836 4.32558E-05 +CGAACA 8.96912E-05 3.87394E-05 +CGAACC 7.94196E-05 3.78522E-05 +CGAACG 2.1708E-05 1.69367E-05 +CGAACT 7.05246E-05 5.20468E-05 +CGAAGA 0.00012273 6.98707E-05 +CGAAGC 0.00012093 6.91448E-05 +CGAAGG 0.000105257 7.73175E-05 +CGAAGT 9.14913E-05 5.02456E-05 +CGAATA 5.87705E-05 3.11582E-05 +CGAATC 0.000109175 3.65618E-05 +CGAATG 0.000124848 4.44925E-05 +CGAATT 0.000111611 3.93577E-05 +CGACAA 6.78773E-05 3.35777E-05 +CGACAC 7.87842E-05 4.30945E-05 +CGACAG 0.000162228 6.71823E-05 +CGACAT 7.61369E-05 3.52983E-05 +CGACCA 7.53956E-05 4.47882E-05 +CGACCC 8.81028E-05 7.68604E-05 +CGACCG 2.45671E-05 3.08356E-05 +CGACCT 7.52898E-05 6.09184E-05 +CGACGA 3.70625E-05 1.8711E-05 +CGACGC 5.09344E-05 3.81479E-05 +CGACGG 6.04648E-05 3.83361E-05 +CGACGT 3.08148E-05 2.10499E-05 +CGACTA 4.80753E-05 2.04047E-05 +CGACTC 8.79969E-05 5.98431E-05 +CGACTG 0.000155768 5.97355E-05 +CGACTT 7.58192E-05 4.98961E-05 +CGAGAA 0.000240271 7.78551E-05 +CGAGAC 0.000228728 9.91739E-05 +CGAGAG 0.000319796 0.000104981 +CGAGAT 0.000198867 6.73974E-05 +CGAGCA 0.000131307 7.19676E-05 +CGAGCC 0.00020342 0.000120923 +CGAGCG 4.36278E-05 7.69411E-05 +CGAGCT 0.000144861 7.74788E-05 +CGAGGA 0.000160533 0.000120546 +CGAGGC 0.000212844 0.000156947 +CGAGGG 0.000158098 0.000129203 +CGAGGT 0.000100598 8.33663E-05 +CGAGTA 7.51839E-05 4.42237E-05 +CGAGTC 0.000117012 5.90097E-05 +CGAGTG 0.000218774 7.56507E-05 +CGAGTT 9.25503E-05 5.46276E-05 +CGATAA 4.4475E-06 2.34157E-05 +CGATAC 7.96314E-05 1.68292E-05 +CGATAG 1.58839E-06 1.92756E-05 +CGATAT 6.68183E-05 2.07811E-05 +CGATCA 5.88764E-05 3.12657E-05 +CGATCC 6.38533E-05 4.14815E-05 +CGATCG 1.36602E-05 1.30924E-05 +CGATCT 6.49123E-05 5.98968E-05 +CGATGA 3.17678E-06 4.29601E-05 +CGATGC 5.16757E-05 4.46269E-05 +CGATGG 5.74998E-05 5.52728E-05 +CGATGT 5.46407E-05 4.21536E-05 +CGATTA 4.43691E-05 2.41147E-05 +CGATTC 8.73615E-05 5.66439E-05 +CGATTG 5.15698E-05 3.25024E-05 +CGATTT 0.000105893 5.76386E-05 +CGCAAA 0.000154498 4.36322E-05 +CGCAAC 0.000204055 3.56746E-05 +CGCAAG 0.000383226 4.81218E-05 +CGCAAT 9.24444E-05 3.12388E-05 +CGCACA 0.000126436 7.55163E-05 +CGCACC 0.000232435 9.61092E-05 +CGCACG 0.000112035 4.65356E-05 +CGCACT 7.92078E-05 5.93592E-05 +CGCAGA 9.71037E-05 9.85287E-05 +CGCAGC 0.0003612 0.000176223 +CGCAGG 0.000203314 0.000149796 +CGCAGT 0.000109917 7.55163E-05 +CGCATA 3.69566E-05 2.19908E-05 +CGCATC 0.000368295 5.15091E-05 +CGCATG 0.000238788 5.69934E-05 +CGCATT 0.000112246 4.25031E-05 +CGCCAA 8.33376E-05 6.15099E-05 +CGCCAC 0.000241647 0.000132617 +CGCCAG 0.000402392 0.00013786 +CGCCAT 0.000101869 8.17533E-05 +CGCCCA 0.000126754 0.000159393 +CGCCCC 0.000181394 0.000260691 +CGCCCG 9.41387E-05 0.000188347 +CGCCCT 0.000112988 0.000148156 +CGCCGA 7.09482E-05 6.20475E-05 +CGCCGC 0.000291205 0.000274375 +CGCCGG 0.000225552 0.00014985 +CGCCGT 6.89362E-05 5.59718E-05 +CGCCTA 6.93598E-05 4.00298E-05 +CGCCTC 0.000333986 0.000210123 +CGCCTG 0.000622226 0.000218968 +CGCCTT 0.00011807 9.94427E-05 +CGCGAA 2.97559E-05 2.45179E-05 +CGCGAC 0.000131836 3.4438E-05 +CGCGAG 0.000226505 7.26397E-05 +CGCGAT 4.07687E-05 2.45717E-05 +CGCGCA 3.90744E-05 6.8177E-05 +CGCGCC 0.000213162 0.000179583 +CGCGCG 9.83744E-05 0.000140655 +CGCGCT 4.18276E-05 9.05442E-05 +CGCGGA 3.72743E-05 8.53826E-05 +CGCGGC 0.000185101 0.000184153 +CGCGGG 0.000119447 0.000168265 +CGCGGT 3.01794E-05 6.53811E-05 +CGCGTA 1.45073E-05 1.21514E-05 +CGCGTC 0.000102504 5.8015E-05 +CGCGTG 0.000228728 6.19131E-05 +CGCGTT 2.4673E-05 2.87924E-05 +CGCTAA 3.91803E-06 3.54865E-05 +CGCTAC 0.000335045 3.0513E-05 +CGCTAG 3.70625E-06 3.40079E-05 +CGCTAT 0.00015185 2.45986E-05 +CGCTCA 0.000112882 6.64027E-05 +CGCTCC 0.000286546 0.000155011 +CGCTCG 0.000100069 6.87416E-05 +CGCTCT 0.000126012 0.000110815 +CGCTGA 1.30248E-05 9.22379E-05 +CGCTGC 0.000354317 0.000193778 +CGCTGG 0.000288028 0.000159555 +CGCTGT 0.000172288 0.000109793 +CGCTTA 4.09805E-05 2.97602E-05 +CGCTTC 0.000428972 9.27487E-05 +CGCTTG 0.000110552 7.84735E-05 +CGCTTT 0.000173135 7.76401E-05 +CGGAAA 0.000229787 8.07855E-05 +CGGAAC 0.00021168 5.76117E-05 +CGGAAG 0.000437337 0.00011939 +CGGAAT 0.000127177 4.73959E-05 +CGGACA 0.000130354 6.51123E-05 +CGGACC 0.0001833 8.12694E-05 +CGGACG 7.70899E-05 5.32566E-05 +CGGACT 9.42446E-05 6.0542E-05 +CGGAGA 0.000147509 0.000119525 +CGGAGC 0.000247895 0.00019445 +CGGAGG 0.000217716 0.000191627 +CGGAGT 0.000110234 8.65117E-05 +CGGATA 6.16296E-05 2.59428E-05 +CGGATC 0.000201726 6.42251E-05 +CGGATG 0.000190289 5.987E-05 +CGGATT 0.000104093 4.35784E-05 +CGGCAA 0.000106952 5.00036E-05 +CGGCAC 0.000222904 7.98176E-05 +CGGCAG 0.00052724 0.000168426 +CGGCAT 9.82685E-05 5.12134E-05 +CGGCCA 0.000164346 0.00012923 +CGGCCC 0.000399428 0.000226172 +CGGCCG 0.000153545 0.000178104 +CGGCCT 0.000189866 0.000176733 +CGGCGA 9.2868E-05 6.56768E-05 +CGGCGC 0.00026219 0.000174179 +CGGCGG 0.000309525 0.00029107 +CGGCGT 6.81949E-05 5.68052E-05 +CGGCTA 7.67723E-05 4.74766E-05 +CGGCTC 0.000298406 0.000171733 +CGGCTG 0.000661406 0.000189664 +CGGCTT 0.000118176 9.2453E-05 +CGGGAA 0.000289934 0.000114148 +CGGGAC 0.000428336 0.00011318 +CGGGAG 0.000715517 0.000233512 +CGGGAT 0.000214115 6.62414E-05 +CGGGCA 0.00021941 0.000132214 +CGGGCC 0.000457457 0.000199719 +CGGGCG 0.000154392 0.000186008 +CGGGCT 0.000202573 0.000137618 +CGGGGA 0.000141685 0.000169475 +CGGGGC 0.000385132 0.000255368 +CGGGGG 0.00015831 0.000175846 +CGGGGT 0.000124 0.000120627 +CGGGTA 6.21591E-05 3.52445E-05 +CGGGTC 0.000169852 8.83667E-05 +CGGGTG 0.000315984 0.000127025 +CGGGTT 7.12658E-05 7.6027E-05 +CGGTAA 2.01196E-06 2.80666E-05 +CGGTAC 0.000103881 2.47061E-05 +CGGTAG 2.8591E-06 3.91426E-05 +CGGTAT 6.11001E-05 2.35501E-05 +CGGTCA 7.23248E-05 5.12672E-05 +CGGTCC 0.000117435 7.91724E-05 +CGGTCG 3.10266E-05 3.36584E-05 +CGGTCT 7.38073E-05 5.72354E-05 +CGGTGA 6.14178E-06 8.13769E-05 +CGGTGC 8.40789E-05 0.000105975 +CGGTGG 9.9751E-05 0.000152941 +CGGTGT 5.73939E-05 6.87685E-05 +CGGTTA 3.97098E-05 2.85505E-05 +CGGTTC 0.00012273 6.17787E-05 +CGGTTG 7.47603E-05 5.27458E-05 +CGGTTT 0.000100704 6.60263E-05 +CGTAAA 7.08423E-05 4.04062E-05 +CGTAAC 4.16159E-05 2.72332E-05 +CGTAAG 6.60771E-05 3.23411E-05 +CGTAAT 4.79694E-05 3.34433E-05 +CGTACA 4.35219E-05 3.11044E-05 +CGTACC 4.80753E-05 2.57546E-05 +CGTACG 9.84803E-06 8.14575E-06 +CGTACT 4.69105E-05 2.78784E-05 +CGTAGA 4.28866E-05 3.6051E-05 +CGTAGC 4.72282E-05 3.88469E-05 +CGTAGG 3.02853E-05 4.1831E-05 +CGTAGT 3.72743E-05 3.15883E-05 +CGTATA 2.06491E-05 2.7045E-05 +CGTATC 5.89823E-05 2.76633E-05 +CGTATG 3.99216E-05 3.27981E-05 +CGTATT 5.38994E-05 4.64281E-05 +CGTCAA 4.8393E-05 3.51639E-05 +CGTCAC 6.23708E-05 6.03539E-05 +CGTCAG 0.000130989 6.98169E-05 +CGTCAT 6.29003E-05 4.77185E-05 +CGTCCA 6.86185E-05 7.01395E-05 +CGTCCC 7.83606E-05 0.000117885 +CGTCCG 2.00137E-05 5.29877E-05 +CGTCCT 8.46083E-05 9.87975E-05 +CGTCGA 3.89685E-05 1.57001E-05 +CGTCGC 5.85587E-05 4.68314E-05 +CGTCGG 6.06766E-05 4.60517E-05 +CGTCGT 3.0603E-05 2.35501E-05 +CGTCTA 3.75919E-05 2.83623E-05 +CGTCTC 9.72096E-05 0.000121998 +CGTCTG 0.000167946 0.000107804 +CGTCTT 7.1054E-05 7.79627E-05 +CGTGAA 0.00012453 7.72099E-05 +CGTGAC 0.000129189 6.88222E-05 +CGTGAG 0.000198231 0.000113799 +CGTGAT 0.000108752 7.05697E-05 +CGTGCA 7.77253E-05 8.0651E-05 +CGTGCC 0.000174935 0.000113584 +CGTGCG 3.07089E-05 5.28264E-05 +CGTGCT 9.90097E-05 8.95495E-05 +CGTGGA 0.000110023 0.000117105 +CGTGGC 0.000180865 0.000128504 +CGTGGG 0.000129189 0.000143855 +CGTGGT 8.71497E-05 0.000108395 +CGTGTA 4.98755E-05 4.88208E-05 +CGTGTC 0.000111187 8.00327E-05 +CGTGTG 0.000229152 0.000130278 +CGTGTT 7.65605E-05 8.8286E-05 +CGTTAA 2.22375E-06 3.48681E-05 +CGTTAC 7.4019E-05 2.94914E-05 +CGTTAG 1.58839E-06 3.35777E-05 +CGTTAT 6.33239E-05 3.57822E-05 +CGTTCA 6.35357E-05 5.21812E-05 +CGTTCC 9.26562E-05 7.08385E-05 +CGTTCG 1.58839E-05 1.99208E-05 +CGTTCT 9.71037E-05 7.12417E-05 +CGTTGA 2.43553E-06 4.30945E-05 +CGTTGC 4.58516E-05 5.50578E-05 +CGTTGG 5.00873E-05 6.11873E-05 +CGTTGT 4.20394E-05 5.53535E-05 +CGTTTA 4.96637E-05 5.37405E-05 +CGTTTC 0.000104622 8.56245E-05 +CGTTTG 7.25365E-05 7.40108E-05 +CGTTTT 9.62565E-05 0.000113852 +CTAAAA 0.000237729 0.000409627 +CTAAAC 0.000120824 0.000159689 +CTAAAG 0.000272886 0.000241308 +CTAAAT 0.000184148 0.000290908 +CTAACA 0.0001222 0.000183481 +CTAACC 8.54555E-05 0.000124902 +CTAACG 2.372E-05 3.32551E-05 +CTAACT 0.00010674 0.000165308 +CTAAGA 0.000108117 0.000223726 +CTAAGC 0.000103351 0.000141301 +CTAAGG 9.39269E-05 0.000171733 +CTAAGT 0.000108222 0.000168991 +CTAATA 6.34298E-05 0.000202138 +CTAATC 7.41249E-05 0.000119337 +CTAATG 0.000146026 0.000188697 +CTAATT 0.000117435 0.000289242 +CTACAA 0.000169111 0.000207408 +CTACAC 0.000100175 0.000132321 +CTACAG 0.000355164 0.00026018 +CTACAT 0.000103669 0.000190229 +CTACCA 0.000115953 0.00018211 +CTACCC 0.000125483 0.000168507 +CTACCG 2.6685E-05 3.1884E-05 +CTACCT 0.000130672 0.00022171 +CTACGA 5.07226E-05 2.78246E-05 +CTACGC 6.11001E-05 2.96258E-05 +CTACGG 7.3066E-05 3.65618E-05 +CTACGT 3.63212E-05 4.05944E-05 +CTACTA 6.97833E-05 0.000161087 +CTACTC 0.000107587 0.000176303 +CTACTG 0.000205961 0.00021886 +CTACTT 0.000119129 0.000250637 +CTAGAA 0.000363318 0.000270584 +CTAGAC 0.000185206 0.000122159 +CTAGAG 0.000355906 0.000215715 +CTAGAT 0.000204479 0.000150011 +CTAGCA 0.000146238 0.000157915 +CTAGCC 0.00014772 0.000139661 +CTAGCG 3.4521E-05 3.6508E-05 +CTAGCT 0.00014232 0.000160738 +CTAGGA 0.000136496 0.000213214 +CTAGGC 0.000124742 0.000150925 +CTAGGG 0.000106528 0.000155979 +CTAGGT 8.24905E-05 0.00013466 +CTAGTA 6.0253E-05 0.000109443 +CTAGTC 6.67124E-05 0.000109148 +CTAGTG 0.000180653 0.000140978 +CTAGTT 7.71958E-05 0.000172889 +CTATAA 6.67124E-06 0.000211763 +CTATAC 6.29003E-05 9.77491E-05 +CTATAG 3.81214E-06 0.000127509 +CTATAT 8.31258E-05 0.000194745 +CTATCA 7.6984E-05 0.000145226 +CTATCC 7.20071E-05 0.000115788 +CTATCG 1.59898E-05 2.13456E-05 +CTATCT 7.91019E-05 0.000178077 +CTATGA 6.24767E-06 0.000178911 +CTATGC 4.79694E-05 0.000122213 +CTATGG 6.40651E-05 0.000152081 +CTATGT 5.74998E-05 0.000207676 +CTATTA 5.17816E-05 0.000187917 +CTATTC 5.94058E-05 0.000167082 +CTATTG 7.82548E-05 0.000161168 +CTATTT 0.000122412 0.000400889 +CTCAAA 0.000370413 0.000375323 +CTCAAC 0.00060253 0.000183696 +CTCAAG 0.000786783 0.000309566 +CTCAAT 0.00034341 0.000187702 +CTCACA 0.000315349 0.000309781 +CTCACC 0.00064944 0.000327766 +CTCACG 0.000199926 0.000101674 +CTCACT 0.00033621 0.000396669 +CTCAGA 0.000203102 0.000417208 +CTCAGC 0.000681102 0.000532189 +CTCAGG 0.000285487 0.000455974 +CTCAGT 0.000353788 0.000342928 +CTCATA 0.000130778 0.000165845 +CTCATC 0.000816327 0.000261739 +CTCATG 0.000511992 0.000280934 +CTCATT 0.00040864 0.000344864 +CTCCAA 0.000215704 0.000302791 +CTCCAC 0.00028877 0.000353682 +CTCCAG 0.000741461 0.000610206 +CTCCAT 0.00020575 0.000345912 +CTCCCA 0.000286228 0.000594882 +CTCCCC 0.000311325 0.000559476 +CTCCCG 0.000153121 0.000238888 +CTCCCT 0.000283051 0.000582569 +CTCCGA 0.000167946 8.27211E-05 +CTCCGC 0.000243659 0.000188401 +CTCCGG 0.000299465 0.000161463 +CTCCGT 0.000102504 0.0001131 +CTCCTA 0.000147085 0.000217435 +CTCCTC 0.00051125 0.000553992 +CTCCTG 0.001019853 0.000740565 +CTCCTT 0.000269391 0.000452157 +CTCGAA 6.37474E-05 6.13754E-05 +CTCGAC 0.000122624 4.2745E-05 +CTCGAG 0.000170487 7.75863E-05 +CTCGAT 7.91019E-05 3.94921E-05 +CTCGCA 5.87705E-05 6.22357E-05 +CTCGCC 0.000198549 0.00014251 +CTCGCG 4.46867E-05 7.47904E-05 +CTCGCT 7.41249E-05 0.000123235 +CTCGGA 6.53358E-05 9.34477E-05 +CTCGGC 0.000177688 0.000189396 +CTCGGG 0.000139461 0.000161221 +CTCGGT 5.07226E-05 7.82046E-05 +CTCGTA 2.61555E-05 2.74751E-05 +CTCGTC 0.000128554 6.6322E-05 +CTCGTG 0.000223434 9.1512E-05 +CTCGTT 4.80753E-05 5.96818E-05 +CTCTAA 8.36553E-06 0.000222893 +CTCTAC 0.000550536 0.000219559 +CTCTAG 1.04834E-05 0.000201009 +CTCTAT 0.000321702 0.000182218 +CTCTCA 0.000272992 0.000338197 +CTCTCC 0.000524805 0.000521597 +CTCTCG 0.000139461 9.73996E-05 +CTCTCT 0.000340445 0.000553266 +CTCTGA 3.99216E-05 0.000429332 +CTCTGC 0.000478424 0.000552056 +CTCTGG 0.000372213 0.000500924 +CTCTGT 0.000280192 0.000533372 +CTCTTA 0.000130883 0.000234829 +CTCTTC 0.000847777 0.000456512 +CTCTTG 0.000273945 0.000355725 +CTCTTT 0.000425159 0.000500709 +CTGAAA 0.000695821 0.000511328 +CTGAAC 0.000569915 0.000249561 +CTGAAG 0.001336261 0.000479524 +CTGAAT 0.000439879 0.000354676 +CTGACA 0.000405781 0.000291016 +CTGACC 0.000684173 0.000321475 +CTGACG 0.000232011 7.30967E-05 +CTGACT 0.000386932 0.00032005 +CTGAGA 0.000344151 0.000482723 +CTGAGC 0.000786254 0.000422692 +CTGAGG 0.000496108 0.000573214 +CTGAGT 0.000370625 0.000347929 +CTGATA 0.00015365 0.000199531 +CTGATC 0.000442208 0.000191116 +CTGATG 0.000592046 0.000315023 +CTGATT 0.000337586 0.000316394 +CTGCAA 0.000370519 0.00037121 +CTGCAC 0.000727483 0.000362661 +CTGCAG 0.001986125 0.000643837 +CTGCAT 0.000331656 0.000343331 +CTGCCA 0.000437443 0.000476083 +CTGCCC 0.001057022 0.000617545 +CTGCCG 0.000310795 0.000183024 +CTGCCT 0.000604436 0.000737231 +CTGCGA 0.000182241 8.2506E-05 +CTGCGC 0.00058834 0.000157323 +CTGCGG 0.000729601 0.000191089 +CTGCGT 0.000189866 0.000108879 +CTGCTA 0.000243659 0.000218295 +CTGCTC 0.000980991 0.000450409 +CTGCTG 0.002398895 0.000681206 +CTGCTT 0.000435007 0.000479954 +CTGGAA 0.001007781 0.00052571 +CTGGAC 0.001392702 0.000318652 +CTGGAG 0.002456712 0.000647816 +CTGGAT 0.000907925 0.0003204 +CTGGCA 0.000688091 0.00038199 +CTGGCC 0.001667599 0.000522888 +CTGGCG 0.000458727 0.000131945 +CTGGCT 0.000845236 0.000503693 +CTGGGA 0.00053137 0.000682254 +CTGGGC 0.001278655 0.000606496 +CTGGGG 0.0007745 0.000584397 +CTGGGT 0.000407899 0.000406508 +CTGGTA 0.000228411 0.000176491 +CTGGTC 0.000593635 0.000289645 +CTGGTG 0.001510243 0.000376882 +CTGGTT 0.000339916 0.000308598 +CTGTAA 1.41896E-05 0.000408578 +CTGTAC 0.00044655 0.000212274 +CTGTAG 1.59898E-05 0.000264777 +CTGTAT 0.00028824 0.000314835 +CTGTCA 0.00031429 0.000349273 +CTGTCC 0.000615343 0.000395835 +CTGTCG 0.000173664 8.49255E-05 +CTGTCT 0.000395615 0.000483987 +CTGTGA 3.4521E-05 0.000469389 +CTGTGC 0.000446232 0.000420783 +CTGTGG 0.000439984 0.000515683 +CTGTGT 0.00031609 0.000527995 +CTGTTA 0.000131942 0.000271203 +CTGTTC 0.000419865 0.000329943 +CTGTTG 0.000344257 0.000364113 +CTGTTT 0.000381532 0.000564987 +CTTAAA 0.000261555 0.000403228 +CTTAAC 0.000126436 0.000173158 +CTTAAG 0.000203314 0.000214532 +CTTAAT 0.000197808 0.000267197 +CTTACA 0.00015365 0.000207166 +CTTACC 0.000140096 0.000159797 +CTTACG 3.63212E-05 3.91695E-05 +CTTACT 0.000192831 0.000212731 +CTTAGA 9.41387E-05 0.000218242 +CTTAGC 0.000103563 0.000161678 +CTTAGG 6.66065E-05 0.000176895 +CTTAGT 0.000123047 0.000170201 +CTTATA 9.27621E-05 0.000192084 +CTTATC 0.000148462 0.000145172 +CTTATG 0.000161275 0.000181196 +CTTATT 0.000225234 0.000331395 +CTTCAA 0.000297029 0.000315023 +CTTCAC 0.00019569 0.000290182 +CTTCAG 0.000588446 0.000458609 +CTTCAT 0.000266638 0.000364758 +CTTCCA 0.000320432 0.000435381 +CTTCCC 0.000262508 0.000558939 +CTTCCG 6.38533E-05 0.000113449 +CTTCCT 0.000372213 0.00065572 +CTTCGA 0.000181606 4.98155E-05 +CTTCGC 0.000116906 7.52474E-05 +CTTCGG 0.000191031 8.75333E-05 +CTTCGT 0.000101763 6.92792E-05 +CTTCTA 0.000147509 0.000266579 +CTTCTC 0.00029057 0.000479712 +CTTCTG 0.000512945 0.000539179 +CTTCTT 0.000280298 0.000463985 +CTTGAA 0.000425795 0.00041702 +CTTGAC 0.000235082 0.000191681 +CTTGAG 0.000335045 0.000322282 +CTTGAT 0.000330491 0.000243324 +CTTGCA 0.000254143 0.000259186 +CTTGCC 0.000282945 0.000297549 +CTTGCG 4.51103E-05 5.75311E-05 +CTTGCT 0.000323502 0.000364543 +CTTGGA 0.000337586 0.000369409 +CTTGGC 0.000269179 0.000348977 +CTTGGG 0.000239847 0.000375968 +CTTGGT 0.000204585 0.000271283 +CTTGTA 0.000136284 0.000229936 +CTTGTC 0.000204479 0.000245797 +CTTGTG 0.00032615 0.000301285 +CTTGTT 0.000227564 0.000354354 +CTTTAA 9.21267E-06 0.000417262 +CTTTAC 0.000137766 0.00021179 +CTTTAG 4.65928E-06 0.00023956 +CTTTAT 0.000220681 0.000400863 +CTTTCA 0.000219939 0.000402368 +CTTTCC 0.000244295 0.000473664 +CTTTCG 3.54741E-05 6.03001E-05 +CTTTCT 0.00033208 0.000622572 +CTTTGA 7.62428E-06 0.000393953 +CTTTGC 0.000124848 0.000358628 +CTTTGG 0.000138296 0.00045299 +CTTTGT 0.000160004 0.000474524 +CTTTTA 0.000165193 0.000486729 +CTTTTC 0.00025319 0.000543615 +CTTTTG 0.000250966 0.000487025 +CTTTTT 0.000263355 0.000862106 +GAAAAA 0.001054057 0.000755539 +GAAAAC 0.00066363 0.000411804 +GAAAAG 0.001044209 0.000524366 +GAAAAT 0.000944034 0.000614319 +GAAACA 0.000513792 0.000427719 +GAAACC 0.000394133 0.000323222 +GAAACG 0.000108858 8.09736E-05 +GAAACT 0.00042823 0.000370618 +GAAAGA 0.000522581 0.000516973 +GAAAGC 0.000384073 0.000321744 +GAAAGG 0.000377931 0.000395136 +GAAAGT 0.000433843 0.000327712 +GAAATA 0.000419865 0.000465814 +GAAATC 0.00046434 0.000280397 +GAAATG 0.000687985 0.000492133 +GAAATT 0.00062985 0.000437021 +GAACAA 0.000460634 0.00027838 +GAACAC 0.000265155 0.000210069 +GAACAG 0.000669348 0.000295559 +GAACAT 0.000352411 0.000254804 +GAACCA 0.000350187 0.000244695 +GAACCC 0.000264838 0.000218 +GAACCG 7.45485E-05 6.22895E-05 +GAACCT 0.000349446 0.000223242 +GAACGA 0.00015831 4.78261E-05 +GAACGC 0.00013639 5.36598E-05 +GAACGG 0.000178535 5.53266E-05 +GAACGT 0.000115 5.52191E-05 +GAACTA 0.000243553 0.000165819 +GAACTC 0.000351564 0.000241657 +GAACTG 0.00065357 0.000305748 +GAACTT 0.000449091 0.000277386 +GAAGAA 0.001988454 0.000610098 +GAAGAC 0.000900724 0.000325319 +GAAGAG 0.001626407 0.000493665 +GAAGAT 0.001304175 0.000348278 +GAAGCA 0.000651558 0.000377608 +GAAGCC 0.000744003 0.000352364 +GAAGCG 0.000118176 9.80985E-05 +GAAGCT 0.000693915 0.000349945 +GAAGGA 0.000675066 0.000476029 +GAAGGC 0.000562926 0.000302603 +GAAGGG 0.000494625 0.000375753 +GAAGGT 0.00039318 0.000249212 +GAAGTA 0.000361624 0.000222893 +GAAGTC 0.000398898 0.00023577 +GAAGTG 0.000693703 0.000337121 +GAAGTT 0.000498967 0.00031341 +GAATAA 1.63075E-05 0.000353117 +GAATAC 0.000294064 0.000154742 +GAATAG 8.36553E-06 0.000168157 +GAATAT 0.000449938 0.000300398 +GAATCA 0.000288028 0.000252357 +GAATCC 0.000255413 0.000192702 +GAATCG 4.96637E-05 5.409E-05 +GAATCT 0.00037539 0.000256954 +GAATGA 1.71546E-05 0.000326637 +GAATGC 0.000260708 0.000203106 +GAATGG 0.000289299 0.000268971 +GAATGT 0.000597129 0.000338008 +GAATTA 0.000300418 0.000268675 +GAATTC 0.000346163 0.000258191 +GAATTG 0.000322338 0.000264051 +GAATTT 0.000549372 0.00044479 +GACAAA 0.00062985 0.000288139 +GACAAC 0.00060666 0.000146489 +GACAAG 0.00095547 0.000235393 +GACAAT 0.000436384 0.000172459 +GACACA 0.000483612 0.000285263 +GACACC 0.00061259 0.000207085 +GACACG 0.000240271 7.05159E-05 +GACACT 0.000365224 0.000226172 +GACAGA 0.000375708 0.000377877 +GACAGC 0.000831576 0.000265261 +GACAGG 0.000386826 0.000291957 +GACAGT 0.000484565 0.000230071 +GACATA 0.000214009 0.000148828 +GACATC 0.000849154 0.000182917 +GACATG 0.000719012 0.000222812 +GACATT 0.000547571 0.000289376 +GACCAA 0.000298618 0.000208241 +GACCAC 0.000443902 0.00019289 +GACCAG 0.000857837 0.000301285 +GACCAT 0.000273627 0.000178535 +GACCCA 0.000439667 0.000256417 +GACCCC 0.000689256 0.000267036 +GACCCG 0.000218669 9.71845E-05 +GACCCT 0.000505532 0.000258191 +GACCGA 0.000178959 5.51922E-05 +GACCGC 0.000330174 6.77469E-05 +GACCGG 0.000330068 7.16719E-05 +GACCGT 0.000127813 4.92509E-05 +GACCTA 0.000196325 0.000116971 +GACCTC 0.000674219 0.000270235 +GACCTG 0.001327154 0.000298866 +GACCTT 0.000364059 0.000230635 +GACGAA 0.000185312 4.38204E-05 +GACGAC 0.000360883 4.0675E-05 +GACGAG 0.00056462 6.40369E-05 +GACGAT 0.000178959 3.29863E-05 +GACGCA 0.000113199 6.18593E-05 +GACGCC 0.000344469 9.55177E-05 +GACGCG 0.000131201 6.0085E-05 +GACGCT 0.000124848 6.91179E-05 +GACGGA 0.000105893 8.24254E-05 +GACGGC 0.00037539 8.50868E-05 +GACGGG 0.000246836 0.000108099 +GACGGT 9.12796E-05 4.98692E-05 +GACGTA 5.05108E-05 2.88731E-05 +GACGTC 0.000218033 5.67514E-05 +GACGTG 0.000484989 8.81516E-05 +GACGTT 8.45024E-05 5.29608E-05 +GACTAA 1.15423E-05 0.000137107 +GACTAC 0.000517074 0.000124391 +GACTAG 1.3872E-05 0.000112266 +GACTAT 0.000379308 0.000125681 +GACTCA 0.000315455 0.000231791 +GACTCC 0.000493884 0.000250798 +GACTCG 0.00019389 7.0032E-05 +GACTCT 0.000393392 0.000258594 +GACTGA 3.82273E-05 0.000270934 +GACTGC 0.000431301 0.000224855 +GACTGG 0.00049399 0.000279644 +GACTGT 0.000355482 0.000255583 +GACTTA 0.000193254 0.000154716 +GACTTC 0.000778735 0.000262116 +GACTTG 0.000447609 0.000252572 +GACTTT 0.000540583 0.000347256 +GAGAAA 0.001312858 0.000605125 +GAGAAC 0.000875627 0.000259347 +GAGAAG 0.002071262 0.000512645 +GAGAAT 0.000656429 0.000355295 +GAGACA 0.000498649 0.00036422 +GAGACC 0.000735002 0.000310506 +GAGACG 0.000281781 0.00012966 +GAGACT 0.00040864 0.000305506 +GAGAGA 0.000513156 0.00053391 +GAGAGC 0.000746438 0.000305425 +GAGAGG 0.000574998 0.00047568 +GAGAGT 0.000445597 0.00024198 +GAGATA 0.000231376 0.000202515 +GAGATC 0.000816433 0.000199988 +GAGATG 0.000909831 0.000374812 +GAGATT 0.000520569 0.000283273 +GAGCAA 0.000439879 0.000271713 +GAGCAC 0.000545348 0.000217139 +GAGCAG 0.001501453 0.000448715 +GAGCAT 0.000328691 0.000208779 +GAGCCA 0.000544818 0.00042823 +GAGCCC 0.000840153 0.00038605 +GAGCCG 0.000306136 0.000204155 +GAGCCT 0.000575104 0.000341799 +GAGCGA 0.000210938 9.40122E-05 +GAGCGC 0.000469846 0.000133881 +GAGCGG 0.000586646 0.000149393 +GAGCGT 0.000178218 6.6322E-05 +GAGCTA 0.000283051 0.000161383 +GAGCTC 0.000780853 0.000282144 +GAGCTG 0.002084393 0.00049388 +GAGCTT 0.000400063 0.000264401 +GAGGAA 0.001468944 0.00051778 +GAGGAC 0.00130301 0.000288112 +GAGGAG 0.002958961 0.000584236 +GAGGAT 0.000921691 0.000273541 +GAGGCA 0.000620637 0.000427908 +GAGGCC 0.00133139 0.000463044 +GAGGCG 0.000414464 0.00021679 +GAGGCT 0.000755651 0.000468502 +GAGGGA 0.00037899 0.000437935 +GAGGGC 0.000868003 0.000323948 +GAGGGG 0.000513686 0.000434709 +GAGGGT 0.000323926 0.00024612 +GAGGTA 0.000208079 0.000151006 +GAGGTC 0.000491554 0.000229156 +GAGGTG 0.001188434 0.000359327 +GAGGTT 0.000319902 0.00025725 +GAGTAA 1.23895E-05 0.000177836 +GAGTAC 0.000492931 9.79641E-05 +GAGTAG 9.42446E-06 0.00018668 +GAGTAT 0.000352729 0.000148048 +GAGTCA 0.000308254 0.000229667 +GAGTCC 0.000459469 0.000215553 +GAGTCG 0.000150685 6.5408E-05 +GAGTCT 0.000372637 0.0002569 +GAGTGA 3.02853E-05 0.000293059 +GAGTGC 0.000386614 0.000239103 +GAGTGG 0.000429183 0.000287494 +GAGTGT 0.00039265 0.000235582 +GAGTTA 0.000189442 0.00017141 +GAGTTC 0.000615872 0.00023499 +GAGTTG 0.000353364 0.000228915 +GAGTTT 0.000526605 0.000337336 +GATAAA 0.00051771 0.000290613 +GATAAC 0.000243447 0.000121434 +GATAAG 0.000346799 0.000148317 +GATAAT 0.000340128 0.000217946 +GATACA 0.000238153 0.000178427 +GATACC 0.000208609 0.000103744 +GATACG 4.6381E-05 2.73945E-05 +GATACT 0.00023127 0.000151221 +GATAGA 0.000165616 0.000158694 +GATAGC 0.000164981 9.37703E-05 +GATAGG 8.91617E-05 0.00010783 +GATAGT 0.000174405 0.000109175 +GATATA 0.000199502 0.000167835 +GATATC 0.000294276 0.000106943 +GATATG 0.000293535 0.000161759 +GATATT 0.000439984 0.000269401 +GATCAA 0.000245671 0.000156167 +GATCAC 0.000195902 0.000193831 +GATCAG 0.000407052 0.000180605 +GATCAT 0.000221422 0.000185309 +GATCCA 0.000312172 0.000187514 +GATCCC 0.000307407 0.000162996 +GATCCG 6.34298E-05 5.24769E-05 +GATCCT 0.000401969 0.00021429 +GATCGA 0.000123789 3.51101E-05 +GATCGC 9.78449E-05 5.10252E-05 +GATCGG 0.000114047 3.6508E-05 +GATCGT 8.36553E-05 3.84437E-05 +GATCTA 0.000138084 0.000112454 +GATCTC 0.000279557 0.000208779 +GATCTG 0.000442314 0.000237517 +GATCTT 0.000324244 0.000226603 +GATGAA 0.001348862 0.000319486 +GATGAC 0.000963836 0.000179583 +GATGAG 0.001275267 0.000264051 +GATGAT 0.001037749 0.000226764 +GATGCA 0.00052491 0.000221172 +GATGCC 0.000793772 0.000213376 +GATGCG 0.000125589 4.99499E-05 +GATGCT 0.000694233 0.000264912 +GATGGA 0.000704081 0.000318814 +GATGGC 0.000695504 0.000215607 +GATGGG 0.00058887 0.00028908 +GATGGT 0.000455445 0.000221898 +GATGTA 0.000303806 0.000185175 +GATGTC 0.00051125 0.000178857 +GATGTG 0.000907183 0.000285424 +GATGTT 0.000511356 0.00027795 +GATTAA 1.19659E-05 0.000211037 +GATTAC 0.000247577 0.000197326 +GATTAG 9.10678E-06 0.00011974 +GATTAT 0.000330068 0.000225178 +GATTCA 0.000289299 0.000222516 +GATTCC 0.00029237 0.000207219 +GATTCG 5.14639E-05 3.47337E-05 +GATTCT 0.000391062 0.000308893 +GATTGA 1.11187E-05 0.000176223 +GATTGC 0.000112776 0.000161974 +GATTGG 0.00013406 0.000175335 +GATTGT 0.000164557 0.000218564 +GATTTA 0.000239424 0.00026924 +GATTTC 0.000353258 0.000295801 +GATTTG 0.000358553 0.000297145 +GATTTT 0.000444644 0.000546814 +GCAAAA 0.000408958 0.000352983 +GCAAAC 0.000197066 0.000197595 +GCAAAG 0.00041277 0.000300022 +GCAAAT 0.0002983 0.000278165 +GCAACA 0.000231482 0.000240071 +GCAACC 0.000175782 0.000178615 +GCAACG 5.54878E-05 4.87401E-05 +GCAACT 0.000208821 0.000171599 +GCAAGA 0.00020755 0.000280719 +GCAAGC 0.000149097 0.000185229 +GCAAGG 0.000147826 0.000243808 +GCAAGT 0.0001815 0.000194934 +GCAATA 0.000115529 0.000180013 +GCAATC 0.000123153 0.000128692 +GCAATG 0.000249589 0.000201574 +GCAATT 0.000223116 0.000200821 +GCACAA 0.000191454 0.000202407 +GCACAC 0.000168158 0.000220876 +GCACAG 0.00044835 0.000351289 +GCACAT 0.000148038 0.000228941 +GCACCA 0.000240165 0.000252196 +GCACCC 0.000290252 0.000248271 +GCACCG 7.26424E-05 9.70232E-05 +GCACCT 0.000277651 0.000270047 +GCACGA 6.95715E-05 4.90627E-05 +GCACGC 8.11139E-05 8.12425E-05 +GCACGG 0.000127707 8.85011E-05 +GCACGT 5.10403E-05 7.21827E-05 +GCACTA 9.56212E-05 0.00011603 +GCACTC 0.000181288 0.000210849 +GCACTG 0.000462751 0.000304054 +GCACTT 0.000191666 0.000296016 +GCAGAA 0.000787207 0.000401051 +GCAGAC 0.000468787 0.000237033 +GCAGAG 0.000964895 0.000517887 +GCAGAT 0.000547995 0.000266471 +GCAGCA 0.000542595 0.000409196 +GCAGCC 0.000800232 0.000495117 +GCAGCG 0.000179382 0.00018539 +GCAGCT 0.000624132 0.000412933 +GCAGGA 0.000404616 0.000450382 +GCAGGC 0.000407687 0.000355429 +GCAGGG 0.000402181 0.000449737 +GCAGGT 0.000243447 0.000268407 +GCAGTA 0.000189654 0.000178723 +GCAGTC 0.000239 0.000205284 +GCAGTG 0.000573198 0.000469013 +GCAGTT 0.000270132 0.000265315 +GCATAA 7.09482E-06 0.000149419 +GCATAC 0.000113623 9.42004E-05 +GCATAG 5.08285E-06 0.000125493 +GCATAT 0.000168581 0.00018504 +GCATCA 0.000197384 0.000201439 +GCATCC 0.000231058 0.000211252 +GCATCG 5.40053E-05 5.08102E-05 +GCATCT 0.000292476 0.000266095 +GCATGA 7.51839E-06 0.000226522 +GCATGC 7.70899E-05 0.00018125 +GCATGG 0.000126224 0.000253406 +GCATGT 0.000113199 0.000239614 +GCATTA 0.000126542 0.000176921 +GCATTC 0.000161063 0.000203187 +GCATTG 0.000184359 0.00020609 +GCATTT 0.00032435 0.000430542 +GCCAAA 0.000602847 0.000274402 +GCCAAC 0.000691056 0.000184126 +GCCAAG 0.001305446 0.000347821 +GCCAAT 0.000404404 0.00015442 +GCCACA 0.000533488 0.000316905 +GCCACC 0.000869591 0.000410809 +GCCACG 0.000312913 0.000121514 +GCCACT 0.000427066 0.000314485 +GCCAGA 0.000295758 0.000335481 +GCCAGC 0.000845236 0.000402072 +GCCAGG 0.000442632 0.000567998 +GCCAGT 0.000411711 0.000258245 +GCCATA 0.000172393 0.000139446 +GCCATC 0.001003016 0.000228458 +GCCATG 0.000842589 0.000286822 +GCCATT 0.000489648 0.000269159 +GCCCAA 0.000268756 0.000215768 +GCCCAC 0.000467517 0.000300344 +GCCCAG 0.001259912 0.00064744 +GCCCAT 0.000245354 0.000207676 +GCCCCA 0.00046381 0.000421993 +GCCCCC 0.000530735 0.000391722 +GCCCCG 0.000301688 0.000271982 +GCCCCT 0.000443691 0.000415783 +GCCCGA 0.000183618 9.55446E-05 +GCCCGC 0.000403875 0.000233189 +GCCCGG 0.000543442 0.000277198 +GCCCGT 0.000133107 8.37427E-05 +GCCCTA 0.000164557 0.000136005 +GCCCTC 0.000589293 0.000361236 +GCCCTG 0.001542858 0.000538131 +GCCCTT 0.000303489 0.000288435 +GCCGAA 0.00014232 5.77999E-05 +GCCGAC 0.000334303 6.44133E-05 +GCCGAG 0.000664371 0.00020394 +GCCGAT 0.000116694 3.6051E-05 +GCCGCA 0.000138825 0.000112266 +GCCGCC 0.000646687 0.000352714 +GCCGCG 0.000242918 0.000187164 +GCCGCT 0.000170487 0.000150199 +GCCGGA 0.000102081 0.000126649 +GCCGGC 0.000374543 0.000208779 +GCCGGG 0.000293323 0.000296258 +GCCGGT 7.45485E-05 7.71562E-05 +GCCGTA 4.55339E-05 3.15077E-05 +GCCGTC 0.000235506 8.87968E-05 +GCCGTG 0.000545136 0.000129579 +GCCGTT 6.81949E-05 6.0085E-05 +GCCTAA 9.63624E-06 0.000137241 +GCCTAC 0.000522051 0.00011681 +GCCTAG 1.2813E-05 0.000166464 +GCCTAT 0.000324561 0.000125843 +GCCTCA 0.000347964 0.000423714 +GCCTCC 0.000715623 0.000648945 +GCCTCG 0.000251389 0.000162969 +GCCTCT 0.000447715 0.000435381 +GCCTGA 3.51564E-05 0.000334003 +GCCTGC 0.000515168 0.000435758 +GCCTGG 0.000526711 0.000671178 +GCCTGT 0.000315878 0.000413417 +GCCTTA 0.000155027 0.000179099 +GCCTTC 0.000990097 0.000350241 +GCCTTG 0.000494625 0.00032169 +GCCTTT 0.000520145 0.000378952 +GCGAAA 5.7288E-05 4.50302E-05 +GCGAAC 4.00275E-05 3.33358E-05 +GCGAAG 0.000102187 6.95481E-05 +GCGAAT 3.71684E-05 3.21529E-05 +GCGACA 4.70164E-05 5.78268E-05 +GCGACC 7.78312E-05 6.41176E-05 +GCGACG 3.90744E-05 4.22611E-05 +GCGACT 4.20394E-05 5.16435E-05 +GCGAGA 3.20855E-05 9.39047E-05 +GCGAGC 7.12658E-05 0.0001074 +GCGAGG 6.05707E-05 0.000142887 +GCGAGT 3.13443E-05 5.55148E-05 +GCGATA 1.76841E-05 1.91143E-05 +GCGATC 5.11462E-05 4.81756E-05 +GCGATG 7.93137E-05 5.11328E-05 +GCGATT 4.4475E-05 5.5004E-05 +GCGCAA 3.43093E-05 3.94384E-05 +GCGCAC 0.000122624 8.01671E-05 +GCGCAG 0.000270662 0.000159286 +GCGCAT 3.28268E-05 4.69389E-05 +GCGCCA 7.22189E-05 0.000108556 +GCGCCC 0.000278286 0.000223403 +GCGCCG 0.000139778 0.000165819 +GCGCCT 9.9751E-05 0.000145575 +GCGCGA 2.4673E-05 5.39018E-05 +GCGCGC 0.000150474 0.000174368 +GCGCGG 0.000147509 0.000200875 +GCGCGT 2.41435E-05 5.18855E-05 +GCGCTA 4.08746E-05 3.12388E-05 +GCGCTC 0.000208079 0.000116729 +GCGCTG 0.000573939 0.000165953 +GCGCTT 6.05707E-05 6.90373E-05 +GCGGAA 0.000124424 7.78551E-05 +GCGGAC 0.00020575 7.48173E-05 +GCGGAG 0.000416688 0.000211817 +GCGGAT 0.00010621 5.9386E-05 +GCGGCA 0.000147509 0.00011275 +GCGGCC 0.000502461 0.000236496 +GCGGCG 0.000337374 0.000318679 +GCGGCT 0.000193784 0.000161894 +GCGGGA 9.80567E-05 0.000164447 +GCGGGC 0.000324455 0.000228511 +GCGGGG 0.000217716 0.000274402 +GCGGGT 7.70899E-05 9.87975E-05 +GCGGTA 3.37798E-05 3.14539E-05 +GCGGTC 0.000107693 6.48165E-05 +GCGGTG 0.000317255 0.000146919 +GCGGTT 5.17816E-05 5.89559E-05 +GCGTAA 1.16482E-06 2.53513E-05 +GCGTAC 5.61232E-05 1.64259E-05 +GCGTAG 1.4825E-06 3.45993E-05 +GCGTAT 4.10864E-05 2.45717E-05 +GCGTCA 4.36278E-05 5.00305E-05 +GCGTCC 0.000136284 0.000103233 +GCGTCG 5.67585E-05 4.41161E-05 +GCGTCT 6.17355E-05 8.42534E-05 +GCGTGA 4.4475E-06 9.869E-05 +GCGTGC 6.56535E-05 9.34208E-05 +GCGTGG 7.05246E-05 0.00014985 +GCGTGT 4.32042E-05 8.97646E-05 +GCGTTA 2.20257E-05 2.71794E-05 +GCGTTC 7.87842E-05 5.62407E-05 +GCGTTG 6.14178E-05 5.3391E-05 +GCGTTT 6.98892E-05 7.29623E-05 +GCTAAA 0.000260073 0.000196036 +GCTAAC 0.000120506 0.000113261 +GCTAAG 0.000232011 0.000161275 +GCTAAT 0.000180441 0.00019695 +GCTACA 0.000208926 0.00016477 +GCTACC 0.00016964 0.000123665 +GCTACG 4.17217E-05 3.36852E-05 +GCTACT 0.000186371 0.000208026 +GCTAGA 9.42446E-05 0.000155845 +GCTAGC 8.68321E-05 9.42004E-05 +GCTAGG 6.59712E-05 0.000143156 +GCTAGT 0.000102716 0.000111944 +GCTATA 0.000107799 0.000130359 +GCTATC 0.000148038 9.03023E-05 +GCTATG 0.000202785 0.000145468 +GCTATT 0.00022894 0.000197649 +GCTCAA 0.000208503 0.000197407 +GCTCAC 0.000202149 0.000300156 +GCTCAG 0.000572668 0.000374947 +GCTCAT 0.000197172 0.000206574 +GCTCCA 0.000335998 0.000313598 +GCTCCC 0.000317678 0.000384598 +GCTCCG 9.60447E-05 0.000157995 +GCTCCT 0.000339069 0.000388469 +GCTCGA 0.000129083 4.33365E-05 +GCTCGC 0.000117647 0.000100088 +GCTCGG 0.00017197 0.00012388 +GCTCGT 7.85724E-05 4.93853E-05 +GCTCTA 0.00013406 0.000151113 +GCTCTC 0.000259649 0.000296177 +GCTCTG 0.00061852 0.000490762 +GCTCTT 0.000266214 0.000310775 +GCTGAA 0.000692962 0.000334406 +GCTGAC 0.000565997 0.00022714 +GCTGAG 0.000984485 0.000527243 +GCTGAT 0.000508815 0.000224291 +GCTGCA 0.000581034 0.000404572 +GCTGCC 0.000926244 0.000506811 +GCTGCG 0.000201514 0.000189019 +GCTGCT 0.000739449 0.000526678 +GCTGGA 0.000512097 0.000491326 +GCTGGC 0.000530735 0.00037492 +GCTGGG 0.000514427 0.000710804 +GCTGGT 0.000331444 0.000318625 +GCTGTA 0.000229681 0.000221306 +GCTGTC 0.000451315 0.000294457 +GCTGTG 0.000976543 0.000491676 +GCTGTT 0.000399004 0.000342767 +GCTTAA 5.92999E-06 0.000181572 +GCTTAC 0.000146661 0.000115519 +GCTTAG 4.4475E-06 0.000147591 +GCTTAT 0.000206067 0.000177755 +GCTTCA 0.000269285 0.00029529 +GCTTCC 0.00031429 0.000374382 +GCTTCG 6.4171E-05 7.68873E-05 +GCTTCT 0.000337268 0.00039105 +GCTTGA 7.83606E-06 0.000232893 +GCTTGC 0.000115 0.000191439 +GCTTGG 0.000138402 0.000277708 +GCTTGT 0.000155239 0.000220554 +GCTTTA 0.000186477 0.000257922 +GCTTTC 0.000311219 0.000318921 +GCTTTG 0.000346269 0.000368737 +GCTTTT 0.000340869 0.000470868 +GGAAAA 0.00063038 0.000625798 +GGAAAC 0.000357388 0.000337551 +GGAAAG 0.000502249 0.00047197 +GGAAAT 0.000445385 0.000427235 +GGAACA 0.000304865 0.000287252 +GGAACC 0.000244718 0.000219855 +GGAACG 5.84528E-05 7.29354E-05 +GGAACT 0.000241012 0.000257277 +GGAAGA 0.000306136 0.000547325 +GGAAGC 0.000294382 0.000385378 +GGAAGG 0.000178641 0.00050259 +GGAAGT 0.000274686 0.000321851 +GGAATA 0.000170911 0.00023948 +GGAATC 0.00024313 0.000204397 +GGAATG 0.000330174 0.000300344 +GGAATT 0.00032022 0.000310426 +GGACAA 0.000216127 0.000224102 +GGACAC 0.000207656 0.000244964 +GGACAG 0.000424842 0.000352821 +GGACAT 0.000185524 0.000221306 +GGACCA 0.000262296 0.000241496 +GGACCC 0.000289405 0.000281499 +GGACCG 5.59114E-05 8.67267E-05 +GGACCT 0.000252872 0.000238351 +GGACGA 8.41847E-05 5.77461E-05 +GGACGC 9.40328E-05 0.000110331 +GGACGG 9.48799E-05 0.000106406 +GGACGT 7.02069E-05 7.04352E-05 +GGACTA 9.76331E-05 0.000142349 +GGACTC 0.000212315 0.000242545 +GGACTG 0.00031429 0.000298167 +GGACTT 0.000216974 0.000270826 +GGAGAA 0.000798855 0.000520602 +GGAGAC 0.000553184 0.000314781 +GGAGAG 0.000879334 0.000530012 +GGAGAT 0.000532641 0.000281902 +GGAGCA 0.000360459 0.000352956 +GGAGCC 0.000500767 0.000455436 +GGAGCG 9.11737E-05 0.000165523 +GGAGCT 0.000392015 0.000390136 +GGAGGA 0.000474611 0.000576816 +GGAGGC 0.000474188 0.000600339 +GGAGGG 0.000298935 0.000563374 +GGAGGT 0.000276592 0.0003179 +GGAGTA 0.000161381 0.000152189 +GGAGTC 0.000243236 0.00025061 +GGAGTG 0.000340763 0.0003493 +GGAGTT 0.000231587 0.000305049 +GGATAA 3.91803E-06 0.000180524 +GGATAC 0.000137872 0.000106217 +GGATAG 3.07089E-06 0.000118127 +GGATAT 0.000196749 0.000180847 +GGATCA 0.000176735 0.000202031 +GGATCC 0.000167522 0.000186573 +GGATCG 3.53682E-05 4.91971E-05 +GGATCT 0.000198337 0.000199558 +GGATGA 6.98892E-06 0.000248136 +GGATGC 8.45024E-05 0.000209827 +GGATGG 0.000131836 0.000306205 +GGATGT 0.000103351 0.000229345 +GGATTA 0.000135437 0.00024983 +GGATTC 0.000205961 0.000205149 +GGATTG 0.000132366 0.000192111 +GGATTT 0.000345528 0.000355268 +GGCAAA 0.000494413 0.000268837 +GGCAAC 0.00046434 0.000175712 +GGCAAG 0.000771111 0.000248163 +GGCAAT 0.00026039 0.00014985 +GGCACA 0.00032742 0.000279859 +GGCACC 0.000632709 0.000264885 +GGCACG 0.000173452 9.48187E-05 +GGCACT 0.000296712 0.000225097 +GGCAGA 0.000220575 0.000436 +GGCAGC 0.000843859 0.000436887 +GGCAGG 0.000274686 0.00055168 +GGCAGT 0.00038132 0.000265423 +GGCATA 0.000121035 0.000126945 +GGCATC 0.00068682 0.000203698 +GGCATG 0.000514851 0.000266552 +GGCATT 0.000337692 0.000245233 +GGCCAA 0.000199608 0.000277386 +GGCCAC 0.000477576 0.00029736 +GGCCAG 0.00080775 0.000492294 +GGCCAT 0.000227352 0.00022093 +GGCCCA 0.000349976 0.000360752 +GGCCCC 0.000609201 0.00042124 +GGCCCG 0.000204267 0.000196412 +GGCCCT 0.000408111 0.000359999 +GGCCGA 0.000167311 0.000128504 +GGCCGC 0.000453645 0.000235259 +GGCCGG 0.000371048 0.000257788 +GGCCGT 0.000141155 9.30444E-05 +GGCCTA 0.000126118 0.000127993 +GGCCTC 0.000597976 0.000445543 +GGCCTG 0.001031925 0.000477615 +GGCCTT 0.000277227 0.000304995 +GGCGAA 9.44563E-05 5.62407E-05 +GGCGAC 0.0002426 8.14575E-05 +GGCGAG 0.000453327 0.000128262 +GGCGAT 0.000113199 4.44925E-05 +GGCGCA 8.51378E-05 0.000108771 +GGCGCC 0.00039085 0.00021765 +GGCGCG 0.000190183 0.000176545 +GGCGCT 0.000116694 0.000127939 +GGCGGA 0.000104304 0.000164071 +GGCGGC 0.000566844 0.000361263 +GGCGGG 0.000243977 0.000329271 +GGCGGT 0.00011214 0.000100894 +GGCGTA 3.69566E-05 2.74214E-05 +GGCGTC 0.000218139 8.77214E-05 +GGCGTG 0.000334198 0.000166625 +GGCGTT 6.21591E-05 5.96549E-05 +GGCTAA 6.45946E-06 0.000172163 +GGCTAC 0.000578386 0.000121272 +GGCTAG 5.92999E-06 0.000137376 +GGCTAT 0.000317255 0.000120143 +GGCTCA 0.000281675 0.000372635 +GGCTCC 0.000728119 0.000392233 +GGCTCG 0.000158733 0.000100518 +GGCTCT 0.000408217 0.000343735 +GGCTGA 1.94843E-05 0.000410111 +GGCTGC 0.000506697 0.000489579 +GGCTGG 0.000506379 0.00066486 +GGCTGT 0.000298935 0.000349192 +GGCTTA 0.000115211 0.000159124 +GGCTTC 0.000764334 0.000325965 +GGCTTG 0.000269603 0.000248002 +GGCTTT 0.000410758 0.000350832 +GGGAAA 0.000591199 0.000482696 +GGGAAC 0.000374013 0.000229667 +GGGAAG 0.000761157 0.000515521 +GGGAAT 0.000254143 0.000240905 +GGGACA 0.000256684 0.000294188 +GGGACC 0.00036173 0.000285908 +GGGACG 0.000107481 0.000112723 +GGGACT 0.000216445 0.000290451 +GGGAGA 0.00018383 0.000461405 +GGGAGC 0.000344363 0.000397314 +GGGAGG 0.000191031 0.000742151 +GGGAGT 0.00017017 0.000252465 +GGGATA 9.21267E-05 0.000140817 +GGGATC 0.000264097 0.000169421 +GGGATG 0.000283475 0.000267761 +GGGATT 0.000188807 0.000307764 +GGGCAA 0.000149097 0.000238055 +GGGCAC 0.000216974 0.000247303 +GGGCAG 0.00061026 0.000506596 +GGGCAT 0.000126118 0.000207327 +GGGCCA 0.000281039 0.000328895 +GGGCCC 0.000529358 0.000380431 +GGGCCG 0.0001761 0.000225984 +GGGCCT 0.000345634 0.000367661 +GGGCGA 8.28081E-05 9.48994E-05 +GGGCGC 0.000183618 0.000206171 +GGGCGG 0.000189442 0.000296312 +GGGCGT 6.7136E-05 9.87169E-05 +GGGCTA 8.83146E-05 0.000131381 +GGGCTC 0.000331868 0.000338949 +GGGCTG 0.000771217 0.000524366 +GGGCTT 0.000184253 0.000277386 +GGGGAA 0.000424524 0.000394276 +GGGGAC 0.000656853 0.000278219 +GGGGAG 0.000908878 0.000499875 +GGGGAT 0.000347222 0.000202434 +GGGGCA 0.00028284 0.000314405 +GGGGCC 0.000660241 0.000416724 +GGGGCG 0.000182771 0.00023456 +GGGGCT 0.000390109 0.000392851 +GGGGGA 0.000190289 0.00032204 +GGGGGC 0.000588128 0.000351639 +GGGGGG 0.000135966 0.000235555 +GGGGGT 0.000202573 0.000239157 +GGGGTA 7.93137E-05 0.000119605 +GGGGTC 0.000282204 0.000221683 +GGGGTG 0.000370625 0.000351854 +GGGGTT 0.000148568 0.000245314 +GGGTAA 3.49446E-06 0.00013052 +GGGTAC 0.000126542 9.12163E-05 +GGGTAG 3.60035E-06 0.000145226 +GGGTAT 9.30797E-05 0.000114471 +GGGTCA 0.000121777 0.00019082 +GGGTCC 0.00021708 0.000238404 +GGGTCG 4.81812E-05 7.26397E-05 +GGGTCT 0.000168687 0.000259159 +GGGTGA 6.88303E-06 0.00025897 +GGGTGC 8.31258E-05 0.000224291 +GGGTGG 0.000100704 0.000444844 +GGGTGT 6.84067E-05 0.000233915 +GGGTTA 6.04648E-05 0.000116863 +GGGTTC 0.000143167 0.000213483 +GGGTTG 0.000115 0.000199369 +GGGTTT 0.000155556 0.000318383 +GGTAAA 0.000185842 0.00019617 +GGTAAC 0.000103563 0.000109443 +GGTAAG 7.04187E-05 0.000115949 +GGTAAT 0.000106422 0.000141569 +GGTACA 0.000106952 0.00012845 +GGTACC 0.000125483 0.000102964 +GGTACG 1.53545E-05 2.43566E-05 +GGTACT 0.000103881 0.000115197 +GGTAGA 7.3066E-05 0.000163802 +GGTAGC 9.92215E-05 0.000115197 +GGTAGG 3.61094E-05 0.000152054 +GGTAGT 7.8043E-05 0.000106325 +GGTATA 6.04648E-05 0.000114014 +GGTATC 0.000117329 9.31788E-05 +GGTATG 9.15972E-05 0.000115008 +GGTATT 0.000139461 0.000180793 +GGTCAA 0.000123789 0.00013837 +GGTCAC 0.000138614 0.000182917 +GGTCAG 0.000252766 0.0002701 +GGTCAT 0.000140731 0.000159178 +GGTCCA 0.000168793 0.000161141 +GGTCCC 0.00024493 0.000258675 +GGTCCG 4.75459E-05 6.69941E-05 +GGTCCT 0.000248319 0.000229398 +GGTCGA 6.59712E-05 2.92763E-05 +GGTCGC 7.39131E-05 6.23164E-05 +GGTCGG 7.4019E-05 7.77207E-05 +GGTCGT 5.85587E-05 3.84168E-05 +GGTCTA 6.22649E-05 9.80985E-05 +GGTCTC 0.000179488 0.000279832 +GGTCTG 0.000254566 0.000259965 +GGTCTT 0.000165404 0.000241792 +GGTGAA 0.000439137 0.000273326 +GGTGAC 0.000391168 0.000226468 +GGTGAG 0.00039911 0.00027416 +GGTGAT 0.000341186 0.000214129 +GGTGCA 0.000227987 0.00022507 +GGTGCC 0.000399322 0.000268165 +GGTGCG 6.19473E-05 9.31519E-05 +GGTGCT 0.000323079 0.000282198 +GGTGGA 0.000338116 0.000329648 +GGTGGC 0.000475776 0.000376264 +GGTGGG 0.000292793 0.000489659 +GGTGGT 0.0002965 0.00026846 +GGTGTA 0.000121247 0.000117455 +GGTGTC 0.000273945 0.000203509 +GGTGTG 0.000424206 0.000326099 +GGTGTT 0.000238153 0.000227866 +GGTTAA 4.55339E-06 0.000157511 +GGTTAC 0.000142002 9.3609E-05 +GGTTAG 2.8591E-06 0.000109685 +GGTTAT 0.000181288 0.000143451 +GGTTCA 0.000138825 0.000223081 +GGTTCC 0.000186795 0.000208375 +GGTTCG 2.61555E-05 4.07825E-05 +GGTTCT 0.000208926 0.000241926 +GGTTGA 3.07089E-06 0.000164474 +GGTTGC 7.03128E-05 0.000180578 +GGTTGG 8.66203E-05 0.000223592 +GGTTGT 9.21267E-05 0.00018254 +GGTTTA 0.000115 0.000184368 +GGTTTC 0.000205008 0.000301366 +GGTTTG 0.000167628 0.000262331 +GGTTTT 0.000222057 0.000433392 +GTAAAA 0.000271403 0.000384463 +GTAAAC 0.000118176 0.00017305 +GTAAAG 0.000220045 0.000216279 +GTAAAT 0.000199608 0.000337713 +GTAACA 0.00015058 0.000190659 +GTAACC 0.000106952 0.000111863 +GTAACG 2.36141E-05 2.78515E-05 +GTAACT 0.000141896 0.000191788 +GTAAGA 9.10678E-05 0.000185686 +GTAAGC 7.3066E-05 0.0001099 +GTAAGG 5.58055E-05 0.000128289 +GTAAGT 6.01471E-05 0.000157108 +GTAATA 8.18551E-05 0.000207703 +GTAATC 7.81489E-05 0.000194073 +GTAATG 0.000126754 0.000177674 +GTAATT 0.000152274 0.000269993 +GTACAA 0.00013872 0.00015942 +GTACAC 8.42906E-05 0.000106379 +GTACAG 0.000238471 0.000193751 +GTACAT 0.000111082 0.000191788 +GTACCA 0.000128236 0.000133934 +GTACCC 0.000108964 0.000107158 +GTACCG 2.19198E-05 2.72601E-05 +GTACCT 0.000132366 0.000150092 +GTACGA 4.4475E-05 1.93294E-05 +GTACGC 3.62153E-05 1.79314E-05 +GTACGG 5.14639E-05 2.22866E-05 +GTACGT 3.37798E-05 3.29594E-05 +GTACTA 5.62291E-05 9.92277E-05 +GTACTC 6.93598E-05 0.000102185 +GTACTG 0.000145708 0.000164555 +GTACTT 9.63624E-05 0.000188723 +GTAGAA 0.000381002 0.00022464 +GTAGAC 0.000181077 0.000106244 +GTAGAG 0.000270238 0.000219048 +GTAGAT 0.000258484 0.00014415 +GTAGCA 0.00018203 0.000159635 +GTAGCC 0.00018203 0.000125359 +GTAGCG 2.59437E-05 3.40885E-05 +GTAGCT 0.000187324 0.000231872 +GTAGGA 0.000142743 0.000163829 +GTAGGC 9.1809E-05 9.92545E-05 +GTAGGG 8.86322E-05 0.000144392 +GTAGGT 7.23248E-05 0.000126676 +GTAGTA 8.51378E-05 0.000116514 +GTAGTC 6.42769E-05 0.000112616 +GTAGTG 0.000149732 0.000136381 +GTAGTT 0.00010314 0.000175981 +GTATAA 5.61232E-06 0.000211306 +GTATAC 7.47603E-05 0.000109309 +GTATAG 4.4475E-06 0.000116863 +GTATAT 0.000116694 0.000274805 +GTATCA 0.000105893 0.000149124 +GTATCC 0.000103881 0.000111755 +GTATCG 2.09668E-05 2.08886E-05 +GTATCT 0.000142743 0.000192514 +GTATGA 8.36553E-06 0.000154474 +GTATGC 5.55937E-05 0.000104147 +GTATGG 7.37014E-05 0.000127294 +GTATGT 8.32317E-05 0.000240958 +GTATTA 8.9903E-05 0.000214505 +GTATTC 9.10678E-05 0.000167647 +GTATTG 9.74213E-05 0.00017141 +GTATTT 0.000208503 0.000533399 +GTCAAA 0.000317467 0.000208994 +GTCAAC 0.000425583 0.000112159 +GTCAAG 0.000523957 0.000182164 +GTCAAT 0.000280616 0.000131569 +GTCACA 0.000304653 0.000232705 +GTCACC 0.000581987 0.000231146 +GTCACG 0.000133001 6.01388E-05 +GTCACT 0.00031249 0.000237705 +GTCAGA 0.000168899 0.000235877 +GTCAGC 0.000442949 0.000212865 +GTCAGG 0.000175253 0.00027631 +GTCAGT 0.000239106 0.00020281 +GTCATA 0.000117647 0.000140037 +GTCATC 0.000703446 0.000183239 +GTCATG 0.000405463 0.000186169 +GTCATT 0.000364801 0.000266579 +GTCCAA 0.00014232 0.000157458 +GTCCAC 0.000281887 0.00016184 +GTCCAG 0.000527875 0.000270154 +GTCCAT 0.000178429 0.000161759 +GTCCCA 0.000222269 0.000276257 +GTCCCC 0.000299041 0.000297683 +GTCCCG 9.9751E-05 0.000104685 +GTCCCT 0.000257849 0.00029236 +GTCCGA 0.000107693 4.01104E-05 +GTCCGC 0.000176947 7.09998E-05 +GTCCGG 0.000174299 8.15113E-05 +GTCCGT 8.00549E-05 5.1993E-05 +GTCCTA 0.000121035 0.000128773 +GTCCTC 0.000410864 0.00026674 +GTCCTG 0.000739131 0.000339218 +GTCCTT 0.000227246 0.000260046 +GTCGAA 4.90283E-05 2.57546E-05 +GTCGAC 8.06903E-05 2.21253E-05 +GTCGAG 9.31856E-05 4.42237E-05 +GTCGAT 6.04648E-05 2.08349E-05 +GTCGCA 4.33101E-05 3.45724E-05 +GTCGCC 0.000121035 9.27218E-05 +GTCGCG 3.54741E-05 4.14815E-05 +GTCGCT 5.42171E-05 5.8714E-05 +GTCGGA 4.46867E-05 4.62668E-05 +GTCGGC 8.87381E-05 7.35806E-05 +GTCGGG 9.43505E-05 8.69956E-05 +GTCGGT 3.75919E-05 4.38204E-05 +GTCGTA 2.68968E-05 1.99208E-05 +GTCGTC 0.000110976 4.15622E-05 +GTCGTG 0.000157568 5.58643E-05 +GTCGTT 3.92862E-05 3.77985E-05 +GTCTAA 9.95392E-06 0.000127025 +GTCTAC 0.000322338 0.000103932 +GTCTAG 6.98892E-06 0.000113906 +GTCTAT 0.000205644 0.000129956 +GTCTCA 0.000184465 0.000306958 +GTCTCC 0.000395615 0.000313786 +GTCTCG 6.40651E-05 9.26412E-05 +GTCTCT 0.000245777 0.00034852 +GTCTGA 2.13903E-05 0.000232947 +GTCTGC 0.000285593 0.000249938 +GTCTGG 0.00022301 0.000286419 +GTCTGT 0.00019982 0.000311501 +GTCTTA 0.000108117 0.000176169 +GTCTTC 0.000551807 0.000278434 +GTCTTG 0.000216021 0.000274106 +GTCTTT 0.000313443 0.0003568 +GTGAAA 0.000607401 0.000415729 +GTGAAC 0.000459257 0.000195471 +GTGAAG 0.000984273 0.000321152 +GTGAAT 0.000412664 0.00027209 +GTGACA 0.000375813 0.00027424 +GTGACC 0.00055329 0.000224452 +GTGACG 0.000162439 7.26666E-05 +GTGACT 0.000367342 0.000276848 +GTGAGA 0.000202043 0.000316502 +GTGAGC 0.000397733 0.000316824 +GTGAGG 0.000269921 0.000324217 +GTGAGT 0.000192513 0.000211359 +GTGATA 0.000145391 0.000168668 +GTGATC 0.000432042 0.000205714 +GTGATG 0.000522157 0.000273461 +GTGATT 0.000353152 0.000290613 +GTGCAA 0.000212209 0.000202622 +GTGCAC 0.000376131 0.000183777 +GTGCAG 0.000908348 0.000351639 +GTGCAT 0.000189124 0.000213322 +GTGCCA 0.000320114 0.000289188 +GTGCCC 0.000673054 0.0002833 +GTGCCG 0.000158204 8.82591E-05 +GTGCCT 0.000418806 0.000342364 +GTGCGA 0.000105575 4.80411E-05 +GTGCGC 0.000316937 8.44416E-05 +GTGCGG 0.000343093 0.00010119 +GTGCGT 0.000100175 6.90104E-05 +GTGCTA 0.000167522 0.000159501 +GTGCTC 0.000496213 0.000225258 +GTGCTG 0.001335414 0.000434386 +GTGCTT 0.000265897 0.000286822 +GTGGAA 0.000826917 0.000341288 +GTGGAC 0.000999945 0.000202085 +GTGGAG 0.001508019 0.00039105 +GTGGAT 0.000759357 0.000238189 +GTGGCA 0.000503944 0.000319889 +GTGGCC 0.001212472 0.000329298 +GTGGCG 0.000266003 0.000141946 +GTGGCT 0.000687879 0.000398201 +GTGGGA 0.00035114 0.000365833 +GTGGGC 0.000769523 0.000290478 +GTGGGG 0.000442102 0.000430273 +GTGGGT 0.000255731 0.000259266 +GTGGTA 0.000236353 0.000160388 +GTGGTC 0.000574998 0.00019238 +GTGGTG 0.001182293 0.000373334 +GTGGTT 0.000341504 0.000259669 +GTGTAA 1.01657E-05 0.000207031 +GTGTAC 0.000331656 0.000133477 +GTGTAG 9.63624E-06 0.000147242 +GTGTAT 0.000234658 0.000251201 +GTGTCA 0.000238788 0.000222489 +GTGTCC 0.000489225 0.00025311 +GTGTCG 0.00011267 4.97886E-05 +GTGTCT 0.00036893 0.0003254 +GTGTGA 3.10266E-05 0.000315399 +GTGTGC 0.000330491 0.000266498 +GTGTGG 0.000316513 0.00035266 +GTGTGT 0.000253931 0.000596683 +GTGTTA 0.000127283 0.000207811 +GTGTTC 0.000410546 0.000243136 +GTGTTG 0.000257531 0.000263164 +GTGTTT 0.000411287 0.000463797 +GTTAAA 0.000234552 0.000303006 +GTTAAC 0.000120718 0.000134849 +GTTAAG 0.000158733 0.000167781 +GTTAAT 0.000174088 0.000231737 +GTTACA 0.000147191 0.000180255 +GTTACC 0.000138084 0.000123611 +GTTACG 2.36141E-05 2.61041E-05 +GTTACT 0.000156827 0.000186922 +GTTAGA 7.46544E-05 0.000158184 +GTTAGC 7.68781E-05 0.000107642 +GTTAGG 4.89225E-05 0.000127563 +GTTAGT 8.74674E-05 0.000123934 +GTTATA 9.14913E-05 0.000176572 +GTTATC 0.000133319 0.000122133 +GTTATG 0.000137449 0.000158829 +GTTATT 0.000220786 0.000292656 +GTTCAA 0.000199714 0.000256417 +GTTCAC 0.000176206 0.000176007 +GTTCAG 0.000372531 0.000235931 +GTTCAT 0.000200984 0.000235071 +GTTCCA 0.000250013 0.000228377 +GTTCCC 0.000198125 0.00023663 +GTTCCG 4.00275E-05 5.73967E-05 +GTTCCT 0.000293535 0.000298678 +GTTCGA 0.000118918 4.00029E-05 +GTTCGC 7.46544E-05 3.22873E-05 +GTTCGG 8.84205E-05 4.58904E-05 +GTTCGT 8.54555E-05 3.98416E-05 +GTTCTA 0.000101233 0.00017348 +GTTCTC 0.00019929 0.000260825 +GTTCTG 0.000303383 0.000329836 +GTTCTT 0.000240271 0.000340079 +GTTGAA 0.000397733 0.000267385 +GTTGAC 0.000233599 0.000128719 +GTTGAG 0.000258272 0.000196654 +GTTGAT 0.000319478 0.000183347 +GTTGCA 0.000223963 0.000223645 +GTTGCC 0.000248319 0.000214801 +GTTGCG 3.33562E-05 4.02718E-05 +GTTGCT 0.000291417 0.000248217 +GTTGGA 0.000302747 0.000231495 +GTTGGC 0.000247154 0.00019496 +GTTGGG 0.000201196 0.000247195 +GTTGGT 0.000204902 0.000193858 +GTTGTA 0.000146979 0.000192917 +GTTGTC 0.000196219 0.000167109 +GTTGTG 0.000296394 0.000226603 +GTTGTT 0.000226187 0.000297602 +GTTTAA 9.42446E-06 0.000321072 +GTTTAC 0.000133319 0.00018953 +GTTTAG 4.4475E-06 0.000173346 +GTTTAT 0.000188171 0.000328841 +GTTTCA 0.000201937 0.000349058 +GTTTCC 0.000212633 0.000340267 +GTTTCG 2.95441E-05 4.91702E-05 +GTTTCT 0.000300418 0.000468233 +GTTTGA 7.83606E-06 0.000289 +GTTTGC 0.000106528 0.000245179 +GTTTGG 0.000110658 0.000297172 +GTTTGT 0.000128236 0.000380995 +GTTTTA 0.0001761 0.000465733 +GTTTTC 0.000205326 0.000444952 +GTTTTG 0.00023487 0.000479067 +GTTTTT 0.000233917 0.000721343 +TAAAAA 1.05893E-07 0.000972275 +TAAAAC 0 0.000401562 +TAAAAG 0 0.00048189 +TAAAAT 0 0.000828205 +TAAACA 1.05893E-07 0.000376855 +TAAACC 0 0.000195794 +TAAACG 1.05893E-07 5.07564E-05 +TAAACT 0 0.000327497 +TAAAGA 2.11786E-07 0.000444871 +TAAAGC 1.05893E-07 0.000258245 +TAAAGG 3.17678E-07 0.000283273 +TAAAGT 0 0.000361048 +TAAATA 0 0.000616685 +TAAATC 0 0.000259911 +TAAATG 0 0.00049345 +TAAATT 0 0.000528452 +TAACAA 0 0.000263514 +TAACAC 0 0.000166437 +TAACAG 0 0.000216467 +TAACAT 0 0.00026967 +TAACCA 1.05893E-07 0.00019531 +TAACCC 0 0.000130977 +TAACCG 0 2.6588E-05 +TAACCT 0 0.000187648 +TAACGA 0 3.04861E-05 +TAACGC 0 2.55933E-05 +TAACGG 0 3.11851E-05 +TAACGT 0 4.48957E-05 +TAACTA 0 0.000170873 +TAACTC 0 0.000161786 +TAACTG 0 0.000243405 +TAACTT 1.05893E-07 0.00030271 +TAAGAA 0 0.000385808 +TAAGAC 0 0.000162243 +TAAGAG 2.11786E-07 0.000231227 +TAAGAT 0 0.000234748 +TAAGCA 0 0.000226414 +TAAGCC 0 0.000160979 +TAAGCG 1.05893E-07 2.93301E-05 +TAAGCT 0 0.000185202 +TAAGGA 0 0.000250368 +TAAGGC 0 0.000136919 +TAAGGG 0 0.000159313 +TAAGGT 0 0.000153425 +TAAGTA 0 0.000211843 +TAAGTC 0 0.000138989 +TAAGTG 0 0.000224532 +TAAGTT 0 0.000241765 +TAATAA 0 0.000479228 +TAATAC 0 0.000178051 +TAATAG 0 0.000190014 +TAATAT 0 0.000363548 +TAATCA 0 0.00022335 +TAATCC 0 0.000228753 +TAATCG 0 2.74751E-05 +TAATCT 0 0.000232598 +TAATGA 2.11786E-07 0.000304377 +TAATGC 1.05893E-07 0.000175658 +TAATGG 0 0.000202569 +TAATGT 0 0.000318679 +TAATTA 0 0.000327121 +TAATTC 1.05893E-07 0.000247679 +TAATTG 0 0.000255207 +TAATTT 0 0.000679781 +TACAAA 0.000433419 0.000397179 +TACAAC 0.00043289 0.000141381 +TACAAG 0.000581457 0.000193321 +TACAAT 0.000280616 0.000220446 +TACACA 0.000271085 0.000255422 +TACACC 0.000352199 0.000113315 +TACACG 0.000169005 3.7664E-05 +TACACT 0.000188807 0.000173023 +TACAGA 0.00025446 0.000318625 +TACAGC 0.000461904 0.000193885 +TACAGG 0.000217716 0.00028494 +TACAGT 0.000243024 0.00027166 +TACATA 0.000114894 0.000263863 +TACATC 0.000501614 0.000151973 +TACATG 0.000390533 0.0002312 +TACATT 0.000279451 0.000344918 +TACCAA 0.000191031 0.000189396 +TACCAC 0.000313019 0.000149823 +TACCAG 0.000639169 0.000188455 +TACCAT 0.000180335 0.000183965 +TACCCA 0.000244189 0.000194503 +TACCCC 0.000255943 0.000139311 +TACCCG 0.000123047 3.97878E-05 +TACCCT 0.000203526 0.000172432 +TACCGA 0.000137025 2.7045E-05 +TACCGC 0.000275109 2.86849E-05 +TACCGG 0.000231058 3.04592E-05 +TACCGT 8.61967E-05 3.30669E-05 +TACCTA 0.000119129 0.000152215 +TACCTC 0.000327738 0.000185524 +TACCTG 0.000824163 0.000244991 +TACCTT 0.000190289 0.000237329 +TACGAA 0.000115211 3.48412E-05 +TACGAC 0.00020342 1.90605E-05 +TACGAG 0.000306771 2.78784E-05 +TACGAT 0.000113411 2.73407E-05 +TACGCA 6.45946E-05 2.83085E-05 +TACGCC 0.000187324 2.60772E-05 +TACGCG 7.93137E-05 1.30117E-05 +TACGCT 5.97235E-05 2.80666E-05 +TACGGA 7.6031E-05 3.70995E-05 +TACGGC 0.000190713 2.7959E-05 +TACGGG 0.000144332 3.06743E-05 +TACGGT 5.77116E-05 2.91688E-05 +TACGTA 3.71684E-05 3.93308E-05 +TACGTC 0.000132154 2.5889E-05 +TACGTG 0.000291629 5.26651E-05 +TACGTT 5.337E-05 4.66163E-05 +TACTAA 8.89499E-06 0.000224963 +TACTAC 0.000357176 0.000120681 +TACTAG 6.98892E-06 0.000105841 +TACTAT 0.000227669 0.000175174 +TACTCA 0.000164981 0.000195364 +TACTCC 0.00027098 0.000144688 +TACTCG 0.000101022 4.05944E-05 +TACTCT 0.000152591 0.000205714 +TACTGA 2.14962E-05 0.000245206 +TACTGC 0.000305395 0.000177836 +TACTGG 0.000274262 0.000194208 +TACTGT 0.000207126 0.00029365 +TACTTA 9.56212E-05 0.000214881 +TACTTC 0.000438608 0.000207542 +TACTTG 0.000214751 0.000238082 +TACTTT 0.00027638 0.000409438 +TAGAAA 0 0.000455463 +TAGAAC 0 0.000171249 +TAGAAG 1.05893E-07 0.000279321 +TAGAAT 0 0.000287763 +TAGACA 2.11786E-07 0.000188455 +TAGACC 0 0.000105814 +TAGACG 0 3.08625E-05 +TAGACT 0 0.000168776 +TAGAGA 1.05893E-07 0.00032005 +TAGAGC 0 0.000157323 +TAGAGG 1.05893E-07 0.000208456 +TAGAGT 0 0.000180309 +TAGATA 0 0.000179153 +TAGATC 0 0.000110384 +TAGATG 1.05893E-07 0.000198348 +TAGATT 0 0.000231925 +TAGCAA 0 0.000205069 +TAGCAC 0 0.000135252 +TAGCAG 1.05893E-07 0.000208241 +TAGCAT 1.05893E-07 0.000188992 +TAGCCA 1.05893E-07 0.000211897 +TAGCCC 2.11786E-07 0.000130977 +TAGCCG 2.11786E-07 5.08639E-05 +TAGCCT 2.11786E-07 0.000181277 +TAGCGA 0 2.72332E-05 +TAGCGC 0 3.06743E-05 +TAGCGG 1.05893E-07 3.92771E-05 +TAGCGT 0 2.9115E-05 +TAGCTA 0 0.000144446 +TAGCTC 0 0.000155307 +TAGCTG 0 0.000295075 +TAGCTT 0 0.000210311 +TAGGAA 0 0.000296715 +TAGGAC 0 0.000127939 +TAGGAG 1.05893E-07 0.000218349 +TAGGAT 1.05893E-07 0.000175577 +TAGGCA 1.05893E-07 0.000167216 +TAGGCC 0 0.000124713 +TAGGCG 0 3.85781E-05 +TAGGCT 0 0.000158452 +TAGGGA 0 0.000191949 +TAGGGC 0 0.000125305 +TAGGGG 0 0.000144822 +TAGGGT 0 0.000129257 +TAGGTA 0 0.000135171 +TAGGTC 0 9.65124E-05 +TAGGTG 0 0.000164689 +TAGGTT 0 0.000161168 +TAGTAA 0 0.000191949 +TAGTAC 0 9.19422E-05 +TAGTAG 0 0.000163695 +TAGTAT 0 0.000179986 +TAGTCA 0 0.000151543 +TAGTCC 0 0.000131246 +TAGTCG 0 2.17489E-05 +TAGTCT 0 0.000161625 +TAGTGA 1.05893E-07 0.000187352 +TAGTGC 0 0.000119847 +TAGTGG 1.05893E-07 0.000155468 +TAGTGT 1.05893E-07 0.000179287 +TAGTTA 1.05893E-07 0.000173265 +TAGTTC 0 0.000158372 +TAGTTG 0 0.000165146 +TAGTTT 0 0.000342606 +TATAAA 0.000320537 0.000524769 +TATAAC 0.000165616 0.000158802 +TATAAG 0.000238259 0.000194423 +TATAAT 0.000221845 0.000359489 +TATACA 0.00013999 0.000255126 +TATACC 0.000131942 0.000123557 +TATACG 3.04971E-05 2.63729E-05 +TATACT 0.00013586 0.000207945 +TATAGA 0.000117435 0.000218699 +TATAGC 0.000114894 0.000128477 +TATAGG 7.94196E-05 0.000135682 +TATAGT 0.00010674 0.000193213 +TATATA 8.86322E-05 0.000546223 +TATATC 0.000163287 0.000172244 +TATATG 0.000153333 0.000286069 +TATATT 0.00020935 0.000518344 +TATCAA 0.000154921 0.000211978 +TATCAC 0.000130672 0.000145441 +TATCAG 0.000299994 0.000196762 +TATCAT 0.000134484 0.000209935 +TATCCA 0.000196008 0.000192487 +TATCCC 0.000117859 0.000137806 +TATCCG 3.22973E-05 2.42222E-05 +TATCCT 0.000185101 0.000198536 +TATCGA 8.21728E-05 2.48405E-05 +TATCGC 6.85126E-05 2.14263E-05 +TATCGG 8.07962E-05 2.11037E-05 +TATCGT 5.61232E-05 2.78246E-05 +TATCTA 6.70301E-05 0.000181035 +TATCTC 0.000148568 0.000183777 +TATCTG 0.000232435 0.000262385 +TATCTT 0.000164134 0.000302952 +TATGAA 0.00072833 0.000340159 +TATGAC 0.00048573 0.000139311 +TATGAG 0.000628156 0.000183911 +TATGAT 0.000489436 0.000219371 +TATGCA 0.000297982 0.000224936 +TATGCC 0.000353682 0.00014122 +TATGCG 6.70301E-05 2.32813E-05 +TATGCT 0.000298935 0.000197595 +TATGGA 0.000385132 0.000223296 +TATGGC 0.000347328 0.000135628 +TATGGG 0.000285381 0.000150011 +TATGGT 0.00021888 0.000168722 +TATGTA 0.000152909 0.000335804 +TATGTC 0.000252766 0.000168426 +TATGTG 0.000430666 0.00030107 +TATGTT 0.000232117 0.000349111 +TATTAA 8.36553E-06 0.00042487 +TATTAC 0.000169005 0.000186734 +TATTAG 4.12982E-06 0.000191089 +TATTAT 0.000177794 0.000396131 +TATTCA 0.000160428 0.00031263 +TATTCC 0.000167628 0.000218403 +TATTCG 2.61555E-05 3.01635E-05 +TATTCT 0.000191984 0.000361639 +TATTGA 6.77714E-06 0.000263917 +TATTGC 8.36553E-05 0.000188992 +TATTGG 9.10678E-05 0.000194288 +TATTGT 8.61967E-05 0.000322658 +TATTTA 0.000130248 0.000621658 +TATTTC 0.000220892 0.00045342 +TATTTG 0.000175782 0.000476002 +TATTTT 0.00027225 0.001195786 +TCAAAA 0.000309525 0.000475115 +TCAAAC 0.000170699 0.000227355 +TCAAAG 0.000295653 0.000329943 +TCAAAT 0.00026039 0.000362419 +TCAACA 0.000205114 0.000248056 +TCAACC 0.000131307 0.000154635 +TCAACG 3.93921E-05 3.84705E-05 +TCAACT 0.000181394 0.000218484 +TCAAGA 0.000190078 0.000338707 +TCAAGC 0.000164769 0.000239265 +TCAAGG 0.000125377 0.000258648 +TCAAGT 0.000196008 0.000276042 +TCAATA 8.57731E-05 0.000232624 +TCAATC 7.78312E-05 0.000135548 +TCAATG 0.000141367 0.000200015 +TCAATT 0.00012453 0.000226629 +TCACAA 0.000175041 0.000254131 +TCACAC 0.000136708 0.000256551 +TCACAG 0.000321067 0.000365376 +TCACAT 0.000135225 0.000292091 +TCACCA 0.000257849 0.000328895 +TCACCC 0.000217821 0.000287521 +TCACCG 6.08883E-05 8.53019E-05 +TCACCT 0.000248319 0.000354757 +TCACGA 4.73341E-05 5.3149E-05 +TCACGC 4.84989E-05 9.11357E-05 +TCACGG 7.5078E-05 7.11073E-05 +TCACGT 4.30984E-05 7.72099E-05 +TCACTA 8.41847E-05 0.000172835 +TCACTC 0.000140096 0.00026631 +TCACTG 0.000312807 0.000449173 +TCACTT 0.000148144 0.000367822 +TCAGAA 0.000649546 0.000473368 +TCAGAC 0.000396568 0.000226925 +TCAGAG 0.000634933 0.000411428 +TCAGAT 0.000510615 0.00029771 +TCAGCA 0.000342457 0.000368038 +TCAGCC 0.00044189 0.000447748 +TCAGCG 7.73017E-05 8.75601E-05 +TCAGCT 0.000356435 0.000387609 +TCAGGA 0.00037539 0.00043151 +TCAGGC 0.000282522 0.000288327 +TCAGGG 0.000289934 0.000328519 +TCAGGT 0.000181818 0.000243432 +TCAGTA 0.000155556 0.000236496 +TCAGTC 0.000192831 0.000234936 +TCAGTG 0.000392015 0.000377581 +TCAGTT 0.000216551 0.000341235 +TCATAA 7.73017E-06 0.000250556 +TCATAC 9.53035E-05 0.000142107 +TCATAG 5.08285E-06 0.00017469 +TCATAT 0.00012453 0.000254965 +TCATCA 0.000251495 0.000281875 +TCATCC 0.000235823 0.000245475 +TCATCG 4.87107E-05 4.86057E-05 +TCATCT 0.000285275 0.000374167 +TCATGA 1.14364E-05 0.00027338 +TCATGC 6.88303E-05 0.000216521 +TCATGG 0.000108328 0.000259616 +TCATGT 7.68781E-05 0.000304834 +TCATTA 0.000119553 0.000272036 +TCATTC 0.000130989 0.00031255 +TCATTG 0.000143696 0.000287037 +TCATTT 0.000232858 0.000621873 +TCCAAA 0.00046614 0.000375081 +TCCAAC 0.000419018 0.00017883 +TCCAAG 0.000665748 0.000313356 +TCCAAT 0.000246836 0.000179395 +TCCACA 0.000319902 0.000301608 +TCCACC 0.000457774 0.000332766 +TCCACG 0.000186371 9.1055E-05 +TCCACT 0.000261555 0.000271982 +TCCAGA 0.000254037 0.000427209 +TCCAGC 0.000652194 0.000462856 +TCCAGG 0.000315772 0.000464873 +TCCAGT 0.000369778 0.000312899 +TCCATA 0.000129613 0.000187729 +TCCATC 0.000578704 0.000303355 +TCCATG 0.000514957 0.000296635 +TCCATT 0.000311113 0.000336369 +TCCCAA 0.000200349 0.000390002 +TCCCAC 0.000309948 0.000343305 +TCCCAG 0.000758192 0.000668436 +TCCCAT 0.000188066 0.000291204 +TCCCCA 0.000417429 0.000499687 +TCCCCC 0.000275851 0.000359354 +TCCCCG 0.000211362 0.00019082 +TCCCCT 0.000298088 0.000441027 +TCCCGA 0.000129189 9.89857E-05 +TCCCGC 0.000211574 0.000153694 +TCCCGG 0.000271297 0.000195686 +TCCCGT 7.42308E-05 8.31243E-05 +TCCCTA 0.000114258 0.000198052 +TCCCTC 0.00037486 0.000463044 +TCCCTG 0.000852013 0.00055453 +TCCCTT 0.000216868 0.000427908 +TCCGAA 9.17031E-05 5.16704E-05 +TCCGAC 0.00016964 3.90082E-05 +TCCGAG 0.000262085 9.22379E-05 +TCCGAT 7.71958E-05 3.16152E-05 +TCCGCA 5.66526E-05 7.07041E-05 +TCCGCC 0.000155133 0.000160469 +TCCGCG 6.93598E-05 7.85003E-05 +TCCGCT 5.85587E-05 7.79089E-05 +TCCGGA 7.14776E-05 8.83129E-05 +TCCGGC 0.00014179 0.000112938 +TCCGGG 0.000135649 0.000131058 +TCCGGT 4.53221E-05 5.92247E-05 +TCCGTA 2.68968E-05 3.62661E-05 +TCCGTC 0.000106528 8.35007E-05 +TCCGTG 0.000259225 0.000100464 +TCCGTT 4.70164E-05 5.94129E-05 +TCCTAA 1.36602E-05 0.000242249 +TCCTAC 0.000399322 0.000167458 +TCCTAG 1.84253E-05 0.000210687 +TCCTAT 0.000252554 0.000187809 +TCCTCA 0.000335151 0.000398416 +TCCTCC 0.000565467 0.000568912 +TCCTCG 0.000166463 0.000106432 +TCCTCT 0.000373272 0.000497025 +TCCTGA 2.94382E-05 0.000464711 +TCCTGC 0.000363848 0.000530173 +TCCTGG 0.000391591 0.000599694 +TCCTGT 0.000235188 0.00043065 +TCCTTA 0.000146556 0.000246039 +TCCTTC 0.000556784 0.000458071 +TCCTTG 0.00033801 0.000370914 +TCCTTT 0.00033928 0.000546303 +TCGAAA 4.61692E-05 4.04331E-05 +TCGAAC 3.36739E-05 3.93846E-05 +TCGAAG 7.17953E-05 4.81218E-05 +TCGAAT 3.38857E-05 3.73414E-05 +TCGACA 3.16619E-05 2.97602E-05 +TCGACC 4.99814E-05 3.33626E-05 +TCGACG 2.03314E-05 1.58883E-05 +TCGACT 3.1556E-05 3.58091E-05 +TCGAGA 3.02853E-05 7.23171E-05 +TCGAGC 6.15237E-05 4.44118E-05 +TCGAGG 4.52162E-05 7.21289E-05 +TCGAGT 3.32503E-05 4.27182E-05 +TCGATA 1.26012E-05 1.91412E-05 +TCGATC 2.55202E-05 3.15614E-05 +TCGATG 4.75459E-05 3.6293E-05 +TCGATT 2.59437E-05 3.78253E-05 +TCGCAA 2.14962E-05 2.89E-05 +TCGCAC 6.34298E-05 4.46807E-05 +TCGCAG 0.000130566 7.3258E-05 +TCGCAT 2.40377E-05 3.14808E-05 +TCGCCA 7.71958E-05 7.72368E-05 +TCGCCC 0.000150156 0.000106782 +TCGCCG 6.85126E-05 7.09998E-05 +TCGCCT 6.9148E-05 9.26949E-05 +TCGCGA 1.45073E-05 2.16682E-05 +TCGCGC 5.05108E-05 5.88215E-05 +TCGCGG 5.42171E-05 5.97355E-05 +TCGCGT 1.186E-05 2.80128E-05 +TCGCTA 2.01196E-05 2.9814E-05 +TCGCTC 9.32915E-05 9.32864E-05 +TCGCTG 0.000271721 0.00010732 +TCGCTT 3.8545E-05 7.53818E-05 +TCGGAA 0.0001168 5.91979E-05 +TCGGAC 0.000178535 4.49764E-05 +TCGGAG 0.000289405 9.10281E-05 +TCGGAT 0.000111293 4.07825E-05 +TCGGCA 8.31258E-05 6.31766E-05 +TCGGCC 0.000246307 0.000124498 +TCGGCG 9.3821E-05 6.22088E-05 +TCGGCT 0.000105787 0.000107588 +TCGGGA 8.46083E-05 9.87438E-05 +TCGGGC 0.000181818 8.66999E-05 +TCGGGG 0.000142955 0.000119417 +TCGGGT 5.48525E-05 5.62675E-05 +TCGGTA 2.8591E-05 2.71525E-05 +TCGGTC 8.27022E-05 4.77992E-05 +TCGGTG 0.000231799 7.27741E-05 +TCGGTT 4.12982E-05 5.16167E-05 +TCGTAA 1.58839E-06 3.2126E-05 +TCGTAC 3.61094E-05 2.20715E-05 +TCGTAG 1.4825E-06 3.15614E-05 +TCGTAT 2.50966E-05 3.18303E-05 +TCGTCA 3.9498E-05 4.40355E-05 +TCGTCC 0.000102081 5.86602E-05 +TCGTCG 3.89685E-05 2.11306E-05 +TCGTCT 5.97235E-05 6.3795E-05 +TCGTGA 3.17678E-06 6.51123E-05 +TCGTGC 4.01334E-05 5.90097E-05 +TCGTGG 6.3218E-05 7.97101E-05 +TCGTGT 2.79557E-05 6.52467E-05 +TCGTTA 1.94843E-05 3.33626E-05 +TCGTTC 4.3416E-05 4.82831E-05 +TCGTTG 3.68507E-05 4.42237E-05 +TCGTTT 4.8393E-05 8.02478E-05 +TCTAAA 0.000244506 0.000343412 +TCTAAC 0.000122836 0.000144392 +TCTAAG 0.00021708 0.000208994 +TCTAAT 0.000163181 0.000240421 +TCTACA 0.000196855 0.000228484 +TCTACC 0.000164451 0.000178185 +TCTACG 3.9498E-05 3.37121E-05 +TCTACT 0.000180018 0.000256121 +TCTAGA 0.000119659 0.000228915 +TCTAGC 0.000124318 0.000151731 +TCTAGG 8.12197E-05 0.000186385 +TCTAGT 0.000133107 0.00017176 +TCTATA 8.33376E-05 0.000208026 +TCTATC 0.00012866 0.000148452 +TCTATG 0.000152274 0.000193616 +TCTATT 0.000146344 0.000294027 +TCTCAA 0.000220681 0.000350133 +TCTCAC 0.000163393 0.000294 +TCTCAG 0.000469317 0.000456377 +TCTCAT 0.000200984 0.000328653 +TCTCCA 0.000420394 0.000457157 +TCTCCC 0.000284957 0.000476352 +TCTCCG 8.7891E-05 0.000114686 +TCTCCT 0.00039678 0.000564961 +TCTCGA 0.000107163 6.92524E-05 +TCTCGC 8.73615E-05 9.06518E-05 +TCTCGG 0.000146873 0.000116863 +TCTCGT 6.93598E-05 6.08378E-05 +TCTCTA 0.00013279 0.000309404 +TCTCTC 0.000233494 0.000502725 +TCTCTG 0.000471858 0.000559181 +TCTCTT 0.000236353 0.000501811 +TCTGAA 0.000642134 0.000470626 +TCTGAC 0.000396992 0.000245529 +TCTGAG 0.000669878 0.000429494 +TCTGAT 0.00046201 0.00030271 +TCTGCA 0.000400381 0.000436241 +TCTGCC 0.000460422 0.000500198 +TCTGCG 9.71037E-05 9.90664E-05 +TCTGCT 0.000436172 0.000461915 +TCTGGA 0.000459257 0.000436403 +TCTGGC 0.000344469 0.000326664 +TCTGGG 0.000393921 0.000470061 +TCTGGT 0.000246095 0.000286311 +TCTGTA 0.000189124 0.000367231 +TCTGTC 0.000327526 0.000406212 +TCTGTG 0.00062985 0.00053641 +TCTGTT 0.000292052 0.000495009 +TCTTAA 1.16482E-05 0.000360134 +TCTTAC 0.000152486 0.00019902 +TCTTAG 5.50642E-06 0.000221575 +TCTTAT 0.00013406 0.000271041 +TCTTCA 0.000370731 0.000449818 +TCTTCC 0.000356753 0.000500682 +TCTTCG 6.96774E-05 6.78275E-05 +TCTTCT 0.000388203 0.000513559 +TCTTGA 1.05893E-05 0.000334541 +TCTTGC 9.5833E-05 0.000292683 +TCTTGG 0.000153862 0.000387958 +TCTTGT 0.000116482 0.000338923 +TCTTTA 0.000165828 0.000399814 +TCTTTC 0.000217821 0.000501676 +TCTTTG 0.000275427 0.000470169 +TCTTTT 0.000243236 0.000781374 +TGAAAA 5.29464E-07 0.000690238 +TGAAAC 1.05893E-07 0.000368683 +TGAAAG 5.29464E-07 0.000439521 +TGAAAT 0 0.00057394 +TGAACA 1.05893E-07 0.000328357 +TGAACC 1.05893E-07 0.000232732 +TGAACG 2.11786E-07 5.5246E-05 +TGAACT 2.11786E-07 0.000331771 +TGAAGA 8.47142E-07 0.000541007 +TGAAGC 2.11786E-07 0.000319781 +TGAAGG 4.23571E-07 0.000363817 +TGAAGT 1.05893E-07 0.000360214 +TGAATA 1.05893E-07 0.00035551 +TGAATC 1.05893E-07 0.000224774 +TGAATG 1.05893E-07 0.000385861 +TGAATT 0 0.000438392 +TGACAA 5.29464E-07 0.00026881 +TGACAC 1.05893E-07 0.000211413 +TGACAG 7.41249E-07 0.000317093 +TGACAT 3.17678E-07 0.000292414 +TGACCA 3.17678E-07 0.00026432 +TGACCC 0 0.000238136 +TGACCG 0 6.0542E-05 +TGACCT 5.29464E-07 0.0003361 +TGACGA 0 4.56216E-05 +TGACGC 4.23571E-07 5.51384E-05 +TGACGG 4.23571E-07 6.20744E-05 +TGACGT 2.11786E-07 6.54618E-05 +TGACTA 4.23571E-07 0.000170012 +TGACTC 2.11786E-07 0.000246443 +TGACTG 4.23571E-07 0.000325131 +TGACTT 0 0.000372957 +TGAGAA 3.17678E-07 0.000503289 +TGAGAC 0 0.000323115 +TGAGAG 2.11786E-07 0.000366075 +TGAGAT 4.23571E-07 0.000344461 +TGAGCA 3.17678E-07 0.000326906 +TGAGCC 0 0.000417315 +TGAGCG 0 8.72913E-05 +TGAGCT 1.05893E-07 0.000352337 +TGAGGA 5.29464E-07 0.000437559 +TGAGGC 1.05893E-06 0.000399169 +TGAGGG 6.35357E-07 0.000343009 +TGAGGT 9.53035E-07 0.000300398 +TGAGTA 1.05893E-07 0.000210795 +TGAGTC 2.11786E-07 0.00022464 +TGAGTG 4.23571E-07 0.000303786 +TGAGTT 1.05893E-07 0.000304538 +TGATAA 1.05893E-07 0.000271902 +TGATAC 3.17678E-07 0.000155791 +TGATAG 0 0.000160522 +TGATAT 0 0.000246281 +TGATCA 2.11786E-07 0.000220876 +TGATCC 1.05893E-07 0.000205042 +TGATCG 0 3.77716E-05 +TGATCT 1.05893E-07 0.000283166 +TGATGA 1.05893E-07 0.000316018 +TGATGC 4.23571E-07 0.000227194 +TGATGG 2.11786E-07 0.00029115 +TGATGT 1.05893E-07 0.000324325 +TGATTA 3.17678E-07 0.000245959 +TGATTC 1.05893E-07 0.000270262 +TGATTG 0 0.000253137 +TGATTT 2.11786E-07 0.000531033 +TGCAAA 0.000309207 0.000393846 +TGCAAC 0.000287499 0.000208806 +TGCAAG 0.000438396 0.000266122 +TGCAAT 0.000205644 0.000267304 +TGCACA 0.00019156 0.000326126 +TGCACC 0.000288558 0.000242168 +TGCACG 0.000110023 7.57044E-05 +TGCACT 0.000146661 0.000313329 +TGCAGA 0.000169534 0.000439709 +TGCAGC 0.000404087 0.000411804 +TGCAGG 0.000198019 0.000389813 +TGCAGT 0.000236564 0.000444844 +TGCATA 7.77253E-05 0.000225688 +TGCATC 0.000350929 0.000227167 +TGCATG 0.000255943 0.000299215 +TGCATT 0.000210938 0.000388792 +TGCCAA 0.000169217 0.000299 +TGCCAC 0.000279239 0.000342955 +TGCCAG 0.000550325 0.000409788 +TGCCAT 0.000168052 0.000317523 +TGCCCA 0.000227564 0.00045014 +TGCCCC 0.000303171 0.000381775 +TGCCCG 0.000123895 0.000146677 +TGCCCT 0.000213797 0.000418794 +TGCCGA 9.23385E-05 6.52467E-05 +TGCCGC 0.000234129 0.000126219 +TGCCGG 0.000193148 0.000112508 +TGCCGT 6.63948E-05 8.43341E-05 +TGCCTA 7.6984E-05 0.000207354 +TGCCTC 0.000326679 0.00051208 +TGCCTG 0.00059607 0.000584397 +TGCCTT 0.000187748 0.000474013 +TGCGAA 6.11001E-05 4.35516E-05 +TGCGAC 0.000137661 4.22074E-05 +TGCGAG 0.000206279 7.15375E-05 +TGCGAT 5.69703E-05 4.18041E-05 +TGCGCA 3.86509E-05 6.91986E-05 +TGCGCC 0.000166358 0.000111352 +TGCGCG 5.89823E-05 7.4199E-05 +TGCGCT 4.69105E-05 7.78014E-05 +TGCGGA 5.35817E-05 8.19683E-05 +TGCGGC 0.000180018 0.000119552 +TGCGGG 0.000142214 0.000128423 +TGCGGT 4.2463E-05 7.01933E-05 +TGCGTA 1.93784E-05 3.32551E-05 +TGCGTC 8.73615E-05 6.59725E-05 +TGCGTG 0.000191242 0.000107481 +TGCGTT 2.80616E-05 6.0542E-05 +TGCTAA 7.73017E-06 0.000238996 +TGCTAC 0.000261343 0.000165872 +TGCTAG 8.47142E-06 0.000168695 +TGCTAT 0.000151427 0.000225957 +TGCTCA 0.000149732 0.000319996 +TGCTCC 0.000324138 0.00033575 +TGCTCG 7.28542E-05 7.1645E-05 +TGCTCT 0.000182877 0.000416966 +TGCTGA 2.35082E-05 0.000411777 +TGCTGC 0.000331444 0.000496649 +TGCTGG 0.000232011 0.000522027 +TGCTGT 0.000213162 0.00049673 +TGCTTA 7.25365E-05 0.000252142 +TGCTTC 0.000358235 0.000390324 +TGCTTG 0.000167946 0.000321825 +TGCTTT 0.000218457 0.000581682 +TGGAAA 0.000352835 0.0006144 +TGGAAC 0.000282522 0.000262949 +TGGAAG 0.000493884 0.000480949 +TGGAAT 0.000278074 0.000403847 +TGGACA 0.000202785 0.000323518 +TGGACC 0.000223857 0.000220742 +TGGACG 8.17492E-05 7.75325E-05 +TGGACT 0.000167099 0.000298731 +TGGAGA 0.000194631 0.000514365 +TGGAGC 0.000269603 0.000367607 +TGGAGG 0.000218774 0.000501569 +TGGAGT 0.000166781 0.000391991 +TGGATA 0.000100175 0.00022257 +TGGATC 0.000251389 0.00020402 +TGGATG 0.000298512 0.000323222 +TGGATT 0.000203102 0.000351907 +TGGCAA 0.000142532 0.000278058 +TGGCAC 0.000175782 0.000264213 +TGGCAG 0.000382167 0.000427692 +TGGCAT 0.000137131 0.000305399 +TGGCCA 0.00015365 0.000434817 +TGGCCC 0.000188807 0.00035887 +TGGCCG 6.59712E-05 0.000135117 +TGGCCT 0.000140414 0.000440516 +TGGCGA 6.33239E-05 6.90104E-05 +TGGCGC 0.000109281 0.000109605 +TGGCGG 0.000124848 0.000148613 +TGGCGT 5.64408E-05 8.40653E-05 +TGGCTA 0.000102504 0.000209666 +TGGCTC 0.00025266 0.000400997 +TGGCTG 0.00055149 0.00051415 +TGGCTT 0.000166569 0.000408121 +TGGGAA 0.000346693 0.000505225 +TGGGAC 0.000380473 0.000311878 +TGGGAG 0.000494731 0.000599103 +TGGGAT 0.000303595 0.00037414 +TGGGCA 0.000202467 0.000405702 +TGGGCC 0.000336421 0.000355268 +TGGGCG 8.5879E-05 0.000145763 +TGGGCT 0.000222798 0.000398577 +TGGGGA 0.000181077 0.000489848 +TGGGGC 0.000280192 0.000396964 +TGGGGG 0.00015005 0.000446377 +TGGGGT 0.000132472 0.000347364 +TGGGTA 9.13855E-05 0.000180389 +TGGGTC 0.000178112 0.000234721 +TGGGTG 0.000333456 0.000378764 +TGGGTT 0.000116164 0.000297817 +TGGTAA 4.3416E-06 0.000214155 +TGGTAC 0.000197066 0.000135225 +TGGTAG 4.97696E-06 0.000176491 +TGGTAT 0.000142638 0.000202703 +TGGTCA 0.000119765 0.000242007 +TGGTCC 0.000175782 0.000210956 +TGGTCG 3.91803E-05 4.57023E-05 +TGGTCT 0.000140731 0.00032669 +TGGTGA 1.55662E-05 0.000338573 +TGGTGC 0.00013999 0.000284214 +TGGTGG 0.000203949 0.000446269 +TGGTGT 0.000111293 0.000302522 +TGGTTA 6.77714E-05 0.000195471 +TGGTTC 0.000233705 0.000244023 +TGGTTG 0.000117541 0.000250045 +TGGTTT 0.000222587 0.00046904 +TGTAAA 0.000257108 0.000523049 +TGTAAC 0.000140731 0.000217489 +TGTAAG 0.000220786 0.000245206 +TGTAAT 0.000220045 0.000429386 +TGTACA 0.000113305 0.00030521 +TGTACC 0.000121035 0.000171034 +TGTACG 1.779E-05 3.50294E-05 +TGTACT 0.000112352 0.000246147 +TGTAGA 7.68781E-05 0.000254615 +TGTAGC 9.53035E-05 0.000186868 +TGTAGG 5.35817E-05 0.000176088 +TGTAGT 0.000105469 0.000239776 +TGTATA 6.65007E-05 0.000361935 +TGTATC 0.00010674 0.000212811 +TGTATG 0.000108434 0.000297575 +TGTATT 0.000127283 0.000528909 +TGTCAA 0.000129507 0.000250233 +TGTCAC 0.000118282 0.000284187 +TGTCAG 0.000244718 0.000311017 +TGTCAT 0.000110976 0.000322577 +TGTCCA 0.000162016 0.000295694 +TGTCCC 0.000181394 0.000329513 +TGTCCG 3.43093E-05 7.00858E-05 +TGTCCT 0.000178641 0.000390378 +TGTCGA 5.96176E-05 3.32282E-05 +TGTCGC 6.26885E-05 6.79082E-05 +TGTCGG 6.77714E-05 5.65633E-05 +TGTCGT 3.9498E-05 5.1778E-05 +TGTCTA 6.43828E-05 0.000203886 +TGTCTC 0.000133107 0.000384222 +TGTCTG 0.000225446 0.000419439 +TGTCTT 0.00013279 0.000462749 +TGTGAA 0.000505744 0.000480035 +TGTGAC 0.000444961 0.000297333 +TGTGAG 0.000522475 0.000387125 +TGTGAT 0.000367448 0.000359515 +TGTGCA 0.000212739 0.000351907 +TGTGCC 0.000387991 0.000353762 +TGTGCG 6.09942E-05 9.11088E-05 +TGTGCT 0.000275215 0.000390485 +TGTGGA 0.000393921 0.00040218 +TGTGGC 0.000446762 0.000361209 +TGTGGG 0.000476729 0.000389195 +TGTGGT 0.00020575 0.000350671 +TGTGTA 0.000120824 0.000367796 +TGTGTC 0.000234341 0.000337175 +TGTGTG 0.0004223 0.000742151 +TGTGTT 0.000192831 0.000517027 +TGTTAA 7.41249E-06 0.000371828 +TGTTAC 0.00010907 0.000219451 +TGTTAG 4.76517E-06 0.00021636 +TGTTAT 9.05383E-05 0.000321744 +TGTTCA 0.000127283 0.000343305 +TGTTCC 0.000141367 0.000305909 +TGTTCG 2.34023E-05 4.72615E-05 +TGTTCT 0.000153227 0.000455087 +TGTTGA 8.36553E-06 0.000323895 +TGTTGC 6.30062E-05 0.000293812 +TGTTGG 6.98892E-05 0.000337014 +TGTTGT 6.97833E-05 0.000379141 +TGTTTA 9.06442E-05 0.000462641 +TGTTTC 0.000135755 0.000473072 +TGTTTG 0.000150368 0.000510521 +TGTTTT 0.00014772 0.000999481 +TTAAAA 0.000354529 0.001063088 +TTAAAC 0.000126754 0.000298678 +TTAAAG 0.000276698 0.000449065 +TTAAAT 0.000272992 0.000625879 +TTAACA 0.00015365 0.000301124 +TTAACC 9.09619E-05 0.000166598 +TTAACG 2.09668E-05 3.91158E-05 +TTAACT 0.000131413 0.000288193 +TTAAGA 0.00014645 0.000347606 +TTAAGC 7.70899E-05 0.00018867 +TTAAGG 9.21267E-05 0.000223726 +TTAAGT 0.000109599 0.000294591 +TTAATA 0.000102822 0.000426752 +TTAATC 8.54555E-05 0.00020765 +TTAATG 0.000158204 0.00033817 +TTAATT 0.000166358 0.000512134 +TTACAA 0.000177794 0.000296473 +TTACAC 7.87842E-05 0.000166464 +TTACAG 0.000297241 0.000372796 +TTACAT 0.000126436 0.000312335 +TTACCA 0.000158733 0.000214989 +TTACCC 8.50319E-05 0.000154958 +TTACCG 2.20257E-05 3.52176E-05 +TTACCT 0.000172393 0.000255207 +TTACGA 5.80292E-05 3.11582E-05 +TTACGC 3.16619E-05 2.48674E-05 +TTACGG 4.99814E-05 3.62661E-05 +TTACGT 3.6533E-05 4.75303E-05 +TTACTA 8.41847E-05 0.000202219 +TTACTC 9.05383E-05 0.000176142 +TTACTG 0.000180865 0.000290263 +TTACTT 0.00013639 0.000354515 +TTAGAA 0.000423571 0.000380081 +TTAGAC 0.000138084 0.000139338 +TTAGAG 0.000251813 0.000236039 +TTAGAT 0.000257743 0.000218215 +TTAGCA 0.000174299 0.00021757 +TTAGCC 0.000126118 0.000184315 +TTAGCG 2.41435E-05 3.01904E-05 +TTAGCT 0.000158945 0.000226495 +TTAGGA 0.000147932 0.000247545 +TTAGGC 6.70301E-05 0.000126649 +TTAGGG 7.07364E-05 0.000173346 +TTAGGT 7.88901E-05 0.00016555 +TTAGTA 8.09021E-05 0.000226253 +TTAGTC 5.50642E-05 0.000132752 +TTAGTG 0.000120824 0.000197084 +TTAGTT 9.33974E-05 0.000264589 +TTATAA 9.10678E-06 0.000434682 +TTATAC 7.25365E-05 0.000194638 +TTATAG 7.09482E-06 0.000235904 +TTATAT 0.000139778 0.000453581 +TTATCA 0.000131307 0.000243727 +TTATCC 9.55153E-05 0.000174636 +TTATCG 1.94843E-05 2.82547E-05 +TTATCT 0.000159475 0.000313517 +TTATGA 7.94196E-06 0.00028787 +TTATGC 4.88166E-05 0.000176034 +TTATGG 7.48662E-05 0.000208375 +TTATGT 8.36553E-05 0.000355886 +TTATTA 0.000113941 0.000446807 +TTATTC 8.48201E-05 0.000314539 +TTATTG 0.000107163 0.000347283 +TTATTT 0.000181288 0.001005235 +TTCAAA 0.0004223 0.000497805 +TTCAAC 0.000514639 0.000215553 +TTCAAG 0.000666171 0.000395351 +TTCAAT 0.000314607 0.000274724 +TTCACA 0.000313548 0.000354865 +TTCACC 0.000581245 0.000290639 +TTCACG 0.000169005 6.84458E-05 +TTCACT 0.000321914 0.000357472 +TTCAGA 0.000247048 0.000463125 +TTCAGC 0.000609731 0.00032868 +TTCAGG 0.000250966 0.000350375 +TTCAGT 0.000375813 0.000411078 +TTCATA 0.000127283 0.000319002 +TTCATC 0.000660347 0.00030634 +TTCATG 0.000481283 0.000342014 +TTCATT 0.000374013 0.000560014 +TTCCAA 0.000258272 0.00038191 +TTCCAC 0.000419441 0.000286634 +TTCCAG 0.000917137 0.000495144 +TTCCAT 0.00025626 0.000385136 +TTCCCA 0.000304971 0.00047447 +TTCCCC 0.000405463 0.000426214 +TTCCCG 0.000162651 0.000121487 +TTCCCT 0.000308783 0.000511086 +TTCCGA 0.000185736 5.61869E-05 +TTCCGC 0.000328056 7.61883E-05 +TTCCGG 0.000326785 9.82061E-05 +TTCCGT 0.000121883 7.15106E-05 +TTCCTA 0.000168687 0.000299 +TTCCTC 0.000567373 0.000499741 +TTCCTG 0.001148407 0.000613647 +TTCCTT 0.00027098 0.000628729 +TTCGAA 8.1008E-05 4.2987E-05 +TTCGAC 0.000220469 2.66686E-05 +TTCGAG 0.000278816 6.39563E-05 +TTCGAT 0.000105257 3.29056E-05 +TTCGCA 5.53819E-05 4.04331E-05 +TTCGCC 0.000227458 6.20206E-05 +TTCGCG 6.81949E-05 2.61578E-05 +TTCGCT 6.68183E-05 5.84989E-05 +TTCGGA 7.17953E-05 5.84451E-05 +TTCGGC 0.000198443 5.66439E-05 +TTCGGG 0.000162228 6.97363E-05 +TTCGGT 5.51701E-05 5.02187E-05 +TTCGTA 2.93323E-05 4.21536E-05 +TTCGTC 0.000133107 4.24493E-05 +TTCGTG 0.000319796 6.3795E-05 +TTCGTT 4.71223E-05 6.59994E-05 +TTCTAA 1.16482E-05 0.000395647 +TTCTAC 0.0004834 0.000231657 +TTCTAG 1.30248E-05 0.00027623 +TTCTAT 0.000286546 0.000328035 +TTCTCA 0.00026219 0.000466271 +TTCTCC 0.000595329 0.000520818 +TTCTCG 0.000119023 7.46829E-05 +TTCTCT 0.000361624 0.000614615 +TTCTGA 3.10266E-05 0.000490627 +TTCTGC 0.000405463 0.000424198 +TTCTGG 0.000376872 0.000455813 +TTCTGT 0.000270874 0.000606872 +TTCTTA 0.000144967 0.000407234 +TTCTTC 0.000670407 0.000511489 +TTCTTG 0.000296817 0.000427719 +TTCTTT 0.000398369 0.000864283 +TTGAAA 0.000450468 0.000592866 +TTGAAC 0.00019569 0.000274294 +TTGAAG 0.00045015 0.000392502 +TTGAAT 0.00028051 0.000396292 +TTGACA 0.000192937 0.000253486 +TTGACC 0.000163922 0.000177352 +TTGACG 5.09344E-05 3.82286E-05 +TTGACT 0.000172499 0.000260557 +TTGAGA 0.000171229 0.000404411 +TTGAGC 0.000148991 0.000234022 +TTGAGG 0.000147509 0.000297871 +TTGAGT 0.000153121 0.000259132 +TTGATA 0.000109387 0.000240716 +TTGATC 0.000136602 0.000170577 +TTGATG 0.000224069 0.000276875 +TTGATT 0.000181606 0.000373764 +TTGCAA 0.000201302 0.000295801 +TTGCAC 0.000155556 0.000219747 +TTGCAG 0.000417747 0.000381264 +TTGCAT 0.000136496 0.000308302 +TTGCCA 0.000238047 0.000317765 +TTGCCC 0.000205961 0.00027994 +TTGCCG 5.97235E-05 6.48703E-05 +TTGCCT 0.000241965 0.000378253 +TTGCGA 5.69703E-05 3.50832E-05 +TTGCGC 7.59251E-05 4.5998E-05 +TTGCGG 0.000107058 5.86871E-05 +TTGCGT 4.80753E-05 4.66701E-05 +TTGCTA 0.000118918 0.000237114 +TTGCTC 0.000186901 0.000278569 +TTGCTG 0.000520463 0.000441349 +TTGCTT 0.000201514 0.000469362 +TTGGAA 0.000619155 0.000472051 +TTGGAC 0.00036173 0.000205875 +TTGGAG 0.000649334 0.000379141 +TTGGAT 0.000491237 0.000284725 +TTGGCA 0.000299994 0.000286876 +TTGGCC 0.000370413 0.000306689 +TTGGCG 8.42906E-05 6.38487E-05 +TTGGCT 0.000350081 0.000352553 +TTGGGA 0.000241859 0.000432558 +TTGGGC 0.000223328 0.000223296 +TTGGGG 0.000201514 0.00037613 +TTGGGT 0.000150156 0.000247868 +TTGGTA 0.000131519 0.000202246 +TTGGTC 0.000176417 0.000187863 +TTGGTG 0.000377402 0.000304538 +TTGGTT 0.00019569 0.000345428 +TTGTAA 9.42446E-06 0.000429305 +TTGTAC 0.000129401 0.000216844 +TTGTAG 7.20071E-06 0.000238861 +TTGTAT 0.000135755 0.00044764 +TTGTCA 0.000169534 0.000311313 +TTGTCC 0.00017144 0.000242061 +TTGTCG 3.53682E-05 4.0675E-05 +TTGTCT 0.000196325 0.000367204 +TTGTGA 1.58839E-05 0.000363656 +TTGTGC 9.14913E-05 0.000253056 +TTGTGG 0.000113305 0.000311824 +TTGTGT 0.000115 0.00043444 +TTGTTA 0.000102504 0.000339783 +TTGTTC 0.000124636 0.000315722 +TTGTTG 0.000167416 0.000365726 +TTGTTT 0.000209879 0.000836996 +TTTAAA 0.000369989 0.001115189 +TTTAAC 0.000225869 0.00030021 +TTTAAG 0.000338751 0.000431564 +TTTAAT 0.000296182 0.000638568 +TTTACA 0.000188913 0.000414493 +TTTACC 0.000195266 0.000232006 +TTTACG 3.25091E-05 4.44925E-05 +TTTACT 0.000203949 0.00038285 +TTTAGA 0.000135331 0.000367984 +TTTAGC 0.000146026 0.000207972 +TTTAGG 9.78449E-05 0.000247518 +TTTAGT 0.000171017 0.000347122 +TTTATA 0.000131836 0.000602705 +TTTATC 0.000199608 0.000302656 +TTTATG 0.000215068 0.000427343 +TTTATT 0.000288452 0.000950714 +TTTCAA 0.000257319 0.000509795 +TTTCAC 0.000164028 0.000377743 +TTTCAG 0.000407793 0.000521275 +TTTCAT 0.000232646 0.000571708 +TTTCCA 0.000291311 0.000551599 +TTTCCC 0.000205114 0.000495869 +TTTCCG 4.78635E-05 8.38771E-05 +TTTCCT 0.00033621 0.000723332 +TTTCGA 0.000114047 4.15622E-05 +TTTCGC 6.96774E-05 5.05413E-05 +TTTCGG 9.30797E-05 6.15099E-05 +TTTCGT 6.81949E-05 6.38756E-05 +TTTCTA 0.000155027 0.00051622 +TTTCTC 0.000255096 0.000597328 +TTTCTG 0.000430772 0.000695938 +TTTCTT 0.000291205 0.000961468 +TTTGAA 0.000826493 0.000637089 +TTTGAC 0.000625826 0.000250986 +TTTGAG 0.000800549 0.000448312 +TTTGAT 0.000682691 0.000392448 +TTTGCA 0.000413511 0.000456807 +TTTGCC 0.000562502 0.000336476 +TTTGCG 7.92078E-05 5.54073E-05 +TTTGCT 0.000487107 0.000503074 +TTTGGA 0.000534017 0.000491622 +TTTGGC 0.000450997 0.000288919 +TTTGGG 0.000441573 0.000471889 +TTTGGT 0.000336421 0.000375914 +TTTGTA 0.000220257 0.000599399 +TTTGTC 0.000340869 0.000339514 +TTTGTG 0.00067729 0.000522215 +TTTGTT 0.000353894 0.000820409 +TTTTAA 1.34484E-05 0.001158418 +TTTTAC 0.000166569 0.000397448 +TTTTAG 5.50642E-06 0.000469739 +TTTTAT 0.000256472 0.000910416 +TTTTCA 0.000252872 0.00071196 +TTTTCC 0.000237623 0.000641633 +TTTTCG 3.31444E-05 6.43595E-05 +TTTTCT 0.000329962 0.001050318 +TTTTGA 1.14364E-05 0.000607033 +TTTTGC 0.000114258 0.000442021 +TTTTGG 0.000147403 0.000498235 +TTTTGT 0.00015185 0.000919341 +TTTTTA 0.000174723 0.001164332 +TTTTTC 0.000241965 0.000870413 +TTTTTG 0.000238365 0.000845572 +TTTTTT 0.000243447 0.002578682 diff --git a/code/utilities/CPAT-1.2.2/dat/Human_cutoff.txt b/code/utilities/CPAT-1.2.2/dat/Human_cutoff.txt new file mode 100755 index 0000000..59139d1 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/Human_cutoff.txt @@ -0,0 +1,2 @@ +Coding Probability Cutoff: 0.364 +Achieved Sensitivity and Specificity: 0.966 diff --git a/code/utilities/CPAT-1.2.2/dat/Human_logitModel.RData b/code/utilities/CPAT-1.2.2/dat/Human_logitModel.RData new file mode 100755 index 0000000..85fe444 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/dat/Human_logitModel.RData differ diff --git a/code/utilities/CPAT-1.2.2/dat/Mouse_Hexamer.tsv b/code/utilities/CPAT-1.2.2/dat/Mouse_Hexamer.tsv new file mode 100755 index 0000000..b74e930 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/Mouse_Hexamer.tsv @@ -0,0 +1,4097 @@ +hexamer coding noncoding +GAACGT 0.000101774181912 6.10808750604e-05 +CTTCTT 0.00025408691306 0.000509033837531 +CACCCT 0.000289638168385 0.0003340733649 +GAACGG 0.000204245447261 6.72924894733e-05 +GAACGC 0.000172179609124 5.40728998253e-05 +GAACGA 0.000159980648964 5.88510647583e-05 +CACCCA 0.000291032335261 0.000367759427678 +CTTCTA 0.000149175855679 0.000289636431023 +CACCCC 0.000298351711357 0.000360353272032 +CTTCTC 0.000324143798554 0.000510706195257 +CACCCG 0.000135931270361 9.52447543314e-05 +CTTCTG 0.000566031751454 0.000608180759891 +CGTGTG 0.000221672533205 0.000147804568595 +TAAGGT 0.0 0.000167315408738 +CGTGTC 0.000111184808321 8.93516842474e-05 +CGTGTA 6.02977173654e-05 6.12401472248e-05 +GGAAAT 0.000346450468562 0.000381695742066 +TAAGGG 0.0 0.000169385946875 +CGTGTT 7.31937609638e-05 0.000100739644004 +TAAGGC 0.0 0.000159670344845 +TAAGGA 0.0 0.000278248471266 +TCACTG 0.00032240108996 0.000431866473862 +GTCAAA 0.000340176717622 0.00020761126634 +CCCGCT 0.000115367308948 0.000115631591379 +GTCAAG 0.000543376539727 0.00019901056946 +CTGTCC 0.000642710929606 0.000467941619107 +TCAGAG 0.000727406567293 0.000498203330349 +CTGTCA 0.000348890260594 0.000400410221387 +CTGTCG 0.000169391275373 8.50513358077e-05 +GTATCT 0.000133840020048 0.00020402764264 +TCAGAA 0.000623889676787 0.000504494580844 +GTCAAT 0.000291729418699 0.000141991134593 +GTATCA 8.85295965943e-05 0.00015194564487 +GTATCC 0.000110139183165 0.0001343460707 +GTATCG 2.43979203213e-05 2.65188153782e-05 +CTGTCT 0.00050503695065 0.000619489083565 +GGTGTC 0.000316475880739 0.000234607898211 +GGTGTA 0.000130354602859 0.00014836202117 +GGTGTG 0.000474713821108 0.000373095045186 +TATCCT 0.000181938777253 0.000224095935358 +CCGGGG 0.00015196418943 0.000162776152051 +TTCTGT 0.000344707759968 0.000661536934976 +ATTCCT 0.00034401067653 0.000343948239095 +CCGGGC 0.000204942530699 0.000178145915919 +CCGGGA 0.000118155642699 0.000148839837663 +TATCCA 0.000151615647711 0.000198453116885 +TATCCC 0.000137325437237 0.000160068525256 +GTTCTG 0.000393155058891 0.000402719667771 +TACACC 0.000344359218249 0.000133071893384 +TATCCG 4.04308393895e-05 2.77133566115e-05 +GGTGTT 0.000234220035084 0.000272355401182 +ATTCCG 5.43725081445e-05 4.82594658235e-05 +TTCTGG 0.000360392137317 0.000506087302489 +CCGGGT 9.27120972208e-05 9.74745646335e-05 +ATTCCC 0.000232825868209 0.000235165350787 +TTCTGC 0.000399080268112 0.000430671932629 +ATTCCA 0.00028824400151 0.000313367983524 +GTTCTA 0.000102819807068 0.000212707975601 +TGCACT 0.0001551010649 0.000286212079488 +TATCTT 0.000133840020048 0.000277133566115 +CGCGGT 3.9036672514e-05 4.59500194392e-05 +CCCGCG 0.000126172102233 0.000124789740834 +CGCGGG 7.73762615903e-05 0.000116985404777 +CGCGGC 9.5151889253e-05 0.000134903523275 +CGCGGA 2.96260461044e-05 6.34699575269e-05 +ACCTGT 0.000286849834634 0.00033192319068 +TCATGT 8.29529290923e-05 0.000339010801997 +CCCGCC 0.000195880446008 0.000210796709628 +TTACAG 0.000280227541976 0.000316633062895 +CTCCGC 0.000212610448514 0.000138487146975 +TTACAA 0.000143250646458 0.000278487379513 +TTACAC 9.61975144096e-05 0.000183879713839 +CTCCGG 0.000264891706345 0.000148282385088 +TCATGC 6.41316762731e-05 0.000200045838529 +ACCTGG 0.000317870047614 0.000383925552368 +GGCGAA 0.000101774181912 4.89761905634e-05 +GTAAGC 7.77248033092e-05 0.000138566783057 +TCATGG 0.000116064392385 0.000295131320696 +ACCTGC 0.000388275474827 0.00033120646594 +ACCTGA 1.74270859438e-05 0.000322844677307 +GTATTT 0.000158237940369 0.000437918816111 +CTCGAT 9.34091806586e-05 4.38794813015e-05 +CTCCGT 0.000126869185671 0.000109340340884 +GCCTGA 3.45056301687e-05 0.000333436276242 +GCCTGC 0.000431843189687 0.000443572977948 +GCCTGG 0.000444739233285 0.00054996678379 +TCTTGC 0.000110487724883 0.000292503329983 +TAAAGG 0.0 0.000315279249497 +CAAATT 0.000169042733655 0.000281832094966 +TAAAGA 0.0 0.000447475145977 +GCATAA 5.576667502e-06 0.000137770422235 +AAGGTC 0.000463909027823 0.00023349299306 +TATTAG 5.576667502e-06 0.000163174332462 +GCCTGT 0.000345404843405 0.000375404491571 +TATCTA 6.23889676787e-05 0.000205700000366 +TAAAGT 0.0 0.000358043825647 +CAAATA 0.000133840020048 0.000340046071066 +CAAATC 0.000183332944128 0.000216928687959 +CGTGCT 0.000113276058634 0.000107508710993 +CAAATG 0.000242236494618 0.000364812892636 +AATACT 0.000151267105992 0.000255154007423 +TATCTC 0.000143599188177 0.000206098180777 +CCGGCG 8.78325131566e-05 0.000100660007922 +GGCATG 0.000531874663004 0.000238271157993 +GGCATA 0.00013941668755 0.000132594076891 +GGCGAC 0.000180544610377 7.27873791463e-05 +GGCATC 0.00067547385118 0.000216371235383 +AATACG 5.36754247068e-05 3.55176926688e-05 +AATACA 0.000182635860691 0.000302856020671 +AATACC 0.000171133983968 0.000155608904652 +GGCATT 0.000332857341526 0.000232537360073 +TATCTG 0.000268028581815 0.000265506698111 +TGCACA 0.000225157950393 0.000382332830723 +GAGCAC 0.000527692162377 0.000269568138304 +ACTGAT 0.000345404843405 0.000247907123941 +GAGCAG 0.00156251252572 0.000481559389166 +AGTAGT 0.00014255356302 0.000174403020055 +TCTCGC 9.55004309718e-05 7.0477932762e-05 +TCTCGA 0.000121989601606 6.21161441292e-05 +TCTCGG 0.000174619401157 9.95451027712e-05 +ACTGAG 0.000580670503646 0.000427008672847 +AGTAGA 9.86373064417e-05 0.000233652265224 +TTTGGT 0.000336691300434 0.000403516028593 +AGTAGG 7.04054272128e-05 0.000175119744795 +ACTGAA 0.000490398198458 0.000438715176933 +AAGGTT 0.000302882753703 0.000268134688824 +GGGTCA 0.000135234186924 0.000213345064259 +GTGTCG 0.000101077098474 6.25939606225e-05 +TCGAAC 4.25220897028e-05 4.25256679038e-05 +TCGAAA 5.54181333012e-05 4.89761905634e-05 +GTGTCC 0.000488306948144 0.000286849168145 +CGCACG 7.73762615903e-05 4.6985288508e-05 +GTGTCA 0.000245373370088 0.000268851413564 +GTTGTA 0.00013314293661 0.000207292722011 +CTTGCT 0.000313339005269 0.00045440348513 +TCGGTC 6.93598020562e-05 5.22412699343e-05 +GTGTCT 0.000451710067662 0.000406701471882 +TTGAAG 0.000466697361574 0.000397384050262 +TCGAAT 4.80987572048e-05 3.79864112175e-05 +CTTGCG 5.15841743935e-05 5.43914441542e-05 +CTTGCA 0.000224460866956 0.000274346303237 +CTTGCC 0.000303928378859 0.000327543206158 +CGAAAG 0.000183332944128 6.06030585671e-05 +CGAAAA 0.000128611894265 6.04437864026e-05 +CGAAAC 0.000119201267855 4.20478514105e-05 +AATCAT 0.000164511691309 0.000247907123941 +AAATGC 0.000234220035084 0.000342514789615 +CACGGC 0.000181938777253 9.42891213448e-05 +AAATGA 2.96260461044e-05 0.000518032714821 +ACAGTC 0.000291729418699 0.000247827487859 +CACGGG 0.000143599188177 0.000103208362553 +ACAGTA 0.000191000861944 0.00024894239301 +TAGAGC 0.0 0.000188100426196 +CGAAAT 0.000100031473317 4.17293070817e-05 +ACAGTT 0.000244327744932 0.000349124584439 +AATCAG 0.000367014429976 0.00026654196718 +CACGGT 8.60898045622e-05 7.31059234751e-05 +AAATGT 0.000283364417446 0.000588829191912 +AATCAC 0.000169042733655 0.000196462214829 +TTTGTA 0.000202154196948 0.000523288696247 +GCTCAA 0.000206685239293 0.000193037863294 +TCTAGT 0.000131748769735 0.00019757711998 +TTGCCG 6.83141768996e-05 6.3868137938e-05 +ATACGT 2.19581282891e-05 4.17293070817e-05 +GGGTAT 0.000100728556755 0.000130921719165 +ATACGA 4.42647982972e-05 3.33675184489e-05 +TCTAGG 9.27120972208e-05 0.000216530507548 +ATACGC 1.98668779759e-05 2.33333720896e-05 +TCTAGA 0.000104911057381 0.000269488502222 +GGGTAG 5.92520922088e-06 0.00015696271805 +TCTAGC 0.000146038980209 0.00018069427055 +ATACGG 4.7401673767e-05 3.10580720646e-05 +TGACTA 0.0 0.000202992373571 +TTTGTG 0.000747970528706 0.000547020248748 +TGGGCC 0.000299397336514 0.000293299690805 +AGATGT 9.30606389397e-05 0.000371343051378 +TCGCCC 0.000127217727389 7.84415409837e-05 +TCGCCA 8.99237634698e-05 7.5256097695e-05 +GGGTCG 5.05385492369e-05 5.77361596073e-05 +TCGCCG 5.89035504899e-05 5.16041812766e-05 +GGTAAT 9.16664720642e-05 0.000122161750121 +ACCCAT 0.000185772736161 0.000222105033303 +GTCAAC 0.000428357772498 0.00013362934596 +ACCCAC 0.000314384630426 0.000296166589765 +GGTAAC 0.000127217727389 0.00011387959757 +ACCCAA 0.000203896905542 0.000245040224981 +AGATGG 0.000114321683791 0.000430194116136 +ACCCAG 0.000672685517429 0.000433937012 +AGATGA 1.56843773494e-05 0.000384244096697 +TCGCCT 9.16664720642e-05 9.77134728802e-05 +AGATGC 8.9575221751e-05 0.000304289470151 +TTTGAG 0.000818375955919 0.000419363608954 +CCCCAT 0.000190652320225 0.000276815021786 +TGGTCT 0.000138371062393 0.000329534108214 +TTGGGT 0.000164860233028 0.000276576113539 +CACTAG 4.53104234538e-06 0.000159988889174 +CACTAA 9.75916812851e-06 0.000200284746776 +CACTAC 0.000313339005269 0.000136974061413 +CCCCAA 0.000223415241799 0.000338134805093 +CCCCAC 0.000287546918072 0.000422389780079 +CCCCAG 0.000729497817606 0.000512219280819 +CACTAT 0.000202154196948 0.000161263066489 +CTATCG 2.30037534458e-05 2.58817267205e-05 +TCGGTT 5.33268829879e-05 5.79750678539e-05 +TTGGGA 0.000248858787277 0.000374130314255 +TTGGGC 0.000258617955405 0.000219238134343 +CTCGAG 0.000156495231775 8.41753389033e-05 +TAGTGG 0.0 0.000170182307698 +TTTCTG 0.000443345066409 0.000712185483266 +TGCAGC 0.000395246309205 0.000393083701823 +TGCCTC 0.000287895459791 0.00048171866133 +TGCCTA 9.7940223004e-05 0.000229511188949 +TGCAGG 0.000200760030072 0.000394357879138 +TTTCCG 5.22812578313e-05 7.8919357477e-05 +GTGGCC 0.0010027545252 0.000308908362919 +TCAGAC 0.000462514860948 0.000281354278472 +TTTCTT 0.000247116078683 0.00095372172063 +TGCCTT 0.000181938777253 0.000508874565366 +TGCAGT 0.000221672533205 0.000369591057569 +TAGTGC 0.0 0.000136894425331 +GTGAGC 0.000432191731405 0.000297122222751 +AAGGAA 0.0011651749662 0.000638442471133 +AAGGAC 0.00100519431724 0.000314482888675 +AAGGAG 0.00171238546483 0.000456235115021 +ATATGC 6.62229265863e-05 0.000178225552001 +GTTCCA 0.000236311285397 0.000277133566115 +ATATGA 9.75916812851e-06 0.000243606775502 +TACGAA 0.000121292518169 3.39249710244e-05 +ATATGG 7.63306364337e-05 0.000189215331347 +AAGGAT 0.000728103650731 0.000304767286644 +CTATCA 6.86627186184e-05 0.000159590708763 +TGGTTT 0.000212261906795 0.000512537825148 +ATATGT 8.08616787791e-05 0.000327782114405 +GGTCCC 0.000264194622907 0.000239147154897 +GCCCAG 0.00112439558509 0.000484187379879 +CCACTG 0.000528389245815 0.000422628688325 +GCCCAA 0.000224112325237 0.000195028765349 +GGTCCG 4.80987572048e-05 6.00456059916e-05 +AGGTCT 0.000146038980209 0.000281354278472 +TGTGTC 0.000287895459791 0.00042063778627 +AGACCC 0.00019518336257 0.000279602284664 +AGACCA 0.000196577529446 0.00032292431339 +AGACCG 5.15841743935e-05 7.00797523509e-05 +CTTCGC 0.000121989601606 7.14335657486e-05 +ATGCAA 0.000216444407422 0.000250614750737 +AGGTCC 0.00014255356302 0.000222105033303 +AGGTCA 0.000135931270361 0.000293618235134 +AGGTCG 3.72939639197e-05 4.91354627278e-05 +GGTCCT 0.000309505046361 0.000278328107348 +TCCGGA 8.88781383132e-05 8.75996904386e-05 +CTTAGC 0.000128263352546 0.000206735269435 +ATTGTG 0.000509916534715 0.000305484011384 +CTTAGA 0.00010212272363 0.000261206349672 +ATGCAC 0.000284410042602 0.000209522532313 +CTTAGG 8.33014708112e-05 0.000206018544695 +ATTGTC 0.000357952345285 0.000217087960123 +ATTGTA 0.000173922317719 0.000270762679538 +CGCTAC 0.000276045041349 4.18885792461e-05 +ATTTTG 0.000250252954152 0.000522173791096 +CGCTAA 1.3941668755e-06 3.24118854623e-05 +ATTTTA 0.000194834820851 0.000658271855605 +CGCTAG 4.87958406425e-06 3.51991483399e-05 +ATTTTC 0.000233871493365 0.000504653853009 +GAGGTC 0.000484821530956 0.000225529384838 +TAGCAG 0.0 0.0002413769652 +GATACT 0.000188561069912 0.000162059427311 +TAGCAC 0.0 0.000158396167529 +TAGCAA 0.0 0.000215335966315 +GAGGTT 0.000327977757462 0.00025037584249 +ATTTTT 0.000242585036337 0.000916690942399 +GCCTTG 0.000535360080192 0.000373732133844 +GTGGGG 0.000398034642956 0.000376041580228 +GCCTTA 0.000169739817092 0.000190170964334 +TTGACA 0.000188212528193 0.000268851413564 +CGCTAT 0.000163117524434 2.66780875427e-05 +GATACG 6.02977173654e-05 2.69169957893e-05 +TAGCAT 0.0 0.00022019376733 +GATACC 0.000231083159614 0.000120967208888 +GATACA 0.000215747323984 0.000197099303487 +TGAGCT 0.0 0.000395233876043 +GTCACC 0.000590778213494 0.000245836585804 +GATCAT 0.000173573776 0.000172651026246 +TGGCAC 0.000174619401157 0.00024822566827 +AAGACA 0.000531526121285 0.0004720030593 +AAGACC 0.000634694470072 0.000267099419756 +ACAATG 0.000209822114763 0.00025682636515 +AAGACG 0.000233174409928 8.29011615878e-05 +CCACTT 0.000195880446008 0.000295370228943 +TGAGCG 0.0 9.03869533162e-05 +GATCAC 0.000203199822104 0.000150034378897 +GATCAA 0.00019832023804 0.000168032133478 +AAGACT 0.000431494647968 0.000364494348307 +GAAGGG 0.000511659243309 0.00037142268746 +CTTCCA 0.000314384630426 0.000481639025248 +GCGGTA 4.39162565783e-05 3.63936895731e-05 +GCGGTG 0.000281273167132 0.000113959233652 +CGGTGT 6.97083437751e-05 8.52106079721e-05 +TCGTTA 2.16095865703e-05 3.61547813265e-05 +TCGTTC 5.68123001767e-05 5.31969029209e-05 +CTTCCC 0.00027255962416 0.000533163570442 +ACTTGT 0.000126172102233 0.00029744076708 +TTGGAG 0.000653515722891 0.00038472191319 +TGTGTG 0.000495626324241 0.00122384731151 +GCGGTT 6.13433425221e-05 6.00456059916e-05 +ACTTGC 0.000122338143325 0.000227440650812 +ATGTGA 1.74270859438e-05 0.000379306659599 +ACTTGA 7.66791781526e-06 0.000315836702072 +CGGTGG 9.72431395662e-05 0.000123117383107 +ACTTGG 0.000115018767229 0.000331126829858 +CGGTGA 9.06208469076e-06 7.50171894483e-05 +CGGTGC 7.35423026827e-05 9.79523811268e-05 +TGCCGC 0.000191697945381 0.000109499613048 +TTCCTA 0.000215747323984 0.000328976655638 +TAGACT 0.0 0.000199886566364 +TTCCTC 0.000583110295678 0.000498044058185 +ATGTGC 0.000209822114763 0.000274744483648 +TGGGTT 0.000112578975197 0.00034052388756 +TTCCTG 0.00109999766477 0.00066384638136 +TCCTTT 0.000355164011534 0.000558010028094 +GACCCA 0.000480987572048 0.000279522648581 +TTCCGT 0.000133491478329 8.26622533412e-05 +TAGACG 0.0 3.79067751353e-05 +TTCCTT 0.000334251508401 0.000663687109196 +TAGACC 0.0 0.000154334727336 +TAGACA 0.0 0.000225370112674 +TCCTTG 0.000381653182168 0.000413629811035 +TCCTTA 0.000178453360064 0.000267338328002 +TCCTTC 0.00056707737661 0.000503459311775 +ATCTCT 0.000376076514666 0.000389659350287 +TCCGCA 6.86627186184e-05 6.14790554715e-05 +ACCGTT 6.72685517429e-05 5.35154472498e-05 +TGGCGC 0.000101077098474 8.64847852876e-05 +TTTACG 4.07793811084e-05 4.18885792461e-05 +TGGCGA 7.14510523694e-05 7.19910183241e-05 +GGCCAT 0.000276045041349 0.000239863879637 +ATCTCG 0.000100728556755 5.20819977699e-05 +ATCTCA 0.000274650874474 0.000311695625797 +ATCTCC 0.000502597158618 0.000272355401182 +GGCCAA 0.000221323991486 0.000213504336424 +GGCCAC 0.000447527567036 0.000286132443405 +ACCGTG 0.000324143798554 9.74745646335e-05 +ACCGTA 5.15841743935e-05 3.40842431888e-05 +GGCCAG 0.000758426780273 0.000436485366631 +ACCGTC 0.000144644813333 4.87372823168e-05 +AGAATT 0.00023247732649 0.000383527371957 +GGCAGT 0.000426266522185 0.000288043709379 +CCATAA 7.31937609638e-06 0.000185233527237 +CAAAGG 0.00020145711351 0.000369591057569 +CCATAC 0.000172179609124 0.000150910375801 +CAAAGA 0.00024467628665 0.000440546806824 +GAAACG 0.000105608140819 8.21844368479e-05 +CAAAGC 0.000221672533205 0.000351035850412 +CAACGT 4.11279228273e-05 5.35154472498e-05 +GGCAGA 0.000250252954152 0.000431627565616 +GGCAGC 0.000767837406682 0.000402878939935 +CGTGAG 0.000219581282891 9.81912893735e-05 +GGCAGG 0.000285455667759 0.000461172552118 +CAACGC 5.576667502e-05 4.50740225348e-05 +CAAAGT 0.000171831067406 0.000325711576267 +CAACGA 4.53104234538e-05 4.34813008904e-05 +CTAACC 0.00010839647457 0.000153219822185 +CAACGG 7.35423026827e-05 5.39932637431e-05 +CGTGAA 0.00013314293661 8.02731708747e-05 +GGGGGT 0.000206685239293 0.000204664731298 +TACGCT 7.73762615903e-05 3.20933411334e-05 +GAAACC 0.000368408596851 0.000317429423717 +CGATCT 7.87704284658e-05 4.2207123575e-05 +CTCTAG 9.75916812851e-06 0.000244801316735 +TGAGCC 0.0 0.000359318002963 +CTCTAA 9.75916812851e-06 0.000234687534293 +CTCTAC 0.000519327161124 0.000221308672481 +GGGGGG 8.15587622168e-05 0.000296564770176 +CGATCC 6.86627186184e-05 4.83391019057e-05 +CGATCA 5.68123001767e-05 3.304897412e-05 +GGGGGC 0.000448921733911 0.000240978784788 +CGATCG 1.88212528193e-05 1.68032133478e-05 +GGGGGA 0.000199017321478 0.000290830972256 +TACGCG 5.576667502e-05 1.09897793459e-05 +CTCTAT 0.00032240108996 0.000208805807573 +TTCTGA 2.89289626667e-05 0.000524323965316 +CAGACC 0.000608902382875 0.000282071003212 +CAGACA 0.000517932994249 0.000450899497512 +CAGACG 0.000199017321478 9.15814945495e-05 +TGCGTG 0.000137325437237 0.000109181068719 +TAGTTG 0.0 0.000167872861313 +GCTAAT 0.000154055439743 0.000151467828377 +TAGTTC 0.0 0.00016811176956 +TAGTTA 0.0 0.000172252845835 +CAGACT 0.00040605110249 0.000372696864775 +GCTAAG 0.000308110879486 0.000206018544695 +TAGTTT 0.0 0.00031145671755 +GCTAAC 0.000171482525687 0.000123993380012 +GCTAAA 0.000224809408675 0.00018857824269 +TAAGTG 0.0 0.000222423577632 +TGCTGC 0.000326235048867 0.000528703949838 +AACCCT 0.000437419857189 0.000289238250612 +TATCAA 0.000123035226763 0.000197178939569 +AACCCC 0.000464606111261 0.000220512311659 +AACCCA 0.000397686101237 0.000319181417525 +AACCCG 0.000122338143325 6.753139772e-05 +TGCATC 0.000355512553253 0.000251251839394 +AGATTT 0.000187166903036 0.000414266899692 +ACGTAA 2.43979203213e-06 4.28442122327e-05 +AACTGG 0.000360740679036 0.000295529501107 +AACTGA 2.82318792289e-05 0.000354380565865 +AACTGC 0.000364574637944 0.00027299248984 +CCCAGA 0.000275347957911 0.00049501788706 +CCCAGC 0.00080896532951 0.000580706311526 +CCCAGG 0.000382350265606 0.000561275107465 +AACTGT 0.000293472127293 0.000374608130748 +AGTTTT 0.000178104818345 0.000502264770542 +ACGTAT 5.75093836144e-05 3.81456833819e-05 +CCCAGT 0.000440556732658 0.000362742354498 +CTCCAA 0.000243630661494 0.000325870848432 +TTGACG 4.80987572048e-05 4.37998452193e-05 +TATAAT 0.000177756276626 0.000291786605243 +CGCATA 4.1825006265e-05 2.80319009404e-05 +ATACTG 0.000159632107245 0.000241934417775 +CGCATC 0.000298003169638 5.21616338521e-05 +ATACTA 5.85550087711e-05 0.000150910375801 +ATACTC 9.16664720642e-05 0.000141831862428 +CGCATG 0.000228991909301 6.00456059916e-05 +GCGCAA 3.10202129799e-05 3.69511421487e-05 +ATACTT 9.89858481606e-05 0.000272435037264 +CGCATT 0.000118504184418 3.87031359574e-05 +GCGCAC 9.20150137831e-05 8.27418894234e-05 +GCTCCG 0.000129308977703 0.00014549512221 +TATTGT 7.42393861204e-05 0.000302935656753 +GCTCCC 0.000348193177156 0.000333595548407 +GCTCCA 0.000359695053879 0.000337895896846 +CCTACT 0.000186818361317 0.000202514557078 +TGTACT 9.93343898795e-05 0.000270603407373 +TTTAGT 0.000134537103486 0.000283822997021 +TATTGG 8.22558456546e-05 0.000170819396355 +GCTCCT 0.000408142352803 0.000417213434734 +GCGCAG 0.000218187116016 0.000125108285163 +GCTGGG 0.00051444757706 0.000543277352884 +TTTAGG 8.12102204979e-05 0.000237952613664 +TGTACG 2.30037534458e-05 4.69056524258e-05 +CCTACG 4.56589651727e-05 4.54722029459e-05 +TGTACA 0.000119549809574 0.000343072242191 +CCTACA 0.000196577529446 0.000222503213714 +TGTACC 0.000136628353799 0.000193674951952 +CCTACC 0.000217838574297 0.000215495238479 +TTCGCG 4.98414657992e-05 2.00682927187e-05 +TTCGCA 7.24966775261e-05 4.1490398835e-05 +TTCGCC 0.000177756276626 5.79750678539e-05 +AGTATC 0.000147781688803 0.000149636198486 +GACTAA 1.35931270361e-05 0.000150990011883 +AGTATA 7.52850112771e-05 0.000183083353017 +GACTAC 0.000531526121285 0.000131160627411 +AGTATG 0.000160677732402 0.000195665854007 +TTTGGA 0.000561152167389 0.000446121332579 +GACTAG 1.3941668755e-05 0.000142070770675 +TTCGCT 0.000103168348787 5.99659699093e-05 +GTGTAT 0.00025408691306 0.000290193883598 +GACTAT 0.000442996524691 0.000155131088159 +AGTATT 0.000153358356305 0.000298953852642 +TTACTC 9.20150137831e-05 0.000190808052992 +GGTCTT 0.000172876692562 0.000254596554848 +TTACTG 0.000212958990233 0.000305563647466 +ACCTTG 0.000348541718875 0.000305085830973 +ACCTTC 0.000639574054136 0.000288760434119 +ACCTTA 0.000118155642699 0.000181888811783 +TTACTT 0.000123732310201 0.000321411227828 +ACCTTT 0.000355861094972 0.000345620596821 +ACAGGG 0.000322749631679 0.00033479008964 +CTGGGA 0.000566728834891 0.00059488153416 +CTGGGC 0.00104248828116 0.000466109989216 +ACAGGC 0.000386532766233 0.000289397522776 +ACAGGA 0.000459029443759 0.000424380682134 +CTGGGG 0.00058276175396 0.000519227256054 +CAGGAC 0.000866823254843 0.00038328846371 +GCAGCT 0.000653167181172 0.000435211189316 +CAGGAA 0.00094210826612 0.000552674410585 +TCGCTT 3.83395890763e-05 7.35837399684e-05 +AGGACC 0.000242933578056 0.000314881069086 +AGGACA 0.000241539411181 0.000432901742931 +GCGCAT 3.27629215743e-05 5.12856369477e-05 +TTATAC 7.24966775261e-05 0.000180057181892 +ACAGGT 0.000230386076177 0.000261126713589 +CTGGGT 0.000452058609381 0.000413151994541 +TTATAG 3.13687546988e-06 0.000214300697246 +CTCCGA 0.000187863986474 8.24233450945e-05 +TCGCTG 0.000213307531952 0.000111809059433 +GAGTTG 0.000410930686554 0.00025037584249 +GCAGCG 0.000189258153349 0.000172571390164 +AGGACT 0.000220278366329 0.000345859505068 +GCAGCA 0.000552787166136 0.000455438754199 +GCAGCC 0.000780036366843 0.000429716299643 +CAGGAT 0.000655258431486 0.00031217344229 +TGCTGA 2.64891706345e-05 0.00046985288508 +CCTCAG 0.000690461145092 0.000520421797288 +CCTCAA 0.00022934045102 0.000282389547541 +CCTCAC 0.000281273167132 0.000324835579363 +TATGTT 0.000200062946634 0.000309067635084 +ATGGGC 0.000453104234538 0.000202116376667 +TCTTTG 0.000257920871968 0.000493743709745 +ATGGGA 0.000333205883245 0.000309943631988 +TCTTTA 0.000135234186924 0.000404312389415 +ATGGGG 0.000306368170891 0.000252207472381 +TCTTTC 0.000239796702586 0.000542640264226 +CCTCAT 0.000194486279132 0.000285256446501 +TCTTTT 0.000212261906795 0.000721104724474 +GCTAGC 0.000148478772241 0.000160705613914 +TATGTA 0.000125823560514 0.000359955091621 +ATGGGT 0.000242933578056 0.000211752342615 +TATGTC 0.000261406289156 0.00018499461899 +GAAAGA 0.000442647982972 0.000539215912691 +ATCAAG 0.000843819501397 0.000237554433253 +CATGAT 0.000291729418699 0.000236598800266 +ATCAAC 0.000629466344289 0.000155290360323 +GAAAGG 0.000367362971695 0.000423026868736 +ATCAAA 0.000491792365333 0.000302218932013 +GGAACT 0.000217838574297 0.000316633062895 +GTCAGG 0.000184727111004 0.000273151762004 +CATGAG 0.000474365279389 0.000277611382608 +ATCAAT 0.000422781104996 0.000189135695265 +GTCCAA 0.000173922317719 0.000156883081967 +CATGAC 0.000334948591839 0.00020617781686 +CATGAA 0.000431494647968 0.000345620596821 +TGACCT 0.0 0.000358601278223 +GTAGCG 4.07793811084e-05 3.6712233902e-05 +CAAGTT 0.000203548363823 0.000285176810419 +GCGGCT 0.000183332944128 0.00013577952018 +GCTTTA 0.000159283565526 0.000254596554848 +GCTTTC 0.000346101926843 0.000365211073047 +TTTCTC 0.000257920871968 0.000598146613531 +GCGGCG 0.000243979203213 0.000234528262129 +CAAGTG 0.000410930686554 0.000324517035034 +GTAGCT 0.000197623154602 0.000215813782808 +TTCTTT 0.000414067562024 0.000867714751836 +GCGGCC 0.000351330052626 0.00017169539326 +CAAGTC 0.000211216281638 0.000240341696131 +GCGGCA 0.000119201267855 0.000100102555347 +CAAGTA 0.000156146690056 0.000195347309678 +AACGGT 8.85295965943e-05 5.10467287011e-05 +GGGGAA 0.000444390691566 0.00037142268746 +TAATCG 0.0 2.88282617625e-05 +CTTGTG 0.000389321099984 0.000378191754448 +TAATCA 0.0 0.000194630584938 +TAATCC 0.0 0.000157121990214 +TGCGAA 5.36754247068e-05 4.3322028726e-05 +CGGCCC 0.000307065254329 0.00014007986862 +AAAATT 0.00037503088951 0.000559523113656 +TTGATA 0.000101425640193 0.000230307549771 +CGGCCG 0.000104562515663 0.000120728300641 +CTTGTA 0.000117458559261 0.000255870732163 +GGTCTG 0.000314384630426 0.000292423693901 +TAATCT 0.0 0.000214937785903 +AGTTTA 0.000120595434731 0.00027912446817 +TGCGAC 0.000107350849414 4.32423926438e-05 +GGTCTC 0.000223763783518 0.000261524894 +GGAGGC 0.000526297995502 0.000425575223367 +GGTCTA 7.66791781526e-05 0.000136894425331 +AAAATG 0.000463909027823 0.000616542548523 +AAAATC 0.000433237356562 0.000373095045186 +TCAATA 6.83141768996e-05 0.000205301819955 +AAAATA 0.000251647121028 0.000736872668753 +TCGTCA 5.22812578313e-05 5.49488967297e-05 +ATCCCT 0.000414416103743 0.000274107394991 +TTCAGG 0.000278136291662 0.000367759427678 +ATATCC 9.7940223004e-05 0.000159909253092 +TCGTCG 3.52027136064e-05 1.96701123076e-05 +TTTAGC 0.000119898351293 0.000198692025131 +TGCCAA 0.000169739817092 0.000306439644371 +TCGGGA 0.000108047932851 9.41298491804e-05 +GAACAA 0.000419644229526 0.000284061905268 +ATCCCG 0.000134885645205 6.25143245403e-05 +GAACAC 0.00034087380106 0.000253640921861 +ATCCCC 0.000394897767486 0.000205700000366 +GAACAG 0.00072217844151 0.000342514789615 +ATCCCA 0.000404656935614 0.000306439644371 +AACGGA 0.000148130230522 6.55404956645e-05 +CACCAC 0.000349935885751 0.000318942509279 +CACCAA 0.00017984752694 0.000277929926937 +CACCAG 0.000666760308208 0.000375882308064 +AACATT 0.00042138693812 0.00038328846371 +AACGGG 0.000180196068659 6.30717771158e-05 +TCCGTC 0.000103168348787 7.03186605975e-05 +GAGTTA 0.000205639614136 0.000185313163319 +TCCGTA 2.96260461044e-05 4.05347658484e-05 +ACCAGA 0.000236311285397 0.00034378896693 +CACCAT 0.000223763783518 0.00031647379073 +AACATG 0.000612039258345 0.000300387302122 +AACATA 0.000200760030072 0.000243367867255 +AACATC 0.000775505324498 0.000237474797171 +CAGTCG 0.000112230433478 6.80888502955e-05 +GCACGG 0.000116761475823 8.93516842474e-05 +GTCAGA 0.000194486279132 0.000295927681518 +GCACGA 6.97083437751e-05 4.38794813015e-05 +CAGTCC 0.000425569438747 0.000286132443405 +GCACGC 8.12102204979e-05 8.05917152035e-05 +CAGTCA 0.000333205883245 0.000327702478323 +GCACCA 0.000239796702586 0.000250535114654 +GCAAGC 0.000168345650217 0.000251411111559 +GCACGT 4.56589651727e-05 6.63368564867e-05 +CAGTCT 0.000424175271871 0.0003613885411 +TAAAGC 0.0 0.000275142664059 +GCAAGG 0.000149175855679 0.00026582524244 +GTCAGT 0.000269771290409 0.000251570383723 +GTATAC 7.98160536224e-05 0.000112844328501 +TTCCCG 0.000138371062393 0.000109738521295 +GTATAA 7.31937609638e-06 0.000187383701456 +GTATAG 4.53104234538e-06 0.000132594076891 +CCGGAA 0.000158237940369 9.58818429892e-05 +CCGGAC 0.000163117524434 7.50968255306e-05 +CCGGAG 0.000349587344032 0.000163731785038 +CGTCTT 7.31937609638e-05 8.17066203546e-05 +TATTTG 0.00016102627412 0.000403834572922 +TTCCGG 0.00029138087698 9.22982192894e-05 +TTCCGA 0.000233174409928 6.41866822668e-05 +TTCCGC 0.000249904412434 6.22754162936e-05 +GTATAT 7.66791781526e-05 0.000263117615645 +CGTCTC 0.000106653765976 9.06258615629e-05 +CGTCTA 4.25220897028e-05 3.86234998752e-05 +CGTCTG 0.00017671065147 9.72356563869e-05 +CCGGAT 0.000135582728642 5.14449091121e-05 +CTCTTC 0.000878673673285 0.000526633411701 +TGTTAT 7.49364695582e-05 0.000283584088774 +CTCTTA 0.000136628353799 0.000274744483648 +CTCTTG 0.00031926421449 0.000384642277108 +CCCGAT 0.000118852726136 4.57111111925e-05 +TACGTA 4.35677148594e-05 3.53584205043e-05 +TACGTC 0.000123383768482 3.24118854623e-05 +TCTGGT 0.00024467628665 0.000349602400932 +CGCGAT 4.00822976707e-05 1.62457607723e-05 +TACGTG 0.000252692746185 5.78157956895e-05 +TGTTAG 4.87958406425e-06 0.000221308672481 +GGTTTC 0.000215747323984 0.000300546574287 +CTCGTG 0.000187863986474 9.71560203047e-05 +CTCTTT 0.000469485695325 0.000507680024133 +TGTTAA 5.576667502e-06 0.00033335664016 +CGCGAA 3.38085467309e-05 1.82366628277e-05 +CGCGAC 8.29529290923e-05 3.24118854623e-05 +GATATT 0.000317521505895 0.00022775919514 +TCTGGC 0.000415810270618 0.000344664963835 +TACGTT 6.16918842409e-05 4.85780101523e-05 +CGCGAG 0.000147084605365 5.16041812766e-05 +AGTCGT 5.36754247068e-05 4.68260163436e-05 +TTACCT 0.000156843773494 0.000242252962104 +CTCCAT 0.000236311285397 0.000368157608089 +TATGCC 0.000376076514666 0.000143663492319 +TTACCG 2.82318792289e-05 3.71900503953e-05 +CTCCAC 0.000300791503389 0.00034665586589 +AGTCGG 9.02723051887e-05 7.21502904885e-05 +TTACCC 8.78325131566e-05 0.000165563414929 +AGTCGA 6.37831345542e-05 3.94994967796e-05 +TTACCA 0.000140462312707 0.00022234394155 +AGTCGC 9.48033475341e-05 5.63027101274e-05 +GTACCG 3.65968804819e-05 3.29693380378e-05 +CCGACT 5.40239664257e-05 6.84870307066e-05 +GCCTAC 0.000494580699084 0.000148282385088 +GCCTAA 1.04562515663e-05 0.000140557685113 +GCCTAG 1.3941668755e-05 0.000199966202447 +GTGCGG 0.000233522951646 8.72811461098e-05 +CCGACA 5.75093836144e-05 5.08078204544e-05 +GATATC 0.000309156504642 0.000124073016094 +CCGACC 9.2363555502e-05 6.94426636932e-05 +CCGACG 4.07793811084e-05 2.81911731048e-05 +GCCTAT 0.000331811716369 0.000134505342864 +TGACGG 0.0 5.94085173338e-05 +TGACGT 0.0 7.43801007906e-05 +CCCGAG 0.00043079756453 0.000160785249996 +CTCGTT 6.41316762731e-05 6.42663183491e-05 +CCCGAA 0.000144644813333 6.72924894733e-05 +CGCACA 0.000137325437237 8.75996904386e-05 +ATACAC 8.29529290923e-05 0.000209522532313 +CGCACC 0.000191349403663 6.64961286511e-05 +ATACAA 0.000102471265349 0.000245756949721 +ACTGCT 0.000392109433735 0.000379625203928 +ATACAG 0.000210519198201 0.000265028881618 +ATTGCC 0.000461120694072 0.00018284444477 +GGGTCC 0.00022620357555 0.000227440650812 +GAGCGT 0.000169391275373 6.84073946243e-05 +CTCACT 0.00035934651216 0.00036712233902 +GGGTCT 0.000210170656482 0.000269488502222 +ACTGCA 0.000339828175903 0.000328021022652 +TTTGTC 0.000379213390136 0.000356371467921 +ACTGCC 0.000466000278136 0.000311217809304 +CGCACT 8.33014708112e-05 5.59045297163e-05 +ATACAT 0.000102819807068 0.000327861750487 +ACTGCG 8.60898045622e-05 7.46190090373e-05 +CTCACC 0.000621101343036 0.000316792335059 +CTCACA 0.000377819223261 0.000390057530699 +CTCACG 0.000184378569285 8.08306234502e-05 +GTGGGT 0.00029451775245 0.000310580720646 +GTGAGG 0.000301140045108 0.000325870848432 +GATTTT 0.000360043595598 0.000444448974853 +ACAATT 0.000178453360064 0.000222821758043 +CTTGAA 0.000369454222008 0.000392844793576 +TAGTGA 0.0 0.000213902516835 +GTGAGA 0.000237705452273 0.00032005741443 +TCGACG 1.81241693815e-05 1.40159504702e-05 +TCGACA 3.97337559518e-05 3.71900503953e-05 +TAGAGG 0.0 0.000225847929167 +ACAATA 0.000123732310201 0.000217008324041 +GTGAGT 0.000228643367582 0.000264073248631 +ACAATC 0.000150570022554 0.00015194564487 +GATTTC 0.000346450468562 0.000283743360939 +CCAGTA 0.000187515444755 0.000206098180777 +TCGACT 3.27629215743e-05 3.75085947242e-05 +CTGGTT 0.000370499847164 0.000343231514355 +TTGAGT 0.000152312731149 0.000288999342365 +TCAAAA 0.000264891706345 0.000405586566731 +CGAACG 1.70785442249e-05 1.83959349921e-05 +CGAACC 9.2363555502e-05 4.23663957394e-05 +CGAACA 9.37577223775e-05 4.55518390281e-05 +CTGGTG 0.00132062457282 0.000429955207889 +CTGGTA 0.000272211082442 0.000216371235383 +CTGGTC 0.000592520922088 0.000305882191795 +CGAACT 6.97083437751e-05 4.92150988101e-05 +TTGCAT 0.000140462312707 0.000277452110444 +GACGAG 0.000531177579566 6.92037554465e-05 +TTGCAG 0.000406748185927 0.000330808285529 +GAGGGA 0.000400125893269 0.000425097406874 +TTGCAC 0.000156843773494 0.000202116376667 +TTGCAA 0.000175665026313 0.000265427062029 +TCCATC 0.000621101343036 0.000325154123692 +TCGCAT 3.17172964177e-05 3.68715060664e-05 +GTCGTG 0.00014255356302 5.38339915786e-05 +GTCGTA 3.27629215743e-05 2.00682927187e-05 +GTCGTC 0.000113624600353 5.36747194142e-05 +CCGTTT 7.28452192449e-05 8.50513358077e-05 +GAGCAA 0.000479593405172 0.000286689895981 +TTTTTG 0.000191349403663 0.000673641619473 +ATATCG 3.20658381365e-05 2.36519164184e-05 +GTCGTT 4.80987572048e-05 4.22867596572e-05 +TCAGAT 0.000452755692819 0.000328419203063 +TCGCAG 0.000131400228016 7.88397213948e-05 +GTGCTC 0.000482381738923 0.000288919706283 +TCGCAC 5.26297995502e-05 3.86234998752e-05 +CCGTTG 6.72685517429e-05 6.19568719648e-05 +CCGTTA 2.64891706345e-05 3.70307782309e-05 +CCGTTC 9.55004309718e-05 6.7929578131e-05 +GATCGG 0.000118852726136 4.19682153283e-05 +AATGCT 0.000431146106249 0.000330171196871 +GGTACG 2.57920871968e-05 2.43686411584e-05 +GGTACA 0.000134188561767 0.000157201626296 +TCCAGG 0.000343662134811 0.000482594658235 +GGTACC 0.000152312731149 0.000144300580977 +GCGGAC 0.000174967942875 6.65757647334e-05 +CAGGGA 0.000412324853429 0.000471047426313 +TTCAGC 0.000608553841156 0.000304687650562 +TATTTC 0.000242236494618 0.000365768525622 +TATTTA 0.000110487724883 0.000563743826014 +CCCCCT 0.000416855895775 0.00031790724021 +GGTACT 0.000113973142072 0.000139124235633 +AATGCG 8.78325131566e-05 3.47213318466e-05 +AATGCC 0.000541633831132 0.000223140302372 +AATGCA 0.000387578391389 0.000301661479438 +CCCCCC 0.000221672533205 0.000376837941051 +CCCCCA 0.000525252370345 0.000418965428543 +TATTTT 0.00023247732649 0.000928715990814 +CCCCCG 0.00020773086445 0.000129966086178 +CTTGAG 0.000374333806072 0.000345859505068 +ATGATG 0.000553135707855 0.000310819628893 +GAAGTA 0.000348890260594 0.000233731901307 +ATGATA 0.000137673978956 0.000217167596206 +ATGATC 0.00040605110249 0.000157360898461 +TGCAAC 0.00029451775245 0.000159749980927 +TGCAAA 0.000313339005269 0.000358919822552 +TGCAAG 0.000432888814843 0.000278168835184 +GAAGTG 0.000697780521188 0.000357725281318 +ATGATT 0.000317521505895 0.000268771777482 +CTTGAT 0.000304276920578 0.000254755827012 +GTGCTT 0.000266285873221 0.000324039218541 +TTGAGG 0.000144296271614 0.000301980023767 +GCCATT 0.000531177579566 0.000263754704302 +TTGAGC 0.000175665026313 0.000223538482783 +TGCAAT 0.000215398782265 0.000209283624066 +GAGAAT 0.000672685517429 0.000308669454673 +TGTCTT 0.000123383768482 0.000536747194142 +TTCAGA 0.00026349753947 0.000484426288126 +AGTAGC 0.000185772736161 0.000171456485013 +AAGGCC 0.000813496371855 0.000298953852642 +ATAACC 9.7940223004e-05 0.00014334494799 +AAGGCA 0.000508522367839 0.000394676423467 +ATAACA 0.000123383768482 0.000227520286894 +AAGGCG 0.000196926071165 9.2138947125e-05 +ATAACG 2.96260461044e-05 3.49602400932e-05 +TATGCT 0.000267680040096 0.000213982152917 +GAGGGT 0.000342267967936 0.00023349299306 +TGTCTG 0.000259315038843 0.000552674410585 +GAGAAG 0.00224391158612 0.000557532211601 +GAGAAA 0.00119305830371 0.00062793050828 +TGTCTC 0.000169739817092 0.000453846032554 +GAGAAC 0.000995783690827 0.000291069880503 +TGTCTA 6.27375093976e-05 0.000265267789865 +TGTGGC 0.000445087775004 0.000378351026613 +TGTGGA 0.000355164011534 0.00046698598612 +TGTGGG 0.000432888814843 0.000454483121212 +ATAACT 0.000121989601606 0.000220830855988 +ACTGAC 0.000391760892016 0.000249738753832 +GGTATT 0.000117110017542 0.000176951374686 +AGGTAT 0.000107699391132 0.000175597561288 +ACCAAG 0.000869960130313 0.000311934534044 +GAGCAT 0.000369454222008 0.000256030004327 +ACCAAA 0.000493883615646 0.000341638792711 +ATCATC 0.000783870325751 0.000193515679787 +ACCAAC 0.000560106542233 0.000206416725106 +GGTCAC 0.000171133983968 0.000211194890039 +GATCGC 9.58489726907e-05 4.3322028726e-05 +GGTCAT 0.000135234186924 0.000189693147841 +ACCAAT 0.000315081713863 0.000172412118 +AGGTAG 1.04562515663e-05 0.000202036740584 +AGGTAA 1.35931270361e-05 0.000180933178797 +AGGTAC 0.000148478772241 0.000145893302621 +TTTTGC 0.000103865432225 0.000357327100907 +GCCGTC 0.000172179609124 7.27873791463e-05 +AATTGG 9.37577223775e-05 0.000198771661213 +GTCGGA 5.71608418956e-05 5.064854829e-05 +AATTGA 9.06208469076e-06 0.00024607549405 +ATCATG 0.000582413212241 0.000252685288874 +AATTGC 7.80733450281e-05 0.000177588463344 +TAGCCA 0.0 0.00023851006624 +TGGGGT 0.000149872939116 0.000327782114405 +CGCTCG 7.28452192449e-05 5.9488153416e-05 +GATAAT 0.00024781316212 0.00019001169217 +CGCTCA 0.000123035226763 7.84415409837e-05 +CGCTCC 0.000247116078683 0.00012646209856 +AATTGT 0.000100380015036 0.000299113124807 +AATCTT 0.000203896905542 0.000300944754698 +TCTTAT 0.000116412934104 0.000257304181643 +GTTATG 0.000125126477076 0.000150352923226 +CGCTCT 0.000163466066153 0.000109897793459 +GATAAA 0.000429403397654 0.000259215447616 +TCGAAG 8.43470959678e-05 6.06826946493e-05 +GATAAC 0.00026663441494 0.000124471196505 +TAGCCT 0.0 0.0002342097178 +TGGGGC 0.000252692746185 0.000338294077258 +GATAAG 0.000344707759968 0.00015552926857 +GATCCT 0.000376425056385 0.000244084591995 +AAGAAT 0.000582413212241 0.000423186140901 +GGGGCT 0.000377122139823 0.000352469299892 +GTTATC 0.000162768982715 0.000132116260398 +AAGAAC 0.000837197208738 0.000376360124557 +GATCCA 0.000297306086201 0.000213663608588 +AAGAAA 0.00135094770236 0.000889375766199 +GATCCC 0.000312641921831 0.000184596438579 +AAGAAG 0.00198773342275 0.000580308131115 +GATCCG 7.38908444016e-05 5.24005420987e-05 +GCCCCA 0.000424175271871 0.000332002826762 +TATTAA 5.92520922088e-06 0.000350717306083 +CAAGGG 0.000240145244305 0.000270762679538 +CAAGGC 0.000355164011534 0.000311615989715 +GGTTCT 0.000222021074924 0.000293777507298 +CAAGGA 0.000372591097478 0.000373493225597 +GGTTCA 0.000126869185671 0.000205700000366 +GGTTCC 0.000224112325237 0.000241536237364 +AAGGCT 0.000653515722891 0.000364573984389 +TGCATT 0.000212261906795 0.000338692257669 +GGTTCG 2.75347957911e-05 4.2207123575e-05 +TAGGCA 0.0 0.000186826248881 +ATTATA 0.000101425640193 0.000294494232038 +ATTATC 0.000183681485847 0.000169306310793 +TAGAAT 0.0 0.00027442593932 +GATAGT 0.000141159396145 0.000121524661463 +ATTATG 0.000164511691309 0.00022091049207 +AGTCTT 0.000171482525687 0.000343072242191 +TCCCAA 0.000231780243052 0.000327065389665 +TAGAAA 0.0 0.00042135451101 +TAGAAC 0.0 0.000199806930282 +ATTATT 0.000215398782265 0.000402002943031 +TAGAAG 0.0 0.00031073999281 +AGTCTA 8.29529290923e-05 0.000183800077757 +AGTCTC 0.00020459398898 0.000303174565 +AGTCTG 0.000305671087454 0.000348407859699 +TAACTC 0.0 0.000182286992195 +TAACTA 0.0 0.000172571390164 +TAACTG 0.0 0.000253322377532 +ATCTAT 0.000320309839646 0.000238430430157 +GCCCCG 0.000227946284144 0.000190330236498 +TAACTT 0.0 0.000278646651677 +ATCTAG 1.08047932851e-05 0.000166280139669 +ATCTAC 0.000472274029076 0.000166041231422 +ATCTAA 9.41062640963e-06 0.000190808052992 +GGTCAG 0.00030985358808 0.000276337205293 +CCATGT 0.000115367308948 0.000343550058684 +GCCCCC 0.000358300887004 0.000273470306333 +TGGAGG 0.000224460866956 0.000477577585055 +TGGAGA 0.000188561069912 0.000572663067222 +GGTCAA 0.000127217727389 0.000144459853142 +CCATGC 0.000116064392385 0.000282230275377 +TCCAGA 0.000308807962924 0.000469056524258 +CCATGA 1.70785442249e-05 0.000292264421736 +CCATGG 0.000147433147084 0.000355415834934 +TGGAGT 0.000169739817092 0.000358680914305 +TCAGTA 0.000150918564273 0.000236519164184 +TCAGTC 0.0001920464871 0.000269249593975 +CTCTCT 0.000406399644209 0.000795405189183 +GGGGAT 0.000341222342779 0.000202036740584 +TCAGTG 0.000416855895775 0.000456792567596 +CGATAT 6.20404259598e-05 2.58817267205e-05 +CTCTCG 0.000110139183165 9.96247388534e-05 +GGGGAC 0.00057335112755 0.000269807046551 +CTCTCC 0.000504688408931 0.000516678901423 +TCAGTT 0.000163117524434 0.000359477275127 +CTCTCA 0.000289638168385 0.000396348781194 +CGATAG 2.09125031325e-06 2.59613628027e-05 +CGATAA 1.74270859438e-06 2.73151762004e-05 +ATGCTG 0.000847653460305 0.000419761789365 +CGATAC 8.12102204979e-05 2.15017421986e-05 +TTCACT 0.000356558178409 0.00033550681438 +GTGTTT 0.000444390691566 0.0005064854829 +GCTACT 0.000194486279132 0.000181251723126 +GTGGTT 0.000375727972948 0.000295051684614 +GTGTTC 0.000447527567036 0.000319659234019 +GTGTTA 0.000135234186924 0.000218680681768 +GTGTTG 0.000295911919325 0.000296405498011 +CGTGCC 0.00017671065147 9.15018584673e-05 +GTGGTA 0.000293820669012 0.000195984398336 +GCTACA 0.000214353157108 0.000246473674461 +GTGGTC 0.000573002585831 0.000203948006558 +GCTACC 0.000240145244305 0.000154892179912 +GTGGTG 0.00106235515913 0.000362503446251 +GCTACG 6.83141768996e-05 4.21274874928e-05 +CGTGCA 9.30606389397e-05 8.79978708497e-05 +TTTCGT 6.16918842409e-05 6.37885018558e-05 +TGCCCT 0.000228294825863 0.000429955207889 +AGCGTT 6.44802179919e-05 6.37885018558e-05 +CGTGCG 4.00822976707e-05 5.00910957144e-05 +CACGGA 0.000122686685044 0.000104004723375 +TGCCCA 0.00022306670008 0.000379306659599 +TGCCCG 8.99237634698e-05 0.000112685056337 +ACAGTG 0.000582413212241 0.00043178683778 +AGCGTA 3.79910473574e-05 3.56769648332e-05 +AGCGTC 0.000147433147084 6.95222997754e-05 +GTACGT 2.40493786024e-05 3.87031359574e-05 +AGCGTG 0.000234568576803 9.59614790714e-05 +GGCCCC 0.000430449022811 0.000279522648581 +GGCCCA 0.000329720466056 0.000271877584689 +CACGTG 0.000293820669012 0.000146769299526 +GGCCCG 0.000147781688803 0.000128851181027 +CACGTA 5.05385492369e-05 4.86576462345e-05 +CACGTC 0.000150221480835 6.39477740202e-05 +ACGTGC 8.08616787791e-05 7.53357337772e-05 +ACGTGA 7.66791781526e-06 9.02276811518e-05 +ACGTGG 0.000102471265349 0.000106632714088 +AAATGG 0.000231083159614 0.000392526249247 +CACGTT 6.51773014297e-05 7.71673636682e-05 +GGGGCC 0.000469137153606 0.000280956098061 +TCTTAA 1.28960435984e-05 0.000346496593726 +GGCCCT 0.000432888814843 0.00031217344229 +GGGACA 0.000290335251823 0.000330091560789 +GGTATA 5.50695915823e-05 0.000122878474861 +GGGACC 0.000348541718875 0.000272753581593 +TCGTGG 5.68123001767e-05 8.38567945744e-05 +ACGTGT 7.35423026827e-05 0.000100500735758 +TCTTAG 8.71354297188e-06 0.000262799071316 +GCTTCC 0.000343662134811 0.000402401123442 +AGAGAG 0.000532223204723 0.000716167287377 +AGAGAA 0.000541982372851 0.000691161557561 +AGAGAC 0.000408490894522 0.000410683275993 +TCGTGA 3.48541718875e-06 6.57794039112e-05 +GTCTTT 0.000321355464803 0.000387110995656 +TCTATC 0.000142205021301 0.000192878591129 +TCTATG 0.000158237940369 0.000245995857968 +AGAGAT 0.000372242555759 0.000394596787385 +TTCACA 0.000390018183421 0.000361547813265 +GTCTTG 0.000260012122281 0.00028055791765 +TCTATT 0.000128263352546 0.000274027758908 +GTCTTC 0.000566031751454 0.000341320248382 +GTCTTA 0.000141507937863 0.000207213085928 +GCAGAG 0.00108535891258 0.000545984979679 +GAAGGC 0.000679307810088 0.000342275881368 +GCTCAC 0.000285804209478 0.0002651085177 +GCAGAC 0.000555924041606 0.000271001587784 +GCAGAA 0.00071590469057 0.000408214557444 +GCTCAG 0.00066327489102 0.00046268563768 +ATGCGT 8.53927211245e-05 4.95336431389e-05 +TTGCTG 0.000563243417703 0.000499636779829 +CTTGAC 0.000274650874474 0.000219875223001 +TTGCTA 0.000124429393638 0.000266303058933 +TTGCTC 0.000224460866956 0.000297679675327 +GCAGAT 0.000520372786281 0.000267338328002 +GCTCAT 0.00018890961163 0.000213902516835 +GTTTGC 9.30606389397e-05 0.000266701239344 +TTGCTT 0.00021992982461 0.000493186257169 +ATGCGG 0.000170785442249 4.41980256304e-05 +GAGAGG 0.000641665304449 0.00043895408518 +TAGCCG 0.0 4.29238483149e-05 +ATGCGC 0.000158586482088 4.45962060415e-05 +ATGCGA 7.63306364337e-05 3.27304297912e-05 +TGTAAG 0.00022620357555 0.000286530623817 +GGCTAG 7.66791781526e-06 0.000182605536523 +TGTAAC 0.000178801901783 0.000237634069335 +GGCTAC 0.00057648800302 0.000168748858218 +GACTGT 0.000411279228273 0.000315279249497 +GGCTAA 4.87958406425e-06 0.000152264189199 +ACTGTA 0.000189606695068 0.000312969803113 +TTGGTA 0.000127217727389 0.000211194890039 +ACTGTC 0.000354815469815 0.000307076733028 +TTGGTC 0.000173573776 0.000198134572556 +TTCGAC 0.000187166903036 3.03413473246e-05 +ACTGTG 0.000665017599614 0.000463880178914 +AATCAA 0.000222718158361 0.000272355401182 +GACTGC 0.000435677148594 0.000261445257918 +GGCTAT 0.000356906720128 0.000161820519065 +GACTGA 3.10202129799e-05 0.000333197367996 +GACTGG 0.000515841743935 0.000311217809304 +TGTAAT 0.000144644813333 0.000334710453558 +TGTGGT 0.000276045041349 0.000415381804843 +TTGGTT 0.000178453360064 0.000408533101773 +ACTGTT 0.000251298579309 0.000366087069951 +GTTTCT 0.000258966497124 0.000511024739586 +ATAATT 0.000128611894265 0.000328897019556 +CCTTTT 0.000228294825863 0.000500672048898 +GTTTCG 2.43979203213e-05 4.59500194392e-05 +GTTTCC 0.000211564823357 0.000354062021536 +GTTTCA 0.000176013568032 0.000292662602147 +ATAATG 0.000153358356305 0.000267656872331 +CCTTTA 0.000141856479582 0.000314881069086 +CCTTTC 0.000307065254329 0.000457748200583 +ATAATC 9.93343898795e-05 0.000160546341749 +ATAATA 8.78325131566e-05 0.000305245103137 +CCTTTG 0.000280576083695 0.00045368676039 +ACAGAA 0.000673731142586 0.000537225010635 +ACAGAC 0.000585201545992 0.000338532985504 +GCCCCT 0.000422084021558 0.000324437398952 +ACAGAG 0.000899934718136 0.000524323965316 +TTATCT 0.000124429393638 0.00028485826609 +CTGGAC 0.00130633436234 0.000343151878273 +CTGGAA 0.00114251975447 0.000580547039361 +CTGGAG 0.0022731890905 0.000644016996888 +ACAGAT 0.000520372786281 0.000333436276242 +GTGAAG 0.00104109411428 0.000348009679288 +TGGGGA 0.000196577529446 0.000477497948973 +CCTTGC 0.000147084605365 0.000317588695881 +TTATCA 0.000106653765976 0.00023492644254 +CTGGAT 0.000948730558779 0.000346178049397 +TTATCC 7.77248033092e-05 0.000164050329367 +CCAATG 0.000216095865703 0.00019829384472 +AAACCG 8.08616787791e-05 6.3868137938e-05 +AAACCA 0.000370848388883 0.00042493813471 +CCAATC 0.000125126477076 0.000138487146975 +AAACCC 0.000410930686554 0.000304289470151 +CCAATA 8.57412628433e-05 0.000165483778847 +TGTCGG 7.31937609638e-05 6.42663183491e-05 +GAGATC 0.000861943670779 0.00021302651993 +AACGAG 0.000338434009028 6.15586915537e-05 +GAGATA 0.000261754830875 0.000207929810668 +AACGAA 0.000169391275373 6.60183121578e-05 +GAGATG 0.000943502432995 0.000393163337905 +AACGAC 0.000214701698827 4.28442122327e-05 +AAACCT 0.000374682347791 0.000336382811284 +CCAATT 0.000141159396145 0.000151069647966 +ATTTGC 0.000100728556755 0.000274824119731 +GTCGAT 6.90112603373e-05 2.62002710494e-05 +ATTTGG 0.000116412934104 0.000331843554598 +AACGAT 0.000128960435984 4.2207123575e-05 +TGTCGT 4.94929240803e-05 6.42663183491e-05 +CCCTAC 0.000422781104996 0.000169067402547 +GAGATT 0.000528040704096 0.000262082346576 +CCCTAA 1.21989601606e-05 0.000181570267455 +TACAAC 0.00046809152845 0.000144937669635 +CATTAT 0.000144296271614 0.000235802439444 +CTACAC 0.000137673978956 0.000192878591129 +TGGATT 0.000193440653976 0.000333754820571 +ATCACA 0.000448573192193 0.000271081223866 +ATCACC 0.000618661551004 0.000186905884963 +CATGCT 0.00027569649963 0.000329693380378 +TGACAC 0.0 0.000249022029092 +ATCACG 0.000166602941622 5.2878358592e-05 +TGGATA 8.9575221751e-05 0.000228237011634 +CATTAG 7.31937609638e-06 0.000164368873696 +CATTAA 6.27375093976e-06 0.000269169957893 +CATTAC 0.000146038980209 0.000152901277857 +CATGCA 0.000231431701333 0.00030245784026 +TGACAT 3.48541718875e-07 0.000313527255688 +CATGCC 0.000335645675277 0.000258498722876 +ATCACT 0.000398034642956 0.000229829733278 +CATGCG 6.37831345542e-05 5.70990709495e-05 +GTAGAA 0.000348890260594 0.000248305304352 +GTAGAC 0.000236311285397 0.000163572512874 +GTAGAG 0.000365271721381 0.000211194890039 +ACAACA 0.000208427947887 0.000307315641275 +ACAACC 0.000201108571791 0.000199249477707 +GATTGC 0.000109093558008 0.000150352923226 +ACAACG 6.20404259598e-05 5.21616338521e-05 +ACTAAG 0.000189606695068 0.00019757711998 +GTAGAT 0.000237008368835 0.000171456485013 +TGCTAC 0.000240493786024 0.000200364382858 +GGGTAC 0.000144644813333 0.000113799961488 +TGATGC 0.0 0.000255870732163 +GATTGT 0.000124429393638 0.000208168718915 +TTCAGT 0.000401171518425 0.000418567248132 +ACAACT 0.000188561069912 0.000235324622951 +GGGTAA 4.53104234538e-06 0.000136416608838 +TTGCCT 0.00027569649963 0.000390614983274 +TAATAG 0.0 0.00015696271805 +AGTCCG 5.99491756466e-05 5.90103369227e-05 +TAATAC 0.0 0.000145176577881 +GTCCGA 0.000132445853173 4.50740225348e-05 +TAATAA 0.0 0.000411001820322 +GTCCGC 0.000146387521928 6.04437864026e-05 +TGTTTA 7.59820947148e-05 0.000446200968661 +TCAACA 0.000191697945381 0.000252207472381 +CACATC 0.000488655489863 0.000261843438329 +GTCCGT 9.48033475341e-05 5.80547039361e-05 +TAATAT 0.0 0.000284619357843 +ATTCGC 9.13179303453e-05 3.03413473246e-05 +TTCTCC 0.000593915088964 0.000470091793327 +ATTCGA 0.000130703144578 3.76678668886e-05 +TAACGA 0.0 3.52787844221e-05 +ATTCGG 0.000113624600353 4.02958576018e-05 +TTCTCG 0.000108745016289 8.38567945744e-05 +GAGCTA 0.000341919426217 0.000219078862179 +TCGTAC 4.4613340016e-05 2.41297329117e-05 +TACCTT 0.000209473573044 0.000243447503337 +TCGTAA 2.43979203213e-06 3.32878823667e-05 +TCGTAG 1.74270859438e-06 3.36064266955e-05 +GAACCT 0.000303231295422 0.000262719435234 +ATCCAA 0.000272211082442 0.00023134281884 +ATCCAC 0.000456938193446 0.000202196012749 +TGAACC 0.0 0.000235722803362 +TTCTCT 0.00043707131547 0.000689011383341 +ATCCAG 0.000915967637204 0.000304528378398 +GAACCC 0.000307065254329 0.000227679559058 +TTATAT 0.000108745016289 0.000394596787385 +GAACCA 0.000316824422458 0.000265904878522 +GAACCG 7.84218867469e-05 6.76906698844e-05 +TACCTC 0.00035342130294 0.000206018544695 +TCGTAT 2.54435454779e-05 3.0102439078e-05 +ACCATC 0.000785613034345 0.000240421332213 +ACCATA 0.000169391275373 0.000169784127286 +ACCATG 0.000585201545992 0.000329534108214 +ATGTTG 0.000270816915566 0.000283185908363 +AGCTCT 0.000392457975454 0.00043895408518 +TGTCCT 0.000209125031325 0.000497566241691 +AGTGGT 0.000314733172144 0.000265267789865 +TGATGT 0.0 0.000352071119481 +ATGTTT 0.000372939639197 0.00053093376014 +ACCATT 0.000387926933108 0.000240023151802 +AGCTCG 0.000122338143325 9.06258615629e-05 +AGTGGC 0.00047715361314 0.00029815749182 +AGCTCC 0.00052385820347 0.000370626326638 +AGCTCA 0.000324143798554 0.000367520519431 +TCCATG 0.000531177579566 0.000333834456653 +CAGTAA 1.98668779759e-05 0.000242730778597 +CAGTAC 0.000499111741429 0.000169624855122 +CAGTAG 1.70785442249e-05 0.000223857027112 +TTAATA 7.84218867469e-05 0.000346257685479 +CAGTAT 0.000411279228273 0.000239704607473 +AAAGTA 0.000253041287903 0.000347292954548 +AAAGTC 0.000388972558265 0.000293618235134 +AAAGTG 0.000581716128803 0.000389659350287 +GATCTA 0.000121641059887 0.000139681688208 +GATCTC 0.000315430255582 0.000209363260148 +TGTCCA 0.000160329190683 0.000328498839145 +GATCTG 0.00049597486596 0.000275461208388 +TCCCTT 0.000210170656482 0.000420717422352 +CCGGCC 0.000222718158361 0.000159988889174 +ATTAGG 6.02977173654e-05 0.000136018428427 +AAAGTT 0.000315430255582 0.000412196361555 +ACTCTC 0.000211216281638 0.000260330352767 +ATTAGC 0.000110487724883 0.000131797716069 +TCCCTC 0.000372242555759 0.000457588928418 +TGTCCG 4.87958406425e-05 7.17521100775e-05 +TCCCTA 0.00013000606114 0.000218123229192 +TTAATG 0.000144296271614 0.000305643283549 +TCCCTG 0.000775853866216 0.00054638316009 +GATCTT 0.000268028581815 0.000236041347691 +CACAAT 0.000243630661494 0.000203868370475 +AAGTGC 0.000358997970442 0.000260171080603 +TGTTCT 0.000164511691309 0.000546223887926 +AAGTGG 0.00036248338763 0.000314243980428 +TGATTG 0.0 0.00024965911775 +TGCGCA 4.11279228273e-05 7.91582657236e-05 +TCTGAT 0.000441602357815 0.000320694503088 +TGTATT 0.000101774181912 0.00044866968721 +CGAGGT 0.000116412934104 6.94426636932e-05 +TGTTCA 0.000116064392385 0.000372696864775 +CACAAG 0.000560106542233 0.000298794580478 +TGTTCC 0.000198668779759 0.000347611498877 +AAGTGT 0.000366665888257 0.000363459079238 +CACAAC 0.000360740679036 0.000204186914804 +TGTTCG 2.64891706345e-05 5.59841657985e-05 +TCTGAA 0.000555575499887 0.000497645877774 +TCTGAC 0.000509567992996 0.000307713821686 +TCTGAG 0.000766094698088 0.000525438870467 +CGCGCC 0.000121989601606 0.00011387959757 +CGCGCA 4.00822976707e-05 5.97270616627e-05 +GGTAAA 0.000188212528193 0.000195108401431 +CGCGCG 7.28452192449e-05 0.000112366512008 +CTCCCT 0.000307762337767 0.000550603872448 +AGCGGG 0.000151267105992 0.000121126481052 +AGCGGA 9.16664720642e-05 8.64051492054e-05 +ACCTCT 0.000312293380112 0.0003376569886 +GGTAAG 0.000104213973944 0.000127815911958 +CGCGCT 4.14764645462e-05 6.80092142133e-05 +ACCTCC 0.000408142352803 0.000292184785654 +ACCTCA 0.000310550671518 0.000318464692785 +ACCTCG 0.000117458559261 7.17521100775e-05 +CTCCCC 0.000275347957911 0.000468976888175 +GCCTCT 0.000500157366586 0.000476383043822 +TAAGCC 0.0 0.000180933178797 +CGGGAG 0.000602977173654 0.000161263066489 +CCCATG 0.000523161120032 0.00029130878875 +CGGGAA 0.000310202129799 0.000114277777981 +CCCATA 0.000126520643952 0.000168908130382 +CGGGAC 0.000330417549494 0.000105995625431 +CCCATC 0.00056707737661 0.000292662602147 +TTGTTG 0.000179150443502 0.000405984747142 +CCTGCT 0.000585898629429 0.000569397987851 +CCGAAT 5.64637584578e-05 4.37202091371e-05 +CCCATT 0.00028510712604 0.00025180929197 +CGGGAT 0.000203896905542 6.40274101024e-05 +GCCTCG 0.000218187116016 0.000137690786153 +GCCTCA 0.000364923179662 0.000341399884464 +TAAGCT 0.0 0.0002068945416 +GCCTCC 0.000654212806329 0.00044038753466 +CCGAAC 6.13433425221e-05 4.0375493684e-05 +CCTGCG 0.000144296271614 0.00013864641914 +CCGAAA 6.97083437751e-05 5.66212544562e-05 +CCGAAG 0.000144644813333 9.13425863028e-05 +CCTGCC 0.000678262184931 0.000614551646468 +CCTGCA 0.000481684655486 0.00044182098414 +GTACTG 0.000189258153349 0.00020116074368 +CAAGGT 0.000218535657735 0.000257622725972 +CCATTC 0.000203548363823 0.000259374719781 +CCATTA 9.16664720642e-05 0.000183003716935 +CCATTG 0.000161374815839 0.000251172203312 +TATAAC 0.000164511691309 0.000155688540734 +GATTTG 0.000302882753703 0.000283822997021 +GTACTC 8.6786888e-05 0.000129727177931 +GTCGAA 4.7401673767e-05 3.21729772156e-05 +CCATTT 0.000239099619148 0.000385757182259 +TCAGCG 8.15587622168e-05 9.3970577016e-05 +TCTACC 0.000215050240546 0.000218441773521 +TCTACG 5.05385492369e-05 3.9658768944e-05 +ACTTTC 0.000260709205719 0.000312412350537 +CGCAAC 0.000162768982715 3.20137050512e-05 +TGCTTA 9.44548058152e-05 0.000274107394991 +CGCAAA 0.000156843773494 4.34016648082e-05 +ATACCG 2.12610448514e-05 2.7155904036e-05 +CGCAAG 0.000361089220755 5.52674410585e-05 +ATACCA 0.000130703144578 0.000191684049896 +ATACCC 9.02723051887e-05 0.000134266434618 +TCTACT 0.000191697945381 0.000241775145611 +CCGAGT 7.14510523694e-05 9.34927605227e-05 +ATACCT 0.000113624600353 0.000190808052992 +GATAGG 8.50441794056e-05 0.000128930817109 +CGCAAT 0.000100728556755 2.68373597071e-05 +TAGTAA 0.0 0.000186348432388 +TGGGTG 0.000318567131052 0.000383447735875 +TAGTAC 0.0 9.92265584423e-05 +CTCAAG 0.000847304918586 0.000308271274262 +GTTTTG 0.000191000861944 0.000542003175568 +CTCAAA 0.000401171518425 0.000353186024632 +TAGTAG 0.0 0.000126780642889 +CTCAAC 0.000600188839903 0.000199806930282 +GTGTGC 0.000363180471068 0.000360990360689 +GTGTGA 3.10202129799e-05 0.000367918699842 +GTGTGG 0.000323795256835 0.000420797058434 +TAACGG 0.0 3.89420442041e-05 +TTGCGT 4.4613340016e-05 4.38794813015e-05 +CTCAAT 0.000362831929349 0.000183879713839 +TAGTAT 0.0 0.000158316531447 +GTTCTC 0.000239796702586 0.00031432361651 +GTGTGT 0.000310550671518 0.00102842036575 +ATCTTT 0.000376076514666 0.000400728765716 +GTTGGG 0.000209473573044 0.000256030004327 +GTTGGA 0.000264543164626 0.000244004955913 +GTTGGC 0.000253389829622 0.000188339334443 +CCTTGG 0.000153358356305 0.000410444367746 +CCTTGA 1.32445853173e-05 0.0003412406123 +GGGAAA 0.000540936747694 0.000446280604744 +AGGATT 0.000202851280385 0.000274187031073 +GGACGT 6.48287597108e-05 5.96474255805e-05 +GTTGGT 0.000197274612883 0.00023205954358 +ATCTTG 0.000350632969189 0.000277133566115 +GAGAGT 0.000485518614393 0.000265188153782 +ATCTTA 0.000151615647711 0.000229989005442 +ATCTTC 0.000649681763984 0.000310978901057 +AGGATC 0.00028510712604 0.000233811537389 +AGGATA 0.000115018767229 0.00020116074368 +AGGATG 0.00033146317465 0.000366246342116 +GACATG 0.000773762615903 0.000253640921861 +GACATC 0.00088006784016 0.000234607898211 +GACATA 0.000246767536964 0.000164448509778 +TCGGCG 6.65714683052e-05 5.14449091121e-05 +GAATAT 0.000346799010281 0.000254994735259 +GGTGCA 0.000232825868209 0.000211911614779 +TCGGCC 0.000181241693815 8.05120791213e-05 +ATCAGA 0.000258617955405 0.000309147271166 +TTGCGA 5.64637584578e-05 3.79864112175e-05 +GACATT 0.000585201545992 0.0002995909413 +TTGCGG 9.09693886265e-05 5.20819977699e-05 +GAATAG 1.18504184418e-05 0.000167076500491 +TCGGCT 0.000120595434731 9.04665893984e-05 +CATAGA 8.01645953413e-05 0.00022019376733 +GAATAC 0.000300442961671 0.000157281262378 +GAATAA 1.25475018795e-05 0.000293299690805 +TGCCTG 0.000533965913317 0.000583254666157 +CACCGC 0.000178104818345 0.000106393805842 +TGCAGA 0.000197274612883 0.000466508169627 +TTAATT 0.00012094397645 0.000429557027478 +GGACGA 8.85295965943e-05 6.29125049514e-05 +TGAGGT 1.04562515663e-06 0.000305006194891 +TTTCTA 0.0001551010649 0.000486257918017 +TTATAA 7.66791781526e-06 0.000362184901923 +GAAATG 0.000573002585831 0.000442537708879 +AATGAT 0.000470879862201 0.000282230275377 +GAAATA 0.000309505046361 0.000383845916286 +GAAATC 0.000487958406425 0.000269966318715 +GAAATT 0.000453801317976 0.000343709330848 +AATGAA 0.000758426780273 0.000495973520047 +AATGAC 0.000639225512417 0.000241058420871 +AATGAG 0.000782127617156 0.000321968680403 +TCAGCA 0.000352724219502 0.000399773132729 +TACTAG 7.31937609638e-06 0.000118657762503 +CTTGGA 0.000304276920578 0.000392844793576 +CTTGGC 0.000290683793542 0.000332799187585 +GTATTG 8.88781383132e-05 0.000177190282933 +GTCCTT 0.000262103372594 0.00032077413917 +CTTGGG 0.000274650874474 0.000398339683249 +AGCCCT 0.000484472989237 0.000421832327503 +GGGAAT 0.000248161703839 0.000244164228077 +TTGAAT 0.000241190869462 0.000348726404028 +GTCCTA 0.000138022520675 0.000166996864409 +GTCCTC 0.00040605110249 0.000297759311409 +TGCACG 9.82887647228e-05 8.02731708747e-05 +CTTGGT 0.000211913365076 0.000319022145361 +GTCCTG 0.000705448439004 0.000423026868736 +TGCACC 0.000251647121028 0.000219636314754 +TTGAAA 0.000386532766233 0.000513174913806 +AGCCCG 0.000159980648964 0.000136416608838 +AGCCCA 0.000414764645462 0.000403675300758 +AGCCCC 0.000531526121285 0.000356849284414 +TTAACT 0.000110139183165 0.000269169957893 +ATAAAT 0.000171831067406 0.00055068350853 +TGGTCG 4.35677148594e-05 4.66667441791e-05 +TGGTCA 0.000131400228016 0.000262719435234 +TGGTCC 0.000157889398651 0.000245836585804 +ACGATT 4.84472989237e-05 4.07736740951e-05 +GAGACT 0.000451361525944 0.000334153000982 +GATTCA 0.000224112325237 0.000205540728202 +GAGGAG 0.00278066583319 0.000580387767197 +ATAAAG 0.000290683793542 0.000428442122327 +ATAAAA 0.000240842327743 0.000702708789482 +TCAGCC 0.000455892568289 0.000364016531814 +ATAAAC 0.00014569043849 0.000302218932013 +GAGACG 0.000268377123534 9.45280295915e-05 +ACGATG 9.2363555502e-05 5.8373248265e-05 +CTACAG 0.000429403397654 0.00031790724021 +GAGACC 0.00073751427714 0.000290990244421 +ACGATC 7.38908444016e-05 2.89078978447e-05 +GAGACA 0.000606114049124 0.000425097406874 +ACGATA 2.82318792289e-05 3.00228029958e-05 +GGTTAC 0.000158237940369 0.000117542857352 +ATGTGT 0.000214701698827 0.000473117964451 +GGTTAA 7.31937609638e-06 0.000157599806707 +ACCACT 0.000327977757462 0.000253800194025 +GCACTT 0.000182635860691 0.000262560163069 +CTTCCT 0.000412673395148 0.000740854472864 +TAAACT 0.0 0.000305484011384 +CTCAGT 0.000396989017799 0.000418248703803 +TCCGCT 7.28452192449e-05 7.91582657236e-05 +ACCACG 0.000191000861944 8.14677121079e-05 +ATGTGG 0.000231083159614 0.000356928920496 +ACCACC 0.000591126755213 0.000277292838279 +GAGGAA 0.00145864709349 0.000513891638546 +ACCACA 0.000448573192193 0.000341718428793 +GGTTAT 0.000141159396145 0.000150273287143 +TCCGCC 0.000127914810827 0.000105517808937 +GACGTG 0.000389321099984 8.44938832322e-05 +TCCGCG 5.19327161124e-05 5.93288812516e-05 +AACGTC 0.000154055439743 5.33561750853e-05 +AACGTA 5.92520922088e-05 3.93402246152e-05 +AACGTG 0.000307762337767 8.35382502456e-05 +CGTGAC 0.000139765229269 6.99204801865e-05 +AGTGTG 0.000465303194699 0.000432264654273 +TCTTCG 7.70277198714e-05 7.5256097695e-05 +AGTGTA 0.000143599188177 0.00024320859509 +TCTTCA 0.000347496093719 0.000497486605609 +AGTGTC 0.000314384630426 0.000281195006308 +TCTTCC 0.000412324853429 0.000544551530199 +CGTGAT 0.000103516890506 6.1319783307e-05 +TAAGTC 0.0 0.000156405265474 +AACGTT 8.36500125301e-05 7.12742935842e-05 +CCGTGA 4.87958406425e-06 9.00684089873e-05 +TCTTCT 0.00040605110249 0.000604756408355 +AGTGTT 0.000220626908048 0.000388703717301 +GTGCGC 0.000257572330249 8.64051492054e-05 +TTGGCA 0.000325189423711 0.000280319009404 +AAAGGT 0.000299745878233 0.000309625087659 +TTGGCC 0.000354815469815 0.000244403136324 +GAGTAG 1.1153335004e-05 0.000162935424216 +TTAACG 2.68377123534e-05 4.29238483149e-05 +TTGGCG 8.74839714377e-05 5.79750678539e-05 +GACTTC 0.000825346790297 0.000296564770176 +TCGAGT 4.04308393895e-05 5.37543554964e-05 +GACTTA 0.000208427947887 0.00017639392211 +GACTTG 0.000489352573301 0.000289477158859 +AAAGGG 0.00034401067653 0.000338851529833 +AAAGGA 0.00053292028816 0.000536110105484 +TTGGCT 0.000400474434988 0.000369750329733 +AAAGGC 0.00048970111502 0.000337099536024 +GAGTAC 0.000496671949397 0.000127099187218 +GTATGG 6.69200100241e-05 0.00015409581909 +GACTTT 0.000566380293172 0.000354221293701 +TAAACC 0.0 0.000186666976716 +CAAGAA 0.000659092390393 0.000437122455289 +GACGTT 9.68945978473e-05 5.61434379629e-05 +CAAGAC 0.00039350360061 0.000258817267205 +GATTCG 7.70277198714e-05 3.84642277108e-05 +CAAGAG 0.00063852842898 0.000374847038995 +TTCTTG 0.00033146317465 0.000458863105734 +TTCTTC 0.000744136569799 0.000544551530199 +TTCTTA 0.000168694191936 0.000376599032804 +CAAGAT 0.000408839436241 0.000277850290855 +AGGGCT 0.000218187116016 0.000357804917401 +TACGGG 0.000129308977703 3.36064266955e-05 +TACGGA 0.000100728556755 4.36405730549e-05 +TACGGC 0.000168345650217 3.16951607223e-05 +CTCAGA 0.000231083159614 0.000523209060165 +TAGAGT 0.0 0.000208965079737 +TACGGT 7.14510523694e-05 3.62344174087e-05 +AGGGCG 6.27375093976e-05 0.000100261827511 +AGGGCA 0.000183332944128 0.000335586450462 +AGGGCC 0.00025408691306 0.000276098297046 +TCGAGA 4.1825006265e-05 6.41866822668e-05 +CTGTGC 0.000399428809831 0.000461172552118 +TAGAGA 0.0 0.000312571622701 +GGCGAG 0.000380607557012 0.000114038869735 +CCGTGT 6.76170934618e-05 0.000123993380012 +GTGCTG 0.00109198120524 0.000478055401548 +GTGCTA 0.000197971696321 0.000187065157128 +ATCTGT 0.000289638168385 0.000375643399817 +CGAATT 0.000106653765976 3.7827139053e-05 +GCTCGT 7.87704284658e-05 5.67805266207e-05 +ATCTGA 2.33522951646e-05 0.000318862873197 +CGAATC 0.000130703144578 3.83845916286e-05 +ATCTGC 0.000378864848417 0.000275301936224 +CGAATA 4.77502154859e-05 2.89078978447e-05 +CGAATG 0.000125475018795 4.77816493302e-05 +ATCTGG 0.000327280674024 0.000296405498011 +ATCATA 0.00016416314959 0.000182685172606 +GATAGC 0.000186121277879 0.00011889667075 +AAGCAG 0.00116099246557 0.00048243538607 +GATAGA 0.000133840020048 0.000177190282933 +AAGCAA 0.000456589651727 0.000425973403778 +CAAACT 0.000158586482088 0.000299909485629 +AAGCAC 0.000513750493622 0.000287884437214 +TTTACC 0.00019832023804 0.000222184669385 +CATTTC 0.000208776489606 0.000427725397587 +CTAGGT 0.000104213973944 0.000162855788134 +CATTTA 9.82887647228e-05 0.000354619474112 +CATTTG 0.000170785442249 0.000417133798652 +GTTATA 7.52850112771e-05 0.000160466705667 +CAAACA 0.000198668779759 0.000408612737855 +AAGCAT 0.000353072761221 0.000317668331963 +CAAACC 0.000182635860691 0.000260648897096 +CTCGGG 0.000138022520675 0.00014621184695 +ATCATT 0.000460772152353 0.000282469183623 +CAAACG 6.34345928353e-05 6.60183121578e-05 +CTAGGG 0.000131051686297 0.000184914982908 +GTTATT 0.000151615647711 0.000258657995041 +TGGAGC 0.000258966497124 0.000386394270917 +CTAGGC 0.000162071899277 0.000180534998386 +CATTTT 0.000215398782265 0.000643618816477 +CTAGGA 0.000154055439743 0.00024066024046 +AAGTTT 0.000503991325494 0.00039873786366 +TACAGT 0.000298700253076 0.000287406620721 +CTCGAA 5.89035504899e-05 6.90444832821e-05 +CTAACG 3.10202129799e-05 3.68715060664e-05 +CTAAGG 0.000110836266602 0.000223219938454 +CTAAGA 0.000129308977703 0.000250853658983 +CTAAGC 0.000127217727389 0.000190409872581 +TACAGG 0.000252344204466 0.000236598800266 +AAGTTG 0.000347844635438 0.00029887421656 +AAGTTA 0.000203199822104 0.000263993612549 +TACAGC 0.000479244863454 0.000229750097196 +AAGTTC 0.000602628631935 0.000279681920746 +TACAGA 0.000258617955405 0.000366325978198 +CTAAGT 0.000120246893012 0.000208248354997 +GTATGA 9.75916812851e-06 0.000167235772656 +GGGGCA 0.000265240248064 0.00027012559088 +GGGGCG 0.000132097311454 0.000154971815994 +TTCAAC 0.000549650290666 0.000205381456037 +TATATC 0.000177407734908 0.000173049206657 +TATATA 8.46956376867e-05 0.000539295548773 +TGTATA 6.72685517429e-05 0.000363618351402 +TATATG 0.000132445853173 0.000277850290855 +TCCGGT 6.41316762731e-05 6.53015874179e-05 +GGTCCA 0.000177756276626 0.000191126597321 +TATATT 0.000149175855679 0.000431707201698 +GGACTA 0.000108047932851 0.00015266236961 +TCTTAC 0.000178104818345 0.000221069764234 +TGATGG 0.0 0.000328658111309 +CTCGGT 8.01645953413e-05 8.94313203296e-05 +ATGAGT 0.000253738371341 0.00024320859509 +GCCCAC 0.000401171518425 0.00026654196718 +TGATGA 0.0 0.000337577352518 +TGCCAT 0.000173573776 0.00032292431339 +ACTCTT 0.000185424194442 0.00032435776287 +TGTTTC 0.000160329190683 0.000493186257169 +CACATA 0.00014569043849 0.000278567015595 +TCATAA 1.01077098474e-05 0.000239465699226 +CACATG 0.000429751939373 0.00036640561428 +TGTTTG 0.000137673978956 0.000632708673213 +ATGAGA 0.000269074206972 0.000334630817476 +ATGAGC 0.0003656202631 0.000219556678672 +ATGAGG 0.000299745878233 0.000273549942415 +GTGGCT 0.000767488864963 0.000395233876043 +ACTCTG 0.000493883615646 0.000431309021287 +TGCCAG 0.0005576667502 0.000408533101773 +ACTCTA 0.000117458559261 0.000190489508663 +ATTGTT 0.000269422748691 0.000360193999867 +CACATT 0.000246418995245 0.000326030120596 +TGCCAC 0.000263846081189 0.000317588695881 +AAATTC 0.000297306086201 0.000322287224732 +AAATTA 0.000172179609124 0.000435211189316 +AAATTG 0.000207033781012 0.000328737747391 +TCCACT 0.00030357983714 0.000286928804228 +TTCAAT 0.000354118386377 0.00025467619093 +CTTCGA 0.000217141490859 5.80547039361e-05 +CGTACC 5.85550087711e-05 2.69169957893e-05 +TTAATC 7.24966775261e-05 0.000195665854007 +AAATTT 0.000327629215743 0.000512776733395 +TTCGAA 0.000110836266602 4.82594658235e-05 +CTTAGT 0.000120246893012 0.0001961436705 +GGGAAC 0.000400125893269 0.000255472551752 +GGTGCG 7.87704284658e-05 7.11150214197e-05 +GCGTAT 4.60075068915e-05 2.96246225847e-05 +GGGAAG 0.000778990741686 0.000508237476708 +GGTGCC 0.000401868601863 0.000233652265224 +TCGTCC 0.000120595434731 6.67350368978e-05 +GCCCAT 0.000258617955405 0.000204983275626 +AGAGCG 7.04054272128e-05 0.000114357414064 +GCGACT 4.80987572048e-05 5.67008905385e-05 +AGAGCC 0.00034087380106 0.000402082579113 +AGAGCA 0.000280576083695 0.000466587805709 +GCGTAG 1.74270859438e-06 3.40046071066e-05 +GGTGCT 0.000377122139823 0.000312491986619 +TCCCCA 0.000452755692819 0.00045655365935 +GCGTAC 5.96006339277e-05 2.54835463094e-05 +TAATTT 0.0 0.000471764151053 +GCGTAA 1.74270859438e-06 2.21388308563e-05 +GCGACG 3.3460005012e-05 3.67918699842e-05 +AGAGCT 0.000272211082442 0.000443732250113 +GCGACA 5.61152167389e-05 5.63823462096e-05 +TATCGG 7.21481358072e-05 2.73948122826e-05 +GCGACC 7.24966775261e-05 5.95677894983e-05 +TCCGGC 0.000120246893012 8.8475687343e-05 +GCAGGA 0.000391760892016 0.000420956330599 +GCAGGC 0.000418598604369 0.000354938018441 +GCAGGG 0.000360740679036 0.000385677546177 +CAATTT 0.000103865432225 0.000258339450712 +GCACTA 0.000118155642699 0.000126780642889 +CCGTGC 7.45879278393e-05 0.00010774761924 +GCTCGG 0.000203199822104 0.000126701006807 +TATTCT 0.00017671065147 0.000332878823667 +CCGTGG 8.88781383132e-05 0.000145813666539 +CTTTAG 1.01077098474e-05 0.000255791096081 +GCAGGT 0.000253041287903 0.000273311034168 +CTTCGT 0.000111881891759 8.15473481901e-05 +TATTCC 0.000163466066153 0.000197816028227 +CAATTG 6.76170934618e-05 0.000142150406757 +TATTCA 0.000106653765976 0.000264232520796 +CAATTA 4.91443823614e-05 0.000168748858218 +TATTCG 3.17172964177e-05 3.06598916535e-05 +CAATTC 8.88781383132e-05 0.000162218699476 +TGTAGA 7.52850112771e-05 0.000315597793826 +GGCTCA 0.000321006923084 0.000317429423717 +AGCATT 0.000307065254329 0.000334391909229 +GGCTCC 0.000670594267116 0.000371661595706 +AATCCT 0.000302534211984 0.00027012559088 +TGTAGG 5.19327161124e-05 0.000220990128152 +GGCTCG 0.000135234186924 0.000101934185238 +TTCGGA 9.37577223775e-05 6.33903214447e-05 +TTCGGC 0.00017671065147 4.97725513856e-05 +CTTTAC 0.000152661272867 0.000229590825031 +TTCAAG 0.000685581561028 0.000361149632854 +TTCGGG 0.000124429393638 7.0477932762e-05 +AGCATG 0.00048029048861 0.000318544328868 +GGCTCT 0.000477850696578 0.000386473906999 +AGCATC 0.000658046765237 0.000317349787634 +TTTACT 0.000173922317719 0.000354938018441 +AGCATA 0.000145341896771 0.000196940031322 +TTACAT 0.000103865432225 0.000310501084564 +AGACCT 0.000222021074924 0.000322287224732 +TTCGGT 7.49364695582e-05 5.51878049763e-05 +GTTTAT 0.000167997108498 0.000299033488725 +GGGGAG 0.000736120110265 0.000421911963585 +GCACTC 0.00021679294914 0.000195267673596 +GCCTTT 0.000544770706602 0.000422469416161 +TGCTTG 0.000203199822104 0.000399295316236 +GTTTAA 5.576667502e-06 0.000288123345461 +GAGGTG 0.00107350849414 0.000325313395856 +AACTTG 0.000357952345285 0.000314881069086 +GTTTAG 5.576667502e-06 0.000186826248881 +GAGGTA 0.000252692746185 0.000164289237614 +CTGGCT 0.000994040982232 0.000574255788866 +AGGCGG 0.000147084605365 0.000149715834568 +AGGCGA 8.88781383132e-05 7.86008131481e-05 +AGGCGC 0.000127914810827 9.84301976201e-05 +AGGAGT 0.000171133983968 0.000307315641275 +ACAGCC 0.000601931548498 0.000376997213215 +ACAGCA 0.000398383184674 0.000442537708879 +TCCAGC 0.000648984680546 0.000414346535775 +ACAGCG 0.000123035226763 0.000101695276991 +AGGAGC 0.000268725665253 0.000431946109945 +AGGCGT 5.96006339277e-05 7.98749904636e-05 +AGGAGA 0.000254783996498 0.000550205692037 +CTGGCG 0.000299745878233 0.000113003600666 +AGGAGG 0.000300094419952 0.000565894000233 +CTGGCA 0.000698129062907 0.000374130314255 +CTGGCC 0.00129483248562 0.000480524120097 +GCGCCC 0.000184030027566 0.000145017305717 +GCATCG 6.83141768996e-05 6.41070461846e-05 +ACAGCT 0.000457635276883 0.000419522881119 +GGAAAA 0.000447527567036 0.000529341038496 +AACGCT 0.000127566269108 5.56656214696e-05 +AATTTT 0.000253041287903 0.000587236470268 +AAACAG 0.000562546334265 0.000450740225348 +TGTCAC 0.000160677732402 0.000326269028843 +AAACAC 0.00031926421449 0.000351752575152 +GCTCTA 0.000147084605365 0.000184038986003 +AAACAA 0.000343662134811 0.000660342393743 +AACGCG 6.76170934618e-05 2.22981030207e-05 +AATTTA 0.000156146690056 0.000382332830723 +AATTTC 0.000235962743679 0.000312332714455 +AACGCC 0.000239099619148 5.59841657985e-05 +TTTCAC 0.000161374815839 0.000300705846451 +ATTGGA 0.000378516306699 0.000231263182758 +AATTTG 0.000200411488353 0.000329693380378 +ATTTAC 0.000169391275373 0.000239147154897 +ATTTAA 1.04562515663e-05 0.000496292064376 +ATTTAG 6.97083437751e-06 0.000242730778597 +CCCTCG 0.00014569043849 0.000116666860448 +TAAATA 0.0 0.000533721023018 +GGAAAG 0.000508522367839 0.00048601900977 +TGACCA 0.0 0.000297600039245 +CATTCT 0.000195880446008 0.000366007433869 +TAAATC 0.0 0.000230227913689 +TGACCG 0.0 6.34699575269e-05 +GCGCCA 8.78325131566e-05 8.9192412083e-05 +CATTCG 4.53104234538e-05 4.96132792211e-05 +CATTCC 0.00016416314959 0.000282628455788 +CATTCA 0.000137673978956 0.00030245784026 +TCCATA 0.000159980648964 0.000217087960123 +GCCTTC 0.000906208469076 0.000368396516336 +ACAAAT 0.000238053993992 0.000351434030823 +GATTAA 9.06208469076e-06 0.0002033109179 +GTAGGC 0.000140113770988 0.000125426829492 +GATTAC 0.000245024828369 0.000110136701706 +GTAGGA 0.000143599188177 0.000178783004577 +GTAGGG 9.93343898795e-05 0.000149317654157 +GATTAG 6.97083437751e-06 0.000113720325406 +GCGGGT 7.38908444016e-05 8.10695316968e-05 +ACAAAC 0.000236311285397 0.000327463570076 +TTTCAA 0.000193789195695 0.000456314751103 +ACAAAA 0.000298351711357 0.00056541618374 +ACAAAG 0.000373636722634 0.000406701471882 +GCGGGC 0.000236311285397 0.000160625977832 +GTCGGT 4.53104234538e-05 4.89761905634e-05 +GCGGGA 9.55004309718e-05 0.000127497367629 +CCCTCA 0.000285455667759 0.000346894774137 +GATTAT 0.000265937331502 0.000183083353017 +GTAGGT 7.91189701847e-05 0.000145335850046 +AACCTG 0.000890524091726 0.000346815138055 +TAATGA 0.0 0.000279522648581 +GATGTT 0.000433585898281 0.000281672822801 +TAATGC 0.0 0.000162855788134 +GGGATG 0.000321355464803 0.000291786605243 +GCCCTT 0.000311944838393 0.000294255323792 +GCGCCG 8.92266800321e-05 0.000111092334693 +GGCGTA 3.41570884498e-05 2.62002710494e-05 +GCCCTC 0.000545119248321 0.000335188270051 +GATGTG 0.000949776183935 0.000316234882483 +GCCCTA 0.000171482525687 0.000151149284048 +GATGTA 0.000277787749944 0.000201797832338 +GCCCTG 0.00126590352296 0.000509113473613 +GATGTC 0.000579276336771 0.000230705730182 +AACCTC 0.000526646537221 0.000229033372456 +TGAAAT 0.0 0.000472879056204 +GCTCTT 0.000264891706345 0.000375802671982 +TTCTAA 1.3941668755e-05 0.000363459079238 +ATCCGT 0.000152661272867 4.94540070567e-05 +TTCTAC 0.000527692162377 0.000245677313639 +GGCTTA 0.0001551010649 0.000169147038629 +TTGGAT 0.000493883615646 0.000278248471266 +TGAAAC 0.0 0.000314801433004 +TGAAAG 0.0 0.000435927914055 +CCCTCC 0.000402217143582 0.000566929269302 +ATCCGC 0.000279879000257 4.4038753466e-05 +ATCCGA 0.000236311285397 4.56314751103e-05 +ATCCGG 0.000291032335261 5.064854829e-05 +TGGCTC 0.000231431701333 0.000404232753333 +TGGCTA 0.000111184808321 0.000237952613664 +TGGCTG 0.000496671949397 0.000561514015712 +GGGTGA 8.01645953413e-06 0.000231263182758 +AGTTGT 9.86373064417e-05 0.000296564770176 +AGCTAT 0.000235962743679 0.000215734146726 +ATTAGT 0.000101774181912 0.0001688284943 +GTCGGC 8.50441794056e-05 5.76565235251e-05 +TGGCTT 0.000168345650217 0.000499955324158 +AGTTGG 8.26043873734e-05 0.000263834340385 +AGCTAA 1.15018767229e-05 0.000228237011634 +AGCTAC 0.000377819223261 0.000213663608588 +AGTTGC 7.91189701847e-05 0.000204505459133 +AGTTGA 5.92520922088e-06 0.000248464576517 +AGCTAG 1.32445853173e-05 0.000221547580727 +TCCTAG 1.32445853173e-05 0.000242332598186 +TCCAGT 0.000416507354056 0.000348328223617 +CTAATT 9.02723051887e-05 0.000207213085928 +CAGTGT 0.00042452381359 0.000475427410835 +TAACAA 0.0 0.000236280255938 +TCAGGT 0.000208079406169 0.000275461208388 +TCAAGG 0.000128611894265 0.000292981146476 +GTCGGG 8.26043873734e-05 7.00001162687e-05 +TCAAGC 0.000152661272867 0.000200682927187 +CTGCAC 0.000631906136321 0.000331047193776 +CTAATA 5.33268829879e-05 0.000174721564384 +CAGTGC 0.000384790057638 0.000361866357594 +CTAATC 8.12102204979e-05 0.000123435927436 +CAGTGA 3.03231295422e-05 0.000434813008904 +CAGTGG 0.000431843189687 0.000442219164551 +CTAATG 0.00013627981208 0.000191445141649 +TCAAGT 0.000194137737414 0.000274744483648 +CTGCAA 0.000361089220755 0.00030532473922 +GAGCCC 0.00076226073918 0.000345063144246 +TCAGGC 0.000314384630426 0.00028270809187 +CGAGCT 0.000153009814586 8.68033296165e-05 +TCCTAA 1.77756276626e-05 0.000259374719781 +GATCAG 0.000410930686554 0.000196621486994 +CAACCA 0.000189258153349 0.000266143786769 +GTTCAT 0.000187515444755 0.000256507820821 +TTCCCT 0.00036875713857 0.000497486605609 +TAACAG 0.0 0.000229750097196 +CGAGCG 6.20404259598e-05 7.19910183241e-05 +GTTAGT 6.93598020562e-05 0.000144539489224 +CGAGCA 0.000143250646458 8.1865892519e-05 +GAGCCG 0.000243630661494 0.00015481254383 +CGAGCC 0.000243282119775 0.000109340340884 +GTTCAG 0.000357603803566 0.000285973171241 +TTCCCC 0.000347147552 0.000389579714205 +GTTCAC 0.000190652320225 0.000195984398336 +GTTCAA 0.000183681485847 0.00023205954358 +TGAGCA 0.0 0.000381297561655 +GGACCT 0.000300094419952 0.000288919706283 +TACATG 0.000441950899534 0.000272435037264 +AAGTAC 0.000537102788787 0.000186189160223 +AAGTAA 2.61406289156e-05 0.000286530623817 +TACATC 0.000539891122538 0.000182207356112 +AAGTAG 2.02154196948e-05 0.000239704607473 +TACATA 0.000127217727389 0.00030747491344 +GCACAC 0.000218187116016 0.000276496477457 +GGACCG 7.45879278393e-05 8.39364306566e-05 +ATTGGT 0.000225506492112 0.000192639682883 +GGACCA 0.000293472127293 0.000273231398086 +TCATCA 0.000222021074924 0.000284460085679 +GGACCC 0.000293820669012 0.000265267789865 +CACACG 0.000192743570538 0.00011172942335 +TACATT 0.000282318792289 0.000327941386569 +CACACC 0.000341570884498 0.000313367983524 +GCACAA 0.000182635860691 0.000206098180777 +CACACA 0.000380956098731 0.000899887729051 +TCTGCC 0.000555226958168 0.00049716806128 +TCTGCA 0.000426615063903 0.00045583693461 +TCTGCG 0.000125126477076 0.000104721448115 +TAGATT 0.0 0.000212389431273 +CCCGTC 9.93343898795e-05 7.94768100525e-05 +TTAAGG 9.44548058152e-05 0.000225768293085 +CCCGTA 4.60075068915e-05 3.22526132979e-05 +CGTCGA 3.86881307952e-05 1.35381339769e-05 +CCCGTG 0.000290335251823 0.00013219589648 +TTAAGC 6.09948008032e-05 0.000174243747891 +TTACGT 2.71862540723e-05 4.52332946992e-05 +TAGATC 0.0 0.00013291262122 +TGTCAA 0.000116412934104 0.00026797541666 +TAGATA 0.0 0.000180534998386 +TTTCGC 5.15841743935e-05 4.02162215195e-05 +TAGATG 0.0 0.000222105033303 +TGGTTA 5.43725081445e-05 0.000215335966315 +TCTGCT 0.000485518614393 0.000531411576634 +TTACGC 3.52027136064e-05 2.02275648831e-05 +TTAAGT 0.000116761475823 0.000284619357843 +TTACGA 4.4613340016e-05 3.1217344229e-05 +TTACGG 5.12356326747e-05 3.99773132729e-05 +CCCGTT 5.0190007518e-05 6.72128533911e-05 +AGTGAC 0.000668154475084 0.00029887421656 +AGTGAA 0.000542679456289 0.000347770771041 +AGTGAG 0.000720784274634 0.000373811769926 +GCGGTC 0.00010212272363 5.81343400184e-05 +CGGGCG 8.3998554249e-05 0.000117224313023 +CCCTCT 0.000330417549494 0.000455438754199 +TAAGAG 0.0 0.000262321254823 +CCTGAT 0.000482033197205 0.000262560163069 +GAAAGT 0.000368408596851 0.0003340733649 +CGGGCA 0.000185075652723 9.88283780312e-05 +TAAGAC 0.0 0.000188737514854 +ATTTAT 0.000200062946634 0.00056326600952 +AGTGAT 0.000451012984225 0.000271718312524 +TAAGAT 0.0 0.000228555555963 +CCTGAA 0.000637134262104 0.000410285095582 +CCTGAC 0.000535011538474 0.000334710453558 +CCTGAG 0.00100693702583 0.000528226133345 +GTTAGG 4.63560486104e-05 0.000138248238729 +ATTGGG 0.000283015875727 0.000178942276741 +TATACT 0.000124777935357 0.000191365505567 +GTTAGC 8.50441794056e-05 0.000123037747025 +CTCCAG 0.000755289904803 0.000572503795057 +GTTAGA 6.76170934618e-05 0.000174164111808 +TGTAGC 0.000123035226763 0.000254755827012 +GCCAAA 0.00061970717616 0.000247907123941 +TATACG 3.55512553253e-05 3.07395277357e-05 +GGTAGC 0.000125823560514 0.000144937669635 +TATACC 0.00013941668755 0.000120250484148 +TATACA 0.000119549809574 0.000271957220771 +ATTGGC 0.000372591097478 0.000166598683998 +TCTTGT 0.000134885645205 0.000387270267821 +TCCACG 0.000180544610377 9.74745646335e-05 +ACTAGT 9.5151889253e-05 0.000123834107847 +TTGACT 0.000171831067406 0.000279522648581 +GTAATA 5.89035504899e-05 0.000170580488109 +AACGCA 0.000113624600353 5.46303524008e-05 +GTAATC 7.07539689317e-05 0.000116666860448 +TCTAAC 0.000151267105992 0.000162457607723 +CGTTCT 9.44548058152e-05 8.52106079721e-05 +CCACCG 0.000180893152096 0.000123834107847 +GGTAGG 3.20658381365e-05 0.000162537243805 +CCACCA 0.000630860511164 0.000425973403778 +CCACCC 0.000552787166136 0.000448351142881 +GTTCGT 6.48287597108e-05 4.57111111925e-05 +TTTATG 0.000179498985221 0.000375484127653 +ACTAGG 5.43725081445e-05 0.00014836202117 +TTTATC 0.000221323991486 0.000274266667155 +ACTAGC 0.000106305224257 0.000122878474861 +TTTATA 0.000113624600353 0.000520182889041 +ACTAGA 7.45879278393e-05 0.000191922958143 +CCACCT 0.000577533628176 0.000397543322427 +CGTTCG 2.19581282891e-05 2.12628339519e-05 +TCGTTG 5.08870909558e-05 4.88965544812e-05 +CGTTCA 4.91443823614e-05 5.76565235251e-05 +CGTTCC 9.93343898795e-05 6.84073946243e-05 +TCTAAT 0.000147084605365 0.000220671583823 +TCGTCT 7.59820947148e-05 7.03982966798e-05 +CTTTGT 0.000132445853173 0.000529261402414 +AAACAT 0.000258617955405 0.000426132675943 +ACTGGA 0.000475410904546 0.00039372079048 +ACTGGC 0.000363180471068 0.000269886682633 +TAGTCC 0.0 0.0001379296944 +GTGACC 0.000538845497381 0.000264152884714 +TAGTCA 0.0 0.000180296090139 +GTGACA 0.000457286735164 0.000324676307198 +TAGTCG 0.0 2.50853658983e-05 +GTGACG 0.00014882731396 6.89648471999e-05 +TGTCAT 0.000105956682538 0.000330728649447 +ACTGGT 0.000234917118522 0.000238350794075 +CTTTGG 0.000123732310201 0.000436644638795 +CCTATG 0.000181938777253 0.000193197135458 +CTTTGC 0.000128960435984 0.000383208827628 +CTACGC 6.62229265863e-05 3.28100658734e-05 +GTGACT 0.000406748185927 0.000337258808189 +TAGTCT 0.0 0.000199488385953 +GTGCAC 0.000395943392642 0.000225449748756 +CGACGG 6.37831345542e-05 3.1217344229e-05 +ACCTAG 1.1153335004e-05 0.000173208478822 +CGACGA 4.35677148594e-05 2.01479288009e-05 +ACCTAA 1.08047932851e-05 0.000175199380877 +CGACGC 6.62229265863e-05 3.21729772156e-05 +ACCTAC 0.000450664442506 0.000167235772656 +CCGCAG 0.000247116078683 0.000142787495415 +CCGCAA 3.58997970442e-05 4.65074720147e-05 +CCGCAC 9.02723051887e-05 7.38226482151e-05 +CTACGG 0.000100380015036 4.68260163436e-05 +ACCTAT 0.000242933578056 0.000147008207772 +CGACGT 3.20658381365e-05 1.95904762254e-05 +CGAAGA 0.000131748769735 7.57339141883e-05 +CCCCGT 7.70277198714e-05 9.19796749606e-05 +CGAAGG 0.00013314293661 8.22640729301e-05 +GCGCTC 0.000177756276626 0.00011316287283 +GTGCAT 0.000190652320225 0.0002377933415 +GCGCTA 4.25220897028e-05 3.49602400932e-05 +CCGCAT 4.00822976707e-05 4.65871080969e-05 +GTTCGC 8.15587622168e-05 3.73493225597e-05 +GAAGAT 0.0011836476773 0.000382412466806 +GGATCT 0.000192743570538 0.000243288231173 +TCATGA 5.576667502e-06 0.000282548819706 +TCGGAA 0.000148478772241 7.03186605975e-05 +TCGGAC 0.000163814607871 4.73038328369e-05 +GAATCT 0.000302185670265 0.000262560163069 +TCGGAG 0.000260360664 9.34927605227e-05 +GGATCG 4.14764645462e-05 5.36747194142e-05 +GAAGAG 0.00182949548238 0.000569477623933 +GAAGAA 0.00171691650718 0.000625939606225 +CGAGAA 0.000236311285397 8.83960512608e-05 +GAAGAC 0.00109999766477 0.00038185501423 +GGATCA 0.00014882731396 0.000187781881868 +GAATCA 0.000212958990233 0.000221786488974 +GAATCC 0.000249207328996 0.000196302942665 +TCGGAT 0.00011780710098 4.84983740701e-05 +GAATCG 6.34345928353e-05 4.34813008904e-05 +ATGGTC 0.000317870047614 0.000177349555097 +CAGATG 0.000790492618409 0.000417930159474 +ATGGTA 0.000170088358811 0.000199647658118 +TGACCC 0.0 0.000256985637314 +ATGGTG 0.000666760308208 0.000319420325772 +CAGATC 0.000723572608385 0.000255791096081 +ACGCCC 0.000140462312707 7.82822688192e-05 +CAGATA 0.000258617955405 0.000245597677557 +TGTCAG 0.000281273167132 0.000375324855488 +ACGCCT 0.000105956682538 7.79637244904e-05 +CAGATT 0.000482381738923 0.000300148393876 +TGATTA 0.0 0.000204186914804 +CTCGAC 0.000104213973944 4.10125823417e-05 +ATGGTT 0.000250252954152 0.000267895780578 +TCGCAA 3.13687546988e-05 3.20137050512e-05 +TTGCGC 7.56335529959e-05 3.77475029708e-05 +GCTATT 0.000197971696321 0.000194232404527 +TGCGTC 7.04054272128e-05 5.70194348673e-05 +GCGTGG 7.11025106506e-05 0.000116268680037 +TTGTAG 9.75916812851e-06 0.000255870732163 +AATGGT 0.000299397336514 0.000237554433253 +TCCACC 0.000460423610634 0.000292025513489 +CTACGT 3.24143798554e-05 4.84983740701e-05 +AATGGC 0.00056080362567 0.000243845683748 +AATGGA 0.000528737787534 0.000361468177183 +AATGGG 0.000387926933108 0.000242571506433 +CCCCGA 0.000160677732402 0.000107269802746 +AATAGA 0.000107699391132 0.00024679221879 +AATAGC 0.000165905858185 0.000168589586053 +GTGAAT 0.000406399644209 0.000258657995041 +AGCCAG 0.000876582422971 0.000559443477574 +GGAGGG 0.000330069007775 0.000467145258285 +AAAAGT 0.000283364417446 0.000426053039861 +AGCCAC 0.000412673395148 0.000372617228693 +AGCCAA 0.000276742124787 0.000324915215445 +TGGTAG 9.06208469076e-06 0.000222025397221 +CGCCAT 0.000122338143325 7.88397213948e-05 +GAGTGT 0.000451361525944 0.000282389547541 +TGGTAC 0.000200411488353 0.000174164111808 +TGGTAA 1.18504184418e-05 0.000213265428177 +AAAAGG 0.000320658381365 0.000416178165666 +GGAGGT 0.000304625462297 0.000272036856853 +AGCCAT 0.00026663441494 0.000370785598802 +AAAAGC 0.000321704006522 0.000390376075027 +AAAAGA 0.000395943392642 0.000658032947358 +TCTATA 8.53927211245e-05 0.000224175571441 +GAGTGG 0.000464257569542 0.000316314518566 +CGCCAG 0.000382350265606 0.000115392683132 +TGGTAT 0.000126172102233 0.000214300697246 +CGCCAA 9.09693886265e-05 5.30376307565e-05 +GAGTGC 0.000379561931855 0.000220273403412 +CGCCAC 0.000199017321478 9.93061945245e-05 +GAGTGA 3.03231295422e-05 0.000286689895981 +GCCAGG 0.000445784858442 0.000458544561405 +GCCAGA 0.000313687546988 0.000347133682384 +GCCAGC 0.000821512831389 0.000427008672847 +GCCCGT 0.000136628353799 7.83619049015e-05 +TACCGA 0.000163466066153 3.38453349422e-05 +TACCGC 0.000231083159614 3.50398761754e-05 +TACTGA 2.75347957911e-05 0.000267417964084 +CTTCAT 0.000231083159614 0.000393004065741 +GCCCGC 0.00029138087698 0.000152104917034 +GCCAGT 0.000441253816096 0.000287565892885 +GCCCGA 0.000203199822104 8.34586141633e-05 +GCCCGG 0.000384790057638 0.000178305188084 +TGCGAT 7.59820947148e-05 3.68715060664e-05 +CTTCAC 0.000226552117269 0.000304687650562 +CTTCAA 0.000258617955405 0.000341399884464 +CTTCAG 0.000655955514923 0.000513573094217 +TCCGAG 0.000255132538217 9.89876501956e-05 +GTGGGC 0.000667108849927 0.000277053930033 +TCCGAC 0.000139765229269 4.45165699593e-05 +AATTCA 0.000206336697574 0.000312253078373 +GGACTG 0.000344359218249 0.000334630817476 +AATTCC 0.000227249200707 0.000242651142515 +AATTCG 4.11279228273e-05 3.59158730798e-05 +TCCGAT 8.9575221751e-05 3.98180411085e-05 +TAGCGG 0.0 3.63140534909e-05 +AATTCT 0.000249555870715 0.000346337321561 +TAGCGC 0.0 3.49602400932e-05 +GTCATC 0.000711025106506 0.00020617781686 +GTCATA 0.000143250646458 0.000140318776866 +GTCATG 0.000456589651727 0.000231183546676 +AGCAGG 0.000325886507148 0.000468499071682 +CCAGGT 0.000309505046361 0.000336621719531 +TTGGAA 0.000558712375357 0.000444687883099 +AGCAGC 0.00109372391383 0.000542242083815 +AGCAGA 0.000308459421205 0.000496929153034 +GGGGTG 0.000329023382618 0.000314562524757 +CCAGGG 0.000462166319229 0.000462048549023 +AGCAGT 0.000519675702843 0.000367281611184 +CCAGGA 0.000537799872225 0.000553311499243 +CCAGGC 0.00050817382612 0.000489045180894 +TCCCCG 0.000207382322731 0.000143185675826 +ATAGAG 0.00028510712604 0.000209920712724 +CATCTG 0.000379213390136 0.000434335192411 +ACGGTC 0.000114321683791 4.53129307814e-05 +CATCTA 9.16664720642e-05 0.000216371235383 +ATAGAC 0.000225506492112 0.000145176577881 +CATCTC 0.000221672533205 0.000373413589515 +CAAGCT 0.000335645675277 0.000314642160839 +TCCAAC 0.000449618817349 0.000206575997271 +GGGGTC 0.000257920871968 0.000189215331347 +CAAGCC 0.000372591097478 0.00028844188979 +CATCTT 0.000207382322731 0.000405029114155 +CAAGCA 0.000333902966683 0.000325950484514 +CAAGCG 7.14510523694e-05 6.63368564867e-05 +GTTCTT 0.000228294825863 0.000390614983274 +ACATGA 7.66791781526e-06 0.000293777507298 +CGTAAT 2.92775043855e-05 2.8987533927e-05 +ACATGC 0.000107699391132 0.000246553310544 +TCTTGA 1.18504184418e-05 0.00033335664016 +ACATGG 0.000135582728642 0.000324437398952 +AGGGAT 0.000236311285397 0.000259772900192 +GTACAT 8.53927211245e-05 0.00021589341889 +TGGCGG 0.000103516890506 0.00011817994601 +CGTAAG 6.79656351807e-05 3.55176926688e-05 +GAGTCA 0.000356209636691 0.000266382695016 +ACATGT 0.000123035226763 0.000326746845336 +CGTAAC 3.58997970442e-05 2.75540844471e-05 +CGTAAA 6.44802179919e-05 3.99773132729e-05 +AGGGAG 0.000431494647968 0.000470967790231 +TTATTT 0.000155449606618 0.000836736315853 +AGGGAC 0.000331811716369 0.000312730894866 +AGGGAA 0.000334948591839 0.000444289702688 +CCCTTT 0.000330417549494 0.000401286218291 +TGTTGT 8.60898045622e-05 0.000451616222252 +TCTTGG 0.000148478772241 0.00038687208741 +GTTGTT 0.000182287318972 0.000348726404028 +ATCCTT 0.000324840881992 0.0002960073176 +GCGGGG 0.00013000606114 0.000184676074661 +TTGTCC 0.000185772736161 0.000273231398086 +TTGTCA 0.000181590235534 0.000326109756678 +ATCCTC 0.000546513415196 0.00025467619093 +CTATGA 1.25475018795e-05 0.000220114131248 +ATCCTA 0.000186818361317 0.000181490631372 +GTTGTC 0.000240842327743 0.000210955981793 +ATCCTG 0.00100867973443 0.000371104143131 +GTTGTG 0.000327977757462 0.000282230275377 +TTGTCT 0.000232128784771 0.000430433024382 +CTATGC 5.99491756466e-05 0.000162616879887 +CTGTGG 0.00043079756453 0.000580069222868 +AAGGGG 0.000350632969189 0.000289795703187 +TGACTC 0.0 0.000292662602147 +TGGGCA 0.000208079406169 0.000358282733894 +TGGGCG 7.28452192449e-05 0.000104641812033 +TGACTG 0.0 0.000399693496647 +AAGCCG 0.000183681485847 9.50058460848e-05 +AAGCCC 0.000658046765237 0.000307076733028 +AAGCCA 0.000641665304449 0.000455199845952 +CAAAAT 0.000241539411181 0.000398498955414 +CTATGG 7.38908444016e-05 0.000206496361188 +TGGGCT 0.000248161703839 0.000408453465691 +CAAAAC 0.000237705452273 0.00035095621433 +CAAAAA 0.000283015875727 0.00046985288508 +AAGCCT 0.000614130508658 0.000385836818341 +CAAAAG 0.000334948591839 0.000380501200832 +TCAATG 0.000128960435984 0.000221308672481 +CCCTTA 0.000110836266602 0.000172013937589 +TCAATC 8.33014708112e-05 0.000130443902671 +CGTCGT 3.55512553253e-05 1.90330236498e-05 +CAGTTC 0.000589384046618 0.000325313395856 +CAGTTA 0.000187166903036 0.000235006078622 +CAGTTG 0.000344707759968 0.000294255323792 +GACCCC 0.000590429671775 0.000226405381743 +CTCTGT 0.000339131092466 0.000631195587651 +TCAATT 9.68945978473e-05 0.000212548703437 +TGGCGT 5.22812578313e-05 7.75655440793e-05 +GTTTGG 0.000102471265349 0.000332002826762 +CTCTGC 0.000410233603116 0.000594164809421 +GACCCT 0.000544073623164 0.000274107394991 +CTCTGA 3.76425056385e-05 0.000517793806574 +CTCTGG 0.000353769844658 0.000572105614646 +CAGTTT 0.000528389245815 0.000429875571807 +GCGAAG 0.000132445853173 6.64164925689e-05 +CTACTC 0.000126869185671 0.000161183430407 +TGCTGG 0.000231083159614 0.000567168177549 +GCGAAC 4.77502154859e-05 3.59158730798e-05 +GAGTCT 0.000463211944385 0.000294812776367 +GCGAAA 6.58743848674e-05 4.13311266706e-05 +TAGGGA 0.0 0.000208646535408 +GCTGGT 0.000339828175903 0.00032292431339 +GTGATT 0.000327629215743 0.000256189276492 +CTACTA 7.28452192449e-05 0.000130842083082 +TGCTGT 0.000264543164626 0.000582697213581 +GCGAAT 3.55512553253e-05 2.9385714338e-05 +TAATGG 0.0 0.000201081107598 +GTGATG 0.000528040704096 0.000304130197986 +CTACTG 0.000273256707598 0.000260728533178 +GTGATC 0.00046181777751 0.000168191405642 +GCTGGC 0.000615176133815 0.0004303533883 +GTGATA 0.000149872939116 0.000174164111808 +GCTGGA 0.000499460283148 0.000450899497512 +TGATAA 0.0 0.000259135811534 +TGTAGT 0.00010839647457 0.0002413769652 +TGATAC 3.48541718875e-07 0.000164289237614 +TGATAG 0.0 0.000176553194275 +CTTGTT 0.000200760030072 0.000380740109079 +GACGGT 0.000115367308948 5.59841657985e-05 +GCTAGG 7.31937609638e-05 0.000185153891154 +GCTAGA 9.55004309718e-05 0.000180375726221 +ATGAAT 0.000403611310458 0.000361229268936 +CTATGT 7.52850112771e-05 0.000247349671366 +AAGGGT 0.000280924625414 0.000232378087909 +TGATAT 0.0 0.000231661363169 +GTAGTG 0.000167997108498 0.000160705613914 +GCTAGT 0.000106305224257 0.000131319899576 +ATGAAC 0.00053292028816 0.000238908246651 +GACGGG 0.000203896905542 7.09557492553e-05 +ATGAAA 0.000556969666763 0.000454801665541 +GACGGA 0.000135234186924 7.33448317218e-05 +ATGAAG 0.000939319932369 0.000420398878023 +GACGGC 0.00028197025057 6.71332173089e-05 +CTTGTC 0.000236659827116 0.000294812776367 +CTAACT 9.86373064417e-05 0.000195188037514 +CCATAG 9.41062640963e-06 0.000189772783923 +GGTGAA 0.000384790057638 0.000240899148706 +GGTGAC 0.000445436316723 0.000261684166165 +GCGTCT 9.96829315983e-05 8.09898956146e-05 +TGTAAA 0.000211564823357 0.000464278359325 +GGTGAG 0.00042766068906 0.000268851413564 +GGAATG 0.000315778797301 0.00029529059286 +CGTCCT 8.78325131566e-05 9.8032017209e-05 +GGAATC 0.000267680040096 0.000209044715819 +GGAATA 0.00013314293661 0.000202116376667 +GCGTCA 6.48287597108e-05 5.16041812766e-05 +GCGTCC 0.000132097311454 8.64051492054e-05 +GGTGAT 0.00033146317465 0.000198054936474 +GCGTCG 4.60075068915e-05 3.0819163818e-05 +CGTCCG 2.54435454779e-05 4.23663957394e-05 +GGAATT 0.000253738371341 0.000284300813514 +CGTCCC 7.87704284658e-05 9.92265584423e-05 +CGTCCA 8.22558456546e-05 6.33106853625e-05 +TTTCGA 9.89858481606e-05 5.23209060165e-05 +CCGTAT 6.58743848674e-05 3.12969803113e-05 +GAAGTC 0.0004524071511 0.000267417964084 +CTACTT 0.0001052595991 0.00024392531983 +CGTGGT 0.000104213973944 0.000100261827511 +GCCGTA 4.42647982972e-05 3.38453349422e-05 +CCGTAC 8.88781383132e-05 2.76337205293e-05 +CCGTAA 1.3941668755e-06 3.40842431888e-05 +CCGTAG 2.43979203213e-06 4.74631050013e-05 +CTAACA 0.000117110017542 0.000192719318965 +GCCGTT 7.98160536224e-05 6.39477740202e-05 +TTGGTG 0.000413719020305 0.000329613744296 +GAAGTT 0.000419295687807 0.000308350910344 +GGCGCG 0.000119201267855 0.000117542857352 +ATGCCC 0.000344359218249 0.000219158498261 +TTAGTT 8.43470959678e-05 0.000248146032188 +ATGCCA 0.00032240108996 0.000280239373321 +GGCGCC 0.000244327744932 0.000134744251111 +ATGCCG 0.000122338143325 5.12060008655e-05 +GGCGCA 9.7940223004e-05 7.8202632737e-05 +TATTAC 0.000176013568032 0.0001652448706 +ACTATG 0.000137325437237 0.000199249477707 +CCATAT 0.000162071899277 0.000186746612799 +TTTAAG 0.000329720466056 0.00039873786366 +ACTATC 0.000147781688803 0.000113481417159 +TTTAAA 0.000314733172144 0.000941218855722 +ACTATA 9.30606389397e-05 0.000176712466439 +TTTAAC 0.000219581282891 0.000274983391895 +TATTAT 0.000143250646458 0.000325791212349 +TTAGTG 0.000136976895518 0.000216291599301 +GGCGCT 0.000134537103486 0.000110455246035 +TTAGTC 7.35423026827e-05 0.000152104917034 +ATGCCT 0.000338782550747 0.000315358885579 +TTAGTA 7.07539689317e-05 0.000176553194275 +TTTAAT 0.000234220035084 0.000556974759025 +ACTATT 0.000142902104739 0.000213185792095 +GGGCAT 0.00012408085192 0.000216769415794 +TCGATA 1.74270859438e-05 2.39704607473e-05 +TTCTAG 1.18504184418e-05 0.000302935656753 +TTTCCA 0.000263846081189 0.000516997445752 +TTTCCC 0.00020773086445 0.000463322726338 +GGGACT 0.000255829621654 0.000295848045436 +TATCGA 7.73762615903e-05 2.58817267205e-05 +GTTTGT 0.000106653765976 0.000489204453059 +TTTCCT 0.000327280674024 0.000714256021404 +GGGCAG 0.000533617371598 0.000437998452193 +GTCTGT 0.000219232741173 0.000397782230674 +GGGCAA 0.000149524397398 0.00020044401894 +GGGCAC 0.000174967942875 0.000209044715819 +GTACGG 5.75093836144e-05 2.73151762004e-05 +GTTTGA 5.92520922088e-06 0.000315358885579 +GTACGC 5.40239664257e-05 2.36519164184e-05 +GTACGA 4.4613340016e-05 2.18999226097e-05 +CCGCTC 0.000141159396145 0.000116905768694 +GCATGT 0.000103516890506 0.000270762679538 +CCGCTA 3.3460005012e-05 3.76678668886e-05 +CCGCTG 0.000295214835887 0.000159351800516 +TGAAAA 3.48541718875e-07 0.000563903098178 +GCGCGG 7.77248033092e-05 0.000139522416044 +GCGCGC 0.000101077098474 0.000146291483032 +TGTTTT 0.000130354602859 0.00101376732662 +GCGCGA 2.43979203213e-05 4.21274874928e-05 +GCATGG 0.000119201267855 0.000256428184739 +TGGATC 0.000247116078683 0.000233254084813 +GCATGC 9.75916812851e-05 0.000220830855988 +CCGCTT 5.64637584578e-05 7.66099110927e-05 +GCATGA 1.1153335004e-05 0.000198134572556 +TTTCAG 0.00039664047608 0.0004720030593 +GTCGAC 7.77248033092e-05 2.25370112674e-05 +GCGCGT 2.2306670008e-05 4.27645761505e-05 +GTCGAG 9.44548058152e-05 4.56314751103e-05 +CGTGGC 0.000167997108498 0.000108543980062 +CTTCCG 7.66791781526e-05 0.000114914866639 +TGCGCT 5.71608418956e-05 8.16269842724e-05 +GAGCTC 0.000751804487614 0.000318703601032 +ATTGAT 0.000445784858442 0.000223697754947 +GAGCTG 0.00195601612633 0.000517475262246 +AAACGA 0.000141159396145 7.51764616128e-05 +AAACGC 0.0001551010649 6.29125049514e-05 +GTAACA 0.000109790641446 0.00018141099529 +GTAGTA 7.35423026827e-05 0.000117702129517 +AAACGG 0.000162420440996 7.06372049264e-05 +ATTGAA 0.000620752801317 0.000314721796921 +TGCGCG 4.39162565783e-05 6.18772358826e-05 +ATTGAC 0.000498414657992 0.000157121990214 +GAGCTT 0.000471925487357 0.000287406620721 +TGCGCC 0.000102819807068 8.5529152301e-05 +ATTGAG 0.000651075930859 0.0002068945416 +CGCTGA 9.75916812851e-06 9.54040264959e-05 +CACGCA 8.43470959678e-05 8.85553234252e-05 +AAACGT 0.000101077098474 8.60069687943e-05 +ATTTCG 3.03231295422e-05 4.09329462595e-05 +ATTTCA 0.000210519198201 0.000424778862545 +ATTTCC 0.000230734617895 0.00035525656277 +ATCAGT 0.000303928378859 0.000233094812649 +ATCGGG 0.000150221480835 4.79409214946e-05 +CATAGT 9.16664720642e-05 0.000194550948856 +ATCGGC 0.000173922317719 4.11718545062e-05 +ATCGGA 9.93343898795e-05 4.53129307814e-05 +ATTTCT 0.000297306086201 0.000566929269302 +TACGCC 0.000167997108498 2.43686411584e-05 +TGGGTC 0.000189606695068 0.000269169957893 +TTTCGG 9.75916812851e-05 6.16383276359e-05 +TGGGTA 0.00012094397645 0.00022162721681 +CATAGG 5.89035504899e-05 0.000161103794325 +ATCGGT 8.60898045622e-05 3.51195122577e-05 +ATCAGG 0.000239448160867 0.000234289353882 +CATAGC 0.000118155642699 0.00018786151795 +ATCAGC 0.000544073623164 0.000222742121961 +ACGGGT 7.11025106506e-05 5.31172668387e-05 +GTCTGA 2.26552117269e-05 0.000290273519681 +GATTCT 0.000337388383871 0.000289477158859 +CTTTTG 0.000233522951646 0.000459022377898 +GCGTTC 9.5151889253e-05 5.55859853874e-05 +CTTTTC 0.000269771290409 0.000532207937456 +CTTTTA 0.000125126477076 0.000438794813015 +GATTCC 0.000273953791036 0.000217087960123 +ACGGGG 0.000109093558008 7.95564461347e-05 +ACGGGA 0.000105956682538 7.4141192544e-05 +ACGGGC 0.000160677732402 6.42663183491e-05 +TACTAT 0.000236659827116 0.000171297212849 +CTTTTT 0.000227946284144 0.000705734960606 +CGTAGA 2.92775043855e-05 4.50740225348e-05 +TCACGA 4.63560486104e-05 5.27987225098e-05 +TCACGC 5.19327161124e-05 5.29579946743e-05 +TCACGG 8.3998554249e-05 7.8919357477e-05 +TCTCAT 0.000177756276626 0.00032435776287 +TCACGT 3.72939639197e-05 8.44142471499e-05 +AGTGGA 0.000394897767486 0.000339727526737 +TTCCAC 0.000412324853429 0.000298316763985 +TTCCAA 0.000279181916819 0.000363220170991 +TTCCAG 0.00095744410175 0.000539773365266 +CGAGGC 0.000222021074924 0.000126063918149 +ACCCTT 0.000189258153349 0.000261047077507 +TGAAGT 0.0 0.000374687766831 +ATGCTT 0.000258617955405 0.000342355517451 +TTCCAT 0.000306019629173 0.000388624081219 +ACCCTA 0.000142205021301 0.000161024158243 +ACCCTC 0.000391760892016 0.000271718312524 +TGAAGG 0.0 0.000424858498627 +ACCCTG 0.000803040120289 0.000408134921362 +CTGACT 0.000443693608128 0.000402719667771 +CCCCTT 0.000181590235534 0.000330171196871 +AGTTAT 0.000103168348787 0.000233174448731 +CTGACG 0.000211216281638 7.95564461347e-05 +CTGACC 0.000619358634441 0.0003269061175 +CTGACA 0.000428706314217 0.000356212195756 +AGTTAA 4.87958406425e-06 0.000254994735259 +CCCCTG 0.000642710929606 0.000400330585304 +AGTTAC 0.000178453360064 0.000186109524141 +CCCCTC 0.00029138087698 0.00042207123575 +AGTTAG 4.1825006265e-06 0.00018284444477 +CCCCTA 9.7940223004e-05 0.000160785249996 +ACACAG 0.000460772152353 0.000488408092236 +ACACAA 0.000172876692562 0.000322765041225 +ACACAC 0.000234568576803 0.000776451801615 +AATGTT 0.000302882753703 0.000434096284164 +CTGCAG 0.00183437506644 0.000620205808305 +CATGGG 0.000234568576803 0.000292105149572 +CATGGA 0.000305322545735 0.00035095621433 +CATGGC 0.000318915672771 0.000285415718665 +AATGTC 0.000420341312964 0.000270045954798 +ACACAT 0.000179150443502 0.00037142268746 +AATGTA 0.000202154196948 0.000362901626663 +AATGTG 0.000603325715373 0.000402082579113 +CATGGT 0.000204942530699 0.00030174111552 +CTGCAT 0.000353072761221 0.000360353272032 +GCACAG 0.000459029443759 0.000387349903903 +ACATTT 0.000280924625414 0.000541127178664 +CGAGAT 0.000203548363823 5.47896245652e-05 +ATTACT 0.000139068145831 0.000218441773521 +ACATTG 0.000162768982715 0.000288123345461 +GTACCA 0.000137325437237 0.000170023035533 +ACATTA 0.00011153335004 0.000233572629142 +ACATTC 0.00021086773992 0.000273868486744 +ATTACA 0.000142902104739 0.000242890050762 +ATGCTC 0.000344359218249 0.00024535876931 +ATTACC 0.000141159396145 0.000129966086178 +CGAGAC 0.000270119832128 6.92037554465e-05 +ATTACG 2.33522951646e-05 2.75540844471e-05 +AAGTCT 0.000453104234538 0.000320535230923 +ATGCTA 0.000167648566779 0.000213902516835 +GGACAT 0.000182635860691 0.000249260937339 +GCTATA 9.30606389397e-05 0.000135222067604 +GCTATC 0.000203548363823 0.000121285753216 +AAGTCG 0.00013000606114 5.15245451944e-05 +AAGTCA 0.000376773598104 0.000346735501973 +GCTATG 0.00023247732649 0.000198692025131 +AAGTCC 0.000490398198458 0.000239067518815 +GGACAG 0.000497020491116 0.000427167945012 +GGACAC 0.000232825868209 0.000266701239344 +GGACAA 0.000231780243052 0.000250933295066 +GCACCT 0.000277439208225 0.000225609020921 +AGGGTT 9.96829315983e-05 0.000268293960989 +GAGGCG 0.000333205883245 0.000153777274761 +TGTTGG 6.44802179919e-05 0.000345063144246 +GAGGCA 0.000588338421462 0.000393083701823 +AGCGCT 0.000127914810827 0.000100022919264 +GAGGCC 0.00107769099476 0.00036210526584 +TGTTGC 6.93598020562e-05 0.000270205226962 +TTCTCA 0.000316475880739 0.000470489973738 +ACTCGA 8.81810548755e-05 4.78612854124e-05 +TAAAAT 0.0 0.000639318468038 +ACTCGC 7.77248033092e-05 5.89307008405e-05 +ACTCGG 0.000149524397398 8.92720481652e-05 +AGCGCA 9.34091806586e-05 7.8202632737e-05 +GAGGCT 0.000810359496385 0.000392765157494 +AGCGCC 0.000242933578056 0.000110933062528 +AGGGTG 0.000220626908048 0.000301581843356 +AGGGTA 6.34345928353e-05 0.000154732907747 +AGCGCG 8.19073039357e-05 7.66099110927e-05 +AGGGTC 0.000172876692562 0.000224414479687 +TAAAAG 0.0 0.00043178683778 +ACTCGT 5.61152167389e-05 5.16041812766e-05 +TAAAAC 0.0 0.00037428958642 +TAAAAA 0.0 0.000726997794558 +ACGTTC 0.000114321683791 5.59045297163e-05 +AGCTGC 0.000419992771245 0.000458464925323 +ACGTTA 3.83395890763e-05 4.07736740951e-05 +AGCTGA 2.5095003759e-05 0.000433698103753 +ACGTTG 7.07539689317e-05 6.45848626779e-05 +AGCTGG 0.000305322545735 0.000509033837531 +TAGGGG 0.0 0.00014907874591 +TAAATG 0.0 0.000420080333694 +AGTGCG 7.56335529959e-05 6.25939606225e-05 +AGTGCA 0.000299397336514 0.000264232520796 +AGAGTT 0.000181241693815 0.000332401007173 +AGTGCC 0.000500157366586 0.0002686921414 +CCAAAA 0.000274302332755 0.000338931165915 +TTCGTG 0.000278136291662 7.75655440793e-05 +TAGGGT 0.0 0.000148123112923 +GCATAG 3.83395890763e-06 0.000155688540734 +AGCTGT 0.000295911919325 0.000470489973738 +ACGTTT 0.000100380015036 9.17407667139e-05 +AGTGCT 0.000383744432482 0.000383447735875 +AGAGTC 0.000194486279132 0.000288362253707 +AGAGTA 0.000101077098474 0.000217406504452 +AGAGTG 0.000269074206972 0.000353186024632 +TTCGTA 4.42647982972e-05 3.86234998752e-05 +GTTAAA 0.000201805655229 0.000268055052742 +CCTGGC 0.00059496071412 0.000497486605609 +GTTAAC 0.000107350849414 0.000135381339769 +CCTGGA 0.000605416965686 0.000578317229059 +CCTGGG 0.000582064670522 0.000607623307315 +GTTAAG 0.000147433147084 0.000182286992195 +TTCGTC 0.000122338143325 4.73038328369e-05 +GCACCC 0.000280576083695 0.000203948006558 +GTCTGG 0.000227249200707 0.000313527255688 +GTCTGC 0.000279530458538 0.000290432791845 +GTTAAT 0.000131051686297 0.000198054936474 +CCTGGT 0.000411279228273 0.000385359001848 +TCTAAA 0.000237356910554 0.000310501084564 +GGAAGG 0.000209473573044 0.000523049788001 +CCACAT 0.000171482525687 0.000311854897961 +GGAAGC 0.000357952345285 0.000417213434734 +GCACCG 8.3998554249e-05 9.23778553716e-05 +GGAAGA 0.000290683793542 0.000586280837281 +GCGTTA 2.85804209478e-05 3.08987999002e-05 +CAATGA 7.66791781526e-06 0.000238987882733 +CCCGCA 9.58489726907e-05 8.99091368229e-05 +CAATGC 8.05131370602e-05 0.000173686295315 +GCGTTG 7.31937609638e-05 5.2480178181e-05 +CAATGG 8.29529290923e-05 0.000215654510643 +CCACAG 0.00061064509147 0.000501707317967 +GGAAGT 0.000281273167132 0.000344187147342 +CCACAC 0.000234220035084 0.000340205343231 +CCACAA 0.000214701698827 0.000262082346576 +ATTTGT 0.000130703144578 0.000459181650063 +TCCTCG 0.0001551010649 0.000109499613048 +TGTATG 0.000134885645205 0.000368157608089 +CAATGT 0.000120246893012 0.000248464576517 +GCGTTT 7.94675119036e-05 7.17521100775e-05 +TCCTCC 0.000611690716626 0.000543994077624 +TGTATC 0.000126869185671 0.000236439528102 +CGTTAG 3.48541718875e-06 3.83049555463e-05 +TAACCG 0.0 3.63936895731e-05 +TCAAAC 0.000151615647711 0.000234528262129 +TCAGGG 0.000304276920578 0.000352787844221 +CGTTAC 7.98160536224e-05 3.12969803113e-05 +TAACCC 0.0 0.000154971815994 +CGTTAA 2.43979203213e-06 4.07736740951e-05 +TAACCA 0.0 0.000205779636449 +ACCGCT 9.2363555502e-05 6.47441348424e-05 +TCGCGA 1.42902104739e-05 1.94312040609e-05 +TAGTGT 0.0 0.000223299574536 +TCAGGA 0.000374333806072 0.000433459195507 +TTCGTT 8.08616787791e-05 7.39819203795e-05 +TACCCT 0.00025095003759 0.00020474436738 +TAACCT 0.0 0.000198851297296 +CGTTAT 5.19327161124e-05 3.42435153533e-05 +GTGAAA 0.000540239664257 0.000327861750487 +GTGAAC 0.000541633831132 0.000218521409603 +TGCATA 8.36500125301e-05 0.00023707661676 +ACCGCG 6.27375093976e-05 4.20478514105e-05 +ACCGCA 8.9575221751e-05 6.1319783307e-05 +CCCTAT 0.000307065254329 0.000140876229442 +ACCGCC 0.000174967942875 8.41753389033e-05 +AGATCC 0.000121292518169 0.00023635989202 +AGGCTT 0.000165557316466 0.000342275881368 +CCTTCT 0.000422432563277 0.00049430116232 +GGGACG 0.000102819807068 9.35723966049e-05 +TGTCGC 6.65714683052e-05 6.41070461846e-05 +GTTGCC 0.000239099619148 0.000188100426196 +GTGCCG 0.000129308977703 7.86804492303e-05 +GTGCCA 0.000342616509654 0.000282230275377 +GTTGCG 3.93852142329e-05 3.45620596821e-05 +GTGCCC 0.000531177579566 0.000258817267205 +CCGCCG 0.000171482525687 0.000160625977832 +AGGCTA 0.000109093558008 0.000213185792095 +CCTTCC 0.000417552979213 0.000590103369227 +AGGCTC 0.00025095003759 0.000330728649447 +CCGCCC 0.000243979203213 0.000209522532313 +TGTCGA 5.12356326747e-05 4.34016648082e-05 +CCGCCA 0.000178453360064 0.000116109407872 +AGGCTG 0.000492140907052 0.000565018003329 +GTGCCT 0.00044927027563 0.000341638792711 +TCCAAA 0.000486215697831 0.000351035850412 +GTTGCT 0.000269074206972 0.000292423693901 +GGATAT 0.000137325437237 0.000173447387068 +TCGGGT 5.54181333012e-05 6.43459544313e-05 +ATTTGA 1.04562515663e-05 0.00036783906376 +GCAGTT 0.000240842327743 0.000272514673346 +GAAGCT 0.000700220313221 0.000397622958509 +GGATAA 2.43979203213e-06 0.000170739760273 +GGATAC 0.000128960435984 0.000129647541849 +TCGGGG 0.000115715850667 9.30149440294e-05 +GGATAG 2.43979203213e-06 0.000139044599551 +GAAGCG 0.000159980648964 9.23778553716e-05 +CCGCCT 0.000164511691309 0.000145893302621 +GCAGTG 0.000533268829879 0.000400808401798 +GAAGCC 0.000871354297188 0.000405666202813 +GCAGTA 0.000173225234281 0.000185074255072 +GAAGCA 0.000630511969445 0.000425973403778 +GCAGTC 0.000258617955405 0.000235802439444 +CGCCCG 5.36754247068e-05 0.000113481417159 +GAGAGA 0.000548256123791 0.000690843013232 +CGCCCC 0.000125823560514 0.00017711064685 +CGCCCA 0.000127566269108 9.59614790714e-05 +AGTTTG 0.000179150443502 0.0003685557885 +ACGCAG 0.000172876692562 8.1865892519e-05 +ACGCAC 7.98160536224e-05 6.16383276359e-05 +ACGCAA 3.27629215743e-05 4.23663957394e-05 +CTCGCA 7.07539689317e-05 6.43459544313e-05 +ACGTAC 8.36500125301e-05 2.81911731048e-05 +CCCTAG 1.08047932851e-05 0.000199169841625 +ACGCAT 3.38085467309e-05 4.39591173837e-05 +AGTTTC 0.000206336697574 0.000323481765965 +GCCGGG 0.00018298440241 0.00018356116951 +TACCCG 0.000101077098474 3.99773132729e-05 +GCCGGC 0.000241190869462 0.000144459853142 +CATGTT 0.000181241693815 0.000333277004078 +GCCGGA 0.000111881891759 9.93858306067e-05 +TTGGGG 0.000208079406169 0.000371661595706 +AGATCT 0.000134885645205 0.000303413473246 +ACGTAG 1.3941668755e-06 4.4436933877e-05 +GCCACT 0.000441602357815 0.000282309911459 +CATGTA 0.000120595434731 0.000272673945511 +GTTGCA 0.000189606695068 0.000183162989099 +CATGTC 0.000258269413687 0.000255074371341 +GCCGGT 7.70277198714e-05 6.96815719398e-05 +CATGTG 0.000403611310458 0.000418407975968 +GTGCGA 0.000107350849414 3.93402246152e-05 +TACCCC 0.000235962743679 0.000148441657252 +GATTGG 0.000128960435984 0.000173686295315 +GGCCTG 0.000825695332016 0.000426212312025 +GGCCTC 0.000525600912064 0.000364812892636 +GGCCTA 0.00013627981208 0.000140637321195 +TTTGTT 0.00031926421449 0.000944085754682 +AATCGG 9.20150137831e-05 4.07736740951e-05 +AATCGC 8.26043873734e-05 3.92605885329e-05 +AATCGA 7.31937609638e-05 3.83845916286e-05 +TTCCCA 0.000379213390136 0.00049645133654 +GGCCTT 0.000313687546988 0.000327941386569 +TCACTA 8.99237634698e-05 0.000188737514854 +TCACTC 0.000174967942875 0.000269488502222 +AATCGT 5.61152167389e-05 4.02958576018e-05 +AGCCGA 0.000179498985221 9.04665893984e-05 +CCTTCA 0.000308110879486 0.00039443751522 +AGCCGC 0.000302185670265 0.000134107162453 +TAATTG 0.0 0.000218362137439 +AAAAAT 0.000454498401413 0.000746667906866 +AGCCGG 0.000293472127293 0.000144141308813 +GTTTTT 0.000186469819598 0.000672526714322 +TGGTGA 1.32445853173e-05 0.000355097290605 +GATGGA 0.000664320516176 0.00034665586589 +TGGTGC 0.000122338143325 0.000274346303237 +CCAAGT 0.000246418995245 0.000302139295931 +GGGCTG 0.000620752801317 0.00046985288508 +TGGTGG 0.000192743570538 0.000429557027478 +GATGGG 0.000633300303196 0.00027155904036 +AAAAAA 0.000459726527197 0.00164687418025 +AAAAAC 0.000430100481092 0.000494619706649 +GAGCGA 0.000231083159614 9.1422222385e-05 +AGCCGT 0.000139765229269 8.28215255056e-05 +AAAAAG 0.000777596574811 0.000579033953799 +TGACAG 6.97083437751e-07 0.000386792451328 +CCAAGG 0.000225506492112 0.000370467054473 +CTACAT 9.34091806586e-05 0.000235085714704 +TCTCAG 0.000571259877237 0.000522014518932 +CCAAGC 0.000261057747438 0.000303413473246 +TGGTGT 0.000131400228016 0.000383607008039 +CCAAGA 0.000224112325237 0.000383925552368 +AGAACT 0.000202851280385 0.000396348781194 +GCATTA 0.00010212272363 0.000154892179912 +CCTTCG 8.64383462811e-05 8.62458770409e-05 +TACCAT 0.000189955236787 0.000192798955047 +AGATAG 7.66791781526e-06 0.000204585095215 +CACTGT 0.000260709205719 0.000445563880004 +ACCCGA 0.000119201267855 6.681467298e-05 +ATGTCT 0.000346799010281 0.00035167293907 +ACCCGC 0.000154055439743 7.36633760507e-05 +AGATAA 1.1153335004e-05 0.00027299248984 +TACCAC 0.000357603803566 0.000186905884963 +AGAACG 5.50695915823e-05 7.86804492303e-05 +TACCAA 0.000196926071165 0.000202514557078 +AGAACA 0.000237356910554 0.000444528610935 +TACCAG 0.000637134262104 0.000214778513739 +AGAACC 0.000200411488353 0.000299033488725 +ATGTCA 0.000279879000257 0.00030532473922 +CACTGG 0.000296957544482 0.000408692373937 +AGATAT 0.000107350849414 0.00025180929197 +TGACAA 3.48541718875e-07 0.000296644406258 +ACCAGG 0.000288592543229 0.000339488618491 +CACTGC 0.000326235048867 0.000361707085429 +ATGTCG 9.2363555502e-05 4.11718545062e-05 +CACTGA 2.92775043855e-05 0.000410125823417 +TAGGTT 0.0 0.000173288114904 +GTTTAC 0.000139765229269 0.000193595315869 +AATTAT 0.00016730002506 0.000342275881368 +CTGTTG 0.00043079756453 0.000399295316236 +TGCTAT 0.000179498985221 0.000245279133228 +CTGTTC 0.000452755692819 0.000380103020421 +CGGGTT 7.45879278393e-05 6.80092142133e-05 +CTGTTA 0.000149872939116 0.000281433914555 +AATTAC 0.000211216281638 0.000191126597321 +AATTAA 1.01077098474e-05 0.000395233876043 +AATTAG 4.1825006265e-06 0.000188498606607 +TAGGTC 0.0 0.000125745373821 +CGGGTC 0.000161374815839 8.49716997255e-05 +CTGTTT 0.000415810270618 0.000570911073413 +CGGGTA 6.83141768996e-05 3.72696864775e-05 +CGGGTG 0.000243282119775 0.000105915989349 +CCAAAC 0.00026663441494 0.000261604530083 +CTTCGG 0.000238402535711 8.87145955897e-05 +CACACT 0.000291032335261 0.000347133682384 +TGGATG 0.000283015875727 0.000366087069951 +AGCAAA 0.000496671949397 0.000401764034784 +ATATAT 0.000103865432225 0.000573937244537 +AGCAAC 0.000554878416449 0.000254357646601 +TTAGGC 7.59820947148e-05 0.000124869376916 +AAAGCT 0.000514099035341 0.000406382927553 +AGCAAG 0.000770277198714 0.000415222532679 +AAAGCA 0.000485867156112 0.000516360357095 +ATATAG 9.06208469076e-06 0.000183959349921 +TTAGGT 7.94675119036e-05 0.000171456485013 +ATATAA 7.66791781526e-06 0.000344824235999 +AGCAAT 0.000353769844658 0.000248384940435 +ATATAC 8.3998554249e-05 0.000201718196255 +ATAGCA 0.000172179609124 0.000210717073546 +ATAGCC 0.000181241693815 0.000166837592244 +TACTTG 0.000253738371341 0.00024320859509 +ATAGCG 3.3460005012e-05 2.8987533927e-05 +TCTCAC 0.000202154196948 0.000307076733028 +TGCTAA 1.49872939116e-05 0.000257702362054 +ATAGCT 0.000171133983968 0.00021087634571 +TACTTT 0.000310899213237 0.000365051800882 +GTTTTC 0.000215747323984 0.000445723152168 +CGAGTT 9.55004309718e-05 6.55404956645e-05 +CTCGCC 0.000149175855679 0.000116666860448 +CGTACT 3.79910473574e-05 3.00228029958e-05 +TCCCGT 7.84218867469e-05 8.44938832322e-05 +ACATAC 0.000180196068659 0.000234050445636 +CTTAAG 0.000209822114763 0.000240421332213 +ACATAA 8.36500125301e-06 0.000254357646601 +CTTAAA 0.000221323991486 0.000349761673097 +AGGGGT 0.000104213973944 0.000231820635333 +CTTAAC 0.000149524397398 0.000180534998386 +CGTACA 4.14764645462e-05 3.6712233902e-05 +CGAGTG 0.000240493786024 8.09102595324e-05 +TTGTTA 0.0001052595991 0.000305484011384 +CGAGTA 7.59820947148e-05 3.60751452443e-05 +CGAGTC 0.00013627981208 6.70535812267e-05 +AGGGGA 0.00014255356302 0.000355495471016 +CTTAAT 0.000151615647711 0.000229431552867 +AGGGGC 0.000221672533205 0.000288760434119 +TATGCA 0.000296260461044 0.000237872977582 +AGGGGG 8.33014708112e-05 0.000250216570326 +TCATTA 9.2363555502e-05 0.000251968564134 +CGACTT 7.66791781526e-05 5.98863338271e-05 +TCGGGC 0.000142902104739 8.32993419989e-05 +TTGTAA 9.06208469076e-06 0.000380899381244 +TTGTAC 0.000165557316466 0.000225449748756 +GTACCT 0.00016102627412 0.000177429191179 +TCATTG 0.000128263352546 0.000286928804228 +TGAATC 0.0 0.000215335966315 +CGACTA 4.98414657992e-05 2.54039102272e-05 +TGAATA 0.0 0.000313845800017 +CGACTC 0.000100380015036 5.58248936341e-05 +TGAATG 0.0 0.000392526249247 +AAGTAT 0.000357603803566 0.000272196129017 +CGACTG 0.000162071899277 6.84073946243e-05 +TTGCCA 0.000251298579309 0.000316792335059 +TTGTAT 0.000137673978956 0.000394596787385 +ATCGTG 0.000320658381365 5.92492451694e-05 +GCTTCG 9.27120972208e-05 8.15473481901e-05 +ATCGTC 0.000197274612883 4.07736740951e-05 +ATCGTA 5.61152167389e-05 3.08987999002e-05 +TGGGAG 0.000450315900787 0.00047128633456 +TGGGAA 0.00034087380106 0.00052336833233 +TGGGAC 0.000352375677783 0.000302537476342 +GCTTCT 0.000376425056385 0.000438316996522 +ATCGTT 9.93343898795e-05 5.00114596322e-05 +GATTGA 9.06208469076e-06 0.000173606659233 +TGGGAT 0.000307762337767 0.000347930043206 +GGGCTA 0.00010839647457 0.000172571390164 +CTAGCC 0.00021086773992 0.000198134572556 +CTAGCA 0.000151267105992 0.000204903639544 +CTAGCG 4.56589651727e-05 4.08533101773e-05 +CGGTAG 2.43979203213e-06 4.76223771657e-05 +ACTTAG 3.13687546988e-06 0.000204824003462 +ACTTAA 9.06208469076e-06 0.000258498722876 +CGGTAC 0.000127914810827 3.17747968046e-05 +ACTTAC 0.000184030027566 0.000174164111808 +CGGTAA 6.97083437751e-06 2.87486256803e-05 +GACCAG 0.000912133678297 0.000320296322676 +GACCAC 0.00046495465298 0.000200205110693 +TTGCCC 0.000224112325237 0.000240978784788 +CTAGCT 0.000175665026313 0.000215097058068 +TTCGAG 0.000241539411181 7.09557492553e-05 +ACTTAT 9.82887647228e-05 0.000173367750986 +CGGTAT 7.00568854939e-05 2.63595432138e-05 +TACACA 0.000324840881992 0.000335427178298 +TACACG 0.00014882731396 5.05689122077e-05 +GCGAGA 5.26297995502e-05 7.31855595574e-05 +GAGAGC 0.000790492618409 0.000358760550387 +GCGAGC 9.20150137831e-05 0.000115153774886 +GGCCGT 0.000152661272867 7.91582657236e-05 +GCGAGG 7.14510523694e-05 0.000113242508912 +TTAAGA 0.000103865432225 0.000350319125672 +CAGCCG 0.000245373370088 0.000158157259283 +CAGCCA 0.000695689270875 0.000516838173588 +CAGCCC 0.000712419273381 0.000475586682999 +TCCGGG 0.000107699391132 0.000120170848065 +GCGAGT 4.32191731405e-05 5.33561750853e-05 +CAGCCT 0.00073437740167 0.00059233317953 +GAACTC 0.000393852142329 0.000301183662944 +GAACTA 0.000220975449767 0.000187065157128 +GGACTT 0.000198668779759 0.000291945877407 +CACCTA 0.000142205021301 0.000175517925206 +AACTAT 0.000290335251823 0.000214937785903 +CACCTC 0.000356558178409 0.000333754820571 +CACCTG 0.000729149275887 0.000401764034784 +TGATCC 0.0 0.000195108401431 +AACACT 0.000322749631679 0.000316712698977 +TGATCA 0.0 0.000218123229192 +TGATCG 0.0 4.22867596572e-05 +TGCATG 0.000265240248064 0.000329215563885 +AACTAG 9.06208469076e-06 0.00016596159534 +GATTTA 0.000174967942875 0.000241934417775 +CACCTT 0.000219581282891 0.00031073999281 +AACTAC 0.000434282981719 0.000161024158243 +AACTAA 1.88212528193e-05 0.000234846806458 +AACACG 0.000162071899277 6.753139772e-05 +AACACA 0.000397686101237 0.000385916454423 +AACACC 0.00045554402657 0.000218123229192 +TGATCT 0.0 0.000271957220771 +CCAGCA 0.00050503695065 0.000518112350903 +CTATAC 6.76170934618e-05 0.000120091211983 +CAACAG 0.00049283799049 0.000303572745411 +GACAGT 0.00059496071412 0.00028629171557 +CAACAA 0.000257920871968 0.000298714944396 +CCAGCC 0.000674428226024 0.000572344522893 +CAACAC 0.000159980648964 0.000214698877657 +GGCCGG 0.000281273167132 0.000159829617009 +CTATAA 5.92520922088e-06 0.000207292722011 +GACAGG 0.000410930686554 0.000341001704053 +CAACAT 0.000146736063647 0.000221467944645 +GACAGC 0.000885644507662 0.000340762795806 +GACAGA 0.000431146106249 0.000428362486245 +GTATTA 6.06462590843e-05 0.000182366628277 +GTATTC 0.000112927516916 0.000168032133478 +GTAAGT 6.65714683052e-05 0.000155688540734 +CCAGCG 0.00013314293661 0.000140318776866 +AGAGGT 0.000171133983968 0.000319261053608 +GGTGGC 0.0005576667502 0.000333993728818 +TCCCCT 0.000358649428723 0.000407975649197 +GGTGGA 0.000336691300434 0.000305961827877 +CGTCAT 4.87958406425e-05 5.27190864276e-05 +GGTGGG 0.000291032335261 0.000397861866756 +AGAGGC 0.00026349753947 0.00041777088731 +GTAAGA 9.37577223775e-05 0.000204585095215 +AGAGGA 0.000291729418699 0.000554506040476 +CGCCCT 0.000126869185671 0.000125108285163 +AGAGGG 0.000202154196948 0.000395791328618 +GTAAGG 6.30860511164e-05 0.000151388192294 +CGTCAA 4.56589651727e-05 3.67918699842e-05 +CGTCAC 7.00568854939e-05 6.37885018558e-05 +TCCCCC 0.000253041287903 0.000341081340135 +GGTGGT 0.000328674840899 0.000276815021786 +CGTCAG 0.000138371062393 7.74859079971e-05 +GTCCGG 0.000172179609124 7.03186605975e-05 +GTCGCA 5.0190007518e-05 3.98976771907e-05 +GTCGCC 0.000115018767229 7.10353853375e-05 +CCGTCT 0.000103516890506 8.70422378631e-05 +TCGGTA 3.76425056385e-05 3.20137050512e-05 +CTCGCG 3.3460005012e-05 5.09670926188e-05 +TCGGTG 0.000196228987727 8.64051492054e-05 +GTCGCT 6.23889676787e-05 6.71332173089e-05 +TACCTA 0.000126520643952 0.000158236895365 +GTAACT 0.000123383768482 0.000202275648831 +CCGTCG 5.2978341269e-05 3.22526132979e-05 +CCGTCA 7.52850112771e-05 5.89307008405e-05 +CCGTCC 0.000146387521928 9.29353079472e-05 +GGCTGT 0.000347147552 0.000408692373937 +CGCGTG 0.000143250646458 5.00910957144e-05 +CTATAT 6.41316762731e-05 0.000190648780827 +CGCGTC 6.48287597108e-05 4.6268563768e-05 +CGCGTA 1.70785442249e-05 1.20250484148e-05 +GTTTTA 0.000139765229269 0.000424539954298 +ATGCAG 0.000694992187437 0.000337497716435 +CCACTA 0.000102819807068 0.000156166357227 +CCACTC 0.000236311285397 0.00027840774343 +CGCGTT 1.77756276626e-05 2.50853658983e-05 +GGCTGG 0.000459726527197 0.000536349013731 +GGCTGA 1.6730002506e-05 0.000374369222502 +GGCTGC 0.000468440070168 0.000442139528468 +ATGCAT 0.000187863986474 0.000278965196006 +TTTAGA 0.00011153335004 0.0003304897412 +TTTCAT 0.000177407734908 0.000482196477824 +TTGACC 0.000174270859438 0.000187304065374 +ATGACG 0.000138022520675 5.41525359075e-05 +GGAGTT 0.000226900658988 0.000272355401182 +ATGACA 0.000329023382618 0.000293777507298 +ATGACC 0.000387926933108 0.000199090205542 +CGGGCC 0.000330417549494 0.000141115137688 +GGGCCT 0.000342965051373 0.000313686527852 +TAAGAA 0.0 0.000375961944146 +ATGACT 0.000308459421205 0.000274585211484 +GGAGTA 0.000141507937863 0.000148999109828 +GGAGTC 0.000280924625414 0.000259852536274 +GGAGTG 0.000376773598104 0.000305643283549 +GGGCCG 0.000118155642699 0.000142548587168 +GGGCCC 0.00039036672514 0.000253561285779 +GGGCCA 0.000284410042602 0.000282947000117 +GGCAAG 0.000831271999518 0.000277850290855 +ACGAGT 5.92520922088e-05 4.88965544812e-05 +AGGCCA 0.000253041287903 0.000404710569826 +AGGCCC 0.000246070453526 0.000287247348556 +AGGCCG 8.99237634698e-05 0.000110853426446 +ACGAGG 6.51773014297e-05 7.93175378881e-05 +ACGAGC 7.59820947148e-05 5.55063493052e-05 +GACCCG 0.000185424194442 8.97498646585e-05 +ACGAGA 4.35677148594e-05 6.10012389782e-05 +GGCAAC 0.000483078822361 0.000144300580977 +AGGCCT 0.000260709205719 0.000355176926688 +AGACGG 9.58489726907e-05 8.57680605476e-05 +GGGTTG 0.000135234186924 0.000225210840509 +TTTGGG 0.000453452776257 0.000409249826513 +GGGTTA 7.24966775261e-05 0.000136098064509 +GGGTTC 0.000153706898024 0.000205700000366 +TTTGAT 0.000640619679293 0.000384323732779 +TGAACT 0.0 0.000373811769926 +CTACGA 6.37831345542e-05 3.04209834069e-05 +ATTGCT 0.000459029443759 0.000302776384589 +GGGTTT 0.000174967942875 0.000337816260764 +TACAAG 0.000603674257092 0.000222981030207 +TGCGAG 0.000167648566779 6.64164925689e-05 +AACGGC 0.00019832023804 5.08874565366e-05 +ATCCAT 0.000273953791036 0.000246155130133 +ATTGCA 0.000301488586827 0.000214619241575 +TTTGGC 0.00046809152845 0.000264710337289 +ATTGCG 7.80733450281e-05 2.74744483648e-05 +TTTGAC 0.000649333222265 0.00025682636515 +TTTGAA 0.000781430533718 0.000574415061031 +CGGGCT 0.000198668779759 0.000129966086178 +CTCGTA 4.1825006265e-05 3.16951607223e-05 +CTCGTC 0.000124777935357 7.01593884331e-05 +CCCTGG 0.00033460005012 0.000546462796173 +CCCTGA 2.71862540723e-05 0.000394915331714 +AAGCTT 0.000373985264353 0.0003340733649 +CCCTGC 0.000330766091213 0.000490956446867 +GTGTAA 1.53358356305e-05 0.000225529384838 +CCCTGT 0.000226900658988 0.000430831204794 +AAGCTC 0.000569517168642 0.000277292838279 +GATATA 0.000166951483341 0.0001652448706 +AAGCTA 0.000277439208225 0.000235722803362 +GATATG 0.000302882753703 0.000166359775751 +AAGCTG 0.00130947123781 0.000479011034535 +TGACGC 3.48541718875e-07 5.37543554964e-05 +TACTCT 0.000196926071165 0.000233094812649 +CATCGT 5.82064670522e-05 6.7929578131e-05 +GTAGTC 0.000100380015036 0.000120569028476 +CAGGGT 0.000347147552 0.000334630817476 +CCAGTC 0.000291729418699 0.000291229152667 +TACGAT 0.00013314293661 2.68373597071e-05 +CCAGTG 0.000535708621911 0.000426053039861 +TACTCG 9.65460561285e-05 3.45620596821e-05 +CATCGA 7.07539689317e-05 5.4709988483e-05 +CATCGC 7.66791781526e-05 6.45848626779e-05 +TACTCC 0.00026663441494 0.000156484901556 +TACTCA 0.000163117524434 0.000199090205542 +CATCGG 0.000105956682538 5.9089973005e-05 +CAGGGG 0.000340525259341 0.000328658111309 +CCAGTT 0.000239796702586 0.000304209834069 +CAGGGC 0.00065072738914 0.000401126946127 +AATCTG 0.000335297133558 0.000291866241325 +CGGACT 0.000125475018795 6.33106853625e-05 +AATCTC 0.000235962743679 0.000237395161089 +AATCTA 0.000122686685044 0.000199966202447 +TGAACG 0.0 6.5699767829e-05 +TCACAC 0.000136976895518 0.000279681920746 +TCACAA 0.000142205021301 0.000281354278472 +TAAATT 0.0 0.000415142896597 +GCCATA 0.000197274612883 0.00015767944279 +CGGACG 5.82064670522e-05 3.87031359574e-05 +ACATCG 5.96006339277e-05 5.16838173588e-05 +CGGACA 0.000152312731149 7.28670152285e-05 +CGGACC 0.000172876692562 7.25484708996e-05 +GCCATG 0.000876233881253 0.000319818506183 +TTTTAA 1.42902104739e-05 0.000959216610303 +TCACAT 0.00011467022551 0.000299033488725 +ATTAAC 0.000185075652723 0.00016811176956 +ATTAAA 0.00032553796543 0.000538738096198 +ATTAAG 0.000295563377606 0.000214539605492 +TTTTAC 0.000181590235534 0.000344346419506 +TCACTT 0.000148130230522 0.000328897019556 +ATTCGT 7.14510523694e-05 4.64278359325e-05 +GTGCAG 0.000848002002024 0.000333197367996 +TTACTA 7.49364695582e-05 0.0001997272942 +ATTAAT 0.000188561069912 0.000292582966065 +TACCTG 0.000773414074184 0.000272594309429 +GGTATG 0.000103865432225 0.000141592954182 +CTGAAT 0.000460075068915 0.000326746845336 +GGTATC 0.000135234186924 0.000105836353266 +CGAGAG 0.000388275474827 9.89876501956e-05 +CTGAAA 0.000677913643212 0.000488089547908 +CTGAAC 0.000616918842409 0.000309306543331 +TCGACC 4.21735479839e-05 3.57566009154e-05 +GGAACC 0.00025408691306 0.000246632946626 +CTGAAG 0.00155519314962 0.000567884902289 +CATTGC 8.57412628433e-05 0.000232298451827 +TATGAG 0.000664669057895 0.00019757711998 +CATTGA 1.01077098474e-05 0.000245597677557 +CTAGTT 7.77248033092e-05 0.00018642806847 +CATTGG 6.65714683052e-05 0.000226086837414 +TCAACT 0.000147084605365 0.000228316647716 +ATGTTA 0.000114321683791 0.000263117615645 +ACACCG 9.93343898795e-05 7.74062719149e-05 +CTGCCA 0.000482381738923 0.000474073597437 +CTGCCC 0.000847304918586 0.000510626559175 +ACACCC 0.00031612733902 0.000245597677557 +ACACCA 0.000321704006522 0.000299829849547 +CTGCCG 0.000238053993992 0.000155847812899 +CTAGTG 0.000209822114763 0.000180136817975 +TCAACC 0.000138719604112 0.000170580488109 +ATGTTC 0.000369454222008 0.000279761556828 +CTAGTC 9.13179303453e-05 0.00013864641914 +TCAACG 3.58997970442e-05 4.27645761505e-05 +CTAGTA 5.78579253333e-05 0.000113959233652 +CATTGT 9.34091806586e-05 0.000343550058684 +TATGAC 0.000524206745188 0.000159192528352 +GTAATG 0.000110836266602 0.000184118622086 +ACACCT 0.000292775043855 0.000265506698111 +CTGCCT 0.00067547385118 0.000753357337772 +CCTCGT 7.42393861204e-05 8.77589626031e-05 +TTGTGT 0.000129308977703 0.000503140767447 +AGACTG 0.000282318792289 0.000418009795557 +AGACTC 0.00017043690053 0.000291945877407 +AGACTA 9.20150137831e-05 0.000198532752967 +CCTCGG 0.000231431701333 0.000153060550021 +CCTCGC 0.00011780710098 0.000118339218174 +CCCGAC 0.000200760030072 7.35041038862e-05 +CCTCGA 0.000168694191936 7.69284554216e-05 +CGAGGA 0.000165557316466 0.00012319701919 +AGACTT 0.000165905858185 0.0003649721648 +CGAGGG 0.000160329190683 0.000113242508912 +CACCGT 9.58489726907e-05 8.6644057452e-05 +ACTTTA 0.000134537103486 0.000310899264975 +ACTTTG 0.000238402535711 0.000401445490456 +TAGCTA 0.0 0.000160625977832 +GACCTG 0.00128193644202 0.000348726404028 +GTCGCG 2.47464620401e-05 3.55176926688e-05 +GACCTA 0.000239099619148 0.000156166357227 +GACCTC 0.000680701976963 0.000252127836299 +CACCGG 0.000214353157108 9.5802206907e-05 +CTATTG 7.38908444016e-05 0.000176234649946 +CACCGA 0.000145341896771 8.16269842724e-05 +ACTTTT 0.000200411488353 0.00046770271086 +GACCTT 0.000418947146088 0.000273629578497 +GGACGC 9.55004309718e-05 8.65644213698e-05 +GGACGG 0.000123035226763 9.02276811518e-05 +CTATTA 4.11279228273e-05 0.00016237797164 +CACAGC 0.000533617371598 0.000453925668636 +CTTATC 0.000174270859438 0.000141831862428 +CACAGA 0.000270468373847 0.000530535579729 +CTTATA 7.94675119036e-05 0.000175916105617 +CACAGG 0.000302882753703 0.00044038753466 +CTTATG 0.000141507937863 0.000191126597321 +ACTCAT 0.0001551010649 0.000231024274511 +CGTATA 1.3941668755e-05 2.6439179296e-05 +GACGTA 6.69200100241e-05 3.07395277357e-05 +CGTATC 5.54181333012e-05 2.5324274145e-05 +CTATTC 6.86627186184e-05 0.000162457607723 +GAGGAC 0.00130284894516 0.00033909043808 +CGTATG 3.69454222008e-05 3.61547813265e-05 +AGCGAT 0.000146736063647 5.20023616877e-05 +TTAACA 0.000129657519422 0.000271957220771 +ACTCAC 0.000231431701333 0.000258100542465 +TTAACC 8.3998554249e-05 0.000174164111808 +ACTCAA 0.000174270859438 0.000242969686844 +ACTCAG 0.000403611310458 0.000390694619356 +CTTATT 0.000159632107245 0.000275779752717 +CACAGT 0.000319612756209 0.000394198606974 +AGCGAC 0.000240842327743 6.06030585671e-05 +TAAACA 0.0 0.000364175803978 +AGCGAA 0.000128263352546 6.23550523759e-05 +GAGGAT 0.00093583451518 0.000274266667155 +AGCGAG 0.000362134845911 0.000121922841874 +CGTATT 4.53104234538e-05 4.12514905884e-05 +TAAACG 0.0 5.35154472498e-05 +AGTTCC 0.000222718158361 0.000294414595956 +GTATGT 0.000103168348787 0.000291388424832 +AGTTCA 0.000198668779759 0.000335108633969 +TACTTA 0.000128960435984 0.000206575997271 +AGTTCG 3.3460005012e-05 4.97725513856e-05 +TAGCCC 0.0 0.000191684049896 +CTGTGA 3.76425056385e-05 0.00055140023327 +CGGGGT 0.000132794394891 8.89535038363e-05 +TAGGAC 0.0 0.000149238018075 +GCAAAG 0.000432540273124 0.00032220758865 +TAGGAA 0.0 0.0002995909413 +GCAAAA 0.000284410042602 0.000289477158859 +TAGGAG 0.0 0.000233015176567 +GCAAAC 0.000227249200707 0.000213185792095 +CGGGGC 0.000264543164626 0.000184835346825 +CGGGGA 0.00013314293661 0.00013936314388 +CTGTGT 0.000375727972948 0.00067603070194 +CGGGGG 9.30606389397e-05 0.000108145799651 +GTATGC 6.34345928353e-05 0.000128691908863 +AGTTCT 0.000296609002763 0.000394198606974 +GCAAAT 0.000254435454779 0.000240819512624 +TAGGAT 0.0 0.00018356116951 +TAATTA 0.0 0.000289317886694 +CTATTT 0.000105956682538 0.000352150755563 +TGCTTT 0.000243979203213 0.000600933876409 +GTCTAT 0.000215050240546 0.000164607781942 +GTAATT 0.000106653765976 0.000216530507548 +GTTACC 0.000140810854426 0.000139681688208 +GTTACA 0.000104213973944 0.000201957104502 +TAATTC 0.0 0.00020259419316 +GTTACG 2.40493786024e-05 2.88282617625e-05 +TATCGC 5.15841743935e-05 2.49260937339e-05 +TATAGT 7.98160536224e-05 0.000183800077757 +GTCTAA 6.97083437751e-06 0.000153219822185 +AGGACG 7.84218867469e-05 9.34927605227e-05 +GTCTAC 0.000340176717622 0.000156803445885 +TGCTTC 0.000360740679036 0.000427008672847 +TTCAAA 0.000423129646715 0.000471604878889 +GGCGTT 7.66791781526e-05 5.7258343114e-05 +GGGCTC 0.000314036088707 0.000312332714455 +TATAGC 0.000121989601606 0.000143106039744 +TATCGT 3.83395890763e-05 3.08987999002e-05 +TATAGA 9.2363555502e-05 0.000228635192045 +AGTGGG 0.000372939639197 0.000341877700957 +TATAGG 6.37831345542e-05 0.000132992257302 +GTGGCG 0.000211913365076 0.000110853426446 +GTTACT 0.000137325437237 0.000194471312774 +GCTCTC 0.000362134845911 0.000346018777233 +AACCTT 0.00029765462792 0.000293618235134 +GATGGC 0.000770974282152 0.000268771777482 +GCTCTG 0.000773762615903 0.000542003175568 +CCACGT 6.41316762731e-05 0.000103049090389 +CAATAT 0.000108047932851 0.000197895664309 +CAGGAG 0.00162629566027 0.000584210299143 +GAATGG 0.000281273167132 0.000276894657868 +GAATGA 1.98668779759e-05 0.000306360008289 +ACTACT 0.000125126477076 0.000171775029342 +GAATGC 0.000234568576803 0.000212389431273 +CCACGA 7.87704284658e-05 7.83619049015e-05 +CAATAC 0.000104911057381 0.000116427952201 +CCACGC 0.000115715850667 0.000108942160473 +CAATAA 5.576667502e-06 0.000300785482533 +GTTCCG 5.43725081445e-05 5.8373248265e-05 +CAATAG 4.53104234538e-06 0.000133549709878 +CCACGG 0.0001551010649 0.000118737398585 +AACCTA 0.000180544610377 0.000172810298411 +GAATGT 0.000413021936867 0.000328737747391 +ACTACC 0.000157192315213 0.000131399535658 +GGCTTC 0.000750410320739 0.000366166706033 +ACTACA 0.000161374815839 0.000211354162204 +ACTACG 4.07793811084e-05 3.16155246401e-05 +GGCTTG 0.000349238802313 0.000302139295931 +CGTTGA 2.788333751e-06 5.12060008655e-05 +AGTCAG 0.000366317346538 0.000354221293701 +CGTTGC 5.12356326747e-05 5.43118080719e-05 +TAACAC 0.0 0.000168032133478 +TCCTAC 0.00037816776498 0.000201479288009 +AGTCAC 0.000184727111004 0.000271001587784 +CGTTGG 4.7401673767e-05 6.23550523759e-05 +AGTCAA 0.000161374815839 0.000234448626047 +TCATCG 4.91443823614e-05 6.08419668137e-05 +TGAGGG 0.0 0.000327463570076 +TCATCC 0.000226900658988 0.00023492644254 +GAGCGG 0.0004524071511 0.000137531513989 +CTTTCT 0.000318218589333 0.000708203679155 +AGTCAT 0.000147084605365 0.000262878707398 +TCCTAT 0.000272211082442 0.000215256330232 +TAACAT 0.0 0.000240421332213 +CGTTGT 4.56589651727e-05 5.99659699093e-05 +CTTTCC 0.000276393583068 0.000508715293202 +CTTTCA 0.000194834820851 0.000395074603878 +CTTTCG 4.11279228273e-05 6.60979482401e-05 +GAGCGC 0.000432540273124 0.000126143554232 +GTTGAT 0.000255481079936 0.000186189160223 +CGACCA 8.53927211245e-05 4.84983740701e-05 +CGACCC 9.30606389397e-05 6.76906698844e-05 +GCATAC 0.000136976895518 0.000122241386203 +CGACCG 1.98668779759e-05 2.85097174337e-05 +CCTTAT 0.000212261906795 0.000186268796305 +GTTGAC 0.000250252954152 0.000145574758293 +GTTGAA 0.000332857341526 0.000241456601282 +ACTGGG 0.000348193177156 0.000343151878273 +GTTGAG 0.000262800456032 0.000222184669385 +TTAGGG 8.6786888e-05 0.000181172087044 +CCTTAC 0.000263148997751 0.000177907007673 +TTCGAT 0.00013627981208 3.6712233902e-05 +CCTTAA 8.36500125301e-06 0.000231422454922 +CCTTAG 8.36500125301e-06 0.000215415602397 +CGACCT 9.30606389397e-05 6.01252420738e-05 +CAACTC 0.000174619401157 0.000216769415794 +CAACTA 8.36500125301e-05 0.000142309678922 +CAACTG 0.000315081713863 0.000257941270301 +AATAGG 7.38908444016e-05 0.000156325629392 +GATGGT 0.00041825006265 0.000246712582708 +GGGGTT 0.00013941668755 0.000226485017825 +GGATGT 8.99237634698e-05 0.000256189276492 +AATAGT 0.000140462312707 0.000192958227212 +GGGCTT 0.000185075652723 0.000295370228943 +CAACTT 0.00016416314959 0.000269647774387 +GGATGC 9.09693886265e-05 0.000258180178547 +GGATGA 7.66791781526e-06 0.000260728533178 +GGATGG 0.000121292518169 0.00032077413917 +GGGGTA 8.78325131566e-05 0.000124232288258 +TCTCCG 0.00010839647457 0.000110694154282 +GAGTCC 0.000502248616899 0.000242014053857 +AAACTG 0.000616918842409 0.000443174797537 +TCTCCC 0.000295563377606 0.000438157724358 +AAACTA 0.000191000861944 0.000276416841375 +TCTCCA 0.000507825284401 0.00049860151076 +AAACTC 0.000372591097478 0.000297520403162 +ACGCGA 1.6730002506e-05 1.58475803612e-05 +AGTACG 2.99745878233e-05 2.8270809187e-05 +ACGCGC 5.08870909558e-05 3.99773132729e-05 +AGTACC 0.000176362109751 0.000145972938704 +ACGCGG 4.98414657992e-05 4.39591173837e-05 +AGTACA 0.000150570022554 0.000208805807573 +AAACTT 0.000344707759968 0.000384562641026 +CCCTTC 0.00052385820347 0.000404630933744 +TCTCCT 0.000427312147341 0.000552913318832 +CCCTTG 0.000309505046361 0.000328498839145 +TTCTAT 0.000298700253076 0.000325472668021 +AGTACT 0.000133491478329 0.000199249477707 +ACGCGT 1.91697945381e-05 2.2775919514e-05 +GCCGAA 0.000147084605365 5.32765390031e-05 +GTGGAG 0.00147084605365 0.000389181533794 +GCCGAC 0.000237705452273 5.27190864276e-05 +GTGGAC 0.000932349097991 0.000235165350787 +GCCGAG 0.000472622570795 0.000140239140784 +GTGGAA 0.000819073039357 0.000339727526737 +TATCAT 0.000104562515663 0.000215335966315 +GTGGAT 0.000757032613397 0.000262082346576 +GCCATC 0.000975219729413 0.000271160859949 +GCCGAT 0.000127914810827 3.66325978198e-05 +CCTATT 0.000151615647711 0.000172412118 +ACCCGG 0.000220626908048 9.54040264959e-05 +ACCGAG 0.000286152751197 9.23778553716e-05 +AAATCG 5.85550087711e-05 5.55063493052e-05 +CACGCG 5.99491756466e-05 4.18885792461e-05 +TTATCG 2.05639614136e-05 3.29693380378e-05 +ACCGAC 0.000175665026313 4.6268563768e-05 +AAATCC 0.000313339005269 0.000276337205293 +ACCGAA 0.00011153335004 5.75768874428e-05 +AAATCA 0.000283364417446 0.000381695742066 +GGCTTT 0.000500157366586 0.000394994967796 +CTTTGA 1.04562515663e-05 0.000431627565616 +AGATAC 0.000184727111004 0.000191763685978 +TCCCGA 0.000146387521928 8.99091368229e-05 +CACGCT 9.13179303453e-05 8.08306234502e-05 +AAATCT 0.000323795256835 0.000374767402913 +ACCGAT 9.7940223004e-05 3.59158730798e-05 +GTAGTT 0.000109442099727 0.000169784127286 +ACCAGT 0.000327977757462 0.000229033372456 +GATGAT 0.000905511385638 0.000230387185854 +GGAGCA 0.000351330052626 0.000363299807074 +GGAGCC 0.000534662996755 0.000422628688325 +CCGGCT 0.000116412934104 0.0001271788233 +CCAAAT 0.00026663441494 0.00028915861453 +GGAGCG 0.000112927516916 0.000145654394375 +AAAACT 0.000349238802313 0.000444687883099 +GATGAC 0.00110905974946 0.000215097058068 +TGTCCC 0.000217490032578 0.000369033604993 +GATGAA 0.00125440164623 0.000315199613415 +GATGAG 0.00134850791033 0.000273470306333 +AAAACC 0.000376076514666 0.000368396516336 +AAAACA 0.000413370478586 0.000698886257536 +AAAACG 0.000107699391132 9.28556718649e-05 +GGAGCT 0.000413719020305 0.000415700349172 +CCAAAG 0.00048029048861 0.00038615536267 +TCGCGG 3.20658381365e-05 4.18089431639e-05 +CTAGAG 0.000415810270618 0.000265506698111 +TCGCGC 4.32191731405e-05 4.22867596572e-05 +CTACCG 4.39162565783e-05 4.41980256304e-05 +GCCACA 0.00054860466551 0.000330171196871 +AGATCA 0.000115715850667 0.000248066396106 +GCCACC 0.000798857619662 0.000357247464825 +AGAAAT 0.000326583590586 0.000543675533295 +TCCCGG 0.000237705452273 0.000138088966564 +GCGCTT 6.55258431486e-05 7.30262873929e-05 +GCCACG 0.000251995662747 0.000106632714088 +AGATCG 3.20658381365e-05 5.13652730299e-05 +ACCAGC 0.00061064509147 0.000309386179413 +TCGCGT 1.15018767229e-05 2.07850174586e-05 +GTGCAA 0.000211564823357 0.000184038986003 +TCCCAT 0.000228643367582 0.000300944754698 +ACCCGT 7.73762615903e-05 5.6541618374e-05 +AGAAAG 0.000402565685301 0.000662811112291 +CTAGAC 0.000236659827116 0.000159192528352 +AGAAAC 0.00030985358808 0.000476621952068 +ATGTCC 0.000358649428723 0.000240341696131 +AGAAAA 0.000381653182168 0.000860467868354 +CTACCC 0.000150570022554 0.000194152768445 +ATGTAC 0.000345056301687 0.00020187746842 +GACCGA 0.000218535657735 5.87714286761e-05 +ATGTAA 1.49872939116e-05 0.000349124584439 +TATGTG 0.000493535073927 0.000348487495781 +ATGTAG 9.75916812851e-06 0.000250694386819 +CCTATA 6.86627186184e-05 0.000140637321195 +CGAAGT 8.60898045622e-05 5.22412699343e-05 +CCGGCA 9.65460561285e-05 8.33789780811e-05 +GACGAC 0.00035934651216 4.96929153034e-05 +CCTATC 0.000168345650217 0.000131399535658 +ATGTAT 0.000238402535711 0.000394357879138 +ATTAGA 8.85295965943e-05 0.000193117499376 +GGCGTC 0.000148130230522 7.65302750105e-05 +GACCGG 0.000337388383871 7.48579172839e-05 +AGCACT 0.000358300887004 0.000356052923592 +TTAGAA 0.000339828175903 0.000355415834934 +CGGCTG 0.000498763199711 0.000164368873696 +TTAGAC 0.000165905858185 0.000148282385088 +CGGCTC 0.000230037534458 0.000129249361438 +TTAGAG 0.000258617955405 0.00024822566827 +CGGCTA 9.75916812851e-05 4.16496709995e-05 +AGCACC 0.00057335112755 0.000276655749622 +AGCACA 0.000434282981719 0.000378351026613 +AGCACG 0.000163814607871 8.64051492054e-05 +GGTCGG 9.06208469076e-05 6.00456059916e-05 +CGGCTT 0.000121989601606 9.36520326871e-05 +TTAGAT 0.000202154196948 0.000207133449846 +AAAGAC 0.000714859065413 0.000357008556578 +CGAAGC 0.000155798148337 8.05917152035e-05 +AAAGAA 0.00114356537963 0.000834028689058 +AAAGAG 0.000949776183935 0.000477179404644 +ATATCA 9.20150137831e-05 0.000207372358093 +GCGCTG 0.000425220897028 0.000140159504702 +TCGCTA 2.30037534458e-05 3.28100658734e-05 +TGTGAG 0.000616221758972 0.000465711808805 +TGTGAA 0.000474365279389 0.000486337554099 +CTACCT 0.000157192315213 0.000269169957893 +TGTGAC 0.000522115494875 0.000364653620471 +ATATCT 0.000117110017542 0.000244960588899 +CCAGCT 0.000538148413943 0.000500592412816 +AAAGAT 0.000739605527453 0.000417372706899 +TGTGAT 0.000362831929349 0.000371263415295 +TTATTG 8.01645953413e-05 0.000283504452692 +TTATTA 7.59820947148e-05 0.000375165583324 +GAAAGC 0.000428357772498 0.000348726404028 +TTATTC 8.05131370602e-05 0.000261047077507 +ACATCT 0.000293123585574 0.000329534108214 +TTTTAT 0.000213307531952 0.000766497291338 +CTTACT 0.000128263352546 0.000250455478572 +AGACGC 7.31937609638e-05 7.79637244904e-05 +TACAAA 0.00037816776498 0.000348168951452 +AGACGA 6.93598020562e-05 6.61775843223e-05 +AAGTGA 4.1825006265e-05 0.00035597328751 +CCTCTG 0.000636088636947 0.000650865699959 +AGGTGG 0.000134537103486 0.000369670693651 +CCTCTC 0.000287895459791 0.000476144135575 +AGGTGC 0.000107350849414 0.000235882075527 +CCTCTA 0.000139068145831 0.000227679559058 +AGGTGA 1.25475018795e-05 0.00030819163818 +CTTACG 3.72939639197e-05 3.83049555463e-05 +TCCACA 0.000374682347791 0.000355734379263 +TTTTAG 8.01645953413e-06 0.000365449981293 +AGACGT 4.80987572048e-05 7.76451801615e-05 +CTTACC 0.000150221480835 0.000176234649946 +ACATCA 0.00021992982461 0.000295529501107 +CTTACA 0.000138719604112 0.000256985637314 +ACATCC 0.000240842327743 0.000237952613664 +AGGTGT 8.46956376867e-05 0.000295927681518 +CCTCTT 0.000258966497124 0.000444608247017 +GCGTGA 3.83395890763e-06 6.37885018558e-05 +CCCGGC 0.000201805655229 0.000167633953067 +CCCGGA 0.000124429393638 0.000130762447 +CCCGGG 0.000196577529446 0.00020402764264 +TATGAA 0.000617615925847 0.000322287224732 +TGGAAT 0.000252692746185 0.00036067181636 +TAGGTG 0.0 0.00018141099529 +TTGTGC 0.000100031473317 0.000262321254823 +TATGAT 0.000408839436241 0.000204824003462 +TTGTGG 0.000119898351293 0.000357964189565 +CCCGGT 8.05131370602e-05 7.46190090373e-05 +GGCGTG 0.000260360664 0.000115950135708 +TAGGTA 0.0 0.000134584978947 +GGTTTT 0.000177059193189 0.000458783469652 +TATCAC 0.000133491478329 0.000140000232537 +TGGAAA 0.000330069007775 0.000577839412566 +TGAGGA 0.0 0.000473914325273 +AAGAGG 0.000564637584578 0.000428840302738 +TGAGGC 0.0 0.000330728649447 +AAGAGA 0.000507476742682 0.000575529966182 +AAGAGC 0.000622495509911 0.000359556911209 +AAGCGT 0.000135582728642 5.62230740452e-05 +GCTTAG 8.71354297188e-06 0.000186905884963 +GCTTAC 0.000173225234281 0.000149397290239 +GCTTAA 9.41062640963e-06 0.000168032133478 +TGATTC 0.0 0.000238589702322 +AAGCGC 0.000327280674024 6.61775843223e-05 +AAGAGT 0.000390018183421 0.000319659234019 +AAGCGA 0.000190652320225 6.46644987601e-05 +AAGCGG 0.000352027136064 7.66895471749e-05 +GCTTAT 0.000167648566779 0.000167952497396 +GTTCGG 0.000105956682538 4.80205575768e-05 +CTGCTA 0.000315081713863 0.00025252601671 +GCGTGT 4.87958406425e-05 9.65985677291e-05 +CTGCTC 0.000883901799068 0.000501866590131 +ACTTCT 0.000252344204466 0.000380341928668 +GACCGT 0.000171133983968 5.43118080719e-05 +CTGCTG 0.00200934300932 0.000750490438812 +CGGTCA 8.08616787791e-05 5.15245451944e-05 +GGTCGT 7.07539689317e-05 3.93402246152e-05 +CGGTCC 0.000125823560514 7.29466513107e-05 +CTAGAA 0.00037189401404 0.000285813899077 +CGGTCG 2.16095865703e-05 2.96246225847e-05 +ACTTCG 4.87958406425e-05 5.63823462096e-05 +GACCGC 0.000278484833381 5.8373248265e-05 +TTTTGG 0.000127914810827 0.000423902865641 +ACTTCC 0.000243979203213 0.000333914092736 +CTGCTT 0.000451361525944 0.000539614093102 +ACTTCA 0.000227597742426 0.000345381688575 +CTAGAT 0.000230734617895 0.000164607781942 +CACAAA 0.000336342758715 0.000363857259649 +CGGTCT 8.60898045622e-05 6.33903214447e-05 +GGTCGC 0.000103168348787 5.40728998253e-05 +GGTCGA 6.44802179919e-05 2.99431669136e-05 +CGTCGC 7.17995940883e-05 3.81456833819e-05 +CAGCAT 0.000426963605622 0.000373493225597 +TGAAGC 6.97083437751e-07 0.000348487495781 +CGTCGG 7.59820947148e-05 3.05006194891e-05 +TGGTTG 0.000115367308948 0.000304289470151 +GCGTGC 6.41316762731e-05 9.45280295915e-05 +TGCTCA 0.000159632107245 0.000371741231789 +TTCATC 0.000713116356819 0.000291547696996 +TGCTCC 0.000317521505895 0.000365449981293 +TTCATA 0.000155449606618 0.000303015292835 +TTCATG 0.000525600912064 0.000351991483399 +TGCTCG 5.92520922088e-05 8.5529152301e-05 +GTACAA 0.000121641059887 0.000164767054107 +CAGCAG 0.00192116195444 0.000667270732896 +TACACT 0.000201108571791 0.000212946883848 +GCTTTG 0.000355164011534 0.000433061015096 +CAGCAC 0.000591475296931 0.000381616105984 +CAGCAA 0.00057648800302 0.000392765157494 +GGGAGT 0.000163117524434 0.000241615873446 +GTACAC 9.68945978473e-05 0.000145096941799 +TGATTT 0.0 0.000460057646967 +TTCATT 0.000413719020305 0.000499158963336 +GTAGCC 0.000237008368835 0.000179818273646 +GCTGCC 0.000939668474088 0.000472241967546 +GCTGCA 0.000590081130056 0.000392924429658 +AACTCT 0.000315778797301 0.000332162098927 +GCTGCG 0.00022306670008 0.000168350677807 +TGGCCA 0.000172528150843 0.000381058653408 +GTAGCA 0.000176362109751 0.000182446264359 +TCATCT 0.000276393583068 0.000373971042091 +TGCTCT 0.000231431701333 0.000511661828244 +AACTCA 0.000276045041349 0.000359875455538 +TGGCCT 0.000156843773494 0.000475268138671 +AACTCC 0.000368408596851 0.000243049322926 +GCTGCT 0.000837894292176 0.000564380914671 +AACTCG 0.000103865432225 6.14790554715e-05 +CTACAA 0.00016102627412 0.000224334843605 +GGATCC 0.000210519198201 0.00021445996941 +TGAAGA 0.0 0.000586917925939 +AATATT 0.000274650874474 0.000466428533545 +GTTCGA 0.00011780710098 3.83845916286e-05 +CAACCT 0.000168345650217 0.000244880952817 +TGGCCG 4.77502154859e-05 0.000104801084197 +GGCACG 0.000135582728642 6.64164925689e-05 +GGAGGA 0.000485170072674 0.000552196594092 +GGCACA 0.000349587344032 0.000272435037264 +GACAAT 0.000443345066409 0.00018499461899 +GGCACC 0.000540936747694 0.000209920712724 +CAACCG 4.98414657992e-05 5.07281843722e-05 +ACGACC 8.43470959678e-05 4.02958576018e-05 +AATATG 0.000237356910554 0.000280478281568 +CAACCC 0.000152312731149 0.00021015962097 +TTAGGA 0.00012408085192 0.00023994351572 +AATATC 0.00025722378853 0.000191922958143 +GACAAA 0.000650030305702 0.000297679675327 +GGCACT 0.000317870047614 0.00023635989202 +GACAAC 0.000674776767743 0.00018929496743 +ACGACA 5.47210498634e-05 5.20819977699e-05 +GACAAG 0.00103691161365 0.000280000465075 +TGGCCC 0.000166602941622 0.000311536353633 +GCAATC 0.000150221480835 0.000121524661463 +GCAATA 9.75916812851e-05 0.000161183430407 +GAATTT 0.000423478188434 0.000370068874062 +TTGAAC 0.000228991909301 0.000262799071316 +CGATGG 6.62229265863e-05 5.4709988483e-05 +GTTCCC 0.000206336697574 0.000262321254823 +CGATGC 8.26043873734e-05 5.78157956895e-05 +GTAAAT 0.000142902104739 0.000299113124807 +CGATGA 5.92520922088e-06 5.09670926188e-05 +GAATTA 0.000189606695068 0.000225131204427 +GAATTC 0.000360740679036 0.000251411111559 +GAATTG 0.00023875107743 0.000232935540485 +GTAAAC 0.000124777935357 0.00016667832008 +CGATGT 5.576667502e-05 5.15245451944e-05 +GTAAAA 0.000212261906795 0.000302537476342 +GTAAAG 0.000253041287903 0.000247190399201 +TCCCAG 0.000724618233542 0.000569796168262 +GGATTT 0.000270816915566 0.000327383933994 +GTGCGT 9.82887647228e-05 7.36633760507e-05 +ACGCCG 6.23889676787e-05 3.92605885329e-05 +GGATTC 0.000221672533205 0.000221866125056 +GGATTA 9.61975144096e-05 0.000170660124191 +GGATTG 0.000150570022554 0.000188976423101 +AGCGGC 0.000285804209478 0.000138248238729 +ACGCCA 0.000108745016289 6.5699767829e-05 +AAAGCC 0.000732634693076 0.000368953968911 +TCTGTG 0.000767140323245 0.000664244561771 +CTATCC 8.53927211245e-05 0.000152264189199 +GTCCCG 0.000101774181912 9.42094852626e-05 +TACAAT 0.000277439208225 0.000196382578747 +AACCGG 0.000214353157108 5.49488967297e-05 +CTCCTT 0.00029765462792 0.000462128185105 +GGCGGA 0.000102819807068 0.000112844328501 +AACCGC 0.000216444407422 5.18430895232e-05 +AACCGA 0.000176362109751 5.81343400184e-05 +GTGGGA 0.000391412350297 0.000361707085429 +TACCCA 0.000298351711357 0.000231024274511 +TCTGTT 0.000273953791036 0.000506724391146 +AAAGCG 0.000120246893012 7.12742935842e-05 +CTCCTG 0.000975219729413 0.000633743942282 +AACCGT 0.000119898351293 5.37543554964e-05 +CTCCTA 0.00016102627412 0.000239704607473 +CTCCTC 0.000491095281895 0.000541366086911 +GGCGGT 0.000129308977703 8.45735193144e-05 +AACAAG 0.000843819501397 0.000312253078373 +CCCACG 0.000216095865703 0.000123435927436 +AACAAC 0.000624586760225 0.000256428184739 +AACAAA 0.000583110295678 0.000641468642257 +TACTTC 0.000473319654233 0.000230466821936 +AGCCTT 0.000321006923084 0.000422549052243 +CCGATT 3.52027136064e-05 3.71104143131e-05 +CCCACT 0.000315430255582 0.000329852652543 +AACAAT 0.000367362971695 0.000263515796056 +GACGCT 0.000172528150843 7.31855595574e-05 +AGCGGT 9.2363555502e-05 6.64961286511e-05 +CCGATA 2.33522951646e-05 2.38111885829e-05 +AGCCTG 0.000903768677044 0.000548453698228 +AGCCTA 0.000159632107245 0.000209522532313 +AGCCTC 0.000506779659245 0.000409727643006 +GTACCC 0.000154752523181 0.000130284630507 +CTCCCG 0.000125823560514 0.000164767054107 +TAGGCT 0.0 0.000196541850911 +ACGAAT 4.25220897028e-05 4.18089431639e-05 +CGCCTT 0.000128263352546 9.47669378381e-05 +AGGCAT 0.000146736063647 0.000271877584689 +CAGAGT 0.000510265076433 0.0003958709647 +GCATCT 0.000283364417446 0.000307395277357 +CTCCCA 0.000295563377606 0.000456155478939 +ACGAAA 7.80733450281e-05 5.78954317717e-05 +CGCCTC 0.000270468373847 0.000139761324291 +AGGCAA 0.000152312731149 0.000294016415545 +CGCCTA 8.81810548755e-05 4.34813008904e-05 +AGGCAG 0.000465303194699 0.000579750678539 +CGCCTG 0.000558363833638 0.000144937669635 +ACGAAG 0.000128611894265 7.2309562653e-05 +CAGAGG 0.00062911780257 0.000590581185721 +GCATCC 0.000273605249317 0.000237235888924 +GCATCA 0.000189258153349 0.000228794464209 +CAGAGC 0.000768185948401 0.000517475262246 +CGGCCA 0.000194137737414 0.000107269802746 +CAGAGA 0.000590081130056 0.000631195587651 +CGGCAC 0.000164860233028 6.58590399934e-05 +CCTAGA 9.96829315983e-05 0.000233652265224 +CCTAGC 0.000173225234281 0.00019542694576 +TTTGCT 0.000530131954409 0.000507759660215 +TAGCTC 0.0 0.000198214208638 +TGCGGT 4.91443823614e-05 7.0477932762e-05 +CCTAGG 9.06208469076e-05 0.000219238134343 +TAAGCA 0.0 0.000246394038379 +GTCTAG 8.36500125301e-06 0.000150193651061 +TGCGGC 0.00013314293661 9.99432831822e-05 +TGCGGA 5.61152167389e-05 7.89989935592e-05 +CCTAGT 0.000135931270361 0.000166519047916 +TGCGGG 0.000117458559261 0.000101774913073 +TAAGCG 0.0 3.34471545311e-05 +TGAGTT 0.0 0.000395791328618 +TAGCTG 0.0 0.000272833217675 +ATCGCT 0.000166951483341 5.63823462096e-05 +TCTCGT 6.55258431486e-05 6.73721255555e-05 +ATCGCC 0.000258617955405 5.7258343114e-05 +TGAGTG 0.0 0.000364733256554 +ATCGCA 0.00012408085192 4.06144019306e-05 +TGAGTA 0.0 0.000209203987984 +ATCGCG 6.69200100241e-05 1.76792102522e-05 +TGAGTC 0.0 0.000256030004327 +AAGGTG 0.000860200962184 0.000328578475227 +ACGGCT 0.000132445853173 7.48579172839e-05 +CATCAT 0.000147781688803 0.000275620480553 +AAGGTA 0.000197274612883 0.000192639682883 +TTTATT 0.000233871493365 0.000820649827245 +ACGGCA 0.000106653765976 5.98066977449e-05 +CATCAC 0.000184030027566 0.000253879830108 +ACGGCC 0.000219581282891 6.87259389532e-05 +CATCAA 0.000167997108498 0.00024894239301 +CATCAG 0.000407445269365 0.000333515912324 +ACGGCG 8.08616787791e-05 4.06940380129e-05 +TCACCT 0.000278136291662 0.000333515912324 +TCTAAG 0.000270468373847 0.000247110763119 +TCGTTT 5.68123001767e-05 9.18204027961e-05 +CGGAAT 0.000132794394891 5.01707317967e-05 +CTCATG 0.000559409458795 0.000281672822801 +TCACCG 7.63306364337e-05 7.74062719149e-05 +TCACCA 0.000297306086201 0.000314005072181 +TCACCC 0.000235265660241 0.000260728533178 +CGGAAG 0.000439859649221 0.000122559930532 +AATATA 0.000142902104739 0.000359556911209 +CGGCCT 0.0001920464871 0.00011387959757 +CGGAAC 0.00020145711351 6.19568719648e-05 +CGGAAA 0.000248858787277 7.30262873929e-05 +TAGCTT 0.0 0.000237395161089 +ATGGCG 0.000298003169638 7.22299265708e-05 +TGTGTA 0.000125823560514 0.000455040573788 +ATGGCC 0.000666760308208 0.000238191521911 +ATGGCA 0.000452755692819 0.000280637553732 +TCCAAT 0.000276742124787 0.000179181184988 +ATGGCT 0.00058276175396 0.000363060898827 +TGTGTT 0.000174967942875 0.000579671042457 +TTGTCG 3.69454222008e-05 4.71445606724e-05 +GAACAT 0.000301488586827 0.000276815021786 +AGATTA 7.77248033092e-05 0.000209761440559 +AGATTC 0.000138719604112 0.000247668215695 +GAAACA 0.000430100481092 0.000419522881119 +AGATTG 0.000101425640193 0.000229829733278 +CTGAGT 0.000415810270618 0.000428601394492 +GAAACT 0.000370151305446 0.000352708208139 +AGAATG 0.000212610448514 0.000389818622452 +AGAATA 0.000132097311454 0.000328737747391 +AGAATC 0.000204942530699 0.000261923074411 +CTGAGC 0.000767837406682 0.000484505924208 +CTGAGA 0.00039036672514 0.000537782463211 +CTGAGG 0.00056707737661 0.000535871197238 +CATACC 0.000105608140819 0.000147884204677 +CATACA 0.000164511691309 0.000276416841375 +CATACG 4.14764645462e-05 3.63140534909e-05 +TCAAAT 0.000205639614136 0.000322765041225 +GTCCAT 0.000201108571791 0.000196382578747 +ACATAG 7.31937609638e-06 0.000219715950837 +CATACT 0.000185772736161 0.000198930933378 +GTCCAG 0.00056394050114 0.000297361130998 +TCAAAG 0.000295911919325 0.000372537592611 +CACGAG 0.000286501292916 8.01935347924e-05 +GTCCAC 0.00028510712604 0.000184835346825 +GCAATG 0.00023247732649 0.000200682927187 +CGGCGG 0.000197274612883 0.000208646535408 +TTGATG 0.000246070453526 0.000293936779463 +CTCATT 0.00044613340016 0.000316234882483 +CGGCGC 0.00017984752694 0.00011817994601 +TTGATC 0.000180544610377 0.000183481533428 +CGGCGA 6.76170934618e-05 5.62230740452e-05 +TCCAAG 0.000728103650731 0.000339408982409 +CTATCT 8.92266800321e-05 0.000220671583823 +TTGATT 0.000154403981462 0.000342036973122 +CGGCGT 7.17995940883e-05 4.55518390281e-05 +TATAAG 0.000240145244305 0.00019471022102 +TGACTT 0.0 0.000398817499742 +TCACAG 0.000346450468562 0.000441263531564 +CGGTTA 4.28706314217e-05 3.49602400932e-05 +GGTTTA 8.64383462811e-05 0.000186746612799 +CGGTTC 0.000133491478329 6.54608595823e-05 +GCTGTT 0.000351678594345 0.000378510298777 +TTTACA 0.000164860233028 0.000386951723492 +CGGTTG 7.91189701847e-05 6.06030585671e-05 +GGTTTG 0.000174967942875 0.000313766163935 +TATAAA 0.000256178163373 0.000457668564501 +CGTACG 1.32445853173e-05 1.17861401681e-05 +GCTGTG 0.00113101787775 0.000568044174453 +GCTGTC 0.000510265076433 0.000378112118366 +CGGTTT 9.65460561285e-05 7.08761131731e-05 +GCTGTA 0.000214004615389 0.000252207472381 +GGGAGG 0.00018890961163 0.000517236353999 +TCATAG 6.27375093976e-06 0.000199249477707 +TATGCG 7.07539689317e-05 2.83504452692e-05 +TCTCAA 0.000196228987727 0.000328737747391 +AGGTTG 0.000119898351293 0.000245836585804 +GCATTT 0.000258269413687 0.000364573984389 +AGGTTC 0.000189606695068 0.000229511188949 +AGGTTA 7.04054272128e-05 0.000175358653042 +ACTCCT 0.000310899213237 0.000306360008289 +TTTTTC 0.000243630661494 0.000703823694633 +GAGGGC 0.000701614480096 0.000288760434119 +TTTTTA 0.000138719604112 0.000915496401166 +TCCTCT 0.0004524071511 0.000530296671483 +TTTTGT 0.000147781688803 0.000894472475461 +GAGGGG 0.000415461728899 0.000357725281318 +TTAAAT 0.000203548363823 0.000510626559175 +AGGTTT 0.000201108571791 0.000337975532929 +ACATAT 0.000133491478329 0.000285336082583 +TTAAAC 0.000127217727389 0.000272514673346 +TTAAAA 0.000255829621654 0.00085672497249 +ACTCCG 8.99237634698e-05 6.92833915287e-05 +TTAAAG 0.000272908165879 0.000458385289241 +ACTCCA 0.00035934651216 0.000314005072181 +TTTTTT 0.000222369616642 0.00215280221057 +ACTCCC 0.000231083159614 0.000240978784788 +CTGTAA 1.60329190683e-05 0.000369591057569 +GTCACG 0.000122686685044 6.50626791712e-05 +CTGTAC 0.000453801317976 0.000246871854872 +GCAACT 0.000191349403663 0.000180216454057 +GCAATT 0.000164511691309 0.000146769299526 +CTGTAG 1.91697945381e-05 0.000314562524757 +GTCACA 0.000379213390136 0.000277133566115 +GCAACG 6.06462590843e-05 4.70649245902e-05 +GTCACT 0.000367362971695 0.000285495354748 +TAGGCG 0.0 3.68715060664e-05 +GCAACC 0.000169042733655 0.000157201626296 +CTGTAT 0.000340176717622 0.000337338444271 +GCAACA 0.000214353157108 0.000205700000366 +TAGGCC 0.0 0.000130284630507 +TGGTTC 0.00023247732649 0.000282309911459 +ATTCAT 0.000251298579309 0.000313925436099 +TCCCAC 0.00029765462792 0.000329613744296 +GCGATT 5.33268829879e-05 4.01365854373e-05 +TCGTGT 3.86881307952e-05 7.84415409837e-05 +TGAATT 0.0 0.000373811769926 +GTCTCT 0.000287198376353 0.000399295316236 +TCCGTG 0.000239099619148 0.00012104684497 +ATTCAG 0.000488655489863 0.000303493109329 +ATTCAA 0.000214353157108 0.000264789973371 +ATTCAC 0.000254783996498 0.000202673829242 +GTCTCC 0.00041511318718 0.000341718428793 +GTCTCA 0.000178104818345 0.000304528378398 +GCGATG 8.92266800321e-05 5.22412699343e-05 +GTCTCG 6.37831345542e-05 6.37885018558e-05 +GCGATA 2.75347957911e-05 2.26962834318e-05 +TCGTGC 3.76425056385e-05 5.9488153416e-05 +GCGATC 5.50695915823e-05 3.91013163685e-05 +CGATTG 5.05385492369e-05 3.71104143131e-05 +TCTACA 0.000223415241799 0.000290114247516 +GAAGGA 0.000630511969445 0.000527111228194 +CGATTC 8.6786888e-05 4.19682153283e-05 +CGATTA 3.17172964177e-05 2.55631823916e-05 +CAATCT 9.09693886265e-05 0.000177986643755 +GGAACA 0.000264891706345 0.000312093806208 +GGAACG 7.52850112771e-05 7.85211770659e-05 +TGACGA 3.48541718875e-07 5.92492451694e-05 +TACTGC 0.000303231295422 0.000198054936474 +CGATTT 8.46956376867e-05 5.22412699343e-05 +GAAGGT 0.000414067562024 0.000288282617625 +CTCGCT 9.75916812851e-05 0.00011961339549 +CAATCG 1.9518336257e-05 3.06598916535e-05 +CAATCA 9.06208469076e-05 0.000185153891154 +CAATCC 8.19073039357e-05 0.000147724932512 +TCCTGA 3.20658381365e-05 0.000486337554099 +AGTCCA 0.000217838574297 0.000253402013614 +TCCTGC 0.000360392137317 0.000499158963336 +AGTCCC 0.000257572330249 0.00026009144452 +ACTAAA 0.000180544610377 0.000254357646601 +TCCTGG 0.000400474434988 0.000588829191912 +ACTAAC 0.000127217727389 0.000137451877906 +TAACGC 0.0 2.65984514605e-05 +CAGCTG 0.00164232857934 0.000601809873313 +CAGCTA 0.000321006923084 0.000264232520796 +CAGCTC 0.000807222620915 0.000472401239711 +ACTAAT 0.000119549809574 0.00017097866852 +AGTCCT 0.000290335251823 0.000334153000982 +TCCTGT 0.000280924625414 0.000518191986986 +TAATGT 0.0 0.000305563647466 +CAGCTT 0.000471925487357 0.000434016648082 +GGTTAG 3.48541718875e-06 0.000136655517084 +TAACGT 0.0 4.70649245902e-05 +ACGGAC 0.000180893152096 5.78954317717e-05 +GTACTT 8.81810548755e-05 0.000207213085928 +CGACAT 6.72685517429e-05 3.90216802863e-05 +TTGTTC 0.0001551010649 0.000342992606108 +CCGAGG 8.92266800321e-05 0.00016022779742 +CCGAGA 5.78579253333e-05 0.000112923964584 +ACGGAA 0.000153009814586 7.31059234751e-05 +CCGAGC 0.00011780710098 0.000126223190314 +CCGCGT 1.81241693815e-05 4.67463802613e-05 +CGACAC 9.68945978473e-05 4.75427410835e-05 +CGACAA 7.70277198714e-05 3.98180411085e-05 +CGACAG 0.000194486279132 7.01593884331e-05 +GTACTA 4.94929240803e-05 0.00010129709658 +CCGCGC 7.66791781526e-05 0.000124789740834 +ACGGAG 0.000323446715116 0.000105517808937 +CCGCGA 2.5095003759e-05 4.09329462595e-05 +TACGCA 8.19073039357e-05 3.27304297912e-05 +CCGCGG 7.52850112771e-05 0.000134664615029 +TTGTTT 0.000200062946634 0.000978090361788 +GCATAT 0.000138371062393 0.000178862640659 +TCCGTT 5.85550087711e-05 6.753139772e-05 +AGGAAC 0.00034087380106 0.0003269061175 +AATAAC 0.000255829621654 0.000208805807573 +AATAAA 0.000370848388883 0.000961764964934 +AATAAG 0.000321355464803 0.00024066024046 +TACTAA 8.71354297188e-06 0.000176234649946 +TGGAAG 0.000488306948144 0.00053236720962 +AATAAT 0.000241887952899 0.000382651375052 +ACGGTG 0.000269074206972 8.13084399435e-05 +CCAACC 0.000227249200707 0.000246712582708 +CCAACA 0.000256526705092 0.000274027758908 +TTATGC 4.56589651727e-05 0.000155210724241 +CCAACG 6.37831345542e-05 5.42321719897e-05 +GGGATT 0.000211216281638 0.000251490747641 +CGCCGC 0.000212261906795 0.000178145915919 +AGTAAA 0.000242236494618 0.000315677429908 +CGCCGA 7.59820947148e-05 4.17293070817e-05 +AGTAAC 0.000198668779759 0.00016237797164 +CGCCGG 0.000170088358811 9.89080141134e-05 +GAGTAA 1.08047932851e-05 0.000164448509778 +AGTAAG 0.000206336697574 0.000200045838529 +CTCAGG 0.000307762337767 0.000470330701573 +CTCAGC 0.000661880724144 0.000483948471632 +CCAACT 0.000230734617895 0.000243049322926 +GAGTAT 0.000369454222008 0.000157042354132 +GCTTCA 0.000280576083695 0.000316234882483 +GTGTAG 1.49872939116e-05 0.000211513434368 +TCGAGC 5.576667502e-05 5.2878358592e-05 +AGTAAT 0.000164860233028 0.000202196012749 +GTGTAC 0.000341919426217 0.00017997754581 +CGCCGT 6.72685517429e-05 4.4436933877e-05 +GTGGCA 0.000493883615646 0.00030460801448 +CATATT 0.000134537103486 0.000275620480553 +CTCGGA 7.84218867469e-05 0.000100261827511 +CTCGGC 0.000127217727389 0.000133231165549 +GCCGCC 0.000401520060144 0.000231502091005 +GCCGCA 0.000149524397398 9.75542007157e-05 +GCCGCG 0.000173225234281 0.000120569028476 +TATTGA 5.22812578313e-06 0.000238350794075 +ACACTT 0.000171482525687 0.00030604146396 +CATATG 0.000133840020048 0.00021517669415 +TCGCTC 9.65460561285e-05 8.48920636432e-05 +CATATC 0.000148130230522 0.000147087843855 +CATATA 7.07539689317e-05 0.000240899148706 +GTCAGC 0.000444042149847 0.000264471429042 +TACTAC 0.000366665888257 0.000117224313023 +ACACTC 0.000237008368835 0.000238669338404 +ACACTA 0.000123732310201 0.000187463337539 +ACACTG 0.000498066116273 0.000421673055339 +GCCGCT 0.000197623154602 0.000130921719165 +ACCGGA 9.68945978473e-05 6.80888502955e-05 +AAATAA 2.37008368835e-05 0.000793414287127 +ACCGGC 0.000159632107245 7.00797523509e-05 +AAATAC 0.000344359218249 0.000330649013365 +CTTTAA 8.71354297188e-06 0.000435211189316 +ACCGGG 0.000109093558008 7.93971739703e-05 +AAATAG 1.3941668755e-05 0.00030747491344 +AACTTA 0.000156843773494 0.000227201742565 +CAGGTA 0.000193440653976 0.000212946883848 +AACTTC 0.000575442377863 0.000293220054723 +CAGGTC 0.000430449022811 0.000262082346576 +CACGAC 0.000163117524434 4.79409214946e-05 +CACGAA 0.000130354602859 6.06826946493e-05 +CAGGTG 0.000859155337028 0.000374369222502 +CTTTAT 0.000193440653976 0.000362583082334 +AATCCC 0.000217490032578 0.000207133449846 +AATCCA 0.000286501292916 0.00025610964041 +AAATAT 0.00028510712604 0.000561354743547 +AATCCG 4.94929240803e-05 4.3322028726e-05 +CACGAT 9.20150137831e-05 4.78612854124e-05 +CAGGTT 0.00031612733902 0.000297042586669 +AACTTT 0.000385138599357 0.00040160476262 +TCTGTC 0.000366665888257 0.000465393264476 +GGGATA 9.61975144096e-05 0.000152742005692 +GGGATC 0.000273605249317 0.000178623732413 +GGGTGT 7.87704284658e-05 0.000263037979563 +GGAGAT 0.000517932994249 0.000289716067105 +GATGCT 0.000704402813847 0.000348168951452 +CGCAGT 0.000126869185671 6.84073946243e-05 +GAGTCG 0.000161374815839 6.8646302871e-05 +GAGCCT 0.000645499263357 0.000377475029708 +GGAGAC 0.000674079684305 0.000344266783424 +GGCGGC 0.000417204437494 0.000265904878522 +GGAGAA 0.000738908444016 0.000487133914921 +GGGTGC 8.01645953413e-05 0.000220034495165 +GGAGAG 0.000915270553767 0.000533959931265 +TGGAAC 0.000278484833381 0.000308350910344 +GGGTGG 9.44548058152e-05 0.000392446613165 +GAGCCA 0.000646544888514 0.000416735618241 +CGCAGG 0.000213656073671 0.000110534882117 +GATGCG 0.000147433147084 5.04096400433e-05 +CGCAGA 0.000121292518169 9.65189316469e-05 +GATGCA 0.000493535073927 0.000235404259033 +CGCAGC 0.000308807962924 0.000153618002596 +GATGCC 0.000778990741686 0.000241695509528 +CGGATT 0.000123035226763 4.84983740701e-05 +GGTAGT 8.81810548755e-05 0.000121285753216 +ACCCCT 0.000324840881992 0.000262560163069 +GCCAAT 0.000434631523438 0.000142468951086 +GGCGGG 0.000181241693815 0.000211991250861 +AGAAGT 0.000193092112257 0.000395313512125 +ACCCCA 0.000436025690313 0.000342275881368 +GGTAGA 7.17995940883e-05 0.000200284746776 +ACCCCC 0.000246767536964 0.000253481649696 +CGGATG 0.000172179609124 7.00001162687e-05 +GCCAAG 0.0012889072764 0.000332719551502 +CGGATA 7.07539689317e-05 3.06598916535e-05 +ACCCCG 0.000152661272867 9.64392955647e-05 +CGGATC 0.000202154196948 5.27987225098e-05 +AGAAGA 0.000315430255582 0.000709955672964 +AGAAGC 0.000249904412434 0.000474631050013 +GCAAGA 0.000188561069912 0.000289795703187 +AGAAGG 0.000205639614136 0.000499238599418 +CACTCC 0.000260360664 0.000269249593975 +CACTCA 0.000208079406169 0.000307793457768 +CACTCG 0.000103516890506 7.62117306816e-05 +TGCGTT 3.03231295422e-05 6.42663183491e-05 +TCAGCT 0.000376773598104 0.000417372706899 +AGCTTT 0.000327280674024 0.000425973403778 +CCCCGG 0.000261057747438 0.000164767054107 +TGCGTA 2.26552117269e-05 3.7428958642e-05 +CCCCGC 0.000162071899277 0.000195825126171 +CACTCT 0.000216444407422 0.000328180294816 +AGCTTC 0.000528389245815 0.00035597328751 +AGCTTA 0.000127566269108 0.000198214208638 +AGCTTG 0.000293123585574 0.000313367983524 +TTAGCT 0.000155449606618 0.000226325745661 +TTAGCC 0.000130354602859 0.000162139063394 +GCACTG 0.000523509661751 0.000350796942166 +TTAGCA 0.000163117524434 0.000236280255938 +GACCAT 0.000298003169638 0.000205142547791 +TTAGCG 2.75347957911e-05 3.47213318466e-05 +TACCGG 0.000189258153349 3.29693380378e-05 +TCATAT 8.60898045622e-05 0.000228157375551 +ATAGGT 9.55004309718e-05 0.000133390437713 +ATAAGG 8.26043873734e-05 0.000174641928302 +TGTGCT 0.00029451775245 0.000473595780944 +AAGGGC 0.00055174154098 0.000245119861064 +ATAAGC 9.30606389397e-05 0.000164687418025 +AAGGGA 0.000357255261847 0.000381775378148 +ATAAGA 0.000104911057381 0.000248544212599 +CCAGAC 0.000552438624417 0.000306280372206 +TCTGTA 0.000184030027566 0.000429318119231 +CCAGAA 0.000785264492626 0.000490398994292 +CCAGAG 0.00103307765475 0.000566212544562 +GCAAGT 0.000153706898024 0.000220114131248 +TGTGCG 6.51773014297e-05 0.00010201382132 +ATAAGT 9.06208469076e-05 0.000175756833453 +ATAGGG 8.46956376867e-05 0.000123515563518 +TGTGCC 0.000379910473574 0.000366166706033 +ATAGGA 0.000135582728642 0.000202992373571 +TGTGCA 0.000235962743679 0.00041633743783 +ATAGGC 0.000100031473317 0.000119215215079 +GCTCGC 0.000140810854426 0.000103049090389 +TAAGTT 0.0 0.000236678436349 +TTTGCG 7.45879278393e-05 5.52674410585e-05 +CCAGAT 0.000556969666763 0.000290512427927 +AGACAA 0.000182287318972 0.000365529617376 +GACGCA 0.000121641059887 5.40728998253e-05 +AGACAC 0.000197274612883 0.000347770771041 +TCCATT 0.000310202129799 0.000324278126787 +AGACAG 0.000349238802313 0.000511263647833 +GCTTTT 0.000292077960418 0.000447076965566 +TTTTCT 0.000296609002763 0.000963755866989 +CGCTGT 0.000196926071165 0.000114755594475 +GACGCC 0.00027569649963 7.70080915038e-05 +TCAAGA 0.000178104818345 0.000337418080353 +CGTGGG 0.000132445853173 0.000130364266589 +CTATAG 9.41062640963e-06 0.000157759078872 +AGACAT 0.000172179609124 0.000350159853508 +CGTGGA 0.000125126477076 0.000113242508912 +TTTTCG 3.13687546988e-05 6.50626791712e-05 +CCCACA 0.000439162565783 0.00038973898637 +CGCTGC 0.000259663580562 0.000169147038629 +TTTTCC 0.000261406289156 0.000556496942532 +TTTTCA 0.000211913365076 0.0005991818826 +CGCTGG 0.000254783996498 0.0001343460707 +TATGGA 0.000352375677783 0.000235483895115 +TATGGC 0.000392806517172 0.000156803445885 +CGTAGG 3.97337559518e-05 3.95791328618e-05 +CCCACC 0.000565334668016 0.000470808518066 +TATGGG 0.000289638168385 0.000170182307698 +CGTAGC 5.43725081445e-05 4.36405730549e-05 +TACCGT 9.96829315983e-05 3.92605885329e-05 +TGGACT 0.00018298440241 0.000337099536024 +CGTAGT 2.89289626667e-05 3.1217344229e-05 +GCTCGA 0.000146736063647 5.12856369477e-05 +TATGGT 0.000218187116016 0.00017926082107 +TGGACA 0.000220278366329 0.00035740673699 +TGGACC 0.000225157950393 0.000250216570326 +TGGACG 7.07539689317e-05 7.29466513107e-05 +CCGGTT 5.2978341269e-05 5.89307008405e-05 +GACCAA 0.000318218589333 0.000216450871466 +GCTTGA 9.06208469076e-06 0.00022449411577 +TGAGAC 3.48541718875e-07 0.000319659234019 +GCTTGC 0.000149524397398 0.000274266667155 +TGAGAA 0.0 0.000518032714821 +TGAGAG 0.0 0.000401445490456 +GCTTGG 0.000136628353799 0.000315438521661 +CCTGTT 0.000296609002763 0.000381377197737 +CCGGTG 0.000218884199454 9.91469223601e-05 +CCGGTC 0.000100728556755 6.16383276359e-05 +CCGGTA 3.76425056385e-05 3.14562524757e-05 +CCTGTC 0.000417901520931 0.000425017770792 +CCTGTA 0.000203199822104 0.000275301936224 +CCTGTG 0.000844516584835 0.000574255788866 +GCTTGT 0.000157192315213 0.000275063027977 +TGAGAT 3.48541718875e-07 0.000336303175202 +TCCGAA 9.37577223775e-05 5.38339915786e-05 +GGTTGT 7.80733450281e-05 0.000240978784788 +TCCTCA 0.00037189401404 0.00040805528528 +TATCAG 0.000269771290409 0.000202434920995 +TATTGC 8.15587622168e-05 0.000168271041724 +TAGCGT 0.0 3.52787844221e-05 +GGTTGG 8.92266800321e-05 0.000248623848681 +GGTTGA 3.83395890763e-06 0.00017782737159 +TTCACG 0.000169042733655 7.0477932762e-05 +GGTTGC 8.50441794056e-05 0.000169226674711 +GGAAAC 0.000363529012787 0.000338453349422 +TCCCGC 0.000170088358811 0.000119055942914 +GTAACG 2.99745878233e-05 3.29693380378e-05 +CAGCGT 0.000181590235534 0.000104960356362 +GTAACC 9.48033475341e-05 0.000125187921245 +CGTTTT 8.53927211245e-05 0.000110614518199 +ATTCTC 0.000272908165879 0.000292025513489 +ATTCTA 0.000127914810827 0.000248703484763 +ATTCTG 0.000411976311711 0.000400330585304 +TCATTT 0.000179498985221 0.000553311499243 +CAGCGA 0.000221672533205 0.000105358536773 +CAGCGC 0.000380259015293 0.000138327874811 +TGCTAG 6.62229265863e-06 0.000217804684863 +CAGCGG 0.000400125893269 0.000159749980927 +CCTTGT 0.000128263352546 0.000350319125672 +TCATTC 0.000144296271614 0.000265347425947 +CGTTTG 6.34345928353e-05 8.79182347675e-05 +CGTTTA 3.58997970442e-05 5.56656214696e-05 +ATTCTT 0.000247116078683 0.000394039334809 +CGTTTC 0.000101774181912 8.60069687943e-05 +TGGCAA 0.000125823560514 0.000283663724857 +CCGATC 5.71608418956e-05 4.02958576018e-05 +TGGCAG 0.000384441515919 0.000423902865641 +GCTGAG 0.00105677849163 0.000506644755064 +GCTGAA 0.00063539155351 0.000348487495781 +GCTGAC 0.000646544888514 0.000273072125922 +TGGCAT 0.000138371062393 0.000285415718665 +GCTGAT 0.000509916534715 0.000245438405393 +CCGATG 8.6786888e-05 5.68601627029e-05 +GGCCGC 0.000358997970442 0.000157281262378 +GAACTT 0.000382698807325 0.00030460801448 +GGCCGA 0.000190652320225 8.40957028211e-05 +GGCAAT 0.00029138087698 0.000145893302621 +CTGATT 0.00036875713857 0.000284698993926 +CCATCG 8.3998554249e-05 7.07168410086e-05 +CTAAAT 0.000177059193189 0.000239386063144 +CCATCC 0.000324492340273 0.000334391909229 +CCATCA 0.000272211082442 0.000304289470151 +CTGATC 0.000471576945638 0.000218441773521 +CTGATA 0.000172528150843 0.000209203987984 +GAGTTT 0.000554878416449 0.000331843554598 +CTGATG 0.000604719882249 0.000363697987485 +GGCAAA 0.000488655489863 0.000261047077507 +CTAAAG 0.000320309839646 0.000261923074411 +CCATCT 0.000307065254329 0.000419124700708 +CTAAAC 0.000130703144578 0.000167872861313 +CTAAAA 0.000190652320225 0.00030819163818 +GACACC 0.000582413212241 0.000223379210618 +GACACA 0.000528389245815 0.0003376569886 +GACACG 0.000249904412434 7.4539372955e-05 +GCGCCT 0.000111881891759 0.000101137824415 +TTCACC 0.000523509661751 0.000236758072431 +TAGCGA 0.0 3.47213318466e-05 +TACGAG 0.000262451914313 3.376569886e-05 +TACGAC 0.000196228987727 2.26962834318e-05 +GACACT 0.000452058609381 0.000276337205293 +GGCGAT 0.000129308977703 4.88965544812e-05 +TGTTAC 0.000122686685044 0.000229989005442 +ACGCTG 0.000318915672771 0.000102252729567 +ACGCTA 4.84472989237e-05 3.07395277357e-05 +ACGCTC 0.000118155642699 5.90103369227e-05 +TCGATG 5.43725081445e-05 4.77816493302e-05 +TCGAGG 5.19327161124e-05 7.8919357477e-05 +TCGATC 2.61406289156e-05 3.22526132979e-05 +ACGCTT 6.37831345542e-05 4.96132792211e-05 +TCTGGG 0.000440905274377 0.000500353504569 +GCATTG 0.000180196068659 0.000221945761139 +GAACTG 0.000732983234795 0.000343550058684 +TCGATT 3.24143798554e-05 3.87031359574e-05 +TCGGCA 7.84218867469e-05 5.9488153416e-05 +AGGCAC 0.000197274612883 0.000261126713589 +TTTTGA 1.15018767229e-05 0.000520103252959 +AACCAA 0.000300791503389 0.000337895896846 +TGCCGG 0.000185772736161 9.26963997005e-05 +AACCAC 0.000368060055132 0.000248305304352 +ACGAAC 6.48287597108e-05 3.69511421487e-05 +AACCAG 0.000755986988241 0.000311058537139 +TGCCGA 0.000115715850667 6.58590399934e-05 +TTGGAC 0.000411627769992 0.000206655633353 +TCTGGA 0.000513401951903 0.000492071352018 +GAGTTC 0.000670245725397 0.000299511305218 +TGCCGT 7.73762615903e-05 8.14677121079e-05 +AACCAT 0.00026349753947 0.000264949245536 +AACAGA 0.000362134845911 0.000408533101773 +ACGTCG 3.45056301687e-05 1.7997754581e-05 +AACAGC 0.00069115822853 0.000315836702072 +ACGTCC 0.000110836266602 5.70990709495e-05 +AACAGG 0.000282318792289 0.000291706969161 +ACGTCA 8.33014708112e-05 6.54608595823e-05 +CCCAAG 0.000846956376867 0.000376599032804 +GTCCCT 0.000307065254329 0.000320694503088 +GACGAA 0.000205988155855 4.84983740701e-05 +CCCAAC 0.00055174154098 0.000231900271416 +CCCAAA 0.000518978619405 0.000335108633969 +ACGTCT 8.92266800321e-05 6.94426636932e-05 +GGGAGA 0.000197274612883 0.000412196361555 +AACAGT 0.000376773598104 0.000310182540235 +GGGAGC 0.000341919426217 0.000356371467921 +CCCAAT 0.00032240108996 0.000159670344845 +GACGAT 0.000249904412434 4.11718545062e-05 +GGGCGC 0.000148130230522 0.000134983159358 +GGGCGA 7.52850112771e-05 7.67691832571e-05 +GGGCGG 0.00013000606114 0.000195745490089 +TCTCTT 0.000228294825863 0.000547975881735 +TGGGGG 0.000126172102233 0.000375961944146 +GTACAG 0.00029138087698 0.000220432675576 +TCATAC 9.65460561285e-05 0.000152821641774 +CAGAAT 0.000559060917076 0.000356291831839 +ACGACT 5.26297995502e-05 4.66667441791e-05 +TCTCTC 0.000280576083695 0.000725166164667 +TCTCTA 0.000141159396145 0.000308430546426 +TCTCTG 0.000566728834891 0.000691639374054 +GGGCGT 6.58743848674e-05 7.21502904885e-05 +CAGAAA 0.000884250340787 0.000602845142382 +CAGAAC 0.000770974282152 0.000350080217426 +ACGACG 2.99745878233e-05 2.41297329117e-05 +CAGAAG 0.00151580793539 0.000628965777349 +CACTTT 0.000277787749944 0.000372537592611 +CCTAAT 0.000141507937863 0.000154016183008 +GCATTC 0.000172528150843 0.000203072009653 +GTCATT 0.000391760892016 0.000259613628027 +TGCCCC 0.000225157950393 0.000306439644371 +CACTTG 0.000273605249317 0.000323879946376 +CCTAAC 0.000186818361317 0.000154493999501 +CCTAAA 0.000226552117269 0.000224573751852 +CACTTC 0.000418947146088 0.000294972048532 +CCTAAG 0.00027569649963 0.000222105033303 +CACTTA 0.000110139183165 0.000201320015844 +GTCCCA 0.000252692746185 0.000267895780578 +GTCCCC 0.000308110879486 0.000285415718665 +AAGATT 0.000481336113767 0.000326507937089 +ATCGAT 0.000171482525687 3.58362369976e-05 +GACTCG 0.000197623154602 7.43801007906e-05 +CTCATC 0.000853578669526 0.00026367506822 +GACTCC 0.000559758000514 0.000261604530083 +CTCATA 0.000146038980209 0.000193595315869 +GACTCA 0.000353769844658 0.000256428184739 +AAGATA 0.000245024828369 0.000286689895981 +AAGATC 0.000770277198714 0.000236519164184 +AAGATG 0.000845213668273 0.000456712931514 +GACTCT 0.000484472989237 0.000312332714455 +ATCGAG 0.000382698807325 4.87372823168e-05 +TTGAGA 0.000163814607871 0.000379306659599 +ATCGAA 0.000172179609124 4.06144019306e-05 +ATCGAC 0.000287546918072 3.07395277357e-05 +ATATTT 0.000211216281638 0.000636929385571 +ACGGTA 5.05385492369e-05 3.45620596821e-05 +GGACTC 0.000247116078683 0.000263993612549 +ATAGTT 0.000100031473317 0.000214778513739 +CTACCA 0.000123035226763 0.000211752342615 +TACTGT 0.000234917118522 0.000314642160839 +ATATTC 0.000139068145831 0.000234687534293 +ATATTA 8.08616787791e-05 0.000284698993926 +ATATTG 8.36500125301e-05 0.000243845683748 +ATAGTA 7.94675119036e-05 0.000161342702571 +ATAGTC 9.86373064417e-05 0.000130682810918 +TACTGG 0.000290335251823 0.000229829733278 +ATAGTG 0.000169042733655 0.000185870615894 +GATCGA 0.00011780710098 3.70307782309e-05 +CAGGCA 0.000544073623164 0.000431149749122 +AGGAAG 0.000744136569799 0.000705814596689 +CATCCG 6.06462590843e-05 6.58590399934e-05 +AGGAAA 0.000495626324241 0.000636451569078 +CATCCA 0.000202851280385 0.000316394154648 +CAGGCG 0.000211216281638 0.00012248029445 +CATCCC 0.000198668779759 0.000296405498011 +TTATGA 9.75916812851e-06 0.000252764924957 +ATAGAA 0.000333902966683 0.00031432361651 +CGGAGT 0.000116412934104 7.73266358326e-05 +TTATGG 5.12356326747e-05 0.000192161866389 +CATCCT 0.000214353157108 0.000364653620471 +AGGAAT 0.000251995662747 0.000335427178298 +CAGGCT 0.000730543442763 0.000495973520047 +ACGGAT 0.00013000606114 5.00910957144e-05 +CGGAGA 0.000156495231775 0.000118259582092 +CGGAGC 0.000228991909301 0.000170341579862 +TTATGT 6.72685517429e-05 0.000336701355613 +CAGGCC 0.000890872633445 0.000366246342116 +CGGAGG 0.000232128784771 0.000153936546925 +ATGGAA 0.000775505324498 0.000411638908979 +ATGGAC 0.000658395306955 0.000232616996156 +ATGGAG 0.00116970600855 0.000377076849297 +CGCTTG 0.000133491478329 7.44597368728e-05 +CGCTTA 4.94929240803e-05 3.16155246401e-05 +CGCTTC 0.000387926933108 9.00684089873e-05 +TGAACA 0.0 0.000354619474112 +ATGGAT 0.000610296549751 0.000272833217675 +TTTGCA 0.000435677148594 0.000403675300758 +CGCTTT 0.000178104818345 7.69284554216e-05 +GCCGTG 0.000403262768739 0.000117622493434 +GATCGT 6.76170934618e-05 4.21274874928e-05 +TTTGCC 0.000533268829879 0.00031432361651 +TTGTGA 1.56843773494e-05 0.000388385172972 +GAAAAG 0.00101809036083 0.000501229501473 +GAAAAC 0.000621101343036 0.000387031359574 +ATAGAT 0.000218884199454 0.000203709098311 +GAAAAA 0.000759820947148 0.000624028340252 +GTTCCT 0.000285804209478 0.00035525656277 +TAAGTA 0.0 0.000208726171491 +TAGGGC 0.0 0.000133947890289 +ACGGTT 6.41316762731e-05 5.49488967297e-05 +GAAAAT 0.000686278644465 0.000503140767447 +ACAAGG 0.000156495231775 0.000285256446501 +ACAAGA 0.000194834820851 0.000337895896846 +ACAAGC 0.000185772736161 0.000241456601282 +ACACGT 4.42647982972e-05 8.25029811767e-05 +CTGCGT 0.000165905858185 0.000100819280087 +GACGTC 0.000195531904289 6.03641503204e-05 +GCGGAG 0.000366665888257 0.000156007085063 +CATAAG 0.000193092112257 0.000173049206657 +GCGGAA 0.00012408085192 6.84073946243e-05 +CATAAA 0.000228643367582 0.000304926558809 +GCCAAC 0.000668851558522 0.000173686295315 +CATAAC 0.000130354602859 0.000138088966564 +ACACGC 7.66791781526e-05 7.19113822419e-05 +ACAAGT 0.000184727111004 0.000249260937339 +ACACGA 5.82064670522e-05 6.16383276359e-05 +ACACGG 8.99237634698e-05 8.80775069319e-05 +CATAAT 0.000130354602859 0.000197656756062 +GCGGAT 0.000120246893012 5.16838173588e-05 +GCACAT 0.000142902104739 0.000250694386819 +CTGCGG 0.000498414657992 0.000167554316984 +CTGCGA 0.0001920464871 7.97157182991e-05 +CTGCGC 0.000478199238297 0.00013864641914 +CGGCAA 0.000112927516916 5.12060008655e-05 +ACCGGT 5.50695915823e-05 4.12514905884e-05 +CGGCAG 0.000468440070168 0.000141194773771 +GACGCG 0.000100728556755 4.71445606724e-05 +CCTCCT 0.000697083437751 0.0005991818826 +TGTTGA 7.66791781526e-06 0.00031790724021 +CGGCAT 9.61975144096e-05 4.46758421237e-05 +CCTCCC 0.000499460283148 0.000628089780445 +CCTCCA 0.000659789473831 0.000463083818091 +CACGCC 0.000168345650217 0.000103606542964 +CCTCCG 0.000188212528193 0.000152343825281 diff --git a/code/utilities/CPAT-1.2.2/dat/Mouse_cutoff.txt b/code/utilities/CPAT-1.2.2/dat/Mouse_cutoff.txt new file mode 100755 index 0000000..fc99925 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/Mouse_cutoff.txt @@ -0,0 +1,2 @@ +Coding Probability Cutoff: 0.44 +Achieved Sensitivity and Specificity: 0.955 diff --git a/code/utilities/CPAT-1.2.2/dat/Mouse_logitModel.RData b/code/utilities/CPAT-1.2.2/dat/Mouse_logitModel.RData new file mode 100755 index 0000000..a0c06c1 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/dat/Mouse_logitModel.RData differ diff --git a/code/utilities/CPAT-1.2.2/dat/Zebrafish_logitModel.RData b/code/utilities/CPAT-1.2.2/dat/Zebrafish_logitModel.RData new file mode 100755 index 0000000..ea1ef0a Binary files /dev/null and b/code/utilities/CPAT-1.2.2/dat/Zebrafish_logitModel.RData differ diff --git a/code/utilities/CPAT-1.2.2/dat/fly_Hexamer.tsv b/code/utilities/CPAT-1.2.2/dat/fly_Hexamer.tsv new file mode 100755 index 0000000..c619f8f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/fly_Hexamer.tsv @@ -0,0 +1,4097 @@ +hexamer coding noncoding +GAACGT 0.000237052563287 0.000151040883142 +CTTCTT 0.000113847612631 0.000291206822698 +CACCCT 3.58697957605e-05 0.000114186907655 +GAACGG 0.000243290788636 0.000157082518468 +GAACGC 0.000414841985752 0.000160103336131 +GAACGA 0.000193384985839 0.000236227941234 +CACCCA 9.045426757e-05 0.000277311061449 +CTTCTA 8.10969295455e-05 0.000186686531564 +CACCCC 8.57755985577e-05 0.000123853524177 +CTTCTC 0.000149717408392 0.000177019915043 +CACCCG 0.000113847612631 0.000141978430154 +CTTCTG 0.000325947274519 0.000206623928138 +CGTGTG 0.000269803246372 0.000222936343518 +TAAGGT 0.0 0.000166144971456 +CGTGTC 0.000131002732343 0.000120832706514 +CGTGTA 5.14653591346e-05 0.000140770103088 +GGAAAT 0.00041016331674 0.000407206220951 +TAAGGG 0.0 0.000122041033579 +CGTGTT 9.35733802448e-05 0.000244082067158 +TAAGGC 0.0 0.000167957462054 +TAAGGA 0.0 0.000198769802215 +TCACTG 0.000305673042133 0.000161311663196 +GTCAAA 0.000268243690035 0.00033410243351 +CCCGCT 0.00027760102806 0.000122041033579 +GTCAAG 0.000878030217964 0.000179436569173 +CTGTCC 0.000581714513855 0.000142582593686 +TCAGAG 0.000232373894275 0.000164936644391 +CTGTCA 9.98116055944e-05 0.000177019915043 +CTGTCG 0.000374293520979 0.000116603561786 +GTATCT 7.95373732081e-05 0.000196957311617 +TCAGAA 0.000107609387282 0.000267040281395 +GTCAAT 0.000350900175918 0.000204207274008 +GTATCA 7.95373732081e-05 0.000119020215916 +GTATCC 0.000227695225262 0.00012929099597 +GTATCG 0.000115407168969 0.000103916127602 +CTGTCT 0.000118526281643 0.000166749134989 +GGTGTC 0.000252648126661 0.000105728618199 +GGTGTA 8.73351548951e-05 0.000128082668904 +GGTGTG 0.000350900175918 0.000155874191403 +TATCCT 0.00013256228868 0.00019756147515 +CCGGGG 4.21080211102e-05 8.33745674944e-05 +TTCTGT 0.000127883619668 0.000343164886499 +ATTCCT 0.00013256228868 0.000198769802215 +CCGGGC 0.000389889084353 7.85412592339e-05 +CCGGGA 0.000262005464685 8.94162028201e-05 +TATCCA 0.000237052563287 0.00024468623069 +TATCCC 0.000330625943532 0.000153457537272 +GTTCTG 0.000341542837893 0.000169165789119 +TACACC 0.000458509563199 0.000198769802215 +TATCCG 0.000343102394231 0.000133520140698 +GGTGTT 0.000207420992876 0.000163124153793 +ATTCCG 0.000354019288593 0.000218103035257 +TTCTGG 0.000291637035096 0.000227165488246 +CCGGGT 0.000233933450612 0.000100291146406 +ATTCCC 0.00040392509139 0.000273081916721 +TTCTGC 0.00036181707028 0.000227769651778 +ATTCCA 0.000233933450612 0.00035283150302 +GTTCTA 9.35733802448e-05 0.00019997812928 +TGCACT 0.000137240957692 0.00023985292243 +TATCTT 9.35733802448e-05 0.000301477602752 +CGCGGT 0.000163753415428 0.000126874341839 +CCCGCG 0.000120085837981 5.07497367357e-05 +CGCGGG 5.14653591346e-05 7.85412592339e-05 +CGCGGC 0.000433556661801 8.8207875755e-05 +CGCGGA 0.000226135668925 9.66661652109e-05 +ACCTGT 0.000188706316827 0.000127478505372 +TCATGT 2.80720140734e-05 0.000157082518468 +CCCGCC 0.000519332260359 0.000114186907655 +TTACAG 9.045426757e-05 0.000198165638682 +CTCCGC 0.000146598295717 0.000132915977165 +TTACAA 3.89889084353e-05 0.000474268373066 +TTACAC 3.89889084353e-05 0.00023985292243 +CTCCGG 9.8252049257e-05 0.000127478505372 +TCATGC 7.01800351836e-05 0.000138957612491 +ACCTGG 0.000244850344974 0.000144395084284 +GGCGAA 0.000550523387107 0.000218103035257 +GTAAGC 8.57755985577e-05 0.000196957311617 +TCATGG 5.14653591346e-05 0.000127478505372 +ACCTGC 0.000388329528016 0.000122041033579 +ACCTGA 1.55955633741e-06 0.000155874191403 +GTATTT 0.000124764506993 0.000544351342844 +CTCGAT 0.000308792154808 0.000163124153793 +CTCCGT 5.3024915472e-05 0.000121436870046 +GCCTGA 9.35733802448e-06 0.00011297858059 +GCCTGC 0.000483462464598 0.000148624229012 +GCCTGG 0.000322828161845 0.000115999398253 +TCTTGC 5.77035844843e-05 0.000154665864337 +TAAAGG 0.0 0.000246498721288 +CAAATT 0.000252648126661 0.000769704340492 +TAAAGA 0.0 0.000453726812959 +GCATAA 4.67866901224e-06 0.000297248458024 +AAGGTC 0.000548963830769 0.000158895009065 +TATTAG 1.24764506993e-05 0.000236227941234 +GCCTGT 0.000204301880201 0.000129895159502 +TATCTA 0.000124764506993 0.000282748533242 +TAAAGT 0.0 0.000465205920078 +CAAATA 0.000182468091477 0.000723183748484 +CAAATC 0.000308792154808 0.000494205769641 +CGTGCT 0.000141919626705 0.000128082668904 +CAAATG 0.000511534478672 0.000477893354262 +AATACT 0.000154396077404 0.000408414548016 +TATCTC 0.000121645394318 0.000186686531564 +CCGGCG 0.000399246422378 0.00010814527233 +GGCATG 0.000703359908173 0.000156478354935 +GGCATA 0.000227695225262 0.000174603260912 +GGCGAC 0.0006752878941 0.00011056192646 +GGCATC 0.000863994210927 0.000164332480859 +AATACG 0.000246409901311 0.000226561324713 +AATACA 0.000151276964729 0.000648871633978 +AATACC 0.000288517922421 0.000238644595364 +GGCATT 0.000606667415254 0.000281540206177 +TATCTG 0.000575476288505 0.000249519538951 +TGCACA 0.000118526281643 0.000268852771993 +GAGCAC 0.000851517760228 0.000185478204498 +ACTGAT 0.000263565021023 0.00026824860846 +GAGCAG 0.00183871692181 0.000291206822698 +AGTAGT 0.000145038739379 0.000175811587977 +TCTCGC 0.000110728499956 0.000138957612491 +TCTCGA 7.48587041958e-05 0.000163728317326 +TCTCGG 4.83462464598e-05 0.000107541108797 +ACTGAG 0.000279160584397 0.000185478204498 +AGTAGA 6.39418098339e-05 0.000193936493954 +TTTGGT 0.000285398809747 0.000378206371388 +AGTAGG 3.89889084353e-05 0.000109957762927 +ACTGAA 0.00027136280271 0.000378206371388 +AAGGTT 0.000333745056206 0.000202998946943 +GGGTCA 4.21080211102e-05 9.78744922761e-05 +GTGTCG 0.000290077478759 9.90828193412e-05 +TCGAAC 0.000293196591434 0.000208436418736 +TCGAAA 0.000198063654851 0.000541330525181 +GTGTCC 0.000491260246285 0.000149832556077 +CGCACG 0.000205861436539 9.48536746132e-05 +GTGTCA 9.51329365822e-05 0.000157082518468 +GTTGTA 7.95373732081e-05 0.000243477903625 +CTTGCT 8.26564858829e-05 0.000181249059771 +TCGGTC 0.000149717408392 0.000103916127602 +GTGTCT 9.8252049257e-05 0.000161311663196 +TTGAAG 0.000463188232212 0.000301477602752 +TCGAAT 0.000371174408304 0.000387268824376 +CTTGCG 6.39418098339e-05 0.000106332781732 +CTTGCA 7.95373732081e-05 0.000235623777702 +CTTGCC 0.000185587204152 0.00013654095836 +CGAAAG 0.000380531746329 0.000369748081932 +CGAAAA 0.000201182767526 0.000709892150768 +CGAAAC 0.00018090853514 0.000360685628943 +AATCAT 0.000207420992876 0.000465205920078 +AAATGC 0.000205861436539 0.000538309707518 +CACGGC 0.000357138401268 0.000128082668904 +AAATGA 2.49529013986e-05 0.000671829848216 +ACAGTC 0.000115407168969 0.000161311663196 +CACGGG 5.45844718095e-05 7.24996239082e-05 +ACAGTA 7.1739591521e-05 0.000161915826728 +TAGAGC 0.0 0.000198165638682 +CGAAAT 0.000210540105551 0.000544351342844 +ACAGTT 0.000168432084441 0.000291206822698 +AATCAG 0.000611346084266 0.000332289942913 +CACGGT 0.000115407168969 0.000119624379449 +AAATGT 0.000110728499956 0.000769704340492 +AATCAC 0.000322828161845 0.000289998495633 +TTTGTA 0.000135681401355 0.000694788062454 +GCTCAA 0.000263565021023 0.000194540657487 +TCTAGT 0.000107609387282 0.000196353148085 +TTGCCG 0.000324387718182 0.000246498721288 +ATACGT 7.48587041958e-05 0.00017641575151 +GGGTAT 3.11911267483e-05 0.000117207725318 +ATACGA 0.000107609387282 0.000244082067158 +TCTAGG 4.05484647727e-05 0.000123249360644 +ATACGC 0.000218337887238 0.000152249210207 +TCTAGA 6.08226971591e-05 0.000146207574882 +GGGTAG 0.0 7.31037874408e-05 +TCTAGC 0.000121645394318 0.000126874341839 +ATACGG 6.86204788462e-05 0.000143790920751 +TGACTA 0.0 0.000185478204498 +TTTGTG 0.000656573218051 0.000520788965074 +TGGGCC 0.000233933450612 0.000143790920751 +AGATGT 3.27506830857e-05 0.00022354050705 +TCGCCC 0.000595750520892 0.000148624229012 +TCGCCA 0.000411722873077 0.000196957311617 +GGGTCG 3.11911267483e-05 6.34371709197e-05 +TCGCCG 0.000558321168794 0.00015285337374 +GGTAAT 0.000151276964729 0.000196353148085 +ACCCAT 0.000210540105551 0.000190311512759 +GTCAAC 0.000492819802623 0.000199373965748 +ACCCAC 0.000339983281556 0.000241061249495 +GGTAAC 0.000199623211189 9.18328569504e-05 +ACCCAA 0.000247969457649 0.000317185854598 +AGATGG 6.08226971591e-05 0.000241665413027 +ACCCAG 0.000527130042046 0.000184269877433 +AGATGA 4.67866901224e-06 0.000253144520146 +TCGCCT 0.000159074746416 0.000159499172598 +AGATGC 4.83462464598e-05 0.000186686531564 +TTTGAG 0.000541166049082 0.000292415149763 +CCCCAT 0.000166872528103 0.000158290845533 +TGGTCT 4.36675774476e-05 0.000161915826728 +TTGGGT 0.000333745056206 0.000211457236399 +CACTAG 1.55955633741e-05 0.000131103486567 +CACTAA 9.35733802448e-06 0.000203603110476 +CACTAC 0.000378972189991 0.000140770103088 +CCCCAA 0.000202742323864 0.000241061249495 +CCCCAC 0.000168432084441 0.000170374116184 +CCCCAG 0.00041016331674 0.00013654095836 +CACTAT 0.0002167783309 0.000154665864337 +CTATCG 0.000182468091477 0.000132915977165 +TCGGTT 0.00017467030979 0.000270665262591 +TTGGGA 0.000274481915385 0.000256165337809 +TTGGGC 0.000516213147684 0.000179436569173 +CTCGAG 0.000408603760402 0.000113582744123 +TAGTGG 0.0 0.000166749134989 +TTTCTG 0.000408603760402 0.000392102132637 +TGCAGC 0.000329066387194 0.000292415149763 +TGCCTC 0.000185587204152 0.00013412430423 +TGCCTA 7.48587041958e-05 0.000140770103088 +TGCAGG 5.61440281469e-05 0.000170978279717 +TTTCCG 0.0002167783309 0.000254352847211 +GTGGCC 0.00165936794301 0.00019997812928 +TCAGAC 0.000134121845018 0.000151040883142 +TTTCTT 9.98116055944e-05 0.000676663156477 +TGCCTT 0.000106049830944 0.00021870719879 +TGCAGT 0.000201182767526 0.000299665112154 +TAGTGC 0.0 0.000160103336131 +GTGAGC 0.000343102394231 0.000137145121893 +AAGGAA 0.00100591383763 0.000436810234047 +AAGGAC 0.00111664233759 0.00020239478341 +AAGGAG 0.00232841761176 0.000273081916721 +ATATGC 0.000151276964729 0.000318998345196 +GTTCCA 0.00022301655625 0.000204207274008 +ATATGA 1.55955633741e-06 0.00052924725453 +TACGAA 0.000352459732255 0.000265227790798 +ATATGG 7.01800351836e-05 0.000288186005035 +AAGGAT 0.00123672817557 0.000251936193081 +CTATCA 8.88947112325e-05 0.000189103185694 +TGGTTT 0.00013880051403 0.000363102283074 +ATATGT 5.3024915472e-05 0.000607788513764 +GGTCCC 0.000274481915385 9.66661652109e-05 +GCCCAG 0.00113847612631 0.000196957311617 +CCACTG 0.000544285161757 0.000193332330422 +GCCCAA 0.000442913999825 0.000276706897916 +GGTCCG 0.000205861436539 6.70621521151e-05 +AGGTCT 3.43102394231e-05 0.000102707800537 +TGTGTC 9.66924929196e-05 0.000201790619878 +AGACCC 0.000116966725306 0.000122645197111 +AGACCA 7.95373732081e-05 0.000191519839824 +AGACCG 7.32991478584e-05 0.000130499323035 +CTTCGC 0.000176229866128 0.000133520140698 +ATGCAA 0.000349340619581 0.000432581089319 +AGGTCC 8.42160422203e-05 0.000113582744123 +AGGTCA 3.89889084353e-05 0.000117811888851 +AGGTCG 5.61440281469e-05 0.000118416052383 +GGTCCT 0.000193384985839 0.000100895309939 +TCCGGA 0.000378972189991 0.000165540807924 +CTTAGC 0.000182468091477 0.000142582593686 +ATTGTG 0.000720515027885 0.00035766481128 +CTTAGA 3.74293520979e-05 0.000217498871725 +ATGCAC 0.000425758880114 0.000198165638682 +CTTAGG 4.05484647727e-05 9.60620016784e-05 +ATTGTC 0.000377412633654 0.000241665413027 +ATTGTA 0.000149717408392 0.000506289040292 +CGCTAC 0.000433556661801 9.30411840155e-05 +ATTTTG 0.00031347082382 0.000793870881795 +CGCTAA 3.11911267483e-06 0.000137749285426 +ATTTTA 0.000121645394318 0.00114851487541 +CGCTAG 7.79778168707e-06 6.58538250499e-05 +ATTTTC 0.000357138401268 0.000788433410002 +GAGGTC 0.000460069119537 0.000115999398253 +TAGCAG 0.0 0.000163124153793 +GATACT 0.000134121845018 0.000155874191403 +TAGCAC 0.0 0.000168561625587 +TAGCAA 0.0 0.000337727414706 +GAGGTT 0.00035557884493 0.000117207725318 +ATTTTT 0.000141919626705 0.00154242949865 +GCCTTG 0.000458509563199 0.000166749134989 +GTGGGG 7.95373732081e-05 0.000104520291134 +GCCTTA 0.000101371161932 0.000127478505372 +TTGACA 0.000134121845018 0.000264623627265 +CGCTAT 0.000251088570324 0.000103916127602 +GATACG 0.000322828161845 0.000147415901947 +TAGCAT 0.0 0.000219311362322 +GATACC 0.000308792154808 0.000148020065479 +GATACA 0.000152836521066 0.000295435967426 +TGAGCT 0.0 0.000177624078575 +GTCACC 0.00053024915472 0.000115999398253 +GATCAT 0.000294756147771 0.000168561625587 +TGGCAC 0.000151276964729 0.000204207274008 +AAGACA 0.000330625943532 0.000289998495633 +AAGACC 0.000779778168707 0.000169165789119 +ACAATG 0.000254207682998 0.000291810986231 +AAGACG 0.000572357175831 0.000181853223303 +CCACTT 0.000191825429502 0.000281540206177 +TGAGCG 0.0 0.000129895159502 +GATCAC 0.000419520654764 0.000204207274008 +GATCAA 0.000388329528016 0.000266436117863 +AAGACT 0.000296315704108 0.000215082217594 +GAAGGG 7.48587041958e-05 0.000137145121893 +CTTCCA 0.000135681401355 0.000203603110476 +GCGGTA 8.73351548951e-05 0.000103311964069 +GCGGTG 0.00057859540118 0.000153457537272 +CGGTGT 3.74293520979e-05 0.000109353599395 +TCGTTA 5.14653591346e-05 0.000209644745801 +TCGTTC 0.000212099661888 0.000175811587977 +CTTCCC 0.00013880051403 0.000140770103088 +ACTTGT 5.92631408217e-05 0.000290602659165 +TTGGAG 0.000876470661626 0.000228373815311 +TGTGTG 0.000244850344974 0.000613225985557 +GCGGTT 0.000188706316827 0.000178228242108 +ACTTGC 0.00013256228868 0.000219915525855 +ATGTGA 9.35733802448e-06 0.000293623476828 +ACTTGA 4.67866901224e-06 0.000288790168568 +CGGTGG 4.36675774476e-05 0.000185478204498 +ACTTGG 9.51329365822e-05 0.000225957161181 +CGGTGA 0.0 0.000103311964069 +CGGTGC 9.045426757e-05 0.00013654095836 +TGCCGC 0.000269803246372 0.000183665713901 +TTCCTA 0.000169991640778 0.000212061399931 +TAGACT 0.0 0.00011297858059 +TTCCTC 0.000489700689948 0.000209644745801 +ATGTGC 0.000305673042133 0.000241665413027 +TGGGTT 8.10969295455e-05 0.000204811437541 +TTCCTG 0.000924816908086 0.000194540657487 +TCCTTT 0.000260445908348 0.000306310911012 +GACCCA 0.000106049830944 0.000169165789119 +TTCCGT 0.000233933450612 0.000180040732705 +TAGACG 0.0 9.60620016784e-05 +TTCCTT 0.0002292547816 0.000285165187372 +TAGACC 0.0 0.000100291146406 +TAGACA 0.0 0.000170374116184 +TCCTTG 0.000280720140734 0.000155874191403 +TCCTTA 6.55013661714e-05 0.00015285337374 +TCCTTC 0.000375853077317 0.000183061550368 +ATCTCT 0.00013880051403 0.00019997812928 +TCCGCA 0.0002167783309 0.000154665864337 +ACCGTT 0.000215218774563 0.000151040883142 +TGGCGC 0.000257326795673 0.000160707499663 +TTTACG 0.000201182767526 0.000226561324713 +TGGCGA 0.000102930718269 0.000160103336131 +GGCCAT 0.000208980549213 0.000203603110476 +ATCTCG 0.000399246422378 0.000140770103088 +ATCTCA 0.000168432084441 0.000212061399931 +ATCTCC 0.000350900175918 0.000164936644391 +GGCCAA 0.000286958366084 0.00030812340161 +GGCCAC 0.000364936182955 0.000177019915043 +ACCGTG 0.000456950006862 0.000102103637004 +ACCGTA 0.000121645394318 8.21662404293e-05 +GGCCAG 0.000715836358873 0.000213873890529 +ACCGTC 0.000279160584397 8.3978731027e-05 +AGAATT 8.88947112325e-05 0.000425331126928 +GGCAGT 0.000556761612456 0.000250123702483 +CCATAA 3.11911267483e-06 0.000270665262591 +CAAAGG 0.000149717408392 0.000251332029548 +CCATAC 0.000121645394318 0.000227769651778 +CAAAGA 0.000116966725306 0.000497226587304 +GAAACG 0.000463188232212 0.00028456102384 +CAAAGC 0.000210540105551 0.000406602057418 +CAACGT 0.000135681401355 0.00017641575151 +GGCAGA 0.000151276964729 0.000211457236399 +GGCAGC 0.00105270052775 0.000297852621556 +CGTGAG 0.000308792154808 0.000101499473471 +GGCAGG 0.000219897443575 0.000132915977165 +CAACGC 0.000238612119624 0.000184874040966 +CAAAGT 0.00022301655625 0.000405997893886 +CAACGA 0.000115407168969 0.000375185553725 +CTAACC 0.000237052563287 0.000157082518468 +CAACGG 0.000160634302754 0.000205415601073 +CGTGAA 0.000152836521066 0.000177019915043 +GGGGGT 5.3024915472e-05 4.95414096706e-05 +TACGCT 0.000137240957692 8.51870580921e-05 +GAAACC 0.000405484647727 0.000307519238077 +CGATCT 0.000124764506993 0.000159499172598 +CTCTAG 3.11911267483e-06 0.000111770253525 +TGAGCC 0.0 0.000138353448958 +CTCTAA 1.55955633741e-05 0.000248915375418 +CTCTAC 0.000417961098427 0.000126270178307 +GGGGGG 1.55955633741e-05 8.03537498316e-05 +CGATCC 0.000262005464685 0.000182457386836 +CGATCA 7.64182605332e-05 0.000213873890529 +GGGGGC 0.000127883619668 6.76663156477e-05 +CGATCG 0.000199623211189 0.000168561625587 +GGGGGA 7.1739591521e-05 0.000123249360644 +TACGCG 0.000165312971766 7.31037874408e-05 +CTCTAT 0.000193384985839 0.000163124153793 +TTCTGA 1.71551197115e-05 0.000252540356614 +CAGACC 0.000438235330813 0.000123853524177 +CAGACA 0.000257326795673 0.000260394482537 +CAGACG 0.000509974922334 0.000171582443249 +TGCGTG 0.000302553929458 0.000202998946943 +TAGTTG 0.0 0.000278519388514 +GCTAAT 0.000188706316827 0.000252540356614 +TAGTTC 0.0 0.000224748834115 +TAGTTA 0.0 0.000319602508729 +CAGACT 0.000235493006949 0.000142582593686 +GCTAAG 0.00026512457736 0.000154061700805 +TAGTTT 0.0 0.000544351342844 +GCTAAC 0.000169991640778 0.000155874191403 +GCTAAA 0.000121645394318 0.000317185854598 +TAAGTG 0.0 0.000341352395901 +TGCTGC 0.000260445908348 0.000323227489924 +AACCCT 5.45844718095e-05 0.000169769952652 +TATCAA 0.000185587204152 0.000435601906982 +AACCCC 0.000179348978803 0.000165540807924 +AACCCA 0.000154396077404 0.000293623476828 +AACCCG 0.000146598295717 0.000139561776023 +TGCATC 0.000385210415341 0.000206019764606 +AGATTT 7.32991478584e-05 0.000441643542307 +ACGTAA 1.09168943619e-05 0.000195748984552 +AACTGG 0.000318149492832 0.000272477753188 +AACTGA 2.49529013986e-05 0.000410227038614 +AACTGC 0.000447592668838 0.000319602508729 +CCCAGA 0.000140360070367 0.000195748984552 +CCCAGC 0.000647215880026 0.000205415601073 +CCCAGG 0.000190265873164 0.000101499473471 +AACTGT 0.000176229866128 0.000286373514437 +AGTTTT 0.00018714676049 0.00073164203794 +ACGTAT 0.000101371161932 0.000209040582269 +CCCAGT 0.000405484647727 0.000180644896238 +CTCCAA 0.000212099661888 0.000225957161181 +TTGACG 0.000145038739379 0.000128686832437 +TATAAT 0.000166872528103 0.000675454829411 +CGCATA 0.000151276964729 0.000198165638682 +ATACTG 0.000288517922421 0.000216894708192 +CGCATC 0.000658132774388 0.00017641575151 +ATACTA 8.88947112325e-05 0.000232602960039 +ATACTC 0.000196504098514 0.000185478204498 +CGCATG 0.000486581577273 0.000100895309939 +GCGCAA 0.000210540105551 0.000196353148085 +ATACTT 9.20138239074e-05 0.000381831352583 +CGCATT 0.000453830894187 0.000209040582269 +GCGCAC 0.000212099661888 0.000122041033579 +GCTCCG 0.000330625943532 0.000147415901947 +TATTGT 5.61440281469e-05 0.000584830299526 +GCTCCC 0.00041016331674 9.84786558086e-05 +GCTCCA 0.000442913999825 0.000203603110476 +CCTACT 5.92631408217e-05 0.000118416052383 +TGTACT 3.11911267483e-05 0.000236832104767 +TTTAGT 0.000121645394318 0.000547976324039 +TATTGG 8.42160422203e-05 0.000228373815311 +GCTCCT 0.000369614851967 0.000153457537272 +GCGCAG 0.000435116218138 0.000169165789119 +GCTGGG 0.000107609387282 0.000128686832437 +TTTAGG 6.39418098339e-05 0.000229582142376 +TGTACG 4.21080211102e-05 0.000154061700805 +CCTACG 9.66924929196e-05 7.61246051036e-05 +TGTACA 3.89889084353e-05 0.000358873138346 +CCTACA 8.10969295455e-05 0.000140165939556 +TGTACC 4.67866901224e-05 0.00015043671961 +CCTACC 8.42160422203e-05 9.18328569504e-05 +TTCGCG 9.51329365822e-05 0.000155874191403 +TTCGCA 0.000140360070367 0.000231998796506 +TTCGCC 0.000645656323689 0.000192124003357 +AGTATC 0.000112288056294 0.000163124153793 +GACTAA 9.35733802448e-06 0.000160707499663 +AGTATA 7.1739591521e-05 0.000281540206177 +GACTAC 0.000786016394056 0.000141374266621 +AGTATG 9.045426757e-05 0.000165540807924 +TTTGGA 0.000330625943532 0.000343164886499 +GACTAG 1.55955633741e-05 9.84786558086e-05 +TTCGCT 0.000165312971766 0.000253144520146 +GTGTAT 0.000124764506993 0.000304498420414 +GACTAT 0.000396127309703 0.000164936644391 +AGTATT 0.000124764506993 0.000389081314974 +TTACTC 5.45844718095e-05 0.000181249059771 +GGTCTT 0.000163753415428 0.000124457687709 +TTACTG 8.26564858829e-05 0.000183665713901 +ACCTTG 0.00027136280271 0.000132311813632 +ACCTTC 0.000601988746241 0.000131103486567 +ACCTTA 8.26564858829e-05 0.000172790770315 +TTACTT 7.1739591521e-05 0.000402372912691 +ACCTTT 0.000324387718182 0.000254957010744 +ACAGGG 3.43102394231e-05 8.63953851573e-05 +CTGGGA 0.00053024915472 0.000149832556077 +CTGGGC 0.00118994148545 0.000130499323035 +ACAGGC 0.000134121845018 0.000116603561786 +ACAGGA 0.000194944542177 0.000196353148085 +CTGGGG 0.000116966725306 8.45828945596e-05 +CAGGAC 0.000737670147596 0.000184269877433 +GCAGCT 0.000561440281469 0.000306310911012 +CAGGAA 0.000659692330726 0.000202998946943 +TCGCTT 0.000157515190079 0.000277915224981 +AGGACC 9.8252049257e-05 0.000105728618199 +AGGACA 8.73351548951e-05 0.000233811287104 +GCGCAT 0.000121645394318 0.000130499323035 +TTATAC 3.89889084353e-05 0.000339539905303 +ACAGGT 0.000104490274607 0.00011297858059 +CTGGGT 0.00040392509139 0.000140165939556 +TTATAG 9.35733802448e-06 0.000354643993618 +CTCCGA 5.92631408217e-05 0.000139561776023 +TCGCTG 0.00105114097142 0.000214478054062 +GAGTTG 0.000541166049082 0.00019756147515 +GCAGCG 0.000461628675874 0.000325644144054 +AGGACT 7.32991478584e-05 0.000167957462054 +GCAGCA 0.00080161195743 0.000691767244791 +GCAGCC 0.00066904966875 0.000244082067158 +CAGGAT 0.000832803084179 0.000191519839824 +TGCTGA 7.79778168707e-06 0.000262811136667 +CCTCAG 0.00018090853514 0.000115395234721 +CCTCAA 0.00013256228868 0.000156478354935 +CCTCAC 6.70609225088e-05 0.000126270178307 +TATGTT 0.000135681401355 0.000420497818668 +ATGGGC 0.000679966563112 0.000141374266621 +TCTTTG 0.000135681401355 0.000317790018131 +ATGGGA 0.000290077478759 0.000190311512759 +TCTTTA 6.55013661714e-05 0.000364914773671 +ATGGGG 7.32991478584e-05 0.000135332631295 +TCTTTC 7.1739591521e-05 0.000303894256882 +CCTCAT 7.01800351836e-05 0.000146811738414 +TCTTTT 7.1739591521e-05 0.000581205318331 +GCTAGC 0.000198063654851 0.00015285337374 +TATGTA 0.000131002732343 0.000734058692071 +ATGGGT 0.000296315704108 0.000139561776023 +TATGTC 0.000179348978803 0.000148624229012 +GAAAGA 0.000140360070367 0.000370352245464 +ATCAAG 0.00128663397837 0.000331081615847 +CATGAT 0.000145038739379 0.00017399909738 +ATCAAC 0.000860875098252 0.000347998194759 +GAAAGG 0.000212099661888 0.00024710288482 +ATCAAA 0.000441354443488 0.00070324635191 +GGAACT 0.000246409901311 0.000203603110476 +GTCAGG 7.95373732081e-05 8.03537498316e-05 +CATGAG 0.000247969457649 0.000107541108797 +ATCAAT 0.00057859540118 0.000453726812959 +GTCCAA 0.000169991640778 0.000212665563464 +CATGAC 0.000176229866128 0.00013654095836 +CATGAA 0.000188706316827 0.000213873890529 +TGACCT 0.0 0.000123853524177 +GTAGCG 6.23822534965e-05 0.000105728618199 +CAAGTT 0.000154396077404 0.000315977527533 +GCGGCT 0.000385210415341 0.000149228392544 +GCTTTA 9.35733802448e-05 0.000261602809602 +GCTTTC 0.000212099661888 0.000230790469441 +TTTCTC 0.000191825429502 0.000324435816989 +GCGGCG 0.000564559394144 0.000167353298521 +CAAGTG 0.000407044204065 0.000331081615847 +GTAGCT 0.000116966725306 0.000181249059771 +TTCTTT 0.000433556661801 0.000645850816316 +GCGGCC 0.000848398647553 0.000105124454667 +CAAGTC 0.00013880051403 0.000267040281395 +GCGGCA 0.000513094035009 0.000235623777702 +CAAGTA 0.000113847612631 0.000243477903625 +AACGGT 0.000297875260446 0.000178228242108 +GGGGAA 0.000131002732343 0.000165540807924 +TAATCG 0.0 0.000181249059771 +CTTGTG 0.000157515190079 0.00022354050705 +TAATCA 0.0 0.0003951229503 +TAATCC 0.0 0.000180644896238 +TGCGAA 0.00026512457736 0.000275498570851 +CGGCCC 0.000127883619668 7.9749586299e-05 +AAAATT 0.00027760102806 0.0013448680235 +TTGATA 0.000106049830944 0.000381227189051 +CGGCCG 0.000129443176005 8.51870580921e-05 +CTTGTA 4.83462464598e-05 0.000239248758897 +GGTCTG 0.000520891816696 9.18328569504e-05 +TAATCT 0.0 0.000250123702483 +AGTTTA 9.8252049257e-05 0.000479705844859 +TGCGAC 0.000304113485796 0.000146811738414 +GGTCTC 0.000184027647815 8.8207875755e-05 +GGAGGC 0.000467866901224 0.000164936644391 +GGTCTA 0.000118526281643 0.000135332631295 +AAAATG 0.000481902908261 0.00091047444358 +AAAATC 0.000375853077317 0.000839183146737 +TCAATA 8.88947112325e-05 0.000360685628943 +AAAATA 0.000249529013986 0.00158653343652 +TCGTCA 0.00012632406333 0.000145603411349 +ATCCCT 4.36675774476e-05 0.000128082668904 +TTCAGG 7.48587041958e-05 0.000145603411349 +ATATCC 0.000262005464685 0.000245894557755 +TCGTCG 0.000380531746329 0.00017399909738 +TTTAGC 0.00018090853514 0.000305102583947 +TGCCAA 0.000152836521066 0.000398143767963 +TCGGGA 0.000343102394231 0.000128686832437 +GAACAA 0.000333745056206 0.000413852019809 +ATCCCG 0.00012632406333 0.000144395084284 +GAACAC 0.0002292547816 0.000304498420414 +ATCCCC 0.000123204950656 0.000158895009065 +GAACAG 0.000659692330726 0.000236227941234 +ATCCCA 9.51329365822e-05 0.000254957010744 +AACGGA 0.000586393182867 0.000293019313296 +CACCAC 0.000456950006862 0.00028697767797 +CACCAA 0.000218337887238 0.00035766481128 +CACCAG 0.000676847450437 0.000230790469441 +AACATT 0.00050061758431 0.000602351041971 +AACGGG 0.000143479183042 0.00011297858059 +TCCGTC 0.000168432084441 0.000106332781732 +GAGTTA 0.000112288056294 0.000189103185694 +TCCGTA 0.000124764506993 0.000146811738414 +ACCAGA 0.000116966725306 0.000274290243786 +CACCAT 0.00031347082382 0.000189103185694 +AACATG 0.000623822534965 0.000279727715579 +AACATA 0.000333745056206 0.000529851418062 +AACATC 0.000743908372946 0.000292415149763 +CAGTCG 0.000555202056119 0.00019756147515 +GCACGG 5.61440281469e-05 9.66661652109e-05 +GTCAGA 6.70609225088e-05 0.000140770103088 +GCACGA 0.000102930718269 0.000121436870046 +CAGTCC 0.000346221506906 0.000129895159502 +GCACGC 0.000163753415428 0.000118416052383 +CAGTCA 0.000176229866128 0.000193936493954 +GCACCA 0.000391448640691 0.000235019614169 +GCAAGC 0.00013880051403 0.000227165488246 +GCACGT 9.51329365822e-05 0.000117207725318 +CAGTCT 0.000127883619668 0.000144395084284 +TAAAGC 0.0 0.000342560722966 +GCAAGG 9.8252049257e-05 0.000164332480859 +GTCAGT 0.000205861436539 0.000143790920751 +GTATAC 9.66924929196e-05 0.000186686531564 +TTCCCG 0.000196504098514 0.000172790770315 +GTATAA 3.11911267483e-06 0.000358873138346 +GTATAG 7.79778168707e-06 0.000149228392544 +CCGGAA 0.000481902908261 0.000143790920751 +CCGGAC 0.000417961098427 0.000125666014774 +CCGGAG 0.000901423563025 0.000137749285426 +CGTCTT 9.8252049257e-05 0.000118416052383 +TATTTG 0.00027760102806 0.000593892752515 +TTCCGG 0.000268243690035 0.00012929099597 +TTCCGA 0.00017467030979 0.000228373815311 +TTCCGC 0.000464747788549 0.000156478354935 +GTATAT 8.10969295455e-05 0.00053408056279 +CGTCTC 0.000162193859091 8.33745674944e-05 +CGTCTA 9.8252049257e-05 0.000100291146406 +CGTCTG 0.000427318436451 0.00015043671961 +CCGGAT 0.000509974922334 0.000126874341839 +CTCTTC 0.000587952739205 0.000206019764606 +TGTTAT 4.21080211102e-05 0.000385456333779 +CTCTTA 4.83462464598e-05 0.000183665713901 +CTCTTG 0.000152836521066 0.000193936493954 +CCCGAT 0.000511534478672 0.000160103336131 +TACGTA 8.26564858829e-05 0.000155874191403 +TACGTC 0.000166872528103 8.45828945596e-05 +TCTGGT 0.000196504098514 0.00017641575151 +CGCGAT 0.000499058027972 0.00011056192646 +TACGTG 0.00040392509139 0.000118416052383 +TGTTAG 7.79778168707e-06 0.000216894708192 +GGTTTC 0.000302553929458 0.000193332330422 +CTCGTG 0.000169991640778 9.36453475481e-05 +CTCTTT 0.000249529013986 0.00033410243351 +TGTTAA 4.67866901224e-06 0.000487559970783 +CGCGAA 0.000408603760402 0.000139561776023 +CGCGAC 0.000447592668838 8.21662404293e-05 +GATATT 0.000439794887151 0.000369748081932 +TCTGGC 0.000308792154808 0.000175811587977 +TACGTT 0.000155955633741 0.000192728166889 +CGCGAG 0.000868672879939 9.48536746132e-05 +AGTCGT 0.000109168943619 0.000128082668904 +TTACCT 6.55013661714e-05 0.000201790619878 +CTCCAT 0.000143479183042 0.000180040732705 +TATGCC 0.000514653591346 0.000177019915043 +TTACCG 4.21080211102e-05 0.000109957762927 +CTCCAC 0.000188706316827 0.000206019764606 +AGTCGG 9.51329365822e-05 0.000158290845533 +TTACCC 8.57755985577e-05 0.000151645046675 +AGTCGA 0.000134121845018 0.000228373815311 +TTACCA 9.98116055944e-05 0.000271873589656 +AGTCGC 0.000291637035096 0.000165540807924 +GTACCG 9.8252049257e-05 7.9749586299e-05 +CCGACT 0.000118526281643 0.00013654095836 +GCCTAC 0.000653454105376 0.000101499473471 +GCCTAA 1.55955633741e-05 0.000162519990261 +GCCTAG 1.24764506993e-05 7.9749586299e-05 +GTGCGG 0.000241731232299 0.000135936794828 +CCGACA 0.000137240957692 0.000138353448958 +GATATC 0.00040392509139 0.000225352997648 +CCGACC 0.000184027647815 0.000148020065479 +CCGACG 0.0002167783309 9.90828193412e-05 +GCCTAT 0.000428877992789 0.000106332781732 +TGACGG 0.0 9.06245298853e-05 +TGACGT 0.0 0.000109353599395 +CCCGAG 0.000639418098339 0.000107541108797 +CTCGTT 9.98116055944e-05 0.000177019915043 +CCCGAA 0.00041016331674 0.000189103185694 +CGCACA 0.000173110753453 0.000219915525855 +ATACAC 0.000120085837981 0.000425331126928 +CGCACC 0.000592631408217 0.000106936945265 +ATACAA 0.000141919626705 0.000624100929143 +ACTGCT 0.000205861436539 0.000177624078575 +ATACAG 0.000212099661888 0.000231998796506 +ATTGCC 0.000742348816609 0.000271269426123 +GGGTCC 7.48587041958e-05 5.79996991266e-05 +GAGCGT 0.000394567753366 0.000157686682 +CTCACT 0.000155955633741 0.000126874341839 +GGGTCT 3.11911267483e-05 9.12286934178e-05 +ACTGCA 0.000212099661888 0.000311144219273 +TTTGTC 0.000210540105551 0.000315373364001 +ACTGCC 0.000393008197028 0.000181853223303 +CGCACT 0.000213659218226 0.000145603411349 +ATACAT 5.92631408217e-05 0.000769704340492 +ACTGCG 0.000146598295717 0.000149832556077 +CTCACC 0.000506855809659 0.000146811738414 +CTCACA 0.000148157852054 0.000187290695096 +CTCACG 0.000166872528103 7.18954603756e-05 +GTGGGT 0.00045227133785 0.000128082668904 +GTGAGG 0.000123204950656 8.45828945596e-05 +GATTTT 0.000341542837893 0.0007104963143 +ACAATT 0.000171551197115 0.000602955205503 +CTTGAA 0.000162193859091 0.000341352395901 +TAGTGA 0.0 0.000206623928138 +GTGAGA 9.35733802448e-05 0.000160103336131 +TCGACG 0.000276041471722 0.000141978430154 +TCGACA 0.000134121845018 0.000159499172598 +TAGAGG 0.0 0.000104520291134 +ACAATA 0.000141919626705 0.000558247104093 +GTGAGT 0.000152836521066 0.000204811437541 +ACAATC 0.000163753415428 0.000279123552047 +GATTTC 0.000469426457561 0.000369748081932 +CCAGTA 0.000109168943619 0.000138353448958 +TCGACT 0.000123204950656 0.000189103185694 +CTGGTT 0.000322828161845 0.000226561324713 +TTGAGT 0.000155955633741 0.000256165337809 +TCAAAA 0.000159074746416 0.000878453776354 +CGAACG 0.000102930718269 0.000180644896238 +CGAACC 0.000127883619668 0.000160103336131 +CGAACA 9.045426757e-05 0.000264623627265 +CTGGTG 0.00118058414742 0.000160103336131 +CTGGTA 0.000160634302754 0.000103916127602 +CTGGTC 0.000731431922247 0.000157082518468 +CGAACT 8.10969295455e-05 0.000201186456345 +TTGCAT 0.000169991640778 0.000384852170246 +GACGAG 0.00152836521066 0.000180040732705 +TTGCAG 0.000506855809659 0.000320810835794 +GAGGGA 0.000439794887151 0.000161915826728 +TTGCAC 0.000218337887238 0.000253144520146 +TTGCAA 0.000296315704108 0.000461580938882 +TCCATC 0.000460069119537 0.000236227941234 +TCGCAT 0.000268243690035 0.000210853072866 +GTCGTG 0.000210540105551 0.000115999398253 +GTCGTA 7.01800351836e-05 0.000103916127602 +GTCGTC 0.000212099661888 0.000132915977165 +CCGTTT 0.000116966725306 0.00020239478341 +GAGCAA 0.000670609225088 0.000300269275686 +TTTTTG 0.000193384985839 0.00104339042075 +ATATCG 0.000230814337937 0.000242873740092 +GTCGTT 0.000129443176005 0.000141978430154 +TCAGAT 0.000185587204152 0.0002634153002 +TCGCAG 0.000709598133523 0.000183061550368 +GTGCTC 0.00058483362653 0.000172790770315 +TCGCAC 0.000338423725219 0.000142582593686 +CCGTTG 0.0002292547816 0.000139561776023 +CCGTTA 3.27506830857e-05 0.000114791071188 +CCGTTC 0.000205861436539 0.000112374417058 +GATCGG 0.000280720140734 0.000138957612491 +AATGCT 0.000338423725219 0.000334706597043 +GGTACG 8.42160422203e-05 7.12912968431e-05 +GGTACA 8.10969295455e-05 0.00011056192646 +TCCAGG 0.000145038739379 0.000128686832437 +GGTACC 0.00013880051403 5.43747179312e-05 +GCGGAC 0.00045227133785 0.000107541108797 +CAGGGA 0.000407044204065 0.000106936945265 +TTCAGC 0.000456950006862 0.000212061399931 +TATTTC 0.000218337887238 0.000492997442576 +TATTTA 0.000101371161932 0.00109897346574 +CCCCCT 5.14653591346e-05 0.000100895309939 +GGTACT 0.000106049830944 9.30411840155e-05 +AATGCG 0.000411722873077 0.000215686381127 +AATGCC 0.00104490274607 0.000250727866016 +AATGCA 0.000416401542089 0.000461580938882 +CCCCCC 9.045426757e-05 0.000148020065479 +CCCCCA 0.00012632406333 0.000132311813632 +TATTTT 0.000123204950656 0.00139018028844 +CCCCCG 0.000110728499956 7.91454227665e-05 +CTTGAG 0.0002292547816 0.00015527002787 +ATGATG 0.000592631408217 0.000267644444928 +GAAGTA 0.000171551197115 0.000207832255204 +ATGATA 0.000177789422465 0.000367331427802 +ATGATC 0.000489700689948 0.000163124153793 +TGCAAC 0.000439794887151 0.000301477602752 +TGCAAA 0.000177789422465 0.00057153870181 +TGCAAG 0.000575476288505 0.000244082067158 +GAAGTG 0.00063317987299 0.000262206973135 +ATGATT 0.000276041471722 0.000462185102415 +CTTGAT 0.000151276964729 0.000230186305909 +GTGCTT 0.000218337887238 0.000210853072866 +TTGAGG 0.000113847612631 0.000177624078575 +GCCATT 0.000806290626443 0.000297852621556 +TTGAGC 0.000304113485796 0.000202998946943 +TGCAAT 0.000280720140734 0.000418081164537 +GAGAAT 0.00076574216167 0.000271873589656 +TGTCTT 3.89889084353e-05 0.000231394632974 +TTCAGA 6.23822534965e-05 0.000254957010744 +AGTAGC 0.000227695225262 0.000182457386836 +AAGGCC 0.00100903295031 0.00017883240564 +ATAACC 0.000251088570324 0.000210853072866 +AAGGCA 0.000474105126574 0.000299060948621 +ATAACA 0.000146598295717 0.000477289190729 +AAGGCG 0.000712717246198 0.000215686381127 +ATAACG 0.000141919626705 0.000187894858629 +TATGCT 0.000137240957692 0.000216290544659 +GAGGGT 0.000492819802623 9.42495110807e-05 +TGTCTG 0.000194944542177 0.000208436418736 +GAGAAG 0.0020258636823 0.000281540206177 +GAGAAA 0.000619143865953 0.000504476549695 +TGTCTC 6.08226971591e-05 0.000144999247816 +GAGAAC 0.0011961797108 0.00019997812928 +TGTCTA 4.99058027972e-05 0.000188499022161 +TGTGGC 0.000221456999913 0.000210248909334 +TGTGGA 0.000118526281643 0.000213873890529 +TGTGGG 3.89889084353e-05 0.000157686682 +ATAACT 0.000102930718269 0.000344373213564 +ACTGAC 0.000154396077404 0.000137145121893 +GGTATT 0.000176229866128 0.00019756147515 +AGGTAT 6.70609225088e-05 0.00015043671961 +ACCAAG 0.0011213210066 0.000285165187372 +GAGCAT 0.000428877992789 0.000229582142376 +ACCAAA 0.000486581577273 0.000611413494959 +ATCATC 0.000762623048995 0.000274894407319 +ACCAAC 0.000698681239161 0.00035524815715 +GGTCAC 0.000283839253409 0.000126270178307 +GATCGC 0.000750146598296 0.000154665864337 +GGTCAT 0.000212099661888 0.000127478505372 +ACCAAT 0.000640977654677 0.000344373213564 +AGGTAG 1.55955633741e-06 0.000177624078575 +AGGTAA 3.11911267483e-06 0.000155874191403 +AGGTAC 6.55013661714e-05 9.12286934178e-05 +TTTTGC 0.000152836521066 0.000487559970783 +GCCGTC 0.000442913999825 0.000119624379449 +AATTGG 0.000162193859091 0.000375789717258 +GTCGGA 0.000151276964729 0.000115999398253 +AATTGA 1.40360070367e-05 0.000593892752515 +ATCATG 0.000422639767439 0.000160707499663 +AATTGC 0.000247969457649 0.000404185403288 +TAGCCA 0.0 0.000235623777702 +TGGGGT 0.000106049830944 9.66661652109e-05 +CGCTCG 0.000191825429502 0.000143186757219 +GATAAT 0.000408603760402 0.000338331578238 +CGCTCA 7.79778168707e-05 0.000122645197111 +CGCTCC 0.000450711781512 0.00013654095836 +AATTGT 9.51329365822e-05 0.000653704942239 +AATCTT 0.000302553929458 0.00037156057253 +TCTTAT 5.14653591346e-05 0.000298456785089 +GTTATG 0.000149717408392 0.00017399909738 +CGCTCT 9.20138239074e-05 0.000146811738414 +GATAAA 0.00031970904917 0.000450705995296 +TCGAAG 0.000408603760402 0.000248311211886 +GATAAC 0.000371174408304 0.000203603110476 +TAGCCT 0.0 0.000111166089993 +TGGGGC 0.000268243690035 0.000125666014774 +GATAAG 0.000625382091303 0.00023985292243 +GATCCT 0.000285398809747 0.000183665713901 +AAGAAT 0.000603548302579 0.00048695580725 +GGGGCT 7.79778168707e-05 8.57912216247e-05 +GTTATC 0.0002167783309 0.000192728166889 +AAGAAC 0.0011213210066 0.00041626867394 +GATCCA 0.000363376626617 0.000186082368031 +AAGAAA 0.000732991478584 0.000974515778033 +GATCCC 0.00075950393632 0.00015043671961 +AAGAAG 0.00209448416115 0.000447685177633 +GATCCG 0.000505296253322 0.000166144971456 +GCCCCA 0.000168432084441 0.000190915676292 +TATTAA 1.8714676049e-05 0.000756412742776 +CAAGGG 5.14653591346e-05 0.000125666014774 +CAAGGC 0.000166872528103 0.000160707499663 +GGTTCT 0.000115407168969 0.000184874040966 +CAAGGA 0.0002292547816 0.000259186155472 +GGTTCA 0.000106049830944 0.000227165488246 +GGTTCC 0.000310351711145 0.000137749285426 +AAGGCT 0.000533368267395 0.000171582443249 +TGCATT 0.000233933450612 0.000450705995296 +GGTTCG 0.000244850344974 0.000182457386836 +TAGGCA 0.0 0.000187894858629 +ATTATA 0.000157515190079 0.000869391323366 +ATTATC 0.000336864168881 0.000299060948621 +TAGAAT 0.0 0.000295435967426 +GATAGT 0.000193384985839 0.000169769952652 +ATTATG 0.000269803246372 0.000391497969104 +AGTCTT 0.000116966725306 0.000180040732705 +TCCCAA 0.000196504098514 0.00026583195433 +TAGAAA 0.0 0.00048695580725 +TAGAAC 0.0 0.000167957462054 +ATTATT 0.000224576112587 0.00092920351309 +TAGAAG 0.0 0.00024226957656 +AGTCTA 0.000115407168969 0.000186686531564 +AGTCTC 0.000140360070367 0.000119624379449 +AGTCTG 0.000413282429414 0.000123249360644 +TAACTC 0.0 0.000205415601073 +TAACTA 0.0 0.000377602207855 +TAACTG 0.0 0.000229582142376 +ATCTAT 0.000291637035096 0.000333498269978 +GCCCCG 0.000152836521066 9.18328569504e-05 +TAACTT 0.0 0.000383039679648 +ATCTAG 2.02742323864e-05 0.000138353448958 +ATCTAC 0.000555202056119 0.000196957311617 +ATCTAA 1.24764506993e-05 0.000314165036936 +GGTCAG 0.000408603760402 9.90828193412e-05 +CCATGT 6.39418098339e-05 0.000181853223303 +GCCCCC 0.000210540105551 0.000102707800537 +TGGAGG 3.58697957605e-05 0.000173394933847 +TGGAGA 3.27506830857e-05 0.000213269726997 +GGTCAA 0.000205861436539 0.000161915826728 +CCATGC 4.67866901224e-05 0.000138957612491 +TCCAGA 0.000118526281643 0.000187894858629 +CCATGA 3.11911267483e-06 0.00013412430423 +CCATGG 7.64182605332e-05 0.000121436870046 +TGGAGT 9.66924929196e-05 0.000192728166889 +TCAGTA 5.45844718095e-05 0.000164936644391 +TCAGTC 6.55013661714e-05 0.000156478354935 +CTCTCT 0.000110728499956 0.000300269275686 +GGGGAT 0.000194944542177 0.000102103637004 +TCAGTG 0.000198063654851 0.000212665563464 +CGATAT 0.00012632406333 0.000233811287104 +CTCTCG 0.000260445908348 0.000137145121893 +GGGGAC 0.000154396077404 9.78744922761e-05 +CTCTCC 0.000338423725219 0.000155874191403 +TCAGTT 0.000112288056294 0.000344373213564 +CTCTCA 9.045426757e-05 0.000193936493954 +CGATAG 6.23822534965e-06 0.00015285337374 +CGATAA 4.67866901224e-06 0.000258581991939 +ATGCTG 0.000948210253147 0.000241665413027 +CGATAC 0.000127883619668 0.000151040883142 +TTCACT 0.000168432084441 0.00022354050705 +GTGTTT 0.00017467030979 0.000430768598721 +GCTACT 0.000113847612631 0.000139561776023 +GTGGTT 0.000378972189991 0.00026583195433 +GTGTTC 0.000408603760402 0.000241061249495 +GTGTTA 5.61440281469e-05 0.000222332179985 +GTGTTG 0.000194944542177 0.000283352696775 +CGTGCC 0.000325947274519 9.54578381458e-05 +GTGGTA 0.000182468091477 0.000173394933847 +GCTACA 9.51329365822e-05 0.000153457537272 +GTGGTC 0.000645656323689 0.000131103486567 +GCTACC 0.000157515190079 0.000127478505372 +GTGGTG 0.00112755923195 0.000200582292813 +GCTACG 0.000118526281643 8.88120392875e-05 +CGTGCA 7.79778168707e-05 0.000143186757219 +TTTCGT 8.73351548951e-05 0.000389081314974 +TGCCCT 2.96315704108e-05 0.000135332631295 +AGCGTT 0.000233933450612 0.000199373965748 +CGTGCG 8.42160422203e-05 0.000115999398253 +CACGGA 0.000246409901311 0.000125061851242 +TGCCCA 0.000121645394318 0.000278519388514 +TGCCCG 0.00013256228868 0.000113582744123 +ACAGTG 0.000279160584397 0.000196957311617 +AGCGTA 0.000107609387282 0.000140770103088 +AGCGTC 0.000163753415428 0.000180644896238 +GTACGT 4.36675774476e-05 0.000100291146406 +AGCGTG 0.000304113485796 0.000148020065479 +GGCCCC 0.000134121845018 7.79370957013e-05 +GGCCCA 9.35733802448e-05 0.000156478354935 +CACGTG 0.000286958366084 0.000118416052383 +GGCCCG 7.64182605332e-05 8.03537498316e-05 +CACGTA 7.48587041958e-05 0.000114791071188 +CACGTC 0.000166872528103 0.000107541108797 +ACGTGC 0.000135681401355 0.000127478505372 +ACGTGA 7.79778168707e-06 0.000140770103088 +ACGTGG 8.10969295455e-05 9.90828193412e-05 +AAATGG 0.000221456999913 0.000447685177633 +CACGTT 0.00013256228868 0.000163124153793 +GGGGCC 0.000162193859091 6.04163532568e-05 +TCTTAA 0.0 0.000434997743449 +GGCCCT 3.27506830857e-05 8.69995486898e-05 +GGGACA 4.05484647727e-05 0.000123249360644 +GGTATA 6.08226971591e-05 0.000187894858629 +GGGACC 4.36675774476e-05 0.000123853524177 +TCGTGG 0.000140360070367 0.000135936794828 +ACGTGT 4.5227133785e-05 0.000169769952652 +TCTTAG 4.67866901224e-06 0.000148624229012 +GCTTCC 0.000276041471722 0.000145603411349 +AGAGAG 0.000109168943619 0.000298456785089 +AGAGAA 0.000118526281643 0.000412643692744 +AGAGAC 6.55013661714e-05 0.000166749134989 +TCGTGA 9.35733802448e-06 0.000122645197111 +GTCTTT 0.000262005464685 0.000233811287104 +TCTATC 5.92631408217e-05 0.000180644896238 +TCTATG 9.20138239074e-05 0.000204811437541 +AGAGAT 0.000140360070367 0.000226561324713 +TTCACA 0.000182468091477 0.000303290093349 +GTCTTG 0.000152836521066 0.000144999247816 +TCTATT 0.000115407168969 0.00032926912525 +GTCTTC 0.000460069119537 0.000131103486567 +GTCTTA 4.83462464598e-05 0.000145603411349 +GCAGAG 0.000388329528016 0.000264623627265 +GAAGGC 0.000296315704108 0.000218103035257 +GCTCAC 0.000169991640778 0.000100291146406 +GCAGAC 0.000177789422465 0.000185478204498 +GCAGAA 0.000219897443575 0.000351623175955 +GCTCAG 0.00036181707028 0.00020239478341 +ATGCGT 0.000207420992876 0.000151645046675 +TTGCTG 0.000534927823733 0.000315373364001 +CTTGAC 0.000155955633741 0.000119624379449 +TTGCTA 0.000123204950656 0.000245290394223 +TTGCTC 0.000237052563287 0.000222936343518 +GCAGAT 0.000322828161845 0.000257977828407 +GCTCAT 0.000129443176005 0.000167957462054 +GTTTGC 0.000194944542177 0.000305102583947 +TTGCTT 0.000143479183042 0.000390289642039 +ATGCGG 0.000226135668925 0.000125061851242 +GAGAGG 0.000204301880201 0.000194540657487 +TAGCCG 0.0 0.000121436870046 +ATGCGC 0.000436675774476 0.000115395234721 +ATGCGA 0.00027760102806 0.000212665563464 +TGTAAG 4.36675774476e-05 0.000287581841503 +GGCTAG 4.67866901224e-06 0.000109353599395 +TGTAAC 5.45844718095e-05 0.000202998946943 +GGCTAC 0.000722074584222 0.000106936945265 +GACTGT 0.000140360070367 0.000146811738414 +GGCTAA 6.23822534965e-06 0.000147415901947 +ACTGTA 0.000101371161932 0.00021870719879 +TTGGTA 0.000109168943619 0.000236227941234 +ACTGTC 0.000168432084441 0.000140165939556 +TTGGTC 0.000283839253409 0.000179436569173 +TTCGAC 0.000611346084266 0.000204811437541 +ACTGTG 0.000322828161845 0.000163728317326 +AATCAA 0.000360257513942 0.00077393348522 +GACTGC 0.000327506830857 0.000156478354935 +GGCTAT 0.000461628675874 0.000139561776023 +GACTGA 4.67866901224e-06 0.000160707499663 +GACTGG 0.000254207682998 0.000109353599395 +TGTAAT 5.77035844843e-05 0.000502664059097 +TGTGGT 9.20138239074e-05 0.000193332330422 +TTGGTT 0.000219897443575 0.000422914472798 +ACTGTT 0.000169991640778 0.000269456935525 +GTTTCT 0.000109168943619 0.000285165187372 +ATAATT 0.000148157852054 0.000829516530216 +CCTTTT 8.73351548951e-05 0.000384852170246 +GTTTCG 0.000212099661888 0.000250727866016 +GTTTCC 0.000302553929458 0.000255561174276 +GTTTCA 0.000118526281643 0.000258581991939 +ATAATG 0.0002292547816 0.000430164435189 +CCTTTA 5.14653591346e-05 0.000207832255204 +CCTTTC 0.000129443176005 0.000181249059771 +ATAATC 0.000184027647815 0.000316581691066 +ATAATA 0.000109168943619 0.00108205688683 +CCTTTG 0.000204301880201 0.000231998796506 +ACAGAA 0.000213659218226 0.000428956108124 +ACAGAC 0.000179348978803 0.00022112385292 +GCCCCT 9.51329365822e-05 0.000109957762927 +ACAGAG 0.000310351711145 0.000217498871725 +TTATCT 2.80720140734e-05 0.000279123552047 +CTGGAC 0.0013630522389 0.000173394933847 +CTGGAA 0.00081408840813 0.000230790469441 +CTGGAG 0.00220989133011 0.000185478204498 +ACAGAT 0.000272922359047 0.000315373364001 +GTGAAG 0.000825005302492 0.000219311362322 +TGGGGA 0.000112288056294 0.000125061851242 +CCTTGC 7.32991478584e-05 0.000132915977165 +TTATCA 7.01800351836e-05 0.000372164736062 +CTGGAT 0.000884268443313 0.000181249059771 +TTATCC 0.000110728499956 0.00022354050705 +CCAATG 0.0002292547816 0.000206623928138 +AAACCG 0.000268243690035 0.000270665262591 +AAACCA 0.000291637035096 0.000632559218599 +CCAATC 0.000109168943619 0.000215686381127 +AAACCC 0.00027136280271 0.000317185854598 +CCAATA 9.66924929196e-05 0.000309331728675 +TGTCGG 4.83462464598e-05 8.21662404293e-05 +GAGATC 0.00111508278125 0.000161311663196 +AACGAG 0.0011213210066 0.000248915375418 +GAGATA 0.000294756147771 0.000220519689387 +AACGAA 0.00058483362653 0.000600538551373 +GAGATG 0.000756384823645 0.000161311663196 +AACGAC 0.000662811443401 0.000245290394223 +AAACCT 8.88947112325e-05 0.000280936042644 +CCAATT 0.000173110753453 0.000413247856277 +ATTTGC 0.000249529013986 0.000445268523503 +GTCGAT 0.000339983281556 0.000158895009065 +ATTTGG 0.00017467030979 0.000381227189051 +AACGAT 0.000873351548951 0.000326248307587 +TGTCGT 4.5227133785e-05 0.000144999247816 +CCCTAC 0.000385210415341 6.58538250499e-05 +GAGATT 0.000634739429327 0.000222332179985 +CCCTAA 9.35733802448e-06 0.000154665864337 +TACAAC 0.000658132774388 0.0002893943321 +CATTAT 9.35733802448e-05 0.000405393730353 +CTACAC 5.92631408217e-05 0.000152249210207 +TGGATT 0.000155955633741 0.000290602659165 +ATCACA 0.000279160584397 0.000277311061449 +ATCACC 0.000673728337762 0.000251332029548 +CATGCT 0.000169991640778 0.000161311663196 +TGACAC 0.0 0.000145603411349 +ATCACG 0.000311911267483 0.000125061851242 +TGGATA 0.000110728499956 0.000249519538951 +CATTAG 1.24764506993e-05 0.000181853223303 +CATTAA 7.79778168707e-06 0.000412643692744 +CATTAC 0.000118526281643 0.000198165638682 +CATGCA 9.8252049257e-05 0.000203603110476 +TGACAT 0.0 0.000186082368031 +CATGCC 0.000393008197028 0.000123853524177 +ATCACT 0.000182468091477 0.000213873890529 +CATGCG 0.00018090853514 9.96869828738e-05 +GTAGAA 0.000124764506993 0.000227165488246 +GTAGAC 0.000124764506993 9.42495110807e-05 +GTAGAG 0.000218337887238 0.000165540807924 +ACAACA 0.000393008197028 0.000811391624239 +ACAACC 0.000274481915385 0.000262206973135 +GATTGC 0.00026512457736 0.000222332179985 +ACAACG 0.000266684133698 0.000230790469441 +ACTAAG 0.000159074746416 0.000187290695096 +GTAGAT 0.000124764506993 0.000175207424445 +TGCTAC 0.000247969457649 0.000143790920751 +GGGTAC 5.61440281469e-05 5.37705543986e-05 +TGATGC 0.0 0.000175811587977 +GATTGT 0.000124764506993 0.000238644595364 +TTCAGT 0.000221456999913 0.000302081766284 +ACAACT 0.000184027647815 0.000410227038614 +GGGTAA 0.0 0.000121436870046 +TTGCCT 0.000110728499956 0.000220519689387 +TAATAG 0.0 0.00032926912525 +AGTCCG 0.000330625943532 0.000102103637004 +TAATAC 0.0 0.000313560873403 +GTCCGA 4.83462464598e-05 0.000198165638682 +TAATAA 0.0 0.00114428573068 +GTCCGC 0.000123204950656 9.72703287435e-05 +TGTTTA 3.27506830857e-05 0.000561872085289 +TCAACA 0.000145038739379 0.000381831352583 +CACATC 0.000533368267395 0.000229582142376 +GTCCGT 7.95373732081e-05 0.000100291146406 +TAATAT 0.0 0.000737079509733 +ATTCGC 0.000378972189991 0.000228373815311 +TTCTCC 0.000464747788549 0.000209040582269 +ATTCGA 0.00017467030979 0.000387268824376 +TAACGA 0.0 0.00022354050705 +ATTCGG 0.000148157852054 0.00017641575151 +TTCTCG 0.000363376626617 0.00024226957656 +GAGCTA 0.000371174408304 0.000146811738414 +TCGTAC 0.000218337887238 9.78744922761e-05 +TACCTT 9.20138239074e-05 0.000209040582269 +TCGTAA 3.11911267483e-06 0.000207832255204 +TCGTAG 7.79778168707e-06 0.000126270178307 +GAACCT 0.000131002732343 0.000125666014774 +ATCCAA 0.000279160584397 0.000378206371388 +ATCCAC 0.000338423725219 0.000209644745801 +TGAACC 0.0 0.00017641575151 +TTCTCT 0.000102930718269 0.000320206672261 +ATCCAG 0.000640977654677 0.000193936493954 +GAACCC 0.000344661950568 0.000143186757219 +TTATAT 7.01800351836e-05 0.000998682319335 +GAACCA 0.000263565021023 0.000233811287104 +GAACCG 0.000339983281556 0.000142582593686 +TACCTC 0.000143479183042 9.06245298853e-05 +TCGTAT 0.000137240957692 0.000183665713901 +ACCATC 0.000661251887063 0.000189707349226 +ACCATA 0.00027760102806 0.000297248458024 +ACCATG 0.000509974922334 0.000129895159502 +ATGTTG 0.000291637035096 0.000315373364001 +AGCTCT 0.000193384985839 0.000190311512759 +TGTCCT 0.000102930718269 0.000141978430154 +AGTGGT 0.000327506830857 0.000293019313296 +TGATGT 0.0 0.000207228091671 +ATGTTT 0.000263565021023 0.000542538852246 +ACCATT 0.00058483362653 0.000291206822698 +AGCTCG 0.000310351711145 0.000133520140698 +AGTGGC 0.000580154957518 0.000218103035257 +AGCTCC 0.000653454105376 0.000169165789119 +AGCTCA 0.000199623211189 0.000247707048353 +TCCATG 0.000463188232212 0.000163728317326 +CAGTAA 1.8714676049e-05 0.000216894708192 +CAGTAC 0.00057859540118 0.000118416052383 +CAGTAG 2.33933450612e-05 0.000133520140698 +TTAATA 7.01800351836e-05 0.000811995787772 +CAGTAT 0.000325947274519 0.000167957462054 +AAAGTA 0.000116966725306 0.000525622273334 +AAAGTC 0.000166872528103 0.000301477602752 +AAAGTG 0.000466307344887 0.000589059444254 +GATCTA 0.000286958366084 0.000162519990261 +GATCTC 0.000469426457561 0.000139561776023 +TGTCCA 0.000101371161932 0.000198769802215 +GATCTG 0.00129443176005 0.000184269877433 +TCCCTT 0.000134121845018 0.000151645046675 +CCGGCC 0.000438235330813 9.54578381458e-05 +ATTAGG 7.79778168707e-05 0.000148624229012 +AAAGTT 0.000198063654851 0.000606580186699 +ACTCTC 9.66924929196e-05 0.000156478354935 +ATTAGC 0.000204301880201 0.000252540356614 +TCCCTC 0.000145038739379 0.000123249360644 +TGTCCG 0.000162193859091 0.000160103336131 +TCCCTA 0.00012632406333 0.000143790920751 +TTAATG 0.000106049830944 0.000427143617526 +TCCCTG 0.000589512295542 0.000120832706514 +GATCTT 0.000333745056206 0.00019997812928 +CACAAT 0.0004460331125 0.000335310760575 +AAGTGC 0.000567678506818 0.000358268974813 +TGTTCT 3.89889084353e-05 0.000300269275686 +AAGTGG 0.000408603760402 0.000315977527533 +TGATTG 0.0 0.000283352696775 +TGCGCA 5.45844718095e-05 0.000163728317326 +TCTGAT 0.000179348978803 0.000210853072866 +TGTATT 6.70609225088e-05 0.000532268072193 +CGAGGT 9.35733802448e-05 8.51870580921e-05 +TGTTCA 4.05484647727e-05 0.000351623175955 +CACAAG 0.000764182605332 0.000273686080253 +TGTTCC 0.000102930718269 0.000169769952652 +AAGTGT 0.000190265873164 0.000415060346874 +CACAAC 0.000524010929371 0.000364310610139 +TGTTCG 8.26564858829e-05 0.000224144670583 +TCTGAA 0.000184027647815 0.000279727715579 +TCTGAC 0.000124764506993 0.000158290845533 +TCTGAG 0.000212099661888 0.000120832706514 +CGCGCC 0.000325947274519 9.96869828738e-05 +CGCGCA 6.55013661714e-05 0.000104520291134 +GGTAAA 0.000140360070367 0.000264623627265 +CGCGCG 5.14653591346e-05 8.15620768967e-05 +CTCCCT 1.8714676049e-05 0.000103916127602 +AGCGGG 0.000116966725306 0.00010814527233 +AGCGGA 0.00035557884493 0.000219311362322 +ACCTCT 0.000118526281643 0.000175207424445 +GGTAAG 0.000124764506993 0.000119624379449 +CGCGCT 0.000106049830944 9.78744922761e-05 +ACCTCC 0.000435116218138 0.00011297858059 +ACCTCA 0.000213659218226 0.000137145121893 +ACCTCG 0.000427318436451 0.000102707800537 +CTCCCC 5.45844718095e-05 0.000118416052383 +GCCTCT 0.000226135668925 0.000137145121893 +TAAGCC 0.0 0.000193332330422 +CGGGAG 0.000586393182867 0.000114186907655 +CCCATG 0.000558321168794 0.000117811888851 +CGGGAA 0.000322828161845 0.000143790920751 +CCCATA 0.000215218774563 0.000232602960039 +CGGGAC 0.000283839253409 7.85412592339e-05 +CCCATC 0.000605107858916 0.00019756147515 +TTGTTG 0.000152836521066 0.000602955205503 +CCTGCT 0.000246409901311 0.000126874341839 +CCGAAT 0.000308792154808 0.000220519689387 +CCCATT 0.000547404274432 0.000241665413027 +CGGGAT 0.000369614851967 0.000108749435862 +GCCTCG 0.000439794887151 0.000154061700805 +GCCTCA 0.000210540105551 0.000139561776023 +TAAGCT 0.0 0.000293623476828 +GCCTCC 0.000775099499694 0.000120832706514 +CCGAAC 0.000233933450612 0.000188499022161 +CCTGCG 0.000154396077404 0.000121436870046 +CCGAAA 0.000244850344974 0.000468830901273 +CCGAAG 0.000318149492832 0.000169165789119 +CCTGCC 0.000221456999913 0.00015527002787 +CCTGCA 0.000145038739379 0.000156478354935 +GTACTG 0.000159074746416 0.00011297858059 +CAAGGT 0.000137240957692 0.000138957612491 +CCATTC 0.000230814337937 0.000212665563464 +CCATTA 7.48587041958e-05 0.000222332179985 +CCATTG 0.000283839253409 0.000240457085962 +TATAAC 0.000123204950656 0.000306310911012 +GATTTG 0.000580154957518 0.000344977377097 +GTACTC 9.045426757e-05 0.000126270178307 +GTCGAA 0.000199623211189 0.000216894708192 +CCATTT 0.000176229866128 0.000465205920078 +TCAGCG 0.000205861436539 0.000160103336131 +TCTACC 8.73351548951e-05 0.000123853524177 +TCTACG 8.10969295455e-05 0.000139561776023 +ACTTTC 0.000157515190079 0.000303290093349 +CGCAAC 0.000662811443401 0.000196353148085 +TGCTTA 4.5227133785e-05 0.000269456935525 +CGCAAA 0.000435116218138 0.000293019313296 +ATACCG 0.000198063654851 0.000118416052383 +CGCAAG 0.001146273908 0.000170978279717 +ATACCA 0.000232373894275 0.00033410243351 +ATACCC 0.000360257513942 0.000186686531564 +TCTACT 8.57755985577e-05 0.000208436418736 +CCGAGT 0.000124764506993 0.000140165939556 +ATACCT 8.26564858829e-05 0.000167353298521 +GATAGG 0.000106049830944 9.2437020483e-05 +CGCAAT 0.000449152225175 0.000208436418736 +TAGTAA 0.0 0.000249519538951 +TGGGTG 0.000272922359047 0.000172186606782 +TAGTAC 0.0 0.000174603260912 +CTCAAG 0.000968484485534 0.000189103185694 +GTTTTG 0.000276041471722 0.000493601606108 +CTCAAA 0.000266684133698 0.000346185704162 +TAGTAG 0.0 0.000164936644391 +CTCAAC 0.000605107858916 0.000191519839824 +GTGTGC 0.000327506830857 0.000261602809602 +GTGTGA 1.24764506993e-05 0.000235623777702 +GTGTGG 0.0002167783309 0.000187290695096 +TAACGG 0.0 0.000140770103088 +TTGCGT 0.000182468091477 0.000186082368031 +CTCAAT 0.000444473556163 0.000222332179985 +TAGTAT 0.0 0.00024710288482 +GTTCTC 0.000201182767526 0.000224748834115 +GTGTGT 9.20138239074e-05 0.000566101230017 +ATCTTT 0.000338423725219 0.000354039830085 +GTTGGG 4.67866901224e-05 0.00013654095836 +GTTGGA 0.000219897443575 0.000194540657487 +GTTGGC 0.000382091302666 0.000282144369709 +CCTTGG 7.48587041958e-05 0.000129895159502 +CCTTGA 0.0 0.000153457537272 +GGGAAA 8.26564858829e-05 0.000340748232369 +AGGATT 0.00013256228868 0.000214478054062 +GGACGT 0.000184027647815 0.000106936945265 +GTTGGT 0.000184027647815 0.000226561324713 +ATCTTG 0.000188706316827 0.000217498871725 +GAGAGT 0.000339983281556 0.000132915977165 +ATCTTA 5.3024915472e-05 0.000306915074545 +ATCTTC 0.000648775436364 0.000243477903625 +AGGATC 0.000151276964729 0.000183665713901 +AGGATA 7.1739591521e-05 0.000203603110476 +AGGATG 0.000115407168969 0.000153457537272 +GACATG 0.00077198038702 0.000103311964069 +GACATC 0.000818767077142 0.000163124153793 +GACATA 0.000344661950568 0.000201790619878 +TCGGCG 0.000480343351923 0.000114186907655 +GAATAT 0.000249529013986 0.000500851568499 +GGTGCA 0.000177789422465 0.000159499172598 +TCGGCC 0.000544285161757 0.000161915826728 +ATCAGA 7.64182605332e-05 0.000299060948621 +TTGCGA 0.000140360070367 0.000216894708192 +GACATT 0.000595750520892 0.000257977828407 +TTGCGG 0.000102930718269 0.000145603411349 +GAATAG 2.33933450612e-05 0.000174603260912 +TCGGCT 0.000293196591434 0.000158895009065 +CATAGA 5.14653591346e-05 0.000207832255204 +GAATAC 0.000346221506906 0.000297852621556 +GAATAA 1.55955633741e-05 0.000448289341166 +TGCCTG 0.000472545570236 0.00015285337374 +CACCGC 0.000179348978803 0.000216290544659 +TGCAGA 4.67866901224e-05 0.000262206973135 +TTAATT 0.000124764506993 0.00108386937743 +GGACGA 0.000190265873164 0.000170978279717 +TGAGGT 0.0 0.000111166089993 +TTTCTA 0.00012632406333 0.000434997743449 +TTATAA 6.23822534965e-06 0.000705058842507 +GAAATG 0.000678407006775 0.000462789265947 +AATGAT 0.000450711781512 0.000420497818668 +GAAATA 0.000311911267483 0.000654913269304 +GAAATC 0.000559880725131 0.000466414247143 +GAAATT 0.000374293520979 0.000761246051036 +AATGAA 0.000477224239248 0.000694183898921 +AATGAC 0.000385210415341 0.000208436418736 +AATGAG 0.000630060760315 0.000257373664874 +TCAGCA 0.000190265873164 0.000268852771993 +TACTAG 1.24764506993e-05 0.000103311964069 +CTTGGA 0.000163753415428 0.000192124003357 +CTTGGC 0.000251088570324 0.00019756147515 +GTATTG 8.88947112325e-05 0.000218103035257 +GTCCTT 0.000116966725306 0.000144999247816 +CTTGGG 4.05484647727e-05 0.000205415601073 +AGCCCT 3.74293520979e-05 0.000114791071188 +GGGAAT 0.000121645394318 0.000181853223303 +TTGAAT 0.000262005464685 0.000528038927465 +GTCCTA 7.79778168707e-05 8.21662404293e-05 +GTCCTC 0.000208980549213 0.000141374266621 +TGCACG 0.00018090853514 0.000122041033579 +CTTGGT 0.000134121845018 0.000186082368031 +GTCCTG 0.000544285161757 0.000159499172598 +TGCACC 0.000366495739292 0.000186686531564 +TTGAAA 0.0002167783309 0.00077635013935 +AGCCCG 9.35733802448e-05 9.96869828738e-05 +AGCCCA 0.000106049830944 0.000217498871725 +AGCCCC 0.000141919626705 0.000137145121893 +TTAACT 7.95373732081e-05 0.000447685177633 +ATAAAT 0.000190265873164 0.00122222282639 +TGGTCG 0.000152836521066 0.000115395234721 +TGGTCA 8.88947112325e-05 0.000206019764606 +TGGTCC 0.000140360070367 0.000124457687709 +ACGATT 0.000182468091477 0.000273081916721 +GAGACT 0.000288517922421 0.000127478505372 +GATTCA 0.000232373894275 0.00023985292243 +GAGGAG 0.0033889159212 0.000342560722966 +ATAAAG 0.00027760102806 0.000467622574208 +ATAAAA 0.000148157852054 0.00147838816419 +TCAGCC 0.000215218774563 0.000164332480859 +ATAAAC 0.000224576112587 0.000583621972461 +GAGACG 0.000612905640603 0.000111770253525 +ACGATG 0.000241731232299 0.000190915676292 +CTACAG 0.000232373894275 0.000113582744123 +GAGACC 0.00072363414056 0.000154061700805 +ACGATC 0.000169991640778 0.000143790920751 +GAGACA 0.000266684133698 0.000190915676292 +ACGATA 0.000118526281643 0.000196957311617 +GGTTAC 0.000202742323864 9.96869828738e-05 +ATGTGT 8.10969295455e-05 0.000425935290461 +GGTTAA 3.11911267483e-06 0.000225957161181 +ACCACT 0.000425758880114 0.00019514482102 +GCACTT 0.000129443176005 0.000288790168568 +CTTCCT 6.70609225088e-05 0.000162519990261 +TAAACT 0.0 0.000405997893886 +CTCAGT 0.000202742323864 0.000195748984552 +TCCGCT 0.000260445908348 0.000132311813632 +ACCACG 0.000524010929371 0.000184874040966 +ATGTGG 0.000251088570324 0.000178228242108 +ACCACC 0.00104022407705 0.000286373514437 +GAGGAA 0.00104802185874 0.000259186155472 +ACCACA 0.000491260246285 0.000294831803893 +GGTTAT 0.000165312971766 0.000180040732705 +TCCGCC 0.000598869633567 0.000157686682 +GACGTG 0.000495938915297 0.000144395084284 +TCCGCG 0.000146598295717 8.51870580921e-05 +AACGTC 0.000221456999913 0.000137749285426 +AACGTA 0.000146598295717 0.000279123552047 +AACGTG 0.000483462464598 0.000154665864337 +CGTGAC 0.000171551197115 6.40413344522e-05 +AGTGTG 0.000394567753366 0.000256165337809 +TCTTCG 0.000213659218226 0.000166749134989 +AGTGTA 0.000104490274607 0.000266436117863 +TCTTCA 0.000113847612631 0.000276102734384 +AGTGTC 0.000210540105551 0.000138957612491 +TCTTCC 0.000166872528103 0.000166144971456 +CGTGAT 0.000198063654851 0.000154061700805 +TAAGTC 0.0 0.000174603260912 +AACGTT 0.000201182767526 0.00028697767797 +CCGTGA 1.55955633741e-06 0.000100895309939 +TCTTCT 9.8252049257e-05 0.000295435967426 +AGTGTT 0.000154396077404 0.00035041484889 +GTGCGC 0.000651894549039 0.000141374266621 +TTGGCA 0.000232373894275 0.000380623025518 +AAAGGT 0.000135681401355 0.000241061249495 +TTGGCC 0.000913900013724 0.000309935892208 +GAGTAG 2.02742323864e-05 0.000146207574882 +TTAACG 5.14653591346e-05 0.000222936343518 +TTGGCG 0.000276041471722 0.000167353298521 +GACTTC 0.000731431922247 0.000154665864337 +TCGAGT 0.000165312971766 0.000251332029548 +GACTTA 0.000112288056294 0.000188499022161 +GACTTG 0.00041016331674 0.000189103185694 +AAAGGG 3.43102394231e-05 0.00022354050705 +AAAGGA 0.000238612119624 0.000435601906982 +TTGGCT 0.000329066387194 0.000287581841503 +AAAGGC 0.000169991640778 0.000317790018131 +GAGTAC 0.000821886189817 0.000148624229012 +GTATGG 5.61440281469e-05 0.000128686832437 +GACTTT 0.000636298985665 0.000312352546338 +TAAACC 0.0 0.000259790319004 +CAAGAA 0.000269803246372 0.000477893354262 +GACGTT 0.000198063654851 0.000100291146406 +CAAGAC 0.000173110753453 0.000181249059771 +GATTCG 0.000408603760402 0.000193936493954 +CAAGAG 0.00036181707028 0.000250727866016 +TTCTTG 0.000237052563287 0.00030570674748 +TTCTTC 0.000718955471547 0.000323227489924 +TTCTTA 6.08226971591e-05 0.000392102132637 +CAAGAT 0.000213659218226 0.00023985292243 +AGGGCT 8.88947112325e-05 8.51870580921e-05 +TACGGG 9.66924929196e-05 7.37079509733e-05 +TACGGA 0.000305673042133 0.000127478505372 +TACGGC 0.00053648738007 0.000102707800537 +CTCAGA 7.64182605332e-05 0.000151645046675 +TAGAGT 0.0 0.000175811587977 +TACGGT 0.000179348978803 0.00011056192646 +AGGGCG 0.000102930718269 7.5520441571e-05 +AGGGCA 9.51329365822e-05 0.000163124153793 +AGGGCC 0.000165312971766 8.21662404293e-05 +TCGAGA 9.35733802448e-05 0.000204207274008 +CTGTGC 0.000478783795586 0.000175207424445 +TAGAGA 0.0 0.000225352997648 +GGCGAG 0.00111664233759 0.000117207725318 +CCGTGT 6.86204788462e-05 0.000127478505372 +GTGCTG 0.00104958141508 0.000219311362322 +GTGCTA 0.000208980549213 0.000160707499663 +ATCTGT 0.000140360070367 0.000230790469441 +CGAATT 0.000113847612631 0.000360081465411 +GCTCGT 0.000151276964729 0.000143790920751 +ATCTGA 6.23822534965e-06 0.000242873740092 +CGAATC 0.000127883619668 0.0002893943321 +ATCTGC 0.000393008197028 0.000227165488246 +CGAATA 6.55013661714e-05 0.000291810986231 +CGAATG 0.000204301880201 0.000211457236399 +ATCTGG 0.000238612119624 0.000193936493954 +ATCATA 0.00027136280271 0.000336519087641 +GATAGC 0.00035557884493 0.000169769952652 +AAGCAG 0.00135681401355 0.000427747781058 +GATAGA 9.51329365822e-05 0.00017641575151 +AAGCAA 0.000531808711058 0.000662163231695 +CAAACT 0.000212099661888 0.000385456333779 +AAGCAC 0.000648775436364 0.000257373664874 +TTTACC 0.000190265873164 0.000267644444928 +CATTTC 0.000163753415428 0.000402372912691 +CTAGGT 4.67866901224e-05 8.51870580921e-05 +CATTTA 9.20138239074e-05 0.000568517884147 +CATTTG 0.000330625943532 0.000443456032905 +GTTATA 0.000135681401355 0.00026824860846 +CAAACA 0.000213659218226 0.000675454829411 +AAGCAT 0.00036181707028 0.000364914773671 +CAAACC 0.000269803246372 0.000313560873403 +CTCGGG 3.89889084353e-05 8.57912216247e-05 +ATCATT 0.000436675774476 0.000392102132637 +CAAACG 0.000305673042133 0.000323227489924 +CTAGGG 1.8714676049e-05 7.06871333105e-05 +GTTATT 0.000179348978803 0.000406602057418 +TGGAGC 0.000185587204152 0.000206019764606 +CTAGGC 0.000109168943619 6.76663156477e-05 +CATTTT 0.000115407168969 0.000873620468094 +CTAGGA 7.48587041958e-05 0.000115395234721 +AAGTTT 0.000431997105463 0.000589663607787 +TACAGT 0.000205861436539 0.00019514482102 +CTCGAA 0.000191825429502 0.000228373815311 +CTAACG 0.000160634302754 0.000111770253525 +CTAAGG 0.000110728499956 0.00013654095836 +CTAAGA 7.32991478584e-05 0.000169769952652 +CTAAGC 0.000204301880201 0.00019514482102 +TACAGG 0.000145038739379 9.18328569504e-05 +AAGTTG 0.000552082943444 0.00032926912525 +AAGTTA 0.000127883619668 0.000427747781058 +TACAGC 0.000399246422378 0.000145603411349 +AAGTTC 0.000951329365822 0.00026099864607 +TACAGA 9.98116055944e-05 0.000237436268299 +CTAAGT 0.000127883619668 0.000214478054062 +GTATGA 6.23822534965e-06 0.000146811738414 +GGGGCA 9.8252049257e-05 0.000146207574882 +GGGGCG 0.000101371161932 8.15620768967e-05 +TTCAAC 0.000606667415254 0.000364914773671 +TATATC 0.000145038739379 0.000327456634652 +TATATA 0.00012632406333 0.00169044956413 +TGTATA 4.05484647727e-05 0.000583621972461 +TATATG 0.000244850344974 0.000682704791802 +TCCGGT 0.000272922359047 8.57912216247e-05 +GGTCCA 0.000193384985839 0.0001317076501 +TATATT 0.000149717408392 0.000945515928469 +GGACTA 0.000118526281643 0.000106936945265 +TCTTAC 6.55013661714e-05 0.000146811738414 +TGATGG 0.0 0.000152249210207 +CTCGGT 0.000104490274607 0.000100895309939 +ATGAGT 0.000182468091477 0.000214478054062 +GCCCAC 0.000469426457561 0.000212061399931 +TGATGA 0.0 0.000367331427802 +TGCCAT 0.000149717408392 0.000247707048353 +ACTCTT 0.000120085837981 0.000233811287104 +TGTTTC 0.000109168943619 0.000300873439219 +CACATA 0.000190265873164 0.000325039980522 +TCATAA 4.67866901224e-06 0.000316581691066 +CACATG 0.00048814113361 0.000172790770315 +TGTTTG 0.000118526281643 0.000455539303557 +ATGAGA 9.98116055944e-05 0.000245894557755 +ATGAGC 0.000463188232212 0.000169165789119 +ATGAGG 0.000151276964729 0.000148624229012 +GTGGCT 0.000516213147684 0.000158290845533 +ACTCTG 0.000339983281556 0.000165540807924 +TGCCAG 0.000458509563199 0.000262811136667 +ACTCTA 0.000102930718269 0.000185478204498 +ATTGTT 0.000260445908348 0.000660350741097 +CACATT 0.000318149492832 0.000349810685357 +TGCCAC 0.000241731232299 0.000254957010744 +AAATTC 0.000330625943532 0.000653100778706 +AAATTA 0.00013256228868 0.00127538921725 +AAATTG 0.000346221506906 0.000732850365005 +TCCACT 0.000257326795673 0.000193332330422 +TTCAAT 0.000556761612456 0.00063739252686 +CTTCGA 8.42160422203e-05 0.000247707048353 +CGTACC 0.000110728499956 8.94162028201e-05 +TTAATC 8.88947112325e-05 0.000312352546338 +AAATTT 0.000188706316827 0.00133459724344 +TTCGAA 0.000315030380157 0.000491789115511 +CTTAGT 8.42160422203e-05 0.000180644896238 +GGGAAC 9.98116055944e-05 0.000203603110476 +GGTGCG 0.000185587204152 0.000109957762927 +GCGTAT 9.51329365822e-05 0.000144395084284 +GGGAAG 9.045426757e-05 0.000130499323035 +GGTGCC 0.000547404274432 0.000127478505372 +TCGTCC 0.000305673042133 0.000231394632974 +GCCCAT 0.000300994373121 0.000175207424445 +AGAGCG 4.83462464598e-05 0.000244082067158 +GCGACT 8.26564858829e-05 0.000138353448958 +AGAGCC 0.000146598295717 0.000146207574882 +AGAGCA 7.95373732081e-05 0.000313560873403 +GCGTAG 3.11911267483e-06 9.84786558086e-05 +GGTGCT 0.000315030380157 0.000148624229012 +TCCCCA 9.98116055944e-05 0.000190311512759 +GCGTAC 0.000151276964729 7.61246051036e-05 +TAATTT 0.0 0.00110139011987 +GCGTAA 1.24764506993e-05 0.000173394933847 +GCGACG 0.000193384985839 0.000111770253525 +AGAGCT 7.64182605332e-05 0.000183061550368 +GCGACA 0.000141919626705 0.000160103336131 +TATCGG 0.000106049830944 0.000126874341839 +GCGACC 0.000176229866128 9.72703287435e-05 +TCCGGC 0.000524010929371 0.000153457537272 +GCAGGA 0.000329066387194 0.000225352997648 +GCAGGC 0.000191825429502 0.000164936644391 +GCAGGG 6.55013661714e-05 9.48536746132e-05 +CAATTT 0.000159074746416 0.000708683823703 +GCACTA 9.045426757e-05 0.0001317076501 +CCGTGC 0.000102930718269 0.000111770253525 +GCTCGG 9.35733802448e-05 0.000101499473471 +TATTCT 7.32991478584e-05 0.000386060497311 +CCGTGG 0.000106049830944 0.000116603561786 +CTTTAG 9.35733802448e-06 0.000194540657487 +GCAGGT 0.000152836521066 0.00011297858059 +CTTCGT 7.48587041958e-05 0.000154061700805 +TATTCC 0.00017467030979 0.000235019614169 +CAATTG 0.000430437549126 0.000456143467089 +TATTCA 4.83462464598e-05 0.000369143918399 +CAATTA 8.57755985577e-05 0.000532872235725 +TATTCG 0.000123204950656 0.000251936193081 +CAATTC 0.000251088570324 0.000404789566821 +TGTAGA 1.71551197115e-05 0.000212061399931 +GGCTCA 0.000177789422465 0.000111770253525 +AGCATT 0.000419520654764 0.000381831352583 +GGCTCC 0.000524010929371 0.000114791071188 +AATCCT 0.000254207682998 0.000214478054062 +TGTAGG 1.71551197115e-05 0.000112374417058 +GGCTCG 0.000247969457649 0.000101499473471 +TTCGGA 0.000322828161845 0.000209040582269 +TTCGGC 0.000425758880114 0.000174603260912 +CTTTAC 0.000137240957692 0.000195748984552 +TTCAAG 0.00101994984467 0.000297852621556 +TTCGGG 0.000127883619668 0.000141374266621 +AGCATG 0.000431997105463 0.000166144971456 +GGCTCT 0.000177789422465 0.000141978430154 +AGCATC 0.000481902908261 0.000200582292813 +TTTACT 7.01800351836e-05 0.000404185403288 +AGCATA 0.000204301880201 0.000323227489924 +TTACAT 3.58697957605e-05 0.000406602057418 +AGACCT 6.08226971591e-05 0.000103916127602 +TTCGGT 0.000213659218226 0.000225352997648 +GTTTAT 0.000112288056294 0.000454330976491 +GGGGAG 0.000249529013986 9.84786558086e-05 +GCACTC 0.000135681401355 0.000190915676292 +GCCTTT 0.0004460331125 0.00021870719879 +TGCTTG 0.000162193859091 0.000196957311617 +GTTTAA 1.71551197115e-05 0.000512330675618 +GAGGTG 0.0012881935347 0.0001317076501 +AACTTG 0.000366495739292 0.000354039830085 +GTTTAG 9.35733802448e-06 0.000254957010744 +GAGGTA 0.000218337887238 0.000108749435862 +CTGGCT 0.00050061758431 0.000181249059771 +AGGCGG 7.64182605332e-05 0.000142582593686 +AGGCGA 8.10969295455e-05 0.000178228242108 +AGGCGC 0.000152836521066 0.000121436870046 +AGGAGT 0.000106049830944 0.000196353148085 +ACAGCC 0.000354019288593 0.000224144670583 +ACAGCA 0.000311911267483 0.000418081164537 +TCCAGC 0.0006752878941 0.000236832104767 +ACAGCG 0.000202742323864 0.000175207424445 +AGGAGC 0.000198063654851 0.000252540356614 +AGGCGT 9.045426757e-05 0.000117811888851 +AGGAGA 3.89889084353e-05 0.000252540356614 +CTGGCG 0.000611346084266 0.000135936794828 +AGGAGG 6.55013661714e-05 0.000245290394223 +CTGGCA 0.000374293520979 0.000252540356614 +CTGGCC 0.00188550361193 0.000187894858629 +GCGCCC 0.000407044204065 8.57912216247e-05 +GCATCG 0.000302553929458 0.000193332330422 +ACAGCT 0.000221456999913 0.000221728016453 +GGAAAA 0.000324387718182 0.000641621671588 +AACGCT 0.000208980549213 0.000163124153793 +AATTTT 0.000202742323864 0.00129834743149 +AAACAG 0.000497498471635 0.000489976624913 +TGTCAC 9.35733802448e-05 0.000157686682 +AAACAC 0.00017467030979 0.000532872235725 +GCTCTA 0.000166872528103 0.000131103486567 +AAACAA 0.00027760102806 0.00139199277904 +AACGCG 0.000188706316827 0.000153457537272 +AATTTA 0.000168432084441 0.00111891086232 +AATTTC 0.000288517922421 0.000627121746806 +AACGCC 0.000612905640603 0.000172186606782 +TTTCAC 0.000159074746416 0.000302081766284 +ATTGGA 0.000399246422378 0.000288186005035 +AATTTG 0.00041016331674 0.00068693393653 +ATTTAC 0.000246409901311 0.000494205769641 +ATTTAA 2.33933450612e-05 0.00112857747884 +ATTTAG 7.79778168707e-06 0.000412643692744 +CCCTCG 0.000366495739292 9.90828193412e-05 +TAAATA 0.0 0.00115274402014 +GGAAAG 0.000480343351923 0.000230186305909 +TGACCA 0.0 0.000200582292813 +CATTCT 4.99058027972e-05 0.000191519839824 +TAAATC 0.0 0.000517163983879 +TGACCG 0.0 0.000100291146406 +GCGCCA 0.000296315704108 0.000167353298521 +CATTCG 0.000182468091477 0.000221728016453 +CATTCC 0.000166872528103 0.000214478054062 +CATTCA 8.26564858829e-05 0.000322623326391 +TCCATA 0.000193384985839 0.000254957010744 +GCCTTC 0.000790695063068 0.000151040883142 +ACAAAT 0.000227695225262 0.000785412592339 +GATTAA 2.80720140734e-05 0.000332894106445 +GTAGGC 9.66924929196e-05 0.000140165939556 +GATTAC 0.000366495739292 0.000198165638682 +GTAGGA 5.92631408217e-05 0.000102707800537 +GTAGGG 1.24764506993e-05 6.46454979848e-05 +GATTAG 2.18337887238e-05 0.000184874040966 +GCGGGT 0.000212099661888 7.37079509733e-05 +ACAAAC 0.000226135668925 0.000546163833442 +TTTCAA 0.000177789422465 0.000690558917726 +ACAAAA 0.00018090853514 0.00124518104062 +ACAAAG 0.000299434816783 0.00044466435997 +GCGGGC 0.000469426457561 0.000105728618199 +GTCGGT 0.000168432084441 0.000113582744123 +GCGGGA 0.000276041471722 0.000123249360644 +CCCTCA 0.000123204950656 0.00011056192646 +GATTAT 0.000254207682998 0.000285769350905 +GTAGGT 5.92631408217e-05 0.000114791071188 +AACCTG 0.000704919464511 0.000153457537272 +TAATGA 0.0 0.000383643843181 +GATGTT 0.000407044204065 0.000207228091671 +TAATGC 0.0 0.000248311211886 +GGGATG 9.35733802448e-05 0.000122645197111 +GCCCTT 0.000240171675962 0.000119020215916 +GCGCCG 0.000302553929458 0.000116603561786 +GGCGTA 0.000169991640778 9.66661652109e-05 +GCCCTC 0.000408603760402 9.12286934178e-05 +GATGTG 0.00122425172487 0.00022112385292 +GCCCTA 0.000194944542177 0.000120832706514 +GATGTA 0.000258886352011 0.000196353148085 +GCCCTG 0.000954448478497 0.00010814527233 +GATGTC 0.000555202056119 0.00013412430423 +AACCTC 0.000196504098514 0.000111770253525 +TGAAAT 0.0 0.000708683823703 +GCTCTT 0.000166872528103 0.000203603110476 +TTCTAA 1.09168943619e-05 0.00037397722666 +ATCCGT 0.00017467030979 0.000159499172598 +TTCTAC 0.000569238063156 0.000228373815311 +GGCTTA 9.20138239074e-05 0.000170374116184 +TTGGAT 0.000630060760315 0.000262811136667 +TGAAAC 0.0 0.000360685628943 +TGAAAG 1.55955633741e-06 0.000354039830085 +CCCTCC 0.000258886352011 0.000100895309939 +ATCCGC 0.000304113485796 0.000142582593686 +ATCCGA 0.000141919626705 0.000227165488246 +ATCCGG 0.000199623211189 0.000151645046675 +TGGCTC 0.000120085837981 0.000138957612491 +TGGCTA 0.000121645394318 0.000192124003357 +TGGCTG 0.000524010929371 0.000228977978843 +GGGTGA 1.55955633741e-06 8.03537498316e-05 +AGTTGT 9.66924929196e-05 0.000288790168568 +AGCTAT 0.00027760102806 0.000213269726997 +ATTAGT 0.000131002732343 0.000315977527533 +GTCGGC 0.000279160584397 0.000130499323035 +TGGCTT 8.10969295455e-05 0.000256769501342 +AGTTGG 8.42160422203e-05 0.000254352847211 +AGCTAA 6.23822534965e-06 0.000299060948621 +AGCTAC 0.000439794887151 0.000165540807924 +AGTTGC 0.000134121845018 0.000257373664874 +AGTTGA 1.55955633741e-06 0.000328060798185 +AGCTAG 7.79778168707e-06 0.000198769802215 +TCCTAG 1.09168943619e-05 9.42495110807e-05 +TCCAGT 0.000469426457561 0.00020239478341 +CTAATT 0.000152836521066 0.000400560422093 +CAGTGT 0.000104490274607 0.00017641575151 +TAACAA 0.0 0.000572142865342 +TCAGGT 6.39418098339e-05 0.000131103486567 +TCAAGG 7.48587041958e-05 0.000164332480859 +GTCGGG 3.74293520979e-05 0.000153457537272 +TCAAGC 0.000116966725306 0.000256165337809 +CTGCAC 0.000751706154633 0.00019997812928 +CTAATA 0.000102930718269 0.000311144219273 +CAGTGC 0.000450711781512 0.000285769350905 +CTAATC 0.000184027647815 0.000173394933847 +CAGTGA 2.33933450612e-05 0.000221728016453 +CAGTGG 0.000300994373121 0.000277311061449 +CTAATG 0.000304113485796 0.000201790619878 +TCAAGT 0.000118526281643 0.000292415149763 +CTGCAA 0.000630060760315 0.00035041484889 +GAGCCC 0.000569238063156 0.000132915977165 +TCAGGC 7.32991478584e-05 9.00203663527e-05 +CGAGCT 0.000129443176005 0.00013412430423 +TCCTAA 3.11911267483e-06 0.000186082368031 +GATCAG 0.000902983119362 0.000208436418736 +CAACCA 0.000232373894275 0.000398143767963 +GTTCAT 0.000112288056294 0.000235623777702 +TTCCCT 6.55013661714e-05 0.000184269877433 +TAACAG 0.0 0.000201186456345 +CGAGCG 0.000112288056294 0.000151040883142 +GTTAGT 0.000106049830944 0.000282748533242 +CGAGCA 0.000107609387282 0.000204811437541 +GAGCCG 0.000589512295542 0.000127478505372 +CGAGCC 0.000196504098514 0.000138353448958 +GTTCAG 0.000315030380157 0.000149832556077 +TTCCCC 0.000311911267483 0.00019756147515 +GTTCAC 0.000169991640778 0.00013654095836 +GTTCAA 0.000169991640778 0.000471247555403 +TGAGCA 0.0 0.000235019614169 +GGACCT 0.000198063654851 9.66661652109e-05 +TACATG 0.000469426457561 0.000200582292813 +AAGTAC 0.000909221344712 0.000227769651778 +AAGTAA 2.6512457736e-05 0.000500247404967 +TACATC 0.000489700689948 0.000258581991939 +AAGTAG 3.74293520979e-05 0.00021870719879 +TACATA 0.000221456999913 0.000750975270982 +GCACAC 0.000110728499956 0.000265227790798 +GGACCG 0.000247969457649 0.0001317076501 +ATTGGT 0.000240171675962 0.000277311061449 +GGACCA 0.000324387718182 0.000128082668904 +TCATCA 0.000190265873164 0.00030812340161 +GGACCC 0.000489700689948 7.61246051036e-05 +CACACG 0.000336864168881 0.000224144670583 +TACATT 0.000263565021023 0.000457955957687 +CACACC 0.000378972189991 0.000198769802215 +GCACAA 0.000185587204152 0.000275498570851 +CACACA 0.000168432084441 0.000794475045327 +TCTGCC 0.000238612119624 0.000184874040966 +TCTGCA 0.000168432084441 0.000258581991939 +TCTGCG 0.000116966725306 0.000148020065479 +TAGATT 0.0 0.000279123552047 +CCCGTC 0.00031347082382 7.91454227665e-05 +TTAAGG 4.36675774476e-05 0.000227769651778 +CCCGTA 0.000112288056294 7.24996239082e-05 +CGTCGA 0.000106049830944 0.000138353448958 +CCCGTG 0.000436675774476 8.3978731027e-05 +TTAAGC 9.66924929196e-05 0.000382435516116 +TTACGT 2.80720140734e-05 0.000175207424445 +TAGATC 0.0 0.000164332480859 +TGTCAA 8.26564858829e-05 0.000292415149763 +TAGATA 0.0 0.000280936042644 +TTTCGC 0.000208980549213 0.000325644144054 +TAGATG 0.0 0.000243477903625 +TGGTTA 3.11911267483e-05 0.000296040130958 +TCTGCT 0.000218337887238 0.000227769651778 +TTACGC 5.61440281469e-05 0.000121436870046 +TTAAGT 9.35733802448e-05 0.000492997442576 +TTACGA 3.43102394231e-05 0.000226561324713 +TTACGG 2.18337887238e-05 0.000100895309939 +CCCGTT 0.000268243690035 0.000111166089993 +AGTGAC 0.000227695225262 0.000166144971456 +AGTGAA 0.000283839253409 0.000496622423771 +AGTGAG 0.00031970904917 0.000188499022161 +GCGGTC 0.000210540105551 9.00203663527e-05 +CGGGCG 0.000159074746416 0.000161311663196 +CCCTCT 0.00013256228868 0.000122645197111 +TAAGAG 0.0 0.00019514482102 +CCTGAT 0.000112288056294 0.00013412430423 +GAAAGT 0.000300994373121 0.000367331427802 +CGGGCA 0.00012632406333 0.000129895159502 +TAAGAC 0.0 0.000167353298521 +ATTTAT 0.000131002732343 0.00110803591873 +AGTGAT 0.000316589936495 0.000207832255204 +TAAGAT 0.0 0.000271269426123 +CCTGAA 0.000171551197115 0.000180644896238 +CCTGAC 8.10969295455e-05 0.000122041033579 +CCTGAG 0.00018090853514 9.72703287435e-05 +GTTAGG 6.08226971591e-05 0.000117207725318 +ATTGGG 0.000106049830944 0.000191519839824 +TATACT 8.10969295455e-05 0.000260394482537 +GTTAGC 0.000190265873164 0.000154061700805 +CTCCAG 0.00039768686604 0.000175811587977 +GTTAGA 4.67866901224e-05 0.000173394933847 +TGTAGC 3.89889084353e-05 0.00019514482102 +GCCAAA 0.00071739591521 0.000513539002683 +TATACG 0.000159074746416 0.00017641575151 +GGTAGC 0.000218337887238 0.000104520291134 +TATACC 0.000120085837981 0.000204207274008 +TATACA 5.45844718095e-05 0.000695392225986 +ATTGGC 0.000609786527929 0.000256769501342 +TCTTGT 3.89889084353e-05 0.000279123552047 +TCCACG 0.000586393182867 0.000132311813632 +ACTAGT 9.51329365822e-05 0.000141374266621 +TTGACT 0.00012632406333 0.000216894708192 +GTAATA 7.64182605332e-05 0.000317790018131 +AACGCA 0.000199623211189 0.000313560873403 +GTAATC 0.000149717408392 0.000202998946943 +TCTAAC 8.10969295455e-05 0.000188499022161 +CGTTCT 8.57755985577e-05 0.000151040883142 +CCACCG 0.000655013661714 0.000161311663196 +GGTAGG 2.6512457736e-05 0.000137145121893 +CCACCA 0.000750146598296 0.000322019162859 +CCACCC 0.000374293520979 0.000187894858629 +GTTCGT 0.000109168943619 0.000171582443249 +TTTATG 0.000221456999913 0.000549788814637 +ACTAGG 3.89889084353e-05 9.06245298853e-05 +TTTATC 0.0002292547816 0.000387268824376 +ACTAGC 0.000140360070367 0.000146811738414 +TTTATA 0.000176229866128 0.000962432507381 +ACTAGA 3.74293520979e-05 0.000181249059771 +CCACCT 0.000268243690035 0.000181249059771 +CGTTCG 0.000188706316827 0.00015527002787 +TCGTTG 0.000235493006949 0.000206623928138 +CGTTCA 6.70609225088e-05 0.000149832556077 +CGTTCC 0.000201182767526 0.000122645197111 +TCTAAT 9.20138239074e-05 0.000324435816989 +TCGTCT 0.000104490274607 0.000141978430154 +CTTTGT 4.99058027972e-05 0.000316581691066 +AAACAT 0.000151276964729 0.000682704791802 +ACTGGA 0.000297875260446 0.000214478054062 +ACTGGC 0.000352459732255 0.000210853072866 +TAGTCC 0.0 0.000128082668904 +GTGACC 0.000636298985665 0.000114186907655 +TAGTCA 0.0 0.000148624229012 +GTGACA 0.00018714676049 0.000138353448958 +TAGTCG 0.0 0.00013654095836 +GTGACG 0.00031970904917 0.00010814527233 +TGTCAT 4.36675774476e-05 0.00017883240564 +ACTGGT 0.000230814337937 0.00015527002787 +CTTTGG 0.000106049830944 0.000214478054062 +CCTATG 7.95373732081e-05 0.000132311813632 +CTTTGC 0.000143479183042 0.000282144369709 +CTACGC 0.000113847612631 9.12286934178e-05 +GTGACT 0.000162193859091 0.000142582593686 +TAGTCT 0.0 0.000138353448958 +GTGCAC 0.000433556661801 0.000164936644391 +CGACGG 9.35733802448e-05 0.000103311964069 +ACCTAG 4.67866901224e-06 9.12286934178e-05 +CGACGA 0.000155955633741 0.000202998946943 +ACCTAA 1.09168943619e-05 0.000216290544659 +CGACGC 0.000262005464685 0.000116603561786 +ACCTAC 0.00049437935896 0.000151040883142 +CCGCAG 0.000790695063068 0.000154665864337 +CCGCAA 0.000316589936495 0.000180040732705 +CCGCAC 0.000332185499869 0.000117207725318 +CTACGG 4.05484647727e-05 7.18954603756e-05 +ACCTAT 0.000291637035096 0.000179436569173 +CGACGT 0.000140360070367 8.57912216247e-05 +CGAAGA 8.57755985577e-05 0.000250727866016 +CCCCGT 0.000102930718269 7.67287686362e-05 +CGAAGG 0.000113847612631 0.000172186606782 +GCGCTC 0.000221456999913 0.000126270178307 +GTGCAT 0.000230814337937 0.00024468623069 +GCGCTA 8.57755985577e-05 9.30411840155e-05 +CCGCAT 0.000268243690035 0.000149228392544 +GTTCGC 0.000191825429502 0.000142582593686 +GAAGAT 0.000631620316652 0.000315373364001 +GGATCT 0.000272922359047 0.000143790920751 +TCATGA 1.24764506993e-05 0.000122645197111 +TCGGAA 0.000364936182955 0.000209040582269 +TCGGAC 0.000400805978715 0.000119020215916 +GAATCT 0.0002167783309 0.000217498871725 +TCGGAG 0.000747027485621 0.000142582593686 +GGATCG 0.00045227133785 0.000151645046675 +GAAGAG 0.000784456837719 0.000271873589656 +GAAGAA 0.000469426457561 0.000450705995296 +CGAGAA 0.000135681401355 0.000277915224981 +GAAGAC 0.000411722873077 0.000208436418736 +GGATCA 0.000255767239336 0.000199373965748 +GAATCA 0.000219897443575 0.000287581841503 +GAATCC 0.000411722873077 0.000235019614169 +TCGGAT 0.00050061758431 0.000189707349226 +GAATCG 0.000438235330813 0.0002634153002 +ATGGTC 0.000324387718182 0.000139561776023 +CAGATG 0.000750146598296 0.000233811287104 +ATGGTA 0.000146598295717 0.000193936493954 +TGACCC 1.55955633741e-06 0.000123249360644 +ATGGTG 0.000559880725131 0.000158895009065 +CAGATC 0.000679966563112 0.000238040431832 +ACGCCC 0.00072363414056 0.000157686682 +CAGATA 0.000255767239336 0.000315373364001 +TGTCAG 0.00012632406333 0.000144999247816 +ACGCCT 0.000171551197115 0.00011297858059 +CAGATT 0.000417961098427 0.000286373514437 +TGATTA 0.0 0.000325039980522 +CTCGAC 0.000304113485796 0.000135332631295 +ATGGTT 0.000219897443575 0.000259790319004 +TCGCAA 0.000285398809747 0.000253748683679 +TTGCGC 0.000269803246372 0.000147415901947 +GCTATT 0.000151276964729 0.000209644745801 +TGCGTC 0.000177789422465 0.000117811888851 +GCGTGG 7.32991478584e-05 0.000157686682 +TTGTAG 1.40360070367e-05 0.000242873740092 +AATGGT 0.000385210415341 0.000266436117863 +TCCACC 0.000616024753278 0.000182457386836 +CTACGT 4.5227133785e-05 0.000100895309939 +AATGGC 0.000882708886976 0.000294227640361 +AATGGA 0.000653454105376 0.000396935440897 +AATGGG 0.000199623211189 0.000195748984552 +CCCCGA 8.26564858829e-05 0.000120832706514 +AATAGA 9.66924929196e-05 0.000354643993618 +AATAGC 0.00031970904917 0.0002893943321 +GTGAAT 0.00040392509139 0.000337727414706 +AGCCAG 0.000630060760315 0.000281540206177 +GGAGGG 5.92631408217e-05 8.63953851573e-05 +AAAAGT 0.000165312971766 0.000784204265274 +AGCCAC 0.000310351711145 0.000245290394223 +AGCCAA 0.000258886352011 0.000424726963396 +TGGTAG 4.67866901224e-06 0.000151040883142 +CGCCAT 0.000179348978803 0.000163728317326 +GAGTGT 0.000194944542177 0.000189707349226 +TGGTAC 0.000210540105551 0.000112374417058 +TGGTAA 4.67866901224e-06 0.000246498721288 +AAAAGG 0.000112288056294 0.000473664209534 +GGAGGT 0.000294756147771 0.000115999398253 +AGCCAT 0.000154396077404 0.000267644444928 +AAAAGC 0.000243290788636 0.000623496765611 +AAAAGA 0.000134121845018 0.000808974970109 +TCTATA 6.23822534965e-05 0.000287581841503 +GAGTGG 0.000352459732255 0.000205415601073 +CGCCAG 0.000818767077142 0.000174603260912 +TGGTAT 0.000121645394318 0.000198165638682 +CGCCAA 0.000254207682998 0.000200582292813 +GAGTGC 0.000606667415254 0.000192728166889 +CGCCAC 0.000283839253409 0.000166144971456 +GAGTGA 9.35733802448e-06 0.000196353148085 +GCCAGG 0.000315030380157 0.000175811587977 +GCCAGA 0.000226135668925 0.000217498871725 +GCCAGC 0.00113223790096 0.000347998194759 +GCCCGT 0.000169991640778 9.36453475481e-05 +TACCGA 0.000124764506993 0.000145603411349 +TACCGC 0.000324387718182 0.000105124454667 +TACTGA 1.09168943619e-05 0.000193936493954 +CTTCAT 0.000109168943619 0.000230790469441 +GCCCGC 0.000350900175918 8.8207875755e-05 +GCCAGT 0.000718955471547 0.000193936493954 +GCCCGA 0.000127883619668 0.000121436870046 +GCCCGG 0.000141919626705 9.72703287435e-05 +TGCGAT 0.000344661950568 0.000181249059771 +CTTCAC 0.000129443176005 0.000170374116184 +CTTCAA 0.000188706316827 0.000339539905303 +CTTCAG 0.000366495739292 0.000198769802215 +TCCGAG 0.000586393182867 0.00013654095836 +GTGGGC 0.00108545121084 0.000185478204498 +TCCGAC 0.000369614851967 0.000127478505372 +AATTCA 0.000202742323864 0.000552205468767 +GGACTG 0.000503736696984 0.000141374266621 +AATTCC 0.00027136280271 0.00033168577938 +AATTCG 0.000321268605507 0.00033410243351 +TCCGAT 0.000545844718095 0.000251936193081 +TAGCGG 0.0 9.48536746132e-05 +AATTCT 0.000137240957692 0.000494809933173 +TAGCGC 0.0 0.000101499473471 +GTCATC 0.000583274070193 0.000181853223303 +GTCATA 0.000148157852054 0.000180040732705 +GTCATG 0.000286958366084 9.36453475481e-05 +AGCAGG 0.00013880051403 0.000188499022161 +CCAGGT 0.000188706316827 0.000122041033579 +TTGGAA 0.000378972189991 0.000343769050031 +AGCAGC 0.00142075582338 0.000719558767289 +AGCAGA 0.000101371161932 0.000383643843181 +GGGGTG 8.10969295455e-05 6.52496615174e-05 +CCAGGG 4.83462464598e-05 9.30411840155e-05 +AGCAGT 0.000566118950481 0.000249519538951 +CCAGGA 0.000327506830857 0.000186686531564 +CCAGGC 0.000188706316827 0.000138957612491 +TCCCCG 0.00017467030979 0.00015285337374 +ATAGAG 0.000213659218226 0.000226561324713 +CATCTG 0.000564559394144 0.000212061399931 +ACGGTC 0.000185587204152 0.00011056192646 +CATCTA 0.000106049830944 0.000190915676292 +ATAGAC 0.000157515190079 0.000168561625587 +CATCTC 0.000127883619668 0.000173394933847 +CAAGCT 0.00017467030979 0.00022354050705 +TCCAAC 0.000572357175831 0.000225352997648 +GGGGTC 7.01800351836e-05 6.04163532568e-05 +CAAGCC 0.0002167783309 0.000193332330422 +CATCTT 0.000113847612631 0.000246498721288 +CAAGCA 0.000182468091477 0.000404185403288 +CAAGCG 0.0002292547816 0.000226561324713 +GTTCTT 0.000110728499956 0.000294227640361 +ACATGA 6.23822534965e-06 0.000217498871725 +CGTAAT 0.000106049830944 0.00019756147515 +ACATGC 7.64182605332e-05 0.000164332480859 +TCTTGA 1.55955633741e-06 0.000230186305909 +ACATGG 8.42160422203e-05 0.000149228392544 +AGGGAT 0.000266684133698 0.000132311813632 +GTACAT 5.3024915472e-05 0.000291206822698 +TGGCGG 9.51329365822e-05 0.000140165939556 +CGTAAG 0.000149717408392 0.000134728467763 +GAGTCA 0.000241731232299 0.000143790920751 +ACATGT 5.3024915472e-05 0.000224748834115 +CGTAAC 9.8252049257e-05 0.000128686832437 +CGTAAA 8.73351548951e-05 0.000259790319004 +AGGGAG 0.000346221506906 0.000104520291134 +TTATTT 9.98116055944e-05 0.00128988914203 +AGGGAC 0.00017467030979 0.000106936945265 +AGGGAA 0.000232373894275 0.000243477903625 +CCCTTT 0.000255767239336 0.000225957161181 +TGTTGT 3.43102394231e-05 0.000512330675618 +TCTTGG 5.92631408217e-05 0.00019756147515 +GTTGTT 0.000166872528103 0.000506893203825 +ATCCTT 0.000221456999913 0.000229582142376 +GCGGGG 8.26564858829e-05 6.64579885825e-05 +TTGTCC 0.000296315704108 0.000200582292813 +TTGTCA 0.000106049830944 0.000231998796506 +ATCCTC 0.000332185499869 0.000189103185694 +CTATGA 7.79778168707e-06 0.000154061700805 +ATCCTA 0.000134121845018 0.000172790770315 +GTTGTC 0.00022301655625 0.000190915676292 +ATCCTG 0.000829683971504 0.000193936493954 +GTTGTG 0.000274481915385 0.00021870719879 +TTGTCT 9.35733802448e-05 0.000271269426123 +CTATGC 7.79778168707e-05 0.000167353298521 +CTGTGG 0.000300994373121 0.000158290845533 +AAGGGG 0.000118526281643 9.96869828738e-05 +TGACTC 0.0 0.000116603561786 +TGGGCA 9.66924929196e-05 0.00019997812928 +TGGGCG 0.00012632406333 0.000157082518468 +TGACTG 0.0 0.000162519990261 +AAGCCG 0.000655013661714 0.000179436569173 +AAGCCC 0.000720515027885 0.000183665713901 +AAGCCA 0.000538046936408 0.00041868532807 +CAAAAT 0.000380531746329 0.000849453926791 +CTATGG 6.86204788462e-05 0.000112374417058 +TGGGCT 8.10969295455e-05 0.000135936794828 +CAAAAC 0.000374293520979 0.000721975421419 +CAAAAA 0.000316589936495 0.00131284735627 +AAGCCT 0.000207420992876 0.000173394933847 +CAAAAG 0.000726753253235 0.000605371859633 +TCAATG 0.000177789422465 0.000293623476828 +CCCTTA 4.83462464598e-05 0.000108749435862 +TCAATC 9.35733802448e-05 0.000275498570851 +CGTCGT 0.000212099661888 0.000128686832437 +CAGTTC 0.00077198038702 0.000230790469441 +CAGTTA 0.000102930718269 0.000227165488246 +CAGTTG 0.000678407006775 0.000302685929817 +GACCCC 0.000155955633741 8.27704039619e-05 +CTCTGT 9.35733802448e-05 0.000193332330422 +TCAATT 0.000131002732343 0.000587246953656 +TGGCGT 0.000109168943619 0.000148624229012 +GTTTGG 0.000143479183042 0.000204811437541 +CTCTGC 0.000297875260446 0.000206019764606 +GACCCT 5.61440281469e-05 8.76037122224e-05 +CTCTGA 7.79778168707e-06 0.000151645046675 +CTCTGG 0.000135681401355 0.000148624229012 +CAGTTT 0.000364936182955 0.000407810384484 +GCGAAG 0.000276041471722 0.000187290695096 +CTACTC 0.000151276964729 0.000125666014774 +TGCTGG 0.000159074746416 0.000210248909334 +GCGAAC 0.000221456999913 0.000189103185694 +GAGTCT 0.000188706316827 0.000123249360644 +GCGAAA 0.000146598295717 0.000391497969104 +TAGGGA 0.0 0.000102103637004 +GCTGGT 0.000354019288593 0.000194540657487 +GTGATT 0.00040392509139 0.000267040281395 +CTACTA 7.48587041958e-05 0.000215082217594 +TGCTGT 0.000118526281643 0.000248311211886 +GCGAAT 0.000249529013986 0.000248311211886 +TAATGG 0.0 0.000251936193081 +GTGATG 0.000647215880026 0.000153457537272 +CTACTG 0.000254207682998 0.000166144971456 +GTGATC 0.000611346084266 0.000163728317326 +GCTGGC 0.000586393182867 0.000205415601073 +GTGATA 0.000191825429502 0.000190915676292 +GCTGGA 0.000463188232212 0.000193332330422 +TGATAA 0.0 0.000412039529212 +TGTAGT 3.43102394231e-05 0.000213269726997 +TGATAC 0.0 0.000164332480859 +TGATAG 0.0 0.000166749134989 +CTTGTT 9.8252049257e-05 0.000302081766284 +GACGGT 0.000204301880201 8.09579133642e-05 +GCTAGG 5.14653591346e-05 7.49162780385e-05 +GCTAGA 6.86204788462e-05 0.0001317076501 +ATGAAT 0.000366495739292 0.000414456183342 +CTATGT 2.80720140734e-05 0.00019514482102 +AAGGGT 0.000449152225175 0.000146207574882 +TGATAT 0.0 0.000434997743449 +GTAGTG 0.000157515190079 0.000141978430154 +GCTAGT 0.000146598295717 0.000138957612491 +ATGAAC 0.000661251887063 0.000252540356614 +GACGGG 8.73351548951e-05 5.3166390866e-05 +ATGAAA 0.000338423725219 0.000741308654461 +GACGGA 0.00027760102806 0.000147415901947 +ATGAAG 0.000860875098252 0.000248915375418 +GACGGC 0.000364936182955 0.000119624379449 +CTTGTC 0.000107609387282 0.00013654095836 +CTAACT 9.51329365822e-05 0.000202998946943 +CCATAG 4.67866901224e-06 0.000137749285426 +GGTGAA 0.000286958366084 0.000185478204498 +GGTGAC 0.000286958366084 0.000107541108797 +GCGTCT 5.61440281469e-05 0.000119020215916 +TGTAAA 6.55013661714e-05 0.000657329923434 +GGTGAG 0.000318149492832 0.000103916127602 +GGAATG 0.000330625943532 0.000184269877433 +CGTCCT 0.00013256228868 9.30411840155e-05 +GGAATC 0.00030723259847 0.000217498871725 +GGAATA 0.000143479183042 0.000227769651778 +GCGTCA 5.61440281469e-05 0.000128082668904 +GCGTCC 0.000202742323864 8.45828945596e-05 +GGTGAT 0.000380531746329 0.000114791071188 +GCGTCG 9.98116055944e-05 0.000189707349226 +CGTCCG 0.000215218774563 0.000158895009065 +GGAATT 0.0002167783309 0.000278519388514 +CGTCCC 0.000237052563287 7.12912968431e-05 +CGTCCA 0.000145038739379 0.000175207424445 +TTTCGA 0.000106049830944 0.000410227038614 +CCGTAT 0.000190265873164 0.000104520291134 +GAAGTC 0.000247969457649 0.000216894708192 +CTACTT 8.57755985577e-05 0.000221728016453 +CGTGGT 0.000157515190079 0.000105124454667 +GCCGTA 0.000166872528103 0.000107541108797 +CCGTAC 0.000226135668925 9.72703287435e-05 +CCGTAA 4.67866901224e-06 0.000144395084284 +CCGTAG 1.55955633741e-06 6.34371709197e-05 +CTAACA 0.000106049830944 0.000199373965748 +GCCGTT 0.000308792154808 0.000143790920751 +TTGGTG 0.000449152225175 0.000230186305909 +GAAGTT 0.000274481915385 0.000253144520146 +GGCGCG 0.000121645394318 0.000122041033579 +ATGCCC 0.000577035844843 0.00015043671961 +TTAGTT 6.70609225088e-05 0.000584830299526 +ATGCCA 0.000321268605507 0.000306310911012 +GGCGCC 0.000637858542002 0.000114186907655 +ATGCCG 0.000382091302666 0.000120832706514 +GGCGCA 0.000219897443575 0.000146207574882 +TATTAC 0.000131002732343 0.000292415149763 +ACTATG 0.000115407168969 0.000173394933847 +CCATAT 0.00013880051403 0.000337727414706 +TTTAAG 0.000427318436451 0.000533476399258 +ACTATC 0.000106049830944 0.000177019915043 +TTTAAA 0.000154396077404 0.00132674311752 +ACTATA 7.1739591521e-05 0.000362498119541 +TTTAAC 0.000240171675962 0.000465205920078 +TATTAT 0.000123204950656 0.000886307902278 +TTAGTG 6.08226971591e-05 0.0002634153002 +GGCGCT 0.000268243690035 0.000123249360644 +TTAGTC 5.77035844843e-05 0.000166144971456 +ATGCCT 0.000127883619668 0.000153457537272 +TTAGTA 5.14653591346e-05 0.000314165036936 +TTTAAT 0.000260445908348 0.00106091116319 +ACTATT 0.000135681401355 0.000326852471119 +GGGCAT 8.88947112325e-05 0.000154061700805 +TCGATA 0.00013256228868 0.000249519538951 +TTCTAG 1.40360070367e-05 0.000194540657487 +TTTCCA 0.000173110753453 0.000496622423771 +TTTCCC 0.000297875260446 0.000306310911012 +GGGACT 3.11911267483e-05 8.51870580921e-05 +TATCGA 0.000109168943619 0.000228373815311 +GTTTGT 8.26564858829e-05 0.000421706145733 +TTTCCT 0.000101371161932 0.000363706446606 +GGGCAG 0.000163753415428 0.000157082518468 +GTCTGT 6.55013661714e-05 0.000170978279717 +GGGCAA 9.8252049257e-05 0.000212665563464 +GGGCAC 0.000110728499956 0.000112374417058 +GTACGG 4.99058027972e-05 9.78744922761e-05 +GTTTGA 4.67866901224e-06 0.000260394482537 +GTACGC 9.51329365822e-05 7.18954603756e-05 +GTACGA 5.61440281469e-05 0.000129895159502 +CCGCTC 0.000249529013986 0.000140770103088 +GCATGT 4.21080211102e-05 0.000179436569173 +CCGCTA 0.000141919626705 9.2437020483e-05 +CCGCTG 0.000782897281381 0.000146207574882 +TGAAAA 0.0 0.0009739116145 +GCGCGG 9.51329365822e-05 0.000123249360644 +GCGCGC 0.000194944542177 9.60620016784e-05 +TGTTTT 6.86204788462e-05 0.000965453325044 +GCGCGA 0.000109168943619 0.000103916127602 +GCATGG 5.14653591346e-05 0.000148020065479 +TGGATC 0.000198063654851 0.000169165789119 +GCATGC 8.26564858829e-05 0.000146207574882 +CCGCTT 0.000135681401355 0.000204207274008 +GCATGA 6.23822534965e-06 0.000158290845533 +TTTCAG 0.000291637035096 0.00030570674748 +GTCGAC 0.000288517922421 0.000102707800537 +GCGCGT 0.000116966725306 0.000119624379449 +GTCGAG 0.000505296253322 0.000166749134989 +CGTGGC 0.000305673042133 0.000182457386836 +CTTCCG 0.000109168943619 0.000101499473471 +TGCGCT 7.64182605332e-05 0.000144395084284 +GAGCTC 0.000480343351923 0.000141374266621 +ATTGAT 0.000421080211102 0.000434997743449 +GAGCTG 0.00203522102032 0.000213269726997 +AAACGA 0.000193384985839 0.000586038626591 +AAACGC 0.000291637035096 0.000311144219273 +GTAACA 7.64182605332e-05 0.000183061550368 +GTAGTA 3.74293520979e-05 0.000149832556077 +AAACGG 0.000196504098514 0.000287581841503 +ATTGAA 0.000425758880114 0.000598121897243 +TGCGCG 5.77035844843e-05 0.000106936945265 +ATTGAC 0.000347781063243 0.000202998946943 +GAGCTT 0.000315030380157 0.000166749134989 +TGCGCC 0.000327506830857 0.000133520140698 +ATTGAG 0.000592631408217 0.00024710288482 +CGCTGA 1.55955633741e-06 0.000210248909334 +CACGCA 0.000101371161932 0.000209644745801 +AAACGT 0.000162193859091 0.000377602207855 +ATTTCG 0.000276041471722 0.000404789566821 +ATTTCA 0.000135681401355 0.00052924725453 +ATTTCC 0.000360257513942 0.00041626867394 +ATCAGT 0.000302553929458 0.000233811287104 +ATCGGG 0.000116966725306 0.000117207725318 +CATAGT 6.70609225088e-05 0.000158895009065 +ATCGGC 0.000407044204065 0.000166144971456 +ATCGGA 0.000316589936495 0.000213873890529 +ATTTCT 0.000104490274607 0.000544955506377 +TACGCC 0.000485022020935 9.72703287435e-05 +TGGGTC 9.35733802448e-05 0.000106332781732 +TTTCGG 0.000101371161932 0.000277311061449 +TGGGTA 4.05484647727e-05 0.000135936794828 +CATAGG 3.43102394231e-05 9.2437020483e-05 +ATCGGT 0.000240171675962 0.000201186456345 +ATCAGG 0.000146598295717 0.00017399909738 +CATAGC 0.000102930718269 0.000157082518468 +ATCAGC 0.000562999837806 0.000282144369709 +ACGGGT 0.000163753415428 6.82704791802e-05 +GTCTGA 1.09168943619e-05 0.000124457687709 +GATTCT 0.000163753415428 0.000222936343518 +CTTTTG 0.000288517922421 0.000387872987909 +GCGTTC 0.000155955633741 0.000142582593686 +CTTTTC 0.000204301880201 0.000374581390192 +CTTTTA 8.42160422203e-05 0.000491184951978 +GATTCC 0.000450711781512 0.000262206973135 +ACGGGG 7.32991478584e-05 6.58538250499e-05 +ACGGGA 0.000291637035096 0.000102707800537 +ACGGGC 0.000435116218138 7.61246051036e-05 +TACTAT 0.000282279697072 0.000294227640361 +CTTTTT 0.000109168943619 0.000768496013427 +CGTAGA 4.67866901224e-05 0.000113582744123 +TCACGA 6.08226971591e-05 0.000103916127602 +TCACGC 0.000116966725306 0.000107541108797 +TCACGG 4.36675774476e-05 9.42495110807e-05 +TCTCAT 5.92631408217e-05 0.00022112385292 +TCACGT 7.01800351836e-05 0.000114791071188 +AGTGGA 0.000372733964642 0.000273081916721 +TTCCAC 0.000360257513942 0.000232602960039 +TTCCAA 0.000251088570324 0.000409018711549 +TTCCAG 0.000762623048995 0.000257373664874 +CGAGGC 0.000109168943619 0.000111770253525 +ACCCTT 0.000131002732343 0.00015527002787 +TGAAGT 0.0 0.000264019463732 +ATGCTT 0.000202742323864 0.000256165337809 +TTCCAT 0.000235493006949 0.000358268974813 +ACCCTA 0.000134121845018 0.000129895159502 +ACCCTC 0.000182468091477 0.000105728618199 +TGAAGG 0.0 0.000173394933847 +ACCCTG 0.000617584309616 0.000109353599395 +CTGACT 0.0002167783309 0.000175207424445 +CCCCTT 9.66924929196e-05 0.000132915977165 +AGTTAT 9.66924929196e-05 0.000328060798185 +CTGACG 0.000382091302666 8.88120392875e-05 +CTGACC 0.000793814175743 0.000137749285426 +CTGACA 0.000194944542177 0.000166749134989 +AGTTAA 7.79778168707e-06 0.000421706145733 +CCCCTG 0.000347781063243 0.000104520291134 +AGTTAC 0.000104490274607 0.000209644745801 +CCCCTC 0.000112288056294 0.000111166089993 +AGTTAG 9.35733802448e-06 0.000210853072866 +CCCCTA 6.08226971591e-05 7.73329321687e-05 +ACACAG 0.000290077478759 0.000280936042644 +ACACAA 0.000141919626705 0.000561267921756 +ACACAC 0.000112288056294 0.000709892150768 +AATGTT 0.000300994373121 0.000607788513764 +CTGCAG 0.00183091914012 0.000244082067158 +CATGGG 6.55013661714e-05 9.90828193412e-05 +CATGGA 0.000230814337937 0.000181853223303 +CATGGC 0.000315030380157 0.000141374266621 +AATGTC 0.000377412633654 0.000254352847211 +ACACAT 0.000120085837981 0.00037156057253 +AATGTA 0.0002292547816 0.000486351643718 +AATGTG 0.000853077316565 0.000366727264269 +CATGGT 0.000190265873164 0.000123853524177 +CTGCAT 0.000433556661801 0.00022354050705 +GCACAG 0.000335304612544 0.000201790619878 +ACATTT 0.000154396077404 0.000748558616852 +CGAGAT 0.000210540105551 0.000160103336131 +ATTACT 8.10969295455e-05 0.000300269275686 +ACATTG 0.000213659218226 0.00026824860846 +GTACCA 0.000112288056294 0.00013412430423 +ACATTA 6.55013661714e-05 0.000386664660844 +ACATTC 0.000235493006949 0.000264623627265 +ATTACA 0.000120085837981 0.000364914773671 +ATGCTC 0.000360257513942 0.000166749134989 +ATTACC 0.000230814337937 0.000248915375418 +CGAGAC 9.51329365822e-05 0.000112374417058 +ATTACG 0.000169991640778 0.000179436569173 +AAGTCT 0.000177789422465 0.000198165638682 +ATGCTA 0.000219897443575 0.000194540657487 +GGACAT 0.000201182767526 0.000182457386836 +GCTATA 0.000106049830944 0.000187290695096 +GCTATC 0.000157515190079 0.000137145121893 +AAGTCG 0.00062070342229 0.000212665563464 +AAGTCA 0.000285398809747 0.000354643993618 +GCTATG 0.00018714676049 0.000117811888851 +AAGTCC 0.000628501203977 0.000196353148085 +GGACAG 0.000428877992789 0.000155874191403 +GGACAC 0.00027760102806 0.000178228242108 +GGACAA 0.000213659218226 0.000217498871725 +GCACCT 0.000145038739379 0.000129895159502 +AGGGTT 7.1739591521e-05 0.000146207574882 +GAGGCG 0.000854636872902 0.000127478505372 +TGTTGG 3.89889084353e-05 0.000283352696775 +GAGGCA 0.000547404274432 0.000189103185694 +AGCGCT 0.000165312971766 0.000172790770315 +GAGGCC 0.00108701076718 0.000113582744123 +TGTTGC 9.35733802448e-05 0.00031295670987 +TTCTCA 0.000145038739379 0.000234415450637 +ACTCGA 7.79778168707e-05 0.000189103185694 +TAAAAT 0.0 0.00119261881329 +ACTCGC 0.000137240957692 0.000138353448958 +ACTCGG 6.70609225088e-05 0.000106936945265 +AGCGCA 0.000141919626705 0.000202998946943 +GAGGCT 0.000519332260359 0.000103916127602 +AGCGCC 0.000505296253322 0.000135936794828 +AGGGTG 0.000121645394318 0.000106332781732 +AGGGTA 3.58697957605e-05 9.30411840155e-05 +AGCGCG 0.000101371161932 0.000130499323035 +AGGGTC 6.08226971591e-05 9.18328569504e-05 +TAAAAG 0.0 0.000533476399258 +ACTCGT 9.51329365822e-05 0.000121436870046 +TAAAAC 0.0 0.000754600252178 +TAAAAA 0.0 0.00151222132202 +ACGTTC 0.000198063654851 0.000148020065479 +AGCTGC 0.000343102394231 0.000296040130958 +ACGTTA 5.3024915472e-05 0.000146811738414 +AGCTGA 4.67866901224e-06 0.000300873439219 +ACGTTG 0.000173110753453 0.000166749134989 +AGCTGG 0.000201182767526 0.000248311211886 +TAGGGG 0.0 7.43121145059e-05 +TAAATG 0.0 0.000581809481863 +AGTGCG 0.000212099661888 0.000220519689387 +AGTGCA 0.000257326795673 0.000333498269978 +AGAGTT 5.77035844843e-05 0.000276102734384 +AGTGCC 0.000647215880026 0.00019756147515 +CCAAAA 0.000224576112587 0.000728621220277 +TTCGTG 0.000477224239248 0.000163728317326 +TAGGGT 0.0 0.000107541108797 +GCATAG 9.35733802448e-06 0.000146207574882 +AGCTGT 0.000152836521066 0.000262206973135 +ACGTTT 0.000141919626705 0.000281540206177 +AGTGCT 0.000247969457649 0.000251332029548 +AGAGTC 2.6512457736e-05 0.000132311813632 +AGAGTA 2.80720140734e-05 0.000193332330422 +AGAGTG 9.045426757e-05 0.000177019915043 +TTCGTA 0.000127883619668 0.000226561324713 +GTTAAA 0.000194944542177 0.000523809782737 +CCTGGC 0.000247969457649 0.000165540807924 +GTTAAC 0.000266684133698 0.000227769651778 +CCTGGA 0.000230814337937 0.000163124153793 +CCTGGG 4.05484647727e-05 0.000124457687709 +GTTAAG 0.000385210415341 0.000229582142376 +TTCGTC 0.000269803246372 0.000141374266621 +GCACCC 0.000338423725219 0.000129895159502 +GTCTGG 0.000129443176005 0.000123249360644 +GTCTGC 0.000280720140734 0.000156478354935 +GTTAAT 0.000201182767526 0.000390893805572 +CCTGGT 0.000168432084441 0.000121436870046 +TCTAAA 7.48587041958e-05 0.000387268824376 +GGAAGG 9.66924929196e-05 0.000161915826728 +CCACAT 0.000191825429502 0.000238040431832 +GGAAGC 0.00026512457736 0.000175207424445 +GCACCG 0.000300994373121 0.000111166089993 +GGAAGA 0.000120085837981 0.000233811287104 +GCGTTA 5.77035844843e-05 0.000120832706514 +CAATGA 7.79778168707e-06 0.00026583195433 +CCCGCA 0.000140360070367 0.000104520291134 +CAATGC 0.000127883619668 0.000231394632974 +GCGTTG 0.00017467030979 0.000170978279717 +CAATGG 0.00013880051403 0.000235019614169 +CCACAG 0.000522451373033 0.000205415601073 +GGAAGT 0.000227695225262 0.000203603110476 +CCACAC 0.000160634302754 0.000288186005035 +CCACAA 0.000288517922421 0.000442851869373 +ATTTGT 0.000109168943619 0.000731037874408 +TCCTCG 0.000587952739205 0.000198769802215 +TGTATG 7.48587041958e-05 0.000360081465411 +CAATGT 8.57755985577e-05 0.000295435967426 +GCGTTT 0.000116966725306 0.000248915375418 +TCCTCC 0.000561440281469 0.000224748834115 +TGTATC 5.61440281469e-05 0.000205415601073 +CGTTAG 7.79778168707e-06 9.90828193412e-05 +TAACCG 0.0 0.000143186757219 +TCAAAC 0.000162193859091 0.000324435816989 +TCAGGG 4.05484647727e-05 9.2437020483e-05 +CGTTAC 0.000123204950656 0.000111770253525 +TAACCC 0.0 0.000140770103088 +CGTTAA 6.23822534965e-06 0.000235623777702 +TAACCA 0.0 0.000305102583947 +ACCGCT 0.000208980549213 0.000182457386836 +TCGCGA 0.000177789422465 0.000119624379449 +TAGTGT 0.0 0.000227165488246 +TCAGGA 0.000141919626705 0.000181249059771 +TTCGTT 0.000199623211189 0.0003951229503 +TACCCT 2.02742323864e-05 0.000128082668904 +TAACCT 0.0 0.000137749285426 +CGTTAT 0.000120085837981 0.000145603411349 +GTGAAA 0.000249529013986 0.000491184951978 +GTGAAC 0.000506855809659 0.000198769802215 +TGCATA 0.000148157852054 0.000304498420414 +ACCGCG 0.000115407168969 0.000134728467763 +ACCGCA 0.000176229866128 0.000169165789119 +CCCTAT 0.000246409901311 0.000169769952652 +ACCGCC 0.0006752878941 0.000166144971456 +AGATCC 0.000155955633741 0.00017399909738 +AGGCTT 4.36675774476e-05 0.000167957462054 +CCTTCT 6.70609225088e-05 0.000154061700805 +GGGACG 4.83462464598e-05 6.28330073871e-05 +TGTCGC 0.000154396077404 0.000140165939556 +GTTGCC 0.000332185499869 0.00024468623069 +GTGCCG 0.000483462464598 0.000121436870046 +GTGCCA 0.000396127309703 0.00022354050705 +GTTGCG 9.35733802448e-05 0.000162519990261 +GTGCCC 0.00081408840813 0.000140165939556 +CCGCCG 0.000846839091215 0.000161311663196 +AGGCTA 5.77035844843e-05 0.000108749435862 +CCTTCC 0.000127883619668 0.000125061851242 +AGGCTC 5.92631408217e-05 9.78744922761e-05 +CCGCCC 0.000622262978628 0.000155874191403 +TGTCGA 5.3024915472e-05 0.000179436569173 +CCGCCA 0.000684645232124 0.000192124003357 +AGGCTG 0.000134121845018 0.000103311964069 +GTGCCT 0.000198063654851 0.000134728467763 +TCCAAA 0.000329066387194 0.000462185102415 +GTTGCT 0.000182468091477 0.000261602809602 +GGATAT 0.00022301655625 0.00023985292243 +TCGGGT 0.000208980549213 7.67287686362e-05 +ATTTGA 1.09168943619e-05 0.000514143166216 +GCAGTT 0.000208980549213 0.000285165187372 +GAAGCT 0.000330625943532 0.000182457386836 +GGATAA 9.35733802448e-06 0.000207832255204 +GGATAC 0.000297875260446 0.000153457537272 +TCGGGG 7.64182605332e-05 9.2437020483e-05 +GGATAG 4.67866901224e-06 0.000120832706514 +GAAGCG 0.000297875260446 0.000199373965748 +CCGCCT 0.000279160584397 0.000123853524177 +GCAGTG 0.000388329528016 0.000326248307587 +GAAGCC 0.00053024915472 0.000222332179985 +GCAGTA 9.51329365822e-05 0.00017399909738 +GAAGCA 0.000266684133698 0.000301477602752 +GCAGTC 0.000131002732343 0.000198769802215 +CGCCCG 0.000110728499956 9.54578381458e-05 +GAGAGA 0.000152836521066 0.00028697767797 +CGCCCC 0.00012632406333 0.000142582593686 +CGCCCA 0.000107609387282 0.000208436418736 +AGTTTG 0.00027136280271 0.000314165036936 +ACGCAG 0.000411722873077 0.000229582142376 +ACGCAC 0.000241731232299 0.000185478204498 +ACGCAA 0.000201182767526 0.000238040431832 +CTCGCA 5.14653591346e-05 0.000155874191403 +ACGTAC 0.000168432084441 0.000121436870046 +CCCTAG 1.24764506993e-05 8.21662404293e-05 +ACGCAT 0.000143479183042 0.000193332330422 +AGTTTC 0.000198063654851 0.000328060798185 +GCCGGG 0.000106049830944 6.94788062454e-05 +TACCCG 0.000131002732343 9.66661652109e-05 +GCCGGC 0.000729872365909 0.000122041033579 +CATGTT 9.51329365822e-05 0.000233207123571 +GCCGGA 0.000558321168794 0.000141978430154 +TTGGGG 7.64182605332e-05 0.00013412430423 +AGATCT 7.1739591521e-05 0.000198769802215 +ACGTAG 9.35733802448e-06 0.000108749435862 +GCCACT 0.000506855809659 0.000212061399931 +CATGTA 6.70609225088e-05 0.000187290695096 +GTTGCA 0.000149717408392 0.000299060948621 +CATGTC 0.000159074746416 0.000137749285426 +GCCGGT 0.000357138401268 9.96869828738e-05 +CATGTG 0.000455390450525 0.000183665713901 +GTGCGA 0.000297875260446 0.000193936493954 +TACCCC 9.98116055944e-05 0.000103311964069 +GATTGG 0.000257326795673 0.000203603110476 +GGCCTG 0.000628501203977 0.000100291146406 +GGCCTC 0.000240171675962 0.000160103336131 +GGCCTA 0.000131002732343 8.3978731027e-05 +TTTGTT 0.0002292547816 0.000925578531895 +AATCGG 0.00018090853514 0.000221728016453 +AATCGC 0.000531808711058 0.000289998495633 +AATCGA 0.000227695225262 0.000459768448285 +TTCCCA 0.000129443176005 0.000317790018131 +GGCCTT 0.000110728499956 0.000135936794828 +TCACTA 8.10969295455e-05 0.000133520140698 +TCACTC 7.79778168707e-05 0.000154061700805 +AATCGT 0.000212099661888 0.000276102734384 +AGCCGA 9.66924929196e-05 0.000198165638682 +CCTTCA 0.000110728499956 0.00015527002787 +AGCCGC 0.000212099661888 0.000162519990261 +TAATTG 0.0 0.00050810153089 +AAAAAT 0.000349340619581 0.00171642859603 +AGCCGG 0.000137240957692 0.000130499323035 +GTTTTT 0.00017467030979 0.000869995486898 +TGGTGA 6.23822534965e-06 0.000172186606782 +GATGGA 0.000519332260359 0.000187290695096 +TGGTGC 0.000120085837981 0.000184269877433 +CCAAGT 0.000166872528103 0.000296040130958 +GGGCTG 0.000149717408392 0.000105728618199 +TGGTGG 0.000176229866128 0.000202998946943 +GATGGG 0.00017467030979 0.000166144971456 +AAAAAA 0.000366495739292 0.00304558836768 +AAAAAC 0.000338423725219 0.00125726431127 +GAGCGA 0.000520891816696 0.000214478054062 +AGCCGT 7.32991478584e-05 0.000133520140698 +AAAAAG 0.000823445746154 0.00095034923673 +TGACAG 0.0 0.000149228392544 +CCAAGG 9.8252049257e-05 0.00019514482102 +CTACAT 6.08226971591e-05 0.000201790619878 +TCTCAG 0.000155955633741 0.000142582593686 +CCAAGC 0.000146598295717 0.000275498570851 +TGGTGT 4.21080211102e-05 0.000190915676292 +CCAAGA 7.1739591521e-05 0.000278519388514 +AGAACT 6.86204788462e-05 0.000264623627265 +GCATTA 8.26564858829e-05 0.000254352847211 +CCTTCG 0.000194944542177 0.000165540807924 +TACCAT 0.00018090853514 0.000227769651778 +AGATAG 9.35733802448e-06 0.000168561625587 +CACTGT 8.57755985577e-05 0.000151645046675 +ACCCGA 0.000115407168969 0.00015527002787 +ATGTCT 0.000152836521066 0.000173394933847 +ACCCGC 0.000241731232299 0.000103311964069 +AGATAA 4.67866901224e-06 0.00035524815715 +TACCAC 0.000293196591434 0.000219311362322 +AGAACG 7.1739591521e-05 0.000207228091671 +TACCAA 0.000194944542177 0.000313560873403 +AGAACA 7.95373732081e-05 0.000384852170246 +TACCAG 0.000566118950481 0.000158895009065 +AGAACC 0.000115407168969 0.000172790770315 +ATGTCA 0.000199623211189 0.000207228091671 +CACTGG 0.000165312971766 0.00017641575151 +AGATAT 7.79778168707e-05 0.000354039830085 +TGACAA 0.0 0.000298456785089 +ACCAGG 0.000191825429502 0.00013412430423 +CACTGC 0.000279160584397 0.000196353148085 +ATGTCG 0.000389889084353 0.000149832556077 +CACTGA 6.23822534965e-06 0.000206623928138 +TAGGTT 0.0 0.000163728317326 +GTTTAC 0.000266684133698 0.000254352847211 +AATTAT 0.000137240957692 0.000914703588308 +CTGTTG 0.000424199323776 0.000253748683679 +TGCTAT 0.000148157852054 0.000194540657487 +CTGTTC 0.000566118950481 0.000208436418736 +CGGGTT 6.86204788462e-05 0.000115999398253 +CTGTTA 8.88947112325e-05 0.000167353298521 +AATTAC 0.000193384985839 0.000401768749158 +AATTAA 1.71551197115e-05 0.00127176423606 +AATTAG 9.35733802448e-06 0.000384852170246 +TAGGTC 0.0 7.79370957013e-05 +CGGGTC 8.42160422203e-05 5.13539002683e-05 +CTGTTT 0.000227695225262 0.000379414698453 +CGGGTA 4.05484647727e-05 6.46454979848e-05 +CGGGTG 0.000233933450612 8.69995486898e-05 +CCAAAC 0.000232373894275 0.000392102132637 +CTTCGG 6.55013661714e-05 0.000151040883142 +CACACT 0.000134121845018 0.000282144369709 +TGGATG 0.000260445908348 0.000187894858629 +AGCAAA 0.000436675774476 0.000697808880116 +ATATAT 0.000102930718269 0.0017605325339 +AGCAAC 0.000846839091215 0.000478497517794 +TTAGGC 5.77035844843e-05 0.000137145121893 +AAAGCT 0.00018714676049 0.00035283150302 +AGCAAG 0.000879589774301 0.000265227790798 +AAAGCA 0.000208980549213 0.000636788363327 +ATATAG 3.11911267483e-06 0.000415664510407 +TTAGGT 3.43102394231e-05 0.000143790920751 +ATATAA 9.35733802448e-06 0.000974515778033 +AGCAAT 0.000673728337762 0.000428351944591 +ATATAC 0.000163753415428 0.000638600853925 +ATAGCA 0.000121645394318 0.000264019463732 +ATAGCC 0.00036181707028 0.000175811587977 +TACTTG 0.000282279697072 0.00023985292243 +ATAGCG 0.00013880051403 0.0001317076501 +TCTCAC 7.64182605332e-05 0.000122041033579 +TGCTAA 6.23822534965e-06 0.000297248458024 +ATAGCT 0.00013880051403 0.000247707048353 +TACTTT 0.000304113485796 0.000436206070514 +GTTTTC 0.000221456999913 0.000514747329748 +CGAGTT 9.045426757e-05 0.000209644745801 +CTCGCC 0.000233933450612 0.000138957612491 +CGTACT 4.05484647727e-05 0.000103916127602 +TCCCGT 0.00013880051403 7.67287686362e-05 +ACATAC 0.000127883619668 0.000389081314974 +CTTAAG 0.000363376626617 0.000281540206177 +ACATAA 9.35733802448e-06 0.000540122198116 +CTTAAA 0.000188706316827 0.000613830149089 +AGGGGT 7.48587041958e-05 7.18954603756e-05 +CTTAAC 0.000237052563287 0.000276706897916 +CGTACA 3.89889084353e-05 0.000130499323035 +CGAGTG 0.000237052563287 0.000215082217594 +TTGTTA 4.99058027972e-05 0.000514143166216 +CGAGTA 5.61440281469e-05 0.000154665864337 +CGAGTC 9.66924929196e-05 0.00015285337374 +AGGGGA 7.95373732081e-05 9.66661652109e-05 +CTTAAT 0.000191825429502 0.00037397722666 +AGGGGC 0.000129443176005 9.78744922761e-05 +TATGCA 0.000162193859091 0.000315977527533 +AGGGGG 2.02742323864e-05 7.79370957013e-05 +TCATTA 5.77035844843e-05 0.000338935741771 +CGACTT 8.88947112325e-05 0.000204207274008 +TCGGGC 0.00041016331674 0.00019997812928 +TTGTAA 2.18337887238e-05 0.000604163532568 +TTGTAC 0.000226135668925 0.000291810986231 +GTACCT 5.61440281469e-05 0.000105728618199 +TCATTG 0.000121645394318 0.000233811287104 +TGAATC 0.0 0.000240457085962 +CGACTA 7.48587041958e-05 0.000132915977165 +TGAATA 0.0 0.000512330675618 +CGACTC 0.000121645394318 0.000120832706514 +TGAATG 0.0 0.000386664660844 +AAGTAT 0.000352459732255 0.000411435365679 +CGACTG 0.000417961098427 0.000148624229012 +TTGCCA 0.000335304612544 0.000370352245464 +TTGTAT 0.00013256228868 0.000544351342844 +ATCGTG 0.000495938915297 0.00017641575151 +GCTTCG 0.000188706316827 0.000145603411349 +ATCGTC 0.000293196591434 0.000160103336131 +ATCGTA 0.000129443176005 0.000180644896238 +TGGGAG 0.00036181707028 0.000143790920751 +TGGGAA 0.000176229866128 0.000315977527533 +TGGGAC 0.000221456999913 0.000111770253525 +GCTTCT 0.000137240957692 0.000177019915043 +ATCGTT 0.000212099661888 0.000256769501342 +GATTGA 1.09168943619e-05 0.000257373664874 +TGGGAT 0.000227695225262 0.000155874191403 +GGGCTA 5.45844718095e-05 7.79370957013e-05 +CTAGCC 0.000184027647815 0.000113582744123 +CTAGCA 7.01800351836e-05 0.000175811587977 +CTAGCG 9.20138239074e-05 7.5520441571e-05 +CGGTAG 1.55955633741e-06 9.2437020483e-05 +ACTTAG 4.67866901224e-06 0.000230186305909 +ACTTAA 6.23822534965e-06 0.000557642940561 +CGGTAC 0.000113847612631 7.12912968431e-05 +ACTTAC 0.000116966725306 0.000222936343518 +CGGTAA 1.55955633741e-06 0.000151645046675 +GACCAG 0.000559880725131 0.000152249210207 +GACCAC 0.000224576112587 0.000164332480859 +TTGCCC 0.000389889084353 0.000183665713901 +CTAGCT 0.000101371161932 0.000158895009065 +TTCGAG 0.000965365372859 0.000289998495633 +ACTTAT 7.48587041958e-05 0.000326852471119 +CGGTAT 7.79778168707e-05 0.000119020215916 +TACACA 0.000198063654851 0.000405393730353 +TACACG 0.000310351711145 0.000137749285426 +GCGAGA 5.77035844843e-05 0.000194540657487 +GAGAGC 0.000712717246198 0.000230790469441 +GCGAGC 0.000157515190079 0.000147415901947 +GGCCGT 0.000116966725306 8.69995486898e-05 +GCGAGG 6.55013661714e-05 0.000111166089993 +TTAAGA 5.45844718095e-05 0.000356456484215 +CAGCCG 0.000778218612369 0.000196957311617 +CAGCCA 0.000625382091303 0.000364310610139 +CAGCCC 0.000491260246285 0.000151040883142 +TCCGGG 0.000124764506993 9.54578381458e-05 +GCGAGT 0.000109168943619 0.000161311663196 +CAGCCT 0.000207420992876 0.000138957612491 +GAACTC 0.000255767239336 0.000184269877433 +GAACTA 0.000263565021023 0.000236832104767 +GGACTT 0.000182468091477 0.000163728317326 +CACCTA 8.73351548951e-05 0.000154665864337 +AACTAT 0.000411722873077 0.000425935290461 +CACCTC 0.000140360070367 0.000193936493954 +CACCTG 0.000581714513855 0.000168561625587 +TGATCC 0.0 0.000160707499663 +AACACT 0.000257326795673 0.000288790168568 +TGATCA 0.0 0.000201790619878 +TGATCG 0.0 0.000138957612491 +TGCATG 0.000282279697072 0.000209040582269 +AACTAG 1.24764506993e-05 0.000226561324713 +GATTTA 0.000168432084441 0.00035524815715 +CACCTT 9.20138239074e-05 0.000158290845533 +AACTAC 0.000739229703934 0.000341352395901 +AACTAA 2.33933450612e-05 0.000611413494959 +AACACG 0.00040392509139 0.000194540657487 +AACACA 0.000293196591434 0.000509309857955 +AACACC 0.000616024753278 0.000362498119541 +TGATCT 0.0 0.000184269877433 +CCAGCA 0.000276041471722 0.000351019012422 +CTATAC 0.000106049830944 0.00017399909738 +CAACAG 0.00135525445721 0.000381831352583 +GACAGT 0.000321268605507 0.000164332480859 +CAACAA 0.000636298985665 0.00095034923673 +CCAGCC 0.000324387718182 0.000218103035257 +CAACAC 0.00027760102806 0.000317790018131 +GGCCGG 0.000102930718269 6.82704791802e-05 +CTATAA 1.24764506993e-05 0.000294227640361 +GACAGG 0.000176229866128 0.000101499473471 +CAACAT 0.00026512457736 0.000409622875081 +GACAGC 0.000611346084266 0.000192124003357 +GACAGA 0.000116966725306 0.000224144670583 +GTATTA 5.14653591346e-05 0.000347394031227 +GTATTC 0.000179348978803 0.000220519689387 +GTAAGT 4.99058027972e-05 0.000227165488246 +CCAGCG 0.000343102394231 0.000170978279717 +AGAGGT 5.14653591346e-05 0.000161311663196 +GGTGGC 0.000948210253147 0.000175811587977 +TCCCCT 6.70609225088e-05 0.000118416052383 +GGTGGA 0.000577035844843 0.000193936493954 +CGTCAT 0.00012632406333 0.000135936794828 +GGTGGG 0.000123204950656 0.000114186907655 +AGAGGC 6.70609225088e-05 0.000143790920751 +GTAAGA 2.49529013986e-05 0.000191519839824 +AGAGGA 0.000104490274607 0.000257977828407 +CGCCCT 4.5227133785e-05 0.000102103637004 +AGAGGG 1.71551197115e-05 0.000153457537272 +GTAAGG 5.3024915472e-05 0.000102103637004 +CGTCAA 0.000184027647815 0.000145603411349 +CGTCAC 0.000185587204152 0.000106936945265 +TCCCCC 0.000127883619668 0.000105728618199 +GGTGGT 0.000587952739205 0.000180644896238 +CGTCAG 0.000378972189991 8.88120392875e-05 +GTCCGG 6.39418098339e-05 9.18328569504e-05 +GTCGCA 7.64182605332e-05 0.000153457537272 +GTCGCC 0.000279160584397 0.000132311813632 +CCGTCT 9.20138239074e-05 9.00203663527e-05 +TCGGTA 0.000106049830944 0.000111166089993 +CTCGCG 3.89889084353e-05 6.76663156477e-05 +TCGGTG 0.0006752878941 0.000156478354935 +GTCGCT 9.51329365822e-05 0.000154665864337 +TACCTA 0.000127883619668 0.000169165789119 +GTAACT 0.000102930718269 0.00019997812928 +CCGTCG 0.000255767239336 0.000120228542981 +CCGTCA 9.98116055944e-05 9.2437020483e-05 +CCGTCC 0.00013880051403 8.8207875755e-05 +GGCTGT 0.00017467030979 0.000126874341839 +CGCGTG 0.000282279697072 0.00017883240564 +CTATAT 0.000101371161932 0.000354643993618 +CGCGTC 0.00027760102806 0.000125061851242 +CGCGTA 7.1739591521e-05 9.90828193412e-05 +GTTTTA 0.000107609387282 0.000610205167894 +ATGCAG 0.000888947112325 0.000225352997648 +CCACTA 9.66924929196e-05 0.000146207574882 +CCACTC 0.000151276964729 0.000166749134989 +CGCGTT 0.000159074746416 0.000124457687709 +GGCTGG 0.000279160584397 0.000131103486567 +GGCTGA 1.55955633741e-06 0.00013412430423 +GGCTGC 0.000377412633654 0.000185478204498 +ATGCAT 0.00018714676049 0.000316581691066 +TTTAGA 6.23822534965e-05 0.000343164886499 +TTTCAT 9.35733802448e-05 0.000489976624913 +TTGACC 0.00027136280271 0.000160707499663 +ATGACG 0.000296315704108 0.000135332631295 +GGAGTT 0.000252648126661 0.000172790770315 +ATGACA 0.000205861436539 0.000218103035257 +ATGACC 0.000489700689948 0.000134728467763 +CGGGCC 0.000254207682998 7.43121145059e-05 +GGGCCT 2.02742323864e-05 0.000104520291134 +TAAGAA 0.0 0.000431372762254 +ATGACT 0.000171551197115 0.000187290695096 +GGAGTA 0.000116966725306 0.000124457687709 +GGAGTC 0.000205861436539 0.000141978430154 +GGAGTG 0.000460069119537 0.000186686531564 +GGGCCG 8.42160422203e-05 6.34371709197e-05 +GGGCCC 9.045426757e-05 6.1624680322e-05 +GGGCCA 0.000101371161932 0.000131103486567 +GGCAAG 0.00140983892902 0.000208436418736 +ACGAGT 8.10969295455e-05 0.000181249059771 +AGGCCA 9.35733802448e-05 0.000199373965748 +AGGCCC 0.000110728499956 9.54578381458e-05 +AGGCCG 6.70609225088e-05 6.64579885825e-05 +ACGAGG 7.01800351836e-05 0.000147415901947 +ACGAGC 0.000193384985839 0.000151040883142 +GACCCG 0.000104490274607 8.03537498316e-05 +ACGAGA 6.39418098339e-05 0.00019514482102 +GGCAAC 0.000949769809485 0.00028456102384 +AGGCCT 4.05484647727e-05 9.48536746132e-05 +AGACGG 2.49529013986e-05 0.000123249360644 +GGGTTG 4.21080211102e-05 0.000105124454667 +TTTGGG 9.66924929196e-05 0.000247707048353 +GGGTTA 2.18337887238e-05 9.18328569504e-05 +GGGTTC 6.70609225088e-05 0.000198165638682 +TTTGAT 0.000382091302666 0.000532268072193 +TGAACT 0.0 0.000320810835794 +CTACGA 8.26564858829e-05 0.000169769952652 +ATTGCT 0.000269803246372 0.000293623476828 +GGGTTT 5.45844718095e-05 0.000160707499663 +TACAAG 0.000943531584135 0.000220519689387 +TGCGAG 0.000603548302579 0.000192728166889 +AACGGC 0.000559880725131 0.000207832255204 +ATCCAT 0.000213659218226 0.000274894407319 +ATTGCA 0.000221456999913 0.000425331126928 +TTTGGC 0.000583274070193 0.000406602057418 +ATTGCG 0.000244850344974 0.000167957462054 +TTTGAC 0.000258886352011 0.000275498570851 +TTTGAA 0.000288517922421 0.000664579885825 +CGGGCT 0.000124764506993 9.54578381458e-05 +CTCGTA 4.36675774476e-05 0.000103916127602 +CTCGTC 0.000201182767526 0.000257977828407 +CCCTGG 0.000179348978803 0.000122041033579 +CCCTGA 1.55955633741e-06 9.66661652109e-05 +AAGCTT 0.00027136280271 0.000274894407319 +CCCTGC 0.000255767239336 0.00012929099597 +GTGTAA 6.23822534965e-06 0.000309331728675 +CCCTGT 9.045426757e-05 9.48536746132e-05 +AAGCTC 0.000444473556163 0.000191519839824 +GATATA 0.000305673042133 0.000453726812959 +AAGCTA 0.000371174408304 0.000291810986231 +GATATG 0.000393008197028 0.000213269726997 +AAGCTG 0.00160166435852 0.000292415149763 +TGACGC 0.0 0.000114791071188 +TACTCT 0.000115407168969 0.000179436569173 +CATCGT 0.000152836521066 0.000163124153793 +GTAGTC 0.000102930718269 0.00011056192646 +CAGGGT 0.000324387718182 8.94162028201e-05 +CCAGTC 0.000148157852054 0.000143790920751 +TACGAT 0.000664370999738 0.000201790619878 +CCAGTG 0.000442913999825 0.000224748834115 +TACTCG 0.000282279697072 0.000111166089993 +CATCGA 0.000137240957692 0.000235019614169 +CATCGC 0.00036181707028 0.000161915826728 +TACTCC 0.000419520654764 0.000135936794828 +TACTCA 0.000137240957692 0.000192728166889 +CATCGG 0.000155955633741 0.000210853072866 +CAGGGG 7.79778168707e-05 8.33745674944e-05 +CCAGTT 0.000218337887238 0.00024226957656 +CAGGGC 0.000642537211014 8.69995486898e-05 +AATCTG 0.00089830445035 0.000248915375418 +CGGACT 5.3024915472e-05 0.000106936945265 +AATCTC 0.000363376626617 0.000216894708192 +AATCTA 0.000257326795673 0.000347394031227 +TGAACG 0.0 0.000172790770315 +TCACAC 8.26564858829e-05 0.000234415450637 +TCACAA 0.000135681401355 0.000303290093349 +TAAATT 0.0 0.00112434833411 +GCCATA 0.000310351711145 0.000189103185694 +CGGACG 7.79778168707e-05 0.00011297858059 +ACATCG 0.000311911267483 0.00022354050705 +CGGACA 7.01800351836e-05 0.000163728317326 +CGGACC 7.32991478584e-05 9.12286934178e-05 +GCCATG 0.000949769809485 0.000163124153793 +TTTTAA 2.02742323864e-05 0.00124034773236 +TCACAT 0.000116966725306 0.000260394482537 +ATTAAC 0.000263565021023 0.000395727113832 +ATTAAA 0.000257326795673 0.00114791071188 +ATTAAG 0.000506855809659 0.000415664510407 +TTTTAC 0.00018714676049 0.000455539303557 +TCACTT 8.73351548951e-05 0.000248915375418 +ATTCGT 0.000169991640778 0.000213269726997 +GTGCAG 0.000871791992614 0.000234415450637 +TTACTA 5.3024915472e-05 0.000247707048353 +ATTAAT 0.00027760102806 0.000810183297174 +TACCTG 0.00054272560542 0.000126874341839 +GGTATG 0.000110728499956 0.00011056192646 +CTGAAT 0.000552082943444 0.000352227339487 +GGTATC 0.00013256228868 8.8207875755e-05 +CGAGAG 0.000241731232299 0.000198769802215 +CTGAAA 0.000422639767439 0.000391497969104 +CTGAAC 0.000795373732081 0.000195748984552 +TCGACC 0.000194944542177 0.000114186907655 +GGAACC 0.000324387718182 0.000135936794828 +CTGAAG 0.00135525445721 0.000253144520146 +CATTGC 0.000101371161932 0.000245290394223 +TATGAG 0.00030723259847 0.000206623928138 +CATTGA 6.23822534965e-06 0.000276102734384 +CTAGTT 6.08226971591e-05 0.000202998946943 +CATTGG 7.64182605332e-05 0.000204811437541 +TCAACT 0.000109168943619 0.000300269275686 +ATGTTA 6.08226971591e-05 0.000363102283074 +ACACCG 0.00031970904917 0.00020239478341 +CTGCCA 0.000509974922334 0.00026583195433 +CTGCCC 0.00120241793615 0.000188499022161 +ACACCC 0.000262005464685 0.00019514482102 +ACACCA 0.000276041471722 0.000283352696775 +CTGCCG 0.000709598133523 0.00017399909738 +CTAGTG 0.000151276964729 0.000146207574882 +TCAACC 0.000127883619668 0.000201186456345 +ATGTTC 0.000456950006862 0.000250123702483 +CTAGTC 0.000112288056294 0.000107541108797 +TCAACG 0.00018090853514 0.000221728016453 +CTAGTA 3.89889084353e-05 0.00010814527233 +CATTGT 7.79778168707e-05 0.000287581841503 +TATGAC 0.000237052563287 0.000122041033579 +GTAATG 0.000182468091477 0.000198165638682 +ACACCT 0.000118526281643 0.000221728016453 +CTGCCT 0.000219897443575 0.000138353448958 +CCTCGT 7.64182605332e-05 0.000180040732705 +TTGTGT 6.55013661714e-05 0.000444060196438 +AGACTG 0.000131002732343 0.000120228542981 +AGACTC 4.83462464598e-05 0.000117207725318 +AGACTA 3.74293520979e-05 0.000140165939556 +CCTCGG 4.67866901224e-05 0.000121436870046 +CCTCGC 0.000118526281643 0.000118416052383 +CCCGAC 0.000371174408304 9.12286934178e-05 +CCTCGA 6.86204788462e-05 0.000134728467763 +CGAGGA 0.000160634302754 0.000215686381127 +AGACTT 4.21080211102e-05 0.000222332179985 +CGAGGG 2.33933450612e-05 8.88120392875e-05 +CACCGT 7.1739591521e-05 0.000112374417058 +ACTTTA 7.64182605332e-05 0.000409622875081 +ACTTTG 0.000276041471722 0.00035041484889 +TAGCTA 0.0 0.000213269726997 +GACCTG 0.000587952739205 0.000100291146406 +GTCGCG 4.05484647727e-05 0.000109957762927 +GACCTA 0.000131002732343 0.000100291146406 +GACCTC 0.000202742323864 0.000132311813632 +CACCGG 8.26564858829e-05 8.88120392875e-05 +CTATTG 0.000151276964729 0.000199373965748 +CACCGA 9.51329365822e-05 0.00024710288482 +ACTTTT 0.000120085837981 0.000682704791802 +GACCTT 0.000131002732343 0.000122645197111 +GGACGC 0.000354019288593 8.51870580921e-05 +GGACGG 0.000109168943619 8.45828945596e-05 +CTATTA 3.11911267483e-05 0.000254957010744 +CACAGC 0.000411722873077 0.000261602809602 +CTTATC 0.000166872528103 0.000207832255204 +CACAGA 7.48587041958e-05 0.000288186005035 +CTTATA 0.000113847612631 0.000297248458024 +CACAGG 8.57755985577e-05 0.000132915977165 +CTTATG 0.000157515190079 0.000164936644391 +ACTCAT 0.000109168943619 0.000206019764606 +CGTATA 2.80720140734e-05 0.00017641575151 +GACGTA 0.000113847612631 8.45828945596e-05 +CGTATC 0.000115407168969 9.2437020483e-05 +CTATTC 0.000168432084441 0.000178228242108 +GAGGAC 0.00144882783746 0.000138353448958 +CGTATG 8.88947112325e-05 0.000163728317326 +AGCGAT 0.000631620316652 0.000216894708192 +TTAACA 7.32991478584e-05 0.000450705995296 +ACTCAC 9.66924929196e-05 0.000184269877433 +TTAACC 0.000131002732343 0.000244082067158 +ACTCAA 0.000146598295717 0.000338331578238 +ACTCAG 0.000255767239336 0.00015527002787 +CTTATT 0.000140360070367 0.000346789867694 +CACAGT 0.0002292547816 0.000195748984552 +AGCGAC 0.000517772704021 0.000167957462054 +TAAACA 0.0 0.000671829848216 +AGCGAA 0.000502177140647 0.000384248006713 +GAGGAT 0.00166560616836 0.000177019915043 +AGCGAG 0.000731431922247 0.000208436418736 +CGTATT 8.88947112325e-05 0.000209644745801 +TAAACG 0.0 0.000308727565142 +AGTTCC 0.000325947274519 0.000222332179985 +GTATGT 2.33933450612e-05 0.000377602207855 +AGTTCA 0.000146598295717 0.000262206973135 +TACTTA 5.14653591346e-05 0.000415664510407 +AGTTCG 0.000308792154808 0.00022354050705 +TAGCCC 0.0 0.000111770253525 +CTGTGA 9.35733802448e-06 0.000185478204498 +CGGGGT 7.1739591521e-05 7.12912968431e-05 +TAGGAC 0.0 0.000102103637004 +GCAAAG 0.000280720140734 0.000361893956008 +TAGGAA 0.0 0.000236832104767 +GCAAAA 0.000185587204152 0.000648267470446 +TAGGAG 0.0 0.000121436870046 +GCAAAC 0.000188706316827 0.000436206070514 +CGGGGC 0.000127883619668 8.15620768967e-05 +CGGGGA 9.51329365822e-05 0.000106332781732 +CTGTGT 0.000118526281643 0.000200582292813 +CGGGGG 2.18337887238e-05 4.8937246138e-05 +GTATGC 6.86204788462e-05 0.000146207574882 +AGTTCT 0.000123204950656 0.000248915375418 +GCAAAT 0.000219897443575 0.000518372310944 +TAGGAT 0.0 0.000134728467763 +TAATTA 0.0 0.00079991251712 +CTATTT 0.00012632406333 0.000436810234047 +TGCTTT 0.00018090853514 0.000376998044323 +GTCTAT 0.000198063654851 0.000153457537272 +GTAATT 0.000121645394318 0.000479101681327 +GTTACC 0.00022301655625 0.000114791071188 +GTTACA 0.000113847612631 0.000214478054062 +TAATTC 0.0 0.000383039679648 +GTTACG 0.000120085837981 0.000111770253525 +TATCGC 0.000338423725219 0.000172186606782 +TATAGT 4.83462464598e-05 0.00032926912525 +GTCTAA 9.35733802448e-06 0.000194540657487 +AGGACG 9.045426757e-05 0.000120228542981 +GTCTAC 0.000491260246285 0.000116603561786 +TGCTTC 0.000341542837893 0.000188499022161 +TTCAAA 0.000290077478759 0.000845828945596 +GGCGTT 0.000329066387194 0.000144395084284 +GGGCTC 6.70609225088e-05 8.69995486898e-05 +TATAGC 0.000107609387282 0.000204207274008 +TATCGT 0.000107609387282 0.000163124153793 +TATAGA 5.3024915472e-05 0.000367331427802 +AGTGGG 0.000135681401355 0.000184269877433 +TATAGG 6.86204788462e-05 0.000192124003357 +GTGGCG 0.000486581577273 0.00017883240564 +GTTACT 0.000120085837981 0.000157686682 +GCTCTC 0.00018090853514 0.000202998946943 +AACCTT 0.000165312971766 0.000201790619878 +GATGGC 0.00098875871792 0.000179436569173 +GCTCTG 0.000608226971591 0.00017641575151 +CCACGT 0.000176229866128 0.000121436870046 +CAATAT 0.0002292547816 0.000462789265947 +CAGGAG 0.00169367818243 0.000210248909334 +GAATGG 0.000204301880201 0.00021870719879 +GAATGA 6.23822534965e-06 0.000264623627265 +ACTACT 0.000112288056294 0.000261602809602 +GAATGC 0.000218337887238 0.000245894557755 +CCACGA 0.000109168943619 0.000126874341839 +CAATAC 0.000169991640778 0.00024468623069 +CCACGC 0.000182468091477 0.000237436268299 +CAATAA 7.79778168707e-06 0.000653704942239 +GTTCCG 0.000198063654851 0.000119624379449 +CAATAG 1.40360070367e-05 0.000230186305909 +CCACGG 8.10969295455e-05 0.000141374266621 +AACCTA 0.000160634302754 0.000213873890529 +GAATGT 8.73351548951e-05 0.000280936042644 +ACTACC 0.000154396077404 0.000146811738414 +GGCTTC 0.00063317987299 0.000151040883142 +ACTACA 0.000134121845018 0.000262811136667 +ACTACG 9.8252049257e-05 0.000130499323035 +GGCTTG 0.000311911267483 0.000169165789119 +CGTTGA 3.11911267483e-06 0.000186082368031 +AGTCAG 0.000302553929458 0.000162519990261 +CGTTGC 0.000124764506993 0.000177019915043 +TAACAC 0.0 0.000201186456345 +TCCTAC 0.00039768686604 0.000108749435862 +AGTCAC 0.000149717408392 0.000160103336131 +CGTTGG 9.35733802448e-05 0.000145603411349 +AGTCAA 0.000171551197115 0.000315977527533 +TCATCG 0.000344661950568 0.000182457386836 +TGAGGG 0.0 0.000122041033579 +TCATCC 0.000258886352011 0.00017399909738 +GAGCGG 0.000499058027972 0.000166144971456 +CTTTCT 7.32991478584e-05 0.000267644444928 +AGTCAT 0.000131002732343 0.000206623928138 +TCCTAT 0.000232373894275 0.000166749134989 +TAACAT 0.0 0.000335914924108 +CGTTGT 5.61440281469e-05 0.000175207424445 +CTTTCC 0.00022301655625 0.000210853072866 +CTTTCA 0.000110728499956 0.000303894256882 +CTTTCG 0.000191825429502 0.000238040431832 +GAGCGC 0.000912340457387 0.000160707499663 +GTTGAT 0.000213659218226 0.000266436117863 +CGACCA 0.000152836521066 0.000229582142376 +CGACCC 0.000235493006949 9.66661652109e-05 +GCATAC 0.000102930718269 0.000203603110476 +CGACCG 0.000149717408392 8.15620768967e-05 +CCTTAT 6.39418098339e-05 0.000140165939556 +GTTGAC 0.00018090853514 0.000175811587977 +GTTGAA 0.0002167783309 0.000334706597043 +ACTGGG 9.66924929196e-05 0.000109957762927 +GTTGAG 0.000329066387194 0.000209040582269 +TTAGGG 1.71551197115e-05 0.000118416052383 +CCTTAC 7.1739591521e-05 9.48536746132e-05 +TTCGAT 0.000776659056032 0.000386060497311 +CCTTAA 4.67866901224e-06 0.000228977978843 +CCTTAG 6.23822534965e-06 9.66661652109e-05 +CGACCT 6.86204788462e-05 0.000131103486567 +CAACTC 0.000179348978803 0.000231998796506 +CAACTA 0.000171551197115 0.000311144219273 +CAACTG 0.000709598133523 0.000323831653457 +AATAGG 8.26564858829e-05 0.000218103035257 +GATGGT 0.000461628675874 0.000135936794828 +GGGGTT 4.21080211102e-05 8.94162028201e-05 +GGATGT 0.000102930718269 0.00015043671961 +AATAGT 0.00018090853514 0.000335914924108 +GGGCTT 4.83462464598e-05 0.0001317076501 +CAACTT 0.000149717408392 0.000435601906982 +GGATGC 0.000198063654851 0.000132915977165 +GGATGA 4.67866901224e-06 0.000183061550368 +GGATGG 0.000148157852054 0.000142582593686 +GGGGTA 3.74293520979e-05 7.43121145059e-05 +TCTCCG 0.000157515190079 0.000140770103088 +GAGTCC 0.000589512295542 0.000146207574882 +AAACTG 0.000706479020848 0.000477289190729 +TCTCCC 0.000127883619668 0.000125666014774 +AAACTA 0.000221456999913 0.000680288137672 +TCTCCA 0.000149717408392 0.000201790619878 +AAACTC 0.000212099661888 0.000326248307587 +ACGCGA 0.000148157852054 0.000125061851242 +AGTACG 7.79778168707e-05 0.000105728618199 +ACGCGC 0.000226135668925 9.30411840155e-05 +AGTACC 0.000129443176005 0.000116603561786 +ACGCGG 0.000149717408392 9.84786558086e-05 +AGTACA 8.10969295455e-05 0.000220519689387 +AAACTT 0.000182468091477 0.000566101230017 +CCCTTC 0.00045227133785 0.000128686832437 +TCTCCT 7.64182605332e-05 0.000168561625587 +CCCTTG 0.000212099661888 9.66661652109e-05 +TTCTAT 0.00031970904917 0.000352227339487 +AGTACT 8.26564858829e-05 0.000227165488246 +ACGCGT 0.000123204950656 0.000107541108797 +GCCGAA 0.000616024753278 0.000216894708192 +GTGGAG 0.00167496350638 0.00019514482102 +GCCGAC 0.000544285161757 0.000175207424445 +GTGGAC 0.00108233209816 0.000138353448958 +GCCGAG 0.00122581128121 0.000169165789119 +GTGGAA 0.000639418098339 0.000301477602752 +TATCAT 0.000134121845018 0.000242873740092 +GTGGAT 0.000862434654589 0.000175811587977 +GCCATC 0.00100747339397 0.000232602960039 +GCCGAT 0.000754825267308 0.000147415901947 +CCTATT 0.000109168943619 0.000204811437541 +ACCCGG 0.000101371161932 0.000100895309939 +ACCGAG 0.000670609225088 0.000145603411349 +AAATCG 0.000380531746329 0.000555830449963 +CACGCG 0.000106049830944 0.000111166089993 +TTATCG 9.35733802448e-05 0.000210853072866 +ACCGAC 0.000383650859004 0.000128082668904 +AAATCC 0.000396127309703 0.000430164435189 +ACCGAA 0.000455390450525 0.000363706446606 +AAATCA 0.000226135668925 0.000822266567826 +GGCTTT 0.000304113485796 0.000210248909334 +CTTTGA 9.35733802448e-06 0.000321414999326 +AGATAC 6.86204788462e-05 0.000277311061449 +TCCCGA 0.000104490274607 0.000153457537272 +CACGCT 8.88947112325e-05 0.000175811587977 +AAATCT 0.00018714676049 0.00050568487676 +ACCGAT 0.000524010929371 0.000192124003357 +GTAGTT 8.57755985577e-05 0.000226561324713 +ACCAGT 0.000393008197028 0.000173394933847 +GATGAT 0.000966924929196 0.000287581841503 +GGAGCA 0.000477224239248 0.000253748683679 +GGAGCC 0.000665930556075 0.000138353448958 +CCGGCT 0.000268243690035 0.000123853524177 +CCAAAT 0.000268243690035 0.000522601455672 +GGAGCG 0.000327506830857 0.000174603260912 +AAAACT 0.000213659218226 0.000869391323366 +GATGAC 0.000918578682736 0.000207832255204 +TGTCCC 0.000215218774563 0.000137749285426 +GATGAA 0.000751706154633 0.000294831803893 +GATGAG 0.00144726828112 0.000206623928138 +AAAACC 0.000374293520979 0.000625913419741 +AAAACA 0.00022301655625 0.00125182683948 +AAAACG 0.000300994373121 0.000647059143381 +GGAGCT 0.0004460331125 0.000173394933847 +CCAAAG 0.000472545570236 0.000372768899595 +TCGCGG 0.000129443176005 9.2437020483e-05 +CTAGAG 0.000279160584397 0.000120832706514 +TCGCGC 0.000304113485796 0.000108749435862 +CTACCG 9.20138239074e-05 9.72703287435e-05 +GCCACA 0.000525570485708 0.000267644444928 +AGATCA 7.32991478584e-05 0.000231998796506 +GCCACC 0.00136617135157 0.000203603110476 +AGAAAT 0.000188706316827 0.000686329772998 +TCCCGG 0.000141919626705 0.000151645046675 +GCGCTT 9.8252049257e-05 0.000158895009065 +GCCACG 0.000566118950481 0.000160707499663 +AGATCG 0.000106049830944 0.000217498871725 +ACCAGC 0.000695562126486 0.000249519538951 +TCGCGT 0.000160634302754 0.000158290845533 +GTGCAA 0.000360257513942 0.000291206822698 +TCCCAT 0.000213659218226 0.000266436117863 +ACCCGT 0.000118526281643 9.90828193412e-05 +AGAAAG 0.000207420992876 0.000378206371388 +CTAGAC 0.000151276964729 9.36453475481e-05 +AGAAAC 0.000194944542177 0.000466414247143 +ATGTCC 0.000559880725131 0.000145603411349 +AGAAAA 0.000118526281643 0.00101076558999 +CTACCC 0.000179348978803 9.00203663527e-05 +ATGTAC 0.000464747788549 0.00028456102384 +GACCGA 0.000102930718269 0.000139561776023 +ATGTAA 7.79778168707e-06 0.00046581008361 +TATGTG 0.000538046936408 0.000367331427802 +ATGTAG 1.40360070367e-05 0.000212061399931 +CCTATA 5.77035844843e-05 0.000161311663196 +CGAAGT 9.8252049257e-05 0.000192728166889 +CCGGCA 0.000272922359047 0.000154665864337 +GACGAC 0.000917019126399 0.000186082368031 +CCTATC 5.45844718095e-05 0.000123249360644 +ATGTAT 0.00018090853514 0.00064222583512 +ATTAGA 5.14653591346e-05 0.000269456935525 +GGCGTC 0.000413282429414 9.42495110807e-05 +GACCGG 0.000101371161932 7.12912968431e-05 +AGCACT 0.000285398809747 0.000256165337809 +TTAGAA 7.32991478584e-05 0.000328664961717 +CGGCTG 0.000316589936495 0.000139561776023 +TTAGAC 7.64182605332e-05 0.000123249360644 +CGGCTC 0.000135681401355 0.000135936794828 +TTAGAG 8.57755985577e-05 0.000189707349226 +CGGCTA 7.64182605332e-05 0.000125061851242 +AGCACC 0.000690883457474 0.000186686531564 +AGCACA 0.00030723259847 0.000278519388514 +AGCACG 0.000268243690035 0.000133520140698 +GGTCGG 7.79778168707e-05 8.57912216247e-05 +CGGCTT 4.5227133785e-05 0.000144395084284 +TTAGAT 0.000140360070367 0.000361289792476 +AAAGAC 0.000210540105551 0.000299665112154 +CGAAGC 8.73351548951e-05 0.000192124003357 +AAAGAA 0.000299434816783 0.000970286633305 +AAAGAG 0.000435116218138 0.000412643692744 +ATATCA 0.000120085837981 0.000372164736062 +GCGCTG 0.000545844718095 0.000160707499663 +TCGCTA 0.000157515190079 0.000126270178307 +TGTGAG 0.000159074746416 0.000194540657487 +TGTGAA 0.000123204950656 0.000389081314974 +CTACCT 5.14653591346e-05 0.000122041033579 +TGTGAC 0.000129443176005 0.000164936644391 +ATATCT 8.73351548951e-05 0.000380018861985 +CCAGCT 0.000375853077317 0.000301477602752 +AAAGAT 0.000318149492832 0.000447081014101 +TGTGAT 0.000140360070367 0.000298456785089 +TTATTG 7.48587041958e-05 0.000503872386162 +TTATTA 5.14653591346e-05 0.000810183297174 +GAAAGC 0.000335304612544 0.000347394031227 +TTATTC 7.01800351836e-05 0.000359477301878 +ACATCT 0.000148157852054 0.000218103035257 +TTTTAT 0.000116966725306 0.00127538921725 +CTTACT 7.79778168707e-05 0.00015285337374 +AGACGC 9.045426757e-05 0.000109353599395 +TACAAA 0.000338423725219 0.000678475647074 +AGACGA 6.86204788462e-05 0.000216894708192 +AAGTGA 2.96315704108e-05 0.000433789416384 +CCTCTG 0.000263565021023 0.000166144971456 +AGGTGG 2.80720140734e-05 0.000151040883142 +CCTCTC 5.45844718095e-05 0.000164332480859 +AGGTGC 5.92631408217e-05 0.000121436870046 +CCTCTA 7.64182605332e-05 0.000115999398253 +AGGTGA 4.67866901224e-06 0.000157686682 +CTTACG 9.20138239074e-05 0.000106936945265 +TCCACA 0.000349340619581 0.000338935741771 +TTTTAG 7.79778168707e-06 0.000562476248821 +AGACGT 7.79778168707e-05 0.000111770253525 +CTTACC 0.000185587204152 0.000105728618199 +ACATCA 0.000204301880201 0.000313560873403 +CTTACA 7.1739591521e-05 0.000238040431832 +ACATCC 0.000268243690035 0.000188499022161 +AGGTGT 2.18337887238e-05 0.000129895159502 +CCTCTT 7.01800351836e-05 0.000185478204498 +GCGTGA 6.23822534965e-06 0.0001317076501 +CCCGGC 0.00045227133785 0.000120228542981 +CCCGGA 0.00031970904917 0.000114186907655 +CCCGGG 8.57755985577e-05 0.000126270178307 +TATGAA 0.000205861436539 0.000457955957687 +TGGAAT 0.000177789422465 0.000303290093349 +TAGGTG 0.0 0.000112374417058 +TTGTGC 0.000160634302754 0.000296040130958 +TATGAT 0.000226135668925 0.000375789717258 +TTGTGG 0.000141919626705 0.000251332029548 +CCCGGT 0.000198063654851 8.88120392875e-05 +GGCGTG 0.000541166049082 0.000141374266621 +TAGGTA 0.0 0.000212665563464 +GGTTTT 0.000116966725306 0.000378206371388 +TATCAC 0.000182468091477 0.000166144971456 +TGGAAA 0.000141919626705 0.000497226587304 +TGAGGA 0.0 0.000162519990261 +AAGAGG 0.000238612119624 0.000209040582269 +TGAGGC 0.0 0.000113582744123 +AAGAGA 0.000176229866128 0.000355852320683 +AAGAGC 0.000728312809572 0.000268852771993 +AAGCGT 0.000388329528016 0.000199373965748 +GCTTAG 6.23822534965e-06 0.000160103336131 +GCTTAC 0.000127883619668 0.000138353448958 +GCTTAA 7.79778168707e-06 0.000325039980522 +TGATTC 0.0 0.000250727866016 +AAGCGC 0.000792254619406 0.000227769651778 +AAGAGT 0.000343102394231 0.000297852621556 +AAGCGA 0.000508415365997 0.00035283150302 +AAGCGG 0.000475664682911 0.00019997812928 +GCTTAT 0.00013256228868 0.000248311211886 +GTTCGG 6.39418098339e-05 0.000145603411349 +CTGCTA 0.000279160584397 0.000165540807924 +GCGTGT 4.5227133785e-05 0.000249519538951 +CTGCTC 0.00098875871792 0.000219915525855 +ACTTCT 0.000104490274607 0.000234415450637 +GACCGT 0.000121645394318 7.73329321687e-05 +CTGCTG 0.00183559780914 0.000269456935525 +CGGTCA 4.36675774476e-05 9.66661652109e-05 +GGTCGT 0.000201182767526 9.18328569504e-05 +CGGTCC 8.88947112325e-05 9.30411840155e-05 +CTAGAA 0.000149717408392 0.000227165488246 +CGGTCG 6.70609225088e-05 9.06245298853e-05 +ACTTCG 0.000185587204152 0.000207832255204 +GACCGC 0.000247969457649 0.000163124153793 +TTTTGG 0.000115407168969 0.000574559519472 +ACTTCC 0.000224576112587 0.000172186606782 +CTGCTT 0.000335304612544 0.000177019915043 +ACTTCA 0.000159074746416 0.000282144369709 +CTAGAT 0.000179348978803 0.000131103486567 +CACAAA 0.00030723259847 0.000608392677296 +CGGTCT 3.11911267483e-05 8.3978731027e-05 +GGTCGC 0.000430437549126 0.000105728618199 +GGTCGA 0.000124764506993 9.78744922761e-05 +CGTCGC 0.000378972189991 0.000138353448958 +CAGCAT 0.000589512295542 0.000258581991939 +TGAAGC 0.0 0.000235623777702 +CGTCGG 0.000109168943619 0.000187290695096 +TGGTTG 0.000129443176005 0.000299665112154 +GCGTGC 7.32991478584e-05 0.000132915977165 +TGCTCA 9.35733802448e-05 0.000181249059771 +TTCATC 0.00068152611945 0.000235623777702 +TGCTCC 0.00036181707028 0.000181249059771 +TTCATA 0.000198063654851 0.000391497969104 +TTCATG 0.00048814113361 0.000184269877433 +TGCTCG 0.000185587204152 0.000184874040966 +GTACAA 9.045426757e-05 0.000251332029548 +CAGCAG 0.00409383538571 0.000655517432837 +TACACT 0.000120085837981 0.000226561324713 +GCTTTG 0.000360257513942 0.000231394632974 +CAGCAC 0.000795373732081 0.00024468623069 +CAGCAA 0.0015174483163 0.000569122047679 +GGGAGT 2.96315704108e-05 0.00010814527233 +GTACAC 8.42160422203e-05 0.000151645046675 +TGATTT 0.0 0.000700225534247 +TTCATT 0.000352459732255 0.000499643241434 +GTAGCC 0.000215218774563 0.00012929099597 +GCTGCC 0.000870232436277 0.000244082067158 +GCTGCA 0.000399246422378 0.000289998495633 +AACTCT 0.000179348978803 0.000270061099058 +GCTGCG 0.00027136280271 0.00017641575151 +TGGCCA 0.000131002732343 0.000360685628943 +GTAGCA 8.57755985577e-05 0.000160103336131 +TCATCT 0.000110728499956 0.000201790619878 +TGCTCT 9.8252049257e-05 0.000235019614169 +AACTCA 0.000243290788636 0.000308727565142 +TGGCCT 3.74293520979e-05 0.000204207274008 +AACTCC 0.000564559394144 0.000179436569173 +GCTGCT 0.000619143865953 0.000298456785089 +AACTCG 0.000573916732168 0.000189103185694 +CTACAA 0.000101371161932 0.000285165187372 +GGATCC 0.000550523387107 0.000168561625587 +TGAAGA 0.0 0.000349810685357 +AATATT 0.00030723259847 0.00117026476258 +GTTCGA 9.51329365822e-05 0.000326248307587 +CAACCT 9.045426757e-05 0.000143790920751 +TGGCCG 0.000101371161932 0.000178228242108 +GGCACG 0.000276041471722 0.000102707800537 +GGAGGA 0.000683085675787 0.000280331879112 +GGCACA 0.000300994373121 0.000182457386836 +GACAAT 0.000609786527929 0.000245894557755 +GGCACC 0.000790695063068 0.000126270178307 +CAACCG 0.000285398809747 0.000165540807924 +ACGACC 0.000191825429502 0.00017883240564 +AATATG 0.000383650859004 0.00043983105171 +CAACCC 0.0002292547816 0.000167353298521 +TTAGGA 6.23822534965e-05 0.000192124003357 +AATATC 0.000354019288593 0.000433789416384 +GACAAA 0.000466307344887 0.000388477151441 +GGCACT 0.000350900175918 0.000149228392544 +GACAAC 0.0009045426757 0.000228373815311 +ACGACA 0.000212099661888 0.000221728016453 +GACAAG 0.0014254344924 0.000192728166889 +TGGCCC 9.35733802448e-05 0.000159499172598 +GCAATC 0.000121645394318 0.000256769501342 +GCAATA 8.42160422203e-05 0.000366123100736 +GAATTT 0.000244850344974 0.000586642790124 +TTGAAC 0.000336864168881 0.000334706597043 +CGATGG 6.55013661714e-05 0.000132311813632 +GTTCCC 0.000255767239336 0.00015285337374 +CGATGC 7.64182605332e-05 0.000162519990261 +GTAAAT 0.00017467030979 0.000548580487572 +CGATGA 3.11911267483e-06 0.000193332330422 +GAATTA 0.000109168943619 0.000363102283074 +GAATTC 0.000382091302666 0.000275498570851 +GAATTG 0.000407044204065 0.000331081615847 +GTAAAC 0.000193384985839 0.000264019463732 +CGATGT 5.3024915472e-05 0.000175811587977 +GTAAAA 0.000140360070367 0.000631350891534 +GTAAAG 0.000293196591434 0.000259186155472 +TCCCAG 0.000469426457561 0.000163728317326 +GGATTT 0.000291637035096 0.000280936042644 +GTGCGT 0.000266684133698 0.000216894708192 +ACGCCG 0.000414841985752 0.000133520140698 +GGATTC 0.000514653591346 0.000187290695096 +GGATTA 0.000106049830944 0.000184269877433 +GGATTG 0.000360257513942 0.000165540807924 +AGCGGC 0.000653454105376 0.000190311512759 +ACGCCA 0.000354019288593 0.000148020065479 +AAAGCC 0.000272922359047 0.000346789867694 +TCTGTG 0.0002292547816 0.000254957010744 +CTATCC 0.000219897443575 0.000131103486567 +GTCCCG 5.14653591346e-05 9.12286934178e-05 +TACAAT 0.000511534478672 0.000443456032905 +AACCGG 0.000149717408392 0.000113582744123 +CTCCTT 0.000123204950656 0.000138353448958 +GGCGGA 0.000782897281381 0.000169165789119 +AACCGC 0.000333745056206 0.000168561625587 +AACCGA 0.000173110753453 0.000297248458024 +GTGGGA 0.000372733964642 0.000131103486567 +TACCCA 0.000106049830944 0.000192124003357 +TCTGTT 0.00012632406333 0.000282748533242 +AAAGCG 0.00018714676049 0.000384248006713 +CTCCTG 0.000433556661801 0.000166144971456 +AACCGT 0.000145038739379 0.000140770103088 +CTCCTA 8.42160422203e-05 9.00203663527e-05 +CTCCTC 0.000199623211189 0.000228977978843 +GGCGGT 0.000665930556075 0.000123249360644 +AACAAG 0.00124452595726 0.000425331126928 +CCCACG 0.000477224239248 0.000149228392544 +AACAAC 0.00147845940787 0.000833141511412 +AACAAA 0.000483462464598 0.00135151382236 +TACTTC 0.000575476288505 0.000199373965748 +AGCCTT 0.000116966725306 0.000156478354935 +CCGATT 0.000179348978803 0.000207832255204 +CCCACT 0.000389889084353 0.000187894858629 +AACAAT 0.000892066225 0.00070807966017 +GACGCT 0.000148157852054 8.15620768967e-05 +AGCGGT 0.000288517922421 0.000149228392544 +CCGATA 6.70609225088e-05 0.000194540657487 +AGCCTG 0.000531808711058 0.000123249360644 +AGCCTA 0.000134121845018 0.000127478505372 +AGCCTC 0.000148157852054 0.000115999398253 +GTACCC 0.000140360070367 9.18328569504e-05 +CTCCCG 5.77035844843e-05 7.18954603756e-05 +TAGGCT 0.0 0.000105124454667 +ACGAAT 0.000237052563287 0.000297248458024 +CGCCTT 0.000145038739379 0.00015285337374 +AGGCAT 6.86204788462e-05 0.000178228242108 +CAGAGT 0.000339983281556 0.000171582443249 +GCATCT 0.000185587204152 0.000192124003357 +CTCCCA 5.3024915472e-05 0.000144395084284 +ACGAAA 0.00018090853514 0.000587246953656 +CGCCTC 0.000208980549213 0.000126874341839 +AGGCAA 0.000102930718269 0.000282748533242 +CGCCTA 0.000113847612631 9.78744922761e-05 +AGGCAG 0.000221456999913 0.000270061099058 +CGCCTG 0.000656573218051 0.000132311813632 +ACGAAG 0.000268243690035 0.000203603110476 +CAGAGG 0.000212099661888 0.000208436418736 +GCATCC 0.000383650859004 0.000174603260912 +GCATCA 0.000198063654851 0.000198165638682 +CAGAGC 0.000667490112413 0.000190311512759 +CGGCCA 0.000112288056294 0.00022112385292 +CAGAGA 0.000166872528103 0.000236227941234 +CGGCAC 0.00018714676049 0.000121436870046 +CCTAGA 4.67866901224e-05 0.000111166089993 +CCTAGC 7.64182605332e-05 9.72703287435e-05 +TTTGCT 0.000219897443575 0.000436810234047 +TAGCTC 0.0 0.000189103185694 +TGCGGT 0.000154396077404 0.000125666014774 +CCTAGG 2.49529013986e-05 5.07497367357e-05 +TAAGCA 0.0 0.000369748081932 +GTCTAG 1.8714676049e-05 0.000146811738414 +TGCGGC 0.000419520654764 0.000170374116184 +TGCGGA 0.000244850344974 0.000149832556077 +CCTAGT 5.92631408217e-05 8.8207875755e-05 +TGCGGG 6.23822534965e-05 9.66661652109e-05 +TAAGCG 0.0 0.000171582443249 +TGAGTT 0.0 0.0002634153002 +TAGCTG 0.0 0.000215686381127 +ATCGCT 0.000179348978803 0.000194540657487 +TCTCGT 7.95373732081e-05 0.000186082368031 +ATCGCC 0.000625382091303 0.000193936493954 +TGAGTG 0.0 0.000205415601073 +ATCGCA 0.000185587204152 0.000248915375418 +TGAGTA 0.0 0.000241665413027 +ATCGCG 0.000120085837981 0.000144999247816 +TGAGTC 0.0 0.000106332781732 +AAGGTG 0.00111508278125 0.000188499022161 +ACGGCT 0.000237052563287 0.00011297858059 +CATCAT 0.000366495739292 0.000288790168568 +AAGGTA 0.000205861436539 0.000149832556077 +TTTATT 0.000246409901311 0.00128143085258 +ACGGCA 0.000266684133698 0.000222332179985 +CATCAC 0.000363376626617 0.000204811437541 +ACGGCC 0.000561440281469 0.000105124454667 +CATCAA 0.000208980549213 0.000365518937204 +CATCAG 0.000556761612456 0.000231394632974 +ACGGCG 0.00040392509139 0.000117811888851 +TCACCT 9.98116055944e-05 0.000144999247816 +TCTAAG 0.000166872528103 0.000230186305909 +TCGTTT 0.000123204950656 0.000380018861985 +CGGAAT 0.000207420992876 0.000193936493954 +CTCATG 0.000269803246372 0.00010814527233 +TCACCG 0.000238612119624 0.000188499022161 +TCACCA 0.000199623211189 0.000224144670583 +TCACCC 0.0002167783309 0.000143790920751 +CGGAAG 0.000241731232299 0.000193936493954 +AATATA 0.000272922359047 0.00101982804298 +CGGCCT 4.67866901224e-05 8.15620768967e-05 +CGGAAC 0.000165312971766 0.000132915977165 +CGGAAA 0.000163753415428 0.000286373514437 +TAGCTT 0.0 0.000241061249495 +ATGGCG 0.000335304612544 0.000128082668904 +TGTGTA 3.89889084353e-05 0.000405393730353 +ATGGCC 0.000893625781338 0.000205415601073 +ATGGCA 0.000280720140734 0.000288790168568 +TCCAAT 0.000586393182867 0.000276102734384 +ATGGCT 0.000316589936495 0.000190311512759 +TGTGTT 8.10969295455e-05 0.000417477001005 +TTGTCG 0.000199623211189 0.000181249059771 +GAACAT 0.000143479183042 0.000281540206177 +AGATTA 4.21080211102e-05 0.000256165337809 +AGATTC 0.000116966725306 0.000250727866016 +GAAACA 0.000296315704108 0.000503872386162 +AGATTG 9.66924929196e-05 0.000245894557755 +CTGAGT 0.000318149492832 0.000141978430154 +GAAACT 0.000296315704108 0.0003951229503 +AGAATG 9.20138239074e-05 0.000228977978843 +AGAATA 5.61440281469e-05 0.000390289642039 +AGAATC 9.20138239074e-05 0.000256165337809 +CTGAGC 0.000550523387107 0.000172186606782 +CTGAGA 0.000159074746416 0.000171582443249 +CTGAGG 0.000241731232299 9.78744922761e-05 +CATACC 7.79778168707e-05 0.000216290544659 +CATACA 7.48587041958e-05 0.000412643692744 +CATACG 0.00012632406333 0.000166749134989 +TCAAAT 0.000237052563287 0.00063980918099 +GTCCAT 0.000148157852054 0.000151645046675 +ACATAG 1.40360070367e-05 0.000189707349226 +CATACT 5.45844718095e-05 0.000187290695096 +GTCCAG 0.000522451373033 0.000128686832437 +TCAAAG 0.00030723259847 0.000383643843181 +CACGAG 0.000603548302579 0.000108749435862 +GTCCAC 0.000219897443575 0.000198165638682 +GCAATG 0.000251088570324 0.000237436268299 +CGGCGG 0.000127883619668 0.000175811587977 +TTGATG 0.000247969457649 0.000311144219273 +CTCATT 0.000219897443575 0.000238644595364 +CGGCGC 0.000199623211189 8.76037122224e-05 +TTGATC 0.000243290788636 0.00020239478341 +CGGCGA 0.000151276964729 0.000148020065479 +TCCAAG 0.00104958141508 0.0002634153002 +CTATCT 8.88947112325e-05 0.000165540807924 +TTGATT 0.0002167783309 0.000567913720614 +CGGCGT 9.98116055944e-05 9.72703287435e-05 +TATAAG 0.000177789422465 0.000358873138346 +TGACTT 0.0 0.000253144520146 +TCACAG 0.000297875260446 0.000190311512759 +CGGTTA 3.74293520979e-05 0.000180040732705 +GGTTTA 5.92631408217e-05 0.000202998946943 +CGGTTC 0.000104490274607 0.000180644896238 +GCTGTT 0.000230814337937 0.000303290093349 +TTTACA 9.8252049257e-05 0.000502059895564 +CGGTTG 0.000106049830944 0.000137749285426 +GGTTTG 0.000149717408392 0.000162519990261 +TATAAA 8.10969295455e-05 0.000984786558086 +CGTACG 6.86204788462e-05 6.82704791802e-05 +GCTGTG 0.000491260246285 0.000180040732705 +GCTGTC 0.000221456999913 0.000144395084284 +CGGTTT 6.23822534965e-05 0.000182457386836 +GCTGTA 0.000131002732343 0.000173394933847 +GGGAGG 1.71551197115e-05 9.36453475481e-05 +TCATAG 3.11911267483e-06 0.000142582593686 +TATGCG 0.00026512457736 0.00015043671961 +TCTCAA 9.35733802448e-05 0.000260394482537 +AGGTTG 5.61440281469e-05 0.000135332631295 +GCATTT 0.000198063654851 0.00053166390866 +AGGTTC 7.48587041958e-05 0.000128686832437 +AGGTTA 4.21080211102e-05 0.000138957612491 +ACTCCT 0.000168432084441 0.00012929099597 +TTTTTC 0.000157515190079 0.000792058391197 +GAGGGC 0.00101839028833 0.000107541108797 +TTTTTA 7.48587041958e-05 0.00128505583377 +TCCTCT 0.000148157852054 0.000196353148085 +TTTTGT 7.64182605332e-05 0.000987807375749 +GAGGGG 0.000124764506993 8.8207875755e-05 +TTAAAT 0.000159074746416 0.00122101449932 +AGGTTT 5.3024915472e-05 0.000230790469441 +ACATAT 0.000134121845018 0.000688142263595 +TTAAAC 0.000124764506993 0.000540122198116 +TTAAAA 0.000143479183042 0.00132009731866 +ACTCCG 0.00030723259847 0.00010814527233 +TTAAAG 0.000190265873164 0.0005268306004 +ACTCCA 0.000241731232299 0.000231394632974 +TTTTTT 9.51329365822e-05 0.00233690454397 +ACTCCC 0.000238612119624 0.000111770253525 +CTGTAA 1.40360070367e-05 0.000274290243786 +GTCACG 0.000169991640778 8.57912216247e-05 +CTGTAC 0.000555202056119 0.000149832556077 +GCAACT 0.000184027647815 0.00028697767797 +GCAATT 0.000146598295717 0.000500851568499 +CTGTAG 1.24764506993e-05 0.000127478505372 +GTCACA 0.000177789422465 0.000216290544659 +GCAACG 0.00022301655625 0.000243477903625 +GTCACT 0.000188706316827 0.000132915977165 +TAGGCG 0.0 7.91454227665e-05 +GCAACC 0.00017467030979 0.000191519839824 +CTGTAT 0.0002167783309 0.000189707349226 +GCAACA 0.000394567753366 0.000538913871051 +TAGGCC 0.0 6.70621521151e-05 +TGGTTC 0.000310351711145 0.000216290544659 +ATTCAT 0.000159074746416 0.000352227339487 +TCCCAC 0.000246409901311 0.000164332480859 +GCGATT 0.000193384985839 0.000190915676292 +TCGTGT 6.08226971591e-05 0.000181853223303 +TGAATT 0.0 0.000491789115511 +GTCTCT 0.000101371161932 0.000146811738414 +TCCGTG 0.000511534478672 0.000146811738414 +ATTCAG 0.000441354443488 0.000257977828407 +ATTCAA 0.000255767239336 0.000648267470446 +ATTCAC 0.000232373894275 0.000241061249495 +GTCTCC 0.000299434816783 0.000106936945265 +GTCTCA 0.000115407168969 0.000106332781732 +GCGATG 0.000251088570324 0.000138353448958 +GTCTCG 0.000193384985839 7.61246051036e-05 +GCGATA 7.79778168707e-05 0.000154061700805 +TCGTGC 0.000120085837981 0.000109957762927 +GCGATC 0.000202742323864 0.000156478354935 +CGATTG 0.000232373894275 0.000227165488246 +TCTACA 9.51329365822e-05 0.000195748984552 +GAAGGA 0.000262005464685 0.000276706897916 +CGATTC 0.000262005464685 0.000229582142376 +CGATTA 4.36675774476e-05 0.000235623777702 +CAATCT 0.000148157852054 0.000210248909334 +GGAACA 0.000191825429502 0.000277311061449 +GGAACG 0.000233933450612 0.000143186757219 +TGACGA 0.0 0.000146811738414 +TACTGC 0.000299434816783 0.000148020065479 +CGATTT 0.000131002732343 0.000356456484215 +GAAGGT 0.000212099661888 0.000154665864337 +CTCGCT 8.57755985577e-05 0.000201186456345 +CAATCG 0.000332185499869 0.00024710288482 +CAATCA 0.000179348978803 0.000358873138346 +CAATCC 0.000252648126661 0.000208436418736 +TCCTGA 6.23822534965e-06 0.000169769952652 +AGTCCA 0.000224576112587 0.000184874040966 +TCCTGC 0.000290077478759 0.000160103336131 +AGTCCC 0.00041016331674 0.000131103486567 +ACTAAA 0.000124764506993 0.000507497367357 +TCCTGG 0.000227695225262 0.000199373965748 +ACTAAC 8.42160422203e-05 0.000217498871725 +TAACGC 0.0 0.000146207574882 +CAGCTG 0.00158139012614 0.000383039679648 +CAGCTA 0.000315030380157 0.000225352997648 +CAGCTC 0.000389889084353 0.000216894708192 +ACTAAT 0.000120085837981 0.00031295670987 +AGTCCT 0.000188706316827 0.000183665713901 +TCCTGT 0.000118526281643 0.000184874040966 +TAATGT 0.0 0.000373373063127 +CAGCTT 0.000266684133698 0.00022112385292 +GGTTAG 1.24764506993e-05 0.000200582292813 +TAACGT 0.0 0.000154665864337 +ACGGAC 0.00045227133785 0.000122041033579 +GTACTT 6.08226971591e-05 0.000285769350905 +CGACAT 0.000115407168969 0.000153457537272 +TTGTTC 0.000191825429502 0.000347394031227 +CCGAGG 8.57755985577e-05 0.000120228542981 +CCGAGA 6.39418098339e-05 0.000154665864337 +ACGGAA 0.000408603760402 0.000253748683679 +CCGAGC 0.000166872528103 0.000144395084284 +CCGCGT 0.000185587204152 0.000141978430154 +CGACAC 0.00013880051403 0.000107541108797 +CGACAA 0.000123204950656 0.000231998796506 +CGACAG 0.000327506830857 0.000186686531564 +GTACTA 4.99058027972e-05 0.00013654095836 +CCGCGC 0.000280720140734 8.51870580921e-05 +ACGGAG 0.000757944379983 0.000131103486567 +CCGCGA 0.000137240957692 7.79370957013e-05 +TACGCA 0.000106049830944 0.000181249059771 +CCGCGG 7.79778168707e-05 7.5520441571e-05 +TTGTTT 0.00013256228868 0.000929807676623 +GCATAT 0.000101371161932 0.00035283150302 +TCCGTT 0.000213659218226 0.000160707499663 +AGGAAC 0.000230814337937 0.000218103035257 +AATAAC 0.0004460331125 0.000474872536599 +AATAAA 0.000224576112587 0.00174422011852 +AATAAG 0.00031970904917 0.000391497969104 +TACTAA 2.02742323864e-05 0.000253144520146 +TGGAAG 0.000396127309703 0.000218103035257 +AATAAT 0.000433556661801 0.00123430609704 +ACGGTG 0.000514653591346 0.000114186907655 +CCAACC 0.000182468091477 0.000219915525855 +CCAACA 0.000227695225262 0.000328060798185 +TTATGC 4.21080211102e-05 0.000226561324713 +CCAACG 0.000268243690035 0.000246498721288 +GGGATT 7.32991478584e-05 0.00013654095836 +CGCCGC 0.000332185499869 0.000180040732705 +AGTAAA 0.000131002732343 0.000520788965074 +CGCCGA 0.000102930718269 0.000143186757219 +AGTAAC 0.000127883619668 0.000215082217594 +CGCCGG 0.000160634302754 0.000116603561786 +GAGTAA 1.55955633741e-05 0.000248311211886 +AGTAAG 9.8252049257e-05 0.000175811587977 +CTCAGG 0.000102930718269 9.30411840155e-05 +CTCAGC 0.000430437549126 0.000178228242108 +CCAACT 0.000237052563287 0.00031054005574 +GAGTAT 0.000368055295629 0.000170374116184 +GCTTCA 0.000143479183042 0.000224748834115 +GTGTAG 6.23822534965e-06 0.000151645046675 +TCGAGC 0.000240171675962 0.000184874040966 +AGTAAT 0.000168432084441 0.000303290093349 +GTGTAC 0.00030723259847 0.000175811587977 +CGCCGT 0.000152836521066 0.000126270178307 +GTGGCA 0.000430437549126 0.000250727866016 +CATATT 0.000107609387282 0.00059510107958 +CTCGGA 0.000135681401355 0.000121436870046 +CTCGGC 0.000255767239336 0.000129895159502 +GCCGCC 0.0013505757882 0.00019514482102 +GCCGCA 0.000377412633654 0.000170978279717 +GCCGCG 0.000196504098514 0.000108749435862 +TATTGA 9.35733802448e-06 0.000356456484215 +ACACTT 9.20138239074e-05 0.000356456484215 +CATATG 0.00013880051403 0.000407206220951 +TCGCTC 0.000227695225262 0.000184269877433 +CATATC 0.00013256228868 0.000254352847211 +CATATA 8.42160422203e-05 0.000627725910339 +GTCAGC 0.000417961098427 0.000138957612491 +TACTAC 0.000545844718095 0.000180040732705 +ACACTC 0.000104490274607 0.000186082368031 +ACACTA 9.35733802448e-05 0.000222936343518 +ACACTG 0.000335304612544 0.000193936493954 +GCCGCT 0.000503736696984 0.000146811738414 +ACCGGA 0.000252648126661 0.000111770253525 +AAATAA 3.11911267483e-05 0.00160949165076 +ACCGGC 0.000411722873077 8.63953851573e-05 +AAATAC 0.000352459732255 0.000668204867021 +CTTTAA 9.35733802448e-06 0.00051051818502 +ACCGGG 6.86204788462e-05 6.04163532568e-05 +AAATAG 2.02742323864e-05 0.000463997593012 +AACTTA 8.42160422203e-05 0.000425331126928 +CAGGTA 0.000137240957692 0.000103311964069 +AACTTC 0.000650334992701 0.000314769200468 +CAGGTC 0.000346221506906 9.90828193412e-05 +CACGAC 0.000399246422378 0.000102103637004 +CACGAA 0.000299434816783 0.000229582142376 +CAGGTG 0.00103866452072 0.000126874341839 +CTTTAT 0.000102930718269 0.000341956559434 +AATCCC 0.000731431922247 0.000237436268299 +AATCCA 0.000357138401268 0.000365518937204 +AAATAT 0.000263565021023 0.00137205538246 +AATCCG 0.000587952739205 0.000235019614169 +CACGAT 0.000449152225175 0.000119624379449 +CAGGTT 0.00022301655625 0.000148624229012 +AACTTT 0.000555202056119 0.00059751773371 +TCTGTC 7.64182605332e-05 0.000180644896238 +GGGATA 2.96315704108e-05 0.000112374417058 +GGGATC 9.98116055944e-05 0.000128686832437 +GGGTGT 2.33933450612e-05 0.000122041033579 +GGAGAT 0.000336864168881 0.00017883240564 +GATGCT 0.00041016331674 0.000146207574882 +CGCAGT 0.000335304612544 0.000172790770315 +GAGTCG 0.000495938915297 0.000121436870046 +GAGCCT 0.00018714676049 9.96869828738e-05 +GGAGAC 0.000215218774563 0.000144999247816 +GGCGGC 0.0011337974573 0.000206019764606 +GGAGAA 0.000286958366084 0.000261602809602 +GGGTGC 3.11911267483e-05 0.000103916127602 +GGAGAG 0.000371174408304 0.000166749134989 +TGGAAC 0.000276041471722 0.000205415601073 +GGGTGG 2.02742323864e-05 0.000124457687709 +GAGCCA 0.000469426457561 0.000201186456345 +CGCAGG 0.000154396077404 0.000105728618199 +GATGCG 0.000475664682911 0.000135332631295 +CGCAGA 0.000110728499956 0.00020239478341 +GATGCA 0.000413282429414 0.000199373965748 +CGCAGC 0.000553642499782 0.000256769501342 +GATGCC 0.00115095257701 0.000177019915043 +CGGATT 0.000109168943619 0.000175811587977 +GGTAGT 0.000135681401355 0.000111770253525 +ACCCCT 4.05484647727e-05 0.000100895309939 +GCCAAT 0.000974722710883 0.000276102734384 +GGCGGG 0.00017467030979 8.57912216247e-05 +AGAAGT 9.98116055944e-05 0.000280331879112 +ACCCCA 0.000115407168969 0.000193936493954 +GGTAGA 3.27506830857e-05 0.000143186757219 +ACCCCC 0.000143479183042 0.000106936945265 +CGGATG 0.00018090853514 0.000146207574882 +GCCAAG 0.00196816009782 0.000278519388514 +CGGATA 6.55013661714e-05 0.000157686682 +ACCCCG 0.000131002732343 7.43121145059e-05 +CGGATC 0.000155955633741 0.000181853223303 +AGAAGA 8.73351548951e-05 0.000411435365679 +AGAAGC 9.66924929196e-05 0.000303290093349 +GCAAGA 6.23822534965e-05 0.000234415450637 +AGAAGG 6.39418098339e-05 0.000279123552047 +CACTCC 0.000238612119624 0.00015527002787 +CACTCA 0.000129443176005 0.00024710288482 +CACTCG 0.000363376626617 0.000146207574882 +TGCGTT 0.000121645394318 0.000214478054062 +TCAGCT 0.000208980549213 0.000218103035257 +AGCTTT 0.000310351711145 0.000285769350905 +CCCCGG 5.61440281469e-05 9.78744922761e-05 +TGCGTA 6.23822534965e-05 0.000155874191403 +CCCCGC 0.000143479183042 0.000102103637004 +CACTCT 0.000109168943619 0.000148624229012 +AGCTTC 0.000485022020935 0.000177624078575 +AGCTTA 8.57755985577e-05 0.000256165337809 +AGCTTG 0.000263565021023 0.000181853223303 +TTAGCT 8.88947112325e-05 0.000271873589656 +TTAGCC 0.000110728499956 0.000161311663196 +GCACTG 0.000430437549126 0.000182457386836 +TTAGCA 6.55013661714e-05 0.000288186005035 +GACCAT 0.000149717408392 0.00019514482102 +TTAGCG 5.3024915472e-05 0.000132915977165 +TACCGG 9.98116055944e-05 6.70621521151e-05 +TCATAT 7.95373732081e-05 0.000507497367357 +ATAGGT 6.70609225088e-05 0.00022354050705 +ATAAGG 6.86204788462e-05 0.000187894858629 +TGTGCT 0.000112288056294 0.000236227941234 +AAGGGC 0.000851517760228 0.000145603411349 +ATAAGC 0.000135681401355 0.000254352847211 +AAGGGA 0.000511534478672 0.000216290544659 +ATAAGA 6.86204788462e-05 0.000348602358292 +CCAGAC 0.000157515190079 0.000140770103088 +TCTGTA 8.88947112325e-05 0.000219311362322 +CCAGAA 0.000302553929458 0.000328060798185 +CCAGAG 0.000458509563199 0.000169165789119 +GCAAGT 0.000162193859091 0.000264019463732 +TGTGCG 8.57755985577e-05 0.000241665413027 +ATAAGT 0.000101371161932 0.000394518786767 +ATAGGG 2.6512457736e-05 9.60620016784e-05 +TGTGCC 0.000304113485796 0.000198769802215 +ATAGGA 7.01800351836e-05 0.000182457386836 +TGTGCA 8.26564858829e-05 0.000297248458024 +ATAGGC 9.8252049257e-05 9.42495110807e-05 +GCTCGC 0.000255767239336 0.000168561625587 +TAAGTT 0.0 0.000432581089319 +TTTGCG 0.000227695225262 0.000258581991939 +CCAGAT 0.000310351711145 0.000238040431832 +AGACAA 7.48587041958e-05 0.000309935892208 +GACGCA 0.000168432084441 0.000146207574882 +AGACAC 7.1739591521e-05 0.000207228091671 +TCCATT 0.000470986013899 0.000309331728675 +AGACAG 7.48587041958e-05 0.000189707349226 +GCTTTT 0.000165312971766 0.000373373063127 +TTTTCT 7.1739591521e-05 0.00072922538381 +CGCTGT 0.000107609387282 0.000163124153793 +GACGCC 0.000467866901224 0.000111770253525 +TCAAGA 5.61440281469e-05 0.000282748533242 +CGTGGG 4.36675774476e-05 9.30411840155e-05 +CTATAG 4.67866901224e-06 0.00017399909738 +AGACAT 4.36675774476e-05 0.000204207274008 +CGTGGA 0.000185587204152 0.000128082668904 +TTTTCG 0.000201182767526 0.000506893203825 +CCCACA 0.000435116218138 0.000272477753188 +CGCTGC 0.000346221506906 0.00020239478341 +TTTTCC 0.000145038739379 0.000538913871051 +TTTTCA 7.79778168707e-05 0.000694183898921 +CGCTGG 0.000252648126661 0.000132915977165 +TATGGA 0.000269803246372 0.000193332330422 +TATGGC 0.000358697957605 0.000196353148085 +CGTAGG 3.89889084353e-05 6.28330073871e-05 +CCCACC 0.000683085675787 0.000179436569173 +TATGGG 8.10969295455e-05 0.000143790920751 +CGTAGC 8.26564858829e-05 9.30411840155e-05 +TACCGT 9.98116055944e-05 8.8207875755e-05 +TGGACT 8.42160422203e-05 0.000179436569173 +CGTAGT 6.08226971591e-05 0.000127478505372 +GCTCGA 0.000118526281643 0.000152249210207 +TATGGT 0.000140360070367 0.000224144670583 +TGGACA 0.000115407168969 0.000212665563464 +TGGACC 0.000249529013986 0.000112374417058 +TGGACG 0.000152836521066 0.000152249210207 +CCGGTT 0.000176229866128 0.000114186907655 +GACCAA 0.0002292547816 0.000238644595364 +GCTTGA 4.67866901224e-06 0.000170978279717 +TGAGAC 0.0 0.000161311663196 +GCTTGC 9.98116055944e-05 0.00015285337374 +TGAGAA 0.0 0.000303894256882 +TGAGAG 0.0 0.000181249059771 +GCTTGG 0.000107609387282 0.000225957161181 +CCTGTT 0.000145038739379 0.00015285337374 +CCGGTG 0.000491260246285 0.000109957762927 +CCGGTC 0.000116966725306 5.86038626591e-05 +CCGGTA 9.35733802448e-05 7.31037874408e-05 +CCTGTC 8.26564858829e-05 0.00013654095836 +CCTGTA 7.79778168707e-05 0.000130499323035 +CCTGTG 0.000210540105551 0.000119624379449 +GCTTGT 7.1739591521e-05 0.000195748984552 +TGAGAT 0.0 0.000199373965748 +TCCGAA 0.000322828161845 0.000277915224981 +GGTTGT 8.57755985577e-05 0.000180644896238 +TCCTCA 0.000243290788636 0.000156478354935 +TATCAG 0.000371174408304 0.000214478054062 +TATTGC 0.000102930718269 0.000287581841503 +TAGCGT 0.0 0.000103916127602 +GGTTGG 0.000123204950656 0.000154061700805 +GGTTGA 3.11911267483e-06 0.000122645197111 +TTCACG 0.000272922359047 0.000137145121893 +GGTTGC 0.000127883619668 0.00021870719879 +GGAAAC 0.000400805978715 0.000305102583947 +TCCCGC 0.000297875260446 9.84786558086e-05 +GTAACG 0.000104490274607 0.000141978430154 +CAGCGT 0.000352459732255 0.000208436418736 +GTAACC 0.000137240957692 0.000114186907655 +CGTTTT 0.000106049830944 0.000410831202146 +ATTCTC 0.000237052563287 0.000279727715579 +ATTCTA 0.000137240957692 0.000327456634652 +ATTCTG 0.000609786527929 0.000282144369709 +TCATTT 0.000102930718269 0.000547372160507 +CAGCGA 0.000458509563199 0.000265227790798 +CAGCGC 0.000695562126486 0.00015285337374 +TGCTAG 1.40360070367e-05 0.000126874341839 +CAGCGG 0.000461628675874 0.000205415601073 +CCTTGT 3.58697957605e-05 0.00013654095836 +TCATTC 0.000120085837981 0.000203603110476 +CGTTTG 0.000254207682998 0.000256769501342 +CGTTTA 4.5227133785e-05 0.000225957161181 +ATTCTT 0.000141919626705 0.000405393730353 +CGTTTC 0.000244850344974 0.000219311362322 +TGGCAA 0.000127883619668 0.000454935140024 +CCGATC 0.000165312971766 0.00021870719879 +TGGCAG 0.000316589936495 0.000261602809602 +GCTGAG 0.000425758880114 0.000180040732705 +GCTGAA 0.000316589936495 0.000353435666552 +GCTGAC 0.000240171675962 0.000151040883142 +TGGCAT 0.000120085837981 0.000252540356614 +GCTGAT 0.000357138401268 0.000221728016453 +CCGATG 0.000282279697072 0.000130499323035 +GGCCGC 0.000199623211189 9.48536746132e-05 +GAACTT 0.000233933450612 0.000311748382805 +GGCCGA 0.000104490274607 0.000143790920751 +GGCAAT 0.000742348816609 0.000306310911012 +CTGATT 0.000396127309703 0.000264623627265 +CCATCG 0.000393008197028 0.000171582443249 +CTAAAT 0.000260445908348 0.000386060497311 +CCATCC 0.000241731232299 0.000202998946943 +CCATCA 0.000166872528103 0.000270061099058 +CTGATC 0.000810969295455 0.000157686682 +CTGATA 0.000210540105551 0.000241061249495 +GAGTTT 0.000467866901224 0.000303894256882 +CTGATG 0.000809409739117 0.000171582443249 +GGCAAA 0.000555202056119 0.000407810384484 +CTAAAG 0.000564559394144 0.000255561174276 +CCATCT 0.000148157852054 0.000211457236399 +CTAAAC 0.000262005464685 0.000262206973135 +CTAAAA 0.000204301880201 0.000578184500668 +GACACC 0.000636298985665 0.000143186757219 +GACACA 0.000260445908348 0.000215082217594 +GACACG 0.00040392509139 0.000120228542981 +GCGCCT 0.000140360070367 0.000114186907655 +TTCACC 0.000616024753278 0.000187290695096 +TAGCGA 0.0 0.000145603411349 +TACGAG 0.000929495577098 0.000137145121893 +TACGAC 0.000605107858916 0.000165540807924 +GACACT 0.000241731232299 0.000160707499663 +GGCGAT 0.000832803084179 0.000130499323035 +TGTTAC 4.36675774476e-05 0.000177624078575 +ACGCTG 0.00075950393632 0.000186686531564 +ACGCTA 0.000112288056294 8.88120392875e-05 +ACGCTC 0.000274481915385 9.72703287435e-05 +TCGATG 0.00035557884493 0.000204207274008 +TCGAGG 9.98116055944e-05 0.000121436870046 +TCGATC 0.000199623211189 0.000205415601073 +ACGCTT 0.000148157852054 0.000132311813632 +TCTGGG 8.42160422203e-05 0.000141374266621 +GCATTG 0.0002292547816 0.000272477753188 +GAACTG 0.00100123516862 0.000257373664874 +TCGATT 0.000230814337937 0.00037639388079 +TCGGCA 0.000282279697072 0.000166749134989 +AGGCAC 9.20138239074e-05 0.000122645197111 +TTTTGA 7.79778168707e-06 0.000670017357618 +AACCAA 0.000375853077317 0.000689954754193 +TGCCGG 0.000129443176005 0.000117207725318 +AACCAC 0.000371174408304 0.000291206822698 +ACGAAC 0.000243290788636 0.000219915525855 +AACCAG 0.000701800351836 0.0002893943321 +TGCCGA 8.73351548951e-05 0.00021870719879 +TTGGAC 0.000527130042046 0.000184874040966 +TCTGGA 0.000252648126661 0.000199373965748 +GAGTTC 0.000990318274257 0.000231394632974 +TGCCGT 7.79778168707e-05 0.000143186757219 +AACCAT 0.000177789422465 0.000294831803893 +AACAGA 0.00013256228868 0.000433789416384 +ACGTCG 0.000196504098514 0.000112374417058 +AACAGC 0.000818767077142 0.000439226888177 +ACGTCC 0.000171551197115 9.18328569504e-05 +AACAGG 0.000127883619668 0.000185478204498 +ACGTCA 9.20138239074e-05 0.000111166089993 +CCCAAG 0.00114939302067 0.000219311362322 +GTCCCT 2.96315704108e-05 0.000122645197111 +GACGAA 0.00059107185188 0.000215686381127 +CCCAAC 0.000706479020848 0.000204811437541 +CCCAAA 0.000439794887151 0.000429560271656 +ACGTCT 5.45844718095e-05 0.000100895309939 +GGGAGA 1.09168943619e-05 0.000131103486567 +AACAGT 0.000341542837893 0.000253144520146 +GGGAGC 8.42160422203e-05 0.000119624379449 +CCCAAT 0.000625382091303 0.000247707048353 +GACGAT 0.000881149330638 0.000159499172598 +GGGCGC 9.045426757e-05 0.000130499323035 +GGGCGA 4.83462464598e-05 8.94162028201e-05 +GGGCGG 6.08226971591e-05 0.000125061851242 +TCTCTT 7.32991478584e-05 0.000294831803893 +TGGGGG 2.96315704108e-05 0.00011056192646 +GTACAG 0.000157515190079 0.000125666014774 +TCATAC 7.32991478584e-05 0.000163124153793 +CAGAAT 0.000608226971591 0.00024468623069 +ACGACT 9.66924929196e-05 0.000142582593686 +TCTCTC 4.99058027972e-05 0.0002634153002 +TCTCTA 5.77035844843e-05 0.000217498871725 +TCTCTG 0.000238612119624 0.000192124003357 +GGGCGT 5.77035844843e-05 0.000112374417058 +CAGAAA 0.000460069119537 0.000584830299526 +CAGAAC 0.00076574216167 0.000242873740092 +ACGACG 0.000268243690035 0.000155874191403 +CAGAAG 0.00126480018964 0.000302685929817 +CACTTT 0.000280720140734 0.000399352095028 +CCTAAT 9.51329365822e-05 0.000196957311617 +GCATTC 0.000233933450612 0.000266436117863 +GTCATT 0.000244850344974 0.000193332330422 +TGCCCC 0.000194944542177 0.000135332631295 +CACTTG 0.000325947274519 0.000241665413027 +CCTAAC 6.08226971591e-05 0.000109957762927 +CCTAAA 7.48587041958e-05 0.000269456935525 +CACTTC 0.00045227133785 0.000226561324713 +CCTAAG 0.000102930718269 0.000143790920751 +CACTTA 6.08226971591e-05 0.000306915074545 +GTCCCA 5.14653591346e-05 0.000131103486567 +GTCCCC 6.08226971591e-05 9.2437020483e-05 +AAGATT 0.000548963830769 0.000405997893886 +ATCGAT 0.000831243527841 0.000326852471119 +GACTCG 0.000436675774476 0.000108749435862 +CTCATC 0.000509974922334 0.000173394933847 +GACTCC 0.000562999837806 0.000109353599395 +CTCATA 0.000120085837981 0.000222332179985 +GACTCA 0.000171551197115 0.00013412430423 +AAGATA 0.000286958366084 0.000338935741771 +AAGATC 0.00102306895734 0.000258581991939 +AAGATG 0.000793814175743 0.000268852771993 +GACTCT 0.00017467030979 0.00013654095836 +ATCGAG 0.00115251213335 0.000190915676292 +TTGAGA 9.8252049257e-05 0.000267040281395 +ATCGAA 0.000575476288505 0.000450101831763 +ATCGAC 0.000587952739205 0.000161915826728 +ATATTT 0.000198063654851 0.00130620155741 +ACGGTA 9.98116055944e-05 0.000146207574882 +GGACTC 0.000238612119624 0.000128686832437 +ATAGTT 0.000106049830944 0.000352227339487 +CTACCA 9.51329365822e-05 0.000180040732705 +TACTGT 0.000106049830944 0.000206623928138 +ATATTC 0.000354019288593 0.000482726662522 +ATATTA 8.42160422203e-05 0.000758829396906 +ATATTG 0.000184027647815 0.000532872235725 +ATAGTA 6.70609225088e-05 0.000265227790798 +ATAGTC 0.000109168943619 0.000166749134989 +TACTGG 0.000230814337937 0.0001317076501 +ATAGTG 0.00022301655625 0.000209644745801 +GATCGA 0.000255767239336 0.000205415601073 +CAGGCA 0.000455390450525 0.000181853223303 +AGGAAG 0.00027136280271 0.000230186305909 +CATCCG 0.00049437935896 0.000144999247816 +AGGAAA 0.000154396077404 0.000458560121219 +CATCCA 0.0002292547816 0.00026099864607 +CAGGCG 0.000839041309528 0.000137145121893 +CATCCC 0.00031970904917 0.000144999247816 +TTATGA 1.55955633741e-06 0.000332289942913 +ATAGAA 0.000162193859091 0.000410831202146 +CGGAGT 7.32991478584e-05 0.000127478505372 +TTATGG 4.5227133785e-05 0.000227769651778 +CATCCT 0.000141919626705 0.000189103185694 +AGGAAT 0.000184027647815 0.000228977978843 +CAGGCT 0.000414841985752 9.66661652109e-05 +ACGGAT 0.000533368267395 0.000186686531564 +CGGAGA 5.77035844843e-05 0.00015527002787 +CGGAGC 0.00012632406333 0.000163124153793 +TTATGT 3.11911267483e-05 0.000490580788445 +CAGGCC 0.000878030217964 9.66661652109e-05 +CGGAGG 6.86204788462e-05 0.000135332631295 +ATGGAA 0.000520891816696 0.000347394031227 +ATGGAC 0.00077198038702 0.000160103336131 +ATGGAG 0.00114315479532 0.000175811587977 +CGCTTG 0.000233933450612 0.000196957311617 +CGCTTA 5.14653591346e-05 0.000177019915043 +CGCTTC 0.000508415365997 0.000175811587977 +TGAACA 0.0 0.00031295670987 +ATGGAT 0.000623822534965 0.000277311061449 +TTTGCA 0.000163753415428 0.000459768448285 +CGCTTT 0.000215218774563 0.000222936343518 +GCCGTG 0.000567678506818 0.000123853524177 +GATCGT 0.000354019288593 0.000171582443249 +TTTGCC 0.00062694164764 0.000366727264269 +TTGTGA 1.24764506993e-05 0.000332289942913 +GAAAAG 0.00103242629537 0.000602955205503 +GAAAAC 0.000586393182867 0.000670621521151 +ATAGAT 0.000196504098514 0.000299665112154 +GAAAAA 0.000427318436451 0.00112616082471 +GTTCCT 0.000157515190079 0.00017641575151 +TAAGTA 0.0 0.000381227189051 +TAGGGC 0.0 6.58538250499e-05 +ACGGTT 0.000155955633741 0.000117811888851 +GAAAAT 0.000485022020935 0.000932224330753 +ACAAGG 6.70609225088e-05 0.000161915826728 +ACAAGA 5.92631408217e-05 0.000354039830085 +ACAAGC 0.000143479183042 0.000289998495633 +ACACGT 7.1739591521e-05 0.00015043671961 +CTGCGT 0.000428877992789 0.00013654095836 +GACGTC 0.000293196591434 8.57912216247e-05 +GCGGAG 0.000876470661626 0.000169165789119 +CATAAG 0.000148157852054 0.000195748984552 +GCGGAA 0.00040392509139 0.000200582292813 +CATAAA 0.000109168943619 0.000579392827733 +GCCAAC 0.00117902459108 0.000322019162859 +CATAAC 9.8252049257e-05 0.000236227941234 +ACACGC 0.000131002732343 0.000203603110476 +ACAAGT 0.000134121845018 0.000306310911012 +ACACGA 7.01800351836e-05 0.000207832255204 +ACACGG 6.23822534965e-05 0.00011297858059 +CATAAT 0.000118526281643 0.000410831202146 +GCGGAT 0.000552082943444 0.000157082518468 +GCACAT 0.000131002732343 0.000207832255204 +CTGCGG 0.000358697957605 0.000135936794828 +CTGCGA 0.000439794887151 0.000172790770315 +CTGCGC 0.00106361742212 0.000144395084284 +CGGCAA 0.000155955633741 0.000255561174276 +ACCGGT 0.000201182767526 8.15620768967e-05 +CGGCAG 0.000364936182955 0.00020239478341 +GACGCG 0.000176229866128 8.57912216247e-05 +CCTCCT 0.000155955633741 0.000171582443249 +TGTTGA 0.0 0.000347394031227 +CGGCAT 0.000109168943619 0.000192124003357 +CCTCCC 0.000177789422465 0.000102103637004 +CCTCCA 0.000285398809747 0.000160707499663 +CACGCC 0.000396127309703 0.000170978279717 +CCTCCG 0.000233933450612 0.000124457687709 diff --git a/code/utilities/CPAT-1.2.2/dat/fly_cutoff.txt b/code/utilities/CPAT-1.2.2/dat/fly_cutoff.txt new file mode 100755 index 0000000..97cf2bc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/fly_cutoff.txt @@ -0,0 +1,2 @@ +Coding Probability Cutoff: 0.39 +Achieved Sensitivity and Specificity: 0.963 diff --git a/code/utilities/CPAT-1.2.2/dat/zebrafish_Hexamer.tsv b/code/utilities/CPAT-1.2.2/dat/zebrafish_Hexamer.tsv new file mode 100755 index 0000000..5d9e176 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/zebrafish_Hexamer.tsv @@ -0,0 +1,4097 @@ +hexamer coding noncoding +GAACGT 9.59993417188e-05 0.000127679058873 +CTTCTT 0.000278855230707 0.000339890460173 +CACCCT 0.000187427286213 0.000159378687283 +GAACGG 0.000114284930618 9.42183399961e-05 +GAACGC 0.000132570519516 0.000104784882799 +GAACGA 0.000173713094539 0.000123276332705 +CACCCA 0.000169141697314 0.000222777944103 +CTTCTA 0.000137141916741 0.000157617596816 +CACCCC 0.000189712984825 0.000155856506349 +CTTCTC 0.000308569312668 0.000315235193632 +CACCCG 0.000146284711191 8.71739781273e-05 +CTTCTG 0.000644567008683 0.000428825528767 +CGTGTG 0.000354283284915 0.000186675589525 +TAAGGT 2.28569861235e-06 0.000188436679992 +CGTGTC 0.000107427834781 0.000103904337566 +CGTGTA 6.39995611459e-05 6.95630734551e-05 +GGAAAT 0.000338283394628 0.000398886990825 +TAAGGG 2.28569861235e-06 0.00014881214448 +CGTGTT 0.000114284930618 0.000160259232517 +TAAGGC 0.0 0.000156737051582 +TAAGGA 0.0 0.000163781413451 +TCACTG 0.000313140709892 0.000378634450452 +GTCAAA 0.000669709693419 0.000362784636247 +CCCGCT 0.000150856108415 0.000110068154201 +GTCAAG 0.000557710461414 0.000193719951394 +CTGTCC 0.000637709912846 0.00024391102971 +TCAGAG 0.000703995172605 0.000390081538489 +CTGTCA 0.000438854133572 0.000392723174189 +CTGTCG 0.000189712984825 0.000121515242238 +GTATCT 9.14279444941e-05 0.000150573234947 +TCAGAA 0.000429711339122 0.000526566049698 +GTCAAT 0.000338283394628 0.000252716482046 +GTATCA 8.68565472694e-05 0.00014881214448 +GTATCC 8.68565472694e-05 8.98156138281e-05 +GTATCG 2.74283833482e-05 4.31467164468e-05 +CTGTCT 0.00061256722811 0.000387439902788 +GGTGTC 0.000253712545971 0.000185795044291 +GGTGTA 0.000182855888988 0.000174347956255 +GGTGTG 0.000591995940599 0.000332846098304 +TATCCT 0.000237712655685 0.000146170508779 +CCGGGG 8.68565472694e-05 4.4907806914e-05 +TTCTGT 0.000319997805729 0.000612859482592 +ATTCCT 0.000411425750223 0.000260641389148 +CCGGGC 0.000123427725067 7.13241639223e-05 +CCGGGA 0.00015542750564 7.22047091559e-05 +TATCCA 0.000239998354297 0.000201644858496 +TATCCC 0.000159998902865 0.000113590335136 +GTTCTG 0.000596567337824 0.000307310286529 +TACACC 0.000527996379453 0.000193719951394 +TATCCG 8.91422458817e-05 6.33992568198e-05 +GGTGTT 0.000356568983527 0.000283535565222 +ATTCCG 6.85709583706e-05 5.54743497173e-05 +TTCTGG 0.000386283065488 0.000372470633816 +CCGGGT 8.68565472694e-05 5.37132592501e-05 +ATTCCC 0.000267426737645 0.000250955391578 +TTCTGC 0.000399997257162 0.000467569519046 +ATTCCA 0.000269712436258 0.000251835936812 +GTTCTA 9.82850403312e-05 0.000122395787472 +TGCACT 0.000265141039033 0.000343412641107 +TATCTT 0.000141713313966 0.00024655266541 +CGCGGT 5.02853694718e-05 5.37132592501e-05 +CCCGCG 6.39995611459e-05 4.4907806914e-05 +CGCGGG 7.31423555953e-05 6.16381663526e-05 +CGCGGC 9.14279444941e-05 5.45938044837e-05 +CGCGGA 5.71424653088e-05 6.95630734551e-05 +ACCTGT 0.000322283504342 0.000274730112886 +TCATGT 0.000114284930618 0.000440272616804 +CCCGCC 0.000118856327842 7.30852543895e-05 +TTACAG 0.00027199813487 0.00043675043587 +CTCCGC 0.000180570190376 0.000133842875509 +TTACAA 9.82850403312e-05 0.00043675043587 +TTACAC 0.000105142136168 0.000327562826902 +CTCCGG 0.000102856437556 0.000124156877939 +TCATGC 9.82850403312e-05 0.000281774474755 +ACCTGG 0.000235426957072 0.00014881214448 +GGCGAA 0.000134856218129 7.83685257912e-05 +GTAAGC 7.08566569829e-05 0.000114470880369 +TCATGG 0.000146284711191 0.000228061215505 +ACCTGC 0.000429711339122 0.000276491203353 +ACCTGA 1.59998902865e-05 0.000324040645968 +GTATTT 9.14279444941e-05 0.000487822059419 +CTCGAT 0.000118856327842 8.01296162584e-05 +CTCCGT 9.37136431064e-05 0.000117993061304 +GCCTGA 1.82855888988e-05 0.000225419579804 +GCCTGC 0.000340569093241 0.000221016853636 +GCCTGG 0.00031085501128 0.000165542503918 +TCTTGC 7.54280542076e-05 0.000213091946533 +TAAAGG 0.0 0.000378634450452 +CAAATT 0.000150856108415 0.000467569519046 +TAAAGA 2.28569861235e-06 0.000511596780727 +GCATAA 1.14284930618e-05 0.000288818836624 +AAGGTC 0.0003885687641 0.000178750682423 +TATTAG 9.14279444941e-06 0.000326682281669 +GCCTGT 0.000267426737645 0.000242149939242 +TATCTA 0.000102856437556 0.000241269394009 +TAAAGT 0.0 0.000518641142595 +CAAATA 0.00015542750564 0.000560026768575 +CAAATC 0.000239998354297 0.000355740274378 +CGTGCT 0.000178284491763 9.42183399961e-05 +CAAATG 0.000262855340421 0.000461405702411 +AATACT 0.000118856327842 0.000280013384288 +TATCTC 0.000159998902865 0.000160259232517 +CCGGCG 0.000111999232005 5.28327140165e-05 +GGCATG 0.000569138954476 0.00016113977775 +GGCATA 0.00011657062923 0.000134723420742 +GGCGAC 0.000180570190376 9.24572495289e-05 +GGCATC 0.000635424214234 0.000137365056443 +AATACG 5.02853694718e-05 0.000108307063734 +AATACA 0.000141713313966 0.000482538788018 +AATACC 0.000109713533393 0.000132962330275 +GGCATT 0.000431997037735 0.000206047584664 +TATCTG 0.000500567996105 0.000255358117747 +TGCACA 0.00027199813487 0.000456122431009 +GAGCAC 0.000493710900268 0.000233344486906 +ACTGAT 0.000498282297493 0.000394484264657 +GAGCAG 0.00158627483697 0.000442914252505 +AGTAGT 6.62852597582e-05 0.000164661958685 +TCTCGC 0.000189712984825 0.000113590335136 +TCTCGA 0.000123427725067 8.71739781273e-05 +TCTCGG 7.99994514323e-05 0.000101262701865 +ACTGAG 0.000591995940599 0.000366306817181 +AGTAGA 6.62852597582e-05 0.000185795044291 +TTTGGT 0.000356568983527 0.000367187362415 +AGTAGG 4.11425750223e-05 0.000142648327845 +ACTGAA 0.00065142410452 0.00060757621119 +AAGGTT 0.000367997476589 0.000249194301111 +GGGTCA 0.000146284711191 0.000184033953824 +GTGTCG 0.000175998793151 9.6859975697e-05 +TCGAAC 3.65711777976e-05 8.98156138281e-05 +TCGAAA 7.99994514323e-05 9.86210661642e-05 +GTGTCC 0.000452568325246 0.000219255763169 +CGCACG 9.37136431064e-05 8.71739781273e-05 +GTGTCA 0.000331426298791 0.000254477572513 +GTTGTA 0.000105142136168 0.000221016853636 +CTTGCT 0.000281140929319 0.000250074846345 +TCGGTC 8.4570848657e-05 6.69214377543e-05 +GTGTCT 0.000527996379453 0.00027561065812 +TTGAAG 0.000422854243285 0.000419139531198 +TCGAAT 3.19997805729e-05 9.77405209306e-05 +CTTGCG 6.17138625335e-05 6.60408925206e-05 +CTTGCA 0.000255998244583 0.000216614127468 +CTTGCC 0.000164570300089 0.00012679851364 +CGAAAG 0.000141713313966 9.42183399961e-05 +CGAAAA 0.000139427615353 0.000154095415882 +CGAAAC 0.000159998902865 9.95016113978e-05 +AATCAT 0.000143999012578 0.000462286247645 +AAATGC 0.000324569202954 0.000486060968952 +CACGGC 0.000196570080662 0.000102143247099 +AAATGA 4.34282736347e-05 0.000826831974359 +ACAGTC 0.000274283833482 0.000264163570083 +CACGGG 0.000105142136168 5.6354894951e-05 +ACAGTA 0.000203427176499 0.000367187362415 +TAGAGC 0.0 0.000165542503918 +CGAAAT 9.82850403312e-05 0.000117993061304 +ACAGTT 0.000281140929319 0.000391842628956 +AATCAG 0.000479996708594 0.00040505080746 +CACGGT 0.000109713533393 0.000117993061304 +AAATGT 0.000262855340421 0.000969480302203 +AATCAC 0.000196570080662 0.000310832467464 +TTTGTA 0.000205712875112 0.000574115492313 +GCTCAA 0.000319997805729 0.000266805205783 +TCTAGT 0.000107427834781 0.000162900868218 +TTGCCG 7.54280542076e-05 7.39657996231e-05 +ATACGT 3.42854791853e-05 9.50988852297e-05 +GGGTAT 9.82850403312e-05 7.30852543895e-05 +ATACGA 6.17138625335e-05 8.71739781273e-05 +TCTAGG 4.11425750223e-05 8.71739781273e-05 +ATACGC 7.99994514323e-05 2.99385379427e-05 +TCTAGA 8.68565472694e-05 0.000165542503918 +GGGTAG 0.0 7.22047091559e-05 +TCTAGC 8.91422458817e-05 8.62934328936e-05 +ATACGG 5.02853694718e-05 6.95630734551e-05 +TGACTA 2.28569861235e-06 0.000205167039431 +TTTGTG 0.000822851500447 0.00057587658278 +TGGGCC 0.000178284491763 0.000151453780181 +AGATGT 0.00011657062923 0.000379514995685 +TCGCCC 0.000111999232005 5.98770758854e-05 +TCGCCA 0.000107427834781 9.24572495289e-05 +GGGTCG 5.02853694718e-05 5.72354401846e-05 +TCGCCG 7.31423555953e-05 7.13241639223e-05 +GGTAAT 0.000130284820904 0.000142648327845 +ACCCAT 0.000127999122292 0.000176989591955 +GTCAAC 0.000633138515622 0.000225419579804 +ACCCAC 0.000166855998702 0.000169945230086 +GGTAAC 0.000118856327842 0.000140006692144 +ACCCAA 0.000141713313966 0.000228941760738 +AGATGG 0.000107427834781 0.000325801736435 +ACCCAG 0.000351997586302 0.000210450310832 +AGATGA 1.37141916741e-05 0.000475494426149 +TCGCCT 0.000118856327842 8.18907067256e-05 +AGATGC 0.000111999232005 0.000330204462603 +TTTGAG 0.000975993307474 0.000501030237923 +CCCCAT 0.000127999122292 0.000151453780181 +TGGTCT 0.000178284491763 0.000216614127468 +TTGGGT 0.000242284052909 0.000215733582234 +CACTAG 6.85709583706e-06 0.000155856506349 +CACTAA 1.37141916741e-05 0.000268566296251 +CACTAC 0.000319997805729 0.000150573234947 +CCCCAA 0.000100570738944 0.00013912614691 +CCCCAC 8.68565472694e-05 0.000127679058873 +CCCCAG 0.000228569861235 0.000120634697004 +CACTAT 0.000178284491763 0.000207808675132 +CTATCG 2.05712875112e-05 3.25801736435e-05 +TCGGTT 0.000100570738944 0.000105665428033 +TTGGGA 0.000265141039033 0.000237747213074 +TTGGGC 0.000242284052909 0.000147931599246 +CTCGAG 0.000180570190376 9.86210661642e-05 +TAGTGG 4.5713972247e-06 0.000123276332705 +TTTCTG 0.000603424433661 0.000721166546325 +TGCAGC 0.000335997696016 0.000366306817181 +TGCCTC 0.000150856108415 0.000200764313263 +TGCCTA 6.39995611459e-05 0.000103904337566 +TGCAGG 0.000217141368173 0.000360143000546 +TTTCCG 6.62852597582e-05 0.000108307063734 +GTGGCC 0.000683423885093 0.000143528873078 +TCAGAC 0.000546281968352 0.000335487734005 +TTTCTT 0.000230855559848 0.000789849074547 +TGCCTT 0.000150856108415 0.000289699381857 +TGCAGT 0.000265141039033 0.000452600250075 +TAGTGC 0.0 0.000141767782611 +GTGAGC 0.000299426518218 0.000209569765599 +AAGGAA 0.0007771375282 0.000410334078862 +AAGGAC 0.00084570848657 0.00024391102971 +AAGGAG 0.0015359894675 0.000302907560361 +ATATGC 8.68565472694e-05 0.000287057746156 +GTTCCA 0.000278855230707 0.000184914499058 +ATATGA 1.37141916741e-05 0.000376873359985 +TACGAA 0.000143999012578 8.45323424264e-05 +ATATGG 0.000107427834781 0.000195481041861 +AAGGAT 0.000642281310071 0.000184914499058 +CTATCA 8.68565472694e-05 0.000162900868218 +TGGTTT 0.000269712436258 0.000460525157177 +ATATGT 7.08566569829e-05 0.000375112269517 +GGTCCC 0.000196570080662 8.71739781273e-05 +GCCCAG 0.000477711009982 0.000143528873078 +CCACTG 0.000354283284915 0.000344293186341 +GCCCAA 0.000171427395926 0.000110068154201 +GGTCCG 0.000100570738944 4.4907806914e-05 +AGGTCT 0.000132570519516 0.000199003222796 +TGTGTC 0.000223998464011 0.000335487734005 +AGACCC 0.000230855559848 0.000152334325414 +AGACCA 0.000217141368173 0.000257999753447 +AGACCG 0.000102856437556 9.42183399961e-05 +CTTCGC 0.000125713423679 7.92490710248e-05 +ATGCAA 0.000228569861235 0.000457883521476 +AGGTCC 7.31423555953e-05 9.6859975697e-05 +AGGTCA 0.000105142136168 0.000269446841484 +AGGTCG 4.5713972247e-05 6.5160347287e-05 +GGTCCT 0.0003885687641 0.000120634697004 +TCCGGA 0.000100570738944 6.86825282215e-05 +CTTAGC 6.39995611459e-05 8.62934328936e-05 +ATTGTG 0.000564567557251 0.000438511526337 +CTTAGA 6.39995611459e-05 0.000117993061304 +ATGCAC 0.000287998025156 0.000300265924661 +CTTAGG 4.79996708594e-05 7.74879805576e-05 +ATTGTC 0.000242284052909 0.000240388848775 +ATTGTA 0.000150856108415 0.000379514995685 +CGCTAC 0.00031085501128 6.69214377543e-05 +ATTTTG 0.000324569202954 0.00072468872726 +CGCTAA 4.5713972247e-06 7.39657996231e-05 +ATTTTA 0.000171427395926 0.00120810806051 +CGCTAG 0.0 4.75494426149e-05 +ATTTTC 0.000287998025156 0.000643678565768 +GAGGTC 0.000580567447538 0.00016113977775 +TAGCAG 4.5713972247e-06 0.000206928129898 +GATACT 0.000150856108415 0.000146170508779 +TAGCAC 0.0 0.000133842875509 +TAGCAA 0.0 0.000176989591955 +GAGGTT 0.000525710680841 0.000172586865787 +ATTTTT 0.000207998573724 0.00135956184069 +GCCTTG 0.000226284162623 0.000162020322984 +GTGGGG 0.000207998573724 0.000143528873078 +GCCTTA 9.82850403312e-05 0.000133842875509 +TTGACA 0.000173713094539 0.000407692443161 +CGCTAT 0.000146284711191 7.13241639223e-05 +GATACG 7.771375282e-05 5.54743497173e-05 +TAGCAT 0.0 0.00020252540373 +GATACC 9.37136431064e-05 6.5160347287e-05 +GATACA 0.00019428438205 0.000188436679992 +TGAGCT 2.28569861235e-06 0.000375112269517 +GTCACC 0.000463996818308 0.00017082577532 +GATCAT 0.000290283723769 0.000277371748587 +TGGCAC 0.000157713204252 0.000178750682423 +AAGACA 0.000383997366875 0.000481658242784 +AAGACC 0.000598853036436 0.000219255763169 +ACAATG 0.000239998354297 0.000381276086153 +AAGACG 0.000292569422381 0.000156737051582 +CCACTT 0.000164570300089 0.000328443372136 +TGAGCG 2.28569861235e-06 0.000157617596816 +GATCAC 0.000322283504342 0.000196361587095 +GATCAA 0.00027199813487 0.000263283024849 +AAGACT 0.00046628251692 0.000280893929521 +GAAGGG 0.000290283723769 0.000206047584664 +CTTCCA 0.000340569093241 0.000226300125037 +GCGGTA 4.11425750223e-05 5.54743497173e-05 +GCGGTG 0.00034971188769 0.00012679851364 +CGGTGT 6.39995611459e-05 0.000132962330275 +TCGTTA 2.74283833482e-05 8.1010161492e-05 +TCGTTC 9.14279444941e-05 8.62934328936e-05 +CTTCCC 0.000246855450134 0.000153214870648 +ACTTGT 0.000111999232005 0.000316115738866 +TTGGAG 0.000555424762802 0.000346054276808 +TGTGTG 0.000626281419785 0.0013886198334 +GCGGTT 0.000150856108415 8.71739781273e-05 +ACTTGC 0.000100570738944 0.000154975961115 +ATGTGA 3.42854791853e-05 0.000453480795308 +ACTTGA 2.28569861235e-06 0.000294982653259 +CGGTGG 5.25710680841e-05 0.000109187608967 +ACTTGG 6.62852597582e-05 0.000176989591955 +CGGTGA 6.85709583706e-06 0.0001074265185 +CGGTGC 2.05712875112e-05 9.15767042953e-05 +TGCCGC 0.000130284820904 0.000103904337566 +TTCCTA 0.000127999122292 0.000155856506349 +TAGACT 0.0 0.000175228501488 +TTCCTC 0.000555424762802 0.000380395540919 +ATGTGC 0.000173713094539 0.000302027015128 +TGGGTT 0.000141713313966 0.000273849567652 +TTCCTG 0.000891422458817 0.000388320448021 +TCCTTT 0.000207998573724 0.000365426271948 +GACCCA 0.000399997257162 0.000152334325414 +TTCCGT 0.000123427725067 8.27712519592e-05 +TAGACG 2.28569861235e-06 0.000110948699435 +TTCCTT 0.000242284052909 0.000324040645968 +TAGACC 2.28569861235e-06 9.50988852297e-05 +TAGACA 0.0 0.000198122677562 +TCCTTG 0.000166855998702 0.000175228501488 +TCCTTA 8.4570848657e-05 0.000162900868218 +TCCTTC 0.000411425750223 0.00025623866298 +ATCTCT 0.000406854352999 0.000313474103165 +TCCGCA 9.82850403312e-05 9.24572495289e-05 +ACCGTT 0.000107427834781 9.06961590617e-05 +TGGCGC 6.85709583706e-05 9.95016113978e-05 +TTTACG 6.39995611459e-05 0.00012679851364 +TGGCGA 3.42854791853e-05 0.000105665428033 +GGCCAT 0.000159998902865 0.000171706320554 +ATCTCG 0.000125713423679 8.62934328936e-05 +ATCTCA 0.000278855230707 0.000302907560361 +ATCTCC 0.000445711229409 0.000250074846345 +GGCCAA 0.000189712984825 0.000154095415882 +GGCCAC 0.000226284162623 0.000174347956255 +ACCGTG 0.000207998573724 8.27712519592e-05 +ACCGTA 7.31423555953e-05 5.45938044837e-05 +GGCCAG 0.00045713972247 0.000214853037001 +ACCGTC 0.000262855340421 9.42183399961e-05 +AGAATT 0.000127999122292 0.000369828998116 +GGCAGT 0.000441139832184 0.000165542503918 +CCATAA 0.0 0.000214853037001 +CAAAGG 0.000157713204252 0.00027561065812 +CCATAC 0.000219427066786 0.0001074265185 +CAAAGA 0.000228569861235 0.000454361340542 +GAAACG 0.000180570190376 0.0002122114013 +CAAAGC 0.00027199813487 0.000311713012697 +CAACGT 4.34282736347e-05 8.71739781273e-05 +GGCAGA 0.000319997805729 0.000300265924661 +GGCAGC 0.000587424543375 0.00020252540373 +CGTGAG 0.000269712436258 0.000113590335136 +GGCAGG 0.000217141368173 0.000184914499058 +CAACGC 5.02853694718e-05 0.000105665428033 +CAAAGT 0.000187427286213 0.000304668650829 +CAACGA 4.5713972247e-05 8.541288766e-05 +CTAACC 0.000102856437556 0.000100382156631 +CAACGG 5.48567666965e-05 5.72354401846e-05 +CGTGAA 0.00019428438205 0.000108307063734 +GGGGGT 0.00015542750564 0.000101262701865 +TACGCT 0.000157713204252 7.39657996231e-05 +GAAACC 0.000404568654386 0.000264163570083 +CGATCT 9.14279444941e-05 6.25187115862e-05 +CTCTAG 1.59998902865e-05 0.000140887237377 +TGAGCC 0.0 0.000179631227656 +CTCTAA 1.59998902865e-05 0.000204286494197 +CTCTAC 0.000482282407206 0.000160259232517 +GGGGGG 3.19997805729e-05 0.000169064684853 +CGATCC 6.17138625335e-05 7.6607435324e-05 +CGATCA 5.71424653088e-05 0.000103023792332 +GGGGGC 0.000139427615353 7.92490710248e-05 +CGATCG 2.74283833482e-05 3.52218093443e-05 +GGGGGA 0.000166855998702 0.000213091946533 +TACGCG 3.65711777976e-05 2.55358117747e-05 +CTCTAT 0.000253712545971 0.000163781413451 +TTCTGA 2.51426847359e-05 0.000423542257366 +CAGACC 0.000516567886392 0.000233344486906 +CAGACA 0.000411425750223 0.000504552418858 +CAGACG 0.000361140380752 0.000191958860927 +TGCGTG 0.000143999012578 0.000147051054013 +TAGTTG 0.0 0.000197242132328 +GCTAAT 0.000221712765398 0.000242149939242 +TAGTTC 0.0 0.000184914499058 +TAGTTA 0.0 0.000230702851205 +CAGACT 0.000390854462712 0.000354859729144 +GCTAAG 0.000251426847359 0.000103904337566 +TAGTTT 2.28569861235e-06 0.000484299878485 +GCTAAC 0.000207998573724 0.000117993061304 +GCTAAA 0.000521139283616 0.000292341017558 +TAAGTG 0.0 0.000232463941673 +TGCTGC 0.000294855120993 0.000424422802599 +AACCCT 0.00041828284606 0.000241269394009 +TATCAA 0.000123427725067 0.000267685751017 +AACCCC 0.000415997147448 0.000153214870648 +AACCCA 0.000443425530796 0.000293221562792 +AACCCG 0.000189712984825 6.60408925206e-05 +TGCATC 0.000374854572426 0.000311713012697 +AGATTT 0.00015542750564 0.000557385132874 +ACGTAA 2.28569861235e-06 0.000103023792332 +AACTGG 0.000441139832184 0.000237747213074 +AACTGA 3.19997805729e-05 0.000530968775866 +AACTGC 0.000399997257162 0.000328443372136 +CCCAGA 0.000326854901566 0.000200764313263 +CCCAGC 0.000459425421083 0.000222777944103 +CCCAGG 0.000150856108415 0.000142648327845 +AACTGT 0.000301712216831 0.000398006445591 +AGTTTT 0.000223998464011 0.000686825282215 +ACGTAT 0.000109713533393 8.62934328936e-05 +CCCAGT 0.00041828284606 0.000140006692144 +CTCCAA 0.000143999012578 0.000253597027279 +TTGACG 0.000127999122292 0.000191078315693 +TATAAT 0.000175998793151 0.000454361340542 +CGCATA 7.771375282e-05 5.98770758854e-05 +ATACTG 0.000212569970949 0.000261521934382 +CGCATC 0.000381711668263 8.80545233609e-05 +ATACTA 6.17138625335e-05 0.000167303594386 +ATACTC 8.91422458817e-05 0.000133842875509 +CGCATG 0.000338283394628 0.000131201239808 +GCGCAA 7.31423555953e-05 0.000108307063734 +ATACTT 9.59993417188e-05 0.00026592466055 +CGCATT 0.000201141477887 0.000118873606537 +GCGCAC 0.000125713423679 0.000127679058873 +GCTCCG 0.000166855998702 0.000110948699435 +TATTGT 7.54280542076e-05 0.000486941514186 +GCTCCC 0.000157713204252 0.000124156877939 +GCTCCA 0.000527996379453 0.000292341017558 +CCTACT 0.000164570300089 0.000103023792332 +TGTACT 6.85709583706e-05 0.000240388848775 +TTTAGT 0.000118856327842 0.000438511526337 +TATTGG 8.22851500447e-05 0.000221897398869 +GCTCCT 0.000468568215532 0.000238627758308 +GCGCAG 0.000299426518218 0.000134723420742 +GCTGGG 0.000274283833482 0.000190197770459 +TTTAGG 7.08566569829e-05 0.00030995192223 +TGTACG 4.79996708594e-05 9.24572495289e-05 +CCTACG 4.34282736347e-05 3.52218093443e-05 +TGTACA 8.4570848657e-05 0.000337248824472 +CCTACA 0.000187427286213 0.000199003222796 +TGTACC 6.39995611459e-05 0.00012944014934 +CCTACC 9.82850403312e-05 7.04436186887e-05 +TTCGCG 5.25710680841e-05 3.34607188771e-05 +TTCGCA 0.000114284930618 0.000102143247099 +TTCGCC 0.000322283504342 6.42798020534e-05 +AGTATC 0.000118856327842 0.000154095415882 +GACTAA 2.28569861235e-05 0.000186675589525 +AGTATA 7.99994514323e-05 0.000206047584664 +GACTAC 0.000585138844762 0.000112709789902 +AGTATG 0.000173713094539 0.000177870137189 +TTTGGA 0.000557710461414 0.000478136061849 +GACTAG 9.14279444941e-06 0.000110948699435 +TTCGCT 0.000201141477887 0.000120634697004 +GTGTAT 0.000347426189078 0.000300265924661 +GACTAT 0.000367997476589 0.000117993061304 +AGTATT 0.000125713423679 0.000301146469894 +TTACTC 9.14279444941e-05 0.000236866667841 +GGTCTT 0.000246855450134 0.000169064684853 +TTACTG 0.000244569751522 0.000339890460173 +ACCTTG 0.000123427725067 0.000194600496628 +ACCTTC 0.000489139503043 0.000181392318123 +ACCTTA 7.99994514323e-05 0.000173467411021 +TTACTT 5.48567666965e-05 0.000407692443161 +ACCTTT 0.000290283723769 0.000353979183911 +ACAGGG 0.000212569970949 0.000162900868218 +CTGGGA 0.000587424543375 0.000217494672701 +CTGGGC 0.000674281090644 0.000172586865787 +ACAGGC 0.000299426518218 0.000230702851205 +ACAGGA 0.000493710900268 0.000375992814751 +CTGGGG 0.000262855340421 0.000154095415882 +CAGGAC 0.000916565143553 0.00025623866298 +GCAGCT 0.000614852926723 0.000390081538489 +CAGGAA 0.000694852378155 0.000398886990825 +TCGCTT 5.71424653088e-05 0.000112709789902 +AGGACC 0.000134856218129 0.000111829244668 +AGGACA 0.000207998573724 0.000382156631386 +GCGCAT 5.48567666965e-05 8.89350685945e-05 +TTATAC 5.48567666965e-05 0.000259760843915 +ACAGGT 0.000290283723769 0.000253597027279 +CTGGGT 0.000454854023858 0.000184033953824 +TTATAG 4.5713972247e-06 0.000217494672701 +CTCCGA 0.000109713533393 0.000103023792332 +TCGCTG 0.00023314125846 0.000168184139619 +GAGTTG 0.000415997147448 0.000182272863357 +GCAGCG 0.000292569422381 0.000206928129898 +AGGACT 0.00015542750564 0.000220136308402 +GCAGCA 0.000683423885093 0.000452600250075 +GCAGCC 0.000527996379453 0.00019283940616 +CAGGAT 0.000685709583706 0.000320518465034 +TGCTGA 2.74283833482e-05 0.000520402233063 +CCTCAG 0.000653709803133 0.000296743743726 +CCTCAA 0.000338283394628 0.000247433210644 +CCTCAC 0.000265141039033 0.000209569765599 +TATGTT 0.000235426957072 0.000406811897927 +ATGGGC 0.00049599659888 0.000134723420742 +TCTTTG 0.000265141039033 0.000390081538489 +ATGGGA 0.000482282407206 0.000223658489337 +TCTTTA 0.000196570080662 0.000504552418858 +ATGGGG 0.000221712765398 0.000177870137189 +TCTTTC 0.000317712107117 0.000386559357554 +CCTCAT 0.000290283723769 0.000296743743726 +TCTTTT 0.000242284052909 0.000680661465579 +GCTAGC 0.000109713533393 7.13241639223e-05 +TATGTA 0.000109713533393 0.000334607188771 +ATGGGT 0.000367997476589 0.000174347956255 +TATGTC 0.000166855998702 0.000183153408591 +GAAAGA 0.000425139941898 0.000527446594932 +ATCAAG 0.000722280761503 0.000254477572513 +CATGAT 0.000365711777976 0.000330204462603 +ATCAAC 0.000751994843464 0.000252716482046 +GAAAGG 0.000228569861235 0.000261521934382 +ATCAAA 0.000742852049015 0.000584682035116 +GGAACT 0.000287998025156 0.000175228501488 +GTCAGG 0.000162284601477 0.000197242132328 +CATGAG 0.000509710790555 0.000221897398869 +ATCAAT 0.000436568434959 0.000342532095874 +GTCCAA 0.000150856108415 0.000183153408591 +CATGAC 0.000313140709892 0.000272088477185 +CATGAA 0.000361140380752 0.000442033707272 +TGACCT 4.5713972247e-06 0.000279132839054 +GTAGCG 8.4570848657e-05 5.10716235493e-05 +CAAGTT 0.000210284272336 0.000292341017558 +GCGGCT 0.000281140929319 0.000110948699435 +GCTTTA 0.000281140929319 0.000419139531198 +GCTTTC 0.000386283065488 0.000316115738866 +TTTCTC 0.000292569422381 0.000530968775866 +GCGGCG 0.000198855779275 9.15767042953e-05 +CAAGTG 0.000342854791853 0.000238627758308 +GTAGCT 0.000150856108415 0.000165542503918 +TTCTTT 0.000397711558549 0.000686825282215 +GCGGCC 0.000230855559848 9.24572495289e-05 +CAAGTC 0.000205712875112 0.000191078315693 +GCGGCA 0.000123427725067 8.45323424264e-05 +CAAGTA 7.771375282e-05 0.000171706320554 +AACGGT 0.000198855779275 0.000109187608967 +GGGGAA 0.000262855340421 0.000239508303542 +TAATCG 0.0 9.77405209306e-05 +CTTGTG 0.000303997915443 0.000301146469894 +TAATCA 2.28569861235e-06 0.00036366518148 +TAATCC 2.28569861235e-06 0.000184914499058 +TGCGAA 8.22851500447e-05 8.45323424264e-05 +CGGCCC 0.000118856327842 7.39657996231e-05 +AAAATT 0.000297140819606 0.000678019829879 +TTGATA 8.22851500447e-05 0.000290579927091 +CGGCCG 9.59993417188e-05 7.04436186887e-05 +CTTGTA 0.000121142026455 0.000245672120177 +GGTCTG 0.000655995501745 0.0002122114013 +TAATCT 0.0 0.000321399010267 +AGTTTA 0.000175998793151 0.000444675342972 +TGCGAC 0.000166855998702 7.57268900903e-05 +GGTCTC 0.000249141148746 0.000130320694574 +GGAGGC 0.000541710571128 0.000204286494197 +GGTCTA 0.000107427834781 9.06961590617e-05 +AAAATG 0.000614852926723 0.000964197030801 +AAAATC 0.000591995940599 0.000572354401846 +TCAATA 9.59993417188e-05 0.000352218093443 +AAAATA 0.000290283723769 0.00114823098463 +TCGTCA 0.000114284930618 0.000110948699435 +ATCCCT 0.000315426408505 0.000208689220365 +TTCAGG 0.000306283614055 0.000317876829333 +ATATCC 0.000105142136168 0.00017082577532 +TCGTCG 4.34282736347e-05 5.45938044837e-05 +TTTAGC 0.000137141916741 0.000327562826902 +TGCCAA 0.000146284711191 0.000279132839054 +TCGGGA 7.99994514323e-05 6.78019829879e-05 +GAACAA 0.000342854791853 0.000375112269517 +ATCCCG 0.000169141697314 7.74879805576e-05 +GAACAC 0.000319997805729 0.000300265924661 +ATCCCC 0.000212569970949 0.000108307063734 +GAACAG 0.000642281310071 0.000312593557931 +ATCCCA 0.000372568873813 0.000205167039431 +AACGGA 0.000333711997403 0.000127679058873 +CACCAC 0.000217141368173 0.000267685751017 +CACCAA 0.000159998902865 0.000257119208214 +CACCAG 0.000397711558549 0.000323160100734 +AACATT 0.000509710790555 0.000726449817727 +AACGGG 0.000185141587601 7.48463448567e-05 +TCCGTC 0.000185141587601 0.000116231970836 +GAGTTA 0.000171427395926 0.000178750682423 +TCCGTA 5.94281639212e-05 6.33992568198e-05 +ACCAGA 0.000290283723769 0.000314354648398 +CACCAT 0.000153141807028 0.000247433210644 +AACATG 0.00080685161016 0.000499269147456 +AACATA 0.000235426957072 0.000405931352694 +AACATC 0.00100342169082 0.000421781166899 +CAGTCG 0.000221712765398 0.000114470880369 +GCACGG 0.000132570519516 7.74879805576e-05 +GTCAGA 0.000324569202954 0.000347815367275 +GCACGA 0.000125713423679 9.59794304633e-05 +CAGTCC 0.000354283284915 0.000206928129898 +GCACGC 9.59993417188e-05 0.000105665428033 +CAGTCA 0.000278855230707 0.000367187362415 +GCACCA 0.00027199813487 0.000191958860927 +GCAAGC 0.000127999122292 0.000149692689713 +GCACGT 9.82850403312e-05 0.000110068154201 +CAGTCT 0.000518853585004 0.000309071376997 +TAAAGC 0.0 0.000366306817181 +GCAAGG 0.000107427834781 0.000114470880369 +GTCAGT 0.000297140819606 0.000282655019988 +GTATAC 6.85709583706e-05 0.000120634697004 +TTCCCG 0.000102856437556 0.000103023792332 +GTATAA 1.14284930618e-05 0.000235105577374 +GTATAG 1.14284930618e-05 0.000125917968406 +CCGGAA 0.000105142136168 5.81159854182e-05 +CCGGAC 0.000239998354297 8.01296162584e-05 +CCGGAG 0.000356568983527 0.000110948699435 +CGTCTT 0.000109713533393 0.000145289963545 +TATTTG 0.000201141477887 0.000569712766145 +TTCCGG 0.000114284930618 5.10716235493e-05 +TTCCGA 5.25710680841e-05 6.5160347287e-05 +TTCCGC 0.000239998354297 8.80545233609e-05 +GTATAT 8.22851500447e-05 0.000280013384288 +CGTCTC 0.000173713094539 0.000138245601677 +CGTCTA 5.48567666965e-05 9.50988852297e-05 +CGTCTG 0.000461711119695 0.000189317225226 +CCGGAT 0.000150856108415 8.01296162584e-05 +CTCTTC 0.000692566679543 0.000375112269517 +TGTTAT 0.00011657062923 0.000452600250075 +CTCTTA 9.82850403312e-05 0.00022453903457 +CTCTTG 0.000153141807028 0.000235105577374 +CCCGAT 0.000111999232005 4.4907806914e-05 +TACGTA 4.79996708594e-05 5.89965306518e-05 +TACGTC 0.00019428438205 6.5160347287e-05 +TCTGGT 0.000315426408505 0.000250074846345 +CGCGAT 3.65711777976e-05 4.22661712132e-05 +TACGTG 0.000223998464011 8.62934328936e-05 +TGTTAG 2.28569861235e-06 0.00020252540373 +GGTTTC 0.000319997805729 0.000226300125037 +CTCGTG 0.000123427725067 0.000100382156631 +CTCTTT 0.000322283504342 0.000504552418858 +TGTTAA 9.14279444941e-06 0.000473733335681 +CGCGAA 4.34282736347e-05 4.66688973813e-05 +CGCGAC 6.85709583706e-05 4.0505080746e-05 +GATATT 0.000377140271038 0.000452600250075 +TCTGGC 0.000278855230707 0.000235986122607 +TACGTT 8.4570848657e-05 0.000132081785041 +CGCGAG 0.000166855998702 6.42798020534e-05 +AGTCGT 0.000130284820904 8.18907067256e-05 +TTACCT 0.000134856218129 0.000270327386718 +CTCCAT 0.000146284711191 0.000320518465034 +TATGCC 0.000283426627932 9.95016113978e-05 +TTACCG 6.85709583706e-05 8.62934328936e-05 +CTCCAC 0.000223998464011 0.000339890460173 +AGTCGG 0.000118856327842 8.36517971928e-05 +TTACCC 0.000105142136168 0.000145289963545 +AGTCGA 0.000125713423679 9.06961590617e-05 +TTACCA 0.000123427725067 0.000229822305972 +AGTCGC 0.000121142026455 7.92490710248e-05 +GTACCG 5.94281639212e-05 4.13856259796e-05 +CCGACT 9.59993417188e-05 6.16381663526e-05 +GCCTAC 0.000372568873813 9.59794304633e-05 +GCCTAA 2.28569861235e-05 0.000110068154201 +GCCTAG 2.28569861235e-06 7.48463448567e-05 +GTGCGG 0.000210284272336 6.25187115862e-05 +CCGACA 0.000100570738944 8.98156138281e-05 +GATATC 0.000299426518218 0.000147931599246 +CCGACC 0.000105142136168 6.16381663526e-05 +CCGACG 4.11425750223e-05 4.13856259796e-05 +GCCTAT 0.000185141587601 0.000103023792332 +TGACGG 0.0 0.000130320694574 +TGACGT 4.5713972247e-06 0.000213091946533 +CCCGAG 0.000255998244583 5.81159854182e-05 +CTCGTT 7.08566569829e-05 9.77405209306e-05 +CCCGAA 0.000157713204252 9.95016113978e-05 +CGCACA 0.000210284272336 0.000211330856066 +ATACAC 0.000121142026455 0.000376873359985 +CGCACC 0.000244569751522 6.86825282215e-05 +ATACAA 8.68565472694e-05 0.000376873359985 +ACTGCT 0.000436568434959 0.000381276086153 +ATACAG 0.000276569532095 0.000337248824472 +ATTGCC 0.000329140600179 0.000131201239808 +GGGTCC 9.59993417188e-05 8.62934328936e-05 +GAGCGT 0.000283426627932 0.000130320694574 +CTCACT 0.000409140051611 0.000285296655689 +GGGTCT 0.000125713423679 0.000115351425603 +ACTGCA 0.000393140161325 0.000489583149886 +TTTGTC 0.000354283284915 0.00040505080746 +ACTGCC 0.000299426518218 0.000181392318123 +CGCACT 0.000164570300089 8.98156138281e-05 +ATACAT 7.54280542076e-05 0.000381276086153 +ACTGCG 0.000107427834781 0.000130320694574 +CTCACC 0.000553139064189 0.000220136308402 +CTCACA 0.000411425750223 0.000321399010267 +CTCACG 0.000159998902865 9.33377947625e-05 +GTGGGT 0.000340569093241 0.000147931599246 +GTGAGG 0.000226284162623 0.000229822305972 +GATTTT 0.00034971188769 0.000633992568198 +ACAATT 0.000146284711191 0.000409453533628 +CTTGAA 0.000306283614055 0.000316996284099 +TAGTGA 0.0 0.000164661958685 +GTGAGA 0.000235426957072 0.00030995192223 +TCGACG 3.42854791853e-05 6.95630734551e-05 +TCGACA 5.25710680841e-05 0.000111829244668 +TAGAGG 2.28569861235e-06 0.000182272863357 +ACAATA 0.000105142136168 0.000421781166899 +GTGAGT 0.000221712765398 0.000221016853636 +ACAATC 0.00015542750564 0.000266805205783 +GATTTC 0.000498282297493 0.000337248824472 +CCAGTA 0.000134856218129 0.000176109046722 +TCGACT 7.31423555953e-05 9.95016113978e-05 +CTGGTT 0.000493710900268 0.000272969022419 +TTGAGT 0.000164570300089 0.000389200993255 +TCAAAA 0.000262855340421 0.000655125653805 +CGAACG 3.65711777976e-05 6.25187115862e-05 +CGAACC 8.22851500447e-05 6.42798020534e-05 +CGAACA 9.37136431064e-05 0.000125917968406 +CTGGTG 0.00132570519516 0.000285296655689 +CTGGTA 0.000173713094539 0.000151453780181 +CTGGTC 0.000548567666965 0.000182272863357 +CGAACT 7.99994514323e-05 7.6607435324e-05 +TTGCAT 0.000102856437556 0.000402409171759 +GACGAG 0.000868565472694 0.000134723420742 +TTGCAG 0.000356568983527 0.000345173731575 +GAGGGA 0.000619424323947 0.000284416110456 +TTGCAC 0.000173713094539 0.000239508303542 +TTGCAA 0.000148570409803 0.000347815367275 +TCCATC 0.000653709803133 0.000308190831763 +TCGCAT 4.11425750223e-05 0.000109187608967 +GTCGTG 0.000146284711191 9.50988852297e-05 +GTCGTA 4.79996708594e-05 4.93105330821e-05 +GTCGTC 0.000132570519516 9.86210661642e-05 +CCGTTT 0.000166855998702 0.000151453780181 +GAGCAA 0.000484568105819 0.000284416110456 +TTTTTG 0.000217141368173 0.00087350087174 +ATATCG 4.11425750223e-05 9.50988852297e-05 +GTCGTT 6.39995611459e-05 8.89350685945e-05 +TCAGAT 0.000511996489167 0.000434108800169 +TCGCAG 0.000223998464011 0.000110068154201 +GTGCTC 0.000434282736347 0.00023422503214 +TCGCAC 6.39995611459e-05 9.42183399961e-05 +CCGTTG 5.25710680841e-05 8.27712519592e-05 +CCGTTA 3.65711777976e-05 5.81159854182e-05 +CCGTTC 0.000191998683438 7.6607435324e-05 +GATCGG 0.000100570738944 5.45938044837e-05 +AATGCT 0.000438854133572 0.000390081538489 +GGTACG 4.5713972247e-05 4.31467164468e-05 +GGTACA 0.000114284930618 0.000133842875509 +TCCAGG 0.000214855669561 0.000248313755878 +GGTACC 5.71424653088e-05 4.66688973813e-05 +GCGGAC 0.000207998573724 6.95630734551e-05 +CAGGGA 0.000372568873813 0.000221016853636 +TTCAGC 0.000603424433661 0.000477255516616 +TATTTC 0.00031085501128 0.000489583149886 +TATTTA 0.000111999232005 0.000924572495289 +CCCCCT 0.000244569751522 0.000177870137189 +GGTACT 7.99994514323e-05 8.71739781273e-05 +AATGCG 0.000118856327842 0.00012679851364 +AATGCC 0.000393140161325 0.000183153408591 +AATGCA 0.000463996818308 0.000523924413997 +CCCCCC 7.99994514323e-05 0.000122395787472 +CCCCCA 0.000178284491763 0.000136484511209 +TATTTT 0.000207998573724 0.00146874944966 +CCCCCG 8.68565472694e-05 6.16381663526e-05 +CTTGAG 0.000411425750223 0.000206047584664 +ATGATG 0.000726852158728 0.000510716235493 +GAAGTA 0.000230855559848 0.000198122677562 +ATGATA 0.000130284820904 0.000280013384288 +ATGATC 0.000601138735049 0.000272088477185 +TGCAAC 0.000324569202954 0.000235986122607 +TGCAAA 0.000347426189078 0.000556504587641 +TGCAAG 0.000340569093241 0.000247433210644 +GAAGTG 0.000795423117099 0.000315235193632 +ATGATT 0.000365711777976 0.000494866421288 +CTTGAT 0.000301712216831 0.000258880298681 +GTGCTT 0.000306283614055 0.000283535565222 +TTGAGG 0.000207998573724 0.000254477572513 +GCCATT 0.000575996050313 0.00029762428896 +TTGAGC 0.000191998683438 0.00025623866298 +TGCAAT 0.000196570080662 0.000346934822042 +GAGAAT 0.000715423665666 0.000273849567652 +TGTCTT 0.000143999012578 0.000387439902788 +TTCAGA 0.00045713972247 0.000529207685399 +AGTAGC 0.00011657062923 0.000105665428033 +AAGGCC 0.00054399626974 0.000159378687283 +ATAACC 9.37136431064e-05 0.000204286494197 +AAGGCA 0.000397711558549 0.000273849567652 +ATAACA 0.000159998902865 0.000452600250075 +AAGGCG 0.000196570080662 9.59794304633e-05 +ATAACG 5.25710680841e-05 0.000102143247099 +TATGCT 0.000301712216831 0.000264163570083 +GAGGGT 0.000498282297493 0.000165542503918 +TGTCTG 0.000527996379453 0.000526566049698 +GAGAAG 0.00225369883178 0.000361904091013 +GAGAAA 0.00165484579534 0.000587323670817 +TGTCTC 0.000148570409803 0.000263283024849 +GAGAAC 0.00107884974503 0.000236866667841 +TGTCTA 9.14279444941e-05 0.000219255763169 +TGTGGC 0.000237712655685 0.000216614127468 +TGTGGA 0.000450282626633 0.000469330609513 +TGTGGG 0.000201141477887 0.000241269394009 +ATAACT 9.14279444941e-05 0.000258880298681 +ACTGAC 0.000420568544673 0.000328443372136 +GGTATT 0.000191998683438 0.000168184139619 +AGGTAT 0.000125713423679 0.00015849814205 +ACCAAG 0.000658281200357 0.00017082577532 +GAGCAT 0.000329140600179 0.000235986122607 +ACCAAA 0.000671995392032 0.00035133754821 +ATCATC 0.00085485128102 0.000474613880915 +ACCAAC 0.000566853255863 0.0002122114013 +GGTCAC 0.000242284052909 0.000174347956255 +GATCGC 0.000162284601477 6.0757621119e-05 +GGTCAT 0.000276569532095 0.000203405948964 +ACCAAT 0.000365711777976 0.000206047584664 +AGGTAG 6.85709583706e-06 0.0001074265185 +AGGTAA 4.5713972247e-06 0.000221897398869 +AGGTAC 0.000100570738944 0.000124156877939 +TTTTGC 9.82850403312e-05 0.000473733335681 +GCCGTC 0.000281140929319 9.77405209306e-05 +AATTGG 6.17138625335e-05 0.000199883768029 +GTCGGA 0.000127999122292 8.98156138281e-05 +AATTGA 2.28569861235e-06 0.00036366518148 +ATCATG 0.00069028098093 0.000377753905218 +AATTGC 3.885687641e-05 0.000198122677562 +TAGCCA 0.0 0.000137365056443 +TGGGGT 0.000146284711191 0.000172586865787 +CGCTCG 0.000102856437556 7.57268900903e-05 +GATAAT 0.000297140819606 0.000214853037001 +CGCTCA 0.000153141807028 0.000141767782611 +CGCTCC 0.000313140709892 0.00011711251607 +AATTGT 7.31423555953e-05 0.000440272616804 +AATCTT 0.000230855559848 0.000370709543349 +TCTTAT 0.000171427395926 0.000244791574943 +GTTATG 0.000159998902865 0.000247433210644 +CGCTCT 0.000267426737645 0.000173467411021 +GATAAA 0.000642281310071 0.000399767536058 +TCGAAG 0.000102856437556 8.541288766e-05 +GATAAC 0.000331426298791 0.000172586865787 +TAGCCT 0.0 0.000154975961115 +TGGGGC 0.000169141697314 0.000125917968406 +GATAAG 0.000482282407206 0.00012679851364 +GATCCT 0.000436568434959 0.000198122677562 +AAGAAT 0.000489139503043 0.000366306817181 +GGGGCT 0.000150856108415 0.000154095415882 +GTTATC 0.000162284601477 0.00016113977775 +AAGAAC 0.000989707499149 0.000309071376997 +GATCCA 0.000409140051611 0.000233344486906 +AAGAAA 0.00165941719257 0.0008541288766 +GATCCC 0.000258283943196 0.000108307063734 +AAGAAG 0.00198170069691 0.000475494426149 +GATCCG 0.000175998793151 0.000103023792332 +GCCCCA 0.000166855998702 9.77405209306e-05 +TATTAA 1.82855888988e-05 0.000708838913055 +CAAGGG 0.000132570519516 0.00012679851364 +CAAGGC 0.00027199813487 0.000146170508779 +GGTTCT 0.000212569970949 0.00015849814205 +CAAGGA 0.000351997586302 0.000177870137189 +GGTTCA 0.000180570190376 0.000179631227656 +GGTTCC 0.000127999122292 9.77405209306e-05 +AAGGCT 0.000619424323947 0.000228061215505 +TGCATT 0.000228569861235 0.00058556258035 +GGTTCG 6.17138625335e-05 4.75494426149e-05 +TAGGCA 0.0 9.6859975697e-05 +ATTATA 9.14279444941e-05 0.000514238416427 +ATTATC 0.000210284272336 0.000257999753447 +TAGAAT 0.0 0.000208689220365 +GATAGT 0.000130284820904 0.000132081785041 +ATTATG 0.000221712765398 0.000405931352694 +AGTCTT 0.000212569970949 0.000266805205783 +TCCCAA 0.000139427615353 0.000213091946533 +TAGAAA 0.0 0.000353098638677 +TAGAAC 0.0 0.000112709789902 +ATTATT 0.000212569970949 0.000972121937904 +TAGAAG 0.0 0.000193719951394 +AGTCTA 0.000130284820904 0.000163781413451 +AGTCTC 0.000169141697314 0.000207808675132 +AGTCTG 0.000564567557251 0.000353979183911 +TAACTC 0.0 0.000174347956255 +TAACTA 2.28569861235e-06 0.000195481041861 +TAACTG 0.0 0.00023422503214 +ATCTAT 0.000265141039033 0.000272969022419 +GCCCCG 0.000123427725067 5.37132592501e-05 +TAACTT 0.0 0.000312593557931 +ATCTAG 9.14279444941e-06 0.000125037423172 +ATCTAC 0.00053485347529 0.000177870137189 +ATCTAA 1.14284930618e-05 0.000294982653259 +GGTCAG 0.000445711229409 0.000249194301111 +CCATGT 0.000162284601477 0.000250074846345 +GCCCCC 0.000159998902865 0.000103023792332 +TGGAGG 0.000283426627932 0.000404170262226 +TGGAGA 0.00027199813487 0.000554743497173 +GGTCAA 0.000221712765398 0.000198122677562 +CCATGC 0.000125713423679 0.00016113977775 +TCCAGA 0.00037942596965 0.000412975714562 +CCATGA 4.5713972247e-06 0.000240388848775 +CCATGG 0.000141713313966 0.000155856506349 +TGGAGT 0.000189712984825 0.000331085007837 +TCAGTA 0.000123427725067 0.000257119208214 +TCAGTC 0.000205712875112 0.000324040645968 +CTCTCT 0.00031085501128 0.000493985876054 +GGGGAT 0.000285712326544 0.000113590335136 +TCAGTG 0.000463996818308 0.000439392071571 +CGATAT 8.68565472694e-05 6.78019829879e-05 +CTCTCG 0.00011657062923 0.000131201239808 +GGGGAC 0.00023314125846 0.000135603965976 +CTCTCC 0.00042742564051 0.000332846098304 +TCAGTT 0.000166855998702 0.000448197523907 +CTCTCA 0.000237712655685 0.00028793829139 +CGATAG 2.28569861235e-06 4.40272616804e-05 +CGATAA 1.37141916741e-05 8.80545233609e-05 +ATGCTG 0.000966850513025 0.000434108800169 +CGATAC 0.000166855998702 5.72354401846e-05 +TTCACT 0.000461711119695 0.000448197523907 +GTGTTT 0.000829708596284 0.000772238169875 +GCTACT 0.000143999012578 0.000145289963545 +GTGGTT 0.000491425201656 0.000254477572513 +GTGTTC 0.000509710790555 0.000279132839054 +GTGTTA 0.000130284820904 0.000276491203353 +GTGTTG 0.000399997257162 0.000397125900358 +CGTGCC 0.000139427615353 6.5160347287e-05 +GTGGTA 0.00015542750564 0.000131201239808 +GCTACA 0.000210284272336 0.000209569765599 +GTGGTC 0.000511996489167 0.000157617596816 +GCTACC 7.54280542076e-05 6.95630734551e-05 +GTGGTG 0.00117256338814 0.000266805205783 +GCTACG 4.5713972247e-05 3.52218093443e-05 +CGTGCA 0.000141713313966 0.000119754151771 +TTTCGT 0.000107427834781 0.000114470880369 +TGCCCT 0.000157713204252 0.000171706320554 +AGCGTT 0.000130284820904 0.00014881214448 +CGTGCG 3.19997805729e-05 7.04436186887e-05 +CACGGA 0.000164570300089 9.33377947625e-05 +TGCCCA 0.000150856108415 0.000145289963545 +TGCCCG 8.4570848657e-05 6.16381663526e-05 +ACAGTG 0.000559996160026 0.000407692443161 +AGCGTA 4.5713972247e-05 7.22047091559e-05 +AGCGTC 0.000214855669561 0.000110948699435 +GTACGT 3.885687641e-05 6.86825282215e-05 +AGCGTG 0.000230855559848 0.000117993061304 +GGCCCC 0.000198855779275 8.89350685945e-05 +GGCCCA 0.000262855340421 0.000117993061304 +CACGTG 0.000175998793151 0.000156737051582 +GGCCCG 0.000118856327842 6.5160347287e-05 +CACGTA 4.34282736347e-05 7.92490710248e-05 +CACGTC 0.000130284820904 0.000117993061304 +ACGTGC 7.99994514323e-05 9.24572495289e-05 +ACGTGA 4.5713972247e-06 0.00015849814205 +ACGTGG 6.39995611459e-05 0.000106545973267 +AAATGG 0.000322283504342 0.000427944983534 +CACGTT 8.22851500447e-05 0.000133842875509 +GGGGCC 0.000178284491763 7.92490710248e-05 +TCTTAA 9.14279444941e-06 0.000364545726714 +GGCCCT 0.000299426518218 0.000108307063734 +GGGACA 0.000223998464011 0.000191958860927 +GGTATA 3.885687641e-05 0.0001074265185 +GGGACC 0.000137141916741 8.62934328936e-05 +TCGTGG 6.85709583706e-05 6.16381663526e-05 +ACGTGT 9.59993417188e-05 0.000167303594386 +TCTTAG 2.28569861235e-06 0.00012944014934 +GCTTCC 0.00019428438205 0.000136484511209 +AGAGAG 0.00084570848657 0.000708838913055 +AGAGAA 0.000511996489167 0.00057587658278 +AGAGAC 0.000626281419785 0.000323160100734 +TCGTGA 9.14279444941e-06 8.18907067256e-05 +GTCTTT 0.000255998244583 0.000334607188771 +TCTATC 0.000159998902865 0.000160259232517 +TCTATG 0.000219427066786 0.000150573234947 +AGAGAT 0.000422854243285 0.000348695912509 +TTCACA 0.000482282407206 0.000567951675678 +GTCTTG 0.000164570300089 0.000195481041861 +TCTATT 0.000148570409803 0.000300265924661 +GTCTTC 0.000425139941898 0.000267685751017 +GTCTTA 9.59993417188e-05 0.000169945230086 +GCAGAG 0.00120913456593 0.000402409171759 +GAAGGC 0.000461711119695 0.000201644858496 +GCTCAC 0.000267426737645 0.000213972491767 +GCAGAC 0.000617138625335 0.000276491203353 +GCAGAA 0.000710852268442 0.000471972245214 +GCTCAG 0.000861708376857 0.000289699381857 +ATGCGT 0.000166855998702 0.000114470880369 +TTGCTG 0.000420568544673 0.000401528626526 +CTTGAC 0.000255998244583 0.000208689220365 +TTGCTA 8.4570848657e-05 0.000199003222796 +TTGCTC 0.000159998902865 0.000260641389148 +GCAGAT 0.00065142410452 0.000358381910079 +GCTCAT 0.000313140709892 0.00026592466055 +GTTTGC 0.000137141916741 0.000311713012697 +TTGCTT 0.000189712984825 0.000420900621665 +ATGCGG 0.00011657062923 9.15767042953e-05 +GAGAGG 0.000623995721172 0.000369828998116 +TAGCCG 0.0 5.72354401846e-05 +ATGCGC 0.000214855669561 0.0001074265185 +ATGCGA 0.000118856327842 0.000110948699435 +TGTAAG 0.000253712545971 0.000237747213074 +GGCTAG 2.28569861235e-06 8.18907067256e-05 +TGTAAC 0.000182855888988 0.00027825229382 +GGCTAC 0.000367997476589 9.59794304633e-05 +GACTGT 0.0003885687641 0.00029762428896 +GGCTAA 9.14279444941e-06 0.000156737051582 +ACTGTA 0.000221712765398 0.000388320448021 +TTGGTA 8.22851500447e-05 0.00013912614691 +ACTGTC 0.000285712326544 0.000222777944103 +TTGGTC 0.000187427286213 0.000205167039431 +TTCGAC 0.000265141039033 8.80545233609e-05 +ACTGTG 0.000525710680841 0.000365426271948 +AATCAA 0.000235426957072 0.000513357871194 +GACTGC 0.000548567666965 0.000267685751017 +GGCTAT 0.000255998244583 0.000156737051582 +GACTGA 6.62852597582e-05 0.000403289716993 +GACTGG 0.000553139064189 0.00027561065812 +TGTAAT 0.000137141916741 0.000469330609513 +TGTGGT 0.000230855559848 0.000349576457743 +TTGGTT 0.000182855888988 0.000323160100734 +ACTGTT 0.000351997586302 0.000425303347833 +GTTTCT 0.000260569641808 0.00044907806914 +ATAATT 9.14279444941e-05 0.000549460225772 +CCTTTT 0.00019428438205 0.000455241885776 +GTTTCG 6.39995611459e-05 8.80545233609e-05 +GTTTCC 0.000175998793151 0.000290579927091 +GTTTCA 0.000230855559848 0.000400648081292 +ATAATG 0.000153141807028 0.000409453533628 +CCTTTA 0.000171427395926 0.000359262455312 +CCTTTC 0.000246855450134 0.000208689220365 +ATAATC 0.000150856108415 0.000274730112886 +ATAATA 5.48567666965e-05 0.000579398763714 +CCTTTG 0.000207998573724 0.000258880298681 +ACAGAA 0.000610281529498 0.000590845851751 +ACAGAC 0.00066056689897 0.000409453533628 +GCCCCT 0.000244569751522 9.86210661642e-05 +ACAGAG 0.000980564704699 0.000471972245214 +TTATCT 8.68565472694e-05 0.000280893929521 +CTGGAC 0.00133713368823 0.000280893929521 +CTGGAA 0.000758851939301 0.000427944983534 +CTGGAG 0.00258512513057 0.000533610411567 +ACAGAT 0.000541710571128 0.00044907806914 +GTGAAG 0.00119999177148 0.000389200993255 +TGGGGA 0.000175998793151 0.000176989591955 +CCTTGC 0.000143999012578 0.000144409418312 +TTATCA 9.37136431064e-05 0.000390081538489 +CTGGAT 0.0010354214714 0.000389200993255 +TTATCC 0.000105142136168 0.000185795044291 +CCAATG 0.000338283394628 0.000188436679992 +AAACCG 0.000159998902865 0.000127679058873 +AAACCA 0.000658281200357 0.000476374971382 +CCAATC 0.000180570190376 0.000165542503918 +AAACCC 0.000546281968352 0.000313474103165 +CCAATA 7.99994514323e-05 0.000184914499058 +TGTCGG 8.91422458817e-05 9.86210661642e-05 +GAGATC 0.00122970585345 0.000232463941673 +AACGAG 0.000473139612757 0.000123276332705 +GAGATA 0.000210284272336 0.00017082577532 +AACGAA 0.000217141368173 0.000137365056443 +GAGATG 0.00116799199091 0.000374231724284 +AACGAC 0.000374854572426 0.000117993061304 +AAACCT 0.000518853585004 0.000374231724284 +CCAATT 0.000118856327842 0.000206928129898 +ATTTGC 0.000105142136168 0.00038303717662 +GTCGAT 8.4570848657e-05 6.78019829879e-05 +ATTTGG 0.000105142136168 0.000312593557931 +AACGAT 0.000196570080662 0.00012679851364 +TGTCGT 7.771375282e-05 0.00014881214448 +CCCTAC 0.000210284272336 6.69214377543e-05 +GAGATT 0.000681138186481 0.000302907560361 +CCCTAA 4.5713972247e-06 0.000140887237377 +TACAAC 0.000571424653088 0.000232463941673 +CATTAT 0.000201141477887 0.000448197523907 +CTACAC 9.14279444941e-05 0.000222777944103 +TGGATT 0.000219427066786 0.000422661712132 +ATCACA 0.000598853036436 0.000440272616804 +ATCACC 0.000605710132273 0.000221897398869 +CATGCT 0.000287998025156 0.00032932391737 +TGACAC 2.28569861235e-06 0.000225419579804 +ATCACG 0.000187427286213 0.000106545973267 +TGGATA 8.4570848657e-05 0.000309071376997 +CATTAG 4.5713972247e-06 0.000260641389148 +CATTAA 1.59998902865e-05 0.000459644611944 +CATTAC 0.000235426957072 0.000285296655689 +CATGCA 0.000265141039033 0.000403289716993 +TGACAT 2.28569861235e-06 0.000434108800169 +CATGCC 0.000210284272336 0.000179631227656 +ATCACT 0.000523424982229 0.000282655019988 +CATGCG 7.31423555953e-05 0.000117993061304 +GTAGAA 0.000164570300089 0.000194600496628 +GTAGAC 0.000205712875112 0.000110948699435 +GTAGAG 0.000322283504342 0.000140887237377 +ACAACA 0.000338283394628 0.000678019829879 +ACAACC 0.000146284711191 0.000213091946533 +GATTGC 0.000111999232005 0.000155856506349 +ACAACG 7.31423555953e-05 0.000104784882799 +ACTAAG 0.000203427176499 0.000160259232517 +GTAGAT 0.000249141148746 0.000164661958685 +TGCTAC 0.000226284162623 0.000125037423172 +GGGTAC 0.000111999232005 5.98770758854e-05 +TGATGC 4.5713972247e-06 0.000308190831763 +GATTGT 0.000148570409803 0.000293221562792 +TTCAGT 0.000450282626633 0.000518641142595 +ACAACT 0.000187427286213 0.00033196555307 +GGGTAA 4.5713972247e-06 0.000130320694574 +TTGCCT 0.000180570190376 0.000247433210644 +TAATAG 0.0 0.000210450310832 +AGTCCG 9.59993417188e-05 6.86825282215e-05 +TAATAC 0.0 0.000221016853636 +GTCCGA 0.00015542750564 6.69214377543e-05 +TAATAA 0.0 0.000759910536604 +GTCCGC 0.000148570409803 6.42798020534e-05 +TGTTTA 9.59993417188e-05 0.000845323424264 +TCAACA 0.000228569861235 0.000443794797739 +CACATC 0.000502853694718 0.000357501364845 +GTCCGT 9.14279444941e-05 7.83685257912e-05 +TAATAT 0.0 0.000545938044837 +ATTCGC 0.00015542750564 8.89350685945e-05 +TTCTCC 0.000575996050313 0.000375112269517 +ATTCGA 0.000157713204252 8.541288766e-05 +TAACGA 0.0 8.45323424264e-05 +ATTCGG 9.14279444941e-05 6.69214377543e-05 +TTCTCG 8.91422458817e-05 0.000115351425603 +GAGCTA 0.000205712875112 0.000162900868218 +TCGTAC 0.000114284930618 5.37132592501e-05 +TACCTT 0.000180570190376 0.000189317225226 +TCGTAA 4.5713972247e-06 9.24572495289e-05 +TCGTAG 4.5713972247e-06 4.57883521476e-05 +GAACCT 0.000290283723769 0.000124156877939 +ATCCAA 0.000203427176499 0.000272969022419 +ATCCAC 0.00041828284606 0.000236866667841 +TGAACC 0.0 0.000198122677562 +TTCTCT 0.000445711229409 0.000457883521476 +ATCCAG 0.000836565692121 0.00033196555307 +GAACCC 0.000260569641808 0.000140006692144 +TTATAT 7.31423555953e-05 0.000604934575489 +GAACCA 0.000326854901566 0.000182272863357 +GAACCG 0.000107427834781 9.24572495289e-05 +TACCTC 0.000313140709892 0.000162900868218 +TCGTAT 9.59993417188e-05 8.62934328936e-05 +ACCATC 0.000799994514323 0.000185795044291 +ACCATA 0.000210284272336 0.000149692689713 +ACCATG 0.000493710900268 0.00018051177289 +ATGTTG 0.000367997476589 0.000425303347833 +AGCTCT 0.000452568325246 0.000339890460173 +TGTCCT 0.000230855559848 0.000311713012697 +AGTGGT 0.000230855559848 0.000189317225226 +TGATGT 6.85709583706e-06 0.000526566049698 +ATGTTT 0.000491425201656 0.000846203969498 +ACCATT 0.000443425530796 0.000281774474755 +AGCTCG 0.000139427615353 0.000117993061304 +AGTGGC 0.000262855340421 0.000176109046722 +AGCTCC 0.000411425750223 0.000251835936812 +AGCTCA 0.000317712107117 0.000370709543349 +TCCATG 0.00053485347529 0.000242149939242 +CAGTAA 2.74283833482e-05 0.000385678812321 +CAGTAC 0.000562281858639 0.000185795044291 +CAGTAG 2.28569861235e-05 0.000183153408591 +TTAATA 9.14279444941e-05 0.000635753658665 +CAGTAT 0.000402282955774 0.000281774474755 +AAAGTA 0.000276569532095 0.000388320448021 +AAAGTC 0.000470853914145 0.000375992814751 +AAAGTG 0.000850279883795 0.000515999506895 +GATCTA 0.000198855779275 0.000153214870648 +GATCTC 0.000354283284915 0.000204286494197 +TGTCCA 0.000221712765398 0.000324040645968 +GATCTG 0.000980564704699 0.000292341017558 +TCCCTT 0.000157713204252 0.000223658489337 +CCGGCC 0.000127999122292 9.33377947625e-05 +ATTAGG 8.22851500447e-05 0.000191078315693 +AAAGTT 0.000399997257162 0.000475494426149 +ACTCTC 0.000242284052909 0.000242149939242 +ATTAGC 0.00011657062923 0.00023422503214 +TCCCTC 0.000210284272336 0.000247433210644 +TGTCCG 0.000121142026455 0.0001074265185 +TCCCTA 6.39995611459e-05 9.95016113978e-05 +TTAATG 0.000173713094539 0.000543296409137 +TCCCTG 0.000258283943196 0.000217494672701 +GATCTT 0.000397711558549 0.000240388848775 +CACAAT 0.000308569312668 0.000418258985964 +AAGTGC 0.000285712326544 0.000254477572513 +TGTTCT 0.000146284711191 0.000415617350263 +AAGTGG 0.000299426518218 0.000265044115316 +TGATTG 4.5713972247e-06 0.000358381910079 +TGCGCA 6.39995611459e-05 0.000147051054013 +TCTGAT 0.000548567666965 0.000430586619235 +TGTATT 0.000114284930618 0.000591726396985 +CGAGGT 0.000105142136168 7.13241639223e-05 +TGTTCA 0.000127999122292 0.000518641142595 +CACAAG 0.000511996489167 0.000296743743726 +TGTTCC 0.000109713533393 0.00023422503214 +AAGTGT 0.000319997805729 0.000398886990825 +CACAAC 0.00049599659888 0.000322279555501 +TGTTCG 7.31423555953e-05 0.000121515242238 +TCTGAA 0.000601138735049 0.000558265678108 +TCTGAC 0.000454854023858 0.000294982653259 +TCTGAG 0.000676566789256 0.000344293186341 +CGCGCC 8.22851500447e-05 8.01296162584e-05 +CGCGCA 5.94281639212e-05 7.74879805576e-05 +GGTAAA 0.000324569202954 0.000289699381857 +CGCGCG 5.02853694718e-05 9.50988852297e-05 +CTCCCT 0.00019428438205 0.000220136308402 +AGCGGG 0.000180570190376 0.000115351425603 +AGCGGA 0.000269712436258 0.000127679058873 +ACCTCT 0.000306283614055 0.000250074846345 +GGTAAG 7.31423555953e-05 8.62934328936e-05 +CGCGCT 7.54280542076e-05 0.000102143247099 +ACCTCC 0.000290283723769 0.000187556134759 +ACCTCA 0.000255998244583 0.000269446841484 +ACCTCG 6.39995611459e-05 5.89965306518e-05 +CTCCCC 0.000114284930618 0.000145289963545 +GCCTCT 0.000333711997403 0.000200764313263 +TAAGCC 2.28569861235e-06 0.000123276332705 +CGGGAG 0.000285712326544 8.98156138281e-05 +CCCATG 0.000420568544673 0.000165542503918 +CGGGAA 0.000148570409803 8.98156138281e-05 +CCCATA 0.00011657062923 0.000119754151771 +CGGGAC 0.000251426847359 7.6607435324e-05 +CCCATC 0.000521139283616 0.000164661958685 +TTGTTG 0.000191998683438 0.000483419333251 +CCTGCT 0.000628567118397 0.000333726643538 +CCGAAT 0.000100570738944 8.18907067256e-05 +CCCATT 0.000306283614055 0.000221016853636 +CGGGAT 0.000191998683438 8.89350685945e-05 +GCCTCG 0.000143999012578 9.33377947625e-05 +GCCTCA 0.000262855340421 0.000210450310832 +TAAGCT 2.28569861235e-06 0.000218375217935 +GCCTCC 0.000363426079364 0.000183153408591 +CCGAAC 0.000114284930618 9.50988852297e-05 +CCTGCG 0.000182855888988 0.000120634697004 +CCGAAA 0.000157713204252 0.000123276332705 +CCGAAG 0.000137141916741 0.000116231970836 +CCTGCC 0.000372568873813 0.000240388848775 +CCTGCA 0.000493710900268 0.000388320448021 +GTACTG 0.000166855998702 0.000191078315693 +CAAGGT 0.000228569861235 0.00014881214448 +CCATTC 0.000239998354297 0.000220136308402 +CCATTA 0.000100570738944 0.000211330856066 +CCATTG 0.000143999012578 0.000243030484476 +TATAAC 0.000201141477887 0.000200764313263 +GATTTG 0.000356568983527 0.000377753905218 +GTACTC 6.62852597582e-05 8.36517971928e-05 +GTCGAA 5.02853694718e-05 6.60408925206e-05 +CCATTT 0.00019428438205 0.000442914252505 +TCAGCG 0.000121142026455 0.00020252540373 +TCTACC 8.22851500447e-05 9.95016113978e-05 +TCTACG 5.48567666965e-05 5.98770758854e-05 +ACTTTC 0.000299426518218 0.000298504834193 +CGCAAC 0.000251426847359 8.541288766e-05 +TGCTTA 6.17138625335e-05 0.000253597027279 +CGCAAA 0.000374854572426 0.000163781413451 +ATACCG 2.51426847359e-05 5.19521687829e-05 +CGCAAG 0.000386283065488 9.15767042953e-05 +ATACCA 0.000143999012578 0.000154975961115 +ATACCC 8.22851500447e-05 7.48463448567e-05 +TCTACT 0.000153141807028 0.00017082577532 +CCGAGT 0.000102856437556 5.89965306518e-05 +ATACCT 0.00011657062923 0.000149692689713 +GATAGG 5.25710680841e-05 5.01910783157e-05 +CGCAAT 0.000132570519516 9.15767042953e-05 +TAGTAA 0.0 0.00022453903457 +TGGGTG 0.000292569422381 0.000189317225226 +TAGTAC 0.0 9.77405209306e-05 +CTCAAG 0.000681138186481 0.0002122114013 +GTTTTG 0.000370283175201 0.000647200746702 +CTCAAA 0.000731423555953 0.000409453533628 +TAGTAG 0.0 0.000128559604107 +CTCAAC 0.000756566240689 0.000240388848775 +GTGTGC 0.00027199813487 0.000302027015128 +GTGTGA 2.05712875112e-05 0.000455241885776 +GTGTGG 0.000340569093241 0.000317876829333 +TAACGG 0.0 9.6859975697e-05 +TTGCGT 0.000111999232005 9.77405209306e-05 +CTCAAT 0.000468568215532 0.000288818836624 +TAGTAT 0.0 0.00016113977775 +GTTCTC 0.000249141148746 0.000240388848775 +GTGTGT 0.000546281968352 0.00129616258387 +ATCTTT 0.000313140709892 0.000435869890636 +GTTGGG 0.000153141807028 0.000155856506349 +GTTGGA 0.000409140051611 0.000244791574943 +GTTGGC 0.000265141039033 0.000138245601677 +CCTTGG 7.54280542076e-05 0.000142648327845 +CCTTGA 1.37141916741e-05 0.000183153408591 +GGGAAA 0.000514282187779 0.000407692443161 +AGGATT 0.000207998573724 0.00030995192223 +GGACGT 0.000109713533393 0.000111829244668 +GTTGGT 0.000306283614055 0.000187556134759 +ATCTTG 0.000258283943196 0.000252716482046 +GAGAGT 0.000518853585004 0.000214853037001 +ATCTTA 0.000150856108415 0.000233344486906 +ATCTTC 0.000674281090644 0.000299385379427 +AGGATC 0.000255998244583 0.000209569765599 +AGGATA 0.000114284930618 0.00015849814205 +AGGATG 0.000278855230707 0.000317876829333 +GACATG 0.000909708047716 0.000273849567652 +GACATC 0.00105827845752 0.000257119208214 +GACATA 0.000251426847359 0.00019283940616 +TCGGCG 7.54280542076e-05 5.54743497173e-05 +GAATAT 0.000308569312668 0.00033196555307 +GGTGCA 0.00037942596965 0.000179631227656 +TCGGCC 0.000123427725067 7.04436186887e-05 +ATCAGA 0.000354283284915 0.000431467164468 +TTGCGA 4.34282736347e-05 5.54743497173e-05 +GACATT 0.00069028098093 0.000389200993255 +TTGCGG 0.000102856437556 6.86825282215e-05 +GAATAG 4.5713972247e-06 0.000145289963545 +TCGGCT 0.000148570409803 0.000125037423172 +CATAGA 6.39995611459e-05 0.000154975961115 +GAATAC 0.000413711448836 0.000160259232517 +GAATAA 2.51426847359e-05 0.000361904091013 +TGCCTG 0.000306283614055 0.000253597027279 +CACCGC 0.000146284711191 0.000103023792332 +TGCAGA 0.000265141039033 0.000499269147456 +TTAATT 0.000102856437556 0.000757268900903 +GGACGA 0.00019428438205 0.000119754151771 +TGAGGT 2.28569861235e-06 0.000258880298681 +TTTCTA 0.000157713204252 0.00035133754821 +TTATAA 1.37141916741e-05 0.000508074599792 +GAAATG 0.000603424433661 0.000550340771005 +AATGAT 0.000498282297493 0.000489583149886 +GAAATA 0.000226284162623 0.000511596780727 +GAAATC 0.000546281968352 0.000355740274378 +GAAATT 0.000358854682139 0.000384798267087 +AATGAA 0.000825137199059 0.000773118715108 +AATGAC 0.000635424214234 0.000390081538489 +AATGAG 0.000911993746329 0.000391842628956 +TCAGCA 0.000338283394628 0.000476374971382 +TACTAG 9.14279444941e-06 7.74879805576e-05 +CTTGGA 0.000338283394628 0.00022453903457 +CTTGGC 0.00023314125846 0.000132962330275 +GTATTG 7.99994514323e-05 0.000214853037001 +GTCCTT 0.000182855888988 0.000173467411021 +CTTGGG 0.000141713313966 0.00012944014934 +AGCCCT 0.000281140929319 0.00018051177289 +GGGAAT 0.000198855779275 0.000163781413451 +TTGAAT 0.000196570080662 0.000486941514186 +GTCCTA 5.02853694718e-05 8.541288766e-05 +GTCCTC 0.000235426957072 0.000218375217935 +TGCACG 8.91422458817e-05 0.000109187608967 +CTTGGT 0.000217141368173 0.000169064684853 +GTCCTG 0.000493710900268 0.000253597027279 +TGCACC 0.000287998025156 0.000188436679992 +TTGAAA 0.000331426298791 0.000554743497173 +AGCCCG 0.000125713423679 8.62934328936e-05 +AGCCCA 0.000278855230707 0.000162900868218 +AGCCCC 0.000201141477887 0.000111829244668 +TTAACT 0.000100570738944 0.000353979183911 +ATAAAT 0.000157713204252 0.000862053783703 +TGGTCG 3.885687641e-05 8.1010161492e-05 +TGGTCA 0.000118856327842 0.000266805205783 +TGGTCC 0.000114284930618 0.000149692689713 +ACGATT 6.85709583706e-05 0.000138245601677 +GAGACT 0.000548567666965 0.000226300125037 +GATTCA 0.000356568983527 0.000360143000546 +GAGGAG 0.0030902645239 0.000477255516616 +ATAAAG 0.000313140709892 0.000545938044837 +ATAAAA 0.000180570190376 0.00104960991846 +TCAGCC 0.000292569422381 0.000264163570083 +ATAAAC 0.000217141368173 0.000496627511755 +GAGACG 0.000452568325246 0.000203405948964 +ACGATG 0.000123427725067 0.000142648327845 +CTACAG 0.000406854352999 0.000262402479615 +GAGACC 0.000678852487869 0.000136484511209 +ACGATC 6.62852597582e-05 9.24572495289e-05 +GAGACA 0.000409140051611 0.000306429741296 +ACGATA 4.34282736347e-05 8.18907067256e-05 +GGTTAC 0.000219427066786 8.27712519592e-05 +ATGTGT 0.000262855340421 0.000509835690259 +GGTTAA 9.14279444941e-06 0.000228061215505 +ACCACT 0.000383997366875 0.000233344486906 +GCACTT 0.000237712655685 0.000229822305972 +CTTCCT 0.000484568105819 0.000291460472324 +TAAACT 0.0 0.000457883521476 +CTCAGT 0.00046628251692 0.000271207931951 +TCCGCT 0.000139427615353 0.000140006692144 +ACCACG 0.000118856327842 9.42183399961e-05 +ATGTGG 0.000269712436258 0.000302027015128 +ACCACC 0.000571424653088 0.000182272863357 +GAGGAA 0.00161370322032 0.000506313509325 +ACCACA 0.000459425421083 0.00032932391737 +GGTTAT 0.000244569751522 0.000191078315693 +TCCGCC 0.00019428438205 9.95016113978e-05 +GACGTG 0.000477711009982 0.000132962330275 +TCCGCG 5.71424653088e-05 6.69214377543e-05 +AACGTC 0.000290283723769 0.000150573234947 +AACGTA 6.17138625335e-05 8.80545233609e-05 +AACGTG 0.000329140600179 0.00014881214448 +CGTGAC 0.000182855888988 0.000109187608967 +AGTGTG 0.00046628251692 0.000460525157177 +TCTTCG 6.85709583706e-05 0.0001074265185 +AGTGTA 0.000132570519516 0.000293221562792 +TCTTCA 0.000331426298791 0.000542415863903 +AGTGTC 0.000212569970949 0.000220136308402 +TCTTCC 0.000187427286213 0.000283535565222 +CGTGAT 0.000182855888988 0.000123276332705 +TAAGTC 0.0 0.000147931599246 +AACGTT 0.000150856108415 0.000233344486906 +CCGTGA 4.5713972247e-06 9.95016113978e-05 +TCTTCT 0.000301712216831 0.000427944983534 +AGTGTT 0.000294855120993 0.000486060968952 +GTGCGC 0.000260569641808 0.000120634697004 +TTGGCA 0.000235426957072 0.000251835936812 +AAAGGT 0.000470853914145 0.000323160100734 +TTGGCC 0.000269712436258 0.000179631227656 +GAGTAG 1.14284930618e-05 0.000115351425603 +TTAACG 4.34282736347e-05 0.000132081785041 +TTGGCG 0.000111999232005 8.45323424264e-05 +GACTTC 0.000722280761503 0.000188436679992 +TCGAGT 6.17138625335e-05 9.95016113978e-05 +GACTTA 8.68565472694e-05 0.000143528873078 +GACTTG 0.000395425859937 0.000188436679992 +AAAGGG 0.00027199813487 0.000311713012697 +AAAGGA 0.00081599440461 0.000454361340542 +TTGGCT 0.000347426189078 0.000241269394009 +AAAGGC 0.000617138625335 0.000252716482046 +GAGTAC 0.000585138844762 8.62934328936e-05 +GTATGG 7.54280542076e-05 0.000155856506349 +GACTTT 0.000596567337824 0.000380395540919 +TAAACC 2.28569861235e-06 0.000318757374566 +CAAGAA 0.000411425750223 0.000356620819612 +GACGTT 0.000173713094539 0.00016113977775 +CAAGAC 0.000402282955774 0.000230702851205 +GATTCG 0.000121142026455 7.22047091559e-05 +CAAGAG 0.000537139173903 0.00023422503214 +TTCTTG 0.000249141148746 0.00034165155064 +TTCTTC 0.000758851939301 0.000420900621665 +TTCTTA 0.000102856437556 0.00029762428896 +CAAGAT 0.000308569312668 0.000272088477185 +AGGGCT 0.000143999012578 0.000178750682423 +TACGGG 0.000118856327842 4.31467164468e-05 +TACGGA 0.000189712984825 6.60408925206e-05 +TACGGC 0.000329140600179 6.60408925206e-05 +CTCAGA 0.000354283284915 0.000375992814751 +TAGAGT 0.0 0.000168184139619 +TACGGT 0.000137141916741 4.93105330821e-05 +AGGGCG 9.59993417188e-05 9.6859975697e-05 +AGGGCA 0.000130284820904 0.000223658489337 +AGGGCC 0.000146284711191 0.000143528873078 +TCGAGA 3.885687641e-05 8.45323424264e-05 +CTGTGC 0.000386283065488 0.000308190831763 +TAGAGA 4.5713972247e-06 0.000211330856066 +GGCGAG 0.000306283614055 0.000105665428033 +CCGTGT 0.00011657062923 0.000119754151771 +GTGCTG 0.0010925639367 0.00036102354578 +GTGCTA 0.000146284711191 0.000117993061304 +ATCTGT 0.000317712107117 0.000394484264657 +CGAATT 6.17138625335e-05 8.71739781273e-05 +GCTCGT 0.000203427176499 0.000102143247099 +ATCTGA 2.28569861235e-05 0.000410334078862 +CGAATC 0.000125713423679 6.60408925206e-05 +ATCTGC 0.000441139832184 0.000350457002976 +CGAATA 5.71424653088e-05 8.541288766e-05 +CGAATG 0.000169141697314 0.000125037423172 +ATCTGG 0.000319997805729 0.00027561065812 +ATCATA 0.000205712875112 0.000286177200923 +GATAGC 0.000100570738944 9.24572495289e-05 +AAGCAG 0.00100570738944 0.000464047338112 +GATAGA 0.000118856327842 0.000151453780181 +AAGCAA 0.000322283504342 0.000387439902788 +CAAACT 0.000210284272336 0.000486060968952 +AAGCAC 0.000347426189078 0.000299385379427 +TTTACC 0.000166855998702 0.0003196379198 +CATTTC 0.00027199813487 0.000521282778296 +CTAGGT 5.25710680841e-05 6.69214377543e-05 +CATTTA 0.000125713423679 0.000686825282215 +CATTTG 0.000180570190376 0.0005318493211 +GTTATA 7.31423555953e-05 0.000208689220365 +CAAACA 0.000285712326544 0.000797773981649 +AAGCAT 0.000287998025156 0.000368948452882 +CAAACC 0.000253712545971 0.000316996284099 +CTCGGG 0.000141713313966 7.30852543895e-05 +ATCATT 0.000509710790555 0.000492224785587 +CAAACG 7.08566569829e-05 0.000178750682423 +CTAGGG 6.85709583706e-05 5.28327140165e-05 +GTTATT 0.000205712875112 0.000456122431009 +TGGAGC 0.000198855779275 0.000359262455312 +CTAGGC 0.000107427834781 6.25187115862e-05 +CATTTT 0.000182855888988 0.00109187608967 +CTAGGA 9.37136431064e-05 7.30852543895e-05 +AAGTTT 0.000630852817009 0.000491344240354 +TACAGT 0.000351997586302 0.000424422802599 +CTCGAA 0.000111999232005 0.000116231970836 +CTAACG 3.42854791853e-05 6.86825282215e-05 +CTAAGG 7.08566569829e-05 0.000105665428033 +CTAAGA 9.37136431064e-05 0.000121515242238 +CTAAGC 7.31423555953e-05 0.000112709789902 +TACAGG 0.000290283723769 0.000199003222796 +AAGTTG 0.000297140819606 0.000366306817181 +AAGTTA 0.000143999012578 0.0003196379198 +TACAGC 0.000559996160026 0.000307310286529 +AAGTTC 0.000603424433661 0.000197242132328 +TACAGA 0.000514282187779 0.00033196555307 +CTAAGT 6.85709583706e-05 0.000104784882799 +GTATGA 2.05712875112e-05 0.000211330856066 +GGGGCA 0.000201141477887 9.6859975697e-05 +GGGGCG 0.000107427834781 6.60408925206e-05 +TTCAAC 0.000722280761503 0.000286177200923 +TATATC 0.000134856218129 0.000210450310832 +TATATA 6.62852597582e-05 0.000694750189317 +TGTATA 5.71424653088e-05 0.000388320448021 +TATATG 0.000162284601477 0.000314354648398 +TCCGGT 0.000105142136168 8.98156138281e-05 +GGTCCA 0.000374854572426 0.000134723420742 +TATATT 0.000171427395926 0.000641917475301 +GGACTA 8.22851500447e-05 0.00014881214448 +TCTTAC 0.000180570190376 0.000185795044291 +TGATGG 2.28569861235e-06 0.00040505080746 +CTCGGT 0.000121142026455 8.541288766e-05 +ATGAGT 0.000287998025156 0.000267685751017 +GCCCAC 0.000171427395926 0.000108307063734 +TGATGA 2.28569861235e-06 0.000582920944649 +TGCCAT 0.000191998683438 0.000316115738866 +ACTCTT 0.000281140929319 0.000308190831763 +TGTTTC 0.000189712984825 0.00050014969269 +CACATA 0.000159998902865 0.000324921191202 +TCATAA 2.05712875112e-05 0.000377753905218 +CACATG 0.000518853585004 0.000378634450452 +TGTTTG 0.000276569532095 0.000751985629502 +ATGAGA 0.000306283614055 0.000339890460173 +ATGAGC 0.000514282187779 0.000267685751017 +ATGAGG 0.000411425750223 0.000257119208214 +GTGGCT 0.000610281529498 0.000179631227656 +ACTCTG 0.000655995501745 0.000316115738866 +TGCCAG 0.000331426298791 0.000215733582234 +ACTCTA 0.000164570300089 0.000172586865787 +ATTGTT 0.000308569312668 0.000511596780727 +CACATT 0.00027199813487 0.000486060968952 +TGCCAC 0.000159998902865 0.000191958860927 +AAATTC 0.000313140709892 0.000317876829333 +AAATTA 0.000153141807028 0.000742299631932 +AAATTG 0.000175998793151 0.000461405702411 +TCCACT 0.000372568873813 0.000340771005407 +TTCAAT 0.000319997805729 0.000393603719423 +CTTCGA 0.000111999232005 6.69214377543e-05 +CGTACC 4.11425750223e-05 3.87439902788e-05 +TTAATC 8.91422458817e-05 0.000369828998116 +AAATTT 0.000292569422381 0.000590845851751 +TTCGAA 9.14279444941e-05 9.33377947625e-05 +CTTAGT 7.54280542076e-05 0.000106545973267 +GGGAAC 0.000322283504342 0.000127679058873 +GGTGCG 0.000109713533393 5.45938044837e-05 +GCGTAT 0.000125713423679 6.16381663526e-05 +GGGAAG 0.000553139064189 0.000185795044291 +GGTGCC 0.000301712216831 8.71739781273e-05 +TCGTCC 0.000137141916741 0.000124156877939 +GCCCAT 0.000148570409803 0.000130320694574 +AGAGCG 0.000148570409803 0.000179631227656 +GCGACT 8.22851500447e-05 7.92490710248e-05 +AGAGCC 0.000267426737645 0.000217494672701 +AGAGCA 0.000301712216831 0.000423542257366 +GCGTAG 6.85709583706e-06 4.93105330821e-05 +GGTGCT 0.000450282626633 0.000190197770459 +TCCCCA 0.000166855998702 0.000135603965976 +GCGTAC 0.000164570300089 4.40272616804e-05 +TAATTT 0.0 0.000760791081838 +GCGTAA 2.28569861235e-06 9.6859975697e-05 +GCGACG 6.17138625335e-05 6.0757621119e-05 +AGAGCT 0.000342854791853 0.000370709543349 +GCGACA 7.31423555953e-05 8.27712519592e-05 +TATCGG 7.99994514323e-05 4.22661712132e-05 +GCGACC 7.54280542076e-05 7.13241639223e-05 +TCCGGC 0.00015542750564 8.01296162584e-05 +GCAGGA 0.000639995611459 0.000347815367275 +GCAGGC 0.00031085501128 0.00018051177289 +GCAGGG 0.000223998464011 0.000217494672701 +CAATTT 6.17138625335e-05 0.000457883521476 +GCACTA 8.91422458817e-05 0.000132962330275 +CCGTGC 4.5713972247e-05 7.22047091559e-05 +GCTCGG 0.000109713533393 8.27712519592e-05 +TATTCT 0.000148570409803 0.000325801736435 +CCGTGG 9.59993417188e-05 7.74879805576e-05 +CTTTAG 4.5713972247e-06 0.000268566296251 +GCAGGT 0.000299426518218 0.000268566296251 +CTTCGT 8.68565472694e-05 7.6607435324e-05 +TATTCC 0.000134856218129 0.00025623866298 +CAATTG 4.5713972247e-05 0.000206928129898 +TATTCA 0.000121142026455 0.000420900621665 +CAATTA 6.17138625335e-05 0.000333726643538 +TATTCG 6.39995611459e-05 0.000103023792332 +CAATTC 8.4570848657e-05 0.0002122114013 +TGTAGA 7.08566569829e-05 0.00028793829139 +GGCTCA 0.000255998244583 0.000184033953824 +AGCATT 0.000324569202954 0.000390081538489 +GGCTCC 0.000477711009982 0.000145289963545 +AATCCT 0.000345140490465 0.000260641389148 +TGTAGG 4.5713972247e-05 0.000199003222796 +GGCTCG 0.000132570519516 8.62934328936e-05 +TTCGGA 0.000164570300089 9.33377947625e-05 +TTCGGC 0.00027199813487 8.541288766e-05 +CTTTAC 0.000297140819606 0.000325801736435 +TTCAAG 0.000635424214234 0.000307310286529 +TTCGGG 0.000198855779275 6.5160347287e-05 +AGCATG 0.000516567886392 0.000307310286529 +GGCTCT 0.000436568434959 0.000178750682423 +AGCATC 0.000575996050313 0.000285296655689 +TTTACT 0.000169141697314 0.000586443125583 +AGCATA 0.000143999012578 0.000276491203353 +TTACAT 6.85709583706e-05 0.000498388602222 +AGACCT 0.00019428438205 0.00018051177289 +TTCGGT 0.000132570519516 9.24572495289e-05 +GTTTAT 0.000260569641808 0.000581159854182 +GGGGAG 0.000326854901566 0.000189317225226 +GCACTC 0.000180570190376 0.000157617596816 +GCCTTT 0.000365711777976 0.000272088477185 +TGCTTG 0.000182855888988 0.000314354648398 +GTTTAA 2.05712875112e-05 0.000552101861473 +GAGGTG 0.00124342004512 0.000240388848775 +AACTTG 0.000278855230707 0.000296743743726 +GTTTAG 6.85709583706e-06 0.000266805205783 +GAGGTA 0.000182855888988 0.00016113977775 +CTGGCT 0.000783994624037 0.000271207931951 +AGGCGG 8.68565472694e-05 8.62934328936e-05 +AGGCGA 5.94281639212e-05 0.000111829244668 +AGGCGC 9.14279444941e-05 7.57268900903e-05 +AGGAGT 0.000159998902865 0.000195481041861 +ACAGCC 0.000345140490465 0.000284416110456 +ACAGCA 0.000438854133572 0.000591726396985 +TCCAGC 0.000692566679543 0.000412975714562 +ACAGCG 0.000189712984825 0.000204286494197 +AGGAGC 0.000274283833482 0.000294102108025 +AGGCGT 5.48567666965e-05 0.000103904337566 +AGGAGA 0.000331426298791 0.000394484264657 +CTGGCG 0.000317712107117 9.86210661642e-05 +AGGAGG 0.000244569751522 0.000368067907648 +CTGGCA 0.000500567996105 0.00022453903457 +CTGGCC 0.000934850732452 0.000167303594386 +GCGCCC 8.4570848657e-05 6.0757621119e-05 +GCATCG 6.85709583706e-05 8.27712519592e-05 +ACAGCT 0.000420568544673 0.000420900621665 +GGAAAA 0.000564567557251 0.000595248577919 +AACGCT 0.000253712545971 0.000153214870648 +AATTTT 0.000148570409803 0.000738777450998 +AAACAG 0.000921136540778 0.000733494179596 +TGTCAC 0.000173713094539 0.000289699381857 +AAACAC 0.000580567447538 0.000875261962207 +GCTCTA 0.000180570190376 0.000146170508779 +AAACAA 0.000445711229409 0.000988852297343 +AACGCG 5.94281639212e-05 8.71739781273e-05 +AATTTA 0.000118856327842 0.000648081291936 +AATTTC 0.000217141368173 0.000394484264657 +AACGCC 0.000299426518218 9.06961590617e-05 +TTTCAC 0.000235426957072 0.00044907806914 +ATTGGA 0.000436568434959 0.000291460472324 +AATTTG 0.000207998573724 0.000484299878485 +ATTTAC 0.000274283833482 0.000479016607083 +ATTTAA 1.37141916741e-05 0.00089551450258 +ATTTAG 4.5713972247e-06 0.000400648081292 +CCCTCG 0.000107427834781 9.06961590617e-05 +TAAATA 0.0 0.000935139038092 +GGAAAG 0.000772566130975 0.000345173731575 +TGACCA 9.14279444941e-06 0.000283535565222 +CATTCT 0.000134856218129 0.00032932391737 +TAAATC 4.5713972247e-06 0.000432347709702 +TGACCG 4.5713972247e-06 9.42183399961e-05 +GCGCCA 6.39995611459e-05 0.000115351425603 +CATTCG 6.62852597582e-05 9.42183399961e-05 +CATTCC 0.000118856327842 0.000215733582234 +CATTCA 0.000185141587601 0.000511596780727 +TCCATA 0.000143999012578 0.000227180670271 +GCCTTC 0.000566853255863 0.000147931599246 +ACAAAT 0.000207998573724 0.000615501118292 +GATTAA 2.28569861235e-05 0.000349576457743 +GTAGGC 7.31423555953e-05 9.77405209306e-05 +GATTAC 0.000402282955774 0.000205167039431 +GTAGGA 0.000111999232005 0.000149692689713 +GTAGGG 7.99994514323e-05 9.06961590617e-05 +GATTAG 4.5713972247e-06 0.000171706320554 +GCGGGT 0.000125713423679 7.22047091559e-05 +ACAAAC 0.000347426189078 0.00065160347287 +TTTCAA 0.000182855888988 0.000622545480161 +ACAAAA 0.000313140709892 0.000865575964637 +ACAAAG 0.000324569202954 0.000420020076431 +GCGGGC 8.4570848657e-05 6.78019829879e-05 +GTCGGT 0.000146284711191 7.39657996231e-05 +GCGGGA 0.000139427615353 0.000122395787472 +CCCTCA 0.000239998354297 0.000205167039431 +GATTAT 0.000313140709892 0.000388320448021 +GTAGGT 8.4570848657e-05 0.000105665428033 +AACCTG 0.000953136321351 0.000280013384288 +TAATGA 0.0 0.000428825528767 +GATGTT 0.00058285314615 0.00043675043587 +TAATGC 0.0 0.000282655019988 +GGGATG 0.00031085501128 0.000186675589525 +GCCCTT 0.000175998793151 0.000134723420742 +GCGCCG 8.22851500447e-05 8.89350685945e-05 +GGCGTA 6.17138625335e-05 5.6354894951e-05 +GCCCTC 0.000258283943196 0.000162020322984 +GATGTG 0.00106742125197 0.000352218093443 +GCCCTA 7.99994514323e-05 6.86825282215e-05 +GATGTA 0.000205712875112 0.000245672120177 +GCCCTG 0.000532567776678 0.000197242132328 +GATGTC 0.000450282626633 0.000286177200923 +AACCTC 0.000463996818308 0.000206928129898 +TGAAAT 2.28569861235e-06 0.000694750189317 +GCTCTT 0.000486853804431 0.000316996284099 +TTCTAA 2.05712875112e-05 0.000291460472324 +ATCCGT 0.000223998464011 0.000100382156631 +TTCTAC 0.00049599659888 0.000169064684853 +GGCTTA 9.59993417188e-05 0.000101262701865 +TTGGAT 0.000409140051611 0.000356620819612 +TGAAAC 0.0 0.000449958614374 +TGAAAG 2.28569861235e-06 0.000462286247645 +CCCTCC 0.000303997915443 0.000236866667841 +ATCCGC 0.000331426298791 0.000112709789902 +ATCCGA 0.000171427395926 8.541288766e-05 +ATCCGG 0.000148570409803 6.78019829879e-05 +TGGCTC 0.000251426847359 0.000175228501488 +TGGCTA 6.62852597582e-05 0.000140006692144 +TGGCTG 0.000429711339122 0.000324040645968 +GGGTGA 6.85709583706e-06 0.000155856506349 +AGTTGT 7.771375282e-05 0.000312593557931 +AGCTAT 0.000210284272336 0.000176109046722 +ATTAGT 9.14279444941e-05 0.000325801736435 +GTCGGC 0.000159998902865 6.95630734551e-05 +TGGCTT 0.000171427395926 0.000307310286529 +AGTTGG 7.08566569829e-05 0.000172586865787 +AGCTAA 2.05712875112e-05 0.000244791574943 +AGCTAC 0.000322283504342 0.000173467411021 +AGTTGC 5.94281639212e-05 0.000188436679992 +AGTTGA 1.37141916741e-05 0.000378634450452 +AGCTAG 6.85709583706e-06 0.000101262701865 +TCCTAG 9.14279444941e-06 5.81159854182e-05 +TCCAGT 0.000395425859937 0.000333726643538 +CTAATT 7.54280542076e-05 0.000288818836624 +CAGTGT 0.00046628251692 0.000470211154747 +TAACAA 0.0 0.000382156631386 +TCAGGT 0.000180570190376 0.000230702851205 +TCAAGG 0.000100570738944 0.00017082577532 +GTCGGG 0.000105142136168 7.83685257912e-05 +TCAAGC 0.000153141807028 0.000208689220365 +CTGCAC 0.000539424872515 0.000359262455312 +CTAATA 6.17138625335e-05 0.000235986122607 +CAGTGC 0.000422854243285 0.000335487734005 +CTAATC 0.000100570738944 0.000152334325414 +CAGTGA 5.25710680841e-05 0.000425303347833 +CAGTGG 0.000422854243285 0.000272088477185 +CTAATG 0.000223998464011 0.000230702851205 +TCAAGT 0.000123427725067 0.000271207931951 +CTGCAA 0.000372568873813 0.000354859729144 +GAGCCC 0.000473139612757 0.000130320694574 +TCAGGC 0.000214855669561 0.000200764313263 +CGAGCT 0.000203427176499 0.000121515242238 +TCCTAA 1.37141916741e-05 0.000163781413451 +GATCAG 0.000697138076767 0.00029762428896 +CAACCA 0.000235426957072 0.000215733582234 +GTTCAT 0.000255998244583 0.000331085007837 +TTCCCT 0.000317712107117 0.000239508303542 +TAACAG 0.0 0.000344293186341 +CGAGCG 0.000107427834781 6.86825282215e-05 +GTTAGT 7.771375282e-05 0.000156737051582 +CGAGCA 0.000159998902865 0.000125037423172 +GAGCCG 0.000326854901566 0.00013912614691 +CGAGCC 0.000166855998702 9.86210661642e-05 +GTTCAG 0.000587424543375 0.000350457002976 +TTCCCC 0.000329140600179 0.000197242132328 +GTTCAC 0.000255998244583 0.000243030484476 +GTTCAA 0.000180570190376 0.000260641389148 +TGAGCA 4.5713972247e-06 0.00035133754821 +GGACCT 0.000413711448836 9.95016113978e-05 +TACATG 0.000591995940599 0.000277371748587 +AAGTAC 0.000420568544673 0.000168184139619 +AAGTAA 4.5713972247e-05 0.000389200993255 +TACATC 0.000649138405908 0.000233344486906 +AAGTAG 1.37141916741e-05 0.000173467411021 +TACATA 0.000134856218129 0.000295863198493 +GCACAC 0.000178284491763 0.00033196555307 +GGACCG 0.000125713423679 5.45938044837e-05 +ATTGGT 0.000372568873813 0.000219255763169 +GGACCA 0.000420568544673 0.000120634697004 +TCATCA 0.000267426737645 0.000556504587641 +GGACCC 0.000395425859937 9.42183399961e-05 +CACACG 0.000189712984825 0.000181392318123 +TACATT 0.000319997805729 0.000574115492313 +CACACC 0.000294855120993 0.000291460472324 +GCACAA 0.000249141148746 0.000354859729144 +CACACA 0.00041828284606 0.00165806667489 +TCTGCC 0.000404568654386 0.000254477572513 +TCTGCA 0.000516567886392 0.000470211154747 +TCTGCG 0.000148570409803 0.000169064684853 +TAGATT 2.28569861235e-06 0.000266805205783 +CCCGTC 0.000164570300089 9.77405209306e-05 +TTAAGG 8.22851500447e-05 0.000260641389148 +CCCGTA 2.74283833482e-05 4.4907806914e-05 +CGTCGA 4.34282736347e-05 4.66688973813e-05 +CCCGTG 0.000134856218129 8.1010161492e-05 +TTAAGC 7.54280542076e-05 0.000228941760738 +TTACGT 1.37141916741e-05 0.000119754151771 +TAGATC 2.28569861235e-06 0.000132081785041 +TGTCAA 0.000164570300089 0.00036102354578 +TAGATA 0.0 0.000152334325414 +TTTCGC 0.000105142136168 9.33377947625e-05 +TAGATG 2.28569861235e-06 0.00024391102971 +TGGTTA 7.31423555953e-05 0.000218375217935 +TCTGCT 0.000546281968352 0.000569712766145 +TTACGC 3.42854791853e-05 6.95630734551e-05 +TTAAGT 6.85709583706e-05 0.000416497895497 +TTACGA 5.02853694718e-05 8.98156138281e-05 +TTACGG 5.94281639212e-05 6.60408925206e-05 +CCCGTT 7.99994514323e-05 6.69214377543e-05 +AGTGAC 0.000484568105819 0.00024655266541 +AGTGAA 0.00053485347529 0.000455241885776 +AGTGAG 0.000537139173903 0.000283535565222 +GCGGTC 0.000130284820904 7.13241639223e-05 +CGGGCG 7.771375282e-05 2.99385379427e-05 +CCCTCT 0.000269712436258 0.000229822305972 +TAAGAG 0.0 0.000196361587095 +CCTGAT 0.00058285314615 0.000255358117747 +GAAAGT 0.000319997805729 0.000318757374566 +CGGGCA 9.37136431064e-05 8.98156138281e-05 +TAAGAC 0.0 0.000143528873078 +ATTTAT 0.000205712875112 0.000911364316785 +AGTGAT 0.000434282736347 0.00027561065812 +TAAGAT 0.0 0.000247433210644 +CCTGAA 0.000555424762802 0.000396245355124 +CCTGAC 0.000479996708594 0.000218375217935 +CCTGAG 0.000653709803133 0.000248313755878 +GTTAGG 4.11425750223e-05 9.42183399961e-05 +ATTGGG 0.000171427395926 0.000169064684853 +TATACT 8.68565472694e-05 0.000221016853636 +GTTAGC 7.771375282e-05 0.000116231970836 +CTCCAG 0.000548567666965 0.000476374971382 +GTTAGA 9.59993417188e-05 0.000136484511209 +TGTAGC 6.85709583706e-05 0.000213972491767 +GCCAAA 0.000948564924126 0.000293221562792 +TATACG 2.51426847359e-05 4.4907806914e-05 +GGTAGC 8.4570848657e-05 7.48463448567e-05 +TATACC 6.17138625335e-05 0.000108307063734 +TATACA 0.000109713533393 0.000403289716993 +ATTGGC 0.000287998025156 0.000203405948964 +TCTTGT 8.4570848657e-05 0.000358381910079 +TCCACG 0.000123427725067 0.000110068154201 +ACTAGT 5.94281639212e-05 0.000137365056443 +TTGACT 0.000201141477887 0.000405931352694 +GTAATA 5.25710680841e-05 0.000289699381857 +AACGCA 0.000198855779275 0.000183153408591 +GTAATC 0.000102856437556 0.000172586865787 +TCTAAC 0.000153141807028 0.000132962330275 +CGTTCT 8.22851500447e-05 0.000124156877939 +CCACCG 0.000164570300089 0.000110948699435 +GGTAGG 1.82855888988e-05 6.33992568198e-05 +CCACCA 0.00046628251692 0.00024655266541 +CCACCC 0.000290283723769 0.000147931599246 +GTTCGT 0.000141713313966 6.86825282215e-05 +TTTATG 0.000223998464011 0.000582040399415 +ACTAGG 2.51426847359e-05 8.27712519592e-05 +TTTATC 0.000212569970949 0.000403289716993 +ACTAGC 7.54280542076e-05 0.000114470880369 +TTTATA 0.000105142136168 0.000690347463149 +ACTAGA 8.22851500447e-05 0.000151453780181 +CCACCT 0.000514282187779 0.000204286494197 +CGTTCG 3.42854791853e-05 3.96245355124e-05 +TCGTTG 4.5713972247e-05 6.33992568198e-05 +CGTTCA 0.000109713533393 0.000136484511209 +CGTTCC 0.000109713533393 8.45323424264e-05 +TCTAAT 0.000185141587601 0.000257119208214 +TCGTCT 0.000114284930618 0.000128559604107 +CTTTGT 0.000146284711191 0.000393603719423 +AAACAT 0.000335997696016 0.000818907067256 +ACTGGA 0.000578281748925 0.000449958614374 +ACTGGC 0.000326854901566 0.000194600496628 +TAGTCC 2.28569861235e-06 0.000108307063734 +GTGACC 0.000445711229409 0.000178750682423 +TAGTCA 2.28569861235e-06 0.000169064684853 +GTGACA 0.000267426737645 0.000248313755878 +TAGTCG 0.0 5.10716235493e-05 +GTGACG 0.000290283723769 0.000147051054013 +TGTCAT 0.000134856218129 0.000442914252505 +ACTGGT 0.000324569202954 0.00023422503214 +CTTTGG 0.000105142136168 0.000276491203353 +CCTATG 0.000139427615353 8.45323424264e-05 +CTTTGC 0.000100570738944 0.000294102108025 +CTACGC 5.48567666965e-05 4.57883521476e-05 +GTGACT 0.000381711668263 0.000237747213074 +TAGTCT 0.0 0.00016113977775 +GTGCAC 0.000313140709892 0.000201644858496 +CGACGG 5.48567666965e-05 6.16381663526e-05 +ACCTAG 0.0 5.19521687829e-05 +CGACGA 6.85709583706e-05 5.19521687829e-05 +ACCTAA 1.37141916741e-05 0.000153214870648 +CGACGC 5.71424653088e-05 5.98770758854e-05 +ACCTAC 0.000374854572426 0.000128559604107 +CCGCAG 0.000356568983527 0.000145289963545 +CCGCAA 6.62852597582e-05 8.98156138281e-05 +CCGCAC 0.000100570738944 8.36517971928e-05 +CTACGG 6.17138625335e-05 4.13856259796e-05 +ACCTAT 0.000185141587601 0.000125917968406 +CGACGT 5.25710680841e-05 6.25187115862e-05 +CGAAGA 0.000102856437556 0.000140887237377 +CCCCGT 7.54280542076e-05 7.04436186887e-05 +CGAAGG 7.54280542076e-05 9.42183399961e-05 +GCGCTC 0.000178284491763 0.000152334325414 +GTGCAT 0.000198855779275 0.00032932391737 +GCGCTA 7.31423555953e-05 6.5160347287e-05 +CCGCAT 7.31423555953e-05 7.48463448567e-05 +GTTCGC 0.000111999232005 5.89965306518e-05 +GAAGAT 0.000918850842166 0.000371590088583 +GGATCT 0.000354283284915 0.0002122114013 +TCATGA 1.82855888988e-05 0.000337248824472 +TCGGAA 9.82850403312e-05 8.36517971928e-05 +TCGGAC 0.000153141807028 5.89965306518e-05 +GAATCT 0.000276569532095 0.000226300125037 +TCGGAG 0.000246855450134 8.98156138281e-05 +GGATCG 7.771375282e-05 5.37132592501e-05 +GAAGAG 0.00174627373984 0.000462286247645 +GAAGAA 0.0012022774701 0.000560026768575 +CGAGAA 0.000207998573724 0.000110068154201 +GAAGAC 0.000991993197761 0.000328443372136 +GGATCA 0.000226284162623 0.000233344486906 +GAATCA 0.000235426957072 0.000292341017558 +GAATCC 0.000217141368173 0.000179631227656 +TCGGAT 0.000134856218129 8.62934328936e-05 +GAATCG 8.68565472694e-05 8.62934328936e-05 +ATGGTC 0.000322283504342 0.000169064684853 +CAGATG 0.000843422787958 0.000454361340542 +ATGGTA 0.000150856108415 0.000162900868218 +TGACCC 6.85709583706e-06 0.000172586865787 +ATGGTG 0.000825137199059 0.000244791574943 +CAGATC 0.00080685161016 0.000304668650829 +ACGCCC 9.59993417188e-05 6.42798020534e-05 +CAGATA 0.000214855669561 0.000255358117747 +TGTCAG 0.000374854572426 0.00037335117905 +ACGCCT 0.000125713423679 9.42183399961e-05 +CAGATT 0.000511996489167 0.000466688973813 +TGATTA 0.0 0.00044907806914 +CTCGAC 0.000164570300089 9.42183399961e-05 +ATGGTT 0.000269712436258 0.000259760843915 +TCGCAA 6.62852597582e-05 9.42183399961e-05 +TTGCGC 8.4570848657e-05 0.000110948699435 +GCTATT 0.000267426737645 0.000218375217935 +TGCGTC 0.000102856437556 0.000103023792332 +GCGTGG 8.4570848657e-05 0.000106545973267 +TTGTAG 1.14284930618e-05 0.000261521934382 +AATGGT 0.000345140490465 0.000257119208214 +TCCACC 0.00054399626974 0.000228941760738 +CTACGT 5.25710680841e-05 5.89965306518e-05 +AATGGC 0.000486853804431 0.000261521934382 +AATGGA 0.000687995282318 0.00040505080746 +AATGGG 0.000260569641808 0.000221016853636 +CCCCGA 5.48567666965e-05 5.01910783157e-05 +AATAGA 9.14279444941e-05 0.00028793829139 +AATAGC 7.08566569829e-05 0.000188436679992 +GTGAAT 0.000367997476589 0.000290579927091 +AGCCAG 0.000530282078066 0.000272088477185 +GGAGGG 0.000267426737645 0.000243030484476 +AAAAGT 0.000313140709892 0.000614620573059 +AGCCAC 0.000244569751522 0.000236866667841 +AGCCAA 0.000212569970949 0.000242149939242 +TGGTAG 9.14279444941e-06 9.6859975697e-05 +CGCCAT 0.000102856437556 0.000121515242238 +GAGTGT 0.000468568215532 0.000340771005407 +TGGTAC 0.000175998793151 9.33377947625e-05 +TGGTAA 2.28569861235e-06 0.000220136308402 +AAAAGG 0.000265141039033 0.000429706074001 +GGAGGT 0.000397711558549 0.000155856506349 +AGCCAT 0.000169141697314 0.000284416110456 +AAAAGC 0.000486853804431 0.000552101861473 +AAAAGA 0.000429711339122 0.000749343993801 +TCTATA 0.000102856437556 0.000201644858496 +GAGTGG 0.000395425859937 0.000177870137189 +CGCCAG 0.000137141916741 0.000117993061304 +TGGTAT 0.000150856108415 0.000174347956255 +CGCCAA 9.82850403312e-05 8.80545233609e-05 +GAGTGC 0.00034971188769 0.000155856506349 +CGCCAC 0.000130284820904 9.86210661642e-05 +GAGTGA 5.02853694718e-05 0.000287057746156 +GCCAGG 0.000217141368173 0.000147051054013 +GCCAGA 0.000420568544673 0.000252716482046 +GCCAGC 0.000537139173903 0.00023422503214 +GCCCGT 0.000164570300089 6.69214377543e-05 +TACCGA 9.59993417188e-05 4.57883521476e-05 +TACCGC 0.000223998464011 5.54743497173e-05 +TACTGA 3.885687641e-05 0.000268566296251 +CTTCAT 0.000274283833482 0.000457883521476 +GCCCGC 0.000171427395926 5.01910783157e-05 +GCCAGT 0.000463996818308 0.000184914499058 +GCCCGA 0.000164570300089 6.86825282215e-05 +GCCCGG 0.000105142136168 6.33992568198e-05 +TGCGAT 0.000109713533393 9.86210661642e-05 +CTTCAC 0.000283426627932 0.000355740274378 +CTTCAA 0.000237712655685 0.00034165155064 +CTTCAG 0.000701709473992 0.000476374971382 +TCCGAG 0.000249141148746 9.42183399961e-05 +GTGGGC 0.00054399626974 0.000132962330275 +TCCGAC 0.000150856108415 5.10716235493e-05 +AATTCA 0.000169141697314 0.000452600250075 +GGACTG 0.000559996160026 0.000285296655689 +AATTCC 0.000146284711191 0.000188436679992 +AATTCG 3.65711777976e-05 6.0757621119e-05 +TCCGAT 9.82850403312e-05 8.01296162584e-05 +TAGCGG 0.0 5.19521687829e-05 +AATTCT 0.000137141916741 0.000309071376997 +TAGCGC 0.0 6.86825282215e-05 +GTCATC 0.00069942377538 0.000239508303542 +GTCATA 0.000137141916741 0.000204286494197 +GTCATG 0.000518853585004 0.00027825229382 +AGCAGG 0.000262855340421 0.000372470633816 +CCAGGT 0.00037942596965 0.000154975961115 +TTGGAA 0.000347426189078 0.000294982653259 +AGCAGC 0.000863994075469 0.000504552418858 +AGCAGA 0.000436568434959 0.000530968775866 +GGGGTG 0.000237712655685 0.000157617596816 +CCAGGG 0.00019428438205 0.000154975961115 +AGCAGT 0.000507425091942 0.000384798267087 +CCAGGA 0.000626281419785 0.000248313755878 +CCAGGC 0.000342854791853 0.00013912614691 +TCCCCG 0.000105142136168 6.33992568198e-05 +ATAGAG 0.000319997805729 0.000204286494197 +CATCTG 0.00046628251692 0.000488702604653 +ACGGTC 0.000146284711191 6.69214377543e-05 +CATCTA 0.00011657062923 0.000206047584664 +ATAGAC 0.000244569751522 0.00017082577532 +CATCTC 0.000278855230707 0.000296743743726 +CAAGCT 0.000306283614055 0.00024391102971 +TCCAAC 0.00050513939333 0.000229822305972 +GGGGTC 0.000175998793151 0.000123276332705 +CAAGCC 0.000253712545971 0.000155856506349 +CATCTT 0.000134856218129 0.00036366518148 +CAAGCA 0.000281140929319 0.000264163570083 +CAAGCG 0.000109713533393 8.1010161492e-05 +GTTCTT 0.000262855340421 0.000289699381857 +ACATGA 9.14279444941e-06 0.000425303347833 +CGTAAT 7.31423555953e-05 8.36517971928e-05 +ACATGC 0.00015542750564 0.00035133754821 +TCTTGA 1.59998902865e-05 0.000284416110456 +ACATGG 0.000244569751522 0.000247433210644 +AGGGAT 0.000249141148746 0.000191078315693 +GTACAT 9.14279444941e-05 0.000219255763169 +TGGCGG 5.02853694718e-05 9.6859975697e-05 +CGTAAG 0.000107427834781 5.10716235493e-05 +GAGTCA 0.000308569312668 0.000247433210644 +ACATGT 0.000141713313966 0.000403289716993 +CGTAAC 0.000100570738944 6.42798020534e-05 +CGTAAA 0.000130284820904 0.00015849814205 +AGGGAG 0.000395425859937 0.000203405948964 +TTATTT 8.4570848657e-05 0.00153479034218 +AGGGAC 0.000260569641808 0.000144409418312 +AGGGAA 0.00031085501128 0.000292341017558 +CCCTTT 0.000221712765398 0.000289699381857 +TGTTGT 6.85709583706e-05 0.000551221316239 +TCTTGG 0.000107427834781 0.000169945230086 +GTTGTT 0.000258283943196 0.000406811897927 +ATCCTT 0.000205712875112 0.000210450310832 +GCGGGG 0.00011657062923 9.77405209306e-05 +TTGTCC 0.000157713204252 0.000217494672701 +TTGTCA 0.000132570519516 0.000406811897927 +ATCCTC 0.000482282407206 0.000279132839054 +CTATGA 4.5713972247e-06 0.000154975961115 +ATCCTA 0.000162284601477 0.000114470880369 +GTTGTC 0.000187427286213 0.000210450310832 +ATCCTG 0.000879993965756 0.000279132839054 +GTTGTG 0.000447996928021 0.000353098638677 +TTGTCT 0.000244569751522 0.000321399010267 +CTATGC 3.19997805729e-05 0.000102143247099 +CTGTGG 0.000347426189078 0.000353979183911 +AAGGGG 0.000189712984825 0.000203405948964 +TGACTC 0.0 0.000267685751017 +TGGGCA 0.000175998793151 0.000162020322984 +TGGGCG 8.4570848657e-05 7.57268900903e-05 +TGACTG 4.5713972247e-06 0.000423542257366 +AAGCCG 0.000230855559848 0.000104784882799 +AAGCCC 0.000370283175201 0.000154975961115 +AAGCCA 0.000390854462712 0.000299385379427 +CAAAAT 0.000260569641808 0.000623426025395 +CTATGG 7.54280542076e-05 0.000114470880369 +TGGGCT 0.000205712875112 0.000198122677562 +CAAAAC 0.000436568434959 0.000564429494743 +CAAAAA 0.000322283504342 0.000760791081838 +AAGCCT 0.000429711339122 0.000225419579804 +CAAAAG 0.000377140271038 0.000493985876054 +TCAATG 0.000189712984825 0.000316996284099 +CCCTTA 5.71424653088e-05 0.000133842875509 +TCAATC 0.000148570409803 0.00025623866298 +CGTCGT 6.62852597582e-05 4.93105330821e-05 +CAGTTC 0.000598853036436 0.000279132839054 +CAGTTA 0.000159998902865 0.000215733582234 +CAGTTG 0.000274283833482 0.000305549196062 +GACCCC 0.00041828284606 0.000105665428033 +CTCTGT 0.000239998354297 0.000430586619235 +TCAATT 0.000100570738944 0.000350457002976 +TGGCGT 7.54280542076e-05 0.000120634697004 +GTTTGG 0.000143999012578 0.000348695912509 +CTCTGC 0.000287998025156 0.000348695912509 +GACCCT 0.000445711229409 0.000152334325414 +CTCTGA 3.19997805729e-05 0.000394484264657 +CTCTGG 0.000198855779275 0.00032932391737 +CAGTTT 0.000653709803133 0.000532729866333 +GCGAAG 0.000173713094539 7.39657996231e-05 +CTACTC 8.4570848657e-05 0.000105665428033 +TGCTGG 0.000201141477887 0.000399767536058 +GCGAAC 0.000102856437556 5.98770758854e-05 +GAGTCT 0.000607995830886 0.000244791574943 +GCGAAA 0.000148570409803 0.000117993061304 +TAGGGA 2.28569861235e-06 8.45323424264e-05 +GCTGGT 0.00045713972247 0.000237747213074 +GTGATT 0.000420568544673 0.000322279555501 +CTACTA 6.17138625335e-05 0.000103023792332 +TGCTGT 0.000214855669561 0.000549460225772 +GCGAAT 7.54280542076e-05 8.36517971928e-05 +TAATGG 0.0 0.000199003222796 +GTGATG 0.00065142410452 0.000404170262226 +CTACTG 0.000212569970949 0.000217494672701 +GTGATC 0.000489139503043 0.000150573234947 +GCTGGC 0.000297140819606 0.000178750682423 +GTGATA 0.000114284930618 0.000167303594386 +GCTGGA 0.000850279883795 0.000448197523907 +TGATAA 4.5713972247e-06 0.000353979183911 +TGTAGT 5.48567666965e-05 0.000287057746156 +TGATAC 0.0 0.000159378687283 +TGATAG 0.0 0.000164661958685 +CTTGTT 0.000205712875112 0.000421781166899 +GACGGT 0.000196570080662 8.80545233609e-05 +GCTAGG 4.34282736347e-05 5.6354894951e-05 +GCTAGA 8.68565472694e-05 0.000130320694574 +ATGAAT 0.00041828284606 0.00054417695437 +CTATGT 4.5713972247e-05 0.000134723420742 +AAGGGT 0.000409140051611 0.000173467411021 +TGATAT 0.0 0.000327562826902 +GTAGTG 0.000198855779275 0.000172586865787 +GCTAGT 0.000107427834781 0.000100382156631 +ATGAAC 0.000678852487869 0.000383917721853 +GACGGG 0.000201141477887 0.000101262701865 +ATGAAA 0.000587424543375 0.00069298909885 +GACGGA 0.00031085501128 0.000132081785041 +ATGAAG 0.0011108495256 0.000525685504464 +GACGGC 0.000393140161325 0.000100382156631 +CTTGTC 0.000139427615353 0.00019283940616 +CTAACT 6.62852597582e-05 0.000145289963545 +CCATAG 6.85709583706e-06 0.000136484511209 +GGTGAA 0.000553139064189 0.000295863198493 +GGTGAC 0.000390854462712 0.00014881214448 +GCGTCT 0.000228569861235 0.000114470880369 +TGTAAA 0.000278855230707 0.000776640896043 +GGTGAG 0.000479996708594 0.000172586865787 +GGAATG 0.00042742564051 0.000255358117747 +CGTCCT 0.000166855998702 0.000123276332705 +GGAATC 0.000329140600179 0.00015849814205 +GGAATA 0.000146284711191 0.000198122677562 +GCGTCA 8.68565472694e-05 0.0001074265185 +GCGTCC 0.000162284601477 0.000100382156631 +GGTGAT 0.000452568325246 0.000205167039431 +GCGTCG 6.85709583706e-05 5.81159854182e-05 +CGTCCG 7.54280542076e-05 5.81159854182e-05 +GGAATT 0.000251426847359 0.00020252540373 +CGTCCC 0.000102856437556 9.6859975697e-05 +CGTCCA 0.00011657062923 0.000142648327845 +TTTCGA 9.59993417188e-05 0.000103023792332 +CCGTAT 0.00015542750564 5.81159854182e-05 +GAAGTC 0.000345140490465 0.000235105577374 +CTACTT 7.99994514323e-05 0.00018051177289 +CGTGGT 0.000162284601477 9.06961590617e-05 +GCCGTA 0.000100570738944 4.40272616804e-05 +CCGTAC 0.000198855779275 4.4907806914e-05 +CCGTAA 6.85709583706e-06 6.5160347287e-05 +CCGTAG 4.5713972247e-06 3.87439902788e-05 +CTAACA 0.000134856218129 0.000198122677562 +GCCGTT 0.000118856327842 9.6859975697e-05 +TTGGTG 0.000395425859937 0.000273849567652 +GAAGTT 0.000377140271038 0.000299385379427 +GGCGCG 8.4570848657e-05 5.89965306518e-05 +ATGCCC 0.00027199813487 0.000118873606537 +TTAGTT 8.68565472694e-05 0.000409453533628 +ATGCCA 0.000301712216831 0.000259760843915 +GGCGCC 0.000107427834781 5.89965306518e-05 +ATGCCG 0.000148570409803 6.60408925206e-05 +GGCGCA 0.000139427615353 8.1010161492e-05 +TATTAC 0.000258283943196 0.000279132839054 +ACTATG 0.000171427395926 0.000159378687283 +CCATAT 0.000205712875112 0.000204286494197 +TTTAAG 0.000372568873813 0.000594368032686 +ACTATC 0.000148570409803 0.000109187608967 +TTTAAA 0.000527996379453 0.00152686543508 +ACTATA 0.00011657062923 0.000205167039431 +TTTAAC 0.000303997915443 0.000525685504464 +TATTAT 0.000217141368173 0.000726449817727 +TTAGTG 0.000173713094539 0.000223658489337 +GGCGCT 0.000217141368173 0.000112709789902 +TTAGTC 6.17138625335e-05 0.000172586865787 +ATGCCT 0.000415997147448 0.000184914499058 +TTAGTA 6.39995611459e-05 0.000221897398869 +TTTAAT 0.000246855450134 0.00096859975697 +ACTATT 0.000212569970949 0.000307310286529 +GGGCAT 0.000100570738944 0.000138245601677 +TCGATA 2.74283833482e-05 5.72354401846e-05 +TTCTAG 6.85709583706e-06 0.000138245601677 +TTTCCA 0.000297140819606 0.000547699135305 +TTTCCC 0.000198855779275 0.000352218093443 +GGGACT 0.000153141807028 0.000141767782611 +TATCGA 7.771375282e-05 8.27712519592e-05 +GTTTGT 0.000173713094539 0.00055386295194 +TTTCCT 0.000335997696016 0.000463166792878 +GGGCAG 0.000265141039033 0.000201644858496 +GTCTGT 0.00019428438205 0.00035133754821 +GGGCAA 0.000121142026455 0.000137365056443 +GGGCAC 8.22851500447e-05 9.6859975697e-05 +GTACGG 5.48567666965e-05 4.66688973813e-05 +GTTTGA 2.51426847359e-05 0.000521282778296 +GTACGC 5.48567666965e-05 4.4907806914e-05 +GTACGA 7.99994514323e-05 4.75494426149e-05 +CCGCTC 0.000198855779275 0.000113590335136 +GCATGT 0.00015542750564 0.000302907560361 +CCGCTA 5.48567666965e-05 7.30852543895e-05 +CCGCTG 0.000399997257162 0.000179631227656 +TGAAAA 4.5713972247e-06 0.000792490710248 +GCGCGG 7.771375282e-05 6.95630734551e-05 +GCGCGC 8.4570848657e-05 0.000156737051582 +TGTTTT 0.000166855998702 0.00137981438106 +GCGCGA 4.5713972247e-05 4.66688973813e-05 +GCATGG 0.000137141916741 0.000162020322984 +TGGATC 0.000278855230707 0.000242149939242 +GCATGC 8.91422458817e-05 0.000236866667841 +CCGCTT 9.37136431064e-05 0.000115351425603 +GCATGA 1.37141916741e-05 0.000263283024849 +TTTCAG 0.000564567557251 0.00061726220876 +GTCGAC 0.000118856327842 8.45323424264e-05 +GCGCGT 4.34282736347e-05 8.62934328936e-05 +GTCGAG 0.000148570409803 7.74879805576e-05 +CGTGGC 0.000148570409803 8.1010161492e-05 +CTTCCG 9.59993417188e-05 8.62934328936e-05 +TGCGCT 0.000125713423679 0.000157617596816 +GAGCTC 0.00081599440461 0.00027561065812 +ATTGAT 0.000587424543375 0.000365426271948 +GAGCTG 0.00212341401088 0.000454361340542 +AAACGA 0.000251426847359 0.000210450310832 +AAACGC 0.000297140819606 0.000220136308402 +GTAACA 0.000102856437556 0.000252716482046 +GTAGTA 7.31423555953e-05 0.000109187608967 +AAACGG 0.000175998793151 0.000165542503918 +ATTGAA 0.000550853365577 0.000407692443161 +TGCGCG 4.5713972247e-05 0.000111829244668 +ATTGAC 0.000589710241987 0.000270327386718 +GAGCTT 0.000607995830886 0.000251835936812 +TGCGCC 9.37136431064e-05 7.48463448567e-05 +ATTGAG 0.000879993965756 0.00028793829139 +CGCTGA 1.82855888988e-05 0.000173467411021 +CACGCA 0.000111999232005 0.000162900868218 +AAACGT 0.000169141697314 0.000264163570083 +ATTTCG 5.25710680841e-05 0.000110068154201 +ATTTCA 0.000203427176499 0.000626067661096 +ATTTCC 0.000205712875112 0.000402409171759 +ATCAGT 0.000500567996105 0.000396245355124 +ATCGGG 0.00015542750564 5.19521687829e-05 +CATAGT 4.79996708594e-05 0.000176989591955 +ATCGGC 0.000361140380752 6.5160347287e-05 +ATCGGA 0.000201141477887 4.4907806914e-05 +ATTTCT 0.000274283833482 0.000602292939788 +TACGCC 0.000274283833482 2.81774474755e-05 +TGGGTC 0.000141713313966 0.000136484511209 +TTTCGG 0.000107427834781 0.00012679851364 +TGGGTA 3.65711777976e-05 0.000122395787472 +CATAGG 3.19997805729e-05 9.50988852297e-05 +ATCGGT 0.000182855888988 8.01296162584e-05 +ATCAGG 0.000251426847359 0.000248313755878 +CATAGC 4.5713972247e-05 0.000112709789902 +ATCAGC 0.000667423994807 0.000337248824472 +ACGGGT 0.000118856327842 6.78019829879e-05 +GTCTGA 3.19997805729e-05 0.000399767536058 +GATTCT 0.000308569312668 0.000245672120177 +CTTTTG 0.00023314125846 0.000497508056989 +GCGTTC 0.000159998902865 0.00011711251607 +CTTTTC 0.000242284052909 0.00043675043587 +CTTTTA 0.000134856218129 0.000632231477731 +GATTCC 0.000159998902865 0.00015849814205 +ACGGGG 8.91422458817e-05 7.13241639223e-05 +ACGGGA 0.000130284820904 8.36517971928e-05 +ACGGGC 0.000178284491763 5.19521687829e-05 +TACTAT 0.000230855559848 0.000196361587095 +CTTTTT 0.000191998683438 0.000881425778842 +CGTAGA 5.71424653088e-05 4.0505080746e-05 +TCACGA 8.91422458817e-05 0.000105665428033 +TCACGC 0.000121142026455 0.000109187608967 +TCACGG 6.39995611459e-05 8.89350685945e-05 +TCTCAT 0.000221712765398 0.000352218093443 +TCACGT 7.771375282e-05 0.000127679058873 +AGTGGA 0.00045713972247 0.000321399010267 +TTCCAC 0.000370283175201 0.000309071376997 +TTCCAA 0.000175998793151 0.000273849567652 +TTCCAG 0.00080685161016 0.00032932391737 +CGAGGC 0.000109713533393 9.50988852297e-05 +ACCCTT 0.00015542750564 0.000175228501488 +TGAAGT 2.28569861235e-06 0.00044907806914 +ATGCTT 0.000283426627932 0.000398886990825 +TTCCAT 0.000178284491763 0.000300265924661 +ACCCTA 7.54280542076e-05 0.000111829244668 +ACCCTC 0.000290283723769 0.000172586865787 +TGAAGG 2.28569861235e-06 0.000390081538489 +ACCCTG 0.000390854462712 0.000191078315693 +CTGACT 0.000377140271038 0.000317876829333 +CCCCTT 0.000107427834781 0.000177870137189 +AGTTAT 0.000166855998702 0.000302027015128 +CTGACG 0.000342854791853 0.000169945230086 +CTGACC 0.000619424323947 0.000247433210644 +CTGACA 0.000475425311369 0.000360143000546 +AGTTAA 1.82855888988e-05 0.000364545726714 +CCCCTG 0.00019428438205 0.000177870137189 +AGTTAC 0.000217141368173 0.000153214870648 +CCCCTC 0.000166855998702 0.00018051177289 +AGTTAG 4.5713972247e-06 0.000122395787472 +CCCCTA 5.02853694718e-05 7.39657996231e-05 +ACACAG 0.000564567557251 0.000568832220911 +ACACAA 0.000324569202954 0.000659528379973 +ACACAC 0.000365711777976 0.00154359579452 +AATGTT 0.00034971188769 0.000726449817727 +CTGCAG 0.00169141697314 0.000605815120723 +CATGGG 0.000153141807028 0.000149692689713 +CATGGA 0.000329140600179 0.000268566296251 +CATGGC 0.000281140929319 0.000196361587095 +AATGTC 0.000299426518218 0.000420020076431 +ACACAT 0.000185141587601 0.000561787859042 +AATGTA 0.000198855779275 0.000525685504464 +AATGTG 0.000626281419785 0.000506313509325 +CATGGT 0.000221712765398 0.000179631227656 +CTGCAT 0.000331426298791 0.000445555888206 +GCACAG 0.000468568215532 0.000311713012697 +ACATTT 0.000299426518218 0.00096859975697 +CGAGAT 0.000226284162623 8.45323424264e-05 +ATTACT 0.000191998683438 0.000336368279239 +ACATTG 0.000173713094539 0.000355740274378 +GTACCA 0.000123427725067 9.86210661642e-05 +ACATTA 0.00015542750564 0.00049046369512 +ACATTC 0.000207998573724 0.000364545726714 +ATTACA 0.000212569970949 0.000461405702411 +ATGCTC 0.000290283723769 0.000206047584664 +ATTACC 0.000105142136168 0.000194600496628 +CGAGAC 0.000258283943196 0.000101262701865 +ATTACG 5.71424653088e-05 0.000102143247099 +AAGTCT 0.000383997366875 0.000277371748587 +ATGCTA 0.000153141807028 0.000242149939242 +GGACAT 0.000189712984825 0.000232463941673 +GCTATA 0.000134856218129 0.000167303594386 +GCTATC 0.000166855998702 0.000108307063734 +AAGTCG 8.91422458817e-05 9.59794304633e-05 +AAGTCA 0.000255998244583 0.00041473680503 +GCTATG 0.000253712545971 0.000111829244668 +AAGTCC 0.000278855230707 0.00016113977775 +GGACAG 0.000639995611459 0.000282655019988 +GGACAC 0.000333711997403 0.000232463941673 +GGACAA 0.000219427066786 0.000280013384288 +GCACCT 0.000276569532095 0.000155856506349 +AGGGTT 0.000148570409803 0.000235105577374 +GAGGCG 0.000381711668263 0.000136484511209 +TGTTGG 4.79996708594e-05 0.000321399010267 +GAGGCA 0.000491425201656 0.000206047584664 +AGCGCT 0.000260569641808 0.000196361587095 +GAGGCC 0.00084570848657 0.000156737051582 +TGTTGC 5.94281639212e-05 0.000322279555501 +TTCTCA 0.000253712545971 0.000416497895497 +ACTCGA 7.99994514323e-05 0.0001074265185 +TAAAAT 0.0 0.00104784882799 +ACTCGC 0.00011657062923 0.000115351425603 +ACTCGG 8.4570848657e-05 6.69214377543e-05 +AGCGCA 0.000182855888988 0.000154095415882 +GAGGCT 0.00080685161016 0.000232463941673 +AGCGCC 0.000239998354297 0.000133842875509 +AGGGTG 0.000221712765398 0.000151453780181 +AGGGTA 4.11425750223e-05 9.33377947625e-05 +AGCGCG 0.000100570738944 9.24572495289e-05 +AGGGTC 0.000121142026455 0.000110068154201 +TAAAAG 4.5713972247e-06 0.00057587658278 +ACTCGT 8.4570848657e-05 9.95016113978e-05 +TAAAAC 2.28569861235e-06 0.000687705827448 +TAAAAA 0.0 0.00120722751528 +ACGTTC 0.000137141916741 0.000105665428033 +AGCTGC 0.000297140819606 0.00040505080746 +ACGTTA 5.71424653088e-05 0.000159378687283 +AGCTGA 3.65711777976e-05 0.000509835690259 +ACGTTG 7.08566569829e-05 0.000100382156631 +AGCTGG 0.000283426627932 0.000294102108025 +TAGGGG 0.0 8.1010161492e-05 +TAAATG 0.0 0.000737896905764 +AGTGCG 0.000114284930618 0.000103904337566 +AGTGCA 0.000294855120993 0.000352218093443 +AGAGTT 0.000235426957072 0.000301146469894 +AGTGCC 0.000303997915443 0.00012679851364 +CCAAAA 0.000390854462712 0.00043675043587 +TTCGTG 0.000180570190376 6.60408925206e-05 +TAGGGT 0.0 0.000115351425603 +GCATAG 4.5713972247e-06 0.000116231970836 +AGCTGT 0.000299426518218 0.000475494426149 +ACGTTT 0.000203427176499 0.000294982653259 +AGTGCT 0.000365711777976 0.000303788105595 +AGAGTC 0.000253712545971 0.000227180670271 +AGAGTA 8.68565472694e-05 0.000150573234947 +AGAGTG 0.000333711997403 0.000270327386718 +TTCGTA 5.94281639212e-05 8.1010161492e-05 +GTTAAA 0.000308569312668 0.000482538788018 +CCTGGC 0.000406854352999 0.000152334325414 +GTTAAC 0.000148570409803 0.000207808675132 +CCTGGA 0.000827422897672 0.000263283024849 +CCTGGG 0.000226284162623 0.000113590335136 +GTTAAG 0.000130284820904 0.00016113977775 +TTCGTC 0.000173713094539 7.92490710248e-05 +GCACCC 0.000153141807028 0.000123276332705 +GTCTGG 0.000182855888988 0.00023422503214 +GTCTGC 0.000255998244583 0.000295863198493 +GTTAAT 0.000171427395926 0.000338129369706 +CCTGGT 0.000498282297493 0.000168184139619 +TCTAAA 0.000356568983527 0.000481658242784 +GGAAGG 0.000159998902865 0.000196361587095 +CCACAT 0.000189712984825 0.000263283024849 +GGAAGC 0.000269712436258 0.000199883768029 +GCACCG 0.000107427834781 8.62934328936e-05 +GGAAGA 0.000237712655685 0.000343412641107 +GCGTTA 6.17138625335e-05 9.15767042953e-05 +CAATGA 1.59998902865e-05 0.000322279555501 +CCCGCA 9.59993417188e-05 8.80545233609e-05 +CAATGC 9.37136431064e-05 0.000244791574943 +GCGTTG 9.59993417188e-05 7.30852543895e-05 +CAATGG 0.000127999122292 0.00025623866298 +CCACAG 0.000553139064189 0.000333726643538 +GGAAGT 0.000265141039033 0.000241269394009 +CCACAC 0.000187427286213 0.000314354648398 +CCACAA 0.000244569751522 0.000286177200923 +ATTTGT 0.000132570519516 0.000670094922776 +TCCTCG 0.000132570519516 0.000132081785041 +TGTATG 0.00019428438205 0.00036102354578 +CAATGT 0.000114284930618 0.000308190831763 +GCGTTT 0.000230855559848 0.000219255763169 +TCCTCC 0.000500567996105 0.000392723174189 +TGTATC 0.000109713533393 0.000154095415882 +CGTTAG 2.28569861235e-06 5.37132592501e-05 +TAACCG 4.5713972247e-06 8.18907067256e-05 +TCAAAC 0.000301712216831 0.000426183893067 +TCAGGG 0.000201141477887 0.00016113977775 +CGTTAC 0.000118856327842 8.89350685945e-05 +TAACCC 0.0 0.000147051054013 +CGTTAA 4.5713972247e-06 0.000120634697004 +TAACCA 4.5713972247e-06 0.000232463941673 +ACCGCT 0.000180570190376 9.59794304633e-05 +TCGCGA 2.74283833482e-05 4.0505080746e-05 +TAGTGT 0.0 0.000250074846345 +TCAGGA 0.000431997037735 0.000350457002976 +TTCGTT 7.08566569829e-05 0.000122395787472 +TACCCT 0.000235426957072 9.77405209306e-05 +TAACCT 4.5713972247e-06 0.000205167039431 +CGTTAT 0.000148570409803 0.000127679058873 +GTGAAA 0.000569138954476 0.00051247732596 +GTGAAC 0.000575996050313 0.000264163570083 +TGCATA 0.000105142136168 0.000357501364845 +ACCGCG 5.71424653088e-05 3.87439902788e-05 +ACCGCA 0.000141713313966 9.86210661642e-05 +CCCTAT 0.000127999122292 9.77405209306e-05 +ACCGCC 0.000217141368173 8.541288766e-05 +AGATCC 0.000111999232005 0.000206047584664 +AGGCTT 0.000114284930618 0.000221016853636 +CCTTCT 0.000285712326544 0.000221016853636 +GGGACG 0.000150856108415 0.000100382156631 +TGTCGC 8.91422458817e-05 8.1010161492e-05 +GTTGCC 0.000210284272336 0.000150573234947 +GTGCCG 0.000214855669561 6.33992568198e-05 +GTGCCA 0.000326854901566 0.000154095415882 +GTTGCG 7.08566569829e-05 7.39657996231e-05 +GTGCCC 0.000370283175201 8.36517971928e-05 +CCGCCG 0.000162284601477 8.1010161492e-05 +AGGCTA 8.22851500447e-05 0.000195481041861 +CCTTCC 0.000226284162623 0.000137365056443 +AGGCTC 0.000137141916741 0.00014881214448 +CCGCCC 0.000134856218129 8.27712519592e-05 +TGTCGA 9.59993417188e-05 0.000100382156631 +CCGCCA 0.000146284711191 0.000109187608967 +AGGCTG 0.000372568873813 0.0003196379198 +GTGCCT 0.000283426627932 0.000159378687283 +TCCAAA 0.000644567008683 0.000405931352694 +GTTGCT 0.000278855230707 0.000221897398869 +GGATAT 0.000281140929319 0.000276491203353 +TCGGGT 6.17138625335e-05 6.86825282215e-05 +ATTTGA 1.14284930618e-05 0.000596129123153 +GCAGTT 0.000262855340421 0.000292341017558 +GAAGCT 0.000687995282318 0.000288818836624 +GGATAA 1.14284930618e-05 0.000176109046722 +GGATAC 0.000370283175201 0.000105665428033 +TCGGGG 7.99994514323e-05 6.78019829879e-05 +GGATAG 4.5713972247e-06 9.50988852297e-05 +GAAGCG 0.000246855450134 0.000125917968406 +CCGCCT 0.000164570300089 8.18907067256e-05 +GCAGTG 0.000642281310071 0.000377753905218 +GAAGCC 0.000575996050313 0.000200764313263 +GCAGTA 0.000230855559848 0.000235105577374 +GAAGCA 0.000557710461414 0.000388320448021 +GCAGTC 0.000262855340421 0.000201644858496 +CGCCCG 4.79996708594e-05 3.52218093443e-05 +GAGAGA 0.000859422678244 0.000743180177166 +CGCCCC 5.25710680841e-05 6.33992568198e-05 +CGCCCA 5.02853694718e-05 6.78019829879e-05 +AGTTTG 0.000278855230707 0.000456122431009 +ACGCAG 0.000278855230707 0.000157617596816 +ACGCAC 0.000107427834781 0.000151453780181 +ACGCAA 9.59993417188e-05 0.000138245601677 +CTCGCA 0.000105142136168 0.000128559604107 +ACGTAC 0.000153141807028 6.42798020534e-05 +CCCTAG 2.28569861235e-06 4.75494426149e-05 +ACGCAT 7.54280542076e-05 0.000125037423172 +AGTTTC 0.000278855230707 0.000325801736435 +GCCGGG 0.000105142136168 7.13241639223e-05 +TACCCG 9.82850403312e-05 4.93105330821e-05 +GCCGGC 0.00019428438205 7.48463448567e-05 +CATGTT 0.000239998354297 0.000438511526337 +GCCGGA 0.000242284052909 9.6859975697e-05 +TTGGGG 0.000130284820904 0.000169064684853 +AGATCT 0.000157713204252 0.000294982653259 +ACGTAG 4.5713972247e-06 5.81159854182e-05 +GCCACT 0.000422854243285 0.000197242132328 +CATGTA 8.91422458817e-05 0.000251835936812 +GTTGCA 0.000230855559848 0.000249194301111 +CATGTC 0.000182855888988 0.000287057746156 +GCCGGT 0.000196570080662 7.83685257912e-05 +CATGTG 0.000402282955774 0.000420900621665 +GTGCGA 0.000189712984825 9.33377947625e-05 +TACCCC 0.000178284491763 7.39657996231e-05 +GATTGG 0.000173713094539 0.000217494672701 +GGCCTG 0.000530282078066 0.000207808675132 +GGCCTC 0.000251426847359 0.000169945230086 +GGCCTA 9.82850403312e-05 9.86210661642e-05 +TTTGTT 0.000381711668263 0.00105929591603 +AATCGG 8.68565472694e-05 7.04436186887e-05 +AATCGC 0.000102856437556 0.000106545973267 +AATCGA 0.000102856437556 0.000106545973267 +TTCCCA 0.000315426408505 0.000340771005407 +GGCCTT 0.000230855559848 0.000153214870648 +TCACTA 8.4570848657e-05 0.000221016853636 +TCACTC 0.000157713204252 0.000279132839054 +AATCGT 0.000102856437556 0.000125037423172 +AGCCGA 0.000150856108415 0.000125037423172 +CCTTCA 0.000278855230707 0.000338129369706 +AGCCGC 0.000180570190376 0.000115351425603 +TAATTG 0.0 0.000299385379427 +AAAAAT 0.000404568654386 0.00112357571808 +AGCCGG 0.000102856437556 8.80545233609e-05 +GTTTTT 0.000230855559848 0.000942183399961 +TGGTGA 2.51426847359e-05 0.000307310286529 +GATGGA 0.000930279335227 0.000417378440731 +TGGTGC 0.00011657062923 0.000163781413451 +CCAAGT 0.000159998902865 0.000153214870648 +GGGCTG 0.000299426518218 0.000199883768029 +TGGTGG 0.000187427286213 0.000250074846345 +GATGGG 0.000406854352999 0.000184914499058 +AAAAAA 0.000642281310071 0.00215997745804 +AAAAAC 0.000630852817009 0.000858531602768 +GAGCGA 0.000322283504342 0.000157617596816 +AGCCGT 0.000130284820904 0.000131201239808 +AAAAAG 0.000934850732452 0.000810982160154 +TGACAG 2.28569861235e-06 0.000421781166899 +CCAAGG 8.22851500447e-05 0.000108307063734 +CTACAT 0.000107427834781 0.000283535565222 +TCTCAG 0.000635424214234 0.000316115738866 +CCAAGC 0.000196570080662 0.000119754151771 +TGGTGT 0.000118856327842 0.000346054276808 +CCAAGA 0.00019428438205 0.000178750682423 +AGAACT 0.000169141697314 0.000240388848775 +GCATTA 0.000162284601477 0.000257119208214 +CCTTCG 6.62852597582e-05 5.37132592501e-05 +TACCAT 0.000185141587601 0.000150573234947 +AGATAG 2.28569861235e-06 0.000122395787472 +CACTGT 0.000258283943196 0.000357501364845 +ACCCGA 7.771375282e-05 5.98770758854e-05 +ATGTCT 0.000436568434959 0.000411214624095 +ACCCGC 0.000143999012578 7.83685257912e-05 +AGATAA 6.85709583706e-06 0.000295863198493 +TACCAC 0.000235426957072 0.000117993061304 +AGAACG 6.85709583706e-05 0.000134723420742 +TACCAA 0.000178284491763 0.000172586865787 +AGAACA 0.000169141697314 0.000438511526337 +TACCAG 0.000541710571128 0.00014881214448 +AGAACC 0.000187427286213 0.000176989591955 +ATGTCA 0.000274283833482 0.000416497895497 +CACTGG 0.000265141039033 0.000346934822042 +AGATAT 0.000153141807028 0.000324921191202 +TGACAA 0.0 0.000413856259796 +ACCAGG 0.000164570300089 0.00016113977775 +CACTGC 0.000285712326544 0.000380395540919 +ATGTCG 0.000166855998702 0.0001074265185 +CACTGA 2.28569861235e-05 0.000491344240354 +TAGGTT 0.0 0.000133842875509 +GTTTAC 0.000313140709892 0.000343412641107 +AATTAT 0.000157713204252 0.000588204216051 +CTGTTG 0.000415997147448 0.000425303347833 +TGCTAT 0.000157713204252 0.000201644858496 +CTGTTC 0.000489139503043 0.00032932391737 +CGGGTT 0.000105142136168 6.33992568198e-05 +CTGTTA 0.000150856108415 0.000281774474755 +AATTAC 0.000230855559848 0.000324921191202 +AATTAA 1.82855888988e-05 0.00073437472483 +AATTAG 4.5713972247e-06 0.000304668650829 +TAGGTC 0.0 8.98156138281e-05 +CGGGTC 0.000139427615353 7.30852543895e-05 +CTGTTT 0.000726852158728 0.000700914005952 +CGGGTA 3.19997805729e-05 4.0505080746e-05 +CGGGTG 0.000148570409803 8.62934328936e-05 +CCAAAC 0.000406854352999 0.000334607188771 +CTTCGG 9.59993417188e-05 7.57268900903e-05 +CACACT 0.000399997257162 0.000456122431009 +TGGATG 0.000351997586302 0.00038303717662 +AGCAAA 0.000687995282318 0.000519521687829 +ATATAT 9.14279444941e-05 0.000750224539035 +AGCAAC 0.00050513939333 0.00023422503214 +TTAGGC 7.99994514323e-05 0.00014881214448 +AAAGCT 0.000658281200357 0.000434989345403 +AGCAAG 0.00053485347529 0.000240388848775 +AAAGCA 0.000740566350402 0.000641917475301 +ATATAG 2.28569861235e-06 0.000206047584664 +TTAGGT 6.17138625335e-05 0.000154095415882 +ATATAA 6.85709583706e-06 0.000524804959231 +AGCAAT 0.000358854682139 0.000283535565222 +ATATAC 0.000114284930618 0.000285296655689 +ATAGCA 0.000148570409803 0.000194600496628 +ATAGCC 0.000130284820904 0.000131201239808 +TACTTG 0.000201141477887 0.000215733582234 +ATAGCG 8.68565472694e-05 5.81159854182e-05 +TCTCAC 0.000226284162623 0.000245672120177 +TGCTAA 6.85709583706e-06 0.000280013384288 +ATAGCT 0.000111999232005 0.000168184139619 +TACTTT 0.000303997915443 0.000440272616804 +GTTTTC 0.000329140600179 0.000482538788018 +CGAGTT 9.59993417188e-05 8.45323424264e-05 +CTCGCC 0.000201141477887 0.000100382156631 +CGTACT 5.48567666965e-05 5.37132592501e-05 +TCCCGT 0.00011657062923 8.36517971928e-05 +ACATAC 0.00027199813487 0.000307310286529 +CTTAAG 0.000185141587601 0.000151453780181 +ACATAA 1.59998902865e-05 0.000424422802599 +CTTAAA 0.000333711997403 0.000584682035116 +AGGGGT 0.000118856327842 0.000166423049152 +CTTAAC 0.000157713204252 0.000156737051582 +CGTACA 6.17138625335e-05 9.50988852297e-05 +CGAGTG 0.000237712655685 0.000104784882799 +TTGTTA 8.22851500447e-05 0.000396245355124 +CGAGTA 6.17138625335e-05 5.72354401846e-05 +CGAGTC 0.000105142136168 0.000103904337566 +AGGGGA 0.000123427725067 0.000206928129898 +CTTAAT 0.000196570080662 0.000316996284099 +AGGGGC 0.000105142136168 0.000111829244668 +TATGCA 0.000281140929319 0.000361904091013 +AGGGGG 6.62852597582e-05 0.000169064684853 +TCATTA 0.000130284820904 0.000492224785587 +CGACTT 7.08566569829e-05 6.95630734551e-05 +TCGGGC 0.000100570738944 6.42798020534e-05 +TTGTAA 6.85709583706e-06 0.000508074599792 +TTGTAC 0.000143999012578 0.000223658489337 +GTACCT 0.000125713423679 0.000110948699435 +TCATTG 0.000139427615353 0.000375992814751 +TGAATC 2.28569861235e-06 0.000338129369706 +CGACTA 4.11425750223e-05 3.25801736435e-05 +TGAATA 2.28569861235e-06 0.000377753905218 +CGACTC 0.000123427725067 9.42183399961e-05 +TGAATG 4.5713972247e-06 0.000569712766145 +AAGTAT 0.000335997696016 0.000251835936812 +CGACTG 0.000249141148746 0.000142648327845 +TTGCCA 0.000226284162623 0.000277371748587 +TTGTAT 0.000137141916741 0.000427944983534 +ATCGTG 0.000333711997403 7.22047091559e-05 +GCTTCG 9.14279444941e-05 7.30852543895e-05 +ATCGTC 0.000290283723769 9.33377947625e-05 +ATCGTA 8.91422458817e-05 7.22047091559e-05 +TGGGAG 0.000498282297493 0.00020252540373 +TGGGAA 0.000260569641808 0.000263283024849 +TGGGAC 0.000331426298791 0.000166423049152 +GCTTCT 0.000253712545971 0.000313474103165 +ATCGTT 0.000137141916741 0.000104784882799 +GATTGA 1.82855888988e-05 0.000284416110456 +TGGGAT 0.000313140709892 0.000208689220365 +GGGCTA 7.31423555953e-05 0.000112709789902 +CTAGCC 0.000109713533393 6.0757621119e-05 +CTAGCA 0.000125713423679 0.00011711251607 +CTAGCG 5.94281639212e-05 3.96245355124e-05 +CGGTAG 0.0 5.54743497173e-05 +ACTTAG 2.28569861235e-06 9.77405209306e-05 +ACTTAA 4.5713972247e-06 0.00038303717662 +CGGTAC 7.771375282e-05 3.6102354578e-05 +ACTTAC 0.000205712875112 0.000154095415882 +CGGTAA 0.0 8.71739781273e-05 +GACCAG 0.000742852049015 0.000194600496628 +GACCAC 0.000358854682139 0.000191958860927 +TTGCCC 0.000150856108415 0.000104784882799 +CTAGCT 0.000130284820904 9.86210661642e-05 +TTCGAG 0.000315426408505 8.36517971928e-05 +ACTTAT 0.000100570738944 0.000227180670271 +CGGTAT 3.885687641e-05 6.0757621119e-05 +TACACA 0.000395425859937 0.000444675342972 +TACACG 0.000191998683438 9.42183399961e-05 +GCGAGA 7.99994514323e-05 0.000114470880369 +GAGAGC 0.000838851390733 0.000294102108025 +GCGAGC 0.000121142026455 9.86210661642e-05 +GGCCGT 0.000178284491763 6.16381663526e-05 +GCGAGG 7.31423555953e-05 0.000111829244668 +TTAAGA 8.22851500447e-05 0.000324921191202 +CAGCCG 0.00037942596965 0.00015849814205 +CAGCCA 0.000406854352999 0.000349576457743 +CAGCCC 0.000452568325246 0.000173467411021 +TCCGGG 8.4570848657e-05 7.22047091559e-05 +GCGAGT 0.000105142136168 9.86210661642e-05 +CAGCCT 0.000498282297493 0.000283535565222 +GAACTC 0.000308569312668 0.000193719951394 +GAACTA 0.000159998902865 0.000198122677562 +GGACTT 0.000251426847359 0.000167303594386 +CACCTA 7.771375282e-05 0.000147931599246 +AACTAT 0.000299426518218 0.000258880298681 +CACCTC 0.000265141039033 0.000267685751017 +CACCTG 0.00053485347529 0.000320518465034 +TGATCC 2.28569861235e-06 0.000190197770459 +AACACT 0.000484568105819 0.000535371502034 +TGATCA 0.0 0.000358381910079 +TGATCG 0.0 5.72354401846e-05 +TGCATG 0.000317712107117 0.000362784636247 +AACTAG 4.5713972247e-06 0.000140887237377 +GATTTA 0.000169141697314 0.0004270644383 +CACCTT 0.000111999232005 0.000232463941673 +AACTAC 0.000598853036436 0.000227180670271 +AACTAA 2.28569861235e-05 0.000344293186341 +AACACG 0.000196570080662 0.000174347956255 +AACACA 0.000694852378155 0.000831234700527 +AACACC 0.000537139173903 0.00029762428896 +TGATCT 9.14279444941e-06 0.0003196379198 +CCAGCA 0.000473139612757 0.00041473680503 +CTATAC 6.39995611459e-05 0.000111829244668 +CAACAG 0.000411425750223 0.000383917721853 +GACAGT 0.00058285314615 0.000243030484476 +CAACAA 0.000338283394628 0.000508955145026 +CCAGCC 0.00034971188769 0.000223658489337 +CAACAC 0.000228569861235 0.000411214624095 +GGCCGG 0.000141713313966 7.74879805576e-05 +CTATAA 1.14284930618e-05 0.000236866667841 +GACAGG 0.00037942596965 0.000248313755878 +CAACAT 0.000139427615353 0.000429706074001 +GACAGC 0.000937136431064 0.000289699381857 +GACAGA 0.000566853255863 0.000430586619235 +GTATTA 5.71424653088e-05 0.000286177200923 +GTATTC 9.14279444941e-05 0.000167303594386 +GTAAGT 5.25710680841e-05 0.000155856506349 +CCAGCG 0.000169141697314 0.000174347956255 +AGAGGT 0.000274283833482 0.000250074846345 +GGTGGC 0.000299426518218 0.000137365056443 +TCCCCT 0.000205712875112 0.000189317225226 +GGTGGA 0.00066056689897 0.000254477572513 +CGTCAT 8.22851500447e-05 0.000164661958685 +GGTGGG 0.000169141697314 0.000128559604107 +AGAGGC 0.000251426847359 0.000214853037001 +GTAAGA 5.02853694718e-05 0.000164661958685 +AGAGGA 0.00058285314615 0.000467569519046 +CGCCCT 5.71424653088e-05 0.000103904337566 +AGAGGG 0.000187427286213 0.000321399010267 +GTAAGG 5.25710680841e-05 0.000123276332705 +CGTCAA 7.99994514323e-05 0.000106545973267 +CGTCAC 9.82850403312e-05 0.000125917968406 +TCCCCC 0.000123427725067 0.000173467411021 +GGTGGT 0.000402282955774 0.00018051177289 +CGTCAG 0.000274283833482 0.000125917968406 +GTCCGG 0.000107427834781 6.86825282215e-05 +GTCGCA 9.82850403312e-05 7.04436186887e-05 +GTCGCC 0.000125713423679 7.39657996231e-05 +CCGTCT 0.000228569861235 0.000151453780181 +TCGGTA 2.51426847359e-05 6.0757621119e-05 +CTCGCG 6.17138625335e-05 5.37132592501e-05 +TCGGTG 0.000198855779275 9.86210661642e-05 +GTCGCT 0.000143999012578 9.6859975697e-05 +TACCTA 9.82850403312e-05 8.98156138281e-05 +GTAACT 8.4570848657e-05 0.00015849814205 +CCGTCG 5.94281639212e-05 4.93105330821e-05 +CCGTCA 0.000130284820904 0.000118873606537 +CCGTCC 0.000226284162623 8.62934328936e-05 +GGCTGT 0.000342854791853 0.000280893929521 +CGCGTG 0.000111999232005 9.06961590617e-05 +CTATAT 5.71424653088e-05 0.000227180670271 +CGCGTC 7.54280542076e-05 5.98770758854e-05 +CGCGTA 2.05712875112e-05 3.34607188771e-05 +GTTTTA 0.000203427176499 0.000717644365391 +ATGCAG 0.000829708596284 0.000402409171759 +CCACTA 7.31423555953e-05 0.000146170508779 +CCACTC 0.000166855998702 0.000191078315693 +CGCGTT 4.34282736347e-05 7.30852543895e-05 +GGCTGG 0.000441139832184 0.000206928129898 +GGCTGA 1.59998902865e-05 0.000286177200923 +GGCTGC 0.00034971188769 0.000226300125037 +ATGCAT 0.000205712875112 0.000442033707272 +TTTAGA 9.59993417188e-05 0.000415617350263 +TTTCAT 0.000210284272336 0.000620784389694 +TTGACC 0.000207998573724 0.000221016853636 +ATGACG 0.000178284491763 0.000153214870648 +GGAGTT 0.000338283394628 0.000207808675132 +ATGACA 0.000358854682139 0.000479016607083 +ATGACC 0.00050513939333 0.00018051177289 +CGGGCC 0.000127999122292 6.60408925206e-05 +GGGCCT 0.000207998573724 0.000146170508779 +TAAGAA 4.5713972247e-06 0.000301146469894 +ATGACT 0.000317712107117 0.00033196555307 +GGAGTA 0.000153141807028 0.000128559604107 +GGAGTC 0.000372568873813 0.000168184139619 +GGAGTG 0.000614852926723 0.000255358117747 +GGGCCG 0.000121142026455 7.48463448567e-05 +GGGCCC 0.000137141916741 6.86825282215e-05 +GGGCCA 0.000201141477887 0.000150573234947 +GGCAAG 0.000473139612757 0.000114470880369 +ACGAGT 5.25710680841e-05 8.89350685945e-05 +AGGCCA 0.000159998902865 0.000201644858496 +AGGCCC 9.37136431064e-05 0.000124156877939 +AGGCCG 9.37136431064e-05 7.04436186887e-05 +ACGAGG 5.02853694718e-05 0.000105665428033 +ACGAGC 0.000105142136168 0.000118873606537 +GACCCG 0.000267426737645 5.89965306518e-05 +ACGAGA 5.71424653088e-05 0.000132962330275 +GGCAAC 0.000395425859937 0.000123276332705 +AGGCCT 0.000146284711191 0.000204286494197 +AGACGG 0.000121142026455 0.000132081785041 +GGGTTG 0.000132570519516 0.000172586865787 +TTTGGG 0.00027199813487 0.000316115738866 +GGGTTA 4.5713972247e-05 0.000143528873078 +GGGTTC 0.000118856327842 8.98156138281e-05 +TTTGAT 0.000722280761503 0.000606695665956 +TGAACT 4.5713972247e-06 0.000413856259796 +CTACGA 6.85709583706e-05 4.0505080746e-05 +ATTGCT 0.00042742564051 0.000289699381857 +GGGTTT 0.00019428438205 0.000313474103165 +TACAAG 0.000658281200357 0.000215733582234 +TGCGAG 0.000226284162623 0.000105665428033 +AACGGC 0.000470853914145 0.000102143247099 +ATCCAT 0.000185141587601 0.000263283024849 +ATTGCA 0.000381711668263 0.000332846098304 +TTTGGC 0.000411425750223 0.000282655019988 +ATTGCG 9.82850403312e-05 9.15767042953e-05 +TTTGAC 0.000735994953177 0.000437630981103 +TTTGAA 0.000619424323947 0.000700914005952 +CGGGCT 0.00011657062923 7.04436186887e-05 +CTCGTA 3.885687641e-05 7.57268900903e-05 +CTCGTC 0.000153141807028 0.000146170508779 +CCCTGG 0.000201141477887 0.000133842875509 +CCCTGA 1.37141916741e-05 0.000210450310832 +AAGCTT 0.000436568434959 0.000290579927091 +CCCTGC 0.000262855340421 0.000235986122607 +GTGTAA 2.05712875112e-05 0.00033196555307 +CCCTGT 0.000173713094539 0.000204286494197 +AAGCTC 0.000484568105819 0.000271207931951 +GATATA 0.000187427286213 0.000216614127468 +AAGCTA 0.000175998793151 0.000198122677562 +GATATG 0.000317712107117 0.000179631227656 +AAGCTG 0.00115884919646 0.000424422802599 +TGACGC 0.0 0.000156737051582 +TACTCT 0.000251426847359 0.000185795044291 +CATCGT 7.08566569829e-05 9.6859975697e-05 +GTAGTC 7.08566569829e-05 0.000104784882799 +CAGGGT 0.000463996818308 0.000135603965976 +CCAGTC 0.000308569312668 0.000207808675132 +TACGAT 0.000171427395926 7.74879805576e-05 +CCAGTG 0.000539424872515 0.00027561065812 +TACTCG 0.000125713423679 6.16381663526e-05 +CATCGA 7.31423555953e-05 0.000111829244668 +CATCGC 0.000114284930618 0.0001074265185 +TACTCC 0.000283426627932 0.000111829244668 +TACTCA 0.000139427615353 0.000200764313263 +CATCGG 5.94281639212e-05 7.48463448567e-05 +CAGGGG 0.000235426957072 0.000176989591955 +CCAGTT 0.000198855779275 0.000199003222796 +CAGGGC 0.000521139283616 0.000163781413451 +AATCTG 0.000562281858639 0.000393603719423 +CGGACT 6.62852597582e-05 7.92490710248e-05 +AATCTC 0.000237712655685 0.000292341017558 +AATCTA 0.000159998902865 0.000271207931951 +TGAACG 0.0 0.000167303594386 +TCACAC 0.000178284491763 0.000397125900358 +TCACAA 0.000207998573724 0.000412095169329 +TAAATT 0.0 0.000581159854182 +GCCATA 0.000228569861235 0.000166423049152 +CGGACG 9.14279444941e-05 6.16381663526e-05 +ACATCG 7.771375282e-05 8.541288766e-05 +CGGACA 9.82850403312e-05 0.000122395787472 +CGGACC 8.22851500447e-05 4.31467164468e-05 +GCCATG 0.000820565801835 0.000219255763169 +TTTTAA 1.59998902865e-05 0.00151101562087 +TCACAT 0.000102856437556 0.000405931352694 +ATTAAC 0.000207998573724 0.000333726643538 +ATTAAA 0.000514282187779 0.000909603226318 +ATTAAG 0.000313140709892 0.000326682281669 +TTTTAC 0.00031085501128 0.00066128947044 +TCACTT 0.000123427725067 0.000379514995685 +ATTCGT 0.000153141807028 8.89350685945e-05 +GTGCAG 0.00085485128102 0.000325801736435 +TTACTA 7.31423555953e-05 0.000274730112886 +ATTAAT 0.000205712875112 0.00068330310128 +TACCTG 0.000749709144852 0.000194600496628 +GGTATG 0.000173713094539 0.000116231970836 +CTGAAT 0.000546281968352 0.000502791328391 +GGTATC 0.000121142026455 7.48463448567e-05 +CGAGAG 0.000393140161325 0.000154095415882 +CTGAAA 0.000927993636615 0.000642798020534 +CTGAAC 0.000717709364279 0.00038303717662 +TCGACC 6.17138625335e-05 5.89965306518e-05 +GGAACC 0.000278855230707 9.95016113978e-05 +CTGAAG 0.00178055921902 0.000569712766145 +CATTGC 6.17138625335e-05 0.000254477572513 +TATGAG 0.000685709583706 0.000213091946533 +CATTGA 4.5713972247e-06 0.000344293186341 +CTAGTT 9.14279444941e-05 0.000164661958685 +CATTGG 8.4570848657e-05 0.000244791574943 +TCAACT 0.000125713423679 0.00032932391737 +ATGTTA 0.000139427615353 0.000413856259796 +ACACCG 0.000180570190376 0.000112709789902 +CTGCCA 0.000420568544673 0.00030995192223 +CTGCCC 0.000500567996105 0.000160259232517 +ACACCC 0.000214855669561 0.00017082577532 +ACACCA 0.000335997696016 0.00032932391737 +CTGCCG 0.000285712326544 0.000177870137189 +CTAGTG 0.000217141368173 0.000124156877939 +TCAACC 0.000130284820904 0.000155856506349 +ATGTTC 0.000381711668263 0.000321399010267 +CTAGTC 9.59993417188e-05 8.27712519592e-05 +TCAACG 7.99994514323e-05 7.39657996231e-05 +CTAGTA 4.5713972247e-05 0.000100382156631 +CATTGT 0.000100570738944 0.00035133754821 +TATGAC 0.000514282187779 0.000207808675132 +GTAATG 0.000139427615353 0.000254477572513 +ACACCT 0.000267426737645 0.000312593557931 +CTGCCT 0.000463996818308 0.00025623866298 +CCTCGT 0.000150856108415 0.000104784882799 +TTGTGT 0.000148570409803 0.000652484018104 +AGACTG 0.000411425750223 0.000393603719423 +AGACTC 0.000262855340421 0.000235105577374 +AGACTA 0.000105142136168 0.000141767782611 +CCTCGG 9.82850403312e-05 9.06961590617e-05 +CCTCGC 0.000159998902865 8.36517971928e-05 +CCCGAC 0.000164570300089 5.81159854182e-05 +CCTCGA 0.000143999012578 9.77405209306e-05 +CGAGGA 0.000239998354297 0.000137365056443 +AGACTT 0.000175998793151 0.000266805205783 +CGAGGG 0.000121142026455 7.22047091559e-05 +CACCGT 0.000105142136168 9.33377947625e-05 +ACTTTA 0.000189712984825 0.000479897152317 +ACTTTG 0.000214855669561 0.000360143000546 +TAGCTA 0.0 0.000130320694574 +GACCTG 0.00115427779924 0.000229822305972 +GTCGCG 6.17138625335e-05 4.57883521476e-05 +GACCTA 0.000137141916741 8.45323424264e-05 +GACCTC 0.000518853585004 0.00012944014934 +CACCGG 0.000134856218129 0.000100382156631 +CTATTG 7.31423555953e-05 0.000183153408591 +CACCGA 8.91422458817e-05 0.000120634697004 +ACTTTT 0.000262855340421 0.000735255270063 +GACCTT 0.000315426408505 0.000198122677562 +GGACGC 0.00015542750564 0.000123276332705 +GGACGG 0.000132570519516 9.6859975697e-05 +CTATTA 5.02853694718e-05 0.000250074846345 +CACAGC 0.000459425421083 0.000460525157177 +CTTATC 0.000127999122292 0.000114470880369 +CACAGA 0.000425139941898 0.00056354894951 +CTTATA 8.4570848657e-05 0.000177870137189 +CACAGG 0.000226284162623 0.000283535565222 +CTTATG 0.000146284711191 0.000172586865787 +ACTCAT 0.000169141697314 0.000282655019988 +CGTATA 3.19997805729e-05 6.0757621119e-05 +GACGTA 9.37136431064e-05 8.71739781273e-05 +CGTATC 0.00011657062923 4.93105330821e-05 +CTATTC 7.08566569829e-05 0.000137365056443 +GAGGAC 0.00139884755076 0.000229822305972 +CGTATG 0.000132570519516 8.71739781273e-05 +AGCGAT 0.000265141039033 0.00014881214448 +TTAACA 0.000118856327842 0.000496627511755 +ACTCAC 0.000203427176499 0.00025623866298 +TTAACC 9.37136431064e-05 0.000240388848775 +ACTCAA 0.000228569861235 0.00035133754821 +ACTCAG 0.000461711119695 0.000228941760738 +CTTATT 0.000198855779275 0.000378634450452 +CACAGT 0.000345140490465 0.000324921191202 +AGCGAC 0.000372568873813 8.541288766e-05 +TAAACA 2.28569861235e-06 0.000711480548756 +AGCGAA 0.000196570080662 0.00012679851364 +GAGGAT 0.00129827681182 0.00032932391737 +AGCGAG 0.000454854023858 0.000147931599246 +CGTATT 9.59993417188e-05 9.50988852297e-05 +TAAACG 0.0 0.000165542503918 +AGTTCC 0.000118856327842 0.000169945230086 +GTATGT 7.08566569829e-05 0.000241269394009 +AGTTCA 0.000255998244583 0.000347815367275 +TACTTA 5.25710680841e-05 0.000172586865787 +AGTTCG 3.65711777976e-05 6.25187115862e-05 +TAGCCC 0.0 8.27712519592e-05 +CTGTGA 3.885687641e-05 0.000429706074001 +CGGGGT 5.71424653088e-05 6.33992568198e-05 +TAGGAC 0.0 0.000109187608967 +GCAAAG 0.000413711448836 0.000285296655689 +TAGGAA 2.28569861235e-06 0.000173467411021 +GCAAAA 0.000370283175201 0.000486941514186 +TAGGAG 4.5713972247e-06 0.000123276332705 +GCAAAC 0.000361140380752 0.000366306817181 +CGGGGC 0.00011657062923 7.92490710248e-05 +CGGGGA 6.85709583706e-05 8.1010161492e-05 +CTGTGT 0.000409140051611 0.000486941514186 +CGGGGG 4.34282736347e-05 5.72354401846e-05 +GTATGC 5.94281639212e-05 0.000133842875509 +AGTTCT 0.000198855779275 0.000258880298681 +GCAAAT 0.000185141587601 0.000375112269517 +TAGGAT 0.0 0.00016113977775 +TAATTA 0.0 0.000550340771005 +CTATTT 7.99994514323e-05 0.000404170262226 +TGCTTT 0.000249141148746 0.000682422556047 +GTCTAT 0.000196570080662 0.00016113977775 +GTAATT 7.771375282e-05 0.000316996284099 +GTTACC 0.000114284930618 9.6859975697e-05 +GTTACA 0.000153141807028 0.000230702851205 +TAATTC 0.0 0.000300265924661 +GTTACG 4.79996708594e-05 5.81159854182e-05 +TATCGC 0.000118856327842 5.10716235493e-05 +TATAGT 5.94281639212e-05 0.000187556134759 +GTCTAA 1.82855888988e-05 0.000187556134759 +AGGACG 8.91422458817e-05 0.000124156877939 +GTCTAC 0.00027199813487 0.000125037423172 +TGCTTC 0.000347426189078 0.000321399010267 +TTCAAA 0.00058285314615 0.000655125653805 +GGCGTT 0.000111999232005 8.98156138281e-05 +GGGCTC 0.000159998902865 0.000135603965976 +TATAGC 5.48567666965e-05 0.00015849814205 +TATCGT 8.22851500447e-05 6.86825282215e-05 +TATAGA 7.99994514323e-05 0.00024655266541 +AGTGGG 0.00019428438205 0.000153214870648 +TATAGG 3.65711777976e-05 0.000111829244668 +GTGGCG 0.000338283394628 0.000104784882799 +GTTACT 0.000139427615353 0.000178750682423 +GCTCTC 0.000372568873813 0.000255358117747 +AACCTT 0.000285712326544 0.000282655019988 +GATGGC 0.000587424543375 0.000219255763169 +GCTCTG 0.00115656349785 0.000364545726714 +CCACGT 0.000141713313966 0.000106545973267 +CAATAT 0.000127999122292 0.000350457002976 +CAGGAG 0.00167770278147 0.000349576457743 +GAATGG 0.000313140709892 0.000263283024849 +GAATGA 2.51426847359e-05 0.000465808428579 +ACTACT 0.000164570300089 0.000187556134759 +GAATGC 0.000235426957072 0.0002122114013 +CCACGA 0.000130284820904 6.5160347287e-05 +CAATAC 0.000148570409803 0.000176109046722 +CCACGC 0.000146284711191 9.6859975697e-05 +CAATAA 1.37141916741e-05 0.000464927883345 +GTTCCG 8.22851500447e-05 3.69828998116e-05 +CAATAG 4.5713972247e-06 0.000189317225226 +CCACGG 8.68565472694e-05 8.71739781273e-05 +AACCTA 0.000146284711191 0.000137365056443 +GAATGT 0.000278855230707 0.000374231724284 +ACTACC 9.37136431064e-05 8.45323424264e-05 +GGCTTC 0.000653709803133 0.000171706320554 +ACTACA 0.000203427176499 0.000316115738866 +ACTACG 7.08566569829e-05 5.54743497173e-05 +GGCTTG 0.000239998354297 0.000182272863357 +CGTTGA 2.28569861235e-06 8.541288766e-05 +AGTCAG 0.000445711229409 0.000307310286529 +CGTTGC 4.79996708594e-05 6.16381663526e-05 +TAACAC 2.28569861235e-06 0.000257119208214 +TCCTAC 0.00031085501128 0.000117993061304 +AGTCAC 0.000164570300089 0.000228941760738 +CGTTGG 3.65711777976e-05 7.39657996231e-05 +AGTCAA 0.000169141697314 0.000367187362415 +TCATCG 7.99994514323e-05 0.000145289963545 +TGAGGG 0.0 0.000203405948964 +TCATCC 0.000290283723769 0.000302027015128 +GAGCGG 0.000287998025156 0.000131201239808 +CTTTCT 0.00027199813487 0.000419139531198 +AGTCAT 0.000164570300089 0.000294102108025 +TCCTAT 0.000150856108415 0.000130320694574 +TAACAT 2.28569861235e-06 0.000416497895497 +CGTTGT 5.25710680841e-05 9.95016113978e-05 +CTTTCC 0.00019428438205 0.000247433210644 +CTTTCA 0.000226284162623 0.000451719704841 +CTTTCG 6.17138625335e-05 9.33377947625e-05 +GAGCGC 0.000450282626633 0.000121515242238 +GTTGAT 0.000329140600179 0.000257119208214 +CGACCA 9.82850403312e-05 7.74879805576e-05 +CGACCC 0.000105142136168 5.10716235493e-05 +GCATAC 0.000141713313966 0.00015849814205 +CGACCG 4.79996708594e-05 4.57883521476e-05 +CCTTAT 0.000185141587601 0.000172586865787 +GTTGAC 0.000274283833482 0.00030995192223 +GTTGAA 0.000434282736347 0.000358381910079 +ACTGGG 0.000210284272336 0.000167303594386 +GTTGAG 0.000404568654386 0.000237747213074 +TTAGGG 9.37136431064e-05 0.000153214870648 +CCTTAC 0.000214855669561 0.000120634697004 +TTCGAT 0.000178284491763 6.69214377543e-05 +CCTTAA 2.05712875112e-05 0.000252716482046 +CCTTAG 0.0 5.89965306518e-05 +CGACCT 9.82850403312e-05 8.27712519592e-05 +CAACTC 0.000189712984825 0.000199883768029 +CAACTA 0.000118856327842 0.000153214870648 +CAACTG 0.000255998244583 0.000291460472324 +AATAGG 5.25710680841e-05 0.000176109046722 +GATGGT 0.000498282297493 0.000233344486906 +GGGGTT 0.000148570409803 0.000145289963545 +GGATGT 0.000157713204252 0.000315235193632 +AATAGT 7.99994514323e-05 0.000273849567652 +GGGCTT 0.000143999012578 0.000152334325414 +CAACTT 0.000143999012578 0.000370709543349 +GGATGC 0.000141713313966 0.000165542503918 +GGATGA 9.14279444941e-06 0.000310832467464 +GGATGG 0.000207998573724 0.000221897398869 +GGGGTA 3.885687641e-05 7.92490710248e-05 +TCTCCG 0.000189712984825 0.000155856506349 +GAGTCC 0.00041828284606 0.000165542503918 +AAACTG 0.00102170727972 0.000655125653805 +TCTCCC 0.000239998354297 0.0002122114013 +AAACTA 0.000308569312668 0.000424422802599 +TCTCCA 0.000564567557251 0.000453480795308 +AAACTC 0.000653709803133 0.000423542257366 +ACGCGA 2.74283833482e-05 6.16381663526e-05 +AGTACG 2.28569861235e-05 5.10716235493e-05 +ACGCGC 8.4570848657e-05 8.71739781273e-05 +AGTACC 5.94281639212e-05 8.36517971928e-05 +ACGCGG 5.94281639212e-05 6.69214377543e-05 +AGTACA 0.000137141916741 0.000253597027279 +AAACTT 0.000317712107117 0.000452600250075 +CCCTTC 0.000358854682139 0.000164661958685 +TCTCCT 0.000441139832184 0.000324040645968 +CCCTTG 0.000109713533393 0.000124156877939 +TTCTAT 0.000230855559848 0.000214853037001 +AGTACT 9.37136431064e-05 0.00014881214448 +ACGCGT 5.48567666965e-05 6.5160347287e-05 +GCCGAA 0.000187427286213 9.95016113978e-05 +GTGGAG 0.00189255845103 0.000370709543349 +GCCGAC 0.000210284272336 6.69214377543e-05 +GTGGAC 0.00112684941589 0.000196361587095 +GCCGAG 0.000425139941898 0.000117993061304 +GTGGAA 0.000653709803133 0.00030995192223 +TATCAT 0.000141713313966 0.000280893929521 +GTGGAT 0.000804565911548 0.000286177200923 +GCCATC 0.000927993636615 0.000211330856066 +GCCGAT 0.000166855998702 6.95630734551e-05 +CCTATT 0.000205712875112 0.000147051054013 +ACCCGG 7.08566569829e-05 5.54743497173e-05 +ACCGAG 0.000269712436258 0.000103904337566 +AAATCG 8.91422458817e-05 0.00016113977775 +CACGCG 7.08566569829e-05 9.59794304633e-05 +TTATCG 2.28569861235e-05 7.48463448567e-05 +ACCGAC 0.000173713094539 7.83685257912e-05 +AAATCC 0.000390854462712 0.000321399010267 +ACCGAA 0.000214855669561 0.000122395787472 +AAATCA 0.000386283065488 0.000664811651375 +GGCTTT 0.000445711229409 0.000315235193632 +CTTTGA 1.59998902865e-05 0.000361904091013 +AGATAC 0.000226284162623 0.000132962330275 +TCCCGA 6.85709583706e-05 8.18907067256e-05 +CACGCT 0.000123427725067 0.00011711251607 +AAATCT 0.000404568654386 0.00056619058521 +ACCGAT 0.000182855888988 7.39657996231e-05 +GTAGTT 8.91422458817e-05 0.000222777944103 +ACCAGT 0.000319997805729 0.000201644858496 +GATGAT 0.001220563059 0.000435869890636 +GGAGCA 0.000521139283616 0.000296743743726 +GGAGCC 0.000532567776678 0.000182272863357 +CCGGCT 0.000169141697314 8.541288766e-05 +CCAAAT 0.000235426957072 0.000330204462603 +GGAGCG 0.00023314125846 0.000133842875509 +AAAACT 0.00042742564051 0.000662170015674 +GATGAC 0.0010171358825 0.000280893929521 +TGTCCC 0.000125713423679 0.000178750682423 +GATGAA 0.00131656240071 0.000483419333251 +GATGAG 0.00164113160367 0.000305549196062 +AAAACC 0.000511996489167 0.000391842628956 +AAAACA 0.000598853036436 0.00132522057658 +AAAACG 0.000173713094539 0.000302907560361 +GGAGCT 0.000605710132273 0.00027825229382 +CCAAAG 0.000358854682139 0.000239508303542 +TCGCGG 3.19997805729e-05 4.40272616804e-05 +CTAGAG 0.000365711777976 0.000131201239808 +TCGCGC 4.34282736347e-05 4.13856259796e-05 +CTACCG 4.79996708594e-05 3.87439902788e-05 +GCCACA 0.000555424762802 0.000248313755878 +AGATCA 0.000166855998702 0.000339009914939 +GCCACC 0.000518853585004 0.00017082577532 +AGAAAT 0.000246855450134 0.000591726396985 +TCCCGG 8.22851500447e-05 7.92490710248e-05 +GCGCTT 0.000107427834781 0.00012944014934 +GCCACG 0.000237712655685 8.541288766e-05 +AGATCG 4.11425750223e-05 7.13241639223e-05 +ACCAGC 0.000530282078066 0.00027825229382 +TCGCGT 2.51426847359e-05 5.72354401846e-05 +GTGCAA 0.000219427066786 0.000226300125037 +TCCCAT 0.000157713204252 0.000211330856066 +ACCCGT 0.000100570738944 6.78019829879e-05 +AGAAAG 0.000452568325246 0.000552101861473 +CTAGAC 0.000148570409803 9.95016113978e-05 +AGAAAC 0.000404568654386 0.000502791328391 +ATGTCC 0.00037942596965 0.000241269394009 +AGAAAA 0.0003885687641 0.000888470140711 +CTACCC 9.14279444941e-05 7.22047091559e-05 +ATGTAC 0.00049599659888 0.000214853037001 +GACCGA 0.000244569751522 9.95016113978e-05 +ATGTAA 2.28569861235e-05 0.000439392071571 +TATGTG 0.000546281968352 0.000287057746156 +ATGTAG 1.82855888988e-05 0.000267685751017 +CCTATA 8.91422458817e-05 0.000156737051582 +CGAAGT 5.94281639212e-05 8.1010161492e-05 +CCGGCA 0.000107427834781 7.6607435324e-05 +GACGAC 0.000619424323947 0.000110068154201 +CCTATC 9.59993417188e-05 6.86825282215e-05 +ATGTAT 0.000276569532095 0.000434989345403 +ATTAGA 8.22851500447e-05 0.000311713012697 +GGCGTC 0.000223998464011 0.000105665428033 +GACCGG 0.000162284601477 6.25187115862e-05 +AGCACT 0.000475425311369 0.000273849567652 +TTAGAA 0.000173713094539 0.000283535565222 +CGGCTG 0.00031085501128 0.000155856506349 +TTAGAC 0.000173713094539 0.000198122677562 +CGGCTC 0.000164570300089 0.000133842875509 +TTAGAG 0.000308569312668 0.000253597027279 +CGGCTA 3.885687641e-05 4.40272616804e-05 +AGCACC 0.000425139941898 0.000208689220365 +AGCACA 0.00046628251692 0.000427944983534 +AGCACG 0.00015542750564 0.00012679851364 +GGTCGG 7.54280542076e-05 7.57268900903e-05 +CGGCTT 5.71424653088e-05 8.89350685945e-05 +TTAGAT 0.000180570190376 0.000247433210644 +AAAGAC 0.00120684886732 0.000435869890636 +CGAAGC 7.771375282e-05 8.80545233609e-05 +AAAGAA 0.0010354214714 0.000784565803145 +AAAGAG 0.00174398804122 0.000524804959231 +ATATCA 0.000169141697314 0.000335487734005 +GCGCTG 0.000498282297493 0.00022453903457 +TCGCTA 3.885687641e-05 5.28327140165e-05 +TGTGAG 0.000605710132273 0.000401528626526 +TGTGAA 0.000399997257162 0.000595248577919 +CTACCT 9.37136431064e-05 0.0001074265185 +TGTGAC 0.000399997257162 0.000306429741296 +ATATCT 0.000111999232005 0.000300265924661 +CCAGCT 0.000422854243285 0.000335487734005 +AAAGAT 0.000882279664368 0.000497508056989 +TGTGAT 0.000372568873813 0.000438511526337 +TTATTG 9.14279444941e-05 0.000494866421288 +TTATTA 7.771375282e-05 0.000975644118838 +GAAAGC 0.000354283284915 0.000346054276808 +TTATTC 9.59993417188e-05 0.000394484264657 +ACATCT 0.000283426627932 0.000353098638677 +TTTTAT 0.000249141148746 0.00126622404593 +CTTACT 0.000118856327842 0.000157617596816 +AGACGC 0.000180570190376 0.000174347956255 +TACAAA 0.000434282736347 0.000496627511755 +AGACGA 0.000153141807028 0.000182272863357 +AAGTGA 3.42854791853e-05 0.000383917721853 +CCTCTG 0.000710852268442 0.000366306817181 +AGGTGG 6.62852597582e-05 0.000177870137189 +CCTCTC 0.000267426737645 0.000287057746156 +AGGTGC 5.48567666965e-05 0.000162020322984 +CCTCTA 0.000159998902865 0.000147051054013 +AGGTGA 1.59998902865e-05 0.000250074846345 +CTTACG 2.74283833482e-05 5.81159854182e-05 +TCCACA 0.000415997147448 0.000398886990825 +TTTTAG 1.14284930618e-05 0.000556504587641 +AGACGT 0.000109713533393 0.000175228501488 +CTTACC 0.000107427834781 0.000123276332705 +ACATCA 0.000283426627932 0.000556504587641 +CTTACA 0.000187427286213 0.000232463941673 +ACATCC 0.000198855779275 0.000274730112886 +AGGTGT 0.000100570738944 0.000324040645968 +CCTCTT 0.000249141148746 0.000286177200923 +GCGTGA 6.85709583706e-06 0.000114470880369 +CCCGGC 0.000175998793151 6.95630734551e-05 +CCCGGA 0.000178284491763 7.48463448567e-05 +CCCGGG 9.82850403312e-05 4.0505080746e-05 +TATGAA 0.000479996708594 0.00044907806914 +TGGAAT 0.000210284272336 0.000288818836624 +TAGGTG 2.28569861235e-06 0.000124156877939 +TTGTGC 0.000105142136168 0.000312593557931 +TATGAT 0.000468568215532 0.000301146469894 +TTGTGG 0.000141713313966 0.000301146469894 +CCCGGT 0.000127999122292 5.81159854182e-05 +GGCGTG 0.000221712765398 9.15767042953e-05 +TAGGTA 0.0 8.62934328936e-05 +GGTTTT 0.000262855340421 0.000431467164468 +TATCAC 0.000198855779275 0.000187556134759 +TGGAAA 0.00037942596965 0.000586443125583 +TGAGGA 1.14284930618e-05 0.000405931352694 +AAGAGG 0.00065142410452 0.000349576457743 +TGAGGC 0.0 0.000217494672701 +AAGAGA 0.000653709803133 0.000472852790448 +AAGAGC 0.000653709803133 0.000312593557931 +AAGCGT 0.000228569861235 0.000105665428033 +GCTTAG 9.14279444941e-06 0.000102143247099 +GCTTAC 0.000219427066786 0.000110068154201 +GCTTAA 1.82855888988e-05 0.000207808675132 +TGATTC 0.0 0.000289699381857 +AAGCGC 0.000294855120993 0.000109187608967 +AAGAGT 0.000438854133572 0.000283535565222 +AAGCGA 0.000169141697314 0.00013912614691 +AAGCGG 0.000198855779275 0.000111829244668 +GCTTAT 0.000198855779275 0.000198122677562 +GTTCGG 8.22851500447e-05 6.78019829879e-05 +CTGCTA 0.000217141368173 0.000176989591955 +GCGTGT 8.91422458817e-05 0.000120634697004 +CTGCTC 0.000809137308773 0.000397125900358 +ACTTCT 0.000146284711191 0.00027825229382 +GACCGT 0.000173713094539 5.89965306518e-05 +CTGCTG 0.00202512897054 0.000695630734551 +CGGTCA 5.71424653088e-05 0.000104784882799 +GGTCGT 0.000162284601477 5.28327140165e-05 +CGGTCC 5.02853694718e-05 5.45938044837e-05 +CTAGAA 0.000205712875112 0.000149692689713 +CGGTCG 2.05712875112e-05 4.66688973813e-05 +ACTTCG 3.65711777976e-05 6.5160347287e-05 +GACCGC 0.000283426627932 6.78019829879e-05 +TTTTGG 0.000127999122292 0.000504552418858 +ACTTCC 0.000137141916741 0.000198122677562 +CTGCTT 0.000393140161325 0.000469330609513 +ACTTCA 0.000205712875112 0.000396245355124 +CTAGAT 0.000189712984825 0.000156737051582 +CACAAA 0.000454854023858 0.000675378194178 +CGGTCT 4.79996708594e-05 7.22047091559e-05 +GGTCGC 0.000111999232005 6.60408925206e-05 +GGTCGA 0.000134856218129 5.72354401846e-05 +CGTCGC 7.54280542076e-05 6.0757621119e-05 +CAGCAT 0.000402282955774 0.000450839159608 +TGAAGC 4.5713972247e-06 0.000411214624095 +CGTCGG 4.79996708594e-05 5.28327140165e-05 +TGGTTG 0.000127999122292 0.000232463941673 +GCGTGC 6.17138625335e-05 0.000104784882799 +TGCTCA 0.000191998683438 0.000339890460173 +TTCATC 0.000788566021262 0.000420020076431 +TGCTCC 0.00023314125846 0.000251835936812 +TTCATA 0.000187427286213 0.00039536480989 +TTCATG 0.000511996489167 0.000392723174189 +TGCTCG 9.37136431064e-05 0.000115351425603 +GTACAA 8.68565472694e-05 0.0002122114013 +CAGCAG 0.00174855943845 0.000679780920346 +TACACT 0.000358854682139 0.000354859729144 +GCTTTG 0.00037942596965 0.000315235193632 +CAGCAC 0.000575996050313 0.00037335117905 +CAGCAA 0.000431997037735 0.000429706074001 +GGGAGT 0.000118856327842 0.000146170508779 +GTACAC 8.91422458817e-05 0.00016113977775 +TGATTT 0.0 0.000675378194178 +TTCATT 0.000461711119695 0.000729971998662 +GTAGCC 0.000132570519516 8.45323424264e-05 +GCTGCC 0.000619424323947 0.000228941760738 +GCTGCA 0.000628567118397 0.000417378440731 +AACTCT 0.000498282297493 0.000348695912509 +GCTGCG 0.000265141039033 0.000165542503918 +TGGCCA 0.000114284930618 0.000266805205783 +GTAGCA 0.000157713204252 0.000146170508779 +TCATCT 0.000306283614055 0.000454361340542 +TGCTCT 0.000253712545971 0.000390081538489 +AACTCA 0.000294855120993 0.000340771005407 +TGGCCT 0.000157713204252 0.000181392318123 +AACTCC 0.000420568544673 0.000191078315693 +GCTGCT 0.0007771375282 0.000456122431009 +AACTCG 0.000146284711191 0.000109187608967 +CTACAA 0.000141713313966 0.000257999753447 +GGATCC 0.000262855340421 0.000169945230086 +TGAAGA 2.28569861235e-06 0.000656006199038 +AATATT 0.000253712545971 0.000831234700527 +GTTCGA 0.000111999232005 7.6607435324e-05 +CAACCT 0.000187427286213 0.000204286494197 +TGGCCG 6.17138625335e-05 8.541288766e-05 +GGCACG 0.000139427615353 6.5160347287e-05 +GGAGGA 0.00104913566307 0.000532729866333 +GGCACA 0.00042742564051 0.000218375217935 +GACAAT 0.000477711009982 0.000251835936812 +GGCACC 0.000372568873813 9.06961590617e-05 +CAACCG 8.91422458817e-05 8.27712519592e-05 +ACGACC 5.02853694718e-05 6.5160347287e-05 +AATATG 0.000303997915443 0.000457002976243 +CAACCC 0.000121142026455 0.000156737051582 +TTAGGA 0.000143999012578 0.000216614127468 +AATATC 0.000221712765398 0.000344293186341 +GACAAA 0.000948564924126 0.00046845006428 +GGCACT 0.000372568873813 0.00012944014934 +GACAAC 0.000783994624037 0.000267685751017 +ACGACA 5.02853694718e-05 0.00012944014934 +GACAAG 0.000934850732452 0.000227180670271 +TGGCCC 8.91422458817e-05 0.000113590335136 +GCAATC 0.000173713094539 0.000159378687283 +GCAATA 0.000107427834781 0.000220136308402 +GAATTT 0.000205712875112 0.000457883521476 +TTGAAC 0.000226284162623 0.000316996284099 +CGATGG 6.62852597582e-05 0.000100382156631 +GTTCCC 0.000249141148746 0.000130320694574 +CGATGC 5.02853694718e-05 8.98156138281e-05 +GTAAAT 0.00015542750564 0.000499269147456 +CGATGA 2.28569861235e-06 0.000136484511209 +GAATTA 0.000148570409803 0.000327562826902 +GAATTC 0.000230855559848 0.00018051177289 +GAATTG 0.000173713094539 0.000238627758308 +GTAAAC 0.000223998464011 0.000340771005407 +CGATGT 6.17138625335e-05 9.6859975697e-05 +GTAAAA 0.000212569970949 0.000631350932497 +GTAAAG 0.000301712216831 0.000277371748587 +TCCCAG 0.000329140600179 0.000235105577374 +GGATTT 0.000356568983527 0.000390962083722 +GTGCGT 0.000214855669561 0.000156737051582 +ACGCCG 0.000123427725067 6.0757621119e-05 +GGATTC 0.000313140709892 0.000178750682423 +GGATTA 7.99994514323e-05 0.00022453903457 +GGATTG 0.000185141587601 0.000206928129898 +AGCGGC 0.000303997915443 0.00014881214448 +ACGCCA 0.000127999122292 0.0001074265185 +AAAGCC 0.000719995062891 0.000307310286529 +TCTGTG 0.000706280871217 0.00051247732596 +CTATCC 8.22851500447e-05 7.92490710248e-05 +GTCCCG 0.000169141697314 9.06961590617e-05 +TACAAT 0.000326854901566 0.000339890460173 +AACCGG 0.000157713204252 7.39657996231e-05 +CTCCTT 0.000130284820904 0.000255358117747 +GGCGGA 0.000203427176499 0.000100382156631 +AACCGC 0.000303997915443 9.24572495289e-05 +AACCGA 0.000173713094539 0.000111829244668 +GTGGGA 0.000443425530796 0.000163781413451 +TACCCA 0.000239998354297 0.00011711251607 +TCTGTT 0.00031085501128 0.000510716235493 +AAAGCG 0.000262855340421 0.000190197770459 +CTCCTG 0.000653709803133 0.00036366518148 +AACCGT 0.00015542750564 0.000106545973267 +CTCCTA 7.771375282e-05 0.000114470880369 +CTCCTC 0.000367997476589 0.000420020076431 +GGCGGT 0.000178284491763 7.74879805576e-05 +AACAAG 0.000781708925425 0.000367187362415 +CCCACG 0.000105142136168 6.60408925206e-05 +AACAAC 0.000941707828289 0.000507194054559 +AACAAA 0.000799994514323 0.000912244862019 +TACTTC 0.000470853914145 0.000195481041861 +AGCCTT 0.000210284272336 0.000206047584664 +CCGATT 5.48567666965e-05 8.71739781273e-05 +CCCACT 0.000306283614055 0.000238627758308 +AACAAT 0.000386283065488 0.000469330609513 +GACGCT 0.000319997805729 0.000168184139619 +AGCGGT 0.000127999122292 0.000105665428033 +CCGATA 3.42854791853e-05 4.4907806914e-05 +AGCCTG 0.000415997147448 0.000267685751017 +AGCCTA 8.68565472694e-05 0.000150573234947 +AGCCTC 0.000301712216831 0.000195481041861 +GTACCC 8.91422458817e-05 4.75494426149e-05 +CTCCCG 0.000100570738944 7.92490710248e-05 +TAGGCT 0.0 0.000188436679992 +ACGAAT 4.5713972247e-05 9.6859975697e-05 +CGCCTT 9.37136431064e-05 6.5160347287e-05 +AGGCAT 8.4570848657e-05 0.000173467411021 +CAGAGT 0.000399997257162 0.000281774474755 +GCATCT 0.000335997696016 0.000264163570083 +CTCCCA 0.000150856108415 0.000184033953824 +ACGAAA 0.000102856437556 0.000125917968406 +CGCCTC 0.000130284820904 0.000118873606537 +AGGCAA 0.000137141916741 0.000219255763169 +CGCCTA 2.05712875112e-05 3.08190831763e-05 +AGGCAG 0.000313140709892 0.000251835936812 +CGCCTG 0.000237712655685 0.000124156877939 +ACGAAG 0.000111999232005 0.000127679058873 +CAGAGG 0.000591995940599 0.000353098638677 +GCATCC 0.000217141368173 0.000173467411021 +GCATCA 0.000255998244583 0.000302027015128 +CAGAGC 0.000617138625335 0.000418258985964 +CGGCCA 0.000111999232005 9.59794304633e-05 +CAGAGA 0.000642281310071 0.000528327140165 +CGGCAC 9.82850403312e-05 8.01296162584e-05 +CCTAGA 9.82850403312e-05 8.98156138281e-05 +CCTAGC 0.000105142136168 4.40272616804e-05 +TTTGCT 0.000521139283616 0.000520402233063 +TAGCTC 2.28569861235e-06 0.000132962330275 +TGCGGT 6.62852597582e-05 0.000101262701865 +CCTAGG 5.02853694718e-05 2.90579927091e-05 +TAAGCA 2.28569861235e-06 0.000228061215505 +GTCTAG 6.85709583706e-06 9.77405209306e-05 +TGCGGC 0.000141713313966 9.86210661642e-05 +TGCGGA 0.000114284930618 9.86210661642e-05 +CCTAGT 0.000100570738944 6.95630734551e-05 +TGCGGG 0.000100570738944 9.42183399961e-05 +TAAGCG 0.0 6.69214377543e-05 +TGAGTT 2.28569861235e-06 0.000350457002976 +TAGCTG 0.0 0.000235105577374 +ATCGCT 0.000383997366875 9.86210661642e-05 +TCTCGT 0.000109713533393 0.000113590335136 +ATCGCC 0.00041828284606 6.69214377543e-05 +TGAGTG 2.28569861235e-06 0.000330204462603 +ATCGCA 0.000210284272336 0.0001074265185 +TGAGTA 0.0 0.000208689220365 +ATCGCG 9.37136431064e-05 5.19521687829e-05 +TGAGTC 2.28569861235e-06 0.000230702851205 +AAGGTG 0.000820565801835 0.000262402479615 +ACGGCT 0.000226284162623 9.95016113978e-05 +CATCAT 0.000201141477887 0.000611098392124 +AAGGTA 0.000139427615353 0.000204286494197 +TTTATT 0.000262855340421 0.0015955479633 +ACGGCA 0.000164570300089 0.000112709789902 +CATCAC 0.000226284162623 0.000357501364845 +ACGGCC 0.000153141807028 8.1010161492e-05 +CATCAA 0.000150856108415 0.000389200993255 +CATCAG 0.000354283284915 0.000410334078862 +ACGGCG 9.82850403312e-05 7.6607435324e-05 +TCACCT 0.000214855669561 0.000294982653259 +TCTAAG 0.000185141587601 0.000104784882799 +TCGTTT 9.82850403312e-05 0.000183153408591 +CGGAAT 6.39995611459e-05 6.42798020534e-05 +CTCATG 0.000546281968352 0.000240388848775 +TCACCG 0.000127999122292 0.000103023792332 +TCACCA 0.000207998573724 0.000327562826902 +TCACCC 0.00019428438205 0.000182272863357 +CGGAAG 0.000175998793151 9.15767042953e-05 +AATATA 0.000127999122292 0.000582920944649 +CGGCCT 0.000127999122292 9.6859975697e-05 +CGGAAC 7.771375282e-05 3.87439902788e-05 +CGGAAA 0.000214855669561 0.000128559604107 +TAGCTT 0.0 0.000189317225226 +ATGGCG 0.000354283284915 0.000134723420742 +TGTGTA 0.000111999232005 0.000427944983534 +ATGGCC 0.000623995721172 0.000157617596816 +ATGGCA 0.000548567666965 0.000286177200923 +TCCAAT 0.000260569641808 0.000200764313263 +ATGGCT 0.000687995282318 0.000254477572513 +TGTGTT 0.000235426957072 0.000792490710248 +TTGTCG 7.99994514323e-05 0.000102143247099 +GAACAT 0.000226284162623 0.000388320448021 +AGATTA 6.39995611459e-05 0.000324921191202 +AGATTC 0.000157713204252 0.000258880298681 +GAAACA 0.000390854462712 0.000582920944649 +AGATTG 0.000105142136168 0.000308190831763 +CTGAGT 0.000381711668263 0.000240388848775 +GAAACT 0.00034971188769 0.000350457002976 +AGAATG 0.000249141148746 0.000365426271948 +AGAATA 0.000143999012578 0.000337248824472 +AGAATC 0.000198855779275 0.000221897398869 +CTGAGC 0.000610281529498 0.00033196555307 +CTGAGA 0.000411425750223 0.000386559357554 +CTGAGG 0.000525710680841 0.000343412641107 +CATACC 6.17138625335e-05 0.000125037423172 +CATACA 8.68565472694e-05 0.000399767536058 +CATACG 3.42854791853e-05 7.30852543895e-05 +TCAAAT 0.000212569970949 0.000525685504464 +GTCCAT 0.000121142026455 0.0002122114013 +ACATAG 6.85709583706e-06 0.000106545973267 +CATACT 5.94281639212e-05 0.00018051177289 +GTCCAG 0.000459425421083 0.000272969022419 +TCAAAG 0.000313140709892 0.000404170262226 +CACGAG 0.000326854901566 0.000131201239808 +GTCCAC 0.000219427066786 0.000194600496628 +GCAATG 0.000290283723769 0.00024391102971 +CGGCGG 0.00011657062923 7.74879805576e-05 +TTGATG 0.000221712765398 0.000432347709702 +CTCATT 0.000429711339122 0.000425303347833 +CGGCGC 7.99994514323e-05 7.30852543895e-05 +TTGATC 0.000180570190376 0.00022453903457 +CGGCGA 6.85709583706e-05 5.6354894951e-05 +TCCAAG 0.000443425530796 0.000147931599246 +CTATCT 7.99994514323e-05 0.000171706320554 +TTGATT 0.000185141587601 0.000540654773436 +CGGCGT 9.14279444941e-05 7.04436186887e-05 +TATAAG 0.00023314125846 0.000181392318123 +TGACTT 6.85709583706e-06 0.000396245355124 +TCACAG 0.000381711668263 0.000415617350263 +CGGTTA 5.94281639212e-05 8.27712519592e-05 +GGTTTA 0.000166855998702 0.000269446841484 +CGGTTC 7.771375282e-05 7.04436186887e-05 +GCTGTT 0.00046628251692 0.000475494426149 +TTTACA 0.000187427286213 0.000774879805576 +CGGTTG 4.79996708594e-05 8.1010161492e-05 +GGTTTG 0.000370283175201 0.000318757374566 +TATAAA 0.000324569202954 0.000668333832309 +CGTACG 1.14284930618e-05 2.11330856066e-05 +GCTGTG 0.000969136211637 0.000420900621665 +GCTGTC 0.000365711777976 0.000285296655689 +CGGTTT 0.000123427725067 0.000138245601677 +GCTGTA 0.000326854901566 0.000336368279239 +GGGAGG 0.000105142136168 0.000228941760738 +TCATAG 1.14284930618e-05 0.00018051177289 +TATGCG 7.54280542076e-05 6.86825282215e-05 +TCTCAA 0.000258283943196 0.000283535565222 +AGGTTG 0.000100570738944 0.00018051177289 +GCATTT 0.000265141039033 0.000614620573059 +AGGTTC 0.000118856327842 0.000124156877939 +AGGTTA 5.48567666965e-05 0.000177870137189 +ACTCCT 0.000367997476589 0.000223658489337 +TTTTTC 0.000306283614055 0.000870859236039 +GAGGGC 0.000653709803133 0.000195481041861 +TTTTTA 0.000102856437556 0.00143528873078 +TCCTCT 0.000406854352999 0.000405931352694 +TTTTGT 0.000148570409803 0.000998538294912 +GAGGGG 0.00031085501128 0.000194600496628 +TTAAAT 0.000185141587601 0.000975644118838 +AGGTTT 0.000239998354297 0.00033196555307 +ACATAT 0.000185141587601 0.000380395540919 +TTAAAC 0.000153141807028 0.000528327140165 +TTAAAA 0.000217141368173 0.00132874275752 +ACTCCG 0.000109713533393 7.83685257912e-05 +TTAAAG 0.000244569751522 0.000670094922776 +ACTCCA 0.00037942596965 0.000309071376997 +TTTTTT 0.000221712765398 0.00264779951746 +ACTCCC 0.000141713313966 0.000133842875509 +CTGTAA 3.19997805729e-05 0.000482538788018 +GTCACG 0.000207998573724 0.000103023792332 +CTGTAC 0.000484568105819 0.000228061215505 +GCAACT 0.000169141697314 0.000169945230086 +GCAATT 0.000123427725067 0.000242149939242 +CTGTAG 2.97140819606e-05 0.000257999753447 +GTCACA 0.000386283065488 0.000300265924661 +GCAACG 6.85709583706e-05 8.541288766e-05 +GTCACT 0.000370283175201 0.000243030484476 +TAGGCG 0.0 3.96245355124e-05 +GCAACC 0.000166855998702 0.000121515242238 +CTGTAT 0.0003885687641 0.000331085007837 +GCAACA 0.000297140819606 0.000300265924661 +TAGGCC 2.28569861235e-06 8.98156138281e-05 +TGGTTC 0.000235426957072 0.000199003222796 +ATTCAT 0.00027199813487 0.000529207685399 +TCCCAC 0.000157713204252 0.00024655266541 +GCGATT 9.37136431064e-05 0.000122395787472 +TCGTGT 7.08566569829e-05 0.000109187608967 +TGAATT 0.0 0.000539774228202 +GTCTCT 0.000255998244583 0.000276491203353 +TCCGTG 0.000109713533393 8.45323424264e-05 +ATTCAG 0.000591995940599 0.000402409171759 +ATTCAA 0.000246855450134 0.000417378440731 +ATTCAC 0.000297140819606 0.000394484264657 +GTCTCC 0.000313140709892 0.000190197770459 +GTCTCA 0.000150856108415 0.000191078315693 +GCGATG 0.000182855888988 9.77405209306e-05 +GTCTCG 8.91422458817e-05 8.18907067256e-05 +GCGATA 4.34282736347e-05 7.30852543895e-05 +TCGTGC 3.885687641e-05 8.1010161492e-05 +GCGATC 7.08566569829e-05 7.30852543895e-05 +CGATTG 7.99994514323e-05 7.6607435324e-05 +TCTACA 0.000207998573724 0.000301146469894 +GAAGGA 0.000756566240689 0.000346054276808 +CGATTC 0.000130284820904 0.000109187608967 +CGATTA 4.11425750223e-05 0.000115351425603 +CAATCT 9.37136431064e-05 0.000214853037001 +GGAACA 0.000342854791853 0.00024655266541 +GGAACG 0.000139427615353 8.541288766e-05 +TGACGA 0.0 0.000162020322984 +TACTGC 0.000326854901566 0.000205167039431 +CGATTT 8.22851500447e-05 0.000152334325414 +GAAGGT 0.000395425859937 0.000235105577374 +CTCGCT 0.000189712984825 0.000146170508779 +CAATCG 3.42854791853e-05 6.33992568198e-05 +CAATCA 0.000130284820904 0.000368948452882 +CAATCC 0.000105142136168 0.000200764313263 +TCCTGA 3.19997805729e-05 0.000357501364845 +AGTCCA 0.000299426518218 0.000259760843915 +TCCTGC 0.000258283943196 0.000349576457743 +AGTCCC 0.000205712875112 0.000137365056443 +ACTAAA 0.000399997257162 0.000411214624095 +TCCTGG 0.00027199813487 0.000249194301111 +ACTAAC 0.000162284601477 0.000168184139619 +TAACGC 2.28569861235e-06 8.18907067256e-05 +CAGCTG 0.00151084678276 0.000570593311378 +CAGCTA 0.00023314125846 0.000205167039431 +CAGCTC 0.000708566569829 0.000399767536058 +ACTAAT 0.000143999012578 0.000263283024849 +AGTCCT 0.000367997476589 0.000175228501488 +TCCTGT 0.000269712436258 0.000328443372136 +TAATGT 0.0 0.000526566049698 +CAGCTT 0.000498282297493 0.000371590088583 +GGTTAG 2.28569861235e-06 0.000122395787472 +TAACGT 2.28569861235e-06 0.000141767782611 +ACGGAC 0.000219427066786 9.77405209306e-05 +GTACTT 9.37136431064e-05 0.00017082577532 +CGACAT 5.94281639212e-05 9.77405209306e-05 +TTGTTC 0.000148570409803 0.000362784636247 +CCGAGG 5.94281639212e-05 8.36517971928e-05 +CCGAGA 5.48567666965e-05 0.00011711251607 +ACGGAA 7.54280542076e-05 8.89350685945e-05 +CCGAGC 0.000114284930618 0.000114470880369 +CCGCGT 4.34282736347e-05 4.66688973813e-05 +CGACAC 0.000150856108415 8.36517971928e-05 +CGACAA 7.54280542076e-05 0.000109187608967 +CGACAG 0.000210284272336 0.000125037423172 +GTACTA 2.97140819606e-05 8.45323424264e-05 +CCGCGC 6.39995611459e-05 6.78019829879e-05 +ACGGAG 0.000372568873813 0.000120634697004 +CCGCGA 3.42854791853e-05 4.4907806914e-05 +TACGCA 0.000130284820904 6.25187115862e-05 +CCGCGG 7.08566569829e-05 5.6354894951e-05 +TTGTTT 0.00019428438205 0.0011579169822 +GCATAT 0.000189712984825 0.000267685751017 +TCCGTT 8.68565472694e-05 0.000114470880369 +AGGAAC 0.0003885687641 0.000221897398869 +AATAAC 0.000297140819606 0.000417378440731 +AATAAA 0.000459425421083 0.00135515911452 +AATAAG 0.000409140051611 0.000378634450452 +TACTAA 1.37141916741e-05 0.000203405948964 +TGGAAG 0.000404568654386 0.000303788105595 +AATAAT 0.00027199813487 0.000773999260342 +ACGGTG 0.000324569202954 0.000124156877939 +CCAACC 0.000173713094539 0.000169945230086 +CCAACA 0.000317712107117 0.000309071376997 +TTATGC 6.39995611459e-05 0.000269446841484 +CCAACG 5.94281639212e-05 7.04436186887e-05 +GGGATT 0.000242284052909 0.000183153408591 +CGCCGC 0.000169141697314 0.000108307063734 +AGTAAA 0.000436568434959 0.00052216332353 +CGCCGA 3.885687641e-05 6.42798020534e-05 +AGTAAC 0.000221712765398 0.000155856506349 +CGCCGG 7.771375282e-05 7.6607435324e-05 +GAGTAA 3.65711777976e-05 0.000198122677562 +AGTAAG 0.000207998573724 0.000182272863357 +CTCAGG 0.000258283943196 0.000179631227656 +CTCAGC 0.000575996050313 0.000303788105595 +CCAACT 0.000159998902865 0.000183153408591 +GAGTAT 0.000413711448836 0.000144409418312 +GCTTCA 0.000292569422381 0.000354859729144 +GTGTAG 1.14284930618e-05 0.000199883768029 +TCGAGC 7.54280542076e-05 8.18907067256e-05 +AGTAAT 0.000228569861235 0.000338129369706 +GTGTAC 0.000347426189078 0.000133842875509 +CGCCGT 8.91422458817e-05 5.28327140165e-05 +GTGGCA 0.000431997037735 0.000182272863357 +CATATT 0.000123427725067 0.000434108800169 +CTCGGA 0.000162284601477 9.06961590617e-05 +CTCGGC 0.000246855450134 9.24572495289e-05 +GCCGCC 0.000292569422381 9.6859975697e-05 +GCCGCA 0.00015542750564 0.000114470880369 +GCCGCG 9.82850403312e-05 6.5160347287e-05 +TATTGA 1.14284930618e-05 0.000339009914939 +ACACTT 0.000214855669561 0.000416497895497 +CATATG 0.000127999122292 0.000282655019988 +TCGCTC 0.000171427395926 0.000128559604107 +CATATC 0.000121142026455 0.000199003222796 +CATATA 5.71424653088e-05 0.000270327386718 +GTCAGC 0.000397711558549 0.000226300125037 +TACTAC 0.000363426079364 0.000152334325414 +ACACTC 0.000297140819606 0.000343412641107 +ACACTA 0.000146284711191 0.000282655019988 +ACACTG 0.000518853585004 0.000539774228202 +GCCGCT 0.000258283943196 0.000135603965976 +ACCGGA 0.000219427066786 8.62934328936e-05 +AAATAA 5.02853694718e-05 0.00133842875509 +ACCGGC 0.000219427066786 8.36517971928e-05 +AAATAC 0.000489139503043 0.00044643643344 +CTTTAA 2.28569861235e-05 0.000656886744272 +ACCGGG 0.000121142026455 5.72354401846e-05 +AAATAG 2.74283833482e-05 0.000382156631386 +AACTTA 6.62852597582e-05 0.000303788105595 +CAGGTA 0.000118856327842 0.00016113977775 +AACTTC 0.00069028098093 0.000254477572513 +CAGGTC 0.000338283394628 0.000201644858496 +CACGAC 0.000178284491763 7.83685257912e-05 +CACGAA 0.000107427834781 9.06961590617e-05 +CAGGTG 0.000934850732452 0.000285296655689 +CTTTAT 0.000207998573724 0.000515999506895 +AATCCC 0.000219427066786 0.000187556134759 +AATCCA 0.000299426518218 0.000340771005407 +AAATAT 0.000395425859937 0.000987091206875 +AATCCG 8.91422458817e-05 9.59794304633e-05 +CACGAT 9.14279444941e-05 0.000103904337566 +CAGGTT 0.000347426189078 0.000257999753447 +AACTTT 0.000441139832184 0.00048077769755 +TCTGTC 0.000340569093241 0.000411214624095 +GGGATA 9.82850403312e-05 0.000117993061304 +GGGATC 0.000221712765398 0.000115351425603 +GGGTGT 7.771375282e-05 0.000174347956255 +GGAGAT 0.000822851500447 0.000293221562792 +GATGCT 0.000715423665666 0.00029762428896 +CGCAGT 0.000230855559848 0.000103023792332 +GAGTCG 0.000196570080662 7.22047091559e-05 +GAGCCT 0.000518853585004 0.00015849814205 +GGAGAC 0.000886851061593 0.000209569765599 +GGCGGC 0.000237712655685 7.74879805576e-05 +GGAGAA 0.000905136650492 0.000390962083722 +GGGTGC 4.79996708594e-05 9.33377947625e-05 +GGAGAG 0.00124799144234 0.000366306817181 +TGGAAC 0.000274283833482 0.000217494672701 +GGGTGG 4.5713972247e-05 0.000162020322984 +GAGCCA 0.000390854462712 0.000249194301111 +CGCAGG 0.000201141477887 9.77405209306e-05 +GATGCG 0.000235426957072 0.000111829244668 +CGCAGA 0.000269712436258 0.000176989591955 +GATGCA 0.000564567557251 0.000315235193632 +CGCAGC 0.000297140819606 0.00017082577532 +GATGCC 0.000623995721172 0.000169064684853 +CGGATT 0.000102856437556 8.62934328936e-05 +GGTAGT 8.22851500447e-05 9.95016113978e-05 +ACCCCT 0.000265141039033 0.000144409418312 +GCCAAT 0.000454854023858 0.000191078315693 +GGCGGG 0.000118856327842 8.89350685945e-05 +AGAAGT 0.000146284711191 0.00027561065812 +ACCCCA 0.000201141477887 0.000169945230086 +GGTAGA 9.59993417188e-05 9.42183399961e-05 +ACCCCC 0.000130284820904 0.000102143247099 +CGGATG 0.000182855888988 0.000125037423172 +GCCAAG 0.000802280212936 0.000136484511209 +CGGATA 8.68565472694e-05 6.78019829879e-05 +ACCCCG 0.000118856327842 6.86825282215e-05 +CGGATC 0.000137141916741 0.000102143247099 +AGAAGA 0.000297140819606 0.000578518218481 +AGAAGC 0.000189712984825 0.000303788105595 +GCAAGA 0.000180570190376 0.000233344486906 +AGAAGG 0.000201141477887 0.00030995192223 +CACTCC 0.000205712875112 0.000254477572513 +CACTCA 0.000159998902865 0.000332846098304 +CACTCG 0.000137141916741 0.000110948699435 +TGCGTT 6.39995611459e-05 0.000188436679992 +TCAGCT 0.00034971188769 0.000399767536058 +AGCTTT 0.000315426408505 0.000412975714562 +CCCCGG 4.11425750223e-05 4.4907806914e-05 +TGCGTA 3.885687641e-05 8.98156138281e-05 +CCCCGC 8.91422458817e-05 8.18907067256e-05 +CACTCT 0.000249141148746 0.00027561065812 +AGCTTC 0.000420568544673 0.000245672120177 +AGCTTA 6.39995611459e-05 0.000203405948964 +AGCTTG 0.000198855779275 0.000241269394009 +TTAGCT 0.000102856437556 0.000254477572513 +TTAGCC 0.000123427725067 0.000156737051582 +GCACTG 0.000523424982229 0.000316115738866 +TTAGCA 0.000143999012578 0.000262402479615 +GACCAT 0.000239998354297 0.000149692689713 +TTAGCG 3.42854791853e-05 8.98156138281e-05 +TACCGG 0.000139427615353 5.37132592501e-05 +TCATAT 0.000143999012578 0.000332846098304 +ATAGGT 6.62852597582e-05 0.000106545973267 +ATAAGG 4.79996708594e-05 0.000169064684853 +TGTGCT 0.000319997805729 0.000408572988394 +AAGGGC 0.00042742564051 0.000176109046722 +ATAAGC 0.000114284930618 0.00018051177289 +AAGGGA 0.00042742564051 0.000239508303542 +ATAAGA 9.37136431064e-05 0.000276491203353 +CCAGAC 0.000589710241987 0.000264163570083 +TCTGTA 0.000180570190376 0.000355740274378 +CCAGAA 0.000591995940599 0.000361904091013 +CCAGAG 0.000941707828289 0.000315235193632 +GCAAGT 0.000148570409803 0.000196361587095 +TGTGCG 0.000125713423679 0.00020252540373 +ATAAGT 6.85709583706e-05 0.00023422503214 +ATAGGG 4.5713972247e-05 9.33377947625e-05 +TGTGCC 0.000292569422381 0.000181392318123 +ATAGGA 0.000132570519516 0.000127679058873 +TGTGCA 0.000217141368173 0.000433228254935 +ATAGGC 7.54280542076e-05 0.000106545973267 +GCTCGC 0.000171427395926 0.00011711251607 +TAAGTT 2.28569861235e-06 0.000306429741296 +TTTGCG 0.000150856108415 0.000102143247099 +CCAGAT 0.000516567886392 0.000240388848775 +AGACAA 0.000265141039033 0.000410334078862 +GACGCA 0.000235426957072 0.000163781413451 +AGACAC 0.000251426847359 0.000352218093443 +TCCATT 0.000319997805729 0.000316115738866 +AGACAG 0.000571424653088 0.000381276086153 +GCTTTT 0.000372568873813 0.000574115492313 +TTTTCT 0.000242284052909 0.000924572495289 +CGCTGT 0.000290283723769 0.000213972491767 +GACGCC 0.000342854791853 0.000110948699435 +TCAAGA 0.00011657062923 0.000315235193632 +CGTGGG 8.4570848657e-05 6.5160347287e-05 +CTATAG 9.14279444941e-06 0.000155856506349 +AGACAT 0.000191998683438 0.000348695912509 +CGTGGA 0.000205712875112 0.000115351425603 +TTTTCG 7.54280542076e-05 0.000145289963545 +CCCACA 0.000399997257162 0.000222777944103 +CGCTGC 0.000303997915443 0.000213972491767 +TTTTCC 0.000196570080662 0.0005318493211 +TTTTCA 0.000205712875112 0.000830354155293 +CGCTGG 0.000290283723769 0.000153214870648 +TATGGA 0.000402282955774 0.000236866667841 +TATGGC 0.000292569422381 0.000156737051582 +CGTAGG 3.19997805729e-05 3.96245355124e-05 +CCCACC 0.000354283284915 0.000125037423172 +TATGGG 0.000175998793151 0.000153214870648 +CGTAGC 4.11425750223e-05 5.37132592501e-05 +TACCGT 0.000137141916741 6.33992568198e-05 +TGGACT 0.00019428438205 0.00033196555307 +CGTAGT 5.02853694718e-05 5.81159854182e-05 +GCTCGA 0.000210284272336 9.77405209306e-05 +TATGGT 0.000207998573724 0.000167303594386 +TGGACA 0.000210284272336 0.000330204462603 +TGGACC 0.00019428438205 0.000127679058873 +TGGACG 0.000134856218129 0.000163781413451 +CCGGTT 0.000123427725067 8.1010161492e-05 +GACCAA 0.00027199813487 0.000203405948964 +GCTTGA 2.05712875112e-05 0.000226300125037 +TGAGAC 0.0 0.000238627758308 +GCTTGC 9.82850403312e-05 0.000149692689713 +TGAGAA 4.5713972247e-06 0.00038303717662 +TGAGAG 6.85709583706e-06 0.000394484264657 +GCTTGG 0.000118856327842 0.000165542503918 +CCTGTT 0.000425139941898 0.000325801736435 +CCGGTG 0.000315426408505 9.06961590617e-05 +CCGGTC 0.000127999122292 7.04436186887e-05 +CCGGTA 3.885687641e-05 4.75494426149e-05 +CCTGTC 0.000306283614055 0.000226300125037 +CCTGTA 0.000150856108415 0.000218375217935 +CCTGTG 0.000557710461414 0.00027825229382 +GCTTGT 0.000121142026455 0.000300265924661 +TGAGAT 4.5713972247e-06 0.000353098638677 +TCCGAA 9.59993417188e-05 9.42183399961e-05 +GGTTGT 0.000100570738944 0.000227180670271 +TCCTCA 0.000358854682139 0.000365426271948 +TATCAG 0.000452568325246 0.000300265924661 +TATTGC 7.54280542076e-05 0.000237747213074 +TAGCGT 0.0 6.25187115862e-05 +GGTTGG 0.000105142136168 0.000157617596816 +GGTTGA 1.37141916741e-05 0.000163781413451 +TTCACG 0.000146284711191 0.000128559604107 +GGTTGC 0.000109713533393 0.000123276332705 +GGAAAC 0.000605710132273 0.000360143000546 +TCCCGC 0.000191998683438 0.000104784882799 +GTAACG 3.885687641e-05 0.000102143247099 +CAGCGT 0.000217141368173 0.000150573234947 +GTAACC 0.000100570738944 0.000125037423172 +CGTTTT 0.000105142136168 0.00028793829139 +ATTCTC 0.000249141148746 0.000277371748587 +ATTCTA 0.000130284820904 0.000184914499058 +ATTCTG 0.00062171002256 0.000420020076431 +TCATTT 0.00023314125846 0.000803937798285 +CAGCGA 0.000187427286213 0.000157617596816 +CAGCGC 0.000345140490465 0.00027825229382 +TGCTAG 2.28569861235e-06 0.000128559604107 +CAGCGG 0.000294855120993 0.000203405948964 +CCTTGT 9.59993417188e-05 0.000184914499058 +TCATTC 0.000178284491763 0.000356620819612 +CGTTTG 0.000162284601477 0.000206928129898 +CGTTTA 5.71424653088e-05 0.000181392318123 +ATTCTT 0.000228569861235 0.000327562826902 +CGTTTC 0.000164570300089 0.000174347956255 +TGGCAA 9.37136431064e-05 0.00022453903457 +CCGATC 0.00011657062923 5.54743497173e-05 +TGGCAG 0.000356568983527 0.000290579927091 +GCTGAG 0.000959993417188 0.000343412641107 +GCTGAA 0.000825137199059 0.000537132592501 +GCTGAC 0.000537139173903 0.000255358117747 +TGGCAT 0.000150856108415 0.000251835936812 +GCTGAT 0.000644567008683 0.000358381910079 +CCGATG 0.000141713313966 8.18907067256e-05 +GGCCGC 0.000242284052909 8.45323424264e-05 +GAACTT 0.000313140709892 0.000200764313263 +GGCCGA 0.000191998683438 7.83685257912e-05 +GGCAAT 0.000276569532095 0.000143528873078 +CTGATT 0.000452568325246 0.00041473680503 +CCATCG 9.37136431064e-05 7.74879805576e-05 +CTAAAT 0.000150856108415 0.00035133754821 +CCATCC 0.000239998354297 0.000156737051582 +CCATCA 0.000297140819606 0.000350457002976 +CTGATC 0.000642281310071 0.000277371748587 +CTGATA 0.000178284491763 0.000268566296251 +GAGTTT 0.00103313577278 0.00040505080746 +CTGATG 0.000847994185183 0.000474613880915 +GGCAAA 0.000635424214234 0.000272969022419 +CTAAAG 0.000306283614055 0.000281774474755 +CCATCT 0.000335997696016 0.000282655019988 +CTAAAC 0.000201141477887 0.000288818836624 +CTAAAA 0.00023314125846 0.000513357871194 +GACACC 0.00062171002256 0.000143528873078 +GACACA 0.000596567337824 0.000402409171759 +GACACG 0.000292569422381 0.000108307063734 +GCGCCT 0.000100570738944 8.18907067256e-05 +TTCACC 0.000642281310071 0.000294982653259 +TAGCGA 0.0 5.54743497173e-05 +TACGAG 0.000413711448836 5.72354401846e-05 +TACGAC 0.00034971188769 4.57883521476e-05 +GACACT 0.000594281639212 0.000236866667841 +GGCGAT 0.000148570409803 7.57268900903e-05 +TGTTAC 0.000153141807028 0.000238627758308 +ACGCTG 0.000356568983527 0.000181392318123 +ACGCTA 6.17138625335e-05 6.86825282215e-05 +ACGCTC 0.000201141477887 0.000112709789902 +TCGATG 0.000105142136168 0.000100382156631 +TCGAGG 3.885687641e-05 7.48463448567e-05 +TCGATC 6.85709583706e-05 5.6354894951e-05 +ACGCTT 0.000107427834781 0.000149692689713 +TCTGGG 0.000212569970949 0.00025623866298 +GCATTG 0.000169141697314 0.000221897398869 +GAACTG 0.000692566679543 0.000315235193632 +TCGATT 6.39995611459e-05 0.000104784882799 +TCGGCA 0.000105142136168 6.16381663526e-05 +AGGCAC 0.000105142136168 0.000147931599246 +TTTTGA 9.14279444941e-06 0.00076871598894 +AACCAA 0.000265141039033 0.000305549196062 +TGCCGG 0.000109713533393 7.92490710248e-05 +AACCAC 0.000397711558549 0.000262402479615 +ACGAAC 7.771375282e-05 8.541288766e-05 +AACCAG 0.000733709254565 0.000289699381857 +TGCCGA 5.25710680841e-05 8.45323424264e-05 +TTGGAC 0.000395425859937 0.000241269394009 +TCTGGA 0.000585138844762 0.000469330609513 +GAGTTC 0.000790851719874 0.000177870137189 +TGCCGT 7.771375282e-05 0.000112709789902 +AACCAT 0.000242284052909 0.000250074846345 +AACAGA 0.000436568434959 0.00059789021362 +ACGTCG 3.65711777976e-05 4.75494426149e-05 +AACAGC 0.00081599440461 0.000442914252505 +ACGTCC 0.000139427615353 0.000110068154201 +AACAGG 0.000303997915443 0.000293221562792 +ACGTCA 0.000105142136168 0.000184033953824 +CCCAAG 0.000395425859937 0.000104784882799 +GTCCCT 0.000164570300089 0.000120634697004 +GACGAA 0.000262855340421 0.000124156877939 +CCCAAC 0.000486853804431 0.000147051054013 +CCCAAA 0.000795423117099 0.000290579927091 +ACGTCT 0.000164570300089 0.000171706320554 +GGGAGA 0.000148570409803 0.000184033953824 +AACAGT 0.000434282736347 0.000438511526337 +GGGAGC 0.000146284711191 0.000127679058873 +CCCAAT 0.000294855120993 0.00014881214448 +GACGAT 0.000377140271038 0.000147051054013 +GGGCGC 7.771375282e-05 6.25187115862e-05 +GGGCGA 7.771375282e-05 7.74879805576e-05 +GGGCGG 4.5713972247e-05 8.18907067256e-05 +TCTCTT 0.000287998025156 0.000423542257366 +TGGGGG 7.54280542076e-05 0.000167303594386 +GTACAG 0.000253712545971 0.000228061215505 +TCATAC 0.000153141807028 0.000208689220365 +CAGAAT 0.000516567886392 0.000447316978673 +ACGACT 7.31423555953e-05 9.42183399961e-05 +TCTCTC 0.00031085501128 0.000459644611944 +TCTCTA 0.000196570080662 0.000200764313263 +TCTCTG 0.000946279225514 0.000457883521476 +GGGCGT 3.885687641e-05 4.66688973813e-05 +CAGAAA 0.000969136211637 0.000739657996231 +CAGAAC 0.000797708815711 0.00033196555307 +ACGACG 5.02853694718e-05 6.33992568198e-05 +CAGAAG 0.00124113434651 0.000434108800169 +CACTTT 0.00023314125846 0.000573234947079 +CCTAAT 0.000164570300089 0.000145289963545 +GCATTC 0.000169141697314 0.000207808675132 +GTCATT 0.000511996489167 0.000381276086153 +TGCCCC 0.000109713533393 8.80545233609e-05 +CACTTG 0.000178284491763 0.00024391102971 +CCTAAC 0.000171427395926 9.42183399961e-05 +CCTAAA 0.000475425311369 0.000250074846345 +CACTTC 0.000354283284915 0.00029762428896 +CCTAAG 0.000125713423679 7.6607435324e-05 +CACTTA 7.08566569829e-05 0.000241269394009 +GTCCCA 0.000171427395926 0.000175228501488 +GTCCCC 0.000114284930618 0.000112709789902 +AAGATT 0.000628567118397 0.000412095169329 +ATCGAT 0.000347426189078 0.000103904337566 +GACTCG 0.000258283943196 0.0001074265185 +CTCATC 0.000754280542076 0.000324921191202 +GACTCC 0.00046628251692 0.000188436679992 +CTCATA 0.000189712984825 0.000213091946533 +GACTCA 0.000278855230707 0.000244791574943 +AAGATA 0.000187427286213 0.00029762428896 +AAGATC 0.00097142191025 0.000240388848775 +AAGATG 0.00092342223939 0.000438511526337 +GACTCT 0.00062171002256 0.000229822305972 +ATCGAG 0.000658281200357 8.1010161492e-05 +TTGAGA 0.000150856108415 0.00033196555307 +ATCGAA 0.000207998573724 9.6859975697e-05 +ATCGAC 0.000420568544673 7.30852543895e-05 +ATATTT 0.000219427066786 0.00102935737809 +ACGGTA 3.885687641e-05 7.57268900903e-05 +GGACTC 0.000297140819606 0.000173467411021 +ATAGTT 0.000134856218129 0.000299385379427 +CTACCA 0.000143999012578 0.000106545973267 +TACTGT 0.000258283943196 0.000349576457743 +ATATTC 0.000166855998702 0.000407692443161 +ATATTA 8.4570848657e-05 0.000530088230632 +ATATTG 8.91422458817e-05 0.000393603719423 +ATAGTA 5.94281639212e-05 0.000181392318123 +ATAGTC 0.000107427834781 0.000130320694574 +TACTGG 0.000258283943196 0.000185795044291 +ATAGTG 0.000217141368173 0.000159378687283 +GATCGA 0.000141713313966 5.19521687829e-05 +CAGGCA 0.000425139941898 0.000215733582234 +AGGAAG 0.000683423885093 0.000397125900358 +CATCCG 9.37136431064e-05 0.000103904337566 +AGGAAA 0.000580567447538 0.000574996037546 +CATCCA 0.000258283943196 0.000328443372136 +CAGGCG 0.000356568983527 0.000105665428033 +CATCCC 0.000182855888988 0.000194600496628 +TTATGA 1.59998902865e-05 0.000427944983534 +ATAGAA 0.000191998683438 0.000241269394009 +CGGAGT 7.99994514323e-05 8.71739781273e-05 +TTATGG 6.39995611459e-05 0.000249194301111 +CATCCT 0.000251426847359 0.000279132839054 +AGGAAT 0.000217141368173 0.00029762428896 +CAGGCT 0.000596567337824 0.000235986122607 +ACGGAT 0.000157713204252 0.000110948699435 +CGGAGA 0.000150856108415 0.000124156877939 +CGGAGC 0.000150856108415 0.000109187608967 +TTATGT 6.17138625335e-05 0.000460525157177 +CAGGCC 0.000685709583706 0.000194600496628 +CGGAGG 0.000127999122292 0.000132081785041 +ATGGAA 0.000477711009982 0.00036366518148 +ATGGAC 0.00092342223939 0.000236866667841 +ATGGAG 0.00152456097444 0.000401528626526 +CGCTTG 9.37136431064e-05 0.000103023792332 +CGCTTA 3.65711777976e-05 5.98770758854e-05 +CGCTTC 0.000447996928021 0.000134723420742 +TGAACA 9.14279444941e-06 0.000567071130444 +ATGGAT 0.000685709583706 0.000324921191202 +TTTGCA 0.000370283175201 0.000539774228202 +CGCTTT 0.000276569532095 0.000210450310832 +GCCGTG 0.000338283394628 0.000120634697004 +GATCGT 0.000132570519516 5.01910783157e-05 +TTTGCC 0.000459425421083 0.000296743743726 +TTGTGA 2.28569861235e-05 0.000401528626526 +GAAAAG 0.00085485128102 0.000466688973813 +GAAAAC 0.000850279883795 0.000571473856612 +ATAGAT 0.000201141477887 0.000225419579804 +GAAAAA 0.00069942377538 0.000825070883891 +GTTCCT 0.000445711229409 0.000233344486906 +TAAGTA 0.0 0.00022453903457 +TAGGGC 2.28569861235e-06 0.000109187608967 +ACGGTT 0.000148570409803 9.77405209306e-05 +GAAAAT 0.000555424762802 0.000568832220911 +ACAAGG 8.68565472694e-05 0.000205167039431 +ACAAGA 0.000143999012578 0.000364545726714 +ACAAGC 0.000180570190376 0.000267685751017 +ACACGT 0.000105142136168 0.000141767782611 +CTGCGT 0.000269712436258 0.000159378687283 +GACGTC 0.000303997915443 0.000181392318123 +GCGGAG 0.000461711119695 0.000132081785041 +CATAAG 0.000169141697314 0.000175228501488 +GCGGAA 0.000150856108415 9.24572495289e-05 +CATAAA 0.000201141477887 0.000530968775866 +GCCAAC 0.000596567337824 0.000143528873078 +CATAAC 0.000127999122292 0.000228941760738 +ACACGC 0.000150856108415 0.000162900868218 +ACAAGT 0.000150856108415 0.000272088477185 +ACACGA 0.000130284820904 0.000138245601677 +ACACGG 9.59993417188e-05 0.000115351425603 +CATAAT 0.000121142026455 0.000370709543349 +GCGGAT 0.00019428438205 0.000103023792332 +GCACAT 0.000185141587601 0.000316115738866 +CTGCGG 0.000381711668263 0.000169064684853 +CTGCGA 0.00019428438205 0.000104784882799 +CTGCGC 0.000484568105819 0.000153214870648 +CGGCAA 7.31423555953e-05 7.39657996231e-05 +ACCGGT 0.000118856327842 6.33992568198e-05 +CGGCAG 0.000297140819606 0.000106545973267 +GACGCG 0.000159998902865 7.13241639223e-05 +CCTCCT 0.0007771375282 0.000367187362415 +TGTTGA 9.14279444941e-06 0.000535371502034 +CGGCAT 0.000107427834781 7.57268900903e-05 +CCTCCC 0.000219427066786 0.00015849814205 +CCTCCA 0.00073828065179 0.000338129369706 +CACGCC 0.000173713094539 9.6859975697e-05 +CCTCCG 0.000269712436258 0.000132962330275 diff --git a/code/utilities/CPAT-1.2.2/dat/zebrafish_cutoff.txt b/code/utilities/CPAT-1.2.2/dat/zebrafish_cutoff.txt new file mode 100755 index 0000000..40b6161 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/dat/zebrafish_cutoff.txt @@ -0,0 +1,2 @@ +Coding Probability Cutoff: 0.381 +Achieved Sensitivity and Specificity: 0.984 diff --git a/code/utilities/CPAT-1.2.2/distribute_setup.py b/code/utilities/CPAT-1.2.2/distribute_setup.py new file mode 100755 index 0000000..0021336 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/distribute_setup.py @@ -0,0 +1,477 @@ +#!python +"""Bootstrap distribute installation + +If you want to use setuptools in your package's setup.py, just include this +file in the same directory with it, and add this to the top of your setup.py:: + + from distribute_setup import use_setuptools + use_setuptools() + +If you want to require a specific version of setuptools, set a download +mirror, or use an alternate download directory, you can do so by supplying +the appropriate options to ``use_setuptools()``. + +This file can also be run as a script to install or upgrade setuptools. +""" +import os +import sys +import time +import fnmatch +import tempfile +import tarfile +from distutils import log + +try: + from site import USER_SITE +except ImportError: + USER_SITE = None + +try: + import subprocess + + def _python_cmd(*args): + args = (sys.executable,) + args + return subprocess.call(args) == 0 + +except ImportError: + # will be used for python 2.3 + def _python_cmd(*args): + args = (sys.executable,) + args + # quoting arguments if windows + if sys.platform == 'win32': + def quote(arg): + if ' ' in arg: + return '"%s"' % arg + return arg + args = [quote(arg) for arg in args] + return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 + +DEFAULT_VERSION = "0.6.10" +DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" +SETUPTOOLS_FAKED_VERSION = "0.6c11" + +SETUPTOOLS_PKG_INFO = """\ +Metadata-Version: 1.0 +Name: setuptools +Version: %s +Summary: xxxx +Home-page: xxx +Author: xxx +Author-email: xxx +License: xxx +Description: xxx +""" % SETUPTOOLS_FAKED_VERSION + + +def _install(tarball): + # extracting the tarball + tmpdir = tempfile.mkdtemp() + log.warn('Extracting in %s', tmpdir) + old_wd = os.getcwd() + try: + os.chdir(tmpdir) + tar = tarfile.open(tarball) + _extractall(tar) + tar.close() + + # going in the directory + subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) + os.chdir(subdir) + log.warn('Now working in %s', subdir) + + # installing + log.warn('Installing Distribute') + if not _python_cmd('setup.py', 'install'): + log.warn('Something went wrong during the installation.') + log.warn('See the error message above.') + finally: + os.chdir(old_wd) + + +def _build_egg(egg, tarball, to_dir): + # extracting the tarball + tmpdir = tempfile.mkdtemp() + log.warn('Extracting in %s', tmpdir) + old_wd = os.getcwd() + try: + os.chdir(tmpdir) + tar = tarfile.open(tarball) + _extractall(tar) + tar.close() + + # going in the directory + subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) + os.chdir(subdir) + log.warn('Now working in %s', subdir) + + # building an egg + log.warn('Building a Distribute egg in %s', to_dir) + _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) + + finally: + os.chdir(old_wd) + # returning the result + log.warn(egg) + if not os.path.exists(egg): + raise IOError('Could not build the egg.') + + +def _do_download(version, download_base, to_dir, download_delay): + egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg' + % (version, sys.version_info[0], sys.version_info[1])) + if not os.path.exists(egg): + tarball = download_setuptools(version, download_base, + to_dir, download_delay) + _build_egg(egg, tarball, to_dir) + sys.path.insert(0, egg) + import setuptools + setuptools.bootstrap_install_from = egg + + +def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, + to_dir=os.curdir, download_delay=15, no_fake=True): + # making sure we use the absolute path + to_dir = os.path.abspath(to_dir) + was_imported = 'pkg_resources' in sys.modules or \ + 'setuptools' in sys.modules + try: + try: + import pkg_resources + if not hasattr(pkg_resources, '_distribute'): + if not no_fake: + _fake_setuptools() + raise ImportError + except ImportError: + return _do_download(version, download_base, to_dir, download_delay) + try: + pkg_resources.require("distribute>="+version) + return + except pkg_resources.VersionConflict: + e = sys.exc_info()[1] + if was_imported: + sys.stderr.write( + "The required version of distribute (>=%s) is not available,\n" + "and can't be installed while this script is running. Please\n" + "install a more recent version first, using\n" + "'easy_install -U distribute'." + "\n\n(Currently using %r)\n" % (version, e.args[0])) + sys.exit(2) + else: + del pkg_resources, sys.modules['pkg_resources'] # reload ok + return _do_download(version, download_base, to_dir, + download_delay) + except pkg_resources.DistributionNotFound: + return _do_download(version, download_base, to_dir, + download_delay) + finally: + if not no_fake: + _create_fake_setuptools_pkg_info(to_dir) + +def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, + to_dir=os.curdir, delay=15): + """Download distribute from a specified location and return its filename + + `version` should be a valid distribute version number that is available + as an egg for download under the `download_base` URL (which should end + with a '/'). `to_dir` is the directory where the egg will be downloaded. + `delay` is the number of seconds to pause before an actual download + attempt. + """ + # making sure we use the absolute path + to_dir = os.path.abspath(to_dir) + try: + from urllib.request import urlopen + except ImportError: + from urllib2 import urlopen + tgz_name = "distribute-%s.tar.gz" % version + url = download_base + tgz_name + saveto = os.path.join(to_dir, tgz_name) + src = dst = None + if not os.path.exists(saveto): # Avoid repeated downloads + try: + log.warn("Downloading %s", url) + src = urlopen(url) + # Read/write all in one block, so we don't create a corrupt file + # if the download is interrupted. + data = src.read() + dst = open(saveto, "wb") + dst.write(data) + finally: + if src: + src.close() + if dst: + dst.close() + return os.path.realpath(saveto) + + +def _patch_file(path, content): + """Will backup the file then patch it""" + existing_content = open(path).read() + if existing_content == content: + # already patched + log.warn('Already patched.') + return False + log.warn('Patching...') + _rename_path(path) + f = open(path, 'w') + try: + f.write(content) + finally: + f.close() + return True + + +def _same_content(path, content): + return open(path).read() == content + +def _no_sandbox(function): + def __no_sandbox(*args, **kw): + try: + from setuptools.sandbox import DirectorySandbox + def violation(*args): + pass + DirectorySandbox._old = DirectorySandbox._violation + DirectorySandbox._violation = violation + patched = True + except ImportError: + patched = False + + try: + return function(*args, **kw) + finally: + if patched: + DirectorySandbox._violation = DirectorySandbox._old + del DirectorySandbox._old + + return __no_sandbox + +@_no_sandbox +def _rename_path(path): + new_name = path + '.OLD.%s' % time.time() + log.warn('Renaming %s into %s', path, new_name) + os.rename(path, new_name) + return new_name + +def _remove_flat_installation(placeholder): + if not os.path.isdir(placeholder): + log.warn('Unkown installation at %s', placeholder) + return False + found = False + for file in os.listdir(placeholder): + if fnmatch.fnmatch(file, 'setuptools*.egg-info'): + found = True + break + if not found: + log.warn('Could not locate setuptools*.egg-info') + return + + log.warn('Removing elements out of the way...') + pkg_info = os.path.join(placeholder, file) + if os.path.isdir(pkg_info): + patched = _patch_egg_dir(pkg_info) + else: + patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO) + + if not patched: + log.warn('%s already patched.', pkg_info) + return False + # now let's move the files out of the way + for element in ('setuptools', 'pkg_resources.py', 'site.py'): + element = os.path.join(placeholder, element) + if os.path.exists(element): + _rename_path(element) + else: + log.warn('Could not find the %s element of the ' + 'Setuptools distribution', element) + return True + + +def _after_install(dist): + log.warn('After install bootstrap.') + placeholder = dist.get_command_obj('install').install_purelib + _create_fake_setuptools_pkg_info(placeholder) + +@_no_sandbox +def _create_fake_setuptools_pkg_info(placeholder): + if not placeholder or not os.path.exists(placeholder): + log.warn('Could not find the install location') + return + pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) + setuptools_file = 'setuptools-%s-py%s.egg-info' % \ + (SETUPTOOLS_FAKED_VERSION, pyver) + pkg_info = os.path.join(placeholder, setuptools_file) + if os.path.exists(pkg_info): + log.warn('%s already exists', pkg_info) + return + + log.warn('Creating %s', pkg_info) + f = open(pkg_info, 'w') + try: + f.write(SETUPTOOLS_PKG_INFO) + finally: + f.close() + + pth_file = os.path.join(placeholder, 'setuptools.pth') + log.warn('Creating %s', pth_file) + f = open(pth_file, 'w') + try: + f.write(os.path.join(os.curdir, setuptools_file)) + finally: + f.close() + +def _patch_egg_dir(path): + # let's check if it's already patched + pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') + if os.path.exists(pkg_info): + if _same_content(pkg_info, SETUPTOOLS_PKG_INFO): + log.warn('%s already patched.', pkg_info) + return False + _rename_path(path) + os.mkdir(path) + os.mkdir(os.path.join(path, 'EGG-INFO')) + pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') + f = open(pkg_info, 'w') + try: + f.write(SETUPTOOLS_PKG_INFO) + finally: + f.close() + return True + + +def _before_install(): + log.warn('Before install bootstrap.') + _fake_setuptools() + + +def _under_prefix(location): + if 'install' not in sys.argv: + return True + args = sys.argv[sys.argv.index('install')+1:] + for index, arg in enumerate(args): + for option in ('--root', '--prefix'): + if arg.startswith('%s=' % option): + top_dir = arg.split('root=')[-1] + return location.startswith(top_dir) + elif arg == option: + if len(args) > index: + top_dir = args[index+1] + return location.startswith(top_dir) + elif option == '--user' and USER_SITE is not None: + return location.startswith(USER_SITE) + return True + + +def _fake_setuptools(): + log.warn('Scanning installed packages') + try: + import pkg_resources + except ImportError: + # we're cool + log.warn('Setuptools or Distribute does not seem to be installed.') + return + ws = pkg_resources.working_set + try: + setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools', + replacement=False)) + except TypeError: + # old distribute API + setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools')) + + if setuptools_dist is None: + log.warn('No setuptools distribution found') + return + # detecting if it was already faked + setuptools_location = setuptools_dist.location + log.warn('Setuptools installation detected at %s', setuptools_location) + + # if --root or --preix was provided, and if + # setuptools is not located in them, we don't patch it + if not _under_prefix(setuptools_location): + log.warn('Not patching, --root or --prefix is installing Distribute' + ' in another location') + return + + # let's see if its an egg + if not setuptools_location.endswith('.egg'): + log.warn('Non-egg installation') + res = _remove_flat_installation(setuptools_location) + if not res: + return + else: + log.warn('Egg installation') + pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO') + if (os.path.exists(pkg_info) and + _same_content(pkg_info, SETUPTOOLS_PKG_INFO)): + log.warn('Already patched.') + return + log.warn('Patching...') + # let's create a fake egg replacing setuptools one + res = _patch_egg_dir(setuptools_location) + if not res: + return + log.warn('Patched done.') + _relaunch() + + +def _relaunch(): + log.warn('Relaunching...') + # we have to relaunch the process + args = [sys.executable] + sys.argv + sys.exit(subprocess.call(args)) + + +def _extractall(self, path=".", members=None): + """Extract all members from the archive to the current working + directory and set owner, modification time and permissions on + directories afterwards. `path' specifies a different directory + to extract to. `members' is optional and must be a subset of the + list returned by getmembers(). + """ + import copy + import operator + from tarfile import ExtractError + directories = [] + + if members is None: + members = self + + for tarinfo in members: + if tarinfo.isdir(): + # Extract directories with a safe mode. + directories.append(tarinfo) + tarinfo = copy.copy(tarinfo) + tarinfo.mode = 448 # decimal for oct 0700 + self.extract(tarinfo, path) + + # Reverse sort directories. + if sys.version_info < (2, 4): + def sorter(dir1, dir2): + return cmp(dir1.name, dir2.name) + directories.sort(sorter) + directories.reverse() + else: + directories.sort(key=operator.attrgetter('name'), reverse=True) + + # Set correct owner, mtime and filemode on directories. + for tarinfo in directories: + dirpath = os.path.join(path, tarinfo.name) + try: + self.chown(tarinfo, dirpath) + self.utime(tarinfo, dirpath) + self.chmod(tarinfo, dirpath) + except ExtractError: + e = sys.exc_info()[1] + if self.errorlevel > 1: + raise + else: + self._dbg(1, "tarfile: %s" % e) + + +def main(argv, version=DEFAULT_VERSION): + """Install or upgrade setuptools and EasyInstall""" + tarball = download_setuptools() + _install(tarball) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/code/utilities/CPAT-1.2.2/doc/CONTACTS b/code/utilities/CPAT-1.2.2/doc/CONTACTS new file mode 100755 index 0000000..3fe0317 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/doc/CONTACTS @@ -0,0 +1,2 @@ +Liguo Wang: wangliguo78@gmail.com +Jung Hyun Park: hjpark@bcm.edu diff --git a/code/utilities/CPAT-1.2.2/doc/COPYING b/code/utilities/CPAT-1.2.2/doc/COPYING new file mode 100755 index 0000000..82fa2f4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/doc/COPYING @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2008-2009 Genome Research Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/doc/INSTALL b/code/utilities/CPAT-1.2.2/doc/INSTALL new file mode 100755 index 0000000..dae0472 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/doc/INSTALL @@ -0,0 +1,26 @@ +Installation guide for CPAT (Coding Potential Assessing Tool)) + +Prerequisite: + * gcc + * python2.7 + * numpy + * If your computer can not connnect to internet, nose>= 0.10.4 and distribute-0.6.10 are also required. + * R + * Xcode (MAC OS) +Below is an example of installing CPAT on Linux system using BASH. You need to change '--root' directory, PYTHONPATH and PATH accordingly + * tar zxf CPAT-VERSION.tar.gz + * cd CPAT-VERSION + * python setup.py install #will install CPAT in system level. require root previledge + * python setup.py install --root=/home/user/CPAT #will install CPAT at user specified location + * export PYTHONPATH=/home/user/CPAT/usr/local/lib/python2.7/site-packages:$PYTHONPATH. #setup PYTHONPATH, so that CDSP knows where to import modules + * export PATH=/home/user/CPAT/usr/local/bin:$PATH #setup PATH, so that system knows where to find executable file + +NOTE: + * If the installation failed with error like: /usr/bin/ld: cannot find -lz, you may need to install a shared zlib library on your system. + +Online Manual: + +http://rna-cpat.sourceforge.net/ + +Contact: +wangliguo78@gmail.com diff --git a/code/utilities/CPAT-1.2.2/doc/Manual b/code/utilities/CPAT-1.2.2/doc/Manual new file mode 100755 index 0000000..741768a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/doc/Manual @@ -0,0 +1 @@ +http://rna-cpat.sourceforge.net/ diff --git a/code/utilities/CPAT-1.2.2/doc/THANKS b/code/utilities/CPAT-1.2.2/doc/THANKS new file mode 100755 index 0000000..4c8fea2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/doc/THANKS @@ -0,0 +1,4 @@ +Acknowledgements goes to: +1) Samtools and pysam contributors +2) bx-python contributors +3) Users' valuable feedback diff --git a/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/PKG-INFO b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/PKG-INFO new file mode 100755 index 0000000..359f037 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/PKG-INFO @@ -0,0 +1,11 @@ +Metadata-Version: 1.0 +Name: CPAT +Version: 1.2.2 +Summary: Coding Potential Assessment Tool +Home-page: http://rna-cpat.sourceforge.net/ +Author: Liguo Wang +Author-email: wangliguo78@gmail.com +License: UNKNOWN +Description: UNKNOWN +Platform: Linux +Platform: MacOS diff --git a/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/SOURCES.txt b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/SOURCES.txt new file mode 100755 index 0000000..6fb26a6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/SOURCES.txt @@ -0,0 +1,361 @@ +MANIFEST.in +distribute_setup.py +setup.py +bin/cpat.py +bin/make_hexamer_tab.py +bin/make_logitModel.py +dat/Fly_logitModel.RData +dat/Human_Hexamer.tsv +dat/Human_cutoff.txt +dat/Human_logitModel.RData +dat/Mouse_Hexamer.tsv +dat/Mouse_cutoff.txt +dat/Mouse_logitModel.RData +dat/Zebrafish_logitModel.RData +dat/fly_Hexamer.tsv +dat/fly_cutoff.txt +dat/zebrafish_Hexamer.tsv +dat/zebrafish_cutoff.txt +doc/CONTACTS +doc/COPYING +doc/INSTALL +doc/Manual +doc/THANKS +lib/psyco_full.py +lib/CPAT.egg-info/PKG-INFO +lib/CPAT.egg-info/SOURCES.txt +lib/CPAT.egg-info/dependency_links.txt +lib/CPAT.egg-info/not-zip-safe +lib/CPAT.egg-info/top_level.txt +lib/bx/__init__.py +lib/bx/_seqmapping.c +lib/bx/_seqmapping.pyx +lib/bx/binned_array.py +lib/bx/binned_array_tests.py +lib/bx/bitset.c +lib/bx/bitset.pyx +lib/bx/bitset_builders.py +lib/bx/bitset_tests.py +lib/bx/bitset_utils.py +lib/bx/filter.py +lib/bx/gene_reader.py +lib/bx/interval_index_file.py +lib/bx/interval_index_file_tests.py +lib/bx/seqmapping.py +lib/bx/seqmapping_tests.py +lib/bx/wiggle.py +lib/bx/wiggle_tests.py +lib/bx/align/__init__.py +lib/bx/align/_core.c +lib/bx/align/_core.pyx +lib/bx/align/_epo.c +lib/bx/align/_epo.pyx +lib/bx/align/axt.py +lib/bx/align/core.py +lib/bx/align/epo.py +lib/bx/align/epo_tests.py +lib/bx/align/lav.py +lib/bx/align/lav_tests.py +lib/bx/align/maf.py +lib/bx/align/maf_tests.py +lib/bx/align/score.py +lib/bx/align/score_tests.py +lib/bx/align/sitemask/__init__.py +lib/bx/align/sitemask/_cpg.c +lib/bx/align/sitemask/_cpg.pyx +lib/bx/align/sitemask/core.py +lib/bx/align/sitemask/cpg.py +lib/bx/align/sitemask/find_cpg.c +lib/bx/align/sitemask/find_cpg.h +lib/bx/align/sitemask/quality.py +lib/bx/align/sitemask/sitemask_tests.py +lib/bx/align/tools/__init__.py +lib/bx/align/tools/chop.py +lib/bx/align/tools/fuse.py +lib/bx/align/tools/thread.py +lib/bx/align/tools/tile.py +lib/bx/arrays/__init__.py +lib/bx/arrays/array_tree.c +lib/bx/arrays/array_tree.pyx +lib/bx/arrays/array_tree_tests.py +lib/bx/arrays/bed.c +lib/bx/arrays/bed.pyx +lib/bx/arrays/wiggle.c +lib/bx/arrays/wiggle.pyx +lib/bx/bbi/__init__.py +lib/bx/bbi/bbi_file.c +lib/bx/bbi/bbi_file.pyx +lib/bx/bbi/bigbed_file.c +lib/bx/bbi/bigbed_file.pyx +lib/bx/bbi/bigwig_file.c +lib/bx/bbi/bigwig_file.pyx +lib/bx/bbi/bigwig_tests.py +lib/bx/bbi/bpt_file.c +lib/bx/bbi/bpt_file.pyx +lib/bx/bbi/cirtree_file.c +lib/bx/bbi/cirtree_file.pyx +lib/bx/cookbook/__init__.py +lib/bx/cookbook/argparse.py +lib/bx/cookbook/attribute.py +lib/bx/cookbook/doc_optparse.py +lib/bx/cookbook/progress_bar.py +lib/bx/intervals/__init__.py +lib/bx/intervals/cluster.c +lib/bx/intervals/cluster.pyx +lib/bx/intervals/cluster_tests.py +lib/bx/intervals/intersection.c +lib/bx/intervals/intersection.pyx +lib/bx/intervals/intersection_tests.py +lib/bx/intervals/io.py +lib/bx/intervals/random_intervals.py +lib/bx/intervals/operations/__init__.py +lib/bx/intervals/operations/base_coverage.py +lib/bx/intervals/operations/complement.py +lib/bx/intervals/operations/concat.py +lib/bx/intervals/operations/coverage.py +lib/bx/intervals/operations/find_clusters.py +lib/bx/intervals/operations/intersect.py +lib/bx/intervals/operations/join.py +lib/bx/intervals/operations/merge.py +lib/bx/intervals/operations/quicksect.py +lib/bx/intervals/operations/subtract.py +lib/bx/intseq/__init__.py +lib/bx/intseq/ngramcount.c +lib/bx/intseq/ngramcount.pyx +lib/bx/misc/__init__.py +lib/bx/misc/_seekbzip2.c +lib/bx/misc/_seekbzip2.pyx +lib/bx/misc/bgzf.c +lib/bx/misc/bgzf.pyx +lib/bx/misc/bgzf_tests.py +lib/bx/misc/binary_file.py +lib/bx/misc/cdb.py +lib/bx/misc/cdb_tests.py +lib/bx/misc/filecache.py +lib/bx/misc/filecache_tests.py +lib/bx/misc/readlengths.py +lib/bx/misc/seekbzip2.py +lib/bx/misc/seekbzip2_tests.py +lib/bx/misc/seeklzop.py +lib/bx/misc/seeklzop_tests.py +lib/bx/motif/__init__.py +lib/bx/motif/_pwm.c +lib/bx/motif/_pwm.pyx +lib/bx/motif/pwm.py +lib/bx/motif/pwm_tests.py +lib/bx/motif/io/__init__.py +lib/bx/motif/io/transfac.py +lib/bx/motif/io/transfac_tests.py +lib/bx/motif/logo/__init__.py +lib/bx/motif/logo/template.ps +lib/bx/phylo/__init__.py +lib/bx/phylo/newick.py +lib/bx/phylo/newick_tests.py +lib/bx/phylo/phast.py +lib/bx/phylo/phast_tests.py +lib/bx/pwm/__init__.py +lib/bx/pwm/_position_weight_matrix.c +lib/bx/pwm/_position_weight_matrix.pyx +lib/bx/pwm/bed_score_aligned_pwm.py +lib/bx/pwm/bed_score_aligned_string.py +lib/bx/pwm/maf_select_motifs.py +lib/bx/pwm/position_weight_matrix.py +lib/bx/pwm/pwm_score_maf.py +lib/bx/pwm/pwm_score_motifs.py +lib/bx/pwm/pwm_score_positions.py +lib/bx/pwm/pwm_tests.py +lib/bx/seq/__init__.py +lib/bx/seq/_nib.c +lib/bx/seq/_nib.pyx +lib/bx/seq/_twobit.c +lib/bx/seq/_twobit.pyx +lib/bx/seq/core.py +lib/bx/seq/fasta.py +lib/bx/seq/fasta_tests.py +lib/bx/seq/nib.py +lib/bx/seq/nib_tests.py +lib/bx/seq/qdna.py +lib/bx/seq/qdna_tests.py +lib/bx/seq/seq.py +lib/bx/seq/seq_tests.py +lib/bx/seq/twobit.py +lib/bx/seq/twobit_tests.py +lib/bx/tabular/__init__.py +lib/bx/tabular/io.py +lib/bx_extras/__init__.py +lib/bx_extras/fpconst.py +lib/bx_extras/lrucache.py +lib/bx_extras/pstat.py +lib/bx_extras/pyparsing.py +lib/bx_extras/stats.py +lib/cpmodule/BED.py +lib/cpmodule/FrameKmer.py +lib/cpmodule/PSL.py +lib/cpmodule/SAM.py +lib/cpmodule/__init__.py +lib/cpmodule/annoGene.py +lib/cpmodule/changePoint.py +lib/cpmodule/cigar.py +lib/cpmodule/dotProduct.py +lib/cpmodule/fasta.py +lib/cpmodule/fastq.py +lib/cpmodule/fickett.py +lib/cpmodule/ireader.py +lib/cpmodule/mystat.py +lib/cpmodule/orf.py +lib/cpmodule/poisson.py +lib/cpmodule/quantile.py +lib/cpmodule/twoList.py +lib/cpmodule/wiggle.py +lib/pysam/Pileup.py +lib/pysam/TabProxies.c +lib/pysam/TabProxies.pxd +lib/pysam/TabProxies.pyx +lib/pysam/__init__.py +lib/pysam/csamtools.c +lib/pysam/csamtools.pxd +lib/pysam/csamtools.pyx +lib/pysam/ctabix.c +lib/pysam/ctabix.pxd +lib/pysam/ctabix.pyx +lib/pysam/cvcf.c +lib/pysam/cvcf.pxd +lib/pysam/cvcf.pyx +lib/pysam/namedtuple.py +lib/pysam/pysam_util.c +lib/pysam/pysam_util.h +lib/pysam/tabix_util.c +lib/pysam/version.py +lib/samtools/bam.c.pysam.c +lib/samtools/bam.h +lib/samtools/bam2bcf.c.pysam.c +lib/samtools/bam2bcf.h +lib/samtools/bam2bcf_indel.c.pysam.c +lib/samtools/bam2depth.c.pysam.c +lib/samtools/bam_aux.c.pysam.c +lib/samtools/bam_cat.c.pysam.c +lib/samtools/bam_color.c.pysam.c +lib/samtools/bam_endian.h +lib/samtools/bam_import.c.pysam.c +lib/samtools/bam_index.c.pysam.c +lib/samtools/bam_lpileup.c.pysam.c +lib/samtools/bam_mate.c.pysam.c +lib/samtools/bam_md.c.pysam.c +lib/samtools/bam_pileup.c.pysam.c +lib/samtools/bam_plcmd.c.pysam.c +lib/samtools/bam_reheader.c.pysam.c +lib/samtools/bam_rmdup.c.pysam.c +lib/samtools/bam_rmdupse.c.pysam.c +lib/samtools/bam_sort.c.pysam.c +lib/samtools/bam_stat.c.pysam.c +lib/samtools/bam_tview.c.pysam.c +lib/samtools/bedidx.c.pysam.c +lib/samtools/bgzf.c.pysam.c +lib/samtools/bgzf.h +lib/samtools/cut_target.c.pysam.c +lib/samtools/errmod.c.pysam.c +lib/samtools/errmod.h +lib/samtools/faidx.c.pysam.c +lib/samtools/faidx.h +lib/samtools/kaln.c.pysam.c +lib/samtools/kaln.h +lib/samtools/khash.h +lib/samtools/klist.h +lib/samtools/knetfile.c.pysam.c +lib/samtools/knetfile.h +lib/samtools/kprobaln.c.pysam.c +lib/samtools/kprobaln.h +lib/samtools/kseq.h +lib/samtools/ksort.h +lib/samtools/kstring.c.pysam.c +lib/samtools/kstring.h +lib/samtools/phase.c.pysam.c +lib/samtools/pysam.h +lib/samtools/razf.c.pysam.c +lib/samtools/razf.h +lib/samtools/sam.c.pysam.c +lib/samtools/sam.h +lib/samtools/sam_header.c.pysam.c +lib/samtools/sam_header.h +lib/samtools/sam_view.c.pysam.c +lib/samtools/sample.c.pysam.c +lib/samtools/sample.h +lib/samtools/bcftools/bcf.c.pysam.c +lib/samtools/bcftools/bcf.h +lib/samtools/bcftools/bcf2qcall.c.pysam.c +lib/samtools/bcftools/bcfutils.c.pysam.c +lib/samtools/bcftools/call1.c.pysam.c +lib/samtools/bcftools/em.c.pysam.c +lib/samtools/bcftools/fet.c.pysam.c +lib/samtools/bcftools/index.c.pysam.c +lib/samtools/bcftools/kfunc.c.pysam.c +lib/samtools/bcftools/kmin.c.pysam.c +lib/samtools/bcftools/kmin.h +lib/samtools/bcftools/mut.c.pysam.c +lib/samtools/bcftools/prob1.c.pysam.c +lib/samtools/bcftools/prob1.h +lib/samtools/bcftools/vcf.c.pysam.c +lib/samtools/misc/md5.c.pysam.c +lib/samtools/misc/md5.h +lib/samtools/misc/seqtk.c.pysam.c +lib/samtools/win32/xcurses.h +lib/samtools/win32/zconf.h +lib/samtools/win32/zlib.h +lib/tabix/bam_endian.h +lib/tabix/bedidx.c.pysam.c +lib/tabix/bgzf.c.pysam.c +lib/tabix/bgzf.h +lib/tabix/bgzip.c.pysam.c +lib/tabix/index.c.pysam.c +lib/tabix/khash.h +lib/tabix/knetfile.c.pysam.c +lib/tabix/knetfile.h +lib/tabix/kseq.h +lib/tabix/ksort.h +lib/tabix/kstring.c.pysam.c +lib/tabix/kstring.h +lib/tabix/pysam.h +lib/tabix/tabix.h +lib/tests/00README.txt +lib/tests/Makefile +lib/tests/ex1.fa +lib/tests/ex1.sam.gz +lib/tests/ex10.sam +lib/tests/ex3.sam +lib/tests/ex4.sam +lib/tests/ex5.sam +lib/tests/ex6.sam +lib/tests/ex7.sam +lib/tests/ex8.sam +lib/tests/ex9_fail.bam +lib/tests/ex9_nofail.bam +lib/tests/example.gtf.gz +lib/tests/example.gtf.gz.tbi +lib/tests/example.py +lib/tests/pysam_test.py +lib/tests/segfault_tests.py +lib/tests/tabix_test.py +src/binBits.c +src/binBits.h +src/cluster.c +src/cluster.h +src/pwm_utils.c +src/pwm_utils.h +src/bunzip/micro-bunzip.c +src/bunzip/micro-bunzip.h +src/kent/bits.c +src/kent/bits.h +src/kent/common.c +src/kent/common.h +src/samtools/bgzf.c +src/samtools/bgzf.h +src/samtools/khash.h +test/Human_coding_transcripts_CDS.fa +test/Human_coding_transcripts_hg19.bed +test/Human_coding_transcripts_mRNA.fa +test/Human_noncoding_transcripts_RNA.fa +test/Human_noncoding_transcripts_hg19.bed +test/Human_test_coding_mRNA.fa +test/Human_test_coding_mRNA_hg19.bed +test/Human_test_noncoding_RNA.fa +test/Human_test_noncoding_hg19.bed \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/dependency_links.txt b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/dependency_links.txt new file mode 100755 index 0000000..6ab76d2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/dependency_links.txt @@ -0,0 +1,2 @@ +http://bitbucket.org/james_taylor/bx-python/wiki/Home +http://wwwfgu.anat.ox.ac.uk/~andreas/documentation/samtools/contents.html diff --git a/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/not-zip-safe b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/not-zip-safe new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/top_level.txt b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/top_level.txt new file mode 100755 index 0000000..6167a87 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/CPAT.egg-info/top_level.txt @@ -0,0 +1,9 @@ +pysam +ctabix +psyco_full +csamtools +cpmodule +cvcf +bx_extras +bx +TabProxies diff --git a/code/utilities/CPAT-1.2.2/lib/bx/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/__init__.py new file mode 100755 index 0000000..e1fcac0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/__init__.py @@ -0,0 +1,14 @@ +import sys +""" +Shamelessly ripped off of py.std +""" +__version__ = '0.5.0' + +class Std( object ): + def __init__( self ): + self.__dict__ = sys.modules + def __getattr__( self, name ): + m = __import__(name) + return m + +std = Std() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.c b/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.c new file mode 100755 index 0000000..2b95b8f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.c @@ -0,0 +1,4869 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:15 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx___seqmapping +#define __PYX_HAVE_API__bx___seqmapping +#include "stdlib.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_seqmapping.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping; +struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping; + +/* "bx/_seqmapping.pyx":19 + * import sys + * + * cdef class CharToIntArrayMapping: # <<<<<<<<<<<<<< + * """Mapping for converting strings to int arrays""" + * + */ +struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping { + PyObject_HEAD + int table[256]; + int out_size; + PyObject *reverse_table; +}; + + +/* "bx/_seqmapping.pyx":102 + * return self.out_size + * + * cdef class IntToIntMapping: # <<<<<<<<<<<<<< + * + * cdef int* table + */ +struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping { + PyObject_HEAD + int *table; + int in_size; + int out_size; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { + return unlikely(b < 0) ? b : !b; +} +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx._seqmapping' */ +static PyTypeObject *__pyx_ptype_2bx_11_seqmapping_CharToIntArrayMapping = 0; +static PyTypeObject *__pyx_ptype_2bx_11_seqmapping_IntToIntMapping = 0; +#define __Pyx_MODULE_NAME "bx._seqmapping" +int __pyx_module_is_main_bx___seqmapping = 0; + +/* Implementation of 'bx._seqmapping' */ +static PyObject *__pyx_builtin_ord; +static PyObject *__pyx_builtin_chr; +static PyObject *__pyx_builtin_range; +static char __pyx_k_1[] = "Malloc Failed"; +static char __pyx_k_2[] = "%d not between 0 and %s"; +static char __pyx_k_3[] = "`src` argument must be a buffer of 32bit integers"; +static char __pyx_k_4[] = "\nPyrex extension classes used by `seqmapping.py`.\n"; +static char __pyx_k__a[] = "a"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__chr[] = "chr"; +static char __pyx_k__ord[] = "ord"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__val[] = "val"; +static char __pyx_k__math[] = "math"; +static char __pyx_k__floor[] = "floor"; +static char __pyx_k__index[] = "index"; +static char __pyx_k__nseqs[] = "nseqs"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__random[] = "random"; +static char __pyx_k__sample[] = "sample"; +static char __pyx_k__symbol[] = "symbol"; +static char __pyx_k__in_size[] = "in_size"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__randrange[] = "randrange"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__b; +static PyObject *__pyx_n_s__c; +static PyObject *__pyx_n_s__chr; +static PyObject *__pyx_n_s__floor; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__in_size; +static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__math; +static PyObject *__pyx_n_s__nseqs; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__ord; +static PyObject *__pyx_n_s__random; +static PyObject *__pyx_n_s__randrange; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__sample; +static PyObject *__pyx_n_s__symbol; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__val; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_neg_1; + +/* "bx/_seqmapping.pyx":26 + * cdef object reverse_table + * + * def __cinit__( self ): # <<<<<<<<<<<<<< + * """Init empty mapping (all characters map to -1)""" + * cdef int i + */ + +static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "bx/_seqmapping.pyx":29 + * """Init empty mapping (all characters map to -1)""" + * cdef int i + * for i from 0 <= i < 256: self.table[i] = -1 # <<<<<<<<<<<<<< + * self.out_size = 0 + * + */ + for (__pyx_v_i = 0; __pyx_v_i < 256; __pyx_v_i++) { + (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[__pyx_v_i]) = -1; + } + + /* "bx/_seqmapping.pyx":30 + * cdef int i + * for i from 0 <= i < 256: self.table[i] = -1 + * self.out_size = 0 # <<<<<<<<<<<<<< + * + * def __init__( self ): + */ + ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":32 + * self.out_size = 0 + * + * def __init__( self ): # <<<<<<<<<<<<<< + * self.reverse_table = dict() + * + */ + +static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + + /* "bx/_seqmapping.pyx":33 + * + * def __init__( self ): + * self.reverse_table = dict() # <<<<<<<<<<<<<< + * + * def set_mapping( self, c, int symbol ): + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table); + __Pyx_DECREF(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table); + ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":35 + * self.reverse_table = dict() + * + * def set_mapping( self, c, int symbol ): # <<<<<<<<<<<<<< + * """Modify mapping so 'chars' map to 'symbol'""" + * char = ord( c ) + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping[] = "Modify mapping so 'chars' map to 'symbol'"; +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_c = 0; + int __pyx_v_symbol; + PyObject *__pyx_v_char = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,&__pyx_n_s__symbol,0}; + __Pyx_RefNannySetupContext("set_mapping"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_c = values[0]; + __pyx_v_symbol = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_symbol == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.set_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":37 + * def set_mapping( self, c, int symbol ): + * """Modify mapping so 'chars' map to 'symbol'""" + * char = ord( c ) # <<<<<<<<<<<<<< + * self.table[ char ] = symbol + * if self.out_size <= symbol: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_c); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_c); + __Pyx_GIVEREF(__pyx_v_c); + __pyx_t_2 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_char = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/_seqmapping.pyx":38 + * """Modify mapping so 'chars' map to 'symbol'""" + * char = ord( c ) + * self.table[ char ] = symbol # <<<<<<<<<<<<<< + * if self.out_size <= symbol: + * self.out_size = symbol + 1 + */ + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_char); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[__pyx_t_3]) = __pyx_v_symbol; + + /* "bx/_seqmapping.pyx":39 + * char = ord( c ) + * self.table[ char ] = symbol + * if self.out_size <= symbol: # <<<<<<<<<<<<<< + * self.out_size = symbol + 1 + * self.reverse_table[ symbol ] = chr( char ) + */ + __pyx_t_4 = (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size <= __pyx_v_symbol); + if (__pyx_t_4) { + + /* "bx/_seqmapping.pyx":40 + * self.table[ char ] = symbol + * if self.out_size <= symbol: + * self.out_size = symbol + 1 # <<<<<<<<<<<<<< + * self.reverse_table[ symbol ] = chr( char ) + * + */ + ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size = (__pyx_v_symbol + 1); + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/_seqmapping.pyx":41 + * if self.out_size <= symbol: + * self.out_size = symbol + 1 + * self.reverse_table[ symbol ] = chr( char ) # <<<<<<<<<<<<<< + * + * def translate( self, string ): + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_char); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_char); + __Pyx_GIVEREF(__pyx_v_char); + __pyx_t_1 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table, __pyx_v_symbol, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.set_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_char); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":43 + * self.reverse_table[ symbol ] = chr( char ) + * + * def translate( self, string ): # <<<<<<<<<<<<<< + * """Translate 'string' and return as int array""" + * cdef int s_len, t_len + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_3translate[] = "Translate 'string' and return as int array"; +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_string) { + int __pyx_v_s_len; + int __pyx_v_t_len; + unsigned char *__pyx_v_s_buf; + int *__pyx_v_t_buf; + PyObject *__pyx_v_rval = NULL; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate"); + + /* "bx/_seqmapping.pyx":49 + * cdef int * t_buf + * # Get direct access to string + * PyString_AsStringAndSize( string, &s_buf, &s_len ) # <<<<<<<<<<<<<< + * # Initialize empty array + * rval = zeros( s_len, 'i' ) + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_string, ((char **)(&__pyx_v_s_buf)), (&__pyx_v_s_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":51 + * PyString_AsStringAndSize( string, &s_buf, &s_len ) + * # Initialize empty array + * rval = zeros( s_len, 'i' ) # <<<<<<<<<<<<<< + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + * # Translate + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_s_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_rval = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":52 + * # Initialize empty array + * rval = zeros( s_len, 'i' ) + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) # <<<<<<<<<<<<<< + * # Translate + * for i from 0 <= i < s_len: + */ + __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_rval, ((void **)(&__pyx_v_t_buf)), (&__pyx_v_t_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":54 + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + * # Translate + * for i from 0 <= i < s_len: # <<<<<<<<<<<<<< + * t_buf[i] = self.table[ s_buf[ i ] ] + * # Done + */ + __pyx_t_1 = __pyx_v_s_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":55 + * # Translate + * for i from 0 <= i < s_len: + * t_buf[i] = self.table[ s_buf[ i ] ] # <<<<<<<<<<<<<< + * # Done + * return rval + */ + (__pyx_v_t_buf[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]); + } + + /* "bx/_seqmapping.pyx":57 + * t_buf[i] = self.table[ s_buf[ i ] ] + * # Done + * return rval # <<<<<<<<<<<<<< + * + * def translate_list( self, strings ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":59 + * return rval + * + * def translate_list( self, strings ): # <<<<<<<<<<<<<< + * """Translate a list of strings into an int array""" + * cdef int text_len, factor, i + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list[] = "Translate a list of strings into an int array"; +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list(PyObject *__pyx_v_self, PyObject *__pyx_v_strings) { + int __pyx_v_text_len; + int __pyx_v_factor; + int __pyx_v_i; + int __pyx_v_s_len; + int __pyx_v_t_len; + unsigned char *__pyx_v_s_buf; + int *__pyx_v_t_buf; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_v_string = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate_list"); + + /* "bx/_seqmapping.pyx":67 + * + * # No input, no output + * if len( strings ) < 1: return None # <<<<<<<<<<<<<< + * + * # Length of result + */ + __pyx_t_1 = PyObject_Length(__pyx_v_strings); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 < 1); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/_seqmapping.pyx":70 + * + * # Length of result + * text_len = len( strings[0] ) # <<<<<<<<<<<<<< + * + * # Init result array + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_strings, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_text_len = __pyx_t_1; + + /* "bx/_seqmapping.pyx":73 + * + * # Init result array + * rval = zeros( text_len, 'i' ) # <<<<<<<<<<<<<< + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + * + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_text_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_rval = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/_seqmapping.pyx":74 + * # Init result array + * rval = zeros( text_len, 'i' ) + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) # <<<<<<<<<<<<<< + * + * # Loop over seqs and accumulate result values + */ + __pyx_t_6 = PyObject_AsWriteBuffer(__pyx_v_rval, ((void **)(&__pyx_v_t_buf)), (&__pyx_v_t_len)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":77 + * + * # Loop over seqs and accumulate result values + * factor = 1 # <<<<<<<<<<<<<< + * for string in strings: + * PyString_AsStringAndSize( string, &s_buf, &s_len ) + */ + __pyx_v_factor = 1; + + /* "bx/_seqmapping.pyx":78 + * # Loop over seqs and accumulate result values + * factor = 1 + * for string in strings: # <<<<<<<<<<<<<< + * PyString_AsStringAndSize( string, &s_buf, &s_len ) + * for i from 0 <= i < text_len: + */ + if (PyList_CheckExact(__pyx_v_strings) || PyTuple_CheckExact(__pyx_v_strings)) { + __pyx_t_4 = __pyx_v_strings; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_strings); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; + } else if (PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; + } else { + __pyx_t_5 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_string); + __pyx_v_string = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/_seqmapping.pyx":79 + * factor = 1 + * for string in strings: + * PyString_AsStringAndSize( string, &s_buf, &s_len ) # <<<<<<<<<<<<<< + * for i from 0 <= i < text_len: + * if t_buf[i] >= 0: + */ + __pyx_t_6 = PyString_AsStringAndSize(__pyx_v_string, ((char **)(&__pyx_v_s_buf)), (&__pyx_v_s_len)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":80 + * for string in strings: + * PyString_AsStringAndSize( string, &s_buf, &s_len ) + * for i from 0 <= i < text_len: # <<<<<<<<<<<<<< + * if t_buf[i] >= 0: + * if self.table[ s_buf[i] ] == -1: + */ + __pyx_t_6 = __pyx_v_text_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":81 + * PyString_AsStringAndSize( string, &s_buf, &s_len ) + * for i from 0 <= i < text_len: + * if t_buf[i] >= 0: # <<<<<<<<<<<<<< + * if self.table[ s_buf[i] ] == -1: + * t_buf[i] = -1 + */ + __pyx_t_2 = ((__pyx_v_t_buf[__pyx_v_i]) >= 0); + if (__pyx_t_2) { + + /* "bx/_seqmapping.pyx":82 + * for i from 0 <= i < text_len: + * if t_buf[i] >= 0: + * if self.table[ s_buf[i] ] == -1: # <<<<<<<<<<<<<< + * t_buf[i] = -1 + * else: + */ + __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]) == -1); + if (__pyx_t_2) { + + /* "bx/_seqmapping.pyx":83 + * if t_buf[i] >= 0: + * if self.table[ s_buf[i] ] == -1: + * t_buf[i] = -1 # <<<<<<<<<<<<<< + * else: + * t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor ) + */ + (__pyx_v_t_buf[__pyx_v_i]) = -1; + goto __pyx_L11; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":85 + * t_buf[i] = -1 + * else: + * t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor ) # <<<<<<<<<<<<<< + * factor = factor * self.out_size + * return rval + */ + (__pyx_v_t_buf[__pyx_v_i]) = ((__pyx_v_t_buf[__pyx_v_i]) + ((((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]) * __pyx_v_factor)); + } + __pyx_L11:; + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "bx/_seqmapping.pyx":86 + * else: + * t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor ) + * factor = factor * self.out_size # <<<<<<<<<<<<<< + * return rval + * + */ + __pyx_v_factor = (__pyx_v_factor * ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/_seqmapping.pyx":87 + * t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor ) + * factor = factor * self.out_size + * return rval # <<<<<<<<<<<<<< + * + * def reverse_map( self, val, nseqs ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.translate_list", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_string); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":89 + * return rval + * + * def reverse_map( self, val, nseqs ): # <<<<<<<<<<<<<< + * factor = self.out_size ** (nseqs-1) + * rval = [] + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_5reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_5reverse_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_val = 0; + PyObject *__pyx_v_nseqs = 0; + PyObject *__pyx_v_factor = NULL; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__val,&__pyx_n_s__nseqs,0}; + __Pyx_RefNannySetupContext("reverse_map"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nseqs); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("reverse_map", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "reverse_map") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_val = values[0]; + __pyx_v_nseqs = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("reverse_map", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.reverse_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_val); + + /* "bx/_seqmapping.pyx":90 + * + * def reverse_map( self, val, nseqs ): + * factor = self.out_size ** (nseqs-1) # <<<<<<<<<<<<<< + * rval = [] + * while factor > 0: + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_v_nseqs, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Power(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_factor = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":91 + * def reverse_map( self, val, nseqs ): + * factor = self.out_size ** (nseqs-1) + * rval = [] # <<<<<<<<<<<<<< + * while factor > 0: + * rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_v_rval = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":92 + * factor = self.out_size ** (nseqs-1) + * rval = [] + * while factor > 0: # <<<<<<<<<<<<<< + * rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) + * val = val - ( floor(val/factor) * factor ) + */ + while (1) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_factor, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_4) break; + + /* "bx/_seqmapping.pyx":93 + * rval = [] + * while factor > 0: + * rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) # <<<<<<<<<<<<<< + * val = val - ( floor(val/factor) * factor ) + * factor = floor( factor / self.out_size ) + */ + if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__floor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_val, __pyx_v_factor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->reverse_table, __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = PyList_Append(__pyx_v_rval, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/_seqmapping.pyx":94 + * while factor > 0: + * rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) + * val = val - ( floor(val/factor) * factor ) # <<<<<<<<<<<<<< + * factor = floor( factor / self.out_size ) + * rval.reverse() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__floor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_val, __pyx_v_factor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_factor); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_v_val, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_val); + __pyx_v_val = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/_seqmapping.pyx":95 + * rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) + * val = val - ( floor(val/factor) * factor ) + * factor = floor( factor / self.out_size ) # <<<<<<<<<<<<<< + * rval.reverse() + * return rval + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__floor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_factor, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_factor); + __pyx_v_factor = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "bx/_seqmapping.pyx":96 + * val = val - ( floor(val/factor) * factor ) + * factor = floor( factor / self.out_size ) + * rval.reverse() # <<<<<<<<<<<<<< + * return rval + * + */ + if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "reverse"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_Reverse(__pyx_v_rval); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":97 + * factor = floor( factor / self.out_size ) + * rval.reverse() + * return rval # <<<<<<<<<<<<<< + * + * def get_out_size( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.reverse_map", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_factor); + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_val); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":99 + * return rval + * + * def get_out_size( self ): # <<<<<<<<<<<<<< + * return self.out_size + * + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_out_size"); + + /* "bx/_seqmapping.pyx":100 + * + * def get_out_size( self ): + * return self.out_size # <<<<<<<<<<<<<< + * + * cdef class IntToIntMapping: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx._seqmapping.CharToIntArrayMapping.get_out_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":108 + * cdef int out_size + * + * def __cinit__( self, int in_size ): # <<<<<<<<<<<<<< + * self.in_size = in_size + * self.table = malloc( in_size * sizeof( int ) ) + */ + +static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_in_size; + long __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_size,0}; + __Pyx_RefNannySetupContext("__cinit__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_size); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_in_size = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_in_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":109 + * + * def __cinit__( self, int in_size ): + * self.in_size = in_size # <<<<<<<<<<<<<< + * self.table = malloc( in_size * sizeof( int ) ) + * if self.table == NULL: raise "Malloc Failed" + */ + ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size = __pyx_v_in_size; + + /* "bx/_seqmapping.pyx":110 + * def __cinit__( self, int in_size ): + * self.in_size = in_size + * self.table = malloc( in_size * sizeof( int ) ) # <<<<<<<<<<<<<< + * if self.table == NULL: raise "Malloc Failed" + * for i from 0 <= i < in_size: self.table[i] = -1 + */ + ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table = ((int *)malloc((__pyx_v_in_size * (sizeof(int))))); + + /* "bx/_seqmapping.pyx":111 + * self.in_size = in_size + * self.table = malloc( in_size * sizeof( int ) ) + * if self.table == NULL: raise "Malloc Failed" # <<<<<<<<<<<<<< + * for i from 0 <= i < in_size: self.table[i] = -1 + * self.out_size = 0 + */ + __pyx_t_1 = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table == NULL); + if (__pyx_t_1) { + __Pyx_Raise(((PyObject *)__pyx_kp_s_1), 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/_seqmapping.pyx":112 + * self.table = malloc( in_size * sizeof( int ) ) + * if self.table == NULL: raise "Malloc Failed" + * for i from 0 <= i < in_size: self.table[i] = -1 # <<<<<<<<<<<<<< + * self.out_size = 0 + * + */ + __pyx_t_2 = __pyx_v_in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) = -1; + } + + /* "bx/_seqmapping.pyx":113 + * if self.table == NULL: raise "Malloc Failed" + * for i from 0 <= i < in_size: self.table[i] = -1 + * self.out_size = 0 # <<<<<<<<<<<<<< + * + * def __dealloc__( self ): + */ + ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":115 + * self.out_size = 0 + * + * def __dealloc__( self ): # <<<<<<<<<<<<<< + * # sys.stderr.write( "freeing mapping_helper.IntToIntMapping\n" ); sys.stderr.flush() + * free( self.table ) + */ + +static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "bx/_seqmapping.pyx":117 + * def __dealloc__( self ): + * # sys.stderr.write( "freeing mapping_helper.IntToIntMapping\n" ); sys.stderr.flush() + * free( self.table ) # <<<<<<<<<<<<<< + * + * def set_mapping( self, int index, int symbol ): + */ + free(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table); + + __Pyx_RefNannyFinishContext(); +} + +/* "bx/_seqmapping.pyx":119 + * free( self.table ) + * + * def set_mapping( self, int index, int symbol ): # <<<<<<<<<<<<<< + * assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size ) + * self.table[index] = symbol + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2set_mapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_index; + int __pyx_v_symbol; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__symbol,0}; + __Pyx_RefNannySetupContext("set_mapping"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__symbol); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_mapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_index = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_symbol = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_symbol == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_mapping", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.set_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":120 + * + * def set_mapping( self, int index, int symbol ): + * assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size ) # <<<<<<<<<<<<<< + * self.table[index] = symbol + * if self.out_size <= symbol: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = (-1 <= __pyx_v_index); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_index < ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); + } + if (unlikely(!__pyx_t_1)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/_seqmapping.pyx":121 + * def set_mapping( self, int index, int symbol ): + * assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size ) + * self.table[index] = symbol # <<<<<<<<<<<<<< + * if self.out_size <= symbol: + * self.out_size = symbol + 1 + */ + (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_index]) = __pyx_v_symbol; + + /* "bx/_seqmapping.pyx":122 + * assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size ) + * self.table[index] = symbol + * if self.out_size <= symbol: # <<<<<<<<<<<<<< + * self.out_size = symbol + 1 + * + */ + __pyx_t_1 = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size <= __pyx_v_symbol); + if (__pyx_t_1) { + + /* "bx/_seqmapping.pyx":123 + * self.table[index] = symbol + * if self.out_size <= symbol: + * self.out_size = symbol + 1 # <<<<<<<<<<<<<< + * + * def translate( self, src ): + */ + ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size = (__pyx_v_symbol + 1); + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.set_mapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":125 + * self.out_size = symbol + 1 + * + * def translate( self, src ): # <<<<<<<<<<<<<< + * """Translate `string` and return as int array""" + * cdef int s_len, t_len + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_3translate[] = "Translate `string` and return as int array"; +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_3translate(PyObject *__pyx_v_self, PyObject *__pyx_v_src) { + int __pyx_v_s_len; + int __pyx_v_t_len; + int *__pyx_v_s_buf; + int *__pyx_v_t_buf; + PyObject *__pyx_v_rval = NULL; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + size_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate"); + + /* "bx/_seqmapping.pyx":130 + * cdef int *s_buf, *t_buf + * # Get direct access to string + * PyObject_AsReadBuffer( src, &s_buf, &s_len ) # <<<<<<<<<<<<<< + * s_len = s_len / sizeof( int ) + * assert s_len == len( src ), "`src` argument must be a buffer of 32bit integers" + */ + __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_src, ((void **)(&__pyx_v_s_buf)), (&__pyx_v_s_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":131 + * # Get direct access to string + * PyObject_AsReadBuffer( src, &s_buf, &s_len ) + * s_len = s_len / sizeof( int ) # <<<<<<<<<<<<<< + * assert s_len == len( src ), "`src` argument must be a buffer of 32bit integers" + * # Initialize empty array + */ + __pyx_t_2 = (sizeof(int)); + if (unlikely(__pyx_t_2 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_s_len = (__pyx_v_s_len / __pyx_t_2); + + /* "bx/_seqmapping.pyx":132 + * PyObject_AsReadBuffer( src, &s_buf, &s_len ) + * s_len = s_len / sizeof( int ) + * assert s_len == len( src ), "`src` argument must be a buffer of 32bit integers" # <<<<<<<<<<<<<< + * # Initialize empty array + * rval = zeros( s_len, 'i' ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_3 = PyObject_Length(__pyx_v_src); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!(__pyx_v_s_len == __pyx_t_3))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_3)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/_seqmapping.pyx":134 + * assert s_len == len( src ), "`src` argument must be a buffer of 32bit integers" + * # Initialize empty array + * rval = zeros( s_len, 'i' ) # <<<<<<<<<<<<<< + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + * # Translate + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_s_len); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_rval = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/_seqmapping.pyx":135 + * # Initialize empty array + * rval = zeros( s_len, 'i' ) + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) # <<<<<<<<<<<<<< + * # Translate + * for i from 0 <= i < s_len: + */ + __pyx_t_1 = PyObject_AsWriteBuffer(__pyx_v_rval, ((void **)(&__pyx_v_t_buf)), (&__pyx_v_t_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/_seqmapping.pyx":137 + * PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + * # Translate + * for i from 0 <= i < s_len: # <<<<<<<<<<<<<< + * if s_buf[i] == -1: + * t_buf[i] = -1 + */ + __pyx_t_1 = __pyx_v_s_len; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":138 + * # Translate + * for i from 0 <= i < s_len: + * if s_buf[i] == -1: # <<<<<<<<<<<<<< + * t_buf[i] = -1 + * elif s_buf[i] >= self.in_size: + */ + __pyx_t_7 = ((__pyx_v_s_buf[__pyx_v_i]) == -1); + if (__pyx_t_7) { + + /* "bx/_seqmapping.pyx":139 + * for i from 0 <= i < s_len: + * if s_buf[i] == -1: + * t_buf[i] = -1 # <<<<<<<<<<<<<< + * elif s_buf[i] >= self.in_size: + * t_buf[i] = -1 + */ + (__pyx_v_t_buf[__pyx_v_i]) = -1; + goto __pyx_L7; + } + + /* "bx/_seqmapping.pyx":140 + * if s_buf[i] == -1: + * t_buf[i] = -1 + * elif s_buf[i] >= self.in_size: # <<<<<<<<<<<<<< + * t_buf[i] = -1 + * else: + */ + __pyx_t_7 = ((__pyx_v_s_buf[__pyx_v_i]) >= ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); + if (__pyx_t_7) { + + /* "bx/_seqmapping.pyx":141 + * t_buf[i] = -1 + * elif s_buf[i] >= self.in_size: + * t_buf[i] = -1 # <<<<<<<<<<<<<< + * else: + * t_buf[i] = self.table[ s_buf[ i ] ] + */ + (__pyx_v_t_buf[__pyx_v_i]) = -1; + goto __pyx_L7; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":143 + * t_buf[i] = -1 + * else: + * t_buf[i] = self.table[ s_buf[ i ] ] # <<<<<<<<<<<<<< + * # Done + * return rval + */ + (__pyx_v_t_buf[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[(__pyx_v_s_buf[__pyx_v_i])]); + } + __pyx_L7:; + } + + /* "bx/_seqmapping.pyx":145 + * t_buf[i] = self.table[ s_buf[ i ] ] + * # Done + * return rval # <<<<<<<<<<<<<< + * + * def __getitem__( self, int x ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":147 + * return rval + * + * def __getitem__( self, int x ): # <<<<<<<<<<<<<< + * if x == -1: return -1 + * assert 0 <= x < self.in_size + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyInt_AsInt(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":148 + * + * def __getitem__( self, int x ): + * if x == -1: return -1 # <<<<<<<<<<<<<< + * assert 0 <= x < self.in_size + * return self.table[ x ] + */ + __pyx_t_1 = (__pyx_v_x == -1); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/_seqmapping.pyx":149 + * def __getitem__( self, int x ): + * if x == -1: return -1 + * assert 0 <= x < self.in_size # <<<<<<<<<<<<<< + * return self.table[ x ] + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = (0 <= __pyx_v_x); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_x < ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); + } + if (unlikely(!__pyx_t_1)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/_seqmapping.pyx":150 + * if x == -1: return -1 + * assert 0 <= x < self.in_size + * return self.table[ x ] # <<<<<<<<<<<<<< + * + * def collapse( self, int a, int b ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":152 + * return self.table[ x ] + * + * def collapse( self, int a, int b ): # <<<<<<<<<<<<<< + * cdef int i + * cdef IntToIntMapping copy + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_5collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_5collapse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_a; + int __pyx_v_b; + int __pyx_v_i; + struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__b,0}; + __Pyx_RefNannySetupContext("collapse"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("collapse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "collapse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_a = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_b = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_b == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("collapse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.collapse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":155 + * cdef int i + * cdef IntToIntMapping copy + * copy = IntToIntMapping( self.in_size ) # <<<<<<<<<<<<<< + * copy.out_size = self.out_size - 1 + * if a > b: a, b = b, a + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_11_seqmapping_IntToIntMapping)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_copy = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/_seqmapping.pyx":156 + * cdef IntToIntMapping copy + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size - 1 # <<<<<<<<<<<<<< + * if a > b: a, b = b, a + * for i from 0 <= i < self.in_size: + */ + __pyx_v_copy->out_size = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size - 1); + + /* "bx/_seqmapping.pyx":157 + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size - 1 + * if a > b: a, b = b, a # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == b: copy.table[i] = a + */ + __pyx_t_3 = (__pyx_v_a > __pyx_v_b); + if (__pyx_t_3) { + __pyx_t_4 = __pyx_v_b; + __pyx_t_5 = __pyx_v_a; + __pyx_v_a = __pyx_t_4; + __pyx_v_b = __pyx_t_5; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/_seqmapping.pyx":158 + * copy.out_size = self.out_size - 1 + * if a > b: a, b = b, a + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == b: copy.table[i] = a + * elif self.table[i] == copy.out_size: copy.table[i] = b + */ + __pyx_t_5 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":159 + * if a > b: a, b = b, a + * for i from 0 <= i < self.in_size: + * if self.table[i] == b: copy.table[i] = a # <<<<<<<<<<<<<< + * elif self.table[i] == copy.out_size: copy.table[i] = b + * else: copy.table[i] = self.table[i] + */ + __pyx_t_3 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_b); + if (__pyx_t_3) { + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_a; + goto __pyx_L9; + } + + /* "bx/_seqmapping.pyx":160 + * for i from 0 <= i < self.in_size: + * if self.table[i] == b: copy.table[i] = a + * elif self.table[i] == copy.out_size: copy.table[i] = b # <<<<<<<<<<<<<< + * else: copy.table[i] = self.table[i] + * return copy + */ + __pyx_t_3 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_copy->out_size); + if (__pyx_t_3) { + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_b; + goto __pyx_L9; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":161 + * if self.table[i] == b: copy.table[i] = a + * elif self.table[i] == copy.out_size: copy.table[i] = b + * else: copy.table[i] = self.table[i] # <<<<<<<<<<<<<< + * return copy + * + */ + (__pyx_v_copy->table[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]); + } + __pyx_L9:; + } + + /* "bx/_seqmapping.pyx":162 + * elif self.table[i] == copy.out_size: copy.table[i] = b + * else: copy.table[i] = self.table[i] + * return copy # <<<<<<<<<<<<<< + * + * def expand( self, int x ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_copy)); + __pyx_r = ((PyObject *)__pyx_v_copy); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.collapse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_copy); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":164 + * return copy + * + * def expand( self, int x ): # <<<<<<<<<<<<<< + * """Grow the alphabet by making 'a' a seperate symbol. If it already mapped to a single symbol, do nothing""" + * cdef int i, count, a, b + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_6expand[] = "Grow the alphabet by making 'a' a seperate symbol. If it already mapped to a single symbol, do nothing"; +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6expand(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) { + int __pyx_v_x; + int __pyx_v_i; + int __pyx_v_count; + int __pyx_v_a; + struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("expand"); + assert(__pyx_arg_x); { + __pyx_v_x = __Pyx_PyInt_AsInt(__pyx_arg_x); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":169 + * cdef IntToIntMapping copy + * # Get the symbol x maps to + * a = self.table[x] # <<<<<<<<<<<<<< + * # Symbols that map to -1 should not be touched + * if a < 0: return self + */ + __pyx_v_a = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_x]); + + /* "bx/_seqmapping.pyx":171 + * a = self.table[x] + * # Symbols that map to -1 should not be touched + * if a < 0: return self # <<<<<<<<<<<<<< + * # Count how many other input symbols map to a + * count = 0 + */ + __pyx_t_1 = (__pyx_v_a < 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/_seqmapping.pyx":173 + * if a < 0: return self + * # Count how many other input symbols map to a + * count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 + */ + __pyx_v_count = 0; + + /* "bx/_seqmapping.pyx":174 + * # Count how many other input symbols map to a + * count = 0 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == a: count = count + 1 + * # Already a singleton + */ + __pyx_t_2 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":175 + * count = 0 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 # <<<<<<<<<<<<<< + * # Already a singleton + * if count < 2: return self + */ + __pyx_t_1 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a); + if (__pyx_t_1) { + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L8; + } + __pyx_L8:; + } + + /* "bx/_seqmapping.pyx":177 + * if self.table[i] == a: count = count + 1 + * # Already a singleton + * if count < 2: return self # <<<<<<<<<<<<<< + * # Otherwise, make a copy with the separated symbol + * copy = IntToIntMapping( self.in_size ) + */ + __pyx_t_1 = (__pyx_v_count < 2); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/_seqmapping.pyx":179 + * if count < 2: return self + * # Otherwise, make a copy with the separated symbol + * copy = IntToIntMapping( self.in_size ) # <<<<<<<<<<<<<< + * copy.out_size = self.out_size + 1 + * for i from 0 <= i < self.in_size: + */ + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_11_seqmapping_IntToIntMapping)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_copy = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":180 + * # Otherwise, make a copy with the separated symbol + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * copy.table[i] = self.table[i] + */ + __pyx_v_copy->out_size = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size + 1); + + /* "bx/_seqmapping.pyx":181 + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * copy.table[i] = self.table[i] + * copy.table[x] = self.out_size + */ + __pyx_t_2 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":182 + * copy.out_size = self.out_size + 1 + * for i from 0 <= i < self.in_size: + * copy.table[i] = self.table[i] # <<<<<<<<<<<<<< + * copy.table[x] = self.out_size + * return copy + */ + (__pyx_v_copy->table[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]); + } + + /* "bx/_seqmapping.pyx":183 + * for i from 0 <= i < self.in_size: + * copy.table[i] = self.table[i] + * copy.table[x] = self.out_size # <<<<<<<<<<<<<< + * return copy + * + */ + (__pyx_v_copy->table[__pyx_v_x]) = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size; + + /* "bx/_seqmapping.pyx":184 + * copy.table[i] = self.table[i] + * copy.table[x] = self.out_size + * return copy # <<<<<<<<<<<<<< + * + * def expand_out( self, int a ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_copy)); + __pyx_r = ((PyObject *)__pyx_v_copy); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_copy); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":186 + * return copy + * + * def expand_out( self, int a ): # <<<<<<<<<<<<<< + * """Grow the alphabet breaking 'a' into two symbols randomly""" + * cdef int i, count, to_split, b + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_7expand_out(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_7expand_out[] = "Grow the alphabet breaking 'a' into two symbols randomly"; +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_7expand_out(PyObject *__pyx_v_self, PyObject *__pyx_arg_a) { + int __pyx_v_a; + int __pyx_v_i; + int __pyx_v_count; + int __pyx_v_to_split; + int __pyx_v_b; + struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("expand_out"); + assert(__pyx_arg_a); { + __pyx_v_a = __Pyx_PyInt_AsInt(__pyx_arg_a); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand_out", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":190 + * cdef int i, count, to_split, b + * cdef IntToIntMapping copy + * count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 + */ + __pyx_v_count = 0; + + /* "bx/_seqmapping.pyx":191 + * cdef IntToIntMapping copy + * count = 0 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == a: count = count + 1 + * if count < 2: return self + */ + __pyx_t_1 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":192 + * count = 0 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 # <<<<<<<<<<<<<< + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) + */ + __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a); + if (__pyx_t_2) { + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "bx/_seqmapping.pyx":193 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 + * if count < 2: return self # <<<<<<<<<<<<<< + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 + */ + __pyx_t_2 = (__pyx_v_count < 2); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/_seqmapping.pyx":194 + * if self.table[i] == a: count = count + 1 + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) # <<<<<<<<<<<<<< + * copy.out_size = self.out_size + 1 + * b = self.out_size + */ + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_11_seqmapping_IntToIntMapping)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_copy = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":195 + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 # <<<<<<<<<<<<<< + * b = self.out_size + * to_split = random.randrange( count ) + */ + __pyx_v_copy->out_size = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size + 1); + + /* "bx/_seqmapping.pyx":196 + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 + * b = self.out_size # <<<<<<<<<<<<<< + * to_split = random.randrange( count ) + * count = 0 + */ + __pyx_v_b = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size; + + /* "bx/_seqmapping.pyx":197 + * copy.out_size = self.out_size + 1 + * b = self.out_size + * to_split = random.randrange( count ) # <<<<<<<<<<<<<< + * count = 0 + * for i from 0 <= i < self.in_size: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__randrange); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_to_split = __pyx_t_1; + + /* "bx/_seqmapping.pyx":198 + * b = self.out_size + * to_split = random.randrange( count ) + * count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: + */ + __pyx_v_count = 0; + + /* "bx/_seqmapping.pyx":199 + * to_split = random.randrange( count ) + * count = 0 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == a: + * if count == to_split: copy.table[i] = b + */ + __pyx_t_1 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":200 + * count = 0 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: # <<<<<<<<<<<<<< + * if count == to_split: copy.table[i] = b + * else: copy.table[i] = a + */ + __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a); + if (__pyx_t_2) { + + /* "bx/_seqmapping.pyx":201 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: + * if count == to_split: copy.table[i] = b # <<<<<<<<<<<<<< + * else: copy.table[i] = a + * count = count + 1 + */ + __pyx_t_2 = (__pyx_v_count == __pyx_v_to_split); + if (__pyx_t_2) { + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_b; + goto __pyx_L12; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":202 + * if self.table[i] == a: + * if count == to_split: copy.table[i] = b + * else: copy.table[i] = a # <<<<<<<<<<<<<< + * count = count + 1 + * else: + */ + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_a; + } + __pyx_L12:; + + /* "bx/_seqmapping.pyx":203 + * if count == to_split: copy.table[i] = b + * else: copy.table[i] = a + * count = count + 1 # <<<<<<<<<<<<<< + * else: + * copy.table[i] = self.table[i] + */ + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":205 + * count = count + 1 + * else: + * copy.table[i] = self.table[i] # <<<<<<<<<<<<<< + * return copy + * + */ + (__pyx_v_copy->table[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]); + } + __pyx_L11:; + } + + /* "bx/_seqmapping.pyx":206 + * else: + * copy.table[i] = self.table[i] + * return copy # <<<<<<<<<<<<<< + * + * def expand_random_split( self, int a ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_copy)); + __pyx_r = ((PyObject *)__pyx_v_copy); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand_out", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_copy); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":208 + * return copy + * + * def expand_random_split( self, int a ): # <<<<<<<<<<<<<< + * """Grow the alphabet breaking 'a' into two symbols randomly""" + * cdef int i, count, b + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8expand_random_split(PyObject *__pyx_v_self, PyObject *__pyx_arg_a); /*proto*/ +static char __pyx_doc_2bx_11_seqmapping_15IntToIntMapping_8expand_random_split[] = "Grow the alphabet breaking 'a' into two symbols randomly"; +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8expand_random_split(PyObject *__pyx_v_self, PyObject *__pyx_arg_a) { + int __pyx_v_a; + int __pyx_v_i; + int __pyx_v_count; + int __pyx_v_b; + struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *__pyx_v_copy = 0; + PyObject *__pyx_v_to_split = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("expand_random_split"); + assert(__pyx_arg_a); { + __pyx_v_a = __Pyx_PyInt_AsInt(__pyx_arg_a); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand_random_split", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/_seqmapping.pyx":212 + * cdef int i, count, b + * cdef IntToIntMapping copy + * count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 + */ + __pyx_v_count = 0; + + /* "bx/_seqmapping.pyx":213 + * cdef IntToIntMapping copy + * count = 0 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == a: count = count + 1 + * if count < 2: return self + */ + __pyx_t_1 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":214 + * count = 0 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 # <<<<<<<<<<<<<< + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) + */ + __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a); + if (__pyx_t_2) { + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "bx/_seqmapping.pyx":215 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: count = count + 1 + * if count < 2: return self # <<<<<<<<<<<<<< + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 + */ + __pyx_t_2 = (__pyx_v_count < 2); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/_seqmapping.pyx":216 + * if self.table[i] == a: count = count + 1 + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) # <<<<<<<<<<<<<< + * copy.out_size = self.out_size + 1 + * b = self.out_size + */ + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_11_seqmapping_IntToIntMapping)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_copy = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/_seqmapping.pyx":217 + * if count < 2: return self + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 # <<<<<<<<<<<<<< + * b = self.out_size + * to_split = random.sample( range( count ), count/2 ) + */ + __pyx_v_copy->out_size = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size + 1); + + /* "bx/_seqmapping.pyx":218 + * copy = IntToIntMapping( self.in_size ) + * copy.out_size = self.out_size + 1 + * b = self.out_size # <<<<<<<<<<<<<< + * to_split = random.sample( range( count ), count/2 ) + * count = 0 + */ + __pyx_v_b = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size; + + /* "bx/_seqmapping.pyx":219 + * copy.out_size = self.out_size + 1 + * b = self.out_size + * to_split = random.sample( range( count ), count/2 ) # <<<<<<<<<<<<<< + * count = 0 + * for i from 0 <= i < self.in_size: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sample); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(__Pyx_div_long(__pyx_v_count, 2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_to_split = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/_seqmapping.pyx":220 + * b = self.out_size + * to_split = random.sample( range( count ), count/2 ) + * count = 0 # <<<<<<<<<<<<<< + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: + */ + __pyx_v_count = 0; + + /* "bx/_seqmapping.pyx":221 + * to_split = random.sample( range( count ), count/2 ) + * count = 0 + * for i from 0 <= i < self.in_size: # <<<<<<<<<<<<<< + * if self.table[i] == a: + * if count in to_split: copy.table[i] = b + */ + __pyx_t_1 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/_seqmapping.pyx":222 + * count = 0 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: # <<<<<<<<<<<<<< + * if count in to_split: copy.table[i] = b + * else: copy.table[i] = a + */ + __pyx_t_2 = ((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]) == __pyx_v_a); + if (__pyx_t_2) { + + /* "bx/_seqmapping.pyx":223 + * for i from 0 <= i < self.in_size: + * if self.table[i] == a: + * if count in to_split: copy.table[i] = b # <<<<<<<<<<<<<< + * else: copy.table[i] = a + * count = count + 1 + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = ((PySequence_Contains(__pyx_v_to_split, __pyx_t_5))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_b; + goto __pyx_L12; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":224 + * if self.table[i] == a: + * if count in to_split: copy.table[i] = b + * else: copy.table[i] = a # <<<<<<<<<<<<<< + * count = count + 1 + * else: + */ + (__pyx_v_copy->table[__pyx_v_i]) = __pyx_v_a; + } + __pyx_L12:; + + /* "bx/_seqmapping.pyx":225 + * if count in to_split: copy.table[i] = b + * else: copy.table[i] = a + * count = count + 1 # <<<<<<<<<<<<<< + * else: + * copy.table[i] = self.table[i] + */ + __pyx_v_count = (__pyx_v_count + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "bx/_seqmapping.pyx":227 + * count = count + 1 + * else: + * copy.table[i] = self.table[i] # <<<<<<<<<<<<<< + * return copy + * + */ + (__pyx_v_copy->table[__pyx_v_i]) = (((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i]); + } + __pyx_L11:; + } + + /* "bx/_seqmapping.pyx":228 + * else: + * copy.table[i] = self.table[i] + * return copy # <<<<<<<<<<<<<< + * + * def get_in_size( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_copy)); + __pyx_r = ((PyObject *)__pyx_v_copy); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.expand_random_split", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_copy); + __Pyx_XDECREF(__pyx_v_to_split); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":230 + * return copy + * + * def get_in_size( self ): # <<<<<<<<<<<<<< + * return self.in_size + * + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_9get_in_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_9get_in_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_in_size"); + + /* "bx/_seqmapping.pyx":231 + * + * def get_in_size( self ): + * return self.in_size # <<<<<<<<<<<<<< + * + * def get_out_size( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.get_in_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":233 + * return self.in_size + * + * def get_out_size( self ): # <<<<<<<<<<<<<< + * return self.out_size + * + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10get_out_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_out_size"); + + /* "bx/_seqmapping.pyx":234 + * + * def get_out_size( self ): + * return self.out_size # <<<<<<<<<<<<<< + * + * def get_table( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->out_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.get_out_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/_seqmapping.pyx":236 + * return self.out_size + * + * def get_table( self ): # <<<<<<<<<<<<<< + * rval = zeros( self.in_size, 'i' ) + * for i in range( self.in_size ): + */ + +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_11get_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_11get_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_v_rval = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_table"); + + /* "bx/_seqmapping.pyx":237 + * + * def get_table( self ): + * rval = zeros( self.in_size, 'i' ) # <<<<<<<<<<<<<< + * for i in range( self.in_size ): + * rval[i] = self.table[i] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_rval = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/_seqmapping.pyx":238 + * def get_table( self ): + * rval = zeros( self.in_size, 'i' ) + * for i in range( self.in_size ): # <<<<<<<<<<<<<< + * rval[i] = self.table[i] + * return rval + */ + __pyx_t_4 = ((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->in_size; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "bx/_seqmapping.pyx":239 + * rval = zeros( self.in_size, 'i' ) + * for i in range( self.in_size ): + * rval[i] = self.table[i] # <<<<<<<<<<<<<< + * return rval + * + */ + __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping *)__pyx_v_self)->table[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(__pyx_v_rval, __pyx_v_i, __pyx_t_2, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "bx/_seqmapping.pyx":240 + * for i in range( self.in_size ): + * rval[i] = self.table[i] + * return rval # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx._seqmapping.IntToIntMapping.get_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_11_seqmapping_CharToIntArrayMapping(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)o); + p->reverse_table = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_11_seqmapping_CharToIntArrayMapping(PyObject *o) { + struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *p = (struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)o; + Py_XDECREF(p->reverse_table); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_11_seqmapping_CharToIntArrayMapping(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *p = (struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)o; + if (p->reverse_table) { + e = (*v)(p->reverse_table, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_11_seqmapping_CharToIntArrayMapping(PyObject *o) { + struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *p = (struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping *)o; + PyObject* tmp; + tmp = ((PyObject*)p->reverse_table); + p->reverse_table = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_11_seqmapping_CharToIntArrayMapping[] = { + {__Pyx_NAMESTR("set_mapping"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_2set_mapping)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_3translate, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_3translate)}, + {__Pyx_NAMESTR("translate_list"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_21CharToIntArrayMapping_4translate_list)}, + {__Pyx_NAMESTR("reverse_map"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_5reverse_map, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_out_size"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_6get_out_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_CharToIntArrayMapping = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_CharToIntArrayMapping = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_CharToIntArrayMapping = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_CharToIntArrayMapping = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_11_seqmapping_CharToIntArrayMapping = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx._seqmapping.CharToIntArrayMapping"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_11_seqmapping_CharToIntArrayMapping), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_11_seqmapping_CharToIntArrayMapping, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_CharToIntArrayMapping, /*tp_as_number*/ + &__pyx_tp_as_sequence_CharToIntArrayMapping, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_CharToIntArrayMapping, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_CharToIntArrayMapping, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Mapping for converting strings to int arrays"), /*tp_doc*/ + __pyx_tp_traverse_2bx_11_seqmapping_CharToIntArrayMapping, /*tp_traverse*/ + __pyx_tp_clear_2bx_11_seqmapping_CharToIntArrayMapping, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_11_seqmapping_CharToIntArrayMapping, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_11_seqmapping_21CharToIntArrayMapping_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_11_seqmapping_CharToIntArrayMapping, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_11_seqmapping_IntToIntMapping(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_2bx_11_seqmapping_15IntToIntMapping___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_11_seqmapping_IntToIntMapping(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_2bx_11_seqmapping_IntToIntMapping(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_2bx_11_seqmapping_IntToIntMapping[] = { + {__Pyx_NAMESTR("set_mapping"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_2set_mapping, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_3translate, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_15IntToIntMapping_3translate)}, + {__Pyx_NAMESTR("collapse"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_5collapse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("expand"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_6expand, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_15IntToIntMapping_6expand)}, + {__Pyx_NAMESTR("expand_out"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_7expand_out, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_15IntToIntMapping_7expand_out)}, + {__Pyx_NAMESTR("expand_random_split"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_8expand_random_split, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_11_seqmapping_15IntToIntMapping_8expand_random_split)}, + {__Pyx_NAMESTR("get_in_size"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_9get_in_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_out_size"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_10get_out_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_table"), (PyCFunction)__pyx_pf_2bx_11_seqmapping_15IntToIntMapping_11get_table, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntToIntMapping = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntToIntMapping = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_11_seqmapping_IntToIntMapping, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IntToIntMapping = { + 0, /*mp_length*/ + __pyx_pf_2bx_11_seqmapping_15IntToIntMapping_4__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntToIntMapping = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_11_seqmapping_IntToIntMapping = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx._seqmapping.IntToIntMapping"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_11_seqmapping_IntToIntMapping), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_11_seqmapping_IntToIntMapping, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IntToIntMapping, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntToIntMapping, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntToIntMapping, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntToIntMapping, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_11_seqmapping_IntToIntMapping, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_11_seqmapping_IntToIntMapping, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_seqmapping"), + __Pyx_DOCSTR(__pyx_k_4), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1}, + {&__pyx_n_s__floor, __pyx_k__floor, sizeof(__pyx_k__floor), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__in_size, __pyx_k__in_size, sizeof(__pyx_k__in_size), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__math, __pyx_k__math, sizeof(__pyx_k__math), 0, 0, 1, 1}, + {&__pyx_n_s__nseqs, __pyx_k__nseqs, sizeof(__pyx_k__nseqs), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1}, + {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1}, + {&__pyx_n_s__randrange, __pyx_k__randrange, sizeof(__pyx_k__randrange), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__sample, __pyx_k__sample, sizeof(__pyx_k__sample), 0, 0, 1, 1}, + {&__pyx_n_s__symbol, __pyx_k__symbol, sizeof(__pyx_k__symbol), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_seqmapping(void); /*proto*/ +PyMODINIT_FUNC init_seqmapping(void) +#else +PyMODINIT_FUNC PyInit__seqmapping(void); /*proto*/ +PyMODINIT_FUNC PyInit__seqmapping(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__seqmapping(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_seqmapping"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_4), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx___seqmapping) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_11_seqmapping_CharToIntArrayMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "CharToIntArrayMapping", (PyObject *)&__pyx_type_2bx_11_seqmapping_CharToIntArrayMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_11_seqmapping_CharToIntArrayMapping = &__pyx_type_2bx_11_seqmapping_CharToIntArrayMapping; + if (PyType_Ready(&__pyx_type_2bx_11_seqmapping_IntToIntMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntToIntMapping", (PyObject *)&__pyx_type_2bx_11_seqmapping_IntToIntMapping) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_11_seqmapping_IntToIntMapping = &__pyx_type_2bx_11_seqmapping_IntToIntMapping; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/_seqmapping.pyx":14 + * int PyString_AsStringAndSize(object, char **, int *) except -1 + * + * from numpy import zeros # <<<<<<<<<<<<<< + * from math import floor + * import random + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__zeros)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zeros, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/_seqmapping.pyx":15 + * + * from numpy import zeros + * from math import floor # <<<<<<<<<<<<<< + * import random + * import sys + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__floor)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__floor)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__floor)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__math), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__floor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__floor, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/_seqmapping.pyx":16 + * from numpy import zeros + * from math import floor + * import random # <<<<<<<<<<<<<< + * import sys + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__random), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/_seqmapping.pyx":17 + * from math import floor + * import random + * import sys # <<<<<<<<<<<<<< + * + * cdef class CharToIntArrayMapping: + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/_seqmapping.pyx":1 + * """ # <<<<<<<<<<<<<< + * Pyrex extension classes used by `seqmapping.py`. + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx._seqmapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx._seqmapping"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.pyx b/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.pyx new file mode 100755 index 0000000..0fae64d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/_seqmapping.pyx @@ -0,0 +1,241 @@ +""" +Pyrex extension classes used by `seqmapping.py`. +""" + +cdef extern from "stdlib.h": + void* malloc( int ) + void free( void* ) + +cdef extern from "Python.h": + int PyObject_AsReadBuffer(object, void **, int *) except -1 + int PyObject_AsWriteBuffer(object, void **, int *) except -1 + int PyString_AsStringAndSize(object, char **, int *) except -1 + +from numpy import zeros +from math import floor +import random +import sys + +cdef class CharToIntArrayMapping: + """Mapping for converting strings to int arrays""" + + cdef int table[256] + cdef int out_size + cdef object reverse_table + + def __cinit__( self ): + """Init empty mapping (all characters map to -1)""" + cdef int i + for i from 0 <= i < 256: self.table[i] = -1 + self.out_size = 0 + + def __init__( self ): + self.reverse_table = dict() + + def set_mapping( self, c, int symbol ): + """Modify mapping so 'chars' map to 'symbol'""" + char = ord( c ) + self.table[ char ] = symbol + if self.out_size <= symbol: + self.out_size = symbol + 1 + self.reverse_table[ symbol ] = chr( char ) + + def translate( self, string ): + """Translate 'string' and return as int array""" + cdef int s_len, t_len + cdef unsigned char * s_buf + cdef int * t_buf + # Get direct access to string + PyString_AsStringAndSize( string, &s_buf, &s_len ) + # Initialize empty array + rval = zeros( s_len, 'i' ) + PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + # Translate + for i from 0 <= i < s_len: + t_buf[i] = self.table[ s_buf[ i ] ] + # Done + return rval + + def translate_list( self, strings ): + """Translate a list of strings into an int array""" + cdef int text_len, factor, i + cdef int s_len, t_len + cdef unsigned char * s_buf + cdef int * t_buf + + # No input, no output + if len( strings ) < 1: return None + + # Length of result + text_len = len( strings[0] ) + + # Init result array + rval = zeros( text_len, 'i' ) + PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + + # Loop over seqs and accumulate result values + factor = 1 + for string in strings: + PyString_AsStringAndSize( string, &s_buf, &s_len ) + for i from 0 <= i < text_len: + if t_buf[i] >= 0: + if self.table[ s_buf[i] ] == -1: + t_buf[i] = -1 + else: + t_buf[i] = t_buf[i] + ( self.table[ s_buf[i] ] * factor ) + factor = factor * self.out_size + return rval + + def reverse_map( self, val, nseqs ): + factor = self.out_size ** (nseqs-1) + rval = [] + while factor > 0: + rval.append( self.reverse_table[ int( floor( val / factor ) ) ] ) + val = val - ( floor(val/factor) * factor ) + factor = floor( factor / self.out_size ) + rval.reverse() + return rval + + def get_out_size( self ): + return self.out_size + +cdef class IntToIntMapping: + + cdef int* table + cdef int in_size + cdef int out_size + + def __cinit__( self, int in_size ): + self.in_size = in_size + self.table = malloc( in_size * sizeof( int ) ) + if self.table == NULL: raise "Malloc Failed" + for i from 0 <= i < in_size: self.table[i] = -1 + self.out_size = 0 + + def __dealloc__( self ): + # sys.stderr.write( "freeing mapping_helper.IntToIntMapping\n" ); sys.stderr.flush() + free( self.table ) + + def set_mapping( self, int index, int symbol ): + assert ( -1 <= index < self.in_size ), "%d not between 0 and %s" % ( index, self.in_size ) + self.table[index] = symbol + if self.out_size <= symbol: + self.out_size = symbol + 1 + + def translate( self, src ): + """Translate `string` and return as int array""" + cdef int s_len, t_len + cdef int *s_buf, *t_buf + # Get direct access to string + PyObject_AsReadBuffer( src, &s_buf, &s_len ) + s_len = s_len / sizeof( int ) + assert s_len == len( src ), "`src` argument must be a buffer of 32bit integers" + # Initialize empty array + rval = zeros( s_len, 'i' ) + PyObject_AsWriteBuffer( rval, &t_buf, &t_len ) + # Translate + for i from 0 <= i < s_len: + if s_buf[i] == -1: + t_buf[i] = -1 + elif s_buf[i] >= self.in_size: + t_buf[i] = -1 + else: + t_buf[i] = self.table[ s_buf[ i ] ] + # Done + return rval + + def __getitem__( self, int x ): + if x == -1: return -1 + assert 0 <= x < self.in_size + return self.table[ x ] + + def collapse( self, int a, int b ): + cdef int i + cdef IntToIntMapping copy + copy = IntToIntMapping( self.in_size ) + copy.out_size = self.out_size - 1 + if a > b: a, b = b, a + for i from 0 <= i < self.in_size: + if self.table[i] == b: copy.table[i] = a + elif self.table[i] == copy.out_size: copy.table[i] = b + else: copy.table[i] = self.table[i] + return copy + + def expand( self, int x ): + """Grow the alphabet by making 'a' a seperate symbol. If it already mapped to a single symbol, do nothing""" + cdef int i, count, a, b + cdef IntToIntMapping copy + # Get the symbol x maps to + a = self.table[x] + # Symbols that map to -1 should not be touched + if a < 0: return self + # Count how many other input symbols map to a + count = 0 + for i from 0 <= i < self.in_size: + if self.table[i] == a: count = count + 1 + # Already a singleton + if count < 2: return self + # Otherwise, make a copy with the separated symbol + copy = IntToIntMapping( self.in_size ) + copy.out_size = self.out_size + 1 + for i from 0 <= i < self.in_size: + copy.table[i] = self.table[i] + copy.table[x] = self.out_size + return copy + + def expand_out( self, int a ): + """Grow the alphabet breaking 'a' into two symbols randomly""" + cdef int i, count, to_split, b + cdef IntToIntMapping copy + count = 0 + for i from 0 <= i < self.in_size: + if self.table[i] == a: count = count + 1 + if count < 2: return self + copy = IntToIntMapping( self.in_size ) + copy.out_size = self.out_size + 1 + b = self.out_size + to_split = random.randrange( count ) + count = 0 + for i from 0 <= i < self.in_size: + if self.table[i] == a: + if count == to_split: copy.table[i] = b + else: copy.table[i] = a + count = count + 1 + else: + copy.table[i] = self.table[i] + return copy + + def expand_random_split( self, int a ): + """Grow the alphabet breaking 'a' into two symbols randomly""" + cdef int i, count, b + cdef IntToIntMapping copy + count = 0 + for i from 0 <= i < self.in_size: + if self.table[i] == a: count = count + 1 + if count < 2: return self + copy = IntToIntMapping( self.in_size ) + copy.out_size = self.out_size + 1 + b = self.out_size + to_split = random.sample( range( count ), count/2 ) + count = 0 + for i from 0 <= i < self.in_size: + if self.table[i] == a: + if count in to_split: copy.table[i] = b + else: copy.table[i] = a + count = count + 1 + else: + copy.table[i] = self.table[i] + return copy + + def get_in_size( self ): + return self.in_size + + def get_out_size( self ): + return self.out_size + + def get_table( self ): + rval = zeros( self.in_size, 'i' ) + for i in range( self.in_size ): + rval[i] = self.table[i] + return rval + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/align/__init__.py new file mode 100755 index 0000000..96441db --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/__init__.py @@ -0,0 +1,7 @@ +""" +Support for dealing with (genome scale) sequence alignments. See `core` for +the abstract alignment classes and `maf`, `axt`, and `lav` for readers and +writers in various formats. +""" + +from bx.align.core import * diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/_core.c b/code/utilities/CPAT-1.2.2/lib/bx/align/_core.c new file mode 100755 index 0000000..9acfed9 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/_core.c @@ -0,0 +1,1478 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:11 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__align___core +#define __PYX_HAVE_API__bx__align___core +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_core.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.align._core' */ +#define __Pyx_MODULE_NAME "bx.align._core" +int __pyx_module_is_main_bx__align___core = 0; + +/* Implementation of 'bx.align._core' */ +static char __pyx_k_1[] = "\nPyrex extension to speed up some operations in `core.py`.\n"; +static char __pyx_k_2[] = "bx.align._core"; +static char __pyx_k__pos[] = "pos"; +static char __pyx_k__text[] = "text"; +static char __pyx_k__start[] = "start"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__coord_to_col[] = "coord_to_col"; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__coord_to_col; +static PyObject *__pyx_n_s__pos; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__text; + +/* "bx/align/_core.pyx":5 + * """ + * + * def coord_to_col( int start, char * text, int pos ): # <<<<<<<<<<<<<< + * cdef int col + * col = 0 + */ + +static PyObject *__pyx_pf_2bx_5align_5_core_coord_to_col(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_5_core_coord_to_col = {__Pyx_NAMESTR("coord_to_col"), (PyCFunction)__pyx_pf_2bx_5align_5_core_coord_to_col, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_5_core_coord_to_col(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + char *__pyx_v_text; + int __pyx_v_pos; + int __pyx_v_col; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__text,&__pyx_n_s__pos,0}; + __Pyx_RefNannySetupContext("coord_to_col"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("coord_to_col", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("coord_to_col", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "coord_to_col") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_text = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_text) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_pos = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_pos == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("coord_to_col", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align._core.coord_to_col", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/_core.pyx":7 + * def coord_to_col( int start, char * text, int pos ): + * cdef int col + * col = 0 # <<<<<<<<<<<<<< + * while start < pos: + * # Note: ord( '-' ) = 45 + */ + __pyx_v_col = 0; + + /* "bx/align/_core.pyx":8 + * cdef int col + * col = 0 + * while start < pos: # <<<<<<<<<<<<<< + * # Note: ord( '-' ) = 45 + * if text[col] != 45: + */ + while (1) { + __pyx_t_1 = (__pyx_v_start < __pyx_v_pos); + if (!__pyx_t_1) break; + + /* "bx/align/_core.pyx":10 + * while start < pos: + * # Note: ord( '-' ) = 45 + * if text[col] != 45: # <<<<<<<<<<<<<< + * start = start + 1 + * col = col + 1 + */ + __pyx_t_1 = ((__pyx_v_text[__pyx_v_col]) != 45); + if (__pyx_t_1) { + + /* "bx/align/_core.pyx":11 + * # Note: ord( '-' ) = 45 + * if text[col] != 45: + * start = start + 1 # <<<<<<<<<<<<<< + * col = col + 1 + * return col + */ + __pyx_v_start = (__pyx_v_start + 1); + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/align/_core.pyx":12 + * if text[col] != 45: + * start = start + 1 + * col = col + 1 # <<<<<<<<<<<<<< + * return col + */ + __pyx_v_col = (__pyx_v_col + 1); + } + + /* "bx/align/_core.pyx":13 + * start = start + 1 + * col = col + 1 + * return col # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_col); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.align._core.coord_to_col", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_core"), + __Pyx_DOCSTR(__pyx_k_1), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__coord_to_col, __pyx_k__coord_to_col, sizeof(__pyx_k__coord_to_col), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_core(void); /*proto*/ +PyMODINIT_FUNC init_core(void) +#else +PyMODINIT_FUNC PyInit__core(void); /*proto*/ +PyMODINIT_FUNC PyInit__core(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__core(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_core"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__align___core) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/align/_core.pyx":5 + * """ + * + * def coord_to_col( int start, char * text, int pos ): # <<<<<<<<<<<<<< + * cdef int col + * col = 0 + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_5_core_coord_to_col, NULL, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__coord_to_col, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/_core.pyx":1 + * """ # <<<<<<<<<<<<<< + * Pyrex extension to speed up some operations in `core.py`. + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.align._core", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.align._core"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/_core.pyx b/code/utilities/CPAT-1.2.2/lib/bx/align/_core.pyx new file mode 100755 index 0000000..5b2d8f4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/_core.pyx @@ -0,0 +1,13 @@ +""" +Pyrex extension to speed up some operations in `core.py`. +""" + +def coord_to_col( int start, char * text, int pos ): + cdef int col + col = 0 + while start < pos: + # Note: ord( '-' ) = 45 + if text[col] != 45: + start = start + 1 + col = col + 1 + return col \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.c b/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.c new file mode 100755 index 0000000..5d5e733 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.c @@ -0,0 +1,10827 @@ +/* Generated by Cython 0.16 on Mon Jul 16 23:08:38 2012 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif + +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif + +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCFunction_Call PyObject_Call +#else + #define __Pyx_PyCFunction_Call PyCFunction_Call +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif + +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + + +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__align___epo +#define __PYX_HAVE_API__bx__align___epo +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_epo.pyx", + "numpy.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":722 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":723 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":724 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":725 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":729 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":730 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":731 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":736 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":737 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":746 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":747 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":748 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":750 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":751 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":752 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":754 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":757 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":758 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":759 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash; + +/* "numpy.pxd":761 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":762 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":763 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":765 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "bx/align/_epo.pyx":26 + * + * + * def rem_dash(p, q): # <<<<<<<<<<<<<< + * """remove dash columns and shift match intervals to the left. both iterables + * are read on the same direction left-to-right. + */ +struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash { + PyObject_HEAD + PyObject *__pyx_v_P; + PyObject *__pyx_v_Q; + PyObject *__pyx_v_p; + PyObject *__pyx_v_q; +}; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) { + PyObject *r, *m, *t, *py_ix; +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000 + if (likely(PyList_CheckExact(L))) { + Py_ssize_t size = PyList_GET_SIZE(L); + if (likely(size > (((PyListObject*)L)->allocated >> 1))) { + if (ix < 0) { + ix += size; + } + if (likely(0 <= ix && ix < size)) { + PyObject* v = PyList_GET_ITEM(L, ix); + Py_SIZE(L) -= 1; + size -= 1; + memmove(&PyList_GET_ITEM(L, ix), &PyList_GET_ITEM(L, ix+1), (size-ix)*sizeof(PyObject*)); + return v; + } + } + } +#endif + py_ix = t = NULL; + m = __Pyx_GetAttrString(L, "pop"); + if (!m) goto bad; + py_ix = PyInt_FromSsize_t(ix); + if (!py_ix) goto bad; + t = PyTuple_New(1); + if (!t) goto bad; + PyTuple_SET_ITEM(t, 0, py_ix); + py_ix = NULL; + r = PyObject_CallObject(m, t); + Py_DECREF(m); + Py_DECREF(t); + return r; +bad: + Py_XDECREF(m); + Py_XDECREF(t); + Py_XDECREF(py_ix); + return NULL; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (likely(i >= 0)) { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + return m->sq_item(o, i); + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } + else if (likely(i >= 0)) { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + return m->sq_ass_item(o, i, v); + } + } + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f) \ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f) \ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f) \ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; + int flags; + PyObject *func_dict; + PyObject *func_weakreflist; + PyObject *func_name; + PyObject *func_doc; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; /* No-args super() class cell */ + void *defaults; + int defaults_pyobjects; + PyObject *defaults_tuple; /* Const defaults tuple */ + PyObject *(*defaults_getter)(PyObject *); +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, + PyMethodDef *ml, int flags, + PyObject *self, PyObject *module, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static int __Pyx_CyFunction_init(void); + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint64(npy_uint64); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from 'cython' */ + +/* Module declarations from 'bx.align._epo' */ +static PyTypeObject *__pyx_ptype_2bx_5align_4_epo___pyx_scope_struct__rem_dash = 0; +static CYTHON_INLINE int __pyx_f_2bx_5align_4_epo_max2(int, int); /*proto*/ +static PyArrayObject *__pyx_f_2bx_5align_4_epo_bed_union(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static PyArrayObject *__pyx_f_2bx_5align_4_epo_cummulative_intervals(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t = { "uint64_t", NULL, sizeof(__pyx_t_5numpy_uint64_t), { 0 }, 0, 'U', IS_UNSIGNED(__pyx_t_5numpy_uint64_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 }; +#define __Pyx_MODULE_NAME "bx.align._epo" +int __pyx_module_is_main_bx__align___epo = 0; + +/* Implementation of 'bx.align._epo' */ +static PyObject *__pyx_builtin_sum; +static PyObject *__pyx_builtin_map; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_open; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_2bx_5align_4_epo_8rem_dash_myp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l); /* proto */ +static PyObject *__pyx_pf_2bx_5align_4_epo_8rem_dash_2adv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_queue, PyObject *__pyx_v_i, PyObject *__pyx_v_d); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_i); /* proto */ +static PyObject *__pyx_pf_2bx_5align_4_epo_rem_dash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_q); /* proto */ +static PyObject *__pyx_pf_2bx_5align_4_epo_2fastLoadChain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_hf); /* proto */ +static PyObject *__pyx_pf_2bx_5align_4_epo_4bed_union(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elements); /* proto */ +static PyObject *__pyx_pf_2bx_5align_4_epo_6cummulative_intervals(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_S, PyArrayObject *__pyx_v_D); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_3[] = "/Users/gerti/software/bx-python/lib/bx/align/_epo.pyx"; +static char __pyx_k_4[] = "bx.align._epo"; +static char __pyx_k_7[] = "one or both should be empty: p=%s, q=%s"; +static char __pyx_k_8[] = "%d != %d"; +static char __pyx_k_9[] = ""; +static char __pyx_k_10[] = "last matching block expected (found %s)"; +static char __pyx_k_11[] = "parsed %d elements from %s"; +static char __pyx_k_13[] = "fe=%d, e=%d"; +static char __pyx_k_14[] = "ndarray is not C contiguous"; +static char __pyx_k_16[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_18[] = "Non-native byte order not supported"; +static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_21[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_24[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__D[] = "D"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__N[] = "N"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__P[] = "P"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__R[] = "R"; +static char __pyx_k__S[] = "S"; +static char __pyx_k__a[] = "a"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__p[] = "p"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__s[] = "s"; +static char __pyx_k__t[] = "t"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__fd[] = "fd"; +static char __pyx_k__hd[] = "hd"; +static char __pyx_k__hf[] = "hf"; +static char __pyx_k__adv[] = "adv"; +static char __pyx_k__int[] = "int"; +static char __pyx_k__log[] = "log"; +static char __pyx_k__map[] = "map"; +static char __pyx_k__myp[] = "myp"; +static char __pyx_k__shi[] = "shi"; +static char __pyx_k__sum[] = "sum"; +static char __pyx_k__zip[] = "zip"; +static char __pyx_k__axis[] = "axis"; +static char __pyx_k__dash[] = "dash"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__info[] = "info"; +static char __pyx_k__line[] = "line"; +static char __pyx_k__open[] = "open"; +static char __pyx_k__qEnd[] = "qEnd"; +static char __pyx_k__sort[] = "sort"; +static char __pyx_k__tEnd[] = "tEnd"; +static char __pyx_k__DTYPE[] = "DTYPE"; +static char __pyx_k__array[] = "array"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__fname[] = "fname"; +static char __pyx_k__int64[] = "int64"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__queue[] = "queue"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__P_card[] = "P_card"; +static char __pyx_k__Q_card[] = "Q_card"; +static char __pyx_k__p_card[] = "p_card"; +static char __pyx_k__qStart[] = "qStart"; +static char __pyx_k__q_card[] = "q_card"; +static char __pyx_k__tStart[] = "tStart"; +static char __pyx_k__uint64[] = "uint64"; +static char __pyx_k__logging[] = "logging"; +static char __pyx_k____exit__[] = "__exit__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____name__[] = "__name__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__readline[] = "readline"; +static char __pyx_k__rem_dash[] = "rem_dash"; +static char __pyx_k____enter__[] = "__enter__"; +static char __pyx_k__getLogger[] = "getLogger"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__namedtuple[] = "namedtuple"; +static char __pyx_k__collections[] = "collections"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__fastLoadChain[] = "fastLoadChain"; +static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_kp_s_13; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_kp_u_18; +static PyObject *__pyx_kp_u_20; +static PyObject *__pyx_kp_u_21; +static PyObject *__pyx_kp_u_24; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_n_s_4; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__D; +static PyObject *__pyx_n_s__DTYPE; +static PyObject *__pyx_n_s__N; +static PyObject *__pyx_n_s__P; +static PyObject *__pyx_n_s__P_card; +static PyObject *__pyx_n_s__Q; +static PyObject *__pyx_n_s__Q_card; +static PyObject *__pyx_n_s__R; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__S; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____enter__; +static PyObject *__pyx_n_s____exit__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____name__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__adv; +static PyObject *__pyx_n_s__array; +static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__b; +static PyObject *__pyx_n_s__collections; +static PyObject *__pyx_n_s__d; +static PyObject *__pyx_n_s__dash; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__fastLoadChain; +static PyObject *__pyx_n_s__fd; +static PyObject *__pyx_n_s__fname; +static PyObject *__pyx_n_s__getLogger; +static PyObject *__pyx_n_s__hd; +static PyObject *__pyx_n_s__hf; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__info; +static PyObject *__pyx_n_s__int; +static PyObject *__pyx_n_s__int64; +static PyObject *__pyx_n_s__l; +static PyObject *__pyx_n_s__line; +static PyObject *__pyx_n_s__log; +static PyObject *__pyx_n_s__logging; +static PyObject *__pyx_n_s__map; +static PyObject *__pyx_n_s__myp; +static PyObject *__pyx_n_s__namedtuple; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__open; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__p_card; +static PyObject *__pyx_n_s__q; +static PyObject *__pyx_n_s__qEnd; +static PyObject *__pyx_n_s__qStart; +static PyObject *__pyx_n_s__q_card; +static PyObject *__pyx_n_s__queue; +static PyObject *__pyx_n_s__r; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readline; +static PyObject *__pyx_n_s__rem_dash; +static PyObject *__pyx_n_s__s; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__shi; +static PyObject *__pyx_n_s__sort; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__sum; +static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__tEnd; +static PyObject *__pyx_n_s__tStart; +static PyObject *__pyx_n_s__uint64; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_n_s__zip; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_1; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_codeobj_2; +static PyObject *__pyx_k_codeobj_6; +static PyObject *__pyx_k_codeobj_27; +static PyObject *__pyx_k_codeobj_29; + +/* "bx/align/_epo.pyx":15 + * + * + * cdef inline int max2( int a, int b ): # <<<<<<<<<<<<<< + * if b > a: + * return b + */ + +static CYTHON_INLINE int __pyx_f_2bx_5align_4_epo_max2(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("max2", 0); + + /* "bx/align/_epo.pyx":16 + * + * cdef inline int max2( int a, int b ): + * if b > a: # <<<<<<<<<<<<<< + * return b + * return a + */ + __pyx_t_1 = (__pyx_v_b > __pyx_v_a); + if (__pyx_t_1) { + + /* "bx/align/_epo.pyx":17 + * cdef inline int max2( int a, int b ): + * if b > a: + * return b # <<<<<<<<<<<<<< + * return a + * + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/align/_epo.pyx":18 + * if b > a: + * return b + * return a # <<<<<<<<<<<<<< + * + * cdef inline int min2( int a, int b ): + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":20 + * return a + * + * cdef inline int min2( int a, int b ): # <<<<<<<<<<<<<< + * if b < a: + * return b + */ + +static CYTHON_INLINE int __pyx_f_2bx_5align_4_epo_min2(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("min2", 0); + + /* "bx/align/_epo.pyx":21 + * + * cdef inline int min2( int a, int b ): + * if b < a: # <<<<<<<<<<<<<< + * return b + * return a + */ + __pyx_t_1 = (__pyx_v_b < __pyx_v_a); + if (__pyx_t_1) { + + /* "bx/align/_epo.pyx":22 + * cdef inline int min2( int a, int b ): + * if b < a: + * return b # <<<<<<<<<<<<<< + * return a + * + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/align/_epo.pyx":23 + * if b < a: + * return b + * return a # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_1rem_dash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_5align_4_epo_rem_dash[] = "remove dash columns and shift match intervals to the left. both iterables\n are read on the same direction left-to-right.\n "; +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_1rem_dash = {__Pyx_NAMESTR("rem_dash"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_1rem_dash, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_5align_4_epo_rem_dash)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_1rem_dash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_p = 0; + PyObject *__pyx_v_q = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__q,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rem_dash (wrapper)", 0); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__q); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("rem_dash", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rem_dash") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = values[0]; + __pyx_v_q = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("rem_dash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align._epo.rem_dash", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_5align_4_epo_rem_dash(__pyx_self, __pyx_v_p, __pyx_v_q); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_1myp(PyObject *__pyx_self, PyObject *__pyx_v_l); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_1myp = {__Pyx_NAMESTR("myp"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_1myp, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_1myp(PyObject *__pyx_self, PyObject *__pyx_v_l) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("myp (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_pf_2bx_5align_4_epo_8rem_dash_myp(__pyx_self, ((PyObject *)__pyx_v_l)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":31 + * """ + * + * def myp(l): # <<<<<<<<<<<<<< + * if l: return l.pop(0) + * + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_8rem_dash_myp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_l) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("myp", 0); + + /* "bx/align/_epo.pyx":32 + * + * def myp(l): + * if l: return l.pop(0) # <<<<<<<<<<<<<< + * + * def adv(queue, i, d): + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_l); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_PopIndex(__pyx_v_l, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.align._epo.rem_dash.myp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_3adv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_3adv = {__Pyx_NAMESTR("adv"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_3adv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_3adv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_queue = 0; + PyObject *__pyx_v_i = 0; + PyObject *__pyx_v_d = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__queue,&__pyx_n_s__i,&__pyx_n_s__d,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("adv (wrapper)", 0); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__queue); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("adv", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__d); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("adv", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "adv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_queue = values[0]; + __pyx_v_i = values[1]; + __pyx_v_d = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("adv", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align._epo.rem_dash.adv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_5align_4_epo_8rem_dash_2adv(__pyx_self, __pyx_v_queue, __pyx_v_i, __pyx_v_d); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":34 + * if l: return l.pop(0) + * + * def adv(queue, i, d): # <<<<<<<<<<<<<< + * # shifted interval + * shi = i[0]-d, i[1]-d + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_8rem_dash_2adv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_queue, PyObject *__pyx_v_i, PyObject *__pyx_v_d) { + PyObject *__pyx_v_shi = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("adv", 0); + + /* "bx/align/_epo.pyx":36 + * def adv(queue, i, d): + * # shifted interval + * shi = i[0]-d, i[1]-d # <<<<<<<<<<<<<< + * assert shi[0] >= 0 + * if queue and queue[-1][1] == shi[0]: + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_v_shi = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":37 + * # shifted interval + * shi = i[0]-d, i[1]-d + * assert shi[0] >= 0 # <<<<<<<<<<<<<< + * if queue and queue[-1][1] == shi[0]: + * # join to the preceeding one + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_shi), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":38 + * shi = i[0]-d, i[1]-d + * assert shi[0] >= 0 + * if queue and queue[-1][1] == shi[0]: # <<<<<<<<<<<<<< + * # join to the preceeding one + * queue[-1] = (queue[-1][0], shi[1]) + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_queue); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_queue, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_shi), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_4; + } + if (__pyx_t_6) { + + /* "bx/align/_epo.pyx":40 + * if queue and queue[-1][1] == shi[0]: + * # join to the preceeding one + * queue[-1] = (queue[-1][0], shi[1]) # <<<<<<<<<<<<<< + * else: + * queue.append( shi ) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_queue, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_shi), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + if (__Pyx_SetItemInt(__pyx_v_queue, -1, ((PyObject *)__pyx_t_1), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "bx/align/_epo.pyx":42 + * queue[-1] = (queue[-1][0], shi[1]) + * else: + * queue.append( shi ) # <<<<<<<<<<<<<< + * return queue + * + */ + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_queue, ((PyObject *)__pyx_v_shi)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L3:; + + /* "bx/align/_epo.pyx":43 + * else: + * queue.append( shi ) + * return queue # <<<<<<<<<<<<<< + * + * p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_queue); + __pyx_r = __pyx_v_queue; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.adv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_shi); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_4lambda1(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_4lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_4lambda1, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_4lambda1(PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":45 + * return queue + * + * p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) # <<<<<<<<<<<<<< + * q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) + * + */ + +static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_i) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_cur_scope; + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda1", 0); + __pyx_outer_scope = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_p)) { __Pyx_RaiseClosureNameError("p"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_p, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_p, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_5lambda2(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_5lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_5lambda2, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_5lambda2(PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":46 + * + * p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) + * q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) # <<<<<<<<<<<<<< + * + * P, Q = [], [] + */ + +static PyObject *__pyx_lambda_funcdef_lambda2(PyObject *__pyx_self, PyObject *__pyx_v_i) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_cur_scope; + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda2", 0); + __pyx_outer_scope = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_q)) { __Pyx_RaiseClosureNameError("q"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_q, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_q, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_6lambda3(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_6lambda3 = {__Pyx_NAMESTR("lambda3"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_6lambda3, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_6lambda3(PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":83 + * if q: r, R = q, Q + * # just extend the last inteval by the remaining bases + * R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) # <<<<<<<<<<<<<< + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) + */ + +static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda3", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_i, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_i, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_7lambda4(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_7lambda4 = {__Pyx_NAMESTR("lambda4"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_7lambda4, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_7lambda4(PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self, ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":85 + * R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) # <<<<<<<<<<<<<< + * Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) + * + */ + +static PyObject *__pyx_lambda_funcdef_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_i) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_cur_scope; + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda4", 0); + __pyx_outer_scope = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_P)) { __Pyx_RaiseClosureNameError("P"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_P, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_P, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_8lambda5(PyObject *__pyx_self, PyObject *__pyx_v_i); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_8rem_dash_8lambda5 = {__Pyx_NAMESTR("lambda5"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_8rem_dash_8lambda5, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_8rem_dash_8lambda5(PyObject *__pyx_self, PyObject *__pyx_v_i) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0); + __pyx_self = __pyx_self; + __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self, ((PyObject *)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":86 + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) + * Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) # <<<<<<<<<<<<<< + * + * assert p_card == P_card, "%d != %d" % (p_card, P_card) + */ + +static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_i) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_cur_scope; + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_outer_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("lambda5", 0); + __pyx_outer_scope = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *) __Pyx_CyFunction_GetClosure(__pyx_self); + __pyx_cur_scope = __pyx_outer_scope; + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_cur_scope->__pyx_v_Q)) { __Pyx_RaiseClosureNameError("Q"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_Q, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_Q, __pyx_v_i); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.align._epo.rem_dash.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":26 + * + * + * def rem_dash(p, q): # <<<<<<<<<<<<<< + * """remove dash columns and shift match intervals to the left. both iterables + * are read on the same direction left-to-right. + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_rem_dash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_p, PyObject *__pyx_v_q) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *__pyx_cur_scope; + PyObject *__pyx_v_myp = 0; + PyObject *__pyx_v_adv = 0; + PyObject *__pyx_v_p_card = NULL; + PyObject *__pyx_v_q_card = NULL; + PyObject *__pyx_v_dash = NULL; + PyObject *__pyx_v_a = NULL; + PyObject *__pyx_v_b = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_v_R = NULL; + PyObject *__pyx_v_P_card = NULL; + PyObject *__pyx_v_Q_card = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rem_dash", 0); + __pyx_cur_scope = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *)__pyx_ptype_2bx_5align_4_epo___pyx_scope_struct__rem_dash->tp_new(__pyx_ptype_2bx_5align_4_epo___pyx_scope_struct__rem_dash, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_p = __pyx_v_p; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_p); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_p); + __pyx_cur_scope->__pyx_v_q = __pyx_v_q; + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_q); + + /* "bx/align/_epo.pyx":31 + * """ + * + * def myp(l): # <<<<<<<<<<<<<< + * if l: return l.pop(0) + * + */ + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_1myp, 0, NULL, __pyx_n_s_4, ((PyObject *)__pyx_k_codeobj_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_myp = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":34 + * if l: return l.pop(0) + * + * def adv(queue, i, d): # <<<<<<<<<<<<<< + * # shifted interval + * shi = i[0]-d, i[1]-d + */ + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_3adv, 0, NULL, __pyx_n_s_4, ((PyObject *)__pyx_k_codeobj_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_adv = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":45 + * return queue + * + * p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) # <<<<<<<<<<<<<< + * q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) + * + */ + __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_4lambda1, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_v_p; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_p_card = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":46 + * + * p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) + * q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) # <<<<<<<<<<<<<< + * + * P, Q = [], [] + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_5lambda2, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_cur_scope->__pyx_v_q; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_q_card = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":48 + * q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) + * + * P, Q = [], [] # <<<<<<<<<<<<<< + * dash = 0 # dash (on both cigars) count so far + * a, b = p.pop(0), q.pop(0) + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_cur_scope->__pyx_v_P = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_cur_scope->__pyx_v_Q = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":49 + * + * P, Q = [], [] + * dash = 0 # dash (on both cigars) count so far # <<<<<<<<<<<<<< + * a, b = p.pop(0), q.pop(0) + * #while p or q: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_dash = __pyx_int_0; + + /* "bx/align/_epo.pyx":50 + * P, Q = [], [] + * dash = 0 # dash (on both cigars) count so far + * a, b = p.pop(0), q.pop(0) # <<<<<<<<<<<<<< + * #while p or q: + * while a and b: + */ + __pyx_t_1 = __Pyx_PyObject_PopIndex(__pyx_cur_scope->__pyx_v_p, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_PopIndex(__pyx_cur_scope->__pyx_v_q, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_v_b = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":52 + * a, b = p.pop(0), q.pop(0) + * #while p or q: + * while a and b: # <<<<<<<<<<<<<< + * assert dash <= min(a[0], b[0]) + * i = max(a[0], b[0]) - min(a[1], b[1]) + */ + while (1) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_b); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (!__pyx_t_7) break; + + /* "bx/align/_epo.pyx":53 + * #while p or q: + * while a and b: + * assert dash <= min(a[0], b[0]) # <<<<<<<<<<<<<< + * i = max(a[0], b[0]) - min(a[1], b[1]) + * if i >= 0: # no intersection + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_b, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_v_dash, __pyx_t_2, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_7)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":54 + * while a and b: + * assert dash <= min(a[0], b[0]) + * i = max(a[0], b[0]) - min(a[1], b[1]) # <<<<<<<<<<<<<< + * if i >= 0: # no intersection + * if a[1] <= b[0]: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_b, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_b, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __pyx_t_2; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":55 + * assert dash <= min(a[0], b[0]) + * i = max(a[0], b[0]) - min(a[1], b[1]) + * if i >= 0: # no intersection # <<<<<<<<<<<<<< + * if a[1] <= b[0]: + * if p: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":56 + * i = max(a[0], b[0]) - min(a[1], b[1]) + * if i >= 0: # no intersection + * if a[1] <= b[0]: # <<<<<<<<<<<<<< + * if p: + * i = min(i, p[0][0] - a[1]) + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_a, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_b, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_8, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":57 + * if i >= 0: # no intersection + * if a[1] <= b[0]: + * if p: # <<<<<<<<<<<<<< + * i = min(i, p[0][0] - a[1]) + * P = adv(P, a, dash) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_p); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":58 + * if a[1] <= b[0]: + * if p: + * i = min(i, p[0][0] - a[1]) # <<<<<<<<<<<<<< + * P = adv(P, a, dash) + * a = myp(p) + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Subtract(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_i); + __pyx_t_1 = __pyx_v_i; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = __pyx_t_4; + } else { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = __pyx_t_1; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_8; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/align/_epo.pyx":59 + * if p: + * i = min(i, p[0][0] - a[1]) + * P = adv(P, a, dash) # <<<<<<<<<<<<<< + * a = myp(p) + * else: + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_P); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_4 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_P = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":60 + * i = min(i, p[0][0] - a[1]) + * P = adv(P, a, dash) + * a = myp(p) # <<<<<<<<<<<<<< + * else: + * if q: + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_p); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_p); + __pyx_t_8 = PyObject_Call(__pyx_v_myp, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/align/_epo.pyx":62 + * a = myp(p) + * else: + * if q: # <<<<<<<<<<<<<< + * i = min(i, q[0][0] - b[1]) + * Q = adv(Q, b, dash) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_q); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":63 + * else: + * if q: + * i = min(i, q[0][0] - b[1]) # <<<<<<<<<<<<<< + * Q = adv(Q, b, dash) + * b = myp(q) + */ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_q, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_b, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_i); + __pyx_t_8 = __pyx_v_i; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + } else { + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = __pyx_t_8; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/align/_epo.pyx":64 + * if q: + * i = min(i, q[0][0] - b[1]) + * Q = adv(Q, b, dash) # <<<<<<<<<<<<<< + * b = myp(q) + * dash += i + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Q); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_INCREF(__pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_1 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_Q = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":65 + * i = min(i, q[0][0] - b[1]) + * Q = adv(Q, b, dash) + * b = myp(q) # <<<<<<<<<<<<<< + * dash += i + * else: # intersection + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_q); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_q); + __pyx_t_4 = PyObject_Call(__pyx_v_myp, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_L6:; + + /* "bx/align/_epo.pyx":66 + * Q = adv(Q, b, dash) + * b = myp(q) + * dash += i # <<<<<<<<<<<<<< + * else: # intersection + * if a[1] >= b[1]: + */ + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_dash, __pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_dash); + __pyx_v_dash = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "bx/align/_epo.pyx":68 + * dash += i + * else: # intersection + * if a[1] >= b[1]: # <<<<<<<<<<<<<< + * Q = adv(Q, b, dash); b = myp(q) + * elif a[1] < b[1]: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_a, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":69 + * else: # intersection + * if a[1] >= b[1]: + * Q = adv(Q, b, dash); b = myp(q) # <<<<<<<<<<<<<< + * elif a[1] < b[1]: + * P = adv(P, a, dash); a = myp(p) + */ + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Q); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_INCREF(__pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_1 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_Q = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_q); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_q); + __pyx_t_8 = PyObject_Call(__pyx_v_myp, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L9; + } + + /* "bx/align/_epo.pyx":70 + * if a[1] >= b[1]: + * Q = adv(Q, b, dash); b = myp(q) + * elif a[1] < b[1]: # <<<<<<<<<<<<<< + * P = adv(P, a, dash); a = myp(p) + * #if not a or not b: # no more matchings + */ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_a, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_b, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_7) { + + /* "bx/align/_epo.pyx":71 + * Q = adv(Q, b, dash); b = myp(q) + * elif a[1] < b[1]: + * P = adv(P, a, dash); a = myp(p) # <<<<<<<<<<<<<< + * #if not a or not b: # no more matchings + * # break + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_P); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_1 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_v_P = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_p); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_p); + __pyx_t_4 = PyObject_Call(__pyx_v_myp, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L9; + } + __pyx_L9:; + } + __pyx_L5:; + } + + /* "bx/align/_epo.pyx":74 + * #if not a or not b: # no more matchings + * # break + * assert (not p) or (not q), "one or both should be empty: p=%s, q=%s" % (str(p), str(q)) # <<<<<<<<<<<<<< + * + * if a: P = adv(P, a, dash) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_p); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_7); + if (!__pyx_t_5) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_q); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (!__pyx_t_7); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_p); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_p); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_q); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_q); + __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":76 + * assert (not p) or (not q), "one or both should be empty: p=%s, q=%s" % (str(p), str(q)) + * + * if a: P = adv(P, a, dash) # <<<<<<<<<<<<<< + * if b: Q = adv(Q, b, dash) + * + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_a); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_P); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_4 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_P = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "bx/align/_epo.pyx":77 + * + * if a: P = adv(P, a, dash) + * if b: Q = adv(Q, b, dash) # <<<<<<<<<<<<<< + * + * # remaining intervals (in q or p) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_b); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Q); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_INCREF(__pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + __Pyx_INCREF(__pyx_v_dash); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_dash); + __Pyx_GIVEREF(__pyx_v_dash); + __pyx_t_8 = PyObject_Call(__pyx_v_adv, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_DECREF(__pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_cur_scope->__pyx_v_Q = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "bx/align/_epo.pyx":80 + * + * # remaining intervals (in q or p) + * r, R = p, P # <<<<<<<<<<<<<< + * if q: r, R = q, Q + * # just extend the last inteval by the remaining bases + */ + __pyx_t_8 = __pyx_cur_scope->__pyx_v_p; + __Pyx_INCREF(__pyx_t_8); + __pyx_t_4 = __pyx_cur_scope->__pyx_v_P; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_r = __pyx_t_8; + __pyx_t_8 = 0; + __pyx_v_R = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":81 + * # remaining intervals (in q or p) + * r, R = p, P + * if q: r, R = q, Q # <<<<<<<<<<<<<< + * # just extend the last inteval by the remaining bases + * R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_q); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_4 = __pyx_cur_scope->__pyx_v_q; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_8 = __pyx_cur_scope->__pyx_v_Q; + __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_v_r); + __pyx_v_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_R); + __pyx_v_R = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "bx/align/_epo.pyx":83 + * if q: r, R = q, Q + * # just extend the last inteval by the remaining bases + * R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) # <<<<<<<<<<<<<< + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) + */ + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_R, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_R, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_6lambda3, 0, NULL, __pyx_n_s_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_r); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + if (__Pyx_SetItemInt(__pyx_v_R, -1, ((PyObject *)__pyx_t_8), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + + /* "bx/align/_epo.pyx":85 + * R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) # <<<<<<<<<<<<<< + * Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) + * + */ + __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_7lambda4, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __pyx_cur_scope->__pyx_v_P; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_8 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_P_card = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":86 + * + * P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) + * Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) # <<<<<<<<<<<<<< + * + * assert p_card == P_card, "%d != %d" % (p_card, P_card) + */ + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_8rem_dash_8lambda5, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_cur_scope->__pyx_v_Q; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_v_Q_card = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":88 + * Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) + * + * assert p_card == P_card, "%d != %d" % (p_card, P_card) # <<<<<<<<<<<<<< + * assert q_card == Q_card, "%d != %d" % (q_card, Q_card) + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_4 = PyObject_RichCompare(__pyx_v_p_card, __pyx_v_P_card, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_p_card); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_p_card); + __Pyx_GIVEREF(__pyx_v_p_card); + __Pyx_INCREF(__pyx_v_P_card); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_P_card); + __Pyx_GIVEREF(__pyx_v_P_card); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":89 + * + * assert p_card == P_card, "%d != %d" % (p_card, P_card) + * assert q_card == Q_card, "%d != %d" % (q_card, Q_card) # <<<<<<<<<<<<<< + * + * return P, Q + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_8 = PyObject_RichCompare(__pyx_v_q_card, __pyx_v_Q_card, Py_EQ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_7)) { + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_q_card); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_q_card); + __Pyx_GIVEREF(__pyx_v_q_card); + __Pyx_INCREF(__pyx_v_Q_card); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_Q_card); + __Pyx_GIVEREF(__pyx_v_Q_card); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":91 + * assert q_card == Q_card, "%d != %d" % (q_card, Q_card) + * + * return P, Q # <<<<<<<<<<<<<< + * + * def fastLoadChain(fname, hf): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_P); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_P); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_P); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_Q); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_Q); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_Q); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("bx.align._epo.rem_dash", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_myp); + __Pyx_XDECREF(__pyx_v_adv); + __Pyx_XDECREF(__pyx_v_p_card); + __Pyx_XDECREF(__pyx_v_q_card); + __Pyx_XDECREF(__pyx_v_dash); + __Pyx_XDECREF(__pyx_v_a); + __Pyx_XDECREF(__pyx_v_b); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XDECREF(__pyx_v_R); + __Pyx_XDECREF(__pyx_v_P_card); + __Pyx_XDECREF(__pyx_v_Q_card); + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_3fastLoadChain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_4_epo_3fastLoadChain = {__Pyx_NAMESTR("fastLoadChain"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_3fastLoadChain, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_2bx_5align_4_epo_3fastLoadChain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fname = 0; + PyObject *__pyx_v_hf = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fname,&__pyx_n_s__hf,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fastLoadChain (wrapper)", 0); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fname); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__hf); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fastLoadChain", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fastLoadChain") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_fname = values[0]; + __pyx_v_hf = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fastLoadChain", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align._epo.fastLoadChain", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_5align_4_epo_2fastLoadChain(__pyx_self, __pyx_v_fname, __pyx_v_hf); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":93 + * return P, Q + * + * def fastLoadChain(fname, hf): # <<<<<<<<<<<<<< + * data = [] + * with open(fname) as fd: + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_2fastLoadChain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fname, PyObject *__pyx_v_hf) { + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_v_fd = NULL; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_hd = NULL; + PyObject *__pyx_v_N = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_v_t = NULL; + PyObject *__pyx_v_q = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *(*__pyx_t_13)(PyObject *); + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fastLoadChain", 0); + + /* "bx/align/_epo.pyx":94 + * + * def fastLoadChain(fname, hf): + * data = [] # <<<<<<<<<<<<<< + * with open(fname) as fd: + * while True: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_data = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":95 + * def fastLoadChain(fname, hf): + * data = [] + * with open(fname) as fd: # <<<<<<<<<<<<<< + * while True: + * line = fd.readline() + */ + /*with:*/ { + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_fname); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fname); + __Pyx_GIVEREF(__pyx_v_fname); + __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*try:*/ { + { + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { + __Pyx_INCREF(__pyx_t_4); + __pyx_v_fd = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":96 + * data = [] + * with open(fname) as fd: + * while True: # <<<<<<<<<<<<<< + * line = fd.readline() + * if line == "": + */ + while (1) { + if (!1) break; + + /* "bx/align/_epo.pyx":97 + * with open(fname) as fd: + * while True: + * line = fd.readline() # <<<<<<<<<<<<<< + * if line == "": + * break + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__readline); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":98 + * while True: + * line = fd.readline() + * if line == "": # <<<<<<<<<<<<<< + * break + * hd = hf(line) + */ + __pyx_t_8 = __Pyx_PyString_Equals(__pyx_v_line, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + if (__pyx_t_8) { + + /* "bx/align/_epo.pyx":99 + * line = fd.readline() + * if line == "": + * break # <<<<<<<<<<<<<< + * hd = hf(line) + * N = [] + */ + goto __pyx_L17_break; + goto __pyx_L18; + } + __pyx_L18:; + + /* "bx/align/_epo.pyx":100 + * if line == "": + * break + * hd = hf(line) # <<<<<<<<<<<<<< + * N = [] + * line = fd.readline().split() + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_4 = PyObject_Call(__pyx_v_hf, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_hd); + __pyx_v_hd = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":101 + * break + * hd = hf(line) + * N = [] # <<<<<<<<<<<<<< + * line = fd.readline().split() + * while len(line) == 3: + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(((PyObject *)__pyx_v_N)); + __pyx_v_N = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":102 + * hd = hf(line) + * N = [] + * line = fd.readline().split() # <<<<<<<<<<<<<< + * while len(line) == 3: + * N.append( (int(line[0]), int(line[1]), int(line[2])) ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__readline); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":103 + * N = [] + * line = fd.readline().split() + * while len(line) == 3: # <<<<<<<<<<<<<< + * N.append( (int(line[0]), int(line[1]), int(line[2])) ) + * line = fd.readline().split() + */ + while (1) { + __pyx_t_9 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = (__pyx_t_9 == 3); + if (!__pyx_t_8) break; + + /* "bx/align/_epo.pyx":104 + * line = fd.readline().split() + * while len(line) == 3: + * N.append( (int(line[0]), int(line[1]), int(line[2])) ) # <<<<<<<<<<<<<< + * line = fd.readline().split() + * if len(line) != 1: + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_line, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_11 = PyList_Append(__pyx_v_N, ((PyObject *)__pyx_t_10)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + + /* "bx/align/_epo.pyx":105 + * while len(line) == 3: + * N.append( (int(line[0]), int(line[1]), int(line[2])) ) + * line = fd.readline().split() # <<<<<<<<<<<<<< + * if len(line) != 1: + * raise ValueError("last matching block expected (found %s)" % str(line)) + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__readline); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "bx/align/_epo.pyx":106 + * N.append( (int(line[0]), int(line[1]), int(line[2])) ) + * line = fd.readline().split() + * if len(line) != 1: # <<<<<<<<<<<<<< + * raise ValueError("last matching block expected (found %s)" % str(line)) + * N.append( (int(line[0]), 0, 0) ) + */ + __pyx_t_9 = PyObject_Length(__pyx_v_line); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_8 = (__pyx_t_9 != 1); + if (__pyx_t_8) { + + /* "bx/align/_epo.pyx":107 + * line = fd.readline().split() + * if len(line) != 1: + * raise ValueError("last matching block expected (found %s)" % str(line)) # <<<<<<<<<<<<<< + * N.append( (int(line[0]), 0, 0) ) + * s, t, q = zip( *N ) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + goto __pyx_L21; + } + __pyx_L21:; + + /* "bx/align/_epo.pyx":108 + * if len(line) != 1: + * raise ValueError("last matching block expected (found %s)" % str(line)) + * N.append( (int(line[0]), 0, 0) ) # <<<<<<<<<<<<<< + * s, t, q = zip( *N ) + * data.append( (hd, + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = 0; + __pyx_t_11 = PyList_Append(__pyx_v_N, ((PyObject *)__pyx_t_10)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + + /* "bx/align/_epo.pyx":109 + * raise ValueError("last matching block expected (found %s)" % str(line)) + * N.append( (int(line[0]), 0, 0) ) + * s, t, q = zip( *N ) # <<<<<<<<<<<<<< + * data.append( (hd, + * numpy.array(s, dtype=numpy.int), + */ + __pyx_t_10 = PySequence_Tuple(((PyObject *)__pyx_v_N)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { + if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 3)) { + if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + __pyx_t_10 = PyList_GET_ITEM(sequence, 0); + __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + __pyx_t_2 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_12 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext; + index = 0; __pyx_t_10 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + index = 1; __pyx_t_4 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 2; __pyx_t_2 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L23_unpacking_done; + __pyx_L22_unpacking_failed:; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_L23_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_q); + __pyx_v_q = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":111 + * s, t, q = zip( *N ) + * data.append( (hd, + * numpy.array(s, dtype=numpy.int), # <<<<<<<<<<<<<< + * numpy.array(t, dtype=numpy.int), + * numpy.array(q, dtype=numpy.int)) ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "bx/align/_epo.pyx":112 + * data.append( (hd, + * numpy.array(s, dtype=numpy.int), + * numpy.array(t, dtype=numpy.int), # <<<<<<<<<<<<<< + * numpy.array(q, dtype=numpy.int)) ) + * assert hd.tEnd - hd.tStart == sum(s) + sum(t) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_t); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t); + __Pyx_GIVEREF(__pyx_v_t); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":113 + * numpy.array(s, dtype=numpy.int), + * numpy.array(t, dtype=numpy.int), + * numpy.array(q, dtype=numpy.int)) ) # <<<<<<<<<<<<<< + * assert hd.tEnd - hd.tStart == sum(s) + sum(t) + * assert hd.qEnd - hd.qStart == sum(s) + sum(q) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_q); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_q); + __Pyx_GIVEREF(__pyx_v_q); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_hd); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_hd); + __Pyx_GIVEREF(__pyx_v_hd); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_12 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_11 = PyList_Append(__pyx_v_data, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":114 + * numpy.array(t, dtype=numpy.int), + * numpy.array(q, dtype=numpy.int)) ) + * assert hd.tEnd - hd.tStart == sum(s) + sum(t) # <<<<<<<<<<<<<< + * assert hd.qEnd - hd.qStart == sum(s) + sum(q) + * fd.readline() # a blank line + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(__pyx_v_hd, __pyx_n_s__tEnd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = PyObject_GetAttr(__pyx_v_hd, __pyx_n_s__tStart); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyNumber_Subtract(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_1 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_t); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_t); + __Pyx_GIVEREF(__pyx_v_t); + __pyx_t_12 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Add(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_RichCompare(__pyx_t_14, __pyx_t_15, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_8)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #endif + + /* "bx/align/_epo.pyx":115 + * numpy.array(q, dtype=numpy.int)) ) + * assert hd.tEnd - hd.tStart == sum(s) + sum(t) + * assert hd.qEnd - hd.qStart == sum(s) + sum(q) # <<<<<<<<<<<<<< + * fd.readline() # a blank line + * log.info("parsed %d elements from %s" % (len(data), fname)) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_12 = PyObject_GetAttr(__pyx_v_hd, __pyx_n_s__qEnd); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_15 = PyObject_GetAttr(__pyx_v_hd, __pyx_n_s__qStart); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyNumber_Subtract(__pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_12 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_q); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_q); + __Pyx_GIVEREF(__pyx_v_q); + __pyx_t_1 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Add(__pyx_t_12, __pyx_t_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_14, __pyx_t_15, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_8)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + } + #endif + + /* "bx/align/_epo.pyx":116 + * assert hd.tEnd - hd.tStart == sum(s) + sum(t) + * assert hd.qEnd - hd.qStart == sum(s) + sum(q) + * fd.readline() # a blank line # <<<<<<<<<<<<<< + * log.info("parsed %d elements from %s" % (len(data), fname)) + * return data + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__readline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __pyx_L17_break:; + + /* "bx/align/_epo.pyx":117 + * assert hd.qEnd - hd.qStart == sum(s) + sum(q) + * fd.readline() # a blank line + * log.info("parsed %d elements from %s" % (len(data), fname)) # <<<<<<<<<<<<<< + * return data + * + */ + __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__log); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_9 = PyList_GET_SIZE(((PyObject *)__pyx_v_data)); + __pyx_t_15 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __Pyx_INCREF(__pyx_v_fname); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_fname); + __Pyx_GIVEREF(__pyx_v_fname); + __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_15)); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "bx/align/_epo.pyx":95 + * def fastLoadChain(fname, hf): + * data = [] + * with open(fname) as fd: # <<<<<<<<<<<<<< + * while True: + * line = fd.readline() + */ + /*except:*/ { + __Pyx_AddTraceback("bx.align._epo.fastLoadChain", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_14, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __Pyx_INCREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_16 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_16); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __pyx_t_17 = (!__pyx_t_8); + if (__pyx_t_17) { + __Pyx_GIVEREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_15, __pyx_t_14, __pyx_t_1); + __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + goto __pyx_L26; + } + __pyx_L26:; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __pyx_L14_try_end:; + } + } + /*finally:*/ { + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_t_3, __pyx_k_tuple_12, NULL); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + goto __pyx_L27; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L1_error; + __pyx_L27:; + } + + /* "bx/align/_epo.pyx":118 + * fd.readline() # a blank line + * log.info("parsed %d elements from %s" % (len(data), fname)) + * return data # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_data)); + __pyx_r = ((PyObject *)__pyx_v_data); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("bx.align._epo.fastLoadChain", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_fd); + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_hd); + __Pyx_XDECREF(__pyx_v_N); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_q); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":124 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * cpdef numpy.ndarray[numpy.uint64_t, ndim=2] bed_union( numpy.ndarray[numpy.uint64_t, ndim=2] elements ): # <<<<<<<<<<<<<< + * """compute the union of these elements. simply walk the sorted elements and join the intersecting ones + * works on half-open intervals, i.e., [a, b), [b, c) ---> [a, c) + */ + +static PyObject *__pyx_pw_2bx_5align_4_epo_5bed_union(PyObject *__pyx_self, PyObject *__pyx_v_elements); /*proto*/ +static PyArrayObject *__pyx_f_2bx_5align_4_epo_bed_union(PyArrayObject *__pyx_v_elements, CYTHON_UNUSED int __pyx_skip_dispatch) { + Py_ssize_t __pyx_v_cst; + Py_ssize_t __pyx_v_cen; + Py_ssize_t __pyx_v_i; + Py_ssize_t __pyx_v_j; + PyArrayObject *__pyx_v_tmp_elems = 0; + PyArrayObject *__pyx_v_final_elems = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_elements; + __Pyx_Buffer __pyx_pybuffer_elements; + __Pyx_LocalBuf_ND __pyx_pybuffernd_final_elems; + __Pyx_Buffer __pyx_pybuffer_final_elems; + __Pyx_LocalBuf_ND __pyx_pybuffernd_tmp_elems; + __Pyx_Buffer __pyx_pybuffer_tmp_elems; + PyArrayObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + long __pyx_t_18; + Py_ssize_t __pyx_t_19; + long __pyx_t_20; + Py_ssize_t __pyx_t_21; + long __pyx_t_22; + Py_ssize_t __pyx_t_23; + long __pyx_t_24; + Py_ssize_t __pyx_t_25; + long __pyx_t_26; + Py_ssize_t __pyx_t_27; + long __pyx_t_28; + Py_ssize_t __pyx_t_29; + long __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + long __pyx_t_34; + Py_ssize_t __pyx_t_35; + long __pyx_t_36; + Py_ssize_t __pyx_t_37; + long __pyx_t_38; + Py_ssize_t __pyx_t_39; + long __pyx_t_40; + long __pyx_t_41; + long __pyx_t_42; + long __pyx_t_43; + long __pyx_t_44; + long __pyx_t_45; + long __pyx_t_46; + long __pyx_t_47; + long __pyx_t_48; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bed_union", 0); + __pyx_pybuffer_tmp_elems.pybuffer.buf = NULL; + __pyx_pybuffer_tmp_elems.refcount = 0; + __pyx_pybuffernd_tmp_elems.data = NULL; + __pyx_pybuffernd_tmp_elems.rcbuffer = &__pyx_pybuffer_tmp_elems; + __pyx_pybuffer_final_elems.pybuffer.buf = NULL; + __pyx_pybuffer_final_elems.refcount = 0; + __pyx_pybuffernd_final_elems.data = NULL; + __pyx_pybuffernd_final_elems.rcbuffer = &__pyx_pybuffer_final_elems; + __pyx_pybuffer_elements.pybuffer.buf = NULL; + __pyx_pybuffer_elements.refcount = 0; + __pyx_pybuffernd_elements.data = NULL; + __pyx_pybuffernd_elements.rcbuffer = &__pyx_pybuffer_elements; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elements.rcbuffer->pybuffer, (PyObject*)__pyx_v_elements, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_elements.diminfo[0].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elements.diminfo[0].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elements.diminfo[1].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elements.diminfo[1].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[1]; + + /* "bx/align/_epo.pyx":131 + * @return: 2-dim numpy array of unsigned64 ints""" + * + * assert numpy.shape(elements)[0] > 0 # <<<<<<<<<<<<<< + * + * cdef Py_ssize_t cst, cen, i, j + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_elements)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_elements)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_elements)); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":136 + * cdef numpy.ndarray[numpy.uint64_t, ndim=2] tmp_elems, final_elems + * + * elements.sort(axis=0) # <<<<<<<<<<<<<< + * assert elements[0][0] <= elements[numpy.shape(elements)[0]-1][0] + * tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_elements), __pyx_n_s__sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":137 + * + * elements.sort(axis=0) + * assert elements[0][0] <= elements[numpy.shape(elements)[0]-1][0] # <<<<<<<<<<<<<< + * tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) + * cst = elements[0, 0] + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elements), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_elements)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_elements)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_elements)); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_elements), __pyx_t_5); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":138 + * elements.sort(axis=0) + * assert elements[0][0] <= elements[numpy.shape(elements)[0]-1][0] + * tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) # <<<<<<<<<<<<<< + * cst = elements[0, 0] + * cen = elements[0, 1] + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_elements)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_elements)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_elements)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_7 < 0)) { + PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer, (PyObject*)__pyx_v_tmp_elems, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); + } + } + __pyx_pybuffernd_tmp_elems.diminfo[0].strides = __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tmp_elems.diminfo[0].shape = __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_tmp_elems.diminfo[1].strides = __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_tmp_elems.diminfo[1].shape = __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.shape[1]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; + __pyx_v_tmp_elems = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":139 + * assert elements[0][0] <= elements[numpy.shape(elements)[0]-1][0] + * tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) + * cst = elements[0, 0] # <<<<<<<<<<<<<< + * cen = elements[0, 1] + * j = 0 + */ + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_v_cst = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_elements.diminfo[1].strides)); + + /* "bx/align/_epo.pyx":140 + * tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) + * cst = elements[0, 0] + * cen = elements[0, 1] # <<<<<<<<<<<<<< + * j = 0 + * + */ + __pyx_t_13 = 0; + __pyx_t_14 = 1; + __pyx_v_cen = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_elements.diminfo[1].strides)); + + /* "bx/align/_epo.pyx":141 + * cst = elements[0, 0] + * cen = elements[0, 1] + * j = 0 # <<<<<<<<<<<<<< + * + * for i in range(1, numpy.shape(elements)[0]): + */ + __pyx_v_j = 0; + + /* "bx/align/_epo.pyx":143 + * j = 0 + * + * for i in range(1, numpy.shape(elements)[0]): # <<<<<<<<<<<<<< + * if elements[i, 0] <= cen: # overlaps with the last one + * cen = max2(cen, elements[i, 1]) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_elements)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_elements)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_elements)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_15 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (__pyx_t_16 = 1; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; + + /* "bx/align/_epo.pyx":144 + * + * for i in range(1, numpy.shape(elements)[0]): + * if elements[i, 0] <= cen: # overlaps with the last one # <<<<<<<<<<<<<< + * cen = max2(cen, elements[i, 1]) + * else: + */ + __pyx_t_17 = __pyx_v_i; + __pyx_t_18 = 0; + __pyx_t_4 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_elements.diminfo[1].strides)) <= __pyx_v_cen); + if (__pyx_t_4) { + + /* "bx/align/_epo.pyx":145 + * for i in range(1, numpy.shape(elements)[0]): + * if elements[i, 0] <= cen: # overlaps with the last one + * cen = max2(cen, elements[i, 1]) # <<<<<<<<<<<<<< + * else: + * tmp_elems[j, 0] = cst + */ + __pyx_t_19 = __pyx_v_i; + __pyx_t_20 = 1; + __pyx_v_cen = __pyx_f_2bx_5align_4_epo_max2(__pyx_v_cen, (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_elements.diminfo[1].strides))); + goto __pyx_L5; + } + /*else*/ { + + /* "bx/align/_epo.pyx":147 + * cen = max2(cen, elements[i, 1]) + * else: + * tmp_elems[j, 0] = cst # <<<<<<<<<<<<<< + * tmp_elems[j, 1] = cen + * j += 1 + */ + __pyx_t_21 = __pyx_v_j; + __pyx_t_22 = 0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_tmp_elems.diminfo[1].strides) = __pyx_v_cst; + + /* "bx/align/_epo.pyx":148 + * else: + * tmp_elems[j, 0] = cst + * tmp_elems[j, 1] = cen # <<<<<<<<<<<<<< + * j += 1 + * cst = elements[i, 0] + */ + __pyx_t_23 = __pyx_v_j; + __pyx_t_24 = 1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_tmp_elems.diminfo[1].strides) = __pyx_v_cen; + + /* "bx/align/_epo.pyx":149 + * tmp_elems[j, 0] = cst + * tmp_elems[j, 1] = cen + * j += 1 # <<<<<<<<<<<<<< + * cst = elements[i, 0] + * cen = elements[i, 1] + */ + __pyx_v_j = (__pyx_v_j + 1); + + /* "bx/align/_epo.pyx":150 + * tmp_elems[j, 1] = cen + * j += 1 + * cst = elements[i, 0] # <<<<<<<<<<<<<< + * cen = elements[i, 1] + * tmp_elems[j, 0] = cst + */ + __pyx_t_25 = __pyx_v_i; + __pyx_t_26 = 0; + __pyx_v_cst = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_elements.diminfo[1].strides)); + + /* "bx/align/_epo.pyx":151 + * j += 1 + * cst = elements[i, 0] + * cen = elements[i, 1] # <<<<<<<<<<<<<< + * tmp_elems[j, 0] = cst + * tmp_elems[j, 1] = cen + */ + __pyx_t_27 = __pyx_v_i; + __pyx_t_28 = 1; + __pyx_v_cen = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_elements.diminfo[1].strides)); + } + __pyx_L5:; + } + + /* "bx/align/_epo.pyx":152 + * cst = elements[i, 0] + * cen = elements[i, 1] + * tmp_elems[j, 0] = cst # <<<<<<<<<<<<<< + * tmp_elems[j, 1] = cen + * j += 1 + */ + __pyx_t_16 = __pyx_v_j; + __pyx_t_15 = 0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_tmp_elems.diminfo[1].strides) = __pyx_v_cst; + + /* "bx/align/_epo.pyx":153 + * cen = elements[i, 1] + * tmp_elems[j, 0] = cst + * tmp_elems[j, 1] = cen # <<<<<<<<<<<<<< + * j += 1 + * final_elems = numpy.empty((j, 2), dtype=DTYPE) + */ + __pyx_t_29 = __pyx_v_j; + __pyx_t_30 = 1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_tmp_elems.diminfo[1].strides) = __pyx_v_cen; + + /* "bx/align/_epo.pyx":154 + * tmp_elems[j, 0] = cst + * tmp_elems[j, 1] = cen + * j += 1 # <<<<<<<<<<<<<< + * final_elems = numpy.empty((j, 2), dtype=DTYPE) + * for i in range(j): + */ + __pyx_v_j = (__pyx_v_j + 1); + + /* "bx/align/_epo.pyx":155 + * tmp_elems[j, 1] = cen + * j += 1 + * final_elems = numpy.empty((j, 2), dtype=DTYPE) # <<<<<<<<<<<<<< + * for i in range(j): + * final_elems[i, 0] = tmp_elems[i, 0] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_final_elems.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_final_elems.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_7 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_final_elems.rcbuffer->pybuffer, (PyObject*)__pyx_v_final_elems, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); + } + } + __pyx_pybuffernd_final_elems.diminfo[0].strides = __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_final_elems.diminfo[0].shape = __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_final_elems.diminfo[1].strides = __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_final_elems.diminfo[1].shape = __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.shape[1]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; + __pyx_v_final_elems = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/align/_epo.pyx":156 + * j += 1 + * final_elems = numpy.empty((j, 2), dtype=DTYPE) + * for i in range(j): # <<<<<<<<<<<<<< + * final_elems[i, 0] = tmp_elems[i, 0] + * final_elems[i, 1] = tmp_elems[i, 1] + */ + __pyx_t_31 = __pyx_v_j; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; + + /* "bx/align/_epo.pyx":157 + * final_elems = numpy.empty((j, 2), dtype=DTYPE) + * for i in range(j): + * final_elems[i, 0] = tmp_elems[i, 0] # <<<<<<<<<<<<<< + * final_elems[i, 1] = tmp_elems[i, 1] + * assert final_elems[0, 0] == elements[0, 0], "fe=%d, e=%d" % (final_elems[0,0], elements[0,0]) + */ + __pyx_t_33 = __pyx_v_i; + __pyx_t_34 = 0; + __pyx_t_35 = __pyx_v_i; + __pyx_t_36 = 0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_final_elems.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_final_elems.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_tmp_elems.diminfo[1].strides)); + + /* "bx/align/_epo.pyx":158 + * for i in range(j): + * final_elems[i, 0] = tmp_elems[i, 0] + * final_elems[i, 1] = tmp_elems[i, 1] # <<<<<<<<<<<<<< + * assert final_elems[0, 0] == elements[0, 0], "fe=%d, e=%d" % (final_elems[0,0], elements[0,0]) + * return final_elems + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = 1; + __pyx_t_39 = __pyx_v_i; + __pyx_t_40 = 1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_final_elems.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_final_elems.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_tmp_elems.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_tmp_elems.diminfo[1].strides)); + } + + /* "bx/align/_epo.pyx":159 + * final_elems[i, 0] = tmp_elems[i, 0] + * final_elems[i, 1] = tmp_elems[i, 1] + * assert final_elems[0, 0] == elements[0, 0], "fe=%d, e=%d" % (final_elems[0,0], elements[0,0]) # <<<<<<<<<<<<<< + * return final_elems + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_41 = 0; + __pyx_t_42 = 0; + __pyx_t_43 = 0; + __pyx_t_44 = 0; + if (unlikely(!((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_final_elems.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_final_elems.diminfo[1].strides)) == (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_elements.diminfo[1].strides))))) { + __pyx_t_45 = 0; + __pyx_t_46 = 0; + __pyx_t_5 = __Pyx_PyInt_to_py_npy_uint64((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_final_elems.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_final_elems.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_final_elems.diminfo[1].strides))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_47 = 0; + __pyx_t_48 = 0; + __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint64((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_elements.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_elements.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_elements.diminfo[1].strides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":160 + * final_elems[i, 1] = tmp_elems[i, 1] + * assert final_elems[0, 0] == elements[0, 0], "fe=%d, e=%d" % (final_elems[0,0], elements[0,0]) + * return final_elems # <<<<<<<<<<<<<< + * + * #@cython.wraparound(False) + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_final_elems)); + __pyx_r = ((PyArrayObject *)__pyx_v_final_elems); + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elements.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_final_elems.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.align._epo.bed_union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elements.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_final_elems.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tmp_elems.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_tmp_elems); + __Pyx_XDECREF((PyObject *)__pyx_v_final_elems); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_5bed_union(PyObject *__pyx_self, PyObject *__pyx_v_elements); /*proto*/ +static char __pyx_doc_2bx_5align_4_epo_4bed_union[] = "compute the union of these elements. simply walk the sorted elements and join the intersecting ones\n works on half-open intervals, i.e., [a, b), [b, c) ---> [a, c)\n\n @param elements: 2-dim numpy array of unsigned64 ints\n @return: 2-dim numpy array of unsigned64 ints"; +static PyObject *__pyx_pw_2bx_5align_4_epo_5bed_union(PyObject *__pyx_self, PyObject *__pyx_v_elements) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("bed_union (wrapper)", 0); + __pyx_self = __pyx_self; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elements), __pyx_ptype_5numpy_ndarray, 1, "elements", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_2bx_5align_4_epo_4bed_union(__pyx_self, ((PyArrayObject *)__pyx_v_elements)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":124 + * @cython.wraparound(False) + * @cython.boundscheck(False) + * cpdef numpy.ndarray[numpy.uint64_t, ndim=2] bed_union( numpy.ndarray[numpy.uint64_t, ndim=2] elements ): # <<<<<<<<<<<<<< + * """compute the union of these elements. simply walk the sorted elements and join the intersecting ones + * works on half-open intervals, i.e., [a, b), [b, c) ---> [a, c) + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_4bed_union(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elements) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_elements; + __Pyx_Buffer __pyx_pybuffer_elements; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bed_union", 0); + __pyx_pybuffer_elements.pybuffer.buf = NULL; + __pyx_pybuffer_elements.refcount = 0; + __pyx_pybuffernd_elements.data = NULL; + __pyx_pybuffernd_elements.rcbuffer = &__pyx_pybuffer_elements; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elements.rcbuffer->pybuffer, (PyObject*)__pyx_v_elements, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_elements.diminfo[0].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elements.diminfo[0].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elements.diminfo[1].strides = __pyx_pybuffernd_elements.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elements.diminfo[1].shape = __pyx_pybuffernd_elements.rcbuffer->pybuffer.shape[1]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_2bx_5align_4_epo_bed_union(__pyx_v_elements, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elements.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.align._epo.bed_union", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elements.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":164 + * #@cython.wraparound(False) + * #@cython.boundscheck(False) + * cpdef numpy.ndarray[numpy.int64_t, ndim=2] cummulative_intervals(numpy.ndarray[numpy.int64_t, ndim=1] S, # <<<<<<<<<<<<<< + * numpy.ndarray[numpy.int64_t, ndim=1] D ): + * """compute cummulative intervals for this side of an aligmnent. S and D are one side of + */ + +static PyObject *__pyx_pw_2bx_5align_4_epo_7cummulative_intervals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_2bx_5align_4_epo_cummulative_intervals(PyArrayObject *__pyx_v_S, PyArrayObject *__pyx_v_D, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_v_N; + int __pyx_v_i; + int __pyx_v_j; + PyArrayObject *__pyx_v_cumm_i = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_D; + __Pyx_Buffer __pyx_pybuffer_D; + __Pyx_LocalBuf_ND __pyx_pybuffernd_S; + __Pyx_Buffer __pyx_pybuffer_S; + __Pyx_LocalBuf_ND __pyx_pybuffernd_cumm_i; + __Pyx_Buffer __pyx_pybuffer_cumm_i; + PyArrayObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + long __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + long __pyx_t_11; + long __pyx_t_12; + long __pyx_t_13; + int __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + long __pyx_t_18; + int __pyx_t_19; + long __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + long __pyx_t_23; + int __pyx_t_24; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cummulative_intervals", 0); + __pyx_pybuffer_cumm_i.pybuffer.buf = NULL; + __pyx_pybuffer_cumm_i.refcount = 0; + __pyx_pybuffernd_cumm_i.data = NULL; + __pyx_pybuffernd_cumm_i.rcbuffer = &__pyx_pybuffer_cumm_i; + __pyx_pybuffer_S.pybuffer.buf = NULL; + __pyx_pybuffer_S.refcount = 0; + __pyx_pybuffernd_S.data = NULL; + __pyx_pybuffernd_S.rcbuffer = &__pyx_pybuffer_S; + __pyx_pybuffer_D.pybuffer.buf = NULL; + __pyx_pybuffer_D.refcount = 0; + __pyx_pybuffernd_D.data = NULL; + __pyx_pybuffernd_D.rcbuffer = &__pyx_pybuffer_D; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S.rcbuffer->pybuffer, (PyObject*)__pyx_v_S, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_S.diminfo[0].strides = __pyx_pybuffernd_S.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S.diminfo[0].shape = __pyx_pybuffernd_S.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_D.diminfo[0].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_D.diminfo[0].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[0]; + + /* "bx/align/_epo.pyx":169 + * the alignment as described in the chain file format""" + * + * cdef int N = S.shape[0] # <<<<<<<<<<<<<< + * cdef int i = 0, j = 0 + * assert N == D.shape[0] + */ + __pyx_v_N = (__pyx_v_S->dimensions[0]); + + /* "bx/align/_epo.pyx":170 + * + * cdef int N = S.shape[0] + * cdef int i = 0, j = 0 # <<<<<<<<<<<<<< + * assert N == D.shape[0] + * cdef numpy.ndarray[numpy.int64_t, ndim=2] cumm_i = numpy.empty((N, 2), dtype=numpy.int64) + */ + __pyx_v_i = 0; + __pyx_v_j = 0; + + /* "bx/align/_epo.pyx":171 + * cdef int N = S.shape[0] + * cdef int i = 0, j = 0 + * assert N == D.shape[0] # <<<<<<<<<<<<<< + * cdef numpy.ndarray[numpy.int64_t, ndim=2] cumm_i = numpy.empty((N, 2), dtype=numpy.int64) + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_N == (__pyx_v_D->dimensions[0])))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/align/_epo.pyx":172 + * cdef int i = 0, j = 0 + * assert N == D.shape[0] + * cdef numpy.ndarray[numpy.int64_t, ndim=2] cumm_i = numpy.empty((N, 2), dtype=numpy.int64) # <<<<<<<<<<<<<< + * + * cumm_i[0,0] = 0 + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cumm_i.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + __pyx_v_cumm_i = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_cumm_i.diminfo[0].strides = __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cumm_i.diminfo[0].shape = __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_cumm_i.diminfo[1].strides = __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_cumm_i.diminfo[1].shape = __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_6 = 0; + __pyx_v_cumm_i = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/align/_epo.pyx":174 + * cdef numpy.ndarray[numpy.int64_t, ndim=2] cumm_i = numpy.empty((N, 2), dtype=numpy.int64) + * + * cumm_i[0,0] = 0 # <<<<<<<<<<<<<< + * cumm_i[0,1] = S[0] + * for i in range(N-1): + */ + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = -1; + if (__pyx_t_7 < 0) { + __pyx_t_7 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_9 = 0; + if (__pyx_t_8 < 0) { + __pyx_t_8 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_cumm_i.diminfo[1].strides) = 0; + + /* "bx/align/_epo.pyx":175 + * + * cumm_i[0,0] = 0 + * cumm_i[0,1] = S[0] # <<<<<<<<<<<<<< + * for i in range(N-1): + * j = i + 1 + */ + __pyx_t_10 = 0; + __pyx_t_9 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_pybuffernd_S.diminfo[0].shape; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_S.diminfo[0].shape)) __pyx_t_9 = 0; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = 0; + __pyx_t_12 = 1; + __pyx_t_9 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_9 = 0; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_9 = 1; + if (unlikely(__pyx_t_9 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_9); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_cumm_i.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_S.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_S.diminfo[0].strides)); + + /* "bx/align/_epo.pyx":176 + * cumm_i[0,0] = 0 + * cumm_i[0,1] = S[0] + * for i in range(N-1): # <<<<<<<<<<<<<< + * j = i + 1 + * cumm_i[j,0] = cumm_i[i, 1] + D[i] + */ + __pyx_t_13 = (__pyx_v_N - 1); + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + + /* "bx/align/_epo.pyx":177 + * cumm_i[0,1] = S[0] + * for i in range(N-1): + * j = i + 1 # <<<<<<<<<<<<<< + * cumm_i[j,0] = cumm_i[i, 1] + D[i] + * cumm_i[j,1] = cumm_i[j,0] + S[j] + */ + __pyx_v_j = (__pyx_v_i + 1); + + /* "bx/align/_epo.pyx":178 + * for i in range(N-1): + * j = i + 1 + * cumm_i[j,0] = cumm_i[i, 1] + D[i] # <<<<<<<<<<<<<< + * cumm_i[j,1] = cumm_i[j,0] + S[j] + * return cumm_i + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = 1; + __pyx_t_16 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_16 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_16 = 0; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1; + } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_16 = 1; + if (unlikely(__pyx_t_16 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_16); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = -1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_pybuffernd_D.diminfo[0].shape; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_17 = 0; + if (unlikely(__pyx_t_17 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_17); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_17 = __pyx_v_j; + __pyx_t_18 = 0; + __pyx_t_19 = -1; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_19 = 0; + } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_19 = 0; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_19 = 1; + } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_19 = 1; + if (unlikely(__pyx_t_19 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_19); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_cumm_i.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_cumm_i.diminfo[1].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_D.diminfo[0].strides))); + + /* "bx/align/_epo.pyx":179 + * j = i + 1 + * cumm_i[j,0] = cumm_i[i, 1] + D[i] + * cumm_i[j,1] = cumm_i[j,0] + S[j] # <<<<<<<<<<<<<< + * return cumm_i + * + */ + __pyx_t_19 = __pyx_v_j; + __pyx_t_20 = 0; + __pyx_t_21 = -1; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_21 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_21 = 0; + if (__pyx_t_20 < 0) { + __pyx_t_20 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_20 < 0)) __pyx_t_21 = 1; + } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_21 = 1; + if (unlikely(__pyx_t_21 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_21); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_21 = __pyx_v_j; + __pyx_t_22 = -1; + if (__pyx_t_21 < 0) { + __pyx_t_21 += __pyx_pybuffernd_S.diminfo[0].shape; + if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 0; + } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_S.diminfo[0].shape)) __pyx_t_22 = 0; + if (unlikely(__pyx_t_22 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_22); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_22 = __pyx_v_j; + __pyx_t_23 = 1; + __pyx_t_24 = -1; + if (__pyx_t_22 < 0) { + __pyx_t_22 += __pyx_pybuffernd_cumm_i.diminfo[0].shape; + if (unlikely(__pyx_t_22 < 0)) __pyx_t_24 = 0; + } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_cumm_i.diminfo[0].shape)) __pyx_t_24 = 0; + if (__pyx_t_23 < 0) { + __pyx_t_23 += __pyx_pybuffernd_cumm_i.diminfo[1].shape; + if (unlikely(__pyx_t_23 < 0)) __pyx_t_24 = 1; + } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_cumm_i.diminfo[1].shape)) __pyx_t_24 = 1; + if (unlikely(__pyx_t_24 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_24); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_cumm_i.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_cumm_i.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_cumm_i.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_cumm_i.diminfo[1].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_S.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_S.diminfo[0].strides))); + } + + /* "bx/align/_epo.pyx":180 + * cumm_i[j,0] = cumm_i[i, 1] + D[i] + * cumm_i[j,1] = cumm_i[j,0] + S[j] + * return cumm_i # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_cumm_i)); + __pyx_r = ((PyArrayObject *)__pyx_v_cumm_i); + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cumm_i.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.align._epo.cummulative_intervals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cumm_i.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_cumm_i); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_5align_4_epo_7cummulative_intervals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_5align_4_epo_6cummulative_intervals[] = "compute cummulative intervals for this side of an aligmnent. S and D are one side of\n the alignment as described in the chain file format"; +static PyObject *__pyx_pw_2bx_5align_4_epo_7cummulative_intervals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_S = 0; + PyArrayObject *__pyx_v_D = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__S,&__pyx_n_s__D,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("cummulative_intervals (wrapper)", 0); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__S); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cummulative_intervals", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cummulative_intervals") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_S = ((PyArrayObject *)values[0]); + __pyx_v_D = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cummulative_intervals", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align._epo.cummulative_intervals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_S), __pyx_ptype_5numpy_ndarray, 1, "S", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_D), __pyx_ptype_5numpy_ndarray, 1, "D", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_2bx_5align_4_epo_6cummulative_intervals(__pyx_self, __pyx_v_S, __pyx_v_D); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/_epo.pyx":164 + * #@cython.wraparound(False) + * #@cython.boundscheck(False) + * cpdef numpy.ndarray[numpy.int64_t, ndim=2] cummulative_intervals(numpy.ndarray[numpy.int64_t, ndim=1] S, # <<<<<<<<<<<<<< + * numpy.ndarray[numpy.int64_t, ndim=1] D ): + * """compute cummulative intervals for this side of an aligmnent. S and D are one side of + */ + +static PyObject *__pyx_pf_2bx_5align_4_epo_6cummulative_intervals(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_S, PyArrayObject *__pyx_v_D) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_D; + __Pyx_Buffer __pyx_pybuffer_D; + __Pyx_LocalBuf_ND __pyx_pybuffernd_S; + __Pyx_Buffer __pyx_pybuffer_S; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cummulative_intervals", 0); + __pyx_pybuffer_S.pybuffer.buf = NULL; + __pyx_pybuffer_S.refcount = 0; + __pyx_pybuffernd_S.data = NULL; + __pyx_pybuffernd_S.rcbuffer = &__pyx_pybuffer_S; + __pyx_pybuffer_D.pybuffer.buf = NULL; + __pyx_pybuffer_D.refcount = 0; + __pyx_pybuffernd_D.data = NULL; + __pyx_pybuffernd_D.rcbuffer = &__pyx_pybuffer_D; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S.rcbuffer->pybuffer, (PyObject*)__pyx_v_S, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_S.diminfo[0].strides = __pyx_pybuffernd_S.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S.diminfo[0].shape = __pyx_pybuffernd_S.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_D.diminfo[0].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_D.diminfo[0].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_f_2bx_5align_4_epo_cummulative_intervals(__pyx_v_S, __pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.align._epo.cummulative_intervals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":193 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":199 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":202 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":203 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":205 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":207 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":208 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":210 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":212 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":213 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":216 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":217 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":218 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":220 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":221 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":222 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":225 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":226 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":227 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":228 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":229 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":231 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":232 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":233 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":234 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":235 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":238 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":239 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); + __pyx_v_descr = __pyx_v_self->descr; + + /* "numpy.pxd":243 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":245 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":247 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":250 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":252 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":254 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":255 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":256 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":257 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L13; + } + + /* "numpy.pxd":258 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L13; + } + + /* "numpy.pxd":259 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L13; + } + + /* "numpy.pxd":260 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L13; + } + + /* "numpy.pxd":261 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L13; + } + + /* "numpy.pxd":262 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L13; + } + + /* "numpy.pxd":263 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L13; + } + + /* "numpy.pxd":264 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L13; + } + + /* "numpy.pxd":265 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L13; + } + + /* "numpy.pxd":266 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L13; + } + + /* "numpy.pxd":267 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L13; + } + + /* "numpy.pxd":268 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L13; + } + + /* "numpy.pxd":269 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L13; + } + + /* "numpy.pxd":270 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L13; + } + + /* "numpy.pxd":271 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L13; + } + + /* "numpy.pxd":272 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L13; + } + + /* "numpy.pxd":273 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":275 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_20), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":276 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":277 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":279 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":280 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":281 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":284 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":285 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":287 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":288 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":289 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":290 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":291 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":767 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":780 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":782 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":789 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":790 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":793 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":794 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":797 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":798 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":800 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":801 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":802 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":812 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":813 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":814 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":815 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":817 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":819 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":820 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":821 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":822 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":825 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":839 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":840 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":841 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":843 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_20), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":844 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":848 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":849 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":964 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":966 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":967 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":969 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":970 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":971 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":972 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":974 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":975 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":976 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":978 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_5align_4_epo___pyx_scope_struct__rem_dash(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *)o); + p->__pyx_v_P = 0; + p->__pyx_v_Q = 0; + p->__pyx_v_p = 0; + p->__pyx_v_q = 0; + return o; +} + +static void __pyx_tp_dealloc_2bx_5align_4_epo___pyx_scope_struct__rem_dash(PyObject *o) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *p = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *)o; + Py_XDECREF(p->__pyx_v_P); + Py_XDECREF(p->__pyx_v_Q); + Py_XDECREF(p->__pyx_v_p); + Py_XDECREF(p->__pyx_v_q); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_5align_4_epo___pyx_scope_struct__rem_dash(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *p = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *)o; + if (p->__pyx_v_P) { + e = (*v)(p->__pyx_v_P, a); if (e) return e; + } + if (p->__pyx_v_Q) { + e = (*v)(p->__pyx_v_Q, a); if (e) return e; + } + if (p->__pyx_v_p) { + e = (*v)(p->__pyx_v_p, a); if (e) return e; + } + if (p->__pyx_v_q) { + e = (*v)(p->__pyx_v_q, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_5align_4_epo___pyx_scope_struct__rem_dash(PyObject *o) { + struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *p = (struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_P); + p->__pyx_v_P = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_Q); + p->__pyx_v_Q = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_p); + p->__pyx_v_p = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_q); + p->__pyx_v_q = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_5align_4_epo___pyx_scope_struct__rem_dash[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__rem_dash = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__rem_dash = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__rem_dash = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__rem_dash = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_5align_4_epo___pyx_scope_struct__rem_dash = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.align._epo.__pyx_scope_struct__rem_dash"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_5align_4_epo___pyx_scope_struct__rem_dash), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_5align_4_epo___pyx_scope_struct__rem_dash, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct__rem_dash, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct__rem_dash, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct__rem_dash, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct__rem_dash, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_5align_4_epo___pyx_scope_struct__rem_dash, /*tp_traverse*/ + __pyx_tp_clear_2bx_5align_4_epo___pyx_scope_struct__rem_dash, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_5align_4_epo___pyx_scope_struct__rem_dash, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_5align_4_epo___pyx_scope_struct__rem_dash, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("bed_union"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_5bed_union, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_5align_4_epo_4bed_union)}, + {__Pyx_NAMESTR("cummulative_intervals"), (PyCFunction)__pyx_pw_2bx_5align_4_epo_7cummulative_intervals, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_5align_4_epo_6cummulative_intervals)}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_epo"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, + {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, + {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0}, + {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0}, + {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_n_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 1}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1}, + {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, + {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1}, + {&__pyx_n_s__P, __pyx_k__P, sizeof(__pyx_k__P), 0, 0, 1, 1}, + {&__pyx_n_s__P_card, __pyx_k__P_card, sizeof(__pyx_k__P_card), 0, 0, 1, 1}, + {&__pyx_n_s__Q, __pyx_k__Q, sizeof(__pyx_k__Q), 0, 0, 1, 1}, + {&__pyx_n_s__Q_card, __pyx_k__Q_card, sizeof(__pyx_k__Q_card), 0, 0, 1, 1}, + {&__pyx_n_s__R, __pyx_k__R, sizeof(__pyx_k__R), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1}, + {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__adv, __pyx_k__adv, sizeof(__pyx_k__adv), 0, 0, 1, 1}, + {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, + {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, + {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, + {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, + {&__pyx_n_s__dash, __pyx_k__dash, sizeof(__pyx_k__dash), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__fastLoadChain, __pyx_k__fastLoadChain, sizeof(__pyx_k__fastLoadChain), 0, 0, 1, 1}, + {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1}, + {&__pyx_n_s__fname, __pyx_k__fname, sizeof(__pyx_k__fname), 0, 0, 1, 1}, + {&__pyx_n_s__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 0, 0, 1, 1}, + {&__pyx_n_s__hd, __pyx_k__hd, sizeof(__pyx_k__hd), 0, 0, 1, 1}, + {&__pyx_n_s__hf, __pyx_k__hf, sizeof(__pyx_k__hf), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1}, + {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, + {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1}, + {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1}, + {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1}, + {&__pyx_n_s__log, __pyx_k__log, sizeof(__pyx_k__log), 0, 0, 1, 1}, + {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, + {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1}, + {&__pyx_n_s__myp, __pyx_k__myp, sizeof(__pyx_k__myp), 0, 0, 1, 1}, + {&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__p_card, __pyx_k__p_card, sizeof(__pyx_k__p_card), 0, 0, 1, 1}, + {&__pyx_n_s__q, __pyx_k__q, sizeof(__pyx_k__q), 0, 0, 1, 1}, + {&__pyx_n_s__qEnd, __pyx_k__qEnd, sizeof(__pyx_k__qEnd), 0, 0, 1, 1}, + {&__pyx_n_s__qStart, __pyx_k__qStart, sizeof(__pyx_k__qStart), 0, 0, 1, 1}, + {&__pyx_n_s__q_card, __pyx_k__q_card, sizeof(__pyx_k__q_card), 0, 0, 1, 1}, + {&__pyx_n_s__queue, __pyx_k__queue, sizeof(__pyx_k__queue), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1}, + {&__pyx_n_s__rem_dash, __pyx_k__rem_dash, sizeof(__pyx_k__rem_dash), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__shi, __pyx_k__shi, sizeof(__pyx_k__shi), 0, 0, 1, 1}, + {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__tEnd, __pyx_k__tEnd, sizeof(__pyx_k__tEnd), 0, 0, 1, 1}, + {&__pyx_n_s__tStart, __pyx_k__tStart, sizeof(__pyx_k__tStart), 0, 0, 1, 1}, + {&__pyx_n_s__uint64, __pyx_k__uint64, sizeof(__pyx_k__uint64), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_sum = __Pyx_GetName(__pyx_b, __pyx_n_s__sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "bx/align/_epo.pyx":31 + * """ + * + * def myp(l): # <<<<<<<<<<<<<< + * if l: return l.pop(0) + * + */ + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); + __pyx_k_codeobj_2 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_1, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_3, __pyx_n_s__myp, 31, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/align/_epo.pyx":34 + * if l: return l.pop(0) + * + * def adv(queue, i, d): # <<<<<<<<<<<<<< + * # shifted interval + * shi = i[0]-d, i[1]-d + */ + __pyx_k_tuple_5 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); + __Pyx_INCREF(((PyObject *)__pyx_n_s__queue)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__queue)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__queue)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 2, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__shi)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 3, ((PyObject *)__pyx_n_s__shi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shi)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_k_codeobj_6 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_3, __pyx_n_s__adv, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/align/_epo.pyx":95 + * def fastLoadChain(fname, hf): + * data = [] + * with open(fname) as fd: # <<<<<<<<<<<<<< + * while True: + * line = fd.readline() + */ + __pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 2, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":214 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "numpy.pxd":218 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "numpy.pxd":256 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_u_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + + /* "numpy.pxd":798 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_22); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_21)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_u_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + + /* "numpy.pxd":802 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + + /* "numpy.pxd":822 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_24)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_u_24)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_24)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + + /* "bx/align/_epo.pyx":26 + * + * + * def rem_dash(p, q): # <<<<<<<<<<<<<< + * """remove dash columns and shift match intervals to the left. both iterables + * are read on the same direction left-to-right. + */ + __pyx_k_tuple_26 = PyTuple_New(18); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__myp)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__myp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__myp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__myp)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__myp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__myp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__adv)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 4, ((PyObject *)__pyx_n_s__adv)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__adv)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__adv)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 5, ((PyObject *)__pyx_n_s__adv)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__adv)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p_card)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 6, ((PyObject *)__pyx_n_s__p_card)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p_card)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q_card)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 7, ((PyObject *)__pyx_n_s__q_card)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q_card)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__P)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 8, ((PyObject *)__pyx_n_s__P)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__P)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Q)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 9, ((PyObject *)__pyx_n_s__Q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Q)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dash)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 10, ((PyObject *)__pyx_n_s__dash)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dash)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 11, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 12, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 13, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 14, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__R)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 15, ((PyObject *)__pyx_n_s__R)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__P_card)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 16, ((PyObject *)__pyx_n_s__P_card)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__P_card)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Q_card)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 17, ((PyObject *)__pyx_n_s__Q_card)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Q_card)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(2, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_3, __pyx_n_s__rem_dash, 26, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/align/_epo.pyx":93 + * return P, Q + * + * def fastLoadChain(fname, hf): # <<<<<<<<<<<<<< + * data = [] + * with open(fname) as fd: + */ + __pyx_k_tuple_28 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fname)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__fname)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fname)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__hf)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, ((PyObject *)__pyx_n_s__hf)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hf)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, ((PyObject *)__pyx_n_s__data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fd)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 3, ((PyObject *)__pyx_n_s__fd)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fd)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__line)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 4, ((PyObject *)__pyx_n_s__line)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__hd)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 5, ((PyObject *)__pyx_n_s__hd)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hd)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__N)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 6, ((PyObject *)__pyx_n_s__N)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 7, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 8, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 9, ((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_3, __pyx_n_s__fastLoadChain, 93, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_epo(void); /*proto*/ +PyMODINIT_FUNC init_epo(void) +#else +PyMODINIT_FUNC PyInit__epo(void); /*proto*/ +PyMODINIT_FUNC PyInit__epo(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__epo(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_epo"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__align___epo) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_5align_4_epo___pyx_scope_struct__rem_dash) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_5align_4_epo___pyx_scope_struct__rem_dash = &__pyx_type_2bx_5align_4_epo___pyx_scope_struct__rem_dash; + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/align/_epo.pyx":3 + * + * + * import logging # <<<<<<<<<<<<<< + * from collections import namedtuple + * import numpy + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/_epo.pyx":4 + * + * import logging + * from collections import namedtuple # <<<<<<<<<<<<<< + * import numpy + * cimport numpy + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__namedtuple)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__namedtuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__namedtuple)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__namedtuple); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":5 + * import logging + * from collections import namedtuple + * import numpy # <<<<<<<<<<<<<< + * cimport numpy + * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":8 + * cimport numpy + * + * log = logging.getLogger(__name__) # <<<<<<<<<<<<<< + * + * cimport cython + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__log, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/_epo.pyx":12 + * cimport cython + * + * DTYPE = numpy.uint64 # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/align/_epo.pyx":26 + * + * + * def rem_dash(p, q): # <<<<<<<<<<<<<< + * """remove dash columns and shift match intervals to the left. both iterables + * are read on the same direction left-to-right. + */ + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_1rem_dash, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rem_dash, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/align/_epo.pyx":93 + * return P, Q + * + * def fastLoadChain(fname, hf): # <<<<<<<<<<<<<< + * data = [] + * with open(fname) as fd: + */ + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_4_epo_3fastLoadChain, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fastLoadChain, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/align/_epo.pyx":3 + * + * + * import logging # <<<<<<<<<<<<<< + * from collections import namedtuple + * import numpy + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "numpy.pxd":974 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.align._epo", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.align._epo"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + + + + +static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { + PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(&local_type, &local_value, &local_tb); + if (unlikely(tstate->curexc_type)) + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + *type = local_type; + *value = local_value; + *tb = local_tb; + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + PyObject *getbuffer_cobj; + + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + #endif + + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + + return -1; +} + +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + PyObject *releasebuffer_cobj; + + if (!obj) return; + + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + + Py_DECREF(releasebuffer_cobj); + + if (!func) + goto fail; + + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + + goto nofail; + +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); + +nofail: + Py_DECREF(obj); + view->obj = NULL; +} + +#endif /* PY_MAJOR_VERSION < 3 */ + + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (op->func_doc == NULL && op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + } + if (op->func_doc == 0) { + Py_INCREF(Py_None); + return Py_None; + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) + op->func_doc = Py_None; /* Mark as deleted */ + else + op->func_doc = value; + Py_INCREF(op->func_doc); + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (op->func_name == NULL) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (value == NULL || !PyUnicode_Check(value)) { +#else + if (value == NULL || !PyString_Check(value)) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (op->func_dict == NULL) { + op->func_dict = PyDict_New(); + if (op->func_dict == NULL) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + PyObject* dict = PyModule_GetDict(__pyx_m); + Py_XINCREF(dict); + return dict; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) +{ + if (op->defaults_tuple) { + Py_INCREF(op->defaults_tuple); + return op->defaults_tuple; + } + if (op->defaults_getter) { + PyObject *res = op->defaults_getter((PyObject *) op); + if (res) { + Py_INCREF(res); + op->defaults_tuple = res; + } + return res; + } + Py_INCREF(Py_None); + return Py_None; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; +#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */ +#define PY_WRITE_RESTRICTED WRITE_RESTRICTED +#endif +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, + PyObject *closure, PyObject *module, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + op->func_weakreflist = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + op->func_doc = NULL; + op->func_classobj = NULL; + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_getter = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyMem_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (m->func_weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return PyMethod_New(func, + type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ + PyObject *func_name = __Pyx_CyFunction_get_name(op); +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + func_name, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(func_name), (void *)op); +#endif +} +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/ + sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __Pyx_PyCFunction_Call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/ + (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_CyFunction_methods, /*tp_methods*/ + __pyx_CyFunction_members, /*tp_members*/ + __pyx_CyFunction_getsets, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + __Pyx_CyFunction_descr_get, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static int __Pyx_CyFunction_init(void) +{ + if (PyType_Ready(&__pyx_CyFunctionType_type) < 0) + return -1; + __pyx_CyFunctionType = &__pyx_CyFunctionType_type; + return 0; +} +void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyMem_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, sizeof(size)); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + #if CYTHON_PEP393_ENABLED + if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0)) + return -1; + if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_LENGTH(s1) == 1) { + Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); + Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); + return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); + #else + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0]; + Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0]; + return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); + #endif + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint64(npy_uint64 val) { + const npy_uint64 neg_one = (npy_uint64)-1, const_zero = (npy_uint64)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_uint64) == sizeof(char)) || + (sizeof(npy_uint64) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_uint64) == sizeof(int)) || + (sizeof(npy_uint64) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_uint64) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_uint64), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.pyx b/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.pyx new file mode 100755 index 0000000..0f3f503 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/_epo.pyx @@ -0,0 +1,183 @@ + + +import logging +from collections import namedtuple +import numpy +cimport numpy + +log = logging.getLogger(__name__) + +cimport cython + +DTYPE = numpy.uint64 + + +cdef inline int max2( int a, int b ): + if b > a: + return b + return a + +cdef inline int min2( int a, int b ): + if b < a: + return b + return a + + +def rem_dash(p, q): + """remove dash columns and shift match intervals to the left. both iterables + are read on the same direction left-to-right. + """ + + def myp(l): + if l: return l.pop(0) + + def adv(queue, i, d): + # shifted interval + shi = i[0]-d, i[1]-d + assert shi[0] >= 0 + if queue and queue[-1][1] == shi[0]: + # join to the preceeding one + queue[-1] = (queue[-1][0], shi[1]) + else: + queue.append( shi ) + return queue + + p_card = sum( map(lambda i: p[i][1] - p[i][0], range(len(p))) ) + q_card = sum( map(lambda i: q[i][1] - q[i][0], range(len(q))) ) + + P, Q = [], [] + dash = 0 # dash (on both cigars) count so far + a, b = p.pop(0), q.pop(0) + #while p or q: + while a and b: + assert dash <= min(a[0], b[0]) + i = max(a[0], b[0]) - min(a[1], b[1]) + if i >= 0: # no intersection + if a[1] <= b[0]: + if p: + i = min(i, p[0][0] - a[1]) + P = adv(P, a, dash) + a = myp(p) + else: + if q: + i = min(i, q[0][0] - b[1]) + Q = adv(Q, b, dash) + b = myp(q) + dash += i + else: # intersection + if a[1] >= b[1]: + Q = adv(Q, b, dash); b = myp(q) + elif a[1] < b[1]: + P = adv(P, a, dash); a = myp(p) + #if not a or not b: # no more matchings + # break + assert (not p) or (not q), "one or both should be empty: p=%s, q=%s" % (str(p), str(q)) + + if a: P = adv(P, a, dash) + if b: Q = adv(Q, b, dash) + + # remaining intervals (in q or p) + r, R = p, P + if q: r, R = q, Q + # just extend the last inteval by the remaining bases + R[-1] = (R[-1][0], R[-1][1] + sum( map(lambda i: i[1]-i[0], r) )) + + P_card = sum( map(lambda i: P[i][1] - P[i][0], range(len(P))) ) + Q_card = sum( map(lambda i: Q[i][1] - Q[i][0], range(len(Q))) ) + + assert p_card == P_card, "%d != %d" % (p_card, P_card) + assert q_card == Q_card, "%d != %d" % (q_card, Q_card) + + return P, Q + +def fastLoadChain(fname, hf): + data = [] + with open(fname) as fd: + while True: + line = fd.readline() + if line == "": + break + hd = hf(line) + N = [] + line = fd.readline().split() + while len(line) == 3: + N.append( (int(line[0]), int(line[1]), int(line[2])) ) + line = fd.readline().split() + if len(line) != 1: + raise ValueError("last matching block expected (found %s)" % str(line)) + N.append( (int(line[0]), 0, 0) ) + s, t, q = zip( *N ) + data.append( (hd, + numpy.array(s, dtype=numpy.int), + numpy.array(t, dtype=numpy.int), + numpy.array(q, dtype=numpy.int)) ) + assert hd.tEnd - hd.tStart == sum(s) + sum(t) + assert hd.qEnd - hd.qStart == sum(s) + sum(q) + fd.readline() # a blank line + log.info("parsed %d elements from %s" % (len(data), fname)) + return data + + + +@cython.wraparound(False) +@cython.boundscheck(False) +cpdef numpy.ndarray[numpy.uint64_t, ndim=2] bed_union( numpy.ndarray[numpy.uint64_t, ndim=2] elements ): + """compute the union of these elements. simply walk the sorted elements and join the intersecting ones + works on half-open intervals, i.e., [a, b), [b, c) ---> [a, c) + + @param elements: 2-dim numpy array of unsigned64 ints + @return: 2-dim numpy array of unsigned64 ints""" + + assert numpy.shape(elements)[0] > 0 + + cdef Py_ssize_t cst, cen, i, j + cdef numpy.ndarray[numpy.uint64_t, ndim=2] tmp_elems, final_elems + + elements.sort(axis=0) + assert elements[0][0] <= elements[numpy.shape(elements)[0]-1][0] + tmp_elems = numpy.zeros((numpy.shape(elements)[0], 2), dtype=DTYPE) + cst = elements[0, 0] + cen = elements[0, 1] + j = 0 + + for i in range(1, numpy.shape(elements)[0]): + if elements[i, 0] <= cen: # overlaps with the last one + cen = max2(cen, elements[i, 1]) + else: + tmp_elems[j, 0] = cst + tmp_elems[j, 1] = cen + j += 1 + cst = elements[i, 0] + cen = elements[i, 1] + tmp_elems[j, 0] = cst + tmp_elems[j, 1] = cen + j += 1 + final_elems = numpy.empty((j, 2), dtype=DTYPE) + for i in range(j): + final_elems[i, 0] = tmp_elems[i, 0] + final_elems[i, 1] = tmp_elems[i, 1] + assert final_elems[0, 0] == elements[0, 0], "fe=%d, e=%d" % (final_elems[0,0], elements[0,0]) + return final_elems + +#@cython.wraparound(False) +#@cython.boundscheck(False) +cpdef numpy.ndarray[numpy.int64_t, ndim=2] cummulative_intervals(numpy.ndarray[numpy.int64_t, ndim=1] S, + numpy.ndarray[numpy.int64_t, ndim=1] D ): + """compute cummulative intervals for this side of an aligmnent. S and D are one side of + the alignment as described in the chain file format""" + + cdef int N = S.shape[0] + cdef int i = 0, j = 0 + assert N == D.shape[0] + cdef numpy.ndarray[numpy.int64_t, ndim=2] cumm_i = numpy.empty((N, 2), dtype=numpy.int64) + + cumm_i[0,0] = 0 + cumm_i[0,1] = S[0] + for i in range(N-1): + j = i + 1 + cumm_i[j,0] = cumm_i[i, 1] + D[i] + cumm_i[j,1] = cumm_i[j,0] + S[j] + return cumm_i + + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/axt.py b/code/utilities/CPAT-1.2.2/lib/bx/align/axt.py new file mode 100755 index 0000000..bb5982a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/axt.py @@ -0,0 +1,193 @@ +""" +Support for reading and writing the `AXT`_ format used for pairwise +alignments. + +.. _AXT: http://genome.ucsc.edu/goldenPath/help/axt.html +""" + +from bx.align import * + +import itertools +from bx import interval_index_file + +# Tools for dealing with pairwise alignments in AXT format + +class MultiIndexed( object ): + """Similar to 'indexed' but wraps more than one axt_file""" + def __init__( self, axt_filenames, keep_open=False ): + self.indexes = [ Indexed( axt_file, axt_file + ".index" ) for axt_file in axt_filenames ] + def get( self, src, start, end ): + blocks = [] + for index in self.indexes: blocks += index.get( src, start, end ) + return blocks + + +class Indexed( object ): + """Indexed access to a axt using overlap queries, requires an index file""" + + def __init__( self, axt_filename, index_filename=None, keep_open=False, species1 = None, species2=None, species_to_lengths=None, support_ids=False ): + if index_filename is None: index_filename = axt_filename + ".index" + self.indexes = interval_index_file.Indexes( filename=index_filename ) + self.axt_filename = axt_filename + # nota bene: (self.species1 = species1 or "species1") is incorrect if species1="" + self.species1 = species1 + if (self.species1 == None): self.species1 = "species1" + self.species2 = species2 + if (self.species2 == None): self.species2 = "species2" + self.species_to_lengths = species_to_lengths + self.support_ids = support_ids # for extra text at end of axt header lines + if keep_open: + self.f = open( axt_filename ) + else: + self.f = None + + def get( self, src, start, end ): + intersections = self.indexes.find( src, start, end ) + return itertools.imap( self.get_axt_at_offset, [ val for start, end, val in intersections ] ) + + def get_axt_at_offset( self, offset ): + if self.f: + self.f.seek( offset ) + return read_next_axt( self.f, self.species1, self.species2, self.species_to_lengths, self.support_ids ) + else: + f = open( self.axt_filename ) + try: + f.seek( offset ) + return read_next_axt( f, self.species1, self.species2, self.species_to_lengths, self.support_ids ) + finally: + f.close() + +class Reader( object ): + """Iterate over all axt blocks in a file in order""" + + def __init__( self, file, species1 = None, species2=None, species_to_lengths=None, support_ids=False ): + self.file = file + # nota bene: (self.species1 = species1 or "species1") is incorrect if species1="" + self.species1 = species1 + if (self.species1 == None): self.species1 = "species1" + self.species2 = species2 + if (self.species2 == None): self.species2 = "species2" + self.species_to_lengths = species_to_lengths + self.support_ids = support_ids # for extra text at end of axt header lines + self.attributes = {} + + def next( self ): + return read_next_axt( self.file, self.species1, self.species2, self.species_to_lengths, self.support_ids ) + + def __iter__( self ): + return ReaderIter( self ) + + def close( self ): + self.file.close() + +class ReaderIter( object ): + def __init__( self, reader ): + self.reader = reader + def __iter__( self ): + return self + def next( self ): + v = self.reader.next() + if not v: raise StopIteration + return v + +class Writer( object ): + + def __init__( self, file, attributes={} ): + self.file = file + self.block = 0 + self.src_split = True + if ("src_split" in attributes): + self.src_split = attributes["src_split"] + + def write( self, alignment ): + if (len(alignment.components) != 2): + raise "%d-component alignment is not compatible with axt" % \ + len(alignment.components) + c1 = alignment.components[0] + c2 = alignment.components[1] + + if c1.strand != "+": + c1 = c1.reverse_complement() + c2 = c2.reverse_complement() + + if (self.src_split): + spec1,chr1 = src_split( c1.src ) + spec2,chr2 = src_split( c2.src ) + else: + chr1,chr2 = c1.src,c2.src + + self.file.write( "%d %s %d %d %s %d %d %s %s\n" % \ + (self.block,chr1,c1.start+1,c1.start+c1.size, + chr2,c2.start+1,c2.start+c2.size,c2.strand, + alignment.score)) + self.file.write( "%s\n" % c1.text ) + self.file.write( "%s\n" % c2.text ) + self.file.write( "\n" ) + self.block += 1 + + def close( self ): + self.file.close() + +# ---- Helper methods --------------------------------------------------------- + +# typical axt block: +# 0 chr19 3001012 3001075 chr11 70568380 70568443 - 3500 [optional text] +# TCAGCTCATAAATCACCTCCTGCCACAAGCCTGGCCTGGTCCCAGGAGAGTGTCCAGGCTCAGA +# TCTGTTCATAAACCACCTGCCATGACAAGCCTGGCCTGTTCCCAAGACAATGTCCAGGCTCAGA +# start and stop are origin-1, inclusive +# first species is always on plus strand +# when second species is on minus strand, start and stop are counted from sequence end + +def read_next_axt( file, species1, species2, species_to_lengths=None, support_ids=False ): + line = readline( file, skip_blank=True ) + if not line: return + fields = line.split() + if (len(fields) < 9) or ((not support_ids) and (len(fields) > 9)): + raise "bad axt-block header: %s" % line + attributes = {} + if (len(fields) > 9): + attributes["id"] = "_".join(fields[9:]) + seq1 = readline( file ) + if not line or line.isspace(): raise "incomplete axt-block; header: %s" % line + seq2 = readline( file ) + if not line or line.isspace(): raise "incomplete axt-block; header: %s" % line + # Build 2 component alignment + alignment = Alignment(attributes=attributes,species_to_lengths=species_to_lengths) + # Build component for species 1 + component = Component() + component.src = fields[1] + if (species1 != ""): component.src = species1 + "." + component.src + component.start = int( fields[2] ) - 1 # (axt intervals are origin-1 + end = int( fields[3] ) # and inclusive on both ends) + component.size = end - component.start + component.strand = "+" + component.text = seq1.strip() + alignment.add_component( component ) + # Build component for species 2 + component = Component() + component.src = fields[4] + if (species2 != ""): component.src = species2 + "." + component.src + component.start = int( fields[5] ) - 1 + end = int( fields[6] ) + component.size = end - component.start + component.strand = fields[7] + component.text = seq2.strip() + alignment.add_component( component ) + # add score + try: + alignment.score = int( fields[8] ) + except: + try: + alignment.score = float( fields[8] ) + except: + alignment.score = fields[8] + return alignment + +def readline( file, skip_blank=False ): + """Read a line from provided file, skipping any blank or comment lines""" + while 1: + line = file.readline() + if not line: return None + if line[0] != '#' and not ( skip_blank and line.isspace() ): + return line + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/core.py b/code/utilities/CPAT-1.2.2/lib/bx/align/core.py new file mode 100755 index 0000000..8ac7df3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/core.py @@ -0,0 +1,426 @@ +""" +Classes that represent alignments between multiple sequences. +""" + +import random +import string +import weakref +from bx.misc.readlengths import read_lengths_file + +# DNA reverse complement table +## DNA_COMP = " - " \ +## " TVGH CD M KN YSA BWXR tvgh cd m kn ysa bwxr " \ +## " " \ +## " " + +DNA_COMP = string.maketrans( "ACGTacgt", "TGCAtgca" ) + +class Alignment( object ): + + def __init__( self, score=0, attributes={}, species_to_lengths=None ): + # species_to_lengths is needed only for file formats that don't provide + # chromosome lengths; it maps each species name to one of these: + # - the name of a file that contains a list of chromosome length pairs + # - a dict mapping chromosome names to their length + # - a single length value (useful when we just have one sequence and no chromosomes) + # internally a file name is replaced by a dict, but only on an "as + # needed" basis + self.score = score + self.text_size = 0 + self.attributes = attributes + if species_to_lengths == None: self.species_to_lengths = {} + else: self.species_to_lengths = species_to_lengths + self.components = [] + + def add_component( self, component ): + component._alignment = weakref.ref( self ) + self.components.append( component ) + if component.text is not None: + if self.text_size == 0: + self.text_size = len( component.text ) + elif self.text_size != len( component.text ): + raise Exception( "Components must have same text length" ) + + def get_score( self ): + return self.__score + def set_score( self,score ): + if type( score ) == str: + try: + score = int(score) + except: + try: + score = float(score) + except: + pass + self.__score = score + score = property( fget=get_score,fset=set_score ) + + def __str__( self ): + s = "a score=" + str( self.score ) + for key in self.attributes: + s += " %s=%s" % ( key, self.attributes[key] ) + s += "\n" + # Components + for c in self.components: + s += str( c ) + s += "\n" + return s + + def src_size( self, src ): + species,chrom = src_split( src ) + if species in self.species_to_lengths: + chrom_to_length = self.species_to_lengths[species] + elif chrom in self.species_to_lengths: + chrom_to_length = self.species_to_lengths + else: + raise "no src_size (no length file for %s)" % species + if type( chrom_to_length ) == int: # (if it's a single length) + return chrom_to_length + if type( chrom_to_length ) == type( "" ): # (if it's a file name) + chrom_to_length = read_lengths_file( chrom_to_length ) + self.species_to_lengths[species] = chrom_to_length + if chrom not in chrom_to_length: raise "no src_size (%s has no length for %s)" % ( species, chrom ) + return chrom_to_length[chrom] + + def get_component_by_src( self, src ): + for c in self.components: + if c.src == src: return c + return None + + def get_components_by_src( self, src ): + for c in self.components: + if c.src == src: yield c + + def get_component_by_src_start( self, src ): + for c in self.components: + if c.src.startswith( src ): return c + return None + + def slice( self, start, end ): + new = Alignment( score=self.score, attributes=self.attributes ) + for component in self.components: + # FIXME: Is this the right solution? + if component.empty: + continue + new.components.append( component.slice( start, end ) ) + new.text_size = end - start + return new + + def reverse_complement( self ): + new = Alignment( score=self.score, attributes=self.attributes ) + for component in self.components: + new.components.append( component.reverse_complement() ) + new.text_size = self.text_size + return new + + def slice_by_component( self, component_index, start, end ): + """ + Return a slice of the alignment, corresponding to an coordinate interval in a specific component. + + component_index is one of + an integer offset into the components list + a string indicating the src of the desired component + a component + + start and end are relative to the + strand, regardless of the component's strand. + + """ + if type( component_index ) == type( 0 ): + ref = self.components[ component_index ] + elif type( component_index ) == type( "" ): + ref = self.get_component_by_src( component_index ) + elif type( component_index ) == Component: + ref = component_index + else: + raise ValueError( "can't figure out what to do" ) + start_col = ref.coord_to_col( start ) + end_col = ref.coord_to_col( end ) + if (ref.strand == '-'): + (start_col,end_col) = (end_col,start_col) + return self.slice( start_col, end_col ) + + def column_iter( self ): + for i in range( self.text_size ): + yield [ c.text[i] for c in self.components ] + + def limit_to_species( self, species ): + new = Alignment( score=self.score, attributes=self.attributes ) + new.text_size = self.text_size + for component in self.components: + if component.src.split('.')[0] in species: + new.add_component( component ) + return new + + def remove_all_gap_columns( self ): + """ + Remove any columns containing only gaps from alignment components, + text of components is modified IN PLACE. + """ + seqs = [] + for c in self.components: + try: + seqs.append( list( c.text ) ) + except TypeError: + seqs.append( None ) + i = 0 + text_size = self.text_size + while i < text_size: + all_gap = True + for seq in seqs: + if seq is None: continue + if seq[i] != '-': all_gap = False + if all_gap: + for seq in seqs: + if seq is None: continue + del seq[i] + text_size -= 1 + else: + i += 1 + for i in range( len( self.components ) ): + if seqs[i] is None: continue + self.components[i].text = ''.join( seqs[i] ) + self.text_size = text_size + + def __eq__( self, other ): + if other is None or type( other ) != type( self ): + return False + if self.score != other.score: + return False + if self.attributes != other.attributes: + return False + if len( self.components ) != len( other.components ): + return False + for c1, c2 in zip( self.components, other.components ): + if c1 != c2: + return False + return True + + def __ne__( self, other ): + return not( self.__eq__( other ) ) + + def __deepcopy__( self, memo ): + from copy import deepcopy + new = Alignment( score=self.score, attributes=deepcopy( self.attributes ), species_to_lengths=deepcopy( self.species_to_lengths ) ) + for component in self.components: + new.add_component( deepcopy( component ) ) + return new + +class Component( object ): + + def __init__( self, src='', start=0, size=0, strand=None, src_size=None, text='' ): + self._alignment = None + self.src = src + self.start = start # Nota Bene: start,size,strand are as they + self.size = size # .. appear in a MAF file-- origin-zero, end + self.strand = strand # .. excluded, and minus strand counts from + self._src_size = src_size # .. end of sequence + self.text = text + self.quality = None + # Optional fields to keep track of synteny status (only makes sense + # when the alignment is part of an ordered set) + self.synteny_left = None + self.synteny_right = None + self.synteny_empty = None + # If true, this component actually represents a non-aligning region, + # and has no text. + self.empty = False + # Index maps a coordinate (distance along + strand from + start) to alignment column + self.index = None + + def __str__( self ): + if self.empty: + rval = "e %s %d %d %s %d %s" % ( self.src, self.start, + self.size, self.strand, + self.src_size, self.synteny_empty ) + else: + rval = "s %s %d %d %s %d %s" % ( self.src, self.start, + self.size, self.strand, + self.src_size, self.text ) + if self.synteny_left and self.synteny_right: + rval += "\ni %s %s %d %s %d" % ( self.src, + self.synteny_left[0], self.synteny_left[1], + self.synteny_right[0], self.synteny_right[1] ) + return rval + + def get_end( self ): + return self.start + self.size + end = property( fget=get_end ) + + def get_src_size( self ): + if self._src_size == None: + if self._alignment == None: + raise Exception("component has no src_size") + self._src_size = self._alignment().src_size( self.src ) + return self._src_size + def set_src_size( self,src_size ): + self._src_size = src_size + src_size = property( fget=get_src_size, fset=set_src_size ) + + def get_forward_strand_start( self ): + if self.strand == '-': return self.src_size - self.end + else: return self.start + forward_strand_start = property( fget=get_forward_strand_start ) + + def get_forward_strand_end( self ): + if self.strand == '-': return self.src_size - self.start + else: return self.end + forward_strand_end = property( fget=get_forward_strand_end) + + def reverse_complement( self ): + start = self.src_size - self.end + if self.strand == "+": strand = "-" + else: strand = "+" + comp = [ch for ch in self.text.translate(DNA_COMP)] + comp.reverse() + text = "".join(comp) + new = Component( self.src, start, self.size, strand, self._src_size, text ) + new._alignment = self._alignment + return new + + def slice( self, start, end ): + new = Component( src=self.src, start=self.start, strand=self.strand, src_size=self._src_size ) + new._alignment = self._alignment + new.text = self.text[start:end] + + #for i in range( 0, start ): + # if self.text[i] != '-': new.start += 1 + #for c in new.text: + # if c != '-': new.size += 1 + new.start += start - self.text.count( '-', 0, start ) + new.size = len( new.text ) - new.text.count( '-' ) + + # FIXME: This annotation probably means nothing after slicing if + # one of the ends changes. In general the 'i' rows of a MAF only + # make sense in context (relative to the previous and next alignments + # in a stream, slicing breaks that). + new.synteny_left = self.synteny_left + new.synteny_right = self.synteny_right + + return new + + def slice_by_coord( self, start, end ): + """ + Return the slice of the component corresponding to a coordinate interval. + + start and end are relative to the + strand, regardless of the component's strand. + + """ + start_col = self.coord_to_col( start ) + end_col = self.coord_to_col( end ) + if (self.strand == '-'): + (start_col,end_col) = (end_col,start_col) + return self.slice( start_col, end_col ) + + def coord_to_col( self, pos ): + """ + Return the alignment column index corresponding to coordinate pos. + + pos is relative to the + strand, regardless of the component's strand. + + """ + start,end = self.get_forward_strand_start(),self.get_forward_strand_end() + if pos < start or pos > end: + raise "Range error: %d not in %d-%d" % ( pos, start, end ) + if not self.index: + self.index = list() + if (self.strand == '-'): + # nota bene: for - strand self.index[x] maps to one column + # higher than is actually associated with the position; thus + # when slice_by_component() and slice_by_coord() flip the ends, + # the resulting slice is correct + for x in range( len(self.text)-1,-1,-1 ): + if not self.text[x] == '-': + self.index.append( x + 1 ) + self.index.append( 0 ) + else: + for x in range( len(self.text) ): + if not self.text[x] == '-': + self.index.append(x) + self.index.append( len(self.text) ) + x = None + try: + x = self.index[ pos - start ] + except: + raise Exception("Error in index.") + return x + + + def __eq__( self, other ): + if other is None or type( other ) != type( self ): + return False + return ( self.src == other.src + and self.start == other.start + and self.size == other.size + and self.strand == other.strand + and self._src_size == other._src_size + and self.text == other.text + and self.synteny_left == other.synteny_left + and self.synteny_right == other.synteny_right + and self.synteny_empty == other.synteny_empty + and self.empty == other.empty ) + + def __ne__( self, other ): + return not( self.__eq__( other ) ) + + def __deepcopy__( self, memo ): + new = Component( src=self.src, start=self.start, size=self.size, strand=self.strand, src_size=self._src_size, text=self.text ) + new._alignment = self._alignment + new.quality = self.quality + new.synteny_left = self.synteny_left + new.synteny_right = self.synteny_right + new.synteny_empty = self.synteny_empty + new.empty = self.empty + new.index = self.index + return new + +def get_reader( format, infile, species_to_lengths=None ): + import bx.align.maf, bx.align.axt, bx.align.lav + if format == "maf": return bx.align.maf.Reader( infile, species_to_lengths ) + elif format == "axt": return bx.align.axt.Reader( infile, species_to_lengths ) + elif format == "lav": return bx.align.lav.Reader( infile ) + else: raise "Unknown alignment format %s" % format + +def get_writer( format, outfile, attributes={} ): + import bx.align.maf, bx.align.axt, bx.align.lav + if format == "maf": return bx.align.maf.Writer( outfile, attributes ) + elif format == "axt": return bx.align.axt.Writer( outfile, attributes ) + elif format == "lav": return bx.align.lav.Writer( outfile, attributes ) + else: raise "Unknown alignment format %s" % format + +def get_indexed( format, filename, index_filename=None, keep_open=False, species_to_lengths=None ): + import bx.align.maf, bx.align.axt, bx.align.lav + if format == "maf": return bx.align.maf.Indexed( filename, index_filename, keep_open, species_to_lengths ) + elif format == "axt": return bx.align.axt.Indexed( filename, index_filename, keep_open, species_to_lengths ) + elif format == "lav": raise Exception("LAV support for Indexed has not been implemented") + else: raise "Unknown alignment format %s" % format + +def shuffle_columns( a ): + """Randomize the columns of an alignment""" + mask = range( a.text_size ) + random.shuffle( mask ) + for c in a.components: + c.text = ''.join( [ c.text[i] for i in mask ] ) + +def src_split( src ): # splits src into species,chrom + dot = src.rfind( "." ) + if dot == -1: return None,src + else: return src[:dot],src[dot+1:] + +def src_merge( species,chrom,contig=None ): # creates src (inverse of src_split) + if species == None: src = chrom + else: src = species + "." + chrom + if contig != None: src += "[%s]" % contig + return src + +# ---- Read C extension if available --------------------------------------- + +try: + from _core import coord_to_col +except: + def coord_to_col( start, text, pos ): + col = 0 + while start < pos: + if text[col] != '-': + start += 1 + col += 1 + return col diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/epo.py b/code/utilities/CPAT-1.2.2/lib/bx/align/epo.py new file mode 100755 index 0000000..b600808 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/epo.py @@ -0,0 +1,271 @@ + +"""Classes and utilities for mutliple alignments from the EPO pipeline""" + + +import logging, re, cPickle, os +from collections import namedtuple +from itertools import imap + +from _epo import rem_dash, fastLoadChain, bed_union, cummulative_intervals + + +log = logging.getLogger(__name__) + +class Chain( namedtuple('Chain', 'score tName tSize tStrand tStart tEnd qName qSize qStrand qStart qEnd id') ): + """A Chain header as in http://genome.ucsc.edu/goldenPath/help/chain.html + + chain coordinates are with respect to the strand, so for example tStart on the + strand is the + distance from the 0th position from the left; tStart on the - strand is the distance from + the last position from the right.""" + + __slots__ = () + + def __str__(self): + return "chain {score} {tName} {tSize} {tStrand} {tStart} {tEnd} {qName} {qSize} {qStrand} {qStart} {qEnd} {id}".format(**self._asdict()) + + @classmethod + def _strfactory(cls, line): + """factory class method for Chain + + :param line: header of a chain (in .chain format) + """ + + assert type(line) == str, "this is a factory from string" + + line = line.rstrip().split()[1:] # the first component is the keyword "chain" + tup = map(lambda t: t[0](t[1]), + zip([int, str, int, str, int, int, str, int, str, int, int, str], line)) + return tuple.__new__(cls, tup) + + @classmethod + def _make_from_epo(cls, trg_comp, qr_comp, trg_chrom_sizes, qr_chrom_sizes): + """crate a chain of collinear rings from the given components. + + The target of the chain will always be on the forward strand. + This is done to avoid confusion when mapping psl files. So, + if trg_comp.strand=-, qr_comp.strand=- (resp. +) the + chain header will have tStrand=+, qStrand=+ (resp. -). No strand + changes on the other cases. + + :param trg_comp: target (i.e, the first) component + :type trg_comp: L{EPOitem} + :param qr_comp: query (i.e, the second) component + :type qr_comp: L{EPOitem} + :param trg_chrom_sizes: chromosome sizes of the target + :type trg_chrom_sizes: dictionary of the type (chrom) --> size + :param qr_chrom_sizes: chromosome sizes of the query + :type qr_chrom_sizes: dictionary of the type (chrom) --> size + :return: A L{Chain} instance""" + + # size, target, query arrays + S, T, Q = [], [], [] + + #the target strand of the chain must be on the forward strand + trg_intervals = trg_comp.intervals(reverse = trg_comp.strand == '-') + qr_intervals = qr_comp.intervals(reverse = trg_comp.strand == '-') + if len(trg_intervals) == 0 or len(qr_intervals) == 0: + log.warning("deletion/insertion only intervals") + return None + A, B = rem_dash(trg_intervals, qr_intervals) + # correct for when cigar starts/ends with dashes (in number of bases) + tr_start_correction = max(B[0][0] - A[0][0], 0) + tr_end_correction = max(A[-1][1] - B[-1][1], 0) + qr_start_correction = max(A[0][0] - B[0][0], 0) + qr_end_correction = max(B[-1][1] - A[-1][1], 0) + + a, b = A.pop(0), B.pop(0) + + # intervals are 0-base, halfo-open => lengths = coordinate difference + while A or B: + if a[1] < b[1]: + T.append(0); Q.append( A[0][0] - a[1] ); S.append( min(a[1], b[1]) - max(a[0], b[0]) ) + a = A.pop(0) + elif b[1] < a[1]: + Q.append(0); T.append( B[0][0] - b[1] ); S.append( min(a[1], b[1]) - max(a[0], b[0]) ) + b = B.pop(0) + elif A and B: + assert 1 > 2, "there are dash columns" + else: + break + S.append( min(a[1], b[1]) - max(a[0], b[0]) ) + assert len(T) == len(Q) == len(S) - 1, "(S, T, Q) = (%d, %d, %d)" % tuple(map(len, (S, T, Q))) + + tSize = trg_chrom_sizes[trg_comp.chrom] + qSize = qr_chrom_sizes[qr_comp.chrom] + ## UCSC coordinates are 0-based, half-open and e! coordinates are 1-base, closed + ## chain_start = epo_start - 1 and chain_end = epo_end + if qr_comp.strand == '+': + chain = Chain(0, + trg_comp.chrom, tSize, "+", + (trg_comp.start - 1) + tr_start_correction, trg_comp.end - tr_end_correction, + qr_comp.chrom, qSize, (qr_comp.strand == trg_comp.strand and '+' or '-'), + (qr_comp.start - 1) + qr_start_correction, qr_comp.end - qr_end_correction, + qr_comp.gabid) + else: + chain = Chain(0, + trg_comp.chrom, tSize, "+", + (trg_comp.start - 1) + tr_start_correction, trg_comp.end - tr_end_correction, + qr_comp.chrom, qSize, (qr_comp.strand == trg_comp.strand and '+' or '-'), + (qr_comp.start - 1) + qr_end_correction, qr_comp.end - qr_start_correction, + qr_comp.gabid) + + # strand correction. in UCSC coordinates this is: size - coord + if chain.qStrand == '-': + chain = chain._replace(qEnd = chain.qSize - chain.qStart, + qStart = chain.qSize - chain.qEnd) + + assert chain.tEnd - chain.tStart == sum(S) + sum(T), "[%s] %d != %d" % (str(chain), + chain.tEnd - chain.tStart, sum(S) + sum(T)) + assert chain.qEnd - chain.qStart == sum(S) + sum(Q), "[%s] %d != %d" % (str(chain), + chain.qEnd - chain.qStart, sum(S) + sum(Q)) + return chain, S, T, Q + + def slice(self, who): + "return the slice entry (in a bed6 format), AS IS in the chain header" + + assert who in ('t', 'q'), "who should be 't' or 'q'" + + if who == 't': + return (self.tName, self.tStart, self.tEnd, self.id, self.score, self.tStrand) + else: + return (self.qName, self.qStart, self.qEnd, self.id, self.score, self.qStrand) + + def bedInterval(self, who): + "return a BED6 entry, thus DOES coordinate conversion for minus strands" + + if who == 't': + st, en = self.tStart, self.tEnd + if self.tStrand == '-': + st, en = self.tSize-en, self.tSize-st + return (self.tName, st, en, self.id, self.score, self.tStrand) + else: + st, en = self.qStart, self.qEnd + if self.qStrand == '-': + st, en = self.qSize-en, self.qSize-st + assert en-st == self.qEnd - self.qStart + return (self.qName, st, en, self.id, self.score, self.qStrand) + + @classmethod + def _parse_file(cls, fname, pickle=False): + """parse a .chain file into a list of the type [(L{Chain}, arr, arr, arr) ...] + + :param fname: name of the file""" + + if fname.endswith('.pkl'): + log.debug("loading pickled file %s ..." % fname) + return cPickle.load( open(fname) ) + elif os.path.isfile("%s.pkl" % fname): + log.info("loading pickled file %s.pkl ..." % fname) + if os.stat(fname).st_mtime > os.stat("%s.pkl" % fname).st_mtime: + log.critical("*** pickled file %s.pkl is not up to date ***" % (fname)) + return cPickle.load( open("%s.pkl" % fname) ) + + data = fastLoadChain(fname, cls._strfactory) + if pickle and not os.path.isfile('%s.pkl' % fname): + log.info("pckling to %s.pkl" % (fname)) + with open('%s.pkl' % fname, 'wb') as fd: + cPickle.dump(data, fd) + return data + +class EPOitem(namedtuple('Epo_item', 'species gabid chrom start end strand cigar')): + "this format is how alignments are delivered from e!" + + __slots__ = () + + cigar_pattern = re.compile("(\d*)([MD])") + + def __repr__(self): return str(self) + + def __str__(self): + c = self.cigar[:5] + "..." + self.cigar[-5:] + return "(%s %s %s %d %d %s %s)" % tuple(self[:6] + (c,)) + + @classmethod + def _strfactory(cls, line): + """factory method for an EPOitem + + :param line: a line of input""" + + cmp = line.rstrip().split() + chrom = cmp[2] + if not chrom.startswith("chr"): + chrom = "chr%s" % chrom + instance = tuple.__new__(cls, + (cmp[0], cmp[1], + chrom, int(cmp[3]), int(cmp[4]), + {'1' : '+', '-1' : '-'}[cmp[5]], cmp[6])) + span = instance.end - instance.start + 1 + m_num = sum( map(lambda t: (t[1] == "M" and [t[0]] or [0])[0] , instance.cigar_iter(False)) ) + if span != m_num: + log.warning("[{gabid}] {species}.{chrom}:{start}-{end}.".format(**instance._asdict()) + "(span) %d != %d (matches)" % (span, m_num)) + return None + return instance + + @classmethod + def _parse_epo(cls, fname): + """Load an entire file in the EPO format into a dictionary of the type {gab_id => [Epoitem, ...]} + + :param fname: file name""" + + data = {} + with open(fname) as fd: + for el in imap(cls._strfactory, fd): + if el: + data.setdefault(el.gabid, []).append( el ) + log.info("parsed %d elements from %s" % (len(data), fname)) + return data + + def cigar_iter(self, reverse): + """self.cigar => [(length, type) ... ] iterate the cigar + + :param reverse: whether to iterate in the reverse direction (right-to-left) + :type reverse: boolean + + :return a list of pairs of the type [(length, M/D) ..] + """ + + l = 0 + P = self.cigar_pattern + + data = [] + cigar = self.cigar + parsed_cigar = re.findall(P, cigar) + if reverse: + parsed_cigar = parsed_cigar[::-1] + for _l, t in parsed_cigar: + # 1M is encoded as M + l = (_l and int(_l) or 1) # int(_l) cannot be 0 + data.append( (l, t) ) + return data + + def intervals(self, reverse, thr=0): + """return a list of (0-based half-open) intervals representing the match regions of the cigar + + for example 4MD4M2DM with reverse=False will produce [(0,4), (5,9), (11,12)] + 4MD4M2DM with reverse=True will produce [(0,1), (3,7), (8,12)] (= 12 - previous interval) + + :param reverse: whether to iterate in the reverse direction (right-to-left) (this is passed as is to self.cigar_iter) + :type reverse: boolean + :param thr: shift all intervals by this much + :type thr: integer + + :return: list of pairs""" + + d = [(thr,thr)] + dl = 0 + for tup in self.cigar_iter(reverse): + if tup[1] == "D": + dl = tup[0] + else: + s = d[-1][1] + dl + d.append( (s, s+tup[0]) ) + + assert d[0] == (thr, thr) + # assert that nr. of Ms in the interval == sum of produced intervals + assert sum( map(lambda t: t[0], filter(lambda t: t[1] == "M", self.cigar_iter(False))) ) == sum( map(lambda t: t[1]-t[0], d) ) + + d_sum = sum( map(lambda t: t[1]-t[0], d) ) + assert self.end - self.start + 1 == d_sum, "[ (%d, %d) = %d ] != %d" % (self.start, self.end, + self.end-self.start+1, d_sum) + return d[1:] #clip the (thr, thr) entry + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/epo_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/align/epo_tests.py new file mode 100755 index 0000000..c066aba --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/epo_tests.py @@ -0,0 +1,234 @@ +"tests for bx.align.epo" + +import unittest, logging, pdb +import random +import numpy as np + +from bx.align._epo import cummulative_intervals, bed_union +from bx.align.epo import * + +class TestBed( unittest.TestCase ): + def setUp(self): + self.N = random.randint(1, 1000) + + def test_ci(self): + S, D = [], [] + for i in range(self.N): + S.append( random.randint(10, 50) ) + D.append( random.randint(10, 50) ) + D[-1] = 0 + C = cummulative_intervals(np.array(S, dtype=np.int64), + np.array(D, dtype=np.int64)) + for i in range(self.N): + assert C[i,1] - C[i,0] == S[i] + for i in range(1, self.N): + assert C[i,0] - C[i-1,1] == D[i-1], "[%d] %d != %d" % (i, C[i,0] - C[i-1,1], D[i-1]) + + def test_elem_u(self): + # back to back, so should return a single interval + EL = [] + th = 0 + for i in range(self.N): + size = random.randint(1, 20) + EL.append( (th, th+size) ) + th += size + U = bed_union( np.array(EL, dtype=np.uint64) ) + assert U[0,0] == 0 and U[0,1] == th + + # disjoint + EL = [] + th = 0 + for i in range(self.N): + size = random.randint(1, 20) + EL.append( (th, th+size) ) + th += (size + 1) + U = bed_union( np.array(EL, dtype=np.uint64) ) + for i in range(U.shape[0]): + assert (U[i,0], U[i,1]) == EL[i] + + # random with some empty elements + EL = [] + th = 0 + for i in range(self.N): + size = random.randint(1, 20) + EL.append( (th, th+size) ) + th += random.randint(1, size+size) #50% of overlapping + U = bed_union( np.array(EL, dtype=np.uint64) ) + + assert U[0,1] > U[0,0] + for i in range(1, U.shape[0]): + assert U[i,1] > U[i,0] + assert U[i,0] > U[i-1,1] + +cigar_pairs = [ +("GGACCTGGAGAGATCAG---------------------------GACTTCAACTGTGTG-------------TCTTAGACTGGG--------AGGGTGTTA", + "AGGCCAGGAGAGATCAGGTAAGTCTTAATTTAATAAAGAGATAGGACCTGAACTGTGTCTAACAATAGGTAATATTAGACTGGGGGAGAGAGAAGACTTTC"), + +("TTT--------------------------------------------------------------------------------------------------------------------T", + "CTTGTACCAAGGACAGTACTGGCAGCCTAATTGCTAACACTTTGTGGTGGATTGGTCCACTCAATATTTGTTCCCACCTCTTTTCAGTCCAGTTCTATAAAGGACAGAAAGTTGAAAACT"), + +("A-------------------------------------------------ACACTGGACACAGCACTAACACGATTACTTA", + "ACATTTCCCACACTCCCTTGCAGCTAGGTTTCTAGATATAATTTAGATTCCA----------------------------A"), + +("TTTGGTCCTCTGGA------CGAGCAGCCAGTGCT---------------------------------------------------------------------------AAAAAAAA", + "T---CATTCTAGCAGGTGCTGCAGCAGCAGGTAGCCCTGGAGCCAACAGTTGTGGCTATGATTCTTGATCATCAGATTTGGCTCAAGTGATGTGTTCCTCTAGCATGCACTTGAGATA"), + +("G-----------------------C----------------------------------------------------------------------------------------A", + "GGCCTGCACTGCCAGTAATTTTAACAAATTTTTAGGCACTGAATTCCCTGTATTAAATCTGTTTTCCTTAGCGTAAACAGATCTCTGTTAAATGAAACTAAACCCTGACTGATA"), + +("TATT----------------------------------T", + "TCCTTCATTTTATTTCTCCCTTAAAATTTTTTTTATTACT"), + +("TAAAAA--A------A------------------------------------------------------------TTTTTTTTTTT", + "T---AATTATTTTGCAGCAGGTCCTTGATAACATATCATCTATAAATATTTCAGCAAGAATCTCTAAAAGGCAAGAACCTCCTTCTT"), + +("AAACAA---------------------------------------TT---T", + "AAACAATACCACTGCATCACTATCAAACCCAAAAAATAACAAAAATTGGGT"), + +("TCTTAAC---TGCTGAGCCATCCCTCCAGCTCCTGTTTTATTTTTATTATGAAGTAATAATA--ATAG--TAATAATAATGATG", + "TACACTTAATTCTAAAACTTGTTATGAATCATCA----------TTGG--TTTTTTATTGTGAAGAACTAATATAATCAGA--G"), + +("ATGATAATGGTATCCTAGCTCAACACCTG-GAGTTCACCCCAACAGTTAACTAA----GTTTGAGGAAGTGTTAACAAGCCTA---ACAAAGAGGACATGCCAATAGCTGACAGAGTCAC", + "A-------CCTCTGCTAGCTCAACTCCTGAGAATCAATTATATAAGCTAGGTCAGTGGTTTTGAGAAAGTATTAGTAGACATTTCTCCAAAGAATACATAAAAATGGCC-A--CAAGTAT") +] + +def toCigar(species, id, s): + I = [(0,0)] + L = map(len, s.split("-")) + NZ = filter(lambda _: _, L) + + if L[0] > 0: + I.append( (0, L[0]) ) + NZ = NZ[1:] + L = L[1:] + + for i in range(len(NZ)): + L.insert(0, 0) + size = NZ[i] + start = L.index(size) + I.append( (I[-1][1] + start, I[-1][1]+start+size) ) + L = L[start+1:] + if len(L): + I.append((I[-1][1] + len(L), I[-1][1] + len(L))) + #print I[1:] + C = [] + for i in range(1,len(I)): + dl = I[i][0] - I[i-1][1] + ml = I[i][1] - I[i][0] + + dc = "" + if dl: + dc = (dl > 1 and str(dl) or "") + "D" + + mc = "" + if ml: + mc = (ml > 1 and str(ml) or "") + "M" + + C.append( dc+mc ) + MSUM = sum(map(lambda i: i[1]-i[0], I)) + start = random.randint(50, 10000) + return "%s\t%d\t1\t%d\t%d\t%d\t%s" % (species, id, start, start+MSUM-1, + random.choice((-1,1)), "".join(C)) + + + +class TestEpo( unittest.TestCase ): + def setUp(self): + self.epo_records = [] + for i, (t,q) in enumerate(cigar_pairs): + gab_pair = (toCigar("homo_sapiens", i, t), toCigar("mus_musculus", i, q)) + A = EPOitem._strfactory(gab_pair[0]) + B = EPOitem._strfactory(gab_pair[1]) + if A and B: + self.epo_records.append( (A,B) ) + + def test_out(self): + def ch(c, ci): + th = 0 + for l,t in ci: + if t == 'M': + assert c[th:th+l].find('-') == -1 + else: + assert c[th:th+l] == '-' * l + th += l + + for (a,b) in self.epo_records: + ca, cb = cigar_pairs[int(a.gabid)] + #if a.strand == '-': ca = ca[::-1] + #if b.strand == '-': cb = cb[::-1] + ch(ca, a.cigar_iter(False)) + ch(cb, b.cigar_iter(False)) + + def test_make_chain(self): + def cch(cigar, s, e): + return cigar[s:e].find('-') == -1 + + for p in self.epo_records: + chain = Chain._make_from_epo(p[0], p[1], {"chr1" : 500}, {"chr1" : 800}) + if not chain: + continue + ch, S, T, Q = chain + i = int( ch.id ) + c1, c2 = cigar_pairs[i] + if p[0].strand == '-': + c1 = c1[::-1] + c2 = c2[::-1] + th = 0 + for s, t, q in zip(S, T, Q): + if not (cch(c1, th, th+s) and cch(c2, th, th+s)): + pdb.set_trace() + assert cch(c1, th, th+s) and cch(c2, th, th+s), "%s and %s" % (c1[th:th+s], c2[th:th+s]) + if t > q: + cch(c1, th+s, th+s+t) and c1[th+s:th+s+t] == '-'*t + else: + cch(c2, th+s, th+s+q) and c1[th+s:th+s+q] == '-'*q + th = th + s + max(t,q) + + def test_rem_dash(self): + # ****--****-------**** 4M2D4M7D4M + # *******-------******* 7M7D7M + # has 4 dash columns and should become + # ****--****---**** 4M2D4M3D4M + # *******---******* 7M3D7M + + for i in range(100): + dash_cols = random.randint(0, 10) + tStart = random.randint(0, 1000) + qStart = random.randint(0, 1000) + epo_pair = (EPOitem._strfactory("homo_sapiens\t0\t1\t%d\t%d\t1\t%s" % (tStart, tStart+12-1, "4M2D4M%dD4M" % (dash_cols+3))), + EPOitem._strfactory("mus_musculus\t0\t1\t%d\t%d\t1\t%s" % (qStart, qStart+14-1, "7M%dD7M" % (dash_cols+3)))) + chain = Chain._make_from_epo(epo_pair[0], epo_pair[1], {"chr1":500}, {"chr1":800}) + ti = epo_pair[0].intervals(False) + qi = epo_pair[1].intervals(False) + assert ti[2][0] - ti[1][1] - dash_cols == chain[2][1] + assert qi[1][0] - qi[0][1] - dash_cols == chain[2][1] + + # ----***** + # *-------* + # has 3 dash cols and should become + # * + # * + # with the qStart += 1 and tStart += 4 + + for i in range(100): + dash_cols = random.randint(0, 10) + tm = random.randint(6, 10) + qm = random.randint(1, 5) + + tStart = random.randint(0, 1000) + qStart = random.randint(0, 1000) + + epo_pair = (EPOitem._strfactory("homo_sapiens\t0\t1\t%d\t%d\t1\t%s" % (tStart, tStart+tm-1, + "%dD%dM" % (dash_cols+1, tm))), + EPOitem._strfactory("mus_musculus\t0\t1\t%d\t%d\t1\t%s" % (qStart, qStart+qm+1-1, + "M%dD%dM" % (dash_cols+tm-qm, qm)))) + chain = Chain._make_from_epo(epo_pair[0], epo_pair[1], {"chr1":500}, {"chr1":800}) + if chain[1][-1] != qm: + pdb.set_trace() + assert chain[1][-1] == qm + # correct also for coordinate interpretation differences between UCSC and EPO + assert (qStart + 1) - 1 == chain[0].qStart, "%d != %d" % (qStart + 1, chain[0].qStart) + + +if __name__ == '__main__': + unittest.main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/lav.py b/code/utilities/CPAT-1.2.2/lib/bx/align/lav.py new file mode 100755 index 0000000..67c80c0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/lav.py @@ -0,0 +1,571 @@ +""" +Support for reading and writing the LAV format produced by the `blastz`_ +pairwise aligner. + +.. _blastz: http://www.bx.psu.edu/miller_lab/ +""" + +from bx.align import * +import bx.seq + +import sys,math,StringIO +import itertools +from bx import interval_index_file + +class Reader(object): + """Iterate over all lav blocks in a file in order""" + + def __init__(self,file,path_subs=None,fail_to_ns=False): + self.file = file + self.lineNumber = 0 + self.path_subs = path_subs # list of (prefix,replacement) to allow + if (self.path_subs == None): # .. redirection of sequence file paths + self.path_subs = [] # .. on different machines + self.fail_to_ns = fail_to_ns # True => if sequences fail to open, + # create a fake file of all Ns + + self.d_stanza_text = None + + self.seq1_filename = None + self.seq1_file = None + self.seq1_header = None + self.seq1_start = None + self.seq1_end = None + self.seq1_strand = None + self.seq1_contig = None + self.seq1_src = None + self.seq1_gap = None + + self.seq2_filename = None + self.seq2_file = None + self.seq2_header = None + self.seq2_start = None + self.seq2_end = None + self.seq2_strand = None + self.seq2_contig = None + self.seq2_src = None + self.seq2_gap = None + + def next(self): + while (True): + line = self.fetch_line(strip=None,requireLine=False) + assert (line), "unexpected end of file (missing #:eof)" + line = line.rstrip() + if (line == ""): # (allow blank lines between stanzas) + continue + if (line == "#:eof"): + line = self.file.readline().rstrip() + assert (not line), "extra line after #:eof (line %d, \"%s\")" \ + % (self.lineNumber,line) + return None + if (line == "#:lav"): + continue + if (line.startswith("d {")): + self.d_stanza_text = self.parse_unknown_stanza() + continue + if (line.startswith("s {")): + self.parse_s_stanza() + continue + if (line.startswith("h {")): + self.parse_h_stanza() + continue + if (line.startswith("a {")): + (score,pieces) = self.parse_a_stanza() + break + if (line.endswith("{")): + self.parse_unknown_stanza() + continue + assert (False), "incomprehensible line (line %d, \"%s\")" \ + % (self.lineNumber,line) + return self.build_alignment(score,pieces) + + def __iter__(self): + return ReaderIter(self) + + def close(self): + self.file.close() + + def open_seqs(self): + if (self.seq1_file != None) and (self.seq2_file != None): + return + + if (self.seq1_file == None): + if (self.seq1_strand == "+"): revcomp = False + else: revcomp = "-5'" + if (self.seq1_contig == 1): contig = None + else: contig = self.seq1_contig + try: + f = file(self.seq1_filename,"rb") + except: + if (self.fail_to_ns): + f = StringIO.StringIO(">seq1\n" + ("n" * (self.seq1_end - self.seq1_start))) + revcomp = False + contig = 1 + else: + assert (False), "failed to open %s" % self.seq1_filename + self.seq1_file = bx.seq.seq_file(f,revcomp=revcomp,contig=contig) + self.seq1_gap = self.seq1_file.gap + try: + name1 = self.header_to_src_name(self.seq1_header) + except ValueError: + try: + name1 = self.path_to_src_name(self.seq1_filename) + except ValueError: + name1 = "seq1" + (species1,chrom1) = src_split(name1) + self.seq1_src = src_merge(species1,chrom1,contig) + if (contig != None): chrom1 += "[%s]" % contig + + if (self.seq2_file == None): + if (self.seq2_strand == "+"): revcomp = False + else: revcomp = "-5'" + if (self.seq2_contig == 1): contig = None + else: contig = self.seq2_contig + try: + f = file(self.seq2_filename,"rb") + except: + if (self.fail_to_ns): + f = StringIO.StringIO(">seq2\n" + ("n" * (self.seq2_end - self.seq2_start))) + revcomp = False + contig = 1 + else: + assert (False), "failed to open %s" % self.seq1_filename + self.seq2_file = bx.seq.seq_file(f,revcomp=revcomp,contig=contig) + self.seq2_gap = self.seq2_file.gap + try: + name2 = self.header_to_src_name(self.seq2_header) + except ValueError: + try: + name2 = self.path_to_src_name(self.seq2_filename) + except ValueError: + name2 = "seq2" + (species2,chrom2) = src_split(name2) + self.seq2_src = src_merge(species2,chrom2,contig) + if (contig != None): chrom2 += "[%s]" % contig + + length1 = self.seq1_file.length + length2 = self.seq2_file.length + assert (species1 != species2) or (chrom1 != chrom2) or (length1 == length2), \ + "conflicting lengths for %s (%d and %d)" % (self.seq1_src,length1,length2) + + self.species_to_lengths = {} + self.species_to_lengths[species1] = {} + self.species_to_lengths[species2] = {} # (OK if it clobbers line above) + self.species_to_lengths[species1][chrom1] = self.seq1_file.length + self.species_to_lengths[species2][chrom2] = self.seq2_file.length + + def close_seqs(self): + if (self.seq1_file != None): + self.seq1_file.close() + self.seq1_file = None + if (self.seq2_file != None): + self.seq2_file.close() + self.seq2_file = None + + def parse_s_stanza(self): + self.close_seqs() + line = self.fetch_line(report=" in s-stanza") + (self.seq1_filename, + self.seq1_start, + self.seq1_end, + self.seq1_strand, + self.seq1_contig) = self.parse_s_seq(line) + + line = self.fetch_line(report=" in s-stanza") + (self.seq2_filename, + self.seq2_start, + self.seq2_end, + self.seq2_strand, + self.seq2_contig) = self.parse_s_seq(line) + + line = self.fetch_line(report=" in s-stanza") + assert (line == "}"), "improper s-stanza terminator (line %d, \"%s\")" \ + % (self.lineNumber,line) + + def parse_s_seq(self,line): + fields = line.split() + filename = fields[0].strip('"') + start = int(fields[1]) - 1 + end = int(fields[2]) + contig = int(fields[4]) + if (fields[3] == "1"): strand = "-" + else: strand = "+" + if (filename.endswith("-")): + assert (strand == "-"), "strand mismatch in \"%s\"" % line + filename = filename[:-1] + filename = do_path_subs(filename,self.path_subs) + return (filename,start,end,strand,contig) + + + def parse_h_stanza(self): + line = self.fetch_line(strip='"',report=" in h-stanza") + self.seq1_header = line + self.seq1_header_prefix = "" + if (line.startswith(">")): + self.seq1_header = line[1:].strip() + self.seq1_header_prefix = ">" + self.seq1_header = self.seq1_header.split(None,1) + if (len(self.seq1_header) > 0): self.seq1_header = self.seq1_header[0] + else: self.seq1_header = "seq1" + + line = self.fetch_line(strip='"',report=" in h-stanza") + self.seq2_header = line + self.seq2_header_prefix = "" + if (line.startswith(">")): + self.seq2_header = line[1:].strip() + self.seq2_header_prefix = ">" + self.seq2_header = self.seq2_header.split(None,1) + if (len(self.seq2_header) > 0): self.seq2_header = self.seq2_header[0] + else: self.seq2_header = "seq2" + + line = self.fetch_line(report=" in h-stanza") + assert (line == "}"), "improper h-stanza terminator (line %d, \"%s\")" \ + % (self.lineNumber,line) + + + def parse_a_stanza(self): + """returns the pair (score,pieces) + where pieces is a list of ungapped segments (start1,start2,length,pctId) + with start1,start2 origin-0""" + # 's' line -- score, 1 field + line = self.fetch_line(report=" in a-stanza") + fields = line.split() + assert (fields[0] == "s"), "s line expected in a-stanza (line %d, \"%s\")" \ + % (self.lineNumber,line) + try: score = int(fields[1]) + except: score = float(fields[1]) + + # 'b' line -- begin positions in seqs, 2 fields + line = self.fetch_line(report=" in a-stanza") + fields = line.split() + assert (fields[0] == "b"), "b line expected in a-stanza (line %d, \"%s\")" \ + % (self.lineNumber,line) + beg1 = int(fields[1]) - 1 + beg2 = int(fields[2]) - 1 + + # 'e' line -- end positions in seqs, 2 fields + line = self.fetch_line(report=" in a-stanza") + fields = line.split() + assert (fields[0] == "e"), "e line expected in a-stanza (line %d, \"%s\")" \ + % (self.lineNumber,line) + len1 = int(fields[1]) - beg1 + len2 = int(fields[2]) - beg2 + + # 'l' lines + pieces = [] + while (True): + line = self.fetch_line(report=" in a-stanza") + fields = line.split() + if (fields[0] != "l"): + break + start1 = int(fields[1]) - 1 + start2 = int(fields[2]) - 1 + length = int(fields[3]) - start1 + length2 = int(fields[4]) - start2 + try: pctId = int(fields[5]) + except: pctId = float(fields[5]) + assert (length2 == length), "length mismatch in a-stanza" + pieces.append((start1+self.seq1_start,start2+self.seq2_start,length,pctId)) + assert (line == "}"), "improper a-stanza terminator (line %d, \"%s\")" \ + % (self.lineNumber,line) + return (score,pieces) + + def parse_unknown_stanza(self): + lines = [] + while (True): + line = self.fetch_line() + assert (line), "unexpected end of file (missing #:eof)" + if (line == "}"): break + lines.append(line) + return " " + "\n ".join(lines) + "\n" + + def fetch_line(self,strip=True,requireLine=True,report=""): + if (strip == None): line = self.file.readline() + elif (strip == True): line = self.file.readline().strip() + else: line = self.file.readline().strip().strip(strip) + self.lineNumber += 1 + if (requireLine): + assert (line), \ + "unexpected blank line or end of file%s (line %d)" \ + % (report,self.lineNumber) + return line + + + def d_stanza(self): + if (self.d_stanza_text == None): return "" + return "d {\n%s}" % self.d_stanza_text + + def s_stanza(self): + if (self.seq1_filename == None): return "" + + if (self.seq1_strand == "-"): seq1_strand = "1" + else: seq1_strand = "0" + if (self.seq2_strand == "-"): seq2_strand = "1" + else: seq2_strand = "0" + + s = " \"%s\" %d %d %s %d\n"\ + % (self.seq1_filename,self.seq2_start+1,self.seq1_end, + seq1_strand,self.seq1_contig) + s += " \"%s\" %d %d %s %d\n"\ + % (self.seq2_filename,self.seq2_start+1,self.seq2_end, + seq2_strand,self.seq2_contig) + + return "s {\n%s}" % s + + def h_stanza(self): + if (self.seq1_header == None): return "" + s = " \"%s%s\"\n" % (self.seq1_header_prefix,self.seq1_header) + s += " \"%s%s\"\n" % (self.seq2_header_prefix,self.seq2_header) + return "h {\n%s}" % s + + def build_alignment(self,score,pieces): + """converts a score and pieces to an alignment""" + # build text + self.open_seqs() + text1 = text2 = "" + end1 = end2 = None + for (start1,start2,length,pctId) in pieces: + if (end1 != None): + if (start1 == end1): # insertion in sequence 2 + text1 += self.seq1_gap * (start2-end2) + text2 += self.seq2_file.get(end2,start2-end2) + else: # insertion in sequence 1 + text1 += self.seq1_file.get(end1,start1-end1) + text2 += self.seq2_gap * (start1-end1) + + text1 += self.seq1_file.get(start1,length) + text2 += self.seq2_file.get(start2,length) + end1 = start1 + length + end2 = start2 + length + # create alignment + start1 = pieces[0][0] + start2 = pieces[0][1] + end1 = pieces[-1][0] + pieces[-1][2] + end2 = pieces[-1][1] + pieces[-1][2] + size1 = end1 - start1 + size2 = end2 - start2 + a = Alignment(score=score,species_to_lengths=self.species_to_lengths) + #if (self.seq1_strand == "-"): start1 = self.seq1_file.length - end1 + a.add_component(Component(self.seq1_src,start1,size1,self.seq1_strand,text=text1)) + #if (self.seq2_strand == "-"): start2 = self.seq2_file.length - end2 + a.add_component(Component(self.seq2_src,start2,size2,self.seq2_strand,text=text2)) + return a + + def path_to_src_name(self,path_name): + # converts, e.g. ".../hg18/seq/chr13.nib" to "hg18.chr13" + if (path_name == None) or (path_name == ""): raise ValueError + if (path_name.endswith(".nib")): path_name = path_name[:-4] + if (path_name.endswith(".fa")): path_name = path_name[:-3] + if (path_name.endswith(".fasta")): path_name = path_name[:-6] + slash = path_name.rfind("/") + if (slash == -1): return path_name + name = path_name[slash+1:] + path_name = path_name[:slash] + if (path_name.endswith("/seq")): path_name = path_name[:-4] + slash = path_name.rfind("/") + if (slash != -1): path_name = path_name[slash+1:] + return path_name + "." + name + + def header_to_src_name(self,header): + # converts, e.g. "hg18.chr13:115404472-117281897" to "hg18.chr13" + if (header == None) or (header == ""): raise ValueError + colon = header.rfind(":") + if (colon != -1): header = header[:colon] + if ("/" in header): raise ValueError + if (header.count(".") == 0): + return header + header = header.split(".") + if (header[0] == "") or (header[1] == ""): raise ValueError + return ".".join(header) + +class ReaderIter(object): + def __init__(self,reader): + self.reader = reader + def __iter__(self): + return self + def next(self): + v = self.reader.next() + if (not v): raise StopIteration + return v + + +class LavAsPiecesReader(Reader): + """Iterate over all lav blocks in a file in order, returning alignments + as score and pieces, as returned by Reader.parse_a_stanza""" + + def build_alignment(self,score,pieces): + return (score,pieces) + + +class Writer(object): + + # blockHash is a hash from (src1,strand1,src2,strand2) to a list of blocks; + # the blocks are collected on each call to write(), but the actual writing + # does not occur until close(). + + def __init__(self,file,attributes={}): + self.file = file + self.fname1 = None + self.fname2 = None + self.block = 0 + self.blockHash = {} # (see note above) + + if ("name_format_1" in attributes): + self.fname1 = attributes["name_format_1"] + if ("name_format_2" in attributes): + self.fname2 = attributes["name_format_2"] + + if ("d_stanza" in attributes): + write_lav_marker(self) + print >>self.file,"d {" + print >>self.file,attributes["d_stanza"] + print >>self.file,"}" + + def write(self,alignment): + if (len(alignment.components) != 2): + raise "%d-component alignment is not compatible with lav" % \ + len(alignment.components) + + c1 = alignment.components[0] + c2 = alignment.components[1] + + key = (c1.src,c1.strand,c2.src,c2.strand) + if (key not in self.blockHash): self.blockHash[key] = [] + self.blockHash[key].append(alignment) + self.block += 1 + + def close(self): + keys = [key for key in self.blockHash] + keys = sort_keys_by_chrom (keys) + for key in keys: + (src1,strand1,src2,strand2) = key + alignment = self.blockHash[key][0] + self.src1 = src1 + self.strand1 = strand1 + self.length1 = alignment.src_size(src1) + self.src2 = src2 + self.strand2 = strand2 + self.length2 = alignment.src_size(src2) + self.write_s_stanza() + self.write_h_stanza() + for alignment in self.blockHash[key]: + self.write_a_stanza(alignment) + self.write_trailer() + if (self.file != sys.stdout): self.file.close() + + def write_s_stanza(self): + self.write_lav_marker() + (strand1,flag1) = minus_or_nothing(self.strand1) + (strand2,flag2) = minus_or_nothing(self.strand2) + fname1 = build_filename(self.fname1,self.src1) + fname2 = build_filename(self.fname2,self.src2) + print >>self.file,"s {" + print >>self.file," \"%s%s\" 1 %d %d 1" \ + % (fname1,strand1,self.length1,flag1) + print >>self.file," \"%s%s\" 1 %d %d 1" \ + % (fname2,strand2,self.length2,flag2) + print >>self.file,"}" + + def write_h_stanza(self): + strand1 = rc_or_nothing(self.strand1) + strand2 = rc_or_nothing(self.strand2) + print >>self.file,"h {" + print >>self.file," \"> %s%s\"" % (self.src1,strand1) + print >>self.file," \"> %s%s\"" % (self.src2,strand2) + print >>self.file,"}" + + def write_a_stanza(self,alignment): + c1 = alignment.components[0] + pos1 = c1.start + text1 = c1.text.upper() + c2 = alignment.components[1] + pos2 = c2.start + text2 = c2.text.upper() + + # collect ungapped pieces + + pieces = [] + piece1 = None + + for ix in range(len(text1)): + ch1 = text1[ix] + ch2 = text2[ix] + + nonGap = (ch1 != "-") and (ch2 != "-") + if (nonGap): + if (piece1 == None): # new piece starts + (piece1,piece2,idCount) = (pos1,pos2,0) + if (ch1 == ch2): idCount += 1 + elif (piece1 != None): # new gap starts + size = pos1 - piece1 + pctId = (200*idCount + size) / (2*size) + pieces.append((piece1,piece2,size,pctId)) + piece1 = None + + if (ch1 != "-"): pos1 += 1 + if (ch2 != "-"): pos2 += 1 + + if (piece1 != None): + size = pos1 - piece1 + pctId = (200*idCount + size) / (2*size) + pieces.append((piece1,piece2,size,pctId)) + + # write the block + + (start1,start2,size,pctId) = pieces[-1] # get end of final piece + end1 = start1 + size + end2 = start2 + size + + (start1,start2,size,pctId) = pieces[0] # get start of first piece + + score = int(round(alignment.score)) + + print >>self.file,"a {" + print >>self.file," s %s" % score + print >>self.file," b %d %d" % (start1+1,start2+1) + print >>self.file," e %d %d" % (end1, end2) + for (start1,start2,size,pctId) in pieces: + print >>self.file," l %d %d %d %d %d" \ + % (start1+1,start2+1,start1+size,start2+size,pctId) + print >>self.file,"}" + + def write_lav_marker(self): + print >>self.file,"#:lav" + + def write_trailer(self): + print >>self.file,"#:eof" + +def sort_keys_by_chrom (keys): + decorated = [(chrom_key(src1),strand1,chrom_key(src2),strand2,(src1,strand1,src2,strand2)) \ + for (src1,strand1,src2,strand2) in keys] + decorated.sort() + return [key for (src1,strand1,src2,strand2,key) in decorated] + +def chrom_key (src): + (species,chrom) = src_split(src) + if (chrom.startswith("chr")): chrom = chrom[3:] + try: chrom = int(chrom) + except ValueError: pass + return chrom + +def build_filename(fmt,src): + if (fmt == None): return src + num = fmt.count("%s") + if (num == 0): return fmt + (species,chrom) = src_split(src) + if (num == 1): return fmt % chrom + return fmt % (species,chrom) + +def minus_or_nothing(strand): + if (strand == "-"): return ("-",1) + else: return ("",0) + +def rc_or_nothing(strand): + if (strand == "-"): return " (reverse complement)" + else: return "" + +def do_path_subs(path,path_subs): + for (prefix,replacement) in path_subs: + if (path.startswith(prefix)): + return replacement + path[len(prefix):] + return path diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/lav_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/align/lav_tests.py new file mode 100755 index 0000000..dad0861 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/lav_tests.py @@ -0,0 +1,45 @@ +""" +Tests for `bx.align.lav`. +""" + +import unittest +import sys +import bx.align as align +import bx.align.lav as lav + +test_lav = "test_data/lav_tests/apple_orange.lav" + +class lavTestCase(unittest.TestCase): + + def testReader(self): + + reader = lav.Reader(file(test_lav)) + + a = reader.next() + assert a.score == 10286, "a.score is wrong: %s" % a.score + assert len(a.components) == 2 + check_component(a.components[0], "apple", 106, 252, "+", 411, "GTCCGGCCGGCTGAGAGCTACAATACACATGCACGCAGTTTGGCCACTCACATTAAGTATATGAGGAAGGGTTAGCATGAGTTGTACTATAAGGCAGCGGATAGCAGGTTGTGGAAAAATATCCTCCCGATTCAAATCCCCAGGTGCCTAAA----------------GTAGGGCCGGTAGTTGAATGCTTGCCTGTCAGACTGGATGACCAAGTTCAGTATCAACACAATATAGTGCCAGGAGCTAATTGTTCCCCAGCAGCGTGAC") + check_component(a.components[1], "lav_tests.orange", 53, 252, "+", 361, "GTCCGGCCGGCTGTGTGCTACAATACACGTTCACGCAGTTTGGCCAATCACTTTAAGTATATACGAAATGGTTACCATGAGTTGTACTGTAAGGCAGCGGAAAGC---TTGTTAA--------CTCCTGGGCGACATT----GGGGCTGCAACATCGTTTATCCTCCTCTACAACCAATAGCTG-TTGCTTCTTGGTTCAAGTATATCCCATGGATTAGTATCAACACGATATAGTGTCAGGAGCTAATTGTTCCCCAGCAGCGTGAC") + + a = reader.next() + assert a.score == 3586, "a.score is wrong: %s" % a.score + assert len(a.components) == 2 + check_component(a.components[0], "apple", 52, 72, "+", 411, "TGCATATCGACTATTACAGCCACGCGAGTTACATTCCTCTTTTTTTTTGCTGGCGTCCGGCCGGCTGAGAGC") + check_component(a.components[1], "lav_tests.orange", 2, 72, "-", 361, "TGCATATCGACTAGTACAGCCTCTCGAGTTACCCCCCCCATTCCTCTTGCTGACGTCACGCTGCTGGGGAAC") + + a = reader.next() + assert a is None + + reader.close() + +def check_component( c, src, start, size, strand, src_size, text ): + #..print "\"%s\" == \"%s\"" % (c.src,src) + assert c.src == src, "c.src = %s (expected %s)" % (c.src, src) + assert c.start == start, "c.start = %s (expected %s)" % (c.start, start) + assert c.size == size, "c.size = %s (expected %s)" % (c.size, size) + assert c.strand == strand, "c.strand = %s (expected %s)" % (c.strand, strand) + assert c.src_size == src_size, "c.src_size = %s (expected %s)" % (c.src_size,src_size) + assert c.text == text, "c.text = \"%s\" (expected \"%s\")" % (c.text, text) + +test_classes = [ lavTestCase ] +suite = unittest.TestSuite([ unittest.makeSuite(c) for c in test_classes ]) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/maf.py b/code/utilities/CPAT-1.2.2/lib/bx/align/maf.py new file mode 100755 index 0000000..3414aeb --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/maf.py @@ -0,0 +1,231 @@ +""" +Support for the `MAF`_ multiple sequence alignment format used by `multiz`_. + +.. _MAF: http://genome.ucsc.edu/FAQ/FAQformat.html#format5 +.. _multiz: http://www.bx.psu.edu/miller_lab/ +""" + +from bx.align import * + +from StringIO import StringIO +import os + +import itertools +from bx import interval_index_file + +from bx.misc.seekbzip2 import SeekableBzip2File + +MAF_INVERSE_STATUS = 'V' +MAF_INSERT_STATUS = 'I' +MAF_CONTIG_STATUS = 'C' +MAF_CONTIG_NESTED_STATUS = 'c' +MAF_NEW_STATUS = 'N' +MAF_NEW_NESTED_STATUS = 'n' +MAF_MAYBE_NEW_STATUS = 'S' +MAF_MAYBE_NEW_NESTED_STATUS = 's' +MAF_MISSING_STATUS = 'M' + +class MAFIndexedAccess( interval_index_file.AbstractIndexedAccess ): + """ + Indexed access to a MAF file. + """ + def read_at_current_offset( self, file, **kwargs ): + """ + Read the MAF block at the current position in `file` and return an + instance of `Alignment`. + """ + return read_next_maf( file, **kwargs ) + +class MAFMultiIndexedAccess( interval_index_file.AbstractMultiIndexedAccess ): + """ + Indexed access to multiple MAF files. + """ + indexed_access_class = MAFIndexedAccess + +Indexed = MAFIndexedAccess +"""Deprecated: `MAFIndexedAccess` is also available under the name `Indexed`.""" + +MultiIndexed = MAFMultiIndexedAccess +"""Deprecated: `MAFMultiIndexedAccess` is also available under the name `MultiIndexed`.""" + +class Reader( object ): + """ + Iterate over all maf blocks in a file in order + """ + def __init__( self, file, **kwargs ): + self.file = file + self.maf_kwargs = kwargs + # Read and verify maf header, store any attributes + fields = self.file.readline().split() + if fields[0] != '##maf': raise Exception("File does not have MAF header") + self.attributes = parse_attributes( fields[1:] ) + + def next( self ): + return read_next_maf( self.file, **self.maf_kwargs ) + + def __iter__( self ): + return ReaderIter( self ) + + def close( self ): + self.file.close() + +class ReaderIter( object ): + """ + Adapts a `Reader` to the iterator protocol. + """ + def __init__( self, reader ): + self.reader = reader + def __iter__( self ): + return self + def next( self ): + v = self.reader.next() + if not v: raise StopIteration + return v + +class Writer( object ): + + def __init__( self, file, attributes={} ): + self.file = file + # Write header, Webb's maf code wants version first, we accomodate + if not attributes.has_key('version'): attributes['version'] = 1 + self.file.write( "##maf version=%s" % attributes['version'] ) + for key in attributes: + if key == 'version': continue + self.file.writelines( " %s=%s" % ( key, attributes[key] ) ) + self.file.write( "\n" ) + + def write( self, alignment ): + self.file.write( "a score=" + str( alignment.score ) ) + for key in alignment.attributes: + self.file.write( " %s=%s" % ( key, alignment.attributes[key] ) ) + self.file.write( "\n" ) + # Components + rows = [] + for c in alignment.components: + # "Empty component" generates an 'e' row + if c.empty: + rows.append( ( "e", c.src, str( c.start ), str( c.size ), c.strand, str( c.src_size ), c.synteny_empty ) ) + continue + # Regular component + rows.append( ( "s", c.src, str( c.start ), str( c.size ), c.strand, str( c.src_size ), c.text ) ) + # If component has quality, write a q row + if c.quality is not None: + rows.append( ( "q", c.src, "", "", "", "", c.quality ) ) + # If component has synteny follow up with an 'i' row + if c.synteny_left and c.synteny_right: + rows.append( ( "i", c.src, "", "", "", "", " ".join( map( str, c.synteny_left + c.synteny_right ) ) ) ) + self.file.write( format_tabular( rows, "llrrrrl" ) ) + self.file.write( "\n" ) + + def close( self ): + self.file.close() + +# ---- Helper methods ------------------------------------------------------- + +def from_string( string, **kwargs ): + return read_next_maf( StringIO( string ), **kwargs ) + +def read_next_maf( file, species_to_lengths=None, parse_e_rows=False ): + """ + Read the next MAF block from `file` and return as an `Alignment` + instance. If `parse_i_rows` is true, empty components will be created + when e rows are encountered. + """ + alignment = Alignment(species_to_lengths=species_to_lengths) + # Attributes line + line = readline( file, skip_blank=True ) + if not line: return None + fields = line.split() + if fields[0] != 'a': raise Exception("Expected 'a ...' line") + alignment.attributes = parse_attributes( fields[1:] ) + if 'score' in alignment.attributes: + alignment.score = alignment.attributes['score'] + del alignment.attributes['score'] + else: + alignment.score = 0 + # Sequence lines + last_component = None + while 1: + line = readline( file ) + # EOF or Blank line terminates alignment components + if not line or line.isspace(): break + if line.isspace(): break + # Parse row + fields = line.split() + if fields[0] == 's': + # An 's' row contains sequence for a component + component = Component() + component.src = fields[1] + component.start = int( fields[2] ) + component.size = int( fields[3] ) + component.strand = fields[4] + component.src_size = int( fields[5] ) + if len(fields) > 6: component.text = fields[6].strip() + # Add to set + alignment.add_component( component ) + last_component = component + elif fields[0] == 'e': + # An 'e' row, when no bases align for a given species this tells + # us something about the synteny + if parse_e_rows: + component = Component() + component.empty = True + component.src = fields[1] + component.start = int( fields[2] ) + component.size = int( fields[3] ) + component.strand = fields[4] + component.src_size = int( fields[5] ) + component.text = None + synteny = fields[6].strip() + assert len( synteny ) == 1, \ + "Synteny status in 'e' rows should be denoted with a single character code" + component.synteny_empty = synteny + alignment.add_component( component ) + last_component = component + elif fields[0] == 'i': + # An 'i' row, indicates left and right synteny status for the + # previous component, we hope ;) + assert fields[1] == last_component.src, "'i' row does not follow matching 's' row" + last_component.synteny_left = ( fields[2], int( fields[3] ) ) + last_component.synteny_right = ( fields[4], int( fields[5] ) ) + elif fields[0] == 'q': + assert fields[1] == last_component.src, "'q' row does not follow matching 's' row" + # TODO: Should convert this to an integer array? + last_component.quality = fields[2] + + return alignment + +def readline( file, skip_blank=False ): + """Read a line from provided file, skipping any blank or comment lines""" + while 1: + line = file.readline() + #print "every line: %r" % line + if not line: return None + if line[0] != '#' and not ( skip_blank and line.isspace() ): + return line + +def parse_attributes( fields ): + """Parse list of key=value strings into a dict""" + attributes = {} + for field in fields: + pair = field.split( '=' ) + attributes[ pair[0] ] = pair[1] + return attributes + +def format_tabular( rows, align=None ): + if len( rows ) == 0: return "" + lengths = [ len( col ) for col in rows[ 0 ] ] + for row in rows[1:]: + for i in range( 0, len( row ) ): + lengths[ i ] = max( lengths[ i ], len( row[ i ] ) ) + rval = "" + for row in rows: + for i in range( 0, len( row ) ): + if align and align[ i ] == "l": + rval += row[ i ].ljust( lengths[ i ] ) + else: + rval += row[ i ].rjust( lengths[ i ] ) + rval += " " + rval += "\n" + return rval + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/maf_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/align/maf_tests.py new file mode 100755 index 0000000..ca67c6c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/maf_tests.py @@ -0,0 +1,190 @@ +""" +Tests for `bx.align.maf`. +""" + +import unittest +import sys +import bx.align as align +import bx.align.maf as maf + +from StringIO import StringIO + +# A simple MAF from the rat paper days +test_maf = """##maf version=1 scoring=humor.v4 +# humor.v4 R=30 M=10 /cluster/data/hg15/bed/blastz.mm3/axtNet300/chr1.maf +# /cluster/data/hg15/bed/blastz.rn3/axtNet300/chr1.maf + +a score=0.128 +s human_hoxa 100 8 + 100257 ACA-TTACT +s horse_hoxa 120 9 - 98892 ACAATTGCT +s fugu_hoxa 88 7 + 90788 ACA--TGCT + + +a score=0.071 +s human_unc 9077 8 + 10998 ACAGTATT +# Comment +s horse_unc 4555 6 - 5099 ACA--ATT +s fugu_unc 4000 4 + 4038 AC----TT +""" + +# A more complicated MAF with synteny annotation and such +test_maf_2 = """##maf version=1 scoring=autoMZ.v1 +a score=3656.000000 +s hg17.chr1 2005 34 + 245522847 TGTAACTTAATACCACAACCAGGCATAGGGG--AAA------------- +s rheMac2.chr11 9625228 31 + 134511895 TGTAACCTCTTACTGCAACAAGGCACAGGGG------------------ +i rheMac2.chr11 C 0 I 1678 +s panTro1.chr1 2014 34 + 229575298 TGTAACTTAATACCACAACCAGGCATGGGGG--AAA------------- +i panTro1.chr1 C 0 C 0 +s bosTau2.chr5 64972365 47 + 76426644 TCCAGCCATGTGTTGTGATCAG--CCAGGGGCTAAAGCCATGGCGGTAG +i bosTau2.chr5 C 0 I 1462 +s canFam2.chr27 45129665 31 + 48908698 TTTGACTCTGTGCTCTTATCAGGCCCAAGGG------------------ +i canFam2.chr27 C 0 I 1664 +e danRer3.chr18 2360867 428 + 50308305 I +e oryCun1.scaffold_139397 643 1271 - 4771 I +e loxAfr1.scaffold_5603 58454 1915 + 68791 I +e echTel1.scaffold_212365 4641 1430 + 9822 I +e echTel1.scaffold_212365 4641 1430 + 9822 I +e rn3.chr4 29161032 1524 - 187371129 I +e mm7.chr6 28091695 3290 - 149646834 I + +""" + +# A MAF to test slicing upon +test_maf_3 = """##maf version=1 scoring=none +a score=0 +s apple 34 64 + 110 AGGGA---GTTCGTCACT------GTCGTAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG +s orange 19 61 - 100 AGGGATGCGTT--TCACTGCTATCGTCGTA----TTCAGACTTCG-CTATCT------GAGTTGT---GCATTACCG + +""" + +def test_reader(): + + reader = maf.Reader( StringIO( test_maf ) ) + assert reader.attributes["version"] == "1" + assert reader.attributes["scoring"] == "humor.v4" + + a = reader.next() + assert a.score == 0.128 + assert len( a.components ) == 3 + check_component( a.components[0], "human_hoxa", 100, 8, "+", 100257, "ACA-TTACT" ) + check_component( a.components[1], "horse_hoxa", 120, 9, "-", 98892, "ACAATTGCT" ) + check_component( a.components[2], "fugu_hoxa", 88, 7, "+", 90788, "ACA--TGCT" ) + + a = reader.next() + assert a.score == 0.071 + assert len( a.components ) == 3 + check_component( a.components[0], "human_unc", 9077, 8, "+", 10998, "ACAGTATT" ) + check_component( a.components[1], "horse_unc", 4555, 6, "-", 5099, "ACA--ATT" ) + check_component( a.components[2], "fugu_unc", 4000, 4, "+", 4038, "AC----TT" ) + + a = reader.next() + assert a is None + + reader.close() + +def test_writer(): + + val = StringIO() + writer = maf.Writer( val, { 'scoring':'foobar' } ) + + a = align.Alignment() + a.score = 7009 + + a.components.append( align.Component( src="human_hoxa", start=100, size=9, strand="+", src_size=1000257, text="ACA-TTACT" ) ) + a.components.append( align.Component( src="horse_hoxa", start=120, size=10, strand="-", src_size=98892, text="ACAATTGCT" ) ) + + check_component( a.components[0], "human_hoxa", 100, 9, "+", 1000257, "ACA-TTACT" ) + check_component( a.components[1], "horse_hoxa", 120, 10, "-", 98892, "ACAATTGCT" ) + + writer.write( a ) + + assert val.getvalue() == """##maf version=1 scoring=foobar +a score=7009 +s human_hoxa 100 9 + 1000257 ACA-TTACT +s horse_hoxa 120 10 - 98892 ACAATTGCT + +""" + + + +def test_slice(): + + a = align.Alignment() + a.score = "7009" + a.components.append( align.Component( src="human_hoxa", start=100, size=9, strand="+", src_size=100257, text="ACA-TTACT" ) ) + a.components.append( align.Component( src="horse_hoxa", start=120, size=10, strand="-", src_size=98892, text="ACAATTGCT" ) ) + + b = a.slice_by_component( 0, 101, 105 ) + + check_component( b.components[0], src="human_hoxa", start=101, size=4, strand="+", src_size=100257, text="CA-TT" ) + check_component( b.components[1], src="horse_hoxa", start=121, size=5, strand="-", src_size=98892, text ="CAATT" ) + + # test slicing with + strand src + reader = maf.Reader( StringIO( test_maf_3 ) ) + a = reader.next() + b = a.slice_by_component( 0, 40, 62 ) + check_component( b.components[0], src="apple", start=40, size=22, strand="+", src_size=110, text="TTCGTCACT------GTCGTAAGGGTTC" ) + check_component( b.components[1], src="orange", start=28, size=22, strand="-", src_size=100, text="TT--TCACTGCTATCGTCGTA----TTC" ) + + # test slicing with - strand src + b = a.slice_by_component( 1, 30, 68 ) + check_component( b.components[0], src="apple", start=46, size=41, strand="+", src_size=110, text="ACT------GTCGTAAGGGTTCAGA--CTGTCTATGTATACACAAGTTG" ) + check_component( b.components[1], src="orange", start=32, size=38, strand="-", src_size=100, text="ACTGCTATCGTCGTA----TTCAGACTTCG-CTATCT------GAGTTG" ) + + a = reader.next() + assert a is None + + +def test_with_synteny(): + reader = maf.Reader( StringIO( test_maf_2 ), parse_e_rows=True ) + + a = reader.next() + check_component( a.components[0], "hg17.chr1", 2005, 34, "+", 245522847, "TGTAACTTAATACCACAACCAGGCATAGGGG--AAA-------------") + check_component( a.components[1], "rheMac2.chr11", 9625228, 31, "+", 134511895, "TGTAACCTCTTACTGCAACAAGGCACAGGGG------------------") + print a.components[1].synteny_left + assert a.components[1].synteny_left == ( maf.MAF_CONTIG_STATUS, 0 ) + assert a.components[1].synteny_right == ( maf.MAF_INSERT_STATUS, 1678 ) + + rat = a.get_component_by_src_start( "rn3." ) + check_component( rat, "rn3.chr4", 29161032, 1524, "-", 187371129, None ) + assert rat.synteny_empty == maf.MAF_INSERT_STATUS + +def test_write_with_synteny(): + reader = maf.Reader( StringIO( test_maf_2 ), parse_e_rows=True ) + a = reader.next() + val = StringIO() + writer = maf.Writer( val, { 'scoring':'foobar' } ) + writer.write( a ) + actual = val.getvalue() + expected = """##maf version=1 scoring=foobar +a score=3656.0 +s hg17.chr1 2005 34 + 245522847 TGTAACTTAATACCACAACCAGGCATAGGGG--AAA------------- +s rheMac2.chr11 9625228 31 + 134511895 TGTAACCTCTTACTGCAACAAGGCACAGGGG------------------ +i rheMac2.chr11 C 0 I 1678 +s panTro1.chr1 2014 34 + 229575298 TGTAACTTAATACCACAACCAGGCATGGGGG--AAA------------- +i panTro1.chr1 C 0 C 0 +s bosTau2.chr5 64972365 47 + 76426644 TCCAGCCATGTGTTGTGATCAG--CCAGGGGCTAAAGCCATGGCGGTAG +i bosTau2.chr5 C 0 I 1462 +s canFam2.chr27 45129665 31 + 48908698 TTTGACTCTGTGCTCTTATCAGGCCCAAGGG------------------ +i canFam2.chr27 C 0 I 1664 +e danRer3.chr18 2360867 428 + 50308305 I +e oryCun1.scaffold_139397 643 1271 - 4771 I +e loxAfr1.scaffold_5603 58454 1915 + 68791 I +e echTel1.scaffold_212365 4641 1430 + 9822 I +e echTel1.scaffold_212365 4641 1430 + 9822 I +e rn3.chr4 29161032 1524 - 187371129 I +e mm7.chr6 28091695 3290 - 149646834 I + +""" + print actual + print "---" + print expected + assert actual == expected + +def check_component( c, src, start, size, strand, src_size, text ): + assert c.src == src + assert c.start == start + assert c.size == size + assert c.strand == strand + assert c.src_size == src_size + assert c.text == text \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/score.py b/code/utilities/CPAT-1.2.2/lib/bx/align/score.py new file mode 100755 index 0000000..fe23a4e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/score.py @@ -0,0 +1,291 @@ +""" +Support for scoring alignments using arbitrary scoring matrices, arbitrary +alphabets, and affine gap penalties. +""" + +from numpy import * + +class ScoringScheme( object ): + # note that gap_open and gap_extend are penalties, which means you should make them positive + def __init__( self, gap_open, gap_extend, default=-100, alphabet1="ACGT", alphabet2=None, gap1="-", gap2=None, text1_range=128, text2_range=None, typecode=int32 ): + if (text2_range == None): text2_range = text1_range + if (alphabet2 == None): alphabet2 = alphabet1 + if (gap2 == None): gap2 = gap1 # (scheme with gap1=gap2=None is legit) + if type(alphabet1) == str: alphabet1 = [ch for ch in alphabet1] + if type(alphabet2) == str: alphabet2 = [ch for ch in alphabet2] + self.table = ones( (text1_range, text2_range), typecode ) + self.table *= default + self.gap_open = gap_open + self.gap_extend = gap_extend + self.gap1 = gap1 + self.gap2 = gap2 + self.alphabet1 = alphabet1 + self.alphabet2 = alphabet2 + # private _set_score and _get_score allow subclasses to override them to + # implement a different underlying table object + def _set_score(self,(a,b),val): + self.table[a,b] = val + def _get_score(self,(a,b)): + return self.table[a,b] + def set_score( self, a, b, val, foldcase1=False, foldcase2=False ): + self._set_score((a,b),val) + if foldcase1: + aCh = chr(a) + if (aCh.isupper()): aa = ord(aCh.lower()) + elif (aCh.islower()): aa = ord(aCh.upper()) + else: foldcase1 = False + if foldcase2: + bCh = chr(b) + if (bCh.isupper()): bb = ord(bCh.lower()) + elif (bCh.islower()): bb = ord(bCh.upper()) + else: foldcase2 = False + if foldcase1 and foldcase2: + self._set_score((aa,b ),val) + self._set_score((a ,bb),val) + self._set_score((aa,bb),val) + elif foldcase1: + self._set_score((aa,b ),val) + elif foldcase2: + self._set_score((a ,bb),val) + def score_alignment( self, a ): + return score_alignment(self,a) + def score_texts( self, text1, text2 ): + return score_texts( self, text1, text2 ) + def __str__ (self): + isDna1 = "".join( self.alphabet1 ) == "ACGT" + isDna2 = "".join( self.alphabet2 ) == "ACGT" + labelRows = not ( isDna1 and isDna2 ) + width = 3 + for a in self.alphabet1: + for b in self.alphabet2: + score = self._get_score((ord(a),ord(b))) + if (type(score) == float): s = "%8.6f" % score + else: s = "%s" % score + if (len(s)+1 > width): + width = len(s)+1 + lines = [] + line = [] + if labelRows: + if isDna1: line.append(" ") + else: line.append(" ") + for b in self.alphabet2: + if isDna2: s = b + else: s = "%02X" % ord(b) + line.append("%*s" % (width,s)) + lines.append(("".join(line))+"\n") + for a in self.alphabet1: + line = [] + if labelRows: + if isDna1: line.append(a) + else: line.append("%02X" % ord(a)) + for b in self.alphabet2: + score = self._get_score((ord(a),ord(b))) + if (type(score) == float): s = "%8.6f" % score + else: s = "%s" % score + line.append("%*s" % (width,s)) + lines.append(("".join(line))+"\n") + return "".join(lines) + +def read_scoring_scheme( f, gap_open, gap_extend, gap1="-", gap2=None, **kwargs ): + """ + Initialize scoring scheme from a file containint a blastz style text blob. + f can be either a file or the name of a file. + """ + close_it = False + if (type(f) == str): + f = file(f,"rt") + close_it = True + ss = build_scoring_scheme("".join([line for line in f]),gap_open, gap_extend, gap1=gap1, gap2=gap2, **kwargs) + if (close_it): + f.close() + return ss + +def build_scoring_scheme( s, gap_open, gap_extend, gap1="-", gap2=None, **kwargs ): + """ + Initialize scoring scheme from a blastz style text blob, first line + specifies the bases for each row/col, subsequent lines contain the + corresponding scores. Slaw extensions allow for unusual and/or + asymmetric alphabets. Symbols can be two digit hex, and each row + begins with symbol. Note that a row corresponds to a symbol in text1 + and a column to a symbol in text2. + + examples: + + blastz slaw + + A C G T 01 02 A C G T + 91 -114 -31 -123 01 200 -200 -50 100 -50 100 + -114 100 -125 -31 02 -200 200 100 -50 100 -50 + -31 -125 100 -114 + -123 -31 -114 91 + """ + # perform initial parse to determine alphabets and locate scores + bad_matrix = "invalid scoring matrix" + s = s.rstrip( "\n" ) + lines = s.split( "\n" ) + rows = [] + symbols2 = lines.pop(0).split() + symbols1 = None + rows_have_syms = False + a_la_blastz = True + for i, line in enumerate( lines ): + row_scores = line.split() + if len( row_scores ) == len( symbols2 ): # blastz-style row + if symbols1 == None: + if len( lines ) != len( symbols2 ): + raise bad_matrix + symbols1 = symbols2 + elif (rows_have_syms): + raise bad_matrix + elif len( row_scores ) == len( symbols2 ) + 1: # row starts with symbol + if symbols1 == None: + symbols1 = [] + rows_have_syms = True + a_la_blastz = False + elif not rows_have_syms: + raise bad_matrix + symbols1.append( row_scores.pop(0) ) + else: + raise bad_matrix + rows.append( row_scores ) + # convert alphabets from strings to characters + try: + alphabet1 = [sym_to_char( sym ) for sym in symbols1] + alphabet2 = [sym_to_char( sym ) for sym in symbols2] + except ValueError: + raise bad_matrix + if (alphabet1 != symbols1) or (alphabet2 != symbols2): + a_la_blastz = False + if a_la_blastz: + alphabet1 = [ch.upper() for ch in alphabet1] + alphabet2 = [ch.upper() for ch in alphabet2] + # decide if rows and/or columns should reflect case + if a_la_blastz: + foldcase1 = foldcase2 = True + else: + foldcase1 = "".join( alphabet1 ) == "ACGT" + foldcase2 = "".join( alphabet2 ) == "ACGT" + # create appropriately sized matrix + text1_range = text2_range = 128 + if ord( max( alphabet1 ) ) >= 128: text1_range = 256 + if ord( max( alphabet2 ) ) >= 128: text2_range = 256 + typecode = int32 + for i, row_scores in enumerate( rows ): + for j, score in enumerate( map( int_or_float, row_scores ) ): + if type( score ) == float: + typecode = float32 + if type( gap_open ) == float: + typecode = float32 + if type( gap_extend ) == float: + typecode = float32 + ss = ScoringScheme( gap_open, gap_extend, alphabet1=alphabet1, alphabet2=alphabet2, gap1=gap1, gap2=gap2, text1_range=text1_range, text2_range=text2_range, typecode=typecode, **kwargs ) + # fill matrix + for i, row_scores in enumerate( rows ): + for j, score in enumerate( map( int_or_float, row_scores ) ): + ss.set_score( ord( alphabet1[i] ), ord( alphabet2[j] ), score ) + if foldcase1 and foldcase2: + ss.set_score( ord( alphabet1[i].lower() ), ord( alphabet2[j].upper() ), score ) + ss.set_score( ord( alphabet1[i].upper() ), ord( alphabet2[j].lower() ), score ) + ss.set_score( ord( alphabet1[i].lower() ), ord( alphabet2[j].lower() ), score ) + elif foldcase1: + ss.set_score( ord( alphabet1[i].lower() ), ord( alphabet2[j] ), score ) + elif foldcase2: + ss.set_score( ord( alphabet1[i] ), ord( alphabet2[j].lower() ), score ) + return ss + +def int_or_float( s ): + try: return int( s ) + except: return float( s ) + +# convert possible two-char symbol to a single character +def sym_to_char( sym ): + if len( sym ) == 1: return sym + elif len( sym ) != 2: raise ValueError + else: return chr(int(sym,base=16)) + +def score_alignment( scoring_scheme, a ): + score = 0 + ncomps = len( a.components ) + for i in range( ncomps ): + for j in range( i+1, ncomps ): + score += score_texts( scoring_scheme, a.components[i].text, a.components[j].text ) + return score + +def score_texts( scoring_scheme, text1, text2 ): + rval = 0 + last_gap_a = last_gap_b = False + for i in range( len( text1 ) ): + a = text1[i] + b = text2[i] + # Ignore gap/gap pair + if a == scoring_scheme.gap1 and b == scoring_scheme.gap2: + continue + # Gap in first species + elif a == scoring_scheme.gap1: + rval -= scoring_scheme.gap_extend + if not last_gap_a: + rval -= scoring_scheme.gap_open + last_gap_a = True + last_gap_b = False + # Gap in second species + elif b == scoring_scheme.gap2: + rval -= scoring_scheme.gap_extend + if not last_gap_b: + rval -= scoring_scheme.gap_open + last_gap_a = False + last_gap_b = True + # Aligned base + else: + rval += scoring_scheme._get_score((ord(a),ord(b))) + last_gap_a = last_gap_b = False + return rval + +def accumulate_scores( scoring_scheme, text1, text2, skip_ref_gaps=False ): + """ + Return cumulative scores for each position in alignment as a 1d array. + + If `skip_ref_gaps` is False positions in returned array correspond to each + column in alignment, if True they correspond to each non-gap position (each + base) in text1. + """ + if skip_ref_gaps: + rval = zeros( len( text1 ) - text1.count( scoring_scheme.gap1 ) ) + else: + rval = zeros( len( text1 ) ) + score = 0 + pos = 0 + last_gap_a = last_gap_b = False + for i in range( len( text1 ) ): + a = text1[i] + b = text2[i] + # Ignore gap/gap pair + if a == scoring_scheme.gap1 and b == scoring_scheme.gap2: + continue + # Gap in first species + elif a == scoring_scheme.gap1: + score -= scoring_scheme.gap_extend + if not last_gap_a: + score -= scoring_scheme.gap_open + last_gap_a = True + last_gap_b = False + # Gap in second species + elif b == scoring_scheme.gap2: + score -= scoring_scheme.gap_extend + if not last_gap_b: + score -= scoring_scheme.gap_open + last_gap_a = False + last_gap_b = True + # Aligned base + else: + score += scoring_scheme._get_score((ord(a),ord(b))) + last_gap_a = last_gap_b = False + if not( skip_ref_gaps ) or a != scoring_scheme.gap1: + rval[pos] = score + pos += 1 + return rval + +hox70 = build_scoring_scheme( """ A C G T + 91 -114 -31 -123 + -114 100 -125 -31 + -31 -125 100 -114 + -123 -31 -114 91 """, 400, 30 ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/score_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/align/score_tests.py new file mode 100755 index 0000000..83c1e9e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/score_tests.py @@ -0,0 +1,94 @@ +""" +Tests for `bx.align.score`. +""" + +import bx.align.score +import bx.align.maf +import StringIO +import unittest +import sys + +from numpy import array, cumsum, allclose + +aligns = [ ( "CCACTAGTTTTTAAATAATCTACTATCAAATAAAAGATTTGTTAATAATAAATTTTAAATCATTAACACTT", + "CCATTTGGGTTCAAAAATTGATCTATCA----------TGGTGGATTATTATTTAGCCATTAAGGACAAAT", + -111 ), + ( "CCACTAGTTTTTAAATAATCTAC-----AATAAAAGATTTGTTAATAAT---AAATTTTAAATCATTAA-----CACTT", + "CCATTTGGGTTCAAAAATTGATCTATCA----------TGGTGGAT---TATTATTT-----AGCCATTAAGGACAAAT", + -3626 ), + ( "CCACTAGTTTTTGATTC", + "CCATTTGGGTTC-----", + -299 ), + ( "CTTAGTTTTTGATCACC", + "-----CTTGGGTTTACC", + -299 ), + ( "gggaattgaacaatgagaacacatggacacaggaaggggaacatcacacacc----------ggggcctgttgtggggtggggggaag", + "ggaactagaacaagggagacacatacaaacaacaacaacaacaacacagcccttcccttcaaagagcttatagtctgatggaggagag", + 1690 ) + ] + +mafs = """##maf +a score=2883.0 +s hg17.chr1 6734 30 + 245522847 CTACCTCAGTGTGGAAGGTGGGCAGTTCTG +s rheMac1.SCAFFOLD71394 9319 30 - 13789 CTACCTCAGTGTGGAAGGTGGGCAGTTCTG + +a score=8167.0 +s hg17.chr1 41401 40 + 245522847 TGTGTGATTAATGCCTGAGACTGTGTGAAGTAAGAGATGG +s panTro1.chr1 49673 40 + 229575298 TGCGTGATTAATGCCTGAGATTGTGTGAAGTAAAAGATGG +s rheMac1.SCAFFOLD45837 26063 33 - 31516 TGTGTGATTAATGCCTGAGATTGTGTGAAGTAA------- +""" + +nonsymm_scheme = bx.align.score.build_scoring_scheme ( """ A C G T + 91 0 -31 -123 + -114 100 -125 -31 + -31 -125 100 -114 + -123 -31 -114 91 """, 400, 30 ) + +aligns_for_nonsymm_scheme = [ ( "AAAACCCCGGGGTTTT", + "ACGTACGTACGTACGT", + -580 ) + ] + + +asymm_scheme = bx.align.score.build_scoring_scheme ( """ 01 02 A C G T + 01 200 -200 -50 100 -50 100 + 02 -200 200 100 -50 100 -50 """, + 0, 0, gap1='\x00' ) + +aligns_for_asymm_scheme = [ ( "\x01\x01\x01\x01\x01\x01", + "ACGT\x01\x02", + 100 ) + ] + + +class BasicTests( unittest.TestCase ): + + def test_scoring_text( self ): + ss = bx.align.score.hox70 + for t1, t2, score in aligns: + self.assertEquals( bx.align.score.score_texts( ss, t1, t2 ), score ) + + def test_align( self ): + ss = bx.align.score.hox70 + for block in bx.align.maf.Reader( StringIO.StringIO( mafs ) ): + self.assertEquals( bx.align.score.score_alignment( ss, block ), float( block.score ) ) + + def test_accumulate( self ): + ss = bx.align.score.hox70 + self.assert_( allclose( bx.align.score.accumulate_scores( ss, "-----CTTT", "CTTAGTTTA" ), + cumsum( array( [ -430, -30, -30, -30, -30, -31, 91, 91, -123 ] ) ) ) ) + self.assert_( allclose( bx.align.score.accumulate_scores( ss, "-----CTTT", "CTTAGTTTA", skip_ref_gaps=True ), + cumsum( array( [ -581, 91, 91, -123 ] ) ) ) ) + + def test_nonsymm_scoring( self ): + ss = nonsymm_scheme + for t1, t2, score in aligns_for_nonsymm_scheme: + self.assertEquals( bx.align.score.score_texts( ss, t1, t2 ), score ) + + def test_asymm_scoring( self ): + ss = asymm_scheme + for t1, t2, score in aligns_for_asymm_scheme: + self.assertEquals( bx.align.score.score_texts( ss, t1, t2 ), score ) + +test_classes = [ BasicTests ] +suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/__init__.py new file mode 100755 index 0000000..84772d6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/__init__.py @@ -0,0 +1,6 @@ +""" +Tools for masking out specific sites in aligments by various criteria, for +example masking CpG sites or sites with low sequence quality. +""" + +from bx.align.sitemask.core import * diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.c b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.c new file mode 100755 index 0000000..0d7b19f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.c @@ -0,0 +1,2775 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:11 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__align__sitemask___cpg +#define __PYX_HAVE_API__bx__align__sitemask___cpg +#include "find_cpg.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_cpg.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.align.sitemask._cpg' */ +#define __Pyx_MODULE_NAME "bx.align.sitemask._cpg" +int __pyx_module_is_main_bx__align__sitemask___cpg = 0; + +/* Implementation of 'bx.align.sitemask._cpg' */ +static char __pyx_k_1[] = "-"; +static char __pyx_k_2[] = "\nPyrex/C extension for quickly finding potential CpG sites in pairs of \nsequences.\n"; +static char __pyx_k_3[] = "bx.align.sitemask._cpg"; +static char __pyx_k__sp[] = "sp"; +static char __pyx_k__sp1[] = "sp1"; +static char __pyx_k__sp2[] = "sp2"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__remove[] = "remove"; +static char __pyx_k__cpglist[] = "cpglist"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__find_cpg[] = "find_cpg"; +static char __pyx_k__list_cpg[] = "list_cpg"; +static char __pyx_k__remove_gaps[] = "remove_gaps"; +static char __pyx_k__find_non_cpg[] = "find_non_cpg"; +static char __pyx_k__list_non_cpg[] = "list_non_cpg"; +static char __pyx_k__find_cpg_restricted[] = "find_cpg_restricted"; +static char __pyx_k__list_cpg_restricted[] = "list_cpg_restricted"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__cpglist; +static PyObject *__pyx_n_s__find_cpg; +static PyObject *__pyx_n_s__find_cpg_restricted; +static PyObject *__pyx_n_s__find_non_cpg; +static PyObject *__pyx_n_s__list_cpg; +static PyObject *__pyx_n_s__list_cpg_restricted; +static PyObject *__pyx_n_s__list_non_cpg; +static PyObject *__pyx_n_s__remove; +static PyObject *__pyx_n_s__remove_gaps; +static PyObject *__pyx_n_s__sp; +static PyObject *__pyx_n_s__sp1; +static PyObject *__pyx_n_s__sp2; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_int_neg_1; + +/* "bx/align/sitemask/_cpg.pyx":11 + * int next_non_cpg( char * sp1, char * sp2, int start) + * + * def find_cpg( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_find_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_find_cpg = {__Pyx_NAMESTR("find_cpg"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_find_cpg, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_find_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + PyObject *__pyx_v_start = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_pos; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,&__pyx_n_s__start,0}; + __Pyx_RefNannySetupContext("find_cpg"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_cpg", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_cpg", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_cpg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + __pyx_v_start = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_cpg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":15 + * cdef char* b + * cdef int pos + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * pos = start + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":16 + * cdef int pos + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * pos = start + * if pos > len(sp1): return -1 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":17 + * a = sp1 + * b = sp2 + * pos = start # <<<<<<<<<<<<<< + * if pos > len(sp1): return -1 + * return next_cpg( a, b, pos ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_pos = __pyx_t_2; + + /* "bx/align/sitemask/_cpg.pyx":18 + * b = sp2 + * pos = start + * if pos > len(sp1): return -1 # <<<<<<<<<<<<<< + * return next_cpg( a, b, pos ) + * + */ + __pyx_t_3 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_v_pos > __pyx_t_3); + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/align/sitemask/_cpg.pyx":19 + * pos = start + * if pos > len(sp1): return -1 + * return next_cpg( a, b, pos ) # <<<<<<<<<<<<<< + * + * def find_cpg_restricted( sp1, sp2, start ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong(next_cpg(__pyx_v_a, __pyx_v_b, __pyx_v_pos)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":21 + * return next_cpg( a, b, pos ) + * + * def find_cpg_restricted( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_1find_cpg_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_1find_cpg_restricted = {__Pyx_NAMESTR("find_cpg_restricted"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_1find_cpg_restricted, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_1find_cpg_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + PyObject *__pyx_v_start = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_pos; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,&__pyx_n_s__start,0}; + __Pyx_RefNannySetupContext("find_cpg_restricted"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_cpg_restricted", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_cpg_restricted", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_cpg_restricted") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + __pyx_v_start = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_cpg_restricted", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_cpg_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":25 + * cdef char* b + * cdef int pos + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * pos = start + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":26 + * cdef int pos + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * pos = start + * if pos > len(sp1): return -1 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":27 + * a = sp1 + * b = sp2 + * pos = start # <<<<<<<<<<<<<< + * if pos > len(sp1): return -1 + * return next_cpg_restricted( a, b, pos ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_pos = __pyx_t_2; + + /* "bx/align/sitemask/_cpg.pyx":28 + * b = sp2 + * pos = start + * if pos > len(sp1): return -1 # <<<<<<<<<<<<<< + * return next_cpg_restricted( a, b, pos ) + * + */ + __pyx_t_3 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_v_pos > __pyx_t_3); + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/align/sitemask/_cpg.pyx":29 + * pos = start + * if pos > len(sp1): return -1 + * return next_cpg_restricted( a, b, pos ) # <<<<<<<<<<<<<< + * + * def find_non_cpg( sp1, sp2, start ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong(next_cpg_restricted(__pyx_v_a, __pyx_v_b, __pyx_v_pos)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_cpg_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":31 + * return next_cpg_restricted( a, b, pos ) + * + * def find_non_cpg( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_2find_non_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_2find_non_cpg = {__Pyx_NAMESTR("find_non_cpg"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_2find_non_cpg, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_2find_non_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + PyObject *__pyx_v_start = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_pos; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,&__pyx_n_s__start,0}; + __Pyx_RefNannySetupContext("find_non_cpg"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_non_cpg", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_non_cpg", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_non_cpg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + __pyx_v_start = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_non_cpg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_non_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":35 + * cdef char* b + * cdef int pos + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * pos = start + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":36 + * cdef int pos + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * pos = start + * if pos > len(sp1): return -1 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":37 + * a = sp1 + * b = sp2 + * pos = start # <<<<<<<<<<<<<< + * if pos > len(sp1): return -1 + * return next_non_cpg( a, b, pos ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_pos = __pyx_t_2; + + /* "bx/align/sitemask/_cpg.pyx":38 + * b = sp2 + * pos = start + * if pos > len(sp1): return -1 # <<<<<<<<<<<<<< + * return next_non_cpg( a, b, pos ) + * + */ + __pyx_t_3 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_v_pos > __pyx_t_3); + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/align/sitemask/_cpg.pyx":39 + * pos = start + * if pos > len(sp1): return -1 + * return next_non_cpg( a, b, pos ) # <<<<<<<<<<<<<< + * + * def list_cpg( sp1, sp2 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong(next_non_cpg(__pyx_v_a, __pyx_v_b, __pyx_v_pos)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.align.sitemask._cpg.find_non_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":41 + * return next_non_cpg( a, b, pos ) + * + * def list_cpg( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_3list_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_3list_cpg = {__Pyx_NAMESTR("list_cpg"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_3list_cpg, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_3list_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_start; + PyObject *__pyx_v_cpglist = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,0}; + __Pyx_RefNannySetupContext("list_cpg"); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("list_cpg", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "list_cpg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("list_cpg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":45 + * cdef char * b + * cdef int start + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * start = 0 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":46 + * cdef int start + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * start = 0 + * cpglist = list() + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":47 + * a = sp1 + * b = sp2 + * start = 0 # <<<<<<<<<<<<<< + * cpglist = list() + * while start > -1 and start < len(sp1): + */ + __pyx_v_start = 0; + + /* "bx/align/sitemask/_cpg.pyx":48 + * b = sp2 + * start = 0 + * cpglist = list() # <<<<<<<<<<<<<< + * while start > -1 and start < len(sp1): + * start = next_cpg( a, b, start ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_cpglist = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":49 + * start = 0 + * cpglist = list() + * while start > -1 and start < len(sp1): # <<<<<<<<<<<<<< + * start = next_cpg( a, b, start ) + * if start == -1: break + */ + while (1) { + __pyx_t_3 = (__pyx_v_start > -1); + if (__pyx_t_3) { + __pyx_t_4 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_v_start < __pyx_t_4); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (!__pyx_t_6) break; + + /* "bx/align/sitemask/_cpg.pyx":50 + * cpglist = list() + * while start > -1 and start < len(sp1): + * start = next_cpg( a, b, start ) # <<<<<<<<<<<<<< + * if start == -1: break + * cpglist.append(start) + */ + __pyx_v_start = next_cpg(__pyx_v_a, __pyx_v_b, __pyx_v_start); + + /* "bx/align/sitemask/_cpg.pyx":51 + * while start > -1 and start < len(sp1): + * start = next_cpg( a, b, start ) + * if start == -1: break # <<<<<<<<<<<<<< + * cpglist.append(start) + * start = start + 1 + */ + __pyx_t_6 = (__pyx_v_start == -1); + if (__pyx_t_6) { + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/align/sitemask/_cpg.pyx":52 + * start = next_cpg( a, b, start ) + * if start == -1: break + * cpglist.append(start) # <<<<<<<<<<<<<< + * start = start + 1 + * return cpglist + */ + if (unlikely(((PyObject *)__pyx_v_cpglist) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyList_Append(__pyx_v_cpglist, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":53 + * if start == -1: break + * cpglist.append(start) + * start = start + 1 # <<<<<<<<<<<<<< + * return cpglist + * + */ + __pyx_v_start = (__pyx_v_start + 1); + } + __pyx_L7_break:; + + /* "bx/align/sitemask/_cpg.pyx":54 + * cpglist.append(start) + * start = start + 1 + * return cpglist # <<<<<<<<<<<<<< + * + * def list_cpg_restricted( sp1, sp2 ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cpglist)); + __pyx_r = ((PyObject *)__pyx_v_cpglist); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cpglist); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":56 + * return cpglist + * + * def list_cpg_restricted( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_4list_cpg_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_4list_cpg_restricted = {__Pyx_NAMESTR("list_cpg_restricted"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_4list_cpg_restricted, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_4list_cpg_restricted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_start; + PyObject *__pyx_v_cpglist = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,0}; + __Pyx_RefNannySetupContext("list_cpg_restricted"); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("list_cpg_restricted", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "list_cpg_restricted") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("list_cpg_restricted", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_cpg_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":60 + * cdef char * b + * cdef int start + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * start = 0 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":61 + * cdef int start + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * start = 0 + * cpglist = list() + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":62 + * a = sp1 + * b = sp2 + * start = 0 # <<<<<<<<<<<<<< + * cpglist = list() + * while start > -1 and start < len(sp1): + */ + __pyx_v_start = 0; + + /* "bx/align/sitemask/_cpg.pyx":63 + * b = sp2 + * start = 0 + * cpglist = list() # <<<<<<<<<<<<<< + * while start > -1 and start < len(sp1): + * start = next_cpg_restricted( a, b, start ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_cpglist = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":64 + * start = 0 + * cpglist = list() + * while start > -1 and start < len(sp1): # <<<<<<<<<<<<<< + * start = next_cpg_restricted( a, b, start ) + * if start == -1: break + */ + while (1) { + __pyx_t_3 = (__pyx_v_start > -1); + if (__pyx_t_3) { + __pyx_t_4 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_v_start < __pyx_t_4); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (!__pyx_t_6) break; + + /* "bx/align/sitemask/_cpg.pyx":65 + * cpglist = list() + * while start > -1 and start < len(sp1): + * start = next_cpg_restricted( a, b, start ) # <<<<<<<<<<<<<< + * if start == -1: break + * cpglist.append(start) + */ + __pyx_v_start = next_cpg_restricted(__pyx_v_a, __pyx_v_b, __pyx_v_start); + + /* "bx/align/sitemask/_cpg.pyx":66 + * while start > -1 and start < len(sp1): + * start = next_cpg_restricted( a, b, start ) + * if start == -1: break # <<<<<<<<<<<<<< + * cpglist.append(start) + * start = start + 1 + */ + __pyx_t_6 = (__pyx_v_start == -1); + if (__pyx_t_6) { + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/align/sitemask/_cpg.pyx":67 + * start = next_cpg_restricted( a, b, start ) + * if start == -1: break + * cpglist.append(start) # <<<<<<<<<<<<<< + * start = start + 1 + * return cpglist + */ + if (unlikely(((PyObject *)__pyx_v_cpglist) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyList_Append(__pyx_v_cpglist, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":68 + * if start == -1: break + * cpglist.append(start) + * start = start + 1 # <<<<<<<<<<<<<< + * return cpglist + * + */ + __pyx_v_start = (__pyx_v_start + 1); + } + __pyx_L7_break:; + + /* "bx/align/sitemask/_cpg.pyx":69 + * cpglist.append(start) + * start = start + 1 + * return cpglist # <<<<<<<<<<<<<< + * + * def list_non_cpg( sp1, sp2 ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cpglist)); + __pyx_r = ((PyObject *)__pyx_v_cpglist); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_cpg_restricted", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cpglist); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":71 + * return cpglist + * + * def list_non_cpg( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_5list_non_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_5list_non_cpg = {__Pyx_NAMESTR("list_non_cpg"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_5list_non_cpg, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_5list_non_cpg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp1 = 0; + PyObject *__pyx_v_sp2 = 0; + char *__pyx_v_a; + char *__pyx_v_b; + int __pyx_v_start; + PyObject *__pyx_v_cpglist = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp1,&__pyx_n_s__sp2,0}; + __Pyx_RefNannySetupContext("list_non_cpg"); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp1); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp2); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("list_non_cpg", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "list_non_cpg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_sp1 = values[0]; + __pyx_v_sp2 = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("list_non_cpg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_non_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":75 + * cdef char * b + * cdef int start + * a = sp1 # <<<<<<<<<<<<<< + * b = sp2 + * start = 0 + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_a = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":76 + * cdef int start + * a = sp1 + * b = sp2 # <<<<<<<<<<<<<< + * start = 0 + * cpglist = list() + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_sp2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_b = __pyx_t_1; + + /* "bx/align/sitemask/_cpg.pyx":77 + * a = sp1 + * b = sp2 + * start = 0 # <<<<<<<<<<<<<< + * cpglist = list() + * while start > -1 and start < len(sp1): + */ + __pyx_v_start = 0; + + /* "bx/align/sitemask/_cpg.pyx":78 + * b = sp2 + * start = 0 + * cpglist = list() # <<<<<<<<<<<<<< + * while start > -1 and start < len(sp1): + * start = next_non_cpg( a, b, start ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_cpglist = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":79 + * start = 0 + * cpglist = list() + * while start > -1 and start < len(sp1): # <<<<<<<<<<<<<< + * start = next_non_cpg( a, b, start ) + * if start == -1: break + */ + while (1) { + __pyx_t_3 = (__pyx_v_start > -1); + if (__pyx_t_3) { + __pyx_t_4 = PyObject_Length(__pyx_v_sp1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_v_start < __pyx_t_4); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (!__pyx_t_6) break; + + /* "bx/align/sitemask/_cpg.pyx":80 + * cpglist = list() + * while start > -1 and start < len(sp1): + * start = next_non_cpg( a, b, start ) # <<<<<<<<<<<<<< + * if start == -1: break + * cpglist.append(start) + */ + __pyx_v_start = next_non_cpg(__pyx_v_a, __pyx_v_b, __pyx_v_start); + + /* "bx/align/sitemask/_cpg.pyx":81 + * while start > -1 and start < len(sp1): + * start = next_non_cpg( a, b, start ) + * if start == -1: break # <<<<<<<<<<<<<< + * cpglist.append(start) + * start = start + 1 + */ + __pyx_t_6 = (__pyx_v_start == -1); + if (__pyx_t_6) { + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/align/sitemask/_cpg.pyx":82 + * start = next_non_cpg( a, b, start ) + * if start == -1: break + * cpglist.append(start) # <<<<<<<<<<<<<< + * start = start + 1 + * return cpglist + */ + if (unlikely(((PyObject *)__pyx_v_cpglist) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyList_Append(__pyx_v_cpglist, __pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/align/sitemask/_cpg.pyx":83 + * if start == -1: break + * cpglist.append(start) + * start = start + 1 # <<<<<<<<<<<<<< + * return cpglist + * + */ + __pyx_v_start = (__pyx_v_start + 1); + } + __pyx_L7_break:; + + /* "bx/align/sitemask/_cpg.pyx":84 + * cpglist.append(start) + * start = start + 1 + * return cpglist # <<<<<<<<<<<<<< + * + * def remove_gaps( sp, cpglist ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_cpglist)); + __pyx_r = ((PyObject *)__pyx_v_cpglist); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.align.sitemask._cpg.list_non_cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_cpglist); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/align/sitemask/_cpg.pyx":86 + * return cpglist + * + * def remove_gaps( sp, cpglist ): # <<<<<<<<<<<<<< + * for item in cpglist: + * if sp[item] == '-': + */ + +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_6remove_gaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_5align_8sitemask_4_cpg_6remove_gaps = {__Pyx_NAMESTR("remove_gaps"), (PyCFunction)__pyx_pf_2bx_5align_8sitemask_4_cpg_6remove_gaps, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_5align_8sitemask_4_cpg_6remove_gaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sp = 0; + PyObject *__pyx_v_cpglist = 0; + PyObject *__pyx_v_item = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sp,&__pyx_n_s__cpglist,0}; + __Pyx_RefNannySetupContext("remove_gaps"); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sp); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cpglist); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("remove_gaps", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "remove_gaps") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_sp = values[0]; + __pyx_v_cpglist = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("remove_gaps", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.align.sitemask._cpg.remove_gaps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/align/sitemask/_cpg.pyx":87 + * + * def remove_gaps( sp, cpglist ): + * for item in cpglist: # <<<<<<<<<<<<<< + * if sp[item] == '-': + * cpglist.remove(item) + */ + if (PyList_CheckExact(__pyx_v_cpglist) || PyTuple_CheckExact(__pyx_v_cpglist)) { + __pyx_t_1 = __pyx_v_cpglist; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cpglist); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else if (PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/align/sitemask/_cpg.pyx":88 + * def remove_gaps( sp, cpglist ): + * for item in cpglist: + * if sp[item] == '-': # <<<<<<<<<<<<<< + * cpglist.remove(item) + * return cpglist + */ + __pyx_t_4 = PyObject_GetItem(__pyx_v_sp, __pyx_v_item); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_4, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "bx/align/sitemask/_cpg.pyx":89 + * for item in cpglist: + * if sp[item] == '-': + * cpglist.remove(item) # <<<<<<<<<<<<<< + * return cpglist + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_cpglist, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_item); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_item); + __Pyx_GIVEREF(__pyx_v_item); + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":90 + * if sp[item] == '-': + * cpglist.remove(item) + * return cpglist # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_cpglist); + __pyx_r = __pyx_v_cpglist; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("bx.align.sitemask._cpg.remove_gaps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_cpg"), + __Pyx_DOCSTR(__pyx_k_2), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__cpglist, __pyx_k__cpglist, sizeof(__pyx_k__cpglist), 0, 0, 1, 1}, + {&__pyx_n_s__find_cpg, __pyx_k__find_cpg, sizeof(__pyx_k__find_cpg), 0, 0, 1, 1}, + {&__pyx_n_s__find_cpg_restricted, __pyx_k__find_cpg_restricted, sizeof(__pyx_k__find_cpg_restricted), 0, 0, 1, 1}, + {&__pyx_n_s__find_non_cpg, __pyx_k__find_non_cpg, sizeof(__pyx_k__find_non_cpg), 0, 0, 1, 1}, + {&__pyx_n_s__list_cpg, __pyx_k__list_cpg, sizeof(__pyx_k__list_cpg), 0, 0, 1, 1}, + {&__pyx_n_s__list_cpg_restricted, __pyx_k__list_cpg_restricted, sizeof(__pyx_k__list_cpg_restricted), 0, 0, 1, 1}, + {&__pyx_n_s__list_non_cpg, __pyx_k__list_non_cpg, sizeof(__pyx_k__list_non_cpg), 0, 0, 1, 1}, + {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1}, + {&__pyx_n_s__remove_gaps, __pyx_k__remove_gaps, sizeof(__pyx_k__remove_gaps), 0, 0, 1, 1}, + {&__pyx_n_s__sp, __pyx_k__sp, sizeof(__pyx_k__sp), 0, 0, 1, 1}, + {&__pyx_n_s__sp1, __pyx_k__sp1, sizeof(__pyx_k__sp1), 0, 0, 1, 1}, + {&__pyx_n_s__sp2, __pyx_k__sp2, sizeof(__pyx_k__sp2), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_cpg(void); /*proto*/ +PyMODINIT_FUNC init_cpg(void) +#else +PyMODINIT_FUNC PyInit__cpg(void); /*proto*/ +PyMODINIT_FUNC PyInit__cpg(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__cpg(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_cpg"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_2), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__align__sitemask___cpg) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/align/sitemask/_cpg.pyx":11 + * int next_non_cpg( char * sp1, char * sp2, int start) + * + * def find_cpg( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_find_cpg, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__find_cpg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":21 + * return next_cpg( a, b, pos ) + * + * def find_cpg_restricted( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_1find_cpg_restricted, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__find_cpg_restricted, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":31 + * return next_cpg_restricted( a, b, pos ) + * + * def find_non_cpg( sp1, sp2, start ): # <<<<<<<<<<<<<< + * cdef char* a + * cdef char* b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_2find_non_cpg, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__find_non_cpg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":41 + * return next_non_cpg( a, b, pos ) + * + * def list_cpg( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_3list_cpg, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__list_cpg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":56 + * return cpglist + * + * def list_cpg_restricted( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_4list_cpg_restricted, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__list_cpg_restricted, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":71 + * return cpglist + * + * def list_non_cpg( sp1, sp2 ): # <<<<<<<<<<<<<< + * cdef char * a + * cdef char * b + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_5list_non_cpg, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__list_non_cpg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":86 + * return cpglist + * + * def remove_gaps( sp, cpglist ): # <<<<<<<<<<<<<< + * for item in cpglist: + * if sp[item] == '-': + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5align_8sitemask_4_cpg_6remove_gaps, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__remove_gaps, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/align/sitemask/_cpg.pyx":1 + * """ # <<<<<<<<<<<<<< + * Pyrex/C extension for quickly finding potential CpG sites in pairs of + * sequences. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.align.sitemask._cpg", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.align.sitemask._cpg"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); + else + return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.pyx b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.pyx new file mode 100755 index 0000000..1133cfc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/_cpg.pyx @@ -0,0 +1,90 @@ +""" +Pyrex/C extension for quickly finding potential CpG sites in pairs of +sequences. +""" + +cdef extern from "find_cpg.h": + int next_cpg( char * sp1, char * sp2, int start) + int next_cpg_restricted( char * sp1, char *sp2, int start) + int next_non_cpg( char * sp1, char * sp2, int start) + +def find_cpg( sp1, sp2, start ): + cdef char* a + cdef char* b + cdef int pos + a = sp1 + b = sp2 + pos = start + if pos > len(sp1): return -1 + return next_cpg( a, b, pos ) + +def find_cpg_restricted( sp1, sp2, start ): + cdef char* a + cdef char* b + cdef int pos + a = sp1 + b = sp2 + pos = start + if pos > len(sp1): return -1 + return next_cpg_restricted( a, b, pos ) + +def find_non_cpg( sp1, sp2, start ): + cdef char* a + cdef char* b + cdef int pos + a = sp1 + b = sp2 + pos = start + if pos > len(sp1): return -1 + return next_non_cpg( a, b, pos ) + +def list_cpg( sp1, sp2 ): + cdef char * a + cdef char * b + cdef int start + a = sp1 + b = sp2 + start = 0 + cpglist = list() + while start > -1 and start < len(sp1): + start = next_cpg( a, b, start ) + if start == -1: break + cpglist.append(start) + start = start + 1 + return cpglist + +def list_cpg_restricted( sp1, sp2 ): + cdef char * a + cdef char * b + cdef int start + a = sp1 + b = sp2 + start = 0 + cpglist = list() + while start > -1 and start < len(sp1): + start = next_cpg_restricted( a, b, start ) + if start == -1: break + cpglist.append(start) + start = start + 1 + return cpglist + +def list_non_cpg( sp1, sp2 ): + cdef char * a + cdef char * b + cdef int start + a = sp1 + b = sp2 + start = 0 + cpglist = list() + while start > -1 and start < len(sp1): + start = next_non_cpg( a, b, start ) + if start == -1: break + cpglist.append(start) + start = start + 1 + return cpglist + +def remove_gaps( sp, cpglist ): + for item in cpglist: + if sp[item] == '-': + cpglist.remove(item) + return cpglist diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/core.py b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/core.py new file mode 100755 index 0000000..e6c9800 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/core.py @@ -0,0 +1,35 @@ +""" +Base classes for site maskers. +""" + +from bx.filter import * + +class Masker( Filter ): + def __init__( self, **kwargs ): + self.masked = 0 + self.total = 0 + Exception("Abstract class") + +class MaskPipeline( Pipeline ): + """ + MaskPipeline implements a Pipeline through which alignments can be + pushed and masked. Pipelines can be aggregated. + """ + def get_masked( self ): + masked = 0 + for function in self.pipeline: + try: masked += masker.masked + except AttributeError: pass + return masked + masked = property( fget=get_masked ) + + def __call__( self, block ): + if not block: return + # push alignment block through all filters + self.total += len( block.components[0].text ) + for masker in self.filters: + if not block: return + try: m_filter = masker.__call__ + except AttributeError: + raise Exception("Masker in pipeline does not implement \"filter( self, block )\".") + masker( block ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/cpg.py b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/cpg.py new file mode 100755 index 0000000..d7d6a53 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/cpg.py @@ -0,0 +1,91 @@ +""" +Support for masking potential CpG sites in *pairwise* alignments. +""" + +from _cpg import * +from bx.align.sitemask import Masker +from bx.filter import * +import string + +# Restricted. Only mask out sites that are defitely CpG +class Restricted( Masker ): + def __init__( self, mask = '?' ): + self.mask = mask + self.masked = 0 + self.total = 0 + + def __call__( self, block ): + if not block: return block + if len(block.components) < 2: + return + cpglist = list_cpg_restricted( \ + string.upper(block.components[0].text), \ + string.upper(block.components[1].text) ) + + # now we have a fast list of CpG columns, iterate/mask + self.masked += len(cpglist) + self.total += len(block.components[0].text) + for component in block.components: + component.text = mask_columns( cpglist, component.text, self.mask ) + + return block + +# Inclusive. Mask out all sites that are not non-CpG sites. +class Inclusive( Masker ): + def __init__( self, mask = '?' ): + self.mask = mask + self.masked = 0 + self.total = 0 + + def __call__( self, block ): + if not block: return block + if len(block.components) < 2: + return + cpglist = list_cpg( \ + string.upper(block.components[0].text), \ + string.upper(block.components[1].text) ) + + self.masked += len( cpglist ) + self.total += len( block.components[0].text ) + for component in block.components: + component.text = mask_columns( cpglist, component.text, self.mask) + + return block + +#Mak nonCpG sites +class nonCpG( Masker ): + def __init__( self, mask = '?' ): + self.mask = mask + self.masked = 0 + self.total = 0 + + def __call__( self, block ): + if not block: return block + if len(block.components) < 2: + return + noncpglist = list_non_cpg( \ + string.upper(block.components[0].text), \ + string.upper(block.components[1].text) ) + + # now we have a fast list of non-CpG columns, iterate/mask + self.masked += len(noncpglist) + self.total += len(block.components[0].text) + for component in block.components: + component.text = mask_columns( noncpglist, component.text, self.mask ) + + return block + +def mask_columns( masklist, text, mask ): + templist = list() + for position in masklist: + if text[position] != "-": + templist.append(position) + templist.append(len(text)) # Add the end of the text + #cut string + newtext = list() + c = 0 + for position in templist: + newtext.append(text[c:position]) + c = position + 1 # Gaps have len = 1 + joinedtext = mask.join(newtext) + return joinedtext diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.c b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.c new file mode 100755 index 0000000..fb6e2b0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.c @@ -0,0 +1,66 @@ +#include +/* + Author: Ian N Schenck + Version: 7/21/2006 + + Most of this was ripped out of James Taylor's never-released code, + and plugged in here for use in Python. Slight modifications were + made where I saw fit. + + It looks as if CpG's are typically not next to gaps. +*/ + +static inline int is_cpg( char * sp1, char * sp2, int pos) +{ + if ( pos < 1 ) return 0; + if ( sp1[pos + 1] == '\0' ) return 0; + if ( sp1[pos - 1] != 'C' && sp2[pos - 1] != 'C' && + sp1[pos + 1] == 'G' && sp2[pos + 1] == 'G' && + (sp1[pos] == 'C' || sp2[pos] == 'C') ) return 1; + if ( sp1[pos + 1] != 'G' && sp2[pos + 1] != 'G' && + sp1[pos - 1] == 'C' && sp2[pos - 1] == 'C' && + (sp1[pos] == 'G' || sp2[pos] == 'G') ) return 1; + return 0; +} + +static inline int is_non_cpg( char * sp1, char * sp2, int pos) +{ + // first one can't assuredly be cpg + if ( pos < 1 ) return 1; + if ( sp1[pos + 1] == '\0' ) return 0; + return + ( sp1[pos - 1] != 'C' && sp2[pos - 1] != 'C' && + sp1[pos + 1] != 'G' && sp2[pos + 1] != 'G' ); +} + +static inline int is_cpg_restricted( char * sp1, char * sp2, int pos ) +{ + return !is_non_cpg( sp1, sp2, pos ); +} + +int next( char * sp1, char * sp2, int start, int (*func)(char*,char*,int)) +{ + while( sp1[start+1] != '\0') + { + if( func(sp1, sp2, start) ) + return start; + start++; + } + // nothing found + return -1; +} + +int next_cpg( char * sp1, char * sp2, int start) +{ + return next( sp1, sp2, start, &is_cpg); +} + +int next_cpg_restricted( char * sp1, char *sp2, int start) +{ + return next( sp1, sp2, start, &is_cpg_restricted ); +} + +int next_non_cpg( char * sp1, char * sp2, int start) +{ + return next( sp1, sp2, start, &is_non_cpg); +} diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.h b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.h new file mode 100755 index 0000000..1e91dba --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/find_cpg.h @@ -0,0 +1,7 @@ +#ifndef __find_cpg__ +#define __find_cpg__ +int next( char * sp1, char * sp2, int start, int (*func)(char*,char*,int)); +int next_cpg( char * sp1, char * sp2, int start); +int next_cpg_restricted( char * sp1, char *sp2, int start); +int next_non_cpg( char * sp1, char * sp2, int start); +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/quality.py b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/quality.py new file mode 100755 index 0000000..b6cd002 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/quality.py @@ -0,0 +1,130 @@ +""" +Support for masking out sites in alignments based on sequence quality. Both +simple masking of regions below some threshold and masking using the +neighborhood quality standard (NQS) are supported. Uses sequence quality +values stored in a `bx.binned_array.FileBinnedArray`. +""" + +from bx.align.sitemask import Masker +from bx.align import * +from bx.binned_array import FileBinnedArray + +# This class implements simple rules for masking quality, if base < +# minqual, mask +class Simple( Masker ): + # keys should be: + # qualspecies: dictionary of species as key, lengths + # dict by chromosome or chromosome list as value + # qualfiles: prefix for quality file for each species in qualspecies + # mask: mask character (default is '?') + # minqual: minimum quality + # cache: optional, but sets the number of megabytes allowed in cache per quality masked species + def __init__( self, qualfiles = None, qualspecies = None, minqual = None, mask = "?", cache=100): + if not qualfiles: + raise Exception("No quality files.") + if not qualspecies: + raise Exception("No species dictionary.") + if not minqual: + raise Exception("No minimum quality specified.") + self.mask = "?" + self.minqual = minqual + self.mask = mask + self.total = 0 + self.masked = 0 + + self.qualfiles = qualfiles + self.qualspecies = qualspecies + self.cache = cache * 2 # typical bin size is 512K + # load quality files into FileBinnedArray + self.qualities = {} + for species, qualfile in self.qualfiles.items(): + specdict = {} + for chrom in self.qualspecies[species]: + specdict[chrom] = FileBinnedArray( \ + open(qualfile + "." + chrom + ".bqv", "rb"), \ + cache = self.cache/len(qualfiles) ) + self.qualities[species] = specdict + + def __call__( self, block ): + if not block: return + for qualspec in self.qualities: + comp = block.get_component_by_src_start(qualspec) + if not comp: continue + chrom = comp.src.split(".")[1] + start, end = comp.get_forward_strand_start(), comp.get_forward_strand_end() + # get quality slice, for + strand + qual = self.qualities[qualspec][chrom][start:end] + x = 0 + while start+x < end: + self.total += 1 + # got the column in the alignment for this particular base + if qual[x] < self.minqual: + col = comp.coord_to_col(start+x) + self.masked += 1 + for component in block.components: + if component.text[col] != "-": + component.text = component.text[0:col] + \ + self.mask + \ + component.text[col+1:len(component.text)] + # iterate through quality + x += 1 + return block + +class NQS( Masker ): + # keys should be: + # qualspecies: dictionary of species as key, lengths + # dict by chromosome or chromosome list as value + # qualfiles: prefix for quality file for each species in qualspecies + # mask: mask character (default is '?') + # minqual: minimum quality + # neighborqual: neighborhood minimum quality (bases within 5 bps are masked) + # cache: optional, but sets the number of megabytes allowed in cache per quality masked species + def __init__( self, qualfiles = None, qualspecies = None, minqual = None, mask = "?", cache=100): + if not qualfiles: + raise Exception("No quality files.") + if not qualspecies: + raise Exception("No species dictionary.") + if not minqual: + raise Exception("No minimum quality specified.") + self.mask = "?" + self.minqual = minqual + self.mask = mask + self.total = 0 + self.masked = 0 + + self.qualfiles = qualfiles + self.qualspecies = qualspecies + self.cache = cache * 2 # typical bin size is 512K + # load quality files into FileBinnedArray + self.qualities = {} + for species, qualfile in self.qualfiles.items(): + specdict = {} + for chrom in self.qualspecies[species]: + specdict[chrom] = FileBinnedArray( \ + open(qualfile + "." + chrom + ".bqv", "rb"), \ + cache = self.cache/len(qualfiles) ) + self.qualities[species] = specdict + + def __call__( self, block ): + if not block: return + for qualspec in self.qualities: + comp = block.get_component_by_src_start(qualspec) + chrom = comp.src.split(".")[1] + start, end = comp.get_forward_strand_start(), comp.get_forward_strand_end() + # get quality slice, for + strand + qual = self.qualities[qualspec][chrom][start:end] + x = 0 + while start+x < end: + self.total += 1 + # got the column in the alignment for this particular base + if qual[x] < self.minqual: + col = comp.coord_to_col(start+x) + self.masked += 1 + for component in block.components: + if component.text[col] != "-": + component.text = component.text[0:col] + \ + self.mask + \ + component.text[col+1:len(component.text)] + # iterate through quality + x += 1 + return block diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/sitemask_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/sitemask_tests.py new file mode 100755 index 0000000..f2886a9 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/sitemask/sitemask_tests.py @@ -0,0 +1,82 @@ +""" +Tests for `bx.align.maf.sitemask`. +""" + +import sys,tempfile +import unittest +from StringIO import StringIO +import cpg +import bx.align.maf + +test_maf_cpg = """##maf version=1 scoring=none +a score=0 +s apple 34 64 + 110 AGGGA---GTTCGTCACT------GTCGTAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG +s orange 19 61 - 100 AGGGATGCGTT--TCACTGCTATCGTCGTA----TTCAGACTTCG-CTATCT------GAGTTGT---GCATTACCG +""" + +cpg_inclusive_result = [ +"##maf,version=1", +"a,score=0", +"s,apple,34,64,+,110,AGGGA---GTTCGTCACT------GT##TAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG", +"s,orange,19,61,-,100,AGGGATG#GTT--TCACTGCTAT#GT##TA----TTCAGACTTCG-CTATCT------GAGTTGT---GCATTACCG" +] + +cpg_restricted_result = [ +"##maf,version=1", +"a,score=0", +"s,apple,34,64,+,110,A##GA---#TT##TC#C#------#T##TA###GTTC#GA--C##TC#A#G#ATAC####GT#G#GT#GC#--AC#G", +"s,orange,19,61,-,100,A##GA#G##TT--TC#C#GC#AT##T##TA----TTC#GAC#T##-C#A#C#------##GT#G#---GC#TTAC#G" +] + +noncpg_result = [ +"##maf,version=1", +"a,score=0", +"s,apple,34,64,+,110,#GG##---G##CG##A#T------G#CG##AGG####A##--#TG##T#T#T####ACAA##T#T##T##A--##CG", +"s,orange,19,61,-,100,#GG##T#CG##--##A#T##T##CG#CG##----###A###T#CG-#T#T#T------GA##T#T---##A####CG" +] + +def test_cpg_inclusive(): + reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) ) + out = tempfile.NamedTemporaryFile('w') + writer = bx.align.maf.Writer( out ) + cpgfilter = cpg.Inclusive( mask='#' ) + cpgfilter.run( reader, writer.write ) + out.seek(0) + j=0 + for line in file(out.name): + line = line.strip() + if not(line): + continue + assert cpg_inclusive_result[j] == ",".join(line.split()) + j+=1 + +def test_cpg_restricted(): + reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) ) + out = tempfile.NamedTemporaryFile('w') + writer = bx.align.maf.Writer( out ) + cpgfilter = cpg.Restricted( mask='#' ) + cpgfilter.run( reader, writer.write ) + out.seek(0) + j=0 + for line in file(out.name): + line = line.strip() + if not(line): + continue + assert cpg_restricted_result[j] == ",".join(line.split()) + j+=1 + +def test_non_cpg(): + reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) ) + out = tempfile.NamedTemporaryFile('w') + writer = bx.align.maf.Writer( out ) + cpgfilter = cpg.nonCpG( mask='#' ) + cpgfilter.run( reader, writer.write ) + out.seek(0) + j=0 + for line in file(out.name): + line = line.strip() + if not(line): + continue + assert noncpg_result[j] == ",".join(line.split()) + j+=1 + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/tools/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/__init__.py new file mode 100755 index 0000000..6fbda99 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/__init__.py @@ -0,0 +1,8 @@ +""" +Various utilities for working with `bx.align.Alignment` objects. +""" + +from fuse import * +from thread import * +from chop import * +from tile import * \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/tools/chop.py b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/chop.py new file mode 100755 index 0000000..560c39f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/chop.py @@ -0,0 +1,29 @@ +""" +Support for chopping a list of alignment blocks to only the portion that +intersects a particular interval. +""" + +def chop_list( blocks, src, start, end ): + """ + For each alignment block in the sequence `blocks`, chop out the portion + of the block that overlaps the interval [`start`,`end`) in the + component/species named `src`. + """ + new_blocks = [] + for block in blocks: + ref = block.get_component_by_src( src ) + # If the reference component is on the '-' strand we should complement the interval + if ref.strand == '-': + slice_start = max( ref.src_size - end, ref.start ) + slice_end = max( ref.src_size - start, ref.end ) + else: + slice_start = max( start, ref.start ) + slice_end = min( end, ref.end ) + sliced = block.slice_by_component( ref, slice_start, slice_end ) + good = True + for c in sliced.components: + if c.size < 1: + good = False + if good: + new_blocks.append( sliced ) + return new_blocks diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/tools/fuse.py b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/fuse.py new file mode 100755 index 0000000..af6cb82 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/fuse.py @@ -0,0 +1,88 @@ +""" +Tools for fusing contiguous alignment blocks together. +""" + +from itertools import * +from copy import deepcopy + +def fuse_list( mafs ): + """ + Try to fuse a list of blocks by progressively fusing each adjacent pair. + """ + last = None + for m in mafs: + if last is None: + last = m + else: + fused = fuse( last, m ) + if fused: + last = fused + else: + yield last + last = m + if last: + yield last + +def fuse( m1, m2 ): + """ + Attempt to fuse two blocks. If they can be fused returns a new block, + otherwise returns None. + + Example: + + >>> import bx.align.maf + + >>> block1 = bx.align.maf.from_string( ''' + ... a score=0.0 + ... s hg18.chr10 52686 44 + 135374737 GTGCTAACTTACTGCTCCACAGAAAACATCAATTCTGCTCATGC + ... s panTro1.chrUn_random 208115356 44 - 240967748 GTGCTAACTGACTGCTCCAGAGAAAACATCAATTCTGTTCATGT + ... ''' ) + + >>> block2 = bx.align.maf.from_string( ''' + ... a score=0.0 + ... s hg18.chr10 52730 69 + 135374737 GCAGGTACAATTCATCAAGAAAGGAATTACAACTTCAGAAATGTGTTCAAAATATATCCATACTTTGAC + ... s panTro1.chrUn_random 208115400 69 - 240967748 GCAGCTACTATTCATCAAGAAAGGGATTACAACTTCAGAAATGTGTTCAAAGTGTATCCATACTTTGAT + ... ''' ) + + >>> fused = fuse( block1, block2 ) + + >>> print fused + a score=0.0 + s hg18.chr10 52686 113 + 135374737 GTGCTAACTTACTGCTCCACAGAAAACATCAATTCTGCTCATGCGCAGGTACAATTCATCAAGAAAGGAATTACAACTTCAGAAATGTGTTCAAAATATATCCATACTTTGAC + s panTro1.chrUn_random 208115356 113 - 240967748 GTGCTAACTGACTGCTCCAGAGAAAACATCAATTCTGTTCATGTGCAGCTACTATTCATCAAGAAAGGGATTACAACTTCAGAAATGTGTTCAAAGTGTATCCATACTTTGAT + + """ + # Check if the blocks are adjacent, return none if not. + if len( m1.components ) != len( m2.components ): return None + for c1, c2 in izip( m1.components, m2.components ): + if c1.src != c2.src: return None + if c1.strand != c2.strand: return None + if c1.end != c2.start: return None + # Try to fuse: + n = deepcopy( m1 ) + for c1, c2 in izip( n.components, m2.components ): + c1.text += c2.text + c1.size += c2.size + n.text_size = len( n.components[0].text ) + return n + +class FusingAlignmentWriter( object ): + """ + Wrapper for an alignment Writer which attempts to fuse adjacent blocks + """ + def __init__( self, maf_writer ): + self.maf_writer = maf_writer + self.last = None + def write( self, m ): + if not self.last: + self.last = m + else: + fused = fuse( self.last, m ) + if fused: + self.last = fused + else: + self.maf_writer.write( self.last ) + self.last = m + def close( self ): + if self.last: self.maf_writer.write( self.last ) + self.maf_writer.close() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/tools/thread.py b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/thread.py new file mode 100755 index 0000000..86636c5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/thread.py @@ -0,0 +1,98 @@ +""" +Tools for "threading" out specific species from alignments (removing other +species and fixing alignment text). +""" + +import sys +from itertools import * +from copy import deepcopy + +def thread( mafs, species ): + """ + Restrict an list of alignments to a given list of species by: + + 1) Removing components for any other species + 2) Remove any columns containing all gaps + + Example: + + >>> import bx.align.maf + + >>> block1 = bx.align.maf.from_string( ''' + ... a score=4964.0 + ... s hg18.chr10 52686 44 + 135374737 GTGCTAACTTACTGCTCCACAGAAAACATCAATTCTGCTCATGC + ... s rheMac2.chr20 58163346 43 - 88221753 ATATTATCTTAACATTAAAGA-AGAACAGTAATTCTGGTCATAA + ... s panTro1.chrUn_random 208115356 44 - 240967748 GTGCTAACTGACTGCTCCAGAGAAAACATCAATTCTGTTCATGT + ... s oryCun1.scaffold_175207 85970 22 + 212797 ----------------------AAAATATTAGTTATCACCATAT + ... s bosTau2.chr23 23894492 43 + 41602928 AAACTACCTTAATGTCACAGG-AAACAATGTATgctgctgctgc + ... ''' ) + + >>> block2 = bx.align.maf.from_string( ''' + ... a score=9151.0 + ... s hg18.chr10 52730 69 + 135374737 GCAGGTACAATTCATCAAGAAAG-GAATTACAACTTCAGAAATGTGTTCAAAATATATCCATACTT-TGAC + ... s oryCun1.scaffold_175207 85992 71 + 212797 TCTAGTGCTCTCCAATAATATAATAGATTATAACTTCATATAATTATGTGAAATATAAGATTATTTATCAG + ... s panTro1.chrUn_random 208115400 69 - 240967748 GCAGCTACTATTCATCAAGAAAG-GGATTACAACTTCAGAAATGTGTTCAAAGTGTATCCATACTT-TGAT + ... s rheMac2.chr20 58163389 69 - 88221753 ACACATATTATTTCTTAACATGGAGGATTATATCTT-AAACATGTGTGCaaaatataaatatatat-tcaa + ... ''' ) + + >>> mafs = [ block1, block2 ] + + >>> threaded = [ t for t in thread( mafs, [ "hg18", "panTro1" ] ) ] + + >>> len( threaded ) + 2 + + >>> print threaded[0] + a score=0.0 + s hg18.chr10 52686 44 + 135374737 GTGCTAACTTACTGCTCCACAGAAAACATCAATTCTGCTCATGC + s panTro1.chrUn_random 208115356 44 - 240967748 GTGCTAACTGACTGCTCCAGAGAAAACATCAATTCTGTTCATGT + + + >>> print threaded[1] + a score=0.0 + s hg18.chr10 52730 69 + 135374737 GCAGGTACAATTCATCAAGAAAGGAATTACAACTTCAGAAATGTGTTCAAAATATATCCATACTTTGAC + s panTro1.chrUn_random 208115400 69 - 240967748 GCAGCTACTATTCATCAAGAAAGGGATTACAACTTCAGAAATGTGTTCAAAGTGTATCCATACTTTGAT + + + """ + for m in mafs: + new_maf = deepcopy( m ) + new_components = get_components_for_species( new_maf, species ) + if new_components: + remove_all_gap_columns( new_components ) + new_maf.components = new_components + new_maf.score = 0.0 + new_maf.text_size = len(new_components[0].text) + yield new_maf + +def get_components_for_species( alignment, species ): + """Return the component for each species in the list `species` or None""" + # If the number of components in the alignment is less that the requested number + # of species we can immediately fail + if len( alignment.components ) < len( species ): return None + # Otherwise, build an index of components by species, then lookup + index = dict( [ ( c.src.split( '.' )[0], c ) for c in alignment.components ] ) + try: return [ index[s] for s in species ] + except: return None + +def remove_all_gap_columns( components ): + """ + Remove any columns containing only gaps from a set of alignment components, + text of components is modified IN PLACE. + + TODO: Optimize this with Pyrex. + """ + seqs = [ list( c.text ) for c in components ] + i = 0 + text_size = len( seqs[0] ) + while i < text_size: + all_gap = True + for seq in seqs: + if seq[i] != '-': all_gap = False + if all_gap: + for seq in seqs: del seq[i] + text_size -= 1 + else: + i += 1 + for i in range( len( components ) ): + components[i].text = ''.join( seqs[i] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/align/tools/tile.py b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/tile.py new file mode 100755 index 0000000..acf18c5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/align/tools/tile.py @@ -0,0 +1,81 @@ +""" +Tools for tiling / projecting alignments onto an interval of a sequence. +""" + +import bx.align as align +from bx import misc +import bx.seq.nib +import os +import string +import sys + + +def tile_interval( sources, index, ref_src, start, end, seq_db=None ): + """ + Tile maf blocks onto an interval. The resulting block will span the interval + exactly and contain the column from the highest scoring alignment at each + position. + + `sources`: list of sequence source names to include in final block + `index`: an instnace that can return maf blocks overlapping intervals + `ref_src`: source name of the interval (ie, hg17.chr7) + `start`: start of interval + `end`: end of interval + `seq_db`: a mapping for source names in the reference species to nib files + """ + # First entry in sources should also be on the reference species + assert sources[0].split('.')[0] == ref_src.split('.')[0], \ + "%s != %s" % ( sources[0].split('.')[0], ref_src.split('.')[0] ) + base_len = end - start + blocks = index.get( ref_src, start, end ) + # From low to high score + blocks.sort(key=lambda t: t.score) + mask = [ -1 ] * base_len + ref_src_size = None + for i, block in enumerate( blocks ): + ref = block.get_component_by_src_start( ref_src ) + ref_src_size = ref.src_size + assert ref.strand == "+" + slice_start = max( start, ref.start ) + slice_end = min( end, ref.end ) + for j in range( slice_start, slice_end ): + mask[j-start] = i + tiled = [] + for i in range( len( sources ) ): + tiled.append( [] ) + for ss, ee, index in intervals_from_mask( mask ): + # Interval with no covering alignments + if index < 0: + # Get sequence if available, otherwise just use 'N' + if seq_db: + tiled[0].append( bx.seq.nib.NibFile( open( seq_db[ ref_src ] ) ).get( start+ss, ee-ss ) ) + else: + tiled[0].append( "N" * (ee-ss) ) + # Gaps in all other species + for row in tiled[1:]: + row.append( "-" * ( ee - ss ) ) + else: + slice_start = start + ss + slice_end = start + ee + block = blocks[index] + ref = block.get_component_by_src_start( ref_src ) + sliced = block.slice_by_component( ref, slice_start, slice_end ) + sliced = sliced.limit_to_species( sources ) + sliced.remove_all_gap_columns() + for i, src in enumerate( sources ): + comp = sliced.get_component_by_src_start( src ) + if comp: + tiled[i].append( comp.text ) + else: + tiled[i].append( "-" * sliced.text_size ) + return [ "".join( t ) for t in tiled ] + +def intervals_from_mask( mask ): + start = 0 + last = mask[0] + for i in range( 1, len( mask ) ): + if mask[i] != last: + yield start, i, last + start = i + last = mask[i] + yield start, len(mask), last diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/arrays/__init__.py new file mode 100755 index 0000000..84f13fc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/__init__.py @@ -0,0 +1,3 @@ +""" +Classes for working with arrays of data. +""" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.c b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.c new file mode 100755 index 0000000..8726f95 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.c @@ -0,0 +1,15353 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:12 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__arrays__array_tree +#define __PYX_HAVE_API__bx__arrays__array_tree +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "array_tree.pyx", + "numpy.pxd", + "wiggle.pxd", +}; + +/* "numpy.pxd":719 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":720 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":721 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":722 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":726 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":727 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":728 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":729 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":733 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":734 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":743 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":744 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":745 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":747 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":748 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":749 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":751 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":754 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":756 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_6arrays_10array_tree_Summary; +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf; +struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree; +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree; +struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict; +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode; +struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader; + +/* "numpy.pxd":758 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":760 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":762 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "bx/arrays/wiggle.pxd":1 + * cdef enum linemode: # <<<<<<<<<<<<<< + * MODE_BED + * MODE_FIXED + */ +enum __pyx_t_2bx_6arrays_6wiggle_linemode { + __pyx_e_2bx_6arrays_6wiggle_MODE_BED, + __pyx_e_2bx_6arrays_6wiggle_MODE_FIXED, + __pyx_e_2bx_6arrays_6wiggle_MODE_VARIABLE +}; + +/* "bx/arrays/array_tree.pyx":203 + * return min + * + * cdef class Summary: # <<<<<<<<<<<<<< + * """ + * Summary for a non-leaf level of the tree, contains arrays of the min, max, + */ +struct __pyx_obj_2bx_6arrays_10array_tree_Summary { + PyObject_HEAD + PyObject *counts; + PyObject *frequencies; + PyObject *mins; + PyObject *maxs; + PyObject *sums; + PyObject *sumsquares; +}; + + +/* "bx/arrays/array_tree.pyx":216 + * + * cdef class ArrayTreeNode + * cdef class ArrayTreeLeaf # <<<<<<<<<<<<<< + * + * cdef class ArrayTree: + */ +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf { + PyObject_HEAD + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree; + int min; + int max; + int frequency; + PyArrayObject *values; + long start_offset; +}; + + +/* "bx/arrays/array_tree.pyx":120 + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + * + * cdef class FileArrayTree: # <<<<<<<<<<<<<< + * """ + * Wrapper for ArrayTree stored in file that reads as little as possible + */ +struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *__pyx_vtab; + int max; + int block_size; + PyObject *dtype; + int levels; + int offset; + int root_offset; + PyObject *io; +}; + + +/* "bx/arrays/array_tree.pyx":218 + * cdef class ArrayTreeLeaf + * + * cdef class ArrayTree: # <<<<<<<<<<<<<< + * """ + * Stores a sparse array of data as a tree. + */ +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree { + PyObject_HEAD + int max; + int block_size; + PyObject *dtype; + int levels; + int no_leaves; + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *root; +}; + + +/* "bx/arrays/array_tree.pyx":79 + * + * + * cdef class FileArrayTreeDict: # <<<<<<<<<<<<<< + * """ + * Access to a file containing multiple array trees indexed by a string key. + */ +struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict { + PyObject_HEAD + PyObject *io; + PyObject *cdb_dict; +}; + + +/* "bx/arrays/array_tree.pyx":215 + * cdef public object sumsquares + * + * cdef class ArrayTreeNode # <<<<<<<<<<<<<< + * cdef class ArrayTreeLeaf + * + */ +struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_vtab; + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree; + int min; + int max; + int block_size; + int level; + int child_size; + PyObject *children; + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *summary; + long start_offset; +}; + + +/* "bx/arrays/wiggle.pxd":6 + * MODE_VARIABLE + * + * cdef class WiggleReader: # <<<<<<<<<<<<<< + * cdef object file + * cdef object current_chrom + */ +struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader { + PyObject_HEAD + PyObject *file; + PyObject *current_chrom; + long current_pos; + long current_step; + long current_span; + enum __pyx_t_2bx_6arrays_6wiggle_linemode mode; +}; + + + +/* "bx/arrays/array_tree.pyx":120 + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + * + * cdef class FileArrayTree: # <<<<<<<<<<<<<< + * """ + * Wrapper for ArrayTree stored in file that reads as little as possible + */ + +struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree { + int (*r_seek_to_node)(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *, int, int, PY_LONG_LONG, int, int); +}; +static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *__pyx_vtabptr_2bx_6arrays_10array_tree_FileArrayTree; + + +/* "bx/arrays/array_tree.pyx":309 + * return tree + * + * cdef class ArrayTreeNode: # <<<<<<<<<<<<<< + * """ + * Internal node of an ArrayTree. Contains summary data and pointers to + */ + +struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode { + PyObject *(*init_bin)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int); + PyObject *(*build_summary)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_vtabptr_2bx_6arrays_10array_tree_ArrayTreeNode; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { + return unlikely(b < 0) ? b : !b; +} +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(d == Py_None)) { + __Pyx_RaiseNoneIndexingError(); + return NULL; + } + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) + PyErr_SetObject(PyExc_KeyError, key); + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ + +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +#include "descrobject.h" +static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/ + +static CYTHON_INLINE PY_LONG_LONG __Pyx_pow_PY_LONG_LONG(PY_LONG_LONG, PY_LONG_LONG); /* proto */ + +static CYTHON_INLINE int __Pyx_pow_int(int, int); /* proto */ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ + +/* Module declarations from 'bx.arrays.wiggle' */ +static PyTypeObject *__pyx_ptype_2bx_6arrays_6wiggle_WiggleReader = 0; + +/* Module declarations from 'bx.arrays' */ + +/* Module declarations from 'bx' */ + +/* Module declarations from 'bx.arrays.array_tree' */ +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict = 0; +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree = 0; +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_Summary = 0; +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode = 0; +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf = 0; +static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree = 0; +#define __Pyx_MODULE_NAME "bx.arrays.array_tree" +int __pyx_module_is_main_bx__arrays__array_tree = 0; + +/* Implementation of 'bx.arrays.array_tree' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_sum; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_8[] = "max < block_size not yet handled"; +static char __pyx_k_9[] = "level must be <= self.levels"; +static char __pyx_k_14[] = "\000\000\000"; +static char __pyx_k_19[] = "Writing without summaries is currently not supported"; +static char __pyx_k_21[] = "ndarray is not C contiguous"; +static char __pyx_k_23[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_25[] = "Non-native byte order not supported"; +static char __pyx_k_27[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_28[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_31[] = "Format string allocated too short."; +static char __pyx_k_33[] = "array_tree_dict_from_reader"; +static char __pyx_k_34[] = "*"; +static char __pyx_k_35[] = "bx.misc.binary_file"; +static char __pyx_k_36[] = "bx.misc.cdb"; +static char __pyx_k_37[] = "bx.arrays.array_tree"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__s[] = "s"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__io[] = "io"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__max[] = "max"; +static char __pyx_k__min[] = "min"; +static char __pyx_k__nan[] = "nan"; +static char __pyx_k__set[] = "set"; +static char __pyx_k__sum[] = "sum"; +static char __pyx_k__char[] = "char"; +static char __pyx_k__dict[] = "dict"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__maxs[] = "maxs"; +static char __pyx_k__mins[] = "mins"; +static char __pyx_k__pack[] = "pack"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__root[] = "root"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__skip[] = "skip"; +static char __pyx_k__sums[] = "sums"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__tree[] = "tree"; +static char __pyx_k__MAGIC[] = "MAGIC"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__index[] = "index"; +static char __pyx_k__int32[] = "int32"; +static char __pyx_k__isnan[] = "isnan"; +static char __pyx_k__level[] = "level"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__sizes[] = "sizes"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__write[] = "write"; +static char __pyx_k__counts[] = "counts"; +static char __pyx_k__nanmax[] = "nanmax"; +static char __pyx_k__nanmin[] = "nanmin"; +static char __pyx_k__nansum[] = "nansum"; +static char __pyx_k__reader[] = "reader"; +static char __pyx_k__unpack[] = "unpack"; +static char __pyx_k__values[] = "values"; +static char __pyx_k__VERSION[] = "VERSION"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k__float32[] = "float32"; +static char __pyx_k__summary[] = "summary"; +static char __pyx_k__to_file[] = "to_file"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__iterkeys[] = "iterkeys"; +static char __pyx_k__ArrayTree[] = "ArrayTree"; +static char __pyx_k__frequency[] = "frequency"; +static char __pyx_k__from_file[] = "from_file"; +static char __pyx_k__iteritems[] = "iteritems"; +static char __pyx_k__no_leaves[] = "no_leaves"; +static char __pyx_k__set_range[] = "set_range"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__block_size[] = "block_size"; +static char __pyx_k__sumsquares[] = "sumsquares"; +static char __pyx_k__FileCDBDict[] = "FileCDBDict"; +static char __pyx_k__frequencies[] = "frequencies"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__read_uint64[] = "read_uint64"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__default_size[] = "default_size"; +static char __pyx_k__dict_to_file[] = "dict_to_file"; +static char __pyx_k__start_offset[] = "start_offset"; +static char __pyx_k__write_uint32[] = "write_uint32"; +static char __pyx_k__write_uint64[] = "write_uint64"; +static char __pyx_k__build_summary[] = "build_summary"; +static char __pyx_k__from_sequence[] = "from_sequence"; +static char __pyx_k__read_raw_array[] = "read_raw_array"; +static char __pyx_k__write_raw_array[] = "write_raw_array"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static char __pyx_k__BinaryFileWriter[] = "BinaryFileWriter"; +static char __pyx_k__is_little_endian[] = "is_little_endian"; +static char __pyx_k__FileArrayTreeDict[] = "FileArrayTreeDict"; +static char __pyx_k__to_file_data_pass[] = "to_file_data_pass"; +static char __pyx_k__NUM_SUMMARY_ARRAYS[] = "NUM_SUMMARY_ARRAYS"; +static char __pyx_k__to_file_offset_pass[] = "to_file_offset_pass"; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_kp_u_21; +static PyObject *__pyx_kp_u_23; +static PyObject *__pyx_kp_u_25; +static PyObject *__pyx_kp_u_27; +static PyObject *__pyx_kp_u_28; +static PyObject *__pyx_kp_u_31; +static PyObject *__pyx_n_s_33; +static PyObject *__pyx_n_s_34; +static PyObject *__pyx_n_s_35; +static PyObject *__pyx_n_s_36; +static PyObject *__pyx_n_s_37; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__ArrayTree; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s__BinaryFileWriter; +static PyObject *__pyx_n_s__FileArrayTreeDict; +static PyObject *__pyx_n_s__FileCDBDict; +static PyObject *__pyx_n_s__L; +static PyObject *__pyx_n_s__MAGIC; +static PyObject *__pyx_n_s__NUM_SUMMARY_ARRAYS; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__VERSION; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__block_size; +static PyObject *__pyx_n_s__build_summary; +static PyObject *__pyx_n_s__char; +static PyObject *__pyx_n_s__counts; +static PyObject *__pyx_n_s__default_size; +static PyObject *__pyx_n_s__dict; +static PyObject *__pyx_n_s__dict_to_file; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__f; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__float32; +static PyObject *__pyx_n_s__frequencies; +static PyObject *__pyx_n_s__frequency; +static PyObject *__pyx_n_s__from_file; +static PyObject *__pyx_n_s__from_sequence; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__int32; +static PyObject *__pyx_n_s__io; +static PyObject *__pyx_n_s__is_little_endian; +static PyObject *__pyx_n_s__isnan; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__iteritems; +static PyObject *__pyx_n_s__iterkeys; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__max; +static PyObject *__pyx_n_s__maxs; +static PyObject *__pyx_n_s__min; +static PyObject *__pyx_n_s__mins; +static PyObject *__pyx_n_s__nan; +static PyObject *__pyx_n_s__nanmax; +static PyObject *__pyx_n_s__nanmin; +static PyObject *__pyx_n_s__nansum; +static PyObject *__pyx_n_s__no_leaves; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__pack; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_raw_array; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__read_uint64; +static PyObject *__pyx_n_s__reader; +static PyObject *__pyx_n_s__root; +static PyObject *__pyx_n_s__s; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__set; +static PyObject *__pyx_n_s__set_range; +static PyObject *__pyx_n_s__sizes; +static PyObject *__pyx_n_s__skip; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__start_offset; +static PyObject *__pyx_n_s__sum; +static PyObject *__pyx_n_s__summary; +static PyObject *__pyx_n_s__sums; +static PyObject *__pyx_n_s__sumsquares; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_n_s__to_file; +static PyObject *__pyx_n_s__to_file_data_pass; +static PyObject *__pyx_n_s__to_file_offset_pass; +static PyObject *__pyx_n_s__tree; +static PyObject *__pyx_n_s__unpack; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__values; +static PyObject *__pyx_n_s__write; +static PyObject *__pyx_n_s__write_raw_array; +static PyObject *__pyx_n_s__write_uint32; +static PyObject *__pyx_n_s__write_uint64; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_1000; +static PyObject *__pyx_int_823052252; +static PyObject *__pyx_int_2147483647; +static PyObject *__pyx_k_1; +static PyObject *__pyx_k_2; +static PyObject *__pyx_k_3; +static PyObject *__pyx_k_5; +static PyObject *__pyx_k_10; +static PyObject *__pyx_k_11; +static PyObject *__pyx_k_12; +static PyObject *__pyx_k_13; +static PyObject *__pyx_k_16; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_20; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_32; + +/* "bx/arrays/array_tree.pyx":62 + * NUM_SUMMARY_ARRAYS = 6 + * + * def array_tree_dict_from_reader( reader, sizes, default_size=2147483647, block_size=1000, no_leaves=False ): # <<<<<<<<<<<<<< + * # Create empty array trees + * rval = {} + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_array_tree_dict_from_reader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_6arrays_10array_tree_array_tree_dict_from_reader = {__Pyx_NAMESTR("array_tree_dict_from_reader"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_array_tree_dict_from_reader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_array_tree_dict_from_reader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reader = 0; + PyObject *__pyx_v_sizes = 0; + PyObject *__pyx_v_default_size = 0; + PyObject *__pyx_v_block_size = 0; + PyObject *__pyx_v_no_leaves = 0; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_v_last_chrom = NULL; + PyObject *__pyx_v_last_array_tree = NULL; + PyObject *__pyx_v_chrom = NULL; + PyObject *__pyx_v_start = NULL; + PyObject *__pyx_v_end = NULL; + PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_val = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reader,&__pyx_n_s__sizes,&__pyx_n_s__default_size,&__pyx_n_s__block_size,&__pyx_n_s__no_leaves,0}; + __Pyx_RefNannySetupContext("array_tree_dict_from_reader"); + __pyx_self = __pyx_self; + { + PyObject* values[5] = {0,0,0,0,0}; + values[2] = ((PyObject *)__pyx_int_2147483647); + values[3] = ((PyObject *)__pyx_int_1000); + values[4] = __pyx_k_1; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reader); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sizes); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_tree_dict_from_reader", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default_size); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_size); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_leaves); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_tree_dict_from_reader") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_reader = values[0]; + __pyx_v_sizes = values[1]; + __pyx_v_default_size = values[2]; + __pyx_v_block_size = values[3]; + __pyx_v_no_leaves = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("array_tree_dict_from_reader", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.array_tree_dict_from_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":64 + * def array_tree_dict_from_reader( reader, sizes, default_size=2147483647, block_size=1000, no_leaves=False ): + * # Create empty array trees + * rval = {} # <<<<<<<<<<<<<< + * ## for key, size in sizes.iteritems(): + * ## rval[ key ] = ArrayTree( size, 1000 ) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":68 + * ## rval[ key ] = ArrayTree( size, 1000 ) + * # Fill + * last_chrom = None # <<<<<<<<<<<<<< + * last_array_tree = None + * for chrom, start, end, _, val in reader: + */ + __Pyx_INCREF(Py_None); + __pyx_v_last_chrom = Py_None; + + /* "bx/arrays/array_tree.pyx":69 + * # Fill + * last_chrom = None + * last_array_tree = None # <<<<<<<<<<<<<< + * for chrom, start, end, _, val in reader: + * if chrom != last_chrom: + */ + __Pyx_INCREF(Py_None); + __pyx_v_last_array_tree = Py_None; + + /* "bx/arrays/array_tree.pyx":70 + * last_chrom = None + * last_array_tree = None + * for chrom, start, end, _, val in reader: # <<<<<<<<<<<<<< + * if chrom != last_chrom: + * if chrom not in rval: + */ + if (PyList_CheckExact(__pyx_v_reader) || PyTuple_CheckExact(__pyx_v_reader)) { + __pyx_t_1 = __pyx_v_reader; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_reader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else if (PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) { + if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 5)) { + if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_7 = PyList_GET_ITEM(sequence, 2); + __pyx_t_8 = PyList_GET_ITEM(sequence, 3); + __pyx_t_9 = PyList_GET_ITEM(sequence, 4); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + index = 2; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + index = 3; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 4; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L9_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_chrom); + __pyx_v_chrom = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_v__); + __pyx_v__ = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_val); + __pyx_v_val = __pyx_t_9; + __pyx_t_9 = 0; + + /* "bx/arrays/array_tree.pyx":71 + * last_array_tree = None + * for chrom, start, end, _, val in reader: + * if chrom != last_chrom: # <<<<<<<<<<<<<< + * if chrom not in rval: + * rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_chrom, __pyx_v_last_chrom, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_12) { + + /* "bx/arrays/array_tree.pyx":72 + * for chrom, start, end, _, val in reader: + * if chrom != last_chrom: + * if chrom not in rval: # <<<<<<<<<<<<<< + * rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) + * last_array_tree = rval[chrom] + */ + if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_12 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_rval), __pyx_v_chrom))); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_12) { + + /* "bx/arrays/array_tree.pyx":73 + * if chrom != last_chrom: + * if chrom not in rval: + * rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) # <<<<<<<<<<<<<< + * last_array_tree = rval[chrom] + * last_array_tree.set_range( start, end, val ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_sizes, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_default_size); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_default_size); + __Pyx_GIVEREF(__pyx_v_default_size); + __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_block_size); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_block_size); + __Pyx_GIVEREF(__pyx_v_block_size); + __pyx_t_8 = 0; + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__no_leaves), __pyx_v_no_leaves) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree)), ((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_rval), __pyx_v_chrom, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "bx/arrays/array_tree.pyx":74 + * if chrom not in rval: + * rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) + * last_array_tree = rval[chrom] # <<<<<<<<<<<<<< + * last_array_tree.set_range( start, end, val ) + * return rval + */ + __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_rval), __pyx_v_chrom); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_last_array_tree); + __pyx_v_last_array_tree = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "bx/arrays/array_tree.pyx":75 + * rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) + * last_array_tree = rval[chrom] + * last_array_tree.set_range( start, end, val ) # <<<<<<<<<<<<<< + * return rval + * + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_last_array_tree, __pyx_n_s__set_range); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_val); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_val); + __Pyx_GIVEREF(__pyx_v_val); + __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":76 + * last_array_tree = rval[chrom] + * last_array_tree.set_range( start, end, val ) + * return rval # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("bx.arrays.array_tree.array_tree_dict_from_reader", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_last_chrom); + __Pyx_XDECREF(__pyx_v_last_array_tree); + __Pyx_XDECREF(__pyx_v_chrom); + __Pyx_XDECREF(__pyx_v_start); + __Pyx_XDECREF(__pyx_v_end); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_val); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":85 + * cdef object io + * cdef object cdb_dict + * def __init__( self, file ): # <<<<<<<<<<<<<< + * self.io = io = BinaryFileReader( file, MAGIC ) + * assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_io = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":86 + * cdef object cdb_dict + * def __init__( self, file ): + * self.io = io = BinaryFileReader( file, MAGIC ) # <<<<<<<<<<<<<< + * assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 + * self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__MAGIC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io = __pyx_t_2; + __Pyx_INCREF(__pyx_t_2); + __pyx_v_io = __pyx_t_2; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":87 + * def __init__( self, file ): + * self.io = io = BinaryFileReader( file, MAGIC ) + * assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 # <<<<<<<<<<<<<< + * self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) + * def __getitem__( self, key ): + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_t_3, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/arrays/array_tree.pyx":88 + * self.io = io = BinaryFileReader( file, MAGIC ) + * assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 + * self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) # <<<<<<<<<<<<<< + * def __getitem__( self, key ): + * offset = self.cdb_dict[key] + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__FileCDBDict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict = __pyx_t_5; + __pyx_t_5 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_io); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":89 + * assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 + * self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) + * def __getitem__( self, key ): # <<<<<<<<<<<<<< + * offset = self.cdb_dict[key] + * offset = self.io.unpack( "L", offset )[0] + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + + /* "bx/arrays/array_tree.pyx":90 + * self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) + * def __getitem__( self, key ): + * offset = self.cdb_dict[key] # <<<<<<<<<<<<<< + * offset = self.io.unpack( "L", offset )[0] + * self.io.seek( offset ) + */ + __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_offset = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":91 + * def __getitem__( self, key ): + * offset = self.cdb_dict[key] + * offset = self.io.unpack( "L", offset )[0] # <<<<<<<<<<<<<< + * self.io.seek( offset ) + * return FileArrayTree( self.io.file, self.io.is_little_endian ) + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__L)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__L)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L)); + __Pyx_INCREF(__pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_offset); + __pyx_v_offset = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":92 + * offset = self.cdb_dict[key] + * offset = self.io.unpack( "L", offset )[0] + * self.io.seek( offset ) # <<<<<<<<<<<<<< + * return FileArrayTree( self.io.file, self.io.is_little_endian ) + * + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":93 + * offset = self.io.unpack( "L", offset )[0] + * self.io.seek( offset ) + * return FileArrayTree( self.io.file, self.io.is_little_endian ) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_n_s__file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":96 + * + * @classmethod + * def dict_to_file( Class, dict, file, is_little_endian=True, no_leaves=False ): # <<<<<<<<<<<<<< + * """ + * Writes a dictionary of array trees to a file that can then be + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_2dict_to_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_17FileArrayTreeDict_2dict_to_file[] = "\n Writes a dictionary of array trees to a file that can then be\n read efficiently using this class.\n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_2dict_to_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_dict = 0; + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_is_little_endian = 0; + PyObject *__pyx_v_no_leaves = 0; + PyObject *__pyx_v_io = NULL; + PyObject *__pyx_v_cdb_dict = NULL; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_cdb_offset = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dict,&__pyx_n_s__file,&__pyx_n_s__is_little_endian,&__pyx_n_s__no_leaves,0}; + __Pyx_RefNannySetupContext("dict_to_file"); + { + PyObject* values[4] = {0,0,0,0}; + values[2] = __pyx_k_2; + values[3] = __pyx_k_3; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dict); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_little_endian); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_leaves); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dict_to_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_dict = values[0]; + __pyx_v_file = values[1]; + __pyx_v_is_little_endian = values[2]; + __pyx_v_no_leaves = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.dict_to_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":101 + * read efficiently using this class. + * """ + * io = BinaryFileWriter( file, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * # Write magic number and version + * io.write_uint32( MAGIC ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileWriter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_io = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":103 + * io = BinaryFileWriter( file, is_little_endian=is_little_endian ) + * # Write magic number and version + * io.write_uint32( MAGIC ) # <<<<<<<<<<<<<< + * io.write_uint32( VERSION ) + * # Write cdb index with fake values just to fill space + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__MAGIC); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":104 + * # Write magic number and version + * io.write_uint32( MAGIC ) + * io.write_uint32( VERSION ) # <<<<<<<<<<<<<< + * # Write cdb index with fake values just to fill space + * cdb_dict = {} + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VERSION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":106 + * io.write_uint32( VERSION ) + * # Write cdb index with fake values just to fill space + * cdb_dict = {} # <<<<<<<<<<<<<< + * for key in dict.iterkeys(): + * cdb_dict[ key ] = io.pack( "L", 0 ) + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_v_cdb_dict = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":107 + * # Write cdb index with fake values just to fill space + * cdb_dict = {} + * for key in dict.iterkeys(): # <<<<<<<<<<<<<< + * cdb_dict[ key ] = io.pack( "L", 0 ) + * cdb_offset = io.tell() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_dict, __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else if (PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else { + __pyx_t_4 = __pyx_t_6(__pyx_t_2); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":108 + * cdb_dict = {} + * for key in dict.iterkeys(): + * cdb_dict[ key ] = io.pack( "L", 0 ) # <<<<<<<<<<<<<< + * cdb_offset = io.tell() + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_cdb_dict), __pyx_v_key, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":109 + * for key in dict.iterkeys(): + * cdb_dict[ key ] = io.pack( "L", 0 ) + * cdb_offset = io.tell() # <<<<<<<<<<<<<< + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + * # Write each tree and save offset + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_cdb_offset = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":110 + * cdb_dict[ key ] = io.pack( "L", 0 ) + * cdb_offset = io.tell() + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * # Write each tree and save offset + * for key, value in dict.iteritems(): + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FileCDBDict); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__to_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_cdb_dict)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_cdb_dict)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_cdb_dict)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":112 + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + * # Write each tree and save offset + * for key, value in dict.iteritems(): # <<<<<<<<<<<<<< + * offset = io.tell() + * cdb_dict[ key ] = io.pack( "L", offset ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dict, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else if (PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else { + __pyx_t_4 = __pyx_t_6(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L11_unpacking_done; + __pyx_L10_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L11_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":113 + * # Write each tree and save offset + * for key, value in dict.iteritems(): + * offset = io.tell() # <<<<<<<<<<<<<< + * cdb_dict[ key ] = io.pack( "L", offset ) + * value.to_file( file, is_little_endian=is_little_endian, no_leaves=no_leaves ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_offset); + __pyx_v_offset = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":114 + * for key, value in dict.iteritems(): + * offset = io.tell() + * cdb_dict[ key ] = io.pack( "L", offset ) # <<<<<<<<<<<<<< + * value.to_file( file, is_little_endian=is_little_endian, no_leaves=no_leaves ) + * # Go back and write the index again + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__L)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__L)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L)); + __Pyx_INCREF(__pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_cdb_dict), __pyx_v_key, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":115 + * offset = io.tell() + * cdb_dict[ key ] = io.pack( "L", offset ) + * value.to_file( file, is_little_endian=is_little_endian, no_leaves=no_leaves ) # <<<<<<<<<<<<<< + * # Go back and write the index again + * io.seek( cdb_offset ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__to_file); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__no_leaves), __pyx_v_no_leaves) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":117 + * value.to_file( file, is_little_endian=is_little_endian, no_leaves=no_leaves ) + * # Go back and write the index again + * io.seek( cdb_offset ) # <<<<<<<<<<<<<< + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_cdb_offset); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_cdb_offset); + __Pyx_GIVEREF(__pyx_v_cdb_offset); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":118 + * # Go back and write the index again + * io.seek( cdb_offset ) + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * + * cdef class FileArrayTree: + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__FileCDBDict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__to_file); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_cdb_dict)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_cdb_dict)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_cdb_dict)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.dict_to_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_io); + __Pyx_XDECREF(__pyx_v_cdb_dict); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_cdb_offset); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":132 + * cdef object io + * + * def __init__( self, file, is_little_endian=True ): # <<<<<<<<<<<<<< + * self.io = BinaryFileReader( file, is_little_endian=is_little_endian ) + * self.offset = self.io.tell() + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_is_little_endian = 0; + PyObject *__pyx_v_dt = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__is_little_endian,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[2] = {0,0}; + values[1] = __pyx_k_5; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_little_endian); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + __pyx_v_is_little_endian = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":133 + * + * def __init__( self, file, is_little_endian=True ): + * self.io = BinaryFileReader( file, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * self.offset = self.io.tell() + * # Read basic info about the tree + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":134 + * def __init__( self, file, is_little_endian=True ): + * self.io = BinaryFileReader( file, is_little_endian=is_little_endian ) + * self.offset = self.io.tell() # <<<<<<<<<<<<<< + * # Read basic info about the tree + * self.max = self.io.read_uint32() + */ + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->offset = __pyx_t_5; + + /* "bx/arrays/array_tree.pyx":136 + * self.offset = self.io.tell() + * # Read basic info about the tree + * self.max = self.io.read_uint32() # <<<<<<<<<<<<<< + * self.block_size = self.io.read_uint32() + * # Read dtype and canonicalize + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max = __pyx_t_5; + + /* "bx/arrays/array_tree.pyx":137 + * # Read basic info about the tree + * self.max = self.io.read_uint32() + * self.block_size = self.io.read_uint32() # <<<<<<<<<<<<<< + * # Read dtype and canonicalize + * dt = self.io.read( 1 ) + */ + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size = __pyx_t_5; + + /* "bx/arrays/array_tree.pyx":139 + * self.block_size = self.io.read_uint32() + * # Read dtype and canonicalize + * dt = self.io.read( 1 ) # <<<<<<<<<<<<<< + * self.dtype = numpy.dtype( dt ) + * self.io.skip( 3 ) + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_dt = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":140 + * # Read dtype and canonicalize + * dt = self.io.read( 1 ) + * self.dtype = numpy.dtype( dt ) # <<<<<<<<<<<<<< + * self.io.skip( 3 ) + * # How many levels are needed to cover the entire range? + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_dt); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dt); + __Pyx_GIVEREF(__pyx_v_dt); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":141 + * dt = self.io.read( 1 ) + * self.dtype = numpy.dtype( dt ) + * self.io.skip( 3 ) # <<<<<<<<<<<<<< + * # How many levels are needed to cover the entire range? + * self.levels = 0 + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__skip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":143 + * self.io.skip( 3 ) + * # How many levels are needed to cover the entire range? + * self.levels = 0 # <<<<<<<<<<<<<< + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + * self.levels += 1 + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels = 0; + + /* "bx/arrays/array_tree.pyx":144 + * # How many levels are needed to cover the entire range? + * self.levels = 0 + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: # <<<<<<<<<<<<<< + * self.levels += 1 + * # Not yet dealing with the case where the root is a Leaf + */ + while (1) { + __pyx_t_6 = (__Pyx_pow_PY_LONG_LONG(((PY_LONG_LONG)((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size), ((PY_LONG_LONG)(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels + 1))) < ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max); + if (!__pyx_t_6) break; + + /* "bx/arrays/array_tree.pyx":145 + * self.levels = 0 + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + * self.levels += 1 # <<<<<<<<<<<<<< + * # Not yet dealing with the case where the root is a Leaf + * assert self.levels > 0, "max < block_size not yet handled" + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels = (((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels + 1); + } + + /* "bx/arrays/array_tree.pyx":147 + * self.levels += 1 + * # Not yet dealing with the case where the root is a Leaf + * assert self.levels > 0, "max < block_size not yet handled" # <<<<<<<<<<<<<< + * # Save offset of root + * self.root_offset = self.io.tell() + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels > 0))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_8)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/arrays/array_tree.pyx":149 + * assert self.levels > 0, "max < block_size not yet handled" + * # Save offset of root + * self.root_offset = self.io.tell() # <<<<<<<<<<<<<< + * + * def __getitem__( self, index ): + */ + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset = __pyx_t_5; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_dt); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":151 + * self.root_offset = self.io.tell() + * + * def __getitem__( self, index ): # <<<<<<<<<<<<<< + * min = self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) + * if min < 0: + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_v_min = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + + /* "bx/arrays/array_tree.pyx":152 + * + * def __getitem__( self, index ): + * min = self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) # <<<<<<<<<<<<<< + * if min < 0: + * return nan + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->__pyx_vtab)->r_seek_to_node(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self), __pyx_t_1, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_min = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":153 + * def __getitem__( self, index ): + * min = self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) + * if min < 0: # <<<<<<<<<<<<<< + * return nan + * self.io.skip( self.dtype.itemsize * ( index - min ) ) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_min, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "bx/arrays/array_tree.pyx":154 + * min = self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) + * if min < 0: + * return nan # <<<<<<<<<<<<<< + * self.io.skip( self.dtype.itemsize * ( index - min ) ) + * return self.io.read_raw_array( self.dtype, 1 )[0] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/arrays/array_tree.pyx":155 + * if min < 0: + * return nan + * self.io.skip( self.dtype.itemsize * ( index - min ) ) # <<<<<<<<<<<<<< + * return self.io.read_raw_array( self.dtype, 1 )[0] + * + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_index, __pyx_v_min); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "bx/arrays/array_tree.pyx":156 + * return nan + * self.io.skip( self.dtype.itemsize * ( index - min ) ) + * return self.io.read_raw_array( self.dtype, 1 )[0] # <<<<<<<<<<<<<< + * + * def get_summary( self, index, level ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_min); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":158 + * return self.io.read_raw_array( self.dtype, 1 )[0] + * + * def get_summary( self, index, level ): # <<<<<<<<<<<<<< + * if level <= 0 or level > self.levels: + * raise ValueError, "level must be <= self.levels" + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_2get_summary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_2get_summary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_level = 0; + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__level,0}; + __Pyx_RefNannySetupContext("get_summary"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_summary", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_summary") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_index = values[0]; + __pyx_v_level = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_summary", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.get_summary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":159 + * + * def get_summary( self, index, level ): + * if level <= 0 or level > self.levels: # <<<<<<<<<<<<<< + * raise ValueError, "level must be <= self.levels" + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, level ) < 0: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_level, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_level, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "bx/arrays/array_tree.pyx":160 + * def get_summary( self, index, level ): + * if level <= 0 or level > self.levels: + * raise ValueError, "level must be <= self.levels" # <<<<<<<<<<<<<< + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, level ) < 0: + * return None + */ + __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_9), 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/arrays/array_tree.pyx":161 + * if level <= 0 or level > self.levels: + * raise ValueError, "level must be <= self.levels" + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, level ) < 0: # <<<<<<<<<<<<<< + * return None + * # Read summary arrays + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_level); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->__pyx_vtab)->r_seek_to_node(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self), __pyx_t_6, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels, __pyx_t_7) < 0); + if (__pyx_t_5) { + + /* "bx/arrays/array_tree.pyx":162 + * raise ValueError, "level must be <= self.levels" + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, level ) < 0: + * return None # <<<<<<<<<<<<<< + * # Read summary arrays + * s = Summary() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/arrays/array_tree.pyx":164 + * return None + * # Read summary arrays + * s = Summary() # <<<<<<<<<<<<<< + * s.counts = self.io.read_raw_array( self.dtype, self.block_size ) + * s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_Summary)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_s = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":165 + * # Read summary arrays + * s = Summary() + * s.counts = self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sums = self.io.read_raw_array( self.dtype, self.block_size ) + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_s->counts); + __Pyx_DECREF(__pyx_v_s->counts); + __pyx_v_s->counts = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":166 + * s = Summary() + * s.counts = self.io.read_raw_array( self.dtype, self.block_size ) + * s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * s.sums = self.io.read_raw_array( self.dtype, self.block_size ) + * s.mins = self.io.read_raw_array( self.dtype, self.block_size) + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_v_s->frequencies); + __Pyx_DECREF(__pyx_v_s->frequencies); + __pyx_v_s->frequencies = __pyx_t_8; + __pyx_t_8 = 0; + + /* "bx/arrays/array_tree.pyx":167 + * s.counts = self.io.read_raw_array( self.dtype, self.block_size ) + * s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sums = self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * s.mins = self.io.read_raw_array( self.dtype, self.block_size) + * s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) + */ + __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_s->sums); + __Pyx_DECREF(__pyx_v_s->sums); + __pyx_v_s->sums = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":168 + * s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sums = self.io.read_raw_array( self.dtype, self.block_size ) + * s.mins = self.io.read_raw_array( self.dtype, self.block_size) # <<<<<<<<<<<<<< + * s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sumsquares = self.io.read_raw_array( self.dtype, self.block_size ) + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_s->mins); + __Pyx_DECREF(__pyx_v_s->mins); + __pyx_v_s->mins = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":169 + * s.sums = self.io.read_raw_array( self.dtype, self.block_size ) + * s.mins = self.io.read_raw_array( self.dtype, self.block_size) + * s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * s.sumsquares = self.io.read_raw_array( self.dtype, self.block_size ) + * return s + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_v_s->maxs); + __Pyx_DECREF(__pyx_v_s->maxs); + __pyx_v_s->maxs = __pyx_t_8; + __pyx_t_8 = 0; + + /* "bx/arrays/array_tree.pyx":170 + * s.mins = self.io.read_raw_array( self.dtype, self.block_size) + * s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sumsquares = self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * return s + * + */ + __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_s->sumsquares); + __Pyx_DECREF(__pyx_v_s->sumsquares); + __pyx_v_s->sumsquares = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":171 + * s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) + * s.sumsquares = self.io.read_raw_array( self.dtype, self.block_size ) + * return s # <<<<<<<<<<<<<< + * + * def get_leaf( self, index ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_s)); + __pyx_r = ((PyObject *)__pyx_v_s); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.get_summary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":173 + * return s + * + * def get_leaf( self, index ): # <<<<<<<<<<<<<< + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) < 0: + * return [] + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3get_leaf(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3get_leaf(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_leaf"); + + /* "bx/arrays/array_tree.pyx":174 + * + * def get_leaf( self, index ): + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) < 0: # <<<<<<<<<<<<<< + * return [] + * return self.io.read_raw_array( self.dtype, self.block_size ) + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->__pyx_vtab)->r_seek_to_node(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self), __pyx_t_1, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels, 0) < 0); + if (__pyx_t_2) { + + /* "bx/arrays/array_tree.pyx":175 + * def get_leaf( self, index ): + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) < 0: + * return [] # <<<<<<<<<<<<<< + * return self.io.read_raw_array( self.dtype, self.block_size ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/arrays/array_tree.pyx":176 + * if self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) < 0: + * return [] + * return self.io.read_raw_array( self.dtype, self.block_size ) # <<<<<<<<<<<<<< + * + * cdef int r_seek_to_node( self, int index, int min, long long offset, int level, int desired_level ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.get_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":178 + * return self.io.read_raw_array( self.dtype, self.block_size ) + * + * cdef int r_seek_to_node( self, int index, int min, long long offset, int level, int desired_level ): # <<<<<<<<<<<<<< + * """ + * Seek to the start of the node at `desired_level` that contains `index`. + */ + +static int __pyx_f_2bx_6arrays_10array_tree_13FileArrayTree_r_seek_to_node(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *__pyx_v_self, int __pyx_v_index, int __pyx_v_min, PY_LONG_LONG __pyx_v_offset, int __pyx_v_level, int __pyx_v_desired_level) { + int __pyx_v_child_size; + int __pyx_v_bin_index; + int __pyx_v_child_min; + PyObject *__pyx_v_child_offset = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PY_LONG_LONG __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("r_seek_to_node"); + + /* "bx/arrays/array_tree.pyx":184 + * """ + * cdef int child_size, bin_index, child_min + * self.io.seek( offset ) # <<<<<<<<<<<<<< + * if level > desired_level: + * child_size = self.block_size ** level + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->io, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromLongLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":185 + * cdef int child_size, bin_index, child_min + * self.io.seek( offset ) + * if level > desired_level: # <<<<<<<<<<<<<< + * child_size = self.block_size ** level + * bin_index = ( index - min ) // ( child_size ) + */ + __pyx_t_4 = (__pyx_v_level > __pyx_v_desired_level); + if (__pyx_t_4) { + + /* "bx/arrays/array_tree.pyx":186 + * self.io.seek( offset ) + * if level > desired_level: + * child_size = self.block_size ** level # <<<<<<<<<<<<<< + * bin_index = ( index - min ) // ( child_size ) + * child_min = min + ( bin_index * child_size ) + */ + __pyx_v_child_size = __Pyx_pow_int(__pyx_v_self->block_size, __pyx_v_level); + + /* "bx/arrays/array_tree.pyx":187 + * if level > desired_level: + * child_size = self.block_size ** level + * bin_index = ( index - min ) // ( child_size ) # <<<<<<<<<<<<<< + * child_min = min + ( bin_index * child_size ) + * # Skip summary arrays -- # arrays * itemsize * block_size + */ + __pyx_t_5 = (__pyx_v_index - __pyx_v_min); + if (unlikely(__pyx_v_child_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_child_size == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_bin_index = __Pyx_div_int(__pyx_t_5, __pyx_v_child_size); + + /* "bx/arrays/array_tree.pyx":188 + * child_size = self.block_size ** level + * bin_index = ( index - min ) // ( child_size ) + * child_min = min + ( bin_index * child_size ) # <<<<<<<<<<<<<< + * # Skip summary arrays -- # arrays * itemsize * block_size + * self.io.skip( NUM_SUMMARY_ARRAYS * self.dtype.itemsize * self.block_size ) + */ + __pyx_v_child_min = (__pyx_v_min + (__pyx_v_bin_index * __pyx_v_child_size)); + + /* "bx/arrays/array_tree.pyx":190 + * child_min = min + ( bin_index * child_size ) + * # Skip summary arrays -- # arrays * itemsize * block_size + * self.io.skip( NUM_SUMMARY_ARRAYS * self.dtype.itemsize * self.block_size ) # <<<<<<<<<<<<<< + * # Skip to offset of correct child -- offsets are 8 bytes + * self.io.skip( 8 * bin_index ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->io, __pyx_n_s__skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__NUM_SUMMARY_ARRAYS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":192 + * self.io.skip( NUM_SUMMARY_ARRAYS * self.dtype.itemsize * self.block_size ) + * # Skip to offset of correct child -- offsets are 8 bytes + * self.io.skip( 8 * bin_index ) # <<<<<<<<<<<<<< + * # Read offset of child + * child_offset = self.io.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->io, __pyx_n_s__skip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong((8 * __pyx_v_bin_index)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":194 + * self.io.skip( 8 * bin_index ) + * # Read offset of child + * child_offset = self.io.read_uint64() # <<<<<<<<<<<<<< + * # print "co: %s\tbi: %s\tcm: %s\n" % (child_offset, bin_index, child_min) + * if child_offset == 0: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->io, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_child_offset = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":196 + * child_offset = self.io.read_uint64() + * # print "co: %s\tbi: %s\tcm: %s\n" % (child_offset, bin_index, child_min) + * if child_offset == 0: # <<<<<<<<<<<<<< + * return -1 + * return self.r_seek_to_node( index, child_min, child_offset, level - 1, desired_level ) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_child_offset, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/array_tree.pyx":197 + * # print "co: %s\tbi: %s\tcm: %s\n" % (child_offset, bin_index, child_min) + * if child_offset == 0: + * return -1 # <<<<<<<<<<<<<< + * return self.r_seek_to_node( index, child_min, child_offset, level - 1, desired_level ) + * else: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/arrays/array_tree.pyx":198 + * if child_offset == 0: + * return -1 + * return self.r_seek_to_node( index, child_min, child_offset, level - 1, desired_level ) # <<<<<<<<<<<<<< + * else: + * # The file pointer is at the start of the desired node, do nothing + */ + __pyx_t_7 = __Pyx_PyInt_AsLongLong(__pyx_v_child_offset); if (unlikely((__pyx_t_7 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self->__pyx_vtab)->r_seek_to_node(__pyx_v_self, __pyx_v_index, __pyx_v_child_min, __pyx_t_7, (__pyx_v_level - 1), __pyx_v_desired_level); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":201 + * else: + * # The file pointer is at the start of the desired node, do nothing + * return min # <<<<<<<<<<<<<< + * + * cdef class Summary: + */ + __pyx_r = __pyx_v_min; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_WriteUnraisable("bx.arrays.array_tree.FileArrayTree.r_seek_to_node", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_child_offset); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":124 + * Wrapper for ArrayTree stored in file that reads as little as possible + * """ + * cdef public int max # <<<<<<<<<<<<<< + * cdef public int block_size + * cdef public object dtype + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.max.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.max.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":125 + * """ + * cdef public int max + * cdef public int block_size # <<<<<<<<<<<<<< + * cdef public object dtype + * cdef public int levels + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.block_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":126 + * cdef public int max + * cdef public int block_size + * cdef public object dtype # <<<<<<<<<<<<<< + * cdef public int levels + * cdef public int offset + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":127 + * cdef public int block_size + * cdef public object dtype + * cdef public int levels # <<<<<<<<<<<<<< + * cdef public int offset + * cdef public int root_offset + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.levels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.levels.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":128 + * cdef public object dtype + * cdef public int levels + * cdef public int offset # <<<<<<<<<<<<<< + * cdef public int root_offset + * cdef object io + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":129 + * cdef public int levels + * cdef public int offset + * cdef public int root_offset # <<<<<<<<<<<<<< + * cdef object io + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.root_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.root_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":208 + * valid count, sum, and sum-of-squares for each child. + * """ + * cdef public object counts # <<<<<<<<<<<<<< + * cdef public object frequencies + * cdef public object mins + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->counts = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":209 + * """ + * cdef public object counts + * cdef public object frequencies # <<<<<<<<<<<<<< + * cdef public object mins + * cdef public object maxs + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->frequencies = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":210 + * cdef public object counts + * cdef public object frequencies + * cdef public object mins # <<<<<<<<<<<<<< + * cdef public object maxs + * cdef public object sums + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->mins = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":211 + * cdef public object frequencies + * cdef public object mins + * cdef public object maxs # <<<<<<<<<<<<<< + * cdef public object sums + * cdef public object sumsquares + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->maxs = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":212 + * cdef public object mins + * cdef public object maxs + * cdef public object sums # <<<<<<<<<<<<<< + * cdef public object sumsquares + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sums = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":213 + * cdef public object maxs + * cdef public object sums + * cdef public object sumsquares # <<<<<<<<<<<<<< + * + * cdef class ArrayTreeNode + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares); + ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_self)->sumsquares = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":241 + * cdef public ArrayTreeNode root + * + * def __init__( self, int max, int block_size, dtype=float32, no_leaves=False ): # <<<<<<<<<<<<<< + * """ + * Create a new array tree of size `max` + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_9ArrayTree___init__[] = "\n Create a new array tree of size `max` \n "; +struct wrapperbase __pyx_wrapperbase_2bx_6arrays_10array_tree_9ArrayTree___init__; +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_max; + int __pyx_v_block_size; + PyObject *__pyx_v_dtype = 0; + PyObject *__pyx_v_no_leaves = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__max,&__pyx_n_s__block_size,&__pyx_n_s__dtype,&__pyx_n_s__no_leaves,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[4] = {0,0,0,0}; + values[2] = __pyx_k_10; + values[3] = __pyx_k_11; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_size); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_leaves); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_max = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dtype = values[2]; + __pyx_v_no_leaves = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":245 + * Create a new array tree of size `max` + * """ + * self.max = max # <<<<<<<<<<<<<< + * self.block_size = block_size + * self.no_leaves = no_leaves + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max = __pyx_v_max; + + /* "bx/arrays/array_tree.pyx":246 + * """ + * self.max = max + * self.block_size = block_size # <<<<<<<<<<<<<< + * self.no_leaves = no_leaves + * # Force the dtype argument to its canonical dtype object + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size = __pyx_v_block_size; + + /* "bx/arrays/array_tree.pyx":247 + * self.max = max + * self.block_size = block_size + * self.no_leaves = no_leaves # <<<<<<<<<<<<<< + * # Force the dtype argument to its canonical dtype object + * self.dtype = numpy.dtype( dtype ) + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_no_leaves); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->no_leaves = __pyx_t_1; + + /* "bx/arrays/array_tree.pyx":249 + * self.no_leaves = no_leaves + * # Force the dtype argument to its canonical dtype object + * self.dtype = numpy.dtype( dtype ) # <<<<<<<<<<<<<< + * # How many levels are needed to cover the entire range? + * self.levels = 0 + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":251 + * self.dtype = numpy.dtype( dtype ) + * # How many levels are needed to cover the entire range? + * self.levels = 0 # <<<<<<<<<<<<<< + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + * self.levels += 1 + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels = 0; + + /* "bx/arrays/array_tree.pyx":252 + * # How many levels are needed to cover the entire range? + * self.levels = 0 + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: # <<<<<<<<<<<<<< + * self.levels += 1 + * # Not yet dealing with the case where the root is a Leaf + */ + while (1) { + __pyx_t_4 = (__Pyx_pow_PY_LONG_LONG(((PY_LONG_LONG)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size), ((PY_LONG_LONG)(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels + 1))) < ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max); + if (!__pyx_t_4) break; + + /* "bx/arrays/array_tree.pyx":253 + * self.levels = 0 + * while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + * self.levels += 1 # <<<<<<<<<<<<<< + * # Not yet dealing with the case where the root is a Leaf + * assert self.levels > 0, "max < block_size not yet handled" + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels = (((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels + 1); + } + + /* "bx/arrays/array_tree.pyx":255 + * self.levels += 1 + * # Not yet dealing with the case where the root is a Leaf + * assert self.levels > 0, "max < block_size not yet handled" # <<<<<<<<<<<<<< + * # Create the root node` + * self.root = ArrayTreeNode( self, 0, max, block_size, self.levels ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels > 0))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_8)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/arrays/array_tree.pyx":257 + * assert self.levels > 0, "max < block_size not yet handled" + * # Create the root node` + * self.root = ArrayTreeNode( self, 0, max, block_size, self.levels ) # <<<<<<<<<<<<<< + * + * def __setitem__( self, int index, value ): + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_t_5); + __pyx_t_5 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":259 + * self.root = ArrayTreeNode( self, 0, max, block_size, self.levels ) + * + * def __setitem__( self, int index, value ): # <<<<<<<<<<<<<< + * self.root.set( index, value ) + * + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_1__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value) { + int __pyx_v_index; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setitem__"); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":260 + * + * def __setitem__( self, int index, value ): + * self.root.set( index, value ) # <<<<<<<<<<<<<< + * + * def set_range( self, int start, int end, value ): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_n_s__set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":262 + * self.root.set( index, value ) + * + * def set_range( self, int start, int end, value ): # <<<<<<<<<<<<<< + * for i from start <= i < end: + * self.root.set( i, value ) + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_2set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_2set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_value = 0; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("set_range"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_range", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_range", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_range", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":263 + * + * def set_range( self, int start, int end, value ): + * for i from start <= i < end: # <<<<<<<<<<<<<< + * self.root.set( i, value ) + * + */ + __pyx_t_1 = __pyx_v_end; + for (__pyx_v_i = __pyx_v_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/arrays/array_tree.pyx":264 + * def set_range( self, int start, int end, value ): + * for i from start <= i < end: + * self.root.set( i, value ) # <<<<<<<<<<<<<< + * + * def __getitem__( self, int index ): + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_n_s__set); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":266 + * self.root.set( i, value ) + * + * def __getitem__( self, int index ): # <<<<<<<<<<<<<< + * return self.root.get( index ) + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":267 + * + * def __getitem__( self, int index ): + * return self.root.get( index ) # <<<<<<<<<<<<<< + * + * def to_file( self, f, is_little_endian=True, no_leaves=False ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":269 + * return self.root.get( index ) + * + * def to_file( self, f, is_little_endian=True, no_leaves=False ): # <<<<<<<<<<<<<< + * io = BinaryFileWriter( f, is_little_endian=is_little_endian ) + * ## io.write_uint32( VERSION ) + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4to_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4to_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_is_little_endian = 0; + PyObject *__pyx_v_no_leaves = 0; + PyObject *__pyx_v_io = NULL; + long __pyx_v_bottom_level; + long __pyx_v_level; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + long __pyx_t_6; + long __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__is_little_endian,&__pyx_n_s__no_leaves,0}; + __Pyx_RefNannySetupContext("to_file"); + { + PyObject* values[3] = {0,0,0}; + values[1] = __pyx_k_12; + values[2] = __pyx_k_13; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_little_endian); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__no_leaves); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "to_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_f = values[0]; + __pyx_v_is_little_endian = values[1]; + __pyx_v_no_leaves = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_file", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.to_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":270 + * + * def to_file( self, f, is_little_endian=True, no_leaves=False ): + * io = BinaryFileWriter( f, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * ## io.write_uint32( VERSION ) + * io.write_uint32( self.max ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileWriter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_io = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":272 + * io = BinaryFileWriter( f, is_little_endian=is_little_endian ) + * ## io.write_uint32( VERSION ) + * io.write_uint32( self.max ) # <<<<<<<<<<<<<< + * io.write_uint32( self.block_size ) + * io.write( self.dtype.char ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":273 + * ## io.write_uint32( VERSION ) + * io.write_uint32( self.max ) + * io.write_uint32( self.block_size ) # <<<<<<<<<<<<<< + * io.write( self.dtype.char ) + * io.write( "\0\0\0" ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":274 + * io.write_uint32( self.max ) + * io.write_uint32( self.block_size ) + * io.write( self.dtype.char ) # <<<<<<<<<<<<<< + * io.write( "\0\0\0" ) + * # Data pass, level order + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype, __pyx_n_s__char); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":275 + * io.write_uint32( self.block_size ) + * io.write( self.dtype.char ) + * io.write( "\0\0\0" ) # <<<<<<<<<<<<<< + * # Data pass, level order + * if no_leaves: + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":277 + * io.write( "\0\0\0" ) + * # Data pass, level order + * if no_leaves: # <<<<<<<<<<<<<< + * bottom_level = 0 + * else: + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_no_leaves); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "bx/arrays/array_tree.pyx":278 + * # Data pass, level order + * if no_leaves: + * bottom_level = 0 # <<<<<<<<<<<<<< + * else: + * bottom_level = -1 + */ + __pyx_v_bottom_level = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":280 + * bottom_level = 0 + * else: + * bottom_level = -1 # <<<<<<<<<<<<<< + * for level in range( self.levels, bottom_level, -1 ): + * self.root.to_file_data_pass( io, level ) + */ + __pyx_v_bottom_level = -1; + } + __pyx_L6:; + + /* "bx/arrays/array_tree.pyx":281 + * else: + * bottom_level = -1 + * for level in range( self.levels, bottom_level, -1 ): # <<<<<<<<<<<<<< + * self.root.to_file_data_pass( io, level ) + * # Offset pass to fix up indexes + */ + __pyx_t_6 = __pyx_v_bottom_level; + for (__pyx_t_7 = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels; __pyx_t_7 > __pyx_t_6; __pyx_t_7-=1) { + __pyx_v_level = __pyx_t_7; + + /* "bx/arrays/array_tree.pyx":282 + * bottom_level = -1 + * for level in range( self.levels, bottom_level, -1 ): + * self.root.to_file_data_pass( io, level ) # <<<<<<<<<<<<<< + * # Offset pass to fix up indexes + * self.root.to_file_offset_pass( io ) + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_n_s__to_file_data_pass); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "bx/arrays/array_tree.pyx":284 + * self.root.to_file_data_pass( io, level ) + * # Offset pass to fix up indexes + * self.root.to_file_offset_pass( io ) # <<<<<<<<<<<<<< + * + * @classmethod + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_n_s__to_file_offset_pass); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.to_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_io); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":287 + * + * @classmethod + * def from_file( Class, f, is_little_endian=True ): # <<<<<<<<<<<<<< + * io = BinaryFileReader( f, is_little_endian=is_little_endian ) + * ## assert io.read_uint32() == VERSION + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5from_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5from_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + PyObject *__pyx_v_is_little_endian = 0; + PyObject *__pyx_v_io = NULL; + PyObject *__pyx_v_max = NULL; + PyObject *__pyx_v_block_size = NULL; + PyObject *__pyx_v_dt = NULL; + PyObject *__pyx_v_tree = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__is_little_endian,0}; + __Pyx_RefNannySetupContext("from_file"); + { + PyObject* values[2] = {0,0}; + values[1] = __pyx_k_16; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_little_endian); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "from_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_f = values[0]; + __pyx_v_is_little_endian = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_file", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":288 + * @classmethod + * def from_file( Class, f, is_little_endian=True ): + * io = BinaryFileReader( f, is_little_endian=is_little_endian ) # <<<<<<<<<<<<<< + * ## assert io.read_uint32() == VERSION + * max = io.read_uint32() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_io = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":290 + * io = BinaryFileReader( f, is_little_endian=is_little_endian ) + * ## assert io.read_uint32() == VERSION + * max = io.read_uint32() # <<<<<<<<<<<<<< + * block_size = io.read_uint32() + * dt = io.read( 1 ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_max = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":291 + * ## assert io.read_uint32() == VERSION + * max = io.read_uint32() + * block_size = io.read_uint32() # <<<<<<<<<<<<<< + * dt = io.read( 1 ) + * io.read( 3 ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_block_size = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":292 + * max = io.read_uint32() + * block_size = io.read_uint32() + * dt = io.read( 1 ) # <<<<<<<<<<<<<< + * io.read( 3 ) + * tree = Class( max, block_size, dt ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_dt = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":293 + * block_size = io.read_uint32() + * dt = io.read( 1 ) + * io.read( 3 ) # <<<<<<<<<<<<<< + * tree = Class( max, block_size, dt ) + * tree.root.from_file( io ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":294 + * dt = io.read( 1 ) + * io.read( 3 ) + * tree = Class( max, block_size, dt ) # <<<<<<<<<<<<<< + * tree.root.from_file( io ) + * return tree + */ + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_max); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_max); + __Pyx_GIVEREF(__pyx_v_max); + __Pyx_INCREF(__pyx_v_block_size); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_block_size); + __Pyx_GIVEREF(__pyx_v_block_size); + __Pyx_INCREF(__pyx_v_dt); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_dt); + __Pyx_GIVEREF(__pyx_v_dt); + __pyx_t_3 = PyObject_Call(__pyx_v_Class, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_tree = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":295 + * io.read( 3 ) + * tree = Class( max, block_size, dt ) + * tree.root.from_file( io ) # <<<<<<<<<<<<<< + * return tree + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_tree, __pyx_n_s__root); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__from_file); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":296 + * tree = Class( max, block_size, dt ) + * tree.root.from_file( io ) + * return tree # <<<<<<<<<<<<<< + * + * @classmethod + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_tree); + __pyx_r = __pyx_v_tree; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_io); + __Pyx_XDECREF(__pyx_v_max); + __Pyx_XDECREF(__pyx_v_block_size); + __Pyx_XDECREF(__pyx_v_dt); + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":299 + * + * @classmethod + * def from_sequence( Class, s, block_size=1000 ): # <<<<<<<<<<<<<< + * """ + * Build an ArrayTree from a sequence like object (must have at least + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6from_sequence(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_9ArrayTree_6from_sequence[] = "\n Build an ArrayTree from a sequence like object (must have at least\n length and getitem).\n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6from_sequence(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_s = 0; + PyObject *__pyx_v_block_size = 0; + PyObject *__pyx_v_tree = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__block_size,0}; + __Pyx_RefNannySetupContext("from_sequence"); + { + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_int_1000); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_size); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "from_sequence") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_s = values[0]; + __pyx_v_block_size = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("from_sequence", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":304 + * length and getitem). + * """ + * tree = Class( len( s ), block_size ) # <<<<<<<<<<<<<< + * for i in range( len( s ) ): + * tree[i] = s[i] + */ + __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_block_size); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_block_size); + __Pyx_GIVEREF(__pyx_v_block_size); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_v_Class, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_tree = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":305 + * """ + * tree = Class( len( s ), block_size ) + * for i in range( len( s ) ): # <<<<<<<<<<<<<< + * tree[i] = s[i] + * return tree + */ + __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + + /* "bx/arrays/array_tree.pyx":306 + * tree = Class( len( s ), block_size ) + * for i in range( len( s ) ): + * tree[i] = s[i] # <<<<<<<<<<<<<< + * return tree + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(__pyx_v_tree, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "bx/arrays/array_tree.pyx":307 + * for i in range( len( s ) ): + * tree[i] = s[i] + * return tree # <<<<<<<<<<<<<< + * + * cdef class ArrayTreeNode: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_tree); + __pyx_r = __pyx_v_tree; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_tree); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":234 + * """ + * + * cdef public int max # <<<<<<<<<<<<<< + * cdef public int block_size + * cdef public object dtype + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.max.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.max.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":235 + * + * cdef public int max + * cdef public int block_size # <<<<<<<<<<<<<< + * cdef public object dtype + * cdef public int levels + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.block_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.block_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":236 + * cdef public int max + * cdef public int block_size + * cdef public object dtype # <<<<<<<<<<<<<< + * cdef public int levels + * cdef public int no_leaves + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + __pyx_r = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":237 + * cdef public int block_size + * cdef public object dtype + * cdef public int levels # <<<<<<<<<<<<<< + * cdef public int no_leaves + * cdef public ArrayTreeNode root + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.levels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.levels.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":238 + * cdef public object dtype + * cdef public int levels + * cdef public int no_leaves # <<<<<<<<<<<<<< + * cdef public ArrayTreeNode root + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->no_leaves); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.no_leaves.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->no_leaves = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.no_leaves.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":239 + * cdef public int levels + * cdef public int no_leaves + * cdef public ArrayTreeNode root # <<<<<<<<<<<<<< + * + * def __init__( self, int max, int block_size, dtype=float32, no_leaves=False ): + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root)); + __pyx_r = ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.root.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":325 + * cdef public long start_offset + * + * def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ): # <<<<<<<<<<<<<< + * self.tree = tree + * self.min = min + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *__pyx_v_tree = 0; + int __pyx_v_min; + int __pyx_v_max; + int __pyx_v_block_size; + int __pyx_v_level; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__min,&__pyx_n_s__max,&__pyx_n_s__block_size,&__pyx_n_s__level,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + } + __pyx_v_tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)values[0]); + __pyx_v_min = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_block_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_level = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_2bx_6arrays_10array_tree_ArrayTree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":326 + * + * def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ): + * self.tree = tree # <<<<<<<<<<<<<< + * self.min = min + * self.max = max + */ + __Pyx_INCREF(((PyObject *)__pyx_v_tree)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_tree)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree = __pyx_v_tree; + + /* "bx/arrays/array_tree.pyx":327 + * def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ): + * self.tree = tree + * self.min = min # <<<<<<<<<<<<<< + * self.max = max + * self.block_size = block_size + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->min = __pyx_v_min; + + /* "bx/arrays/array_tree.pyx":328 + * self.tree = tree + * self.min = min + * self.max = max # <<<<<<<<<<<<<< + * self.block_size = block_size + * self.level = level + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->max = __pyx_v_max; + + /* "bx/arrays/array_tree.pyx":329 + * self.min = min + * self.max = max + * self.block_size = block_size # <<<<<<<<<<<<<< + * self.level = level + * # Each of my children represents block_size ** level values + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size = __pyx_v_block_size; + + /* "bx/arrays/array_tree.pyx":330 + * self.max = max + * self.block_size = block_size + * self.level = level # <<<<<<<<<<<<<< + * # Each of my children represents block_size ** level values + * self.child_size = self.block_size ** self.level + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->level = __pyx_v_level; + + /* "bx/arrays/array_tree.pyx":332 + * self.level = level + * # Each of my children represents block_size ** level values + * self.child_size = self.block_size ** self.level # <<<<<<<<<<<<<< + * self.children = [None] * self.block_size + * self.summary = None + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size = __Pyx_pow_int(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->level); + + /* "bx/arrays/array_tree.pyx":333 + * # Each of my children represents block_size ** level values + * self.child_size = self.block_size ** self.level + * self.children = [None] * self.block_size # <<<<<<<<<<<<<< + * self.summary = None + * self.start_offset = 0 + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(Py_None); + PyList_SET_ITEM(__pyx_t_1, 0, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":334 + * self.child_size = self.block_size ** self.level + * self.children = [None] * self.block_size + * self.summary = None # <<<<<<<<<<<<<< + * self.start_offset = 0 + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)Py_None); + + /* "bx/arrays/array_tree.pyx":335 + * self.children = [None] * self.block_size + * self.summary = None + * self.start_offset = 0 # <<<<<<<<<<<<<< + * + * cdef inline init_bin( self, int index ): + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":337 + * self.start_offset = 0 + * + * cdef inline init_bin( self, int index ): # <<<<<<<<<<<<<< + * cdef int min = self.min + ( index * self.child_size ) + * cdef int max = min + self.child_size + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6arrays_10array_tree_13ArrayTreeNode_init_bin(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_v_self, int __pyx_v_index) { + int __pyx_v_min; + int __pyx_v_max; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_bin"); + + /* "bx/arrays/array_tree.pyx":338 + * + * cdef inline init_bin( self, int index ): + * cdef int min = self.min + ( index * self.child_size ) # <<<<<<<<<<<<<< + * cdef int max = min + self.child_size + * if self.level == 1: + */ + __pyx_v_min = (__pyx_v_self->min + (__pyx_v_index * __pyx_v_self->child_size)); + + /* "bx/arrays/array_tree.pyx":339 + * cdef inline init_bin( self, int index ): + * cdef int min = self.min + ( index * self.child_size ) + * cdef int max = min + self.child_size # <<<<<<<<<<<<<< + * if self.level == 1: + * self.children[ index ] = ArrayTreeLeaf( self.tree, min, max ) + */ + __pyx_v_max = (__pyx_v_min + __pyx_v_self->child_size); + + /* "bx/arrays/array_tree.pyx":340 + * cdef int min = self.min + ( index * self.child_size ) + * cdef int max = min + self.child_size + * if self.level == 1: # <<<<<<<<<<<<<< + * self.children[ index ] = ArrayTreeLeaf( self.tree, min, max ) + * else: + */ + __pyx_t_1 = (__pyx_v_self->level == 1); + if (__pyx_t_1) { + + /* "bx/arrays/array_tree.pyx":341 + * cdef int max = min + self.child_size + * if self.level == 1: + * self.children[ index ] = ArrayTreeLeaf( self.tree, min, max ) # <<<<<<<<<<<<<< + * else: + * self.children[ index ] = ArrayTreeNode( self.tree, min, max, self.block_size, self.level - 1 ) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->tree)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->tree)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tree)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (__Pyx_SetItemInt(__pyx_v_self->children, __pyx_v_index, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":343 + * self.children[ index ] = ArrayTreeLeaf( self.tree, min, max ) + * else: + * self.children[ index ] = ArrayTreeNode( self.tree, min, max, self.block_size, self.level - 1 ) # <<<<<<<<<<<<<< + * + * def set( self, int index, value ): + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_min); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyInt_FromLong((__pyx_v_self->level - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->tree)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self->tree)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tree)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (__Pyx_SetItemInt(__pyx_v_self->children, __pyx_v_index, __pyx_t_5, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.init_bin", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":345 + * self.children[ index ] = ArrayTreeNode( self.tree, min, max, self.block_size, self.level - 1 ) + * + * def set( self, int index, value ): # <<<<<<<<<<<<<< + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_index; + PyObject *__pyx_v_value = 0; + int __pyx_v_bin_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("set"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_index = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":346 + * + * def set( self, int index, value ): + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) # <<<<<<<<<<<<<< + * if self.children[ bin_index ] is None: + * self.init_bin( bin_index ) + */ + __pyx_t_1 = (__pyx_v_index - ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->min); + if (unlikely(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_bin_index = __Pyx_div_int(__pyx_t_1, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size); + + /* "bx/arrays/array_tree.pyx":347 + * def set( self, int index, value ): + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: # <<<<<<<<<<<<<< + * self.init_bin( bin_index ) + * self.children[ bin_index ].set( index, value ) + */ + __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_2 == Py_None); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "bx/arrays/array_tree.pyx":348 + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: + * self.init_bin( bin_index ) # <<<<<<<<<<<<<< + * self.children[ bin_index ].set( index, value ) + * + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->__pyx_vtab)->init_bin(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self), __pyx_v_bin_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/arrays/array_tree.pyx":349 + * if self.children[ bin_index ] is None: + * self.init_bin( bin_index ) + * self.children[ bin_index ].set( index, value ) # <<<<<<<<<<<<<< + * + * def get( self, int index ): + */ + __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__set); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":351 + * self.children[ bin_index ].set( index, value ) + * + * def get( self, int index ): # <<<<<<<<<<<<<< + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_2get(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_2get(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + int __pyx_v_bin_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get"); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":352 + * + * def get( self, int index ): + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) # <<<<<<<<<<<<<< + * if self.children[ bin_index ] is None: + * return nan + */ + __pyx_t_1 = (__pyx_v_index - ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->min); + if (unlikely(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(int) == sizeof(long) && unlikely(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_1))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_bin_index = __Pyx_div_int(__pyx_t_1, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size); + + /* "bx/arrays/array_tree.pyx":353 + * def get( self, int index ): + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: # <<<<<<<<<<<<<< + * return nan + * else: + */ + __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_2 == Py_None); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "bx/arrays/array_tree.pyx":354 + * cdef int bin_index = ( index - self.min ) // ( self.child_size ) + * if self.children[ bin_index ] is None: + * return nan # <<<<<<<<<<<<<< + * else: + * return self.children[ bin_index ].get( index ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":356 + * return nan + * else: + * return self.children[ bin_index ].get( index ) # <<<<<<<<<<<<<< + * + * cpdef build_summary( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":358 + * return self.children[ bin_index ].get( index ) + * + * cpdef build_summary( self ): # <<<<<<<<<<<<<< + * """ + * Build summary of children. + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_2bx_6arrays_10array_tree_13ArrayTreeNode_build_summary(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_v_counts = NULL; + PyObject *__pyx_v_frequencies = NULL; + PyObject *__pyx_v_mins = NULL; + PyObject *__pyx_v_maxs = NULL; + PyObject *__pyx_v_sums = NULL; + PyObject *__pyx_v_sumsquares = NULL; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_v = NULL; + PyObject *__pyx_v_c = NULL; + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *__pyx_v_s = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("build_summary"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__build_summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/arrays/array_tree.pyx":362 + * Build summary of children. + * """ + * counts = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * frequencies = empty( self.tree.block_size, self.tree.dtype ) + * mins = empty( self.tree.block_size, self.tree.dtype ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_counts = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":363 + * """ + * counts = empty( self.tree.block_size, self.tree.dtype ) + * frequencies = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * mins = empty( self.tree.block_size, self.tree.dtype ) + * maxs = empty( self.tree.block_size, self.tree.dtype ) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_frequencies = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":364 + * counts = empty( self.tree.block_size, self.tree.dtype ) + * frequencies = empty( self.tree.block_size, self.tree.dtype ) + * mins = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * maxs = empty( self.tree.block_size, self.tree.dtype ) + * sums = empty( self.tree.block_size, self.tree.dtype ) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_mins = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":365 + * frequencies = empty( self.tree.block_size, self.tree.dtype ) + * mins = empty( self.tree.block_size, self.tree.dtype ) + * maxs = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * sums = empty( self.tree.block_size, self.tree.dtype ) + * sumsquares = empty( self.tree.block_size, self.tree.dtype ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_maxs = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":366 + * mins = empty( self.tree.block_size, self.tree.dtype ) + * maxs = empty( self.tree.block_size, self.tree.dtype ) + * sums = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * sumsquares = empty( self.tree.block_size, self.tree.dtype ) + * for i in range( len( self.children ) ): + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_sums = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":367 + * maxs = empty( self.tree.block_size, self.tree.dtype ) + * sums = empty( self.tree.block_size, self.tree.dtype ) + * sumsquares = empty( self.tree.block_size, self.tree.dtype ) # <<<<<<<<<<<<<< + * for i in range( len( self.children ) ): + * if self.children[i]: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->tree->block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_self->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->tree->dtype); + __Pyx_GIVEREF(__pyx_v_self->tree->dtype); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_sumsquares = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":368 + * sums = empty( self.tree.block_size, self.tree.dtype ) + * sumsquares = empty( self.tree.block_size, self.tree.dtype ) + * for i in range( len( self.children ) ): # <<<<<<<<<<<<<< + * if self.children[i]: + * if self.level == 1: + */ + __pyx_t_1 = __pyx_v_self->children; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "bx/arrays/array_tree.pyx":369 + * sumsquares = empty( self.tree.block_size, self.tree.dtype ) + * for i in range( len( self.children ) ): + * if self.children[i]: # <<<<<<<<<<<<<< + * if self.level == 1: + * v = self.children[i].values + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "bx/arrays/array_tree.pyx":370 + * for i in range( len( self.children ) ): + * if self.children[i]: + * if self.level == 1: # <<<<<<<<<<<<<< + * v = self.children[i].values + * counts[i] = sum( ~isnan( v ) ) + */ + __pyx_t_6 = (__pyx_v_self->level == 1); + if (__pyx_t_6) { + + /* "bx/arrays/array_tree.pyx":371 + * if self.children[i]: + * if self.level == 1: + * v = self.children[i].values # <<<<<<<<<<<<<< + * counts[i] = sum( ~isnan( v ) ) + * frequencies[i] = self.children[i].frequency + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__values); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":372 + * if self.level == 1: + * v = self.children[i].values + * counts[i] = sum( ~isnan( v ) ) # <<<<<<<<<<<<<< + * frequencies[i] = self.children[i].frequency + * mins[i] = nanmin( v ) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__isnan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Invert(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_v_i, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":373 + * v = self.children[i].values + * counts[i] = sum( ~isnan( v ) ) + * frequencies[i] = self.children[i].frequency # <<<<<<<<<<<<<< + * mins[i] = nanmin( v ) + * maxs[i] = nanmax( v ) + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__frequency); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_frequencies, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":374 + * counts[i] = sum( ~isnan( v ) ) + * frequencies[i] = self.children[i].frequency + * mins[i] = nanmin( v ) # <<<<<<<<<<<<<< + * maxs[i] = nanmax( v ) + * sums[i] = nansum( v ) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nanmin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_mins, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":375 + * frequencies[i] = self.children[i].frequency + * mins[i] = nanmin( v ) + * maxs[i] = nanmax( v ) # <<<<<<<<<<<<<< + * sums[i] = nansum( v ) + * sumsquares[i] = nansum( v ** 2 ) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nanmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_maxs, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":376 + * mins[i] = nanmin( v ) + * maxs[i] = nanmax( v ) + * sums[i] = nansum( v ) # <<<<<<<<<<<<<< + * sumsquares[i] = nansum( v ** 2 ) + * else: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nansum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_sums, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":377 + * maxs[i] = nanmax( v ) + * sums[i] = nansum( v ) + * sumsquares[i] = nansum( v ** 2 ) # <<<<<<<<<<<<<< + * else: + * c = self.children[i] + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nansum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Power(__pyx_v_v, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (__Pyx_SetItemInt(__pyx_v_sumsquares, __pyx_v_i, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":379 + * sumsquares[i] = nansum( v ** 2 ) + * else: + * c = self.children[i] # <<<<<<<<<<<<<< + * c.build_summary() + * counts[i] = sum( c.summary.counts ) + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_c); + __pyx_v_c = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":380 + * else: + * c = self.children[i] + * c.build_summary() # <<<<<<<<<<<<<< + * counts[i] = sum( c.summary.counts ) + * frequencies[i] = sum( c.summary.frequencies ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__build_summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":381 + * c = self.children[i] + * c.build_summary() + * counts[i] = sum( c.summary.counts ) # <<<<<<<<<<<<<< + * frequencies[i] = sum( c.summary.frequencies ) + * mins[i] = nanmin( c.summary.mins ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__counts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_v_i, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":382 + * c.build_summary() + * counts[i] = sum( c.summary.counts ) + * frequencies[i] = sum( c.summary.frequencies ) # <<<<<<<<<<<<<< + * mins[i] = nanmin( c.summary.mins ) + * maxs[i] = nanmax( c.summary.maxs ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__frequencies); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_frequencies, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":383 + * counts[i] = sum( c.summary.counts ) + * frequencies[i] = sum( c.summary.frequencies ) + * mins[i] = nanmin( c.summary.mins ) # <<<<<<<<<<<<<< + * maxs[i] = nanmax( c.summary.maxs ) + * sums[i] = nansum( c.summary.sums ) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nanmin); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mins); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_mins, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":384 + * frequencies[i] = sum( c.summary.frequencies ) + * mins[i] = nanmin( c.summary.mins ) + * maxs[i] = nanmax( c.summary.maxs ) # <<<<<<<<<<<<<< + * sums[i] = nansum( c.summary.sums ) + * sumsquares[i] = nansum( c.summary.sumsquares ) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nanmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__maxs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_maxs, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":385 + * mins[i] = nanmin( c.summary.mins ) + * maxs[i] = nanmax( c.summary.maxs ) + * sums[i] = nansum( c.summary.sums ) # <<<<<<<<<<<<<< + * sumsquares[i] = nansum( c.summary.sumsquares ) + * else: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nansum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sums); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_sums, __pyx_v_i, __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":386 + * maxs[i] = nanmax( c.summary.maxs ) + * sums[i] = nansum( c.summary.sums ) + * sumsquares[i] = nansum( c.summary.sumsquares ) # <<<<<<<<<<<<<< + * else: + * counts[i] = 0 + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nansum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__summary); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sumsquares); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_SetItemInt(__pyx_v_sumsquares, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L6:; + goto __pyx_L5; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":388 + * sumsquares[i] = nansum( c.summary.sumsquares ) + * else: + * counts[i] = 0 # <<<<<<<<<<<<<< + * frequencies[i] = 0 + * mins[i] = nan + */ + if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_v_i, __pyx_int_0, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":389 + * else: + * counts[i] = 0 + * frequencies[i] = 0 # <<<<<<<<<<<<<< + * mins[i] = nan + * maxs[i] = nan + */ + if (__Pyx_SetItemInt(__pyx_v_frequencies, __pyx_v_i, __pyx_int_0, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":390 + * counts[i] = 0 + * frequencies[i] = 0 + * mins[i] = nan # <<<<<<<<<<<<<< + * maxs[i] = nan + * sums[i] = nan + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_v_mins, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":391 + * frequencies[i] = 0 + * mins[i] = nan + * maxs[i] = nan # <<<<<<<<<<<<<< + * sums[i] = nan + * sumsquares[i] = nan + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_v_maxs, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":392 + * mins[i] = nan + * maxs[i] = nan + * sums[i] = nan # <<<<<<<<<<<<<< + * sumsquares[i] = nan + * s = Summary() + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_v_sums, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":393 + * maxs[i] = nan + * sums[i] = nan + * sumsquares[i] = nan # <<<<<<<<<<<<<< + * s = Summary() + * s.counts = counts + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetItemInt(__pyx_v_sumsquares, __pyx_v_i, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L5:; + } + + /* "bx/arrays/array_tree.pyx":394 + * sums[i] = nan + * sumsquares[i] = nan + * s = Summary() # <<<<<<<<<<<<<< + * s.counts = counts + * s.frequencies = frequencies + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_Summary)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_s = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":395 + * sumsquares[i] = nan + * s = Summary() + * s.counts = counts # <<<<<<<<<<<<<< + * s.frequencies = frequencies + * s.mins = mins + */ + __Pyx_INCREF(__pyx_v_counts); + __Pyx_GIVEREF(__pyx_v_counts); + __Pyx_GOTREF(__pyx_v_s->counts); + __Pyx_DECREF(__pyx_v_s->counts); + __pyx_v_s->counts = __pyx_v_counts; + + /* "bx/arrays/array_tree.pyx":396 + * s = Summary() + * s.counts = counts + * s.frequencies = frequencies # <<<<<<<<<<<<<< + * s.mins = mins + * s.maxs = maxs + */ + __Pyx_INCREF(__pyx_v_frequencies); + __Pyx_GIVEREF(__pyx_v_frequencies); + __Pyx_GOTREF(__pyx_v_s->frequencies); + __Pyx_DECREF(__pyx_v_s->frequencies); + __pyx_v_s->frequencies = __pyx_v_frequencies; + + /* "bx/arrays/array_tree.pyx":397 + * s.counts = counts + * s.frequencies = frequencies + * s.mins = mins # <<<<<<<<<<<<<< + * s.maxs = maxs + * s.sums = sums + */ + __Pyx_INCREF(__pyx_v_mins); + __Pyx_GIVEREF(__pyx_v_mins); + __Pyx_GOTREF(__pyx_v_s->mins); + __Pyx_DECREF(__pyx_v_s->mins); + __pyx_v_s->mins = __pyx_v_mins; + + /* "bx/arrays/array_tree.pyx":398 + * s.frequencies = frequencies + * s.mins = mins + * s.maxs = maxs # <<<<<<<<<<<<<< + * s.sums = sums + * s.sumsquares = sumsquares + */ + __Pyx_INCREF(__pyx_v_maxs); + __Pyx_GIVEREF(__pyx_v_maxs); + __Pyx_GOTREF(__pyx_v_s->maxs); + __Pyx_DECREF(__pyx_v_s->maxs); + __pyx_v_s->maxs = __pyx_v_maxs; + + /* "bx/arrays/array_tree.pyx":399 + * s.mins = mins + * s.maxs = maxs + * s.sums = sums # <<<<<<<<<<<<<< + * s.sumsquares = sumsquares + * self.summary = s + */ + __Pyx_INCREF(__pyx_v_sums); + __Pyx_GIVEREF(__pyx_v_sums); + __Pyx_GOTREF(__pyx_v_s->sums); + __Pyx_DECREF(__pyx_v_s->sums); + __pyx_v_s->sums = __pyx_v_sums; + + /* "bx/arrays/array_tree.pyx":400 + * s.maxs = maxs + * s.sums = sums + * s.sumsquares = sumsquares # <<<<<<<<<<<<<< + * self.summary = s + * + */ + __Pyx_INCREF(__pyx_v_sumsquares); + __Pyx_GIVEREF(__pyx_v_sumsquares); + __Pyx_GOTREF(__pyx_v_s->sumsquares); + __Pyx_DECREF(__pyx_v_s->sumsquares); + __pyx_v_s->sumsquares = __pyx_v_sumsquares; + + /* "bx/arrays/array_tree.pyx":401 + * s.sums = sums + * s.sumsquares = sumsquares + * self.summary = s # <<<<<<<<<<<<<< + * + * def to_file_data_pass( self, io, level ): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_s)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_s)); + __Pyx_GOTREF(__pyx_v_self->summary); + __Pyx_DECREF(((PyObject *)__pyx_v_self->summary)); + __pyx_v_self->summary = __pyx_v_s; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.build_summary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_counts); + __Pyx_XDECREF(__pyx_v_frequencies); + __Pyx_XDECREF(__pyx_v_mins); + __Pyx_XDECREF(__pyx_v_maxs); + __Pyx_XDECREF(__pyx_v_sums); + __Pyx_XDECREF(__pyx_v_sumsquares); + __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_c); + __Pyx_XDECREF((PyObject *)__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":358 + * return self.children[ bin_index ].get( index ) + * + * cpdef build_summary( self ): # <<<<<<<<<<<<<< + * """ + * Build summary of children. + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary[] = "\n Build summary of children. \n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("build_summary"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->__pyx_vtab)->build_summary(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.build_summary", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":403 + * self.summary = s + * + * def to_file_data_pass( self, io, level ): # <<<<<<<<<<<<<< + * """ + * First pass of writing to file, writes data and saves position of block. + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_4to_file_data_pass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_4to_file_data_pass[] = "\n First pass of writing to file, writes data and saves position of block.\n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_4to_file_data_pass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_io = 0; + PyObject *__pyx_v_level = 0; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + long __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__io,&__pyx_n_s__level,0}; + __Pyx_RefNannySetupContext("to_file_data_pass"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__io); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("to_file_data_pass", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "to_file_data_pass") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_io = values[0]; + __pyx_v_level = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_file_data_pass", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.to_file_data_pass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":407 + * First pass of writing to file, writes data and saves position of block. + * """ + * assert self.summary, "Writing without summaries is currently not supported" # <<<<<<<<<<<<<< + * # If we are at the current level being written, write a block + * if self.level == level: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_19)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/arrays/array_tree.pyx":409 + * assert self.summary, "Writing without summaries is currently not supported" + * # If we are at the current level being written, write a block + * if self.level == level: # <<<<<<<<<<<<<< + * # Save file offset where this block starts + * self.start_offset = io.tell() + */ + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_level, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "bx/arrays/array_tree.pyx":411 + * if self.level == level: + * # Save file offset where this block starts + * self.start_offset = io.tell() # <<<<<<<<<<<<<< + * # Write out summary data + * io.write_raw_array( self.summary.counts ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset = __pyx_t_4; + + /* "bx/arrays/array_tree.pyx":413 + * self.start_offset = io.tell() + * # Write out summary data + * io.write_raw_array( self.summary.counts ) # <<<<<<<<<<<<<< + * io.write_raw_array( self.summary.frequencies ) + * io.write_raw_array( self.summary.sums ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->counts); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->counts); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->counts); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/arrays/array_tree.pyx":414 + * # Write out summary data + * io.write_raw_array( self.summary.counts ) + * io.write_raw_array( self.summary.frequencies ) # <<<<<<<<<<<<<< + * io.write_raw_array( self.summary.sums ) + * io.write_raw_array( self.summary.mins ) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->frequencies); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->frequencies); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->frequencies); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":415 + * io.write_raw_array( self.summary.counts ) + * io.write_raw_array( self.summary.frequencies ) + * io.write_raw_array( self.summary.sums ) # <<<<<<<<<<<<<< + * io.write_raw_array( self.summary.mins ) + * io.write_raw_array( self.summary.maxs ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sums); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sums); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sums); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/arrays/array_tree.pyx":416 + * io.write_raw_array( self.summary.frequencies ) + * io.write_raw_array( self.summary.sums ) + * io.write_raw_array( self.summary.mins ) # <<<<<<<<<<<<<< + * io.write_raw_array( self.summary.maxs ) + * io.write_raw_array( self.summary.sumsquares ) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->mins); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->mins); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->mins); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":417 + * io.write_raw_array( self.summary.sums ) + * io.write_raw_array( self.summary.mins ) + * io.write_raw_array( self.summary.maxs ) # <<<<<<<<<<<<<< + * io.write_raw_array( self.summary.sumsquares ) + * # Skip enough room for child offsets (block_size children * 64bits) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->maxs); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->maxs); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->maxs); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/arrays/array_tree.pyx":418 + * io.write_raw_array( self.summary.mins ) + * io.write_raw_array( self.summary.maxs ) + * io.write_raw_array( self.summary.sumsquares ) # <<<<<<<<<<<<<< + * # Skip enough room for child offsets (block_size children * 64bits) + * io.skip( self.tree.block_size * 8 ) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sumsquares); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sumsquares); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary->sumsquares); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":420 + * io.write_raw_array( self.summary.sumsquares ) + * # Skip enough room for child offsets (block_size children * 64bits) + * io.skip( self.tree.block_size * 8 ) # <<<<<<<<<<<<<< + * # Must be writing a lower level, so recurse + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong((((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree->block_size * 8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":424 + * else: + * # Write all non-empty children + * for i in range( len( self.children ) ): # <<<<<<<<<<<<<< + * if self.children[i] is not None: + * self.children[i].to_file_data_pass( io, level ) + */ + __pyx_t_3 = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "bx/arrays/array_tree.pyx":425 + * # Write all non-empty children + * for i in range( len( self.children ) ): + * if self.children[i] is not None: # <<<<<<<<<<<<<< + * self.children[i].to_file_data_pass( io, level ) + * + */ + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = (__pyx_t_3 != Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "bx/arrays/array_tree.pyx":426 + * for i in range( len( self.children ) ): + * if self.children[i] is not None: + * self.children[i].to_file_data_pass( io, level ) # <<<<<<<<<<<<<< + * + * def to_file_offset_pass( self, io ): + */ + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__to_file_data_pass); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + __Pyx_INCREF(__pyx_v_level); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_level); + __Pyx_GIVEREF(__pyx_v_level); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9; + } + __pyx_L9:; + } + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.to_file_data_pass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":428 + * self.children[i].to_file_data_pass( io, level ) + * + * def to_file_offset_pass( self, io ): # <<<<<<<<<<<<<< + * """ + * Second pass of writing to file, seek to appropriate position and write + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_5to_file_offset_pass(PyObject *__pyx_v_self, PyObject *__pyx_v_io); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_5to_file_offset_pass[] = "\n Second pass of writing to file, seek to appropriate position and write\n offsets of children.\n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_5to_file_offset_pass(PyObject *__pyx_v_self, PyObject *__pyx_v_io) { + PyObject *__pyx_v_skip_amount = NULL; + PyObject *__pyx_v_child = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("to_file_offset_pass"); + + /* "bx/arrays/array_tree.pyx":434 + * """ + * # Seek to location of child offfsets (skip over # summary arrays) + * skip_amount = NUM_SUMMARY_ARRAYS * self.tree.dtype.itemsize * self.block_size # <<<<<<<<<<<<<< + * io.seek( self.start_offset + skip_amount ) + * # Write the file offset of each child into the index + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NUM_SUMMARY_ARRAYS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree->dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_skip_amount = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":435 + * # Seek to location of child offfsets (skip over # summary arrays) + * skip_amount = NUM_SUMMARY_ARRAYS * self.tree.dtype.itemsize * self.block_size + * io.seek( self.start_offset + skip_amount ) # <<<<<<<<<<<<<< + * # Write the file offset of each child into the index + * for child in self.children: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_skip_amount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":437 + * io.seek( self.start_offset + skip_amount ) + * # Write the file offset of each child into the index + * for child in self.children: # <<<<<<<<<<<<<< + * if child is None: + * io.write_uint64( 0 ) + */ + if (PyList_CheckExact(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children) || PyTuple_CheckExact(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children)) { + __pyx_t_3 = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":438 + * # Write the file offset of each child into the index + * for child in self.children: + * if child is None: # <<<<<<<<<<<<<< + * io.write_uint64( 0 ) + * else: + */ + __pyx_t_6 = (__pyx_v_child == Py_None); + if (__pyx_t_6) { + + /* "bx/arrays/array_tree.pyx":439 + * for child in self.children: + * if child is None: + * io.write_uint64( 0 ) # <<<<<<<<<<<<<< + * else: + * io.write_uint64( child.start_offset ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":441 + * io.write_uint64( 0 ) + * else: + * io.write_uint64( child.start_offset ) # <<<<<<<<<<<<<< + * # Recursively write offsets in child nodes + * for child in self.children: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_uint64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L7:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/arrays/array_tree.pyx":443 + * io.write_uint64( child.start_offset ) + * # Recursively write offsets in child nodes + * for child in self.children: # <<<<<<<<<<<<<< + * if child is not None: + * child.to_file_offset_pass( io ) + */ + if (PyList_CheckExact(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children) || PyTuple_CheckExact(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children)) { + __pyx_t_3 = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_child); + __pyx_v_child = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":444 + * # Recursively write offsets in child nodes + * for child in self.children: + * if child is not None: # <<<<<<<<<<<<<< + * child.to_file_offset_pass( io ) + * + */ + __pyx_t_6 = (__pyx_v_child != Py_None); + if (__pyx_t_6) { + + /* "bx/arrays/array_tree.pyx":445 + * for child in self.children: + * if child is not None: + * child.to_file_offset_pass( io ) # <<<<<<<<<<<<<< + * + * def from_file( self, io ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__to_file_offset_pass); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.to_file_offset_pass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_skip_amount); + __Pyx_XDECREF(__pyx_v_child); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":447 + * child.to_file_offset_pass( io ) + * + * def from_file( self, io ): # <<<<<<<<<<<<<< + * """ + * Load entire summary and all children into memory. + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_6from_file(PyObject *__pyx_v_self, PyObject *__pyx_v_io); /*proto*/ +static char __pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_6from_file[] = "\n Load entire summary and all children into memory.\n "; +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_6from_file(PyObject *__pyx_v_self, PyObject *__pyx_v_io) { + PyObject *__pyx_v_dtype = NULL; + int __pyx_v_block_size; + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *__pyx_v_s = NULL; + PyObject *__pyx_v_child_offsets = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_file"); + + /* "bx/arrays/array_tree.pyx":451 + * Load entire summary and all children into memory. + * """ + * dtype = self.tree.dtype # <<<<<<<<<<<<<< + * block_size = self.tree.block_size + * # Read summary arrays + */ + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree->dtype); + __pyx_v_dtype = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree->dtype; + + /* "bx/arrays/array_tree.pyx":452 + * """ + * dtype = self.tree.dtype + * block_size = self.tree.block_size # <<<<<<<<<<<<<< + * # Read summary arrays + * s = Summary() + */ + __pyx_v_block_size = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree->block_size; + + /* "bx/arrays/array_tree.pyx":454 + * block_size = self.tree.block_size + * # Read summary arrays + * s = Summary() # <<<<<<<<<<<<<< + * s.counts = io.read_raw_array( dtype, block_size ) + * s.frequencies = io.read_raw_array( int32, block_size ) + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_Summary)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_s = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":455 + * # Read summary arrays + * s = Summary() + * s.counts = io.read_raw_array( dtype, block_size ) # <<<<<<<<<<<<<< + * s.frequencies = io.read_raw_array( int32, block_size ) + * s.sums = io.read_raw_array( dtype, block_size ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_s->counts); + __Pyx_DECREF(__pyx_v_s->counts); + __pyx_v_s->counts = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":456 + * s = Summary() + * s.counts = io.read_raw_array( dtype, block_size ) + * s.frequencies = io.read_raw_array( int32, block_size ) # <<<<<<<<<<<<<< + * s.sums = io.read_raw_array( dtype, block_size ) + * s.mins = io.read_raw_array( dtype, block_size) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_s->frequencies); + __Pyx_DECREF(__pyx_v_s->frequencies); + __pyx_v_s->frequencies = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":457 + * s.counts = io.read_raw_array( dtype, block_size ) + * s.frequencies = io.read_raw_array( int32, block_size ) + * s.sums = io.read_raw_array( dtype, block_size ) # <<<<<<<<<<<<<< + * s.mins = io.read_raw_array( dtype, block_size) + * s.maxs = io.read_raw_array( dtype, block_size ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_s->sums); + __Pyx_DECREF(__pyx_v_s->sums); + __pyx_v_s->sums = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":458 + * s.frequencies = io.read_raw_array( int32, block_size ) + * s.sums = io.read_raw_array( dtype, block_size ) + * s.mins = io.read_raw_array( dtype, block_size) # <<<<<<<<<<<<<< + * s.maxs = io.read_raw_array( dtype, block_size ) + * s.sumsquares = io.read_raw_array( dtype, block_size ) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_s->mins); + __Pyx_DECREF(__pyx_v_s->mins); + __pyx_v_s->mins = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":459 + * s.sums = io.read_raw_array( dtype, block_size ) + * s.mins = io.read_raw_array( dtype, block_size) + * s.maxs = io.read_raw_array( dtype, block_size ) # <<<<<<<<<<<<<< + * s.sumsquares = io.read_raw_array( dtype, block_size ) + * self.summary = s + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_s->maxs); + __Pyx_DECREF(__pyx_v_s->maxs); + __pyx_v_s->maxs = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":460 + * s.mins = io.read_raw_array( dtype, block_size) + * s.maxs = io.read_raw_array( dtype, block_size ) + * s.sumsquares = io.read_raw_array( dtype, block_size ) # <<<<<<<<<<<<<< + * self.summary = s + * # Read offset of all children + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dtype); + __Pyx_GIVEREF(__pyx_v_dtype); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_s->sumsquares); + __Pyx_DECREF(__pyx_v_s->sumsquares); + __pyx_v_s->sumsquares = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":461 + * s.maxs = io.read_raw_array( dtype, block_size ) + * s.sumsquares = io.read_raw_array( dtype, block_size ) + * self.summary = s # <<<<<<<<<<<<<< + * # Read offset of all children + * child_offsets = [ io.read_uint64() for i in range( block_size ) ] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_s)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_s)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = __pyx_v_s; + + /* "bx/arrays/array_tree.pyx":463 + * self.summary = s + * # Read offset of all children + * child_offsets = [ io.read_uint64() for i in range( block_size ) ] # <<<<<<<<<<<<<< + * for i in range( block_size ): + * if child_offsets[i] > 0: + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = __pyx_v_block_size; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_INCREF(((PyObject *)__pyx_t_4)); + __pyx_v_child_offsets = __pyx_t_4; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":464 + * # Read offset of all children + * child_offsets = [ io.read_uint64() for i in range( block_size ) ] + * for i in range( block_size ): # <<<<<<<<<<<<<< + * if child_offsets[i] > 0: + * self.init_bin( i ) + */ + __pyx_t_5 = __pyx_v_block_size; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "bx/arrays/array_tree.pyx":465 + * child_offsets = [ io.read_uint64() for i in range( block_size ) ] + * for i in range( block_size ): + * if child_offsets[i] > 0: # <<<<<<<<<<<<<< + * self.init_bin( i ) + * io.seek( child_offsets[i] ) + */ + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_child_offsets), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + + /* "bx/arrays/array_tree.pyx":466 + * for i in range( block_size ): + * if child_offsets[i] > 0: + * self.init_bin( i ) # <<<<<<<<<<<<<< + * io.seek( child_offsets[i] ) + * self.children[i].from_file( io ) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->__pyx_vtab)->init_bin(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self), __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":467 + * if child_offsets[i] > 0: + * self.init_bin( i ) + * io.seek( child_offsets[i] ) # <<<<<<<<<<<<<< + * self.children[i].from_file( io ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_child_offsets), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/arrays/array_tree.pyx":468 + * self.init_bin( i ) + * io.seek( child_offsets[i] ) + * self.children[i].from_file( io ) # <<<<<<<<<<<<<< + * + * def get_from_file( self, io, index ): + */ + __pyx_t_4 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__from_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_io); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_io); + __Pyx_GIVEREF(__pyx_v_io); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L9; + } + __pyx_L9:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_dtype); + __Pyx_XDECREF((PyObject *)__pyx_v_s); + __Pyx_XDECREF(__pyx_v_child_offsets); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":470 + * self.children[i].from_file( io ) + * + * def get_from_file( self, io, index ): # <<<<<<<<<<<<<< + * cdef int bin_index = ( index - self.min ) //( self.child_size ) + * if self.children[ bin_index ] is None: + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7get_from_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7get_from_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_io = 0; + PyObject *__pyx_v_index = 0; + int __pyx_v_bin_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__io,&__pyx_n_s__index,0}; + __Pyx_RefNannySetupContext("get_from_file"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__io); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_from_file", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_from_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_io = values[0]; + __pyx_v_index = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_from_file", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.get_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":471 + * + * def get_from_file( self, io, index ): + * cdef int bin_index = ( index - self.min ) //( self.child_size ) # <<<<<<<<<<<<<< + * if self.children[ bin_index ] is None: + * return nan + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_v_index, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_FloorDivide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_bin_index = __pyx_t_4; + + /* "bx/arrays/array_tree.pyx":472 + * def get_from_file( self, io, index ): + * cdef int bin_index = ( index - self.min ) //( self.child_size ) + * if self.children[ bin_index ] is None: # <<<<<<<<<<<<<< + * return nan + * else: + */ + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = (__pyx_t_3 == Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + + /* "bx/arrays/array_tree.pyx":473 + * cdef int bin_index = ( index - self.min ) //( self.child_size ) + * if self.children[ bin_index ] is None: + * return nan # <<<<<<<<<<<<<< + * else: + * return self.children[ bin_index ].get( index ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/arrays/array_tree.pyx":475 + * return nan + * else: + * return self.children[ bin_index ].get( index ) # <<<<<<<<<<<<<< + * + * cdef class ArrayTreeLeaf: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_GetItemInt(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children, __pyx_v_bin_index, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.get_from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":322 + * cdef int child_size + * cdef object children + * cdef public Summary summary # <<<<<<<<<<<<<< + * cdef public long start_offset + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); + __pyx_r = ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_Summary))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.summary.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":323 + * cdef object children + * cdef public Summary summary + * cdef public long start_offset # <<<<<<<<<<<<<< + * + * def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ): + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.start_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + long __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.start_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":489 + * cdef public long start_offset + * + * def __init__( self, ArrayTree tree, int min, int max ): # <<<<<<<<<<<<<< + * self.tree = tree + * self.min = min + */ + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *__pyx_v_tree = 0; + int __pyx_v_min; + int __pyx_v_max; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__min,&__pyx_n_s__max,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)values[0]); + __pyx_v_min = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_2bx_6arrays_10array_tree_ArrayTree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":490 + * + * def __init__( self, ArrayTree tree, int min, int max ): + * self.tree = tree # <<<<<<<<<<<<<< + * self.min = min + * self.max = max + */ + __Pyx_INCREF(((PyObject *)__pyx_v_tree)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_tree)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree = __pyx_v_tree; + + /* "bx/arrays/array_tree.pyx":491 + * def __init__( self, ArrayTree tree, int min, int max ): + * self.tree = tree + * self.min = min # <<<<<<<<<<<<<< + * self.max = max + * self.frequency = 0 + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->min = __pyx_v_min; + + /* "bx/arrays/array_tree.pyx":492 + * self.tree = tree + * self.min = min + * self.max = max # <<<<<<<<<<<<<< + * self.frequency = 0 + * self.values = empty( max - min, self.tree.dtype ) + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->max = __pyx_v_max; + + /* "bx/arrays/array_tree.pyx":493 + * self.min = min + * self.max = max + * self.frequency = 0 # <<<<<<<<<<<<<< + * self.values = empty( max - min, self.tree.dtype ) + * self.values[:] = nan + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->frequency = 0; + + /* "bx/arrays/array_tree.pyx":494 + * self.max = max + * self.frequency = 0 + * self.values = empty( max - min, self.tree.dtype ) # <<<<<<<<<<<<<< + * self.values[:] = nan + * self.start_offset = 0 + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong((__pyx_v_max - __pyx_v_min)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":495 + * self.frequency = 0 + * self.values = empty( max - min, self.tree.dtype ) + * self.values[:] = nan # <<<<<<<<<<<<<< + * self.start_offset = 0 + * + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PySequence_SetSlice(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values), 0, PY_SSIZE_T_MAX, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":496 + * self.values = empty( max - min, self.tree.dtype ) + * self.values[:] = nan + * self.start_offset = 0 # <<<<<<<<<<<<<< + * + * def set( self, index, value ): + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->start_offset = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":498 + * self.start_offset = 0 + * + * def set( self, index, value ): # <<<<<<<<<<<<<< + * self.frequency += 1 + * self.values[ index - self.min ] = value + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_1set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("set"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_index = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":499 + * + * def set( self, index, value ): + * self.frequency += 1 # <<<<<<<<<<<<<< + * self.values[ index - self.min ] = value + * + */ + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->frequency = (((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->frequency + 1); + + /* "bx/arrays/array_tree.pyx":500 + * def set( self, index, value ): + * self.frequency += 1 + * self.values[ index - self.min ] = value # <<<<<<<<<<<<<< + * + * def get( self, index ): + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_v_index, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetItem(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values), __pyx_t_2, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":502 + * self.values[ index - self.min ] = value + * + * def get( self, index ): # <<<<<<<<<<<<<< + * return self.values[ index - self.min ] + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_2get(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_2get(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get"); + + /* "bx/arrays/array_tree.pyx":503 + * + * def get( self, index ): + * return self.values[ index - self.min ] # <<<<<<<<<<<<<< + * + * def to_file_data_pass( self, io, level ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_v_index, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values), __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":505 + * return self.values[ index - self.min ] + * + * def to_file_data_pass( self, io, level ): # <<<<<<<<<<<<<< + * assert level == 0 + * self.start_offset = io.tell() + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_3to_file_data_pass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_3to_file_data_pass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_io = 0; + PyObject *__pyx_v_level = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + long __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__io,&__pyx_n_s__level,0}; + __Pyx_RefNannySetupContext("to_file_data_pass"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__io); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("to_file_data_pass", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "to_file_data_pass") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_io = values[0]; + __pyx_v_level = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("to_file_data_pass", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.to_file_data_pass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/array_tree.pyx":506 + * + * def to_file_data_pass( self, io, level ): + * assert level == 0 # <<<<<<<<<<<<<< + * self.start_offset = io.tell() + * io.write_raw_array( self.values ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_RichCompare(__pyx_v_level, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/arrays/array_tree.pyx":507 + * def to_file_data_pass( self, io, level ): + * assert level == 0 + * self.start_offset = io.tell() # <<<<<<<<<<<<<< + * io.write_raw_array( self.values ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->start_offset = __pyx_t_4; + + /* "bx/arrays/array_tree.pyx":508 + * assert level == 0 + * self.start_offset = io.tell() + * io.write_raw_array( self.values ) # <<<<<<<<<<<<<< + * + * def to_file_offset_pass( self, io ): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__write_raw_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.to_file_data_pass", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":510 + * io.write_raw_array( self.values ) + * + * def to_file_offset_pass( self, io ): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_4to_file_offset_pass(PyObject *__pyx_v_self, PyObject *__pyx_v_io); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_4to_file_offset_pass(PyObject *__pyx_v_self, PyObject *__pyx_v_io) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("to_file_offset_pass"); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":513 + * pass + * + * def from_file( self, io ): # <<<<<<<<<<<<<< + * self.values = io.read_raw_array( self.tree.dtype, self.tree.block_size ) + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_5from_file(PyObject *__pyx_v_self, PyObject *__pyx_v_io); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_5from_file(PyObject *__pyx_v_self, PyObject *__pyx_v_io) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("from_file"); + + /* "bx/arrays/array_tree.pyx":514 + * + * def from_file( self, io ): + * self.values = io.read_raw_array( self.tree.dtype, self.tree.block_size ) # <<<<<<<<<<<<<< + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_n_s__read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->tree->dtype); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.from_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":485 + * cdef int min + * cdef int max + * cdef public int frequency # <<<<<<<<<<<<<< + * cdef public numpy.ndarray values + * cdef public long start_offset + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->frequency); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.frequency.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->frequency = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.frequency.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":486 + * cdef int max + * cdef public int frequency + * cdef public numpy.ndarray values # <<<<<<<<<<<<<< + * cdef public long start_offset + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + __pyx_r = ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.values.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values)); + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->values = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/array_tree.pyx":487 + * cdef public int frequency + * cdef public numpy.ndarray values + * cdef public long start_offset # <<<<<<<<<<<<<< + * + * def __init__( self, ArrayTree tree, int min, int max ): + */ + +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.start_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + long __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)__pyx_v_self)->start_offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeLeaf.start_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":190 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":196 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":199 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":200 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":202 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":204 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":205 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L6; + } + /*else*/ { + + /* "numpy.pxd":207 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L6:; + + /* "numpy.pxd":209 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":210 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":213 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":218 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":219 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":222 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":223 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":224 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":225 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "numpy.pxd":226 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":228 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":229 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L9:; + + /* "numpy.pxd":230 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":231 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":232 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":235 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":236 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "numpy.pxd":240 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":242 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":244 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L12; + } + /*else*/ { + + /* "numpy.pxd":247 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L12:; + + /* "numpy.pxd":249 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":250 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":251 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":252 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "numpy.pxd":254 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L15; + } + + /* "numpy.pxd":255 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L15; + } + + /* "numpy.pxd":256 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L15; + } + + /* "numpy.pxd":257 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L15; + } + + /* "numpy.pxd":258 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L15; + } + + /* "numpy.pxd":259 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L15; + } + + /* "numpy.pxd":260 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L15; + } + + /* "numpy.pxd":261 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L15; + } + + /* "numpy.pxd":262 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L15; + } + + /* "numpy.pxd":263 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L15; + } + + /* "numpy.pxd":264 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L15; + } + + /* "numpy.pxd":265 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L15; + } + + /* "numpy.pxd":266 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L15; + } + + /* "numpy.pxd":267 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L15; + } + + /* "numpy.pxd":268 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L15; + } + + /* "numpy.pxd":269 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L15; + } + + /* "numpy.pxd":270 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L15; + } + /*else*/ { + + /* "numpy.pxd":272 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_27), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L15:; + + /* "numpy.pxd":273 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":274 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":276 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":277 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":278 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":281 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":282 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L13:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":284 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "numpy.pxd":285 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "numpy.pxd":286 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":287 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":288 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":764 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":767 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring"); + + /* "numpy.pxd":786 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":787 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":790 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":791 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":792 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":794 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":797 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":798 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":809 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":810 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":811 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":812 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":814 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":816 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":817 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":818 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":822 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":823 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":824 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":825 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":840 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_27), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":841 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":845 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":846 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":961 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "numpy.pxd":963 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":964 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":966 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":967 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":968 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":969 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "numpy.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":975 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_FileArrayTreeDict(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)o); + p->io = Py_None; Py_INCREF(Py_None); + p->cdb_dict = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_FileArrayTreeDict(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)o; + Py_XDECREF(p->io); + Py_XDECREF(p->cdb_dict); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_FileArrayTreeDict(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)o; + if (p->io) { + e = (*v)(p->io, a); if (e) return e; + } + if (p->cdb_dict) { + e = (*v)(p->cdb_dict, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_FileArrayTreeDict(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)o; + PyObject* tmp; + tmp = ((PyObject*)p->io); + p->io = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cdb_dict); + p->cdb_dict = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_2bx_6arrays_10array_tree_FileArrayTreeDict(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_FileArrayTreeDict[] = { + {__Pyx_NAMESTR("dict_to_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_2dict_to_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_17FileArrayTreeDict_2dict_to_file)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_FileArrayTreeDict = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_FileArrayTreeDict = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_6arrays_10array_tree_FileArrayTreeDict, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_FileArrayTreeDict = { + 0, /*mp_length*/ + __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_1__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_FileArrayTreeDict = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_FileArrayTreeDict = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.FileArrayTreeDict"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_FileArrayTreeDict, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_FileArrayTreeDict, /*tp_as_number*/ + &__pyx_tp_as_sequence_FileArrayTreeDict, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FileArrayTreeDict, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_FileArrayTreeDict, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Access to a file containing multiple array trees indexed by a string key.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_FileArrayTreeDict, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_FileArrayTreeDict, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_FileArrayTreeDict, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_FileArrayTreeDict, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree __pyx_vtable_2bx_6arrays_10array_tree_FileArrayTree; + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_FileArrayTree(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_6arrays_10array_tree_FileArrayTree; + p->dtype = Py_None; Py_INCREF(Py_None); + p->io = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_FileArrayTree(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)o; + Py_XDECREF(p->dtype); + Py_XDECREF(p->io); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_FileArrayTree(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)o; + if (p->dtype) { + e = (*v)(p->dtype, a); if (e) return e; + } + if (p->io) { + e = (*v)(p->io, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_FileArrayTree(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)o; + PyObject* tmp; + tmp = ((PyObject*)p->dtype); + p->dtype = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->io); + p->io = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_2bx_6arrays_10array_tree_FileArrayTree(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_max(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_max(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3max_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_block_size(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_block_size(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_10block_size_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_dtype(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_dtype(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_5dtype_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_levels(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_levels(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6levels_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_offset(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_6offset_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_root_offset(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_root_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_11root_offset_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_FileArrayTree[] = { + {__Pyx_NAMESTR("get_summary"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_2get_summary, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_leaf"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_3get_leaf, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6arrays_10array_tree_FileArrayTree[] = { + {(char *)"max", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_max, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_max, 0, 0}, + {(char *)"block_size", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_block_size, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_block_size, 0, 0}, + {(char *)"dtype", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_dtype, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_dtype, 0, 0}, + {(char *)"levels", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_levels, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_levels, 0, 0}, + {(char *)"offset", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_offset, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_offset, 0, 0}, + {(char *)"root_offset", __pyx_getprop_2bx_6arrays_10array_tree_13FileArrayTree_root_offset, __pyx_setprop_2bx_6arrays_10array_tree_13FileArrayTree_root_offset, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_FileArrayTree = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_FileArrayTree = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_6arrays_10array_tree_FileArrayTree, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_FileArrayTree = { + 0, /*mp_length*/ + __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree_1__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_FileArrayTree = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_FileArrayTree = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.FileArrayTree"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_FileArrayTree, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_FileArrayTree, /*tp_as_number*/ + &__pyx_tp_as_sequence_FileArrayTree, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FileArrayTree, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_FileArrayTree, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Wrapper for ArrayTree stored in file that reads as little as possible\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_FileArrayTree, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_FileArrayTree, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_FileArrayTree, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6arrays_10array_tree_FileArrayTree, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_FileArrayTree, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_Summary(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)o); + p->counts = Py_None; Py_INCREF(Py_None); + p->frequencies = Py_None; Py_INCREF(Py_None); + p->mins = Py_None; Py_INCREF(Py_None); + p->maxs = Py_None; Py_INCREF(Py_None); + p->sums = Py_None; Py_INCREF(Py_None); + p->sumsquares = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_Summary(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *p = (struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)o; + Py_XDECREF(p->counts); + Py_XDECREF(p->frequencies); + Py_XDECREF(p->mins); + Py_XDECREF(p->maxs); + Py_XDECREF(p->sums); + Py_XDECREF(p->sumsquares); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_Summary(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *p = (struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)o; + if (p->counts) { + e = (*v)(p->counts, a); if (e) return e; + } + if (p->frequencies) { + e = (*v)(p->frequencies, a); if (e) return e; + } + if (p->mins) { + e = (*v)(p->mins, a); if (e) return e; + } + if (p->maxs) { + e = (*v)(p->maxs, a); if (e) return e; + } + if (p->sums) { + e = (*v)(p->sums, a); if (e) return e; + } + if (p->sumsquares) { + e = (*v)(p->sumsquares, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_Summary(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_Summary *p = (struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)o; + PyObject* tmp; + tmp = ((PyObject*)p->counts); + p->counts = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->frequencies); + p->frequencies = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->mins); + p->mins = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->maxs); + p->maxs = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sums); + p->sums = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sumsquares); + p->sumsquares = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_counts(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_counts(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_6counts_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_frequencies(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_frequencies(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_11frequencies_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_mins(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_mins(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4mins_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_maxs(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_maxs(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4maxs_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_sums(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_sums(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_4sums_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_7Summary_sumsquares(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_7Summary_sumsquares(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_7Summary_10sumsquares_2__del__(o); + } +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_Summary[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6arrays_10array_tree_Summary[] = { + {(char *)"counts", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_counts, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_counts, 0, 0}, + {(char *)"frequencies", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_frequencies, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_frequencies, 0, 0}, + {(char *)"mins", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_mins, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_mins, 0, 0}, + {(char *)"maxs", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_maxs, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_maxs, 0, 0}, + {(char *)"sums", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_sums, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_sums, 0, 0}, + {(char *)"sumsquares", __pyx_getprop_2bx_6arrays_10array_tree_7Summary_sumsquares, __pyx_setprop_2bx_6arrays_10array_tree_7Summary_sumsquares, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Summary = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Summary = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Summary = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Summary = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_Summary = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.Summary"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_Summary), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_Summary, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Summary, /*tp_as_number*/ + &__pyx_tp_as_sequence_Summary, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Summary, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Summary, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Summary for a non-leaf level of the tree, contains arrays of the min, max,\n valid count, sum, and sum-of-squares for each child.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_Summary, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_Summary, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_Summary, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6arrays_10array_tree_Summary, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_Summary, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode __pyx_vtable_2bx_6arrays_10array_tree_ArrayTreeNode; + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_ArrayTreeNode(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_6arrays_10array_tree_ArrayTreeNode; + p->tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)Py_None); Py_INCREF(Py_None); + p->children = Py_None; Py_INCREF(Py_None); + p->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTreeNode(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)o; + Py_XDECREF(((PyObject *)p->tree)); + Py_XDECREF(p->children); + Py_XDECREF(((PyObject *)p->summary)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTreeNode(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)o; + if (p->tree) { + e = (*v)(((PyObject*)p->tree), a); if (e) return e; + } + if (p->children) { + e = (*v)(p->children, a); if (e) return e; + } + if (p->summary) { + e = (*v)(((PyObject*)p->summary), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTreeNode(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)o; + PyObject* tmp; + tmp = ((PyObject*)p->tree); + p->tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->children); + p->children = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->summary); + p->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeNode_summary(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeNode_summary(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeNode_start_offset(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeNode_start_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_12start_offset_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_ArrayTreeNode[] = { + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_1set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_2get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("build_summary"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_3build_summary)}, + {__Pyx_NAMESTR("to_file_data_pass"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_4to_file_data_pass, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_4to_file_data_pass)}, + {__Pyx_NAMESTR("to_file_offset_pass"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_5to_file_offset_pass, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_5to_file_offset_pass)}, + {__Pyx_NAMESTR("from_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_6from_file, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_13ArrayTreeNode_6from_file)}, + {__Pyx_NAMESTR("get_from_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7get_from_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6arrays_10array_tree_ArrayTreeNode[] = { + {(char *)"summary", __pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeNode_summary, __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeNode_summary, 0, 0}, + {(char *)"start_offset", __pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeNode_start_offset, __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeNode_start_offset, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ArrayTreeNode = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ArrayTreeNode = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ArrayTreeNode = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ArrayTreeNode = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_ArrayTreeNode = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.ArrayTreeNode"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ArrayTreeNode, /*tp_as_number*/ + &__pyx_tp_as_sequence_ArrayTreeNode, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ArrayTreeNode, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ArrayTreeNode, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Internal node of an ArrayTree. Contains summary data and pointers to\n subtrees.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_ArrayTreeNode, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_ArrayTreeLeaf(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)o); + p->tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)Py_None); Py_INCREF(Py_None); + p->values = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTreeLeaf(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)o; + Py_XDECREF(((PyObject *)p->tree)); + Py_XDECREF(((PyObject *)p->values)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTreeLeaf(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)o; + if (p->tree) { + e = (*v)(((PyObject*)p->tree), a); if (e) return e; + } + if (p->values) { + e = (*v)(((PyObject*)p->values), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTreeLeaf(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf *)o; + PyObject* tmp; + tmp = ((PyObject*)p->tree); + p->tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->values); + p->values = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_frequency(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_frequency(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_9frequency_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_values(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_values(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_6values_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_start_offset(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_start_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_12start_offset_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_ArrayTreeLeaf[] = { + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_1set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_2get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("to_file_data_pass"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_3to_file_data_pass, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("to_file_offset_pass"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_4to_file_offset_pass, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("from_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf_5from_file, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6arrays_10array_tree_ArrayTreeLeaf[] = { + {(char *)"frequency", __pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_frequency, __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_frequency, 0, 0}, + {(char *)"values", __pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_values, __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_values, 0, 0}, + {(char *)"start_offset", __pyx_getprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_start_offset, __pyx_setprop_2bx_6arrays_10array_tree_13ArrayTreeLeaf_start_offset, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ArrayTreeLeaf = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ArrayTreeLeaf = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ArrayTreeLeaf = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ArrayTreeLeaf = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_ArrayTreeLeaf = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.ArrayTreeLeaf"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ArrayTreeLeaf, /*tp_as_number*/ + &__pyx_tp_as_sequence_ArrayTreeLeaf, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ArrayTreeLeaf, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ArrayTreeLeaf, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Leaf node of an ArrayTree, contains data values.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeLeaf___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_ArrayTreeLeaf, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_6arrays_10array_tree_ArrayTree(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)o); + p->dtype = Py_None; Py_INCREF(Py_None); + p->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTree(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)o; + Py_XDECREF(p->dtype); + Py_XDECREF(((PyObject *)p->root)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTree(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)o; + if (p->dtype) { + e = (*v)(p->dtype, a); if (e) return e; + } + if (p->root) { + e = (*v)(((PyObject*)p->root), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTree(PyObject *o) { + struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *p = (struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)o; + PyObject* tmp; + tmp = ((PyObject*)p->dtype); + p->dtype = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->root); + p->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_2bx_6arrays_10array_tree_ArrayTree(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_2bx_6arrays_10array_tree_ArrayTree(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_1__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_max(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_max(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3max_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_block_size(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_block_size(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_10block_size_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_dtype(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_dtype(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5dtype_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_levels(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_levels(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6levels_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_no_leaves(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_no_leaves(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_9no_leaves_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_root(PyObject *o, void *x) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___get__(o); +} + +static int __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_root(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_1__set__(o, v); + } + else { + return __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root_2__del__(o); + } +} + +static PyMethodDef __pyx_methods_2bx_6arrays_10array_tree_ArrayTree[] = { + {__Pyx_NAMESTR("set_range"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_2set_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("to_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4to_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("from_file"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_5from_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("from_sequence"), (PyCFunction)__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_6from_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_6arrays_10array_tree_9ArrayTree_6from_sequence)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6arrays_10array_tree_ArrayTree[] = { + {(char *)"max", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_max, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_max, 0, 0}, + {(char *)"block_size", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_block_size, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_block_size, 0, 0}, + {(char *)"dtype", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_dtype, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_dtype, 0, 0}, + {(char *)"levels", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_levels, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_levels, 0, 0}, + {(char *)"no_leaves", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_no_leaves, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_no_leaves, 0, 0}, + {(char *)"root", __pyx_getprop_2bx_6arrays_10array_tree_9ArrayTree_root, __pyx_setprop_2bx_6arrays_10array_tree_9ArrayTree_root, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ArrayTree = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ArrayTree = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_6arrays_10array_tree_ArrayTree, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ArrayTree = { + 0, /*mp_length*/ + __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_3__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_2bx_6arrays_10array_tree_ArrayTree, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ArrayTree = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_10array_tree_ArrayTree = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.array_tree.ArrayTree"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_10array_tree_ArrayTree, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ArrayTree, /*tp_as_number*/ + &__pyx_tp_as_sequence_ArrayTree, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ArrayTree, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ArrayTree, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Stores a sparse array of data as a tree.\n \n An array of `self.max` values is stored in a tree in which each leaf\n contains `self.block_size` values and each internal node contains\n `self.block_size` children.\n \n Entirely empty subtrees are not stored. Thus, the storage is efficient for\n data that is block sparse -- having contiguous chunks of `self.block_size` or\n larger data. Currently it is not efficient if the data is strided (e.g.\n one or two data points in every interval of length `self.block_size`).\n \n Internal nodes store `Summary` instances for their subtrees. \n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_10array_tree_ArrayTree, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_10array_tree_ArrayTree, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_10array_tree_ArrayTree, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6arrays_10array_tree_ArrayTree, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_10array_tree_ArrayTree, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +char* __pyx_import_star_type_names[] = { + "ArrayTreeNode", + "FileArrayTree", + "FileArrayTreeDict", + "ArrayTreeLeaf", + "Summary", + "ArrayTree", + 0 +}; + +static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { + char** type_name = __pyx_import_star_type_names; + while (*type_name) { + if (__Pyx_StrEq(name, *type_name)) { + PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name); + goto bad; + } + type_name++; + } + if (0); + else { + if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad; + } + return 0; + bad: + return -1; +} + + +/* import_all_from is an unexposed function from ceval.c */ + +static int +__Pyx_import_all_from(PyObject *locals, PyObject *v) +{ + PyObject *all = __Pyx_GetAttrString(v, "__all__"); + PyObject *dict, *name, *value; + int skip_leading_underscores = 0; + int pos, err; + + if (all == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; /* Unexpected error */ + PyErr_Clear(); + dict = __Pyx_GetAttrString(v, "__dict__"); + if (dict == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; + PyErr_SetString(PyExc_ImportError, + "from-import-* object has no __dict__ and no __all__"); + return -1; + } +#if PY_MAJOR_VERSION < 3 + all = PyObject_CallMethod(dict, (char *)"keys", NULL); +#else + all = PyMapping_Keys(dict); +#endif + Py_DECREF(dict); + if (all == NULL) + return -1; + skip_leading_underscores = 1; + } + + for (pos = 0, err = 0; ; pos++) { + name = PySequence_GetItem(all, pos); + if (name == NULL) { + if (!PyErr_ExceptionMatches(PyExc_IndexError)) + err = -1; + else + PyErr_Clear(); + break; + } + if (skip_leading_underscores && +#if PY_MAJOR_VERSION < 3 + PyString_Check(name) && + PyString_AS_STRING(name)[0] == '_') +#else + PyUnicode_Check(name) && + PyUnicode_AS_UNICODE(name)[0] == '_') +#endif + { + Py_DECREF(name); + continue; + } + value = PyObject_GetAttr(v, name); + if (value == NULL) + err = -1; + else if (PyDict_CheckExact(locals)) + err = PyDict_SetItem(locals, name, value); + else + err = PyObject_SetItem(locals, name, value); + Py_DECREF(name); + Py_XDECREF(value); + if (err != 0) + break; + } + Py_DECREF(all); + return err; +} + + +static int __pyx_import_star(PyObject* m) { + + int i; + int ret = -1; + char* s; + PyObject *locals = 0; + PyObject *list = 0; +#if PY_MAJOR_VERSION >= 3 + PyObject *utf8_name = 0; +#endif + PyObject *name; + PyObject *item; + + locals = PyDict_New(); if (!locals) goto bad; + if (__Pyx_import_all_from(locals, m) < 0) goto bad; + list = PyDict_Items(locals); if (!list) goto bad; + + for(i=0; i= 3 + utf8_name = PyUnicode_AsUTF8String(name); + if (!utf8_name) goto bad; + s = PyBytes_AS_STRING(utf8_name); + if (__pyx_import_star_set(item, name, s) < 0) goto bad; + Py_DECREF(utf8_name); utf8_name = 0; +#else + s = PyString_AsString(name); + if (!s) goto bad; + if (__pyx_import_star_set(item, name, s) < 0) goto bad; +#endif + } + ret = 0; + +bad: + Py_XDECREF(locals); + Py_XDECREF(list); +#if PY_MAJOR_VERSION >= 3 + Py_XDECREF(utf8_name); +#endif + return ret; +} + + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("array_tree"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0}, + {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 1, 0, 0}, + {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0}, + {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0}, + {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, + {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0}, + {&__pyx_n_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 1}, + {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1}, + {&__pyx_n_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 1}, + {&__pyx_n_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 1}, + {&__pyx_n_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 1}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__ArrayTree, __pyx_k__ArrayTree, sizeof(__pyx_k__ArrayTree), 0, 0, 1, 1}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s__BinaryFileWriter, __pyx_k__BinaryFileWriter, sizeof(__pyx_k__BinaryFileWriter), 0, 0, 1, 1}, + {&__pyx_n_s__FileArrayTreeDict, __pyx_k__FileArrayTreeDict, sizeof(__pyx_k__FileArrayTreeDict), 0, 0, 1, 1}, + {&__pyx_n_s__FileCDBDict, __pyx_k__FileCDBDict, sizeof(__pyx_k__FileCDBDict), 0, 0, 1, 1}, + {&__pyx_n_s__L, __pyx_k__L, sizeof(__pyx_k__L), 0, 0, 1, 1}, + {&__pyx_n_s__MAGIC, __pyx_k__MAGIC, sizeof(__pyx_k__MAGIC), 0, 0, 1, 1}, + {&__pyx_n_s__NUM_SUMMARY_ARRAYS, __pyx_k__NUM_SUMMARY_ARRAYS, sizeof(__pyx_k__NUM_SUMMARY_ARRAYS), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__VERSION, __pyx_k__VERSION, sizeof(__pyx_k__VERSION), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__block_size, __pyx_k__block_size, sizeof(__pyx_k__block_size), 0, 0, 1, 1}, + {&__pyx_n_s__build_summary, __pyx_k__build_summary, sizeof(__pyx_k__build_summary), 0, 0, 1, 1}, + {&__pyx_n_s__char, __pyx_k__char, sizeof(__pyx_k__char), 0, 0, 1, 1}, + {&__pyx_n_s__counts, __pyx_k__counts, sizeof(__pyx_k__counts), 0, 0, 1, 1}, + {&__pyx_n_s__default_size, __pyx_k__default_size, sizeof(__pyx_k__default_size), 0, 0, 1, 1}, + {&__pyx_n_s__dict, __pyx_k__dict, sizeof(__pyx_k__dict), 0, 0, 1, 1}, + {&__pyx_n_s__dict_to_file, __pyx_k__dict_to_file, sizeof(__pyx_k__dict_to_file), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, + {&__pyx_n_s__frequencies, __pyx_k__frequencies, sizeof(__pyx_k__frequencies), 0, 0, 1, 1}, + {&__pyx_n_s__frequency, __pyx_k__frequency, sizeof(__pyx_k__frequency), 0, 0, 1, 1}, + {&__pyx_n_s__from_file, __pyx_k__from_file, sizeof(__pyx_k__from_file), 0, 0, 1, 1}, + {&__pyx_n_s__from_sequence, __pyx_k__from_sequence, sizeof(__pyx_k__from_sequence), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, + {&__pyx_n_s__io, __pyx_k__io, sizeof(__pyx_k__io), 0, 0, 1, 1}, + {&__pyx_n_s__is_little_endian, __pyx_k__is_little_endian, sizeof(__pyx_k__is_little_endian), 0, 0, 1, 1}, + {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1}, + {&__pyx_n_s__iterkeys, __pyx_k__iterkeys, sizeof(__pyx_k__iterkeys), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, + {&__pyx_n_s__maxs, __pyx_k__maxs, sizeof(__pyx_k__maxs), 0, 0, 1, 1}, + {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, + {&__pyx_n_s__mins, __pyx_k__mins, sizeof(__pyx_k__mins), 0, 0, 1, 1}, + {&__pyx_n_s__nan, __pyx_k__nan, sizeof(__pyx_k__nan), 0, 0, 1, 1}, + {&__pyx_n_s__nanmax, __pyx_k__nanmax, sizeof(__pyx_k__nanmax), 0, 0, 1, 1}, + {&__pyx_n_s__nanmin, __pyx_k__nanmin, sizeof(__pyx_k__nanmin), 0, 0, 1, 1}, + {&__pyx_n_s__nansum, __pyx_k__nansum, sizeof(__pyx_k__nansum), 0, 0, 1, 1}, + {&__pyx_n_s__no_leaves, __pyx_k__no_leaves, sizeof(__pyx_k__no_leaves), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_raw_array, __pyx_k__read_raw_array, sizeof(__pyx_k__read_raw_array), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint64, __pyx_k__read_uint64, sizeof(__pyx_k__read_uint64), 0, 0, 1, 1}, + {&__pyx_n_s__reader, __pyx_k__reader, sizeof(__pyx_k__reader), 0, 0, 1, 1}, + {&__pyx_n_s__root, __pyx_k__root, sizeof(__pyx_k__root), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__set, __pyx_k__set, sizeof(__pyx_k__set), 0, 0, 1, 1}, + {&__pyx_n_s__set_range, __pyx_k__set_range, sizeof(__pyx_k__set_range), 0, 0, 1, 1}, + {&__pyx_n_s__sizes, __pyx_k__sizes, sizeof(__pyx_k__sizes), 0, 0, 1, 1}, + {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__start_offset, __pyx_k__start_offset, sizeof(__pyx_k__start_offset), 0, 0, 1, 1}, + {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, + {&__pyx_n_s__summary, __pyx_k__summary, sizeof(__pyx_k__summary), 0, 0, 1, 1}, + {&__pyx_n_s__sums, __pyx_k__sums, sizeof(__pyx_k__sums), 0, 0, 1, 1}, + {&__pyx_n_s__sumsquares, __pyx_k__sumsquares, sizeof(__pyx_k__sumsquares), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {&__pyx_n_s__to_file, __pyx_k__to_file, sizeof(__pyx_k__to_file), 0, 0, 1, 1}, + {&__pyx_n_s__to_file_data_pass, __pyx_k__to_file_data_pass, sizeof(__pyx_k__to_file_data_pass), 0, 0, 1, 1}, + {&__pyx_n_s__to_file_offset_pass, __pyx_k__to_file_offset_pass, sizeof(__pyx_k__to_file_offset_pass), 0, 0, 1, 1}, + {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1}, + {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, + {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, + {&__pyx_n_s__write_raw_array, __pyx_k__write_raw_array, sizeof(__pyx_k__write_raw_array), 0, 0, 1, 1}, + {&__pyx_n_s__write_uint32, __pyx_k__write_uint32, sizeof(__pyx_k__write_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__write_uint64, __pyx_k__write_uint64, sizeof(__pyx_k__write_uint64), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_sum = __Pyx_GetName(__pyx_b, __pyx_n_s__sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/arrays/array_tree.pyx":108 + * cdb_dict = {} + * for key in dict.iterkeys(): + * cdb_dict[ key ] = io.pack( "L", 0 ) # <<<<<<<<<<<<<< + * cdb_offset = io.tell() + * FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + */ + __pyx_k_tuple_4 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__L)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__L)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__L)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "bx/arrays/array_tree.pyx":139 + * self.block_size = self.io.read_uint32() + * # Read dtype and canonicalize + * dt = self.io.read( 1 ) # <<<<<<<<<<<<<< + * self.dtype = numpy.dtype( dt ) + * self.io.skip( 3 ) + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "bx/arrays/array_tree.pyx":141 + * dt = self.io.read( 1 ) + * self.dtype = numpy.dtype( dt ) + * self.io.skip( 3 ) # <<<<<<<<<<<<<< + * # How many levels are needed to cover the entire range? + * self.levels = 0 + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "bx/arrays/array_tree.pyx":275 + * io.write_uint32( self.block_size ) + * io.write( self.dtype.char ) + * io.write( "\0\0\0" ) # <<<<<<<<<<<<<< + * # Data pass, level order + * if no_leaves: + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "bx/arrays/array_tree.pyx":292 + * max = io.read_uint32() + * block_size = io.read_uint32() + * dt = io.read( 1 ) # <<<<<<<<<<<<<< + * io.read( 3 ) + * tree = Class( max, block_size, dt ) + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "bx/arrays/array_tree.pyx":293 + * block_size = io.read_uint32() + * dt = io.read( 1 ) + * io.read( 3 ) # <<<<<<<<<<<<<< + * tree = Class( max, block_size, dt ) + * tree.root.from_file( io ) + */ + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "bx/arrays/array_tree.pyx":439 + * for child in self.children: + * if child is None: + * io.write_uint64( 0 ) # <<<<<<<<<<<<<< + * else: + * io.write_uint64( child.start_offset ) + */ + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_21)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_u_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_23)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_u_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_25)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_28)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_u_28)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_28)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_25)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_31)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_u_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1000 = PyInt_FromLong(1000); if (unlikely(!__pyx_int_1000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_823052252 = PyInt_FromLong(823052252); if (unlikely(!__pyx_int_823052252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2147483647 = PyInt_FromLong(2147483647); if (unlikely(!__pyx_int_2147483647)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initarray_tree(void); /*proto*/ +PyMODINIT_FUNC initarray_tree(void) +#else +PyMODINIT_FUNC PyInit_array_tree(void); /*proto*/ +PyMODINIT_FUNC PyInit_array_tree(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_array_tree(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("array_tree"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__arrays__array_tree) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_FileArrayTreeDict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FileArrayTreeDict", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_FileArrayTreeDict) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict = &__pyx_type_2bx_6arrays_10array_tree_FileArrayTreeDict; + __pyx_vtabptr_2bx_6arrays_10array_tree_FileArrayTree = &__pyx_vtable_2bx_6arrays_10array_tree_FileArrayTree; + __pyx_vtable_2bx_6arrays_10array_tree_FileArrayTree.r_seek_to_node = (int (*)(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *, int, int, PY_LONG_LONG, int, int))__pyx_f_2bx_6arrays_10array_tree_13FileArrayTree_r_seek_to_node; + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_FileArrayTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_6arrays_10array_tree_FileArrayTree.tp_dict, __pyx_vtabptr_2bx_6arrays_10array_tree_FileArrayTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FileArrayTree", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_FileArrayTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree = &__pyx_type_2bx_6arrays_10array_tree_FileArrayTree; + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_Summary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Summary", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_Summary) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_Summary = &__pyx_type_2bx_6arrays_10array_tree_Summary; + __pyx_vtabptr_2bx_6arrays_10array_tree_ArrayTreeNode = &__pyx_vtable_2bx_6arrays_10array_tree_ArrayTreeNode; + __pyx_vtable_2bx_6arrays_10array_tree_ArrayTreeNode.init_bin = (PyObject *(*)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int))__pyx_f_2bx_6arrays_10array_tree_13ArrayTreeNode_init_bin; + __pyx_vtable_2bx_6arrays_10array_tree_ArrayTreeNode.build_summary = (PyObject *(*)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int __pyx_skip_dispatch))__pyx_f_2bx_6arrays_10array_tree_13ArrayTreeNode_build_summary; + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_ArrayTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_6arrays_10array_tree_ArrayTreeNode.tp_dict, __pyx_vtabptr_2bx_6arrays_10array_tree_ArrayTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ArrayTreeNode", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_ArrayTreeNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode = &__pyx_type_2bx_6arrays_10array_tree_ArrayTreeNode; + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_ArrayTreeLeaf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ArrayTreeLeaf", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_ArrayTreeLeaf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf = &__pyx_type_2bx_6arrays_10array_tree_ArrayTreeLeaf; + if (PyType_Ready(&__pyx_type_2bx_6arrays_10array_tree_ArrayTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_2bx_6arrays_10array_tree_ArrayTree, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_2bx_6arrays_10array_tree_9ArrayTree___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_2bx_6arrays_10array_tree_9ArrayTree___init__.doc = __pyx_doc_2bx_6arrays_10array_tree_9ArrayTree___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_2bx_6arrays_10array_tree_9ArrayTree___init__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "ArrayTree", (PyObject *)&__pyx_type_2bx_6arrays_10array_tree_ArrayTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_10array_tree_ArrayTree = &__pyx_type_2bx_6arrays_10array_tree_ArrayTree; + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_6wiggle_WiggleReader = __Pyx_ImportType("bx.arrays.wiggle", "WiggleReader", sizeof(struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader), 1); if (unlikely(!__pyx_ptype_2bx_6arrays_6wiggle_WiggleReader)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/arrays/array_tree.pyx":3 + * from __future__ import division + * + * __all__ = [ 'ArrayTree', 'FileArrayTreeDict', 'array_tree_dict_from_reader' ] # <<<<<<<<<<<<<< + * + * import numpy + */ + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ArrayTree)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__ArrayTree)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ArrayTree)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FileArrayTreeDict)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__FileArrayTreeDict)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FileArrayTreeDict)); + __Pyx_INCREF(((PyObject *)__pyx_n_s_33)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s_33)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_33)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":5 + * __all__ = [ 'ArrayTree', 'FileArrayTreeDict', 'array_tree_dict_from_reader' ] + * + * import numpy # <<<<<<<<<<<<<< + * from numpy import * + * cimport numpy + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":6 + * + * import numpy + * from numpy import * # <<<<<<<<<<<<<< + * cimport numpy + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s_34)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_34)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":11 + * cimport bx.arrays.wiggle + * + * from bx.misc.binary_file import BinaryFileWriter, BinaryFileReader # <<<<<<<<<<<<<< + * from bx.misc.cdb import FileCDBDict + * + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileWriter)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__BinaryFileWriter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileWriter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_35), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BinaryFileWriter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileWriter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":12 + * + * from bx.misc.binary_file import BinaryFileWriter, BinaryFileReader + * from bx.misc.cdb import FileCDBDict # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FileCDBDict)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__FileCDBDict)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FileCDBDict)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_36), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__FileCDBDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FileCDBDict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":58 + * ## - Compression for blocks? + * + * MAGIC = 0x310ec7dc # <<<<<<<<<<<<<< + * VERSION = 1 + * NUM_SUMMARY_ARRAYS = 6 + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MAGIC, __pyx_int_823052252) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":59 + * + * MAGIC = 0x310ec7dc + * VERSION = 1 # <<<<<<<<<<<<<< + * NUM_SUMMARY_ARRAYS = 6 + * + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VERSION, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":60 + * MAGIC = 0x310ec7dc + * VERSION = 1 + * NUM_SUMMARY_ARRAYS = 6 # <<<<<<<<<<<<<< + * + * def array_tree_dict_from_reader( reader, sizes, default_size=2147483647, block_size=1000, no_leaves=False ): + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NUM_SUMMARY_ARRAYS, __pyx_int_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/arrays/array_tree.pyx":62 + * NUM_SUMMARY_ARRAYS = 6 + * + * def array_tree_dict_from_reader( reader, sizes, default_size=2147483647, block_size=1000, no_leaves=False ): # <<<<<<<<<<<<<< + * # Create empty array trees + * rval = {} + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_1 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2bx_6arrays_10array_tree_array_tree_dict_from_reader, NULL, __pyx_n_s_37); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_33, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":96 + * + * @classmethod + * def dict_to_file( Class, dict, file, is_little_endian=True, no_leaves=False ): # <<<<<<<<<<<<<< + * """ + * Writes a dictionary of array trees to a file that can then be + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_2 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_k_3 = __pyx_t_2; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/arrays/array_tree.pyx":95 + * return FileArrayTree( self.io.file, self.io.is_little_endian ) + * + * @classmethod # <<<<<<<<<<<<<< + * def dict_to_file( Class, dict, file, is_little_endian=True, no_leaves=False ): + * """ + */ + __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict, __pyx_n_s__dict_to_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict->tp_dict, __pyx_n_s__dict_to_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict); + + /* "bx/arrays/array_tree.pyx":132 + * cdef object io + * + * def __init__( self, file, is_little_endian=True ): # <<<<<<<<<<<<<< + * self.io = BinaryFileReader( file, is_little_endian=is_little_endian ) + * self.offset = self.io.tell() + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_5 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":241 + * cdef public ArrayTreeNode root + * + * def __init__( self, int max, int block_size, dtype=float32, no_leaves=False ): # <<<<<<<<<<<<<< + * """ + * Create a new array tree of size `max` + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_10 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_11 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":269 + * return self.root.get( index ) + * + * def to_file( self, f, is_little_endian=True, no_leaves=False ): # <<<<<<<<<<<<<< + * io = BinaryFileWriter( f, is_little_endian=is_little_endian ) + * ## io.write_uint32( VERSION ) + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_12 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_13 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":287 + * + * @classmethod + * def from_file( Class, f, is_little_endian=True ): # <<<<<<<<<<<<<< + * io = BinaryFileReader( f, is_little_endian=is_little_endian ) + * ## assert io.read_uint32() == VERSION + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_16 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/arrays/array_tree.pyx":286 + * self.root.to_file_offset_pass( io ) + * + * @classmethod # <<<<<<<<<<<<<< + * def from_file( Class, f, is_little_endian=True ): + * io = BinaryFileReader( f, is_little_endian=is_little_endian ) + */ + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree, __pyx_n_s__from_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree->tp_dict, __pyx_n_s__from_file, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree); + + /* "bx/arrays/array_tree.pyx":299 + * + * @classmethod + * def from_sequence( Class, s, block_size=1000 ): # <<<<<<<<<<<<<< + * """ + * Build an ArrayTree from a sequence like object (must have at least + */ + __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree, __pyx_n_s__from_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree->tp_dict, __pyx_n_s__from_sequence, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree); + + /* "bx/arrays/array_tree.pyx":1 + * from __future__ import division # <<<<<<<<<<<<<< + * + * __all__ = [ 'ArrayTree', 'FileArrayTreeDict', 'array_tree_dict_from_reader' ] + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.arrays.array_tree", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.arrays.array_tree"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE int __Pyx_div_int(int a, int b) { + int q = a / b; + int r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { + /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */ + static PyTypeObject *methoddescr_type = NULL; + if (methoddescr_type == NULL) { + PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append"); + if (!meth) return NULL; + methoddescr_type = Py_TYPE(meth); + Py_DECREF(meth); + } + if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */ + PyMethodDescrObject *descr = (PyMethodDescrObject *)method; + #if PY_VERSION_HEX < 0x03020000 + PyTypeObject *d_type = descr->d_type; + #else + PyTypeObject *d_type = descr->d_common.d_type; + #endif + return PyDescr_NewClassMethod(d_type, descr->d_method); + } + else if (PyMethod_Check(method)) { /* python classes */ + return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); + } + else if (PyCFunction_Check(method)) { + return PyClassMethod_New(method); + } +#ifdef __pyx_binding_PyCFunctionType_USED + else if (PyObject_TypeCheck(method, __pyx_binding_PyCFunctionType)) { /* binded CFunction */ + return PyClassMethod_New(method); + } +#endif + PyErr_Format(PyExc_TypeError, + "Class-level classmethod() can only be called on " + "a method_descriptor or instance method."); + return NULL; +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_pow_PY_LONG_LONG(PY_LONG_LONG b, PY_LONG_LONG e) { + PY_LONG_LONG t = b; + switch (e) { + case 3: + t *= b; + case 2: + t *= b; + case 1: + return t; + case 0: + return 1; + } + if (unlikely(e<0)) return 0; + t = 1; + while (likely(e)) { + t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ + b *= b; + e >>= 1; + } + return t; +} + +static CYTHON_INLINE int __Pyx_pow_int(int b, int e) { + int t = b; + switch (e) { + case 3: + t *= b; + case 2: + t *= b; + case 1: + return t; + case 0: + return 1; + } + if (unlikely(e<0)) return 0; + t = 1; + while (likely(e)) { + t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ + b *= b; + e >>= 1; + } + return t; +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) { + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + return *s1 == *s2; +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.pyx b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.pyx new file mode 100755 index 0000000..89de0fd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree.pyx @@ -0,0 +1,514 @@ +from __future__ import division + +__all__ = [ 'ArrayTree', 'FileArrayTreeDict', 'array_tree_dict_from_reader' ] + +import numpy +from numpy import * +cimport numpy + +cimport bx.arrays.wiggle + +from bx.misc.binary_file import BinaryFileWriter, BinaryFileReader +from bx.misc.cdb import FileCDBDict + +""" +Classes for storing binary data on disk in a tree structure that allows for +efficient sparse storage (when the data occurs in contiguous blocks), fast +access to a specific block of data, and fast access to summaries at different +resolutions. + +On disk format +-------------- + +Blocks are stored contiguously on disk in level-order. Contents should always be +network byte order (big endian), however this implementation will byte-swap when +reading if necessary. File contents: + +- magic: uint32 +- version: unit32 +- array size: uint32 +- block size: uint32 +- array type: 4 chars (numpy typecode, currently only simple types represented by one char are supported) + +- Internal nodes in level order + - Summary + - count of valid values in each subtree : sizeof( dtype ) * block_size + - frequencies: sizeof ( int32 ) * block_size + - min of valid values in each subtree : sizeof( dtype ) * block_size + - max of valid values in each subtree : sizeof( dtype ) * block_size + - sum of valid values in each subtree : sizeof( dtype ) * block_size + - sum of squares of valid values in each subtree : sizeof( dtype ) * block_size + - File offsets of each child node: uint64 * block_size + +- Leaf nodes + - data points: sizeof( dtype ) * block_size + +- Version 1 reads version 0 and version 1 + +""" + +## Enhancement ideas: +## +## - Write markers of the number of blocks skipped between blocks. This would +## allow fast striding across data or summaries (use the indexes to get to +## the start of a block, then just read straight through). Would this help? +## +## - Compression for blocks? + +MAGIC = 0x310ec7dc +VERSION = 1 +NUM_SUMMARY_ARRAYS = 6 + +def array_tree_dict_from_reader( reader, sizes, default_size=2147483647, block_size=1000, no_leaves=False ): + # Create empty array trees + rval = {} + ## for key, size in sizes.iteritems(): + ## rval[ key ] = ArrayTree( size, 1000 ) + # Fill + last_chrom = None + last_array_tree = None + for chrom, start, end, _, val in reader: + if chrom != last_chrom: + if chrom not in rval: + rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size, no_leaves=no_leaves ) + last_array_tree = rval[chrom] + last_array_tree.set_range( start, end, val ) + return rval + + +cdef class FileArrayTreeDict: + """ + Access to a file containing multiple array trees indexed by a string key. + """ + cdef object io + cdef object cdb_dict + def __init__( self, file ): + self.io = io = BinaryFileReader( file, MAGIC ) + assert (0 <= io.read_uint32() <= 1) # Check for version 0 or 1 + self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian ) + def __getitem__( self, key ): + offset = self.cdb_dict[key] + offset = self.io.unpack( "L", offset )[0] + self.io.seek( offset ) + return FileArrayTree( self.io.file, self.io.is_little_endian ) + + @classmethod + def dict_to_file( Class, dict, file, is_little_endian=True, no_leaves=False ): + """ + Writes a dictionary of array trees to a file that can then be + read efficiently using this class. + """ + io = BinaryFileWriter( file, is_little_endian=is_little_endian ) + # Write magic number and version + io.write_uint32( MAGIC ) + io.write_uint32( VERSION ) + # Write cdb index with fake values just to fill space + cdb_dict = {} + for key in dict.iterkeys(): + cdb_dict[ key ] = io.pack( "L", 0 ) + cdb_offset = io.tell() + FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + # Write each tree and save offset + for key, value in dict.iteritems(): + offset = io.tell() + cdb_dict[ key ] = io.pack( "L", offset ) + value.to_file( file, is_little_endian=is_little_endian, no_leaves=no_leaves ) + # Go back and write the index again + io.seek( cdb_offset ) + FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian ) + +cdef class FileArrayTree: + """ + Wrapper for ArrayTree stored in file that reads as little as possible + """ + cdef public int max + cdef public int block_size + cdef public object dtype + cdef public int levels + cdef public int offset + cdef public int root_offset + cdef object io + + def __init__( self, file, is_little_endian=True ): + self.io = BinaryFileReader( file, is_little_endian=is_little_endian ) + self.offset = self.io.tell() + # Read basic info about the tree + self.max = self.io.read_uint32() + self.block_size = self.io.read_uint32() + # Read dtype and canonicalize + dt = self.io.read( 1 ) + self.dtype = numpy.dtype( dt ) + self.io.skip( 3 ) + # How many levels are needed to cover the entire range? + self.levels = 0 + while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + self.levels += 1 + # Not yet dealing with the case where the root is a Leaf + assert self.levels > 0, "max < block_size not yet handled" + # Save offset of root + self.root_offset = self.io.tell() + + def __getitem__( self, index ): + min = self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) + if min < 0: + return nan + self.io.skip( self.dtype.itemsize * ( index - min ) ) + return self.io.read_raw_array( self.dtype, 1 )[0] + + def get_summary( self, index, level ): + if level <= 0 or level > self.levels: + raise ValueError, "level must be <= self.levels" + if self.r_seek_to_node( index, 0, self.root_offset, self.levels, level ) < 0: + return None + # Read summary arrays + s = Summary() + s.counts = self.io.read_raw_array( self.dtype, self.block_size ) + s.frequencies = self.io.read_raw_array( self.dtype, self.block_size ) + s.sums = self.io.read_raw_array( self.dtype, self.block_size ) + s.mins = self.io.read_raw_array( self.dtype, self.block_size) + s.maxs = self.io.read_raw_array( self.dtype, self.block_size ) + s.sumsquares = self.io.read_raw_array( self.dtype, self.block_size ) + return s + + def get_leaf( self, index ): + if self.r_seek_to_node( index, 0, self.root_offset, self.levels, 0 ) < 0: + return [] + return self.io.read_raw_array( self.dtype, self.block_size ) + + cdef int r_seek_to_node( self, int index, int min, long long offset, int level, int desired_level ): + """ + Seek to the start of the node at `desired_level` that contains `index`. + Returns the minimum value represented in that node. + """ + cdef int child_size, bin_index, child_min + self.io.seek( offset ) + if level > desired_level: + child_size = self.block_size ** level + bin_index = ( index - min ) // ( child_size ) + child_min = min + ( bin_index * child_size ) + # Skip summary arrays -- # arrays * itemsize * block_size + self.io.skip( NUM_SUMMARY_ARRAYS * self.dtype.itemsize * self.block_size ) + # Skip to offset of correct child -- offsets are 8 bytes + self.io.skip( 8 * bin_index ) + # Read offset of child + child_offset = self.io.read_uint64() + # print "co: %s\tbi: %s\tcm: %s\n" % (child_offset, bin_index, child_min) + if child_offset == 0: + return -1 + return self.r_seek_to_node( index, child_min, child_offset, level - 1, desired_level ) + else: + # The file pointer is at the start of the desired node, do nothing + return min + +cdef class Summary: + """ + Summary for a non-leaf level of the tree, contains arrays of the min, max, + valid count, sum, and sum-of-squares for each child. + """ + cdef public object counts + cdef public object frequencies + cdef public object mins + cdef public object maxs + cdef public object sums + cdef public object sumsquares + +cdef class ArrayTreeNode +cdef class ArrayTreeLeaf + +cdef class ArrayTree: + """ + Stores a sparse array of data as a tree. + + An array of `self.max` values is stored in a tree in which each leaf + contains `self.block_size` values and each internal node contains + `self.block_size` children. + + Entirely empty subtrees are not stored. Thus, the storage is efficient for + data that is block sparse -- having contiguous chunks of `self.block_size` or + larger data. Currently it is not efficient if the data is strided (e.g. + one or two data points in every interval of length `self.block_size`). + + Internal nodes store `Summary` instances for their subtrees. + """ + + cdef public int max + cdef public int block_size + cdef public object dtype + cdef public int levels + cdef public int no_leaves + cdef public ArrayTreeNode root + + def __init__( self, int max, int block_size, dtype=float32, no_leaves=False ): + """ + Create a new array tree of size `max` + """ + self.max = max + self.block_size = block_size + self.no_leaves = no_leaves + # Force the dtype argument to its canonical dtype object + self.dtype = numpy.dtype( dtype ) + # How many levels are needed to cover the entire range? + self.levels = 0 + while ( self.block_size ) ** ( self.levels + 1 ) < self.max: + self.levels += 1 + # Not yet dealing with the case where the root is a Leaf + assert self.levels > 0, "max < block_size not yet handled" + # Create the root node` + self.root = ArrayTreeNode( self, 0, max, block_size, self.levels ) + + def __setitem__( self, int index, value ): + self.root.set( index, value ) + + def set_range( self, int start, int end, value ): + for i from start <= i < end: + self.root.set( i, value ) + + def __getitem__( self, int index ): + return self.root.get( index ) + + def to_file( self, f, is_little_endian=True, no_leaves=False ): + io = BinaryFileWriter( f, is_little_endian=is_little_endian ) + ## io.write_uint32( VERSION ) + io.write_uint32( self.max ) + io.write_uint32( self.block_size ) + io.write( self.dtype.char ) + io.write( "\0\0\0" ) + # Data pass, level order + if no_leaves: + bottom_level = 0 + else: + bottom_level = -1 + for level in range( self.levels, bottom_level, -1 ): + self.root.to_file_data_pass( io, level ) + # Offset pass to fix up indexes + self.root.to_file_offset_pass( io ) + + @classmethod + def from_file( Class, f, is_little_endian=True ): + io = BinaryFileReader( f, is_little_endian=is_little_endian ) + ## assert io.read_uint32() == VERSION + max = io.read_uint32() + block_size = io.read_uint32() + dt = io.read( 1 ) + io.read( 3 ) + tree = Class( max, block_size, dt ) + tree.root.from_file( io ) + return tree + + @classmethod + def from_sequence( Class, s, block_size=1000 ): + """ + Build an ArrayTree from a sequence like object (must have at least + length and getitem). + """ + tree = Class( len( s ), block_size ) + for i in range( len( s ) ): + tree[i] = s[i] + return tree + +cdef class ArrayTreeNode: + """ + Internal node of an ArrayTree. Contains summary data and pointers to + subtrees. + """ + + cdef ArrayTree tree + cdef int min + cdef int max + cdef int block_size + cdef int level + cdef int child_size + cdef object children + cdef public Summary summary + cdef public long start_offset + + def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ): + self.tree = tree + self.min = min + self.max = max + self.block_size = block_size + self.level = level + # Each of my children represents block_size ** level values + self.child_size = self.block_size ** self.level + self.children = [None] * self.block_size + self.summary = None + self.start_offset = 0 + + cdef inline init_bin( self, int index ): + cdef int min = self.min + ( index * self.child_size ) + cdef int max = min + self.child_size + if self.level == 1: + self.children[ index ] = ArrayTreeLeaf( self.tree, min, max ) + else: + self.children[ index ] = ArrayTreeNode( self.tree, min, max, self.block_size, self.level - 1 ) + + def set( self, int index, value ): + cdef int bin_index = ( index - self.min ) // ( self.child_size ) + if self.children[ bin_index ] is None: + self.init_bin( bin_index ) + self.children[ bin_index ].set( index, value ) + + def get( self, int index ): + cdef int bin_index = ( index - self.min ) // ( self.child_size ) + if self.children[ bin_index ] is None: + return nan + else: + return self.children[ bin_index ].get( index ) + + cpdef build_summary( self ): + """ + Build summary of children. + """ + counts = empty( self.tree.block_size, self.tree.dtype ) + frequencies = empty( self.tree.block_size, self.tree.dtype ) + mins = empty( self.tree.block_size, self.tree.dtype ) + maxs = empty( self.tree.block_size, self.tree.dtype ) + sums = empty( self.tree.block_size, self.tree.dtype ) + sumsquares = empty( self.tree.block_size, self.tree.dtype ) + for i in range( len( self.children ) ): + if self.children[i]: + if self.level == 1: + v = self.children[i].values + counts[i] = sum( ~isnan( v ) ) + frequencies[i] = self.children[i].frequency + mins[i] = nanmin( v ) + maxs[i] = nanmax( v ) + sums[i] = nansum( v ) + sumsquares[i] = nansum( v ** 2 ) + else: + c = self.children[i] + c.build_summary() + counts[i] = sum( c.summary.counts ) + frequencies[i] = sum( c.summary.frequencies ) + mins[i] = nanmin( c.summary.mins ) + maxs[i] = nanmax( c.summary.maxs ) + sums[i] = nansum( c.summary.sums ) + sumsquares[i] = nansum( c.summary.sumsquares ) + else: + counts[i] = 0 + frequencies[i] = 0 + mins[i] = nan + maxs[i] = nan + sums[i] = nan + sumsquares[i] = nan + s = Summary() + s.counts = counts + s.frequencies = frequencies + s.mins = mins + s.maxs = maxs + s.sums = sums + s.sumsquares = sumsquares + self.summary = s + + def to_file_data_pass( self, io, level ): + """ + First pass of writing to file, writes data and saves position of block. + """ + assert self.summary, "Writing without summaries is currently not supported" + # If we are at the current level being written, write a block + if self.level == level: + # Save file offset where this block starts + self.start_offset = io.tell() + # Write out summary data + io.write_raw_array( self.summary.counts ) + io.write_raw_array( self.summary.frequencies ) + io.write_raw_array( self.summary.sums ) + io.write_raw_array( self.summary.mins ) + io.write_raw_array( self.summary.maxs ) + io.write_raw_array( self.summary.sumsquares ) + # Skip enough room for child offsets (block_size children * 64bits) + io.skip( self.tree.block_size * 8 ) + # Must be writing a lower level, so recurse + else: + # Write all non-empty children + for i in range( len( self.children ) ): + if self.children[i] is not None: + self.children[i].to_file_data_pass( io, level ) + + def to_file_offset_pass( self, io ): + """ + Second pass of writing to file, seek to appropriate position and write + offsets of children. + """ + # Seek to location of child offfsets (skip over # summary arrays) + skip_amount = NUM_SUMMARY_ARRAYS * self.tree.dtype.itemsize * self.block_size + io.seek( self.start_offset + skip_amount ) + # Write the file offset of each child into the index + for child in self.children: + if child is None: + io.write_uint64( 0 ) + else: + io.write_uint64( child.start_offset ) + # Recursively write offsets in child nodes + for child in self.children: + if child is not None: + child.to_file_offset_pass( io ) + + def from_file( self, io ): + """ + Load entire summary and all children into memory. + """ + dtype = self.tree.dtype + block_size = self.tree.block_size + # Read summary arrays + s = Summary() + s.counts = io.read_raw_array( dtype, block_size ) + s.frequencies = io.read_raw_array( int32, block_size ) + s.sums = io.read_raw_array( dtype, block_size ) + s.mins = io.read_raw_array( dtype, block_size) + s.maxs = io.read_raw_array( dtype, block_size ) + s.sumsquares = io.read_raw_array( dtype, block_size ) + self.summary = s + # Read offset of all children + child_offsets = [ io.read_uint64() for i in range( block_size ) ] + for i in range( block_size ): + if child_offsets[i] > 0: + self.init_bin( i ) + io.seek( child_offsets[i] ) + self.children[i].from_file( io ) + + def get_from_file( self, io, index ): + cdef int bin_index = ( index - self.min ) //( self.child_size ) + if self.children[ bin_index ] is None: + return nan + else: + return self.children[ bin_index ].get( index ) + +cdef class ArrayTreeLeaf: + """ + Leaf node of an ArrayTree, contains data values. + """ + + cdef ArrayTree tree + cdef int min + cdef int max + cdef public int frequency + cdef public numpy.ndarray values + cdef public long start_offset + + def __init__( self, ArrayTree tree, int min, int max ): + self.tree = tree + self.min = min + self.max = max + self.frequency = 0 + self.values = empty( max - min, self.tree.dtype ) + self.values[:] = nan + self.start_offset = 0 + + def set( self, index, value ): + self.frequency += 1 + self.values[ index - self.min ] = value + + def get( self, index ): + return self.values[ index - self.min ] + + def to_file_data_pass( self, io, level ): + assert level == 0 + self.start_offset = io.tell() + io.write_raw_array( self.values ) + + def to_file_offset_pass( self, io ): + pass + + def from_file( self, io ): + self.values = io.read_raw_array( self.tree.dtype, self.tree.block_size ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree_tests.py new file mode 100755 index 0000000..698df25 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/array_tree_tests.py @@ -0,0 +1,117 @@ +import sys, os +import unittest +import tempfile +try: + sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +except: + sys.path.insert(0, os.path.dirname(os.path.abspath("."))) + +from bx.arrays.array_tree import ArrayTree, FileArrayTree, FileArrayTreeDict, array_tree_dict_from_reader +from bx.arrays.bed import BedReader +from bx.arrays.wiggle import WiggleReader + +class TestArrayTree(unittest.TestCase): + def setUp(self): + tree = ArrayTree(10000, 10) # max value of 10000, each block has 10 numbers + for i in range(5000): + tree[i] = i + + # Insert extra copies to test frequency + for i in range(3000): + tree[i] = i + + tree.set_range(5000, 9001, 100) + tree.root.build_summary() + + d = {'test': tree} + f = tempfile.TemporaryFile() + FileArrayTreeDict.dict_to_file( d, f ) + f.seek(0) + self.filearraytreedict = FileArrayTreeDict(f) + self.filearraytree = self.filearraytreedict['test'] + + def test_get_summary(self): + f = self.filearraytree + lvl1 = f.get_summary(0, 1) + self.assertEqual( map(float, lvl1.sums/lvl1.counts), [4.5, 14.5, 24.5, 34.5, 44.5, 54.5, 64.5, 74.5, 84.5, 94.5]) + lvl2 = f.get_summary(0, 2) + self.assertEqual( map(float, lvl2.sums/lvl2.counts), [49.5, 149.5, 249.5, 349.5, 449.5, 549.5, 649.5, 749.5, 849.5, 949.5]) + lvl3 = f.get_summary(0, 3) + self.assertEqual( map(float, lvl3.sums/lvl3.counts), [499.5, 1499.5, 2499.5, 3499.5, 4499.5, 100.0, 100.0, 100.0, 100.0, 100.0]) + lvl2_2 = f.get_summary(3000, 2) + self.assertEqual( map(float, lvl2_2.sums/lvl2_2.counts), [3049.5, 3149.5, 3249.5, 3349.5, 3449.5, 3549.5, 3649.5, 3749.5, 3849.5, 3949.5]) + + def test_get_leaf(self): + f = self.filearraytree + from_start = [int(i) for i in f.get_leaf(0)] + from_middle = [int(i) for i in f.get_leaf(5)] + self.assertEqual(from_start, from_middle) + self.assertEqual(from_start, range(10)) + + from_start = [int(i) for i in f.get_leaf(4999)] + self.assertEqual(from_start, range(4990, 5000)) + + from_start = [int(i) for i in f.get_leaf(9600)] + self.assertEqual(from_start, []) + + def test_big(self): + tree = ArrayTree(2147483647, 1000) # What we use for tracks + for i in range(5000): + tree[i] = i + + # Insert extra copies to test frequency + for i in range(3000): + tree[i] = i + + tree.set_range(5000, 9001, 100) + tree.set_range(14000000, 15000000, 200) + tree.root.build_summary() + + d = {'test': tree} + f = tempfile.TemporaryFile() + FileArrayTreeDict.dict_to_file( d, f ) + f.seek(0) + at = FileArrayTreeDict(f)['test'] + + lvl1 = at.get_summary(14000000, 1) + avgs = map(float, lvl1.sums/lvl1.counts) + self.assertEqual( len(avgs), 1000 ) + self.assertEqual( avgs, [ 200 for i in range(0, 1000)] ) + + +# def create_bed(self): +# reader = BedReader( open( "22.bed.txt" ) ) +# temp = tempfile.TemporaryFile() +# +# d = array_tree_dict_from_reader( reader, {}, block_size = 1000 ) +# +# for array_tree in d.itervalues(): +# array_tree.root.build_summary() +# +# FileArrayTreeDict.dict_to_file( d, open("tree.at", "w"), no_leaves=True ) # just summaries +# +# def test_bed(self): +# # self.create_bed() +# print "bed" +# at = FileArrayTreeDict( open( "tree.at" ) )['chr22'] +# print map(, at.get_summary(14000000, 1).frequencies) + + + def test_get_frequencies(self): + f = self.filearraytree + self.assertEqual( map(float, f.get_summary(0, 1).frequencies), ([20] * 10) ) + self.assertEqual( map(float, f.get_summary(4000, 1).frequencies), ([10] * 10) ) + self.assertEqual( map(float, f.get_summary(0, 2).frequencies), ([200] * 10) ) + self.assertEqual( map(int, f.get_summary(0, 3).frequencies), [2000, 2000, 2000, 1000, 1000, 1000, 1000, 1000, 1000, 1] ) + + def test_wrong_dictkey(self): + self.assertRaises(KeyError, self.filearraytreedict.__getitem__, "non-existing") + + def test_higher_level_than_tree(self): + f = self.filearraytree + self.assertEqual(3, f.levels) + self.assertRaises(ValueError, f.get_summary, 0, 4) + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.c b/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.c new file mode 100755 index 0000000..2dd61e6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.c @@ -0,0 +1,2435 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:11 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__arrays__bed +#define __PYX_HAVE_API__bx__arrays__bed +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "bed.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_6arrays_3bed_BedReader; + +/* "bx/arrays/bed.pyx":6 + * """ + * + * cdef class BedReader: # <<<<<<<<<<<<<< + * cdef object f + * def __init__( self, f ): + */ +struct __pyx_obj_2bx_6arrays_3bed_BedReader { + PyObject_HEAD + PyObject *f; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.arrays.bed' */ +static PyTypeObject *__pyx_ptype_2bx_6arrays_3bed_BedReader = 0; +#define __Pyx_MODULE_NAME "bx.arrays.bed" +int __pyx_module_is_main_bx__arrays__bed = 0; + +/* Implementation of 'bx.arrays.bed' */ +static PyObject *__pyx_builtin_StopIteration; +static char __pyx_k_1[] = "#"; +static char __pyx_k_4[] = "Unexpected input line: %s"; +static char __pyx_k_5[] = "\nIterator for the BED format ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 )\nReturns chrom, chromStart, chromEnd, name, score\n"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__strip[] = "strip"; +static char __pyx_k__track[] = "track"; +static char __pyx_k__browser[] = "browser"; +static char __pyx_k__isalpha[] = "isalpha"; +static char __pyx_k__isspace[] = "isspace"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__readline[] = "readline"; +static char __pyx_k__startswith[] = "startswith"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__browser; +static PyObject *__pyx_n_s__f; +static PyObject *__pyx_n_s__isalpha; +static PyObject *__pyx_n_s__isspace; +static PyObject *__pyx_n_s__readline; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__startswith; +static PyObject *__pyx_n_s__strip; +static PyObject *__pyx_n_s__track; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_3; + +/* "bx/arrays/bed.pyx":8 + * cdef class BedReader: + * cdef object f + * def __init__( self, f ): # <<<<<<<<<<<<<< + * self.f = f + * + */ + +static int __pyx_pf_2bx_6arrays_3bed_9BedReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_3bed_9BedReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_f = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_f = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.bed.BedReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/bed.pyx":9 + * cdef object f + * def __init__( self, f ): + * self.f = f # <<<<<<<<<<<<<< + * + * def __iter__( self ): + */ + __Pyx_INCREF(__pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self)->f); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self)->f); + ((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self)->f = __pyx_v_f; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/bed.pyx":11 + * self.f = f + * + * def __iter__( self ): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__"); + + /* "bx/arrays/bed.pyx":12 + * + * def __iter__( self ): + * return self # <<<<<<<<<<<<<< + * + * def __next__( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/bed.pyx":14 + * return self + * + * def __next__( self ): # <<<<<<<<<<<<<< + * while True: + * line = self.f.readline() + */ + +static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_2__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_3bed_9BedReader_2__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_feature = NULL; + PyObject *__pyx_v_chrom = NULL; + PyObject *__pyx_v_chrom_start = NULL; + PyObject *__pyx_v_chrom_end = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_score = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__"); + + /* "bx/arrays/bed.pyx":15 + * + * def __next__( self ): + * while True: # <<<<<<<<<<<<<< + * line = self.f.readline() + * if not line: + */ + while (1) { + if (!1) break; + + /* "bx/arrays/bed.pyx":16 + * def __next__( self ): + * while True: + * line = self.f.readline() # <<<<<<<<<<<<<< + * if not line: + * raise StopIteration() + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)__pyx_v_self)->f, __pyx_n_s__readline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/bed.pyx":17 + * while True: + * line = self.f.readline() + * if not line: # <<<<<<<<<<<<<< + * raise StopIteration() + * if line.isspace(): + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "bx/arrays/bed.pyx":18 + * line = self.f.readline() + * if not line: + * raise StopIteration() # <<<<<<<<<<<<<< + * if line.isspace(): + * continue + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/arrays/bed.pyx":19 + * if not line: + * raise StopIteration() + * if line.isspace(): # <<<<<<<<<<<<<< + * continue + * if line[0] == "#": + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__isspace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/bed.pyx":20 + * raise StopIteration() + * if line.isspace(): + * continue # <<<<<<<<<<<<<< + * if line[0] == "#": + * continue + */ + goto __pyx_L5_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/arrays/bed.pyx":21 + * if line.isspace(): + * continue + * if line[0] == "#": # <<<<<<<<<<<<<< + * continue + * if line[0].isalpha(): + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/bed.pyx":22 + * continue + * if line[0] == "#": + * continue # <<<<<<<<<<<<<< + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): + */ + goto __pyx_L5_continue; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/arrays/bed.pyx":23 + * if line[0] == "#": + * continue + * if line[0].isalpha(): # <<<<<<<<<<<<<< + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isalpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/bed.pyx":24 + * continue + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + if (__pyx_t_5) { + + /* "bx/arrays/bed.pyx":25 + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue # <<<<<<<<<<<<<< + * + * feature = line.strip().split() + */ + goto __pyx_L5_continue; + goto __pyx_L11; + } + __pyx_L11:; + + /* "bx/arrays/bed.pyx":27 + * continue + * + * feature = line.strip().split() # <<<<<<<<<<<<<< + * chrom = feature[0] + * chrom_start = int(feature[1]) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_feature = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/bed.pyx":28 + * + * feature = line.strip().split() + * chrom = feature[0] # <<<<<<<<<<<<<< + * chrom_start = int(feature[1]) + * chrom_end = int(feature[2]) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_chrom = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/bed.pyx":29 + * feature = line.strip().split() + * chrom = feature[0] + * chrom_start = int(feature[1]) # <<<<<<<<<<<<<< + * chrom_end = int(feature[2]) + * if len(feature) > 3: + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_chrom_start = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/bed.pyx":30 + * chrom = feature[0] + * chrom_start = int(feature[1]) + * chrom_end = int(feature[2]) # <<<<<<<<<<<<<< + * if len(feature) > 3: + * name = feature[3] + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_chrom_end = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/bed.pyx":31 + * chrom_start = int(feature[1]) + * chrom_end = int(feature[2]) + * if len(feature) > 3: # <<<<<<<<<<<<<< + * name = feature[3] + * else: + */ + __pyx_t_6 = PyObject_Length(__pyx_v_feature); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_6 > 3); + if (__pyx_t_5) { + + /* "bx/arrays/bed.pyx":32 + * chrom_end = int(feature[2]) + * if len(feature) > 3: + * name = feature[3] # <<<<<<<<<<<<<< + * else: + * name = None + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_name = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "bx/arrays/bed.pyx":34 + * name = feature[3] + * else: + * name = None # <<<<<<<<<<<<<< + * + * if len(feature) > 4: + */ + __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; + } + __pyx_L12:; + + /* "bx/arrays/bed.pyx":36 + * name = None + * + * if len(feature) > 4: # <<<<<<<<<<<<<< + * score = int(feature[4]) + * else: + */ + __pyx_t_6 = PyObject_Length(__pyx_v_feature); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_6 > 4); + if (__pyx_t_5) { + + /* "bx/arrays/bed.pyx":37 + * + * if len(feature) > 4: + * score = int(feature[4]) # <<<<<<<<<<<<<< + * else: + * score = None + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_feature, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_score = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L13; + } + /*else*/ { + + /* "bx/arrays/bed.pyx":39 + * score = int(feature[4]) + * else: + * score = None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_INCREF(Py_None); + __pyx_v_score = Py_None; + } + __pyx_L13:; + + /* "bx/arrays/bed.pyx":42 + * + * + * return chrom, chrom_start, chrom_end, name, score # <<<<<<<<<<<<<< + * + * else: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_chrom_start); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_chrom_start); + __Pyx_GIVEREF(__pyx_v_chrom_start); + __Pyx_INCREF(__pyx_v_chrom_end); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_chrom_end); + __Pyx_GIVEREF(__pyx_v_chrom_end); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_INCREF(__pyx_v_score); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_score); + __Pyx_GIVEREF(__pyx_v_score); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + /*else*/ { + + /* "bx/arrays/bed.pyx":45 + * + * else: + * raise "Unexpected input line: %s" % line.strip() # <<<<<<<<<<<<<< + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(((PyObject *)__pyx_t_2), 0, 0, 0); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L10:; + __pyx_L5_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.arrays.bed.BedReader.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_feature); + __Pyx_XDECREF(__pyx_v_chrom); + __Pyx_XDECREF(__pyx_v_chrom_start); + __Pyx_XDECREF(__pyx_v_chrom_end); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_score); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_6arrays_3bed_BedReader(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_3bed_BedReader *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o); + p->f = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_3bed_BedReader(PyObject *o) { + struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o; + Py_XDECREF(p->f); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_3bed_BedReader(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o; + if (p->f) { + e = (*v)(p->f, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_3bed_BedReader(PyObject *o) { + struct __pyx_obj_2bx_6arrays_3bed_BedReader *p = (struct __pyx_obj_2bx_6arrays_3bed_BedReader *)o; + PyObject* tmp; + tmp = ((PyObject*)p->f); + p->f = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_6arrays_3bed_BedReader[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_2bx_6arrays_3bed_9BedReader_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BedReader = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BedReader = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BedReader = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BedReader = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_3bed_BedReader = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.bed.BedReader"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_3bed_BedReader), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_3bed_BedReader, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BedReader, /*tp_as_number*/ + &__pyx_tp_as_sequence_BedReader, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BedReader, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BedReader, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_3bed_BedReader, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_3bed_BedReader, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_2bx_6arrays_3bed_9BedReader_1__iter__, /*tp_iter*/ + __pyx_pf_2bx_6arrays_3bed_9BedReader_2__next__, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_3bed_BedReader, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_3bed_9BedReader___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_3bed_BedReader, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bed"), + __Pyx_DOCSTR(__pyx_k_5), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__browser, __pyx_k__browser, sizeof(__pyx_k__browser), 0, 0, 1, 1}, + {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, + {&__pyx_n_s__isalpha, __pyx_k__isalpha, sizeof(__pyx_k__isalpha), 0, 0, 1, 1}, + {&__pyx_n_s__isspace, __pyx_k__isspace, sizeof(__pyx_k__isspace), 0, 0, 1, 1}, + {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/arrays/bed.pyx":24 + * continue + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__track)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__track)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__track)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__browser)); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__browser)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__browser)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbed(void); /*proto*/ +PyMODINIT_FUNC initbed(void) +#else +PyMODINIT_FUNC PyInit_bed(void); /*proto*/ +PyMODINIT_FUNC PyInit_bed(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bed(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bed"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_5), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__arrays__bed) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_6arrays_3bed_BedReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BedReader", (PyObject *)&__pyx_type_2bx_6arrays_3bed_BedReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_3bed_BedReader = &__pyx_type_2bx_6arrays_3bed_BedReader; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/arrays/bed.pyx":1 + * """ # <<<<<<<<<<<<<< + * Iterator for the BED format ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 ) + * Returns chrom, chromStart, chromEnd, name, score + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.arrays.bed", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.arrays.bed"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); + else + return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.pyx b/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.pyx new file mode 100755 index 0000000..a8aeff9 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/bed.pyx @@ -0,0 +1,46 @@ +""" +Iterator for the BED format ( http://genome.ucsc.edu/FAQ/FAQformat.html#format1 ) +Returns chrom, chromStart, chromEnd, name, score +""" + +cdef class BedReader: + cdef object f + def __init__( self, f ): + self.f = f + + def __iter__( self ): + return self + + def __next__( self ): + while True: + line = self.f.readline() + if not line: + raise StopIteration() + if line.isspace(): + continue + if line[0] == "#": + continue + if line[0].isalpha(): + if line.startswith( "track" ) or line.startswith( "browser" ): + continue + + feature = line.strip().split() + chrom = feature[0] + chrom_start = int(feature[1]) + chrom_end = int(feature[2]) + if len(feature) > 3: + name = feature[3] + else: + name = None + + if len(feature) > 4: + score = int(feature[4]) + else: + score = None + + + return chrom, chrom_start, chrom_end, name, score + + else: + raise "Unexpected input line: %s" % line.strip() + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.c b/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.c new file mode 100755 index 0000000..6b86f66 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.c @@ -0,0 +1,3461 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:11 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__arrays__wiggle +#define __PYX_HAVE_API__bx__arrays__wiggle +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "wiggle.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader; + +/* "bx/arrays/wiggle.pxd":1 + * cdef enum linemode: # <<<<<<<<<<<<<< + * MODE_BED + * MODE_FIXED + */ +enum __pyx_t_2bx_6arrays_6wiggle_linemode { + __pyx_e_2bx_6arrays_6wiggle_MODE_BED, + __pyx_e_2bx_6arrays_6wiggle_MODE_FIXED, + __pyx_e_2bx_6arrays_6wiggle_MODE_VARIABLE +}; + +/* "bx/arrays/wiggle.pxd":6 + * MODE_VARIABLE + * + * cdef class WiggleReader: # <<<<<<<<<<<<<< + * cdef object file + * cdef object current_chrom + */ +struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader { + PyObject_HEAD + PyObject *file; + PyObject *current_chrom; + long current_pos; + long current_step; + long current_span; + enum __pyx_t_2bx_6arrays_6wiggle_linemode mode; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { + return unlikely(b < 0) ? b : !b; +} +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ + +#define __Pyx_PyObject_AsDouble(obj) \ + ((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.arrays.wiggle' */ +static PyTypeObject *__pyx_ptype_2bx_6arrays_6wiggle_WiggleReader = 0; +#define __Pyx_MODULE_NAME "bx.arrays.wiggle" +int __pyx_module_is_main_bx__arrays__wiggle = 0; + +/* Implementation of 'bx.arrays.wiggle' */ +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_ValueError; +static char __pyx_k_1[] = "="; +static char __pyx_k_3[] = "#"; +static char __pyx_k_8[] = "+"; +static char __pyx_k_9[] = "Unexpected input line: %s"; +static char __pyx_k_10[] = "\nSupport for scores in the `wiggle`_ file format used by the UCSC Genome \nBrowser.\n\nThe positions in the wiggle format are 1-relative, however,\nthe positions returned match the BED/interval format which is zero-based, half-open.\n\n.. _wiggle: http://genome.ucsc.edu/goldenPath/help/wiggle.html\n"; +static char __pyx_k_11[] = "bx.arrays.wiggle"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__span[] = "span"; +static char __pyx_k__step[] = "step"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__strip[] = "strip"; +static char __pyx_k__track[] = "track"; +static char __pyx_k__browser[] = "browser"; +static char __pyx_k__isalpha[] = "isalpha"; +static char __pyx_k__isspace[] = "isspace"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__readline[] = "readline"; +static char __pyx_k__fixedStep[] = "fixedStep"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__startswith[] = "startswith"; +static char __pyx_k__parse_header[] = "parse_header"; +static char __pyx_k__variableStep[] = "variableStep"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_11; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__browser; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__fixedStep; +static PyObject *__pyx_n_s__isalpha; +static PyObject *__pyx_n_s__isspace; +static PyObject *__pyx_n_s__parse_header; +static PyObject *__pyx_n_s__readline; +static PyObject *__pyx_n_s__span; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__startswith; +static PyObject *__pyx_n_s__step; +static PyObject *__pyx_n_s__strip; +static PyObject *__pyx_n_s__track; +static PyObject *__pyx_n_s__variableStep; +static PyObject *__pyx_int_1; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_7; + +/* "bx/arrays/wiggle.pyx":11 + * """ + * + * def parse_header( line ): # <<<<<<<<<<<<<< + * return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_parse_header(PyObject *__pyx_self, PyObject *__pyx_v_line); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_6arrays_6wiggle_parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pf_2bx_6arrays_6wiggle_parse_header, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_parse_header(PyObject *__pyx_self, PyObject *__pyx_v_line) { + PyObject *__pyx_v_field = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("parse_header"); + __pyx_self = __pyx_self; + + /* "bx/arrays/wiggle.pyx":12 + * + * def parse_header( line ): + * return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) # <<<<<<<<<<<<<< + * + * cdef class WiggleReader: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_3, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_field); + __pyx_v_field = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.arrays.wiggle.parse_header", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_field); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/wiggle.pyx":26 + * #cdef long current_span + * #cdef linemode mode + * def __init__( self, file ): # <<<<<<<<<<<<<< + * self.file = file + * self.current_chrom = None + */ + +static int __pyx_pf_2bx_6arrays_6wiggle_12WiggleReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6arrays_6wiggle_12WiggleReader___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.arrays.wiggle.WiggleReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/arrays/wiggle.pyx":27 + * #cdef linemode mode + * def __init__( self, file ): + * self.file = file # <<<<<<<<<<<<<< + * self.current_chrom = None + * self.current_pos = -1 + */ + __Pyx_INCREF(__pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->file); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->file); + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->file = __pyx_v_file; + + /* "bx/arrays/wiggle.pyx":28 + * def __init__( self, file ): + * self.file = file + * self.current_chrom = None # <<<<<<<<<<<<<< + * self.current_pos = -1 + * self.current_step = -1 + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom = Py_None; + + /* "bx/arrays/wiggle.pyx":29 + * self.file = file + * self.current_chrom = None + * self.current_pos = -1 # <<<<<<<<<<<<<< + * self.current_step = -1 + * self.current_span = -1 + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_pos = -1; + + /* "bx/arrays/wiggle.pyx":30 + * self.current_chrom = None + * self.current_pos = -1 + * self.current_step = -1 # <<<<<<<<<<<<<< + * self.current_span = -1 + * self.mode = MODE_BED + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_step = -1; + + /* "bx/arrays/wiggle.pyx":31 + * self.current_pos = -1 + * self.current_step = -1 + * self.current_span = -1 # <<<<<<<<<<<<<< + * self.mode = MODE_BED + * + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span = -1; + + /* "bx/arrays/wiggle.pyx":32 + * self.current_step = -1 + * self.current_span = -1 + * self.mode = MODE_BED # <<<<<<<<<<<<<< + * + * def __iter__( self ): + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode = __pyx_e_2bx_6arrays_6wiggle_MODE_BED; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/wiggle.pyx":34 + * self.mode = MODE_BED + * + * def __iter__( self ): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__"); + + /* "bx/arrays/wiggle.pyx":35 + * + * def __iter__( self ): + * return self # <<<<<<<<<<<<<< + * + * def __next__( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/arrays/wiggle.pyx":37 + * return self + * + * def __next__( self ): # <<<<<<<<<<<<<< + * while True: + * line = self.file.readline() + */ + +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_2__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_2__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_header = NULL; + PyObject *__pyx_v_fields = NULL; + PyObject *__pyx_v_pos = NULL; + double __pyx_v_val; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + long __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + double __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__"); + + /* "bx/arrays/wiggle.pyx":38 + * + * def __next__( self ): + * while True: # <<<<<<<<<<<<<< + * line = self.file.readline() + * if not line: + */ + while (1) { + if (!1) break; + + /* "bx/arrays/wiggle.pyx":39 + * def __next__( self ): + * while True: + * line = self.file.readline() # <<<<<<<<<<<<<< + * if not line: + * raise StopIteration() + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->file, __pyx_n_s__readline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/wiggle.pyx":40 + * while True: + * line = self.file.readline() + * if not line: # <<<<<<<<<<<<<< + * raise StopIteration() + * if line.isspace(): + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "bx/arrays/wiggle.pyx":41 + * line = self.file.readline() + * if not line: + * raise StopIteration() # <<<<<<<<<<<<<< + * if line.isspace(): + * continue + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/arrays/wiggle.pyx":42 + * if not line: + * raise StopIteration() + * if line.isspace(): # <<<<<<<<<<<<<< + * continue + * if line[0] == "#": + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__isspace); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/wiggle.pyx":43 + * raise StopIteration() + * if line.isspace(): + * continue # <<<<<<<<<<<<<< + * if line[0] == "#": + * continue + */ + goto __pyx_L5_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/arrays/wiggle.pyx":44 + * if line.isspace(): + * continue + * if line[0] == "#": # <<<<<<<<<<<<<< + * continue + * if line[0].isalpha(): + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_kp_s_3), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/wiggle.pyx":45 + * continue + * if line[0] == "#": + * continue # <<<<<<<<<<<<<< + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): + */ + goto __pyx_L5_continue; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/arrays/wiggle.pyx":46 + * if line[0] == "#": + * continue + * if line[0].isalpha(): # <<<<<<<<<<<<<< + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_line, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isalpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "bx/arrays/wiggle.pyx":47 + * continue + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<< + * continue + * elif line.startswith( "variableStep" ): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":48 + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue # <<<<<<<<<<<<<< + * elif line.startswith( "variableStep" ): + * header = parse_header( line ) + */ + goto __pyx_L5_continue; + goto __pyx_L11; + } + + /* "bx/arrays/wiggle.pyx":49 + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue + * elif line.startswith( "variableStep" ): # <<<<<<<<<<<<<< + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":50 + * continue + * elif line.startswith( "variableStep" ): + * header = parse_header( line ) # <<<<<<<<<<<<<< + * self.current_chrom = header['chrom'] + * self.current_pos = -1 + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__parse_header); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_header); + __pyx_v_header = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/arrays/wiggle.pyx":51 + * elif line.startswith( "variableStep" ): + * header = parse_header( line ) + * self.current_chrom = header['chrom'] # <<<<<<<<<<<<<< + * self.current_pos = -1 + * self.current_step = -1 + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__chrom)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/arrays/wiggle.pyx":52 + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + * self.current_pos = -1 # <<<<<<<<<<<<<< + * self.current_step = -1 + * if 'span' in header: + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_pos = -1; + + /* "bx/arrays/wiggle.pyx":53 + * self.current_chrom = header['chrom'] + * self.current_pos = -1 + * self.current_step = -1 # <<<<<<<<<<<<<< + * if 'span' in header: + * self.current_span = int( header['span'] ) + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_step = -1; + + /* "bx/arrays/wiggle.pyx":54 + * self.current_pos = -1 + * self.current_step = -1 + * if 'span' in header: # <<<<<<<<<<<<<< + * self.current_span = int( header['span'] ) + * else: + */ + __pyx_t_5 = ((PySequence_Contains(__pyx_v_header, ((PyObject *)__pyx_n_s__span)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":55 + * self.current_step = -1 + * if 'span' in header: + * self.current_span = int( header['span'] ) # <<<<<<<<<<<<<< + * else: + * self.current_span = 1 + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__span)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_6); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span = __pyx_t_7; + goto __pyx_L12; + } + /*else*/ { + + /* "bx/arrays/wiggle.pyx":57 + * self.current_span = int( header['span'] ) + * else: + * self.current_span = 1 # <<<<<<<<<<<<<< + * self.mode = MODE_VARIABLE + * continue + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span = 1; + } + __pyx_L12:; + + /* "bx/arrays/wiggle.pyx":58 + * else: + * self.current_span = 1 + * self.mode = MODE_VARIABLE # <<<<<<<<<<<<<< + * continue + * elif line.startswith( "fixedStep" ): + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode = __pyx_e_2bx_6arrays_6wiggle_MODE_VARIABLE; + + /* "bx/arrays/wiggle.pyx":59 + * self.current_span = 1 + * self.mode = MODE_VARIABLE + * continue # <<<<<<<<<<<<<< + * elif line.startswith( "fixedStep" ): + * header = parse_header( line ) + */ + goto __pyx_L5_continue; + goto __pyx_L11; + } + + /* "bx/arrays/wiggle.pyx":60 + * self.mode = MODE_VARIABLE + * continue + * elif line.startswith( "fixedStep" ): # <<<<<<<<<<<<<< + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":61 + * continue + * elif line.startswith( "fixedStep" ): + * header = parse_header( line ) # <<<<<<<<<<<<<< + * self.current_chrom = header['chrom'] + * self.current_pos = int( header['start'] ) - 1 + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__parse_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_header); + __pyx_v_header = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/wiggle.pyx":62 + * elif line.startswith( "fixedStep" ): + * header = parse_header( line ) + * self.current_chrom = header['chrom'] # <<<<<<<<<<<<<< + * self.current_pos = int( header['start'] ) - 1 + * self.current_step = int( header['step'] ) + */ + __pyx_t_2 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__chrom)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/wiggle.pyx":63 + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + * self.current_pos = int( header['start'] ) - 1 # <<<<<<<<<<<<<< + * self.current_step = int( header['step'] ) + * if 'span' in header: + */ + __pyx_t_2 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__start)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_6); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_pos = __pyx_t_7; + + /* "bx/arrays/wiggle.pyx":64 + * self.current_chrom = header['chrom'] + * self.current_pos = int( header['start'] ) - 1 + * self.current_step = int( header['step'] ) # <<<<<<<<<<<<<< + * if 'span' in header: + * self.current_span = int( header['span'] ) + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__step)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_6); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_step = __pyx_t_7; + + /* "bx/arrays/wiggle.pyx":65 + * self.current_pos = int( header['start'] ) - 1 + * self.current_step = int( header['step'] ) + * if 'span' in header: # <<<<<<<<<<<<<< + * self.current_span = int( header['span'] ) + * else: + */ + __pyx_t_5 = ((PySequence_Contains(__pyx_v_header, ((PyObject *)__pyx_n_s__span)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":66 + * self.current_step = int( header['step'] ) + * if 'span' in header: + * self.current_span = int( header['span'] ) # <<<<<<<<<<<<<< + * else: + * self.current_span = 1 + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_header, ((PyObject *)__pyx_n_s__span)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_AsLong(__pyx_t_6); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span = __pyx_t_7; + goto __pyx_L13; + } + /*else*/ { + + /* "bx/arrays/wiggle.pyx":68 + * self.current_span = int( header['span'] ) + * else: + * self.current_span = 1 # <<<<<<<<<<<<<< + * self.mode = MODE_FIXED + * continue + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span = 1; + } + __pyx_L13:; + + /* "bx/arrays/wiggle.pyx":69 + * else: + * self.current_span = 1 + * self.mode = MODE_FIXED # <<<<<<<<<<<<<< + * continue + * elif self.mode == MODE_BED: + */ + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode = __pyx_e_2bx_6arrays_6wiggle_MODE_FIXED; + + /* "bx/arrays/wiggle.pyx":70 + * self.current_span = 1 + * self.mode = MODE_FIXED + * continue # <<<<<<<<<<<<<< + * elif self.mode == MODE_BED: + * fields = line.split() + */ + goto __pyx_L5_continue; + goto __pyx_L11; + } + __pyx_L11:; + goto __pyx_L10; + } + + /* "bx/arrays/wiggle.pyx":71 + * self.mode = MODE_FIXED + * continue + * elif self.mode == MODE_BED: # <<<<<<<<<<<<<< + * fields = line.split() + * if len( fields ) > 3: + */ + __pyx_t_5 = (((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode == __pyx_e_2bx_6arrays_6wiggle_MODE_BED); + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":72 + * continue + * elif self.mode == MODE_BED: + * fields = line.split() # <<<<<<<<<<<<<< + * if len( fields ) > 3: + * if len( fields ) > 5: + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/arrays/wiggle.pyx":73 + * elif self.mode == MODE_BED: + * fields = line.split() + * if len( fields ) > 3: # <<<<<<<<<<<<<< + * if len( fields ) > 5: + * return fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) + */ + __pyx_t_8 = PyObject_Length(__pyx_v_fields); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_8 > 3); + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":74 + * fields = line.split() + * if len( fields ) > 3: + * if len( fields ) > 5: # <<<<<<<<<<<<<< + * return fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) + * else: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_fields); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_8 > 5); + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":75 + * if len( fields ) > 3: + * if len( fields ) > 5: + * return fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) # <<<<<<<<<<<<<< + * else: + * return fields[0], int( fields[1] ), int( fields[2] ), "+", float( fields[3] ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_fields, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_fields, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_fields, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_t_10); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyTuple_New(5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_r = ((PyObject *)__pyx_t_12); + __pyx_t_12 = 0; + goto __pyx_L0; + goto __pyx_L15; + } + /*else*/ { + + /* "bx/arrays/wiggle.pyx":77 + * return fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) + * else: + * return fields[0], int( fields[1] ), int( fields[2] ), "+", float( fields[3] ) # <<<<<<<<<<<<<< + * elif self.mode == MODE_VARIABLE: + * fields = line.split() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_fields, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_fields, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_t_1); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_12 = 0; + __pyx_t_10 = 0; + __pyx_t_9 = 0; + __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + goto __pyx_L0; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + goto __pyx_L10; + } + + /* "bx/arrays/wiggle.pyx":78 + * else: + * return fields[0], int( fields[1] ), int( fields[2] ), "+", float( fields[3] ) + * elif self.mode == MODE_VARIABLE: # <<<<<<<<<<<<<< + * fields = line.split() + * try: + */ + __pyx_t_5 = (((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode == __pyx_e_2bx_6arrays_6wiggle_MODE_VARIABLE); + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":79 + * return fields[0], int( fields[1] ), int( fields[2] ), "+", float( fields[3] ) + * elif self.mode == MODE_VARIABLE: + * fields = line.split() # <<<<<<<<<<<<<< + * try: + * pos = int( fields[0] ) - 1 + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/arrays/wiggle.pyx":80 + * elif self.mode == MODE_VARIABLE: + * fields = line.split() + * try: # <<<<<<<<<<<<<< + * pos = int( fields[0] ) - 1 + * val = float( fields[1] ) + */ + { + __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + /*try:*/ { + + /* "bx/arrays/wiggle.pyx":81 + * fields = line.split() + * try: + * pos = int( fields[0] ) - 1 # <<<<<<<<<<<<<< + * val = float( fields[1] ) + * except ValueError: + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/arrays/wiggle.pyx":82 + * try: + * pos = int( fields[0] ) - 1 + * val = float( fields[1] ) # <<<<<<<<<<<<<< + * except ValueError: + * continue + */ + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_fields, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_t_6); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_val = __pyx_t_11; + } + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L23_try_end; + __pyx_L16_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "bx/arrays/wiggle.pyx":83 + * pos = int( fields[0] ) - 1 + * val = float( fields[1] ) + * except ValueError: # <<<<<<<<<<<<<< + * continue + * return self.current_chrom, pos, pos + self.current_span, "+", val + */ + __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_16) { + __Pyx_AddTraceback("bx.arrays.wiggle.WiggleReader.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_9); + + /* "bx/arrays/wiggle.pyx":84 + * val = float( fields[1] ) + * except ValueError: + * continue # <<<<<<<<<<<<<< + * return self.current_chrom, pos, pos + self.current_span, "+", val + * elif self.mode == MODE_FIXED: + */ + goto __pyx_L25_except_continue; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L17_exception_handled; + __pyx_L25_except_continue:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L22_try_continue; + } + __pyx_L18_except_error:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + goto __pyx_L1_error; + __pyx_L22_try_continue:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + goto __pyx_L5_continue; + __pyx_L17_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + __pyx_L23_try_end:; + } + + /* "bx/arrays/wiggle.pyx":85 + * except ValueError: + * continue + * return self.current_chrom, pos, pos + self.current_span, "+", val # <<<<<<<<<<<<<< + * elif self.mode == MODE_FIXED: + * fields = line.split() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_1 = 0; + __pyx_t_9 = 0; + __pyx_r = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + + /* "bx/arrays/wiggle.pyx":86 + * continue + * return self.current_chrom, pos, pos + self.current_span, "+", val + * elif self.mode == MODE_FIXED: # <<<<<<<<<<<<<< + * fields = line.split() + * try: + */ + __pyx_t_5 = (((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->mode == __pyx_e_2bx_6arrays_6wiggle_MODE_FIXED); + if (__pyx_t_5) { + + /* "bx/arrays/wiggle.pyx":87 + * return self.current_chrom, pos, pos + self.current_span, "+", val + * elif self.mode == MODE_FIXED: + * fields = line.split() # <<<<<<<<<<<<<< + * try: + * val = float( fields[0] ) + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_9; + __pyx_t_9 = 0; + + /* "bx/arrays/wiggle.pyx":88 + * elif self.mode == MODE_FIXED: + * fields = line.split() + * try: # <<<<<<<<<<<<<< + * val = float( fields[0] ) + * except ValueError: + */ + { + __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { + + /* "bx/arrays/wiggle.pyx":89 + * fields = line.split() + * try: + * val = float( fields[0] ) # <<<<<<<<<<<<<< + * except ValueError: + * continue + */ + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L26_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_t_9); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L26_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_val = __pyx_t_11; + } + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L33_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "bx/arrays/wiggle.pyx":90 + * try: + * val = float( fields[0] ) + * except ValueError: # <<<<<<<<<<<<<< + * continue + * return self.current_chrom, self.current_pos, self.current_pos + self.current_span, "+", val + */ + __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_16) { + __Pyx_AddTraceback("bx.arrays.wiggle.WiggleReader.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L28_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + + /* "bx/arrays/wiggle.pyx":91 + * val = float( fields[0] ) + * except ValueError: + * continue # <<<<<<<<<<<<<< + * return self.current_chrom, self.current_pos, self.current_pos + self.current_span, "+", val + * # FIXME: unreachable! need to test this and fix! + */ + goto __pyx_L35_except_continue; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L27_exception_handled; + __pyx_L35_except_continue:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L32_try_continue; + } + __pyx_L28_except_error:; + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); + goto __pyx_L1_error; + __pyx_L32_try_continue:; + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); + goto __pyx_L5_continue; + __pyx_L27_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); + __pyx_L33_try_end:; + } + + /* "bx/arrays/wiggle.pyx":92 + * except ValueError: + * continue + * return self.current_chrom, self.current_pos, self.current_pos + self.current_span, "+", val # <<<<<<<<<<<<<< + * # FIXME: unreachable! need to test this and fix! + * self.current_pos += self.current_step + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyInt_FromLong((((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_pos + ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_span)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)__pyx_v_self)->current_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_9 = 0; + __pyx_r = ((PyObject *)__pyx_t_10); + __pyx_t_10 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + /*else*/ { + + /* "bx/arrays/wiggle.pyx":96 + * self.current_pos += self.current_step + * else: + * raise "Unexpected input line: %s" % line.strip() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_Raise(((PyObject *)__pyx_t_10), 0, 0, 0); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L10:; + __pyx_L5_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("bx.arrays.wiggle.WiggleReader.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_header); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_pos); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_6arrays_6wiggle_WiggleReader(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)o); + p->file = Py_None; Py_INCREF(Py_None); + p->current_chrom = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_6arrays_6wiggle_WiggleReader(PyObject *o) { + struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *p = (struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)o; + Py_XDECREF(p->file); + Py_XDECREF(p->current_chrom); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_6arrays_6wiggle_WiggleReader(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *p = (struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)o; + if (p->file) { + e = (*v)(p->file, a); if (e) return e; + } + if (p->current_chrom) { + e = (*v)(p->current_chrom, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_6arrays_6wiggle_WiggleReader(PyObject *o) { + struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *p = (struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader *)o; + PyObject* tmp; + tmp = ((PyObject*)p->file); + p->file = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->current_chrom); + p->current_chrom = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_6arrays_6wiggle_WiggleReader[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_WiggleReader = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_WiggleReader = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_WiggleReader = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_WiggleReader = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6arrays_6wiggle_WiggleReader = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.arrays.wiggle.WiggleReader"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6arrays_6wiggle_WiggleReader), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6arrays_6wiggle_WiggleReader, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_WiggleReader, /*tp_as_number*/ + &__pyx_tp_as_sequence_WiggleReader, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_WiggleReader, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_WiggleReader, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Iterator yielding chrom, start, end, strand, value.\n Values are zero-based, half-open.\n Regions which lack a score are ignored.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_6arrays_6wiggle_WiggleReader, /*tp_traverse*/ + __pyx_tp_clear_2bx_6arrays_6wiggle_WiggleReader, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_1__iter__, /*tp_iter*/ + __pyx_pf_2bx_6arrays_6wiggle_12WiggleReader_2__next__, /*tp_iternext*/ + __pyx_methods_2bx_6arrays_6wiggle_WiggleReader, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_6arrays_6wiggle_12WiggleReader___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6arrays_6wiggle_WiggleReader, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("wiggle"), + __Pyx_DOCSTR(__pyx_k_10), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__browser, __pyx_k__browser, sizeof(__pyx_k__browser), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__fixedStep, __pyx_k__fixedStep, sizeof(__pyx_k__fixedStep), 0, 0, 1, 1}, + {&__pyx_n_s__isalpha, __pyx_k__isalpha, sizeof(__pyx_k__isalpha), 0, 0, 1, 1}, + {&__pyx_n_s__isspace, __pyx_k__isspace, sizeof(__pyx_k__isspace), 0, 0, 1, 1}, + {&__pyx_n_s__parse_header, __pyx_k__parse_header, sizeof(__pyx_k__parse_header), 0, 0, 1, 1}, + {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1}, + {&__pyx_n_s__span, __pyx_k__span, sizeof(__pyx_k__span), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, + {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1}, + {&__pyx_n_s__variableStep, __pyx_k__variableStep, sizeof(__pyx_k__variableStep), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/arrays/wiggle.pyx":12 + * + * def parse_header( line ): + * return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) # <<<<<<<<<<<<<< + * + * cdef class WiggleReader: + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "bx/arrays/wiggle.pyx":47 + * continue + * if line[0].isalpha(): + * if line.startswith( "track" ) or line.startswith( "browser" ): # <<<<<<<<<<<<<< + * continue + * elif line.startswith( "variableStep" ): + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__track)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__track)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__track)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__browser)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__browser)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__browser)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "bx/arrays/wiggle.pyx":49 + * if line.startswith( "track" ) or line.startswith( "browser" ): + * continue + * elif line.startswith( "variableStep" ): # <<<<<<<<<<<<<< + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__variableStep)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__variableStep)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__variableStep)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "bx/arrays/wiggle.pyx":60 + * self.mode = MODE_VARIABLE + * continue + * elif line.startswith( "fixedStep" ): # <<<<<<<<<<<<<< + * header = parse_header( line ) + * self.current_chrom = header['chrom'] + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fixedStep)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__fixedStep)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixedStep)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initwiggle(void); /*proto*/ +PyMODINIT_FUNC initwiggle(void) +#else +PyMODINIT_FUNC PyInit_wiggle(void); /*proto*/ +PyMODINIT_FUNC PyInit_wiggle(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_wiggle(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("wiggle"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_10), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__arrays__wiggle) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_6arrays_6wiggle_WiggleReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "WiggleReader", (PyObject *)&__pyx_type_2bx_6arrays_6wiggle_WiggleReader) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6arrays_6wiggle_WiggleReader = &__pyx_type_2bx_6arrays_6wiggle_WiggleReader; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/arrays/wiggle.pyx":11 + * """ + * + * def parse_header( line ): # <<<<<<<<<<<<<< + * return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) + * + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_6arrays_6wiggle_parse_header, NULL, __pyx_n_s_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__parse_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/arrays/wiggle.pyx":1 + * """ # <<<<<<<<<<<<<< + * Support for scores in the `wiggle`_ file format used by the UCSC Genome + * Browser. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.arrays.wiggle", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.arrays.wiggle"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + + +static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; + if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { + return PyFloat_AsDouble(obj); + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(&local_type, &local_value, &local_tb); + if (unlikely(tstate->curexc_type)) + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + *type = local_type; + *value = local_value; + *tb = local_tb; + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); + else + return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.pyx b/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.pyx new file mode 100755 index 0000000..425daa4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/arrays/wiggle.pyx @@ -0,0 +1,98 @@ +""" +Support for scores in the `wiggle`_ file format used by the UCSC Genome +Browser. + +The positions in the wiggle format are 1-relative, however, +the positions returned match the BED/interval format which is zero-based, half-open. + +.. _wiggle: http://genome.ucsc.edu/goldenPath/help/wiggle.html +""" + +def parse_header( line ): + return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) + +cdef class WiggleReader: + """ + Iterator yielding chrom, start, end, strand, value. + Values are zero-based, half-open. + Regions which lack a score are ignored. + """ + #cdef object file + #cdef object current_chrom + #cdef long current_pos + #cdef long current_step + #cdef long current_span + #cdef linemode mode + def __init__( self, file ): + self.file = file + self.current_chrom = None + self.current_pos = -1 + self.current_step = -1 + self.current_span = -1 + self.mode = MODE_BED + + def __iter__( self ): + return self + + def __next__( self ): + while True: + line = self.file.readline() + if not line: + raise StopIteration() + if line.isspace(): + continue + if line[0] == "#": + continue + if line[0].isalpha(): + if line.startswith( "track" ) or line.startswith( "browser" ): + continue + elif line.startswith( "variableStep" ): + header = parse_header( line ) + self.current_chrom = header['chrom'] + self.current_pos = -1 + self.current_step = -1 + if 'span' in header: + self.current_span = int( header['span'] ) + else: + self.current_span = 1 + self.mode = MODE_VARIABLE + continue + elif line.startswith( "fixedStep" ): + header = parse_header( line ) + self.current_chrom = header['chrom'] + self.current_pos = int( header['start'] ) - 1 + self.current_step = int( header['step'] ) + if 'span' in header: + self.current_span = int( header['span'] ) + else: + self.current_span = 1 + self.mode = MODE_FIXED + continue + elif self.mode == MODE_BED: + fields = line.split() + if len( fields ) > 3: + if len( fields ) > 5: + return fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) + else: + return fields[0], int( fields[1] ), int( fields[2] ), "+", float( fields[3] ) + elif self.mode == MODE_VARIABLE: + fields = line.split() + try: + pos = int( fields[0] ) - 1 + val = float( fields[1] ) + except ValueError: + continue + return self.current_chrom, pos, pos + self.current_span, "+", val + elif self.mode == MODE_FIXED: + fields = line.split() + try: + val = float( fields[0] ) + except ValueError: + continue + return self.current_chrom, self.current_pos, self.current_pos + self.current_span, "+", val + # FIXME: unreachable! need to test this and fix! + self.current_pos += self.current_step + else: + raise "Unexpected input line: %s" % line.strip() + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/bbi/__init__.py new file mode 100755 index 0000000..ef7f873 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/__init__.py @@ -0,0 +1,3 @@ +""" +Support for the UCSC "Big Binary Indexed" file formats (bigWig and bigBed) +""" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.c b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.c new file mode 100755 index 0000000..8104f68 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.c @@ -0,0 +1,14877 @@ +/* Generated by Cython 0.16 on Mon Jul 16 22:45:56 2012 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif + +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif + +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCFunction_Call PyObject_Call +#else + #define __Pyx_PyCFunction_Call PyCFunction_Call +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif + +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + + +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bbi__bbi_file +#define __PYX_HAVE_API__bx__bbi__bbi_file +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "limits.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "bbi_file.pyx", + "bbi_file.pxd", + "numpy.pxd", + "bpt_file.pxd", + "cirtree_file.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "types.pxd":1 + * ctypedef unsigned char UBYTE # <<<<<<<<<<<<<< + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE; + +/* "types.pxd":2 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE # <<<<<<<<<<<<<< + * ctypedef unsigned short UWORD + * ctypedef short WORD + */ +typedef signed char __pyx_t_2bx_3bbi_5types_BYTE; + +/* "types.pxd":3 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD # <<<<<<<<<<<<<< + * ctypedef short WORD + * ctypedef unsigned long long bits64 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD; + +/* "types.pxd":4 + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + * ctypedef short WORD # <<<<<<<<<<<<<< + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + */ +typedef short __pyx_t_2bx_3bbi_5types_WORD; + +/* "types.pxd":5 + * ctypedef unsigned short UWORD + * ctypedef short WORD + * ctypedef unsigned long long bits64 # <<<<<<<<<<<<<< + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64; + +/* "types.pxd":6 + * ctypedef short WORD + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 # <<<<<<<<<<<<<< + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + */ +typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32; + +/* "types.pxd":7 + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 # <<<<<<<<<<<<<< + * ctypedef unsigned char bits8 + * ctypedef int signed32 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16; + +/* "types.pxd":8 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 # <<<<<<<<<<<<<< + * ctypedef int signed32 + * + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8; + +/* "types.pxd":9 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + * ctypedef int signed32 # <<<<<<<<<<<<<< + * + * ctypedef bint boolean + */ +typedef int __pyx_t_2bx_3bbi_5types_signed32; + +/* "types.pxd":11 + * ctypedef int signed32 + * + * ctypedef bint boolean # <<<<<<<<<<<<<< + * + */ +typedef int __pyx_t_2bx_3bbi_5types_boolean; + +/* "numpy.pxd":722 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":723 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":724 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":725 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":729 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":730 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":731 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":736 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":737 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":746 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":747 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":748 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":750 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":751 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":752 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":754 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":757 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":758 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":759 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock; +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler; +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile; +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData; +struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel; +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile; +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile; + +/* "numpy.pxd":761 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":762 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":763 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":765 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "bx/bbi/bbi_file.pyx":43 + * cdef inline int imin(int a, int b): return a if a <= b else b + * + * cdef enum summary_type: # <<<<<<<<<<<<<< + * summary_type_mean = 0 + * summary_type_max = 1 + */ +enum __pyx_t_2bx_3bbi_8bbi_file_summary_type { + __pyx_e_2bx_3bbi_8bbi_file_summary_type_mean = 0, + __pyx_e_2bx_3bbi_8bbi_file_summary_type_max = 1, + __pyx_e_2bx_3bbi_8bbi_file_summary_type_min = 2, + __pyx_e_2bx_3bbi_8bbi_file_summary_type_coverage = 3, + __pyx_e_2bx_3bbi_8bbi_file_summary_type_sd = 4 +}; + +/* "bx/bbi/bbi_file.pxd":8 + * cimport numpy + * + * cdef class SummaryBlock: # <<<<<<<<<<<<<< + * """ + * A block of summary data from disk + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock { + PyObject_HEAD + __pyx_t_2bx_3bbi_5types_bits32 chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + __pyx_t_2bx_3bbi_5types_bits32 valid_count; + double min_val; + double max_val; + double sum_data; + double sum_squares; +}; + + +/* "bx/bbi/bbi_file.pxd":39 + * cdef class BBIFile + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtab; +}; + + +/* "cirtree_file.pxd":3 + * from types cimport * + * + * cdef class CIRTreeFile: # <<<<<<<<<<<<<< + * cdef object file + * cdef object reader + */ +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits32 start_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 start_base; + __pyx_t_2bx_3bbi_5types_bits32 end_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 end_base; + __pyx_t_2bx_3bbi_5types_bits64 file_size; + __pyx_t_2bx_3bbi_5types_bits32 items_per_slot; +}; + + +/* "bx/bbi/bbi_file.pxd":21 + * cdef public double sum_squares + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtab; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + int size; + PyArrayObject *valid_count; + PyArrayObject *min_val; + PyArrayObject *max_val; + PyArrayObject *sum_data; + PyArrayObject *sum_squares; +}; + + +/* "bx/bbi/bbi_file.pyx":279 + * return closest_level + * + * cdef class ZoomLevel: # <<<<<<<<<<<<<< + * cdef BBIFile bbi_file + * cdef public bits32 reduction_level + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_vtab; + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *bbi_file; + __pyx_t_2bx_3bbi_5types_bits32 reduction_level; + __pyx_t_2bx_3bbi_5types_bits32 reserved; + __pyx_t_2bx_3bbi_5types_bits64 data_offset; + __pyx_t_2bx_3bbi_5types_bits64 index_offset; + int item_count; +}; + + +/* "bx/bbi/bbi_file.pxd":37 + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + * + * cdef class BBIFile # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtab; + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_bits32 magic; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *chrom_bpt; + __pyx_t_2bx_3bbi_5types_bits16 version; + __pyx_t_2bx_3bbi_5types_bits16 zoom_levels; + __pyx_t_2bx_3bbi_5types_bits64 chrom_tree_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_data_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_index_offset; + __pyx_t_2bx_3bbi_5types_bits16 field_count; + __pyx_t_2bx_3bbi_5types_bits16 defined_field_count; + __pyx_t_2bx_3bbi_5types_bits64 as_offset; + __pyx_t_2bx_3bbi_5types_bits64 total_summary_offset; + __pyx_t_2bx_3bbi_5types_bits32 uncompress_buf_size; + PyObject *level_list; +}; + + +/* "bpt_file.pxd":5 + * from types cimport * + * + * cdef class BPTFile: # <<<<<<<<<<<<<< + * """ + * On disk B+ tree compatible with Jim Kent's bPlusTree.c + */ +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits32 key_size; + __pyx_t_2bx_3bbi_5types_bits32 value_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; +}; + + + +/* "bx/bbi/bbi_file.pyx":110 + * pass + * + * cdef class BBIFile: # <<<<<<<<<<<<<< + * """ + * A "big binary indexed" file. Stores blocks of raw data and numeric + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile { + PyObject *(*visit_blocks_in_region)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *); + PyObject *(*_get_chrom_id_and_size)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *); + PyObject *(*_best_zoom_level)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, int); + PyObject *(*summarize)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*query)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*_summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + + +/* "bx/bbi/bbi_file.pyx":103 + * min_val[j] = val + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler { + PyObject *(*handle_block)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + + +/* "bx/bbi/bbi_file.pyx":56 + * pass + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData { + PyObject *(*accumulate_interval_value)(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData; + + +/* "bx/bbi/bbi_file.pyx":279 + * return closest_level + * + * cdef class ZoomLevel: # <<<<<<<<<<<<<< + * cdef BBIFile bbi_file + * cdef public bits32 reduction_level + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel { + PyObject *(*_get_summary_slice)(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *); + PyObject *(*_summarize)(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_vtabptr_2bx_3bbi_8bbi_file_ZoomLevel; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (likely(i >= 0)) { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + return m->sq_item(o, i); + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'bx.bbi.types' */ + +/* Module declarations from 'bx.bbi.bpt_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = 0; + +/* Module declarations from 'bx.bbi.cirtree_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = 0; + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from 'cython' */ + +/* Module declarations from 'libc' */ + +/* Module declarations from 'libc.limits' */ + +/* Module declarations from 'bx.bbi.bbi_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_ZoomLevel = 0; +__PYX_EXTERN_C DL_EXPORT(int) big_wig_sig; +__PYX_EXTERN_C DL_EXPORT(int) big_bed_sig; +static CYTHON_INLINE int __pyx_f_2bx_3bbi_8bbi_file_range_intersection(int, int, int, int); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "bx.bbi.bbi_file" +int __pyx_module_is_main_bx__bbi__bbi_file = 0; + +/* Implementation of 'bx.bbi.bbi_file' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData___init__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_size); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile___init__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_expected_sig, PyObject *__pyx_v_type_name); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_2open(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_expected_sig, CYTHON_UNUSED PyObject *__pyx_v_type_name); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_4summarize(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_6summarize_from_full(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_8query(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel__summary_blocks_in_region(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self); /* proto */ +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_2[] = "find_overlapping_blocks"; +static char __pyx_k_5[] = "_summary_blocks_in_region"; +static char __pyx_k_6[] = "ndarray is not C contiguous"; +static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_10[] = "Non-native byte order not supported"; +static char __pyx_k_12[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_13[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_16[] = "Format string allocated too short."; +static char __pyx_k_18[] = "\nCore implementation for reading UCSC \"big binary indexed\" files.\n\nThere isn't really any specification for the format beyond the code, so this\nmirrors Jim Kent's 'bbiRead.c' mostly. \n"; +static char __pyx_k_19[] = "bx.misc.binary_file"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__II[] = "II"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__max[] = "max"; +static char __pyx_k__min[] = "min"; +static char __pyx_k__nan[] = "nan"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__find[] = "find"; +static char __pyx_k__math[] = "math"; +static char __pyx_k__mean[] = "mean"; +static char __pyx_k__open[] = "open"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__skip[] = "skip"; +static char __pyx_k__sqrt[] = "sqrt"; +static char __pyx_k__zlib[] = "zlib"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__deque[] = "deque"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__query[] = "query"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__unpack[] = "unpack"; +static char __pyx_k__float64[] = "float64"; +static char __pyx_k__max_val[] = "max_val"; +static char __pyx_k__min_val[] = "min_val"; +static char __pyx_k__popleft[] = "popleft"; +static char __pyx_k__std_dev[] = "std_dev"; +static char __pyx_k__StringIO[] = "StringIO"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__chrom_id[] = "chrom_id"; +static char __pyx_k__coverage[] = "coverage"; +static char __pyx_k__sum_data[] = "sum_data"; +static char __pyx_k__cStringIO[] = "cStringIO"; +static char __pyx_k__summarize[] = "summarize"; +static char __pyx_k__type_name[] = "type_name"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__decompress[] = "decompress"; +static char __pyx_k__read_float[] = "read_float"; +static char __pyx_k__collections[] = "collections"; +static char __pyx_k__read_uint16[] = "read_uint16"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__read_uint64[] = "read_uint64"; +static char __pyx_k__sum_squares[] = "sum_squares"; +static char __pyx_k__valid_count[] = "valid_count"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__expected_sig[] = "expected_sig"; +static char __pyx_k__summary_size[] = "summary_size"; +static char __pyx_k__byteswap_needed[] = "byteswap_needed"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static char __pyx_k__is_little_endian[] = "is_little_endian"; +static char __pyx_k__summarize_from_full[] = "summarize_from_full"; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_n_s_19; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_n_s_5; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s__II; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__StringIO; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__byteswap_needed; +static PyObject *__pyx_n_s__cStringIO; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__chrom_id; +static PyObject *__pyx_n_s__collections; +static PyObject *__pyx_n_s__coverage; +static PyObject *__pyx_n_s__decompress; +static PyObject *__pyx_n_s__deque; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__expected_sig; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__find; +static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__is_little_endian; +static PyObject *__pyx_n_s__math; +static PyObject *__pyx_n_s__max; +static PyObject *__pyx_n_s__max_val; +static PyObject *__pyx_n_s__mean; +static PyObject *__pyx_n_s__min; +static PyObject *__pyx_n_s__min_val; +static PyObject *__pyx_n_s__nan; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__open; +static PyObject *__pyx_n_s__popleft; +static PyObject *__pyx_n_s__query; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_float; +static PyObject *__pyx_n_s__read_uint16; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__read_uint64; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__skip; +static PyObject *__pyx_n_s__sqrt; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__std_dev; +static PyObject *__pyx_n_s__sum_data; +static PyObject *__pyx_n_s__sum_squares; +static PyObject *__pyx_n_s__summarize; +static PyObject *__pyx_n_s__summarize_from_full; +static PyObject *__pyx_n_s__summary_size; +static PyObject *__pyx_n_s__type_name; +static PyObject *__pyx_n_s__unpack; +static PyObject *__pyx_n_s__valid_count; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_n_s__zlib; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_28; +static PyObject *__pyx_int_32; +static PyObject *__pyx_int_64; +static PyObject *__pyx_k_tuple_1; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +int big_wig_sig; +int big_bed_sig; + +/* "bx/bbi/bbi_file.pyx":35 + * + * @cython.profile(False) + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): # <<<<<<<<<<<<<< + * return min( end1, end2 ) - max( start1, start2 ) + * + */ + +static CYTHON_INLINE int __pyx_f_2bx_3bbi_8bbi_file_range_intersection(int __pyx_v_start1, int __pyx_v_end1, int __pyx_v_start2, int __pyx_v_end2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("range_intersection", 0); + + /* "bx/bbi/bbi_file.pyx":36 + * @cython.profile(False) + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + * return min( end1, end2 ) - max( start1, start2 ) # <<<<<<<<<<<<<< + * + * @cython.profile(False) + */ + __pyx_t_1 = __pyx_v_end2; + __pyx_t_2 = __pyx_v_end1; + if ((__pyx_t_1 < __pyx_t_2)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_t_1 = __pyx_v_start2; + __pyx_t_2 = __pyx_v_start1; + if ((__pyx_t_1 > __pyx_t_2)) { + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = __pyx_t_2; + } + __pyx_r = (__pyx_t_3 - __pyx_t_4); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":39 + * + * @cython.profile(False) + * cdef inline int imax(int a, int b): return a if a >= b else b # <<<<<<<<<<<<<< + * @cython.profile(False) + * cdef inline int imin(int a, int b): return a if a <= b else b + */ + +static CYTHON_INLINE int __pyx_f_2bx_3bbi_8bbi_file_imax(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imax", 0); + if ((__pyx_v_a >= __pyx_v_b)) { + __pyx_t_1 = __pyx_v_a; + } else { + __pyx_t_1 = __pyx_v_b; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":41 + * cdef inline int imax(int a, int b): return a if a >= b else b + * @cython.profile(False) + * cdef inline int imin(int a, int b): return a if a <= b else b # <<<<<<<<<<<<<< + * + * cdef enum summary_type: + */ + +static CYTHON_INLINE int __pyx_f_2bx_3bbi_8bbi_file_imin(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imin", 0); + if ((__pyx_v_a <= __pyx_v_b)) { + __pyx_t_1 = __pyx_v_a; + } else { + __pyx_t_1 = __pyx_v_b; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":12 + * A block of summary data from disk + * """ + * cdef public bits32 chrom_id # <<<<<<<<<<<<<< + * cdef public bits32 start + * cdef public bits32 end + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->chrom_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.chrom_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->chrom_id = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.chrom_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":13 + * """ + * cdef public bits32 chrom_id + * cdef public bits32 start # <<<<<<<<<<<<<< + * cdef public bits32 end + * cdef public bits32 valid_count + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_5start_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->start = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":14 + * cdef public bits32 chrom_id + * cdef public bits32 start + * cdef public bits32 end # <<<<<<<<<<<<<< + * cdef public bits32 valid_count + * cdef public double min_val + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_3end_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->end = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":15 + * cdef public bits32 start + * cdef public bits32 end + * cdef public bits32 valid_count # <<<<<<<<<<<<<< + * cdef public double min_val + * cdef public double max_val + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->valid_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.valid_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->valid_count = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.valid_count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":16 + * cdef public bits32 end + * cdef public bits32 valid_count + * cdef public double min_val # <<<<<<<<<<<<<< + * cdef public double max_val + * cdef public double sum_data + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->min_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.min_val.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->min_val = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.min_val.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":17 + * cdef public bits32 valid_count + * cdef public double min_val + * cdef public double max_val # <<<<<<<<<<<<<< + * cdef public double sum_data + * cdef public double sum_squares + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.max_val.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->max_val = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.max_val.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":18 + * cdef public double min_val + * cdef public double max_val + * cdef public double sum_data # <<<<<<<<<<<<<< + * cdef public double sum_squares + * + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->sum_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.sum_data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->sum_data = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.sum_data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":19 + * cdef public double max_val + * cdef public double sum_data + * cdef public double sum_squares # <<<<<<<<<<<<<< + * + * cdef class SummarizedData: + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->sum_squares); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.sum_squares.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->sum_squares = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummaryBlock.sum_squares.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_size; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__size,0}; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData___init__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), __pyx_v_start, __pyx_v_end, __pyx_v_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":61 + * aggregation over a particular range and resolution + * """ + * def __init__( self, bits32 start, bits32 end, int size ): # <<<<<<<<<<<<<< + * self.start = start + * self.end = end + */ + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData___init__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "bx/bbi/bbi_file.pyx":62 + * """ + * def __init__( self, bits32 start, bits32 end, int size ): + * self.start = start # <<<<<<<<<<<<<< + * self.end = end + * self.size = size + */ + __pyx_v_self->start = __pyx_v_start; + + /* "bx/bbi/bbi_file.pyx":63 + * def __init__( self, bits32 start, bits32 end, int size ): + * self.start = start + * self.end = end # <<<<<<<<<<<<<< + * self.size = size + * self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) + */ + __pyx_v_self->end = __pyx_v_end; + + /* "bx/bbi/bbi_file.pyx":64 + * self.start = start + * self.end = end + * self.size = size # <<<<<<<<<<<<<< + * self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) + */ + __pyx_v_self->size = __pyx_v_size; + + /* "bx/bbi/bbi_file.pyx":65 + * self.end = end + * self.size = size + * self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) # <<<<<<<<<<<<<< + * self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_v_self->valid_count); + __Pyx_DECREF(((PyObject *)__pyx_v_self->valid_count)); + __pyx_v_self->valid_count = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":66 + * self.size = size + * self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) # <<<<<<<<<<<<<< + * self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->min_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->min_val)); + __pyx_v_self->min_val = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":67 + * self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) # <<<<<<<<<<<<<< + * self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_squares = numpy.zeros( self.size, dtype=numpy.float64 ) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->max_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->max_val)); + __pyx_v_self->max_val = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":68 + * self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) # <<<<<<<<<<<<<< + * self.sum_squares = numpy.zeros( self.size, dtype=numpy.float64 ) + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ): + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sum_data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_data)); + __pyx_v_self->sum_data = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":69 + * self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_squares = numpy.zeros( self.size, dtype=numpy.float64 ) # <<<<<<<<<<<<<< + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ): + * cdef int base_start, base_end, base_step, overlap, j, interval_size + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_v_self->sum_squares); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_squares)); + __pyx_v_self->sum_squares = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":70 + * self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) + * self.sum_squares = numpy.zeros( self.size, dtype=numpy.float64 ) + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ): # <<<<<<<<<<<<<< + * cdef int base_start, base_end, base_step, overlap, j, interval_size + * cdef double overlap_factor, interval_weight + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_14SummarizedData_accumulate_interval_value(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, float __pyx_v_val) { + int __pyx_v_base_start; + int __pyx_v_base_end; + int __pyx_v_base_step; + int __pyx_v_overlap; + int __pyx_v_j; + int __pyx_v_interval_size; + double __pyx_v_overlap_factor; + double __pyx_v_interval_weight; + PyArrayObject *__pyx_v_valid_count = 0; + PyArrayObject *__pyx_v_min_val = 0; + PyArrayObject *__pyx_v_max_val = 0; + PyArrayObject *__pyx_v_sum_data = 0; + PyArrayObject *__pyx_v_sum_squares = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_max_val; + __Pyx_Buffer __pyx_pybuffer_max_val; + __Pyx_LocalBuf_ND __pyx_pybuffernd_min_val; + __Pyx_Buffer __pyx_pybuffer_min_val; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sum_data; + __Pyx_Buffer __pyx_pybuffer_sum_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sum_squares; + __Pyx_Buffer __pyx_pybuffer_sum_squares; + __Pyx_LocalBuf_ND __pyx_pybuffernd_valid_count; + __Pyx_Buffer __pyx_pybuffer_valid_count; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArrayObject *__pyx_t_1 = NULL; + PyArrayObject *__pyx_t_2 = NULL; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("accumulate_interval_value", 0); + __pyx_pybuffer_valid_count.pybuffer.buf = NULL; + __pyx_pybuffer_valid_count.refcount = 0; + __pyx_pybuffernd_valid_count.data = NULL; + __pyx_pybuffernd_valid_count.rcbuffer = &__pyx_pybuffer_valid_count; + __pyx_pybuffer_min_val.pybuffer.buf = NULL; + __pyx_pybuffer_min_val.refcount = 0; + __pyx_pybuffernd_min_val.data = NULL; + __pyx_pybuffernd_min_val.rcbuffer = &__pyx_pybuffer_min_val; + __pyx_pybuffer_max_val.pybuffer.buf = NULL; + __pyx_pybuffer_max_val.refcount = 0; + __pyx_pybuffernd_max_val.data = NULL; + __pyx_pybuffernd_max_val.rcbuffer = &__pyx_pybuffer_max_val; + __pyx_pybuffer_sum_data.pybuffer.buf = NULL; + __pyx_pybuffer_sum_data.refcount = 0; + __pyx_pybuffernd_sum_data.data = NULL; + __pyx_pybuffernd_sum_data.rcbuffer = &__pyx_pybuffer_sum_data; + __pyx_pybuffer_sum_squares.pybuffer.buf = NULL; + __pyx_pybuffer_sum_squares.refcount = 0; + __pyx_pybuffernd_sum_squares.data = NULL; + __pyx_pybuffernd_sum_squares.rcbuffer = &__pyx_pybuffer_sum_squares; + + /* "bx/bbi/bbi_file.pyx":74 + * cdef double overlap_factor, interval_weight + * # We locally cdef the arrays so all indexing will be at C speeds + * cdef numpy.ndarray[numpy.float64_t, ndim=1] valid_count = self.valid_count # <<<<<<<<<<<<<< + * cdef numpy.ndarray[numpy.float64_t, ndim=1] min_val = self.min_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val + */ + __pyx_t_1 = ((PyArrayObject *)__pyx_v_self->valid_count); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_valid_count = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_valid_count.diminfo[0].strides = __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valid_count.diminfo[0].shape = __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->valid_count)); + __pyx_v_valid_count = ((PyArrayObject *)__pyx_v_self->valid_count); + + /* "bx/bbi/bbi_file.pyx":75 + * # We locally cdef the arrays so all indexing will be at C speeds + * cdef numpy.ndarray[numpy.float64_t, ndim=1] valid_count = self.valid_count + * cdef numpy.ndarray[numpy.float64_t, ndim=1] min_val = self.min_val # <<<<<<<<<<<<<< + * cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_data = self.sum_data + */ + __pyx_t_2 = ((PyArrayObject *)__pyx_v_self->min_val); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_min_val = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_min_val.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_min_val.diminfo[0].strides = __pyx_pybuffernd_min_val.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_val.diminfo[0].shape = __pyx_pybuffernd_min_val.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->min_val)); + __pyx_v_min_val = ((PyArrayObject *)__pyx_v_self->min_val); + + /* "bx/bbi/bbi_file.pyx":76 + * cdef numpy.ndarray[numpy.float64_t, ndim=1] valid_count = self.valid_count + * cdef numpy.ndarray[numpy.float64_t, ndim=1] min_val = self.min_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val # <<<<<<<<<<<<<< + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_data = self.sum_data + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_squares = self.sum_squares + */ + __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->max_val); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_max_val = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_max_val.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_max_val.diminfo[0].strides = __pyx_pybuffernd_max_val.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_val.diminfo[0].shape = __pyx_pybuffernd_max_val.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->max_val)); + __pyx_v_max_val = ((PyArrayObject *)__pyx_v_self->max_val); + + /* "bx/bbi/bbi_file.pyx":77 + * cdef numpy.ndarray[numpy.float64_t, ndim=1] min_val = self.min_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_data = self.sum_data # <<<<<<<<<<<<<< + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_squares = self.sum_squares + * # Trim interval down to region of interest + */ + __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->sum_data); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_sum_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_sum_data.diminfo[0].strides = __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sum_data.diminfo[0].shape = __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->sum_data)); + __pyx_v_sum_data = ((PyArrayObject *)__pyx_v_self->sum_data); + + /* "bx/bbi/bbi_file.pyx":78 + * cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_data = self.sum_data + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_squares = self.sum_squares # <<<<<<<<<<<<<< + * # Trim interval down to region of interest + * if s < self.start: + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->sum_squares); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_sum_squares = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_sum_squares.diminfo[0].strides = __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sum_squares.diminfo[0].shape = __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->sum_squares)); + __pyx_v_sum_squares = ((PyArrayObject *)__pyx_v_self->sum_squares); + + /* "bx/bbi/bbi_file.pyx":80 + * cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_squares = self.sum_squares + * # Trim interval down to region of interest + * if s < self.start: # <<<<<<<<<<<<<< + * s = self.start + * if e > self.end: + */ + __pyx_t_6 = (__pyx_v_s < __pyx_v_self->start); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":81 + * # Trim interval down to region of interest + * if s < self.start: + * s = self.start # <<<<<<<<<<<<<< + * if e > self.end: + * e = self.end + */ + __pyx_v_s = __pyx_v_self->start; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":82 + * if s < self.start: + * s = self.start + * if e > self.end: # <<<<<<<<<<<<<< + * e = self.end + * if s >= e: + */ + __pyx_t_6 = (__pyx_v_e > __pyx_v_self->end); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":83 + * s = self.start + * if e > self.end: + * e = self.end # <<<<<<<<<<<<<< + * if s >= e: + * return + */ + __pyx_v_e = __pyx_v_self->end; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/bbi/bbi_file.pyx":84 + * if e > self.end: + * e = self.end + * if s >= e: # <<<<<<<<<<<<<< + * return + * base_step = ( self.end - self.start ) / self.size + */ + __pyx_t_6 = (__pyx_v_s >= __pyx_v_e); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":85 + * e = self.end + * if s >= e: + * return # <<<<<<<<<<<<<< + * base_step = ( self.end - self.start ) / self.size + * for j from 0 <= j < self.size: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/bbi/bbi_file.pyx":86 + * if s >= e: + * return + * base_step = ( self.end - self.start ) / self.size # <<<<<<<<<<<<<< + * for j from 0 <= j < self.size: + * base_start = self.start + ( base_step * j ) + */ + __pyx_t_7 = (__pyx_v_self->end - __pyx_v_self->start); + if (unlikely(__pyx_v_self->size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_base_step = (__pyx_t_7 / __pyx_v_self->size); + + /* "bx/bbi/bbi_file.pyx":87 + * return + * base_step = ( self.end - self.start ) / self.size + * for j from 0 <= j < self.size: # <<<<<<<<<<<<<< + * base_start = self.start + ( base_step * j ) + * base_end = base_start + base_step + */ + __pyx_t_8 = __pyx_v_self->size; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_8; __pyx_v_j++) { + + /* "bx/bbi/bbi_file.pyx":88 + * base_step = ( self.end - self.start ) / self.size + * for j from 0 <= j < self.size: + * base_start = self.start + ( base_step * j ) # <<<<<<<<<<<<<< + * base_end = base_start + base_step + * overlap = range_intersection( base_start, base_end, s, e ) + */ + __pyx_v_base_start = (__pyx_v_self->start + (__pyx_v_base_step * __pyx_v_j)); + + /* "bx/bbi/bbi_file.pyx":89 + * for j from 0 <= j < self.size: + * base_start = self.start + ( base_step * j ) + * base_end = base_start + base_step # <<<<<<<<<<<<<< + * overlap = range_intersection( base_start, base_end, s, e ) + * if overlap > 0: + */ + __pyx_v_base_end = (__pyx_v_base_start + __pyx_v_base_step); + + /* "bx/bbi/bbi_file.pyx":90 + * base_start = self.start + ( base_step * j ) + * base_end = base_start + base_step + * overlap = range_intersection( base_start, base_end, s, e ) # <<<<<<<<<<<<<< + * if overlap > 0: + * interval_size = e - s + */ + __pyx_v_overlap = __pyx_f_2bx_3bbi_8bbi_file_range_intersection(__pyx_v_base_start, __pyx_v_base_end, __pyx_v_s, __pyx_v_e); + + /* "bx/bbi/bbi_file.pyx":91 + * base_end = base_start + base_step + * overlap = range_intersection( base_start, base_end, s, e ) + * if overlap > 0: # <<<<<<<<<<<<<< + * interval_size = e - s + * overlap_factor = overlap / interval_size + */ + __pyx_t_6 = (__pyx_v_overlap > 0); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":92 + * overlap = range_intersection( base_start, base_end, s, e ) + * if overlap > 0: + * interval_size = e - s # <<<<<<<<<<<<<< + * overlap_factor = overlap / interval_size + * interval_weight = interval_size * overlap_factor + */ + __pyx_v_interval_size = (__pyx_v_e - __pyx_v_s); + + /* "bx/bbi/bbi_file.pyx":93 + * if overlap > 0: + * interval_size = e - s + * overlap_factor = overlap / interval_size # <<<<<<<<<<<<<< + * interval_weight = interval_size * overlap_factor + * valid_count[j] += interval_weight + */ + if (unlikely(__pyx_v_interval_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_overlap_factor = (((double)__pyx_v_overlap) / __pyx_v_interval_size); + + /* "bx/bbi/bbi_file.pyx":94 + * interval_size = e - s + * overlap_factor = overlap / interval_size + * interval_weight = interval_size * overlap_factor # <<<<<<<<<<<<<< + * valid_count[j] += interval_weight + * sum_data[j] += val * interval_weight + */ + __pyx_v_interval_weight = (__pyx_v_interval_size * __pyx_v_overlap_factor); + + /* "bx/bbi/bbi_file.pyx":95 + * overlap_factor = overlap / interval_size + * interval_weight = interval_size * overlap_factor + * valid_count[j] += interval_weight # <<<<<<<<<<<<<< + * sum_data[j] += val * interval_weight + * sum_squares[j] += val * val * interval_weight + */ + __pyx_t_9 = __pyx_v_j; + __pyx_t_10 = -1; + if (__pyx_t_9 < 0) { + __pyx_t_9 += __pyx_pybuffernd_valid_count.diminfo[0].shape; + if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; + } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_valid_count.diminfo[0].shape)) __pyx_t_10 = 0; + if (unlikely(__pyx_t_10 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_10); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_valid_count.diminfo[0].strides) += __pyx_v_interval_weight; + + /* "bx/bbi/bbi_file.pyx":96 + * interval_weight = interval_size * overlap_factor + * valid_count[j] += interval_weight + * sum_data[j] += val * interval_weight # <<<<<<<<<<<<<< + * sum_squares[j] += val * val * interval_weight + * if max_val[j] < val: + */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_11 = -1; + if (__pyx_t_10 < 0) { + __pyx_t_10 += __pyx_pybuffernd_sum_data.diminfo[0].shape; + if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_sum_data.diminfo[0].shape)) __pyx_t_11 = 0; + if (unlikely(__pyx_t_11 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_11); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_sum_data.diminfo[0].strides) += (__pyx_v_val * __pyx_v_interval_weight); + + /* "bx/bbi/bbi_file.pyx":97 + * valid_count[j] += interval_weight + * sum_data[j] += val * interval_weight + * sum_squares[j] += val * val * interval_weight # <<<<<<<<<<<<<< + * if max_val[j] < val: + * max_val[j] = val + */ + __pyx_t_11 = __pyx_v_j; + __pyx_t_12 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_pybuffernd_sum_squares.diminfo[0].shape; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_sum_squares.diminfo[0].shape)) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_sum_squares.diminfo[0].strides) += ((__pyx_v_val * __pyx_v_val) * __pyx_v_interval_weight); + + /* "bx/bbi/bbi_file.pyx":98 + * sum_data[j] += val * interval_weight + * sum_squares[j] += val * val * interval_weight + * if max_val[j] < val: # <<<<<<<<<<<<<< + * max_val[j] = val + * if min_val[j] > val: + */ + __pyx_t_12 = __pyx_v_j; + __pyx_t_13 = -1; + if (__pyx_t_12 < 0) { + __pyx_t_12 += __pyx_pybuffernd_max_val.diminfo[0].shape; + if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0; + } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_max_val.diminfo[0].shape)) __pyx_t_13 = 0; + if (unlikely(__pyx_t_13 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_13); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_max_val.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_max_val.diminfo[0].strides)) < __pyx_v_val); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":99 + * sum_squares[j] += val * val * interval_weight + * if max_val[j] < val: + * max_val[j] = val # <<<<<<<<<<<<<< + * if min_val[j] > val: + * min_val[j] = val + */ + __pyx_t_13 = __pyx_v_j; + __pyx_t_14 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_pybuffernd_max_val.diminfo[0].shape; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_max_val.diminfo[0].shape)) __pyx_t_14 = 0; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_max_val.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_max_val.diminfo[0].strides) = __pyx_v_val; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/bbi/bbi_file.pyx":100 + * if max_val[j] < val: + * max_val[j] = val + * if min_val[j] > val: # <<<<<<<<<<<<<< + * min_val[j] = val + * + */ + __pyx_t_14 = __pyx_v_j; + __pyx_t_15 = -1; + if (__pyx_t_14 < 0) { + __pyx_t_14 += __pyx_pybuffernd_min_val.diminfo[0].shape; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_min_val.diminfo[0].shape)) __pyx_t_15 = 0; + if (unlikely(__pyx_t_15 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_15); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_min_val.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_min_val.diminfo[0].strides)) > __pyx_v_val); + if (__pyx_t_6) { + + /* "bx/bbi/bbi_file.pyx":101 + * max_val[j] = val + * if min_val[j] > val: + * min_val[j] = val # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ + __pyx_t_15 = __pyx_v_j; + __pyx_t_16 = -1; + if (__pyx_t_15 < 0) { + __pyx_t_15 += __pyx_pybuffernd_min_val.diminfo[0].shape; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_min_val.diminfo[0].shape)) __pyx_t_16 = 0; + if (unlikely(__pyx_t_16 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_16); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_min_val.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_min_val.diminfo[0].strides) = __pyx_v_val; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L8; + } + __pyx_L8:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.accumulate_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_valid_count); + __Pyx_XDECREF((PyObject *)__pyx_v_min_val); + __Pyx_XDECREF((PyObject *)__pyx_v_max_val); + __Pyx_XDECREF((PyObject *)__pyx_v_sum_data); + __Pyx_XDECREF((PyObject *)__pyx_v_sum_squares); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":26 + * aggregation over a particular range and resolution + * """ + * cdef public bits32 start # <<<<<<<<<<<<<< + * cdef public bits32 end + * cdef public int size + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_5start_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->start = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":27 + * """ + * cdef public bits32 start + * cdef public bits32 end # <<<<<<<<<<<<<< + * cdef public int size + * cdef public numpy.ndarray valid_count + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_3end_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->end = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":28 + * cdef public bits32 start + * cdef public bits32 end + * cdef public int size # <<<<<<<<<<<<<< + * cdef public numpy.ndarray valid_count + * cdef public numpy.ndarray min_val + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_4size_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->size = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":29 + * cdef public bits32 end + * cdef public int size + * cdef public numpy.ndarray valid_count # <<<<<<<<<<<<<< + * cdef public numpy.ndarray min_val + * cdef public numpy.ndarray max_val + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->valid_count)); + __pyx_r = ((PyObject *)__pyx_v_self->valid_count); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->valid_count); + __Pyx_DECREF(((PyObject *)__pyx_v_self->valid_count)); + __pyx_v_self->valid_count = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.valid_count.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->valid_count); + __Pyx_DECREF(((PyObject *)__pyx_v_self->valid_count)); + __pyx_v_self->valid_count = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":30 + * cdef public int size + * cdef public numpy.ndarray valid_count + * cdef public numpy.ndarray min_val # <<<<<<<<<<<<<< + * cdef public numpy.ndarray max_val + * cdef public numpy.ndarray sum_data + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->min_val)); + __pyx_r = ((PyObject *)__pyx_v_self->min_val); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->min_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->min_val)); + __pyx_v_self->min_val = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.min_val.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->min_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->min_val)); + __pyx_v_self->min_val = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":31 + * cdef public numpy.ndarray valid_count + * cdef public numpy.ndarray min_val + * cdef public numpy.ndarray max_val # <<<<<<<<<<<<<< + * cdef public numpy.ndarray sum_data + * cdef public numpy.ndarray sum_squares + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->max_val)); + __pyx_r = ((PyObject *)__pyx_v_self->max_val); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->max_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->max_val)); + __pyx_v_self->max_val = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.max_val.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->max_val); + __Pyx_DECREF(((PyObject *)__pyx_v_self->max_val)); + __pyx_v_self->max_val = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":32 + * cdef public numpy.ndarray min_val + * cdef public numpy.ndarray max_val + * cdef public numpy.ndarray sum_data # <<<<<<<<<<<<<< + * cdef public numpy.ndarray sum_squares + * + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->sum_data)); + __pyx_r = ((PyObject *)__pyx_v_self->sum_data); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->sum_data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_data)); + __pyx_v_self->sum_data = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.sum_data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->sum_data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_data)); + __pyx_v_self->sum_data = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":33 + * cdef public numpy.ndarray max_val + * cdef public numpy.ndarray sum_data + * cdef public numpy.ndarray sum_squares # <<<<<<<<<<<<<< + * + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->sum_squares)); + __pyx_r = ((PyObject *)__pyx_v_self->sum_squares); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->sum_squares); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_squares)); + __pyx_v_self->sum_squares = ((PyArrayObject *)__pyx_v_value); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.SummarizedData.sum_squares.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->sum_squares); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sum_squares)); + __pyx_v_self->sum_squares = ((PyArrayObject *)Py_None); + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":107 + * Callback for `BBIFile.visit_blocks_in_region` + * """ + * cdef handle_block( self, str block_data, BBIFile bbi_file ): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_12BlockHandler_handle_block(CYTHON_UNUSED struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_block_data, CYTHON_UNUSED struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_bbi_file) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle_block", 0); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_expected_sig = 0; + PyObject *__pyx_v_type_name = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__expected_sig,&__pyx_n_s__type_name,0}; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + PyObject* values[3] = {0,0,0}; + + /* "bx/bbi/bbi_file.pyx":117 + * """ + * + * def __init__( self, file=None, expected_sig=None, type_name=None ): # <<<<<<<<<<<<<< + * if file is not None: + * self.open( file, expected_sig, type_name ) + */ + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__expected_sig); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type_name); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + __pyx_v_expected_sig = values[1]; + __pyx_v_type_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile___init__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_file, __pyx_v_expected_sig, __pyx_v_type_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile___init__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_expected_sig, PyObject *__pyx_v_type_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "bx/bbi/bbi_file.pyx":118 + * + * def __init__( self, file=None, expected_sig=None, type_name=None ): + * if file is not None: # <<<<<<<<<<<<<< + * self.open( file, expected_sig, type_name ) + * + */ + __pyx_t_1 = (__pyx_v_file != Py_None); + if (__pyx_t_1) { + + /* "bx/bbi/bbi_file.pyx":119 + * def __init__( self, file=None, expected_sig=None, type_name=None ): + * if file is not None: + * self.open( file, expected_sig, type_name ) # <<<<<<<<<<<<<< + * + * def open( self, file, expected_sig, type_name ): + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_v_expected_sig); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_expected_sig); + __Pyx_GIVEREF(__pyx_v_expected_sig); + __Pyx_INCREF(__pyx_v_type_name); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_type_name); + __Pyx_GIVEREF(__pyx_v_type_name); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_3open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_2open[] = "\n Initialize from an existing bbi file, signature (magic) must be passed\n in since this is generic. \n "; +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_3open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_expected_sig = 0; + CYTHON_UNUSED PyObject *__pyx_v_type_name = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__expected_sig,&__pyx_n_s__type_name,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open (wrapper)", 0); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__expected_sig); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type_name); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_file = values[0]; + __pyx_v_expected_sig = values[1]; + __pyx_v_type_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("open", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_2open(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_file, __pyx_v_expected_sig, __pyx_v_type_name); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":121 + * self.open( file, expected_sig, type_name ) + * + * def open( self, file, expected_sig, type_name ): # <<<<<<<<<<<<<< + * """ + * Initialize from an existing bbi file, signature (magic) must be passed + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_2open(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_expected_sig, CYTHON_UNUSED PyObject *__pyx_v_type_name) { + PyObject *__pyx_v_reader = NULL; + CYTHON_UNUSED long __pyx_v_i; + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_level = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_5; + __pyx_t_2bx_3bbi_5types_boolean __pyx_t_6; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_7; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("open", 0); + + /* "bx/bbi/bbi_file.pyx":126 + * in since this is generic. + * """ + * assert expected_sig is not None # <<<<<<<<<<<<<< + * self.file = file + * # Open the file in a BinaryFileReader, handles magic and byteswapping + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = (__pyx_v_expected_sig != Py_None); + if (unlikely(!__pyx_t_1)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/bbi/bbi_file.pyx":127 + * """ + * assert expected_sig is not None + * self.file = file # <<<<<<<<<<<<<< + * # Open the file in a BinaryFileReader, handles magic and byteswapping + * self.reader = reader = BinaryFileReader( file, expected_sig ) + */ + __Pyx_INCREF(__pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_GOTREF(__pyx_v_self->file); + __Pyx_DECREF(__pyx_v_self->file); + __pyx_v_self->file = __pyx_v_file; + + /* "bx/bbi/bbi_file.pyx":129 + * self.file = file + * # Open the file in a BinaryFileReader, handles magic and byteswapping + * self.reader = reader = BinaryFileReader( file, expected_sig ) # <<<<<<<<<<<<<< + * self.magic = expected_sig + * self.is_byteswapped = self.reader.byteswap_needed + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_v_expected_sig); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_expected_sig); + __Pyx_GIVEREF(__pyx_v_expected_sig); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->reader); + __Pyx_DECREF(__pyx_v_self->reader); + __pyx_v_self->reader = __pyx_t_4; + __Pyx_INCREF(__pyx_t_4); + __pyx_v_reader = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":130 + * # Open the file in a BinaryFileReader, handles magic and byteswapping + * self.reader = reader = BinaryFileReader( file, expected_sig ) + * self.magic = expected_sig # <<<<<<<<<<<<<< + * self.is_byteswapped = self.reader.byteswap_needed + * # Read header stuff + */ + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_expected_sig); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->magic = __pyx_t_5; + + /* "bx/bbi/bbi_file.pyx":131 + * self.reader = reader = BinaryFileReader( file, expected_sig ) + * self.magic = expected_sig + * self.is_byteswapped = self.reader.byteswap_needed # <<<<<<<<<<<<<< + * # Read header stuff + * self.version = reader.read_uint16() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self->reader, __pyx_n_s__byteswap_needed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->is_byteswapped = __pyx_t_6; + + /* "bx/bbi/bbi_file.pyx":133 + * self.is_byteswapped = self.reader.byteswap_needed + * # Read header stuff + * self.version = reader.read_uint16() # <<<<<<<<<<<<<< + * self.zoom_levels = reader.read_uint16() + * self.chrom_tree_offset = reader.read_uint64() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->version = __pyx_t_7; + + /* "bx/bbi/bbi_file.pyx":134 + * # Read header stuff + * self.version = reader.read_uint16() + * self.zoom_levels = reader.read_uint16() # <<<<<<<<<<<<<< + * self.chrom_tree_offset = reader.read_uint64() + * self.unzoomed_data_offset = reader.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->zoom_levels = __pyx_t_7; + + /* "bx/bbi/bbi_file.pyx":135 + * self.version = reader.read_uint16() + * self.zoom_levels = reader.read_uint16() + * self.chrom_tree_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.unzoomed_data_offset = reader.read_uint64() + * self.unzoomed_index_offset = reader.read_uint64() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->chrom_tree_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":136 + * self.zoom_levels = reader.read_uint16() + * self.chrom_tree_offset = reader.read_uint64() + * self.unzoomed_data_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.unzoomed_index_offset = reader.read_uint64() + * self.field_count = reader.read_uint16() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_4); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->unzoomed_data_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":137 + * self.chrom_tree_offset = reader.read_uint64() + * self.unzoomed_data_offset = reader.read_uint64() + * self.unzoomed_index_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.field_count = reader.read_uint16() + * self.defined_field_count = reader.read_uint16() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->unzoomed_index_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":138 + * self.unzoomed_data_offset = reader.read_uint64() + * self.unzoomed_index_offset = reader.read_uint64() + * self.field_count = reader.read_uint16() # <<<<<<<<<<<<<< + * self.defined_field_count = reader.read_uint16() + * self.as_offset = reader.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->field_count = __pyx_t_7; + + /* "bx/bbi/bbi_file.pyx":139 + * self.unzoomed_index_offset = reader.read_uint64() + * self.field_count = reader.read_uint16() + * self.defined_field_count = reader.read_uint16() # <<<<<<<<<<<<<< + * self.as_offset = reader.read_uint64() + * self.total_summary_offset = reader.read_uint64() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->defined_field_count = __pyx_t_7; + + /* "bx/bbi/bbi_file.pyx":140 + * self.field_count = reader.read_uint16() + * self.defined_field_count = reader.read_uint16() + * self.as_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.total_summary_offset = reader.read_uint64() + * self.uncompress_buf_size = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_4); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->as_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":141 + * self.defined_field_count = reader.read_uint16() + * self.as_offset = reader.read_uint64() + * self.total_summary_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.uncompress_buf_size = reader.read_uint32() + * # Skip reserved + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->total_summary_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":142 + * self.as_offset = reader.read_uint64() + * self.total_summary_offset = reader.read_uint64() + * self.uncompress_buf_size = reader.read_uint32() # <<<<<<<<<<<<<< + * # Skip reserved + * reader.seek( 64 ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->uncompress_buf_size = __pyx_t_5; + + /* "bx/bbi/bbi_file.pyx":144 + * self.uncompress_buf_size = reader.read_uint32() + * # Skip reserved + * reader.seek( 64 ) # <<<<<<<<<<<<<< + * # Read zoom headers + * self.level_list = [] + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":146 + * reader.seek( 64 ) + * # Read zoom headers + * self.level_list = [] # <<<<<<<<<<<<<< + * for i from 0 <= i < self.zoom_levels: + * level = ZoomLevel() + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_v_self->level_list); + __Pyx_DECREF(__pyx_v_self->level_list); + __pyx_v_self->level_list = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":147 + * # Read zoom headers + * self.level_list = [] + * for i from 0 <= i < self.zoom_levels: # <<<<<<<<<<<<<< + * level = ZoomLevel() + * level.bbi_file = self + */ + __pyx_t_7 = __pyx_v_self->zoom_levels; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "bx/bbi/bbi_file.pyx":148 + * self.level_list = [] + * for i from 0 <= i < self.zoom_levels: + * level = ZoomLevel() # <<<<<<<<<<<<<< + * level.bbi_file = self + * level.reduction_level = reader.read_uint32() + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_ZoomLevel)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(((PyObject *)__pyx_v_level)); + __pyx_v_level = ((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":149 + * for i from 0 <= i < self.zoom_levels: + * level = ZoomLevel() + * level.bbi_file = self # <<<<<<<<<<<<<< + * level.reduction_level = reader.read_uint32() + * level.reserved = reader.read_uint32() + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_level->bbi_file); + __Pyx_DECREF(((PyObject *)__pyx_v_level->bbi_file)); + __pyx_v_level->bbi_file = __pyx_v_self; + + /* "bx/bbi/bbi_file.pyx":150 + * level = ZoomLevel() + * level.bbi_file = self + * level.reduction_level = reader.read_uint32() # <<<<<<<<<<<<<< + * level.reserved = reader.read_uint32() + * level.data_offset = reader.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_level->reduction_level = __pyx_t_5; + + /* "bx/bbi/bbi_file.pyx":151 + * level.bbi_file = self + * level.reduction_level = reader.read_uint32() + * level.reserved = reader.read_uint32() # <<<<<<<<<<<<<< + * level.data_offset = reader.read_uint64() + * level.index_offset = reader.read_uint64() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_level->reserved = __pyx_t_5; + + /* "bx/bbi/bbi_file.pyx":152 + * level.reduction_level = reader.read_uint32() + * level.reserved = reader.read_uint32() + * level.data_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * level.index_offset = reader.read_uint64() + * self.level_list.append( level ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_4); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_level->data_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":153 + * level.reserved = reader.read_uint32() + * level.data_offset = reader.read_uint64() + * level.index_offset = reader.read_uint64() # <<<<<<<<<<<<<< + * self.level_list.append( level ) + * # Initialize and attach embedded BPTFile containing chromosome names and ids + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_8 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_level->index_offset = __pyx_t_8; + + /* "bx/bbi/bbi_file.pyx":154 + * level.data_offset = reader.read_uint64() + * level.index_offset = reader.read_uint64() + * self.level_list.append( level ) # <<<<<<<<<<<<<< + * # Initialize and attach embedded BPTFile containing chromosome names and ids + * reader.seek( self.chrom_tree_offset ) + */ + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_self->level_list, ((PyObject *)__pyx_v_level)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "bx/bbi/bbi_file.pyx":156 + * self.level_list.append( level ) + * # Initialize and attach embedded BPTFile containing chromosome names and ids + * reader.seek( self.chrom_tree_offset ) # <<<<<<<<<<<<<< + * self.chrom_bpt = BPTFile( file=self.file ) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLongLong(__pyx_v_self->chrom_tree_offset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":157 + * # Initialize and attach embedded BPTFile containing chromosome names and ids + * reader.seek( self.chrom_tree_offset ) + * self.chrom_bpt = BPTFile( file=self.file ) # <<<<<<<<<<<<<< + * + * cdef visit_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end, BlockHandler handler ): + */ + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__file), __pyx_v_self->file) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->chrom_bpt); + __Pyx_DECREF(((PyObject *)__pyx_v_self->chrom_bpt)); + __pyx_v_self->chrom_bpt = ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_t_2); + __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XDECREF((PyObject *)__pyx_v_level); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":159 + * self.chrom_bpt = BPTFile( file=self.file ) + * + * cdef visit_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end, BlockHandler handler ): # <<<<<<<<<<<<<< + * """ + * Visit each block from the full data that overlaps a specific region + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_visit_blocks_in_region(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *__pyx_v_handler) { + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *__pyx_v_ctf = 0; + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_v_block_list = NULL; + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_v_size = NULL; + PyObject *__pyx_v_block_data = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("visit_blocks_in_region", 0); + + /* "bx/bbi/bbi_file.pyx":164 + * """ + * cdef CIRTreeFile ctf + * reader = self.reader # <<<<<<<<<<<<<< + * reader.seek( self.unzoomed_index_offset ) + * ctf = CIRTreeFile( reader.file ) + */ + __Pyx_INCREF(__pyx_v_self->reader); + __pyx_v_reader = __pyx_v_self->reader; + + /* "bx/bbi/bbi_file.pyx":165 + * cdef CIRTreeFile ctf + * reader = self.reader + * reader.seek( self.unzoomed_index_offset ) # <<<<<<<<<<<<<< + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLongLong(__pyx_v_self->unzoomed_index_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":166 + * reader = self.reader + * reader.seek( self.unzoomed_index_offset ) + * ctf = CIRTreeFile( reader.file ) # <<<<<<<<<<<<<< + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + * for offset, size in block_list: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_ctf = ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":167 + * reader.seek( self.unzoomed_index_offset ) + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) # <<<<<<<<<<<<<< + * for offset, size in block_list: + * # Seek to and read all data for the block + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_ctf), __pyx_n_s_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_block_list = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":168 + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + * for offset, size in block_list: # <<<<<<<<<<<<<< + * # Seek to and read all data for the block + * reader.seek( offset ) + */ + if (PyList_CheckExact(__pyx_v_block_list) || PyTuple_CheckExact(__pyx_v_block_list)) { + __pyx_t_4 = __pyx_v_block_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_block_list); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else { + __pyx_t_5 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_offset); + __pyx_v_offset = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_size); + __pyx_v_size = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":170 + * for offset, size in block_list: + * # Seek to and read all data for the block + * reader.seek( offset ) # <<<<<<<<<<<<<< + * block_data = reader.read( size ) + * # Might need to uncompress + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":171 + * # Seek to and read all data for the block + * reader.seek( offset ) + * block_data = reader.read( size ) # <<<<<<<<<<<<<< + * # Might need to uncompress + * if self.uncompress_buf_size > 0: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_size); + __Pyx_GIVEREF(__pyx_v_size); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_block_data); + __pyx_v_block_data = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":173 + * block_data = reader.read( size ) + * # Might need to uncompress + * if self.uncompress_buf_size > 0: # <<<<<<<<<<<<<< + * block_data = zlib.decompress( block_data ) + * handler.handle_block( block_data, self ) + */ + __pyx_t_9 = (__pyx_v_self->uncompress_buf_size > 0); + if (__pyx_t_9) { + + /* "bx/bbi/bbi_file.pyx":174 + * # Might need to uncompress + * if self.uncompress_buf_size > 0: + * block_data = zlib.decompress( block_data ) # <<<<<<<<<<<<<< + * handler.handle_block( block_data, self ) + * + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__zlib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__decompress); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_block_data); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_block_data); + __Pyx_GIVEREF(__pyx_v_block_data); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_block_data); + __pyx_v_block_data = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/bbi/bbi_file.pyx":175 + * if self.uncompress_buf_size > 0: + * block_data = zlib.decompress( block_data ) + * handler.handle_block( block_data, self ) # <<<<<<<<<<<<<< + * + * cpdef summarize( self, char * chrom, bits32 start, bits32 end, int summary_size ): + */ + if (!(likely(PyString_CheckExact(__pyx_v_block_data))||((__pyx_v_block_data) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_block_data)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_block_data; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_handler->__pyx_vtab)->handle_block(__pyx_v_handler, ((PyObject*)__pyx_t_2), __pyx_v_self); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.visit_blocks_in_region", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ctf); + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XDECREF(__pyx_v_block_list); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XDECREF(__pyx_v_size); + __Pyx_XDECREF(__pyx_v_block_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":177 + * handler.handle_block( block_data, self ) + * + * cpdef summarize( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Gets `summary_size` data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5summarize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_summarize(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size, int __pyx_skip_dispatch) { + PyObject *__pyx_v_chrom_id = NULL; + CYTHON_UNUSED PyObject *__pyx_v_chrom_size = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_size; + int __pyx_v_full_reduction; + int __pyx_v_zoom; + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_zoom_level = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("summarize", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__summarize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5summarize)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bbi_file.pyx":181 + * Gets `summary_size` data points over the regions `chrom`:`start`-`end`. + * """ + * if start >= end: # <<<<<<<<<<<<<< + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + */ + __pyx_t_7 = (__pyx_v_start >= __pyx_v_end); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":182 + * """ + * if start >= end: + * return None # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":183 + * if start >= end: + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) # <<<<<<<<<<<<<< + * if chrom_id is None: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->_get_chrom_id_and_size(__pyx_v_self, __pyx_v_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_v_chrom_size = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/bbi/bbi_file.pyx":184 + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: # <<<<<<<<<<<<<< + * return None + * # Return value will be a structured array (rather than an array + */ + __pyx_t_7 = (__pyx_v_chrom_id == Py_None); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":185 + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + * return None # <<<<<<<<<<<<<< + * # Return value will be a structured array (rather than an array + * # of summary element structures + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bbi_file.pyx":190 + * + * # Find appropriate zoom level + * cdef bits32 base_size = end - start # <<<<<<<<<<<<<< + * cdef int full_reduction = base_size / summary_size + * cdef int zoom = full_reduction / 2 + */ + __pyx_v_base_size = (__pyx_v_end - __pyx_v_start); + + /* "bx/bbi/bbi_file.pyx":191 + * # Find appropriate zoom level + * cdef bits32 base_size = end - start + * cdef int full_reduction = base_size / summary_size # <<<<<<<<<<<<<< + * cdef int zoom = full_reduction / 2 + * if zoom < 0: + */ + if (unlikely(__pyx_v_summary_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_full_reduction = (__pyx_v_base_size / __pyx_v_summary_size); + + /* "bx/bbi/bbi_file.pyx":192 + * cdef bits32 base_size = end - start + * cdef int full_reduction = base_size / summary_size + * cdef int zoom = full_reduction / 2 # <<<<<<<<<<<<<< + * if zoom < 0: + * zoom = 0 + */ + __pyx_v_zoom = __Pyx_div_long(__pyx_v_full_reduction, 2); + + /* "bx/bbi/bbi_file.pyx":193 + * cdef int full_reduction = base_size / summary_size + * cdef int zoom = full_reduction / 2 + * if zoom < 0: # <<<<<<<<<<<<<< + * zoom = 0 + * cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) + */ + __pyx_t_7 = (__pyx_v_zoom < 0); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":194 + * cdef int zoom = full_reduction / 2 + * if zoom < 0: + * zoom = 0 # <<<<<<<<<<<<<< + * cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) + * if zoom_level is not None: + */ + __pyx_v_zoom = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/bbi/bbi_file.pyx":195 + * if zoom < 0: + * zoom = 0 + * cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) # <<<<<<<<<<<<<< + * if zoom_level is not None: + * return zoom_level._summarize( chrom_id, start, end, summary_size ) + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->_best_zoom_level(__pyx_v_self, __pyx_v_zoom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_2bx_3bbi_8bbi_file_ZoomLevel))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_zoom_level = ((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":196 + * zoom = 0 + * cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) + * if zoom_level is not None: # <<<<<<<<<<<<<< + * return zoom_level._summarize( chrom_id, start, end, summary_size ) + * else: + */ + __pyx_t_7 = (((PyObject *)__pyx_v_zoom_level) != Py_None); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":197 + * cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) + * if zoom_level is not None: + * return zoom_level._summarize( chrom_id, start, end, summary_size ) # <<<<<<<<<<<<<< + * else: + * return self._summarize_from_full( chrom_id, start, end, summary_size ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_zoom_level->__pyx_vtab)->_summarize(__pyx_v_zoom_level, __pyx_t_9, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + /*else*/ { + + /* "bx/bbi/bbi_file.pyx":199 + * return zoom_level._summarize( chrom_id, start, end, summary_size ) + * else: + * return self._summarize_from_full( chrom_id, start, end, summary_size ) # <<<<<<<<<<<<<< + * + * cpdef summarize_from_full( self, char * chrom, bits32 start, bits32 end, int summary_size ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->_summarize_from_full(__pyx_v_self, __pyx_t_9, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L8:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XDECREF((PyObject *)__pyx_v_zoom_level); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5summarize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_4summarize[] = "\n Gets `summary_size` data points over the regions `chrom`:`start`-`end`.\n "; +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5summarize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_summary_size; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("summarize (wrapper)", 0); + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "summarize") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("summarize", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_4summarize(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":177 + * handler.handle_block( block_data, self ) + * + * cpdef summarize( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Gets `summary_size` data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_4summarize(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("summarize", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->summarize(__pyx_v_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":201 + * return self._summarize_from_full( chrom_id, start, end, summary_size ) + * + * cpdef summarize_from_full( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Gets `summary_size` data points over the regions `chrom`:`start`-`end`, + */ + +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7summarize_from_full(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_summarize_from_full(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size, int __pyx_skip_dispatch) { + PyObject *__pyx_v_chrom_id = NULL; + CYTHON_UNUSED PyObject *__pyx_v_chrom_size = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("summarize_from_full", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__summarize_from_full); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7summarize_from_full)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bbi_file.pyx":206 + * always using the raw data points + * """ + * if start >= end: # <<<<<<<<<<<<<< + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + */ + __pyx_t_7 = (__pyx_v_start >= __pyx_v_end); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":207 + * """ + * if start >= end: + * return None # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":208 + * if start >= end: + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) # <<<<<<<<<<<<<< + * if chrom_id is None: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->_get_chrom_id_and_size(__pyx_v_self, __pyx_v_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_v_chrom_size = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/bbi/bbi_file.pyx":209 + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: # <<<<<<<<<<<<<< + * return None + * # Return value will be a structured array (rather than an array + */ + __pyx_t_7 = (__pyx_v_chrom_id == Py_None); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":210 + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + * return None # <<<<<<<<<<<<<< + * # Return value will be a structured array (rather than an array + * # of summary element structures + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bbi_file.pyx":213 + * # Return value will be a structured array (rather than an array + * # of summary element structures + * return self._summarize_from_full( chrom_id, start, end, summary_size ) # <<<<<<<<<<<<<< + * + * cpdef query( self, char * chrom, bits32 start, bits32 end, int summary_size ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_9 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->_summarize_from_full(__pyx_v_self, __pyx_t_9, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize_from_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7summarize_from_full(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_6summarize_from_full[] = "\n Gets `summary_size` data points over the regions `chrom`:`start`-`end`, \n always using the raw data points\n "; +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7summarize_from_full(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_summary_size; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("summarize_from_full (wrapper)", 0); + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize_from_full", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize_from_full", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("summarize_from_full", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "summarize_from_full") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("summarize_from_full", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize_from_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_6summarize_from_full(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":201 + * return self._summarize_from_full( chrom_id, start, end, summary_size ) + * + * cpdef summarize_from_full( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Gets `summary_size` data points over the regions `chrom`:`start`-`end`, + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_6summarize_from_full(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("summarize_from_full", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->summarize_from_full(__pyx_v_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.summarize_from_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":215 + * return self._summarize_from_full( chrom_id, start, end, summary_size ) + * + * cpdef query( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Provides a different view of summary for region, a list of dictionaries + */ + +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_9query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_query(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size, int __pyx_skip_dispatch) { + PyObject *__pyx_v_results = NULL; + PyObject *__pyx_v_rval = NULL; + int __pyx_v_i; + PyObject *__pyx_v_sum_data = NULL; + PyObject *__pyx_v_valid_count = NULL; + PyObject *__pyx_v_mean = NULL; + PyObject *__pyx_v_coverage = NULL; + PyObject *__pyx_v_variance = NULL; + PyObject *__pyx_v_std_dev = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_12; + long __pyx_t_13; + int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("query", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__query); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_9query)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bbi_file.pyx":221 + * """ + * + * if end > 2147483647 or start < 0: # <<<<<<<<<<<<<< + * raise ValueError + * results = self.summarize(chrom, start, end, summary_size) + */ + __pyx_t_7 = (__pyx_v_end > 2147483647); + if (!__pyx_t_7) { + __pyx_t_8 = (__pyx_v_start < 0); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_7; + } + if (__pyx_t_9) { + + /* "bx/bbi/bbi_file.pyx":222 + * + * if end > 2147483647 or start < 0: + * raise ValueError # <<<<<<<<<<<<<< + * results = self.summarize(chrom, start, end, summary_size) + * if not results: + */ + __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":223 + * if end > 2147483647 or start < 0: + * raise ValueError + * results = self.summarize(chrom, start, end, summary_size) # <<<<<<<<<<<<<< + * if not results: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->summarize(__pyx_v_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_results = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":224 + * raise ValueError + * results = self.summarize(chrom, start, end, summary_size) + * if not results: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_results); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (!__pyx_t_9); + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":225 + * results = self.summarize(chrom, start, end, summary_size) + * if not results: + * return None # <<<<<<<<<<<<<< + * + * rval = [] + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/bbi/bbi_file.pyx":227 + * return None + * + * rval = [] # <<<<<<<<<<<<<< + * for i in range(summary_size): + * sum_data = results.sum_data[i] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":228 + * + * rval = [] + * for i in range(summary_size): # <<<<<<<<<<<<<< + * sum_data = results.sum_data[i] + * valid_count = results.valid_count[i] + */ + __pyx_t_10 = __pyx_v_summary_size; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; + + /* "bx/bbi/bbi_file.pyx":229 + * rval = [] + * for i in range(summary_size): + * sum_data = results.sum_data[i] # <<<<<<<<<<<<<< + * valid_count = results.valid_count[i] + * mean = sum_data / valid_count + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__sum_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_sum_data); + __pyx_v_sum_data = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":230 + * for i in range(summary_size): + * sum_data = results.sum_data[i] + * valid_count = results.valid_count[i] # <<<<<<<<<<<<<< + * mean = sum_data / valid_count + * coverage = summary_size / (end - start) * valid_count + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__valid_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_valid_count); + __pyx_v_valid_count = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":231 + * sum_data = results.sum_data[i] + * valid_count = results.valid_count[i] + * mean = sum_data / valid_count # <<<<<<<<<<<<<< + * coverage = summary_size / (end - start) * valid_count + * + */ + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_sum_data, __pyx_v_valid_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_mean); + __pyx_v_mean = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":232 + * valid_count = results.valid_count[i] + * mean = sum_data / valid_count + * coverage = summary_size / (end - start) * valid_count # <<<<<<<<<<<<<< + * + * # print results.sum_squares[i], sum_data, valid_count + */ + __pyx_t_12 = (__pyx_v_end - __pyx_v_start); + if (unlikely(__pyx_t_12 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyFloat_FromDouble((((double)__pyx_v_summary_size) / __pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_valid_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_coverage); + __pyx_v_coverage = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":235 + * + * # print results.sum_squares[i], sum_data, valid_count + * variance = results.sum_squares[i] - sum_data * sum_data / valid_count # <<<<<<<<<<<<<< + * if valid_count > 1: + * variance /= valid_count - 1 + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__sum_squares); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Multiply(__pyx_v_sum_data, __pyx_v_sum_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_valid_count); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_variance); + __pyx_v_variance = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":236 + * # print results.sum_squares[i], sum_data, valid_count + * variance = results.sum_squares[i] - sum_data * sum_data / valid_count + * if valid_count > 1: # <<<<<<<<<<<<<< + * variance /= valid_count - 1 + * std_dev = math.sqrt(max(variance, 0)) + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_valid_count, __pyx_int_1, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":237 + * variance = results.sum_squares[i] - sum_data * sum_data / valid_count + * if valid_count > 1: + * variance /= valid_count - 1 # <<<<<<<<<<<<<< + * std_dev = math.sqrt(max(variance, 0)) + * + */ + __pyx_t_5 = PyNumber_Subtract(__pyx_v_valid_count, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_variance, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_variance); + __pyx_v_variance = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/bbi/bbi_file.pyx":238 + * if valid_count > 1: + * variance /= valid_count - 1 + * std_dev = math.sqrt(max(variance, 0)) # <<<<<<<<<<<<<< + * + * rval.append( { "mean": mean, "max": results.max_val[i], "min": results.min_val[i], \ + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_13 = 0; + __Pyx_INCREF(__pyx_v_variance); + __pyx_t_6 = __pyx_v_variance; + __pyx_t_4 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __Pyx_INCREF(__pyx_t_6); + __pyx_t_1 = __pyx_t_6; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_std_dev); + __pyx_v_std_dev = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":240 + * std_dev = math.sqrt(max(variance, 0)) + * + * rval.append( { "mean": mean, "max": results.max_val[i], "min": results.min_val[i], \ # <<<<<<<<<<<<<< + * "coverage": coverage, "std_dev": std_dev } ) + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mean), __pyx_v_mean) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__max_val); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__max), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_results, __pyx_n_s__min_val); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__min), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "bx/bbi/bbi_file.pyx":241 + * + * rval.append( { "mean": mean, "max": results.max_val[i], "min": results.min_val[i], \ + * "coverage": coverage, "std_dev": std_dev } ) # <<<<<<<<<<<<<< + * + * return rval + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__coverage), __pyx_v_coverage) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__std_dev), __pyx_v_std_dev) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyList_Append(__pyx_v_rval, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + + /* "bx/bbi/bbi_file.pyx":243 + * "coverage": coverage, "std_dev": std_dev } ) + * + * return rval # <<<<<<<<<<<<<< + * + * cdef _get_chrom_id_and_size( self, char * chrom ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.query", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_sum_data); + __Pyx_XDECREF(__pyx_v_valid_count); + __Pyx_XDECREF(__pyx_v_mean); + __Pyx_XDECREF(__pyx_v_coverage); + __Pyx_XDECREF(__pyx_v_variance); + __Pyx_XDECREF(__pyx_v_std_dev); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_9query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_8query[] = "\n Provides a different view of summary for region, a list of dictionaries\n with keys: mean, max, min, coverage, std_dev\n "; +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_9query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_summary_size; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("query (wrapper)", 0); + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("query", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("query", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("query", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("query", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.query", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_8query(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":215 + * return self._summarize_from_full( chrom_id, start, end, summary_size ) + * + * cpdef query( self, char * chrom, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Provides a different view of summary for region, a list of dictionaries + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_8query(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("query", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self->__pyx_vtab)->query(__pyx_v_self, __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_summary_size, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.query", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":245 + * return rval + * + * cdef _get_chrom_id_and_size( self, char * chrom ): # <<<<<<<<<<<<<< + * """ + * Lookup id and size from the chromosome named `chrom` + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__get_chrom_id_and_size(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, char *__pyx_v_chrom) { + PyObject *__pyx_v_bytes = NULL; + PyObject *__pyx_v_chrom_id = NULL; + PyObject *__pyx_v_chrom_size = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *(*__pyx_t_7)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_chrom_id_and_size", 0); + + /* "bx/bbi/bbi_file.pyx":249 + * Lookup id and size from the chromosome named `chrom` + * """ + * bytes = self.chrom_bpt.find( chrom ) # <<<<<<<<<<<<<< + * if bytes is not None: + * # The value is two 32 bit uints, use the BPT's reader for checking byteswapping + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->chrom_bpt), __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_bytes = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":250 + * """ + * bytes = self.chrom_bpt.find( chrom ) + * if bytes is not None: # <<<<<<<<<<<<<< + * # The value is two 32 bit uints, use the BPT's reader for checking byteswapping + * assert len( bytes ) == 8 + */ + __pyx_t_4 = (__pyx_v_bytes != Py_None); + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":252 + * if bytes is not None: + * # The value is two 32 bit uints, use the BPT's reader for checking byteswapping + * assert len( bytes ) == 8 # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self.chrom_bpt.reader.unpack( "II", bytes ) + * return chrom_id, chrom_size + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_5 = PyObject_Length(__pyx_v_bytes); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!(__pyx_t_5 == 8))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/bbi/bbi_file.pyx":253 + * # The value is two 32 bit uints, use the BPT's reader for checking byteswapping + * assert len( bytes ) == 8 + * chrom_id, chrom_size = self.chrom_bpt.reader.unpack( "II", bytes ) # <<<<<<<<<<<<<< + * return chrom_id, chrom_size + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->chrom_bpt->reader, __pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_n_s__II)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__II)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__II)); + __Pyx_INCREF(__pyx_v_bytes); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_bytes); + __Pyx_GIVEREF(__pyx_v_bytes); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_v_chrom_size = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":254 + * assert len( bytes ) == 8 + * chrom_id, chrom_size = self.chrom_bpt.reader.unpack( "II", bytes ) + * return chrom_id, chrom_size # <<<<<<<<<<<<<< + * else: + * return None, None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_chrom_id); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom_id); + __Pyx_GIVEREF(__pyx_v_chrom_id); + __Pyx_INCREF(__pyx_v_chrom_size); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_chrom_size); + __Pyx_GIVEREF(__pyx_v_chrom_size); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "bx/bbi/bbi_file.pyx":256 + * return chrom_id, chrom_size + * else: + * return None, None # <<<<<<<<<<<<<< + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_k_tuple_3)); + __pyx_r = ((PyObject *)__pyx_k_tuple_3); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile._get_chrom_id_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_bytes); + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":258 + * return None, None + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Create summary from full data. This is data specific so must be overridden. + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__summarize_from_full(CYTHON_UNUSED struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, CYTHON_UNUSED __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, CYTHON_UNUSED __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, CYTHON_UNUSED __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, CYTHON_UNUSED int __pyx_v_summary_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_summarize_from_full", 0); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":264 + * pass + * + * cdef _best_zoom_level( self, int desired_reduction ): # <<<<<<<<<<<<<< + * if desired_reduction <= 1: + * return None + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__best_zoom_level(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, int __pyx_v_desired_reduction) { + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_level = 0; + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_closest_level = 0; + int __pyx_v_diff; + int __pyx_v_closest_diff; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_best_zoom_level", 0); + + /* "bx/bbi/bbi_file.pyx":265 + * + * cdef _best_zoom_level( self, int desired_reduction ): + * if desired_reduction <= 1: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = (__pyx_v_desired_reduction <= 1); + if (__pyx_t_1) { + + /* "bx/bbi/bbi_file.pyx":266 + * cdef _best_zoom_level( self, int desired_reduction ): + * if desired_reduction <= 1: + * return None # <<<<<<<<<<<<<< + * + * cdef ZoomLevel level, closest_level + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":269 + * + * cdef ZoomLevel level, closest_level + * cdef int diff, closest_diff = limits.INT_MAX # <<<<<<<<<<<<<< + * + * closest_level = None + */ + __pyx_v_closest_diff = INT_MAX; + + /* "bx/bbi/bbi_file.pyx":271 + * cdef int diff, closest_diff = limits.INT_MAX + * + * closest_level = None # <<<<<<<<<<<<<< + * for level in self.level_list: + * diff = desired_reduction - level.reduction_level + */ + __Pyx_INCREF(Py_None); + __pyx_v_closest_level = ((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)Py_None); + + /* "bx/bbi/bbi_file.pyx":272 + * + * closest_level = None + * for level in self.level_list: # <<<<<<<<<<<<<< + * diff = desired_reduction - level.reduction_level + * if diff >= 0 and diff < closest_diff: + */ + if (PyList_CheckExact(__pyx_v_self->level_list) || PyTuple_CheckExact(__pyx_v_self->level_list)) { + __pyx_t_2 = __pyx_v_self->level_list; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->level_list); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_2bx_3bbi_8bbi_file_ZoomLevel))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_level)); + __pyx_v_level = ((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":273 + * closest_level = None + * for level in self.level_list: + * diff = desired_reduction - level.reduction_level # <<<<<<<<<<<<<< + * if diff >= 0 and diff < closest_diff: + * closest_diff = diff + */ + __pyx_v_diff = (__pyx_v_desired_reduction - __pyx_v_level->reduction_level); + + /* "bx/bbi/bbi_file.pyx":274 + * for level in self.level_list: + * diff = desired_reduction - level.reduction_level + * if diff >= 0 and diff < closest_diff: # <<<<<<<<<<<<<< + * closest_diff = diff + * closest_level = level + */ + __pyx_t_1 = (__pyx_v_diff >= 0); + if (__pyx_t_1) { + __pyx_t_6 = (__pyx_v_diff < __pyx_v_closest_diff); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (__pyx_t_7) { + + /* "bx/bbi/bbi_file.pyx":275 + * diff = desired_reduction - level.reduction_level + * if diff >= 0 and diff < closest_diff: + * closest_diff = diff # <<<<<<<<<<<<<< + * closest_level = level + * return closest_level + */ + __pyx_v_closest_diff = __pyx_v_diff; + + /* "bx/bbi/bbi_file.pyx":276 + * if diff >= 0 and diff < closest_diff: + * closest_diff = diff + * closest_level = level # <<<<<<<<<<<<<< + * return closest_level + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_level)); + __Pyx_DECREF(((PyObject *)__pyx_v_closest_level)); + __pyx_v_closest_level = __pyx_v_level; + goto __pyx_L6; + } + __pyx_L6:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":277 + * closest_diff = diff + * closest_level = level + * return closest_level # <<<<<<<<<<<<<< + * + * cdef class ZoomLevel: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_closest_level)); + __pyx_r = ((PyObject *)__pyx_v_closest_level); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile._best_zoom_level", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_level); + __Pyx_XDECREF((PyObject *)__pyx_v_closest_level); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":56 + * cdef object reader + * # The magic number or type signature (whether the file is bigWig or bigBed or...) + * cdef public bits32 magic # <<<<<<<<<<<<<< + * # Is the file byteswapped relative to our native byte order? + * cdef boolean is_byteswapped + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->magic); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.magic.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_5magic_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->magic = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.magic.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":62 + * cdef BPTFile chrom_bpt + * # Version number + * cdef public bits16 version # <<<<<<<<<<<<<< + * # Number of zoom levels + * cdef public bits16 zoom_levels + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_7version_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->version = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.version.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":64 + * cdef public bits16 version + * # Number of zoom levels + * cdef public bits16 zoom_levels # <<<<<<<<<<<<<< + * # Offset to chromosome index + * cdef bits64 chrom_tree_offset + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->zoom_levels); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.zoom_levels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedShort(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->zoom_levels = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.BBIFile.zoom_levels.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pxd":81 + * cdef bits32 uncompress_buf_size + * # Zoom levels list + * cdef public object level_list # <<<<<<<<<<<<<< + * + * cdef visit_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end, BlockHandler handler ) + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->level_list); + __pyx_r = __pyx_v_self->level_list; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__", 0); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->level_list); + __Pyx_DECREF(__pyx_v_self->level_list); + __pyx_v_self->level_list = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_4__del__(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_7BBIFile_10level_list_4__del__(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->level_list); + __Pyx_DECREF(__pyx_v_self->level_list); + __pyx_v_self->level_list = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_1_summary_blocks_in_region(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bbi_file_9ZoomLevel__summary_blocks_in_region[] = "\n Return a list of all SummaryBlocks that overlap the region \n `chrom_id`:`start`-`end`\n "; +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_1_summary_blocks_in_region(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,0}; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_summary_blocks_in_region (wrapper)", 0); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_summary_blocks_in_region", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_summary_blocks_in_region", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_summary_blocks_in_region") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_summary_blocks_in_region", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel._summary_blocks_in_region", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel__summary_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self), __pyx_v_chrom_id, __pyx_v_start, __pyx_v_end); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":287 + * cdef int item_count + * + * def _summary_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Return a list of all SummaryBlocks that overlap the region + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel__summary_blocks_in_region(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end) { + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *__pyx_v_ctf = 0; + struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *__pyx_v_summary = 0; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_v_block_list = NULL; + PyObject *__pyx_v_offset = NULL; + PyObject *__pyx_v_size = NULL; + PyObject *__pyx_v_block_data = NULL; + PyObject *__pyx_v_block_size = NULL; + PyObject *__pyx_v_item_count = NULL; + PyObject *__pyx_v_block_reader = NULL; + CYTHON_UNUSED long __pyx_v_i; + PyObject *__pyx_v_sum_chrom_id = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + long __pyx_t_11; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_12; + double __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_summary_blocks_in_region", 0); + + /* "bx/bbi/bbi_file.pyx":294 + * cdef CIRTreeFile ctf + * cdef SummaryBlock summary + * rval = deque() # <<<<<<<<<<<<<< + * reader = self.bbi_file.reader + * reader.seek( self.index_offset ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__deque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rval = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":295 + * cdef SummaryBlock summary + * rval = deque() + * reader = self.bbi_file.reader # <<<<<<<<<<<<<< + * reader.seek( self.index_offset ) + * ctf = CIRTreeFile( reader.file ) + */ + __Pyx_INCREF(__pyx_v_self->bbi_file->reader); + __pyx_v_reader = __pyx_v_self->bbi_file->reader; + + /* "bx/bbi/bbi_file.pyx":296 + * rval = deque() + * reader = self.bbi_file.reader + * reader.seek( self.index_offset ) # <<<<<<<<<<<<<< + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyLong_FromUnsignedLongLong(__pyx_v_self->index_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":297 + * reader = self.bbi_file.reader + * reader.seek( self.index_offset ) + * ctf = CIRTreeFile( reader.file ) # <<<<<<<<<<<<<< + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + * for offset, size in block_list: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_ctf = ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":298 + * reader.seek( self.index_offset ) + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) # <<<<<<<<<<<<<< + * for offset, size in block_list: + * # Seek to and read all data for the block + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_ctf), __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_block_list = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":299 + * ctf = CIRTreeFile( reader.file ) + * block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + * for offset, size in block_list: # <<<<<<<<<<<<<< + * # Seek to and read all data for the block + * reader.seek( offset ) + */ + if (PyList_CheckExact(__pyx_v_block_list) || PyTuple_CheckExact(__pyx_v_block_list)) { + __pyx_t_4 = __pyx_v_block_list; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_block_list); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; + } + for (;;) { + if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else { + __pyx_t_5 = __pyx_t_7(__pyx_t_4); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_offset); + __pyx_v_offset = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_size); + __pyx_v_size = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":301 + * for offset, size in block_list: + * # Seek to and read all data for the block + * reader.seek( offset ) # <<<<<<<<<<<<<< + * block_data = reader.read( size ) + * # Might need to uncompress + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_offset); + __Pyx_GIVEREF(__pyx_v_offset); + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":302 + * # Seek to and read all data for the block + * reader.seek( offset ) + * block_data = reader.read( size ) # <<<<<<<<<<<<<< + * # Might need to uncompress + * if self.bbi_file.uncompress_buf_size > 0: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_size); + __Pyx_GIVEREF(__pyx_v_size); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_block_data); + __pyx_v_block_data = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":304 + * block_data = reader.read( size ) + * # Might need to uncompress + * if self.bbi_file.uncompress_buf_size > 0: # <<<<<<<<<<<<<< + * ## block_data = zlib.decompress( block_data, buf_size = self.bbi_file.uncompress_buf_size ) + * block_data = zlib.decompress( block_data ) + */ + __pyx_t_9 = (__pyx_v_self->bbi_file->uncompress_buf_size > 0); + if (__pyx_t_9) { + + /* "bx/bbi/bbi_file.pyx":306 + * if self.bbi_file.uncompress_buf_size > 0: + * ## block_data = zlib.decompress( block_data, buf_size = self.bbi_file.uncompress_buf_size ) + * block_data = zlib.decompress( block_data ) # <<<<<<<<<<<<<< + * block_size = len( block_data ) + * # The block should be a bunch of summaries. + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__zlib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__decompress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_block_data); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_block_data); + __Pyx_GIVEREF(__pyx_v_block_data); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_block_data); + __pyx_v_block_data = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/bbi/bbi_file.pyx":307 + * ## block_data = zlib.decompress( block_data, buf_size = self.bbi_file.uncompress_buf_size ) + * block_data = zlib.decompress( block_data ) + * block_size = len( block_data ) # <<<<<<<<<<<<<< + * # The block should be a bunch of summaries. + * assert block_size % summary_on_disk_size == 0 + */ + __pyx_t_10 = PyObject_Length(__pyx_v_block_data); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_block_size); + __pyx_v_block_size = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":309 + * block_size = len( block_data ) + * # The block should be a bunch of summaries. + * assert block_size % summary_on_disk_size == 0 # <<<<<<<<<<<<<< + * item_count = block_size / summary_on_disk_size + * # Create another reader just for the block, shouldn't be too expensive + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyNumber_Remainder(__pyx_v_block_size, __pyx_int_32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_9)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/bbi/bbi_file.pyx":310 + * # The block should be a bunch of summaries. + * assert block_size % summary_on_disk_size == 0 + * item_count = block_size / summary_on_disk_size # <<<<<<<<<<<<<< + * # Create another reader just for the block, shouldn't be too expensive + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=reader.is_little_endian ) + */ + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_block_size, __pyx_int_32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_v_item_count); + __pyx_v_item_count = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bbi_file.pyx":312 + * item_count = block_size / summary_on_disk_size + * # Create another reader just for the block, shouldn't be too expensive + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=reader.is_little_endian ) # <<<<<<<<<<<<<< + * for i from 0 <= i < item_count: + * ## NOTE: Look carefully at bbiRead again to be sure the endian + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_block_data); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_block_data); + __Pyx_GIVEREF(__pyx_v_block_data); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_block_reader); + __pyx_v_block_reader = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":313 + * # Create another reader just for the block, shouldn't be too expensive + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=reader.is_little_endian ) + * for i from 0 <= i < item_count: # <<<<<<<<<<<<<< + * ## NOTE: Look carefully at bbiRead again to be sure the endian + * ## conversion here is all correct. It looks like it is + */ + __pyx_t_11 = __Pyx_PyInt_AsLong(__pyx_v_item_count); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) { + + /* "bx/bbi/bbi_file.pyx":318 + * ## just pushing raw data into memory and not swapping + * + * sum_chrom_id = block_reader.read_uint32() # <<<<<<<<<<<<<< + * # A block can contain summaries from more that one chrom_id + * if sum_chrom_id != chrom_id: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_sum_chrom_id); + __pyx_v_sum_chrom_id = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":320 + * sum_chrom_id = block_reader.read_uint32() + * # A block can contain summaries from more that one chrom_id + * if sum_chrom_id != chrom_id: # <<<<<<<<<<<<<< + * block_reader.skip(7*4) + * continue + */ + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_sum_chrom_id, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_9) { + + /* "bx/bbi/bbi_file.pyx":321 + * # A block can contain summaries from more that one chrom_id + * if sum_chrom_id != chrom_id: + * block_reader.skip(7*4) # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__skip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":322 + * if sum_chrom_id != chrom_id: + * block_reader.skip(7*4) + * continue # <<<<<<<<<<<<<< + * + * summary = SummaryBlock() + */ + goto __pyx_L8_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "bx/bbi/bbi_file.pyx":324 + * continue + * + * summary = SummaryBlock() # <<<<<<<<<<<<<< + * summary.chrom_id = sum_chrom_id + * summary.start = block_reader.read_uint32() + */ + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(((PyObject *)__pyx_v_summary)); + __pyx_v_summary = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":325 + * + * summary = SummaryBlock() + * summary.chrom_id = sum_chrom_id # <<<<<<<<<<<<<< + * summary.start = block_reader.read_uint32() + * summary.end = block_reader.read_uint32() + */ + __pyx_t_12 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_sum_chrom_id); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_summary->chrom_id = __pyx_t_12; + + /* "bx/bbi/bbi_file.pyx":326 + * summary = SummaryBlock() + * summary.chrom_id = sum_chrom_id + * summary.start = block_reader.read_uint32() # <<<<<<<<<<<<<< + * summary.end = block_reader.read_uint32() + * summary.valid_count = block_reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_summary->start = __pyx_t_12; + + /* "bx/bbi/bbi_file.pyx":327 + * summary.chrom_id = sum_chrom_id + * summary.start = block_reader.read_uint32() + * summary.end = block_reader.read_uint32() # <<<<<<<<<<<<<< + * summary.valid_count = block_reader.read_uint32() + * summary.min_val = block_reader.read_float() + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_summary->end = __pyx_t_12; + + /* "bx/bbi/bbi_file.pyx":328 + * summary.start = block_reader.read_uint32() + * summary.end = block_reader.read_uint32() + * summary.valid_count = block_reader.read_uint32() # <<<<<<<<<<<<<< + * summary.min_val = block_reader.read_float() + * summary.max_val = block_reader.read_float() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_summary->valid_count = __pyx_t_12; + + /* "bx/bbi/bbi_file.pyx":329 + * summary.end = block_reader.read_uint32() + * summary.valid_count = block_reader.read_uint32() + * summary.min_val = block_reader.read_float() # <<<<<<<<<<<<<< + * summary.max_val = block_reader.read_float() + * summary.sum_data = block_reader.read_float() + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_summary->min_val = __pyx_t_13; + + /* "bx/bbi/bbi_file.pyx":330 + * summary.valid_count = block_reader.read_uint32() + * summary.min_val = block_reader.read_float() + * summary.max_val = block_reader.read_float() # <<<<<<<<<<<<<< + * summary.sum_data = block_reader.read_float() + * summary.sum_squares = block_reader.read_float() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_summary->max_val = __pyx_t_13; + + /* "bx/bbi/bbi_file.pyx":331 + * summary.min_val = block_reader.read_float() + * summary.max_val = block_reader.read_float() + * summary.sum_data = block_reader.read_float() # <<<<<<<<<<<<<< + * summary.sum_squares = block_reader.read_float() + * rval.append( summary ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_summary->sum_data = __pyx_t_13; + + /* "bx/bbi/bbi_file.pyx":332 + * summary.max_val = block_reader.read_float() + * summary.sum_data = block_reader.read_float() + * summary.sum_squares = block_reader.read_float() # <<<<<<<<<<<<<< + * rval.append( summary ) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_summary->sum_squares = __pyx_t_13; + + /* "bx/bbi/bbi_file.pyx":333 + * summary.sum_data = block_reader.read_float() + * summary.sum_squares = block_reader.read_float() + * rval.append( summary ) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_rval, ((PyObject *)__pyx_v_summary)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L8_continue:; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":336 + * + * + * return rval # <<<<<<<<<<<<<< + * + * cdef _get_summary_slice( self, bits32 base_start, bits32 base_end, summaries ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel._summary_blocks_in_region", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_ctf); + __Pyx_XDECREF((PyObject *)__pyx_v_summary); + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XDECREF(__pyx_v_block_list); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XDECREF(__pyx_v_size); + __Pyx_XDECREF(__pyx_v_block_data); + __Pyx_XDECREF(__pyx_v_block_size); + __Pyx_XDECREF(__pyx_v_item_count); + __Pyx_XDECREF(__pyx_v_block_reader); + __Pyx_XDECREF(__pyx_v_sum_chrom_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":338 + * return rval + * + * cdef _get_summary_slice( self, bits32 base_start, bits32 base_end, summaries ): # <<<<<<<<<<<<<< + * cdef float valid_count = 0.0 + * cdef float sum_data = 0.0 + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_9ZoomLevel__get_summary_slice(CYTHON_UNUSED struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_end, PyObject *__pyx_v_summaries) { + float __pyx_v_valid_count; + float __pyx_v_sum_data; + float __pyx_v_sum_squares; + float __pyx_v_min_val; + float __pyx_v_max_val; + float __pyx_v_overlap_factor; + int __pyx_v_overlap; + PyObject *__pyx_v_summary = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + float __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_summary_slice", 0); + + /* "bx/bbi/bbi_file.pyx":339 + * + * cdef _get_summary_slice( self, bits32 base_start, bits32 base_end, summaries ): + * cdef float valid_count = 0.0 # <<<<<<<<<<<<<< + * cdef float sum_data = 0.0 + * cdef float sum_squares = 0.0 + */ + __pyx_v_valid_count = 0.0; + + /* "bx/bbi/bbi_file.pyx":340 + * cdef _get_summary_slice( self, bits32 base_start, bits32 base_end, summaries ): + * cdef float valid_count = 0.0 + * cdef float sum_data = 0.0 # <<<<<<<<<<<<<< + * cdef float sum_squares = 0.0 + * cdef float min_val = numpy.nan + */ + __pyx_v_sum_data = 0.0; + + /* "bx/bbi/bbi_file.pyx":341 + * cdef float valid_count = 0.0 + * cdef float sum_data = 0.0 + * cdef float sum_squares = 0.0 # <<<<<<<<<<<<<< + * cdef float min_val = numpy.nan + * cdef float max_val = numpy.nan + */ + __pyx_v_sum_squares = 0.0; + + /* "bx/bbi/bbi_file.pyx":342 + * cdef float sum_data = 0.0 + * cdef float sum_squares = 0.0 + * cdef float min_val = numpy.nan # <<<<<<<<<<<<<< + * cdef float max_val = numpy.nan + * cdef float overlap_factor + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_min_val = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":343 + * cdef float sum_squares = 0.0 + * cdef float min_val = numpy.nan + * cdef float max_val = numpy.nan # <<<<<<<<<<<<<< + * cdef float overlap_factor + * cdef int overlap + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_max_val = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":347 + * cdef int overlap + * + * if summaries: # <<<<<<<<<<<<<< + * + * min_val = summaries[0].min_val + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_summaries); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":349 + * if summaries: + * + * min_val = summaries[0].min_val # <<<<<<<<<<<<<< + * max_val = summaries[0].max_val + * + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_summaries, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__min_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_min_val = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":350 + * + * min_val = summaries[0].min_val + * max_val = summaries[0].max_val # <<<<<<<<<<<<<< + * + * for summary in summaries: + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_summaries, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_max_val = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":352 + * max_val = summaries[0].max_val + * + * for summary in summaries: # <<<<<<<<<<<<<< + * if summary.start >= base_end: + * break + */ + if (PyList_CheckExact(__pyx_v_summaries) || PyTuple_CheckExact(__pyx_v_summaries)) { + __pyx_t_1 = __pyx_v_summaries; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_summaries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + for (;;) { + if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; + } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF(__pyx_v_summary); + __pyx_v_summary = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":353 + * + * for summary in summaries: + * if summary.start >= base_end: # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_base_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":354 + * for summary in summaries: + * if summary.start >= base_end: + * break # <<<<<<<<<<<<<< + * + * overlap = range_intersection( base_start, base_end, summary.start, summary.end ) + */ + goto __pyx_L5_break; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bbi_file.pyx":356 + * break + * + * overlap = range_intersection( base_start, base_end, summary.start, summary.end ) # <<<<<<<<<<<<<< + * if overlap > 0: + * overlap_factor = overlap / (summary.end - summary.start) + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__end); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_overlap = __pyx_f_2bx_3bbi_8bbi_file_range_intersection(__pyx_v_base_start, __pyx_v_base_end, __pyx_t_9, __pyx_t_10); + + /* "bx/bbi/bbi_file.pyx":357 + * + * overlap = range_intersection( base_start, base_end, summary.start, summary.end ) + * if overlap > 0: # <<<<<<<<<<<<<< + * overlap_factor = overlap / (summary.end - summary.start) + * + */ + __pyx_t_4 = (__pyx_v_overlap > 0); + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":358 + * overlap = range_intersection( base_start, base_end, summary.start, summary.end ) + * if overlap > 0: + * overlap_factor = overlap / (summary.end - summary.start) # <<<<<<<<<<<<<< + * + * valid_count += summary.valid_count * overlap_factor + */ + __pyx_t_8 = PyFloat_FromDouble(((double)__pyx_v_overlap)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyNumber_Subtract(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_overlap_factor = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":360 + * overlap_factor = overlap / (summary.end - summary.start) + * + * valid_count += summary.valid_count * overlap_factor # <<<<<<<<<<<<<< + * sum_data += summary.sum_data * overlap_factor + * sum_squares += summary.sum_squares * overlap_factor + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_valid_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__valid_count); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_overlap_factor); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyNumber_Multiply(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_8); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_valid_count = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":361 + * + * valid_count += summary.valid_count * overlap_factor + * sum_data += summary.sum_data * overlap_factor # <<<<<<<<<<<<<< + * sum_squares += summary.sum_squares * overlap_factor + * + */ + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_sum_data); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__sum_data); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_overlap_factor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyNumber_Multiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_sum_data = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":362 + * valid_count += summary.valid_count * overlap_factor + * sum_data += summary.sum_data * overlap_factor + * sum_squares += summary.sum_squares * overlap_factor # <<<<<<<<<<<<<< + * + * if max_val < summary.max_val: + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sum_squares); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__sum_squares); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_overlap_factor); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyNumber_Multiply(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_8); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_sum_squares = __pyx_t_3; + + /* "bx/bbi/bbi_file.pyx":364 + * sum_squares += summary.sum_squares * overlap_factor + * + * if max_val < summary.max_val: # <<<<<<<<<<<<<< + * max_val = summary.max_val + * if min_val > summary.min_val: + */ + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_max_val); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__max_val); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":365 + * + * if max_val < summary.max_val: + * max_val = summary.max_val # <<<<<<<<<<<<<< + * if min_val > summary.min_val: + * min_val = summary.min_val + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__max_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_max_val = __pyx_t_3; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/bbi/bbi_file.pyx":366 + * if max_val < summary.max_val: + * max_val = summary.max_val + * if min_val > summary.min_val: # <<<<<<<<<<<<<< + * min_val = summary.min_val + * + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_min_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__min_val); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__pyx_t_4) { + + /* "bx/bbi/bbi_file.pyx":367 + * max_val = summary.max_val + * if min_val > summary.min_val: + * min_val = summary.min_val # <<<<<<<<<<<<<< + * + * return valid_count, sum_data, sum_squares, min_val, max_val + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_summary, __pyx_n_s__min_val); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_8); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_min_val = __pyx_t_3; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L7; + } + __pyx_L7:; + } + __pyx_L5_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bbi_file.pyx":369 + * min_val = summary.min_val + * + * return valid_count, sum_data, sum_squares, min_val, max_val # <<<<<<<<<<<<<< + * + * cdef _summarize( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_valid_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_sum_data); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_sum_squares); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_min_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_max_val); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_2 = 0; + __pyx_t_11 = 0; + __pyx_r = ((PyObject *)__pyx_t_12); + __pyx_t_12 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel._get_summary_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_summary); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":371 + * return valid_count, sum_data, sum_squares, min_val, max_val + * + * cdef _summarize( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Summarize directly from file. + */ + +static PyObject *__pyx_f_2bx_3bbi_8bbi_file_9ZoomLevel__summarize(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_end; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_base_step; + PyArrayObject *__pyx_v_valid_count = 0; + PyArrayObject *__pyx_v_min_val = 0; + PyArrayObject *__pyx_v_max_val = 0; + PyArrayObject *__pyx_v_sum_data = 0; + PyArrayObject *__pyx_v_sum_squares = 0; + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *__pyx_v_rval = NULL; + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_v_summaries = NULL; + int __pyx_v_i; + __Pyx_LocalBuf_ND __pyx_pybuffernd_max_val; + __Pyx_Buffer __pyx_pybuffer_max_val; + __Pyx_LocalBuf_ND __pyx_pybuffernd_min_val; + __Pyx_Buffer __pyx_pybuffer_min_val; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sum_data; + __Pyx_Buffer __pyx_pybuffer_sum_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sum_squares; + __Pyx_Buffer __pyx_pybuffer_sum_squares; + __Pyx_LocalBuf_ND __pyx_pybuffernd_valid_count; + __Pyx_Buffer __pyx_pybuffer_valid_count; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *(*__pyx_t_22)(PyObject *); + __pyx_t_5numpy_float64_t __pyx_t_23; + __pyx_t_5numpy_float64_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_26; + __pyx_t_5numpy_float64_t __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + int __pyx_t_30; + int __pyx_t_31; + int __pyx_t_32; + int __pyx_t_33; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_summarize", 0); + __pyx_pybuffer_valid_count.pybuffer.buf = NULL; + __pyx_pybuffer_valid_count.refcount = 0; + __pyx_pybuffernd_valid_count.data = NULL; + __pyx_pybuffernd_valid_count.rcbuffer = &__pyx_pybuffer_valid_count; + __pyx_pybuffer_min_val.pybuffer.buf = NULL; + __pyx_pybuffer_min_val.refcount = 0; + __pyx_pybuffernd_min_val.data = NULL; + __pyx_pybuffernd_min_val.rcbuffer = &__pyx_pybuffer_min_val; + __pyx_pybuffer_max_val.pybuffer.buf = NULL; + __pyx_pybuffer_max_val.refcount = 0; + __pyx_pybuffernd_max_val.data = NULL; + __pyx_pybuffernd_max_val.rcbuffer = &__pyx_pybuffer_max_val; + __pyx_pybuffer_sum_data.pybuffer.buf = NULL; + __pyx_pybuffer_sum_data.refcount = 0; + __pyx_pybuffernd_sum_data.data = NULL; + __pyx_pybuffernd_sum_data.rcbuffer = &__pyx_pybuffer_sum_data; + __pyx_pybuffer_sum_squares.pybuffer.buf = NULL; + __pyx_pybuffer_sum_squares.refcount = 0; + __pyx_pybuffernd_sum_squares.data = NULL; + __pyx_pybuffernd_sum_squares.rcbuffer = &__pyx_pybuffer_sum_squares; + + /* "bx/bbi/bbi_file.pyx":391 + * + * # What we will load into + * rval = SummarizedData( start, end, summary_size ) # <<<<<<<<<<<<<< + * valid_count = rval.valid_count + * min_val = rval.min_val + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_rval = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/bbi/bbi_file.pyx":392 + * # What we will load into + * rval = SummarizedData( start, end, summary_size ) + * valid_count = rval.valid_count # <<<<<<<<<<<<<< + * min_val = rval.min_val + * max_val = rval.max_val + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_rval->valid_count); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_valid_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + } + } + __pyx_pybuffernd_valid_count.diminfo[0].strides = __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_valid_count.diminfo[0].shape = __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_rval->valid_count)); + __pyx_v_valid_count = ((PyArrayObject *)__pyx_v_rval->valid_count); + + /* "bx/bbi/bbi_file.pyx":393 + * rval = SummarizedData( start, end, summary_size ) + * valid_count = rval.valid_count + * min_val = rval.min_val # <<<<<<<<<<<<<< + * max_val = rval.max_val + * sum_data = rval.sum_data + */ + __pyx_t_10 = ((PyArrayObject *)__pyx_v_rval->min_val); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer, (PyObject*)__pyx_v_min_val, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); + } + } + __pyx_pybuffernd_min_val.diminfo[0].strides = __pyx_pybuffernd_min_val.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_min_val.diminfo[0].shape = __pyx_pybuffernd_min_val.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_rval->min_val)); + __pyx_v_min_val = ((PyArrayObject *)__pyx_v_rval->min_val); + + /* "bx/bbi/bbi_file.pyx":394 + * valid_count = rval.valid_count + * min_val = rval.min_val + * max_val = rval.max_val # <<<<<<<<<<<<<< + * sum_data = rval.sum_data + * sum_squares = rval.sum_squares + */ + __pyx_t_11 = ((PyArrayObject *)__pyx_v_rval->max_val); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer, (PyObject*)__pyx_v_max_val, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + } + } + __pyx_pybuffernd_max_val.diminfo[0].strides = __pyx_pybuffernd_max_val.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_max_val.diminfo[0].shape = __pyx_pybuffernd_max_val.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_rval->max_val)); + __pyx_v_max_val = ((PyArrayObject *)__pyx_v_rval->max_val); + + /* "bx/bbi/bbi_file.pyx":395 + * min_val = rval.min_val + * max_val = rval.max_val + * sum_data = rval.sum_data # <<<<<<<<<<<<<< + * sum_squares = rval.sum_squares + * # First, load up summaries + */ + __pyx_t_12 = ((PyArrayObject *)__pyx_v_rval->sum_data); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_sum_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7); + } + } + __pyx_pybuffernd_sum_data.diminfo[0].strides = __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sum_data.diminfo[0].shape = __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_12 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_rval->sum_data)); + __pyx_v_sum_data = ((PyArrayObject *)__pyx_v_rval->sum_data); + + /* "bx/bbi/bbi_file.pyx":396 + * max_val = rval.max_val + * sum_data = rval.sum_data + * sum_squares = rval.sum_squares # <<<<<<<<<<<<<< + * # First, load up summaries + * reader = self.bbi_file.reader + */ + __pyx_t_13 = ((PyArrayObject *)__pyx_v_rval->sum_squares); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer, (PyObject*)__pyx_v_sum_squares, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); + } + } + __pyx_pybuffernd_sum_squares.diminfo[0].strides = __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sum_squares.diminfo[0].shape = __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_13 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_rval->sum_squares)); + __pyx_v_sum_squares = ((PyArrayObject *)__pyx_v_rval->sum_squares); + + /* "bx/bbi/bbi_file.pyx":398 + * sum_squares = rval.sum_squares + * # First, load up summaries + * reader = self.bbi_file.reader # <<<<<<<<<<<<<< + * reader.seek( self.index_offset ) + * summaries = self._summary_blocks_in_region(chrom_id, start, end) + */ + __Pyx_INCREF(__pyx_v_self->bbi_file->reader); + __pyx_v_reader = __pyx_v_self->bbi_file->reader; + + /* "bx/bbi/bbi_file.pyx":399 + * # First, load up summaries + * reader = self.bbi_file.reader + * reader.seek( self.index_offset ) # <<<<<<<<<<<<<< + * summaries = self._summary_blocks_in_region(chrom_id, start, end) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLongLong(__pyx_v_self->index_offset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bbi_file.pyx":400 + * reader = self.bbi_file.reader + * reader.seek( self.index_offset ) + * summaries = self._summary_blocks_in_region(chrom_id, start, end) # <<<<<<<<<<<<<< + * + * base_step = (end - start) / summary_size + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __pyx_v_summaries = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":402 + * summaries = self._summary_blocks_in_region(chrom_id, start, end) + * + * base_step = (end - start) / summary_size # <<<<<<<<<<<<<< + * base_start = start + * base_end = start + */ + __pyx_t_15 = (__pyx_v_end - __pyx_v_start); + if (unlikely(__pyx_v_summary_size == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_base_step = (__pyx_t_15 / __pyx_v_summary_size); + + /* "bx/bbi/bbi_file.pyx":403 + * + * base_step = (end - start) / summary_size + * base_start = start # <<<<<<<<<<<<<< + * base_end = start + * + */ + __pyx_v_base_start = __pyx_v_start; + + /* "bx/bbi/bbi_file.pyx":404 + * base_step = (end - start) / summary_size + * base_start = start + * base_end = start # <<<<<<<<<<<<<< + * + * for i in range(summary_size): + */ + __pyx_v_base_end = __pyx_v_start; + + /* "bx/bbi/bbi_file.pyx":406 + * base_end = start + * + * for i in range(summary_size): # <<<<<<<<<<<<<< + * base_end += base_step + * + */ + __pyx_t_6 = __pyx_v_summary_size; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_6; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; + + /* "bx/bbi/bbi_file.pyx":407 + * + * for i in range(summary_size): + * base_end += base_step # <<<<<<<<<<<<<< + * + * while summaries and summaries[0].end <= base_start: + */ + __pyx_v_base_end = (__pyx_v_base_end + __pyx_v_base_step); + + /* "bx/bbi/bbi_file.pyx":409 + * base_end += base_step + * + * while summaries and summaries[0].end <= base_start: # <<<<<<<<<<<<<< + * summaries.popleft() + * + */ + while (1) { + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_summaries); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_17) { + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_summaries, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_base_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_14, __pyx_t_1, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_19 = __pyx_t_18; + } else { + __pyx_t_19 = __pyx_t_17; + } + if (!__pyx_t_19) break; + + /* "bx/bbi/bbi_file.pyx":410 + * + * while summaries and summaries[0].end <= base_start: + * summaries.popleft() # <<<<<<<<<<<<<< + * + * valid_count[i], sum_data[i], sum_squares[i], min_val[i], max_val[i] = self._get_summary_slice(base_start, base_end, summaries) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_summaries, __pyx_n_s__popleft); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bbi_file.pyx":412 + * summaries.popleft() + * + * valid_count[i], sum_data[i], sum_squares[i], min_val[i], max_val[i] = self._get_summary_slice(base_start, base_end, summaries) # <<<<<<<<<<<<<< + * base_start = base_end + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self->__pyx_vtab)->_get_summary_slice(__pyx_v_self, __pyx_v_base_start, __pyx_v_base_end, __pyx_v_summaries); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) { + if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 4); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 5)) { + if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_14 = PyList_GET_ITEM(sequence, 1); + __pyx_t_3 = PyList_GET_ITEM(sequence, 2); + __pyx_t_2 = PyList_GET_ITEM(sequence, 3); + __pyx_t_20 = PyList_GET_ITEM(sequence, 4); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_21 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_14 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_14)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_14); + index = 2; __pyx_t_3 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 3; __pyx_t_2 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + index = 4; __pyx_t_20 = __pyx_t_22(__pyx_t_21); if (unlikely(!__pyx_t_20)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_20); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + goto __pyx_L8_unpacking_done; + __pyx_L7_unpacking_failed:; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L8_unpacking_done:; + } + __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_23 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_24 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_25 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_26 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_27 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_28 = __pyx_v_i; + __pyx_t_29 = -1; + if (__pyx_t_28 < 0) { + __pyx_t_28 += __pyx_pybuffernd_valid_count.diminfo[0].shape; + if (unlikely(__pyx_t_28 < 0)) __pyx_t_29 = 0; + } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_valid_count.diminfo[0].shape)) __pyx_t_29 = 0; + if (unlikely(__pyx_t_29 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_29); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_valid_count.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_valid_count.diminfo[0].strides) = __pyx_t_23; + __pyx_t_29 = __pyx_v_i; + __pyx_t_30 = -1; + if (__pyx_t_29 < 0) { + __pyx_t_29 += __pyx_pybuffernd_sum_data.diminfo[0].shape; + if (unlikely(__pyx_t_29 < 0)) __pyx_t_30 = 0; + } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_sum_data.diminfo[0].shape)) __pyx_t_30 = 0; + if (unlikely(__pyx_t_30 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_30); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sum_data.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_sum_data.diminfo[0].strides) = __pyx_t_24; + __pyx_t_30 = __pyx_v_i; + __pyx_t_31 = -1; + if (__pyx_t_30 < 0) { + __pyx_t_30 += __pyx_pybuffernd_sum_squares.diminfo[0].shape; + if (unlikely(__pyx_t_30 < 0)) __pyx_t_31 = 0; + } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_sum_squares.diminfo[0].shape)) __pyx_t_31 = 0; + if (unlikely(__pyx_t_31 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_31); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sum_squares.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_sum_squares.diminfo[0].strides) = __pyx_t_25; + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = -1; + if (__pyx_t_31 < 0) { + __pyx_t_31 += __pyx_pybuffernd_min_val.diminfo[0].shape; + if (unlikely(__pyx_t_31 < 0)) __pyx_t_32 = 0; + } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_min_val.diminfo[0].shape)) __pyx_t_32 = 0; + if (unlikely(__pyx_t_32 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_32); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_min_val.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_min_val.diminfo[0].strides) = __pyx_t_26; + __pyx_t_32 = __pyx_v_i; + __pyx_t_33 = -1; + if (__pyx_t_32 < 0) { + __pyx_t_32 += __pyx_pybuffernd_max_val.diminfo[0].shape; + if (unlikely(__pyx_t_32 < 0)) __pyx_t_33 = 0; + } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_max_val.diminfo[0].shape)) __pyx_t_33 = 0; + if (unlikely(__pyx_t_33 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_33); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_max_val.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_max_val.diminfo[0].strides) = __pyx_t_27; + + /* "bx/bbi/bbi_file.pyx":413 + * + * valid_count[i], sum_data[i], sum_squares[i], min_val[i], max_val[i] = self._get_summary_slice(base_start, base_end, summaries) + * base_start = base_end # <<<<<<<<<<<<<< + * + * return rval + */ + __pyx_v_base_start = __pyx_v_base_end; + } + + /* "bx/bbi/bbi_file.pyx":415 + * base_start = base_end + * + * return rval # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel._summarize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_max_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_min_val.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sum_squares.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_valid_count.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_valid_count); + __Pyx_XDECREF((PyObject *)__pyx_v_min_val); + __Pyx_XDECREF((PyObject *)__pyx_v_max_val); + __Pyx_XDECREF((PyObject *)__pyx_v_sum_data); + __Pyx_XDECREF((PyObject *)__pyx_v_sum_squares); + __Pyx_XDECREF((PyObject *)__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XDECREF(__pyx_v_summaries); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":281 + * cdef class ZoomLevel: + * cdef BBIFile bbi_file + * cdef public bits32 reduction_level # <<<<<<<<<<<<<< + * cdef bits32 reserved + * cdef public bits64 data_offset + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->reduction_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.reduction_level.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->reduction_level = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.reduction_level.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":283 + * cdef public bits32 reduction_level + * cdef bits32 reserved + * cdef public bits64 data_offset # <<<<<<<<<<<<<< + * cdef public bits64 index_offset + * cdef int item_count + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLongLong(__pyx_v_self->data_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.data_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->data_offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.data_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset___get__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bbi_file.pyx":284 + * cdef bits32 reserved + * cdef public bits64 data_offset + * cdef public bits64 index_offset # <<<<<<<<<<<<<< + * cdef int item_count + * + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset___get__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLongLong(__pyx_v_self->index_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.index_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_2__set__(((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_2__set__(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->index_offset = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.bbi.bbi_file.ZoomLevel.index_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":193 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":199 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":202 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":203 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":205 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":207 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":208 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":210 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":212 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":213 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":216 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":217 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":218 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":220 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":221 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":222 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":225 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":226 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":227 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":228 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":229 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":231 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":232 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":233 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":234 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":235 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":238 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":239 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); + __pyx_v_descr = __pyx_v_self->descr; + + /* "numpy.pxd":243 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":245 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":247 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":250 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":252 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":254 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":255 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":256 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":257 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L13; + } + + /* "numpy.pxd":258 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L13; + } + + /* "numpy.pxd":259 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L13; + } + + /* "numpy.pxd":260 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L13; + } + + /* "numpy.pxd":261 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L13; + } + + /* "numpy.pxd":262 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L13; + } + + /* "numpy.pxd":263 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L13; + } + + /* "numpy.pxd":264 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L13; + } + + /* "numpy.pxd":265 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L13; + } + + /* "numpy.pxd":266 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L13; + } + + /* "numpy.pxd":267 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L13; + } + + /* "numpy.pxd":268 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L13; + } + + /* "numpy.pxd":269 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L13; + } + + /* "numpy.pxd":270 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L13; + } + + /* "numpy.pxd":271 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L13; + } + + /* "numpy.pxd":272 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L13; + } + + /* "numpy.pxd":273 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":275 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":276 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":277 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":279 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":280 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":281 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":284 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":285 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":287 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":288 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":289 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":290 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":291 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":767 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":780 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":782 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":789 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":790 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":793 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":794 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":797 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":798 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":800 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":801 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":802 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":812 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":813 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":814 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":815 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":817 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":819 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":820 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":821 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":822 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":825 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":839 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":840 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":841 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":843 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":844 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":848 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":849 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":964 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":966 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":967 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":969 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":970 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":971 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":972 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":974 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":975 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":976 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":978 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_3bbi_8bbi_file_SummaryBlock(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bbi_file_SummaryBlock(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_chrom_id(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_chrom_id(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8chrom_id_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_start(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_start(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_5start_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_end(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_end(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_3end_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_valid_count(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_valid_count(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11valid_count_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_min_val(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_min_val(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7min_val_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_max_val(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_max_val(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_7max_val_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_data(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_data(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_8sum_data_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_squares(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_squares(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_12SummaryBlock_11sum_squares_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bbi_file_SummaryBlock[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_3bbi_8bbi_file_SummaryBlock[] = { + {(char *)"chrom_id", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_chrom_id, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_chrom_id, 0, 0}, + {(char *)"start", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_start, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_start, 0, 0}, + {(char *)"end", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_end, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_end, 0, 0}, + {(char *)"valid_count", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_valid_count, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_valid_count, 0, 0}, + {(char *)"min_val", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_min_val, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_min_val, 0, 0}, + {(char *)"max_val", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_max_val, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_max_val, 0, 0}, + {(char *)"sum_data", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_data, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_data, 0, 0}, + {(char *)"sum_squares", __pyx_getprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_squares, __pyx_setprop_2bx_3bbi_8bbi_file_12SummaryBlock_sum_squares, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SummaryBlock = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SummaryBlock = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SummaryBlock = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SummaryBlock = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bbi_file_SummaryBlock = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bbi_file.SummaryBlock"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bbi_file_SummaryBlock, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SummaryBlock, /*tp_as_number*/ + &__pyx_tp_as_sequence_SummaryBlock, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SummaryBlock, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SummaryBlock, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("\n A block of summary data from disk\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bbi_file_SummaryBlock, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_3bbi_8bbi_file_SummaryBlock, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bbi_file_SummaryBlock, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData __pyx_vtable_2bx_3bbi_8bbi_file_SummarizedData; + +static PyObject *__pyx_tp_new_2bx_3bbi_8bbi_file_SummarizedData(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData; + p->valid_count = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->min_val = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->max_val = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->sum_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->sum_squares = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bbi_file_SummarizedData(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)o; + Py_XDECREF(((PyObject *)p->valid_count)); + Py_XDECREF(((PyObject *)p->min_val)); + Py_XDECREF(((PyObject *)p->max_val)); + Py_XDECREF(((PyObject *)p->sum_data)); + Py_XDECREF(((PyObject *)p->sum_squares)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_8bbi_file_SummarizedData(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)o; + if (p->valid_count) { + e = (*v)(((PyObject*)p->valid_count), a); if (e) return e; + } + if (p->min_val) { + e = (*v)(((PyObject*)p->min_val), a); if (e) return e; + } + if (p->max_val) { + e = (*v)(((PyObject*)p->max_val), a); if (e) return e; + } + if (p->sum_data) { + e = (*v)(((PyObject*)p->sum_data), a); if (e) return e; + } + if (p->sum_squares) { + e = (*v)(((PyObject*)p->sum_squares), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_8bbi_file_SummarizedData(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)o; + PyObject* tmp; + tmp = ((PyObject*)p->valid_count); + p->valid_count = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->min_val); + p->min_val = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->max_val); + p->max_val = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sum_data); + p->sum_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sum_squares); + p->sum_squares = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_start(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_start(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_5start_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_end(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_end(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_3end_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_size(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_size(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_4size_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_valid_count(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_valid_count(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11valid_count_5__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_min_val(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_min_val(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7min_val_5__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_max_val(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_max_val(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_7max_val_5__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_data(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_data(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_8sum_data_5__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_squares(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_squares(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_11sum_squares_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bbi_file_SummarizedData[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_3bbi_8bbi_file_SummarizedData[] = { + {(char *)"start", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_start, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_start, 0, 0}, + {(char *)"end", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_end, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_end, 0, 0}, + {(char *)"size", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_size, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_size, 0, 0}, + {(char *)"valid_count", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_valid_count, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_valid_count, 0, 0}, + {(char *)"min_val", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_min_val, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_min_val, 0, 0}, + {(char *)"max_val", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_max_val, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_max_val, 0, 0}, + {(char *)"sum_data", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_data, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_data, 0, 0}, + {(char *)"sum_squares", __pyx_getprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_squares, __pyx_setprop_2bx_3bbi_8bbi_file_14SummarizedData_sum_squares, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SummarizedData = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SummarizedData = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SummarizedData = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SummarizedData = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bbi_file_SummarizedData = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bbi_file.SummarizedData"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bbi_file_SummarizedData, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SummarizedData, /*tp_as_number*/ + &__pyx_tp_as_sequence_SummarizedData, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SummarizedData, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SummarizedData, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n The result of using SummaryBlocks read from the file to produce a \n aggregation over a particular range and resolution\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_8bbi_file_SummarizedData, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_8bbi_file_SummarizedData, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bbi_file_SummarizedData, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_3bbi_8bbi_file_SummarizedData, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_2bx_3bbi_8bbi_file_14SummarizedData_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bbi_file_SummarizedData, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile; + +static PyObject *__pyx_tp_new_2bx_3bbi_8bbi_file_BBIFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + p->file = Py_None; Py_INCREF(Py_None); + p->reader = Py_None; Py_INCREF(Py_None); + p->chrom_bpt = ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)Py_None); Py_INCREF(Py_None); + p->level_list = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bbi_file_BBIFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)o; + Py_XDECREF(p->file); + Py_XDECREF(p->reader); + Py_XDECREF(((PyObject *)p->chrom_bpt)); + Py_XDECREF(p->level_list); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_8bbi_file_BBIFile(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)o; + if (p->file) { + e = (*v)(p->file, a); if (e) return e; + } + if (p->reader) { + e = (*v)(p->reader, a); if (e) return e; + } + if (p->chrom_bpt) { + e = (*v)(((PyObject*)p->chrom_bpt), a); if (e) return e; + } + if (p->level_list) { + e = (*v)(p->level_list, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_8bbi_file_BBIFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)o; + PyObject* tmp; + tmp = ((PyObject*)p->file); + p->file = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->reader); + p->reader = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->chrom_bpt); + p->chrom_bpt = ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->level_list); + p->level_list = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_magic(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_magic(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5magic_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_version(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_version(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7version_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_zoom_levels(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_zoom_levels(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_11zoom_levels_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_level_list(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_level_list(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_3__set__(o, v); + } + else { + return __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_10level_list_5__del__(o); + } +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bbi_file_BBIFile[] = { + {__Pyx_NAMESTR("open"), (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_3open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_2open)}, + {__Pyx_NAMESTR("summarize"), (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_5summarize, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_4summarize)}, + {__Pyx_NAMESTR("summarize_from_full"), (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_7summarize_from_full, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_6summarize_from_full)}, + {__Pyx_NAMESTR("query"), (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_9query, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bbi_file_7BBIFile_8query)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_3bbi_8bbi_file_BBIFile[] = { + {(char *)"magic", __pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_magic, __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_magic, 0, 0}, + {(char *)"version", __pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_version, __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_version, 0, 0}, + {(char *)"zoom_levels", __pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_zoom_levels, __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_zoom_levels, 0, 0}, + {(char *)"level_list", __pyx_getprop_2bx_3bbi_8bbi_file_7BBIFile_level_list, __pyx_setprop_2bx_3bbi_8bbi_file_7BBIFile_level_list, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BBIFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BBIFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BBIFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BBIFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bbi_file_BBIFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bbi_file.BBIFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bbi_file_BBIFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BBIFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_BBIFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BBIFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BBIFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n A \"big binary indexed\" file. Stores blocks of raw data and numeric \n summaries of that data at different levels of aggregation (\"zoom levels\").\n Generic enough to accommodate both wiggle and bed data. \n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_8bbi_file_BBIFile, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_8bbi_file_BBIFile, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bbi_file_BBIFile, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_3bbi_8bbi_file_BBIFile, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_2bx_3bbi_8bbi_file_7BBIFile_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bbi_file_BBIFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler __pyx_vtable_2bx_3bbi_8bbi_file_BlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_8bbi_file_BlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bbi_file_BlockHandler(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bbi_file_BlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bbi_file_BlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bbi_file.BlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bbi_file_BlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_BlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("\n Callback for `BBIFile.visit_blocks_in_region`\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bbi_file_BlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bbi_file_BlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_ZoomLevel __pyx_vtable_2bx_3bbi_8bbi_file_ZoomLevel; + +static PyObject *__pyx_tp_new_2bx_3bbi_8bbi_file_ZoomLevel(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_3bbi_8bbi_file_ZoomLevel; + p->bbi_file = ((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bbi_file_ZoomLevel(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)o; + Py_XDECREF(((PyObject *)p->bbi_file)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_8bbi_file_ZoomLevel(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)o; + if (p->bbi_file) { + e = (*v)(((PyObject*)p->bbi_file), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_8bbi_file_ZoomLevel(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *p = (struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *)o; + PyObject* tmp; + tmp = ((PyObject*)p->bbi_file); + p->bbi_file = ((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_reduction_level(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_reduction_level(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_15reduction_level_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_data_offset(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_data_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_11data_offset_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_index_offset(PyObject *o, void *x) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_1__get__(o); +} + +static int __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_index_offset(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_12index_offset_3__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bbi_file_ZoomLevel[] = { + {__Pyx_NAMESTR("_summary_blocks_in_region"), (PyCFunction)__pyx_pw_2bx_3bbi_8bbi_file_9ZoomLevel_1_summary_blocks_in_region, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bbi_file_9ZoomLevel__summary_blocks_in_region)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_3bbi_8bbi_file_ZoomLevel[] = { + {(char *)"reduction_level", __pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_reduction_level, __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_reduction_level, 0, 0}, + {(char *)"data_offset", __pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_data_offset, __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_data_offset, 0, 0}, + {(char *)"index_offset", __pyx_getprop_2bx_3bbi_8bbi_file_9ZoomLevel_index_offset, __pyx_setprop_2bx_3bbi_8bbi_file_9ZoomLevel_index_offset, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ZoomLevel = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ZoomLevel = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ZoomLevel = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ZoomLevel = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bbi_file_ZoomLevel = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bbi_file.ZoomLevel"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ZoomLevel, /*tp_as_number*/ + &__pyx_tp_as_sequence_ZoomLevel, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ZoomLevel, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ZoomLevel, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bbi_file_ZoomLevel, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bbi_file"), + __Pyx_DOCSTR(__pyx_k_18), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, + {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_n_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 1}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s__II, __pyx_k__II, sizeof(__pyx_k__II), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__StringIO, __pyx_k__StringIO, sizeof(__pyx_k__StringIO), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__byteswap_needed, __pyx_k__byteswap_needed, sizeof(__pyx_k__byteswap_needed), 0, 0, 1, 1}, + {&__pyx_n_s__cStringIO, __pyx_k__cStringIO, sizeof(__pyx_k__cStringIO), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__chrom_id, __pyx_k__chrom_id, sizeof(__pyx_k__chrom_id), 0, 0, 1, 1}, + {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, + {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1}, + {&__pyx_n_s__decompress, __pyx_k__decompress, sizeof(__pyx_k__decompress), 0, 0, 1, 1}, + {&__pyx_n_s__deque, __pyx_k__deque, sizeof(__pyx_k__deque), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__expected_sig, __pyx_k__expected_sig, sizeof(__pyx_k__expected_sig), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__find, __pyx_k__find, sizeof(__pyx_k__find), 0, 0, 1, 1}, + {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__is_little_endian, __pyx_k__is_little_endian, sizeof(__pyx_k__is_little_endian), 0, 0, 1, 1}, + {&__pyx_n_s__math, __pyx_k__math, sizeof(__pyx_k__math), 0, 0, 1, 1}, + {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, + {&__pyx_n_s__max_val, __pyx_k__max_val, sizeof(__pyx_k__max_val), 0, 0, 1, 1}, + {&__pyx_n_s__mean, __pyx_k__mean, sizeof(__pyx_k__mean), 0, 0, 1, 1}, + {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, + {&__pyx_n_s__min_val, __pyx_k__min_val, sizeof(__pyx_k__min_val), 0, 0, 1, 1}, + {&__pyx_n_s__nan, __pyx_k__nan, sizeof(__pyx_k__nan), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, + {&__pyx_n_s__popleft, __pyx_k__popleft, sizeof(__pyx_k__popleft), 0, 0, 1, 1}, + {&__pyx_n_s__query, __pyx_k__query, sizeof(__pyx_k__query), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_float, __pyx_k__read_float, sizeof(__pyx_k__read_float), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint16, __pyx_k__read_uint16, sizeof(__pyx_k__read_uint16), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint64, __pyx_k__read_uint64, sizeof(__pyx_k__read_uint64), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, + {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__std_dev, __pyx_k__std_dev, sizeof(__pyx_k__std_dev), 0, 0, 1, 1}, + {&__pyx_n_s__sum_data, __pyx_k__sum_data, sizeof(__pyx_k__sum_data), 0, 0, 1, 1}, + {&__pyx_n_s__sum_squares, __pyx_k__sum_squares, sizeof(__pyx_k__sum_squares), 0, 0, 1, 1}, + {&__pyx_n_s__summarize, __pyx_k__summarize, sizeof(__pyx_k__summarize), 0, 0, 1, 1}, + {&__pyx_n_s__summarize_from_full, __pyx_k__summarize_from_full, sizeof(__pyx_k__summarize_from_full), 0, 0, 1, 1}, + {&__pyx_n_s__summary_size, __pyx_k__summary_size, sizeof(__pyx_k__summary_size), 0, 0, 1, 1}, + {&__pyx_n_s__type_name, __pyx_k__type_name, sizeof(__pyx_k__type_name), 0, 0, 1, 1}, + {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1}, + {&__pyx_n_s__valid_count, __pyx_k__valid_count, sizeof(__pyx_k__valid_count), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s__zlib, __pyx_k__zlib, sizeof(__pyx_k__zlib), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "bx/bbi/bbi_file.pyx":144 + * self.uncompress_buf_size = reader.read_uint32() + * # Skip reserved + * reader.seek( 64 ) # <<<<<<<<<<<<<< + * # Read zoom headers + * self.level_list = [] + */ + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_1); + __Pyx_INCREF(__pyx_int_64); + PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_64); + __Pyx_GIVEREF(__pyx_int_64); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); + + /* "bx/bbi/bbi_file.pyx":256 + * return chrom_id, chrom_size + * else: + * return None, None # <<<<<<<<<<<<<< + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + */ + __pyx_k_tuple_3 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_3); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + + /* "bx/bbi/bbi_file.pyx":321 + * # A block can contain summaries from more that one chrom_id + * if sum_chrom_id != chrom_id: + * block_reader.skip(7*4) # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(__pyx_int_28); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, __pyx_int_28); + __Pyx_GIVEREF(__pyx_int_28); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":214 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "numpy.pxd":218 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":256 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":798 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":802 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "numpy.pxd":822 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_28 = PyInt_FromLong(28); if (unlikely(!__pyx_int_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbbi_file(void); /*proto*/ +PyMODINIT_FUNC initbbi_file(void) +#else +PyMODINIT_FUNC PyInit_bbi_file(void); /*proto*/ +PyMODINIT_FUNC PyInit_bbi_file(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bbi_file(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bbi_file"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_18), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bbi__bbi_file) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bbi_file_SummaryBlock) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SummaryBlock", (PyObject *)&__pyx_type_2bx_3bbi_8bbi_file_SummaryBlock) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = &__pyx_type_2bx_3bbi_8bbi_file_SummaryBlock; + __pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData = &__pyx_vtable_2bx_3bbi_8bbi_file_SummarizedData; + __pyx_vtable_2bx_3bbi_8bbi_file_SummarizedData.accumulate_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float))__pyx_f_2bx_3bbi_8bbi_file_14SummarizedData_accumulate_interval_value; + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bbi_file_SummarizedData) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_8bbi_file_SummarizedData.tp_dict, __pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SummarizedData", (PyObject *)&__pyx_type_2bx_3bbi_8bbi_file_SummarizedData) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = &__pyx_type_2bx_3bbi_8bbi_file_SummarizedData; + __pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile = &__pyx_vtable_2bx_3bbi_8bbi_file_BBIFile; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile.visit_blocks_in_region = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_visit_blocks_in_region; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile._get_chrom_id_and_size = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__get_chrom_id_and_size; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile._best_zoom_level = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, int))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__best_zoom_level; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile.summarize = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_summarize; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile.summarize_from_full = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_summarize_from_full; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile.query = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile_query; + __pyx_vtable_2bx_3bbi_8bbi_file_BBIFile._summarize_from_full = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int))__pyx_f_2bx_3bbi_8bbi_file_7BBIFile__summarize_from_full; + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bbi_file_BBIFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_8bbi_file_BBIFile.tp_dict, __pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BBIFile", (PyObject *)&__pyx_type_2bx_3bbi_8bbi_file_BBIFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = &__pyx_type_2bx_3bbi_8bbi_file_BBIFile; + __pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler = &__pyx_vtable_2bx_3bbi_8bbi_file_BlockHandler; + __pyx_vtable_2bx_3bbi_8bbi_file_BlockHandler.handle_block = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *))__pyx_f_2bx_3bbi_8bbi_file_12BlockHandler_handle_block; + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bbi_file_BlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_8bbi_file_BlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_8bbi_file_BlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = &__pyx_type_2bx_3bbi_8bbi_file_BlockHandler; + __pyx_vtabptr_2bx_3bbi_8bbi_file_ZoomLevel = &__pyx_vtable_2bx_3bbi_8bbi_file_ZoomLevel; + __pyx_vtable_2bx_3bbi_8bbi_file_ZoomLevel._get_summary_slice = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *))__pyx_f_2bx_3bbi_8bbi_file_9ZoomLevel__get_summary_slice; + __pyx_vtable_2bx_3bbi_8bbi_file_ZoomLevel._summarize = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_ZoomLevel *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int))__pyx_f_2bx_3bbi_8bbi_file_9ZoomLevel__summarize; + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bbi_file_ZoomLevel) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_8bbi_file_ZoomLevel.tp_dict, __pyx_vtabptr_2bx_3bbi_8bbi_file_ZoomLevel) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ZoomLevel", (PyObject *)&__pyx_type_2bx_3bbi_8bbi_file_ZoomLevel) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_ZoomLevel = &__pyx_type_2bx_3bbi_8bbi_file_ZoomLevel; + /*--- Type import code ---*/ + __pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = __Pyx_ImportType("bx.bbi.bpt_file", "BPTFile", sizeof(struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = __Pyx_ImportType("bx.bbi.cirtree_file", "CIRTreeFile", sizeof(struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bbi/bbi_file.pyx":12 + * cimport cython + * + * from collections import deque # <<<<<<<<<<<<<< + * from bpt_file cimport BPTFile + * from cirtree_file cimport CIRTreeFile + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__deque)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__deque)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deque)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deque); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__deque); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__deque, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":19 + * from libc cimport limits + * + * import numpy # <<<<<<<<<<<<<< + * cimport numpy + * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":22 + * cimport numpy + * + * from bx.misc.binary_file import BinaryFileReader # <<<<<<<<<<<<<< + * from cStringIO import StringIO + * import zlib, math + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_19), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BinaryFileReader); + if (__pyx_t_2 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__BinaryFileReader); + if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bbi_file.pyx":23 + * + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO # <<<<<<<<<<<<<< + * import zlib, math + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__StringIO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__cStringIO), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__StringIO); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__StringIO); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StringIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":24 + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO + * import zlib, math # <<<<<<<<<<<<<< + * + * # Signatures for bbi related file types + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zlib, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__math), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__math, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bbi_file.pyx":28 + * # Signatures for bbi related file types + * + * cdef public int big_wig_sig = 0x888FFC26 # <<<<<<<<<<<<<< + * cdef public int big_bed_sig = 0x8789F2EB + * + */ + big_wig_sig = 0x888FFC26; + + /* "bx/bbi/bbi_file.pyx":29 + * + * cdef public int big_wig_sig = 0x888FFC26 + * cdef public int big_bed_sig = 0x8789F2EB # <<<<<<<<<<<<<< + * + * # Some record sizes for parsing + */ + big_bed_sig = 0x8789F2EB; + + /* "bx/bbi/bbi_file.pyx":1 + * # cython: profile=False # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":974 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bbi.bbi_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bbi.bbi_file"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +} + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + return; +} +#endif + + + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + PyObject *getbuffer_cobj; + + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + #endif + + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + + return -1; +} + +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + PyObject *releasebuffer_cobj; + + if (!obj) return; + + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + + Py_DECREF(releasebuffer_cobj); + + if (!func) + goto fail; + + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + + goto nofail; + +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); + +nofail: + Py_DECREF(obj); + view->obj = NULL; +} + +#endif /* PY_MAJOR_VERSION < 3 */ + + static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.pyx new file mode 100755 index 0000000..d8f3d84 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bbi_file.pyx @@ -0,0 +1,415 @@ +# cython: profile=False + +""" +Core implementation for reading UCSC "big binary indexed" files. + +There isn't really any specification for the format beyond the code, so this +mirrors Jim Kent's 'bbiRead.c' mostly. +""" + +cimport cython + +from collections import deque +from bpt_file cimport BPTFile +from cirtree_file cimport CIRTreeFile +from types cimport * + +from libc cimport limits + +import numpy +cimport numpy + +from bx.misc.binary_file import BinaryFileReader +from cStringIO import StringIO +import zlib, math + +# Signatures for bbi related file types + +cdef public int big_wig_sig = 0x888FFC26 +cdef public int big_bed_sig = 0x8789F2EB + +# Some record sizes for parsing +DEF summary_on_disk_size = 32 + +@cython.profile(False) +cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + return min( end1, end2 ) - max( start1, start2 ) + +@cython.profile(False) +cdef inline int imax(int a, int b): return a if a >= b else b +@cython.profile(False) +cdef inline int imin(int a, int b): return a if a <= b else b + +cdef enum summary_type: + summary_type_mean = 0 + summary_type_max = 1 + summary_type_min = 2 + summary_type_coverage = 3 + summary_type_sd = 4 + +cdef class SummaryBlock: + """ + A block of summary data from disk + """ + pass + +cdef class SummarizedData: + """ + The result of using SummaryBlocks read from the file to produce a + aggregation over a particular range and resolution + """ + def __init__( self, bits32 start, bits32 end, int size ): + self.start = start + self.end = end + self.size = size + self.valid_count = numpy.zeros( self.size, dtype=numpy.float64 ) + self.min_val = numpy.zeros( self.size, dtype=numpy.float64 ) + self.max_val = numpy.zeros( self.size, dtype=numpy.float64 ) + self.sum_data = numpy.zeros( self.size, dtype=numpy.float64 ) + self.sum_squares = numpy.zeros( self.size, dtype=numpy.float64 ) + cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ): + cdef int base_start, base_end, base_step, overlap, j, interval_size + cdef double overlap_factor, interval_weight + # We locally cdef the arrays so all indexing will be at C speeds + cdef numpy.ndarray[numpy.float64_t, ndim=1] valid_count = self.valid_count + cdef numpy.ndarray[numpy.float64_t, ndim=1] min_val = self.min_val + cdef numpy.ndarray[numpy.float64_t, ndim=1] max_val = self.max_val + cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_data = self.sum_data + cdef numpy.ndarray[numpy.float64_t, ndim=1] sum_squares = self.sum_squares + # Trim interval down to region of interest + if s < self.start: + s = self.start + if e > self.end: + e = self.end + if s >= e: + return + base_step = ( self.end - self.start ) / self.size + for j from 0 <= j < self.size: + base_start = self.start + ( base_step * j ) + base_end = base_start + base_step + overlap = range_intersection( base_start, base_end, s, e ) + if overlap > 0: + interval_size = e - s + overlap_factor = overlap / interval_size + interval_weight = interval_size * overlap_factor + valid_count[j] += interval_weight + sum_data[j] += val * interval_weight + sum_squares[j] += val * val * interval_weight + if max_val[j] < val: + max_val[j] = val + if min_val[j] > val: + min_val[j] = val + +cdef class BlockHandler: + """ + Callback for `BBIFile.visit_blocks_in_region` + """ + cdef handle_block( self, str block_data, BBIFile bbi_file ): + pass + +cdef class BBIFile: + """ + A "big binary indexed" file. Stores blocks of raw data and numeric + summaries of that data at different levels of aggregation ("zoom levels"). + Generic enough to accommodate both wiggle and bed data. + """ + + def __init__( self, file=None, expected_sig=None, type_name=None ): + if file is not None: + self.open( file, expected_sig, type_name ) + + def open( self, file, expected_sig, type_name ): + """ + Initialize from an existing bbi file, signature (magic) must be passed + in since this is generic. + """ + assert expected_sig is not None + self.file = file + # Open the file in a BinaryFileReader, handles magic and byteswapping + self.reader = reader = BinaryFileReader( file, expected_sig ) + self.magic = expected_sig + self.is_byteswapped = self.reader.byteswap_needed + # Read header stuff + self.version = reader.read_uint16() + self.zoom_levels = reader.read_uint16() + self.chrom_tree_offset = reader.read_uint64() + self.unzoomed_data_offset = reader.read_uint64() + self.unzoomed_index_offset = reader.read_uint64() + self.field_count = reader.read_uint16() + self.defined_field_count = reader.read_uint16() + self.as_offset = reader.read_uint64() + self.total_summary_offset = reader.read_uint64() + self.uncompress_buf_size = reader.read_uint32() + # Skip reserved + reader.seek( 64 ) + # Read zoom headers + self.level_list = [] + for i from 0 <= i < self.zoom_levels: + level = ZoomLevel() + level.bbi_file = self + level.reduction_level = reader.read_uint32() + level.reserved = reader.read_uint32() + level.data_offset = reader.read_uint64() + level.index_offset = reader.read_uint64() + self.level_list.append( level ) + # Initialize and attach embedded BPTFile containing chromosome names and ids + reader.seek( self.chrom_tree_offset ) + self.chrom_bpt = BPTFile( file=self.file ) + + cdef visit_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end, BlockHandler handler ): + """ + Visit each block from the full data that overlaps a specific region + """ + cdef CIRTreeFile ctf + reader = self.reader + reader.seek( self.unzoomed_index_offset ) + ctf = CIRTreeFile( reader.file ) + block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + for offset, size in block_list: + # Seek to and read all data for the block + reader.seek( offset ) + block_data = reader.read( size ) + # Might need to uncompress + if self.uncompress_buf_size > 0: + block_data = zlib.decompress( block_data ) + handler.handle_block( block_data, self ) + + cpdef summarize( self, char * chrom, bits32 start, bits32 end, int summary_size ): + """ + Gets `summary_size` data points over the regions `chrom`:`start`-`end`. + """ + if start >= end: + return None + chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + if chrom_id is None: + return None + # Return value will be a structured array (rather than an array + # of summary element structures + + # Find appropriate zoom level + cdef bits32 base_size = end - start + cdef int full_reduction = base_size / summary_size + cdef int zoom = full_reduction / 2 + if zoom < 0: + zoom = 0 + cdef ZoomLevel zoom_level = self._best_zoom_level( zoom ) + if zoom_level is not None: + return zoom_level._summarize( chrom_id, start, end, summary_size ) + else: + return self._summarize_from_full( chrom_id, start, end, summary_size ) + + cpdef summarize_from_full( self, char * chrom, bits32 start, bits32 end, int summary_size ): + """ + Gets `summary_size` data points over the regions `chrom`:`start`-`end`, + always using the raw data points + """ + if start >= end: + return None + chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + if chrom_id is None: + return None + # Return value will be a structured array (rather than an array + # of summary element structures + return self._summarize_from_full( chrom_id, start, end, summary_size ) + + cpdef query( self, char * chrom, bits32 start, bits32 end, int summary_size ): + """ + Provides a different view of summary for region, a list of dictionaries + with keys: mean, max, min, coverage, std_dev + """ + + if end > 2147483647 or start < 0: + raise ValueError + results = self.summarize(chrom, start, end, summary_size) + if not results: + return None + + rval = [] + for i in range(summary_size): + sum_data = results.sum_data[i] + valid_count = results.valid_count[i] + mean = sum_data / valid_count + coverage = summary_size / (end - start) * valid_count + + # print results.sum_squares[i], sum_data, valid_count + variance = results.sum_squares[i] - sum_data * sum_data / valid_count + if valid_count > 1: + variance /= valid_count - 1 + std_dev = math.sqrt(max(variance, 0)) + + rval.append( { "mean": mean, "max": results.max_val[i], "min": results.min_val[i], \ + "coverage": coverage, "std_dev": std_dev } ) + + return rval + + cdef _get_chrom_id_and_size( self, char * chrom ): + """ + Lookup id and size from the chromosome named `chrom` + """ + bytes = self.chrom_bpt.find( chrom ) + if bytes is not None: + # The value is two 32 bit uints, use the BPT's reader for checking byteswapping + assert len( bytes ) == 8 + chrom_id, chrom_size = self.chrom_bpt.reader.unpack( "II", bytes ) + return chrom_id, chrom_size + else: + return None, None + + cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + """ + Create summary from full data. This is data specific so must be overridden. + """ + pass + + cdef _best_zoom_level( self, int desired_reduction ): + if desired_reduction <= 1: + return None + + cdef ZoomLevel level, closest_level + cdef int diff, closest_diff = limits.INT_MAX + + closest_level = None + for level in self.level_list: + diff = desired_reduction - level.reduction_level + if diff >= 0 and diff < closest_diff: + closest_diff = diff + closest_level = level + return closest_level + +cdef class ZoomLevel: + cdef BBIFile bbi_file + cdef public bits32 reduction_level + cdef bits32 reserved + cdef public bits64 data_offset + cdef public bits64 index_offset + cdef int item_count + + def _summary_blocks_in_region( self, bits32 chrom_id, bits32 start, bits32 end ): + """ + Return a list of all SummaryBlocks that overlap the region + `chrom_id`:`start`-`end` + """ + cdef CIRTreeFile ctf + cdef SummaryBlock summary + rval = deque() + reader = self.bbi_file.reader + reader.seek( self.index_offset ) + ctf = CIRTreeFile( reader.file ) + block_list = ctf.find_overlapping_blocks( chrom_id, start, end ) + for offset, size in block_list: + # Seek to and read all data for the block + reader.seek( offset ) + block_data = reader.read( size ) + # Might need to uncompress + if self.bbi_file.uncompress_buf_size > 0: + ## block_data = zlib.decompress( block_data, buf_size = self.bbi_file.uncompress_buf_size ) + block_data = zlib.decompress( block_data ) + block_size = len( block_data ) + # The block should be a bunch of summaries. + assert block_size % summary_on_disk_size == 0 + item_count = block_size / summary_on_disk_size + # Create another reader just for the block, shouldn't be too expensive + block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=reader.is_little_endian ) + for i from 0 <= i < item_count: + ## NOTE: Look carefully at bbiRead again to be sure the endian + ## conversion here is all correct. It looks like it is + ## just pushing raw data into memory and not swapping + + sum_chrom_id = block_reader.read_uint32() + # A block can contain summaries from more that one chrom_id + if sum_chrom_id != chrom_id: + block_reader.skip(7*4) + continue + + summary = SummaryBlock() + summary.chrom_id = sum_chrom_id + summary.start = block_reader.read_uint32() + summary.end = block_reader.read_uint32() + summary.valid_count = block_reader.read_uint32() + summary.min_val = block_reader.read_float() + summary.max_val = block_reader.read_float() + summary.sum_data = block_reader.read_float() + summary.sum_squares = block_reader.read_float() + rval.append( summary ) + + + return rval + + cdef _get_summary_slice( self, bits32 base_start, bits32 base_end, summaries ): + cdef float valid_count = 0.0 + cdef float sum_data = 0.0 + cdef float sum_squares = 0.0 + cdef float min_val = numpy.nan + cdef float max_val = numpy.nan + cdef float overlap_factor + cdef int overlap + + if summaries: + + min_val = summaries[0].min_val + max_val = summaries[0].max_val + + for summary in summaries: + if summary.start >= base_end: + break + + overlap = range_intersection( base_start, base_end, summary.start, summary.end ) + if overlap > 0: + overlap_factor = overlap / (summary.end - summary.start) + + valid_count += summary.valid_count * overlap_factor + sum_data += summary.sum_data * overlap_factor + sum_squares += summary.sum_squares * overlap_factor + + if max_val < summary.max_val: + max_val = summary.max_val + if min_val > summary.min_val: + min_val = summary.min_val + + return valid_count, sum_data, sum_squares, min_val, max_val + + cdef _summarize( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + """ + Summarize directly from file. + + Looking at Jim's code, it appears that + - bbiSummariesInRegion returns all summaries that span start-end in + sorted order + - bbiSummarySlice is then used to aggregate over the subset of those + summaries that overlap a single summary element + """ + cdef bits32 base_start, base_end, base_step + + # We locally cdef the arrays so all indexing will be at C speeds + cdef numpy.ndarray[numpy.float64_t] valid_count + cdef numpy.ndarray[numpy.float64_t] min_val + cdef numpy.ndarray[numpy.float64_t] max_val + cdef numpy.ndarray[numpy.float64_t] sum_data + cdef numpy.ndarray[numpy.float64_t] sum_squares + + # What we will load into + rval = SummarizedData( start, end, summary_size ) + valid_count = rval.valid_count + min_val = rval.min_val + max_val = rval.max_val + sum_data = rval.sum_data + sum_squares = rval.sum_squares + # First, load up summaries + reader = self.bbi_file.reader + reader.seek( self.index_offset ) + summaries = self._summary_blocks_in_region(chrom_id, start, end) + + base_step = (end - start) / summary_size + base_start = start + base_end = start + + for i in range(summary_size): + base_end += base_step + + while summaries and summaries[0].end <= base_start: + summaries.popleft() + + valid_count[i], sum_data[i], sum_squares[i], min_val[i], max_val[i] = self._get_summary_slice(base_start, base_end, summaries) + base_start = base_end + + return rval diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.c b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.c new file mode 100755 index 0000000..18305b4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.c @@ -0,0 +1,7643 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:12 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bbi__bigbed_file +#define __PYX_HAVE_API__bx__bbi__bigbed_file +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "bigbed_file.pyx", + "numpy.pxd", + "bpt_file.pxd", + "cirtree_file.pxd", + "bbi_file.pxd", +}; + +/* "types.pxd":1 + * ctypedef unsigned char UBYTE # <<<<<<<<<<<<<< + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE; + +/* "types.pxd":2 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE # <<<<<<<<<<<<<< + * ctypedef unsigned short UWORD + * ctypedef short WORD + */ +typedef signed char __pyx_t_2bx_3bbi_5types_BYTE; + +/* "types.pxd":3 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD # <<<<<<<<<<<<<< + * ctypedef short WORD + * ctypedef unsigned long long bits64 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD; + +/* "types.pxd":4 + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + * ctypedef short WORD # <<<<<<<<<<<<<< + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + */ +typedef short __pyx_t_2bx_3bbi_5types_WORD; + +/* "types.pxd":5 + * ctypedef unsigned short UWORD + * ctypedef short WORD + * ctypedef unsigned long long bits64 # <<<<<<<<<<<<<< + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64; + +/* "types.pxd":6 + * ctypedef short WORD + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 # <<<<<<<<<<<<<< + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + */ +typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32; + +/* "types.pxd":7 + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 # <<<<<<<<<<<<<< + * ctypedef unsigned char bits8 + * ctypedef int signed32 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16; + +/* "types.pxd":8 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 # <<<<<<<<<<<<<< + * ctypedef int signed32 + * + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8; + +/* "types.pxd":9 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + * ctypedef int signed32 # <<<<<<<<<<<<<< + * + * ctypedef bint boolean + */ +typedef int __pyx_t_2bx_3bbi_5types_signed32; + +/* "types.pxd":11 + * ctypedef int signed32 + * + * ctypedef bint boolean # <<<<<<<<<<<<<< + * + */ +typedef int __pyx_t_2bx_3bbi_5types_boolean; + +/* "numpy.pxd":719 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":720 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":721 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":722 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":726 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":727 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":728 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":729 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":733 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":734 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":743 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":744 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":745 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":747 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":748 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":749 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":751 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":754 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":756 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock; +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile; +struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile; +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler; +struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler; +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile; +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData; +struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; +struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile; + +/* "numpy.pxd":758 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":760 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":762 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "bbi_file.pxd":8 + * cimport numpy + * + * cdef class SummaryBlock: # <<<<<<<<<<<<<< + * """ + * A block of summary data from disk + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock { + PyObject_HEAD + __pyx_t_2bx_3bbi_5types_bits32 chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + __pyx_t_2bx_3bbi_5types_bits32 valid_count; + double min_val; + double max_val; + double sum_data; + double sum_squares; +}; + + +/* "bbi_file.pxd":37 + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + * + * cdef class BBIFile # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtab; + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_bits32 magic; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *chrom_bpt; + __pyx_t_2bx_3bbi_5types_bits16 version; + __pyx_t_2bx_3bbi_5types_bits16 zoom_levels; + __pyx_t_2bx_3bbi_5types_bits64 chrom_tree_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_data_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_index_offset; + __pyx_t_2bx_3bbi_5types_bits16 field_count; + __pyx_t_2bx_3bbi_5types_bits16 defined_field_count; + __pyx_t_2bx_3bbi_5types_bits64 as_offset; + __pyx_t_2bx_3bbi_5types_bits64 total_summary_offset; + __pyx_t_2bx_3bbi_5types_bits32 uncompress_buf_size; + PyObject *level_list; +}; + + +/* "bx/bbi/bigbed_file.pyx":85 + * self.intervals.append( ( s, e, rest ) ) + * + * cdef class BigBedFile( BBIFile ): # <<<<<<<<<<<<<< + * """ + * A "big binary indexed" file whose raw data is in BED format. + */ +struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile { + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile __pyx_base; +}; + + +/* "bbi_file.pxd":39 + * cdef class BBIFile + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtab; +}; + + +/* "bx/bbi/bigbed_file.pyx":20 + * return min( end1, end2 ) - max( start1, start2 ) + * + * cdef class BigBedBlockHandler( BlockHandler ): # <<<<<<<<<<<<<< + * """ + * BlockHandler that parses the block into a series of BED records + */ +struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler { + struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler __pyx_base; + __pyx_t_2bx_3bbi_5types_bits32 chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; +}; + + +/* "cirtree_file.pxd":3 + * from types cimport * + * + * cdef class CIRTreeFile: # <<<<<<<<<<<<<< + * cdef object file + * cdef object reader + */ +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits32 start_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 start_base; + __pyx_t_2bx_3bbi_5types_bits32 end_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 end_base; + __pyx_t_2bx_3bbi_5types_bits64 file_size; + __pyx_t_2bx_3bbi_5types_bits32 items_per_slot; +}; + + +/* "bbi_file.pxd":21 + * cdef public double sum_squares + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtab; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + int size; + PyArrayObject *valid_count; + PyArrayObject *min_val; + PyArrayObject *max_val; + PyArrayObject *sum_data; + PyArrayObject *sum_squares; +}; + + +/* "bx/bbi/bigbed_file.pyx":54 + * pass + * + * cdef class SummarizingBlockHandler( BigBedBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a SummarizedData + */ +struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler { + struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base; + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *sd; +}; + + +/* "bx/bbi/bigbed_file.pyx":73 + * self.sd.accumulate_interval_value( s, e, 1 ) + * + * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ): # <<<<<<<<<<<<<< + * cdef list intervals + * """ + */ +struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler { + struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base; + PyObject *intervals; +}; + + +/* "bpt_file.pxd":5 + * from types cimport * + * + * cdef class BPTFile: # <<<<<<<<<<<<<< + * """ + * On disk B+ tree compatible with Jim Kent's bPlusTree.c + */ +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits32 key_size; + __pyx_t_2bx_3bbi_5types_bits32 value_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; +}; + + + +/* "bbi_file.pxd":37 + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + * + * cdef class BBIFile # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile { + PyObject *(*visit_blocks_in_region)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *); + PyObject *(*_get_chrom_id_and_size)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *); + PyObject *(*_best_zoom_level)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, int); + PyObject *(*summarize)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*query)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*_summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + + +/* "bx/bbi/bigbed_file.pyx":85 + * self.intervals.append( ( s, e, rest ) ) + * + * cdef class BigBedFile( BBIFile ): # <<<<<<<<<<<<<< + * """ + * A "big binary indexed" file whose raw data is in BED format. + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile { + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile __pyx_base; + PyObject *(*get)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedFile; + + +/* "bbi_file.pxd":39 + * cdef class BBIFile + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler { + PyObject *(*handle_block)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + + +/* "bx/bbi/bigbed_file.pyx":20 + * return min( end1, end2 ) - max( start1, start2 ) + * + * cdef class BigBedBlockHandler( BlockHandler ): # <<<<<<<<<<<<<< + * """ + * BlockHandler that parses the block into a series of BED records + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler __pyx_base; + PyObject *(*handle_interval_value)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *); +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + + +/* "bx/bbi/bigbed_file.pyx":73 + * self.sd.accumulate_interval_value( s, e, 1 ) + * + * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ): # <<<<<<<<<<<<<< + * cdef list intervals + * """ + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base; +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; + + +/* "bbi_file.pxd":21 + * cdef public double sum_squares + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData { + PyObject *(*accumulate_interval_value)(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData; + + +/* "bx/bbi/bigbed_file.pyx":54 + * pass + * + * cdef class SummarizingBlockHandler( BigBedBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a SummarizedData + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_SummarizingBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base; +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.bbi.types' */ + +/* Module declarations from 'bx.bbi.bpt_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = 0; + +/* Module declarations from 'bx.bbi.cirtree_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = 0; + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ + +/* Module declarations from 'bx.bbi.bbi_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = 0; + +/* Module declarations from 'bx.bbi.bigbed_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_SummarizingBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedFile = 0; +static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigbed_file_range_intersection(int, int, int, int); /*proto*/ +#define __Pyx_MODULE_NAME "bx.bbi.bigbed_file" +int __pyx_module_is_main_bx__bbi__bigbed_file = 0; + +/* Implementation of 'bx.bbi.bigbed_file' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_round; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "\t"; +static char __pyx_k_3[] = "+"; +static char __pyx_k_4[] = "ndarray is not C contiguous"; +static char __pyx_k_6[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_8[] = "Non-native byte order not supported"; +static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_14[] = "Format string allocated too short."; +static char __pyx_k_16[] = "\nBigBed file.\n"; +static char __pyx_k_17[] = "bx.intervals.io"; +static char __pyx_k_18[] = "bx.misc.binary_file"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__inf[] = "inf"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__zlib[] = "zlib"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__round[] = "round"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__bigbed[] = "bigbed"; +static char __pyx_k__StringIO[] = "StringIO"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__chrom_id[] = "chrom_id"; +static char __pyx_k__cStringIO[] = "cStringIO"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__summary_size[] = "summary_size"; +static char __pyx_k__read_c_string[] = "read_c_string"; +static char __pyx_k__GenomicInterval[] = "GenomicInterval"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static char __pyx_k__is_little_endian[] = "is_little_endian"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_n_s_17; +static PyObject *__pyx_n_s_18; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s__GenomicInterval; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__StringIO; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__bigbed; +static PyObject *__pyx_n_s__cStringIO; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__chrom_id; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__inf; +static PyObject *__pyx_n_s__is_little_endian; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__read_c_string; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__round; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__summary_size; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_n_s__zlib; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_2273964779; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_15; + +/* "bx/bbi/bigbed_file.pyx":17 + * DEF big_bed_sig = 0x8789F2EB + * + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): # <<<<<<<<<<<<<< + * return min( end1, end2 ) - max( start1, start2 ) + * + */ + +static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigbed_file_range_intersection(int __pyx_v_start1, int __pyx_v_end1, int __pyx_v_start2, int __pyx_v_end2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("range_intersection"); + + /* "bx/bbi/bigbed_file.pyx":18 + * + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + * return min( end1, end2 ) - max( start1, start2 ) # <<<<<<<<<<<<<< + * + * cdef class BigBedBlockHandler( BlockHandler ): + */ + __pyx_t_1 = __pyx_v_end2; + __pyx_t_2 = __pyx_v_end1; + if ((__pyx_t_1 < __pyx_t_2)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_t_1 = __pyx_v_start2; + __pyx_t_2 = __pyx_v_start1; + if ((__pyx_t_1 > __pyx_t_2)) { + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = __pyx_t_2; + } + __pyx_r = (__pyx_t_3 - __pyx_t_4); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":27 + * cdef bits32 start + * cdef bits32 end + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * BlockHandler.__init__( self ) + * self.chrom_id = chrom_id + */ + +static int __pyx_pf_2bx_3bbi_11bigbed_file_18BigBedBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigbed_file_18BigBedBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigbed_file.pyx":28 + * cdef bits32 end + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + * BlockHandler.__init__( self ) # <<<<<<<<<<<<<< + * self.chrom_id = chrom_id + * self.start = start + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigbed_file.pyx":29 + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + * BlockHandler.__init__( self ) + * self.chrom_id = chrom_id # <<<<<<<<<<<<<< + * self.start = start + * self.end = end + */ + ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->chrom_id = __pyx_v_chrom_id; + + /* "bx/bbi/bigbed_file.pyx":30 + * BlockHandler.__init__( self ) + * self.chrom_id = chrom_id + * self.start = start # <<<<<<<<<<<<<< + * self.end = end + * cdef handle_block( self, str block_data, BBIFile bbi_file ): + */ + ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->start = __pyx_v_start; + + /* "bx/bbi/bigbed_file.pyx":31 + * self.chrom_id = chrom_id + * self.start = start + * self.end = end # <<<<<<<<<<<<<< + * cdef handle_block( self, str block_data, BBIFile bbi_file ): + * cdef object string_io + */ + ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->end = __pyx_v_end; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":32 + * self.start = start + * self.end = end + * cdef handle_block( self, str block_data, BBIFile bbi_file ): # <<<<<<<<<<<<<< + * cdef object string_io + * cdef int length + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_block(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_v_self, PyObject *__pyx_v_block_data, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_bbi_file) { + PyObject *__pyx_v_string_io = 0; + int __pyx_v_length; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e; + PyObject *__pyx_v_rest = 0; + PyObject *__pyx_v_block_reader = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_block"); + + /* "bx/bbi/bigbed_file.pyx":38 + * cdef str rest + * # Now we parse the block, which should just be a bunch of BED records + * string_io = StringIO( block_data ) # <<<<<<<<<<<<<< + * block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian ) + * length = len( block_data ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_block_data)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_block_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_block_data)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_string_io = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/bbi/bigbed_file.pyx":39 + * # Now we parse the block, which should just be a bunch of BED records + * string_io = StringIO( block_data ) + * block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian ) # <<<<<<<<<<<<<< + * length = len( block_data ) + * while string_io.tell() < length: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_string_io); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_string_io); + __Pyx_GIVEREF(__pyx_v_string_io); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_bbi_file->reader, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_block_reader = __pyx_t_4; + __pyx_t_4 = 0; + + /* "bx/bbi/bigbed_file.pyx":40 + * string_io = StringIO( block_data ) + * block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian ) + * length = len( block_data ) # <<<<<<<<<<<<<< + * while string_io.tell() < length: + * chrom_id = block_reader.read_uint32() + */ + __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_block_data)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_length = __pyx_t_5; + + /* "bx/bbi/bigbed_file.pyx":41 + * block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian ) + * length = len( block_data ) + * while string_io.tell() < length: # <<<<<<<<<<<<<< + * chrom_id = block_reader.read_uint32() + * s = block_reader.read_uint32() + */ + while (1) { + __pyx_t_4 = PyObject_GetAttr(__pyx_v_string_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_6) break; + + /* "bx/bbi/bigbed_file.pyx":42 + * length = len( block_data ) + * while string_io.tell() < length: + * chrom_id = block_reader.read_uint32() # <<<<<<<<<<<<<< + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_chrom_id = __pyx_t_7; + + /* "bx/bbi/bigbed_file.pyx":43 + * while string_io.tell() < length: + * chrom_id = block_reader.read_uint32() + * s = block_reader.read_uint32() # <<<<<<<<<<<<<< + * e = block_reader.read_uint32() + * rest = block_reader.read_c_string() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_s = __pyx_t_7; + + /* "bx/bbi/bigbed_file.pyx":44 + * chrom_id = block_reader.read_uint32() + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() # <<<<<<<<<<<<<< + * rest = block_reader.read_c_string() + * if chrom_id != self.chrom_id: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_e = __pyx_t_7; + + /* "bx/bbi/bigbed_file.pyx":45 + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() + * rest = block_reader.read_c_string() # <<<<<<<<<<<<<< + * if chrom_id != self.chrom_id: + * continue + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_c_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_rest)); + __pyx_v_rest = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/bbi/bigbed_file.pyx":46 + * e = block_reader.read_uint32() + * rest = block_reader.read_c_string() + * if chrom_id != self.chrom_id: # <<<<<<<<<<<<<< + * continue + * if s < self.end and e > self.start: + */ + __pyx_t_6 = (__pyx_v_chrom_id != __pyx_v_self->chrom_id); + if (__pyx_t_6) { + + /* "bx/bbi/bigbed_file.pyx":47 + * rest = block_reader.read_c_string() + * if chrom_id != self.chrom_id: + * continue # <<<<<<<<<<<<<< + * if s < self.end and e > self.start: + * self.handle_interval_value( s, e, rest ) + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/bbi/bigbed_file.pyx":48 + * if chrom_id != self.chrom_id: + * continue + * if s < self.end and e > self.start: # <<<<<<<<<<<<<< + * self.handle_interval_value( s, e, rest ) + * + */ + __pyx_t_6 = (__pyx_v_s < __pyx_v_self->end); + if (__pyx_t_6) { + __pyx_t_8 = (__pyx_v_e > __pyx_v_self->start); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + if (__pyx_t_9) { + + /* "bx/bbi/bigbed_file.pyx":49 + * continue + * if s < self.end and e > self.start: + * self.handle_interval_value( s, e, rest ) # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self->__pyx_base.__pyx_vtab)->handle_interval_value(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_rest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + __pyx_L3_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.handle_block", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_string_io); + __Pyx_XDECREF(__pyx_v_rest); + __Pyx_XDECREF(__pyx_v_block_reader); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":51 + * self.handle_interval_value( s, e, rest ) + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle_interval_value"); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":59 + * """ + * cdef SummarizedData sd + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) + * # What we will load into + */ + +static int __pyx_pf_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_summary_size; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigbed_file.pyx":60 + * cdef SummarizedData sd + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) # <<<<<<<<<<<<<< + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bigbed_file.pyx":62 + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) # <<<<<<<<<<<<<< + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf + */ + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd)); + ((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bbi/bigbed_file.pyx":63 + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) + * for i in range(summary_size): # <<<<<<<<<<<<<< + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): + */ + __pyx_t_6 = __pyx_v_summary_size; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "bx/bbi/bigbed_file.pyx":64 + * self.sd = SummarizedData( start, end, summary_size ) + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf # <<<<<<<<<<<<<< + * for i in range(summary_size): + * self.sd.max_val[i] = -numpy.inf + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Positive(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd->min_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bigbed_file.pyx":65 + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): # <<<<<<<<<<<<<< + * self.sd.max_val[i] = -numpy.inf + * + */ + __pyx_t_6 = __pyx_v_summary_size; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "bx/bbi/bigbed_file.pyx":66 + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): + * self.sd.max_val[i] = -numpy.inf # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd->max_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":68 + * self.sd.max_val[i] = -numpy.inf + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): # <<<<<<<<<<<<<< + * # FIXME: Does this really obvious thing actually do what we want? + * # No... sum_data will end up being the coverage, but min/max/etc are wrong + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_interval_value"); + + /* "bx/bbi/bigbed_file.pyx":71 + * # FIXME: Does this really obvious thing actually do what we want? + * # No... sum_data will end up being the coverage, but min/max/etc are wrong + * self.sd.accumulate_interval_value( s, e, 1 ) # <<<<<<<<<<<<<< + * + * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self->sd->__pyx_vtab)->accumulate_interval_value(__pyx_v_self->sd, __pyx_v_s, __pyx_v_e, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.handle_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":78 + * Accumulates intervals into a list of intervals with values + * """ + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) + * self.intervals = [] + */ + +static int __pyx_pf_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_id); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigbed_file.pyx":79 + * """ + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) # <<<<<<<<<<<<<< + * self.intervals = [] + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bigbed_file.pyx":80 + * def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + * BigBedBlockHandler.__init__( self, chrom_id, start, end ) + * self.intervals = [] # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals)); + ((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals = __pyx_t_4; + __pyx_t_4 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":82 + * self.intervals = [] + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): # <<<<<<<<<<<<<< + * self.intervals.append( ( s, e, rest ) ) + * + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_interval_value"); + + /* "bx/bbi/bigbed_file.pyx":83 + * + * cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + * self.intervals.append( ( s, e, rest ) ) # <<<<<<<<<<<<<< + * + * cdef class BigBedFile( BBIFile ): + */ + if (unlikely(((PyObject *)__pyx_v_self->intervals) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_e); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_rest)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_rest)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_rest)); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_self->intervals, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.handle_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":89 + * A "big binary indexed" file whose raw data is in BED format. + * """ + * def __init__( self, file=None ): # <<<<<<<<<<<<<< + * BBIFile.__init__( self, file, big_bed_sig, "bigbed" ) + * + */ + +static int __pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigbed_file.pyx":90 + * """ + * def __init__( self, file=None ): + * BBIFile.__init__( self, file, big_bed_sig, "bigbed" ) # <<<<<<<<<<<<<< + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_int_2273964779); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_2273964779); + __Pyx_GIVEREF(__pyx_int_2273964779); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bigbed)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__bigbed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigbed)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":92 + * BBIFile.__init__( self, file, big_bed_sig, "bigbed" ) + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Create summary from full data. + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_10BigBedFile__summarize_from_full(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *__pyx_v_v = NULL; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_summarize_from_full"); + + /* "bx/bbi/bigbed_file.pyx":96 + * Create summary from full data. + * """ + * v = SummarizingBlockHandler( chrom_id, start, end, summary_size ) # <<<<<<<<<<<<<< + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * # Round valid count, in place + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_SummarizingBlockHandler)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_v = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "bx/bbi/bigbed_file.pyx":97 + * """ + * v = SummarizingBlockHandler( chrom_id, start, end, summary_size ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) # <<<<<<<<<<<<<< + * # Round valid count, in place + * for i from 0 <= i < summary_size: + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.visit_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom_id, __pyx_v_start, __pyx_v_end, ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_v)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bigbed_file.pyx":99 + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * # Round valid count, in place + * for i from 0 <= i < summary_size: # <<<<<<<<<<<<<< + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + * return v.sd + */ + __pyx_t_6 = __pyx_v_summary_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { + + /* "bx/bbi/bigbed_file.pyx":100 + * # Round valid count, in place + * for i from 0 <= i < summary_size: + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) # <<<<<<<<<<<<<< + * return v.sd + * + */ + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_v->sd->valid_count), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_v->sd->valid_count), __pyx_v_i, __pyx_t_4, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "bx/bbi/bigbed_file.pyx":101 + * for i from 0 <= i < summary_size: + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + * return v.sd # <<<<<<<<<<<<<< + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_v->sd)); + __pyx_r = ((PyObject *)__pyx_v_v->sd); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile._summarize_from_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":103 + * return v.sd + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_11bigbed_file_10BigBedFile_get(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_skip_dispatch) { + PyObject *__pyx_v_chrom_id = NULL; + PyObject *__pyx_v_chrom_size = NULL; + struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *__pyx_v_v = NULL; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_v_s = NULL; + PyObject *__pyx_v_e = NULL; + PyObject *__pyx_v_rest = NULL; + PyObject *__pyx_v_fields = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile_1get)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bigbed_file.pyx":107 + * Gets all data points over the regions `chrom`:`start`-`end`. + * """ + * if start >= end: # <<<<<<<<<<<<<< + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + */ + __pyx_t_6 = (__pyx_v_start >= __pyx_v_end); + if (__pyx_t_6) { + + /* "bx/bbi/bigbed_file.pyx":108 + * """ + * if start >= end: + * return None # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bigbed_file.pyx":109 + * if start >= end: + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) # <<<<<<<<<<<<<< + * if chrom_id is None: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_chrom_id_and_size(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_chrom_size = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bigbed_file.pyx":110 + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: # <<<<<<<<<<<<<< + * return None + * v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) + */ + __pyx_t_6 = (__pyx_v_chrom_id == Py_None); + if (__pyx_t_6) { + + /* "bx/bbi/bigbed_file.pyx":111 + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + * return None # <<<<<<<<<<<<<< + * v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bigbed_file.pyx":112 + * if chrom_id is None: + * return None + * v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) # <<<<<<<<<<<<<< + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * rval = [] + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_chrom_id); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom_id); + __Pyx_GIVEREF(__pyx_v_chrom_id); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_v = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bigbed_file.pyx":113 + * return None + * v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) # <<<<<<<<<<<<<< + * rval = [] + * # FIXME: Not sure the best way to return, will user GenomicInterval for + */ + __pyx_t_8 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.visit_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_t_8, __pyx_v_start, __pyx_v_end, ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_v)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/bbi/bigbed_file.pyx":114 + * v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * rval = [] # <<<<<<<<<<<<<< + * # FIXME: Not sure the best way to return, will user GenomicInterval for + * # now. + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_v_rval = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bigbed_file.pyx":117 + * # FIXME: Not sure the best way to return, will user GenomicInterval for + * # now. + * for ( s, e, rest ) in v.intervals: # <<<<<<<<<<<<<< + * fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) + * rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) + */ + if (unlikely(((PyObject *)__pyx_v_v->intervals) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = ((PyObject *)__pyx_v_v->intervals); __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0; + for (;;) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) { + if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 3)) { + if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); + __pyx_t_2 = PyList_GET_ITEM(sequence, 2); + } + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_1); + index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 2; __pyx_t_2 = __pyx_t_7(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L10_unpacking_done; + __pyx_L9_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L10_unpacking_done:; + } + __Pyx_XDECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_e); + __pyx_v_e = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_rest); + __pyx_v_rest = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bigbed_file.pyx":118 + * # now. + * for ( s, e, rest ) in v.intervals: + * fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) # <<<<<<<<<<<<<< + * rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) + * return rval + */ + __pyx_t_4 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_e); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_e); + __Pyx_GIVEREF(__pyx_v_e); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_rest, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bigbed_file.pyx":119 + * for ( s, e, rest ) in v.intervals: + * fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) + * rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) # <<<<<<<<<<<<<< + * return rval + * + */ + if (unlikely(((PyObject *)__pyx_v_rval) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__GenomicInterval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_INCREF(__pyx_v_fields); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_fields); + __Pyx_GIVEREF(__pyx_v_fields); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_11 = PyList_Append(__pyx_v_rval, __pyx_t_2); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/bbi/bigbed_file.pyx":120 + * fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) + * rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) + * return rval # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_s); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_rest); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigbed_file.pyx":103 + * return v.sd + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_11bigbed_file_10BigBedFile_1get[] = "\n Gets all data points over the regions `chrom`:`start`-`end`.\n "; +static PyObject *__pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("get"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *)__pyx_v_self)->__pyx_base.__pyx_vtab)->get(((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":190 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":196 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":199 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":200 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":202 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":204 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":205 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L6; + } + /*else*/ { + + /* "numpy.pxd":207 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L6:; + + /* "numpy.pxd":209 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":210 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":213 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":218 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":219 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":222 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":223 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":224 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":225 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "numpy.pxd":226 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":228 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":229 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L9:; + + /* "numpy.pxd":230 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":231 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":232 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":235 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":236 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "numpy.pxd":240 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":242 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":244 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L12; + } + /*else*/ { + + /* "numpy.pxd":247 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L12:; + + /* "numpy.pxd":249 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":250 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":251 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":252 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "numpy.pxd":254 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L15; + } + + /* "numpy.pxd":255 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L15; + } + + /* "numpy.pxd":256 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L15; + } + + /* "numpy.pxd":257 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L15; + } + + /* "numpy.pxd":258 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L15; + } + + /* "numpy.pxd":259 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L15; + } + + /* "numpy.pxd":260 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L15; + } + + /* "numpy.pxd":261 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L15; + } + + /* "numpy.pxd":262 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L15; + } + + /* "numpy.pxd":263 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L15; + } + + /* "numpy.pxd":264 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L15; + } + + /* "numpy.pxd":265 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L15; + } + + /* "numpy.pxd":266 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L15; + } + + /* "numpy.pxd":267 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L15; + } + + /* "numpy.pxd":268 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L15; + } + + /* "numpy.pxd":269 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L15; + } + + /* "numpy.pxd":270 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L15; + } + /*else*/ { + + /* "numpy.pxd":272 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L15:; + + /* "numpy.pxd":273 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":274 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":276 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":277 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":278 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":281 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":282 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L13:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":284 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "numpy.pxd":285 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "numpy.pxd":286 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":287 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":288 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":764 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":767 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring"); + + /* "numpy.pxd":786 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":787 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":790 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":791 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":792 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":794 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":797 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":798 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":809 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":810 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":811 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":812 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":814 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":816 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":817 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":818 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":822 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":823 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":824 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":825 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":840 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":841 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":845 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":846 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":961 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "numpy.pxd":963 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":964 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":966 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":967 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":968 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":969 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "numpy.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":975 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *p; + PyObject *o = __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedBlockHandler(PyObject *o) { + __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_dealloc(o); +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigbed_file_BigBedBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BigBedBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BigBedBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BigBedBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BigBedBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigbed_file.BigBedBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BigBedBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_BigBedBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BigBedBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BigBedBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("\n BlockHandler that parses the block into a series of BED records\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigbed_file_BigBedBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigbed_file_18BigBedBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_SummarizingBlockHandler __pyx_vtable_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigbed_file_SummarizingBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *p; + PyObject *o = __pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedBlockHandler(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; + p->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_SummarizingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)o; + Py_XDECREF(((PyObject *)p->sd)); + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedBlockHandler(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigbed_file_SummarizingBlockHandler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)o; + if (__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_traverse(o, v, a); if (e) return e; + } + if (p->sd) { + e = (*v)(((PyObject*)p->sd), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigbed_file_SummarizingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)o; + PyObject* tmp; + if (__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_clear) { + __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_clear(o); + } + tmp = ((PyObject*)p->sd); + p->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigbed_file_SummarizingBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SummarizingBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SummarizingBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SummarizingBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SummarizingBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigbed_file.SummarizingBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_SummarizingBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SummarizingBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_SummarizingBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SummarizingBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SummarizingBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Accumulates intervals into a SummarizedData\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigbed_file_SummarizingBlockHandler, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigbed_file_SummarizingBlockHandler, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigbed_file_SummarizingBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigbed_file_SummarizingBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler __pyx_vtable_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *p; + PyObject *o = __pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedBlockHandler(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; + p->intervals = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)o; + Py_XDECREF(((PyObject *)p->intervals)); + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedBlockHandler(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)o; + if (__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_traverse(o, v, a); if (e) return e; + } + if (p->intervals) { + e = (*v)(p->intervals, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)o; + PyObject* tmp; + if (__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_clear) { + __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler->tp_clear(o); + } + tmp = ((PyObject*)p->intervals); + p->intervals = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntervalAccumulatingBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntervalAccumulatingBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IntervalAccumulatingBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntervalAccumulatingBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IntervalAccumulatingBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntervalAccumulatingBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntervalAccumulatingBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntervalAccumulatingBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedFile; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *p; + PyObject *o = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile*)__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedFile; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedFile(PyObject *o) { + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_dealloc(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigbed_file_BigBedFile(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigbed_file_BigBedFile(PyObject *o) { + if (__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_clear) { + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_clear(o); + } + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigbed_file_BigBedFile[] = { + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile_1get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_11bigbed_file_10BigBedFile_1get)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BigBedFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BigBedFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BigBedFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BigBedFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigbed_file_BigBedFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigbed_file.BigBedFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigbed_file_BigBedFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BigBedFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_BigBedFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BigBedFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BigBedFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n A \"big binary indexed\" file whose raw data is in BED format.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigbed_file_BigBedFile, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigbed_file_BigBedFile, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigbed_file_BigBedFile, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigbed_file_BigBedFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bigbed_file"), + __Pyx_DOCSTR(__pyx_k_16), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s__GenomicInterval, __pyx_k__GenomicInterval, sizeof(__pyx_k__GenomicInterval), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__StringIO, __pyx_k__StringIO, sizeof(__pyx_k__StringIO), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__bigbed, __pyx_k__bigbed, sizeof(__pyx_k__bigbed), 0, 0, 1, 1}, + {&__pyx_n_s__cStringIO, __pyx_k__cStringIO, sizeof(__pyx_k__cStringIO), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__chrom_id, __pyx_k__chrom_id, sizeof(__pyx_k__chrom_id), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, + {&__pyx_n_s__is_little_endian, __pyx_k__is_little_endian, sizeof(__pyx_k__is_little_endian), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read_c_string, __pyx_k__read_c_string, sizeof(__pyx_k__read_c_string), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__summary_size, __pyx_k__summary_size, sizeof(__pyx_k__summary_size), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {&__pyx_n_s__zlib, __pyx_k__zlib, sizeof(__pyx_k__zlib), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetName(__pyx_b, __pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/bbi/bigbed_file.pyx":118 + * # now. + * for ( s, e, rest ) in v.intervals: + * fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) # <<<<<<<<<<<<<< + * rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) + * return rval + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2273964779 = PyInt_FromString((char *)"2273964779", 0, 0); if (unlikely(!__pyx_int_2273964779)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbigbed_file(void); /*proto*/ +PyMODINIT_FUNC initbigbed_file(void) +#else +PyMODINIT_FUNC PyInit_bigbed_file(void); /*proto*/ +PyMODINIT_FUNC PyInit_bigbed_file(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bigbed_file(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bigbed_file"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_16), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bbi__bigbed_file) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = __Pyx_ImportType("bx.bbi.bbi_file", "BlockHandler", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler = &__pyx_vtable_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedBlockHandler.__pyx_base.handle_block = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *))__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_block; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedBlockHandler.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *))__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BigBedBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler = &__pyx_type_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + __pyx_vtabptr_2bx_3bbi_11bigbed_file_SummarizingBlockHandler = &__pyx_vtable_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_SummarizingBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_SummarizingBlockHandler.__pyx_base.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *))__pyx_f_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigbed_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SummarizingBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigbed_file_SummarizingBlockHandler = &__pyx_type_2bx_3bbi_11bigbed_file_SummarizingBlockHandler; + __pyx_vtabptr_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler = &__pyx_vtable_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + __pyx_vtable_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler.__pyx_base.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *))__pyx_f_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntervalAccumulatingBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler = &__pyx_type_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler; + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = __Pyx_ImportType("bx.bbi.bbi_file", "BBIFile", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedFile = &__pyx_vtable_2bx_3bbi_11bigbed_file_BigBedFile; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedFile.__pyx_base = *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedFile.__pyx_base._summarize_from_full = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int))__pyx_f_2bx_3bbi_11bigbed_file_10BigBedFile__summarize_from_full; + __pyx_vtable_2bx_3bbi_11bigbed_file_BigBedFile.get = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_11bigbed_file_10BigBedFile_get; + __pyx_type_2bx_3bbi_11bigbed_file_BigBedFile.tp_base = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigbed_file_BigBedFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigbed_file_BigBedFile.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BigBedFile", (PyObject *)&__pyx_type_2bx_3bbi_11bigbed_file_BigBedFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigbed_file_BigBedFile = &__pyx_type_2bx_3bbi_11bigbed_file_BigBedFile; + /*--- Type import code ---*/ + __pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = __Pyx_ImportType("bx.bbi.bpt_file", "BPTFile", sizeof(struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = __Pyx_ImportType("bx.bbi.cirtree_file", "CIRTreeFile", sizeof(struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = __Pyx_ImportType("bx.bbi.bbi_file", "SummaryBlock", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = __Pyx_ImportType("bx.bbi.bbi_file", "SummarizedData", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bbi/bigbed_file.pyx":7 + * from bbi_file cimport * + * from cirtree_file cimport CIRTreeFile + * import numpy # <<<<<<<<<<<<<< + * cimport numpy + * from types cimport * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bigbed_file.pyx":10 + * cimport numpy + * from types cimport * + * from bx.intervals.io import GenomicInterval # <<<<<<<<<<<<<< + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__GenomicInterval)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__GenomicInterval)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GenomicInterval)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_17), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__GenomicInterval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__GenomicInterval, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigbed_file.pyx":11 + * from types cimport * + * from bx.intervals.io import GenomicInterval + * from bx.misc.binary_file import BinaryFileReader # <<<<<<<<<<<<<< + * from cStringIO import StringIO + * import zlib + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_18), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bigbed_file.pyx":12 + * from bx.intervals.io import GenomicInterval + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO # <<<<<<<<<<<<<< + * import zlib + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__StringIO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__cStringIO), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StringIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigbed_file.pyx":13 + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO + * import zlib # <<<<<<<<<<<<<< + * + * DEF big_bed_sig = 0x8789F2EB + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zlib, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigbed_file.pyx":1 + * """ # <<<<<<<<<<<<<< + * BigBed file. + * """ + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bbi.bigbed_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bbi.bigbed_file"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.pyx new file mode 100755 index 0000000..420d934 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigbed_file.pyx @@ -0,0 +1,122 @@ +""" +BigBed file. +""" + +from bbi_file cimport * +from cirtree_file cimport CIRTreeFile +import numpy +cimport numpy +from types cimport * +from bx.intervals.io import GenomicInterval +from bx.misc.binary_file import BinaryFileReader +from cStringIO import StringIO +import zlib + +DEF big_bed_sig = 0x8789F2EB + +cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + return min( end1, end2 ) - max( start1, start2 ) + +cdef class BigBedBlockHandler( BlockHandler ): + """ + BlockHandler that parses the block into a series of BED records + """ + cdef bits32 chrom_id + cdef bits32 start + cdef bits32 end + def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + BlockHandler.__init__( self ) + self.chrom_id = chrom_id + self.start = start + self.end = end + cdef handle_block( self, str block_data, BBIFile bbi_file ): + cdef object string_io + cdef int length + cdef bits32 chrom_id, s, e + cdef str rest + # Now we parse the block, which should just be a bunch of BED records + string_io = StringIO( block_data ) + block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian ) + length = len( block_data ) + while string_io.tell() < length: + chrom_id = block_reader.read_uint32() + s = block_reader.read_uint32() + e = block_reader.read_uint32() + rest = block_reader.read_c_string() + if chrom_id != self.chrom_id: + continue + if s < self.end and e > self.start: + self.handle_interval_value( s, e, rest ) + + cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + pass + +cdef class SummarizingBlockHandler( BigBedBlockHandler ): + """ + Accumulates intervals into a SummarizedData + """ + cdef SummarizedData sd + def __init__( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + BigBedBlockHandler.__init__( self, chrom_id, start, end ) + # What we will load into + self.sd = SummarizedData( start, end, summary_size ) + for i in range(summary_size): + self.sd.min_val[i] = +numpy.inf + for i in range(summary_size): + self.sd.max_val[i] = -numpy.inf + + cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + # FIXME: Does this really obvious thing actually do what we want? + # No... sum_data will end up being the coverage, but min/max/etc are wrong + self.sd.accumulate_interval_value( s, e, 1 ) + +cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ): + cdef list intervals + """ + Accumulates intervals into a list of intervals with values + """ + def __init__( self, bits32 chrom_id, bits32 start, bits32 end ): + BigBedBlockHandler.__init__( self, chrom_id, start, end ) + self.intervals = [] + + cdef handle_interval_value( self, bits32 s, bits32 e, str rest ): + self.intervals.append( ( s, e, rest ) ) + +cdef class BigBedFile( BBIFile ): + """ + A "big binary indexed" file whose raw data is in BED format. + """ + def __init__( self, file=None ): + BBIFile.__init__( self, file, big_bed_sig, "bigbed" ) + + cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + """ + Create summary from full data. + """ + v = SummarizingBlockHandler( chrom_id, start, end, summary_size ) + self.visit_blocks_in_region( chrom_id, start, end, v ) + # Round valid count, in place + for i from 0 <= i < summary_size: + v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + return v.sd + + cpdef get( self, char * chrom, bits32 start, bits32 end ): + """ + Gets all data points over the regions `chrom`:`start`-`end`. + """ + if start >= end: + return None + chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + if chrom_id is None: + return None + v = IntervalAccumulatingBlockHandler( chrom_id, start, end ) + self.visit_blocks_in_region( chrom_id, start, end, v ) + rval = [] + # FIXME: Not sure the best way to return, will user GenomicInterval for + # now. + for ( s, e, rest ) in v.intervals: + fields = [ chrom, str( s ), str( e ) ] + rest.split( "\t" ) + rval.append( GenomicInterval( None, fields, 0, 1, 2, 5, "+" ) ) + return rval + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.c b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.c new file mode 100755 index 0000000..ea45584 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.c @@ -0,0 +1,8992 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:13 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bbi__bigwig_file +#define __PYX_HAVE_API__bx__bbi__bigwig_file +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "bigwig_file.pyx", + "numpy.pxd", + "bpt_file.pxd", + "cirtree_file.pxd", + "bbi_file.pxd", +}; + +/* "types.pxd":1 + * ctypedef unsigned char UBYTE # <<<<<<<<<<<<<< + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE; + +/* "types.pxd":2 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE # <<<<<<<<<<<<<< + * ctypedef unsigned short UWORD + * ctypedef short WORD + */ +typedef signed char __pyx_t_2bx_3bbi_5types_BYTE; + +/* "types.pxd":3 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD # <<<<<<<<<<<<<< + * ctypedef short WORD + * ctypedef unsigned long long bits64 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD; + +/* "types.pxd":4 + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + * ctypedef short WORD # <<<<<<<<<<<<<< + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + */ +typedef short __pyx_t_2bx_3bbi_5types_WORD; + +/* "types.pxd":5 + * ctypedef unsigned short UWORD + * ctypedef short WORD + * ctypedef unsigned long long bits64 # <<<<<<<<<<<<<< + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64; + +/* "types.pxd":6 + * ctypedef short WORD + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 # <<<<<<<<<<<<<< + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + */ +typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32; + +/* "types.pxd":7 + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 # <<<<<<<<<<<<<< + * ctypedef unsigned char bits8 + * ctypedef int signed32 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16; + +/* "types.pxd":8 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 # <<<<<<<<<<<<<< + * ctypedef int signed32 + * + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8; + +/* "types.pxd":9 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + * ctypedef int signed32 # <<<<<<<<<<<<<< + * + * ctypedef bint boolean + */ +typedef int __pyx_t_2bx_3bbi_5types_signed32; + +/* "types.pxd":11 + * ctypedef int signed32 + * + * ctypedef bint boolean # <<<<<<<<<<<<<< + * + */ +typedef int __pyx_t_2bx_3bbi_5types_boolean; + +/* "numpy.pxd":719 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":720 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":721 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":722 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":726 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":727 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":728 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":729 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":733 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":734 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":743 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":744 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":745 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":747 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":748 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":749 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":751 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":754 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":756 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock; +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile; +struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile; +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler; +struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler; +struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; +struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile; +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData; +struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile; + +/* "numpy.pxd":758 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":760 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":762 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "bbi_file.pxd":8 + * cimport numpy + * + * cdef class SummaryBlock: # <<<<<<<<<<<<<< + * """ + * A block of summary data from disk + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock { + PyObject_HEAD + __pyx_t_2bx_3bbi_5types_bits32 chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + __pyx_t_2bx_3bbi_5types_bits32 valid_count; + double min_val; + double max_val; + double sum_data; + double sum_squares; +}; + + +/* "bbi_file.pxd":37 + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + * + * cdef class BBIFile # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtab; + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_bits32 magic; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *chrom_bpt; + __pyx_t_2bx_3bbi_5types_bits16 version; + __pyx_t_2bx_3bbi_5types_bits16 zoom_levels; + __pyx_t_2bx_3bbi_5types_bits64 chrom_tree_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_data_offset; + __pyx_t_2bx_3bbi_5types_bits64 unzoomed_index_offset; + __pyx_t_2bx_3bbi_5types_bits16 field_count; + __pyx_t_2bx_3bbi_5types_bits16 defined_field_count; + __pyx_t_2bx_3bbi_5types_bits64 as_offset; + __pyx_t_2bx_3bbi_5types_bits64 total_summary_offset; + __pyx_t_2bx_3bbi_5types_bits32 uncompress_buf_size; + PyObject *level_list; +}; + + +/* "bx/bbi/bigwig_file.pyx":122 + * array[ i ] = val + * + * cdef class BigWigFile( BBIFile ): # <<<<<<<<<<<<<< + * """ + * A "big binary indexed" file whose raw data is in wiggle format. + */ +struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile { + struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile __pyx_base; +}; + + +/* "bbi_file.pxd":39 + * cdef class BBIFile + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtab; +}; + + +/* "bx/bbi/bigwig_file.pyx":23 + * return min( end1, end2 ) - max( start1, start2 ) + * + * cdef class BigWigBlockHandler( BlockHandler ): # <<<<<<<<<<<<<< + * """ + * BlockHandler that parses the block into a series of wiggle records, and calls `handle_interval_value` for each. + */ +struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler { + struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler __pyx_base; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; +}; + + +/* "bx/bbi/bigwig_file.pyx":93 + * self.sd.accumulate_interval_value( s, e, val ) + * + * cdef class IntervalAccumulatingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * cdef list intervals + * """ + */ +struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler { + struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; + PyObject *intervals; +}; + + +/* "bx/bbi/bigwig_file.pyx":105 + * self.intervals.append( ( s, e, val ) ) + * + * cdef class ArrayAccumulatingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a list of intervals with values + */ +struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler { + struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; + PyArrayObject *array; +}; + + +/* "cirtree_file.pxd":3 + * from types cimport * + * + * cdef class CIRTreeFile: # <<<<<<<<<<<<<< + * cdef object file + * cdef object reader + */ +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits32 start_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 start_base; + __pyx_t_2bx_3bbi_5types_bits32 end_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 end_base; + __pyx_t_2bx_3bbi_5types_bits64 file_size; + __pyx_t_2bx_3bbi_5types_bits32 items_per_slot; +}; + + +/* "bbi_file.pxd":21 + * cdef public double sum_squares + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ +struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtab; + __pyx_t_2bx_3bbi_5types_bits32 start; + __pyx_t_2bx_3bbi_5types_bits32 end; + int size; + PyArrayObject *valid_count; + PyArrayObject *min_val; + PyArrayObject *max_val; + PyArrayObject *sum_data; + PyArrayObject *sum_squares; +}; + + +/* "bx/bbi/bigwig_file.pyx":76 + * pass + * + * cdef class SummarizingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a SummarizedData + */ +struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler { + struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; + struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *sd; +}; + + +/* "bpt_file.pxd":5 + * from types cimport * + * + * cdef class BPTFile: # <<<<<<<<<<<<<< + * """ + * On disk B+ tree compatible with Jim Kent's bPlusTree.c + */ +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits32 key_size; + __pyx_t_2bx_3bbi_5types_bits32 value_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; +}; + + + +/* "bbi_file.pxd":39 + * cdef class BBIFile + * + * cdef class BlockHandler: # <<<<<<<<<<<<<< + * """ + * Callback for `BBIFile.visit_blocks_in_region` + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler { + PyObject *(*handle_block)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + + +/* "bx/bbi/bigwig_file.pyx":23 + * return min( end1, end2 ) - max( start1, start2 ) + * + * cdef class BigWigBlockHandler( BlockHandler ): # <<<<<<<<<<<<<< + * """ + * BlockHandler that parses the block into a series of wiggle records, and calls `handle_interval_value` for each. + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler __pyx_base; + PyObject *(*handle_interval_value)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float); +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + + +/* "bx/bbi/bigwig_file.pyx":105 + * self.intervals.append( ( s, e, val ) ) + * + * cdef class ArrayAccumulatingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a list of intervals with values + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; + + +/* "bbi_file.pxd":21 + * cdef public double sum_squares + * + * cdef class SummarizedData: # <<<<<<<<<<<<<< + * """ + * The result of using SummaryBlocks read from the file to produce a + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData { + PyObject *(*accumulate_interval_value)(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *__pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData; + + +/* "bbi_file.pxd":37 + * cdef accumulate_interval_value( self, bits32 s, bits32 e, float val ) + * + * cdef class BBIFile # <<<<<<<<<<<<<< + * + * cdef class BlockHandler: + */ + +struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile { + PyObject *(*visit_blocks_in_region)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *); + PyObject *(*_get_chrom_id_and_size)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *); + PyObject *(*_best_zoom_level)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, int); + PyObject *(*summarize)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*query)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch); + PyObject *(*_summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int); +}; +static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + + +/* "bx/bbi/bigwig_file.pyx":122 + * array[ i ] = val + * + * cdef class BigWigFile( BBIFile ): # <<<<<<<<<<<<<< + * """ + * A "big binary indexed" file whose raw data is in wiggle format. + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile { + struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile __pyx_base; + PyObject *(*get)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch); + PyObject *(*get_as_array)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigFile; + + +/* "bx/bbi/bigwig_file.pyx":93 + * self.sd.accumulate_interval_value( s, e, val ) + * + * cdef class IntervalAccumulatingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * cdef list intervals + * """ + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; + + +/* "bx/bbi/bigwig_file.pyx":76 + * pass + * + * cdef class SummarizingBlockHandler( BigWigBlockHandler ): # <<<<<<<<<<<<<< + * """ + * Accumulates intervals into a SummarizedData + */ + +struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_SummarizingBlockHandler { + struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_base; +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0}; +Py_ssize_t __Pyx_minusones[] = {-1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.bbi.types' */ + +/* Module declarations from 'bx.bbi.bpt_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = 0; + +/* Module declarations from 'bx.bbi.cirtree_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = 0; + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ + +/* Module declarations from 'bx.bbi.bbi_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = 0; + +/* Module declarations from 'bx.bbi.bigwig_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigwig_file_SummarizingBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler = 0; +static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigFile = 0; +static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigwig_file_range_intersection(int, int, int, int); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), 'R' }; +#define __Pyx_MODULE_NAME "bx.bbi.bigwig_file" +int __pyx_module_is_main_bx__bbi__bigwig_file = 0; + +/* Implementation of 'bx.bbi.bigwig_file' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_round; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_2[] = "ndarray is not C contiguous"; +static char __pyx_k_4[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_6[] = "Non-native byte order not supported"; +static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_12[] = "Format string allocated too short."; +static char __pyx_k_14[] = "\nBigWig file.\n"; +static char __pyx_k_15[] = "bx.misc.binary_file"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__inf[] = "inf"; +static char __pyx_k__nan[] = "nan"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__skip[] = "skip"; +static char __pyx_k__zlib[] = "zlib"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__deque[] = "deque"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__round[] = "round"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__bigwig[] = "bigwig"; +static char __pyx_k__float32[] = "float32"; +static char __pyx_k__StringIO[] = "StringIO"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__cStringIO[] = "cStringIO"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__read_float[] = "read_float"; +static char __pyx_k__read_uint8[] = "read_uint8"; +static char __pyx_k__collections[] = "collections"; +static char __pyx_k__read_uint16[] = "read_uint16"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__get_as_array[] = "get_as_array"; +static char __pyx_k__summary_size[] = "summary_size"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static char __pyx_k__is_little_endian[] = "is_little_endian"; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_n_s_15; +static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__StringIO; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__bigwig; +static PyObject *__pyx_n_s__cStringIO; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__collections; +static PyObject *__pyx_n_s__deque; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__float32; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__get_as_array; +static PyObject *__pyx_n_s__inf; +static PyObject *__pyx_n_s__is_little_endian; +static PyObject *__pyx_n_s__nan; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__read_float; +static PyObject *__pyx_n_s__read_uint16; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__read_uint8; +static PyObject *__pyx_n_s__round; +static PyObject *__pyx_n_s__skip; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__summary_size; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_n_s__zlib; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_2291137574; +static PyObject *__pyx_k_tuple_1; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_13; + +/* "bx/bbi/bigwig_file.pyx":20 + * DEF bwg_fixed_step = 3 + * + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): # <<<<<<<<<<<<<< + * return min( end1, end2 ) - max( start1, start2 ) + * + */ + +static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigwig_file_range_intersection(int __pyx_v_start1, int __pyx_v_end1, int __pyx_v_start2, int __pyx_v_end2) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("range_intersection"); + + /* "bx/bbi/bigwig_file.pyx":21 + * + * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + * return min( end1, end2 ) - max( start1, start2 ) # <<<<<<<<<<<<<< + * + * cdef class BigWigBlockHandler( BlockHandler ): + */ + __pyx_t_1 = __pyx_v_end2; + __pyx_t_2 = __pyx_v_end1; + if ((__pyx_t_1 < __pyx_t_2)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_t_1 = __pyx_v_start2; + __pyx_t_2 = __pyx_v_start1; + if ((__pyx_t_1 > __pyx_t_2)) { + __pyx_t_4 = __pyx_t_1; + } else { + __pyx_t_4 = __pyx_t_2; + } + __pyx_r = (__pyx_t_3 - __pyx_t_4); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":29 + * cdef bits32 start + * cdef bits32 end + * def __init__( self, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * BlockHandler.__init__( self ) + * self.start = start + */ + +static int __pyx_pf_2bx_3bbi_11bigwig_file_18BigWigBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigwig_file_18BigWigBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigwig_file.pyx":30 + * cdef bits32 end + * def __init__( self, bits32 start, bits32 end ): + * BlockHandler.__init__( self ) # <<<<<<<<<<<<<< + * self.start = start + * self.end = end + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":31 + * def __init__( self, bits32 start, bits32 end ): + * BlockHandler.__init__( self ) + * self.start = start # <<<<<<<<<<<<<< + * self.end = end + * cdef handle_block( self, str block_data, BBIFile bbi_file ): + */ + ((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *)__pyx_v_self)->start = __pyx_v_start; + + /* "bx/bbi/bigwig_file.pyx":32 + * BlockHandler.__init__( self ) + * self.start = start + * self.end = end # <<<<<<<<<<<<<< + * cdef handle_block( self, str block_data, BBIFile bbi_file ): + * cdef bits32 b_chrom_id, b_start, b_end, b_valid_count + */ + ((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *)__pyx_v_self)->end = __pyx_v_end; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":33 + * self.start = start + * self.end = end + * cdef handle_block( self, str block_data, BBIFile bbi_file ): # <<<<<<<<<<<<<< + * cdef bits32 b_chrom_id, b_start, b_end, b_valid_count + * cdef bits32 b_item_step, b_item_span + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_18BigWigBlockHandler_handle_block(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *__pyx_v_self, PyObject *__pyx_v_block_data, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_bbi_file) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_chrom_id; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_end; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_item_step; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_item_span; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_v_b_item_count; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_v_b_type; + int __pyx_v_s; + int __pyx_v_e; + float __pyx_v_val; + PyObject *__pyx_v_block_reader = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_5; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_t_6; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + float __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_block"); + + /* "bx/bbi/bigwig_file.pyx":41 + * cdef float val + * # Now we parse the block, first the header + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=bbi_file.reader.is_little_endian ) # <<<<<<<<<<<<<< + * b_chrom_id = block_reader.read_uint32() + * b_start = block_reader.read_uint32() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_block_data)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_block_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_block_data)); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_bbi_file->reader, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_block_reader = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":42 + * # Now we parse the block, first the header + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=bbi_file.reader.is_little_endian ) + * b_chrom_id = block_reader.read_uint32() # <<<<<<<<<<<<<< + * b_start = block_reader.read_uint32() + * b_end = block_reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_b_chrom_id = __pyx_t_5; + + /* "bx/bbi/bigwig_file.pyx":43 + * block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=bbi_file.reader.is_little_endian ) + * b_chrom_id = block_reader.read_uint32() + * b_start = block_reader.read_uint32() # <<<<<<<<<<<<<< + * b_end = block_reader.read_uint32() + * b_item_step = block_reader.read_uint32() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_b_start = __pyx_t_5; + + /* "bx/bbi/bigwig_file.pyx":44 + * b_chrom_id = block_reader.read_uint32() + * b_start = block_reader.read_uint32() + * b_end = block_reader.read_uint32() # <<<<<<<<<<<<<< + * b_item_step = block_reader.read_uint32() + * b_item_span = block_reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_b_end = __pyx_t_5; + + /* "bx/bbi/bigwig_file.pyx":45 + * b_start = block_reader.read_uint32() + * b_end = block_reader.read_uint32() + * b_item_step = block_reader.read_uint32() # <<<<<<<<<<<<<< + * b_item_span = block_reader.read_uint32() + * b_type = block_reader.read_uint8() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_b_item_step = __pyx_t_5; + + /* "bx/bbi/bigwig_file.pyx":46 + * b_end = block_reader.read_uint32() + * b_item_step = block_reader.read_uint32() + * b_item_span = block_reader.read_uint32() # <<<<<<<<<<<<<< + * b_type = block_reader.read_uint8() + * block_reader.skip(1) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_b_item_span = __pyx_t_5; + + /* "bx/bbi/bigwig_file.pyx":47 + * b_item_step = block_reader.read_uint32() + * b_item_span = block_reader.read_uint32() + * b_type = block_reader.read_uint8() # <<<<<<<<<<<<<< + * block_reader.skip(1) + * b_item_count = block_reader.read_uint16() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedChar(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_b_type = __pyx_t_6; + + /* "bx/bbi/bigwig_file.pyx":48 + * b_item_span = block_reader.read_uint32() + * b_type = block_reader.read_uint8() + * block_reader.skip(1) # <<<<<<<<<<<<<< + * b_item_count = block_reader.read_uint16() + * for i from 0 <= i < b_item_count: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/bbi/bigwig_file.pyx":49 + * b_type = block_reader.read_uint8() + * block_reader.skip(1) + * b_item_count = block_reader.read_uint16() # <<<<<<<<<<<<<< + * for i from 0 <= i < b_item_count: + * # Depending on the type, s and e are either read or + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_b_item_count = __pyx_t_7; + + /* "bx/bbi/bigwig_file.pyx":50 + * block_reader.skip(1) + * b_item_count = block_reader.read_uint16() + * for i from 0 <= i < b_item_count: # <<<<<<<<<<<<<< + * # Depending on the type, s and e are either read or + * # generate using header, val is always read + */ + __pyx_t_7 = __pyx_v_b_item_count; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { + __pyx_t_2 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":61 + * e = s + b_item_span + * val = block_reader.read_float() + * elif b_type == bwg_fixed_step: # <<<<<<<<<<<<<< + * s = b_start + ( i * b_item_span ) + * e = s + b_item_span + */ + switch (__pyx_v_b_type) { + + /* "bx/bbi/bigwig_file.pyx":53 + * # Depending on the type, s and e are either read or + * # generate using header, val is always read + * if b_type == bwg_bed_graph: # <<<<<<<<<<<<<< + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() + */ + case 1: + + /* "bx/bbi/bigwig_file.pyx":54 + * # generate using header, val is always read + * if b_type == bwg_bed_graph: + * s = block_reader.read_uint32() # <<<<<<<<<<<<<< + * e = block_reader.read_uint32() + * val = block_reader.read_float() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_s = __pyx_t_9; + + /* "bx/bbi/bigwig_file.pyx":55 + * if b_type == bwg_bed_graph: + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() # <<<<<<<<<<<<<< + * val = block_reader.read_float() + * elif b_type == bwg_variable_step: + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_e = __pyx_t_9; + + /* "bx/bbi/bigwig_file.pyx":56 + * s = block_reader.read_uint32() + * e = block_reader.read_uint32() + * val = block_reader.read_float() # <<<<<<<<<<<<<< + * elif b_type == bwg_variable_step: + * s = block_reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_val = __pyx_t_10; + break; + + /* "bx/bbi/bigwig_file.pyx":57 + * e = block_reader.read_uint32() + * val = block_reader.read_float() + * elif b_type == bwg_variable_step: # <<<<<<<<<<<<<< + * s = block_reader.read_uint32() + * e = s + b_item_span + */ + case 2: + + /* "bx/bbi/bigwig_file.pyx":58 + * val = block_reader.read_float() + * elif b_type == bwg_variable_step: + * s = block_reader.read_uint32() # <<<<<<<<<<<<<< + * e = s + b_item_span + * val = block_reader.read_float() + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_s = __pyx_t_9; + + /* "bx/bbi/bigwig_file.pyx":59 + * elif b_type == bwg_variable_step: + * s = block_reader.read_uint32() + * e = s + b_item_span # <<<<<<<<<<<<<< + * val = block_reader.read_float() + * elif b_type == bwg_fixed_step: + */ + __pyx_v_e = (__pyx_v_s + __pyx_v_b_item_span); + + /* "bx/bbi/bigwig_file.pyx":60 + * s = block_reader.read_uint32() + * e = s + b_item_span + * val = block_reader.read_float() # <<<<<<<<<<<<<< + * elif b_type == bwg_fixed_step: + * s = b_start + ( i * b_item_span ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_val = __pyx_t_10; + break; + + /* "bx/bbi/bigwig_file.pyx":61 + * e = s + b_item_span + * val = block_reader.read_float() + * elif b_type == bwg_fixed_step: # <<<<<<<<<<<<<< + * s = b_start + ( i * b_item_span ) + * e = s + b_item_span + */ + case 3: + + /* "bx/bbi/bigwig_file.pyx":62 + * val = block_reader.read_float() + * elif b_type == bwg_fixed_step: + * s = b_start + ( i * b_item_span ) # <<<<<<<<<<<<<< + * e = s + b_item_span + * val = block_reader.read_float() + */ + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_b_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_b_item_span); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_v_i, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_s = __pyx_t_9; + + /* "bx/bbi/bigwig_file.pyx":63 + * elif b_type == bwg_fixed_step: + * s = b_start + ( i * b_item_span ) + * e = s + b_item_span # <<<<<<<<<<<<<< + * val = block_reader.read_float() + * if s < self.start: + */ + __pyx_v_e = (__pyx_v_s + __pyx_v_b_item_span); + + /* "bx/bbi/bigwig_file.pyx":64 + * s = b_start + ( i * b_item_span ) + * e = s + b_item_span + * val = block_reader.read_float() # <<<<<<<<<<<<<< + * if s < self.start: + * s = self.start + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_val = __pyx_t_10; + break; + } + + /* "bx/bbi/bigwig_file.pyx":65 + * e = s + b_item_span + * val = block_reader.read_float() + * if s < self.start: # <<<<<<<<<<<<<< + * s = self.start + * if e > self.end: + */ + __pyx_t_11 = (__pyx_v_s < __pyx_v_self->start); + if (__pyx_t_11) { + + /* "bx/bbi/bigwig_file.pyx":66 + * val = block_reader.read_float() + * if s < self.start: + * s = self.start # <<<<<<<<<<<<<< + * if e > self.end: + * e = self.end + */ + __pyx_v_s = __pyx_v_self->start; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/bbi/bigwig_file.pyx":67 + * if s < self.start: + * s = self.start + * if e > self.end: # <<<<<<<<<<<<<< + * e = self.end + * if s >= e: + */ + __pyx_t_11 = (__pyx_v_e > __pyx_v_self->end); + if (__pyx_t_11) { + + /* "bx/bbi/bigwig_file.pyx":68 + * s = self.start + * if e > self.end: + * e = self.end # <<<<<<<<<<<<<< + * if s >= e: + * continue + */ + __pyx_v_e = __pyx_v_self->end; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bigwig_file.pyx":69 + * if e > self.end: + * e = self.end + * if s >= e: # <<<<<<<<<<<<<< + * continue + * self.handle_interval_value( s, e, val ) + */ + __pyx_t_11 = (__pyx_v_s >= __pyx_v_e); + if (__pyx_t_11) { + + /* "bx/bbi/bigwig_file.pyx":70 + * e = self.end + * if s >= e: + * continue # <<<<<<<<<<<<<< + * self.handle_interval_value( s, e, val ) + * + */ + goto __pyx_L3_continue; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/bbi/bigwig_file.pyx":71 + * if s >= e: + * continue + * self.handle_interval_value( s, e, val ) # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler *)__pyx_v_self->__pyx_base.__pyx_vtab)->handle_interval_value(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3_continue:; + __pyx_t_8 = __Pyx_PyInt_AsLong(__pyx_v_i); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "bx/bbi/bigwig_file.pyx":50 + * block_reader.skip(1) + * b_item_count = block_reader.read_uint16() + * for i from 0 <= i < b_item_count: # <<<<<<<<<<<<<< + * # Depending on the type, s and e are either read or + * # generate using header, val is always read + */ + __pyx_t_3 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_3; + __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigBlockHandler.handle_block", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_block_reader); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":73 + * self.handle_interval_value( s, e, val ) + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_18BigWigBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, float __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("handle_interval_value"); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":81 + * """ + * cdef SummarizedData sd + * def __init__( self, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * BigWigBlockHandler.__init__( self, start, end ) + * # What we will load into + */ + +static int __pyx_pf_2bx_3bbi_11bigwig_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigwig_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_v_summary_size; + int __pyx_v_i; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.SummarizingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigwig_file.pyx":82 + * cdef SummarizedData sd + * def __init__( self, bits32 start, bits32 end, int summary_size ): + * BigWigBlockHandler.__init__( self, start, end ) # <<<<<<<<<<<<<< + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":84 + * BigWigBlockHandler.__init__( self, start, end ) + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) # <<<<<<<<<<<<<< + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf + */ + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_v_self)->sd); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_v_self)->sd)); + ((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_v_self)->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bbi/bigwig_file.pyx":85 + * # What we will load into + * self.sd = SummarizedData( start, end, summary_size ) + * for i in range(summary_size): # <<<<<<<<<<<<<< + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): + */ + __pyx_t_5 = __pyx_v_summary_size; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "bx/bbi/bigwig_file.pyx":86 + * self.sd = SummarizedData( start, end, summary_size ) + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf # <<<<<<<<<<<<<< + * for i in range(summary_size): + * self.sd.max_val[i] = -numpy.inf + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Positive(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_v_self)->sd->min_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bigwig_file.pyx":87 + * for i in range(summary_size): + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): # <<<<<<<<<<<<<< + * self.sd.max_val[i] = -numpy.inf + * + */ + __pyx_t_5 = __pyx_v_summary_size; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "bx/bbi/bigwig_file.pyx":88 + * self.sd.min_val[i] = +numpy.inf + * for i in range(summary_size): + * self.sd.max_val[i] = -numpy.inf # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_v_self)->sd->max_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigwig_file.SummarizingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":90 + * self.sd.max_val[i] = -numpy.inf + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): # <<<<<<<<<<<<<< + * self.sd.accumulate_interval_value( s, e, val ) + * + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_23SummarizingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, float __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_interval_value"); + + /* "bx/bbi/bigwig_file.pyx":91 + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + * self.sd.accumulate_interval_value( s, e, val ) # <<<<<<<<<<<<<< + * + * cdef class IntervalAccumulatingBlockHandler( BigWigBlockHandler ): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_v_self->sd->__pyx_vtab)->accumulate_interval_value(__pyx_v_self->sd, __pyx_v_s, __pyx_v_e, __pyx_v_val); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bigwig_file.SummarizingBlockHandler.handle_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":98 + * Accumulates intervals into a list of intervals with values + * """ + * def __init__( self, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * BigWigBlockHandler.__init__( self, start, end ) + * self.intervals = [] + */ + +static int __pyx_pf_2bx_3bbi_11bigwig_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigwig_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.IntervalAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigwig_file.pyx":99 + * """ + * def __init__( self, bits32 start, bits32 end ): + * BigWigBlockHandler.__init__( self, start, end ) # <<<<<<<<<<<<<< + * self.intervals = [] + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":100 + * def __init__( self, bits32 start, bits32 end ): + * BigWigBlockHandler.__init__( self, start, end ) + * self.intervals = [] # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals)); + ((struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals = __pyx_t_3; + __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigwig_file.IntervalAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":102 + * self.intervals = [] + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): # <<<<<<<<<<<<<< + * self.intervals.append( ( s, e, val ) ) + * + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_32IntervalAccumulatingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, float __pyx_v_val) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_interval_value"); + + /* "bx/bbi/bigwig_file.pyx":103 + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + * self.intervals.append( ( s, e, val ) ) # <<<<<<<<<<<<<< + * + * cdef class ArrayAccumulatingBlockHandler( BigWigBlockHandler ): + */ + if (unlikely(((PyObject *)__pyx_v_self->intervals) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_e); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = PyList_Append(__pyx_v_self->intervals, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigwig_file.IntervalAccumulatingBlockHandler.handle_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":110 + * """ + * cdef numpy.ndarray array + * def __init__( self, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * BigWigBlockHandler.__init__( self, start, end ) + * self.array = numpy.zeros( end - start, dtype=numpy.float32 ) + */ + +static int __pyx_pf_2bx_3bbi_11bigwig_file_29ArrayAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigwig_file_29ArrayAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.ArrayAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigwig_file.pyx":111 + * cdef numpy.ndarray array + * def __init__( self, bits32 start, bits32 end ): + * BigWigBlockHandler.__init__( self, start, end ) # <<<<<<<<<<<<<< + * self.array = numpy.zeros( end - start, dtype=numpy.float32 ) + * self.array[...] = numpy.nan + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":112 + * def __init__( self, bits32 start, bits32 end ): + * BigWigBlockHandler.__init__( self, start, end ) + * self.array = numpy.zeros( end - start, dtype=numpy.float32 ) # <<<<<<<<<<<<<< + * self.array[...] = numpy.nan + * + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyLong_FromUnsignedLong((__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)__pyx_v_self)->array); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)__pyx_v_self)->array)); + ((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)__pyx_v_self)->array = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":113 + * BigWigBlockHandler.__init__( self, start, end ) + * self.array = numpy.zeros( end - start, dtype=numpy.float32 ) + * self.array[...] = numpy.nan # <<<<<<<<<<<<<< + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyObject_SetItem(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)__pyx_v_self)->array), Py_Ellipsis, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigwig_file.ArrayAccumulatingBlockHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":115 + * self.array[...] = numpy.nan + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): # <<<<<<<<<<<<<< + * cdef numpy.ndarray[ numpy.float32_t, ndim=1 ] array = self.array + * cdef int i + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_29ArrayAccumulatingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, float __pyx_v_val) { + PyArrayObject *__pyx_v_array = 0; + int __pyx_v_i; + Py_buffer __pyx_bstruct_array; + Py_ssize_t __pyx_bstride_0_array = 0; + Py_ssize_t __pyx_bshape_0_array = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyArrayObject *__pyx_t_1 = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_interval_value"); + __pyx_bstruct_array.buf = NULL; + + /* "bx/bbi/bigwig_file.pyx":116 + * + * cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + * cdef numpy.ndarray[ numpy.float32_t, ndim=1 ] array = self.array # <<<<<<<<<<<<<< + * cdef int i + * # Slicing is not optimized by Cython + */ + __pyx_t_1 = ((PyArrayObject *)__pyx_v_self->array); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_array, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_array.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_bstride_0_array = __pyx_bstruct_array.strides[0]; + __pyx_bshape_0_array = __pyx_bstruct_array.shape[0]; + } + } + __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->array)); + __pyx_v_array = ((PyArrayObject *)__pyx_v_self->array); + + /* "bx/bbi/bigwig_file.pyx":119 + * cdef int i + * # Slicing is not optimized by Cython + * for i from s - self.start <= i < e - self.start: # <<<<<<<<<<<<<< + * array[ i ] = val + * + */ + __pyx_t_2 = (__pyx_v_e - __pyx_v_self->__pyx_base.start); + for (__pyx_v_i = (__pyx_v_s - __pyx_v_self->__pyx_base.start); __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "bx/bbi/bigwig_file.pyx":120 + * # Slicing is not optimized by Cython + * for i from s - self.start <= i < e - self.start: + * array[ i ] = val # <<<<<<<<<<<<<< + * + * cdef class BigWigFile( BBIFile ): + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = -1; + if (__pyx_t_3 < 0) { + __pyx_t_3 += __pyx_bshape_0_array; + if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; + } else if (unlikely(__pyx_t_3 >= __pyx_bshape_0_array)) __pyx_t_4 = 0; + if (unlikely(__pyx_t_4 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_4); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_bstruct_array.buf, __pyx_t_3, __pyx_bstride_0_array) = __pyx_v_val; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_array); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("bx.bbi.bigwig_file.ArrayAccumulatingBlockHandler.handle_interval_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_array); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_array); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":126 + * A "big binary indexed" file whose raw data is in wiggle format. + * """ + * def __init__( self, file=None ): # <<<<<<<<<<<<<< + * BBIFile.__init__( self, file, big_wig_sig, "bigwig" ) + * + */ + +static int __pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bigwig_file.pyx":127 + * """ + * def __init__( self, file=None ): + * BBIFile.__init__( self, file, big_wig_sig, "bigwig" ) # <<<<<<<<<<<<<< + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_int_2291137574); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_2291137574); + __Pyx_GIVEREF(__pyx_int_2291137574); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bigwig)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__bigwig)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bigwig)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":129 + * BBIFile.__init__( self, file, big_wig_sig, "bigwig" ) + * + * cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): # <<<<<<<<<<<<<< + * """ + * Create summary from full data. + */ + +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile__summarize_from_full(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_v_summary_size) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *__pyx_v_v = NULL; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_summarize_from_full"); + + /* "bx/bbi/bigwig_file.pyx":133 + * Create summary from full data. + * """ + * v = SummarizingBlockHandler( start, end, summary_size ) # <<<<<<<<<<<<<< + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * # Round valid count, in place + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_SummarizingBlockHandler)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_v = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":134 + * """ + * v = SummarizingBlockHandler( start, end, summary_size ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) # <<<<<<<<<<<<<< + * # Round valid count, in place + * for i from 0 <= i < summary_size: + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.visit_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom_id, __pyx_v_start, __pyx_v_end, ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bigwig_file.pyx":136 + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * # Round valid count, in place + * for i from 0 <= i < summary_size: # <<<<<<<<<<<<<< + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + * return v.sd + */ + __pyx_t_5 = __pyx_v_summary_size; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "bx/bbi/bigwig_file.pyx":137 + * # Round valid count, in place + * for i from 0 <= i < summary_size: + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) # <<<<<<<<<<<<<< + * return v.sd + * + */ + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_v->sd->valid_count), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_v->sd->valid_count), __pyx_v_i, __pyx_t_3, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "bx/bbi/bigwig_file.pyx":138 + * for i from 0 <= i < summary_size: + * v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + * return v.sd # <<<<<<<<<<<<<< + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_v->sd)); + __pyx_r = ((PyObject *)__pyx_v_v->sd); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile._summarize_from_full", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":140 + * return v.sd + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile_get(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_skip_dispatch) { + PyObject *__pyx_v_chrom_id = NULL; + PyObject *__pyx_v_chrom_size = NULL; + struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *__pyx_v_v = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_1get)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bigwig_file.pyx":144 + * Gets all data points over the regions `chrom`:`start`-`end`. + * """ + * if start >= end: # <<<<<<<<<<<<<< + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + */ + __pyx_t_6 = (__pyx_v_start >= __pyx_v_end); + if (__pyx_t_6) { + + /* "bx/bbi/bigwig_file.pyx":145 + * """ + * if start >= end: + * return None # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bigwig_file.pyx":146 + * if start >= end: + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) # <<<<<<<<<<<<<< + * if chrom_id is None: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_chrom_id_and_size(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_chrom_size = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":147 + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: # <<<<<<<<<<<<<< + * return None + * v = IntervalAccumulatingBlockHandler( start, end ) + */ + __pyx_t_6 = (__pyx_v_chrom_id == Py_None); + if (__pyx_t_6) { + + /* "bx/bbi/bigwig_file.pyx":148 + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + * return None # <<<<<<<<<<<<<< + * v = IntervalAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bigwig_file.pyx":149 + * if chrom_id is None: + * return None + * v = IntervalAccumulatingBlockHandler( start, end ) # <<<<<<<<<<<<<< + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * return v.intervals + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_v = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":150 + * return None + * v = IntervalAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) # <<<<<<<<<<<<<< + * return v.intervals + * + */ + __pyx_t_8 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.visit_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_t_8, __pyx_v_start, __pyx_v_end, ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_v)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":151 + * v = IntervalAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * return v.intervals # <<<<<<<<<<<<<< + * + * cpdef get_as_array( self, char * chrom, bits32 start, bits32 end ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_v->intervals)); + __pyx_r = ((PyObject *)__pyx_v_v->intervals); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":140 + * return v.sd + * + * cpdef get( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_11bigwig_file_10BigWigFile_1get[] = "\n Gets all data points over the regions `chrom`:`start`-`end`.\n "; +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_1get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("get"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self)->__pyx_base.__pyx_vtab)->get(((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":153 + * return v.intervals + * + * cpdef get_as_array( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile_get_as_array(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *__pyx_v_self, char *__pyx_v_chrom, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end, int __pyx_skip_dispatch) { + PyObject *__pyx_v_chrom_id = NULL; + PyObject *__pyx_v_chrom_size = NULL; + struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *__pyx_v_v = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_as_array"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_as_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/bbi/bigwig_file.pyx":157 + * Gets all data points over the regions `chrom`:`start`-`end`. + * """ + * if start >= end: # <<<<<<<<<<<<<< + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + */ + __pyx_t_6 = (__pyx_v_start >= __pyx_v_end); + if (__pyx_t_6) { + + /* "bx/bbi/bigwig_file.pyx":158 + * """ + * if start >= end: + * return None # <<<<<<<<<<<<<< + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bbi/bigwig_file.pyx":159 + * if start >= end: + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) # <<<<<<<<<<<<<< + * if chrom_id is None: + * return None + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._get_chrom_id_and_size(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_v_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + if (likely(PyTuple_CheckExact(sequence))) { + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); + } else { + if (unlikely(PyList_GET_SIZE(sequence) != 2)) { + if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5_unpacking_done; + __pyx_L4_unpacking_failed:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); + if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L5_unpacking_done:; + } + __pyx_v_chrom_id = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_chrom_size = __pyx_t_5; + __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":160 + * return None + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: # <<<<<<<<<<<<<< + * return None + * v = ArrayAccumulatingBlockHandler( start, end ) + */ + __pyx_t_6 = (__pyx_v_chrom_id == Py_None); + if (__pyx_t_6) { + + /* "bx/bbi/bigwig_file.pyx":161 + * chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + * if chrom_id is None: + * return None # <<<<<<<<<<<<<< + * v = ArrayAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bigwig_file.pyx":162 + * if chrom_id is None: + * return None + * v = ArrayAccumulatingBlockHandler( start, end ) # <<<<<<<<<<<<<< + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * return v.array + */ + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_v = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":163 + * return None + * v = ArrayAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) # <<<<<<<<<<<<<< + * return v.array + * + */ + __pyx_t_8 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_chrom_id); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.visit_blocks_in_region(((struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *)__pyx_v_self), __pyx_t_8, __pyx_v_start, __pyx_v_end, ((struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *)__pyx_v_v)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/bbi/bigwig_file.pyx":164 + * v = ArrayAccumulatingBlockHandler( start, end ) + * self.visit_blocks_in_region( chrom_id, start, end, v ) + * return v.array # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_v->array)); + __pyx_r = ((PyObject *)__pyx_v_v->array); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get_as_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_chrom_id); + __Pyx_XDECREF(__pyx_v_chrom_size); + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bigwig_file.pyx":153 + * return v.intervals + * + * cpdef get_as_array( self, char * chrom, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * """ + * Gets all data points over the regions `chrom`:`start`-`end`. + */ + +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array[] = "\n Gets all data points over the regions `chrom`:`start`-`end`.\n "; +static PyObject *__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_chrom; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("get_as_array"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_as_array", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_as_array", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_as_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_chrom) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_as_array", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get_as_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile *)((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self)->__pyx_base.__pyx_vtab)->get_as_array(((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *)__pyx_v_self), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bbi.bigwig_file.BigWigFile.get_as_array", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":190 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":196 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":199 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":200 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":202 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":204 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":205 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L6; + } + /*else*/ { + + /* "numpy.pxd":207 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L6:; + + /* "numpy.pxd":209 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":210 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":213 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":218 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":219 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":222 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":223 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":224 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":225 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "numpy.pxd":226 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":228 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":229 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L9:; + + /* "numpy.pxd":230 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":231 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":232 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":235 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":236 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "numpy.pxd":240 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":242 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":244 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L12; + } + /*else*/ { + + /* "numpy.pxd":247 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L12:; + + /* "numpy.pxd":249 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":250 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":251 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":252 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "numpy.pxd":254 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L15; + } + + /* "numpy.pxd":255 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L15; + } + + /* "numpy.pxd":256 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L15; + } + + /* "numpy.pxd":257 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L15; + } + + /* "numpy.pxd":258 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L15; + } + + /* "numpy.pxd":259 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L15; + } + + /* "numpy.pxd":260 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L15; + } + + /* "numpy.pxd":261 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L15; + } + + /* "numpy.pxd":262 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L15; + } + + /* "numpy.pxd":263 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L15; + } + + /* "numpy.pxd":264 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L15; + } + + /* "numpy.pxd":265 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L15; + } + + /* "numpy.pxd":266 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L15; + } + + /* "numpy.pxd":267 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L15; + } + + /* "numpy.pxd":268 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L15; + } + + /* "numpy.pxd":269 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L15; + } + + /* "numpy.pxd":270 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L15; + } + /*else*/ { + + /* "numpy.pxd":272 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L15:; + + /* "numpy.pxd":273 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":274 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":276 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":277 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":278 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":281 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":282 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L13:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":284 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "numpy.pxd":285 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "numpy.pxd":286 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":287 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":288 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":764 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":767 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring"); + + /* "numpy.pxd":786 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":787 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":790 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":791 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":792 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":794 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":797 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":798 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":809 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":810 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":811 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":812 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":814 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":816 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":817 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":818 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":822 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":823 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":824 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":825 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":840 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":841 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":845 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":846 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":961 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "numpy.pxd":963 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":964 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":966 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":967 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":968 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":969 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "numpy.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":975 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigBlockHandler __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *p; + PyObject *o = __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigBlockHandler(PyObject *o) { + __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_dealloc(o); +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigwig_file_BigWigBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BigWigBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BigWigBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BigWigBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BigWigBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigwig_file.BigWigBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BigWigBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_BigWigBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BigWigBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BigWigBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("\n BlockHandler that parses the block into a series of wiggle records, and calls `handle_interval_value` for each.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigwig_file_BigWigBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigwig_file_18BigWigBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_SummarizingBlockHandler __pyx_vtable_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigwig_file_SummarizingBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *p; + PyObject *o = __pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigBlockHandler(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; + p->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_SummarizingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)o; + Py_XDECREF(((PyObject *)p->sd)); + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigBlockHandler(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigwig_file_SummarizingBlockHandler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)o; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse(o, v, a); if (e) return e; + } + if (p->sd) { + e = (*v)(((PyObject*)p->sd), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigwig_file_SummarizingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler *)o; + PyObject* tmp; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear) { + __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear(o); + } + tmp = ((PyObject*)p->sd); + p->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigwig_file_SummarizingBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SummarizingBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SummarizingBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SummarizingBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SummarizingBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigwig_file.SummarizingBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigwig_file_SummarizingBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_SummarizingBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SummarizingBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_SummarizingBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SummarizingBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SummarizingBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Accumulates intervals into a SummarizedData\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigwig_file_SummarizingBlockHandler, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigwig_file_SummarizingBlockHandler, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigwig_file_SummarizingBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigwig_file_23SummarizingBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigwig_file_SummarizingBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler __pyx_vtable_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *p; + PyObject *o = __pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigBlockHandler(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; + p->intervals = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)o; + Py_XDECREF(((PyObject *)p->intervals)); + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigBlockHandler(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)o; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse(o, v, a); if (e) return e; + } + if (p->intervals) { + e = (*v)(p->intervals, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler *)o; + PyObject* tmp; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear) { + __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear(o); + } + tmp = ((PyObject*)p->intervals); + p->intervals = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntervalAccumulatingBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntervalAccumulatingBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IntervalAccumulatingBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntervalAccumulatingBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigwig_file.IntervalAccumulatingBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IntervalAccumulatingBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntervalAccumulatingBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntervalAccumulatingBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntervalAccumulatingBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigwig_file_32IntervalAccumulatingBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler __pyx_vtable_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *p; + PyObject *o = __pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigBlockHandler(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__pyx_vtabptr_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; + p->array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)o; + Py_XDECREF(((PyObject *)p->array)); + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigBlockHandler(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)o; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_traverse(o, v, a); if (e) return e; + } + if (p->array) { + e = (*v)(((PyObject*)p->array), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler(PyObject *o) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *p = (struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler *)o; + PyObject* tmp; + if (__pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear) { + __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler->tp_clear(o); + } + tmp = ((PyObject*)p->array); + p->array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ArrayAccumulatingBlockHandler = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ArrayAccumulatingBlockHandler = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ArrayAccumulatingBlockHandler = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ArrayAccumulatingBlockHandler = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigwig_file.ArrayAccumulatingBlockHandler"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ArrayAccumulatingBlockHandler, /*tp_as_number*/ + &__pyx_tp_as_sequence_ArrayAccumulatingBlockHandler, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ArrayAccumulatingBlockHandler, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ArrayAccumulatingBlockHandler, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Accumulates intervals into a list of intervals with values\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigwig_file_29ArrayAccumulatingBlockHandler___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_2bx_3bbi_11bigwig_file_BigWigFile __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile; + +static PyObject *__pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *p; + PyObject *o = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile*)__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigFile; + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigFile(PyObject *o) { + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_dealloc(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_11bigwig_file_BigWigFile(PyObject *o, visitproc v, void *a) { + int e; + if (__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_traverse) { + e = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_traverse(o, v, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_11bigwig_file_BigWigFile(PyObject *o) { + if (__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_clear) { + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_clear(o); + } + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_11bigwig_file_BigWigFile[] = { + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_1get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_11bigwig_file_10BigWigFile_1get)}, + {__Pyx_NAMESTR("get_as_array"), (PyCFunction)__pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_11bigwig_file_10BigWigFile_2get_as_array)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BigWigFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BigWigFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BigWigFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BigWigFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_11bigwig_file_BigWigFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bigwig_file.BigWigFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_11bigwig_file_BigWigFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BigWigFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_BigWigFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BigWigFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BigWigFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n A \"big binary indexed\" file whose raw data is in wiggle format.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_11bigwig_file_BigWigFile, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_11bigwig_file_BigWigFile, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_11bigwig_file_BigWigFile, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_11bigwig_file_10BigWigFile___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_11bigwig_file_BigWigFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bigwig_file"), + __Pyx_DOCSTR(__pyx_k_14), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, + {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__StringIO, __pyx_k__StringIO, sizeof(__pyx_k__StringIO), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__bigwig, __pyx_k__bigwig, sizeof(__pyx_k__bigwig), 0, 0, 1, 1}, + {&__pyx_n_s__cStringIO, __pyx_k__cStringIO, sizeof(__pyx_k__cStringIO), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, + {&__pyx_n_s__deque, __pyx_k__deque, sizeof(__pyx_k__deque), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__get_as_array, __pyx_k__get_as_array, sizeof(__pyx_k__get_as_array), 0, 0, 1, 1}, + {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, + {&__pyx_n_s__is_little_endian, __pyx_k__is_little_endian, sizeof(__pyx_k__is_little_endian), 0, 0, 1, 1}, + {&__pyx_n_s__nan, __pyx_k__nan, sizeof(__pyx_k__nan), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read_float, __pyx_k__read_float, sizeof(__pyx_k__read_float), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint16, __pyx_k__read_uint16, sizeof(__pyx_k__read_uint16), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint8, __pyx_k__read_uint8, sizeof(__pyx_k__read_uint8), 0, 0, 1, 1}, + {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, + {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__summary_size, __pyx_k__summary_size, sizeof(__pyx_k__summary_size), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s__zlib, __pyx_k__zlib, sizeof(__pyx_k__zlib), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetName(__pyx_b, __pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/bbi/bigwig_file.pyx":48 + * b_item_span = block_reader.read_uint32() + * b_type = block_reader.read_uint8() + * block_reader.skip(1) # <<<<<<<<<<<<<< + * b_item_count = block_reader.read_uint16() + * for i from 0 <= i < b_item_count: + */ + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2291137574 = PyInt_FromString((char *)"2291137574", 0, 0); if (unlikely(!__pyx_int_2291137574)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbigwig_file(void); /*proto*/ +PyMODINIT_FUNC initbigwig_file(void) +#else +PyMODINIT_FUNC PyInit_bigwig_file(void); /*proto*/ +PyMODINIT_FUNC PyInit_bigwig_file(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bigwig_file(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bigwig_file"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_14), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bbi__bigwig_file) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = __Pyx_ImportType("bx.bbi.bbi_file", "BlockHandler", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler = &__pyx_vtable_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigBlockHandler.__pyx_base.handle_block = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *))__pyx_f_2bx_3bbi_11bigwig_file_18BigWigBlockHandler_handle_block; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigBlockHandler.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float))__pyx_f_2bx_3bbi_11bigwig_file_18BigWigBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BigWigBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler = &__pyx_type_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + __pyx_vtabptr_2bx_3bbi_11bigwig_file_SummarizingBlockHandler = &__pyx_vtable_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_SummarizingBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_SummarizingBlockHandler.__pyx_base.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float))__pyx_f_2bx_3bbi_11bigwig_file_23SummarizingBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigwig_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SummarizingBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigwig_file_SummarizingBlockHandler = &__pyx_type_2bx_3bbi_11bigwig_file_SummarizingBlockHandler; + __pyx_vtabptr_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler = &__pyx_vtable_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler.__pyx_base.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float))__pyx_f_2bx_3bbi_11bigwig_file_32IntervalAccumulatingBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntervalAccumulatingBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler = &__pyx_type_2bx_3bbi_11bigwig_file_IntervalAccumulatingBlockHandler; + __pyx_vtabptr_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler = &__pyx_vtable_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler.__pyx_base = *__pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + __pyx_vtable_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler.__pyx_base.handle_interval_value = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, float))__pyx_f_2bx_3bbi_11bigwig_file_29ArrayAccumulatingBlockHandler_handle_interval_value; + __pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler.tp_base = __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigBlockHandler; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ArrayAccumulatingBlockHandler", (PyObject *)&__pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler = &__pyx_type_2bx_3bbi_11bigwig_file_ArrayAccumulatingBlockHandler; + __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = __Pyx_ImportType("bx.bbi.bbi_file", "BBIFile", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigFile = &__pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile.__pyx_base = *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile.__pyx_base._summarize_from_full = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int))__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile__summarize_from_full; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile.get = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile_get; + __pyx_vtable_2bx_3bbi_11bigwig_file_BigWigFile.get_as_array = (PyObject *(*)(struct __pyx_obj_2bx_3bbi_11bigwig_file_BigWigFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch))__pyx_f_2bx_3bbi_11bigwig_file_10BigWigFile_get_as_array; + __pyx_type_2bx_3bbi_11bigwig_file_BigWigFile.tp_base = __pyx_ptype_2bx_3bbi_8bbi_file_BBIFile; + if (PyType_Ready(&__pyx_type_2bx_3bbi_11bigwig_file_BigWigFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_3bbi_11bigwig_file_BigWigFile.tp_dict, __pyx_vtabptr_2bx_3bbi_11bigwig_file_BigWigFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BigWigFile", (PyObject *)&__pyx_type_2bx_3bbi_11bigwig_file_BigWigFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_11bigwig_file_BigWigFile = &__pyx_type_2bx_3bbi_11bigwig_file_BigWigFile; + /*--- Type import code ---*/ + __pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = __Pyx_ImportType("bx.bbi.bpt_file", "BPTFile", sizeof(struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = __Pyx_ImportType("bx.bbi.cirtree_file", "CIRTreeFile", sizeof(struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = __Pyx_ImportType("bx.bbi.bbi_file", "SummaryBlock", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = __Pyx_ImportType("bx.bbi.bbi_file", "SummarizedData", sizeof(struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData), 1); if (unlikely(!__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData = (struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_SummarizedData*)__Pyx_GetVtable(__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData->tp_dict); if (unlikely(!__pyx_vtabptr_2bx_3bbi_8bbi_file_SummarizedData)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bbi/bigwig_file.pyx":5 + * """ + * + * from collections import deque # <<<<<<<<<<<<<< + * from bbi_file cimport * + * from cirtree_file cimport CIRTreeFile + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__deque)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__deque)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deque)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__deque, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":8 + * from bbi_file cimport * + * from cirtree_file cimport CIRTreeFile + * import numpy # <<<<<<<<<<<<<< + * cimport numpy + * from types cimport * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":11 + * cimport numpy + * from types cimport * + * from bx.misc.binary_file import BinaryFileReader # <<<<<<<<<<<<<< + * from cStringIO import StringIO + * import zlib + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_15), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/bigwig_file.pyx":12 + * from types cimport * + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO # <<<<<<<<<<<<<< + * import zlib + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__StringIO)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__StringIO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__StringIO)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__cStringIO), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StringIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":13 + * from bx.misc.binary_file import BinaryFileReader + * from cStringIO import StringIO + * import zlib # <<<<<<<<<<<<<< + * + * DEF big_wig_sig = 0x888FFC26 + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__zlib), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zlib, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bigwig_file.pyx":1 + * """ # <<<<<<<<<<<<<< + * BigWig file. + * """ + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bbi.bigwig_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bbi.bigwig_file"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} + +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} + +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 0: return "end"; + default: return "unparseable format string"; + } +} + +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + default: + { + int number = __Pyx_BufFmt_ParseNumber(&ts); + if (number == -1) { /* First char was not a digit */ + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%c')", *ts); + return NULL; + } + ctx->new_count = (size_t)number; + } + } + } +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} +static void __Pyx_RaiseBufferIndexError(int axis) { + PyErr_Format(PyExc_IndexError, + "Out of bounds on buffer access (axis %d)", axis); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); + else { + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + return -1; + } +} + +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject* obj = view->obj; + if (obj) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + Py_DECREF(obj); + view->obj = NULL; + } +} + +#endif + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.pyx new file mode 100755 index 0000000..20c8d82 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_file.pyx @@ -0,0 +1,171 @@ +""" +BigWig file. +""" + +from collections import deque +from bbi_file cimport * +from cirtree_file cimport CIRTreeFile +import numpy +cimport numpy +from types cimport * +from bx.misc.binary_file import BinaryFileReader +from cStringIO import StringIO +import zlib + +DEF big_wig_sig = 0x888FFC26 +DEF bwg_bed_graph = 1 +DEF bwg_variable_step = 2 +DEF bwg_fixed_step = 3 + +cdef inline int range_intersection( int start1, int end1, int start2, int end2 ): + return min( end1, end2 ) - max( start1, start2 ) + +cdef class BigWigBlockHandler( BlockHandler ): + """ + BlockHandler that parses the block into a series of wiggle records, and calls `handle_interval_value` for each. + """ + cdef bits32 start + cdef bits32 end + def __init__( self, bits32 start, bits32 end ): + BlockHandler.__init__( self ) + self.start = start + self.end = end + cdef handle_block( self, str block_data, BBIFile bbi_file ): + cdef bits32 b_chrom_id, b_start, b_end, b_valid_count + cdef bits32 b_item_step, b_item_span + cdef bits16 b_item_count + cdef UBYTE b_type + cdef int s, e + cdef float val + # Now we parse the block, first the header + block_reader = BinaryFileReader( StringIO( block_data ), is_little_endian=bbi_file.reader.is_little_endian ) + b_chrom_id = block_reader.read_uint32() + b_start = block_reader.read_uint32() + b_end = block_reader.read_uint32() + b_item_step = block_reader.read_uint32() + b_item_span = block_reader.read_uint32() + b_type = block_reader.read_uint8() + block_reader.skip(1) + b_item_count = block_reader.read_uint16() + for i from 0 <= i < b_item_count: + # Depending on the type, s and e are either read or + # generate using header, val is always read + if b_type == bwg_bed_graph: + s = block_reader.read_uint32() + e = block_reader.read_uint32() + val = block_reader.read_float() + elif b_type == bwg_variable_step: + s = block_reader.read_uint32() + e = s + b_item_span + val = block_reader.read_float() + elif b_type == bwg_fixed_step: + s = b_start + ( i * b_item_span ) + e = s + b_item_span + val = block_reader.read_float() + if s < self.start: + s = self.start + if e > self.end: + e = self.end + if s >= e: + continue + self.handle_interval_value( s, e, val ) + + cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + pass + +cdef class SummarizingBlockHandler( BigWigBlockHandler ): + """ + Accumulates intervals into a SummarizedData + """ + cdef SummarizedData sd + def __init__( self, bits32 start, bits32 end, int summary_size ): + BigWigBlockHandler.__init__( self, start, end ) + # What we will load into + self.sd = SummarizedData( start, end, summary_size ) + for i in range(summary_size): + self.sd.min_val[i] = +numpy.inf + for i in range(summary_size): + self.sd.max_val[i] = -numpy.inf + + cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + self.sd.accumulate_interval_value( s, e, val ) + +cdef class IntervalAccumulatingBlockHandler( BigWigBlockHandler ): + cdef list intervals + """ + Accumulates intervals into a list of intervals with values + """ + def __init__( self, bits32 start, bits32 end ): + BigWigBlockHandler.__init__( self, start, end ) + self.intervals = [] + + cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + self.intervals.append( ( s, e, val ) ) + +cdef class ArrayAccumulatingBlockHandler( BigWigBlockHandler ): + """ + Accumulates intervals into a list of intervals with values + """ + cdef numpy.ndarray array + def __init__( self, bits32 start, bits32 end ): + BigWigBlockHandler.__init__( self, start, end ) + self.array = numpy.zeros( end - start, dtype=numpy.float32 ) + self.array[...] = numpy.nan + + cdef handle_interval_value( self, bits32 s, bits32 e, float val ): + cdef numpy.ndarray[ numpy.float32_t, ndim=1 ] array = self.array + cdef int i + # Slicing is not optimized by Cython + for i from s - self.start <= i < e - self.start: + array[ i ] = val + +cdef class BigWigFile( BBIFile ): + """ + A "big binary indexed" file whose raw data is in wiggle format. + """ + def __init__( self, file=None ): + BBIFile.__init__( self, file, big_wig_sig, "bigwig" ) + + cdef _summarize_from_full( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ): + """ + Create summary from full data. + """ + v = SummarizingBlockHandler( start, end, summary_size ) + self.visit_blocks_in_region( chrom_id, start, end, v ) + # Round valid count, in place + for i from 0 <= i < summary_size: + v.sd.valid_count[i] = round( v.sd.valid_count[i] ) + return v.sd + + cpdef get( self, char * chrom, bits32 start, bits32 end ): + """ + Gets all data points over the regions `chrom`:`start`-`end`. + """ + if start >= end: + return None + chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + if chrom_id is None: + return None + v = IntervalAccumulatingBlockHandler( start, end ) + self.visit_blocks_in_region( chrom_id, start, end, v ) + return v.intervals + + cpdef get_as_array( self, char * chrom, bits32 start, bits32 end ): + """ + Gets all data points over the regions `chrom`:`start`-`end`. + """ + if start >= end: + return None + chrom_id, chrom_size = self._get_chrom_id_and_size( chrom ) + if chrom_id is None: + return None + v = ArrayAccumulatingBlockHandler( start, end ) + self.visit_blocks_in_region( chrom_id, start, end, v ) + return v.array + + + + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_tests.py new file mode 100755 index 0000000..6d4f355 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bigwig_tests.py @@ -0,0 +1,83 @@ +import sys, os +import unittest +import numpy + +try: + sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +except: + sys.path.insert(0, os.path.dirname(os.path.abspath("."))) + +from bx.bbi.bigwig_file import BigWigFile + +def allclose( a, b, tol=0.00001 ): + """ + Like numpy.allclose but treat Nan == Nan + """ + d = numpy.absolute( a - b ) + return numpy.all( numpy.isnan( d ) | ( d < tol ) ) + +class TestBigWig(unittest.TestCase): + def setUp(self): + f = open( "test_data/bbi_tests/test.bw" ) + self.bw = BigWigFile(file=f) + + def test_get_summary(self): + data = self.bw.query("chr1", 10000, 20000, 10) + means = [ x['mean'] for x in data ] + assert numpy.allclose( map(float, means), [-0.17557571594973645, -0.054009292602539061, -0.056892242431640622, -0.03650328826904297, 0.036112907409667966, 0.0064466032981872557, 0.036949024200439454, 0.076638259887695306, 0.043518108367919923, 0.01554749584197998] ) + + # Summarize variant + sd = self.bw.summarize( "chr1", 10000, 20000, 10) + assert numpy.allclose( sd.sum_data / sd.valid_count, [-0.17557571594973645, -0.054009292602539061, -0.056892242431640622, -0.03650328826904297, 0.036112907409667966, 0.0064466032981872557, 0.036949024200439454, 0.076638259887695306, 0.043518108367919923, 0.01554749584197998] ) + + # Test min and max for this entire summary region + data = self.bw.query("chr1", 10000, 20000, 1) + maxs = [ x['max'] for x in data ] + mins = [ x['min'] for x in data ] + self.assertEqual( map(float, maxs), [0.289000004529953] ) + self.assertEqual( map(float, mins), [-3.9100000858306885] ) + + def test_get_leaf(self): + data = self.bw.query("chr1", 11000, 11005, 5) + means = [ x['mean'] for x in data ] + assert numpy.allclose( map(float, means), [0.050842501223087311, -2.4589500427246094, 0.050842501223087311, 0.050842501223087311, 0.050842501223087311] ) + + # Test min and max for this entire leaf region + data = self.bw.query("chr1", 11000, 11005, 1) + maxs = [ x['max'] for x in data ] + mins = [ x['min'] for x in data ] + self.assertEqual( map(float, maxs), [0.050842501223087311] ) + self.assertEqual( map(float, mins), [-2.4589500427246094] ) + + def test_wrong_nochrom(self): + data = self.bw.query("chr2", 0, 10000, 10) + self.assertEqual( data, None ) + +# Nose test generator +def test_summaries_from_file(): + bw = BigWigFile( file=open( "test_data/bbi_tests/test.bw" ) ) + def check_summary( line ): + fields = line.split() + chrom = fields[0] + start = int( fields[1] ) + end = int( fields[2] ) + n = int( fields[3] ) + t = fields[4] + values = [ float( v.replace( 'n/a', 'NaN' ) ) for v in fields[5:] ] + sd = bw.summarize( chrom, start, end, n ) + if t == 'mean': + print sd.sum_data / sd.valid_count + print values + assert allclose( sd.sum_data / sd.valid_count, values ) + elif t == 'min': + assert allclose( sd.min_val, values ) + elif t == 'max': + assert allclose( sd.max_val, values ) + #elif t == 'std': + # assert numpy.allclose( sd.max_val, values ) + for line in open( "test_data/bbi_tests/test.expectation" ): + yield check_summary, line + + +if __name__ == '__main__': + unittest.main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.c b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.c new file mode 100755 index 0000000..5e49338 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.c @@ -0,0 +1,2617 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:14 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bbi__bpt_file +#define __PYX_HAVE_API__bx__bbi__bpt_file +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "bpt_file.pyx", +}; + +/* "types.pxd":1 + * ctypedef unsigned char UBYTE # <<<<<<<<<<<<<< + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE; + +/* "types.pxd":2 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE # <<<<<<<<<<<<<< + * ctypedef unsigned short UWORD + * ctypedef short WORD + */ +typedef signed char __pyx_t_2bx_3bbi_5types_BYTE; + +/* "types.pxd":3 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD # <<<<<<<<<<<<<< + * ctypedef short WORD + * ctypedef unsigned long long bits64 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD; + +/* "types.pxd":4 + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + * ctypedef short WORD # <<<<<<<<<<<<<< + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + */ +typedef short __pyx_t_2bx_3bbi_5types_WORD; + +/* "types.pxd":5 + * ctypedef unsigned short UWORD + * ctypedef short WORD + * ctypedef unsigned long long bits64 # <<<<<<<<<<<<<< + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64; + +/* "types.pxd":6 + * ctypedef short WORD + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 # <<<<<<<<<<<<<< + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + */ +typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32; + +/* "types.pxd":7 + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 # <<<<<<<<<<<<<< + * ctypedef unsigned char bits8 + * ctypedef int signed32 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16; + +/* "types.pxd":8 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 # <<<<<<<<<<<<<< + * ctypedef int signed32 + * + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8; + +/* "types.pxd":9 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + * ctypedef int signed32 # <<<<<<<<<<<<<< + * + * ctypedef bint boolean + */ +typedef int __pyx_t_2bx_3bbi_5types_signed32; + +/* "types.pxd":11 + * ctypedef int signed32 + * + * ctypedef bint boolean # <<<<<<<<<<<<<< + * + */ +typedef int __pyx_t_2bx_3bbi_5types_boolean; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile; + +/* "bx/bbi/bpt_file.pxd":5 + * from types cimport * + * + * cdef class BPTFile: # <<<<<<<<<<<<<< + * """ + * On disk B+ tree compatible with Jim Kent's bPlusTree.c + */ +struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits32 key_size; + __pyx_t_2bx_3bbi_5types_bits32 value_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.bbi.types' */ + +/* Module declarations from 'bx.bbi.bpt_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = 0; +#define __Pyx_MODULE_NAME "bx.bbi.bpt_file" +int __pyx_module_is_main_bx__bbi__bpt_file = 0; + +/* Implementation of 'bx.bbi.bpt_file' */ +static char __pyx_k_2[] = "\000"; +static char __pyx_k_3[] = "bx.misc.binary_file"; +static char __pyx_k__key[] = "key"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__skip[] = "skip"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__attach[] = "attach"; +static char __pyx_k__r_find[] = "r_find"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__read_uint8[] = "read_uint8"; +static char __pyx_k__block_start[] = "block_start"; +static char __pyx_k__read_bits64[] = "read_bits64"; +static char __pyx_k__read_uint16[] = "read_uint16"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__read_uint64[] = "read_uint64"; +static char __pyx_k__byteswap_needed[] = "byteswap_needed"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__attach; +static PyObject *__pyx_n_s__block_start; +static PyObject *__pyx_n_s__byteswap_needed; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__key; +static PyObject *__pyx_n_s__r_find; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_bits64; +static PyObject *__pyx_n_s__read_uint16; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__read_uint64; +static PyObject *__pyx_n_s__read_uint8; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__skip; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_int_8; +static PyObject *__pyx_int_2026540177; +static PyObject *__pyx_k_tuple_1; + +/* "bx/bbi/bpt_file.pyx":13 + * """ + * + * def __init__( self, file=None ): # <<<<<<<<<<<<<< + * if file is not None: + * self.attach( file ) + */ + +static int __pyx_pf_2bx_3bbi_8bpt_file_7BPTFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_8bpt_file_7BPTFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bpt_file.pyx":14 + * + * def __init__( self, file=None ): + * if file is not None: # <<<<<<<<<<<<<< + * self.attach( file ) + * + */ + __pyx_t_1 = (__pyx_v_file != Py_None); + if (__pyx_t_1) { + + /* "bx/bbi/bpt_file.pyx":15 + * def __init__( self, file=None ): + * if file is not None: + * self.attach( file ) # <<<<<<<<<<<<<< + * + * def attach( self, file ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__attach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bpt_file.pyx":17 + * self.attach( file ) + * + * def attach( self, file ): # <<<<<<<<<<<<<< + * """ + * Attach to an open file + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_1attach(PyObject *__pyx_v_self, PyObject *__pyx_v_file); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_1attach[] = "\n Attach to an open file\n "; +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_1attach(PyObject *__pyx_v_self, PyObject *__pyx_v_file) { + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_2bx_3bbi_5types_boolean __pyx_t_4; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_5; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("attach"); + + /* "bx/bbi/bpt_file.pyx":21 + * Attach to an open file + * """ + * self.file = file # <<<<<<<<<<<<<< + * self.reader = reader = BinaryFileReader( file, bpt_sig ) + * self.is_byteswapped = self.reader.byteswap_needed + */ + __Pyx_INCREF(__pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->file); + __Pyx_DECREF(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->file); + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->file = __pyx_v_file; + + /* "bx/bbi/bpt_file.pyx":22 + * """ + * self.file = file + * self.reader = reader = BinaryFileReader( file, bpt_sig ) # <<<<<<<<<<<<<< + * self.is_byteswapped = self.reader.byteswap_needed + * # Read header stuff + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_int_2026540177); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_2026540177); + __Pyx_GIVEREF(__pyx_int_2026540177); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader); + __Pyx_DECREF(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader); + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader = __pyx_t_3; + __Pyx_INCREF(__pyx_t_3); + __pyx_v_reader = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bpt_file.pyx":23 + * self.file = file + * self.reader = reader = BinaryFileReader( file, bpt_sig ) + * self.is_byteswapped = self.reader.byteswap_needed # <<<<<<<<<<<<<< + * # Read header stuff + * self.block_size = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__byteswap_needed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->is_byteswapped = __pyx_t_4; + + /* "bx/bbi/bpt_file.pyx":25 + * self.is_byteswapped = self.reader.byteswap_needed + * # Read header stuff + * self.block_size = reader.read_uint32() # <<<<<<<<<<<<<< + * self.key_size = reader.read_uint32() + * self.value_size = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->block_size = __pyx_t_5; + + /* "bx/bbi/bpt_file.pyx":26 + * # Read header stuff + * self.block_size = reader.read_uint32() + * self.key_size = reader.read_uint32() # <<<<<<<<<<<<<< + * self.value_size = reader.read_uint32() + * self.item_count = reader.read_uint64() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size = __pyx_t_5; + + /* "bx/bbi/bpt_file.pyx":27 + * self.block_size = reader.read_uint32() + * self.key_size = reader.read_uint32() + * self.value_size = reader.read_uint32() # <<<<<<<<<<<<<< + * self.item_count = reader.read_uint64() + * reader.skip( 8 ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->value_size = __pyx_t_5; + + /* "bx/bbi/bpt_file.pyx":28 + * self.key_size = reader.read_uint32() + * self.value_size = reader.read_uint32() + * self.item_count = reader.read_uint64() # <<<<<<<<<<<<<< + * reader.skip( 8 ) + * self.root_offset = reader.tell() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->item_count = __pyx_t_6; + + /* "bx/bbi/bpt_file.pyx":29 + * self.value_size = reader.read_uint32() + * self.item_count = reader.read_uint64() + * reader.skip( 8 ) # <<<<<<<<<<<<<< + * self.root_offset = reader.tell() + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__skip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bpt_file.pyx":30 + * self.item_count = reader.read_uint64() + * reader.skip( 8 ) + * self.root_offset = reader.tell() # <<<<<<<<<<<<<< + * + * def r_find( self, bits64 block_start, key ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->root_offset = __pyx_t_6; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.attach", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bpt_file.pyx":32 + * self.root_offset = reader.tell() + * + * def r_find( self, bits64 block_start, key ): # <<<<<<<<<<<<<< + * """ + * Recursively seek the value matching key under the subtree starting + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_2r_find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_2r_find[] = "\n Recursively seek the value matching key under the subtree starting\n at file offset `block_start`\n "; +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_2r_find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits64 __pyx_v_block_start; + PyObject *__pyx_v_key = 0; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_v_is_leaf; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_v_child_count; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_v_offset; + long __pyx_v_i; + PyObject *__pyx_v_node_key = NULL; + PyObject *__pyx_v_node_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_t_4; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_5; + int __pyx_t_6; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__block_start,&__pyx_n_s__key,0}; + __Pyx_RefNannySetupContext("r_find"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__block_start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "r_find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_block_start = __Pyx_PyInt_AsUnsignedLongLong(values[0]); if (unlikely((__pyx_v_block_start == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_key = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("r_find", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.r_find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/bpt_file.pyx":40 + * cdef bits16 child_count + * cdef bits64 offset + * self.reader.seek( block_start ) # <<<<<<<<<<<<<< + * # Block header + * is_leaf = self.reader.read_uint8() + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLongLong(__pyx_v_block_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bpt_file.pyx":42 + * self.reader.seek( block_start ) + * # Block header + * is_leaf = self.reader.read_uint8() # <<<<<<<<<<<<<< + * self.reader.read_uint8() + * child_count = self.reader.read_uint16() + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read_uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedChar(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_is_leaf = __pyx_t_4; + + /* "bx/bbi/bpt_file.pyx":43 + * # Block header + * is_leaf = self.reader.read_uint8() + * self.reader.read_uint8() # <<<<<<<<<<<<<< + * child_count = self.reader.read_uint16() + * if is_leaf: + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read_uint8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bpt_file.pyx":44 + * is_leaf = self.reader.read_uint8() + * self.reader.read_uint8() + * child_count = self.reader.read_uint16() # <<<<<<<<<<<<<< + * if is_leaf: + * for i from 0 <= i < child_count: + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_child_count = __pyx_t_5; + + /* "bx/bbi/bpt_file.pyx":45 + * self.reader.read_uint8() + * child_count = self.reader.read_uint16() + * if is_leaf: # <<<<<<<<<<<<<< + * for i from 0 <= i < child_count: + * node_key = self.reader.read( self.key_size ) + */ + if (__pyx_v_is_leaf) { + + /* "bx/bbi/bpt_file.pyx":46 + * child_count = self.reader.read_uint16() + * if is_leaf: + * for i from 0 <= i < child_count: # <<<<<<<<<<<<<< + * node_key = self.reader.read( self.key_size ) + * node_value = self.reader.read( self.value_size ) + */ + __pyx_t_5 = __pyx_v_child_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "bx/bbi/bpt_file.pyx":47 + * if is_leaf: + * for i from 0 <= i < child_count: + * node_key = self.reader.read( self.key_size ) # <<<<<<<<<<<<<< + * node_value = self.reader.read( self.value_size ) + * if node_key == key: + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyLong_FromUnsignedLong(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_node_key); + __pyx_v_node_key = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/bbi/bpt_file.pyx":48 + * for i from 0 <= i < child_count: + * node_key = self.reader.read( self.key_size ) + * node_value = self.reader.read( self.value_size ) # <<<<<<<<<<<<<< + * if node_key == key: + * return node_value + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->value_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_node_value); + __pyx_v_node_value = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/bpt_file.pyx":49 + * node_key = self.reader.read( self.key_size ) + * node_value = self.reader.read( self.value_size ) + * if node_key == key: # <<<<<<<<<<<<<< + * return node_value + * return None + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_node_key, __pyx_v_key, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "bx/bbi/bpt_file.pyx":50 + * node_value = self.reader.read( self.value_size ) + * if node_key == key: + * return node_value # <<<<<<<<<<<<<< + * return None + * else: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_node_value); + __pyx_r = __pyx_v_node_value; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + } + + /* "bx/bbi/bpt_file.pyx":51 + * if node_key == key: + * return node_value + * return None # <<<<<<<<<<<<<< + * else: + * # Read and discard first key, store offset + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/bbi/bpt_file.pyx":54 + * else: + * # Read and discard first key, store offset + * self.reader.read( self.key_size ) # <<<<<<<<<<<<<< + * offset = self.reader.read_bits64() + * # Loop until correct subtree is found + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyLong_FromUnsignedLong(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/bpt_file.pyx":55 + * # Read and discard first key, store offset + * self.reader.read( self.key_size ) + * offset = self.reader.read_bits64() # <<<<<<<<<<<<<< + * # Loop until correct subtree is found + * for i from 0 <= i < child_count: + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read_bits64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_offset = __pyx_t_7; + + /* "bx/bbi/bpt_file.pyx":57 + * offset = self.reader.read_bits64() + * # Loop until correct subtree is found + * for i from 0 <= i < child_count: # <<<<<<<<<<<<<< + * node_key = self.reader.read( self.key_size ) + * if node_key > key: + */ + __pyx_t_5 = __pyx_v_child_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "bx/bbi/bpt_file.pyx":58 + * # Loop until correct subtree is found + * for i from 0 <= i < child_count: + * node_key = self.reader.read( self.key_size ) # <<<<<<<<<<<<<< + * if node_key > key: + * break + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_v_node_key); + __pyx_v_node_key = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/bbi/bpt_file.pyx":59 + * for i from 0 <= i < child_count: + * node_key = self.reader.read( self.key_size ) + * if node_key > key: # <<<<<<<<<<<<<< + * break + * offset = self.reader.read_bits64() + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_node_key, __pyx_v_key, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + + /* "bx/bbi/bpt_file.pyx":60 + * node_key = self.reader.read( self.key_size ) + * if node_key > key: + * break # <<<<<<<<<<<<<< + * offset = self.reader.read_bits64() + * return self.r_find( offset, key ) + */ + goto __pyx_L11_break; + goto __pyx_L12; + } + __pyx_L12:; + + /* "bx/bbi/bpt_file.pyx":61 + * if node_key > key: + * break + * offset = self.reader.read_bits64() # <<<<<<<<<<<<<< + * return self.r_find( offset, key ) + * + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->reader, __pyx_n_s__read_bits64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_1); if (unlikely((__pyx_t_7 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_offset = __pyx_t_7; + } + __pyx_L11_break:; + + /* "bx/bbi/bpt_file.pyx":62 + * break + * offset = self.reader.read_bits64() + * return self.r_find( offset, key ) # <<<<<<<<<<<<<< + * + * def find( self, key ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__r_find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyLong_FromUnsignedLongLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.r_find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_node_key); + __Pyx_XDECREF(__pyx_v_node_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/bpt_file.pyx":64 + * return self.r_find( offset, key ) + * + * def find( self, key ): # <<<<<<<<<<<<<< + * """ + * Find the value matching `key` (a bytestring). Returns the matching + */ + +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_3find(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static char __pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_3find[] = "\n Find the value matching `key` (a bytestring). Returns the matching\n value as a bytestring if found, or None\n "; +static PyObject *__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_3find(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("find"); + __Pyx_INCREF(__pyx_v_key); + + /* "bx/bbi/bpt_file.pyx":70 + * """ + * # Key is greater than key_size, must not be a match + * if len(key) > self.key_size: # <<<<<<<<<<<<<< + * return None + * # Key is less than key_size, right pad with 0 bytes + */ + __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 > ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size); + if (__pyx_t_2) { + + /* "bx/bbi/bpt_file.pyx":71 + * # Key is greater than key_size, must not be a match + * if len(key) > self.key_size: + * return None # <<<<<<<<<<<<<< + * # Key is less than key_size, right pad with 0 bytes + * if len(key) < self.key_size: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/bbi/bpt_file.pyx":73 + * return None + * # Key is less than key_size, right pad with 0 bytes + * if len(key) < self.key_size: # <<<<<<<<<<<<<< + * key += ( '\0' * ( self.key_size - len(key) ) ) + * # Call the recursive finder + */ + __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_1 < ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size); + if (__pyx_t_2) { + + /* "bx/bbi/bpt_file.pyx":74 + * # Key is less than key_size, right pad with 0 bytes + * if len(key) < self.key_size: + * key += ( '\0' * ( self.key_size - len(key) ) ) # <<<<<<<<<<<<<< + * # Call the recursive finder + * return self.r_find( self.root_offset, key ) + */ + __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t((((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->key_size - __pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_2), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_key, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bbi/bpt_file.pyx":76 + * key += ( '\0' * ( self.key_size - len(key) ) ) + * # Call the recursive finder + * return self.r_find( self.root_offset, key ) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__r_find); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLongLong(((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)__pyx_v_self)->root_offset); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.bbi.bpt_file.BPTFile.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_3bbi_8bpt_file_BPTFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)o); + p->file = Py_None; Py_INCREF(Py_None); + p->reader = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_8bpt_file_BPTFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *p = (struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)o; + Py_XDECREF(p->file); + Py_XDECREF(p->reader); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_8bpt_file_BPTFile(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *p = (struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)o; + if (p->file) { + e = (*v)(p->file, a); if (e) return e; + } + if (p->reader) { + e = (*v)(p->reader, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_8bpt_file_BPTFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *p = (struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *)o; + PyObject* tmp; + tmp = ((PyObject*)p->file); + p->file = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->reader); + p->reader = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_8bpt_file_BPTFile[] = { + {__Pyx_NAMESTR("attach"), (PyCFunction)__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_1attach, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_1attach)}, + {__Pyx_NAMESTR("r_find"), (PyCFunction)__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_2r_find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_2r_find)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_2bx_3bbi_8bpt_file_7BPTFile_3find, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_8bpt_file_7BPTFile_3find)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BPTFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BPTFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BPTFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BPTFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_8bpt_file_BPTFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.bpt_file.BPTFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_8bpt_file_BPTFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BPTFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_BPTFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BPTFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BPTFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n On disk B+ tree compatible with Jim Kent's bPlusTree.c\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_8bpt_file_BPTFile, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_8bpt_file_BPTFile, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_8bpt_file_BPTFile, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_8bpt_file_7BPTFile___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_8bpt_file_BPTFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bpt_file"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__attach, __pyx_k__attach, sizeof(__pyx_k__attach), 0, 0, 1, 1}, + {&__pyx_n_s__block_start, __pyx_k__block_start, sizeof(__pyx_k__block_start), 0, 0, 1, 1}, + {&__pyx_n_s__byteswap_needed, __pyx_k__byteswap_needed, sizeof(__pyx_k__byteswap_needed), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, + {&__pyx_n_s__r_find, __pyx_k__r_find, sizeof(__pyx_k__r_find), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_bits64, __pyx_k__read_bits64, sizeof(__pyx_k__read_bits64), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint16, __pyx_k__read_uint16, sizeof(__pyx_k__read_uint16), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint64, __pyx_k__read_uint64, sizeof(__pyx_k__read_uint64), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint8, __pyx_k__read_uint8, sizeof(__pyx_k__read_uint8), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__skip, __pyx_k__skip, sizeof(__pyx_k__skip), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/bbi/bpt_file.pyx":29 + * self.value_size = reader.read_uint32() + * self.item_count = reader.read_uint64() + * reader.skip( 8 ) # <<<<<<<<<<<<<< + * self.root_offset = reader.tell() + * + */ + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); + __Pyx_INCREF(__pyx_int_8); + PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, __pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2026540177 = PyInt_FromLong(2026540177); if (unlikely(!__pyx_int_2026540177)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbpt_file(void); /*proto*/ +PyMODINIT_FUNC initbpt_file(void) +#else +PyMODINIT_FUNC PyInit_bpt_file(void); /*proto*/ +PyMODINIT_FUNC PyInit_bpt_file(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bpt_file(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bpt_file"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bbi__bpt_file) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_3bbi_8bpt_file_BPTFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BPTFile", (PyObject *)&__pyx_type_2bx_3bbi_8bpt_file_BPTFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = &__pyx_type_2bx_3bbi_8bpt_file_BPTFile; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bbi/bpt_file.pyx":1 + * from bx.misc.binary_file import BinaryFileReader # <<<<<<<<<<<<<< + * + * DEF bpt_sig = 0x78CA8C91 + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_3), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/bpt_file.pyx":64 + * return self.r_find( offset, key ) + * + * def find( self, key ): # <<<<<<<<<<<<<< + * """ + * Find the value matching `key` (a bytestring). Returns the matching + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bbi.bpt_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bbi.bpt_file"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.pyx new file mode 100755 index 0000000..0008dde --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/bpt_file.pyx @@ -0,0 +1,76 @@ +from bx.misc.binary_file import BinaryFileReader + +DEF bpt_sig = 0x78CA8C91 + +# bptFileHeaderSize = 32 +# bptBlockHeaderSize = 4 + +cdef class BPTFile: + """ + On disk B+ tree compatible with Jim Kent's bPlusTree.c + """ + + def __init__( self, file=None ): + if file is not None: + self.attach( file ) + + def attach( self, file ): + """ + Attach to an open file + """ + self.file = file + self.reader = reader = BinaryFileReader( file, bpt_sig ) + self.is_byteswapped = self.reader.byteswap_needed + # Read header stuff + self.block_size = reader.read_uint32() + self.key_size = reader.read_uint32() + self.value_size = reader.read_uint32() + self.item_count = reader.read_uint64() + reader.skip( 8 ) + self.root_offset = reader.tell() + + def r_find( self, bits64 block_start, key ): + """ + Recursively seek the value matching key under the subtree starting + at file offset `block_start` + """ + cdef UBYTE is_leaf + cdef bits16 child_count + cdef bits64 offset + self.reader.seek( block_start ) + # Block header + is_leaf = self.reader.read_uint8() + self.reader.read_uint8() + child_count = self.reader.read_uint16() + if is_leaf: + for i from 0 <= i < child_count: + node_key = self.reader.read( self.key_size ) + node_value = self.reader.read( self.value_size ) + if node_key == key: + return node_value + return None + else: + # Read and discard first key, store offset + self.reader.read( self.key_size ) + offset = self.reader.read_bits64() + # Loop until correct subtree is found + for i from 0 <= i < child_count: + node_key = self.reader.read( self.key_size ) + if node_key > key: + break + offset = self.reader.read_bits64() + return self.r_find( offset, key ) + + def find( self, key ): + """ + Find the value matching `key` (a bytestring). Returns the matching + value as a bytestring if found, or None + """ + # Key is greater than key_size, must not be a match + if len(key) > self.key_size: + return None + # Key is less than key_size, right pad with 0 bytes + if len(key) < self.key_size: + key += ( '\0' * ( self.key_size - len(key) ) ) + # Call the recursive finder + return self.r_find( self.root_offset, key ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.c b/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.c new file mode 100755 index 0000000..40f2b20 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.c @@ -0,0 +1,3644 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:14 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bbi__cirtree_file +#define __PYX_HAVE_API__bx__bbi__cirtree_file +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "cirtree_file.pyx", +}; + +/* "types.pxd":1 + * ctypedef unsigned char UBYTE # <<<<<<<<<<<<<< + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE; + +/* "types.pxd":2 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE # <<<<<<<<<<<<<< + * ctypedef unsigned short UWORD + * ctypedef short WORD + */ +typedef signed char __pyx_t_2bx_3bbi_5types_BYTE; + +/* "types.pxd":3 + * ctypedef unsigned char UBYTE + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD # <<<<<<<<<<<<<< + * ctypedef short WORD + * ctypedef unsigned long long bits64 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD; + +/* "types.pxd":4 + * ctypedef signed char BYTE + * ctypedef unsigned short UWORD + * ctypedef short WORD # <<<<<<<<<<<<<< + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + */ +typedef short __pyx_t_2bx_3bbi_5types_WORD; + +/* "types.pxd":5 + * ctypedef unsigned short UWORD + * ctypedef short WORD + * ctypedef unsigned long long bits64 # <<<<<<<<<<<<<< + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64; + +/* "types.pxd":6 + * ctypedef short WORD + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 # <<<<<<<<<<<<<< + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + */ +typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32; + +/* "types.pxd":7 + * ctypedef unsigned long long bits64 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 # <<<<<<<<<<<<<< + * ctypedef unsigned char bits8 + * ctypedef int signed32 + */ +typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16; + +/* "types.pxd":8 + * ctypedef unsigned bits32 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 # <<<<<<<<<<<<<< + * ctypedef int signed32 + * + */ +typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8; + +/* "types.pxd":9 + * ctypedef unsigned short bits16 + * ctypedef unsigned char bits8 + * ctypedef int signed32 # <<<<<<<<<<<<<< + * + * ctypedef bint boolean + */ +typedef int __pyx_t_2bx_3bbi_5types_signed32; + +/* "types.pxd":11 + * ctypedef int signed32 + * + * ctypedef bint boolean # <<<<<<<<<<<<<< + * + */ +typedef int __pyx_t_2bx_3bbi_5types_boolean; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile; + +/* "bx/bbi/cirtree_file.pxd":3 + * from types cimport * + * + * cdef class CIRTreeFile: # <<<<<<<<<<<<<< + * cdef object file + * cdef object reader + */ +struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile { + PyObject_HEAD + PyObject *file; + PyObject *reader; + __pyx_t_2bx_3bbi_5types_boolean is_byteswapped; + __pyx_t_2bx_3bbi_5types_bits64 root_offset; + __pyx_t_2bx_3bbi_5types_bits32 block_size; + __pyx_t_2bx_3bbi_5types_bits64 item_count; + __pyx_t_2bx_3bbi_5types_bits32 start_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 start_base; + __pyx_t_2bx_3bbi_5types_bits32 end_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 end_base; + __pyx_t_2bx_3bbi_5types_bits64 file_size; + __pyx_t_2bx_3bbi_5types_bits32 items_per_slot; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.bbi.types' */ + +/* Module declarations from 'bx.bbi.cirtree_file' */ +static PyTypeObject *__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = 0; +static int __pyx_f_2bx_3bbi_12cirtree_file_ovcmp(__pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32); /*proto*/ +static PyObject *__pyx_f_2bx_3bbi_12cirtree_file_overlaps(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "bx.bbi.cirtree_file" +int __pyx_module_is_main_bx__bbi__cirtree_file = 0; + +/* Implementation of 'bx.bbi.cirtree_file' */ +static char __pyx_k_1[] = "r_find_overlapping_leaf"; +static char __pyx_k_2[] = "r_find_overlapping_parent"; +static char __pyx_k_3[] = "bx.misc.binary_file"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__rval[] = "rval"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__level[] = "level"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__attach[] = "attach"; +static char __pyx_k__reader[] = "reader"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__chrom_ix[] = "chrom_ix"; +static char __pyx_k__read_uint8[] = "read_uint8"; +static char __pyx_k__child_count[] = "child_count"; +static char __pyx_k__read_uint16[] = "read_uint16"; +static char __pyx_k__read_uint32[] = "read_uint32"; +static char __pyx_k__read_uint64[] = "read_uint64"; +static char __pyx_k__byteswap_needed[] = "byteswap_needed"; +static char __pyx_k__BinaryFileReader[] = "BinaryFileReader"; +static char __pyx_k__index_file_offset[] = "index_file_offset"; +static char __pyx_k__r_find_overlapping[] = "r_find_overlapping"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s__BinaryFileReader; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__attach; +static PyObject *__pyx_n_s__byteswap_needed; +static PyObject *__pyx_n_s__child_count; +static PyObject *__pyx_n_s__chrom_ix; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__index_file_offset; +static PyObject *__pyx_n_s__level; +static PyObject *__pyx_n_s__r_find_overlapping; +static PyObject *__pyx_n_s__read_uint16; +static PyObject *__pyx_n_s__read_uint32; +static PyObject *__pyx_n_s__read_uint64; +static PyObject *__pyx_n_s__read_uint8; +static PyObject *__pyx_n_s__reader; +static PyObject *__pyx_n_s__rval; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_610839776; + +/* "bx/bbi/cirtree_file.pyx":5 + * DEF cir_tree_sig = 0x2468ACE0 + * + * cdef int ovcmp( bits32 a_hi, bits32 a_lo, bits32 b_hi, bits32 b_lo ): # <<<<<<<<<<<<<< + * if a_hi < b_hi: + * return 1 + */ + +static int __pyx_f_2bx_3bbi_12cirtree_file_ovcmp(__pyx_t_2bx_3bbi_5types_bits32 __pyx_v_a_hi, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_a_lo, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_hi, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_b_lo) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("ovcmp"); + + /* "bx/bbi/cirtree_file.pyx":6 + * + * cdef int ovcmp( bits32 a_hi, bits32 a_lo, bits32 b_hi, bits32 b_lo ): + * if a_hi < b_hi: # <<<<<<<<<<<<<< + * return 1 + * elif a_hi > b_hi: + */ + __pyx_t_1 = (__pyx_v_a_hi < __pyx_v_b_hi); + if (__pyx_t_1) { + + /* "bx/bbi/cirtree_file.pyx":7 + * cdef int ovcmp( bits32 a_hi, bits32 a_lo, bits32 b_hi, bits32 b_lo ): + * if a_hi < b_hi: + * return 1 # <<<<<<<<<<<<<< + * elif a_hi > b_hi: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "bx/bbi/cirtree_file.pyx":8 + * if a_hi < b_hi: + * return 1 + * elif a_hi > b_hi: # <<<<<<<<<<<<<< + * return -1 + * else: + */ + __pyx_t_1 = (__pyx_v_a_hi > __pyx_v_b_hi); + if (__pyx_t_1) { + + /* "bx/bbi/cirtree_file.pyx":9 + * return 1 + * elif a_hi > b_hi: + * return -1 # <<<<<<<<<<<<<< + * else: + * if a_lo < b_lo: + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "bx/bbi/cirtree_file.pyx":11 + * return -1 + * else: + * if a_lo < b_lo: # <<<<<<<<<<<<<< + * return 1 + * elif a_lo > b_lo: + */ + __pyx_t_1 = (__pyx_v_a_lo < __pyx_v_b_lo); + if (__pyx_t_1) { + + /* "bx/bbi/cirtree_file.pyx":12 + * else: + * if a_lo < b_lo: + * return 1 # <<<<<<<<<<<<<< + * elif a_lo > b_lo: + * return -1 + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L4; + } + + /* "bx/bbi/cirtree_file.pyx":13 + * if a_lo < b_lo: + * return 1 + * elif a_lo > b_lo: # <<<<<<<<<<<<<< + * return -1 + * else: + */ + __pyx_t_1 = (__pyx_v_a_lo > __pyx_v_b_lo); + if (__pyx_t_1) { + + /* "bx/bbi/cirtree_file.pyx":14 + * return 1 + * elif a_lo > b_lo: + * return -1 # <<<<<<<<<<<<<< + * else: + * return 0 + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L4; + } + /*else*/ { + + /* "bx/bbi/cirtree_file.pyx":16 + * return -1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * cdef overlaps( qchrom, qstart, qend, rstartchrom, rstartbase, rendchrom, rendbase ): + */ + __pyx_r = 0; + goto __pyx_L0; + } + __pyx_L4:; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":18 + * return 0 + * + * cdef overlaps( qchrom, qstart, qend, rstartchrom, rstartbase, rendchrom, rendbase ): # <<<<<<<<<<<<<< + * return ( ovcmp( qchrom, qstart, rendchrom, rendbase ) > 0 ) and \ + * ( ovcmp( qchrom, qend, rstartchrom, rstartbase ) < 0 ) + */ + +static PyObject *__pyx_f_2bx_3bbi_12cirtree_file_overlaps(PyObject *__pyx_v_qchrom, PyObject *__pyx_v_qstart, PyObject *__pyx_v_qend, PyObject *__pyx_v_rstartchrom, PyObject *__pyx_v_rstartbase, PyObject *__pyx_v_rendchrom, PyObject *__pyx_v_rendbase) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_1; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_2; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_3; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("overlaps"); + + /* "bx/bbi/cirtree_file.pyx":19 + * + * cdef overlaps( qchrom, qstart, qend, rstartchrom, rstartbase, rendchrom, rendbase ): + * return ( ovcmp( qchrom, qstart, rendchrom, rendbase ) > 0 ) and \ # <<<<<<<<<<<<<< + * ( ovcmp( qchrom, qend, rstartchrom, rstartbase ) < 0 ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_qchrom); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_qstart); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_rendchrom); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_rendbase); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_f_2bx_3bbi_12cirtree_file_ovcmp(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4) > 0); + if (__pyx_t_5) { + + /* "bx/bbi/cirtree_file.pyx":20 + * cdef overlaps( qchrom, qstart, qend, rstartchrom, rstartbase, rendchrom, rendbase ): + * return ( ovcmp( qchrom, qstart, rendchrom, rendbase ) > 0 ) and \ + * ( ovcmp( qchrom, qend, rstartchrom, rstartbase ) < 0 ) # <<<<<<<<<<<<<< + * + * cdef class CIRTreeFile: + */ + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_qchrom); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_qend); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_rstartchrom); if (unlikely((__pyx_t_2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_rstartbase); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (__pyx_f_2bx_3bbi_12cirtree_file_ovcmp(__pyx_t_4, __pyx_t_3, __pyx_t_2, __pyx_t_1) < 0); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("bx.bbi.cirtree_file.overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":24 + * cdef class CIRTreeFile: + * + * def __init__( self, file=None ): # <<<<<<<<<<<<<< + * if file is not None: + * self.attach( file ) + */ + +static int __pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_file = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/cirtree_file.pyx":25 + * + * def __init__( self, file=None ): + * if file is not None: # <<<<<<<<<<<<<< + * self.attach( file ) + * + */ + __pyx_t_1 = (__pyx_v_file != Py_None); + if (__pyx_t_1) { + + /* "bx/bbi/cirtree_file.pyx":26 + * def __init__( self, file=None ): + * if file is not None: + * self.attach( file ) # <<<<<<<<<<<<<< + * + * def attach( self, file ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__attach); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":28 + * self.attach( file ) + * + * def attach( self, file ): # <<<<<<<<<<<<<< + * """ + * Attach to an open file + */ + +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_1attach(PyObject *__pyx_v_self, PyObject *__pyx_v_file); /*proto*/ +static char __pyx_doc_2bx_3bbi_12cirtree_file_11CIRTreeFile_1attach[] = "\n Attach to an open file\n "; +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_1attach(PyObject *__pyx_v_self, PyObject *__pyx_v_file) { + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_2bx_3bbi_5types_boolean __pyx_t_4; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_5; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("attach"); + + /* "bx/bbi/cirtree_file.pyx":32 + * Attach to an open file + * """ + * self.file = file # <<<<<<<<<<<<<< + * self.reader = reader = BinaryFileReader( file, cir_tree_sig ) + * self.is_byteswapped = self.reader.byteswap_needed + */ + __Pyx_INCREF(__pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->file); + __Pyx_DECREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->file); + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->file = __pyx_v_file; + + /* "bx/bbi/cirtree_file.pyx":33 + * """ + * self.file = file + * self.reader = reader = BinaryFileReader( file, cir_tree_sig ) # <<<<<<<<<<<<<< + * self.is_byteswapped = self.reader.byteswap_needed + * # Header + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_file); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file); + __Pyx_GIVEREF(__pyx_v_file); + __Pyx_INCREF(__pyx_int_610839776); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_610839776); + __Pyx_GIVEREF(__pyx_int_610839776); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader); + __Pyx_DECREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader); + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader = __pyx_t_3; + __Pyx_INCREF(__pyx_t_3); + __pyx_v_reader = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/cirtree_file.pyx":34 + * self.file = file + * self.reader = reader = BinaryFileReader( file, cir_tree_sig ) + * self.is_byteswapped = self.reader.byteswap_needed # <<<<<<<<<<<<<< + * # Header + * self.block_size = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader, __pyx_n_s__byteswap_needed); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->is_byteswapped = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":36 + * self.is_byteswapped = self.reader.byteswap_needed + * # Header + * self.block_size = reader.read_uint32() # <<<<<<<<<<<<<< + * self.item_count = reader.read_uint64() + * self.start_chrom_ix = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->block_size = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":37 + * # Header + * self.block_size = reader.read_uint32() + * self.item_count = reader.read_uint64() # <<<<<<<<<<<<<< + * self.start_chrom_ix = reader.read_uint32() + * self.start_base = reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->item_count = __pyx_t_6; + + /* "bx/bbi/cirtree_file.pyx":38 + * self.block_size = reader.read_uint32() + * self.item_count = reader.read_uint64() + * self.start_chrom_ix = reader.read_uint32() # <<<<<<<<<<<<<< + * self.start_base = reader.read_uint32() + * self.end_chrom_ix = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->start_chrom_ix = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":39 + * self.item_count = reader.read_uint64() + * self.start_chrom_ix = reader.read_uint32() + * self.start_base = reader.read_uint32() # <<<<<<<<<<<<<< + * self.end_chrom_ix = reader.read_uint32() + * self.end_base = reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->start_base = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":40 + * self.start_chrom_ix = reader.read_uint32() + * self.start_base = reader.read_uint32() + * self.end_chrom_ix = reader.read_uint32() # <<<<<<<<<<<<<< + * self.end_base = reader.read_uint32() + * self.file_size = reader.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->end_chrom_ix = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":41 + * self.start_base = reader.read_uint32() + * self.end_chrom_ix = reader.read_uint32() + * self.end_base = reader.read_uint32() # <<<<<<<<<<<<<< + * self.file_size = reader.read_uint64() + * self.items_per_slot = reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->end_base = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":42 + * self.end_chrom_ix = reader.read_uint32() + * self.end_base = reader.read_uint32() + * self.file_size = reader.read_uint64() # <<<<<<<<<<<<<< + * self.items_per_slot = reader.read_uint32() + * # Skip reserved + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->file_size = __pyx_t_6; + + /* "bx/bbi/cirtree_file.pyx":43 + * self.end_base = reader.read_uint32() + * self.file_size = reader.read_uint64() + * self.items_per_slot = reader.read_uint32() # <<<<<<<<<<<<<< + * # Skip reserved + * reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->items_per_slot = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":45 + * self.items_per_slot = reader.read_uint32() + * # Skip reserved + * reader.read_uint32() # <<<<<<<<<<<<<< + * # Save root + * self.root_offset = reader.tell() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/cirtree_file.pyx":47 + * reader.read_uint32() + * # Save root + * self.root_offset = reader.tell() # <<<<<<<<<<<<<< + * + * def r_find_overlapping( self, int level, bits64 index_file_offset, bits32 chrom_ix, bits32 start, bits32 end, object rval, object reader ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->root_offset = __pyx_t_6; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.attach", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":49 + * self.root_offset = reader.tell() + * + * def r_find_overlapping( self, int level, bits64 index_file_offset, bits32 chrom_ix, bits32 start, bits32 end, object rval, object reader ): # <<<<<<<<<<<<<< + * cdef UBYTE is_leaf + * cdef bits16 child_count + */ + +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_2r_find_overlapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_2r_find_overlapping(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_v_index_file_offset; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_v_rval = 0; + PyObject *__pyx_v_reader = 0; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_v_is_leaf; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_v_child_count; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_2bx_3bbi_5types_UBYTE __pyx_t_4; + int __pyx_t_5; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__index_file_offset,&__pyx_n_s__chrom_ix,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__rval,&__pyx_n_s__reader,0}; + __Pyx_RefNannySetupContext("r_find_overlapping"); + { + PyObject* values[7] = {0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index_file_offset); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_ix); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rval); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reader); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "r_find_overlapping") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_index_file_offset = __Pyx_PyInt_AsUnsignedLongLong(values[1]); if (unlikely((__pyx_v_index_file_offset == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_chrom_ix = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_chrom_ix == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[3]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[4]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_rval = values[5]; + __pyx_v_reader = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("r_find_overlapping", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/cirtree_file.pyx":52 + * cdef UBYTE is_leaf + * cdef bits16 child_count + * reader.seek( index_file_offset ) # <<<<<<<<<<<<<< + * # Block header + * is_leaf = reader.read_uint8() + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLongLong(__pyx_v_index_file_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/cirtree_file.pyx":54 + * reader.seek( index_file_offset ) + * # Block header + * is_leaf = reader.read_uint8() # <<<<<<<<<<<<<< + * assert is_leaf == 0 or is_leaf == 1 + * reader.read_uint8() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedChar(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_is_leaf = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":55 + * # Block header + * is_leaf = reader.read_uint8() + * assert is_leaf == 0 or is_leaf == 1 # <<<<<<<<<<<<<< + * reader.read_uint8() + * child_count = reader.read_uint16() + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + switch (__pyx_v_is_leaf) { + case 0: + case 1: + __pyx_t_5 = 1; + break; + default: + __pyx_t_5 = 0; + break; + } + if (unlikely(!__pyx_t_5)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/bbi/cirtree_file.pyx":56 + * is_leaf = reader.read_uint8() + * assert is_leaf == 0 or is_leaf == 1 + * reader.read_uint8() # <<<<<<<<<<<<<< + * child_count = reader.read_uint16() + * # Read block + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/cirtree_file.pyx":57 + * assert is_leaf == 0 or is_leaf == 1 + * reader.read_uint8() + * child_count = reader.read_uint16() # <<<<<<<<<<<<<< + * # Read block + * if is_leaf: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_AsUnsignedShort(__pyx_t_3); if (unlikely((__pyx_t_6 == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_child_count = __pyx_t_6; + + /* "bx/bbi/cirtree_file.pyx":59 + * child_count = reader.read_uint16() + * # Read block + * if is_leaf: # <<<<<<<<<<<<<< + * self.r_find_overlapping_leaf( level, chrom_ix, start, end, rval, child_count, reader ) + * else: + */ + if (__pyx_v_is_leaf) { + + /* "bx/bbi/cirtree_file.pyx":60 + * # Read block + * if is_leaf: + * self.r_find_overlapping_leaf( level, chrom_ix, start, end, rval, child_count, reader ) # <<<<<<<<<<<<<< + * else: + * self.r_find_overlapping_parent( level, chrom_ix, start, end, rval, child_count, reader ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyInt_FromLong(__pyx_v_child_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_rval); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_v_rval); + __Pyx_GIVEREF(__pyx_v_rval); + PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_reader); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_v_reader); + __Pyx_GIVEREF(__pyx_v_reader); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/bbi/cirtree_file.pyx":62 + * self.r_find_overlapping_leaf( level, chrom_ix, start, end, rval, child_count, reader ) + * else: + * self.r_find_overlapping_parent( level, chrom_ix, start, end, rval, child_count, reader ) # <<<<<<<<<<<<<< + * + * def r_find_overlapping_leaf( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyInt_FromLong(__pyx_v_level); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyInt_FromLong(__pyx_v_child_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_rval); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_rval); + __Pyx_GIVEREF(__pyx_v_rval); + PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_reader); + PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_reader); + __Pyx_GIVEREF(__pyx_v_reader); + __pyx_t_10 = 0; + __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":64 + * self.r_find_overlapping_parent( level, chrom_ix, start, end, rval, child_count, reader ) + * + * def r_find_overlapping_leaf( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, # <<<<<<<<<<<<<< + * bits16 child_count, object reader ): + * cdef bits32 start_chrom_ix, start_base, end_chrom_ix, end_base + */ + +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_3r_find_overlapping_leaf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_3r_find_overlapping_leaf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_v_rval = 0; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_v_child_count; + PyObject *__pyx_v_reader = 0; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start_base; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end_base; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_v_offset; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_v_size; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_4; + __pyx_t_2bx_3bbi_5types_bits64 __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__chrom_ix,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__rval,&__pyx_n_s__child_count,&__pyx_n_s__reader,0}; + __Pyx_RefNannySetupContext("r_find_overlapping_leaf"); + { + PyObject* values[7] = {0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_ix); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rval); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_count); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reader); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "r_find_overlapping_leaf") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_chrom_ix = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_chrom_ix == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[3]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_rval = values[4]; + __pyx_v_child_count = __Pyx_PyInt_AsUnsignedShort(values[5]); if (unlikely((__pyx_v_child_count == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reader = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_leaf", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/cirtree_file.pyx":69 + * cdef bits64 offset + * cdef bits64 size + * for i from 0 <= i < child_count: # <<<<<<<<<<<<<< + * start_chrom_ix = reader.read_uint32() + * start_base = reader.read_uint32() + */ + __pyx_t_1 = __pyx_v_child_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/bbi/cirtree_file.pyx":70 + * cdef bits64 size + * for i from 0 <= i < child_count: + * start_chrom_ix = reader.read_uint32() # <<<<<<<<<<<<<< + * start_base = reader.read_uint32() + * end_chrom_ix = reader.read_uint32() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_start_chrom_ix = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":71 + * for i from 0 <= i < child_count: + * start_chrom_ix = reader.read_uint32() + * start_base = reader.read_uint32() # <<<<<<<<<<<<<< + * end_chrom_ix = reader.read_uint32() + * end_base = reader.read_uint32() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_start_base = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":72 + * start_chrom_ix = reader.read_uint32() + * start_base = reader.read_uint32() + * end_chrom_ix = reader.read_uint32() # <<<<<<<<<<<<<< + * end_base = reader.read_uint32() + * offset = reader.read_uint64() + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_end_chrom_ix = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":73 + * start_base = reader.read_uint32() + * end_chrom_ix = reader.read_uint32() + * end_base = reader.read_uint32() # <<<<<<<<<<<<<< + * offset = reader.read_uint64() + * size = reader.read_uint64() + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_end_base = __pyx_t_4; + + /* "bx/bbi/cirtree_file.pyx":74 + * end_chrom_ix = reader.read_uint32() + * end_base = reader.read_uint32() + * offset = reader.read_uint64() # <<<<<<<<<<<<<< + * size = reader.read_uint64() + * if overlaps( chrom_ix, start, end, start_chrom_ix, start_base, end_chrom_ix, end_base ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_offset = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":75 + * end_base = reader.read_uint32() + * offset = reader.read_uint64() + * size = reader.read_uint64() # <<<<<<<<<<<<<< + * if overlaps( chrom_ix, start, end, start_chrom_ix, start_base, end_chrom_ix, end_base ): + * rval.append( ( offset, size ) ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_size = __pyx_t_5; + + /* "bx/bbi/cirtree_file.pyx":76 + * offset = reader.read_uint64() + * size = reader.read_uint64() + * if overlaps( chrom_ix, start, end, start_chrom_ix, start_base, end_chrom_ix, end_base ): # <<<<<<<<<<<<<< + * rval.append( ( offset, size ) ) + * + */ + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_start_chrom_ix); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_start_base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyLong_FromUnsignedLong(__pyx_v_end_chrom_ix); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyLong_FromUnsignedLong(__pyx_v_end_base); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __pyx_f_2bx_3bbi_12cirtree_file_overlaps(__pyx_t_2, __pyx_t_3, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_12) { + + /* "bx/bbi/cirtree_file.pyx":77 + * size = reader.read_uint64() + * if overlaps( chrom_ix, start, end, start_chrom_ix, start_base, end_chrom_ix, end_base ): + * rval.append( ( offset, size ) ) # <<<<<<<<<<<<<< + * + * def r_find_overlapping_parent( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, + */ + __pyx_t_11 = PyLong_FromUnsignedLongLong(__pyx_v_offset); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyLong_FromUnsignedLongLong(__pyx_v_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_11 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_rval, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L8; + } + __pyx_L8:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":79 + * rval.append( ( offset, size ) ) + * + * def r_find_overlapping_parent( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, # <<<<<<<<<<<<<< + * bits16 child_count, object reader ): + * # Read and cache offsets for all children to avoid excessive seeking + */ + +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_4r_find_overlapping_parent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_4r_find_overlapping_parent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_level; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_v_rval = 0; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_v_child_count; + PyObject *__pyx_v_reader = 0; + PyObject *__pyx_v_start_chrom_ix = NULL; + PyObject *__pyx_v_start_base = NULL; + PyObject *__pyx_v_end_chrom_ix = NULL; + PyObject *__pyx_v_end_base = NULL; + PyObject *__pyx_v_offset = NULL; + long __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_2bx_3bbi_5types_bits16 __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__level,&__pyx_n_s__chrom_ix,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__rval,&__pyx_n_s__child_count,&__pyx_n_s__reader,0}; + __Pyx_RefNannySetupContext("r_find_overlapping_parent"); + { + PyObject* values[7] = {0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__level); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_ix); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rval); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__child_count); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reader); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "r_find_overlapping_parent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + } + __pyx_v_level = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_chrom_ix = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_chrom_ix == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[3]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_rval = values[4]; + __pyx_v_child_count = __Pyx_PyInt_AsUnsignedShort(values[5]); if (unlikely((__pyx_v_child_count == (unsigned short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reader = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("r_find_overlapping_parent", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/cirtree_file.pyx":84 + * ## cdef bits32 start_chrom_ix[child_count], start_base[child_count], end_chrom_ix[child_count], end_base[child_count] + * ## cdef bits64 offset[child_count] + * start_chrom_ix = []; start_base = []; end_chrom_ix = []; end_base = [] # <<<<<<<<<<<<<< + * offset = [] + * for i from 0 <= i < child_count: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_start_chrom_ix = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_start_base = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_end_chrom_ix = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_end_base = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/cirtree_file.pyx":85 + * ## cdef bits64 offset[child_count] + * start_chrom_ix = []; start_base = []; end_chrom_ix = []; end_base = [] + * offset = [] # <<<<<<<<<<<<<< + * for i from 0 <= i < child_count: + * ## start_chrom_ix[i] = reader.read_bits32() + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_offset = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/cirtree_file.pyx":86 + * start_chrom_ix = []; start_base = []; end_chrom_ix = []; end_base = [] + * offset = [] + * for i from 0 <= i < child_count: # <<<<<<<<<<<<<< + * ## start_chrom_ix[i] = reader.read_bits32() + * ## start_base[i] = reader.read_bits32() + */ + __pyx_t_2 = __pyx_v_child_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "bx/bbi/cirtree_file.pyx":92 + * ## end_base[i] = reader.read_bits32() + * ## offset[i] = reader.read_bits64() + * start_chrom_ix.append( reader.read_uint32() ) # <<<<<<<<<<<<<< + * start_base.append( reader.read_uint32() ) + * end_chrom_ix.append( reader.read_uint32() ) + */ + if (unlikely(((PyObject *)__pyx_v_start_chrom_ix) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_start_chrom_ix, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/cirtree_file.pyx":93 + * ## offset[i] = reader.read_bits64() + * start_chrom_ix.append( reader.read_uint32() ) + * start_base.append( reader.read_uint32() ) # <<<<<<<<<<<<<< + * end_chrom_ix.append( reader.read_uint32() ) + * end_base.append( reader.read_uint32() ) + */ + if (unlikely(((PyObject *)__pyx_v_start_base) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_start_base, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/cirtree_file.pyx":94 + * start_chrom_ix.append( reader.read_uint32() ) + * start_base.append( reader.read_uint32() ) + * end_chrom_ix.append( reader.read_uint32() ) # <<<<<<<<<<<<<< + * end_base.append( reader.read_uint32() ) + * offset.append( reader.read_uint64() ) + */ + if (unlikely(((PyObject *)__pyx_v_end_chrom_ix) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_end_chrom_ix, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bbi/cirtree_file.pyx":95 + * start_base.append( reader.read_uint32() ) + * end_chrom_ix.append( reader.read_uint32() ) + * end_base.append( reader.read_uint32() ) # <<<<<<<<<<<<<< + * offset.append( reader.read_uint64() ) + * # Now recurse + */ + if (unlikely(((PyObject *)__pyx_v_end_base) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_end_base, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bbi/cirtree_file.pyx":96 + * end_chrom_ix.append( reader.read_uint32() ) + * end_base.append( reader.read_uint32() ) + * offset.append( reader.read_uint64() ) # <<<<<<<<<<<<<< + * # Now recurse + * for i from 0 <= i < child_count: + */ + if (unlikely(((PyObject *)__pyx_v_offset) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(__pyx_v_reader, __pyx_n_s__read_uint64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_offset, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "bx/bbi/cirtree_file.pyx":98 + * offset.append( reader.read_uint64() ) + * # Now recurse + * for i from 0 <= i < child_count: # <<<<<<<<<<<<<< + * if overlaps( chrom_ix, start, end, start_chrom_ix[i], start_base[i], end_chrom_ix[i], end_base[i] ): + * self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) + */ + __pyx_t_2 = __pyx_v_child_count; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + + /* "bx/bbi/cirtree_file.pyx":99 + * # Now recurse + * for i from 0 <= i < child_count: + * if overlaps( chrom_ix, start, end, start_chrom_ix[i], start_base[i], end_chrom_ix[i], end_base[i] ): # <<<<<<<<<<<<<< + * self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) + * + */ + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_start_chrom_ix), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_start_base), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_end_chrom_ix), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_end_base), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __pyx_f_2bx_3bbi_12cirtree_file_overlaps(__pyx_t_3, __pyx_t_1, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_11) { + + /* "bx/bbi/cirtree_file.pyx":100 + * for i from 0 <= i < child_count: + * if overlaps( chrom_ix, start, end, start_chrom_ix[i], start_base[i], end_chrom_ix[i], end_base[i] ): + * self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) # <<<<<<<<<<<<<< + * + * def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__r_find_overlapping); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyInt_FromLong((__pyx_v_level + 1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_offset), __pyx_v_i, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_rval); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_v_rval); + __Pyx_GIVEREF(__pyx_v_rval); + __Pyx_INCREF(__pyx_v_reader); + PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_v_reader); + __Pyx_GIVEREF(__pyx_v_reader); + __pyx_t_9 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_6 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.r_find_overlapping_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_start_chrom_ix); + __Pyx_XDECREF(__pyx_v_start_base); + __Pyx_XDECREF(__pyx_v_end_chrom_ix); + __Pyx_XDECREF(__pyx_v_end_base); + __Pyx_XDECREF(__pyx_v_offset); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bbi/cirtree_file.pyx":102 + * self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) + * + * def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * rval = [] + * self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) + */ + +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_5find_overlapping_blocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_5find_overlapping_blocks(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_ix; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start; + __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_ix,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("find_overlapping_blocks"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_ix); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_overlapping_blocks", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find_overlapping_blocks", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find_overlapping_blocks") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_chrom_ix = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_ix == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find_overlapping_blocks", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.find_overlapping_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bbi/cirtree_file.pyx":103 + * + * def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): + * rval = [] # <<<<<<<<<<<<<< + * self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) + * return rval + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/bbi/cirtree_file.pyx":104 + * def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): + * rval = [] + * self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) # <<<<<<<<<<<<<< + * return rval + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__r_find_overlapping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLongLong(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->root_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_chrom_ix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + PyTuple_SET_ITEM(__pyx_t_6, 5, ((PyObject *)__pyx_v_rval)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_rval)); + __Pyx_INCREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader); + PyTuple_SET_ITEM(__pyx_t_6, 6, ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)__pyx_v_self)->reader); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/bbi/cirtree_file.pyx":105 + * rval = [] + * self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) + * return rval # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_rval)); + __pyx_r = ((PyObject *)__pyx_v_rval); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.bbi.cirtree_file.CIRTreeFile.find_overlapping_blocks", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_3bbi_12cirtree_file_CIRTreeFile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)o); + p->file = Py_None; Py_INCREF(Py_None); + p->reader = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_3bbi_12cirtree_file_CIRTreeFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *p = (struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)o; + Py_XDECREF(p->file); + Py_XDECREF(p->reader); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_3bbi_12cirtree_file_CIRTreeFile(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *p = (struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)o; + if (p->file) { + e = (*v)(p->file, a); if (e) return e; + } + if (p->reader) { + e = (*v)(p->reader, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_3bbi_12cirtree_file_CIRTreeFile(PyObject *o) { + struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *p = (struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile *)o; + PyObject* tmp; + tmp = ((PyObject*)p->file); + p->file = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->reader); + p->reader = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_3bbi_12cirtree_file_CIRTreeFile[] = { + {__Pyx_NAMESTR("attach"), (PyCFunction)__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_1attach, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_3bbi_12cirtree_file_11CIRTreeFile_1attach)}, + {__Pyx_NAMESTR("r_find_overlapping"), (PyCFunction)__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_2r_find_overlapping, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("r_find_overlapping_leaf"), (PyCFunction)__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_3r_find_overlapping_leaf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("r_find_overlapping_parent"), (PyCFunction)__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_4r_find_overlapping_parent, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("find_overlapping_blocks"), (PyCFunction)__pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile_5find_overlapping_blocks, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_CIRTreeFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_CIRTreeFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_CIRTreeFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_CIRTreeFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_3bbi_12cirtree_file_CIRTreeFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bbi.cirtree_file.CIRTreeFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_3bbi_12cirtree_file_CIRTreeFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_CIRTreeFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_CIRTreeFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_CIRTreeFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_CIRTreeFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_2bx_3bbi_12cirtree_file_CIRTreeFile, /*tp_traverse*/ + __pyx_tp_clear_2bx_3bbi_12cirtree_file_CIRTreeFile, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_3bbi_12cirtree_file_CIRTreeFile, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_3bbi_12cirtree_file_11CIRTreeFile___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_3bbi_12cirtree_file_CIRTreeFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("cirtree_file"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s__BinaryFileReader, __pyx_k__BinaryFileReader, sizeof(__pyx_k__BinaryFileReader), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__attach, __pyx_k__attach, sizeof(__pyx_k__attach), 0, 0, 1, 1}, + {&__pyx_n_s__byteswap_needed, __pyx_k__byteswap_needed, sizeof(__pyx_k__byteswap_needed), 0, 0, 1, 1}, + {&__pyx_n_s__child_count, __pyx_k__child_count, sizeof(__pyx_k__child_count), 0, 0, 1, 1}, + {&__pyx_n_s__chrom_ix, __pyx_k__chrom_ix, sizeof(__pyx_k__chrom_ix), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__index_file_offset, __pyx_k__index_file_offset, sizeof(__pyx_k__index_file_offset), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__r_find_overlapping, __pyx_k__r_find_overlapping, sizeof(__pyx_k__r_find_overlapping), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint16, __pyx_k__read_uint16, sizeof(__pyx_k__read_uint16), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint32, __pyx_k__read_uint32, sizeof(__pyx_k__read_uint32), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint64, __pyx_k__read_uint64, sizeof(__pyx_k__read_uint64), 0, 0, 1, 1}, + {&__pyx_n_s__read_uint8, __pyx_k__read_uint8, sizeof(__pyx_k__read_uint8), 0, 0, 1, 1}, + {&__pyx_n_s__reader, __pyx_k__reader, sizeof(__pyx_k__reader), 0, 0, 1, 1}, + {&__pyx_n_s__rval, __pyx_k__rval, sizeof(__pyx_k__rval), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_610839776 = PyInt_FromLong(610839776); if (unlikely(!__pyx_int_610839776)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcirtree_file(void); /*proto*/ +PyMODINIT_FUNC initcirtree_file(void) +#else +PyMODINIT_FUNC PyInit_cirtree_file(void); /*proto*/ +PyMODINIT_FUNC PyInit_cirtree_file(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cirtree_file(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cirtree_file"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bbi__cirtree_file) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_3bbi_12cirtree_file_CIRTreeFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "CIRTreeFile", (PyObject *)&__pyx_type_2bx_3bbi_12cirtree_file_CIRTreeFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = &__pyx_type_2bx_3bbi_12cirtree_file_CIRTreeFile; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bbi/cirtree_file.pyx":1 + * from bx.misc.binary_file import BinaryFileReader # <<<<<<<<<<<<<< + * + * DEF cir_tree_sig = 0x2468ACE0 + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__BinaryFileReader)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__BinaryFileReader)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_3), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BinaryFileReader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bbi/cirtree_file.pyx":102 + * self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) + * + * def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): # <<<<<<<<<<<<<< + * rval = [] + * self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bbi.cirtree_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bbi.cirtree_file"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.pyx new file mode 100755 index 0000000..8820699 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bbi/cirtree_file.pyx @@ -0,0 +1,105 @@ +from bx.misc.binary_file import BinaryFileReader + +DEF cir_tree_sig = 0x2468ACE0 + +cdef int ovcmp( bits32 a_hi, bits32 a_lo, bits32 b_hi, bits32 b_lo ): + if a_hi < b_hi: + return 1 + elif a_hi > b_hi: + return -1 + else: + if a_lo < b_lo: + return 1 + elif a_lo > b_lo: + return -1 + else: + return 0 + +cdef overlaps( qchrom, qstart, qend, rstartchrom, rstartbase, rendchrom, rendbase ): + return ( ovcmp( qchrom, qstart, rendchrom, rendbase ) > 0 ) and \ + ( ovcmp( qchrom, qend, rstartchrom, rstartbase ) < 0 ) + +cdef class CIRTreeFile: + + def __init__( self, file=None ): + if file is not None: + self.attach( file ) + + def attach( self, file ): + """ + Attach to an open file + """ + self.file = file + self.reader = reader = BinaryFileReader( file, cir_tree_sig ) + self.is_byteswapped = self.reader.byteswap_needed + # Header + self.block_size = reader.read_uint32() + self.item_count = reader.read_uint64() + self.start_chrom_ix = reader.read_uint32() + self.start_base = reader.read_uint32() + self.end_chrom_ix = reader.read_uint32() + self.end_base = reader.read_uint32() + self.file_size = reader.read_uint64() + self.items_per_slot = reader.read_uint32() + # Skip reserved + reader.read_uint32() + # Save root + self.root_offset = reader.tell() + + def r_find_overlapping( self, int level, bits64 index_file_offset, bits32 chrom_ix, bits32 start, bits32 end, object rval, object reader ): + cdef UBYTE is_leaf + cdef bits16 child_count + reader.seek( index_file_offset ) + # Block header + is_leaf = reader.read_uint8() + assert is_leaf == 0 or is_leaf == 1 + reader.read_uint8() + child_count = reader.read_uint16() + # Read block + if is_leaf: + self.r_find_overlapping_leaf( level, chrom_ix, start, end, rval, child_count, reader ) + else: + self.r_find_overlapping_parent( level, chrom_ix, start, end, rval, child_count, reader ) + + def r_find_overlapping_leaf( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, + bits16 child_count, object reader ): + cdef bits32 start_chrom_ix, start_base, end_chrom_ix, end_base + cdef bits64 offset + cdef bits64 size + for i from 0 <= i < child_count: + start_chrom_ix = reader.read_uint32() + start_base = reader.read_uint32() + end_chrom_ix = reader.read_uint32() + end_base = reader.read_uint32() + offset = reader.read_uint64() + size = reader.read_uint64() + if overlaps( chrom_ix, start, end, start_chrom_ix, start_base, end_chrom_ix, end_base ): + rval.append( ( offset, size ) ) + + def r_find_overlapping_parent( self, int level, bits32 chrom_ix, bits32 start, bits32 end, object rval, + bits16 child_count, object reader ): + # Read and cache offsets for all children to avoid excessive seeking + ## cdef bits32 start_chrom_ix[child_count], start_base[child_count], end_chrom_ix[child_count], end_base[child_count] + ## cdef bits64 offset[child_count] + start_chrom_ix = []; start_base = []; end_chrom_ix = []; end_base = [] + offset = [] + for i from 0 <= i < child_count: + ## start_chrom_ix[i] = reader.read_bits32() + ## start_base[i] = reader.read_bits32() + ## end_chrom_ix[i] = reader.read_bits32() + ## end_base[i] = reader.read_bits32() + ## offset[i] = reader.read_bits64() + start_chrom_ix.append( reader.read_uint32() ) + start_base.append( reader.read_uint32() ) + end_chrom_ix.append( reader.read_uint32() ) + end_base.append( reader.read_uint32() ) + offset.append( reader.read_uint64() ) + # Now recurse + for i from 0 <= i < child_count: + if overlaps( chrom_ix, start, end, start_chrom_ix[i], start_base[i], end_chrom_ix[i], end_base[i] ): + self.r_find_overlapping( level + 1, offset[i], chrom_ix, start, end, rval, reader ) + + def find_overlapping_blocks( self, bits32 chrom_ix, bits32 start, bits32 end ): + rval = [] + self.r_find_overlapping( 0, self.root_offset, chrom_ix, start, end, rval, self.reader ) + return rval diff --git a/code/utilities/CPAT-1.2.2/lib/bx/binned_array.py b/code/utilities/CPAT-1.2.2/lib/bx/binned_array.py new file mode 100755 index 0000000..dfeec4f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/binned_array.py @@ -0,0 +1,345 @@ +""" +Numeric arrays stored as individually compressed blocks on disk, allowing +pseudo-random acccess. + +`BinnedArray` is used to build such an array in memory and save it to disk. +`BinnedArrayWriter` can instead be used when creating the array sequentially +(does not require keeping all data in memory). `FileBinnedArray` provides +read only access to an on disk binned array. +""" + +from __future__ import division + +import math + +from numpy import * +from struct import * +from bx_extras.lrucache import LRUCache + +import sys +platform_is_little_endian = ( sys.byteorder == 'little' ) + +MAGIC=0x4AB04612 + +# Version incremented from version 0 to version 1 by Ian Schenck, June +# 23, 2006. Version 1 supports different typecodes, and in doing so +# breaks the original header format. The new FileBinnedArray is +# backwards compatible with version 0. + +# Version 1 -> 2 by James Taylor, allow specifying different compression +# types. + +VERSION=2 + +# Compression types + +comp_types = dict() + +comp_types['none'] = ( lambda x: x, lambda x: x ) + +try: + import zlib + comp_types['zlib'] = ( zlib.compress, zlib.decompress ) +except: + pass + +try: + import lzo + comp_types['lzo'] = ( lzo.compress, lzo.decompress ) +except: + pass + + +MAX=512*1024*1024 + +class BinnedArray( object ): + def __init__( self, bin_size=512*1024, default=NaN, max_size=MAX, typecode="f" ): + self.max_size = max_size + self.bin_size = bin_size + self.nbins = int( math.ceil( ( max_size / self.bin_size ) ) ) + self.bins = [ None ] * self.nbins + self.default = default + self.typecode = typecode + def get_bin_offset( self, index ): + return index // self.bin_size, index % self.bin_size + def init_bin( self, index ): + # self.bins[index] = zeros( self.bin_size ) * self.default + self.bins[index] = zeros( self.bin_size, self.typecode ) + self.bins[index][:] = self.default + def get( self, key ): + bin, offset = self.get_bin_offset( key ) + if self.bins[bin] is None: + return self.default + else: + return self.bins[bin][offset] + def set( self, key, value ): + bin, offset = self.get_bin_offset( key ) + if self.bins[bin] is None: + self.init_bin( bin ) + self.bins[bin][offset] = value + def get_range( self, start, end ): + size = end - start + assert size >= 0 + rval = [] + while size > 0: + bin, offset = self.get_bin_offset( start ) + delta = self.bin_size - offset + if self.bins[bin] is None: + if delta < size: + rval.append( resize( array(self.default, self.typecode), (delta,) ) ) + size -= delta + start += delta + else: + rval.append( resize( array(self.default, "f"), (size,) ) ) + size = 0 + else: + if delta < size: + rval.append( self.bins[bin][offset:offset+delta] ) + size -= delta + start += delta + else: + rval.append( self.bins[bin][offset:offset+size] ) + size = 0 + return concatenate( rval ) + def __getitem__( self, key ): + if isinstance( key, slice ): + start, stop, stride = key.indices( self.max_size ) + assert stride == 1, "Slices with strides are not supported" + return self.get_range( start, stop ) + else: + return self.get( key ) + def __setitem__( self, key, value ): + return self.set( key, value ) + def to_file( self, f, comp_type='zlib' ): + # Get compress method + compress, _ = comp_types[comp_type] + # Write header + write_packed( f, ">5I", MAGIC, VERSION, self.max_size, self.bin_size, self.nbins ) + # save type code + f.write( pack('c',self.typecode ) ) + # save compression type + f.write( comp_type[0:4].ljust( 4 ) ) + # write default value + a = array( self.default, self.typecode ) + # Struct module can't deal with NaN and endian conversion, we'll hack + # around that by byteswapping the array + if platform_is_little_endian: + a = a.byteswap() + f.write( a.tostring() ) + # Save current position (start of bin offsets) + index_start_pos = f.tell() + # Skip forward to save space for index + f.seek( calcsize( ">2I" ) * self.nbins, 1 ) + bin_pos_and_size = [] + # Write each bin + for bin in self.bins: + if bin is None: + bin_pos_and_size.append( ( 0, 0 ) ) + else: + assert bin.dtype.char == self.typecode + if platform_is_little_endian: + s = bin.byteswap().tostring() + else: + s = bin.tostring() + compressed = compress( s ) + bin_pos_and_size.append( ( f.tell(), len( compressed ) ) ) + f.write( compressed ) + # Go back and fill in table + f.seek( index_start_pos ) + for pos, size in bin_pos_and_size: + write_packed( f, ">2I", pos, size ) + +class FileBinnedArray( object ): + def __init__( self, f, cache=32): + # If cache=None, then everything is allowed to stay in memory, + # this is the default behavior. + self.f = f + M, V, max_size, bin_size, nbins = read_packed( f, ">5I" ) + assert M == MAGIC + # assert version less than max supported + assert V <= VERSION, "File is version %d but I don't know about anything beyond %d" % ( V, VERSION ) + self.max_size = max_size + self.bin_size = bin_size + self.nbins = nbins + self.bins = LRUCache(size=cache) + # Read typecode + if V >= 1: + self.typecode = unpack( 'c', f.read(1) )[0] + else: + self.typecode = 'f' + # Read compression type + if V >= 2: + self.comp_type = f.read( 4 ).strip() + else: + self.comp_type = 'zlib' + self.decompress = comp_types[self.comp_type][1] + # Read default value + s = f.read( calcsize( self.typecode ) ) + a = fromstring( s, self.typecode ) + if platform_is_little_endian: + a = a.byteswap() + self.default = a[0] + # Read bin sizes and offsets + self.bin_pos = [] + self.bin_sizes = [] + for i in range( nbins ): + pos, size = read_packed( f, ">2I" ) + self.bin_pos.append( pos ) + self.bin_sizes.append( size ) + def get_bin_offset( self, index ): + return int( index // self.bin_size ), int( index % self.bin_size ) + def load_bin( self, index ): + assert self.bin_pos[index] != 0 + self.f.seek( self.bin_pos[index] ) + raw = self.f.read( self.bin_sizes[index] ) + a = fromstring( self.decompress( raw ), self.typecode ) + if platform_is_little_endian: + a = a.byteswap() + assert len( a ) == self.bin_size + self.bins[index] = a + def get( self, key ): + bin, offset = self.get_bin_offset( key ) + if bin in self.bins: + return self.bins[bin][offset] + elif self.bin_pos[bin]: + self.load_bin( bin ) + return self.bins[bin][offset] + else: + return self.default + def get_range( self, start, end ): + size = end - start + assert size >= 0 + rval = [] + while size > 0: + bin, offset = self.get_bin_offset( start ) + delta = self.bin_size - offset + if not bin in self.bins and self.bin_pos[bin] != 0: + self.load_bin( bin ) + if self.bins[bin] is None: + if delta < size: + rval.append( resize( array(self.default, self.typecode), (delta,) ) ) + size -= delta + start += delta + else: + rval.append( resize( array(self.default, self.typecode), (size,) ) ) + size = 0 + else: + if delta < size: + rval.append( self.bins[bin][offset:offset+delta] ) + size -= delta + start += delta + else: + rval.append( self.bins[bin][offset:offset+size] ) + size = 0 + return concatenate( rval ) + def __getitem__( self, key ): + if isinstance( key, slice ): + start, stop, stride = key.indices( self.max_size ) + assert stride == 1, "Slices with strides are not supported" + return self.get_range( start, stop ) + else: + return self.get( key ) + +class BinnedArrayWriter( object ): + def __init__( self, f, bin_size=512*1024, default=NaN, max_size=MAX, typecode="f", comp_type='zlib' ): + # All parameters in the constructor are immutable after creation + self.f = f + self.max_size = max_size + self.bin_size = bin_size + self.nbins = int( math.ceil( ( max_size / self.bin_size ) ) ) + self.default = default + self.typecode = typecode + self.bin = 0 + self.bin_pos = 0 + self.bin_index = [] + self.buffer = resize( array(self.default, self.typecode), (self.bin_size,) ) + self.buffer_contains_values = False + self.comp_type = comp_type + self.compress = comp_types[comp_type][0] + self.write_header() + # Start the first bin + ## self.bin_index = [ (self.data_offset, 0) ] + # Put the fp at the start of the data (we go back and fill in the index at the end) + self.f.seek( self.data_offset ) + + def write_header( self ): + self.f.seek(0) + # Write header + write_packed( self.f, ">5I", MAGIC, VERSION, self.max_size, self.bin_size, self.nbins ) + # save type code + self.f.write( pack('c',self.typecode ) ) + # write default value + a = array( self.default, self.typecode ) + # write comp type + self.f.write( self.comp_type[0:4].ljust(4) ) + # write default + # Struct module can't deal with NaN and endian conversion, we'll hack + # around that by byteswapping the array + if platform_is_little_endian: + a = a.byteswap() + self.f.write( a.tostring() ) + # Save current position (start of bin offsets) + self.index_pos = self.f.tell() + self.data_offset = self.index_pos + (self.nbins * calcsize( ">2I" )) + + def write_index( self ): + self.f.seek(self.index_pos) + for pos, size in self.bin_index: + write_packed( self.f, ">2I", pos, size ) + + def skip( self ): + self.bin_pos += 1 + if self.bin_pos == self.bin_size: + self.flush() + self.bin_pos = 0 + self.bin += 1 + assert self.bin <= self.nbins + self.buffer = resize( array(self.default, self.typecode), (self.bin_size,) ) + self.buffer_contains_values = False + ## self.bin_index.append( (self.f.tell(), 0) ) + + def write( self, data ): + self.buffer[self.bin_pos] = data + self.buffer_contains_values = True + self.bin_pos += 1 + if self.bin_pos == self.bin_size: + self.flush() + self.bin_pos = 0 + self.bin += 1 + assert self.bin <= self.nbins + self.buffer = resize( array(self.default, self.typecode), (self.bin_size,) ) + self.buffer_contains_values = False + ## self.bin_index.append( (self.f.tell(), 0) ) + + def flush( self ): + # Flush buffer to file + if self.buffer_contains_values: + ## pos, size = self.bin_index[self.bin] + ## self.f.seek( pos ) + pos = self.f.tell() + if platform_is_little_endian: + s = self.buffer.byteswap().tostring() + else: + s = self.buffer.tostring() + compressed = self.compress( s ) + size = len( compressed ) + assert len( self.bin_index ) == self.bin + self.bin_index.append( ( pos, size ) ) + self.f.write( compressed ) + else: + assert len( self.bin_index ) == self.bin + self.bin_index.append( ( 0, 0 ) ) + + def finish( self ): + self.flush() + self.nbins = self.bin + 1 + self.write_header() + self.write_index() + +def write_packed( f, pattern, *vals ): + f.write( pack( pattern, *vals ) ) + +def read_packed( f, pattern ): + rval = unpack( pattern, f.read( calcsize( pattern ) ) ) + if len( rval ) == 1: return rval[0] + return rval \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/binned_array_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/binned_array_tests.py new file mode 100755 index 0000000..d7eb1c8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/binned_array_tests.py @@ -0,0 +1,93 @@ +""" +Tests for `bx.binned_array`. +""" + +from numpy import * +from binned_array import * + +random = random.random + +# Bigger values take longer, but excercise more bins +CHUNK_SIZE_RANDOM=945 +CHUNK_SIZE_ZEROS=897 +##CHUNK_SIZE_RANDOM=9456 +##CHUNK_SIZE_ZEROS=8972 + +source = target = None + +def setup(): + global source + global target + source = [] + for i in range( 13 ): + if random() < 0.5: + source = concatenate( ( source, random( CHUNK_SIZE_RANDOM ) ) ) + else: + source = concatenate( ( source, zeros( CHUNK_SIZE_ZEROS, 'f' ) ) ) + source = source.astype( 'f' ) + # Set on target + target = BinnedArray( 128, NaN, len( source ) ) + for i in range( len( source ) ): + # if not isNaN( source[i] ): + target[i] = source[i] + return source, target + +def test_simple(): + # Verify + for i in range( len( source ) ): + assert source[i] == target[i], "No match, index: %d, source: %f, target: %f, len( source ): %d" % ( i, source[i], target[i], len( source ) ) + # Verify with slices + for i in range( 10 ): + a = int( random() * len( source ) ) + b = int( random() * len( source ) ) + if b < a: a, b = b, a + assert allclose( source[a:b], target[a:b] ), "No match, index: %d:%d, source: %s, target: %s" % \ + ( a, b, ",".join( map( str, source[a:a+10] ) ), ",".join( map( str, target[a:a+10] ) ) ) + +def test_file(): + # With a file (zlib) + target.to_file( open( "/tmp/foo", "w" ) ) + target2 = FileBinnedArray( open( "/tmp/foo" ) ) + for i in range( len( source ) ): + assert source[i] == target2[i], "No match, index: %d, source: %d, target: %d" % ( i, source[i], target2[i] ) + # Verify with slices + target2 = FileBinnedArray( open( "/tmp/foo" ) ) + for i in range( 10 ): + a = int( random() * len( source ) ) + b = int( random() * len( source ) ) + if b < a: a, b = b, a + assert allclose( source[a:b], target[a:b] ), "No match, index: %d:%d, source: %s, target: %s" % \ + ( a, b, ",".join( map( str, source[a:a+10] ) ), ",".join( map( str, target2[a:a+10] ) ) ) + +def test_file_lzo(): + # With a file (lzo) + target.to_file( open( "/tmp/foo3", "w" ), comp_type="lzo" ) + target3 = FileBinnedArray( open( "/tmp/foo3" ) ) + # Verify + for i in range( len( source ) ): + assert source[i] == target3[i], "No match, index: %d, source: %d, target: %d" % ( i, source[i], target3[i] ) + # Verify with slices + target3 = FileBinnedArray( open( "/tmp/foo3" ) ) + for i in range( 10 ): + a = int( random() * len( source ) ) + b = int( random() * len( source ) ) + if b < a: a, b = b, a + assert allclose( source[a:b], target3[a:b] ), "No match, index: %d:%d, source: %s, target: %s" % \ + ( a, b, ",".join( map( str, source[a:a+10] ) ), ",".join( map( str, target3[a:a+10] ) ) ) + +def test_binned_array_writer(): + # Test with ba writer + o = open( "/tmp/foo4", "w" ) + w = BinnedArrayWriter( o, 128, comp_type='lzo' ) + for val in source: + w.write( val ) + w.finish() + o.close() + # Verify + target4 = FileBinnedArray( open( "/tmp/foo4" ) ) + for i in range( len( source ) ): + assert allclose( source[i], target4[i] ), "No match, index: %d, source: %d, target: %d" % ( i, source[i], target4[i] ) + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bitset.c b/code/utilities/CPAT-1.2.2/lib/bx/bitset.c new file mode 100755 index 0000000..a5a1323 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bitset.c @@ -0,0 +1,5199 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:10 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__bitset +#define __PYX_HAVE_API__bx__bitset +#include "common.h" +#include "bits.h" +#include "binBits.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "bitset.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_6bitset_BinnedBitSet; +struct __pyx_obj_2bx_6bitset_BitSet; + +/* "bx/bitset.pyx":71 + * + * cdef class BitSet + * cdef class BinnedBitSet # <<<<<<<<<<<<<< + * + * ## ---- BitSet bounds checking ---------------------------------------------- + */ +struct __pyx_obj_2bx_6bitset_BinnedBitSet { + PyObject_HEAD + struct BinBits *bb; +}; + + +/* "bx/bitset.pyx":70 + * ## ---- Forward declerations ------------------------------------------------ + * + * cdef class BitSet # <<<<<<<<<<<<<< + * cdef class BinnedBitSet + * + */ +struct __pyx_obj_2bx_6bitset_BitSet { + PyObject_HEAD + Bits *bits; + int bitCount; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.bitset' */ +static PyTypeObject *__pyx_ptype_2bx_6bitset_BitSet = 0; +static PyTypeObject *__pyx_ptype_2bx_6bitset_BinnedBitSet = 0; +static int __pyx_v_2bx_6bitset_MAX_INT; +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_index(struct __pyx_obj_2bx_6bitset_BitSet *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_range(struct __pyx_obj_2bx_6bitset_BitSet *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_range_count(struct __pyx_obj_2bx_6bitset_BitSet *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_same_size(struct __pyx_obj_2bx_6bitset_BitSet *, struct __pyx_obj_2bx_6bitset_BitSet *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_index(struct __pyx_obj_2bx_6bitset_BinnedBitSet *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_start(struct __pyx_obj_2bx_6bitset_BinnedBitSet *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_range_count(struct __pyx_obj_2bx_6bitset_BinnedBitSet *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_same_size(struct __pyx_obj_2bx_6bitset_BinnedBitSet *, struct __pyx_obj_2bx_6bitset_BinnedBitSet *); /*proto*/ +#define __Pyx_MODULE_NAME "bx.bitset" +int __pyx_module_is_main_bx__bitset = 0; + +/* Implementation of 'bx.bitset' */ +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_ValueError; +static char __pyx_k_1[] = "BitSet index (%d) must be non-negative."; +static char __pyx_k_2[] = "%d is larger than the size of this BitSet (%d)."; +static char __pyx_k_3[] = "Range end (%d) must be greater than range start(%d)."; +static char __pyx_k_4[] = "End %d is larger than the size of this BitSet (%d)."; +static char __pyx_k_5[] = "Count (%d) must be non-negative."; +static char __pyx_k_6[] = "BitSets must have the same size"; +static char __pyx_k_8[] = "%d is larger than the maximum BitSet size of %d."; +static char __pyx_k_9[] = "End (%d) is larger than the size of this BinnedBitSet (%d)."; +static char __pyx_k_12[] = "%d is larger than the maximum BinnedBitSet size of %d."; +static char __pyx_k_13[] = "\nCompact mutable sequences of bits (vectors of 0s and 1s) supporting various\nboolean operations, and a \"binned\" variation which stores long runs of \nidentical bits compactly.\n\nBecause the binned implementation avoids a lot of memory allocation and access\nwhen working with either small subregions of the total interval or setting /\ntesting spans larger than the bin size, it can be much faster.\n"; +static char __pyx_k__MAX[] = "MAX"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__ior[] = "ior"; +static char __pyx_k__iand[] = "iand"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__count[] = "count"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__invert[] = "invert"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__bitCount[] = "bitCount"; +static char __pyx_k__IndexError[] = "IndexError"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__granularity[] = "granularity"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_12; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__IndexError; +static PyObject *__pyx_n_s__MAX; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__bitCount; +static PyObject *__pyx_n_s__count; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__granularity; +static PyObject *__pyx_n_s__iand; +static PyObject *__pyx_n_s__invert; +static PyObject *__pyx_n_s__ior; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1024; +static PyObject *__pyx_int_536870912; +static PyObject *__pyx_k_11; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_10; + +/* "bx/bitset.pyx":75 + * ## ---- BitSet bounds checking ---------------------------------------------- + * + * cdef inline b_check_index( BitSet b, index ): # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_index(struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_b, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("b_check_index"); + + /* "bx/bitset.pyx":76 + * + * cdef inline b_check_index( BitSet b, index ): + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= b.bitCount: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":77 + * cdef inline b_check_index( BitSet b, index ): + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) # <<<<<<<<<<<<<< + * if index >= b.bitCount: + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, b.bitCount ) ) + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bitset.pyx":78 + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= b.bitCount: # <<<<<<<<<<<<<< + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, b.bitCount ) ) + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":79 + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= b.bitCount: + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, b.bitCount ) ) # <<<<<<<<<<<<<< + * + * cdef inline b_check_range( BitSet b, start, end ): + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.b_check_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":81 + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, b.bitCount ) ) + * + * cdef inline b_check_range( BitSet b, start, end ): # <<<<<<<<<<<<<< + * b_check_index( b, start ) + * if end < start: + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_range(struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_b, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("b_check_range"); + + /* "bx/bitset.pyx":82 + * + * cdef inline b_check_range( BitSet b, start, end ): + * b_check_index( b, start ) # <<<<<<<<<<<<<< + * if end < start: + * raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_index(__pyx_v_b, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":83 + * cdef inline b_check_range( BitSet b, start, end ): + * b_check_index( b, start ) + * if end < start: # <<<<<<<<<<<<<< + * raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) + * if end > b.bitCount: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":84 + * b_check_index( b, start ) + * if end < start: + * raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) # <<<<<<<<<<<<<< + * if end > b.bitCount: + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( end, b.bitCount ) ) + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bitset.pyx":85 + * if end < start: + * raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) + * if end > b.bitCount: # <<<<<<<<<<<<<< + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( end, b.bitCount ) ) + * + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":86 + * raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) + * if end > b.bitCount: + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( end, b.bitCount ) ) # <<<<<<<<<<<<<< + * + * cdef inline b_check_range_count( BitSet b, start, count ): + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.b_check_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":88 + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( end, b.bitCount ) ) + * + * cdef inline b_check_range_count( BitSet b, start, count ): # <<<<<<<<<<<<<< + * b_check_index( b, start ) + * if count < 0: + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_range_count(struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_b, PyObject *__pyx_v_start, PyObject *__pyx_v_count) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("b_check_range_count"); + + /* "bx/bitset.pyx":89 + * + * cdef inline b_check_range_count( BitSet b, start, count ): + * b_check_index( b, start ) # <<<<<<<<<<<<<< + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_index(__pyx_v_b, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":90 + * cdef inline b_check_range_count( BitSet b, start, count ): + * b_check_index( b, start ) + * if count < 0: # <<<<<<<<<<<<<< + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > b.bitCount: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_count, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":91 + * b_check_index( b, start ) + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) # <<<<<<<<<<<<<< + * if start + count > b.bitCount: + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( start + count, b.bitCount ) ) + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bitset.pyx":92 + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > b.bitCount: # <<<<<<<<<<<<<< + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( start + count, b.bitCount ) ) + * + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":93 + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > b.bitCount: + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( start + count, b.bitCount ) ) # <<<<<<<<<<<<<< + * + * cdef inline b_check_same_size( BitSet b, BitSet other ): + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(__pyx_v_b->bitCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bitset.b_check_range_count", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":95 + * raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( start + count, b.bitCount ) ) + * + * cdef inline b_check_same_size( BitSet b, BitSet other ): # <<<<<<<<<<<<<< + * if b.bitCount != other.bitCount: + * raise ValueError( "BitSets must have the same size" ) + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_b_check_same_size(struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_b, struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("b_check_same_size"); + + /* "bx/bitset.pyx":96 + * + * cdef inline b_check_same_size( BitSet b, BitSet other ): + * if b.bitCount != other.bitCount: # <<<<<<<<<<<<<< + * raise ValueError( "BitSets must have the same size" ) + * + */ + __pyx_t_1 = (__pyx_v_b->bitCount != __pyx_v_other->bitCount); + if (__pyx_t_1) { + + /* "bx/bitset.pyx":97 + * cdef inline b_check_same_size( BitSet b, BitSet other ): + * if b.bitCount != other.bitCount: + * raise ValueError( "BitSets must have the same size" ) # <<<<<<<<<<<<<< + * + * ## ---- BitSet -------------------------------------------------------------- + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.b_check_same_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":107 + * cdef Bits * bits + * cdef int bitCount + * def __cinit__( self, bitCount ): # <<<<<<<<<<<<<< + * if bitCount > MAX_INT: + * raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) + */ + +static int __pyx_pf_2bx_6bitset_6BitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6bitset_6BitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_bitCount = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bitCount,0}; + __Pyx_RefNannySetupContext("__cinit__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bitCount); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_bitCount = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BitSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bitset.pyx":108 + * cdef int bitCount + * def __cinit__( self, bitCount ): + * if bitCount > MAX_INT: # <<<<<<<<<<<<<< + * raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) + * self.bitCount = bitCount + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_2bx_6bitset_MAX_INT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_bitCount, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "bx/bitset.pyx":109 + * def __cinit__( self, bitCount ): + * if bitCount > MAX_INT: + * raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) # <<<<<<<<<<<<<< + * self.bitCount = bitCount + * self.bits = bitAlloc( bitCount ) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_2bx_6bitset_MAX_INT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_bitCount); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bitCount); + __Pyx_GIVEREF(__pyx_v_bitCount); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bitset.pyx":110 + * if bitCount > MAX_INT: + * raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) + * self.bitCount = bitCount # <<<<<<<<<<<<<< + * self.bits = bitAlloc( bitCount ) + * def __dealloc__( self ): + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_bitCount); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount = __pyx_t_4; + + /* "bx/bitset.pyx":111 + * raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) + * self.bitCount = bitCount + * self.bits = bitAlloc( bitCount ) # <<<<<<<<<<<<<< + * def __dealloc__( self ): + * bitFree( & self.bits ) + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_bitCount); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits = bitAlloc(__pyx_t_4); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.BitSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":112 + * self.bitCount = bitCount + * self.bits = bitAlloc( bitCount ) + * def __dealloc__( self ): # <<<<<<<<<<<<<< + * bitFree( & self.bits ) + * property size: + */ + +static void __pyx_pf_2bx_6bitset_6BitSet_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_2bx_6bitset_6BitSet_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "bx/bitset.pyx":113 + * self.bits = bitAlloc( bitCount ) + * def __dealloc__( self ): + * bitFree( & self.bits ) # <<<<<<<<<<<<<< + * property size: + * def __get__( self ): + */ + bitFree((&((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits)); + + __Pyx_RefNannyFinishContext(); +} + +/* "bx/bitset.pyx":115 + * bitFree( & self.bits ) + * property size: + * def __get__( self ): # <<<<<<<<<<<<<< + * return self.bitCount + * def set( self, index ): + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_4size___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_4size___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/bitset.pyx":116 + * property size: + * def __get__( self ): + * return self.bitCount # <<<<<<<<<<<<<< + * def set( self, index ): + * b_check_index( self, index ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":117 + * def __get__( self ): + * return self.bitCount + * def set( self, index ): # <<<<<<<<<<<<<< + * b_check_index( self, index ) + * bitSetOne( self.bits, index ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_2set(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_2set(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set"); + + /* "bx/bitset.pyx":118 + * return self.bitCount + * def set( self, index ): + * b_check_index( self, index ) # <<<<<<<<<<<<<< + * bitSetOne( self.bits, index ) + * def clear( self, index ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_index(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":119 + * def set( self, index ): + * b_check_index( self, index ) + * bitSetOne( self.bits, index ) # <<<<<<<<<<<<<< + * def clear( self, index ): + * b_check_index( self, index ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + bitSetOne(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_2); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":120 + * b_check_index( self, index ) + * bitSetOne( self.bits, index ) + * def clear( self, index ): # <<<<<<<<<<<<<< + * b_check_index( self, index ) + * bitClearOne( self.bits, index ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_3clear(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_3clear(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clear"); + + /* "bx/bitset.pyx":121 + * bitSetOne( self.bits, index ) + * def clear( self, index ): + * b_check_index( self, index ) # <<<<<<<<<<<<<< + * bitClearOne( self.bits, index ) + * def clone( self ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_index(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":122 + * def clear( self, index ): + * b_check_index( self, index ) + * bitClearOne( self.bits, index ) # <<<<<<<<<<<<<< + * def clone( self ): + * other = BitSet( self.bitCount ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + bitClearOne(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_2); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":123 + * b_check_index( self, index ) + * bitClearOne( self.bits, index ) + * def clone( self ): # <<<<<<<<<<<<<< + * other = BitSet( self.bitCount ) + * other.ior( self ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_4clone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_4clone(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + struct __pyx_obj_2bx_6bitset_BitSet *__pyx_v_other = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clone"); + + /* "bx/bitset.pyx":124 + * bitClearOne( self.bits, index ) + * def clone( self ): + * other = BitSet( self.bitCount ) # <<<<<<<<<<<<<< + * other.ior( self ) + * return other + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6bitset_BitSet)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_other = ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bitset.pyx":125 + * def clone( self ): + * other = BitSet( self.bitCount ) + * other.ior( self ) # <<<<<<<<<<<<<< + * return other + * def set_range( self, start, count ): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_other), __pyx_n_s__ior); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bitset.pyx":126 + * other = BitSet( self.bitCount ) + * other.ior( self ) + * return other # <<<<<<<<<<<<<< + * def set_range( self, start, count ): + * b_check_range_count( self, start, count ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_other)); + __pyx_r = ((PyObject *)__pyx_v_other); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.BitSet.clone", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_other); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":127 + * other.ior( self ) + * return other + * def set_range( self, start, count ): # <<<<<<<<<<<<<< + * b_check_range_count( self, start, count ) + * bitSetRange( self.bits, start, count ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_5set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_5set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_count = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__count,0}; + __Pyx_RefNannySetupContext("set_range"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_range", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_count = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_range", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BitSet.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bitset.pyx":128 + * return other + * def set_range( self, start, count ): + * b_check_range_count( self, start, count ) # <<<<<<<<<<<<<< + * bitSetRange( self.bits, start, count ) + * def get( self, index ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_range_count(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":129 + * def set_range( self, start, count ): + * b_check_range_count( self, start, count ) + * bitSetRange( self.bits, start, count ) # <<<<<<<<<<<<<< + * def get( self, index ): + * b_check_index( self, index ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_count); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + bitSetRange(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_2, __pyx_t_3); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":130 + * b_check_range_count( self, start, count ) + * bitSetRange( self.bits, start, count ) + * def get( self, index ): # <<<<<<<<<<<<<< + * b_check_index( self, index ) + * return bitReadOne( self.bits, index ); + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_6get(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_6get(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get"); + + /* "bx/bitset.pyx":131 + * bitSetRange( self.bits, start, count ) + * def get( self, index ): + * b_check_index( self, index ) # <<<<<<<<<<<<<< + * return bitReadOne( self.bits, index ); + * def count_range( self, start=0, count=None ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_index(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":132 + * def get( self, index ): + * b_check_index( self, index ) + * return bitReadOne( self.bits, index ); # <<<<<<<<<<<<<< + * def count_range( self, start=0, count=None ): + * if count == None: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(bitReadOne(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":133 + * b_check_index( self, index ) + * return bitReadOne( self.bits, index ); + * def count_range( self, start=0, count=None ): # <<<<<<<<<<<<<< + * if count == None: + * count = self.bitCount - start + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_7count_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_7count_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_count = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__count,0}; + __Pyx_RefNannySetupContext("count_range"); + { + PyObject* values[2] = {0,0}; + values[0] = ((PyObject *)__pyx_int_0); + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = values[0]; + __pyx_v_count = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("count_range", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BitSet.count_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_count); + + /* "bx/bitset.pyx":134 + * return bitReadOne( self.bits, index ); + * def count_range( self, start=0, count=None ): + * if count == None: # <<<<<<<<<<<<<< + * count = self.bitCount - start + * b_check_range_count( self, start, count ) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_count, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":135 + * def count_range( self, start=0, count=None ): + * if count == None: + * count = self.bitCount - start # <<<<<<<<<<<<<< + * b_check_range_count( self, start, count ) + * return bitCountRange( self.bits, start, count ) + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_count); + __pyx_v_count = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bitset.pyx":136 + * if count == None: + * count = self.bitCount - start + * b_check_range_count( self, start, count ) # <<<<<<<<<<<<<< + * return bitCountRange( self.bits, start, count ) + * def next_set( self, start, end=None ): + */ + __pyx_t_3 = __pyx_f_2bx_6bitset_b_check_range_count(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bitset.pyx":137 + * count = self.bitCount - start + * b_check_range_count( self, start, count ) + * return bitCountRange( self.bits, start, count ) # <<<<<<<<<<<<<< + * def next_set( self, start, end=None ): + * if end == None: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_count); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(bitCountRange(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_4, __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.BitSet.count_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_count); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":138 + * b_check_range_count( self, start, count ) + * return bitCountRange( self.bits, start, count ) + * def next_set( self, start, end=None ): # <<<<<<<<<<<<<< + * if end == None: + * end = self.bitCount + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_8next_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_8next_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("next_set"); + { + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "next_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = values[0]; + __pyx_v_end = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("next_set", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BitSet.next_set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_end); + + /* "bx/bitset.pyx":139 + * return bitCountRange( self.bits, start, count ) + * def next_set( self, start, end=None ): + * if end == None: # <<<<<<<<<<<<<< + * end = self.bitCount + * b_check_range( self, start, end ) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":140 + * def next_set( self, start, end=None ): + * if end == None: + * end = self.bitCount # <<<<<<<<<<<<<< + * b_check_range( self, start, end ) + * return bitFindSet( self.bits, start, end ) + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bitset.pyx":141 + * if end == None: + * end = self.bitCount + * b_check_range( self, start, end ) # <<<<<<<<<<<<<< + * return bitFindSet( self.bits, start, end ) + * def next_clear( self, start, end=None ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_range(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":142 + * end = self.bitCount + * b_check_range( self, start, end ) + * return bitFindSet( self.bits, start, end ) # <<<<<<<<<<<<<< + * def next_clear( self, start, end=None ): + * if end == None: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_end); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(bitFindSet(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_3, __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.next_set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_end); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":143 + * b_check_range( self, start, end ) + * return bitFindSet( self.bits, start, end ) + * def next_clear( self, start, end=None ): # <<<<<<<<<<<<<< + * if end == None: + * end = self.bitCount + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_9next_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_9next_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("next_clear"); + { + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "next_clear") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = values[0]; + __pyx_v_end = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("next_clear", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BitSet.next_clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_end); + + /* "bx/bitset.pyx":144 + * return bitFindSet( self.bits, start, end ) + * def next_clear( self, start, end=None ): + * if end == None: # <<<<<<<<<<<<<< + * end = self.bitCount + * b_check_range( self, start, end ) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":145 + * def next_clear( self, start, end=None ): + * if end == None: + * end = self.bitCount # <<<<<<<<<<<<<< + * b_check_range( self, start, end ) + * return bitFindClear( self.bits, start, end ) + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bitset.pyx":146 + * if end == None: + * end = self.bitCount + * b_check_range( self, start, end ) # <<<<<<<<<<<<<< + * return bitFindClear( self.bits, start, end ) + * def iand( self, BitSet other ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_range(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":147 + * end = self.bitCount + * b_check_range( self, start, end ) + * return bitFindClear( self.bits, start, end ) # <<<<<<<<<<<<<< + * def iand( self, BitSet other ): + * b_check_same_size( self, other ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_end); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(bitFindClear(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, __pyx_t_3, __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.next_clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_end); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":148 + * b_check_range( self, start, end ) + * return bitFindClear( self.bits, start, end ) + * def iand( self, BitSet other ): # <<<<<<<<<<<<<< + * b_check_same_size( self, other ) + * bitAnd( self.bits, other.bits, self.bitCount ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_10iand(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_10iand(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("iand"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_2bx_6bitset_BitSet, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":149 + * return bitFindClear( self.bits, start, end ) + * def iand( self, BitSet other ): + * b_check_same_size( self, other ) # <<<<<<<<<<<<<< + * bitAnd( self.bits, other.bits, self.bitCount ) + * def ior( self, BitSet other ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_same_size(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":150 + * def iand( self, BitSet other ): + * b_check_same_size( self, other ) + * bitAnd( self.bits, other.bits, self.bitCount ) # <<<<<<<<<<<<<< + * def ior( self, BitSet other ): + * b_check_same_size( self, other ) + */ + bitAnd(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.iand", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":151 + * b_check_same_size( self, other ) + * bitAnd( self.bits, other.bits, self.bitCount ) + * def ior( self, BitSet other ): # <<<<<<<<<<<<<< + * b_check_same_size( self, other ) + * bitOr( self.bits, other.bits, self.bitCount ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_11ior(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_11ior(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ior"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_2bx_6bitset_BitSet, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":152 + * bitAnd( self.bits, other.bits, self.bitCount ) + * def ior( self, BitSet other ): + * b_check_same_size( self, other ) # <<<<<<<<<<<<<< + * bitOr( self.bits, other.bits, self.bitCount ) + * def ixor( self, BitSet other ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_same_size(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":153 + * def ior( self, BitSet other ): + * b_check_same_size( self, other ) + * bitOr( self.bits, other.bits, self.bitCount ) # <<<<<<<<<<<<<< + * def ixor( self, BitSet other ): + * b_check_same_size( self, other ) + */ + bitOr(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.ior", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":154 + * b_check_same_size( self, other ) + * bitOr( self.bits, other.bits, self.bitCount ) + * def ixor( self, BitSet other ): # <<<<<<<<<<<<<< + * b_check_same_size( self, other ) + * bitXor( self.bits, other.bits, self.bitCount ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_12ixor(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_12ixor(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ixor"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_2bx_6bitset_BitSet, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":155 + * bitOr( self.bits, other.bits, self.bitCount ) + * def ixor( self, BitSet other ): + * b_check_same_size( self, other ) # <<<<<<<<<<<<<< + * bitXor( self.bits, other.bits, self.bitCount ) + * def invert( self ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_b_check_same_size(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self), ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":156 + * def ixor( self, BitSet other ): + * b_check_same_size( self, other ) + * bitXor( self.bits, other.bits, self.bitCount ) # <<<<<<<<<<<<<< + * def invert( self ): + * bitNot( self.bits, self.bitCount) + */ + bitXor(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_other)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BitSet.ixor", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":157 + * b_check_same_size( self, other ) + * bitXor( self.bits, other.bits, self.bitCount ) + * def invert( self ): # <<<<<<<<<<<<<< + * bitNot( self.bits, self.bitCount) + * def __getitem__( self, index ): + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_13invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_13invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("invert"); + + /* "bx/bitset.pyx":158 + * bitXor( self.bits, other.bits, self.bitCount ) + * def invert( self ): + * bitNot( self.bits, self.bitCount) # <<<<<<<<<<<<<< + * def __getitem__( self, index ): + * return self.get( index ) + */ + bitNot(((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bits, ((struct __pyx_obj_2bx_6bitset_BitSet *)__pyx_v_self)->bitCount); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":159 + * def invert( self ): + * bitNot( self.bits, self.bitCount) + * def __getitem__( self, index ): # <<<<<<<<<<<<<< + * return self.get( index ) + * def __iand__( self, other ): + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_14__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_14__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + + /* "bx/bitset.pyx":160 + * bitNot( self.bits, self.bitCount) + * def __getitem__( self, index ): + * return self.get( index ) # <<<<<<<<<<<<<< + * def __iand__( self, other ): + * self.iand( other ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.BitSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":161 + * def __getitem__( self, index ): + * return self.get( index ) + * def __iand__( self, other ): # <<<<<<<<<<<<<< + * self.iand( other ) + * return self + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_15__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_15__iand__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iand__"); + + /* "bx/bitset.pyx":162 + * return self.get( index ) + * def __iand__( self, other ): + * self.iand( other ) # <<<<<<<<<<<<<< + * return self + * def __ior__( self, other ): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__iand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bitset.pyx":163 + * def __iand__( self, other ): + * self.iand( other ) + * return self # <<<<<<<<<<<<<< + * def __ior__( self, other ): + * self.ior( other ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.BitSet.__iand__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":164 + * self.iand( other ) + * return self + * def __ior__( self, other ): # <<<<<<<<<<<<<< + * self.ior( other ) + * return self + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_16__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_16__ior__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__ior__"); + + /* "bx/bitset.pyx":165 + * return self + * def __ior__( self, other ): + * self.ior( other ) # <<<<<<<<<<<<<< + * return self + * def __invert__( self ): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ior); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/bitset.pyx":166 + * def __ior__( self, other ): + * self.ior( other ) + * return self # <<<<<<<<<<<<<< + * def __invert__( self ): + * self.invert() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.BitSet.__ior__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":167 + * self.ior( other ) + * return self + * def __invert__( self ): # <<<<<<<<<<<<<< + * self.invert() + * return self + */ + +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_17__invert__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_6BitSet_17__invert__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__invert__"); + + /* "bx/bitset.pyx":168 + * return self + * def __invert__( self ): + * self.invert() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__invert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bitset.pyx":169 + * def __invert__( self ): + * self.invert() + * return self # <<<<<<<<<<<<<< + * + * ## ---- BinnedBitSet bounds checking ---------------------------------------- + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.BitSet.__invert__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":173 + * ## ---- BinnedBitSet bounds checking ---------------------------------------- + * + * cdef inline bb_check_index( BinnedBitSet bb, index ): # <<<<<<<<<<<<<< + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_index(struct __pyx_obj_2bx_6bitset_BinnedBitSet *__pyx_v_bb, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bb_check_index"); + + /* "bx/bitset.pyx":174 + * + * cdef inline bb_check_index( BinnedBitSet bb, index ): + * if index < 0: # <<<<<<<<<<<<<< + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= bb.bb.size: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":175 + * cdef inline bb_check_index( BinnedBitSet bb, index ): + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) # <<<<<<<<<<<<<< + * if index >= bb.bb.size: + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bitset.pyx":176 + * if index < 0: + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= bb.bb.size: # <<<<<<<<<<<<<< + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) + * cdef inline bb_check_start( BinnedBitSet bb, start ): + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_bb->bb->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":177 + * raise IndexError( "BitSet index (%d) must be non-negative." % index ) + * if index >= bb.bb.size: + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) # <<<<<<<<<<<<<< + * cdef inline bb_check_start( BinnedBitSet bb, start ): + * bb_check_index( bb, start ) + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_bb->bb->size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.bitset.bb_check_index", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":178 + * if index >= bb.bb.size: + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) + * cdef inline bb_check_start( BinnedBitSet bb, start ): # <<<<<<<<<<<<<< + * bb_check_index( bb, start ) + * cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_start(struct __pyx_obj_2bx_6bitset_BinnedBitSet *__pyx_v_bb, PyObject *__pyx_v_start) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bb_check_start"); + + /* "bx/bitset.pyx":179 + * raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) + * cdef inline bb_check_start( BinnedBitSet bb, start ): + * bb_check_index( bb, start ) # <<<<<<<<<<<<<< + * cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): + * bb_check_index( bb, start ) + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_index(__pyx_v_bb, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.bb_check_start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":180 + * cdef inline bb_check_start( BinnedBitSet bb, start ): + * bb_check_index( bb, start ) + * cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): # <<<<<<<<<<<<<< + * bb_check_index( bb, start ) + * if count < 0: + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_range_count(struct __pyx_obj_2bx_6bitset_BinnedBitSet *__pyx_v_bb, PyObject *__pyx_v_start, PyObject *__pyx_v_count) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bb_check_range_count"); + + /* "bx/bitset.pyx":181 + * bb_check_index( bb, start ) + * cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): + * bb_check_index( bb, start ) # <<<<<<<<<<<<<< + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_index(__pyx_v_bb, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":182 + * cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): + * bb_check_index( bb, start ) + * if count < 0: # <<<<<<<<<<<<<< + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > bb.bb.size: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_count, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":183 + * bb_check_index( bb, start ) + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) # <<<<<<<<<<<<<< + * if start + count > bb.bb.size: + * raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/bitset.pyx":184 + * if count < 0: + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > bb.bb.size: # <<<<<<<<<<<<<< + * raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_bb->bb->size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "bx/bitset.pyx":185 + * raise IndexError( "Count (%d) must be non-negative." % count ) + * if start + count > bb.bb.size: + * raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) # <<<<<<<<<<<<<< + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + * if bb.bb.size != other.bb.size: + */ + __pyx_t_4 = PyNumber_Add(__pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(__pyx_v_bb->bb->size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.bitset.bb_check_range_count", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":186 + * if start + count > bb.bb.size: + * raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): # <<<<<<<<<<<<<< + * if bb.bb.size != other.bb.size: + * raise ValueError( "BitSets must have the same size" ) + */ + +static CYTHON_INLINE PyObject *__pyx_f_2bx_6bitset_bb_check_same_size(struct __pyx_obj_2bx_6bitset_BinnedBitSet *__pyx_v_bb, struct __pyx_obj_2bx_6bitset_BinnedBitSet *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("bb_check_same_size"); + + /* "bx/bitset.pyx":187 + * raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + * if bb.bb.size != other.bb.size: # <<<<<<<<<<<<<< + * raise ValueError( "BitSets must have the same size" ) + * + */ + __pyx_t_1 = (__pyx_v_bb->bb->size != __pyx_v_other->bb->size); + if (__pyx_t_1) { + + /* "bx/bitset.pyx":188 + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + * if bb.bb.size != other.bb.size: + * raise ValueError( "BitSets must have the same size" ) # <<<<<<<<<<<<<< + * + * ## ---- BinnedBitSet -------------------------------------------------------- + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.bb_check_same_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":196 + * cdef class BinnedBitSet: + * cdef BinBits * bb + * def __cinit__( self, size=MAX, granularity=1024 ): # <<<<<<<<<<<<<< + * if size > MAX_INT: + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + */ + +static int __pyx_pf_2bx_6bitset_12BinnedBitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_6bitset_12BinnedBitSet___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_size = 0; + PyObject *__pyx_v_granularity = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__granularity,0}; + __Pyx_RefNannySetupContext("__cinit__"); + { + PyObject* values[2] = {0,0}; + values[0] = __pyx_k_11; + values[1] = ((PyObject *)__pyx_int_1024); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__granularity); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_size = values[0]; + __pyx_v_granularity = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bitset.pyx":197 + * cdef BinBits * bb + * def __cinit__( self, size=MAX, granularity=1024 ): + * if size > MAX_INT: # <<<<<<<<<<<<<< + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + * self.bb = binBitsAlloc( size, granularity ) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_2bx_6bitset_MAX_INT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_size, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "bx/bitset.pyx":198 + * def __cinit__( self, size=MAX, granularity=1024 ): + * if size > MAX_INT: + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) # <<<<<<<<<<<<<< + * self.bb = binBitsAlloc( size, granularity ) + * def __dealloc( self ): + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_2bx_6bitset_MAX_INT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_size); + __Pyx_GIVEREF(__pyx_v_size); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/bitset.pyx":199 + * if size > MAX_INT: + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + * self.bb = binBitsAlloc( size, granularity ) # <<<<<<<<<<<<<< + * def __dealloc( self ): + * binBitsFree( self.bb ); + */ + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_size); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_granularity); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb = binBitsAlloc(__pyx_t_4, __pyx_t_5); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":200 + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + * self.bb = binBitsAlloc( size, granularity ) + * def __dealloc( self ): # <<<<<<<<<<<<<< + * binBitsFree( self.bb ); + * def __getitem__( self, index ): + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_1__dealloc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_1__dealloc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc"); + + /* "bx/bitset.pyx":201 + * self.bb = binBitsAlloc( size, granularity ) + * def __dealloc( self ): + * binBitsFree( self.bb ); # <<<<<<<<<<<<<< + * def __getitem__( self, index ): + * bb_check_index( self, index ) + */ + binBitsFree(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":202 + * def __dealloc( self ): + * binBitsFree( self.bb ); + * def __getitem__( self, index ): # <<<<<<<<<<<<<< + * bb_check_index( self, index ) + * return binBitsReadOne( self.bb, index ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__"); + + /* "bx/bitset.pyx":203 + * binBitsFree( self.bb ); + * def __getitem__( self, index ): + * bb_check_index( self, index ) # <<<<<<<<<<<<<< + * return binBitsReadOne( self.bb, index ) + * def set( self, index ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_index(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":204 + * def __getitem__( self, index ): + * bb_check_index( self, index ) + * return binBitsReadOne( self.bb, index ) # <<<<<<<<<<<<<< + * def set( self, index ): + * bb_check_index( self, index ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(binBitsReadOne(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":205 + * bb_check_index( self, index ) + * return binBitsReadOne( self.bb, index ) + * def set( self, index ): # <<<<<<<<<<<<<< + * bb_check_index( self, index ) + * binBitsSetOne( self.bb, index ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_3set(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_3set(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set"); + + /* "bx/bitset.pyx":206 + * return binBitsReadOne( self.bb, index ) + * def set( self, index ): + * bb_check_index( self, index ) # <<<<<<<<<<<<<< + * binBitsSetOne( self.bb, index ) + * def clear( self, index ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_index(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":207 + * def set( self, index ): + * bb_check_index( self, index ) + * binBitsSetOne( self.bb, index ) # <<<<<<<<<<<<<< + * def clear( self, index ): + * bb_check_index( self, index ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + binBitsSetOne(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":208 + * bb_check_index( self, index ) + * binBitsSetOne( self.bb, index ) + * def clear( self, index ): # <<<<<<<<<<<<<< + * bb_check_index( self, index ) + * binBitsClearOne( self.bb, index ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_4clear(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_4clear(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("clear"); + + /* "bx/bitset.pyx":209 + * binBitsSetOne( self.bb, index ) + * def clear( self, index ): + * bb_check_index( self, index ) # <<<<<<<<<<<<<< + * binBitsClearOne( self.bb, index ) + * def set_range( self, int start, count ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_index(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":210 + * def clear( self, index ): + * bb_check_index( self, index ) + * binBitsClearOne( self.bb, index ) # <<<<<<<<<<<<<< + * def set_range( self, int start, count ): + * bb_check_range_count( self, start, count ) + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + binBitsClearOne(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":211 + * bb_check_index( self, index ) + * binBitsClearOne( self.bb, index ) + * def set_range( self, int start, count ): # <<<<<<<<<<<<<< + * bb_check_range_count( self, start, count ) + * binBitsSetRange( self.bb, start, count ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_5set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_5set_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + PyObject *__pyx_v_count = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__count,0}; + __Pyx_RefNannySetupContext("set_range"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("set_range", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_count = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_range", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bitset.pyx":212 + * binBitsClearOne( self.bb, index ) + * def set_range( self, int start, count ): + * bb_check_range_count( self, start, count ) # <<<<<<<<<<<<<< + * binBitsSetRange( self.bb, start, count ) + * def count_range( self, start, count ): + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_2bx_6bitset_bb_check_range_count(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_t_1, __pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/bitset.pyx":213 + * def set_range( self, int start, count ): + * bb_check_range_count( self, start, count ) + * binBitsSetRange( self.bb, start, count ) # <<<<<<<<<<<<<< + * def count_range( self, start, count ): + * bb_check_range_count( self, start, count ) + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_count); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + binBitsSetRange(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_v_start, __pyx_t_3); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.set_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":214 + * bb_check_range_count( self, start, count ) + * binBitsSetRange( self.bb, start, count ) + * def count_range( self, start, count ): # <<<<<<<<<<<<<< + * bb_check_range_count( self, start, count ) + * return binBitsCountRange( self.bb, start, count ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_6count_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_6count_range(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_count = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__count,0}; + __Pyx_RefNannySetupContext("count_range"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__count); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("count_range", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count_range") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_count = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("count_range", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.count_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/bitset.pyx":215 + * binBitsSetRange( self.bb, start, count ) + * def count_range( self, start, count ): + * bb_check_range_count( self, start, count ) # <<<<<<<<<<<<<< + * return binBitsCountRange( self.bb, start, count ) + * def next_set( self, start ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_range_count(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_start, __pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":216 + * def count_range( self, start, count ): + * bb_check_range_count( self, start, count ) + * return binBitsCountRange( self.bb, start, count ) # <<<<<<<<<<<<<< + * def next_set( self, start ): + * bb_check_start( self, start ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_count); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(binBitsCountRange(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.count_range", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":217 + * bb_check_range_count( self, start, count ) + * return binBitsCountRange( self.bb, start, count ) + * def next_set( self, start ): # <<<<<<<<<<<<<< + * bb_check_start( self, start ) + * return binBitsFindSet( self.bb, start ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_7next_set(PyObject *__pyx_v_self, PyObject *__pyx_v_start); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_7next_set(PyObject *__pyx_v_self, PyObject *__pyx_v_start) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("next_set"); + + /* "bx/bitset.pyx":218 + * return binBitsCountRange( self.bb, start, count ) + * def next_set( self, start ): + * bb_check_start( self, start ) # <<<<<<<<<<<<<< + * return binBitsFindSet( self.bb, start ) + * def next_clear( self, start ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_start(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":219 + * def next_set( self, start ): + * bb_check_start( self, start ) + * return binBitsFindSet( self.bb, start ) # <<<<<<<<<<<<<< + * def next_clear( self, start ): + * bb_check_start( self, start ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(binBitsFindSet(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.next_set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":220 + * bb_check_start( self, start ) + * return binBitsFindSet( self.bb, start ) + * def next_clear( self, start ): # <<<<<<<<<<<<<< + * bb_check_start( self, start ) + * return binBitsFindClear( self.bb, start ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_8next_clear(PyObject *__pyx_v_self, PyObject *__pyx_v_start); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_8next_clear(PyObject *__pyx_v_self, PyObject *__pyx_v_start) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("next_clear"); + + /* "bx/bitset.pyx":221 + * return binBitsFindSet( self.bb, start ) + * def next_clear( self, start ): + * bb_check_start( self, start ) # <<<<<<<<<<<<<< + * return binBitsFindClear( self.bb, start ) + * property size: + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_start(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":222 + * def next_clear( self, start ): + * bb_check_start( self, start ) + * return binBitsFindClear( self.bb, start ) # <<<<<<<<<<<<<< + * property size: + * def __get__( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(binBitsFindClear(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, __pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.next_clear", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":224 + * return binBitsFindClear( self.bb, start ) + * property size: + * def __get__( self ): # <<<<<<<<<<<<<< + * return self.bb.size + * property bin_size: + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_4size___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_4size___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/bitset.pyx":225 + * property size: + * def __get__( self ): + * return self.bb.size # <<<<<<<<<<<<<< + * property bin_size: + * def __get__( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":227 + * return self.bb.size + * property bin_size: + * def __get__( self ): # <<<<<<<<<<<<<< + * return self.bb.bin_size + * def iand( self, BinnedBitSet other ): + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_8bin_size___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_8bin_size___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/bitset.pyx":228 + * property bin_size: + * def __get__( self ): + * return self.bb.bin_size # <<<<<<<<<<<<<< + * def iand( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb->bin_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.bin_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":229 + * def __get__( self ): + * return self.bb.bin_size + * def iand( self, BinnedBitSet other ): # <<<<<<<<<<<<<< + * bb_check_same_size( self, other ) + * binBitsAnd( self.bb, other.bb ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_9iand(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_9iand(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("iand"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_2bx_6bitset_BinnedBitSet, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":230 + * return self.bb.bin_size + * def iand( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) # <<<<<<<<<<<<<< + * binBitsAnd( self.bb, other.bb ) + * def ior( self, BinnedBitSet other ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_same_size(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), ((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_other)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":231 + * def iand( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) + * binBitsAnd( self.bb, other.bb ) # <<<<<<<<<<<<<< + * def ior( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) + */ + binBitsAnd(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, ((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_other)->bb); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.iand", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":232 + * bb_check_same_size( self, other ) + * binBitsAnd( self.bb, other.bb ) + * def ior( self, BinnedBitSet other ): # <<<<<<<<<<<<<< + * bb_check_same_size( self, other ) + * binBitsOr( self.bb, other.bb ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_10ior(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_10ior(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ior"); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_2bx_6bitset_BinnedBitSet, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":233 + * binBitsAnd( self.bb, other.bb ) + * def ior( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) # <<<<<<<<<<<<<< + * binBitsOr( self.bb, other.bb ) + * def invert( self ): + */ + __pyx_t_1 = __pyx_f_2bx_6bitset_bb_check_same_size(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self), ((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_other)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/bitset.pyx":234 + * def ior( self, BinnedBitSet other ): + * bb_check_same_size( self, other ) + * binBitsOr( self.bb, other.bb ) # <<<<<<<<<<<<<< + * def invert( self ): + * binBitsNot( self.bb ) + */ + binBitsOr(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb, ((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_other)->bb); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.bitset.BinnedBitSet.ior", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/bitset.pyx":235 + * bb_check_same_size( self, other ) + * binBitsOr( self.bb, other.bb ) + * def invert( self ): # <<<<<<<<<<<<<< + * binBitsNot( self.bb ) + */ + +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_11invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_6bitset_12BinnedBitSet_11invert(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("invert"); + + /* "bx/bitset.pyx":236 + * binBitsOr( self.bb, other.bb ) + * def invert( self ): + * binBitsNot( self.bb ) # <<<<<<<<<<<<<< + */ + binBitsNot(((struct __pyx_obj_2bx_6bitset_BinnedBitSet *)__pyx_v_self)->bb); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_6bitset_BitSet(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_2bx_6bitset_6BitSet___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_6bitset_BitSet(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_2bx_6bitset_6BitSet_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_2bx_6bitset_BitSet(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_2bx_6bitset_6BitSet_size(PyObject *o, void *x) { + return __pyx_pf_2bx_6bitset_6BitSet_4size___get__(o); +} + +static PyMethodDef __pyx_methods_2bx_6bitset_BitSet[] = { + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_2set, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_3clear, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clone"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_4clone, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_range"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_5set_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_6get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("count_range"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_7count_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("next_set"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_8next_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("next_clear"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_9next_clear, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iand"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_10iand, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ior"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_11ior, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ixor"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_12ixor, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("invert"), (PyCFunction)__pyx_pf_2bx_6bitset_6BitSet_13invert, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6bitset_BitSet[] = { + {(char *)"size", __pyx_getprop_2bx_6bitset_6BitSet_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BitSet = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + __pyx_pf_2bx_6bitset_6BitSet_17__invert__, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + __pyx_pf_2bx_6bitset_6BitSet_15__iand__, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + __pyx_pf_2bx_6bitset_6BitSet_16__ior__, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BitSet = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_6bitset_BitSet, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BitSet = { + 0, /*mp_length*/ + __pyx_pf_2bx_6bitset_6BitSet_14__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BitSet = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6bitset_BitSet = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bitset.BitSet"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6bitset_BitSet), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6bitset_BitSet, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BitSet, /*tp_as_number*/ + &__pyx_tp_as_sequence_BitSet, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BitSet, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BitSet, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6bitset_BitSet, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6bitset_BitSet, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6bitset_BitSet, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_6bitset_BinnedBitSet(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_2bx_6bitset_12BinnedBitSet___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_6bitset_BinnedBitSet(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_2bx_6bitset_BinnedBitSet(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_2bx_6bitset_12BinnedBitSet_size(PyObject *o, void *x) { + return __pyx_pf_2bx_6bitset_12BinnedBitSet_4size___get__(o); +} + +static PyObject *__pyx_getprop_2bx_6bitset_12BinnedBitSet_bin_size(PyObject *o, void *x) { + return __pyx_pf_2bx_6bitset_12BinnedBitSet_8bin_size___get__(o); +} + +static PyMethodDef __pyx_methods_2bx_6bitset_BinnedBitSet[] = { + {__Pyx_NAMESTR("__dealloc"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_1__dealloc, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_3set, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("clear"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_4clear, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_range"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_5set_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("count_range"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_6count_range, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("next_set"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_7next_set, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("next_clear"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_8next_clear, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("iand"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_9iand, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ior"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_10ior, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("invert"), (PyCFunction)__pyx_pf_2bx_6bitset_12BinnedBitSet_11invert, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_6bitset_BinnedBitSet[] = { + {(char *)"size", __pyx_getprop_2bx_6bitset_12BinnedBitSet_size, 0, 0, 0}, + {(char *)"bin_size", __pyx_getprop_2bx_6bitset_12BinnedBitSet_bin_size, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BinnedBitSet = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BinnedBitSet = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_2bx_6bitset_BinnedBitSet, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BinnedBitSet = { + 0, /*mp_length*/ + __pyx_pf_2bx_6bitset_12BinnedBitSet_2__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BinnedBitSet = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_6bitset_BinnedBitSet = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.bitset.BinnedBitSet"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_6bitset_BinnedBitSet), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_6bitset_BinnedBitSet, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BinnedBitSet, /*tp_as_number*/ + &__pyx_tp_as_sequence_BinnedBitSet, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BinnedBitSet, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BinnedBitSet, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_6bitset_BinnedBitSet, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_6bitset_BinnedBitSet, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_6bitset_BinnedBitSet, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bitset"), + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, + {&__pyx_n_s__MAX, __pyx_k__MAX, sizeof(__pyx_k__MAX), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__bitCount, __pyx_k__bitCount, sizeof(__pyx_k__bitCount), 0, 0, 1, 1}, + {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__granularity, __pyx_k__granularity, sizeof(__pyx_k__granularity), 0, 0, 1, 1}, + {&__pyx_n_s__iand, __pyx_k__iand, sizeof(__pyx_k__iand), 0, 0, 1, 1}, + {&__pyx_n_s__invert, __pyx_k__invert, sizeof(__pyx_k__invert), 0, 0, 1, 1}, + {&__pyx_n_s__ior, __pyx_k__ior, sizeof(__pyx_k__ior), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/bitset.pyx":97 + * cdef inline b_check_same_size( BitSet b, BitSet other ): + * if b.bitCount != other.bitCount: + * raise ValueError( "BitSets must have the same size" ) # <<<<<<<<<<<<<< + * + * ## ---- BitSet -------------------------------------------------------------- + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "bx/bitset.pyx":188 + * cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + * if bb.bb.size != other.bb.size: + * raise ValueError( "BitSets must have the same size" ) # <<<<<<<<<<<<<< + * + * ## ---- BinnedBitSet -------------------------------------------------------- + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_536870912 = PyInt_FromLong(536870912); if (unlikely(!__pyx_int_536870912)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbitset(void); /*proto*/ +PyMODINIT_FUNC initbitset(void) +#else +PyMODINIT_FUNC PyInit_bitset(void); /*proto*/ +PyMODINIT_FUNC PyInit_bitset(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bitset(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bitset"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__bitset) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_6bitset_BitSet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BitSet", (PyObject *)&__pyx_type_2bx_6bitset_BitSet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6bitset_BitSet = &__pyx_type_2bx_6bitset_BitSet; + if (PyType_Ready(&__pyx_type_2bx_6bitset_BinnedBitSet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BinnedBitSet", (PyObject *)&__pyx_type_2bx_6bitset_BinnedBitSet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_6bitset_BinnedBitSet = &__pyx_type_2bx_6bitset_BinnedBitSet; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/bitset.pyx":102 + * + * # Maximum value of a signed 32 bit integer ( 2**31 - 1 ) + * cdef int MAX_INT = 2147483647 # <<<<<<<<<<<<<< + * + * cdef class BitSet: + */ + __pyx_v_2bx_6bitset_MAX_INT = 2147483647; + + /* "bx/bitset.pyx":192 + * ## ---- BinnedBitSet -------------------------------------------------------- + * + * MAX=512*1024*1024 # <<<<<<<<<<<<<< + * + * cdef class BinnedBitSet: + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MAX, __pyx_int_536870912) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/bitset.pyx":196 + * cdef class BinnedBitSet: + * cdef BinBits * bb + * def __cinit__( self, size=MAX, granularity=1024 ): # <<<<<<<<<<<<<< + * if size > MAX_INT: + * raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_11 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/bitset.pyx":1 + * """ # <<<<<<<<<<<<<< + * Compact mutable sequences of bits (vectors of 0s and 1s) supporting various + * boolean operations, and a "binned" variation which stores long runs of + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.bitset", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.bitset"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bitset.pyx b/code/utilities/CPAT-1.2.2/lib/bx/bitset.pyx new file mode 100755 index 0000000..a35df71 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bitset.pyx @@ -0,0 +1,236 @@ +""" +Compact mutable sequences of bits (vectors of 0s and 1s) supporting various +boolean operations, and a "binned" variation which stores long runs of +identical bits compactly. + +Because the binned implementation avoids a lot of memory allocation and access +when working with either small subregions of the total interval or setting / +testing spans larger than the bin size, it can be much faster. +""" + +cdef extern from "common.h": + ctypedef int boolean + +cdef extern from "bits.h": + ctypedef unsigned char Bits + # Allocate bits. + Bits * bitAlloc( int bitCount ) + # Clone bits. + Bits * bitClone(Bits* orig, int bitCount ) + # Free bits. + void bitFree(Bits **pB) + # Set a single bit. + void bitSetOne(Bits *b, int bitIx) + # Clear a single bit. + void bitClearOne(Bits *b, int bitIx) + # Set a range of bits. + void bitSetRange(Bits *b, int startIx, int bitCount) + # Read a single bit. + int bitReadOne(Bits *b, int bitIx) + # Count number of bits set in range. + int bitCountRange(Bits *b, int startIx, int bitCount) + # Find the index of the the next set bit. + int bitFindSet(Bits *b, int startIx, int bitCount) + # Find the index of the the next clear bit. + int bitFindClear(Bits *b, int startIx, int bitCount) + # Clear many bits. + void bitClear(Bits *b, int bitCount) + # And two bitmaps. Put result in a. + void bitAnd(Bits *a, Bits *b, int bitCount) + # Or two bitmaps. Put result in a. + void bitOr(Bits *a, Bits *b, int bitCount) + # Xor two bitmaps. Put result in a. + void bitXor(Bits *a, Bits *b, int bitCount) + # Flip all bits in a. + void bitNot(Bits *a, int bitCount) + ## # Print part or all of bit map as a string of 0s and 1s. Mostly useful for + ## void bitPrint(Bits *a, int startIx, int bitCount, FILE* out) + +cdef extern from "binBits.h": + struct BinBits: + int size + int bin_size + int nbins + Bits ** bins + BinBits* binBitsAlloc( int size, int granularity ) + void binBitsFree( BinBits * bb ) + int binBitsReadOne( BinBits * bb, int pos ) + void binBitsSetOne( BinBits * bb, int pos ) + void binBitsClearOne( BinBits * bb, int pos ) + void binBitsSetRange( BinBits *bb, int start, int size ) + int binBitsCountRange( BinBits *bb, int start, int size ) + int binBitsFindSet( BinBits *bb, int start ) + int binBitsFindClear( BinBits *bb, int start ) + void binBitsAnd( BinBits *bb1, BinBits *bb2 ) + void binBitsOr( BinBits *bb1, BinBits *bb2 ) + void binBitsNot( BinBits *bb ) + +## ---- Forward declerations ------------------------------------------------ + +cdef class BitSet +cdef class BinnedBitSet + +## ---- BitSet bounds checking ---------------------------------------------- + +cdef inline b_check_index( BitSet b, index ): + if index < 0: + raise IndexError( "BitSet index (%d) must be non-negative." % index ) + if index >= b.bitCount: + raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, b.bitCount ) ) + +cdef inline b_check_range( BitSet b, start, end ): + b_check_index( b, start ) + if end < start: + raise IndexError( "Range end (%d) must be greater than range start(%d)." % ( end, start ) ) + if end > b.bitCount: + raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( end, b.bitCount ) ) + +cdef inline b_check_range_count( BitSet b, start, count ): + b_check_index( b, start ) + if count < 0: + raise IndexError( "Count (%d) must be non-negative." % count ) + if start + count > b.bitCount: + raise IndexError( "End %d is larger than the size of this BitSet (%d)." % ( start + count, b.bitCount ) ) + +cdef inline b_check_same_size( BitSet b, BitSet other ): + if b.bitCount != other.bitCount: + raise ValueError( "BitSets must have the same size" ) + +## ---- BitSet -------------------------------------------------------------- + +# Maximum value of a signed 32 bit integer ( 2**31 - 1 ) +cdef int MAX_INT = 2147483647 + +cdef class BitSet: + cdef Bits * bits + cdef int bitCount + def __cinit__( self, bitCount ): + if bitCount > MAX_INT: + raise ValueError( "%d is larger than the maximum BitSet size of %d." % ( bitCount, MAX_INT ) ) + self.bitCount = bitCount + self.bits = bitAlloc( bitCount ) + def __dealloc__( self ): + bitFree( & self.bits ) + property size: + def __get__( self ): + return self.bitCount + def set( self, index ): + b_check_index( self, index ) + bitSetOne( self.bits, index ) + def clear( self, index ): + b_check_index( self, index ) + bitClearOne( self.bits, index ) + def clone( self ): + other = BitSet( self.bitCount ) + other.ior( self ) + return other + def set_range( self, start, count ): + b_check_range_count( self, start, count ) + bitSetRange( self.bits, start, count ) + def get( self, index ): + b_check_index( self, index ) + return bitReadOne( self.bits, index ); + def count_range( self, start=0, count=None ): + if count == None: + count = self.bitCount - start + b_check_range_count( self, start, count ) + return bitCountRange( self.bits, start, count ) + def next_set( self, start, end=None ): + if end == None: + end = self.bitCount + b_check_range( self, start, end ) + return bitFindSet( self.bits, start, end ) + def next_clear( self, start, end=None ): + if end == None: + end = self.bitCount + b_check_range( self, start, end ) + return bitFindClear( self.bits, start, end ) + def iand( self, BitSet other ): + b_check_same_size( self, other ) + bitAnd( self.bits, other.bits, self.bitCount ) + def ior( self, BitSet other ): + b_check_same_size( self, other ) + bitOr( self.bits, other.bits, self.bitCount ) + def ixor( self, BitSet other ): + b_check_same_size( self, other ) + bitXor( self.bits, other.bits, self.bitCount ) + def invert( self ): + bitNot( self.bits, self.bitCount) + def __getitem__( self, index ): + return self.get( index ) + def __iand__( self, other ): + self.iand( other ) + return self + def __ior__( self, other ): + self.ior( other ) + return self + def __invert__( self ): + self.invert() + return self + +## ---- BinnedBitSet bounds checking ---------------------------------------- + +cdef inline bb_check_index( BinnedBitSet bb, index ): + if index < 0: + raise IndexError( "BitSet index (%d) must be non-negative." % index ) + if index >= bb.bb.size: + raise IndexError( "%d is larger than the size of this BitSet (%d)." % ( index, bb.bb.size ) ) +cdef inline bb_check_start( BinnedBitSet bb, start ): + bb_check_index( bb, start ) +cdef inline bb_check_range_count( BinnedBitSet bb, start, count ): + bb_check_index( bb, start ) + if count < 0: + raise IndexError( "Count (%d) must be non-negative." % count ) + if start + count > bb.bb.size: + raise IndexError( "End (%d) is larger than the size of this BinnedBitSet (%d)." % ( start + count, bb.bb.size ) ) +cdef inline bb_check_same_size( BinnedBitSet bb, BinnedBitSet other ): + if bb.bb.size != other.bb.size: + raise ValueError( "BitSets must have the same size" ) + +## ---- BinnedBitSet -------------------------------------------------------- + +MAX=512*1024*1024 + +cdef class BinnedBitSet: + cdef BinBits * bb + def __cinit__( self, size=MAX, granularity=1024 ): + if size > MAX_INT: + raise ValueError( "%d is larger than the maximum BinnedBitSet size of %d." % ( size, MAX_INT ) ) + self.bb = binBitsAlloc( size, granularity ) + def __dealloc( self ): + binBitsFree( self.bb ); + def __getitem__( self, index ): + bb_check_index( self, index ) + return binBitsReadOne( self.bb, index ) + def set( self, index ): + bb_check_index( self, index ) + binBitsSetOne( self.bb, index ) + def clear( self, index ): + bb_check_index( self, index ) + binBitsClearOne( self.bb, index ) + def set_range( self, int start, count ): + bb_check_range_count( self, start, count ) + binBitsSetRange( self.bb, start, count ) + def count_range( self, start, count ): + bb_check_range_count( self, start, count ) + return binBitsCountRange( self.bb, start, count ) + def next_set( self, start ): + bb_check_start( self, start ) + return binBitsFindSet( self.bb, start ) + def next_clear( self, start ): + bb_check_start( self, start ) + return binBitsFindClear( self.bb, start ) + property size: + def __get__( self ): + return self.bb.size + property bin_size: + def __get__( self ): + return self.bb.bin_size + def iand( self, BinnedBitSet other ): + bb_check_same_size( self, other ) + binBitsAnd( self.bb, other.bb ) + def ior( self, BinnedBitSet other ): + bb_check_same_size( self, other ) + binBitsOr( self.bb, other.bb ) + def invert( self ): + binBitsNot( self.bb ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bitset_builders.py b/code/utilities/CPAT-1.2.2/lib/bx/bitset_builders.py new file mode 100755 index 0000000..47bb9d9 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bitset_builders.py @@ -0,0 +1,155 @@ +""" +Support for creating dictionaries of `Bitset`s / `BinnedBitset`s from text +files containg sets of "covered" intervals in sequences (e.g. `BED`_ files). + +.. BED: http://genome.ucsc.edu/FAQ/FAQformat.html#format1 +""" + +from warnings import warn +from bx.bitset import * +import re + +def binned_bitsets_from_file( f, chrom_col=0, start_col=1, end_col=2, strand_col=5, upstream_pad=0, downstream_pad=0, lens={} ): + """ + Read a file into a dictionary of bitsets. The defaults arguments + + - 'f' should be a file like object (or any iterable containing strings) + - 'chrom_col', 'start_col', and 'end_col' must exist in each line. + - 'strand_col' is optional, any line without it will be assumed to be '+' + - if 'lens' is provided bitset sizes will be looked up from it, otherwise + chromosomes will be assumed to be the maximum size + """ + last_chrom = None + last_bitset = None + bitsets = dict() + for line in f: + if line.startswith("#") or line.isspace(): + continue + fields = line.split() + strand = "+" + if len(fields) > strand_col: + if fields[strand_col] == "-": strand = "-" + chrom = fields[chrom_col] + if chrom != last_chrom: + if chrom not in bitsets: + if chrom in lens: + size = lens[chrom] + else: + size = MAX + bitsets[chrom] = BinnedBitSet( size ) + last_chrom = chrom + last_bitset = bitsets[chrom] + start, end = int( fields[start_col] ), int( fields[end_col] ) + if upstream_pad: start = max( 0, start - upstream_pad ) + if downstream_pad: end = min( size, end + downstream_pad ) + if start > end: warn( "Interval start after end!" ) + last_bitset.set_range( start, end-start ) + return bitsets + +def binned_bitsets_from_bed_file( f, chrom_col=0, start_col=1, end_col=2, strand_col=5, upstream_pad=0, downstream_pad=0, lens={} ): + """ + Read a file into a dictionary of bitsets. The defaults arguments + + - 'f' should be a file like object (or any iterable containing strings) + - 'chrom_col', 'start_col', and 'end_col' must exist in each line. + - 'strand_col' is optional, any line without it will be assumed to be '+' + - if 'lens' is provided bitset sizes will be looked up from it, otherwise + chromosomes will be assumed to be the maximum size + """ + last_chrom = None + last_bitset = None + bitsets = dict() + offset = 0 + for line in f: + if line.startswith("#") or line.isspace(): + continue + # Ignore browser lines completely + if line.startswith( "browser" ): + continue + # Need to check track lines due to the offset + if line.startswith( "track" ): + m = re.search( "offset=(\d+)", line ) + if m and m.group( 1 ): + offset = int( m.group(1) ) + continue + fields = line.split() + strand = "+" + if len(fields) > strand_col: + if fields[strand_col] == "-": strand = "-" + chrom = fields[chrom_col] + if chrom != last_chrom: + if chrom not in bitsets: + if chrom in lens: + size = lens[chrom] + else: + size = MAX + bitsets[chrom] = BinnedBitSet( size ) + last_chrom = chrom + last_bitset = bitsets[chrom] + start, end = int( fields[start_col] ) + offset, int( fields[end_col] ) + offset + ## # Switch to '+' strand coordinates if not already + ## if strand == '-': + ## start = size - end + ## end = size - start + if upstream_pad: start = max( 0, start - upstream_pad ) + if downstream_pad: end = min( size, end + downstream_pad ) + if start > end: warn( "Interval start after end!" ) + last_bitset.set_range( start, end-start ) + return bitsets + +def binned_bitsets_proximity( f, chrom_col=0, start_col=1, end_col=2, strand_col=5, upstream=0, downstream=0 ): + """Read a file into a dictionary of bitsets""" + last_chrom = None + last_bitset = None + bitsets = dict() + for line in f: + if line.startswith("#"): continue +# print "input=%s" % ( line ), + fields = line.split() + strand = "+" + if len(fields) >= strand_col + 1: + if fields[strand_col] == "-": strand = "-" + chrom = fields[chrom_col] + if chrom != last_chrom: + if chrom not in bitsets: + bitsets[chrom] = BinnedBitSet( MAX ) + last_chrom = chrom + last_bitset = bitsets[chrom] + start, end = int( fields[start_col] ), int( fields[end_col] ) + if strand == "+": + if upstream: start = max( 0, start - upstream ) + if downstream: end = min( MAX, end + downstream ) + if strand == "-": + if upstream: end = min( MAX, end + upstream ) + if downstream: start = max( 0, start - downstream ) +# print "set: start=%d\tend=%d" % ( start, end ) + if end-start > 0: + last_bitset.set_range( start, end-start ) + return bitsets + +def binned_bitsets_from_list( list=[] ): + """Read a list into a dictionary of bitsets""" + last_chrom = None + last_bitset = None + bitsets = dict() + for l in list: + chrom = l[0] + if chrom != last_chrom: + if chrom not in bitsets: + bitsets[chrom] = BinnedBitSet(MAX) + last_chrom = chrom + last_bitset = bitsets[chrom] + start, end = int( l[1] ), int( l[2] ) + last_bitset.set_range( start, end - start ) + return bitsets + +def binned_bitsets_by_chrom( f, chrom, chrom_col=0, start_col=1, end_col=2): + """Read a file by chrom name into a bitset""" + bitset = BinnedBitSet( MAX ) + for line in f: + if line.startswith("#"): continue + fields = line.split() + if fields[chrom_col] == chrom: + start, end = int( fields[start_col] ), int( fields[end_col] ) + bitset.set_range( start, end-start ) + return bitset diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bitset_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/bitset_tests.py new file mode 100755 index 0000000..9413fe2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bitset_tests.py @@ -0,0 +1,112 @@ +""" +Tests for `bx.bitset`. +""" + +import bx.bitset +import unittest + +class AbstractTests( object ): + + def assert_bits( self, bits, list ): + assert bits.size == len( list ), "Bitset size and verification list size do not match" + for i in range( bits.size ): + self.assertEquals( bits[i], list[i] ) + + def test_overflow_create( self ): + self.assertRaises( ValueError, self.new_bits, 4000000000 ) + + def test_overflow_access( self ): + bits = self.new_bits( 100 ) + self.assertRaises( IndexError, bits.set, -5 ) + self.assertRaises( IndexError, bits.set, 110 ) + + def test_access( self ): + # Create and assert empty + bits = self.new_bits( 100 ) + l = [ 0 ] * 100 + self.assert_bits( bits, l ) + # Set some positions + for pos in ( 11, 14, 70, 16 ): + bits.set( pos ) + l[ pos ] = 1 + # Clear some positions + for pos in ( 14, 80, 16 ): + bits.clear( pos ) + l[ pos ] = 0 + self.assert_bits( bits, l ) + + def test_range_access( self ): + # Create and assert empty + bits = self.new_bits( 100 ) + l = [ 0 ] * 100 + self.assert_bits( bits, l ) + # Set some positions + for b, e in ( ( 11, 14 ), (20,75), (90,99) ): + bits.set_range( b, e-b) + for pos in range( b, e ): l[ pos ] = 1 + self.assert_bits( bits, l ) + + def test_count( self ): + # Create and assert empty + bits = self.new_bits( 100 ) + # Set some positions + for b, e in ( ( 11, 14 ), (20,75), (90,100) ): + bits.set_range( b, e-b) + self.assertEquals( bits.count_range( 0, 0 ), 0 ) + self.assertEquals( bits.count_range( 0, 20 ), 3 ) + self.assertEquals( bits.count_range( 25, 25 ), 25 ) + self.assertEquals( bits.count_range( 80, 20 ), 10 ) + self.assertEquals( bits.count_range( 0, 100 ), 68 ) + + def test_find( self ): + # Create and assert empty + bits = self.new_bits( 100 ) + # Set some positions + for b, e in ( ( 11, 14 ), (20,75), (90,100) ): + bits.set_range( b, e-b) + # Next set + self.assertEquals( bits.next_set( 0 ), 11 ) + self.assertEquals( bits.next_set( 13 ), 13 ) + self.assertEquals( bits.next_set( 15 ), 20 ) + # Next clear + self.assertEquals( bits.next_clear( 0 ), 0 ) + self.assertEquals( bits.next_clear( 11 ), 14 ) + self.assertEquals( bits.next_clear( 20 ), 75 ) + self.assertEquals( bits.next_clear( 92 ), 100 ) + + def test_and( self ): + bits1 = self.new_bits( 100 ) + bits2 = self.new_bits( 100 ) + bits1.set_range( 20, 40 ) + bits2.set_range( 50, 25 ) + bits1.iand( bits2 ) + l = [0]*100 + for i in range( 50, 60 ): l[i] = 1 + self.assert_bits( bits1, l ) + + def test_or( self ): + bits1 = self.new_bits( 100 ) + bits2 = self.new_bits( 100 ) + bits1.set_range( 20, 40 ) + bits2.set_range( 50, 25 ) + bits1.ior( bits2 ) + l = [0]*100 + for i in range( 20, 75 ): l[i] = 1 + self.assert_bits( bits1, l ) + + def test_not( self ): + bits = self.new_bits( 100 ) + bits.set_range( 20, 40 ) + bits.invert() + l = [1]*100 + for i in range( 20, 60 ): l[i] = 0 + self.assert_bits( bits, l ) + +class BitSetTests( AbstractTests, unittest.TestCase ): + def new_bits( self, size ): + return bx.bitset.BitSet( size ) + +class BinnedBitSetTests( AbstractTests, unittest.TestCase ): + def new_bits( self, size ): + granularity = size % 11 + return bx.bitset.BinnedBitSet( size, granularity ) \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/bitset_utils.py b/code/utilities/CPAT-1.2.2/lib/bx/bitset_utils.py new file mode 100755 index 0000000..104dc53 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/bitset_utils.py @@ -0,0 +1,74 @@ +""" +Utility functions for working with `Bitset`s and treating lists of (start,end) +as `Bitset`s. +""" + +from bx.bitset import * + +def bitset_intersect( ex1, ex2 ): + bits1 = list2bits( ex1 ) + bits2 = list2bits( ex2 ) + bits1.iand( bits2 ) + return bits2list( bits1 ) + +def bitset_subtract( ex1, ex2 ): + bits1 = list2bits( ex1 ) + bits2 = list2bits( ex2 ) + bits2.invert() + bits1.iand( bits2 ) + return bits2list( bits1 ) + +def list2bits( ex ): + bits = BinnedBitSet(MAX) + for start,end in ex: + bits.set_range( start, end - start ) + return bits + +def bits2list( bits ): + ex = [] + end = 0 + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + ex.append( (start, end) ) + return ex + +def bitset_complement( exons ): + bits = BinnedBitSet(MAX) + introns = [] + for start, end in exons: + bits.set_range( start, end - start ) + bits.invert() + + # only complement within the range of the list + ex_start = min( [a[0] for a in exons] ) + ex_end = max( [a[1] for a in exons] ) + end = ex_start + len = ex_end + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + if end > len: end = len + if start != end: + introns.append( (start,end ) ) + if end == len: break + return introns + +def bitset_interval_intersect( bits, istart, iend ): + rval = [] + end = istart + len = iend + while 1: + start = bits.next_set( end ) + if start >= len: break + end = bits.next_clear( start ) + if start != end: + rval.append( (start,end) ) + if end >= len: break + return rval + +def bitset_union( exons ): + bits = list2bits( exons ) + return bits2list( bits ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/cookbook/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/__init__.py new file mode 100755 index 0000000..3d79703 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/__init__.py @@ -0,0 +1,98 @@ +""" +Various useful utilities, mostly taken from the ASPN Python cookbook. +""" + +seq_types = type( () ), type( [] ) + +def flatten( *args ): + for arg in args: + if type( arg ) in seq_types: + for elem in arg: + for f in flatten( elem ): + yield f + else: + yield arg + +def cross_lists(*sets): + """Return the cross product of the arguments""" + wheels = map(iter, sets) + digits = [it.next() for it in wheels] + while True: + yield digits[:] + for i in range(len(digits)-1, -1, -1): + try: + digits[i] = wheels[i].next() + break + except StopIteration: + wheels[i] = iter(sets[i]) + digits[i] = wheels[i].next() + else: + break + +# Cached / memoized methods + +import types + +def cachedmethod(function): + return types.MethodType(Memoize(function), None) + + +class Memoize: + def __init__(self,function): + self._cache = {} + self._callable = function + + def __call__(self, *args, **kwds): + cache = self._cache + key = self._getKey(*args,**kwds) + try: return cache[key] + except KeyError: + cachedValue = cache[key] = self._callable(*args,**kwds) + return cachedValue + + def _getKey(self,*args,**kwds): + return kwds and (args, ImmutableDict(kwds)) or args + + +class memoized(object): + """Decorator that caches a function's return value each time it is called. + If called later with the same arguments, the cached value is returned, and + not re-evaluated. + """ + def __init__(self, func): + self.func = func + self.cache = {} + def __call__(self, *args): + try: + return self.cache[args] + except KeyError: + self.cache[args] = value = self.func(*args) + return value + except TypeError: + # uncachable -- for instance, passing a list as an argument. + # Better to not cache than to blow up entirely. + return self.func(*args) + def __repr__(self): + """Return the function's docstring.""" + return self.func.__doc__ + + +class ImmutableDict(dict): + '''A hashable dict.''' + + def __init__(self,*args,**kwds): + dict.__init__(self,*args,**kwds) + def __setitem__(self,key,value): + raise NotImplementedError, "dict is immutable" + def __delitem__(self,key): + raise NotImplementedError, "dict is immutable" + def clear(self): + raise NotImplementedError, "dict is immutable" + def setdefault(self,k,default=None): + raise NotImplementedError, "dict is immutable" + def popitem(self): + raise NotImplementedError, "dict is immutable" + def update(self,other): + raise NotImplementedError, "dict is immutable" + def __hash__(self): + return hash(tuple(self.iteritems())) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/cookbook/argparse.py b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/argparse.py new file mode 100755 index 0000000..32d948c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/argparse.py @@ -0,0 +1,2362 @@ +# Author: Steven J. Bethard . + +"""Command-line parsing library + +This module is an optparse-inspired command-line parsing library that: + + - handles both optional and positional arguments + - produces highly informative usage messages + - supports parsers that dispatch to sub-parsers + +The following is a simple usage example that sums integers from the +command-line and writes the result to a file:: + + parser = argparse.ArgumentParser( + description='sum the integers at the command line') + parser.add_argument( + 'integers', metavar='int', nargs='+', type=int, + help='an integer to be summed') + parser.add_argument( + '--log', default=sys.stdout, type=argparse.FileType('w'), + help='the file where the sum should be written') + args = parser.parse_args() + args.log.write('%s' % sum(args.integers)) + args.log.close() + +The module contains the following public classes: + + - ArgumentParser -- The main entry point for command-line parsing. As the + example above shows, the add_argument() method is used to populate + the parser with actions for optional and positional arguments. Then + the parse_args() method is invoked to convert the args at the + command-line into an object with attributes. + + - ArgumentError -- The exception raised by ArgumentParser objects when + there are errors with the parser's actions. Errors raised while + parsing the command-line are caught by ArgumentParser and emitted + as command-line messages. + + - FileType -- A factory for defining types of files to be created. As the + example above shows, instances of FileType are typically passed as + the type= argument of add_argument() calls. + + - Action -- The base class for parser actions. Typically actions are + selected by passing strings like 'store_true' or 'append_const' to + the action= argument of add_argument(). However, for greater + customization of ArgumentParser actions, subclasses of Action may + be defined and passed as the action= argument. + + - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, + ArgumentDefaultsHelpFormatter -- Formatter classes which + may be passed as the formatter_class= argument to the + ArgumentParser constructor. HelpFormatter is the default, + RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser + not to change the formatting for help text, and + ArgumentDefaultsHelpFormatter adds information about argument defaults + to the help. + +All other classes in this module are considered implementation details. +(Also note that HelpFormatter and RawDescriptionHelpFormatter are only +considered public as object names -- the API of the formatter objects is +still considered an implementation detail.) +""" + +__version__ = '1.2.1' +__all__ = [ + 'ArgumentParser', + 'ArgumentError', + 'ArgumentTypeError', + 'FileType', + 'HelpFormatter', + 'ArgumentDefaultsHelpFormatter', + 'RawDescriptionHelpFormatter', + 'RawTextHelpFormatter', + 'Namespace', + 'Action', + 'ONE_OR_MORE', + 'OPTIONAL', + 'PARSER', + 'REMAINDER', + 'SUPPRESS', + 'ZERO_OR_MORE', +] + + +import copy as _copy +import os as _os +import re as _re +import sys as _sys +import textwrap as _textwrap + +from gettext import gettext as _ + +try: + set +except NameError: + # for python < 2.4 compatibility (sets module is there since 2.3): + from sets import Set as set + +try: + basestring +except NameError: + basestring = str + +try: + sorted +except NameError: + # for python < 2.4 compatibility: + def sorted(iterable, reverse=False): + result = list(iterable) + result.sort() + if reverse: + result.reverse() + return result + + +def _callable(obj): + return hasattr(obj, '__call__') or hasattr(obj, '__bases__') + + +SUPPRESS = '==SUPPRESS==' + +OPTIONAL = '?' +ZERO_OR_MORE = '*' +ONE_OR_MORE = '+' +PARSER = 'A...' +REMAINDER = '...' +_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args' + +# ============================= +# Utility functions and classes +# ============================= + +class _AttributeHolder(object): + """Abstract base class that provides __repr__. + + The __repr__ method returns a string in the format:: + ClassName(attr=name, attr=name, ...) + The attributes are determined either by a class-level attribute, + '_kwarg_names', or by inspecting the instance __dict__. + """ + + def __repr__(self): + type_name = type(self).__name__ + arg_strings = [] + for arg in self._get_args(): + arg_strings.append(repr(arg)) + for name, value in self._get_kwargs(): + arg_strings.append('%s=%r' % (name, value)) + return '%s(%s)' % (type_name, ', '.join(arg_strings)) + + def _get_kwargs(self): + return sorted(self.__dict__.items()) + + def _get_args(self): + return [] + + +def _ensure_value(namespace, name, value): + if getattr(namespace, name, None) is None: + setattr(namespace, name, value) + return getattr(namespace, name) + + +# =============== +# Formatting Help +# =============== + +class HelpFormatter(object): + """Formatter for generating usage messages and argument help strings. + + Only the name of this class is considered a public API. All the methods + provided by the class are considered an implementation detail. + """ + + def __init__(self, + prog, + indent_increment=2, + max_help_position=24, + width=None): + + # default setting for width + if width is None: + try: + width = int(_os.environ['COLUMNS']) + except (KeyError, ValueError): + width = 80 + width -= 2 + + self._prog = prog + self._indent_increment = indent_increment + self._max_help_position = max_help_position + self._width = width + + self._current_indent = 0 + self._level = 0 + self._action_max_length = 0 + + self._root_section = self._Section(self, None) + self._current_section = self._root_section + + self._whitespace_matcher = _re.compile(r'\s+') + self._long_break_matcher = _re.compile(r'\n\n\n+') + + # =============================== + # Section and indentation methods + # =============================== + def _indent(self): + self._current_indent += self._indent_increment + self._level += 1 + + def _dedent(self): + self._current_indent -= self._indent_increment + assert self._current_indent >= 0, 'Indent decreased below 0.' + self._level -= 1 + + class _Section(object): + + def __init__(self, formatter, parent, heading=None): + self.formatter = formatter + self.parent = parent + self.heading = heading + self.items = [] + + def format_help(self): + # format the indented section + if self.parent is not None: + self.formatter._indent() + join = self.formatter._join_parts + for func, args in self.items: + func(*args) + item_help = join([func(*args) for func, args in self.items]) + if self.parent is not None: + self.formatter._dedent() + + # return nothing if the section was empty + if not item_help: + return '' + + # add the heading if the section was non-empty + if self.heading is not SUPPRESS and self.heading is not None: + current_indent = self.formatter._current_indent + heading = '%*s%s:\n' % (current_indent, '', self.heading) + else: + heading = '' + + # join the section-initial newline, the heading and the help + return join(['\n', heading, item_help, '\n']) + + def _add_item(self, func, args): + self._current_section.items.append((func, args)) + + # ======================== + # Message building methods + # ======================== + def start_section(self, heading): + self._indent() + section = self._Section(self, self._current_section, heading) + self._add_item(section.format_help, []) + self._current_section = section + + def end_section(self): + self._current_section = self._current_section.parent + self._dedent() + + def add_text(self, text): + if text is not SUPPRESS and text is not None: + self._add_item(self._format_text, [text]) + + def add_usage(self, usage, actions, groups, prefix=None): + if usage is not SUPPRESS: + args = usage, actions, groups, prefix + self._add_item(self._format_usage, args) + + def add_argument(self, action): + if action.help is not SUPPRESS: + + # find all invocations + get_invocation = self._format_action_invocation + invocations = [get_invocation(action)] + for subaction in self._iter_indented_subactions(action): + invocations.append(get_invocation(subaction)) + + # update the maximum item length + invocation_length = max([len(s) for s in invocations]) + action_length = invocation_length + self._current_indent + self._action_max_length = max(self._action_max_length, + action_length) + + # add the item to the list + self._add_item(self._format_action, [action]) + + def add_arguments(self, actions): + for action in actions: + self.add_argument(action) + + # ======================= + # Help-formatting methods + # ======================= + def format_help(self): + help = self._root_section.format_help() + if help: + help = self._long_break_matcher.sub('\n\n', help) + help = help.strip('\n') + '\n' + return help + + def _join_parts(self, part_strings): + return ''.join([part + for part in part_strings + if part and part is not SUPPRESS]) + + def _format_usage(self, usage, actions, groups, prefix): + if prefix is None: + prefix = _('usage: ') + + # if usage is specified, use that + if usage is not None: + usage = usage % dict(prog=self._prog) + + # if no optionals or positionals are available, usage is just prog + elif usage is None and not actions: + usage = '%(prog)s' % dict(prog=self._prog) + + # if optionals and positionals are available, calculate usage + elif usage is None: + prog = '%(prog)s' % dict(prog=self._prog) + + # split optionals from positionals + optionals = [] + positionals = [] + for action in actions: + if action.option_strings: + optionals.append(action) + else: + positionals.append(action) + + # build full usage string + format = self._format_actions_usage + action_usage = format(optionals + positionals, groups) + usage = ' '.join([s for s in [prog, action_usage] if s]) + + # wrap the usage parts if it's too long + text_width = self._width - self._current_indent + if len(prefix) + len(usage) > text_width: + + # break usage into wrappable parts + part_regexp = r'\(.*?\)+|\[.*?\]+|\S+' + opt_usage = format(optionals, groups) + pos_usage = format(positionals, groups) + opt_parts = _re.findall(part_regexp, opt_usage) + pos_parts = _re.findall(part_regexp, pos_usage) + assert ' '.join(opt_parts) == opt_usage + assert ' '.join(pos_parts) == pos_usage + + # helper for wrapping lines + def get_lines(parts, indent, prefix=None): + lines = [] + line = [] + if prefix is not None: + line_len = len(prefix) - 1 + else: + line_len = len(indent) - 1 + for part in parts: + if line_len + 1 + len(part) > text_width: + lines.append(indent + ' '.join(line)) + line = [] + line_len = len(indent) - 1 + line.append(part) + line_len += len(part) + 1 + if line: + lines.append(indent + ' '.join(line)) + if prefix is not None: + lines[0] = lines[0][len(indent):] + return lines + + # if prog is short, follow it with optionals or positionals + if len(prefix) + len(prog) <= 0.75 * text_width: + indent = ' ' * (len(prefix) + len(prog) + 1) + if opt_parts: + lines = get_lines([prog] + opt_parts, indent, prefix) + lines.extend(get_lines(pos_parts, indent)) + elif pos_parts: + lines = get_lines([prog] + pos_parts, indent, prefix) + else: + lines = [prog] + + # if prog is long, put it on its own line + else: + indent = ' ' * len(prefix) + parts = opt_parts + pos_parts + lines = get_lines(parts, indent) + if len(lines) > 1: + lines = [] + lines.extend(get_lines(opt_parts, indent)) + lines.extend(get_lines(pos_parts, indent)) + lines = [prog] + lines + + # join lines into usage + usage = '\n'.join(lines) + + # prefix with 'usage:' + return '%s%s\n\n' % (prefix, usage) + + def _format_actions_usage(self, actions, groups): + # find group indices and identify actions in groups + group_actions = set() + inserts = {} + for group in groups: + try: + start = actions.index(group._group_actions[0]) + except ValueError: + continue + else: + end = start + len(group._group_actions) + if actions[start:end] == group._group_actions: + for action in group._group_actions: + group_actions.add(action) + if not group.required: + if start in inserts: + inserts[start] += ' [' + else: + inserts[start] = '[' + inserts[end] = ']' + else: + if start in inserts: + inserts[start] += ' (' + else: + inserts[start] = '(' + inserts[end] = ')' + for i in range(start + 1, end): + inserts[i] = '|' + + # collect all actions format strings + parts = [] + for i, action in enumerate(actions): + + # suppressed arguments are marked with None + # remove | separators for suppressed arguments + if action.help is SUPPRESS: + parts.append(None) + if inserts.get(i) == '|': + inserts.pop(i) + elif inserts.get(i + 1) == '|': + inserts.pop(i + 1) + + # produce all arg strings + elif not action.option_strings: + part = self._format_args(action, action.dest) + + # if it's in a group, strip the outer [] + if action in group_actions: + if part[0] == '[' and part[-1] == ']': + part = part[1:-1] + + # add the action string to the list + parts.append(part) + + # produce the first way to invoke the option in brackets + else: + option_string = action.option_strings[0] + + # if the Optional doesn't take a value, format is: + # -s or --long + if action.nargs == 0: + part = '%s' % option_string + + # if the Optional takes a value, format is: + # -s ARGS or --long ARGS + else: + default = action.dest.upper() + args_string = self._format_args(action, default) + part = '%s %s' % (option_string, args_string) + + # make it look optional if it's not required or in a group + if not action.required and action not in group_actions: + part = '[%s]' % part + + # add the action string to the list + parts.append(part) + + # insert things at the necessary indices + for i in sorted(inserts, reverse=True): + parts[i:i] = [inserts[i]] + + # join all the action items with spaces + text = ' '.join([item for item in parts if item is not None]) + + # clean up separators for mutually exclusive groups + open = r'[\[(]' + close = r'[\])]' + text = _re.sub(r'(%s) ' % open, r'\1', text) + text = _re.sub(r' (%s)' % close, r'\1', text) + text = _re.sub(r'%s *%s' % (open, close), r'', text) + text = _re.sub(r'\(([^|]*)\)', r'\1', text) + text = text.strip() + + # return the text + return text + + def _format_text(self, text): + if '%(prog)' in text: + text = text % dict(prog=self._prog) + text_width = self._width - self._current_indent + indent = ' ' * self._current_indent + return self._fill_text(text, text_width, indent) + '\n\n' + + def _format_action(self, action): + # determine the required width and the entry label + help_position = min(self._action_max_length + 2, + self._max_help_position) + help_width = self._width - help_position + action_width = help_position - self._current_indent - 2 + action_header = self._format_action_invocation(action) + + # ho nelp; start on same line and add a final newline + if not action.help: + tup = self._current_indent, '', action_header + action_header = '%*s%s\n' % tup + + # short action name; start on the same line and pad two spaces + elif len(action_header) <= action_width: + tup = self._current_indent, '', action_width, action_header + action_header = '%*s%-*s ' % tup + indent_first = 0 + + # long action name; start on the next line + else: + tup = self._current_indent, '', action_header + action_header = '%*s%s\n' % tup + indent_first = help_position + + # collect the pieces of the action help + parts = [action_header] + + # if there was help for the action, add lines of help text + if action.help: + help_text = self._expand_help(action) + help_lines = self._split_lines(help_text, help_width) + parts.append('%*s%s\n' % (indent_first, '', help_lines[0])) + for line in help_lines[1:]: + parts.append('%*s%s\n' % (help_position, '', line)) + + # or add a newline if the description doesn't end with one + elif not action_header.endswith('\n'): + parts.append('\n') + + # if there are any sub-actions, add their help as well + for subaction in self._iter_indented_subactions(action): + parts.append(self._format_action(subaction)) + + # return a single string + return self._join_parts(parts) + + def _format_action_invocation(self, action): + if not action.option_strings: + metavar, = self._metavar_formatter(action, action.dest)(1) + return metavar + + else: + parts = [] + + # if the Optional doesn't take a value, format is: + # -s, --long + if action.nargs == 0: + parts.extend(action.option_strings) + + # if the Optional takes a value, format is: + # -s ARGS, --long ARGS + else: + default = action.dest.upper() + args_string = self._format_args(action, default) + for option_string in action.option_strings: + parts.append('%s %s' % (option_string, args_string)) + + return ', '.join(parts) + + def _metavar_formatter(self, action, default_metavar): + if action.metavar is not None: + result = action.metavar + elif action.choices is not None: + choice_strs = [str(choice) for choice in action.choices] + result = '{%s}' % ','.join(choice_strs) + else: + result = default_metavar + + def format(tuple_size): + if isinstance(result, tuple): + return result + else: + return (result, ) * tuple_size + return format + + def _format_args(self, action, default_metavar): + get_metavar = self._metavar_formatter(action, default_metavar) + if action.nargs is None: + result = '%s' % get_metavar(1) + elif action.nargs == OPTIONAL: + result = '[%s]' % get_metavar(1) + elif action.nargs == ZERO_OR_MORE: + result = '[%s [%s ...]]' % get_metavar(2) + elif action.nargs == ONE_OR_MORE: + result = '%s [%s ...]' % get_metavar(2) + elif action.nargs == REMAINDER: + result = '...' + elif action.nargs == PARSER: + result = '%s ...' % get_metavar(1) + else: + formats = ['%s' for _ in range(action.nargs)] + result = ' '.join(formats) % get_metavar(action.nargs) + return result + + def _expand_help(self, action): + params = dict(vars(action), prog=self._prog) + for name in list(params): + if params[name] is SUPPRESS: + del params[name] + for name in list(params): + if hasattr(params[name], '__name__'): + params[name] = params[name].__name__ + if params.get('choices') is not None: + choices_str = ', '.join([str(c) for c in params['choices']]) + params['choices'] = choices_str + return self._get_help_string(action) % params + + def _iter_indented_subactions(self, action): + try: + get_subactions = action._get_subactions + except AttributeError: + pass + else: + self._indent() + for subaction in get_subactions(): + yield subaction + self._dedent() + + def _split_lines(self, text, width): + text = self._whitespace_matcher.sub(' ', text).strip() + return _textwrap.wrap(text, width) + + def _fill_text(self, text, width, indent): + text = self._whitespace_matcher.sub(' ', text).strip() + return _textwrap.fill(text, width, initial_indent=indent, + subsequent_indent=indent) + + def _get_help_string(self, action): + return action.help + + +class RawDescriptionHelpFormatter(HelpFormatter): + """Help message formatter which retains any formatting in descriptions. + + Only the name of this class is considered a public API. All the methods + provided by the class are considered an implementation detail. + """ + + def _fill_text(self, text, width, indent): + return ''.join([indent + line for line in text.splitlines(True)]) + + +class RawTextHelpFormatter(RawDescriptionHelpFormatter): + """Help message formatter which retains formatting of all help text. + + Only the name of this class is considered a public API. All the methods + provided by the class are considered an implementation detail. + """ + + def _split_lines(self, text, width): + return text.splitlines() + + +class ArgumentDefaultsHelpFormatter(HelpFormatter): + """Help message formatter which adds default values to argument help. + + Only the name of this class is considered a public API. All the methods + provided by the class are considered an implementation detail. + """ + + def _get_help_string(self, action): + help = action.help + if '%(default)' not in action.help: + if action.default is not SUPPRESS: + defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] + if action.option_strings or action.nargs in defaulting_nargs: + help += ' (default: %(default)s)' + return help + + +# ===================== +# Options and Arguments +# ===================== + +def _get_action_name(argument): + if argument is None: + return None + elif argument.option_strings: + return '/'.join(argument.option_strings) + elif argument.metavar not in (None, SUPPRESS): + return argument.metavar + elif argument.dest not in (None, SUPPRESS): + return argument.dest + else: + return None + + +class ArgumentError(Exception): + """An error from creating or using an argument (optional or positional). + + The string value of this exception is the message, augmented with + information about the argument that caused it. + """ + + def __init__(self, argument, message): + self.argument_name = _get_action_name(argument) + self.message = message + + def __str__(self): + if self.argument_name is None: + format = '%(message)s' + else: + format = 'argument %(argument_name)s: %(message)s' + return format % dict(message=self.message, + argument_name=self.argument_name) + + +class ArgumentTypeError(Exception): + """An error from trying to convert a command line string to a type.""" + pass + + +# ============== +# Action classes +# ============== + +class Action(_AttributeHolder): + """Information about how to convert command line strings to Python objects. + + Action objects are used by an ArgumentParser to represent the information + needed to parse a single argument from one or more strings from the + command line. The keyword arguments to the Action constructor are also + all attributes of Action instances. + + Keyword Arguments: + + - option_strings -- A list of command-line option strings which + should be associated with this action. + + - dest -- The name of the attribute to hold the created object(s) + + - nargs -- The number of command-line arguments that should be + consumed. By default, one argument will be consumed and a single + value will be produced. Other values include: + - N (an integer) consumes N arguments (and produces a list) + - '?' consumes zero or one arguments + - '*' consumes zero or more arguments (and produces a list) + - '+' consumes one or more arguments (and produces a list) + Note that the difference between the default and nargs=1 is that + with the default, a single value will be produced, while with + nargs=1, a list containing a single value will be produced. + + - const -- The value to be produced if the option is specified and the + option uses an action that takes no values. + + - default -- The value to be produced if the option is not specified. + + - type -- The type which the command-line arguments should be converted + to, should be one of 'string', 'int', 'float', 'complex' or a + callable object that accepts a single string argument. If None, + 'string' is assumed. + + - choices -- A container of values that should be allowed. If not None, + after a command-line argument has been converted to the appropriate + type, an exception will be raised if it is not a member of this + collection. + + - required -- True if the action must always be specified at the + command line. This is only meaningful for optional command-line + arguments. + + - help -- The help string describing the argument. + + - metavar -- The name to be used for the option's argument with the + help string. If None, the 'dest' value will be used as the name. + """ + + def __init__(self, + option_strings, + dest, + nargs=None, + const=None, + default=None, + type=None, + choices=None, + required=False, + help=None, + metavar=None): + self.option_strings = option_strings + self.dest = dest + self.nargs = nargs + self.const = const + self.default = default + self.type = type + self.choices = choices + self.required = required + self.help = help + self.metavar = metavar + + def _get_kwargs(self): + names = [ + 'option_strings', + 'dest', + 'nargs', + 'const', + 'default', + 'type', + 'choices', + 'help', + 'metavar', + ] + return [(name, getattr(self, name)) for name in names] + + def __call__(self, parser, namespace, values, option_string=None): + raise NotImplementedError(_('.__call__() not defined')) + + +class _StoreAction(Action): + + def __init__(self, + option_strings, + dest, + nargs=None, + const=None, + default=None, + type=None, + choices=None, + required=False, + help=None, + metavar=None): + if nargs == 0: + raise ValueError('nargs for store actions must be > 0; if you ' + 'have nothing to store, actions such as store ' + 'true or store const may be more appropriate') + if const is not None and nargs != OPTIONAL: + raise ValueError('nargs must be %r to supply const' % OPTIONAL) + super(_StoreAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=nargs, + const=const, + default=default, + type=type, + choices=choices, + required=required, + help=help, + metavar=metavar) + + def __call__(self, parser, namespace, values, option_string=None): + setattr(namespace, self.dest, values) + + +class _StoreConstAction(Action): + + def __init__(self, + option_strings, + dest, + const, + default=None, + required=False, + help=None, + metavar=None): + super(_StoreConstAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=0, + const=const, + default=default, + required=required, + help=help) + + def __call__(self, parser, namespace, values, option_string=None): + setattr(namespace, self.dest, self.const) + + +class _StoreTrueAction(_StoreConstAction): + + def __init__(self, + option_strings, + dest, + default=False, + required=False, + help=None): + super(_StoreTrueAction, self).__init__( + option_strings=option_strings, + dest=dest, + const=True, + default=default, + required=required, + help=help) + + +class _StoreFalseAction(_StoreConstAction): + + def __init__(self, + option_strings, + dest, + default=True, + required=False, + help=None): + super(_StoreFalseAction, self).__init__( + option_strings=option_strings, + dest=dest, + const=False, + default=default, + required=required, + help=help) + + +class _AppendAction(Action): + + def __init__(self, + option_strings, + dest, + nargs=None, + const=None, + default=None, + type=None, + choices=None, + required=False, + help=None, + metavar=None): + if nargs == 0: + raise ValueError('nargs for append actions must be > 0; if arg ' + 'strings are not supplying the value to append, ' + 'the append const action may be more appropriate') + if const is not None and nargs != OPTIONAL: + raise ValueError('nargs must be %r to supply const' % OPTIONAL) + super(_AppendAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=nargs, + const=const, + default=default, + type=type, + choices=choices, + required=required, + help=help, + metavar=metavar) + + def __call__(self, parser, namespace, values, option_string=None): + items = _copy.copy(_ensure_value(namespace, self.dest, [])) + items.append(values) + setattr(namespace, self.dest, items) + + +class _AppendConstAction(Action): + + def __init__(self, + option_strings, + dest, + const, + default=None, + required=False, + help=None, + metavar=None): + super(_AppendConstAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=0, + const=const, + default=default, + required=required, + help=help, + metavar=metavar) + + def __call__(self, parser, namespace, values, option_string=None): + items = _copy.copy(_ensure_value(namespace, self.dest, [])) + items.append(self.const) + setattr(namespace, self.dest, items) + + +class _CountAction(Action): + + def __init__(self, + option_strings, + dest, + default=None, + required=False, + help=None): + super(_CountAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=0, + default=default, + required=required, + help=help) + + def __call__(self, parser, namespace, values, option_string=None): + new_count = _ensure_value(namespace, self.dest, 0) + 1 + setattr(namespace, self.dest, new_count) + + +class _HelpAction(Action): + + def __init__(self, + option_strings, + dest=SUPPRESS, + default=SUPPRESS, + help=None): + super(_HelpAction, self).__init__( + option_strings=option_strings, + dest=dest, + default=default, + nargs=0, + help=help) + + def __call__(self, parser, namespace, values, option_string=None): + parser.print_help() + parser.exit() + + +class _VersionAction(Action): + + def __init__(self, + option_strings, + version=None, + dest=SUPPRESS, + default=SUPPRESS, + help="show program's version number and exit"): + super(_VersionAction, self).__init__( + option_strings=option_strings, + dest=dest, + default=default, + nargs=0, + help=help) + self.version = version + + def __call__(self, parser, namespace, values, option_string=None): + version = self.version + if version is None: + version = parser.version + formatter = parser._get_formatter() + formatter.add_text(version) + parser.exit(message=formatter.format_help()) + + +class _SubParsersAction(Action): + + class _ChoicesPseudoAction(Action): + + def __init__(self, name, help): + sup = super(_SubParsersAction._ChoicesPseudoAction, self) + sup.__init__(option_strings=[], dest=name, help=help) + + def __init__(self, + option_strings, + prog, + parser_class, + dest=SUPPRESS, + help=None, + metavar=None): + + self._prog_prefix = prog + self._parser_class = parser_class + self._name_parser_map = {} + self._choices_actions = [] + + super(_SubParsersAction, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=PARSER, + choices=self._name_parser_map, + help=help, + metavar=metavar) + + def add_parser(self, name, **kwargs): + # set prog from the existing prefix + if kwargs.get('prog') is None: + kwargs['prog'] = '%s %s' % (self._prog_prefix, name) + + # create a pseudo-action to hold the choice help + if 'help' in kwargs: + help = kwargs.pop('help') + choice_action = self._ChoicesPseudoAction(name, help) + self._choices_actions.append(choice_action) + + # create the parser and add it to the map + parser = self._parser_class(**kwargs) + self._name_parser_map[name] = parser + return parser + + def _get_subactions(self): + return self._choices_actions + + def __call__(self, parser, namespace, values, option_string=None): + parser_name = values[0] + arg_strings = values[1:] + + # set the parser name if requested + if self.dest is not SUPPRESS: + setattr(namespace, self.dest, parser_name) + + # select the parser + try: + parser = self._name_parser_map[parser_name] + except KeyError: + tup = parser_name, ', '.join(self._name_parser_map) + msg = _('unknown parser %r (choices: %s)' % tup) + raise ArgumentError(self, msg) + + # parse all the remaining options into the namespace + # store any unrecognized options on the object, so that the top + # level parser can decide what to do with them + namespace, arg_strings = parser.parse_known_args(arg_strings, namespace) + if arg_strings: + vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, []) + getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings) + + +# ============== +# Type classes +# ============== + +class FileType(object): + """Factory for creating file object types + + Instances of FileType are typically passed as type= arguments to the + ArgumentParser add_argument() method. + + Keyword Arguments: + - mode -- A string indicating how the file is to be opened. Accepts the + same values as the builtin open() function. + - bufsize -- The file's desired buffer size. Accepts the same values as + the builtin open() function. + """ + + def __init__(self, mode='r', bufsize=None): + self._mode = mode + self._bufsize = bufsize + + def __call__(self, string): + # the special argument "-" means sys.std{in,out} + if string == '-': + if 'r' in self._mode: + return _sys.stdin + elif 'w' in self._mode: + return _sys.stdout + else: + msg = _('argument "-" with mode %r' % self._mode) + raise ValueError(msg) + + # all other arguments are used as file names + if self._bufsize: + return open(string, self._mode, self._bufsize) + else: + return open(string, self._mode) + + def __repr__(self): + args = [self._mode, self._bufsize] + args_str = ', '.join([repr(arg) for arg in args if arg is not None]) + return '%s(%s)' % (type(self).__name__, args_str) + +# =========================== +# Optional and Positional Parsing +# =========================== + +class Namespace(_AttributeHolder): + """Simple object for storing attributes. + + Implements equality by attribute names and values, and provides a simple + string representation. + """ + + def __init__(self, **kwargs): + for name in kwargs: + setattr(self, name, kwargs[name]) + + __hash__ = None + + def __eq__(self, other): + return vars(self) == vars(other) + + def __ne__(self, other): + return not (self == other) + + def __contains__(self, key): + return key in self.__dict__ + + +class _ActionsContainer(object): + + def __init__(self, + description, + prefix_chars, + argument_default, + conflict_handler): + super(_ActionsContainer, self).__init__() + + self.description = description + self.argument_default = argument_default + self.prefix_chars = prefix_chars + self.conflict_handler = conflict_handler + + # set up registries + self._registries = {} + + # register actions + self.register('action', None, _StoreAction) + self.register('action', 'store', _StoreAction) + self.register('action', 'store_const', _StoreConstAction) + self.register('action', 'store_true', _StoreTrueAction) + self.register('action', 'store_false', _StoreFalseAction) + self.register('action', 'append', _AppendAction) + self.register('action', 'append_const', _AppendConstAction) + self.register('action', 'count', _CountAction) + self.register('action', 'help', _HelpAction) + self.register('action', 'version', _VersionAction) + self.register('action', 'parsers', _SubParsersAction) + + # raise an exception if the conflict handler is invalid + self._get_handler() + + # action storage + self._actions = [] + self._option_string_actions = {} + + # groups + self._action_groups = [] + self._mutually_exclusive_groups = [] + + # defaults storage + self._defaults = {} + + # determines whether an "option" looks like a negative number + self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$') + + # whether or not there are any optionals that look like negative + # numbers -- uses a list so it can be shared and edited + self._has_negative_number_optionals = [] + + # ==================== + # Registration methods + # ==================== + def register(self, registry_name, value, object): + registry = self._registries.setdefault(registry_name, {}) + registry[value] = object + + def _registry_get(self, registry_name, value, default=None): + return self._registries[registry_name].get(value, default) + + # ================================== + # Namespace default accessor methods + # ================================== + def set_defaults(self, **kwargs): + self._defaults.update(kwargs) + + # if these defaults match any existing arguments, replace + # the previous default on the object with the new one + for action in self._actions: + if action.dest in kwargs: + action.default = kwargs[action.dest] + + def get_default(self, dest): + for action in self._actions: + if action.dest == dest and action.default is not None: + return action.default + return self._defaults.get(dest, None) + + + # ======================= + # Adding argument actions + # ======================= + def add_argument(self, *args, **kwargs): + """ + add_argument(dest, ..., name=value, ...) + add_argument(option_string, option_string, ..., name=value, ...) + """ + + # if no positional args are supplied or only one is supplied and + # it doesn't look like an option string, parse a positional + # argument + chars = self.prefix_chars + if not args or len(args) == 1 and args[0][0] not in chars: + if args and 'dest' in kwargs: + raise ValueError('dest supplied twice for positional argument') + kwargs = self._get_positional_kwargs(*args, **kwargs) + + # otherwise, we're adding an optional argument + else: + kwargs = self._get_optional_kwargs(*args, **kwargs) + + # if no default was supplied, use the parser-level default + if 'default' not in kwargs: + dest = kwargs['dest'] + if dest in self._defaults: + kwargs['default'] = self._defaults[dest] + elif self.argument_default is not None: + kwargs['default'] = self.argument_default + + # create the action object, and add it to the parser + action_class = self._pop_action_class(kwargs) + if not _callable(action_class): + raise ValueError('unknown action "%s"' % action_class) + action = action_class(**kwargs) + + # raise an error if the action type is not callable + type_func = self._registry_get('type', action.type, action.type) + if not _callable(type_func): + raise ValueError('%r is not callable' % type_func) + + return self._add_action(action) + + def add_argument_group(self, *args, **kwargs): + group = _ArgumentGroup(self, *args, **kwargs) + self._action_groups.append(group) + return group + + def add_mutually_exclusive_group(self, **kwargs): + group = _MutuallyExclusiveGroup(self, **kwargs) + self._mutually_exclusive_groups.append(group) + return group + + def _add_action(self, action): + # resolve any conflicts + self._check_conflict(action) + + # add to actions list + self._actions.append(action) + action.container = self + + # index the action by any option strings it has + for option_string in action.option_strings: + self._option_string_actions[option_string] = action + + # set the flag if any option strings look like negative numbers + for option_string in action.option_strings: + if self._negative_number_matcher.match(option_string): + if not self._has_negative_number_optionals: + self._has_negative_number_optionals.append(True) + + # return the created action + return action + + def _remove_action(self, action): + self._actions.remove(action) + + def _add_container_actions(self, container): + # collect groups by titles + title_group_map = {} + for group in self._action_groups: + if group.title in title_group_map: + msg = _('cannot merge actions - two groups are named %r') + raise ValueError(msg % (group.title)) + title_group_map[group.title] = group + + # map each action to its group + group_map = {} + for group in container._action_groups: + + # if a group with the title exists, use that, otherwise + # create a new group matching the container's group + if group.title not in title_group_map: + title_group_map[group.title] = self.add_argument_group( + title=group.title, + description=group.description, + conflict_handler=group.conflict_handler) + + # map the actions to their new group + for action in group._group_actions: + group_map[action] = title_group_map[group.title] + + # add container's mutually exclusive groups + # NOTE: if add_mutually_exclusive_group ever gains title= and + # description= then this code will need to be expanded as above + for group in container._mutually_exclusive_groups: + mutex_group = self.add_mutually_exclusive_group( + required=group.required) + + # map the actions to their new mutex group + for action in group._group_actions: + group_map[action] = mutex_group + + # add all actions to this container or their group + for action in container._actions: + group_map.get(action, self)._add_action(action) + + def _get_positional_kwargs(self, dest, **kwargs): + # make sure required is not specified + if 'required' in kwargs: + msg = _("'required' is an invalid argument for positionals") + raise TypeError(msg) + + # mark positional arguments as required if at least one is + # always required + if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]: + kwargs['required'] = True + if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs: + kwargs['required'] = True + + # return the keyword arguments with no option strings + return dict(kwargs, dest=dest, option_strings=[]) + + def _get_optional_kwargs(self, *args, **kwargs): + # determine short and long option strings + option_strings = [] + long_option_strings = [] + for option_string in args: + # error on strings that don't start with an appropriate prefix + if not option_string[0] in self.prefix_chars: + msg = _('invalid option string %r: ' + 'must start with a character %r') + tup = option_string, self.prefix_chars + raise ValueError(msg % tup) + + # strings starting with two prefix characters are long options + option_strings.append(option_string) + if option_string[0] in self.prefix_chars: + if len(option_string) > 1: + if option_string[1] in self.prefix_chars: + long_option_strings.append(option_string) + + # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' + dest = kwargs.pop('dest', None) + if dest is None: + if long_option_strings: + dest_option_string = long_option_strings[0] + else: + dest_option_string = option_strings[0] + dest = dest_option_string.lstrip(self.prefix_chars) + if not dest: + msg = _('dest= is required for options like %r') + raise ValueError(msg % option_string) + dest = dest.replace('-', '_') + + # return the updated keyword arguments + return dict(kwargs, dest=dest, option_strings=option_strings) + + def _pop_action_class(self, kwargs, default=None): + action = kwargs.pop('action', default) + return self._registry_get('action', action, action) + + def _get_handler(self): + # determine function from conflict handler string + handler_func_name = '_handle_conflict_%s' % self.conflict_handler + try: + return getattr(self, handler_func_name) + except AttributeError: + msg = _('invalid conflict_resolution value: %r') + raise ValueError(msg % self.conflict_handler) + + def _check_conflict(self, action): + + # find all options that conflict with this option + confl_optionals = [] + for option_string in action.option_strings: + if option_string in self._option_string_actions: + confl_optional = self._option_string_actions[option_string] + confl_optionals.append((option_string, confl_optional)) + + # resolve any conflicts + if confl_optionals: + conflict_handler = self._get_handler() + conflict_handler(action, confl_optionals) + + def _handle_conflict_error(self, action, conflicting_actions): + message = _('conflicting option string(s): %s') + conflict_string = ', '.join([option_string + for option_string, action + in conflicting_actions]) + raise ArgumentError(action, message % conflict_string) + + def _handle_conflict_resolve(self, action, conflicting_actions): + + # remove all conflicting options + for option_string, action in conflicting_actions: + + # remove the conflicting option + action.option_strings.remove(option_string) + self._option_string_actions.pop(option_string, None) + + # if the option now has no option string, remove it from the + # container holding it + if not action.option_strings: + action.container._remove_action(action) + + +class _ArgumentGroup(_ActionsContainer): + + def __init__(self, container, title=None, description=None, **kwargs): + # add any missing keyword arguments by checking the container + update = kwargs.setdefault + update('conflict_handler', container.conflict_handler) + update('prefix_chars', container.prefix_chars) + update('argument_default', container.argument_default) + super_init = super(_ArgumentGroup, self).__init__ + super_init(description=description, **kwargs) + + # group attributes + self.title = title + self._group_actions = [] + + # share most attributes with the container + self._registries = container._registries + self._actions = container._actions + self._option_string_actions = container._option_string_actions + self._defaults = container._defaults + self._has_negative_number_optionals = \ + container._has_negative_number_optionals + + def _add_action(self, action): + action = super(_ArgumentGroup, self)._add_action(action) + self._group_actions.append(action) + return action + + def _remove_action(self, action): + super(_ArgumentGroup, self)._remove_action(action) + self._group_actions.remove(action) + + +class _MutuallyExclusiveGroup(_ArgumentGroup): + + def __init__(self, container, required=False): + super(_MutuallyExclusiveGroup, self).__init__(container) + self.required = required + self._container = container + + def _add_action(self, action): + if action.required: + msg = _('mutually exclusive arguments must be optional') + raise ValueError(msg) + action = self._container._add_action(action) + self._group_actions.append(action) + return action + + def _remove_action(self, action): + self._container._remove_action(action) + self._group_actions.remove(action) + + +class ArgumentParser(_AttributeHolder, _ActionsContainer): + """Object for parsing command line strings into Python objects. + + Keyword Arguments: + - prog -- The name of the program (default: sys.argv[0]) + - usage -- A usage message (default: auto-generated from arguments) + - description -- A description of what the program does + - epilog -- Text following the argument descriptions + - parents -- Parsers whose arguments should be copied into this one + - formatter_class -- HelpFormatter class for printing help messages + - prefix_chars -- Characters that prefix optional arguments + - fromfile_prefix_chars -- Characters that prefix files containing + additional arguments + - argument_default -- The default value for all arguments + - conflict_handler -- String indicating how to handle conflicts + - add_help -- Add a -h/-help option + """ + + def __init__(self, + prog=None, + usage=None, + description=None, + epilog=None, + version=None, + parents=[], + formatter_class=HelpFormatter, + prefix_chars='-', + fromfile_prefix_chars=None, + argument_default=None, + conflict_handler='error', + add_help=True): + + if version is not None: + import warnings + warnings.warn( + """The "version" argument to ArgumentParser is deprecated. """ + """Please use """ + """"add_argument(..., action='version', version="N", ...)" """ + """instead""", DeprecationWarning) + + superinit = super(ArgumentParser, self).__init__ + superinit(description=description, + prefix_chars=prefix_chars, + argument_default=argument_default, + conflict_handler=conflict_handler) + + # default setting for prog + if prog is None: + prog = _os.path.basename(_sys.argv[0]) + + self.prog = prog + self.usage = usage + self.epilog = epilog + self.version = version + self.formatter_class = formatter_class + self.fromfile_prefix_chars = fromfile_prefix_chars + self.add_help = add_help + + add_group = self.add_argument_group + self._positionals = add_group(_('positional arguments')) + self._optionals = add_group(_('optional arguments')) + self._subparsers = None + + # register types + def identity(string): + return string + self.register('type', None, identity) + + # add help and version arguments if necessary + # (using explicit default to override global argument_default) + if '-' in prefix_chars: + default_prefix = '-' + else: + default_prefix = prefix_chars[0] + if self.add_help: + self.add_argument( + default_prefix+'h', default_prefix*2+'help', + action='help', default=SUPPRESS, + help=_('show this help message and exit')) + if self.version: + self.add_argument( + default_prefix+'v', default_prefix*2+'version', + action='version', default=SUPPRESS, + version=self.version, + help=_("show program's version number and exit")) + + # add parent arguments and defaults + for parent in parents: + self._add_container_actions(parent) + try: + defaults = parent._defaults + except AttributeError: + pass + else: + self._defaults.update(defaults) + + # ======================= + # Pretty __repr__ methods + # ======================= + def _get_kwargs(self): + names = [ + 'prog', + 'usage', + 'description', + 'version', + 'formatter_class', + 'conflict_handler', + 'add_help', + ] + return [(name, getattr(self, name)) for name in names] + + # ================================== + # Optional/Positional adding methods + # ================================== + def add_subparsers(self, **kwargs): + if self._subparsers is not None: + self.error(_('cannot have multiple subparser arguments')) + + # add the parser class to the arguments if it's not present + kwargs.setdefault('parser_class', type(self)) + + if 'title' in kwargs or 'description' in kwargs: + title = _(kwargs.pop('title', 'subcommands')) + description = _(kwargs.pop('description', None)) + self._subparsers = self.add_argument_group(title, description) + else: + self._subparsers = self._positionals + + # prog defaults to the usage message of this parser, skipping + # optional arguments and with no "usage:" prefix + if kwargs.get('prog') is None: + formatter = self._get_formatter() + positionals = self._get_positional_actions() + groups = self._mutually_exclusive_groups + formatter.add_usage(self.usage, positionals, groups, '') + kwargs['prog'] = formatter.format_help().strip() + + # create the parsers action and add it to the positionals list + parsers_class = self._pop_action_class(kwargs, 'parsers') + action = parsers_class(option_strings=[], **kwargs) + self._subparsers._add_action(action) + + # return the created parsers action + return action + + def _add_action(self, action): + if action.option_strings: + self._optionals._add_action(action) + else: + self._positionals._add_action(action) + return action + + def _get_optional_actions(self): + return [action + for action in self._actions + if action.option_strings] + + def _get_positional_actions(self): + return [action + for action in self._actions + if not action.option_strings] + + # ===================================== + # Command line argument parsing methods + # ===================================== + def parse_args(self, args=None, namespace=None): + args, argv = self.parse_known_args(args, namespace) + if argv: + msg = _('unrecognized arguments: %s') + self.error(msg % ' '.join(argv)) + return args + + def parse_known_args(self, args=None, namespace=None): + # args default to the system args + if args is None: + args = _sys.argv[1:] + + # default Namespace built from parser defaults + if namespace is None: + namespace = Namespace() + + # add any action defaults that aren't present + for action in self._actions: + if action.dest is not SUPPRESS: + if not hasattr(namespace, action.dest): + if action.default is not SUPPRESS: + default = action.default + if isinstance(action.default, basestring): + default = self._get_value(action, default) + setattr(namespace, action.dest, default) + + # add any parser defaults that aren't present + for dest in self._defaults: + if not hasattr(namespace, dest): + setattr(namespace, dest, self._defaults[dest]) + + # parse the arguments and exit if there are any errors + try: + namespace, args = self._parse_known_args(args, namespace) + if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR): + args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) + delattr(namespace, _UNRECOGNIZED_ARGS_ATTR) + return namespace, args + except ArgumentError: + err = _sys.exc_info()[1] + self.error(str(err)) + + def _parse_known_args(self, arg_strings, namespace): + # replace arg strings that are file references + if self.fromfile_prefix_chars is not None: + arg_strings = self._read_args_from_files(arg_strings) + + # map all mutually exclusive arguments to the other arguments + # they can't occur with + action_conflicts = {} + for mutex_group in self._mutually_exclusive_groups: + group_actions = mutex_group._group_actions + for i, mutex_action in enumerate(mutex_group._group_actions): + conflicts = action_conflicts.setdefault(mutex_action, []) + conflicts.extend(group_actions[:i]) + conflicts.extend(group_actions[i + 1:]) + + # find all option indices, and determine the arg_string_pattern + # which has an 'O' if there is an option at an index, + # an 'A' if there is an argument, or a '-' if there is a '--' + option_string_indices = {} + arg_string_pattern_parts = [] + arg_strings_iter = iter(arg_strings) + for i, arg_string in enumerate(arg_strings_iter): + + # all args after -- are non-options + if arg_string == '--': + arg_string_pattern_parts.append('-') + for arg_string in arg_strings_iter: + arg_string_pattern_parts.append('A') + + # otherwise, add the arg to the arg strings + # and note the index if it was an option + else: + option_tuple = self._parse_optional(arg_string) + if option_tuple is None: + pattern = 'A' + else: + option_string_indices[i] = option_tuple + pattern = 'O' + arg_string_pattern_parts.append(pattern) + + # join the pieces together to form the pattern + arg_strings_pattern = ''.join(arg_string_pattern_parts) + + # converts arg strings to the appropriate and then takes the action + seen_actions = set() + seen_non_default_actions = set() + + def take_action(action, argument_strings, option_string=None): + seen_actions.add(action) + argument_values = self._get_values(action, argument_strings) + + # error if this argument is not allowed with other previously + # seen arguments, assuming that actions that use the default + # value don't really count as "present" + if argument_values is not action.default: + seen_non_default_actions.add(action) + for conflict_action in action_conflicts.get(action, []): + if conflict_action in seen_non_default_actions: + msg = _('not allowed with argument %s') + action_name = _get_action_name(conflict_action) + raise ArgumentError(action, msg % action_name) + + # take the action if we didn't receive a SUPPRESS value + # (e.g. from a default) + if argument_values is not SUPPRESS: + action(self, namespace, argument_values, option_string) + + # function to convert arg_strings into an optional action + def consume_optional(start_index): + + # get the optional identified at this index + option_tuple = option_string_indices[start_index] + action, option_string, explicit_arg = option_tuple + + # identify additional optionals in the same arg string + # (e.g. -xyz is the same as -x -y -z if no args are required) + match_argument = self._match_argument + action_tuples = [] + while True: + + # if we found no optional action, skip it + if action is None: + extras.append(arg_strings[start_index]) + return start_index + 1 + + # if there is an explicit argument, try to match the + # optional's string arguments to only this + if explicit_arg is not None: + arg_count = match_argument(action, 'A') + + # if the action is a single-dash option and takes no + # arguments, try to parse more single-dash options out + # of the tail of the option string + chars = self.prefix_chars + if arg_count == 0 and option_string[1] not in chars: + action_tuples.append((action, [], option_string)) + char = option_string[0] + option_string = char + explicit_arg[0] + new_explicit_arg = explicit_arg[1:] or None + optionals_map = self._option_string_actions + if option_string in optionals_map: + action = optionals_map[option_string] + explicit_arg = new_explicit_arg + else: + msg = _('ignored explicit argument %r') + raise ArgumentError(action, msg % explicit_arg) + + # if the action expect exactly one argument, we've + # successfully matched the option; exit the loop + elif arg_count == 1: + stop = start_index + 1 + args = [explicit_arg] + action_tuples.append((action, args, option_string)) + break + + # error if a double-dash option did not use the + # explicit argument + else: + msg = _('ignored explicit argument %r') + raise ArgumentError(action, msg % explicit_arg) + + # if there is no explicit argument, try to match the + # optional's string arguments with the following strings + # if successful, exit the loop + else: + start = start_index + 1 + selected_patterns = arg_strings_pattern[start:] + arg_count = match_argument(action, selected_patterns) + stop = start + arg_count + args = arg_strings[start:stop] + action_tuples.append((action, args, option_string)) + break + + # add the Optional to the list and return the index at which + # the Optional's string args stopped + assert action_tuples + for action, args, option_string in action_tuples: + take_action(action, args, option_string) + return stop + + # the list of Positionals left to be parsed; this is modified + # by consume_positionals() + positionals = self._get_positional_actions() + + # function to convert arg_strings into positional actions + def consume_positionals(start_index): + # match as many Positionals as possible + match_partial = self._match_arguments_partial + selected_pattern = arg_strings_pattern[start_index:] + arg_counts = match_partial(positionals, selected_pattern) + + # slice off the appropriate arg strings for each Positional + # and add the Positional and its args to the list + for action, arg_count in zip(positionals, arg_counts): + args = arg_strings[start_index: start_index + arg_count] + start_index += arg_count + take_action(action, args) + + # slice off the Positionals that we just parsed and return the + # index at which the Positionals' string args stopped + positionals[:] = positionals[len(arg_counts):] + return start_index + + # consume Positionals and Optionals alternately, until we have + # passed the last option string + extras = [] + start_index = 0 + if option_string_indices: + max_option_string_index = max(option_string_indices) + else: + max_option_string_index = -1 + while start_index <= max_option_string_index: + + # consume any Positionals preceding the next option + next_option_string_index = min([ + index + for index in option_string_indices + if index >= start_index]) + if start_index != next_option_string_index: + positionals_end_index = consume_positionals(start_index) + + # only try to parse the next optional if we didn't consume + # the option string during the positionals parsing + if positionals_end_index > start_index: + start_index = positionals_end_index + continue + else: + start_index = positionals_end_index + + # if we consumed all the positionals we could and we're not + # at the index of an option string, there were extra arguments + if start_index not in option_string_indices: + strings = arg_strings[start_index:next_option_string_index] + extras.extend(strings) + start_index = next_option_string_index + + # consume the next optional and any arguments for it + start_index = consume_optional(start_index) + + # consume any positionals following the last Optional + stop_index = consume_positionals(start_index) + + # if we didn't consume all the argument strings, there were extras + extras.extend(arg_strings[stop_index:]) + + # if we didn't use all the Positional objects, there were too few + # arg strings supplied. + if positionals: + self.error(_('too few arguments')) + + # make sure all required actions were present + for action in self._actions: + if action.required: + if action not in seen_actions: + name = _get_action_name(action) + self.error(_('argument %s is required') % name) + + # make sure all required groups had one option present + for group in self._mutually_exclusive_groups: + if group.required: + for action in group._group_actions: + if action in seen_non_default_actions: + break + + # if no actions were used, report the error + else: + names = [_get_action_name(action) + for action in group._group_actions + if action.help is not SUPPRESS] + msg = _('one of the arguments %s is required') + self.error(msg % ' '.join(names)) + + # return the updated namespace and the extra arguments + return namespace, extras + + def _read_args_from_files(self, arg_strings): + # expand arguments referencing files + new_arg_strings = [] + for arg_string in arg_strings: + + # for regular arguments, just add them back into the list + if arg_string[0] not in self.fromfile_prefix_chars: + new_arg_strings.append(arg_string) + + # replace arguments referencing files with the file content + else: + try: + args_file = open(arg_string[1:]) + try: + arg_strings = [] + for arg_line in args_file.read().splitlines(): + for arg in self.convert_arg_line_to_args(arg_line): + arg_strings.append(arg) + arg_strings = self._read_args_from_files(arg_strings) + new_arg_strings.extend(arg_strings) + finally: + args_file.close() + except IOError: + err = _sys.exc_info()[1] + self.error(str(err)) + + # return the modified argument list + return new_arg_strings + + def convert_arg_line_to_args(self, arg_line): + return [arg_line] + + def _match_argument(self, action, arg_strings_pattern): + # match the pattern for this action to the arg strings + nargs_pattern = self._get_nargs_pattern(action) + match = _re.match(nargs_pattern, arg_strings_pattern) + + # raise an exception if we weren't able to find a match + if match is None: + nargs_errors = { + None: _('expected one argument'), + OPTIONAL: _('expected at most one argument'), + ONE_OR_MORE: _('expected at least one argument'), + } + default = _('expected %s argument(s)') % action.nargs + msg = nargs_errors.get(action.nargs, default) + raise ArgumentError(action, msg) + + # return the number of arguments matched + return len(match.group(1)) + + def _match_arguments_partial(self, actions, arg_strings_pattern): + # progressively shorten the actions list by slicing off the + # final actions until we find a match + result = [] + for i in range(len(actions), 0, -1): + actions_slice = actions[:i] + pattern = ''.join([self._get_nargs_pattern(action) + for action in actions_slice]) + match = _re.match(pattern, arg_strings_pattern) + if match is not None: + result.extend([len(string) for string in match.groups()]) + break + + # return the list of arg string counts + return result + + def _parse_optional(self, arg_string): + # if it's an empty string, it was meant to be a positional + if not arg_string: + return None + + # if it doesn't start with a prefix, it was meant to be positional + if not arg_string[0] in self.prefix_chars: + return None + + # if the option string is present in the parser, return the action + if arg_string in self._option_string_actions: + action = self._option_string_actions[arg_string] + return action, arg_string, None + + # if it's just a single character, it was meant to be positional + if len(arg_string) == 1: + return None + + # if the option string before the "=" is present, return the action + if '=' in arg_string: + option_string, explicit_arg = arg_string.split('=', 1) + if option_string in self._option_string_actions: + action = self._option_string_actions[option_string] + return action, option_string, explicit_arg + + # search through all possible prefixes of the option string + # and all actions in the parser for possible interpretations + option_tuples = self._get_option_tuples(arg_string) + + # if multiple actions match, the option string was ambiguous + if len(option_tuples) > 1: + options = ', '.join([option_string + for action, option_string, explicit_arg in option_tuples]) + tup = arg_string, options + self.error(_('ambiguous option: %s could match %s') % tup) + + # if exactly one action matched, this segmentation is good, + # so return the parsed action + elif len(option_tuples) == 1: + option_tuple, = option_tuples + return option_tuple + + # if it was not found as an option, but it looks like a negative + # number, it was meant to be positional + # unless there are negative-number-like options + if self._negative_number_matcher.match(arg_string): + if not self._has_negative_number_optionals: + return None + + # if it contains a space, it was meant to be a positional + if ' ' in arg_string: + return None + + # it was meant to be an optional but there is no such option + # in this parser (though it might be a valid option in a subparser) + return None, arg_string, None + + def _get_option_tuples(self, option_string): + result = [] + + # option strings starting with two prefix characters are only + # split at the '=' + chars = self.prefix_chars + if option_string[0] in chars and option_string[1] in chars: + if '=' in option_string: + option_prefix, explicit_arg = option_string.split('=', 1) + else: + option_prefix = option_string + explicit_arg = None + for option_string in self._option_string_actions: + if option_string.startswith(option_prefix): + action = self._option_string_actions[option_string] + tup = action, option_string, explicit_arg + result.append(tup) + + # single character options can be concatenated with their arguments + # but multiple character options always have to have their argument + # separate + elif option_string[0] in chars and option_string[1] not in chars: + option_prefix = option_string + explicit_arg = None + short_option_prefix = option_string[:2] + short_explicit_arg = option_string[2:] + + for option_string in self._option_string_actions: + if option_string == short_option_prefix: + action = self._option_string_actions[option_string] + tup = action, option_string, short_explicit_arg + result.append(tup) + elif option_string.startswith(option_prefix): + action = self._option_string_actions[option_string] + tup = action, option_string, explicit_arg + result.append(tup) + + # shouldn't ever get here + else: + self.error(_('unexpected option string: %s') % option_string) + + # return the collected option tuples + return result + + def _get_nargs_pattern(self, action): + # in all examples below, we have to allow for '--' args + # which are represented as '-' in the pattern + nargs = action.nargs + + # the default (None) is assumed to be a single argument + if nargs is None: + nargs_pattern = '(-*A-*)' + + # allow zero or one arguments + elif nargs == OPTIONAL: + nargs_pattern = '(-*A?-*)' + + # allow zero or more arguments + elif nargs == ZERO_OR_MORE: + nargs_pattern = '(-*[A-]*)' + + # allow one or more arguments + elif nargs == ONE_OR_MORE: + nargs_pattern = '(-*A[A-]*)' + + # allow any number of options or arguments + elif nargs == REMAINDER: + nargs_pattern = '([-AO]*)' + + # allow one argument followed by any number of options or arguments + elif nargs == PARSER: + nargs_pattern = '(-*A[-AO]*)' + + # all others should be integers + else: + nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs) + + # if this is an optional action, -- is not allowed + if action.option_strings: + nargs_pattern = nargs_pattern.replace('-*', '') + nargs_pattern = nargs_pattern.replace('-', '') + + # return the pattern + return nargs_pattern + + # ======================== + # Value conversion methods + # ======================== + def _get_values(self, action, arg_strings): + # for everything but PARSER args, strip out '--' + if action.nargs not in [PARSER, REMAINDER]: + arg_strings = [s for s in arg_strings if s != '--'] + + # optional argument produces a default when not present + if not arg_strings and action.nargs == OPTIONAL: + if action.option_strings: + value = action.const + else: + value = action.default + if isinstance(value, basestring): + value = self._get_value(action, value) + self._check_value(action, value) + + # when nargs='*' on a positional, if there were no command-line + # args, use the default if it is anything other than None + elif (not arg_strings and action.nargs == ZERO_OR_MORE and + not action.option_strings): + if action.default is not None: + value = action.default + else: + value = arg_strings + self._check_value(action, value) + + # single argument or optional argument produces a single value + elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]: + arg_string, = arg_strings + value = self._get_value(action, arg_string) + self._check_value(action, value) + + # REMAINDER arguments convert all values, checking none + elif action.nargs == REMAINDER: + value = [self._get_value(action, v) for v in arg_strings] + + # PARSER arguments convert all values, but check only the first + elif action.nargs == PARSER: + value = [self._get_value(action, v) for v in arg_strings] + self._check_value(action, value[0]) + + # all other types of nargs produce a list + else: + value = [self._get_value(action, v) for v in arg_strings] + for v in value: + self._check_value(action, v) + + # return the converted value + return value + + def _get_value(self, action, arg_string): + type_func = self._registry_get('type', action.type, action.type) + if not _callable(type_func): + msg = _('%r is not callable') + raise ArgumentError(action, msg % type_func) + + # convert the value to the appropriate type + try: + result = type_func(arg_string) + + # ArgumentTypeErrors indicate errors + except ArgumentTypeError: + name = getattr(action.type, '__name__', repr(action.type)) + msg = str(_sys.exc_info()[1]) + raise ArgumentError(action, msg) + + # TypeErrors or ValueErrors also indicate errors + except (TypeError, ValueError): + name = getattr(action.type, '__name__', repr(action.type)) + msg = _('invalid %s value: %r') + raise ArgumentError(action, msg % (name, arg_string)) + + # return the converted value + return result + + def _check_value(self, action, value): + # converted value must be one of the choices (if specified) + if action.choices is not None and value not in action.choices: + tup = value, ', '.join(map(repr, action.choices)) + msg = _('invalid choice: %r (choose from %s)') % tup + raise ArgumentError(action, msg) + + # ======================= + # Help-formatting methods + # ======================= + def format_usage(self): + formatter = self._get_formatter() + formatter.add_usage(self.usage, self._actions, + self._mutually_exclusive_groups) + return formatter.format_help() + + def format_help(self): + formatter = self._get_formatter() + + # usage + formatter.add_usage(self.usage, self._actions, + self._mutually_exclusive_groups) + + # description + formatter.add_text(self.description) + + # positionals, optionals and user-defined groups + for action_group in self._action_groups: + formatter.start_section(action_group.title) + formatter.add_text(action_group.description) + formatter.add_arguments(action_group._group_actions) + formatter.end_section() + + # epilog + formatter.add_text(self.epilog) + + # determine help from format above + return formatter.format_help() + + def format_version(self): + import warnings + warnings.warn( + 'The format_version method is deprecated -- the "version" ' + 'argument to ArgumentParser is no longer supported.', + DeprecationWarning) + formatter = self._get_formatter() + formatter.add_text(self.version) + return formatter.format_help() + + def _get_formatter(self): + return self.formatter_class(prog=self.prog) + + # ===================== + # Help-printing methods + # ===================== + def print_usage(self, file=None): + if file is None: + file = _sys.stdout + self._print_message(self.format_usage(), file) + + def print_help(self, file=None): + if file is None: + file = _sys.stdout + self._print_message(self.format_help(), file) + + def print_version(self, file=None): + import warnings + warnings.warn( + 'The print_version method is deprecated -- the "version" ' + 'argument to ArgumentParser is no longer supported.', + DeprecationWarning) + self._print_message(self.format_version(), file) + + def _print_message(self, message, file=None): + if message: + if file is None: + file = _sys.stderr + file.write(message) + + # =============== + # Exiting methods + # =============== + def exit(self, status=0, message=None): + if message: + self._print_message(message, _sys.stderr) + _sys.exit(status) + + def error(self, message): + """error(message: string) + + Prints a usage message incorporating the message to stderr and + exits. + + If you override this in a subclass, it should not return -- it + should either exit or raise an exception. + """ + self.print_usage(_sys.stderr) + self.exit(2, _('%s: error: %s\n') % (self.prog, message)) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/cookbook/attribute.py b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/attribute.py new file mode 100755 index 0000000..79726c7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/attribute.py @@ -0,0 +1,121 @@ +""" +Provides functions for creating simple properties. + +If, inside a class definition, you write: + + attribute(foo=1, bar=2) + +simple properties named 'foo' and 'bar' are created for this class. +Also, private instance variables '__foo' and '__bar' will be added +to instances of this class. + +USEAGE: + +# assumes attribute.py is on path +from attribute import * + +class MyClass(object): + readable(foo=1, bar=2) # or, attribute('r', foo=1, bar=2) + writable(fro=3, boz=4) # or, attribute('w', fro=3, boz=4) + attribute(baz=5) + +This is equivalent to the following: + +class MyClass(object): + def __init__(self): + self.__foo = 1 + self.__bar = 2 + self.__fro = 3 + self.__boz = 4 + self.__baz = 5 + + def get_foo(self): + return self.__foo + def get_bar(self): + return self.__bar + def set_fro(self, value): + self.__fro = value + def set_boz(self, value): + self.__boz = value + def get_baz(self): + return self.__baz + def set_baz(self, value): + self.__baz = value + def del_baz(self): + del self.__baz + + foo = property(fget=get_foo, doc="foo") + bar = property(fget=get_bar, doc="bar") + fro = property(fset=set_fro, doc="fro") + boz = property(fset=set_boz, doc="boz") + baz = property(fget=get_baz, fset=set_baz, fdel=del_baz, doc="baz") +""" + +__all__ = ['attribute', 'readable', 'writable'] +__version__ = '3.0' +__author__ = 'Sean Ross' +__credits__ = ['Guido van Rossum', 'Garth Kidd'] +__created__ = '10/21/02' + +import sys + +def mangle(classname, attrname): + """mangles name according to python name-mangling + conventions for private variables""" + return "_%s__%s" % (classname, attrname) + +def class_space(classlevel=3): + "returns the calling class' name and dictionary" + frame = sys._getframe(classlevel) + classname = frame.f_code.co_name + classdict = frame.f_locals + return classname, classdict + +# convenience function +def readable(**kwds): + "returns one read-only property for each (key,value) pair in kwds" + return _attribute(permission='r', **kwds) + +# convenience function +def writable(**kwds): + "returns one write-only property for each (key,value) pair in kwds" + return _attribute(permission='w', **kwds) + +# needed because of the way class_space is resolved in _attribute +def attribute(permission='rwd', **kwds): + """returns one property for each (key,value) pair in kwds; + each property provides the specified level of access(permission): + 'r': readable, 'w':writable, 'd':deletable + """ + return _attribute(permission, **kwds) + +# based on code by Guido van Rossum, comp.lang.python 2001-07-31 +def _attribute(permission='rwd', **kwds): + """returns one property for each (key,value) pair in kwds; + each property provides the specified level of access(permission): + 'r': readable, 'w':writable, 'd':deletable + """ + classname, classdict = class_space() + def _property(attrname, default): + propname, attrname = attrname, mangle(classname, attrname) + fget, fset, fdel, doc = None, None, None, propname + if 'r' in permission: + def fget(self): + value = default + try: value = getattr(self, attrname) + except AttributeError: setattr(self, attrname, default) + return value + if 'w' in permission: + def fset(self, value): + setattr(self, attrname, value) + if 'd' in permission: + def fdel(self): + try: delattr(self, attrname) + except AttributeError: pass + # calling fget can restore this attribute, so remove property + delattr(self.__class__, propname) + return property(fget=fget, fset=fset, fdel=fdel, doc=doc) + + for attrname, default in kwds.items(): + classdict[attrname] = _property(attrname, default) + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/cookbook/doc_optparse.py b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/doc_optparse.py new file mode 100755 index 0000000..2072d4d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/doc_optparse.py @@ -0,0 +1,86 @@ +""" +:Author: M. Simionato +:Date: April 2004 +:Title: A much simplified interface to optparse. + +You should use optionparse in your scripts as follows. +First, write a module level docstring containing something like this +(this is just an example):: + + '''usage: %prog files [options] + -d, --delete: delete all files + -e, --erase = ERASE: erase the given file''' + +Then write a main program of this kind: + +# sketch of a script to delete files:: + + if __name__=='__main__': + import optionparse + option,args=optionparse.parse(__doc__) + if not args and not option: optionparse.exit() + elif option.delete: print "Delete all files" + elif option.erase: print "Delete the given file" + +Notice that ``optionparse`` parses the docstring by looking at the +characters ",", ":", "=", "\\n", so be careful in using them. If +the docstring is not correctly formatted you will get a SyntaxError +or worse, the script will not work as expected. +""" + +import optparse, re, sys, traceback + +USAGE = re.compile(r'(?s)\s*usage: (.*?)(\n[ \t]*\n|$)') + +def nonzero(self): # will become the nonzero method of optparse.Values + "True if options were given" + for v in self.__dict__.itervalues(): + if v is not None: return True + return False + +optparse.Values.__nonzero__ = nonzero # dynamically fix optparse.Values + +class ParsingError(Exception): pass + +optionstring="" + +def exception(msg=""): + print >> sys.stderr, "Exception while parsing command line:" + print >>sys.stderr, traceback.format_exc() + exit( msg ) + +def exit(msg=""): + raise SystemExit(msg or optionstring.replace("%prog",sys.argv[0])) + +def parse(docstring, arglist=None): + global optionstring + optionstring = docstring + match = USAGE.search(optionstring) + if not match: raise ParsingError("Cannot find the option string") + optlines = match.group(1).splitlines() + try: + p = optparse.OptionParser(optlines[0],conflict_handler="resolve") + for line in optlines[1:]: + opt, help=line.split(':')[:2] + # Make both short and long optional (but at least one) + ## Old: short,long=opt.split(',')[:2] + opt_strings = [] + action = "store_true" + for k in opt.split( ', ' ): + k = k.strip() + if k.startswith( "--" ) and "=" in k: + action = "store" + k = k.split( "=" )[0] + opt_strings.append( k ) + p.add_option( *opt_strings, **dict( action = action, help = help.strip() ) ) + helpstring = docstring.replace("%prog",sys.argv[0]) + # p.add_option( "-h", "--help", action="callback", callback=help_callback, callback_args=(helpstring,) ) + except (IndexError,ValueError): + raise ParsingError("Cannot parse the option string correctly") + return p.parse_args(arglist) + +def help_callback( option, opt, value, parser, help ): + print >> sys.stderr, help + sys.exit( 1 ) + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/cookbook/progress_bar.py b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/progress_bar.py new file mode 100755 index 0000000..b5c1fb0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/cookbook/progress_bar.py @@ -0,0 +1,80 @@ +""" +An ASCII text progress bar. See __main__ for command line use (using \r to +move the cursor back to the start of the current line is the key, on +terminals that do not support this functionality the progress bar will +not work as well). + +http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639 +""" + +import sys + +class ProgressBar: + def __init__(self, minValue = 0, maxValue = 10, totalWidth=72): + self.progBar = "[]" # This holds the progress bar string + self.min = minValue + self.max = maxValue + self.span = maxValue - minValue + self.width = totalWidth + self.amount = 0 # When amount == max, we are 100% done + self.update(0) # Build progress bar string + + def update(self, newAmount = 0): + if newAmount < self.min: newAmount = self.min + if newAmount > self.max: newAmount = self.max + self.amount = newAmount + + # Figure out the new percent done, round to an integer + diffFromMin = float(self.amount - self.min) + percentDone = (diffFromMin / float(self.span)) * 100.0 + percentDone = round(percentDone) + percentDone = int(percentDone) + + # Figure out how many hash bars the percentage should be + allFull = self.width - 2 + numHashes = (percentDone / 100.0) * allFull + numHashes = int(round(numHashes)) + + # build a progress bar with hashes and spaces + if allFull == numHashes: + self.progBar = "[" + '='*(numHashes) + "]" + else: + self.progBar = "[" + '='*(numHashes-1) + '>' + ' '*(allFull-numHashes) + "]" + + # figure out where to put the percentage, roughly centered + percentPlace = (len(self.progBar) / 2) - len(str(percentDone)) + percentString = str(percentDone) + "%" + + # slice the percentage into the bar + self.progBar = self.progBar[0:percentPlace] + percentString + self.progBar[percentPlace+len(percentString):] + + def update_and_print( self, newAmount = 0, f = sys.stdout ): + self.update( newAmount ) + print >> f, "\r", self, + f.flush() + + + def __str__(self): + return str(self.progBar) + +def iterprogress( sized_iterable ): + """ + Iterate something printing progress bar to stdout + """ + pb = ProgressBar( 0, len( sized_iterable ) ) + for i, value in enumerate( sized_iterable ): + yield value + pb.update_and_print( i, sys.stderr ) + +if __name__ == "__main__": + import time + + bar = ProgressBar( 0, 1000, 80 ) + + for i in range(1000): + bar.update( i ) + print "\r", bar, + sys.stdout.flush() + + + print diff --git a/code/utilities/CPAT-1.2.2/lib/bx/filter.py b/code/utilities/CPAT-1.2.2/lib/bx/filter.py new file mode 100755 index 0000000..cccae4d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/filter.py @@ -0,0 +1,54 @@ +""" +Classes for implementing `Pipeline`s composed of `Filter`s (intended to be +subclassed). +""" + +class Filter( object ): + def __init__( self, **kwargs ): + raise Exception("AbstractClass") + + def run( self, reader, writer ): + for block in reader: + block = self( block ) + if block: writer( block ) + + def step( self, reader, writer ): + block = reader.next() + if not block: raise StopIteration + block = self( block ) + if block: writer( block ) + + def __call__( self, block ): + raise Exception("AbstractMethod") + +class Pipeline( Filter ): + def __init__( self, **kwargs ): + self.pipeline = list() + + def __call__( self, block ): + for function in pipeline: + if not block: return block + try: f = function.__call__ + except: raise TypeError, "'" + function.__class__.__name__ + "' is not callable." + block = f( block ) + return block + + def append( self, function ): + try: f = function.__call__ + except: raise TypeError, "'" + function.__class__.__name__ + "' is not callable." + return self.pipeline.append( function ) + def remove( self, function ): + return self.pipeline.remove( function ) + def extend( self, pipeline ): + for item in pipeline: + self.append( item ) + # Container interface + def __len__( self ): return len( self.pipeline ) + def __getitem__( self, key ): return self.pipeline[key] + def __setitem__( self, key, value ): + try: f = value.__call__ + except: raise TypeError, "'" + value.__class__.__name__ + "' is not callable." + return self.pipeline.__setitem__( key, value ) + def __delitem__( self, key ): return self.pipeline.__delitem__( key ) + def __iter__( self ): return self.pipeline.__iter__() + def __contains__( self, item ): return self.pipeline.__contains__( item ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/gene_reader.py b/code/utilities/CPAT-1.2.2/lib/bx/gene_reader.py new file mode 100755 index 0000000..9ae6e17 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/gene_reader.py @@ -0,0 +1,283 @@ +""" +Readers extracting gene (exon and intron) information from bed / gtf / gff +formats. + + - GeneReader: yields exons + - CDSReader: yields cds_exons + - FeatureReader: yields cds_exons, introns, exons + +For gff/gtf, the start_codon stop_codon line types are merged with CDSs. +""" + +import sys +from bx.bitset import * +from bx.bitset_utils import * +from bx.bitset_builders import * + +def GeneReader( fh, format='gff' ): + """ yield chrom, strand, gene_exons, name """ + + known_formats = ( 'gff', 'gtf', 'bed') + if format not in known_formats: + print >>sys.stderr, '%s format not in %s' % (format, ",".join( known_formats )) + raise Exception('?') + + if format == 'bed': + for line in fh: + f = line.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + + # grab cdsStart - cdsEnd + gene_exons = [] + for base,offset in zip( blockStarts, blockSizes ): + exon_start = base + exon_end = base+offset + gene_exons.append( (exon_start, exon_end) ) + yield chrom, strand, gene_exons, name + genelist = {} + grouplist = [] + if format == 'gff' or format == 'gtf': + for line in fh: + if line.startswith('#'): continue + fields = line.strip().split('\t') + if len( fields ) < 9: continue + + # fields + + chrom = fields[0] + ex_st = int( fields[3] ) - 1 # make zero-centered + ex_end = int( fields[4] ) #+ 1 # make exclusive + strand = fields[6] + + if format == 'gtf': + group = fields[8].split(';')[0] + else: + group = fields[8] + + if group not in grouplist: grouplist.append( group ) + if group not in genelist: + genelist[group] = (chrom, strand, []) + exons_i = 2 + genelist[group][exons_i].append( ( ex_st, ex_end ) ) + + sp = lambda a,b: cmp( a[0], b[0] ) + + #for gene in genelist.values(): + for gene in grouplist: + chrom, strand, gene_exons = genelist[ gene ] + gene_exons = bitset_union( gene_exons ) + yield chrom, strand, gene_exons, gene + +def CDSReader( fh, format='gff' ): + """ yield chrom, strand, cds_exons, name """ + + known_formats = ( 'gff', 'gtf', 'bed') + if format not in known_formats: + print >>sys.stderr, '%s format not in %s' % (format, ",".join( known_formats )) + raise Exception('?') + + if format == 'bed': + for line in fh: + f = line.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + + # grab cdsStart - cdsEnd + cds_exons = [] + cds_seq = '' + genome_seq_index = [] + for base,offset in zip( blockStarts, blockSizes ): + if (base + offset) < cdsStart: continue + if base > cdsEnd: continue + exon_start = max( base, cdsStart ) + exon_end = min( base+offset, cdsEnd ) + cds_exons.append( (exon_start, exon_end) ) + yield chrom, strand, cds_exons, name + + genelist = {} + grouplist = [] + if format == 'gff' or format == 'gtf': + for line in fh: + if line.startswith('#'): continue + fields = line.strip().split('\t') + if len( fields ) < 9: continue + if fields[2] not in ('CDS', 'stop_codon', 'start_codon'): continue + + # fields + + chrom = fields[0] + ex_st = int( fields[3] ) - 1 # make zero-centered + ex_end = int( fields[4] ) #+ 1 # make exclusive + strand = fields[6] + + if format == 'gtf': + group = fields[8].split(';')[0] + else: + group = fields[8] + + if group not in grouplist: grouplist.append( group ) + if group not in genelist: + genelist[group] = (chrom, strand, []) + + genelist[group][2].append( ( ex_st, ex_end ) ) + + sp = lambda a,b: cmp( a[0], b[0] ) + + #for gene in genelist.values(): + for gene in grouplist: + chrom, strand, cds_exons = genelist[ gene ] + seqlen = sum([ a[1]-a[0] for a in cds_exons ]) + overhang = seqlen % 3 + if overhang > 0: + #print >>sys.stderr, "adjusting ", gene + if strand == '+': + cds_exons[-1] = ( cds_exons[-1][0], cds_exons[-1][1] - overhang ) + else: + cds_exons[0] = ( cds_exons[0][0] + overhang, cds_exons[0][1] ) + cds_exons = bitset_union( cds_exons ) + yield chrom, strand, cds_exons, gene + +def FeatureReader( fh, format='gff', alt_introns_subtract="exons", gtf_parse=None): + """ + yield chrom, strand, cds_exons, introns, exons, name + + gtf_parse Example: + # parse gene_id from transcript_id "AC073130.2-001"; gene_id "TES"; + gene_name = lambda s: s.split(';')[1].split()[1].strip('"') + + for chrom, strand, cds_exons, introns, exons, name in FeatureReader( sys.stdin, format='gtf', gtf_parse=gene_name ) + """ + + known_formats = ( 'gff', 'gtf', 'bed') + if format not in known_formats: + print >>sys.stderr, '%s format not in %s' % (format, ",".join( known_formats )) + raise Exception('?') + + if format == 'bed': + for line in fh: + f = line.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + + # grab cdsStart - cdsEnd + cds_exons = [] + exons = [] + + cds_seq = '' + genome_seq_index = [] + for base,offset in zip( blockStarts, blockSizes ): + if (base + offset) < cdsStart: continue + if base > cdsEnd: continue + # exons + exon_start = base + exon_end = base+offset + exons.append( (exon_start, exon_end) ) + # cds exons + exon_start = max( base, cdsStart ) + exon_end = min( base+offset, cdsEnd ) + cds_exons.append( (exon_start, exon_end) ) + cds_exons = bitset_union( cds_exons ) + exons = bitset_union( exons ) + introns = bitset_complement( exons ) + yield chrom, strand, cds_exons, introns, exons, name + + genelist = {} + grouplist = [] + if format == 'gff' or format == 'gtf': + for line in fh: + if line.startswith('#'): continue + fields = line.strip().split('\t') + if len( fields ) < 9: continue + + # fields + + chrom = fields[0] + ex_st = int( fields[3] ) - 1 # make zero-centered + ex_end = int( fields[4] ) #+ 1 # make exclusive + strand = fields[6] + + if format == 'gtf': + if not gtf_parse: + group = fields[8].split(';')[0] + else: + group = gtf_parse( fields[8] ) + else: + group = fields[8] + + # Results are listed in the same order as encountered + if group not in grouplist: grouplist.append( group ) + + if group not in genelist: + # chrom, strand, cds_exons, introns, exons, cds_start, cds_end + genelist[group] = [chrom, strand, [], [], [], None, None] + + if fields[2] == 'exon': + genelist[group][4].append( ( ex_st, ex_end ) ) + + elif fields[2] in ('CDS', 'stop_codon', 'start_codon'): + genelist[group][2].append( ( ex_st, ex_end ) ) + + if fields[2] == 'start_codon': + if strand == '+': genelist[group][5] = ex_st + else: genelist[group][5] = ex_end + if fields[2] == 'stop_codon': + if strand == '+': genelist[group][5] = ex_end + else: genelist[group][5] = ex_st + + elif fields[2] == 'intron': + genelist[group][3].append( ( ex_st, ex_end ) ) + + for gene in grouplist: + chrom, strand, cds_exons, introns, exons, cds_start, cds_end = genelist[ gene ] + + cds_exons = bitset_union( cds_exons ) + exons = bitset_union( exons ) + + # assure that cds exons were within the cds range + if cds_start is not None and cds_end is not None: + if strand == '+': + cds_exons = bitset_intersect( cds_exons, [(cds_start,cds_end)] ) + else: + cds_exons = bitset_intersect( cds_exons, [(cds_end,cds_start)] ) + + # assure that introns are non-overlapping with themselves or exons + if alt_introns_subtract: + if alt_introns_subtract == 'exons': + introns = bitset_subtract( introns, exons ) + if alt_introns_subtract == 'cds_exons': + introns = bitset_subtract( introns, cds_exons ) + else: introns = bitset_union( introns ) + + # assure CDS is a multiple of 3, trim from last exon if necessary + seqlen = sum([ a[1]-a[0] for a in cds_exons ]) + overhang = seqlen % 3 + if overhang > 0: + if strand == '+': + cds_exons[-1] = ( cds_exons[-1][0], cds_exons[-1][1] - overhang ) + else: + cds_exons[0] = ( cds_exons[0][0] + overhang, cds_exons[0][1] ) + + yield chrom, strand, cds_exons, introns, exons, gene + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file.py b/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file.py new file mode 100755 index 0000000..a6adaa0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file.py @@ -0,0 +1,503 @@ +""" +Classes for index files that map genomic intervals to values. + +:Authors: James Taylor (james@bx.psu.edu), Bob Harris (rsharris@bx.psu.edu) + +An interval index file maps genomic intervals to values. + +This implementation writes version 1 file format, and reads versions 0 and 1. + +Index File Format +----------------- + +All fields are in big-endian format (most significant byte first). + +All intervals are origin-zero, inclusive start, exclusive end. + +The file begins with an index file header, then is immediately followed +by an index table. The index table points to index headers, and index +headers point to bins. Index headers and bins are referenced via pointers +(file offsets), and can be placed more or less anywhere in the file. + +File header +~~~~~~~~~~~ + +============ =========== ================================================= +offset 0x00: 2C FF 80 0A magic number +offset 0x04: 00 00 00 01 version (00 00 00 00 is also supported) +offset 0x08: 00 00 00 2A (N) number of index sets +offset 0x0C: ... index table +============ =========== ================================================= + +Index table +~~~~~~~~~~~ + +The index table is a list of N index headers, packed sequentially and +sorted by name. The first begins at offset 0x0C. Each header describes +one set of intervals. + +============ =========== ================================================= +offset: xx xx xx xx (L) length of index src name +offset+4: ... index src name (e.g. canFam1.chr1) +offset+4+L: xx xx xx xx offset (in this file) to index data +offset+8+L: xx xx xx xx (B) number of bytes in each value; for version + 0, this field is absent, and B is assumed to be 4 +============ =========== ================================================= + +Index data +~~~~~~~~~~ + +The index data for (for one index table) consists of the overall range of +intervals followed by an array of pointers to bins. The length of the +array is 1+binForRange(maxEnd-1,maxEnd), where maxEnd is the maximum +interval end. + +============ =========== ================================================= +offset: xx xx xx xx minimum interval start +offset+4: xx xx xx xx maximum interval end +offset+8: xx xx xx xx offset (in this file) to bin 0 +offset+12: xx xx xx xx number of intervals in bin 0 +offset+16: xx xx xx xx offset (in this file) to bin 1 +offset+20: xx xx xx xx number of intervals in bin 1 +... ... ... +============ =========== ================================================= + +Bin +~~~ + +A bin is an array of (start,end,val), sorted by increasing start (with +end and val as tiebreakers). Note that bins may be empty (the number of +intervals indicated in the index data is zero). Note that B is determined +from the appropriate entry in the index table. + +============ =========== ================================================= +offset: xx xx xx xx start for interval 1 +offset+4: xx xx xx xx end for interval 1 +offset+8: ... (B bytes) value for interval 1 +offset+8+B: xx xx xx xx start for interval 2 +offset+12+B: xx xx xx xx end for interval 2 +offset+16+B: ... (B bytes) value for interval 2 +... ... ... +============ =========== ================================================= +""" + +from bisect import * +from struct import * + +from bx.misc import filecache + +try: + from bx.misc import seekbzip2 +except: + seekbzip2 = None + +try: + from bx.misc import seeklzop +except: + seeklzop = None + +import os.path + +__all__ = [ 'Indexes', 'Index' ] + +MAGIC = 0x2cff800a +VERSION = 2 + +# These three constants determine the structure of the default binning strategy +BIN_LEVELS = 6 # Number of levels of bins to build +BIN_FIRST_SHIFT = 17 # Number of bits for the bottom level bin +BIN_NEXT_SHIFT = 3 # Number of bits for each higher level bin + +# Build offset and max size arrays for each bin level +BIN_OFFSETS = [ 1, 0 ] +BIN_OFFSETS_MAX = [ ( 1 << BIN_FIRST_SHIFT << BIN_NEXT_SHIFT ), ( 1 << BIN_FIRST_SHIFT ) ] +for i in range( BIN_LEVELS - 2 ): + BIN_OFFSETS.insert( 0, ( 2 ** (3*(i+1)) ) + BIN_OFFSETS[0] ) + BIN_OFFSETS_MAX.insert( 0, ( BIN_OFFSETS_MAX[0] << BIN_NEXT_SHIFT ) ) +# The maximum size for the top bin is actually bigger than the signed integers +# we use to store positions in the file, so we'll change it to prevent confusion +BIN_OFFSETS_MAX[ 0 ] = max + +# Constants for the minimum and maximum size of the overall interval +MIN = 0 +OLD_MAX = 512*1024*1024 # Maximum size supported by versions < 2 +DEFAULT_MAX = 512*1024*1024 # Default max size to use when none is passed +MAX = ( 2 ** 31 ) # Absolute max size (limited by file format) + +def offsets_for_max_size( max_size ): + """ + Return the subset of offsets needed to contain intervals over (0,max_size) + """ + for i, max in enumerate( reversed( BIN_OFFSETS_MAX ) ): + if max_size < max: + break + else: + raise Exception( "%d is larger than the maximum possible size (%d)" % ( max_size, BIN_OFFSETS_MAX[0] ) ) + return BIN_OFFSETS[ ( len(BIN_OFFSETS) - i - 1 ) : ] + +def bin_for_range( start, end, offsets=None ): + """Find the smallest bin that can contain interval (start,end)""" + if offsets is None: + offsets = BIN_OFFSETS + start_bin, end_bin = start, max(start, end - 1) + start_bin >>= BIN_FIRST_SHIFT + end_bin >>= BIN_FIRST_SHIFT + for offset in offsets: + if start_bin == end_bin: + return offset + start_bin + else: + start_bin >>= BIN_NEXT_SHIFT + end_bin >>= BIN_NEXT_SHIFT + raise Exceptionn("Interval (%d,%d) out of range") + +class AbstractMultiIndexedAccess( object ): + """ + Allows accessing multiple indexes / files as if they were one + """ + indexed_access_class = None + def __init__( self, filenames, index_filenames=None, keep_open=False, use_cache=False, **kwargs ): + # TODO: Handle index_filenames argument + self.indexes = [ self.new_indexed_access( fname, keep_open=keep_open, use_cache=use_cache, **kwargs ) \ + for fname in filenames ] + def new_indexed_access( self, data_filename, index_filename=None, keep_open=False, **kwargs ): + return self.indexed_access_class( data_filename, index_filename, keep_open, **kwargs ) + def get( self, src, start, end ): + return [block for block in self.get_as_iterator( src, start, end )] + def get_as_iterator( self, src, start, end ): + for block, index, offset in self.get_as_iterator_with_index_and_offset( src, start, end ): + yield block + def get_as_iterator_with_index_and_offset( self, src, start, end ): + for index in self.indexes: + for block, idx, offset in index.get_as_iterator_with_index_and_offset( src, start, end ): + yield block, idx, offset + def close( self ): + for index in self.indexes: + index.close() + +class AbstractIndexedAccess( object ): + """Indexed access to a data using overlap queries, requires an index file""" + + def __init__( self, data_filename, index_filename=None, keep_open=False, use_cache=False, **kwargs ): + self.data_kwargs = kwargs + self.data_filename = data_filename + if data_filename.endswith( ".bz2" ): + if seekbzip2 is None: + raise Exception( "Trying to open .bz2 file but no seekbzip2 module found") + table_filename = data_filename + "t" + self.table_filename = table_filename + if not os.path.exists( table_filename ): + raise Exception( "Cannot find bz2t file for: " + data_filename ) + self.file_type = "bz2t" + # Strip .bz2 from the filename before adding ".index" + data_filename_root = data_filename[:-4] + elif data_filename.endswith( ".lzo" ): + if seeklzop is None: + raise Exception( "Trying to open .lzo file but no seeklzop module found") + table_filename = data_filename + "t" + self.table_filename = table_filename + if not os.path.exists( table_filename ): + raise Exception( "Cannot find lzot file for: " + data_filename ) + self.file_type = "lzot" + # Strip .lzo from the filename before adding ".index" + data_filename_root = data_filename[:-4] + else: + self.file_type = "plain" + data_filename_root = data_filename + # Open index + if index_filename is None: + index_filename = data_filename_root + ".index" + self.indexes = Indexes( filename=index_filename ) + # Use a file cache? + self.use_cache = use_cache + # Open now? + if keep_open: + self.f = self.open_data() + else: + self.f = None + + def close( self ): + if self.f: + self.f.close() + self.f = None + + def open_data( self ): + if self.file_type == "plain": + return open( self.data_filename ) + elif self.file_type == "bz2t": + f = seekbzip2.SeekableBzip2File( self.data_filename, self.table_filename ) + if self.use_cache: + return filecache.FileCache( f, f.size ) + else: + return f + elif self.file_type == "lzot": + if self.use_cache: + block_cache_size = 20 + else: + block_cache_size = 0 + f = seeklzop.SeekableLzopFile( self.data_filename, + self.table_filename, + block_cache_size = block_cache_size ) + return f + + def get( self, src, start, end ): + return [ val for val in self.get_as_iterator( src, start, end ) ] + def get_as_iterator( self, src, start, end ): + for val, index, offset in self.get_as_iterator_with_index_and_offset( src, start, end ): + yield val + def get_as_iterator_with_index_and_offset( self, src, start, end ): + for val_start, val_end, val in self.indexes.find( src, start, end ): + yield self.get_at_offset( val ), self, val + + def get_at_offset( self, offset ): + if self.f: + self.f.seek( offset ) + return self.read_at_current_offset( self.f, **self.data_kwargs ) + else: + f = self.open_data() + try: + f.seek( offset ) + return self.read_at_current_offset( f, **self.data_kwargs ) + finally: + f.close() + + def read_at_current_offset( self, file, **kwargs ): + raise TypeError( "Abstract Method" ) + +class Indexes: + """A set of indexes, each identified by a unique name""" + + def __init__( self, filename=None ): + self.indexes = dict() + if filename is not None: self.open( filename ) + + def add( self, name, start, end, val, max=DEFAULT_MAX ): + if name not in self.indexes: + self.indexes[name] = Index( max=max ) + self.indexes[name].add( start, end, val ) + + def get( self, name ): + if self.indexes[name] is None: + offset, value_size = self.offsets[name] + self.indexes[name] = Index( filename=self.filename, offset=offset, value_size=value_size, version=self.version ) + return self.indexes[name] + + def find( self, name, start, end ): + if name in self.indexes: + return self.get( name ).find( start, end ) + else: + return [] + + def open( self, filename ): + self.filename = filename + self.offsets = dict() # (will map key to (offset,value_size)) + f = open( filename ) + magic, version, length = read_packed( f, ">3I" ) + if magic != MAGIC: + raise Exception("File does not have expected header") + if version > VERSION: + warn( "File claims version %d, I don't known anything about versions beyond %d. Attempting to continue", version, VERSION ) + self.version = version + for i in range( length ): + key_len = read_packed( f, ">I" ) + key = f.read( key_len ) + offset = read_packed( f, ">I" ) + if version == 0: + value_size = 4 + else: + value_size = read_packed( f, ">I" ) + assert value_size % 4 == 0, "unsupported value size: %s" % value_size + self.indexes[ key ] = None + self.offsets[ key ] = (offset,value_size) + f.close() + + def write( self, f ): + keys = self.indexes.keys() + keys.sort() + # First determine the size of the header + base = calcsize( ">3I" ) + for key in keys: + key = str( key ) + base += calcsize( ">I" ) + base += len( key ) + base += calcsize( ">2I" ) + # Now actually write the header + write_packed( f, ">3I", MAGIC, VERSION, len( self.indexes ) ) + # And write the index table + for key in keys: + key = str( key ) + # Write the string prefixed by its length (pascal!) + write_packed( f, ">I", len( key ) ) + f.write( key ) + # Write offset + write_packed( f, ">I", base ) + base += self.indexes[key].bytes_required() + # Write value size + write_packed( f, ">I", self.indexes[key].value_size ) + # And finally write each index in order + for key in keys: + self.indexes[key].write( f ) + +class Index: + + def __init__( self, min=MIN, max=DEFAULT_MAX, filename=None, offset=0, value_size=None, version=None ): + self._value_size = value_size + self.max_val = 1 # (1, rather than 0, to force value_size > 0) + if filename is None: + self.new( min, max ) + else: + self.open( filename, offset, version ) + + def get_value_size ( self ): + if self._value_size != None: + return self._value_size + else: + return round_up_to_4( bytes_of( self.max_val ) ) + value_size = property( fget=get_value_size ) + + def new( self, min, max ): + """Create an empty index for intervals in the range min, max""" + # Ensure the range will fit given the shifting strategy + assert MIN <= min <= max <= MAX + self.min = min + self.max = max + # Determine offsets to use + self.offsets = offsets_for_max_size( max ) + # Determine the largest bin we will actually use + self.bin_count = bin_for_range( max - 1, max, offsets = self.offsets ) + 1 + # Create empty bins + self.bins = [ [] for i in range( self.bin_count ) ] + + def open( self, filename, offset, version ): + self.filename = filename + self.offset = offset + # Open the file and seek to where we expect our header + f = open( filename ) + f.seek( offset ) + # Read min/max + min, max = read_packed( f, ">2I" ) + self.new( min, max ) + # Decide how many levels of bins based on 'max' + if version < 2: + # Prior to version 2 all files used the bins for 512MB + self.offsets = offsets_for_max_size( OLD_MAX - 1 ) + else: + self.offsets = offsets_for_max_size( max ) + # Read bin indexes + self.bin_offsets = [] + self.bin_sizes = [] + for i in range( self.bin_count ): + o, s = read_packed( f, ">2I" ) + self.bin_offsets.append( o ) + self.bin_sizes.append( s ) + # Initialize bins to None, indicating that they need to be loaded + self.bins = [ None for i in range( self.bin_count ) ] + + def add( self, start, end, val ): + """Add the interval (start,end) with associated value val to the index""" + insort( self.bins[ bin_for_range( start, end, offsets=self.offsets ) ], ( start, end, val ) ) + assert val >= 0 + self.max_val = max(self.max_val,val) + + def find( self, start, end ): + rval = [] + start_bin = ( max( start, self.min ) ) >> BIN_FIRST_SHIFT + end_bin = ( min( end, self.max ) - 1 ) >> BIN_FIRST_SHIFT + for offset in self.offsets: + for i in range( start_bin + offset, end_bin + offset + 1 ): + if self.bins[i] is None: self.load_bin( i ) + # Iterate over bin and insert any overlapping elements into return value + for el_start, el_end, val in self.bins[i]: + if el_start < end and el_end > start: + insort_right( rval, ( el_start, el_end, val ) ) + start_bin >>= BIN_NEXT_SHIFT + end_bin >>= BIN_NEXT_SHIFT + return rval + + def iterate( self ): + for i in range( self.bin_count ): + if self.bins[i] is None: self.load_bin( i ) + for entry in self.bins[i]: yield entry + + def load_bin( self, index ): + bin = [] + if self.bin_sizes[index] == 0: + self.bins[index] = bin + return + f = open( self.filename ) + f.seek( self.bin_offsets[index] ) + # One big read for happy NFS + item_size = self.value_size + calcsize( ">2I" ) + buffer = f.read( self.bin_sizes[index] * item_size ) + for i in range( self.bin_sizes[index] ): + start, end = unpack( ">2I", buffer[ i*item_size : i*item_size+8 ] ) + val = unpack_uints( buffer[ i*item_size+8 : (i+1)*item_size ] ) + bin.append( (start, end, val) ) + self.bins[index] = bin + f.close() + + def write( self, f ): + value_size = self.value_size + item_size = value_size + calcsize( ">2I" ) + # Write min/max + write_packed( f, ">2I", self.min, self.max ) + # Write table of bin sizes and offsets + base = f.tell() + self.bin_count * calcsize( ">2I" ) + for bin in self.bins: + write_packed( f, ">2I", base, len( bin ) ) + base += len( bin ) * item_size + # Write contents of each bin + for bin in self.bins: + for start, end, val in bin: + write_packed( f, ">2I", start, end ) + write_packed_uints( f, val, value_size ) + + def bytes_required( self ): + item_size = self.value_size + calcsize( ">2I" ) + rval = calcsize( ">2I" ) + rval += self.bin_count * calcsize( ">2I" ) + for bin in self.bins: + rval += len( bin ) * item_size + return rval + +def write_packed( f, pattern, *vals ): + f.write( pack( pattern, *vals ) ) + +def read_packed( f, pattern ): + rval = unpack( pattern, f.read( calcsize( pattern ) ) ) + if len( rval ) == 1: return rval[0] + return rval + +def write_packed_uints( f, v, num_bytes ): + if num_bytes < 4: + write_packed( f, ">I", v ) + else: + parts = [] + while num_bytes > 0: + parts.append( v & 0xFFFFFFFFL ) + v >>= 32 + num_bytes -= 4 + parts.reverse() # (write most-significant chunk first) + write_packed( f, ">%dI" % len( parts ), *parts ) + +def unpack_uints( parts ): + chunks = len( parts )/4 + vals = unpack( ">%dI" % chunks, parts ) + val = vals[0] + for v in vals[1:]: + val = (val << 32) + v + return val + +def bytes_of( v ): + assert v > 0 + b = 0 + while v > 0: + v >>= 8 + b += 1 + return b + +def round_up_to_4( v ): + if v % 4 == 0: + return v + else: + return v + 4 - (v % 4) + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file_tests.py new file mode 100755 index 0000000..f050b7e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/interval_index_file_tests.py @@ -0,0 +1,50 @@ +import interval_index_file +from interval_index_file import Indexes +from tempfile import mktemp +import random + +def test_offsets(): + assert interval_index_file.offsets_for_max_size( 512*1024*1024 - 1 ) == [ 512 + 64 + 8 + 1, 64 + 8 + 1, 8 + 1, 1, 0 ] + +def test_interval_index_file(): + ix = Indexes() + chrs = [] + for i in range( 5 ): + intervals = [] + name = "seq%d" % i + max = random.randint( 0, interval_index_file.MAX ) + # print name, "size", max + for i in range( 500 ): + start = random.randint( 0, max ) + end = random.randint( 0, max ) + if end < start: + end, start = start, end + ix.add( name, start, end, i, max=interval_index_file.MAX ) + intervals.append( ( start, end, i ) ) + chrs.append( intervals ) + fname = mktemp() + f = open( fname, "w" ) + ix.write( f ) + f.close() + del ix + + ix = Indexes( fname ) + for i in range( 5 ): + intervals = chrs[i] + name = "seq%d" % i + for i in range( 100 ): + start = random.randint( 0, max ) + end = random.randint( 0, max ) + if end < start: + end, start = start, end + query_intervals = set() + for ( s, e, i ) in intervals: + if e > start and s < end: + query_intervals.add( ( s, e, i ) ) + result = ix.find( name, start, end ) + for inter in result: + assert inter in query_intervals + +def test_zero(): + ix = Indexes() + ix.add("t.idx", 0, 0, 1, 123) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/__init__.py new file mode 100755 index 0000000..db8c435 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/__init__.py @@ -0,0 +1,7 @@ +""" +Tools and data structures for working with genomic intervals (or sets of +regions on a line in general) efficiently. +""" + +# For compatiblity with existing stuff +from bx.intervals.intersection import * \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.c b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.c new file mode 100755 index 0000000..8ccaf57 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.c @@ -0,0 +1,2384 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:10 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__intervals__cluster +#define __PYX_HAVE_API__bx__intervals__cluster +#include "cluster.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "cluster.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree; + +/* "bx/intervals/cluster.pyx":57 + * void free_tree(clustertree *tree) + * + * cdef class ClusterTree: # <<<<<<<<<<<<<< + * cdef clustertree *tree + * cdef int mincols + */ +struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree { + PyObject_HEAD + clustertree *tree; + int mincols; + int minregions; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.intervals.cluster' */ +static PyTypeObject *__pyx_ptype_2bx_9intervals_7cluster_ClusterTree = 0; +#define __Pyx_MODULE_NAME "bx.intervals.cluster" +int __pyx_module_is_main_bx__intervals__cluster = 0; + +/* Implementation of 'bx.intervals.cluster' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_sorted; +static char __pyx_k_1[] = "Interval start must be before end"; +static char __pyx_k_3[] = "\nKanwei Li, 2009\nInspired by previous ClusterTree\n\nProvides a ClusterTree data structure that supports efficient finding of \nclusters of intervals that are within a certain distance apart.\n\nThis clustering algorithm uses a binary tree structure. Nodes correspond to \nnon-overlapping intervals, where overlapping means that the distance between\ntwo intervals is less or equal to the max separation.\n\nThe tree self-balances using rotations based on the binomial sequence. Merges\namong nodes are performed whenever a node is changed/added that will cause other\nnodes to form a new cluster.\n\nC source code is in src/cluster.c\n"; +static char __pyx_k__e[] = "e"; +static char __pyx_k__s[] = "s"; +static char __pyx_k__id[] = "id"; +static char __pyx_k__extend[] = "extend"; +static char __pyx_k__sorted[] = "sorted"; +static char __pyx_k__mincols[] = "mincols"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__minregions[] = "minregions"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__e; +static PyObject *__pyx_n_s__extend; +static PyObject *__pyx_n_s__id; +static PyObject *__pyx_n_s__mincols; +static PyObject *__pyx_n_s__minregions; +static PyObject *__pyx_n_s__s; +static PyObject *__pyx_n_s__sorted; +static PyObject *__pyx_k_tuple_2; + +/* "bx/intervals/cluster.pyx":62 + * cdef int minregions + * + * def __cinit__(self, mincols, minregions): # <<<<<<<<<<<<<< + * self.tree = create_clustertree(mincols, minregions) + * self.mincols = mincols + */ + +static int __pyx_pf_2bx_9intervals_7cluster_11ClusterTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_9intervals_7cluster_11ClusterTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_mincols = 0; + PyObject *__pyx_v_minregions = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mincols,&__pyx_n_s__minregions,0}; + __Pyx_RefNannySetupContext("__cinit__"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mincols); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minregions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_mincols = values[0]; + __pyx_v_minregions = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/cluster.pyx":63 + * + * def __cinit__(self, mincols, minregions): + * self.tree = create_clustertree(mincols, minregions) # <<<<<<<<<<<<<< + * self.mincols = mincols + * self.minregions = minregions + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mincols); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_minregions); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree = create_clustertree(__pyx_t_1, __pyx_t_2); + + /* "bx/intervals/cluster.pyx":64 + * def __cinit__(self, mincols, minregions): + * self.tree = create_clustertree(mincols, minregions) + * self.mincols = mincols # <<<<<<<<<<<<<< + * self.minregions = minregions + * + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_mincols); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->mincols = __pyx_t_2; + + /* "bx/intervals/cluster.pyx":65 + * self.tree = create_clustertree(mincols, minregions) + * self.mincols = mincols + * self.minregions = minregions # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_minregions); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->minregions = __pyx_t_2; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/cluster.pyx":67 + * self.minregions = minregions + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free_tree(self.tree) + * + */ + +static void __pyx_pf_2bx_9intervals_7cluster_11ClusterTree_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_2bx_9intervals_7cluster_11ClusterTree_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "bx/intervals/cluster.pyx":68 + * + * def __dealloc__(self): + * free_tree(self.tree) # <<<<<<<<<<<<<< + * + * def insert(self, s, e, id): + */ + free_tree(((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree); + + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/cluster.pyx":70 + * free_tree(self.tree) + * + * def insert(self, s, e, id): # <<<<<<<<<<<<<< + * ''' Insert an interval with start, end, id as parameters''' + * if s > e: raise ValueError("Interval start must be before end") + */ + +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_7cluster_11ClusterTree_2insert[] = " Insert an interval with start, end, id as parameters"; +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_s = 0; + PyObject *__pyx_v_e = 0; + PyObject *__pyx_v_id = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__s,&__pyx_n_s__e,&__pyx_n_s__id,0}; + __Pyx_RefNannySetupContext("insert"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__e); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_s = values[0]; + __pyx_v_e = values[1]; + __pyx_v_id = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/cluster.pyx":72 + * def insert(self, s, e, id): + * ''' Insert an interval with start, end, id as parameters''' + * if s > e: raise ValueError("Interval start must be before end") # <<<<<<<<<<<<<< + * self.tree.root = clusternode_insert(self.tree, self.tree.root, s, e, id) + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_s, __pyx_v_e, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/cluster.pyx":73 + * ''' Insert an interval with start, end, id as parameters''' + * if s > e: raise ValueError("Interval start must be before end") + * self.tree.root = clusternode_insert(self.tree, self.tree.root, s, e, id) # <<<<<<<<<<<<<< + * + * def getregions(self): + */ + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_s); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_e); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_id); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree->root = clusternode_insert(((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree, ((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree->root, __pyx_t_3, __pyx_t_4, __pyx_t_5); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/cluster.pyx":75 + * self.tree.root = clusternode_insert(self.tree, self.tree.root, s, e, id) + * + * def getregions(self): # <<<<<<<<<<<<<< + * ''' Returns a list clusters in ascending order of starting position. + * Each cluster is a tuple of (start, end, [sorted ids of intervals in cluster]) + */ + +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_3getregions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_2bx_9intervals_7cluster_11ClusterTree_3getregions[] = " Returns a list clusters in ascending order of starting position.\n Each cluster is a tuple of (start, end, [sorted ids of intervals in cluster])\n \n tree = ClusterTree(0, 0)\n Insert (6, 7, 1), (1, 2, 3), (9, 10, 2), (3, 4, 0), (3, 8, 4)\n tree.getregions() returns [(1, 2, [3]), (3, 8, [0, 1, 4]), (9, 10, [2])]\n "; +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_3getregions(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + treeitr *__pyx_v_itr; + interval *__pyx_v_ival; + PyObject *__pyx_v_regions = NULL; + PyObject *__pyx_v_ids = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getregions"); + + /* "bx/intervals/cluster.pyx":86 + * cdef interval *ival + * + * regions = [] # <<<<<<<<<<<<<< + * itr = clusteritr(self.tree) + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_regions = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":87 + * + * regions = [] + * itr = clusteritr(self.tree) # <<<<<<<<<<<<<< + * + * while (itr): + */ + __pyx_v_itr = clusteritr(((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree); + + /* "bx/intervals/cluster.pyx":89 + * itr = clusteritr(self.tree) + * + * while (itr): # <<<<<<<<<<<<<< + * ids = [] + * ival = itr.node.interval_head + */ + while (1) { + __pyx_t_2 = (__pyx_v_itr != 0); + if (!__pyx_t_2) break; + + /* "bx/intervals/cluster.pyx":90 + * + * while (itr): + * ids = [] # <<<<<<<<<<<<<< + * ival = itr.node.interval_head + * while (ival): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_XDECREF(((PyObject *)__pyx_v_ids)); + __pyx_v_ids = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":91 + * while (itr): + * ids = [] + * ival = itr.node.interval_head # <<<<<<<<<<<<<< + * while (ival): + * ids.append(ival.id) + */ + __pyx_v_ival = __pyx_v_itr->node->interval_head; + + /* "bx/intervals/cluster.pyx":92 + * ids = [] + * ival = itr.node.interval_head + * while (ival): # <<<<<<<<<<<<<< + * ids.append(ival.id) + * ival = ival.next + */ + while (1) { + __pyx_t_2 = (__pyx_v_ival != 0); + if (!__pyx_t_2) break; + + /* "bx/intervals/cluster.pyx":93 + * ival = itr.node.interval_head + * while (ival): + * ids.append(ival.id) # <<<<<<<<<<<<<< + * ival = ival.next + * + */ + if (unlikely(((PyObject *)__pyx_v_ids) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyInt_FromLong(__pyx_v_ival->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(__pyx_v_ids, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":94 + * while (ival): + * ids.append(ival.id) + * ival = ival.next # <<<<<<<<<<<<<< + * + * regions.append( (itr.node.start, itr.node.end, sorted(ids)) ) + */ + __pyx_v_ival = __pyx_v_ival->next; + } + + /* "bx/intervals/cluster.pyx":96 + * ival = ival.next + * + * regions.append( (itr.node.start, itr.node.end, sorted(ids)) ) # <<<<<<<<<<<<<< + * itr = itr.next + * freeclusteritr(itr) + */ + if (unlikely(((PyObject *)__pyx_v_regions) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyInt_FromLong(__pyx_v_itr->node->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_itr->node->end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_v_ids)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_ids)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ids)); + __pyx_t_6 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_6 = 0; + __pyx_t_3 = PyList_Append(__pyx_v_regions, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "bx/intervals/cluster.pyx":97 + * + * regions.append( (itr.node.start, itr.node.end, sorted(ids)) ) + * itr = itr.next # <<<<<<<<<<<<<< + * freeclusteritr(itr) + * return regions + */ + __pyx_v_itr = __pyx_v_itr->next; + } + + /* "bx/intervals/cluster.pyx":98 + * regions.append( (itr.node.start, itr.node.end, sorted(ids)) ) + * itr = itr.next + * freeclusteritr(itr) # <<<<<<<<<<<<<< + * return regions + * + */ + freeclusteritr(__pyx_v_itr); + + /* "bx/intervals/cluster.pyx":99 + * itr = itr.next + * freeclusteritr(itr) + * return regions # <<<<<<<<<<<<<< + * + * def getlines(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_regions)); + __pyx_r = ((PyObject *)__pyx_v_regions); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.getregions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_regions); + __Pyx_XDECREF(__pyx_v_ids); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/cluster.pyx":101 + * return regions + * + * def getlines(self): # <<<<<<<<<<<<<< + * ''' Similar to getregions except it just returns a list of ids of intervals + * The above example would return [3, 0, 1, 4, 2] + */ + +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_4getlines(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_2bx_9intervals_7cluster_11ClusterTree_4getlines[] = " Similar to getregions except it just returns a list of ids of intervals\n The above example would return [3, 0, 1, 4, 2]\n "; +static PyObject *__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_4getlines(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + treeitr *__pyx_v_itr; + interval *__pyx_v_ival; + PyObject *__pyx_v_lines = NULL; + PyObject *__pyx_v_ids = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("getlines"); + + /* "bx/intervals/cluster.pyx":108 + * cdef interval *ival + * + * lines = [] # <<<<<<<<<<<<<< + * itr = clusteritr(self.tree) + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_lines = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":109 + * + * lines = [] + * itr = clusteritr(self.tree) # <<<<<<<<<<<<<< + * + * while (itr): + */ + __pyx_v_itr = clusteritr(((struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree *)__pyx_v_self)->tree); + + /* "bx/intervals/cluster.pyx":111 + * itr = clusteritr(self.tree) + * + * while (itr): # <<<<<<<<<<<<<< + * ids = [] + * ival = itr.node.interval_head + */ + while (1) { + __pyx_t_2 = (__pyx_v_itr != 0); + if (!__pyx_t_2) break; + + /* "bx/intervals/cluster.pyx":112 + * + * while (itr): + * ids = [] # <<<<<<<<<<<<<< + * ival = itr.node.interval_head + * while (ival): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_XDECREF(((PyObject *)__pyx_v_ids)); + __pyx_v_ids = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":113 + * while (itr): + * ids = [] + * ival = itr.node.interval_head # <<<<<<<<<<<<<< + * while (ival): + * ids.append(ival.id) + */ + __pyx_v_ival = __pyx_v_itr->node->interval_head; + + /* "bx/intervals/cluster.pyx":114 + * ids = [] + * ival = itr.node.interval_head + * while (ival): # <<<<<<<<<<<<<< + * ids.append(ival.id) + * ival = ival.next + */ + while (1) { + __pyx_t_2 = (__pyx_v_ival != 0); + if (!__pyx_t_2) break; + + /* "bx/intervals/cluster.pyx":115 + * ival = itr.node.interval_head + * while (ival): + * ids.append(ival.id) # <<<<<<<<<<<<<< + * ival = ival.next + * + */ + if (unlikely(((PyObject *)__pyx_v_ids) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyInt_FromLong(__pyx_v_ival->id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(__pyx_v_ids, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/intervals/cluster.pyx":116 + * while (ival): + * ids.append(ival.id) + * ival = ival.next # <<<<<<<<<<<<<< + * + * lines.extend(sorted(ids)) + */ + __pyx_v_ival = __pyx_v_ival->next; + } + + /* "bx/intervals/cluster.pyx":118 + * ival = ival.next + * + * lines.extend(sorted(ids)) # <<<<<<<<<<<<<< + * itr = itr.next + * freeclusteritr(itr) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_lines), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_v_ids)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_ids)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ids)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "bx/intervals/cluster.pyx":119 + * + * lines.extend(sorted(ids)) + * itr = itr.next # <<<<<<<<<<<<<< + * freeclusteritr(itr) + * return lines + */ + __pyx_v_itr = __pyx_v_itr->next; + } + + /* "bx/intervals/cluster.pyx":120 + * lines.extend(sorted(ids)) + * itr = itr.next + * freeclusteritr(itr) # <<<<<<<<<<<<<< + * return lines + * + */ + freeclusteritr(__pyx_v_itr); + + /* "bx/intervals/cluster.pyx":121 + * itr = itr.next + * freeclusteritr(itr) + * return lines # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_lines)); + __pyx_r = ((PyObject *)__pyx_v_lines); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.intervals.cluster.ClusterTree.getlines", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_lines); + __Pyx_XDECREF(__pyx_v_ids); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_9intervals_7cluster_ClusterTree(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_2bx_9intervals_7cluster_11ClusterTree___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_9intervals_7cluster_ClusterTree(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_2bx_9intervals_7cluster_11ClusterTree_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_2bx_9intervals_7cluster_ClusterTree[] = { + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_2insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_7cluster_11ClusterTree_2insert)}, + {__Pyx_NAMESTR("getregions"), (PyCFunction)__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_3getregions, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_7cluster_11ClusterTree_3getregions)}, + {__Pyx_NAMESTR("getlines"), (PyCFunction)__pyx_pf_2bx_9intervals_7cluster_11ClusterTree_4getlines, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_7cluster_11ClusterTree_4getlines)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ClusterTree = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ClusterTree = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ClusterTree = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ClusterTree = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_9intervals_7cluster_ClusterTree = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.intervals.cluster.ClusterTree"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_9intervals_7cluster_ClusterTree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_9intervals_7cluster_ClusterTree, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ClusterTree, /*tp_as_number*/ + &__pyx_tp_as_sequence_ClusterTree, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ClusterTree, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ClusterTree, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_9intervals_7cluster_ClusterTree, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_9intervals_7cluster_ClusterTree, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("cluster"), + __Pyx_DOCSTR(__pyx_k_3), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1}, + {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__mincols, __pyx_k__mincols, sizeof(__pyx_k__mincols), 0, 0, 1, 1}, + {&__pyx_n_s__minregions, __pyx_k__minregions, sizeof(__pyx_k__minregions), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/intervals/cluster.pyx":72 + * def insert(self, s, e, id): + * ''' Insert an interval with start, end, id as parameters''' + * if s > e: raise ValueError("Interval start must be before end") # <<<<<<<<<<<<<< + * self.tree.root = clusternode_insert(self.tree, self.tree.root, s, e, id) + * + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcluster(void); /*proto*/ +PyMODINIT_FUNC initcluster(void) +#else +PyMODINIT_FUNC PyInit_cluster(void); /*proto*/ +PyMODINIT_FUNC PyInit_cluster(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cluster(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cluster"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_3), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__intervals__cluster) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_9intervals_7cluster_ClusterTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ClusterTree", (PyObject *)&__pyx_type_2bx_9intervals_7cluster_ClusterTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_9intervals_7cluster_ClusterTree = &__pyx_type_2bx_9intervals_7cluster_ClusterTree; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/intervals/cluster.pyx":1 + * """ # <<<<<<<<<<<<<< + * Kanwei Li, 2009 + * Inspired by previous ClusterTree + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.intervals.cluster", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.intervals.cluster"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.pyx b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.pyx new file mode 100755 index 0000000..fe58283 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster.pyx @@ -0,0 +1,122 @@ +""" +Kanwei Li, 2009 +Inspired by previous ClusterTree + +Provides a ClusterTree data structure that supports efficient finding of +clusters of intervals that are within a certain distance apart. + +This clustering algorithm uses a binary tree structure. Nodes correspond to +non-overlapping intervals, where overlapping means that the distance between +two intervals is less or equal to the max separation. + +The tree self-balances using rotations based on the binomial sequence. Merges +among nodes are performed whenever a node is changed/added that will cause other +nodes to form a new cluster. + +C source code is in src/cluster.c +""" + +cdef extern from "cluster.h": + + cdef struct struct_interval: + int start + int end + int id + struct_interval * next + + ctypedef struct_interval interval + + cdef struct struct_clusternode: + int start + int end + struct_interval *interval_head + struct_interval *interval_tail + + ctypedef struct_clusternode clusternode + + cdef struct struct_clustertree: + int max_dist + int min_intervals + + struct_clusternode *root + + ctypedef struct_clustertree clustertree + + cdef struct struct_treeitr: + struct_treeitr *next + struct_clusternode *node + + ctypedef struct_treeitr treeitr + + clusternode* clusternode_insert(clustertree *tree, clusternode *node, int start, int end, int id) + clustertree* create_clustertree(int max_dist, int min_intervals) + treeitr* clusteritr(clustertree *tree) + void freeclusteritr(treeitr *itr) + void free_tree(clustertree *tree) + +cdef class ClusterTree: + cdef clustertree *tree + cdef int mincols + cdef int minregions + + def __cinit__(self, mincols, minregions): + self.tree = create_clustertree(mincols, minregions) + self.mincols = mincols + self.minregions = minregions + + def __dealloc__(self): + free_tree(self.tree) + + def insert(self, s, e, id): + ''' Insert an interval with start, end, id as parameters''' + if s > e: raise ValueError("Interval start must be before end") + self.tree.root = clusternode_insert(self.tree, self.tree.root, s, e, id) + + def getregions(self): + ''' Returns a list clusters in ascending order of starting position. + Each cluster is a tuple of (start, end, [sorted ids of intervals in cluster]) + + tree = ClusterTree(0, 0) + Insert (6, 7, 1), (1, 2, 3), (9, 10, 2), (3, 4, 0), (3, 8, 4) + tree.getregions() returns [(1, 2, [3]), (3, 8, [0, 1, 4]), (9, 10, [2])] + ''' + cdef treeitr *itr + cdef interval *ival + + regions = [] + itr = clusteritr(self.tree) + + while (itr): + ids = [] + ival = itr.node.interval_head + while (ival): + ids.append(ival.id) + ival = ival.next + + regions.append( (itr.node.start, itr.node.end, sorted(ids)) ) + itr = itr.next + freeclusteritr(itr) + return regions + + def getlines(self): + ''' Similar to getregions except it just returns a list of ids of intervals + The above example would return [3, 0, 1, 4, 2] + ''' + cdef treeitr *itr + cdef interval *ival + + lines = [] + itr = clusteritr(self.tree) + + while (itr): + ids = [] + ival = itr.node.interval_head + while (ival): + ids.append(ival.id) + ival = ival.next + + lines.extend(sorted(ids)) + itr = itr.next + freeclusteritr(itr) + return lines + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster_tests.py new file mode 100755 index 0000000..8438b92 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/cluster_tests.py @@ -0,0 +1,103 @@ +import sys, os +import unittest +try: + sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +except: + sys.path.insert(0, os.path.dirname(os.path.abspath("."))) + +# from bx.intervals.cluster import ClusterTree +from cluster import ClusterTree + +class TestCluster(unittest.TestCase): + def setUp(self): + self.tree = ClusterTree(0, 0) + + def insertpairs(self, pairs): + for i, (s, e) in enumerate(pairs): + self.tree.insert(s, e, i) + + def test_merge_case(self): + pairs = [(3, 4), (6, 7), (9, 10), (1, 2), (3, 8)] + self.insertpairs(pairs) + + self.assertEqual( [(1, 2, [3]), (3, 8, [0, 1, 4]), (9, 10, [2])], self.tree.getregions() ) + + def test_trivial(self): + pairs = [ (1, 4), (4, 5) ] + self.insertpairs(pairs) + + self.assertEqual( [(1, 5, [0, 1])], self.tree.getregions() ) + + def test_easymerge(self): + pairs = [ (1, 2), (4, 5), (2, 4) ] + self.insertpairs(pairs) + + self.assertEqual( [(1, 5, [0, 1, 2])], self.tree.getregions() ) + + def test_hardmerge(self): + pairs = [ (1, 2), (8, 9), (3, 4), (5, 6), (7, 8), (1, 10) ] + self.insertpairs(pairs) + + self.assertEqual( [(1, 10, [0, 1, 2, 3, 4, 5])], self.tree.getregions() ) + + def test_duplicates(self): + pairs = [ (1, 1), (1, 2), (3, 4), (3, 4), (1, 4) ] + self.insertpairs(pairs) + + self.assertEqual( [(1, 4, [0, 1, 2, 3, 4])], self.tree.getregions() ) + + def test_startbeforeend(self): + self.assertRaises(ValueError, self.tree.insert, 4, 2, 0) + + def test_large_sorted(self): + upto = 100000 + pairs = [ (2*i + 1, 2*i + 2) for i in range(upto) ] + self.insertpairs(pairs) + self.tree.insert( 0, upto*3, upto ) + self.assertEqual( [ (0, upto*3, [x for x in range(upto+1)]) ], self.tree.getregions() ) + + def test_minregions(self): + self.tree = ClusterTree(0, 2) + pairs = [(3, 4), (6, 7), (9, 10), (1, 2), (3, 8)] + self.insertpairs(pairs) + + self.assertEqual( [(3, 8, [0, 1, 4])], self.tree.getregions() ) + + def test_distance(self): + self.tree = ClusterTree(1, 0) + pairs = [(3, 4), (6, 7), (9, 10), (1, 2), (3, 8)] + self.insertpairs(pairs) + + self.assertEqual( [(1, 10, [0, 1, 2, 3, 4])], self.tree.getregions() ) + + def test_merge_left_right(self): + pairs = [(6, 7, 1), (1, 2, 3), (9, 10, 2), (3, 4, 0), (3, 8, 4)] + for s, e, i in pairs: + self.tree.insert(s, e, i) + + self.assertEqual( [(1, 2, [3]), (3, 8, [0, 1, 4]), (9, 10, [2])], self.tree.getregions() ) + + def test_larger(self): + pairs = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 10), (11, 12), (13, 14), (15, 16), (17, 18), (19, 20), + (1, 3), (4, 10), (10, 15), (15, 20), (21, 22)] + self.insertpairs(pairs) + + self.assertEqual( [(1, 20, [x for x in range(14)]), (21, 22, [14])], self.tree.getregions() ) + + def test_another(self): + pairs = [(3, 4, 1), (13, 14, 6), (21, 22, 14), (5, 6, 2), (4, 10, 11), (1, 2, 0), (11, 12, 5), (1, 3, 10), (7, 8, 3), (15, 16, 7), (15, 20, 13), (19, 20, 9), (10, 15, 12), (17, 18, 8), (9, 10, 4)] + # pairs = [(3, 4, 1), (13, 14, 6), (21, 22, 14), (5, 6, 2), (4, 10, 11), (1, 2, 0), (11, 12, 5), (1, 3, 10), (7, 8, 3), (15, 16, 7), (15, 20, 13), (19, 20, 9), (10, 15, 12), (9, 10, 4)] + for s, e, i in pairs: + self.tree.insert(s, e, i) + + self.assertEqual( [(1, 20, [x for x in range(14)]), (21, 22, [14])], self.tree.getregions() ) + + def test_none(self): + pairs = [] + self.insertpairs(pairs) + + self.assertEqual( [], self.tree.getregions() ) + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.c b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.c new file mode 100755 index 0000000..7e90720 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.c @@ -0,0 +1,7883 @@ +/* Generated by Cython 0.15.1 on Mon Dec 12 00:16:36 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__intervals__intersection +#define __PYX_HAVE_API__bx__intervals__intersection +#include "stdlib.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "intersection.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode; +struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree; +struct __pyx_obj_2bx_9intervals_12intersection_Interval; +struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left; +struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right; + +/* "bx/intervals/intersection.pyx":231 + * + * + * cpdef left(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a start > than `position` + */ +struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left { + int __pyx_n; + int n; + int max_dist; +}; + +/* "bx/intervals/intersection.pyx":246 + * return r[:n] + * + * cpdef right(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a end < than position + */ +struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right { + int __pyx_n; + int n; + int max_dist; +}; + +/* "bx/intervals/intersection.pyx":60 + * cdef float nlog = -1.0 / log(0.5) + * + * cdef class IntervalNode: # <<<<<<<<<<<<<< + * """ + * A single node of an `IntervalTree`. + */ +struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode { + PyObject_HEAD + struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *__pyx_vtab; + float priority; + PyObject *interval; + int start; + int end; + int minend; + int maxend; + int minstart; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *cleft; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *cright; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *croot; +}; + + +/* "bx/intervals/intersection.pyx":325 + * return self == other or self > other + * + * cdef class IntervalTree: # <<<<<<<<<<<<<< + * """ + * Data structure for performing window intersect queries on a set of + */ +struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree { + PyObject_HEAD + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *root; +}; + + +/* "bx/intervals/intersection.pyx":273 + * ## ---- Wrappers that retain the old interface ------------------------------- + * + * cdef class Interval: # <<<<<<<<<<<<<< + * """ + * Basic feature, with required integer start and end properties. + */ +struct __pyx_obj_2bx_9intervals_12intersection_Interval { + PyObject_HEAD + int start; + int end; + PyObject *value; + PyObject *chrom; + PyObject *strand; +}; + + + +/* "bx/intervals/intersection.pyx":60 + * cdef float nlog = -1.0 / log(0.5) + * + * cdef class IntervalNode: # <<<<<<<<<<<<<< + * """ + * A single node of an `IntervalTree`. + */ + +struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*insert)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, int, PyObject *, int __pyx_skip_dispatch); + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*rotate_right)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *); + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*rotate_left)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *); + void (*set_ends)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *); + void (*_intersect)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, int, PyObject *); + void (*_seek_left)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, PyObject *, int, int); + void (*_seek_right)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, PyObject *, int, int); + PyObject *(*left)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left *__pyx_optional_args); + PyObject *(*right)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right *__pyx_optional_args); + void (*_traverse)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *); +}; +static struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *__pyx_vtabptr_2bx_9intervals_12intersection_IntervalNode; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.intervals.intersection' */ +static PyTypeObject *__pyx_ptype_2bx_9intervals_12intersection_IntervalNode = 0; +static PyTypeObject *__pyx_ptype_2bx_9intervals_12intersection_Interval = 0; +static PyTypeObject *__pyx_ptype_2bx_9intervals_12intersection_IntervalTree = 0; +static float __pyx_v_2bx_9intervals_12intersection_nlog; +static struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_2bx_9intervals_12intersection_EmptyNode = 0; +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imax2(int, int); /*proto*/ +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imax3(int, int, int); /*proto*/ +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imin3(int, int, int); /*proto*/ +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imin2(int, int); /*proto*/ +#define __Pyx_MODULE_NAME "bx.intervals.intersection" +int __pyx_module_is_main_bx__intervals__intersection = 0; + +/* Implementation of 'bx.intervals.intersection' */ +static char __pyx_k_1[] = "IntervalNode(%i, %i)"; +static char __pyx_k_5[] = "start must be less than end"; +static char __pyx_k_6[] = "Interval(%d, %d"; +static char __pyx_k_7[] = ", value="; +static char __pyx_k_8[] = ")"; +static char __pyx_k_9[] = "-"; +static char __pyx_k_10[] = "\nData structure for performing intersect queries on a set of intervals which\npreserves all information about the intervals (unlike bitset projection methods).\n\n:Authors: James Taylor (james@jamestaylor.org),\n Ian Schenk (ian.schenck@gmail.com),\n Brent Pedersen (bpederse@gmail.com)\n"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__add[] = "add"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__key[] = "key"; +static char __pyx_k__find[] = "find"; +static char __pyx_k__left[] = "left"; +static char __pyx_k__sort[] = "sort"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__right[] = "right"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__insert[] = "insert"; +static char __pyx_k__strand[] = "strand"; +static char __pyx_k__reverse[] = "reverse"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__interval[] = "interval"; +static char __pyx_k__max_dist[] = "max_dist"; +static char __pyx_k__operator[] = "operator"; +static char __pyx_k__position[] = "position"; +static char __pyx_k__traverse[] = "traverse"; +static char __pyx_k__intersect[] = "intersect"; +static char __pyx_k__attrgetter[] = "attrgetter"; +static char __pyx_k__Intersecter[] = "Intersecter"; +static char __pyx_k__add_interval[] = "add_interval"; +static char __pyx_k__num_intervals[] = "num_intervals"; +static char __pyx_k__insert_interval[] = "insert_interval"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__Intersecter; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__add; +static PyObject *__pyx_n_s__add_interval; +static PyObject *__pyx_n_s__attrgetter; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__find; +static PyObject *__pyx_n_s__insert; +static PyObject *__pyx_n_s__insert_interval; +static PyObject *__pyx_n_s__intersect; +static PyObject *__pyx_n_s__interval; +static PyObject *__pyx_n_s__key; +static PyObject *__pyx_n_s__left; +static PyObject *__pyx_n_s__max_dist; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__num_intervals; +static PyObject *__pyx_n_s__operator; +static PyObject *__pyx_n_s__position; +static PyObject *__pyx_n_s__reverse; +static PyObject *__pyx_n_s__right; +static PyObject *__pyx_n_s__sort; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__strand; +static PyObject *__pyx_n_s__traverse; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_2500; +static PyObject *__pyx_k_2; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_11; + +/* "bx/intervals/intersection.pyx":32 + * int iabs(int) + * + * cdef inline int imax2(int a, int b): # <<<<<<<<<<<<<< + * if b > a: return b + * return a + */ + +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imax2(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imax2"); + + /* "bx/intervals/intersection.pyx":33 + * + * cdef inline int imax2(int a, int b): + * if b > a: return b # <<<<<<<<<<<<<< + * return a + * + */ + __pyx_t_1 = (__pyx_v_b > __pyx_v_a); + if (__pyx_t_1) { + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":34 + * cdef inline int imax2(int a, int b): + * if b > a: return b + * return a # <<<<<<<<<<<<<< + * + * cdef inline int imax3(int a, int b, int c): + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":36 + * return a + * + * cdef inline int imax3(int a, int b, int c): # <<<<<<<<<<<<<< + * if b > a: + * if c > b: + */ + +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imax3(int __pyx_v_a, int __pyx_v_b, int __pyx_v_c) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imax3"); + + /* "bx/intervals/intersection.pyx":37 + * + * cdef inline int imax3(int a, int b, int c): + * if b > a: # <<<<<<<<<<<<<< + * if c > b: + * return c + */ + __pyx_t_1 = (__pyx_v_b > __pyx_v_a); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":38 + * cdef inline int imax3(int a, int b, int c): + * if b > a: + * if c > b: # <<<<<<<<<<<<<< + * return c + * return b + */ + __pyx_t_1 = (__pyx_v_c > __pyx_v_b); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":39 + * if b > a: + * if c > b: + * return c # <<<<<<<<<<<<<< + * return b + * if a > c: + */ + __pyx_r = __pyx_v_c; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":40 + * if c > b: + * return c + * return b # <<<<<<<<<<<<<< + * if a > c: + * return a + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":41 + * return c + * return b + * if a > c: # <<<<<<<<<<<<<< + * return a + * return c + */ + __pyx_t_1 = (__pyx_v_a > __pyx_v_c); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":42 + * return b + * if a > c: + * return a # <<<<<<<<<<<<<< + * return c + * + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":43 + * if a > c: + * return a + * return c # <<<<<<<<<<<<<< + * + * cdef inline int imin3(int a, int b, int c): + */ + __pyx_r = __pyx_v_c; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":45 + * return c + * + * cdef inline int imin3(int a, int b, int c): # <<<<<<<<<<<<<< + * if b < a: + * if c < b: + */ + +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imin3(int __pyx_v_a, int __pyx_v_b, int __pyx_v_c) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imin3"); + + /* "bx/intervals/intersection.pyx":46 + * + * cdef inline int imin3(int a, int b, int c): + * if b < a: # <<<<<<<<<<<<<< + * if c < b: + * return c + */ + __pyx_t_1 = (__pyx_v_b < __pyx_v_a); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":47 + * cdef inline int imin3(int a, int b, int c): + * if b < a: + * if c < b: # <<<<<<<<<<<<<< + * return c + * return b + */ + __pyx_t_1 = (__pyx_v_c < __pyx_v_b); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":48 + * if b < a: + * if c < b: + * return c # <<<<<<<<<<<<<< + * return b + * if a < c: + */ + __pyx_r = __pyx_v_c; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":49 + * if c < b: + * return c + * return b # <<<<<<<<<<<<<< + * if a < c: + * return a + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":50 + * return c + * return b + * if a < c: # <<<<<<<<<<<<<< + * return a + * return c + */ + __pyx_t_1 = (__pyx_v_a < __pyx_v_c); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":51 + * return b + * if a < c: + * return a # <<<<<<<<<<<<<< + * return c + * + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":52 + * if a < c: + * return a + * return c # <<<<<<<<<<<<<< + * + * cdef inline int imin2(int a, int b): + */ + __pyx_r = __pyx_v_c; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":54 + * return c + * + * cdef inline int imin2(int a, int b): # <<<<<<<<<<<<<< + * if b < a: return b + * return a + */ + +static CYTHON_INLINE int __pyx_f_2bx_9intervals_12intersection_imin2(int __pyx_v_a, int __pyx_v_b) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("imin2"); + + /* "bx/intervals/intersection.pyx":55 + * + * cdef inline int imin2(int a, int b): + * if b < a: return b # <<<<<<<<<<<<<< + * return a + * + */ + __pyx_t_1 = (__pyx_v_b < __pyx_v_a); + if (__pyx_t_1) { + __pyx_r = __pyx_v_b; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":56 + * cdef inline int imin2(int a, int b): + * if b < a: return b + * return a # <<<<<<<<<<<<<< + * + * cdef float nlog = -1.0 / log(0.5) + */ + __pyx_r = __pyx_v_a; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":74 + * + * property left_node: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.cleft if self.cleft is not EmptyNode else None + * property right_node: + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9left_node___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9left_node___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/intervals/intersection.pyx":75 + * property left_node: + * def __get__(self): + * return self.cleft if self.cleft is not EmptyNode else None # <<<<<<<<<<<<<< + * property right_node: + * def __get__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft)); + __pyx_t_1 = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":77 + * return self.cleft if self.cleft is not EmptyNode else None + * property right_node: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.cright if self.cright is not EmptyNode else None + * property root_node: + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_10right_node___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_10right_node___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/intervals/intersection.pyx":78 + * property right_node: + * def __get__(self): + * return self.cright if self.cright is not EmptyNode else None # <<<<<<<<<<<<<< + * property root_node: + * def __get__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright)); + __pyx_t_1 = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":80 + * return self.cright if self.cright is not EmptyNode else None + * property root_node: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.croot if self.croot is not EmptyNode else None + * + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9root_node___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9root_node___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__get__"); + + /* "bx/intervals/intersection.pyx":81 + * property root_node: + * def __get__(self): + * return self.croot if self.croot is not EmptyNode else None # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = (((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_2) { + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot)); + __pyx_t_1 = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":83 + * return self.croot if self.croot is not EmptyNode else None + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "IntervalNode(%i, %i)" % (self.start, self.end) + * + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode___repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode___repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__"); + + /* "bx/intervals/intersection.pyx":84 + * + * def __repr__(self): + * return "IntervalNode(%i, %i)" % (self.start, self.end) # <<<<<<<<<<<<<< + * + * def __cinit__(IntervalNode self, int start, int end, object interval): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":86 + * return "IntervalNode(%i, %i)" % (self.start, self.end) + * + * def __cinit__(IntervalNode self, int start, int end, object interval): # <<<<<<<<<<<<<< + * # Python lacks the binomial distribution, so we convert a + * # uniform into a binomial because it naturally scales with + */ + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_interval = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + double __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__interval,0}; + __Pyx_RefNannySetupContext("__cinit__"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_interval = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":91 + * # tree size. Also, python's uniform is perfect since the + * # upper limit is not inclusive, which gives us undefined here. + * self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1))) # <<<<<<<<<<<<<< + * self.start = start + * self.end = end + */ + __pyx_t_1 = (1.0 * rand()); + if (unlikely(RAND_MAX == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = ((__pyx_t_1 / RAND_MAX) - 1.0); + if (unlikely(__pyx_t_2 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->priority = ceil((__pyx_v_2bx_9intervals_12intersection_nlog * log((-1.0 / __pyx_t_2)))); + + /* "bx/intervals/intersection.pyx":92 + * # upper limit is not inclusive, which gives us undefined here. + * self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1))) + * self.start = start # <<<<<<<<<<<<<< + * self.end = end + * self.interval = interval + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->start = __pyx_v_start; + + /* "bx/intervals/intersection.pyx":93 + * self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1))) + * self.start = start + * self.end = end # <<<<<<<<<<<<<< + * self.interval = interval + * self.maxend = end + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->end = __pyx_v_end; + + /* "bx/intervals/intersection.pyx":94 + * self.start = start + * self.end = end + * self.interval = interval # <<<<<<<<<<<<<< + * self.maxend = end + * self.minstart = start + */ + __Pyx_INCREF(__pyx_v_interval); + __Pyx_GIVEREF(__pyx_v_interval); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval = __pyx_v_interval; + + /* "bx/intervals/intersection.pyx":95 + * self.end = end + * self.interval = interval + * self.maxend = end # <<<<<<<<<<<<<< + * self.minstart = start + * self.minend = end + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->maxend = __pyx_v_end; + + /* "bx/intervals/intersection.pyx":96 + * self.interval = interval + * self.maxend = end + * self.minstart = start # <<<<<<<<<<<<<< + * self.minend = end + * self.cleft = EmptyNode + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->minstart = __pyx_v_start; + + /* "bx/intervals/intersection.pyx":97 + * self.maxend = end + * self.minstart = start + * self.minend = end # <<<<<<<<<<<<<< + * self.cleft = EmptyNode + * self.cright = EmptyNode + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->minend = __pyx_v_end; + + /* "bx/intervals/intersection.pyx":98 + * self.minstart = start + * self.minend = end + * self.cleft = EmptyNode # <<<<<<<<<<<<<< + * self.cright = EmptyNode + * self.croot = EmptyNode + */ + __Pyx_INCREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft)); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cleft = __pyx_v_2bx_9intervals_12intersection_EmptyNode; + + /* "bx/intervals/intersection.pyx":99 + * self.minend = end + * self.cleft = EmptyNode + * self.cright = EmptyNode # <<<<<<<<<<<<<< + * self.croot = EmptyNode + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright)); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->cright = __pyx_v_2bx_9intervals_12intersection_EmptyNode; + + /* "bx/intervals/intersection.pyx":100 + * self.cleft = EmptyNode + * self.cright = EmptyNode + * self.croot = EmptyNode # <<<<<<<<<<<<<< + * + * cpdef IntervalNode insert(IntervalNode self, int start, int end, object interval): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot)); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->croot = __pyx_v_2bx_9intervals_12intersection_EmptyNode; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":102 + * self.croot = EmptyNode + * + * cpdef IntervalNode insert(IntervalNode self, int start, int end, object interval): # <<<<<<<<<<<<<< + * """ + * Insert a new IntervalNode into the tree of which this node is + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_f_2bx_9intervals_12intersection_12IntervalNode_insert(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, int __pyx_v_start, int __pyx_v_end, PyObject *__pyx_v_interval, int __pyx_skip_dispatch) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_croot = 0; + int __pyx_v_decision_endpoint; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("insert"); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__insert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_2insert)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_interval); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_interval); + __Pyx_GIVEREF(__pyx_v_interval); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_2bx_9intervals_12intersection_IntervalNode))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/intervals/intersection.pyx":108 + * may or may not be this node!) + * """ + * cdef IntervalNode croot = self # <<<<<<<<<<<<<< + * # If starts are the same, decide which to add interval to based on + * # end, thus maintaining sortedness relative to start/end + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_v_croot = __pyx_v_self; + + /* "bx/intervals/intersection.pyx":111 + * # If starts are the same, decide which to add interval to based on + * # end, thus maintaining sortedness relative to start/end + * cdef int decision_endpoint = start # <<<<<<<<<<<<<< + * if start == self.start: + * decision_endpoint = end + */ + __pyx_v_decision_endpoint = __pyx_v_start; + + /* "bx/intervals/intersection.pyx":112 + * # end, thus maintaining sortedness relative to start/end + * cdef int decision_endpoint = start + * if start == self.start: # <<<<<<<<<<<<<< + * decision_endpoint = end + * + */ + __pyx_t_5 = (__pyx_v_start == __pyx_v_self->start); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":113 + * cdef int decision_endpoint = start + * if start == self.start: + * decision_endpoint = end # <<<<<<<<<<<<<< + * + * if decision_endpoint > self.start: + */ + __pyx_v_decision_endpoint = __pyx_v_end; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":115 + * decision_endpoint = end + * + * if decision_endpoint > self.start: # <<<<<<<<<<<<<< + * # insert to cright tree + * if self.cright is not EmptyNode: + */ + __pyx_t_5 = (__pyx_v_decision_endpoint > __pyx_v_self->start); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":117 + * if decision_endpoint > self.start: + * # insert to cright tree + * if self.cright is not EmptyNode: # <<<<<<<<<<<<<< + * self.cright = self.cright.insert( start, end, interval ) + * else: + */ + __pyx_t_5 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":118 + * # insert to cright tree + * if self.cright is not EmptyNode: + * self.cright = self.cright.insert( start, end, interval ) # <<<<<<<<<<<<<< + * else: + * self.cright = IntervalNode( start, end, interval ) + */ + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cright->__pyx_vtab)->insert(__pyx_v_self->cright, __pyx_v_start, __pyx_v_end, __pyx_v_interval, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->cright); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cright)); + __pyx_v_self->cright = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":120 + * self.cright = self.cright.insert( start, end, interval ) + * else: + * self.cright = IntervalNode( start, end, interval ) # <<<<<<<<<<<<<< + * # rebalance tree + * if self.priority < self.cright.priority: + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_interval); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_interval); + __Pyx_GIVEREF(__pyx_v_interval); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->cright); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cright)); + __pyx_v_self->cright = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":122 + * self.cright = IntervalNode( start, end, interval ) + * # rebalance tree + * if self.priority < self.cright.priority: # <<<<<<<<<<<<<< + * croot = self.rotate_left() + * else: + */ + __pyx_t_5 = (__pyx_v_self->priority < __pyx_v_self->cright->priority); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":123 + * # rebalance tree + * if self.priority < self.cright.priority: + * croot = self.rotate_left() # <<<<<<<<<<<<<< + * else: + * # insert to cleft tree + */ + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->rotate_left(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_v_croot)); + __pyx_v_croot = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + goto __pyx_L4; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":126 + * else: + * # insert to cleft tree + * if self.cleft is not EmptyNode: # <<<<<<<<<<<<<< + * self.cleft = self.cleft.insert( start, end, interval) + * else: + */ + __pyx_t_5 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":127 + * # insert to cleft tree + * if self.cleft is not EmptyNode: + * self.cleft = self.cleft.insert( start, end, interval) # <<<<<<<<<<<<<< + * else: + * self.cleft = IntervalNode( start, end, interval) + */ + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cleft->__pyx_vtab)->insert(__pyx_v_self->cleft, __pyx_v_start, __pyx_v_end, __pyx_v_interval, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->cleft); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cleft)); + __pyx_v_self->cleft = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":129 + * self.cleft = self.cleft.insert( start, end, interval) + * else: + * self.cleft = IntervalNode( start, end, interval) # <<<<<<<<<<<<<< + * # rebalance tree + * if self.priority < self.cleft.priority: + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_interval); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_interval); + __Pyx_GIVEREF(__pyx_v_interval); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->cleft); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cleft)); + __pyx_v_self->cleft = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L7:; + + /* "bx/intervals/intersection.pyx":131 + * self.cleft = IntervalNode( start, end, interval) + * # rebalance tree + * if self.priority < self.cleft.priority: # <<<<<<<<<<<<<< + * croot = self.rotate_right() + * + */ + __pyx_t_5 = (__pyx_v_self->priority < __pyx_v_self->cleft->priority); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":132 + * # rebalance tree + * if self.priority < self.cleft.priority: + * croot = self.rotate_right() # <<<<<<<<<<<<<< + * + * croot.set_ends() + */ + __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->rotate_right(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_croot)); + __pyx_v_croot = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":134 + * croot = self.rotate_right() + * + * croot.set_ends() # <<<<<<<<<<<<<< + * self.cleft.croot = croot + * self.cright.croot = croot + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_croot->__pyx_vtab)->set_ends(__pyx_v_croot); + + /* "bx/intervals/intersection.pyx":135 + * + * croot.set_ends() + * self.cleft.croot = croot # <<<<<<<<<<<<<< + * self.cright.croot = croot + * return croot + */ + __Pyx_INCREF(((PyObject *)__pyx_v_croot)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_croot)); + __Pyx_GOTREF(__pyx_v_self->cleft->croot); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cleft->croot)); + __pyx_v_self->cleft->croot = __pyx_v_croot; + + /* "bx/intervals/intersection.pyx":136 + * croot.set_ends() + * self.cleft.croot = croot + * self.cright.croot = croot # <<<<<<<<<<<<<< + * return croot + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_croot)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_croot)); + __Pyx_GOTREF(__pyx_v_self->cright->croot); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cright->croot)); + __pyx_v_self->cright->croot = __pyx_v_croot; + + /* "bx/intervals/intersection.pyx":137 + * self.cleft.croot = croot + * self.cright.croot = croot + * return croot # <<<<<<<<<<<<<< + * + * cdef IntervalNode rotate_right(IntervalNode self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_croot)); + __pyx_r = __pyx_v_croot; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_croot); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":102 + * self.croot = EmptyNode + * + * cpdef IntervalNode insert(IntervalNode self, int start, int end, object interval): # <<<<<<<<<<<<<< + * """ + * Insert a new IntervalNode into the tree of which this node is + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalNode_2insert[] = "\n Insert a new IntervalNode into the tree of which this node is\n currently the root. The return value is the new root of the tree (which\n may or may not be this node!)\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_2insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_interval = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__interval,0}; + __Pyx_RefNannySetupContext("insert"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_interval = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("insert", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->__pyx_vtab)->insert(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self), __pyx_v_start, __pyx_v_end, __pyx_v_interval, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":139 + * return croot + * + * cdef IntervalNode rotate_right(IntervalNode self): # <<<<<<<<<<<<<< + * cdef IntervalNode croot = self.cleft + * self.cleft = self.cleft.cright + */ + +static struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_f_2bx_9intervals_12intersection_12IntervalNode_rotate_right(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_croot = 0; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotate_right"); + + /* "bx/intervals/intersection.pyx":140 + * + * cdef IntervalNode rotate_right(IntervalNode self): + * cdef IntervalNode croot = self.cleft # <<<<<<<<<<<<<< + * self.cleft = self.cleft.cright + * croot.cright = self + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->cleft)); + __pyx_v_croot = __pyx_v_self->cleft; + + /* "bx/intervals/intersection.pyx":141 + * cdef IntervalNode rotate_right(IntervalNode self): + * cdef IntervalNode croot = self.cleft + * self.cleft = self.cleft.cright # <<<<<<<<<<<<<< + * croot.cright = self + * self.set_ends() + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->cleft->cright)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cleft->cright)); + __Pyx_GOTREF(__pyx_v_self->cleft); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cleft)); + __pyx_v_self->cleft = __pyx_v_self->cleft->cright; + + /* "bx/intervals/intersection.pyx":142 + * cdef IntervalNode croot = self.cleft + * self.cleft = self.cleft.cright + * croot.cright = self # <<<<<<<<<<<<<< + * self.set_ends() + * return croot + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_croot->cright); + __Pyx_DECREF(((PyObject *)__pyx_v_croot->cright)); + __pyx_v_croot->cright = __pyx_v_self; + + /* "bx/intervals/intersection.pyx":143 + * self.cleft = self.cleft.cright + * croot.cright = self + * self.set_ends() # <<<<<<<<<<<<<< + * return croot + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->set_ends(__pyx_v_self); + + /* "bx/intervals/intersection.pyx":144 + * croot.cright = self + * self.set_ends() + * return croot # <<<<<<<<<<<<<< + * + * cdef IntervalNode rotate_left(IntervalNode self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_croot)); + __pyx_r = __pyx_v_croot; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_croot); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":146 + * return croot + * + * cdef IntervalNode rotate_left(IntervalNode self): # <<<<<<<<<<<<<< + * cdef IntervalNode croot = self.cright + * self.cright = self.cright.cleft + */ + +static struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_f_2bx_9intervals_12intersection_12IntervalNode_rotate_left(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_croot = 0; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rotate_left"); + + /* "bx/intervals/intersection.pyx":147 + * + * cdef IntervalNode rotate_left(IntervalNode self): + * cdef IntervalNode croot = self.cright # <<<<<<<<<<<<<< + * self.cright = self.cright.cleft + * croot.cleft = self + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->cright)); + __pyx_v_croot = __pyx_v_self->cright; + + /* "bx/intervals/intersection.pyx":148 + * cdef IntervalNode rotate_left(IntervalNode self): + * cdef IntervalNode croot = self.cright + * self.cright = self.cright.cleft # <<<<<<<<<<<<<< + * croot.cleft = self + * self.set_ends() + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self->cright->cleft)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->cright->cleft)); + __Pyx_GOTREF(__pyx_v_self->cright); + __Pyx_DECREF(((PyObject *)__pyx_v_self->cright)); + __pyx_v_self->cright = __pyx_v_self->cright->cleft; + + /* "bx/intervals/intersection.pyx":149 + * cdef IntervalNode croot = self.cright + * self.cright = self.cright.cleft + * croot.cleft = self # <<<<<<<<<<<<<< + * self.set_ends() + * return croot + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_croot->cleft); + __Pyx_DECREF(((PyObject *)__pyx_v_croot->cleft)); + __pyx_v_croot->cleft = __pyx_v_self; + + /* "bx/intervals/intersection.pyx":150 + * self.cright = self.cright.cleft + * croot.cleft = self + * self.set_ends() # <<<<<<<<<<<<<< + * return croot + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->set_ends(__pyx_v_self); + + /* "bx/intervals/intersection.pyx":151 + * croot.cleft = self + * self.set_ends() + * return croot # <<<<<<<<<<<<<< + * + * cdef inline void set_ends(IntervalNode self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_croot)); + __pyx_r = __pyx_v_croot; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_croot); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":153 + * return croot + * + * cdef inline void set_ends(IntervalNode self): # <<<<<<<<<<<<<< + * if self.cright is not EmptyNode and self.cleft is not EmptyNode: + * self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) + */ + +static CYTHON_INLINE void __pyx_f_2bx_9intervals_12intersection_12IntervalNode_set_ends(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("set_ends"); + + /* "bx/intervals/intersection.pyx":154 + * + * cdef inline void set_ends(IntervalNode self): + * if self.cright is not EmptyNode and self.cleft is not EmptyNode: # <<<<<<<<<<<<<< + * self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) + * self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) + */ + __pyx_t_1 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "bx/intervals/intersection.pyx":155 + * cdef inline void set_ends(IntervalNode self): + * if self.cright is not EmptyNode and self.cleft is not EmptyNode: + * self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) # <<<<<<<<<<<<<< + * self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) + * self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) + */ + __pyx_v_self->maxend = __pyx_f_2bx_9intervals_12intersection_imax3(__pyx_v_self->end, __pyx_v_self->cright->maxend, __pyx_v_self->cleft->maxend); + + /* "bx/intervals/intersection.pyx":156 + * if self.cright is not EmptyNode and self.cleft is not EmptyNode: + * self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) + * self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) # <<<<<<<<<<<<<< + * self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) + * elif self.cright is not EmptyNode: + */ + __pyx_v_self->minend = __pyx_f_2bx_9intervals_12intersection_imin3(__pyx_v_self->end, __pyx_v_self->cright->minend, __pyx_v_self->cleft->minend); + + /* "bx/intervals/intersection.pyx":157 + * self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) + * self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) + * self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) # <<<<<<<<<<<<<< + * elif self.cright is not EmptyNode: + * self.maxend = imax2(self.end, self.cright.maxend) + */ + __pyx_v_self->minstart = __pyx_f_2bx_9intervals_12intersection_imin3(__pyx_v_self->start, __pyx_v_self->cright->minstart, __pyx_v_self->cleft->minstart); + goto __pyx_L3; + } + + /* "bx/intervals/intersection.pyx":158 + * self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) + * self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) + * elif self.cright is not EmptyNode: # <<<<<<<<<<<<<< + * self.maxend = imax2(self.end, self.cright.maxend) + * self.minend = imin2(self.end, self.cright.minend) + */ + __pyx_t_3 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_3) { + + /* "bx/intervals/intersection.pyx":159 + * self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) + * elif self.cright is not EmptyNode: + * self.maxend = imax2(self.end, self.cright.maxend) # <<<<<<<<<<<<<< + * self.minend = imin2(self.end, self.cright.minend) + * self.minstart = imin2(self.start, self.cright.minstart) + */ + __pyx_v_self->maxend = __pyx_f_2bx_9intervals_12intersection_imax2(__pyx_v_self->end, __pyx_v_self->cright->maxend); + + /* "bx/intervals/intersection.pyx":160 + * elif self.cright is not EmptyNode: + * self.maxend = imax2(self.end, self.cright.maxend) + * self.minend = imin2(self.end, self.cright.minend) # <<<<<<<<<<<<<< + * self.minstart = imin2(self.start, self.cright.minstart) + * elif self.cleft is not EmptyNode: + */ + __pyx_v_self->minend = __pyx_f_2bx_9intervals_12intersection_imin2(__pyx_v_self->end, __pyx_v_self->cright->minend); + + /* "bx/intervals/intersection.pyx":161 + * self.maxend = imax2(self.end, self.cright.maxend) + * self.minend = imin2(self.end, self.cright.minend) + * self.minstart = imin2(self.start, self.cright.minstart) # <<<<<<<<<<<<<< + * elif self.cleft is not EmptyNode: + * self.maxend = imax2(self.end, self.cleft.maxend) + */ + __pyx_v_self->minstart = __pyx_f_2bx_9intervals_12intersection_imin2(__pyx_v_self->start, __pyx_v_self->cright->minstart); + goto __pyx_L3; + } + + /* "bx/intervals/intersection.pyx":162 + * self.minend = imin2(self.end, self.cright.minend) + * self.minstart = imin2(self.start, self.cright.minstart) + * elif self.cleft is not EmptyNode: # <<<<<<<<<<<<<< + * self.maxend = imax2(self.end, self.cleft.maxend) + * self.minend = imin2(self.end, self.cleft.minend) + */ + __pyx_t_3 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_3) { + + /* "bx/intervals/intersection.pyx":163 + * self.minstart = imin2(self.start, self.cright.minstart) + * elif self.cleft is not EmptyNode: + * self.maxend = imax2(self.end, self.cleft.maxend) # <<<<<<<<<<<<<< + * self.minend = imin2(self.end, self.cleft.minend) + * self.minstart = imin2(self.start, self.cleft.minstart) + */ + __pyx_v_self->maxend = __pyx_f_2bx_9intervals_12intersection_imax2(__pyx_v_self->end, __pyx_v_self->cleft->maxend); + + /* "bx/intervals/intersection.pyx":164 + * elif self.cleft is not EmptyNode: + * self.maxend = imax2(self.end, self.cleft.maxend) + * self.minend = imin2(self.end, self.cleft.minend) # <<<<<<<<<<<<<< + * self.minstart = imin2(self.start, self.cleft.minstart) + * + */ + __pyx_v_self->minend = __pyx_f_2bx_9intervals_12intersection_imin2(__pyx_v_self->end, __pyx_v_self->cleft->minend); + + /* "bx/intervals/intersection.pyx":165 + * self.maxend = imax2(self.end, self.cleft.maxend) + * self.minend = imin2(self.end, self.cleft.minend) + * self.minstart = imin2(self.start, self.cleft.minstart) # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->minstart = __pyx_f_2bx_9intervals_12intersection_imin2(__pyx_v_self->start, __pyx_v_self->cleft->minstart); + goto __pyx_L3; + } + __pyx_L3:; + + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/intersection.pyx":168 + * + * + * def intersect( self, int start, int end, sort=True ): # <<<<<<<<<<<<<< + * """ + * given a start and a end, return a list of features + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3intersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalNode_3intersect[] = "\n given a start and a end, return a list of features\n falling within that range\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3intersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_sort = 0; + PyObject *__pyx_v_results = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__sort,0}; + __Pyx_RefNannySetupContext("intersect"); + { + PyObject* values[3] = {0,0,0}; + values[2] = __pyx_k_2; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("intersect", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sort); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "intersect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sort = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("intersect", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":173 + * falling within that range + * """ + * cdef list results = [] # <<<<<<<<<<<<<< + * self._intersect( start, end, results ) + * return results + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_results = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":174 + * """ + * cdef list results = [] + * self._intersect( start, end, results ) # <<<<<<<<<<<<<< + * return results + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->__pyx_vtab)->_intersect(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self), __pyx_v_start, __pyx_v_end, __pyx_v_results); + + /* "bx/intervals/intersection.pyx":175 + * cdef list results = [] + * self._intersect( start, end, results ) + * return results # <<<<<<<<<<<<<< + * + * find = intersect + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_results)); + __pyx_r = ((PyObject *)__pyx_v_results); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":179 + * find = intersect + * + * cdef void _intersect( IntervalNode self, int start, int end, list results): # <<<<<<<<<<<<<< + * # Left subtree + * if self.cleft is not EmptyNode and self.cleft.maxend > start: + */ + +static void __pyx_f_2bx_9intervals_12intersection_12IntervalNode__intersect(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, int __pyx_v_start, int __pyx_v_end, PyObject *__pyx_v_results) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_intersect"); + + /* "bx/intervals/intersection.pyx":181 + * cdef void _intersect( IntervalNode self, int start, int end, list results): + * # Left subtree + * if self.cleft is not EmptyNode and self.cleft.maxend > start: # <<<<<<<<<<<<<< + * self.cleft._intersect( start, end, results ) + * # This interval + */ + __pyx_t_1 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_self->cleft->maxend > __pyx_v_start); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "bx/intervals/intersection.pyx":182 + * # Left subtree + * if self.cleft is not EmptyNode and self.cleft.maxend > start: + * self.cleft._intersect( start, end, results ) # <<<<<<<<<<<<<< + * # This interval + * if ( self.end > start ) and ( self.start < end ): + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cleft->__pyx_vtab)->_intersect(__pyx_v_self->cleft, __pyx_v_start, __pyx_v_end, __pyx_v_results); + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":184 + * self.cleft._intersect( start, end, results ) + * # This interval + * if ( self.end > start ) and ( self.start < end ): # <<<<<<<<<<<<<< + * results.append( self.interval ) + * # Right subtree + */ + __pyx_t_3 = (__pyx_v_self->end > __pyx_v_start); + if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_self->start < __pyx_v_end); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":185 + * # This interval + * if ( self.end > start ) and ( self.start < end ): + * results.append( self.interval ) # <<<<<<<<<<<<<< + * # Right subtree + * if self.cright is not EmptyNode and self.start < end: + */ + if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __pyx_v_self->interval; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyList_Append(__pyx_v_results, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":187 + * results.append( self.interval ) + * # Right subtree + * if self.cright is not EmptyNode and self.start < end: # <<<<<<<<<<<<<< + * self.cright._intersect( start, end, results ) + * + */ + __pyx_t_2 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_self->start < __pyx_v_end); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":188 + * # Right subtree + * if self.cright is not EmptyNode and self.start < end: + * self.cright._intersect( start, end, results ) # <<<<<<<<<<<<<< + * + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cright->__pyx_vtab)->_intersect(__pyx_v_self->cright, __pyx_v_start, __pyx_v_end, __pyx_v_results); + goto __pyx_L5; + } + __pyx_L5:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("bx.intervals.intersection.IntervalNode._intersect", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/intersection.pyx":191 + * + * + * cdef void _seek_left(IntervalNode self, int position, list results, int n, int max_dist): # <<<<<<<<<<<<<< + * # we know we can bail in these 2 cases. + * if self.maxend + max_dist < position: + */ + +static void __pyx_f_2bx_9intervals_12intersection_12IntervalNode__seek_left(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, int __pyx_v_position, PyObject *__pyx_v_results, int __pyx_v_n, int __pyx_v_max_dist) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_seek_left"); + + /* "bx/intervals/intersection.pyx":193 + * cdef void _seek_left(IntervalNode self, int position, list results, int n, int max_dist): + * # we know we can bail in these 2 cases. + * if self.maxend + max_dist < position: # <<<<<<<<<<<<<< + * return + * if self.minstart > position: + */ + __pyx_t_1 = ((__pyx_v_self->maxend + __pyx_v_max_dist) < __pyx_v_position); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":194 + * # we know we can bail in these 2 cases. + * if self.maxend + max_dist < position: + * return # <<<<<<<<<<<<<< + * if self.minstart > position: + * return + */ + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":195 + * if self.maxend + max_dist < position: + * return + * if self.minstart > position: # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_1 = (__pyx_v_self->minstart > __pyx_v_position); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":196 + * return + * if self.minstart > position: + * return # <<<<<<<<<<<<<< + * + * # the ordering of these 3 blocks makes it so the results are + */ + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":200 + * # the ordering of these 3 blocks makes it so the results are + * # ordered nearest to farest from the query position + * if self.cright is not EmptyNode: # <<<<<<<<<<<<<< + * self.cright._seek_left(position, results, n, max_dist) + * + */ + __pyx_t_1 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":201 + * # ordered nearest to farest from the query position + * if self.cright is not EmptyNode: + * self.cright._seek_left(position, results, n, max_dist) # <<<<<<<<<<<<<< + * + * if -1 < position - self.end < max_dist: + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cright->__pyx_vtab)->_seek_left(__pyx_v_self->cright, __pyx_v_position, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":203 + * self.cright._seek_left(position, results, n, max_dist) + * + * if -1 < position - self.end < max_dist: # <<<<<<<<<<<<<< + * results.append(self.interval) + * + */ + __pyx_t_2 = (__pyx_v_position - __pyx_v_self->end); + __pyx_t_1 = (-1 < __pyx_t_2); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_t_2 < __pyx_v_max_dist); + } + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":204 + * + * if -1 < position - self.end < max_dist: + * results.append(self.interval) # <<<<<<<<<<<<<< + * + * # TODO: can these conditionals be more stringent? + */ + if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __pyx_v_self->interval; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":207 + * + * # TODO: can these conditionals be more stringent? + * if self.cleft is not EmptyNode: # <<<<<<<<<<<<<< + * self.cleft._seek_left(position, results, n, max_dist) + * + */ + __pyx_t_1 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":208 + * # TODO: can these conditionals be more stringent? + * if self.cleft is not EmptyNode: + * self.cleft._seek_left(position, results, n, max_dist) # <<<<<<<<<<<<<< + * + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cleft->__pyx_vtab)->_seek_left(__pyx_v_self->cleft, __pyx_v_position, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + goto __pyx_L7; + } + __pyx_L7:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("bx.intervals.intersection.IntervalNode._seek_left", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/intersection.pyx":212 + * + * + * cdef void _seek_right(IntervalNode self, int position, list results, int n, int max_dist): # <<<<<<<<<<<<<< + * # we know we can bail in these 2 cases. + * if self.maxend < position: return + */ + +static void __pyx_f_2bx_9intervals_12intersection_12IntervalNode__seek_right(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, int __pyx_v_position, PyObject *__pyx_v_results, int __pyx_v_n, int __pyx_v_max_dist) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_seek_right"); + + /* "bx/intervals/intersection.pyx":214 + * cdef void _seek_right(IntervalNode self, int position, list results, int n, int max_dist): + * # we know we can bail in these 2 cases. + * if self.maxend < position: return # <<<<<<<<<<<<<< + * if self.minstart - max_dist > position: return + * + */ + __pyx_t_1 = (__pyx_v_self->maxend < __pyx_v_position); + if (__pyx_t_1) { + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":215 + * # we know we can bail in these 2 cases. + * if self.maxend < position: return + * if self.minstart - max_dist > position: return # <<<<<<<<<<<<<< + * + * #print "SEEK_RIGHT:",self, self.cleft, self.maxend, self.minstart, position + */ + __pyx_t_1 = ((__pyx_v_self->minstart - __pyx_v_max_dist) > __pyx_v_position); + if (__pyx_t_1) { + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "bx/intervals/intersection.pyx":221 + * # the ordering of these 3 blocks makes it so the results are + * # ordered nearest to farest from the query position + * if self.cleft is not EmptyNode: # <<<<<<<<<<<<<< + * self.cleft._seek_right(position, results, n, max_dist) + * + */ + __pyx_t_1 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":222 + * # ordered nearest to farest from the query position + * if self.cleft is not EmptyNode: + * self.cleft._seek_right(position, results, n, max_dist) # <<<<<<<<<<<<<< + * + * if -1 < self.start - position < max_dist: + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cleft->__pyx_vtab)->_seek_right(__pyx_v_self->cleft, __pyx_v_position, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":224 + * self.cleft._seek_right(position, results, n, max_dist) + * + * if -1 < self.start - position < max_dist: # <<<<<<<<<<<<<< + * results.append(self.interval) + * + */ + __pyx_t_2 = (__pyx_v_self->start - __pyx_v_position); + __pyx_t_1 = (-1 < __pyx_t_2); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_t_2 < __pyx_v_max_dist); + } + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":225 + * + * if -1 < self.start - position < max_dist: + * results.append(self.interval) # <<<<<<<<<<<<<< + * + * if self.cright is not EmptyNode: + */ + if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __pyx_v_self->interval; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyList_Append(__pyx_v_results, __pyx_t_3); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":227 + * results.append(self.interval) + * + * if self.cright is not EmptyNode: # <<<<<<<<<<<<<< + * self.cright._seek_right(position, results, n, max_dist) + * + */ + __pyx_t_1 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":228 + * + * if self.cright is not EmptyNode: + * self.cright._seek_right(position, results, n, max_dist) # <<<<<<<<<<<<<< + * + * + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cright->__pyx_vtab)->_seek_right(__pyx_v_self->cright, __pyx_v_position, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + goto __pyx_L7; + } + __pyx_L7:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("bx.intervals.intersection.IntervalNode._seek_right", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/intersection.pyx":231 + * + * + * cpdef left(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a start > than `position` + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_4left(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_9intervals_12intersection_12IntervalNode_left(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, PyObject *__pyx_v_position, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left *__pyx_optional_args) { + int __pyx_v_n = ((int)1); + int __pyx_v_max_dist = ((int)2500); + PyObject *__pyx_v_results = 0; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("left"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_n = __pyx_optional_args->n; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_max_dist = __pyx_optional_args->max_dist; + } + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__left); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_4left)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_max_dist); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_position); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_position); + __Pyx_GIVEREF(__pyx_v_position); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/intervals/intersection.pyx":238 + * max_dist: the maximum distance to look before giving up. + * """ + * cdef list results = [] # <<<<<<<<<<<<<< + * # use start - 1 becuase .left() assumes strictly left-of + * self._seek_left( position - 1, results, n, max_dist ) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_results = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":240 + * cdef list results = [] + * # use start - 1 becuase .left() assumes strictly left-of + * self._seek_left( position - 1, results, n, max_dist ) # <<<<<<<<<<<<<< + * if len(results) == n: return results + * r = results + */ + __pyx_t_1 = PyNumber_Subtract(__pyx_v_position, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->_seek_left(__pyx_v_self, __pyx_t_5, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + + /* "bx/intervals/intersection.pyx":241 + * # use start - 1 becuase .left() assumes strictly left-of + * self._seek_left( position - 1, results, n, max_dist ) + * if len(results) == n: return results # <<<<<<<<<<<<<< + * r = results + * r.sort(key=operator.attrgetter('end'), reverse=True) + */ + if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_results)); + __pyx_t_7 = (__pyx_t_6 == __pyx_v_n); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_results)); + __pyx_r = ((PyObject *)__pyx_v_results); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":242 + * self._seek_left( position - 1, results, n, max_dist ) + * if len(results) == n: return results + * r = results # <<<<<<<<<<<<<< + * r.sort(key=operator.attrgetter('end'), reverse=True) + * return r[:n] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_results)); + __pyx_v_r = __pyx_v_results; + + /* "bx/intervals/intersection.pyx":243 + * if len(results) == n: return results + * r = results + * r.sort(key=operator.attrgetter('end'), reverse=True) # <<<<<<<<<<<<<< + * return r[:n] + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_r), __pyx_n_s__sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__operator); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__attrgetter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__key), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__reverse), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/intervals/intersection.pyx":244 + * r = results + * r.sort(key=operator.attrgetter('end'), reverse=True) + * return r[:n] # <<<<<<<<<<<<<< + * + * cpdef right(self, position, int n=1, int max_dist=2500): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_r), 0, __pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.left", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":231 + * + * + * cpdef left(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a start > than `position` + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_4left(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalNode_4left[] = "\n find n features with a start > than `position`\n f: a Interval object (or anything with an `end` attribute)\n n: the number of features to return\n max_dist: the maximum distance to look before giving up.\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_4left(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_position = 0; + int __pyx_v_n; + int __pyx_v_max_dist; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__position,&__pyx_n_s__n,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("left"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__position); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "left") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_position = values[0]; + if (values[1]) { + __pyx_v_n = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_n = ((int)1); + } + if (values[2]) { + __pyx_v_max_dist = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_max_dist == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_dist = ((int)2500); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("left", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.left", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.n = __pyx_v_n; + __pyx_t_2.max_dist = __pyx_v_max_dist; + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->__pyx_vtab)->left(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self), __pyx_v_position, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.left", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":246 + * return r[:n] + * + * cpdef right(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a end < than position + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5right(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_2bx_9intervals_12intersection_12IntervalNode_right(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, PyObject *__pyx_v_position, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right *__pyx_optional_args) { + int __pyx_v_n = ((int)1); + int __pyx_v_max_dist = ((int)2500); + PyObject *__pyx_v_results = 0; + PyObject *__pyx_v_r = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("right"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_n = __pyx_optional_args->n; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_max_dist = __pyx_optional_args->max_dist; + } + } + } + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__right); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5right)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_max_dist); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_position); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_position); + __Pyx_GIVEREF(__pyx_v_position); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "bx/intervals/intersection.pyx":253 + * max_dist: the maximum distance to look before giving up. + * """ + * cdef list results = [] # <<<<<<<<<<<<<< + * # use end + 1 becuase .right() assumes strictly right-of + * self._seek_right(position + 1, results, n, max_dist) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_results = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":255 + * cdef list results = [] + * # use end + 1 becuase .right() assumes strictly right-of + * self._seek_right(position + 1, results, n, max_dist) # <<<<<<<<<<<<<< + * if len(results) == n: return results + * r = results + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_position, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->__pyx_vtab)->_seek_right(__pyx_v_self, __pyx_t_5, __pyx_v_results, __pyx_v_n, __pyx_v_max_dist); + + /* "bx/intervals/intersection.pyx":256 + * # use end + 1 becuase .right() assumes strictly right-of + * self._seek_right(position + 1, results, n, max_dist) + * if len(results) == n: return results # <<<<<<<<<<<<<< + * r = results + * r.sort(key=operator.attrgetter('start')) + */ + if (unlikely(((PyObject *)__pyx_v_results) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_results)); + __pyx_t_7 = (__pyx_t_6 == __pyx_v_n); + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_results)); + __pyx_r = ((PyObject *)__pyx_v_results); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":257 + * self._seek_right(position + 1, results, n, max_dist) + * if len(results) == n: return results + * r = results # <<<<<<<<<<<<<< + * r.sort(key=operator.attrgetter('start')) + * return r[:n] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_results)); + __pyx_v_r = __pyx_v_results; + + /* "bx/intervals/intersection.pyx":258 + * if len(results) == n: return results + * r = results + * r.sort(key=operator.attrgetter('start')) # <<<<<<<<<<<<<< + * return r[:n] + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_r), __pyx_n_s__sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__operator); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__attrgetter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__key), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/intervals/intersection.pyx":259 + * r = results + * r.sort(key=operator.attrgetter('start')) + * return r[:n] # <<<<<<<<<<<<<< + * + * def traverse(self, func): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_r), 0, __pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.right", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_results); + __Pyx_XDECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":246 + * return r[:n] + * + * cpdef right(self, position, int n=1, int max_dist=2500): # <<<<<<<<<<<<<< + * """ + * find n features with a end < than position + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5right(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalNode_5right[] = "\n find n features with a end < than position\n f: a Interval object (or anything with a `start` attribute)\n n: the number of features to return\n max_dist: the maximum distance to look before giving up.\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5right(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_position = 0; + int __pyx_v_n; + int __pyx_v_max_dist; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__position,&__pyx_n_s__n,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("right"); + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__position); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "right") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_position = values[0]; + if (values[1]) { + __pyx_v_n = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_n = ((int)1); + } + if (values[2]) { + __pyx_v_max_dist = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_max_dist == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_max_dist = ((int)2500); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("right", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.right", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.n = __pyx_v_n; + __pyx_t_2.max_dist = __pyx_v_max_dist; + __pyx_t_1 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->__pyx_vtab)->right(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self), __pyx_v_position, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.right", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":261 + * return r[:n] + * + * def traverse(self, func): # <<<<<<<<<<<<<< + * self._traverse(func) + * + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_6traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_func); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_6traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_func) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("traverse"); + + /* "bx/intervals/intersection.pyx":262 + * + * def traverse(self, func): + * self._traverse(func) # <<<<<<<<<<<<<< + * + * cdef void _traverse(IntervalNode self, object func): + */ + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->__pyx_vtab)->_traverse(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self), __pyx_v_func); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":264 + * self._traverse(func) + * + * cdef void _traverse(IntervalNode self, object func): # <<<<<<<<<<<<<< + * if self.cleft is not EmptyNode: self.cleft._traverse(func) + * func(self) + */ + +static void __pyx_f_2bx_9intervals_12intersection_12IntervalNode__traverse(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *__pyx_v_self, PyObject *__pyx_v_func) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_traverse"); + + /* "bx/intervals/intersection.pyx":265 + * + * cdef void _traverse(IntervalNode self, object func): + * if self.cleft is not EmptyNode: self.cleft._traverse(func) # <<<<<<<<<<<<<< + * func(self) + * if self.cright is not EmptyNode: self.cright._traverse(func) + */ + __pyx_t_1 = (__pyx_v_self->cleft != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cleft->__pyx_vtab)->_traverse(__pyx_v_self->cleft, __pyx_v_func); + goto __pyx_L3; + } + __pyx_L3:; + + /* "bx/intervals/intersection.pyx":266 + * cdef void _traverse(IntervalNode self, object func): + * if self.cleft is not EmptyNode: self.cleft._traverse(func) + * func(self) # <<<<<<<<<<<<<< + * if self.cright is not EmptyNode: self.cright._traverse(func) + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_3 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "bx/intervals/intersection.pyx":267 + * if self.cleft is not EmptyNode: self.cleft._traverse(func) + * func(self) + * if self.cright is not EmptyNode: self.cright._traverse(func) # <<<<<<<<<<<<<< + * + * cdef IntervalNode EmptyNode = IntervalNode( 0, 0, Interval(0, 0)) + */ + __pyx_t_1 = (__pyx_v_self->cright != __pyx_v_2bx_9intervals_12intersection_EmptyNode); + if (__pyx_t_1) { + ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self->cright->__pyx_vtab)->_traverse(__pyx_v_self->cright, __pyx_v_func); + goto __pyx_L4; + } + __pyx_L4:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("bx.intervals.intersection.IntervalNode._traverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* "bx/intervals/intersection.pyx":68 + * """ + * cdef float priority + * cdef public object interval # <<<<<<<<<<<<<< + * cdef public int start, end + * cdef int minend, maxend, minstart + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->interval = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":69 + * cdef float priority + * cdef public object interval + * cdef public int start, end # <<<<<<<<<<<<<< + * cdef int minend, maxend, minstart + * cdef IntervalNode cleft, cright, croot + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->start = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_v_self)->end = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalNode.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":290 + * cdef public object value, chrom, strand + * + * def __init__(self, int start, int end, object value=None, object chrom=None, object strand=None ): # <<<<<<<<<<<<<< + * assert start <= end, "start must be less than end" + * self.start = start + */ + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_chrom = 0; + PyObject *__pyx_v_strand = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__value,&__pyx_n_s__chrom,&__pyx_n_s__strand,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[5] = {0,0,0,0,0}; + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = values[2]; + __pyx_v_chrom = values[3]; + __pyx_v_strand = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.Interval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":291 + * + * def __init__(self, int start, int end, object value=None, object chrom=None, object strand=None ): + * assert start <= end, "start must be less than end" # <<<<<<<<<<<<<< + * self.start = start + * self.end = end + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_start <= __pyx_v_end))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_5)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intervals/intersection.pyx":292 + * def __init__(self, int start, int end, object value=None, object chrom=None, object strand=None ): + * assert start <= end, "start must be less than end" + * self.start = start # <<<<<<<<<<<<<< + * self.end = end + * self.value = value + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->start = __pyx_v_start; + + /* "bx/intervals/intersection.pyx":293 + * assert start <= end, "start must be less than end" + * self.start = start + * self.end = end # <<<<<<<<<<<<<< + * self.value = value + * self.chrom = chrom + */ + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->end = __pyx_v_end; + + /* "bx/intervals/intersection.pyx":294 + * self.start = start + * self.end = end + * self.value = value # <<<<<<<<<<<<<< + * self.chrom = chrom + * self.strand = strand + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value = __pyx_v_value; + + /* "bx/intervals/intersection.pyx":295 + * self.end = end + * self.value = value + * self.chrom = chrom # <<<<<<<<<<<<<< + * self.strand = strand + * + */ + __Pyx_INCREF(__pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom = __pyx_v_chrom; + + /* "bx/intervals/intersection.pyx":296 + * self.value = value + * self.chrom = chrom + * self.strand = strand # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_INCREF(__pyx_v_strand); + __Pyx_GIVEREF(__pyx_v_strand); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand = __pyx_v_strand; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.Interval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":298 + * self.strand = strand + * + * def __repr__(self): # <<<<<<<<<<<<<< + * fstr = "Interval(%d, %d" % (self.start, self.end) + * if not self.value is None: + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_1__repr__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_1__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_fstr = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__"); + + /* "bx/intervals/intersection.pyx":299 + * + * def __repr__(self): + * fstr = "Interval(%d, %d" % (self.start, self.end) # <<<<<<<<<<<<<< + * if not self.value is None: + * fstr += ", value=" + str(self.value) + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_fstr = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "bx/intervals/intersection.pyx":300 + * def __repr__(self): + * fstr = "Interval(%d, %d" % (self.start, self.end) + * if not self.value is None: # <<<<<<<<<<<<<< + * fstr += ", value=" + str(self.value) + * fstr += ")" + */ + __pyx_t_4 = (((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value == Py_None); + __pyx_t_5 = (!__pyx_t_4); + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":301 + * fstr = "Interval(%d, %d" % (self.start, self.end) + * if not self.value is None: + * fstr += ", value=" + str(self.value) # <<<<<<<<<<<<<< + * fstr += ")" + * return fstr + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __Pyx_GIVEREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_7), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_fstr, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_fstr); + __pyx_v_fstr = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":302 + * if not self.value is None: + * fstr += ", value=" + str(self.value) + * fstr += ")" # <<<<<<<<<<<<<< + * return fstr + * + */ + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_fstr, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_fstr); + __pyx_v_fstr = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/intervals/intersection.pyx":303 + * fstr += ", value=" + str(self.value) + * fstr += ")" + * return fstr # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, op): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_fstr); + __pyx_r = __pyx_v_fstr; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.intervals.intersection.Interval.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fstr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":305 + * return fstr + * + * def __richcmp__(self, other, op): # <<<<<<<<<<<<<< + * if op == 0: + * # < + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_2__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op) { + PyObject *__pyx_v_op = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__"); + __pyx_v_op = PyInt_FromLong(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_v_op); + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.Interval.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":306 + * + * def __richcmp__(self, other, op): + * if op == 0: # <<<<<<<<<<<<<< + * # < + * return self.start < other.start or self.end < other.end + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_op, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":308 + * if op == 0: + * # < + * return self.start < other.start or self.end < other.end # <<<<<<<<<<<<<< + * elif op == 1: + * # <= + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "bx/intervals/intersection.pyx":309 + * # < + * return self.start < other.start or self.end < other.end + * elif op == 1: # <<<<<<<<<<<<<< + * # <= + * return self == other or self < other + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_op, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":311 + * elif op == 1: + * # <= + * return self == other or self < other # <<<<<<<<<<<<<< + * elif op == 2: + * # == + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "bx/intervals/intersection.pyx":312 + * # <= + * return self == other or self < other + * elif op == 2: # <<<<<<<<<<<<<< + * # == + * return self.start == other.start and self.end == other.end + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_op, __pyx_int_2, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":314 + * elif op == 2: + * # == + * return self.start == other.start and self.end == other.end # <<<<<<<<<<<<<< + * elif op == 3: + * # != + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_5 = __pyx_t_4; + __pyx_t_4 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "bx/intervals/intersection.pyx":315 + * # == + * return self.start == other.start and self.end == other.end + * elif op == 3: # <<<<<<<<<<<<<< + * # != + * return self.start != other.start or self.end != other.end + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_op, __pyx_int_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":317 + * elif op == 3: + * # != + * return self.start != other.start or self.end != other.end # <<<<<<<<<<<<<< + * elif op == 4: + * # > + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "bx/intervals/intersection.pyx":318 + * # != + * return self.start != other.start or self.end != other.end + * elif op == 4: # <<<<<<<<<<<<<< + * # > + * return self.start > other.start or self.end > other.end + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_op, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":320 + * elif op == 4: + * # > + * return self.start > other.start or self.end > other.end # <<<<<<<<<<<<<< + * elif op == 5: + * # >= + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_other, __pyx_n_s__end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + + /* "bx/intervals/intersection.pyx":321 + * # > + * return self.start > other.start or self.end > other.end + * elif op == 5: # <<<<<<<<<<<<<< + * # >= + * return self == other or self > other + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_op, __pyx_int_5, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_2) { + + /* "bx/intervals/intersection.pyx":323 + * elif op == 5: + * # >= + * return self == other or self > other # <<<<<<<<<<<<<< + * + * cdef class IntervalTree: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.intervals.intersection.Interval.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_op); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":287 + * + * """ + * cdef public int start, end # <<<<<<<<<<<<<< + * cdef public object value, chrom, strand + * + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5start___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5start___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.Interval.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->start = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.Interval.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_3end___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_3end___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.intervals.intersection.Interval.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__"); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->end = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.intervals.intersection.Interval.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":288 + * """ + * cdef public int start, end + * cdef public object value, chrom, strand # <<<<<<<<<<<<<< + * + * def __init__(self, int start, int end, object value=None, object chrom=None, object strand=None ): + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5value___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5value___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->value = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->chrom = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_6strand___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_2bx_9intervals_12intersection_8Interval_6strand___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + __pyx_r = ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand = __pyx_v_value; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_2__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_2__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + __Pyx_DECREF(((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand); + ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)__pyx_v_self)->strand = Py_None; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":383 + * cdef IntervalNode root + * + * def __cinit__( self ): # <<<<<<<<<<<<<< + * root = None + * + */ + +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_9intervals_12intersection_12IntervalTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_root = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "bx/intervals/intersection.pyx":384 + * + * def __cinit__( self ): + * root = None # <<<<<<<<<<<<<< + * + * # ---- Position based interfaces ----------------------------------------- + */ + __Pyx_INCREF(Py_None); + __pyx_v_root = Py_None; + + __pyx_r = 0; + __Pyx_XDECREF(__pyx_v_root); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":388 + * # ---- Position based interfaces ----------------------------------------- + * + * def insert( self, int start, int end, object value=None ): # <<<<<<<<<<<<<< + * """ + * Insert the interval [start,end) associated with value `value`. + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_1insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_1insert[] = "\n Insert the interval [start,end) associated with value `value`.\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_1insert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("insert"); + { + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("insert", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "insert") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_start = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("insert", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":392 + * Insert the interval [start,end) associated with value `value`. + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * self.root = IntervalNode( start, end, value ) + * else: + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":393 + * """ + * if self.root is None: + * self.root = IntervalNode( start, end, value ) # <<<<<<<<<<<<<< + * else: + * self.root = self.root.insert( start, end, value ) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root)); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":395 + * self.root = IntervalNode( start, end, value ) + * else: + * self.root = self.root.insert( start, end, value ) # <<<<<<<<<<<<<< + * + * add = insert + */ + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->insert(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_v_start, __pyx_v_end, __pyx_v_value, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root)); + ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.insert", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":400 + * + * + * def find( self, start, end ): # <<<<<<<<<<<<<< + * """ + * Return a sorted list of all intervals overlapping [start,end). + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_2find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_2find[] = "\n Return a sorted list of all intervals overlapping [start,end).\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_2find(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("find"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "find") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_start = values[0]; + __pyx_v_end = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("find", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":404 + * Return a sorted list of all intervals overlapping [start,end). + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * return self.root.find( start, end ) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":405 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * return self.root.find( start, end ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":406 + * if self.root is None: + * return [] + * return self.root.find( start, end ) # <<<<<<<<<<<<<< + * + * def before( self, position, num_intervals=1, max_dist=2500 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root), __pyx_n_s__find); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.find", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":408 + * return self.root.find( start, end ) + * + * def before( self, position, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie before `position` and are no + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_3before(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_3before[] = "\n Find `num_intervals` intervals that lie before `position` and are no\n further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_3before(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_position = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__position,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("before"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__position); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "before") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_position = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("before", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.before", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":413 + * further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * return self.root.left( position, num_intervals, max_dist ) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":414 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * return self.root.left( position, num_intervals, max_dist ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":415 + * if self.root is None: + * return [] + * return self.root.left( position, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * def after( self, position, num_intervals=1, max_dist=2500 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5.__pyx_n = 2; + __pyx_t_5.n = __pyx_t_3; + __pyx_t_5.max_dist = __pyx_t_4; + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->left(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_v_position, 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.before", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":417 + * return self.root.left( position, num_intervals, max_dist ) + * + * def after( self, position, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie after `position` and are no + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_4after(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_4after[] = "\n Find `num_intervals` intervals that lie after `position` and are no\n further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_4after(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_position = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__position,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("after"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__position); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "after") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_position = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("after", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.after", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":422 + * further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * return self.root.right( position, num_intervals, max_dist ) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":423 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * return self.root.right( position, num_intervals, max_dist ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":424 + * if self.root is None: + * return [] + * return self.root.right( position, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * # ---- Interval-like object based interfaces ----------------------------- + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5.__pyx_n = 2; + __pyx_t_5.n = __pyx_t_3; + __pyx_t_5.max_dist = __pyx_t_4; + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->right(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_v_position, 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.after", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":428 + * # ---- Interval-like object based interfaces ----------------------------- + * + * def insert_interval( self, interval ): # <<<<<<<<<<<<<< + * """ + * Insert an "interval" like object (one with at least start and end + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_5insert_interval(PyObject *__pyx_v_self, PyObject *__pyx_v_interval); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_5insert_interval[] = "\n Insert an \"interval\" like object (one with at least start and end\n attributes)\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_5insert_interval(PyObject *__pyx_v_self, PyObject *__pyx_v_interval) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("insert_interval"); + + /* "bx/intervals/intersection.pyx":433 + * attributes) + * """ + * self.insert( interval.start, interval.end, interval ) # <<<<<<<<<<<<<< + * + * add_interval = insert_interval + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__insert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_interval); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_interval); + __Pyx_GIVEREF(__pyx_v_interval); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.insert_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":437 + * add_interval = insert_interval + * + * def before_interval( self, interval, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie completely before `interval` + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_6before_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_6before_interval[] = "\n Find `num_intervals` intervals that lie completely before `interval`\n and are no further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_6before_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_interval = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__interval,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("before_interval"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "before_interval") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_interval = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("before_interval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.before_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":442 + * and are no further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * return self.root.left( interval.start, num_intervals, max_dist ) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":443 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * return self.root.left( interval.start, num_intervals, max_dist ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":444 + * if self.root is None: + * return [] + * return self.root.left( interval.start, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * def after_interval( self, interval, num_intervals=1, max_dist=2500 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6.__pyx_n = 2; + __pyx_t_6.n = __pyx_t_3; + __pyx_t_6.max_dist = __pyx_t_4; + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->left(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_2, 0, &__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.before_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":446 + * return self.root.left( interval.start, num_intervals, max_dist ) + * + * def after_interval( self, interval, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie completely after `interval` and + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_7after_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_7after_interval[] = "\n Find `num_intervals` intervals that lie completely after `interval` and\n are no further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_7after_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_interval = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__interval,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("after_interval"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "after_interval") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_interval = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("after_interval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.after_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":451 + * are no further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * return self.root.right( interval.end, num_intervals, max_dist ) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":452 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * return self.root.right( interval.end, num_intervals, max_dist ) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":453 + * if self.root is None: + * return [] + * return self.root.right( interval.end, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * def upstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6.__pyx_n = 2; + __pyx_t_6.n = __pyx_t_3; + __pyx_t_6.max_dist = __pyx_t_4; + __pyx_t_5 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->right(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_2, 0, &__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.after_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":455 + * return self.root.right( interval.end, num_intervals, max_dist ) + * + * def upstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie completely upstream of + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_8upstream_of_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_8upstream_of_interval[] = "\n Find `num_intervals` intervals that lie completely upstream of\n `interval` and are no further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_8upstream_of_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_interval = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right __pyx_t_8; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__interval,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("upstream_of_interval"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "upstream_of_interval") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_interval = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("upstream_of_interval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.upstream_of_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":460 + * `interval` and are no further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * if interval.strand == -1 or interval.strand == "-": + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":461 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * if interval.strand == -1 or interval.strand == "-": + * return self.root.right( interval.end, num_intervals, max_dist ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":462 + * if self.root is None: + * return [] + * if interval.strand == -1 or interval.strand == "-": # <<<<<<<<<<<<<< + * return self.root.right( interval.end, num_intervals, max_dist ) + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_1) { + __pyx_t_3 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_1; + } + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":463 + * return [] + * if interval.strand == -1 or interval.strand == "-": + * return self.root.right( interval.end, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * else: + * return self.root.left( interval.start, num_intervals, max_dist ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8.__pyx_n = 2; + __pyx_t_8.n = __pyx_t_6; + __pyx_t_8.max_dist = __pyx_t_7; + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->right(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_3, 0, &__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":465 + * return self.root.right( interval.end, num_intervals, max_dist ) + * else: + * return self.root.left( interval.start, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * def downstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9.__pyx_n = 2; + __pyx_t_9.n = __pyx_t_7; + __pyx_t_9.max_dist = __pyx_t_6; + __pyx_t_3 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->left(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_2, 0, &__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.upstream_of_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":467 + * return self.root.left( interval.start, num_intervals, max_dist ) + * + * def downstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): # <<<<<<<<<<<<<< + * """ + * Find `num_intervals` intervals that lie completely downstream of + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_9downstream_of_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_9downstream_of_interval[] = "\n Find `num_intervals` intervals that lie completely downstream of\n `interval` and are no further than `max_dist` positions away\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_9downstream_of_interval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_interval = 0; + PyObject *__pyx_v_num_intervals = 0; + PyObject *__pyx_v_max_dist = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left __pyx_t_8; + struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__interval,&__pyx_n_s__num_intervals,&__pyx_n_s__max_dist,0}; + __Pyx_RefNannySetupContext("downstream_of_interval"); + { + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)__pyx_int_1); + values[2] = ((PyObject *)__pyx_int_2500); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interval); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_intervals); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_dist); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "downstream_of_interval") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_interval = values[0]; + __pyx_v_num_intervals = values[1]; + __pyx_v_max_dist = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("downstream_of_interval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.downstream_of_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intervals/intersection.pyx":472 + * `interval` and are no further than `max_dist` positions away + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return [] + * if interval.strand == -1 or interval.strand == "-": + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":473 + * """ + * if self.root is None: + * return [] # <<<<<<<<<<<<<< + * if interval.strand == -1 or interval.strand == "-": + * return self.root.left( interval.start, num_intervals, max_dist ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/intervals/intersection.pyx":474 + * if self.root is None: + * return [] + * if interval.strand == -1 or interval.strand == "-": # <<<<<<<<<<<<<< + * return self.root.left( interval.start, num_intervals, max_dist ) + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_1) { + __pyx_t_3 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_1; + } + if (__pyx_t_5) { + + /* "bx/intervals/intersection.pyx":475 + * return [] + * if interval.strand == -1 or interval.strand == "-": + * return self.root.left( interval.start, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * else: + * return self.root.right( interval.end, num_intervals, max_dist ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8.__pyx_n = 2; + __pyx_t_8.n = __pyx_t_6; + __pyx_t_8.max_dist = __pyx_t_7; + __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->left(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_3, 0, &__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "bx/intervals/intersection.pyx":477 + * return self.root.left( interval.start, num_intervals, max_dist ) + * else: + * return self.root.right( interval.end, num_intervals, max_dist ) # <<<<<<<<<<<<<< + * + * def traverse(self, fn): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_interval, __pyx_n_s__end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_num_intervals); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_max_dist); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9.__pyx_n = 2; + __pyx_t_9.n = __pyx_t_7; + __pyx_t_9.max_dist = __pyx_t_6; + __pyx_t_3 = ((struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root->__pyx_vtab)->right(((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root, __pyx_t_2, 0, &__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.downstream_of_interval", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intervals/intersection.pyx":479 + * return self.root.right( interval.end, num_intervals, max_dist ) + * + * def traverse(self, fn): # <<<<<<<<<<<<<< + * """ + * call fn for each element in the tree + */ + +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_10traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_fn); /*proto*/ +static char __pyx_doc_2bx_9intervals_12intersection_12IntervalTree_10traverse[] = "\n call fn for each element in the tree\n "; +static PyObject *__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_10traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_fn) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("traverse"); + + /* "bx/intervals/intersection.pyx":483 + * call fn for each element in the tree + * """ + * if self.root is None: # <<<<<<<<<<<<<< + * return None + * return self.root.traverse(fn) + */ + __pyx_t_1 = (((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root) == Py_None); + if (__pyx_t_1) { + + /* "bx/intervals/intersection.pyx":484 + * """ + * if self.root is None: + * return None # <<<<<<<<<<<<<< + * return self.root.traverse(fn) + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/intervals/intersection.pyx":485 + * if self.root is None: + * return None + * return self.root.traverse(fn) # <<<<<<<<<<<<<< + * + * # For backward compatibility + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)__pyx_v_self)->root), __pyx_n_s__traverse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_fn); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fn); + __Pyx_GIVEREF(__pyx_v_fn); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.intervals.intersection.IntervalTree.traverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_2bx_9intervals_12intersection_IntervalNode __pyx_vtable_2bx_9intervals_12intersection_IntervalNode; + +static PyObject *__pyx_tp_new_2bx_9intervals_12intersection_IntervalNode(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)o); + p->__pyx_vtab = __pyx_vtabptr_2bx_9intervals_12intersection_IntervalNode; + p->interval = Py_None; Py_INCREF(Py_None); + p->cleft = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + p->cright = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + p->croot = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + if (__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_1__cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_9intervals_12intersection_IntervalNode(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)o; + Py_XDECREF(p->interval); + Py_XDECREF(((PyObject *)p->cleft)); + Py_XDECREF(((PyObject *)p->cright)); + Py_XDECREF(((PyObject *)p->croot)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_9intervals_12intersection_IntervalNode(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)o; + if (p->interval) { + e = (*v)(p->interval, a); if (e) return e; + } + if (p->cleft) { + e = (*v)(((PyObject*)p->cleft), a); if (e) return e; + } + if (p->cright) { + e = (*v)(((PyObject*)p->cright), a); if (e) return e; + } + if (p->croot) { + e = (*v)(((PyObject*)p->croot), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_9intervals_12intersection_IntervalNode(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)o; + PyObject* tmp; + tmp = ((PyObject*)p->interval); + p->interval = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cleft); + p->cleft = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->cright); + p->cright = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->croot); + p->croot = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_left_node(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9left_node___get__(o); +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_right_node(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_10right_node___get__(o); +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_root_node(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_9root_node___get__(o); +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_interval(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_interval(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_1__set__(o, v); + } + else { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_8interval_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_start(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_start(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5start_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_end(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_end(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3end_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_2bx_9intervals_12intersection_IntervalNode[] = { + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_2insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalNode_2insert)}, + {__Pyx_NAMESTR("intersect"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_3intersect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalNode_3intersect)}, + {__Pyx_NAMESTR("left"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_4left, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalNode_4left)}, + {__Pyx_NAMESTR("right"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_5right, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalNode_5right)}, + {__Pyx_NAMESTR("traverse"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalNode_6traverse, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_9intervals_12intersection_IntervalNode[] = { + {(char *)"left_node", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_left_node, 0, 0, 0}, + {(char *)"right_node", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_right_node, 0, 0, 0}, + {(char *)"root_node", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_root_node, 0, 0, 0}, + {(char *)"interval", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_interval, __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_interval, 0, 0}, + {(char *)"start", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_start, __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_start, 0, 0}, + {(char *)"end", __pyx_getprop_2bx_9intervals_12intersection_12IntervalNode_end, __pyx_setprop_2bx_9intervals_12intersection_12IntervalNode_end, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntervalNode = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntervalNode = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IntervalNode = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntervalNode = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_9intervals_12intersection_IntervalNode = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.intervals.intersection.IntervalNode"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_9intervals_12intersection_IntervalNode, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pf_2bx_9intervals_12intersection_12IntervalNode___repr__, /*tp_repr*/ + &__pyx_tp_as_number_IntervalNode, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntervalNode, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntervalNode, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntervalNode, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n A single node of an `IntervalTree`.\n\n NOTE: Unless you really know what you are doing, you probably should us\n `IntervalTree` rather than using this directly.\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_9intervals_12intersection_IntervalNode, /*tp_traverse*/ + __pyx_tp_clear_2bx_9intervals_12intersection_IntervalNode, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_9intervals_12intersection_IntervalNode, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_9intervals_12intersection_IntervalNode, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_9intervals_12intersection_IntervalNode, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_9intervals_12intersection_Interval(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_9intervals_12intersection_Interval *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_9intervals_12intersection_Interval *)o); + p->value = Py_None; Py_INCREF(Py_None); + p->chrom = Py_None; Py_INCREF(Py_None); + p->strand = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_2bx_9intervals_12intersection_Interval(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_Interval *p = (struct __pyx_obj_2bx_9intervals_12intersection_Interval *)o; + Py_XDECREF(p->value); + Py_XDECREF(p->chrom); + Py_XDECREF(p->strand); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_9intervals_12intersection_Interval(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_9intervals_12intersection_Interval *p = (struct __pyx_obj_2bx_9intervals_12intersection_Interval *)o; + if (p->value) { + e = (*v)(p->value, a); if (e) return e; + } + if (p->chrom) { + e = (*v)(p->chrom, a); if (e) return e; + } + if (p->strand) { + e = (*v)(p->strand, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_9intervals_12intersection_Interval(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_Interval *p = (struct __pyx_obj_2bx_9intervals_12intersection_Interval *)o; + PyObject* tmp; + tmp = ((PyObject*)p->value); + p->value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->chrom); + p->chrom = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->strand); + p->strand = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_8Interval_start(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5start___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_8Interval_start(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5start_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_8Interval_end(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_3end___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_8Interval_end(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_3end_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_8Interval_value(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5value___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_8Interval_value(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_1__set__(o, v); + } + else { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5value_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_8Interval_chrom(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_8Interval_chrom(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_1__set__(o, v); + } + else { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_5chrom_2__del__(o); + } +} + +static PyObject *__pyx_getprop_2bx_9intervals_12intersection_8Interval_strand(PyObject *o, void *x) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand___get__(o); +} + +static int __pyx_setprop_2bx_9intervals_12intersection_8Interval_strand(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_1__set__(o, v); + } + else { + return __pyx_pf_2bx_9intervals_12intersection_8Interval_6strand_2__del__(o); + } +} + +static PyMethodDef __pyx_methods_2bx_9intervals_12intersection_Interval[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_2bx_9intervals_12intersection_Interval[] = { + {(char *)"start", __pyx_getprop_2bx_9intervals_12intersection_8Interval_start, __pyx_setprop_2bx_9intervals_12intersection_8Interval_start, 0, 0}, + {(char *)"end", __pyx_getprop_2bx_9intervals_12intersection_8Interval_end, __pyx_setprop_2bx_9intervals_12intersection_8Interval_end, 0, 0}, + {(char *)"value", __pyx_getprop_2bx_9intervals_12intersection_8Interval_value, __pyx_setprop_2bx_9intervals_12intersection_8Interval_value, 0, 0}, + {(char *)"chrom", __pyx_getprop_2bx_9intervals_12intersection_8Interval_chrom, __pyx_setprop_2bx_9intervals_12intersection_8Interval_chrom, 0, 0}, + {(char *)"strand", __pyx_getprop_2bx_9intervals_12intersection_8Interval_strand, __pyx_setprop_2bx_9intervals_12intersection_8Interval_strand, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Interval = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Interval = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Interval = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Interval = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_9intervals_12intersection_Interval = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.intervals.intersection.Interval"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_9intervals_12intersection_Interval), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_9intervals_12intersection_Interval, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + __pyx_pf_2bx_9intervals_12intersection_8Interval_1__repr__, /*tp_repr*/ + &__pyx_tp_as_number_Interval, /*tp_as_number*/ + &__pyx_tp_as_sequence_Interval, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Interval, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Interval, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Basic feature, with required integer start and end properties.\n Also accepts optional strand as +1 or -1 (used for up/downstream queries),\n a name, and any arbitrary data is sent in on the info keyword argument\n\n >>> from bx.intervals.intersection import Interval\n\n >>> f1 = Interval(23, 36)\n >>> f2 = Interval(34, 48, value={'chr':12, 'anno':'transposon'})\n >>> f2\n Interval(34, 48, value={'anno': 'transposon', 'chr': 12})\n\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_9intervals_12intersection_Interval, /*tp_traverse*/ + __pyx_tp_clear_2bx_9intervals_12intersection_Interval, /*tp_clear*/ + __pyx_pf_2bx_9intervals_12intersection_8Interval_2__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_9intervals_12intersection_Interval, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_2bx_9intervals_12intersection_Interval, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_9intervals_12intersection_8Interval___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_9intervals_12intersection_Interval, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_2bx_9intervals_12intersection_IntervalTree(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)o); + p->root = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + if (__pyx_pf_2bx_9intervals_12intersection_12IntervalTree___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_2bx_9intervals_12intersection_IntervalTree(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)o; + Py_XDECREF(((PyObject *)p->root)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_2bx_9intervals_12intersection_IntervalTree(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)o; + if (p->root) { + e = (*v)(((PyObject*)p->root), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_2bx_9intervals_12intersection_IntervalTree(PyObject *o) { + struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *p = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree *)o; + PyObject* tmp; + tmp = ((PyObject*)p->root); + p->root = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_2bx_9intervals_12intersection_IntervalTree[] = { + {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_1insert, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_1insert)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_2find, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_2find)}, + {__Pyx_NAMESTR("before"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_3before, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_3before)}, + {__Pyx_NAMESTR("after"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_4after, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_4after)}, + {__Pyx_NAMESTR("insert_interval"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_5insert_interval, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_5insert_interval)}, + {__Pyx_NAMESTR("before_interval"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_6before_interval, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_6before_interval)}, + {__Pyx_NAMESTR("after_interval"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_7after_interval, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_7after_interval)}, + {__Pyx_NAMESTR("upstream_of_interval"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_8upstream_of_interval, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_8upstream_of_interval)}, + {__Pyx_NAMESTR("downstream_of_interval"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_9downstream_of_interval, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_9downstream_of_interval)}, + {__Pyx_NAMESTR("traverse"), (PyCFunction)__pyx_pf_2bx_9intervals_12intersection_12IntervalTree_10traverse, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_9intervals_12intersection_12IntervalTree_10traverse)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IntervalTree = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IntervalTree = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IntervalTree = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IntervalTree = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_9intervals_12intersection_IntervalTree = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.intervals.intersection.IntervalTree"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_9intervals_12intersection_IntervalTree), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_9intervals_12intersection_IntervalTree, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IntervalTree, /*tp_as_number*/ + &__pyx_tp_as_sequence_IntervalTree, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IntervalTree, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IntervalTree, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("\n Data structure for performing window intersect queries on a set of\n of possibly overlapping 1d intervals.\n\n Usage\n =====\n\n Create an empty IntervalTree\n\n >>> from bx.intervals.intersection import Interval, IntervalTree\n >>> intersecter = IntervalTree()\n\n An interval is a start and end position and a value (possibly None).\n You can add any object as an interval:\n\n >>> intersecter.insert( 0, 10, \"food\" )\n >>> intersecter.insert( 3, 7, dict(foo='bar') )\n\n >>> intersecter.find( 2, 5 )\n ['food', {'foo': 'bar'}]\n\n If the object has start and end attributes (like the Interval class) there\n is are some shortcuts:\n\n >>> intersecter = IntervalTree()\n >>> intersecter.insert_interval( Interval( 0, 10 ) )\n >>> intersecter.insert_interval( Interval( 3, 7 ) )\n >>> intersecter.insert_interval( Interval( 3, 40 ) )\n >>> intersecter.insert_interval( Interval( 13, 50 ) )\n\n >>> intersecter.find( 30, 50 )\n [Interval(3, 40), Interval(13, 50)]\n >>> intersecter.find( 100, 200 )\n []\n\n Before/after for intervals\n\n >>> intersecter.before_interval( Interval( 10, 20 ) )\n [Interval(3, 7)]\n >>> intersecter.before_interval( Interval( 5, 20 ) )\n []\n\n Upstream/downstream\n\n >>> intersecter.upstream_of_interval(Interval(11, 12))\n [Interval(0, 10)]\n >>> intersecter.upstream_of_interval(Interval(11, 12, strand=\"-\"))\n [Interval(13, 50)]\n\n >>> intersecter.upstream_of_interval(Interval(1, 2, strand=\"-\"), num_intervals=3)\n [Interval(3, 7), Interval(3, 40), Interval(13, 50)]\n\n\n "), /*tp_doc*/ + __pyx_tp_traverse_2bx_9intervals_12intersection_IntervalTree, /*tp_traverse*/ + __pyx_tp_clear_2bx_9intervals_12intersection_IntervalTree, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_9intervals_12intersection_IntervalTree, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_9intervals_12intersection_IntervalTree, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("intersection"), + __Pyx_DOCSTR(__pyx_k_10), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__Intersecter, __pyx_k__Intersecter, sizeof(__pyx_k__Intersecter), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1}, + {&__pyx_n_s__add_interval, __pyx_k__add_interval, sizeof(__pyx_k__add_interval), 0, 0, 1, 1}, + {&__pyx_n_s__attrgetter, __pyx_k__attrgetter, sizeof(__pyx_k__attrgetter), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__find, __pyx_k__find, sizeof(__pyx_k__find), 0, 0, 1, 1}, + {&__pyx_n_s__insert, __pyx_k__insert, sizeof(__pyx_k__insert), 0, 0, 1, 1}, + {&__pyx_n_s__insert_interval, __pyx_k__insert_interval, sizeof(__pyx_k__insert_interval), 0, 0, 1, 1}, + {&__pyx_n_s__intersect, __pyx_k__intersect, sizeof(__pyx_k__intersect), 0, 0, 1, 1}, + {&__pyx_n_s__interval, __pyx_k__interval, sizeof(__pyx_k__interval), 0, 0, 1, 1}, + {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, + {&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1}, + {&__pyx_n_s__max_dist, __pyx_k__max_dist, sizeof(__pyx_k__max_dist), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__num_intervals, __pyx_k__num_intervals, sizeof(__pyx_k__num_intervals), 0, 0, 1, 1}, + {&__pyx_n_s__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1}, + {&__pyx_n_s__position, __pyx_k__position, sizeof(__pyx_k__position), 0, 0, 1, 1}, + {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1}, + {&__pyx_n_s__right, __pyx_k__right, sizeof(__pyx_k__right), 0, 0, 1, 1}, + {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__strand, __pyx_k__strand, sizeof(__pyx_k__strand), 0, 0, 1, 1}, + {&__pyx_n_s__traverse, __pyx_k__traverse, sizeof(__pyx_k__traverse), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/intervals/intersection.pyx":243 + * if len(results) == n: return results + * r = results + * r.sort(key=operator.attrgetter('end'), reverse=True) # <<<<<<<<<<<<<< + * return r[:n] + * + */ + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__end)); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__end)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + + /* "bx/intervals/intersection.pyx":258 + * if len(results) == n: return results + * r = results + * r.sort(key=operator.attrgetter('start')) # <<<<<<<<<<<<<< + * return r[:n] + * + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__start)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__start)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "bx/intervals/intersection.pyx":269 + * if self.cright is not EmptyNode: self.cright._traverse(func) + * + * cdef IntervalNode EmptyNode = IntervalNode( 0, 0, Interval(0, 0)) # <<<<<<<<<<<<<< + * + * ## ---- Wrappers that retain the old interface ------------------------------- + */ + __pyx_k_tuple_11 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2500 = PyInt_FromLong(2500); if (unlikely(!__pyx_int_2500)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initintersection(void); /*proto*/ +PyMODINIT_FUNC initintersection(void) +#else +PyMODINIT_FUNC PyInit_intersection(void); /*proto*/ +PyMODINIT_FUNC PyInit_intersection(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + float __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_intersection(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("intersection"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_10), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__intervals__intersection) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + __pyx_v_2bx_9intervals_12intersection_EmptyNode = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)Py_None); Py_INCREF(Py_None); + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_2bx_9intervals_12intersection_IntervalNode = &__pyx_vtable_2bx_9intervals_12intersection_IntervalNode; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.insert = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, int, PyObject *, int __pyx_skip_dispatch))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_insert; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.rotate_right = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_rotate_right; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.rotate_left = (struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *(*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_rotate_left; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.set_ends = (void (*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_set_ends; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode._intersect = (void (*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, int, PyObject *))__pyx_f_2bx_9intervals_12intersection_12IntervalNode__intersect; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode._seek_left = (void (*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, PyObject *, int, int))__pyx_f_2bx_9intervals_12intersection_12IntervalNode__seek_left; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode._seek_right = (void (*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, int, PyObject *, int, int))__pyx_f_2bx_9intervals_12intersection_12IntervalNode__seek_right; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.left = (PyObject *(*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_left *__pyx_optional_args))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_left; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode.right = (PyObject *(*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_2bx_9intervals_12intersection_12IntervalNode_right *__pyx_optional_args))__pyx_f_2bx_9intervals_12intersection_12IntervalNode_right; + __pyx_vtable_2bx_9intervals_12intersection_IntervalNode._traverse = (void (*)(struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *, PyObject *))__pyx_f_2bx_9intervals_12intersection_12IntervalNode__traverse; + if (PyType_Ready(&__pyx_type_2bx_9intervals_12intersection_IntervalNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_2bx_9intervals_12intersection_IntervalNode.tp_dict, __pyx_vtabptr_2bx_9intervals_12intersection_IntervalNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntervalNode", (PyObject *)&__pyx_type_2bx_9intervals_12intersection_IntervalNode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_9intervals_12intersection_IntervalNode = &__pyx_type_2bx_9intervals_12intersection_IntervalNode; + if (PyType_Ready(&__pyx_type_2bx_9intervals_12intersection_Interval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Interval", (PyObject *)&__pyx_type_2bx_9intervals_12intersection_Interval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_9intervals_12intersection_Interval = &__pyx_type_2bx_9intervals_12intersection_Interval; + if (PyType_Ready(&__pyx_type_2bx_9intervals_12intersection_IntervalTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IntervalTree", (PyObject *)&__pyx_type_2bx_9intervals_12intersection_IntervalTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_9intervals_12intersection_IntervalTree = &__pyx_type_2bx_9intervals_12intersection_IntervalTree; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/intervals/intersection.pyx":22 + * #cython: cdivision=True + * + * import operator # <<<<<<<<<<<<<< + * + * cdef extern from "stdlib.h": + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__operator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":58 + * return a + * + * cdef float nlog = -1.0 / log(0.5) # <<<<<<<<<<<<<< + * + * cdef class IntervalNode: + */ + __pyx_t_2 = log(0.5); + if (unlikely(__pyx_t_2 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_2bx_9intervals_12intersection_nlog = (-1.0 / __pyx_t_2); + + /* "bx/intervals/intersection.pyx":168 + * + * + * def intersect( self, int start, int end, sort=True ): # <<<<<<<<<<<<<< + * """ + * given a start and a end, return a list of features + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_2 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":177 + * return results + * + * find = intersect # <<<<<<<<<<<<<< + * + * cdef void _intersect( IntervalNode self, int start, int end, list results): + */ + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode, __pyx_n_s__intersect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode->tp_dict, __pyx_n_s__find, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_2bx_9intervals_12intersection_IntervalNode); + + /* "bx/intervals/intersection.pyx":269 + * if self.cright is not EmptyNode: self.cright._traverse(func) + * + * cdef IntervalNode EmptyNode = IntervalNode( 0, 0, Interval(0, 0)) # <<<<<<<<<<<<<< + * + * ## ---- Wrappers that retain the old interface ------------------------------- + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_Interval)), ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_IntervalNode)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_DECREF(((PyObject *)__pyx_v_2bx_9intervals_12intersection_EmptyNode)); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_v_2bx_9intervals_12intersection_EmptyNode = ((struct __pyx_obj_2bx_9intervals_12intersection_IntervalNode *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "bx/intervals/intersection.pyx":397 + * self.root = self.root.insert( start, end, value ) + * + * add = insert # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalTree, __pyx_n_s__insert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalTree->tp_dict, __pyx_n_s__add, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_2bx_9intervals_12intersection_IntervalTree); + + /* "bx/intervals/intersection.pyx":435 + * self.insert( interval.start, interval.end, interval ) + * + * add_interval = insert_interval # <<<<<<<<<<<<<< + * + * def before_interval( self, interval, num_intervals=1, max_dist=2500 ): + */ + __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalTree, __pyx_n_s__insert_interval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem((PyObject *)__pyx_ptype_2bx_9intervals_12intersection_IntervalTree->tp_dict, __pyx_n_s__add_interval, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_2bx_9intervals_12intersection_IntervalTree); + + /* "bx/intervals/intersection.pyx":488 + * + * # For backward compatibility + * Intersecter = IntervalTree # <<<<<<<<<<<<<< + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Intersecter, ((PyObject *)((PyObject*)__pyx_ptype_2bx_9intervals_12intersection_IntervalTree))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intervals/intersection.pyx":1 + * """ # <<<<<<<<<<<<<< + * Data structure for performing intersect queries on a set of intervals which + * preserves all information about the intervals (unlike bitset projection methods). + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.intervals.intersection", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.intervals.intersection"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); + else + return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.pyx b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.pyx new file mode 100755 index 0000000..f06df13 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection.pyx @@ -0,0 +1,488 @@ +""" +Data structure for performing intersect queries on a set of intervals which +preserves all information about the intervals (unlike bitset projection methods). + +:Authors: James Taylor (james@jamestaylor.org), + Ian Schenk (ian.schenck@gmail.com), + Brent Pedersen (bpederse@gmail.com) +""" + +# Historical note: +# This module original contained an implementation based on sorted endpoints +# and a binary search, using an idea from Scott Schwartz and Piotr Berman. +# Later an interval tree implementation was implemented by Ian for Galaxy's +# join tool (see `bx.intervals.operations.quicksect.py`). This was then +# converted to Cython by Brent, who also added support for +# upstream/downstream/neighbor queries. This was modified by James to +# handle half-open intervals strictly, to maintain sort order, and to +# implement the same interface as the original Intersecter. + +#cython: cdivision=True + +import operator + +cdef extern from "stdlib.h": + int ceil(float f) + float log(float f) + int RAND_MAX + int rand() + int strlen(char *) + int iabs(int) + +cdef inline int imax2(int a, int b): + if b > a: return b + return a + +cdef inline int imax3(int a, int b, int c): + if b > a: + if c > b: + return c + return b + if a > c: + return a + return c + +cdef inline int imin3(int a, int b, int c): + if b < a: + if c < b: + return c + return b + if a < c: + return a + return c + +cdef inline int imin2(int a, int b): + if b < a: return b + return a + +cdef float nlog = -1.0 / log(0.5) + +cdef class IntervalNode: + """ + A single node of an `IntervalTree`. + + NOTE: Unless you really know what you are doing, you probably should us + `IntervalTree` rather than using this directly. + """ + cdef float priority + cdef public object interval + cdef public int start, end + cdef int minend, maxend, minstart + cdef IntervalNode cleft, cright, croot + + property left_node: + def __get__(self): + return self.cleft if self.cleft is not EmptyNode else None + property right_node: + def __get__(self): + return self.cright if self.cright is not EmptyNode else None + property root_node: + def __get__(self): + return self.croot if self.croot is not EmptyNode else None + + def __repr__(self): + return "IntervalNode(%i, %i)" % (self.start, self.end) + + def __cinit__(IntervalNode self, int start, int end, object interval): + # Python lacks the binomial distribution, so we convert a + # uniform into a binomial because it naturally scales with + # tree size. Also, python's uniform is perfect since the + # upper limit is not inclusive, which gives us undefined here. + self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1))) + self.start = start + self.end = end + self.interval = interval + self.maxend = end + self.minstart = start + self.minend = end + self.cleft = EmptyNode + self.cright = EmptyNode + self.croot = EmptyNode + + cpdef IntervalNode insert(IntervalNode self, int start, int end, object interval): + """ + Insert a new IntervalNode into the tree of which this node is + currently the root. The return value is the new root of the tree (which + may or may not be this node!) + """ + cdef IntervalNode croot = self + # If starts are the same, decide which to add interval to based on + # end, thus maintaining sortedness relative to start/end + cdef int decision_endpoint = start + if start == self.start: + decision_endpoint = end + + if decision_endpoint > self.start: + # insert to cright tree + if self.cright is not EmptyNode: + self.cright = self.cright.insert( start, end, interval ) + else: + self.cright = IntervalNode( start, end, interval ) + # rebalance tree + if self.priority < self.cright.priority: + croot = self.rotate_left() + else: + # insert to cleft tree + if self.cleft is not EmptyNode: + self.cleft = self.cleft.insert( start, end, interval) + else: + self.cleft = IntervalNode( start, end, interval) + # rebalance tree + if self.priority < self.cleft.priority: + croot = self.rotate_right() + + croot.set_ends() + self.cleft.croot = croot + self.cright.croot = croot + return croot + + cdef IntervalNode rotate_right(IntervalNode self): + cdef IntervalNode croot = self.cleft + self.cleft = self.cleft.cright + croot.cright = self + self.set_ends() + return croot + + cdef IntervalNode rotate_left(IntervalNode self): + cdef IntervalNode croot = self.cright + self.cright = self.cright.cleft + croot.cleft = self + self.set_ends() + return croot + + cdef inline void set_ends(IntervalNode self): + if self.cright is not EmptyNode and self.cleft is not EmptyNode: + self.maxend = imax3(self.end, self.cright.maxend, self.cleft.maxend) + self.minend = imin3(self.end, self.cright.minend, self.cleft.minend) + self.minstart = imin3(self.start, self.cright.minstart, self.cleft.minstart) + elif self.cright is not EmptyNode: + self.maxend = imax2(self.end, self.cright.maxend) + self.minend = imin2(self.end, self.cright.minend) + self.minstart = imin2(self.start, self.cright.minstart) + elif self.cleft is not EmptyNode: + self.maxend = imax2(self.end, self.cleft.maxend) + self.minend = imin2(self.end, self.cleft.minend) + self.minstart = imin2(self.start, self.cleft.minstart) + + + def intersect( self, int start, int end, sort=True ): + """ + given a start and a end, return a list of features + falling within that range + """ + cdef list results = [] + self._intersect( start, end, results ) + return results + + find = intersect + + cdef void _intersect( IntervalNode self, int start, int end, list results): + # Left subtree + if self.cleft is not EmptyNode and self.cleft.maxend > start: + self.cleft._intersect( start, end, results ) + # This interval + if ( self.end > start ) and ( self.start < end ): + results.append( self.interval ) + # Right subtree + if self.cright is not EmptyNode and self.start < end: + self.cright._intersect( start, end, results ) + + + cdef void _seek_left(IntervalNode self, int position, list results, int n, int max_dist): + # we know we can bail in these 2 cases. + if self.maxend + max_dist < position: + return + if self.minstart > position: + return + + # the ordering of these 3 blocks makes it so the results are + # ordered nearest to farest from the query position + if self.cright is not EmptyNode: + self.cright._seek_left(position, results, n, max_dist) + + if -1 < position - self.end < max_dist: + results.append(self.interval) + + # TODO: can these conditionals be more stringent? + if self.cleft is not EmptyNode: + self.cleft._seek_left(position, results, n, max_dist) + + + + cdef void _seek_right(IntervalNode self, int position, list results, int n, int max_dist): + # we know we can bail in these 2 cases. + if self.maxend < position: return + if self.minstart - max_dist > position: return + + #print "SEEK_RIGHT:",self, self.cleft, self.maxend, self.minstart, position + + # the ordering of these 3 blocks makes it so the results are + # ordered nearest to farest from the query position + if self.cleft is not EmptyNode: + self.cleft._seek_right(position, results, n, max_dist) + + if -1 < self.start - position < max_dist: + results.append(self.interval) + + if self.cright is not EmptyNode: + self.cright._seek_right(position, results, n, max_dist) + + + cpdef left(self, position, int n=1, int max_dist=2500): + """ + find n features with a start > than `position` + f: a Interval object (or anything with an `end` attribute) + n: the number of features to return + max_dist: the maximum distance to look before giving up. + """ + cdef list results = [] + # use start - 1 becuase .left() assumes strictly left-of + self._seek_left( position - 1, results, n, max_dist ) + if len(results) == n: return results + r = results + r.sort(key=operator.attrgetter('end'), reverse=True) + return r[:n] + + cpdef right(self, position, int n=1, int max_dist=2500): + """ + find n features with a end < than position + f: a Interval object (or anything with a `start` attribute) + n: the number of features to return + max_dist: the maximum distance to look before giving up. + """ + cdef list results = [] + # use end + 1 becuase .right() assumes strictly right-of + self._seek_right(position + 1, results, n, max_dist) + if len(results) == n: return results + r = results + r.sort(key=operator.attrgetter('start')) + return r[:n] + + def traverse(self, func): + self._traverse(func) + + cdef void _traverse(IntervalNode self, object func): + if self.cleft is not EmptyNode: self.cleft._traverse(func) + func(self) + if self.cright is not EmptyNode: self.cright._traverse(func) + +cdef IntervalNode EmptyNode = IntervalNode( 0, 0, Interval(0, 0)) + +## ---- Wrappers that retain the old interface ------------------------------- + +cdef class Interval: + """ + Basic feature, with required integer start and end properties. + Also accepts optional strand as +1 or -1 (used for up/downstream queries), + a name, and any arbitrary data is sent in on the info keyword argument + + >>> from bx.intervals.intersection import Interval + + >>> f1 = Interval(23, 36) + >>> f2 = Interval(34, 48, value={'chr':12, 'anno':'transposon'}) + >>> f2 + Interval(34, 48, value={'anno': 'transposon', 'chr': 12}) + + """ + cdef public int start, end + cdef public object value, chrom, strand + + def __init__(self, int start, int end, object value=None, object chrom=None, object strand=None ): + assert start <= end, "start must be less than end" + self.start = start + self.end = end + self.value = value + self.chrom = chrom + self.strand = strand + + def __repr__(self): + fstr = "Interval(%d, %d" % (self.start, self.end) + if not self.value is None: + fstr += ", value=" + str(self.value) + fstr += ")" + return fstr + + def __richcmp__(self, other, op): + if op == 0: + # < + return self.start < other.start or self.end < other.end + elif op == 1: + # <= + return self == other or self < other + elif op == 2: + # == + return self.start == other.start and self.end == other.end + elif op == 3: + # != + return self.start != other.start or self.end != other.end + elif op == 4: + # > + return self.start > other.start or self.end > other.end + elif op == 5: + # >= + return self == other or self > other + +cdef class IntervalTree: + """ + Data structure for performing window intersect queries on a set of + of possibly overlapping 1d intervals. + + Usage + ===== + + Create an empty IntervalTree + + >>> from bx.intervals.intersection import Interval, IntervalTree + >>> intersecter = IntervalTree() + + An interval is a start and end position and a value (possibly None). + You can add any object as an interval: + + >>> intersecter.insert( 0, 10, "food" ) + >>> intersecter.insert( 3, 7, dict(foo='bar') ) + + >>> intersecter.find( 2, 5 ) + ['food', {'foo': 'bar'}] + + If the object has start and end attributes (like the Interval class) there + is are some shortcuts: + + >>> intersecter = IntervalTree() + >>> intersecter.insert_interval( Interval( 0, 10 ) ) + >>> intersecter.insert_interval( Interval( 3, 7 ) ) + >>> intersecter.insert_interval( Interval( 3, 40 ) ) + >>> intersecter.insert_interval( Interval( 13, 50 ) ) + + >>> intersecter.find( 30, 50 ) + [Interval(3, 40), Interval(13, 50)] + >>> intersecter.find( 100, 200 ) + [] + + Before/after for intervals + + >>> intersecter.before_interval( Interval( 10, 20 ) ) + [Interval(3, 7)] + >>> intersecter.before_interval( Interval( 5, 20 ) ) + [] + + Upstream/downstream + + >>> intersecter.upstream_of_interval(Interval(11, 12)) + [Interval(0, 10)] + >>> intersecter.upstream_of_interval(Interval(11, 12, strand="-")) + [Interval(13, 50)] + + >>> intersecter.upstream_of_interval(Interval(1, 2, strand="-"), num_intervals=3) + [Interval(3, 7), Interval(3, 40), Interval(13, 50)] + + + """ + + cdef IntervalNode root + + def __cinit__( self ): + root = None + + # ---- Position based interfaces ----------------------------------------- + + def insert( self, int start, int end, object value=None ): + """ + Insert the interval [start,end) associated with value `value`. + """ + if self.root is None: + self.root = IntervalNode( start, end, value ) + else: + self.root = self.root.insert( start, end, value ) + + add = insert + + + def find( self, start, end ): + """ + Return a sorted list of all intervals overlapping [start,end). + """ + if self.root is None: + return [] + return self.root.find( start, end ) + + def before( self, position, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie before `position` and are no + further than `max_dist` positions away + """ + if self.root is None: + return [] + return self.root.left( position, num_intervals, max_dist ) + + def after( self, position, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie after `position` and are no + further than `max_dist` positions away + """ + if self.root is None: + return [] + return self.root.right( position, num_intervals, max_dist ) + + # ---- Interval-like object based interfaces ----------------------------- + + def insert_interval( self, interval ): + """ + Insert an "interval" like object (one with at least start and end + attributes) + """ + self.insert( interval.start, interval.end, interval ) + + add_interval = insert_interval + + def before_interval( self, interval, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie completely before `interval` + and are no further than `max_dist` positions away + """ + if self.root is None: + return [] + return self.root.left( interval.start, num_intervals, max_dist ) + + def after_interval( self, interval, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie completely after `interval` and + are no further than `max_dist` positions away + """ + if self.root is None: + return [] + return self.root.right( interval.end, num_intervals, max_dist ) + + def upstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie completely upstream of + `interval` and are no further than `max_dist` positions away + """ + if self.root is None: + return [] + if interval.strand == -1 or interval.strand == "-": + return self.root.right( interval.end, num_intervals, max_dist ) + else: + return self.root.left( interval.start, num_intervals, max_dist ) + + def downstream_of_interval( self, interval, num_intervals=1, max_dist=2500 ): + """ + Find `num_intervals` intervals that lie completely downstream of + `interval` and are no further than `max_dist` positions away + """ + if self.root is None: + return [] + if interval.strand == -1 or interval.strand == "-": + return self.root.left( interval.start, num_intervals, max_dist ) + else: + return self.root.right( interval.end, num_intervals, max_dist ) + + def traverse(self, fn): + """ + call fn for each element in the tree + """ + if self.root is None: + return None + return self.root.traverse(fn) + +# For backward compatibility +Intersecter = IntervalTree diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection_tests.py new file mode 100755 index 0000000..b36fb35 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/intersection_tests.py @@ -0,0 +1,219 @@ +import sys, os +import unittest +try: + sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) +except: + sys.path.insert(0, os.path.dirname(os.path.abspath("."))) + +from bx.intervals.intersection import Interval +from bx.intervals.intersection import IntervalNode +from bx.intervals.intersection import IntervalTree + +class NeighborTestCase(unittest.TestCase): + + def setUp(self): + iv = IntervalNode( 50, 59, Interval(50, 59)) + for i in range(0, 110, 10): + if i == 50: continue + f = Interval(i, i + 9) + iv = iv.insert( f.start, f.end, f) + self.intervals = iv + + def test_left(self): + iv = self.intervals + self.assertEqual(str(iv.left(60, n=2)), str([Interval(50, 59), Interval(40, 49)])) + + for i in range(10, 100, 10): + r = iv.left(i, max_dist=10, n=1) + self.assertEqual(r[0].end, i - 1) + + def test_toomany(self): + iv = self.intervals + self.assertEqual(len(iv.left(60, n=200)) , 6) + + + def test_right(self): + iv = self.intervals + self.assertEqual(str(iv.left(60, n=2)), str([Interval(50, 59), Interval(40, 49)])) + + def get_right_start(b10): + r = iv.right(b10+1, n=1) + assert len(r) == 1 + return r[0].start + + for i in range(10, 100, 10): + self.assertEqual(get_right_start(i), i + 10) + + for i in range(0, 100, 10): + r = iv.right(i-1, max_dist=10, n=1) + print r + self.assertEqual(r[0].start, i) + +class UpDownStreamTestCase(unittest.TestCase): + + def setUp(self): + iv = IntervalTree() + iv.add_interval(Interval(50, 59)) + for i in range(0, 110, 10): + if i == 50: continue + f = Interval(i, i + 9) + iv.add_interval(f) + self.intervals = iv + + + def test_upstream(self): + iv = self.intervals + upstreams = iv.upstream_of_interval(Interval(59, 60), num_intervals=200) + for u in upstreams: + self.assertTrue(u.end < 59) + + upstreams = iv.upstream_of_interval(Interval(60, 70, strand=-1), + num_intervals=200) + for u in upstreams: + self.assertTrue(u.start > 70) + + + upstreams = iv.upstream_of_interval(Interval(58, 58, strand=-1), + num_intervals=200) + for u in upstreams: + self.assertTrue(u.start > 59) + + + def test_downstream(self): + iv = self.intervals + downstreams = iv.downstream_of_interval(Interval(59, 60), + num_intervals=200) + for d in downstreams: + self.assertTrue(d.start > 60) + + downstreams = iv.downstream_of_interval(Interval(59, 60, strand=-1), + num_intervals=200) + for d in downstreams: + self.assertTrue(d.start < 59) + + + def test_n(self): + iv = self.intervals + for i in range(0, 90, 10): + r = iv.after(i, max_dist=20, num_intervals=2) + self.assertEqual(r[0].start, i + 10) + self.assertEqual(r[1].start, i + 20) + + r = iv.after_interval(Interval(i, i), max_dist=20, num_intervals=2) + self.assertEqual(r[0].start, i + 10) + self.assertEqual(r[1].start, i + 20) + + +class LotsaTestCase(unittest.TestCase): + """ put lotsa data in the tree and make sure it works""" + def setUp(self): + iv = IntervalNode(1, 2, Interval(1, 2)) + self.max = 1000000 + for i in range(0, self.max, 10): + f = Interval(i, i) + iv = iv.insert(f.start, f.end, f) + + for i in range(600): + iv = iv.insert( 0, 1, Interval(0, 1) ) + self.intervals = iv + + + + def test_count(self): + iv = self.intervals + + r = iv.right(1, n=33) + self.assertEqual(len(r), 33) + + l = iv.left(1, n=33) + self.assertEqual(len(l), 1) + + u = iv.right(1, n=9999) + self.assertEqual(len(u), 250) + + # now increase max_dist + u = iv.right(1, n=9999, max_dist=99999) + self.assertEqual(len(u), 9999) + + + def test_max_dist(self): + iv = self.intervals + r = iv.right(1, max_dist=0, n=10) + self.assertEqual(len(r), 0) + + for n, d in enumerate(range(10, 1000, 10)): + r = iv.right(1, max_dist=d, n=10000) + self.assertEqual(len(r), n + 1) + + def test_find(self): + iv = self.intervals + path = sys.path[:] + sys.path = sys.path[2:] + ## import random + random = __import__("random") + sys.path = path + for t in range(25): + start = random.randint(0, self.max - 10000) + end = start + random.randint(100, 10000) + + results = iv.find(start, end) + for feat in results: + self.assertTrue( + (feat.end >= start and feat.end <= end) + or + (feat.start <= end and feat.start >= start) + ) + + +class IntervalTreeTest(unittest.TestCase): + def setUp(self): + + iv = IntervalTree() + n = 0 + for i in range(1, 1000, 80): + iv.insert(i, i + 10, dict(value=i*i)) + # add is synonym for insert. + iv.add(i + 20, i + 30, dict(astr=str(i*i))) + + # or insert/add an interval object with start, end attrs. + iv.insert_interval(Interval(i + 40, i + 50, + value=dict(astr=str(i*i)))) + iv.add_interval(Interval(i + 60, i + 70, + value=dict(astr=str(i*i)))) + + n += 4 + self.intervals = self.iv = iv + self.nintervals = n + + + def test_find(self): + + r = self.iv.find(100, 200) + self.assertEqual(len(r), 5) + + def test_traverse(self): + a = [] + fn = a.append + + self.iv.traverse(fn) + self.assertEqual(len(a), self.nintervals) + + def test_empty(self): + iv = IntervalTree() + self.assertEqual([], iv.find(100, 300)) + self.assertEqual([], iv.after(100)) + self.assertEqual([], iv.before(100)) + self.assertEqual([], iv.after_interval(100)) + self.assertEqual([], iv.before_interval(100)) + self.assertEqual([], iv.upstream_of_interval(100)) + self.assertEqual([], iv.downstream_of_interval(100)) + self.assertEqual(None, iv.traverse(lambda x: x.append(1))) + + def test_public_interval(self): + + fn = lambda ival: self.assert_(ival.interval) + self.iv.traverse(fn) + +if __name__ == "__main__": + + unittest.main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/io.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/io.py new file mode 100755 index 0000000..aa7468a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/io.py @@ -0,0 +1,221 @@ +""" +Support for reading and writing genomic intervals from delimited text files. +""" + +import sys +from itertools import * +from bx.tabular.io import * +from bx.bitset import * + +class MissingFieldError( ParseError ): + pass + +class FieldFormatError( ParseError ): + def __init__( self, *args, **kwargs): + ParseError.__init__( self, *args, **kwargs ) + self.expected = kwargs.get("expected",None) + def __str__( self ): + if self.expected: + return ParseError.__str__( self ) + ", " + self.expected + " expected" + else: + return ParseError.__str__( self ) + +class StrandFormatError( ParseError ): + pass + +class GenomicInterval( TableRow ): + """ + A genomic interval stored in a set of fields (a row of a table) + """ + def __init__( self, reader, fields, chrom_col, start_col, end_col, strand_col, default_strand, fix_strand=False ): + TableRow.__init__( self, reader, fields ) + self.chrom_col = chrom_col + self.start_col = start_col + self.end_col = end_col + self.strand_col = strand_col + self.nfields = nfields = len( fields ) + # Parse chrom/source column + if chrom_col >= nfields: + raise MissingFieldError( "No field for chrom_col (%d)" % chrom_col ) + self.chrom = fields[chrom_col].strip() + # Parse start column and ensure it is an integer + if start_col >= nfields: + raise MissingFieldError( "No field for start_col (%d)" % start_col ) + try: + self.start = int( fields[start_col] ) + except ValueError, e: + raise FieldFormatError( "Could not parse start_col: " + str( e ), expected="integer" ) + # Parse end column and ensure it is an integer + if end_col >= nfields: + raise MissingFieldError( "No field for end_col (%d)" % end_col ) + try: + self.end = int( fields[end_col] ) + except ValueError, e: + raise FieldFormatError( "Could not parse end_col: " + str( e ), expected="integer" ) + # Ensure start <= end + if self.end < self.start: + raise ParseError( "Start is greater than End. Interval length is < 1." ) + # Parse strand and ensure it is valid + if strand_col >= nfields or strand_col < 0: + # This should probable be immutable since the fields are + # not updated when it is set + self.strand = default_strand + else: + strand = fields[strand_col] + if strand not in ( "+", "-"): + if fix_strand: + strand = "+" + else: raise StrandFormatError( "Strand must be either '+' or '-'" ) + self.strand = strand + def __setattr__( self, name, value ): + if name == "chrom": + self.fields[self.chrom_col] = str( value ) + elif name == "start": + self.fields[self.start_col] = str( value ) + elif name == "end": + self.fields[self.end_col] = str( value ) + elif name == "strand": + if self.strand_col < self.nfields and self.strand_col >= 0: + self.fields[self.strand_col] = str( value ) + object.__setattr__( self, name, value ) + def __str__( self ): + return "\t".join( self.fields ) + def copy( self ): + return GenomicInterval(self.reader, list( self.fields ), self.chrom_col, self.start_col, self.end_col, self.strand_col, self.strand) + +class GenomicIntervalReader( TableReader ): + """ + Reader for iterating a set of intervals in a tab separated file. Can + also parse header and comment lines if requested. + + >>> r = GenomicIntervalReader( [ "#chrom\\tname\\tstart\\tend\\textra", + ... "chr1\\tfoo\\t1\\t100\\txxx", + ... "chr2\\tbar\\t20\\t300\\txxx", + ... "#I am a comment", + ... "chr2\\tbar\\t20\\t300\\txxx" ], start_col=2, end_col=3 ) + >>> elements = list( r ) + >>> assert type( elements[0] ) is Header + >>> str( elements[0] ) + '#chrom\\tname\\tstart\\tend\\textra' + >>> assert type( elements[1] ) is GenomicInterval + >>> print elements[1].start, elements[1].end + 1 100 + >>> str( elements[1] ) + 'chr1\\tfoo\\t1\\t100\\txxx' + >>> elements[1].start = 30 + >>> print elements[1].start, elements[1].end + 30 100 + >>> str( elements[1] ) + 'chr1\\tfoo\\t30\\t100\\txxx' + >>> assert type( elements[2] ) is GenomicInterval + >>> assert type( elements[3] ) is Comment + >>> assert type( elements[4] ) is GenomicInterval + """ + def __init__( self, input, chrom_col=0, start_col=1, end_col=2, strand_col=5, + default_strand="+", return_header=True, return_comments=True, force_header=None, fix_strand=False, comment_lines_startswith = ["#", "track "], allow_spaces=False ): + TableReader.__init__( self, input, return_header, return_comments, force_header, comment_lines_startswith ) + self.chrom_col = chrom_col + self.start_col = start_col + self.end_col = end_col + self.strand_col = strand_col + self.default_strand = default_strand + self.fix_strand = fix_strand + self.allow_spaces = allow_spaces + def parse_row( self, line ): + # Try multiple separators. First tab, our expected splitter, than + # just whitespace in the case of problematic files with space instead of + # tab separation + seps = ["\t"] + if self.allow_spaces: + seps.append(None) + for i, sep in enumerate(seps): + try: + return GenomicInterval( self, line.split( sep ), self.chrom_col, + self.start_col, self.end_col, + self.strand_col, self.default_strand, + fix_strand=self.fix_strand ) + except Exception, e: + # Catch and store the initial error + if i == 0: + err = e + # Ran out of separators and still have errors, raise our problem + raise err + + def binned_bitsets( self , upstream_pad=0, downstream_pad=0, lens={} ): + # The incoming lens dictionary is a dictionary of chromosome lengths + # which are used to initialize the bitsets. + last_chrom = None + last_bitset = None + bitsets = dict() + for interval in self: + if isinstance(interval, GenomicInterval): + chrom = interval[self.chrom_col] + if chrom != last_chrom: + if chrom not in bitsets: + size = lens.get( chrom, MAX ) + try: + bbs = BinnedBitSet( size ) + except ValueError, e: + # We will only reach here when constructing this bitset from the lens dict + # since the value of MAX is always safe. + raise Exception( "Invalid chrom length %s in 'lens' dictionary. %s" % ( str( size ), str( e ) ) ) + bitsets[chrom] = bbs + last_chrom = chrom + last_bitset = bitsets[chrom] + start = max( int( interval[self.start_col] ), 0 ) + end = min( int( interval[self.end_col] ), last_bitset.size) + last_bitset.set_range( start, end-start ) + return bitsets + +class NiceReaderWrapper( GenomicIntervalReader ): + def __init__( self, reader, **kwargs ): + GenomicIntervalReader.__init__( self, reader, **kwargs ) + self.outstream = kwargs.get("outstream", None) + self.print_delegate = kwargs.get("print_delegate", None) + self.input_wrapper = iter( self.input ) + self.input_iter = self.iterwrapper() + self.skipped = 0 + self.skipped_lines = [] + def __iter__( self ): + return self + def next( self ): + while 1: + try: + nextitem = GenomicIntervalReader.next( self ) + return nextitem + except ParseError, e: + if self.outstream: + if self.print_delegate and hasattr(self.print_delegate,"__call__"): + self.print_delegate( self.outstream, e, self ) + self.skipped += 1 + # no reason to stuff an entire bad file into memmory + if self.skipped < 10: + self.skipped_lines.append( ( self.linenum, self.current_line, str( e ) ) ) + def iterwrapper( self ): + while 1: + self.current_line = self.input_wrapper.next() + yield self.current_line + +class BitsetSafeReaderWrapper( NiceReaderWrapper ): + def __init__( self, reader, lens={} ): + # This class handles any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines. + # The incoming lens dictionary is a dictionary of chromosome lengths + # which are used to initialize the bitsets. + # It is assumed that the reader is an interval reader, i.e. it has chr_col, start_col, end_col and strand_col attributes. + NiceReaderWrapper.__init__( self, reader.input, chrom_col=reader.chrom_col, start_col=reader.start_col, end_col=reader.end_col, strand_col=reader.strand_col) + self.lens = lens + def next( self ): + while True: + rval = NiceReaderWrapper.next( self ) + if isinstance(rval, GenomicInterval) and rval.end > self.lens.get( rval.chrom, MAX ): # MAX_INT is defined in bx.bitset + try: + # This will only work if reader is a NiceReaderWrapper + self.skipped += 1 + # no reason to stuff an entire bad file into memmory + if self.skipped < 10: + self.skipped_lines.append( ( self.linenum, self.current_line, str( e ) ) ) + except: + pass + else: + return rval diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/__init__.py new file mode 100755 index 0000000..ad50a6f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/__init__.py @@ -0,0 +1,39 @@ +""" +High level operations on genomic intervals. Most accept and produce iterables +of `bx.io.inervals.io.GenomicInterval` objects. +""" + +from bx.bitset import * +from bx.filter import * + +def warn( msg ): + print >> sys.stderr, msg + +def fail( msg ): + print >> sys.stderr, msg + sys.exit(1) + +BED_DEFAULT_COLS = 0, 1, 2, 5 +MAX_END = 512*1024*1024 + +def bits_set_in_range( bits, range_start, range_end ): + """ + Yield start,end tuples for each span of set bits in [range_start,range_end) + """ + end = range_start + while 1: + start = bits.next_set( end ) + end = min( bits.next_clear( start ), range_end ) + if start >= end: break + yield start, end + +def bits_clear_in_range( bits, range_start, range_end ): + """ + Yield start,end tuples for each span of clear bits in [range_start,range_end) + """ + end = range_start + while 1: + start = bits.next_clear( end ) + if start >= range_end: break + end = min( bits.next_set( start ), range_end ) + yield start, end diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/base_coverage.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/base_coverage.py new file mode 100755 index 0000000..95a79da --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/base_coverage.py @@ -0,0 +1,29 @@ +""" +Determine the number of bases covered by a set of intervals. +""" + +import psyco_full + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +def base_coverage( reader ): + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + base_reader = BitsetSafeReaderWrapper( reader, lens={} ) + bitsets = base_reader.binned_bitsets() + coverage = 0 + for chrom in bitsets: + try: + coverage += bitsets[chrom].count_range(0, MAX_END) + except IndexError, e: + base_reader.skipped += 1 + # no reason to stuff an entire bad file into memmory + if base_reader.skipped < 10: + base_reader.skipped_lines.append( ( base_reader.linenum, base_reader.current_line, str( e ) ) ) + continue + return coverage diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/complement.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/complement.py new file mode 100755 index 0000000..0ff0804 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/complement.py @@ -0,0 +1,55 @@ +""" +Complement a set of intervals. +""" + +import psyco_full + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * +from bx.bitset import MAX + +def complement( reader, lens ): + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + complement_reader = BitsetSafeReaderWrapper( reader, lens=lens ) + bitsets = complement_reader.binned_bitsets( upstream_pad=0, downstream_pad=0, lens=lens ) + # NOT them all + for key, value in bitsets.items(): + value.invert() + # Read remaining intervals and subtract + for chrom in bitsets: + bitset = bitsets[chrom] + out_intervals = bits_set_in_range( bitset, 0, lens.get( chrom, MAX ) ) + try: + # Write the intervals + for start, end in out_intervals: + fields = ["." for x in range(max(complement_reader.chrom_col, complement_reader.start_col, complement_reader.end_col)+1)] + # default the column to a + if it exists + if complement_reader.strand_col < len( fields ) and complement_reader.strand_col >= 0: + fields[complement_reader.strand_col] = "+" + fields[complement_reader.chrom_col] = chrom + fields[complement_reader.start_col] = start + fields[complement_reader.end_col] = end + new_interval = GenomicInterval(complement_reader, fields, complement_reader.chrom_col, complement_reader.start_col, complement_reader.end_col, complement_reader.strand_col, "+") + yield new_interval + except IndexError, e: + complement_reader.skipped += 1 + # no reason to stuff an entire bad file into memmory + if complement_reader.skipped < 10: + complement_reader.skipped_lines.append( ( complement_reader.linenum, complement_reader.current_line, str( e ) ) ) + continue + + +# def main(): +# # test it all out +# f1 = fileinput.FileInput("dataset_7.dat") +# g1 = GenomicIntervalReader(f1) +# for interval in complement(g1,{"chr":16000000}): +# print "\t".join(interval) +# +# if __name__ == "__main__": +# main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/concat.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/concat.py new file mode 100755 index 0000000..ce660f6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/concat.py @@ -0,0 +1,61 @@ +""" +Concatenate sets of intervals. + +Preserves format of the first input -- it is possible to concat two files that +have different column orders. Of course, the meta-data of the second will be +lost (and filled with a "."). If all of the files (GenomicInteralReaders) are +the same format, sameformat=True will preserve all columns of the first input, +cuts extra columns on subsequent input, and pads missing columns. If +sameformat=False then extra columns are filled with ".". +""" + +import psyco_full + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +def concat(readers, comments=True, header=True, sameformat=True): + # Save columns from the first input + chrom_col = readers[0].chrom_col + start_col = readers[0].start_col + end_col = readers[0].end_col + strand_col = readers[0].strand_col + nfields = None + firstdataset = True + output = False + for intervals in readers: + for interval in intervals: + if isinstance(interval, GenomicInterval): + if not nfields: nfields = interval.nfields + out_interval = interval.copy() + if sameformat or firstdataset: + # everything except the first input has to be + # trimmed or padded to match the first input + if len(out_interval.fields) > nfields: + out_interval.fields = out_interval.fields[0:nfields] + while len(out_interval.fields) < nfields: + out_interval.fields.append(".") + output = True + yield out_interval + else: + chrom = out_interval.chrom + start = out_interval.start + end = out_interval.end + strand = out_interval.strand + out_interval.fields = ["." for col in range(nfields)] + out_interval.fields[chrom_col] = chrom + out_interval.fields[start_col] = str(start) + out_interval.fields[end_col] = str(end) + # Strand is optional, might not exist in output + if strand_col < len( out_interval.fields ): + out_interval.fields[strand_col] = strand + yield out_interval + elif isinstance(interval, Header) and header: + yield interval + elif isinstance(interval, Comment) and comments: + yield interval + if output and firstdataset: firstdataset = False diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/coverage.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/coverage.py new file mode 100755 index 0000000..c106637 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/coverage.py @@ -0,0 +1,72 @@ +""" +Determine amount of each interval in one set covered by the intervals of +another set. Adds two columns to the first input, giving number of bases +covered and percent coverage on the second input. +""" + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +def coverage(readers, comments=True): + # The incoming lens dictionary is a dictionary of chromosome lengths which are used to initialize the bitsets. + primary = readers[0] + intersect = readers[1:] + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + intersect[0] = BitsetSafeReaderWrapper( intersect[0], lens={} ) + bitsets = intersect[0].binned_bitsets() + intersect = intersect[1:] + for andset in intersect: + bitset2 = andset.binned_bitsets() + for chrom in bitsets: + if chrom not in bitset2: continue + bitsets[chrom].ior(bitset2[chrom]) + intersect = intersect[1:] + + # Read remaining intervals and give coverage + for interval in primary: + if isinstance(interval, Header): + yield interval + if isinstance(interval, Comment) and comments: + yield interval + elif isinstance(interval, GenomicInterval): + chrom = interval.chrom + start = int(interval.start) + end = int(interval.end) + if start > end: + try: + # This will only work if primary is a NiceReaderWrapper + primary.skipped += 1 + # no reason to stuff an entire bad file into memmory + if primary.skipped < 10: + primary.skipped_lines.append( ( primary.linenum, primary.current_line, "Interval start after end!" ) ) + except: + pass + continue + if chrom not in bitsets: + bases_covered = 0 + percent = 0.0 + else: + try: + bases_covered = bitsets[ chrom ].count_range( start, end-start ) + except IndexError, e: + try: + # This will only work if primary is a NiceReaderWrapper + primary.skipped += 1 + # no reason to stuff an entire bad file into memmory + if primary.skipped < 10: + primary.skipped_lines.append( ( primary.linenum, primary.current_line, str( e ) ) ) + except: + pass + continue + if (end - start) == 0: + percent = 0 + else: + percent = float(bases_covered) / float(end - start) + interval.fields.append(str(bases_covered)) + interval.fields.append(str(percent)) + yield interval diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/find_clusters.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/find_clusters.py new file mode 100755 index 0000000..819bb80 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/find_clusters.py @@ -0,0 +1,162 @@ +""" +Find clusters of intervals within a set of intervals. A cluster is a +group (of size minregions) of intervals within a specific distance (of +mincols) of each other. + +Returns Cluster objects, which have a chrom, start, end, and lines (a +list of linenumbers from the original file). The original can then be +ran through with the linenumbers to extract clustered regions without +disturbing original order, or the clusters may themselves be written +as intervals. +""" + +import random +import math + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.cluster import * +from bx.intervals.io import * +from bx.intervals.operations import * + + +def find_clusters(reader, mincols=1, minregions=2): + extra = dict() + chroms = dict() + linenum = -1 + for interval in reader: + linenum += 1 + if not isinstance(interval, GenomicInterval): + extra[linenum] = interval + else: + if interval.chrom not in chroms: + chroms[interval.chrom] = ClusterTree( mincols, minregions ) + try: + chroms[interval.chrom].insert( interval.start, interval.end, linenum ) + except OverflowError, e: + try: + # This will work only if reader is a NiceReaderWrapper + reader.skipped += 1 + if reader.skipped < 10: + reader.skipped_lines.append( ( reader.linenum, reader.current_line, str( e ) ) ) + except: + pass + continue + return chroms, extra + + +### DEPRECATED: Use the ClusterTree in bx.intervals.cluster for this. +### It does the same thing, but is a C implementation. +class ClusterNode( object ): + def __init__( self, start, end, linenum, mincols, minregions ): + # Python lacks the binomial distribution, so we convert a + # uniform into a binomial because it naturally scales with + # tree size. Also, python's uniform is perfect since the + # upper limit is not inclusive, which gives us undefined here. + self.priority = math.ceil( (-1.0 / math.log(.5)) * math.log( -1.0 / (random.uniform(0,1) - 1))) + self.start = start + self.end = end + self.left = None + self.right = None + self.lines = [linenum] + self.mincols = mincols + self.minregions = minregions + + def insert( self, start, end, linenum ): + if start - self.mincols > self.end: + # insert to right tree + if self.right: + self.right = self.right.insert( start, end, linenum ) + else: + self.right = ClusterNode(start, end, linenum, self.mincols, self.minregions) + # rebalance tree + if self.priority < self.right.priority: + return self.rotateleft() + elif end + self.mincols < self.start: + # insert to left tree + if self.left: + self.left = self.left.insert( start, end, linenum ) + else: + self.left = ClusterNode(start, end, linenum, self.mincols, self.minregions) + # rebalance tree + if self.priority < self.left.priority: + return self.rotateright() + else: + # insert here + self.start = min(self.start, start) + self.end = max(self.end, end) + self.lines.append(linenum) + # recursive call to push nodes up + if self.left: + self.left = self.left.push_up(self) + if self.right: + self.right = self.right.push_up(self) + return self + + def rotateright( self ): + root = self.left + self.left = self.left.right + root.right = self + return root + + def rotateleft( self ): + root = self.right + self.right = self.right.left + root.left = self + return root + + def push_up( self, topnode ): + # Note: this function does not affect heap property + # Distance method removed for inline, faster? + distance = max(self.start, topnode.start) - min(self.end, topnode.end) + if distance <= self.mincols: + topnode.start = min(self.start, topnode.start) + topnode.end = max(self.end, topnode.end) + for linenum in self.lines: + topnode.lines.append(linenum) + if self.right: + return self.right.push_up( topnode ) + if self.left: + return self.left.push_up( topnode ) + return None + if self.end < topnode.start and self.right: + self.right = self.right.push_up( topnode ) + if self.start > topnode.end and self.left: + self.left = self.left.push_up( topnode ) + return self + + def getintervals( self ): + if self.left: + for start, end in self.left.getintervals(minregions): + yield start, end + if len(self.lines) >= minregions: + yield self.start, self.end + if self.right: + for start, end in self.right.getintervals(minregions): + yield start, end + + def getlines( self ): + if self.left: + for line in self.left.getlines(): + yield line + if len(self.lines) >= minregions: + for line in self.lines: + yield line + if self.right: + for line in self.right.getlines(): + yield line + +## def main(): +## f1 = fileinput.FileInput("big.bed") +## g1 = GenomicIntervalReader(f1) +## returntree, extra = find_clusters(g1, mincols=50) +## print "All found" +## for chrom, value in returntree.items(): +## for start, end in value.getregions(): +## print chrom+"\t"+str(start)+"\t"+str(end) +## for line in value.getlines(): +## print "Line:\t"+str(line) + +## main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/intersect.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/intersect.py new file mode 100755 index 0000000..6380eb1 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/intersect.py @@ -0,0 +1,77 @@ +""" +Compute the intersection of two sets of genomic intervals, either base-by-base +or at the interval level. The returned GenomicIntervalReader will be in +the order of the first set of intervals passed in, with the corresponding +additional fields. +""" + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +def intersect(readers, mincols=1, upstream_pad=0, downstream_pad=0, pieces=True, lens={}, comments=True): + # The incoming lens dictionary is a dictionary of chromosome lengths which are used to initialize the bitsets. + # Read all but first into bitsets and intersect to one + primary = readers[0] + intersect = readers[1:] + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + intersect[0] = BitsetSafeReaderWrapper( intersect[0], lens=lens ) + bitsets = intersect[0].binned_bitsets( upstream_pad=upstream_pad, downstream_pad=downstream_pad, lens=lens ) + intersect = intersect[1:] + for andset in intersect: + bitset2 = andset.binned_bitsets(upstream_pad = upstream_pad, downstream_pad = downstream_pad, lens = lens) + for chrom in bitsets: + if chrom not in bitset2: continue + bitsets[chrom].iand(bitset2[chrom]) + intersect = intersect[1:] + + # Read remaining intervals and intersect + for interval in primary: + if isinstance(interval, Header): + yield interval + if isinstance(interval, Comment) and comments: + yield interval + elif isinstance(interval, GenomicInterval): + chrom = interval.chrom + start = int( interval.start ) + end = int( interval.end ) + if chrom not in bitsets: + continue + if start > end: + try: + # This will only work if primary is a NiceReaderWrapper + primary.skipped += 1 + # no reason to stuff an entire bad file into memmory + if primary.skipped < 10: + primary.skipped_lines.append( ( primary.linenum, primary.current_line, "Interval start after end!" ) ) + except: + pass + continue + out_intervals = [] + # Intersect or Overlap + try: + if bitsets[ chrom ].count_range( start, end-start ) >= mincols: + if pieces: + out_intervals = bits_set_in_range( bitsets[chrom], start, end ) + else: + out_intervals = [ ( start, end ) ] + # Write the intervals + for start, end in out_intervals: + new_interval = interval.copy() + new_interval.start = start + new_interval.end = end + yield new_interval + except IndexError, e: + try: + # This will only work if primary is a NiceReaderWrapper + primary.skipped += 1 + # no reason to stuff an entire bad file into memmory + if primary.skipped < 10: + primary.skipped_lines.append( ( primary.linenum, primary.current_line, str( e ) ) ) + except: + pass + continue diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/join.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/join.py new file mode 100755 index 0000000..1ff7533 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/join.py @@ -0,0 +1,137 @@ +""" +Join two sets of intervals using their overlap as the key. The +intervals MUST be sorted by chrom(lexicographically), +start(arithmetically) and end(arithmetically). This works by simply +walking through the inputs in O(n) time. +""" + +import psyco_full + +import math +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * +from quicksect import IntervalTree + +def join(leftSet, rightSet, mincols=1, leftfill=True, rightfill=True): + # Read rightSet into memory: + rightlen = 0 + leftlen = 0 + rightTree = IntervalTree() + for item in rightSet: + if isinstance(item, GenomicInterval): + rightTree.insert( item, rightSet.linenum, item.fields ) + if rightlen == 0: rightlen = item.nfields + + for interval in leftSet: + if leftlen == 0 and isinstance(interval, GenomicInterval): + leftlen = interval.nfields + if not isinstance(interval, GenomicInterval): + yield interval + else: + result = [] + rightTree.intersect( interval, lambda node: result.append( node ) ) + overlap_not_met = 0 + for item in result: + if item.start in range(interval.start,interval.end+1) and item.end not in range(interval.start,interval.end+1): + overlap = interval.end-item.start + elif item.end in range(interval.start,interval.end+1) and item.start not in range(interval.start,interval.end+1): + overlap = item.end-interval.start + elif item.start in range(interval.start,interval.end+1) and item.end in range(interval.start,interval.end+1): + overlap = item.end-item.start + else: #the intersecting item's start and end are outside the interval range + overlap = interval.end-interval.start + if overlap < mincols: + overlap_not_met += 1 + continue + outfields = list(interval) + map(outfields.append, item.other) + setattr( item, "visited", True ) + yield outfields + if (len(result) == 0 or overlap_not_met == len(result)) and rightfill: + outfields = list(interval) + for x in range(rightlen): outfields.append(".") + yield outfields + + if leftfill: + def report_unvisited( node, results ): + if not hasattr(node, "visited"): + results.append( node ) + results = [] + rightTree.traverse( lambda x: report_unvisited( x, results ) ) + for item in results: + outfields = list() + for x in range(leftlen): outfields.append(".") + map(outfields.append, item.other) + yield outfields + + +def interval_cmp(a, b): + interval1 = a[0] + interval2 = b[0] + if not (isinstance(interval1, GenomicInterval) and isinstance(interval2, GenomicInterval)): + return 0 + # Both are intervals + if interval1.chrom == interval2.chrom: + center1 = interval1.start + ((interval1.end - interval1.start) / 2) + center2 = interval2.start + ((interval2.end - interval2.start) / 2) + return center1 - center2 + else: + if interval1.chrom > interval2.chrom: + return 1 + else: + return -1 + + return 0 + +def findintersect(interval, sortedlist, mincols): + # find range of intervals that intersect via a binary search + # find lower bound + x = len(sortedlist) / 2 + n = int(math.pow(2,math.ceil(math.log(len(sortedlist),2)))) + + not_found = True + not_done = True + while not_found and not_done: + n = n / 2 + if n == 0: + n = 1 + not_done = False + if x >= len(sortedlist): + x -= n + elif x < 0: + x += n + else: + if findoverlap(sortedlist[x][0], interval) >= mincols: + not_found = False + else: + comp = interval_cmp(sortedlist[x], [interval, 0]) + if comp > 0: + x -= n + else: + x += n + + print "\t".join(sortedlist[x][0].fields) + print "not_found = " + str(not_found) + if not_found: + return 0,-1 + + lowerbound = x + middlebound = x + upperbound = x + while (lowerbound > -1) and (findoverlap(sortedlist[lowerbound-1][0],interval) >= mincols): + lowerbound -= 1 + while (upperbound+1 < len(sortedlist)) and (findoverlap(sortedlist[upperbound+1][0],interval) >= mincols): + upperbound += 1 + + return lowerbound, upperbound + +def findoverlap(a, b): + # overlapping + if a.chrom == b.chrom: + return min(a.end, b.end) - max(a.start, b.start) + else: + return 0 diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/merge.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/merge.py new file mode 100755 index 0000000..4ebbdb8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/merge.py @@ -0,0 +1,40 @@ +""" +Merge overlapping regions in two sets of genomic intervals. +""" + +import psyco_full + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +# sorting could make this a less memory intensive operation(?) +def merge( interval, mincols=1 ): + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + interval = BitsetSafeReaderWrapper( interval, lens={} ) + bitsets = interval.binned_bitsets() + if interval.header: + yield interval.header + for chrom in bitsets: + bitset = bitsets[chrom] + output = ["."] * (max(interval.chrom_col, interval.start_col, interval.end_col) + 1) + output[interval.chrom_col] = chrom + try: + for start, end in bits_set_in_range(bitset,0, MAX_END): + output[interval.start_col] = str(start) + output[interval.end_col] = str(end) + yield output + except IndexError, e: + try: + # This will work only if interval is a NiceReaderWrapper + interval.skipped += 1 + # no reason to stuff an entire bad file into memmory + if interval.skipped < 10: + interval.skipped_lines.append( ( interval.linenum, interval.current_line, str( e ) ) ) + except: + pass + continue diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/quicksect.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/quicksect.py new file mode 100755 index 0000000..de05158 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/quicksect.py @@ -0,0 +1,155 @@ +""" +Intersects ... faster. Suports GenomicInterval datatype and multiple +chromosomes. +""" +import math +import time +import sys +import random + +class IntervalTree( object ): + def __init__( self ): + self.chroms = {} + def insert( self, interval, linenum=0, other=None ): + chrom = interval.chrom + start = interval.start + end = interval.end + if interval.chrom in self.chroms: + self.chroms[chrom] = self.chroms[chrom].insert( start, end, linenum, other ) + else: + self.chroms[chrom] = IntervalNode( start, end, linenum, other ) + def intersect( self, interval, report_func ): + chrom = interval.chrom + start = interval.start + end = interval.end + if chrom in self.chroms: + self.chroms[chrom].intersect( start, end, report_func ) + def traverse( self, func ): + for item in self.chroms.itervalues(): + item.traverse( func ) + +class IntervalNode( object ): + def __init__( self, start, end, linenum=0, other=None ): + # Python lacks the binomial distribution, so we convert a + # uniform into a binomial because it naturally scales with + # tree size. Also, python's uniform is perfect since the + # upper limit is not inclusive, which gives us undefined here. + self.priority = math.ceil( (-1.0 / math.log(.5)) * math.log( -1.0 / (random.uniform(0,1) - 1))) + self.start = start + self.end = end + self.maxend = self.end + self.minend = self.end + self.left = None + self.right = None + self.linenum = linenum + self.other = other + def insert( self, start, end, linenum=0, other=None ): + root = self + if start > self.start: + # insert to right tree + if self.right: + self.right = self.right.insert( start, end, linenum, other ) + else: + self.right = IntervalNode(start, end, linenum, other ) + # rebalance tree + if self.priority < self.right.priority: + root = self.rotateleft() + else: + # insert to left tree + if self.left: + self.left = self.left.insert( start, end, linenum, other ) + else: + self.left = IntervalNode(start, end, linenum, other ) + # rebalance tree + if self.priority < self.left.priority: + root = self.rotateright() + if root.right and root.left: + root.maxend = max( root.end, root.right.maxend, root.left.maxend ) + root.minend = min( root.end, root.right.minend, root.left.minend ) + elif root.right: + root.maxend = max( root.end, root.right.maxend ) + root.minend = min( root.end, root.right.minend ) + elif root.left: + root.maxend = max( root.end, root.left.maxend ) + root.minend = min( root.end, root.left.minend ) + return root + + def rotateright( self ): + root = self.left + self.left = self.left.right + root.right = self + if self.right and self.left: + self.maxend = max(self.end, self.right.maxend, self.left.maxend) + self.minend = min(self.end, self.right.minend, self.left.minend ) + elif self.right: + self.maxend = max(self.end, self.right.maxend) + self.minend = min(self.end, self.right.minend) + elif self.left: + self.maxend = max(self.end, self.left.maxend) + self.minend = min(self.end, self.left.minend ) + return root + + def rotateleft( self ): + root = self.right + self.right = self.right.left + root.left = self + if self.right and self.left: + self.maxend = max(self.end, self.right.maxend, self.left.maxend) + self.minend = min(self.end, self.right.minend, self.left.minend ) + elif self.right: + self.maxend = max(self.end, self.right.maxend) + self.minend = min(self.end, self.right.minend) + elif self.left: + self.maxend = max(self.end, self.left.maxend) + self.minend = min(self.end, self.left.minend ) + return root + + def intersect( self, start, end, report_func ): + if start < self.end and end > self.start: report_func( self ) + if self.left and start < self.left.maxend: + self.left.intersect( start, end, report_func ) + if self.right and end > self.start: + self.right.intersect( start, end, report_func ) + + def traverse( self, func ): + if self.left: self.left.traverse( func ) + func( self ) + if self.right: self.right.traverse( func ) + +def main(): + test = None + intlist = [] + for x in range(20000): + start = random.randint(0,1000000) + end = start + random.randint(1, 1000) + if test: test = test.insert( start, end ) + else: test = IntervalNode( start, end ) + intlist.append( (start, end) ) + starttime = time.clock() + for x in range(5000): + start = random.randint(0, 10000000) + end = start + random.randint(1, 1000) + result = [] + test.intersect( start, end, lambda x: result.append(x.linenum) ) + print "%f for tree method" % (time.clock() - starttime) + starttime = time.clock() + for x in range(5000): + start = random.randint(0, 10000000) + end = start + random.randint(1, 1000) + bad_sect( intlist, start, end) + print "%f for linear (bad) method" % (time.clock() - starttime) + +def test_func( node ): + print "[%d, %d), %d" % (node.start, node.end, node.maxend) + +def bad_sect( lst, int_start, int_end ): + intersection = [] + for start, end in lst: + if int_start < end and int_end > start: + intersection.append( (start, end) ) + return intersection + +if __name__ == "__main__": + main() + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/subtract.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/subtract.py new file mode 100755 index 0000000..75384e2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/operations/subtract.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +""" +Subtract one set of genomic intervals from another (base-by-base or whole +intervals). The returned GenomicIntervals will be in the order +of the first set of intervals passed in, with the corresponding +meta-data. +""" + +import traceback +import fileinput +from warnings import warn + +from bx.intervals.io import * +from bx.intervals.operations import * + +def subtract(readers, mincols=1, upstream_pad=0, downstream_pad=0, pieces=True, lens={}, comments=True): + # The incoming lens dictionary is a dictionary of chromosome lengths which are used to initialize the bitsets. + # Read all but first into bitsets and union to one (if confused, read DeMorgan's...) + primary = readers[0] + union = readers[1:] + # Handle any ValueError, IndexError and OverflowError exceptions that may be thrown when + # the bitsets are being created by skipping the problem lines + union[0] = BitsetSafeReaderWrapper( union[0], lens=lens ) + bitsets = union[0].binned_bitsets( upstream_pad=upstream_pad, downstream_pad=downstream_pad, lens=lens ) + union = union[1:] + for andset in union: + bitset2 = andset.binned_bitsets(upstream_pad = upstream_pad, downstream_pad = downstream_pad, lens = lens) + for chrom in bitset2: + if chrom not in bitsets: + bitsets[chrom] = bitset2[chrom] + else: + bitsets[chrom].ior(bitset2[chrom]) + + # Read remaining intervals and subtract + for interval in primary: + if isinstance(interval, Header): + yield interval + if isinstance(interval, Comment) and comments: + yield interval + elif isinstance(interval, GenomicInterval): + chrom = interval.chrom + if chrom not in bitsets: + yield interval + else: + start = int(interval.start) + end = int(interval.end) + if start > end: warn( "Interval start after end!" ) + out_intervals = [] + # Find the intervals that meet the criteria (for the three sensible + # permutations of reverse and pieces) + try: + if bitsets[ chrom ].count_range( start, end-start ) >= mincols: + if pieces: + out_intervals = bits_clear_in_range( bitsets[chrom], start, end ) + else: + out_intervals = [ ( start, end ) ] + # Write the intervals + for start, end in out_intervals: + new_interval = interval.copy() + new_interval.start = start + new_interval.end = end + yield new_interval + except IndexError, e: + try: + # This will work only if primary is a NiceReaderWrapper + primary.skipped += 1 + # no reason to stuff an entire bad file into memmory + if primary.skipped < 10: + primary.skipped_lines.append( ( primary.linenum, primary.current_line, str( e ) ) ) + except: + pass + continue diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intervals/random_intervals.py b/code/utilities/CPAT-1.2.2/lib/bx/intervals/random_intervals.py new file mode 100755 index 0000000..08e37bb --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intervals/random_intervals.py @@ -0,0 +1,212 @@ +""" +Classes for generating random sets of intervals over larger regions. +""" + +from bx.bitset import * +import bisect +random = __import__( 'random' ) + +class MaxtriesException( Exception ): + pass + +def throw_random_list( lengths, mask, allow_overlap=False ): + rval = [] + throw_random_gap_list( lengths, mask, lambda s, e: rval.append( ( s, e ) ), allow_overlap ) + assert sum( b - a for a, b in rval ) == sum( lengths ) + return rval + +def throw_random_bits( lengths, mask, allow_overlap=False ): + rval = BitSet( mask.size ) + throw_random_gap_list( lengths, mask, lambda s, e: rval.set_range( s, e - s ), allow_overlap ) + if not allow_overlap: + assert rval.count_range( 0, rval.size ) == sum( lengths ) + return rval + +def throw_random_gap_list( lengths, mask, save_interval_func, allow_overlap=False ): + """ + Generates a set of non-overlapping random intervals from a length + distribution. + + `lengths`: list containing the length of each interval to be generated. + We expect this to be sorted by decreasing length to minimize + the chance of failure (MaxtriesException) and for some + performance gains when allow_overlap==True and there are + duplicate lengths + `mask`: a BitSet in which set bits represent regions not to place + intervals. The size of the region is also determined from the + mask. + """ + # Use mask to find the gaps; gaps is a list of (length,start,end) + lengths = [length for length in lengths if length > 0] + min_length = min( lengths ) + gaps = [] + start = end = 0 + while 1: + start = mask.next_clear( end ) + if start == mask.size: break + end = mask.next_set( start ) + if end-start >= min_length: + gaps.append( ( end-start, start, None ) ) + # Sort (long regions first) + gaps.sort() + gaps.reverse() + # Throw + throw_random_private( lengths, gaps, save_interval_func, allow_overlap, three_args=False ) + +def throw_random_intervals( lengths, regions, save_interval_func=None, allow_overlap=False ): + """ + Generates a set of non-overlapping random intervals from a length + distribution. + + `lengths`: list containing the length of each interval to be generated. + We expect this to be sorted by decreasing length to minimize + the chance of failure (MaxtriesException) and for some + performance gains when allow_overlap==True and there are + duplicate lengths. + `regions`: A list of regions in which intervals can be placed. Elements + are tuples or lists of the form (start, end, ...), where ... + indicates any number of items (including zero). + `save_interval_func`: A function accepting three arguments which will be + passed the (start,stop,region) for each generated + interval, where region is an entry in the regions + list. If this is None, the generated intervals will + be returned as a list of elements copied from the + region with start and end modified. + """ + # Copy regions + regions = [( x[1]-x[0], x[0], x ) for x in regions] + # Sort (long regions first) + regions.sort() + regions.reverse() + # Throw + if (save_interval_func != None): + throw_random_private( lengths, regions, save_interval_func, allow_overlap ) + return + else: + intervals = [] + save_interval_func = lambda s, e, rgn: intervals.append( overwrite_start_end ( s, e, rgn ) ) + throw_random_private( lengths, regions, save_interval_func, allow_overlap ) + return intervals + +def overwrite_start_end(s,e,rgn): + rgn = list(rgn) + rgn[0] = s + rgn[1] = e + return tuple(rgn) + + +def throw_random_private( lengths, regions, save_interval_func, allow_overlap=False, three_args=True ): + """ + (Internal function; we expect calls only through the interface functions + above) + + `lengths`: A list containing the length of each interval to be generated. + `regions`: A list of regions in which intervals can be placed, sorted by + decreasing length. Elements are triples of the form (length, + start, extra), This list CAN BE MODIFIED by this function. + `save_interval_func`: A function accepting three arguments which will be + passed the (start,stop,extra) for each generated + interval. + """ + + # Implementation: + # We keep a list of the regions, sorted from largest to smallest. We then + # place each length by following steps: + # (1) construct a candidate counts array (cc array) + # (2) choose a candidate at random + # (3) find region containing that candidate + # (4) map candidate to position in that region + # (5) split region if not allowing overlaps + # (6) report placed segment + # + # The cc array is only constructed if there's a change (different length + # to place, or the region list has changed). It contains, for each + # region, the total number of number of candidate positions in regions + # *preceding* it in the region list: + # cc[i] = sum over k in 0..(i-1) of length[i] - L + 1 + # where N is the number of regions and L is the length being thrown. + # At the same time, we determine the total number of candidates (the total + # number of places the current length can be placed) and the index range + # of regions into which the length will fit. + # + # example: + # for L = 20 + # i = 0 1 2 3 4 5 6 7 8 9 + # length[i] = 96 66 56 50 48 40 29 17 11 8 + # cc[i] = 0 77 124 161 192 221 242 X X X + # candidates = 252 + # lo_rgn = 0 + # hi_rgn = 6 + # + # The candidate is chosen in (0..candidates-1). The candidate counts + # array allows us to do a binary search to locate the region that holds that + # candidate. Continuing the example above, we choose a random candidate + # s in (0..251). If s happens to be in (124..160), it will be mapped to + # region 2 at start position s-124. + # + # During the binary search, if we are looking at region 3, if s < cc[3] + # then the desired region is region 2 or lower. Otherwise it is region 3 or + # higher. + + min_length = min( lengths ) + prev_length = None # (force initial cc array construction) + cc = [0] * (len( regions ) + len(lengths) - 1) + num_thrown = 0 + for length in lengths: + # construct cc array (only needed if length has changed or region list has + # changed) + if length != prev_length: + prev_length = length + assert len( cc ) >= len( regions ) + candidates = 0 + hi_rgn = 0 + for region in regions: + rgn_len = region[0] + if rgn_len < length: + break + cc[hi_rgn] = candidates + candidates += rgn_len - length + 1 + hi_rgn += 1 + if candidates == 0: + raise MaxtriesException( "No region can fit an interval of length %d (we threw %d of %d)" \ + % ( length, num_thrown,len( lengths ) ) ) + hi_rgn -= 1 + # Select a candidate + s = random.randrange( candidates ) + #.. + #..for ix in range( len( regions ) ): + #.. region = regions[ix] + #.. if ix <= hi_rgn: print "%2s: %5s %5s %5s" % ( ix, region[1], region[0], cc[ix] ) + #.. else: print "%2s: %5s %5s %5s" % ( ix, region[1], region[0], "X" ) + #..print "s = %s (of %s candidates)" % ( s, candidates ) + # Locate region containing that candidate, by binary search + lo = 0 + hi = hi_rgn + while hi > lo: + mid = (lo + hi + 1) / 2 # (we round up to prevent infinite loop) + if s < cc[mid]: hi = mid-1 # (s < num candidates from 0..mid-1) + else: lo = mid # (s >= num candidates from 0..mid-1) + s -= cc[lo] + # If we are not allowing overlaps we will remove the placed interval + # from the region list + if allow_overlap: + rgn_length, rgn_start, rgn_extra = regions[lo] + else: + # Remove the chosen region and split + rgn_length, rgn_start, rgn_extra = regions.pop( lo ) + rgn_end = rgn_start + rgn_length + assert s >= 0 + assert rgn_start + s + length <= rgn_end, "Expected: %d + %d + %d == %d <= %d" % ( rgn_start, s, length, rgn_start + s + length, rgn_end ) + regions.reverse() + if s >= min_length: + bisect.insort( regions, ( s, rgn_start, rgn_extra ) ) + if s + length <= rgn_length - min_length: + bisect.insort( regions, ( rgn_length - ( s + length ), rgn_start + s + length, rgn_extra ) ) + regions.reverse() + prev_length = None # (force cc array construction) + # Save the new interval + if (three_args): + save_interval_func( rgn_start + s, rgn_start + s + length, rgn_extra ) + else: + save_interval_func( rgn_start + s, rgn_start + s + length ) + num_thrown += 1 diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intseq/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/intseq/__init__.py new file mode 100755 index 0000000..9f07e65 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intseq/__init__.py @@ -0,0 +1,3 @@ +""" +Tools for working with strings over interger alphabets efficiently. +""" \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.c b/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.c new file mode 100755 index 0000000..4fb5194 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.c @@ -0,0 +1,2468 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:09 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__intseq__ngramcount +#define __PYX_HAVE_API__bx__intseq__ngramcount +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "ngramcount.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface; +typedef struct __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface; + +/* "bx/intseq/ngramcount.pyx":21 + * WRITEABLE=0x400 + * + * ctypedef struct PyArrayInterface: # <<<<<<<<<<<<<< + * int two # contains the integer 2 as a sanity check + * int nd # number of dimensions + */ +struct __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface { + int two; + int nd; + char typekind; + int itemsize; + int flags; + Py_intptr_t *shape; + Py_intptr_t *strides; + void *data; +}; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +#if PY_MAJOR_VERSION >= 3 +static PyObject* __pyx_print = 0; +static PyObject* __pyx_print_kwargs = 0; +#endif + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.intseq.ngramcount' */ +static PyObject *__pyx_f_2bx_6intseq_10ngramcount__count_ngrams(int *, int, int *, int, int); /*proto*/ +#define __Pyx_MODULE_NAME "bx.intseq.ngramcount" +int __pyx_module_is_main_bx__intseq__ngramcount = 0; + +/* Implementation of 'bx.intseq.ngramcount' */ +static char __pyx_k_1[] = "Array interface sanity check failed, got %d"; +static char __pyx_k_2[] = "Input array must be 1d"; +static char __pyx_k_3[] = "Input array must contain integers"; +static char __pyx_k_4[] = "Input array must contain 32bit integers"; +static char __pyx_k_5[] = "Input array must be contiguous"; +static char __pyx_k_6[] = "Input array must be aligned"; +static char __pyx_k_7[] = "Input array must not be byteswapped"; +static char __pyx_k_8[] = "Array interface sanity check failed"; +static char __pyx_k_9[] = "breaking, letter"; +static char __pyx_k_10[] = "\nTools for counting words (n-grams) in integer sequences.\n"; +static char __pyx_k_11[] = "bx.intseq.ngramcount"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__ints[] = "ints"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__int32[] = "int32"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__radix[] = "radix"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__ALIGNED[] = "ALIGNED"; +static char __pyx_k__FORTRAN[] = "FORTRAN"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__WRITEABLE[] = "WRITEABLE"; +static char __pyx_k__CONTIGUOUS[] = "CONTIGUOUS"; +static char __pyx_k__NOTSWAPPED[] = "NOTSWAPPED"; +static char __pyx_k__count_ngrams[] = "count_ngrams"; +static char __pyx_k____array_struct__[] = "__array_struct__"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_11; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__ALIGNED; +static PyObject *__pyx_n_s__CONTIGUOUS; +static PyObject *__pyx_n_s__FORTRAN; +static PyObject *__pyx_n_s__NOTSWAPPED; +static PyObject *__pyx_n_s__WRITEABLE; +static PyObject *__pyx_n_s____array_struct__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__count_ngrams; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__int32; +static PyObject *__pyx_n_s__ints; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__radix; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_256; +static PyObject *__pyx_int_512; +static PyObject *__pyx_int_1024; + +/* "bx/intseq/ngramcount.pyx":31 + * void *data # A pointer to the first element of the array + * + * def count_ngrams( object ints, int n, int radix ): # <<<<<<<<<<<<<< + * """ + * Count the number of occurrences of each possible length `n` word in + */ + +static PyObject *__pyx_pf_2bx_6intseq_10ngramcount_count_ngrams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_6intseq_10ngramcount_count_ngrams[] = "\n Count the number of occurrences of each possible length `n` word in \n `ints` (which contains values from 0 to `radix`). Returns an array\n of length `radix` ** `n` containing the counts.\n "; +static PyMethodDef __pyx_mdef_2bx_6intseq_10ngramcount_count_ngrams = {__Pyx_NAMESTR("count_ngrams"), (PyCFunction)__pyx_pf_2bx_6intseq_10ngramcount_count_ngrams, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_6intseq_10ngramcount_count_ngrams)}; +static PyObject *__pyx_pf_2bx_6intseq_10ngramcount_count_ngrams(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_ints = 0; + int __pyx_v_n; + int __pyx_v_radix; + __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface *__pyx_v_ints_desc; + __pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface *__pyx_v_rval_desc; + PyObject *__pyx_v_ints_desc_obj = NULL; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_v_rval_desc_obj = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ints,&__pyx_n_s__n,&__pyx_n_s__radix,0}; + __Pyx_RefNannySetupContext("count_ngrams"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ints); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("count_ngrams", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__radix); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("count_ngrams", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count_ngrams") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_ints = values[0]; + __pyx_v_n = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_radix = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_radix == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("count_ngrams", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.intseq.ngramcount.count_ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/intseq/ngramcount.pyx":39 + * cdef PyArrayInterface * ints_desc, * rval_desc + * # Get array interface for input string and validate + * ints_desc_obj = ints.__array_struct__ # <<<<<<<<<<<<<< + * ints_desc = PyCObject_AsVoidPtr( ints_desc_obj ) + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_ints, __pyx_n_s____array_struct__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ints_desc_obj = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/intseq/ngramcount.pyx":40 + * # Get array interface for input string and validate + * ints_desc_obj = ints.__array_struct__ + * ints_desc = PyCObject_AsVoidPtr( ints_desc_obj ) # <<<<<<<<<<<<<< + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * assert ints_desc.nd == 1, "Input array must be 1d" + */ + __pyx_v_ints_desc = ((__pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_ints_desc_obj)); + + /* "bx/intseq/ngramcount.pyx":41 + * ints_desc_obj = ints.__array_struct__ + * ints_desc = PyCObject_AsVoidPtr( ints_desc_obj ) + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two # <<<<<<<<<<<<<< + * assert ints_desc.nd == 1, "Input array must be 1d" + * assert ints_desc.typekind == 'i'[0], "Input array must contain integers" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_ints_desc->two == 2))) { + __pyx_t_1 = PyInt_FromLong(__pyx_v_ints_desc->two); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":42 + * ints_desc = PyCObject_AsVoidPtr( ints_desc_obj ) + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * assert ints_desc.nd == 1, "Input array must be 1d" # <<<<<<<<<<<<<< + * assert ints_desc.typekind == 'i'[0], "Input array must contain integers" + * assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_ints_desc->nd == 1))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_2)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":43 + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * assert ints_desc.nd == 1, "Input array must be 1d" + * assert ints_desc.typekind == 'i'[0], "Input array must contain integers" # <<<<<<<<<<<<<< + * assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = PyInt_FromLong(__pyx_v_ints_desc->typekind); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_n_s__i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_3)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":44 + * assert ints_desc.nd == 1, "Input array must be 1d" + * assert ints_desc.typekind == 'i'[0], "Input array must contain integers" + * assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" # <<<<<<<<<<<<<< + * assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert ints_desc.flags & ALIGNED > 0, "Input array must be aligned" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_ints_desc->itemsize == 4))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_4)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":45 + * assert ints_desc.typekind == 'i'[0], "Input array must contain integers" + * assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" # <<<<<<<<<<<<<< + * assert ints_desc.flags & ALIGNED > 0, "Input array must be aligned" + * assert ints_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_3 = PyInt_FromLong(__pyx_v_ints_desc->flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__CONTIGUOUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_5)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":46 + * assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert ints_desc.flags & ALIGNED > 0, "Input array must be aligned" # <<<<<<<<<<<<<< + * assert ints_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + * # Create numpy array for return value, get array interface and validate + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyInt_FromLong(__pyx_v_ints_desc->flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ALIGNED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_And(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_6)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":47 + * assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert ints_desc.flags & ALIGNED > 0, "Input array must be aligned" + * assert ints_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" # <<<<<<<<<<<<<< + * # Create numpy array for return value, get array interface and validate + * rval = numpy.zeros( ( ( radix ) ** n ), dtype=numpy.int32 ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = PyInt_FromLong(__pyx_v_ints_desc->flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__NOTSWAPPED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_7)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":49 + * assert ints_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + * # Create numpy array for return value, get array interface and validate + * rval = numpy.zeros( ( ( radix ) ** n ), dtype=numpy.int32 ) # <<<<<<<<<<<<<< + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * rval_desc_obj = rval.__array_struct__ + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(((int)powf(((float)__pyx_v_radix), ((float)__pyx_v_n)))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_rval = __pyx_t_6; + __pyx_t_6 = 0; + + /* "bx/intseq/ngramcount.pyx":50 + * # Create numpy array for return value, get array interface and validate + * rval = numpy.zeros( ( ( radix ) ** n ), dtype=numpy.int32 ) + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two # <<<<<<<<<<<<<< + * rval_desc_obj = rval.__array_struct__ + * rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_ints_desc->two == 2))) { + __pyx_t_6 = PyInt_FromLong(__pyx_v_ints_desc->two); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":51 + * rval = numpy.zeros( ( ( radix ) ** n ), dtype=numpy.int32 ) + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * rval_desc_obj = rval.__array_struct__ # <<<<<<<<<<<<<< + * rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) + * assert rval_desc.two == 2, "Array interface sanity check failed" + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_rval, __pyx_n_s____array_struct__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_rval_desc_obj = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/intseq/ngramcount.pyx":52 + * assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + * rval_desc_obj = rval.__array_struct__ + * rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) # <<<<<<<<<<<<<< + * assert rval_desc.two == 2, "Array interface sanity check failed" + * assert rval_desc.nd == 1, "Input array must be 1d" + */ + __pyx_v_rval_desc = ((__pyx_t_2bx_6intseq_10ngramcount_PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_rval_desc_obj)); + + /* "bx/intseq/ngramcount.pyx":53 + * rval_desc_obj = rval.__array_struct__ + * rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) + * assert rval_desc.two == 2, "Array interface sanity check failed" # <<<<<<<<<<<<<< + * assert rval_desc.nd == 1, "Input array must be 1d" + * assert rval_desc.typekind == 'i'[0], "Input array must contain integers" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_rval_desc->two == 2))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_8)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":54 + * rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) + * assert rval_desc.two == 2, "Array interface sanity check failed" + * assert rval_desc.nd == 1, "Input array must be 1d" # <<<<<<<<<<<<<< + * assert rval_desc.typekind == 'i'[0], "Input array must contain integers" + * assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_rval_desc->nd == 1))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_2)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":55 + * assert rval_desc.two == 2, "Array interface sanity check failed" + * assert rval_desc.nd == 1, "Input array must be 1d" + * assert rval_desc.typekind == 'i'[0], "Input array must contain integers" # <<<<<<<<<<<<<< + * assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_3 = PyInt_FromLong(__pyx_v_rval_desc->typekind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_n_s__i), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_3)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":56 + * assert rval_desc.nd == 1, "Input array must be 1d" + * assert rval_desc.typekind == 'i'[0], "Input array must contain integers" + * assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" # <<<<<<<<<<<<<< + * assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert rval_desc.flags & ALIGNED > 0, "Input array must be aligned" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_rval_desc->itemsize == 4))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_4)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":57 + * assert rval_desc.typekind == 'i'[0], "Input array must contain integers" + * assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" # <<<<<<<<<<<<<< + * assert rval_desc.flags & ALIGNED > 0, "Input array must be aligned" + * assert rval_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = PyInt_FromLong(__pyx_v_rval_desc->flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__CONTIGUOUS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_And(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_5)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":58 + * assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" + * assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert rval_desc.flags & ALIGNED > 0, "Input array must be aligned" # <<<<<<<<<<<<<< + * assert rval_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + * # Do it + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_6 = PyInt_FromLong(__pyx_v_rval_desc->flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ALIGNED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_And(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_6)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":59 + * assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + * assert rval_desc.flags & ALIGNED > 0, "Input array must be aligned" + * assert rval_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" # <<<<<<<<<<<<<< + * # Do it + * _count_ngrams( ints_desc.data, ints_desc.shape[0], rval_desc.data, n, radix ) + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_3 = PyInt_FromLong(__pyx_v_rval_desc->flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NOTSWAPPED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_And(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_7)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/intseq/ngramcount.pyx":61 + * assert rval_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + * # Do it + * _count_ngrams( ints_desc.data, ints_desc.shape[0], rval_desc.data, n, radix ) # <<<<<<<<<<<<<< + * return rval + * + */ + __pyx_t_2 = __pyx_f_2bx_6intseq_10ngramcount__count_ngrams(((int *)__pyx_v_ints_desc->data), (__pyx_v_ints_desc->shape[0]), ((int *)__pyx_v_rval_desc->data), __pyx_v_n, __pyx_v_radix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/intseq/ngramcount.pyx":62 + * # Do it + * _count_ngrams( ints_desc.data, ints_desc.shape[0], rval_desc.data, n, radix ) + * return rval # <<<<<<<<<<<<<< + * + * cdef _count_ngrams( int* ints, int n_ints, int* rval, int n, int radix ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("bx.intseq.ngramcount.count_ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ints_desc_obj); + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_rval_desc_obj); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/intseq/ngramcount.pyx":64 + * return rval + * + * cdef _count_ngrams( int* ints, int n_ints, int* rval, int n, int radix ): # <<<<<<<<<<<<<< + * cdef int i, j, index, factor, letter + * # Loop over each word in the string + */ + +static PyObject *__pyx_f_2bx_6intseq_10ngramcount__count_ngrams(int *__pyx_v_ints, int __pyx_v_n_ints, int *__pyx_v_rval, int __pyx_v_n, int __pyx_v_radix) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_index; + int __pyx_v_factor; + int __pyx_v_letter; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_count_ngrams"); + + /* "bx/intseq/ngramcount.pyx":67 + * cdef int i, j, index, factor, letter + * # Loop over each word in the string + * for i from 0 <= i < ( n_ints - n ): # <<<<<<<<<<<<<< + * # Walk back to build index into count array + * index = 0 + */ + __pyx_t_1 = (__pyx_v_n_ints - __pyx_v_n); + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/intseq/ngramcount.pyx":69 + * for i from 0 <= i < ( n_ints - n ): + * # Walk back to build index into count array + * index = 0 # <<<<<<<<<<<<<< + * factor = 1 + * for j from 0 <= j < n: + */ + __pyx_v_index = 0; + + /* "bx/intseq/ngramcount.pyx":70 + * # Walk back to build index into count array + * index = 0 + * factor = 1 # <<<<<<<<<<<<<< + * for j from 0 <= j < n: + * letter = ints[ i + j ] + */ + __pyx_v_factor = 1; + + /* "bx/intseq/ngramcount.pyx":71 + * index = 0 + * factor = 1 + * for j from 0 <= j < n: # <<<<<<<<<<<<<< + * letter = ints[ i + j ] + * if letter < 0 or letter >= radix: + */ + __pyx_t_2 = __pyx_v_n; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "bx/intseq/ngramcount.pyx":72 + * factor = 1 + * for j from 0 <= j < n: + * letter = ints[ i + j ] # <<<<<<<<<<<<<< + * if letter < 0 or letter >= radix: + * # This word is bad, break out and do not increment counts + */ + __pyx_v_letter = (__pyx_v_ints[(__pyx_v_i + __pyx_v_j)]); + + /* "bx/intseq/ngramcount.pyx":73 + * for j from 0 <= j < n: + * letter = ints[ i + j ] + * if letter < 0 or letter >= radix: # <<<<<<<<<<<<<< + * # This word is bad, break out and do not increment counts + * print "breaking, letter", letter + */ + __pyx_t_3 = (__pyx_v_letter < 0); + if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_letter >= __pyx_v_radix); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "bx/intseq/ngramcount.pyx":75 + * if letter < 0 or letter >= radix: + * # This word is bad, break out and do not increment counts + * print "breaking, letter", letter # <<<<<<<<<<<<<< + * break + * index = index + letter * factor + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_letter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + if (__Pyx_Print(0, ((PyObject *)__pyx_t_7), 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + + /* "bx/intseq/ngramcount.pyx":76 + * # This word is bad, break out and do not increment counts + * print "breaking, letter", letter + * break # <<<<<<<<<<<<<< + * index = index + letter * factor + * factor = factor * radix + */ + goto __pyx_L6_break; + goto __pyx_L7; + } + __pyx_L7:; + + /* "bx/intseq/ngramcount.pyx":77 + * print "breaking, letter", letter + * break + * index = index + letter * factor # <<<<<<<<<<<<<< + * factor = factor * radix + * else: + */ + __pyx_v_index = (__pyx_v_index + (__pyx_v_letter * __pyx_v_factor)); + + /* "bx/intseq/ngramcount.pyx":78 + * break + * index = index + letter * factor + * factor = factor * radix # <<<<<<<<<<<<<< + * else: + * print index + */ + __pyx_v_factor = (__pyx_v_factor * __pyx_v_radix); + } + /*else*/ { + + /* "bx/intseq/ngramcount.pyx":80 + * factor = factor * radix + * else: + * print index # <<<<<<<<<<<<<< + * rval[ index ] = rval[ index ] + 1 + * + */ + __pyx_t_7 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_PrintOne(0, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "bx/intseq/ngramcount.pyx":81 + * else: + * print index + * rval[ index ] = rval[ index ] + 1 # <<<<<<<<<<<<<< + * + */ + (__pyx_v_rval[__pyx_v_index]) = ((__pyx_v_rval[__pyx_v_index]) + 1); + } + __pyx_L6_break:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("bx.intseq.ngramcount._count_ngrams", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("ngramcount"), + __Pyx_DOCSTR(__pyx_k_10), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 1}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__ALIGNED, __pyx_k__ALIGNED, sizeof(__pyx_k__ALIGNED), 0, 0, 1, 1}, + {&__pyx_n_s__CONTIGUOUS, __pyx_k__CONTIGUOUS, sizeof(__pyx_k__CONTIGUOUS), 0, 0, 1, 1}, + {&__pyx_n_s__FORTRAN, __pyx_k__FORTRAN, sizeof(__pyx_k__FORTRAN), 0, 0, 1, 1}, + {&__pyx_n_s__NOTSWAPPED, __pyx_k__NOTSWAPPED, sizeof(__pyx_k__NOTSWAPPED), 0, 0, 1, 1}, + {&__pyx_n_s__WRITEABLE, __pyx_k__WRITEABLE, sizeof(__pyx_k__WRITEABLE), 0, 0, 1, 1}, + {&__pyx_n_s____array_struct__, __pyx_k____array_struct__, sizeof(__pyx_k____array_struct__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__count_ngrams, __pyx_k__count_ngrams, sizeof(__pyx_k__count_ngrams), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, + {&__pyx_n_s__ints, __pyx_k__ints, sizeof(__pyx_k__ints), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__radix, __pyx_k__radix, sizeof(__pyx_k__radix), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initngramcount(void); /*proto*/ +PyMODINIT_FUNC initngramcount(void) +#else +PyMODINIT_FUNC PyInit_ngramcount(void); /*proto*/ +PyMODINIT_FUNC PyInit_ngramcount(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ngramcount(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ngramcount"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_10), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__intseq__ngramcount) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/intseq/ngramcount.pyx":5 + * """ + * + * import numpy # <<<<<<<<<<<<<< + * + * cdef extern from "Python.h": + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/intseq/ngramcount.pyx":15 + * + * # for PyArrayInterface: + * CONTIGUOUS=0x01 # <<<<<<<<<<<<<< + * FORTRAN=0x02 + * ALIGNED=0x100 + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__CONTIGUOUS, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intseq/ngramcount.pyx":16 + * # for PyArrayInterface: + * CONTIGUOUS=0x01 + * FORTRAN=0x02 # <<<<<<<<<<<<<< + * ALIGNED=0x100 + * NOTSWAPPED=0x200 + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FORTRAN, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intseq/ngramcount.pyx":17 + * CONTIGUOUS=0x01 + * FORTRAN=0x02 + * ALIGNED=0x100 # <<<<<<<<<<<<<< + * NOTSWAPPED=0x200 + * WRITEABLE=0x400 + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ALIGNED, __pyx_int_256) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intseq/ngramcount.pyx":18 + * FORTRAN=0x02 + * ALIGNED=0x100 + * NOTSWAPPED=0x200 # <<<<<<<<<<<<<< + * WRITEABLE=0x400 + * + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NOTSWAPPED, __pyx_int_512) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intseq/ngramcount.pyx":19 + * ALIGNED=0x100 + * NOTSWAPPED=0x200 + * WRITEABLE=0x400 # <<<<<<<<<<<<<< + * + * ctypedef struct PyArrayInterface: + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__WRITEABLE, __pyx_int_1024) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/intseq/ngramcount.pyx":31 + * void *data # A pointer to the first element of the array + * + * def count_ngrams( object ints, int n, int radix ): # <<<<<<<<<<<<<< + * """ + * Count the number of occurrences of each possible length `n` word in + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_6intseq_10ngramcount_count_ngrams, NULL, __pyx_n_s_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__count_ngrams, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/intseq/ngramcount.pyx":1 + * """ # <<<<<<<<<<<<<< + * Tools for counting words (n-grams) in integer sequences. + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.intseq.ngramcount", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.intseq.ngramcount"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if PY_MAJOR_VERSION < 3 +static PyObject *__Pyx_GetStdout(void) { + PyObject *f = PySys_GetObject((char *)"stdout"); + if (!f) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + } + return f; +} + +static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { + PyObject* v; + int i; + + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + if (PyFile_SoftSpace(f, 1)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + v = PyTuple_GET_ITEM(arg_tuple, i); + if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) + return -1; + if (PyString_Check(v)) { + char *s = PyString_AsString(v); + Py_ssize_t len = PyString_Size(v); + if (len > 0 && + isspace(Py_CHARMASK(s[len-1])) && + s[len-1] != ' ') + PyFile_SoftSpace(f, 0); + } + } + if (newline) { + if (PyFile_WriteString("\n", f) < 0) + return -1; + PyFile_SoftSpace(f, 0); + } + return 0; +} + +#else /* Python 3 has a print function */ + +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_print)) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_print_kwargs)) { + __pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_print_kwargs; + } + result = PyObject_Call(__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} + +#endif + +#if PY_MAJOR_VERSION < 3 + +static int __Pyx_PrintOne(PyObject* f, PyObject *o) { + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + if (PyFile_SoftSpace(f, 0)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) + return -1; + if (PyFile_WriteString("\n", f) < 0) + return -1; + return 0; + /* the line below is just to avoid compiler + * compiler warnings about unused functions */ + return __Pyx_Print(f, NULL, 0); +} + +#else /* Python 3 has a print function */ + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { + int res; + PyObject* arg_tuple = PyTuple_New(1); + if (unlikely(!arg_tuple)) + return -1; + Py_INCREF(o); + PyTuple_SET_ITEM(arg_tuple, 0, o); + res = __Pyx_Print(stream, arg_tuple, 1); + Py_DECREF(arg_tuple); + return res; +} + +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.pyx b/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.pyx new file mode 100755 index 0000000..4ae891e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/intseq/ngramcount.pyx @@ -0,0 +1,82 @@ +""" +Tools for counting words (n-grams) in integer sequences. +""" + +import numpy + +cdef extern from "Python.h": + ctypedef int Py_intptr_t + long PyInt_AsLong(object) + void Py_INCREF(object) + void Py_DECREF(object) + void * PyCObject_AsVoidPtr(object cobj) + +# for PyArrayInterface: +CONTIGUOUS=0x01 +FORTRAN=0x02 +ALIGNED=0x100 +NOTSWAPPED=0x200 +WRITEABLE=0x400 + +ctypedef struct PyArrayInterface: + int two # contains the integer 2 as a sanity check + int nd # number of dimensions + char typekind # kind in array --- character code of typestr + int itemsize # size of each element + int flags # flags indicating how the data should be interpreted + Py_intptr_t *shape # A length-nd array of shape information + Py_intptr_t *strides # A length-nd array of stride information + void *data # A pointer to the first element of the array + +def count_ngrams( object ints, int n, int radix ): + """ + Count the number of occurrences of each possible length `n` word in + `ints` (which contains values from 0 to `radix`). Returns an array + of length `radix` ** `n` containing the counts. + """ + cdef PyArrayInterface * ints_desc, * rval_desc + # Get array interface for input string and validate + ints_desc_obj = ints.__array_struct__ + ints_desc = PyCObject_AsVoidPtr( ints_desc_obj ) + assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + assert ints_desc.nd == 1, "Input array must be 1d" + assert ints_desc.typekind == 'i'[0], "Input array must contain integers" + assert ints_desc.itemsize == 4, "Input array must contain 32bit integers" + assert ints_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + assert ints_desc.flags & ALIGNED > 0, "Input array must be aligned" + assert ints_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + # Create numpy array for return value, get array interface and validate + rval = numpy.zeros( ( ( radix ) ** n ), dtype=numpy.int32 ) + assert ints_desc.two == 2, "Array interface sanity check failed, got %d" % ints_desc.two + rval_desc_obj = rval.__array_struct__ + rval_desc = PyCObject_AsVoidPtr( rval_desc_obj ) + assert rval_desc.two == 2, "Array interface sanity check failed" + assert rval_desc.nd == 1, "Input array must be 1d" + assert rval_desc.typekind == 'i'[0], "Input array must contain integers" + assert rval_desc.itemsize == 4, "Input array must contain 32bit integers" + assert rval_desc.flags & CONTIGUOUS > 0, "Input array must be contiguous" + assert rval_desc.flags & ALIGNED > 0, "Input array must be aligned" + assert rval_desc.flags & NOTSWAPPED > 0, "Input array must not be byteswapped" + # Do it + _count_ngrams( ints_desc.data, ints_desc.shape[0], rval_desc.data, n, radix ) + return rval + +cdef _count_ngrams( int* ints, int n_ints, int* rval, int n, int radix ): + cdef int i, j, index, factor, letter + # Loop over each word in the string + for i from 0 <= i < ( n_ints - n ): + # Walk back to build index into count array + index = 0 + factor = 1 + for j from 0 <= j < n: + letter = ints[ i + j ] + if letter < 0 or letter >= radix: + # This word is bad, break out and do not increment counts + print "breaking, letter", letter + break + index = index + letter * factor + factor = factor * radix + else: + print index + rval[ index ] = rval[ index ] + 1 + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/__init__.py new file mode 100755 index 0000000..94a3b13 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/__init__.py @@ -0,0 +1,13 @@ +""" +Various utilities. +""" + +import bz2, gzip + +def open_compressed( filename, mode='r' ): + if filename.endswith( ".bz2" ): + return bz2.BZ2File( filename, mode ) + elif filename.endswith( ".gz" ): + return gzip.GzipFile( filename, mode ) + else: + return file( filename, mode ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.c b/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.c new file mode 100755 index 0000000..358fb33 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.c @@ -0,0 +1,2936 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__misc___seekbzip2 +#define __PYX_HAVE_API__bx__misc___seekbzip2 +#include "micro-bunzip.h" +#include "unistd.h" +#include "stdlib.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_seekbzip2.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2; + +/* "bx/misc/_seekbzip2.pyx":38 + * import os + * + * cdef class SeekBzip2: # <<<<<<<<<<<<<< + * + * cdef bunzip_data * bd + */ +struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 { + PyObject_HEAD + bunzip_data *bd; + int file_fd; + int at_eof; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.misc._seekbzip2' */ +static PyTypeObject *__pyx_ptype_2bx_4misc_10_seekbzip2_SeekBzip2 = 0; +#define __Pyx_MODULE_NAME "bx.misc._seekbzip2" +int __pyx_module_is_main_bx__misc___seekbzip2 = 0; + +/* Implementation of 'bx.misc._seekbzip2' */ +static PyObject *__pyx_builtin_Exception; +static char __pyx_k_1[] = "lseek of underlying file failed"; +static char __pyx_k_3[] = "read_bunzip error %d"; +static char __pyx_k_4[] = ""; +static char __pyx_k_5[] = "\nPyrex/C extension supporting `bx.misc.seekbzip2` (wrapping the low level\nfunctions in `micro-bunzip.c`).\n"; +static char __pyx_k__os[] = "os"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__open[] = "open"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__O_RDONLY[] = "O_RDONLY"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__filename[] = "filename"; +static char __pyx_k__Exception[] = "Exception"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_n_s__Exception; +static PyObject *__pyx_n_s__O_RDONLY; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__filename; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__open; +static PyObject *__pyx_n_s__os; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_k_tuple_2; + +/* "bx/misc/_seekbzip2.pyx":44 + * cdef int at_eof + * + * def __init__( self, filename ): # <<<<<<<<<<<<<< + * self.at_eof = 0 + * self.file_fd = os.open( filename, os.O_RDONLY ) + */ + +static int __pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_filename = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/_seekbzip2.pyx":45 + * + * def __init__( self, filename ): + * self.at_eof = 0 # <<<<<<<<<<<<<< + * self.file_fd = os.open( filename, os.O_RDONLY ) + * # Initialize bunzip_data from the file + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof = 0; + + /* "bx/misc/_seekbzip2.pyx":46 + * def __init__( self, filename ): + * self.at_eof = 0 + * self.file_fd = os.open( filename, os.O_RDONLY ) # <<<<<<<<<<<<<< + * # Initialize bunzip_data from the file + * start_bunzip( &( self.bd ), self.file_fd, NULL, 0 ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_RDONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->file_fd = __pyx_t_4; + + /* "bx/misc/_seekbzip2.pyx":48 + * self.file_fd = os.open( filename, os.O_RDONLY ) + * # Initialize bunzip_data from the file + * start_bunzip( &( self.bd ), self.file_fd, NULL, 0 ) # <<<<<<<<<<<<<< + * + * def close( self ): + */ + start_bunzip((&((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd), ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->file_fd, NULL, 0); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/_seekbzip2.pyx":50 + * start_bunzip( &( self.bd ), self.file_fd, NULL, 0 ) + * + * def close( self ): # <<<<<<<<<<<<<< + * free( self.bd.dbuf ) + * free( self.bd ) + */ + +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("close"); + + /* "bx/misc/_seekbzip2.pyx":51 + * + * def close( self ): + * free( self.bd.dbuf ) # <<<<<<<<<<<<<< + * free( self.bd ) + * os.close( self.file_fd ) + */ + free(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->dbuf); + + /* "bx/misc/_seekbzip2.pyx":52 + * def close( self ): + * free( self.bd.dbuf ) + * free( self.bd ) # <<<<<<<<<<<<<< + * os.close( self.file_fd ) + * + */ + free(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd); + + /* "bx/misc/_seekbzip2.pyx":53 + * free( self.bd.dbuf ) + * free( self.bd ) + * os.close( self.file_fd ) # <<<<<<<<<<<<<< + * + * def seek( self, unsigned long long position ): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->file_fd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/_seekbzip2.pyx":55 + * os.close( self.file_fd ) + * + * def seek( self, unsigned long long position ): # <<<<<<<<<<<<<< + * """ + * Seek the bunzip_data to a specific chunk (position must correspond to + */ + +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_2seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_position); /*proto*/ +static char __pyx_doc_2bx_4misc_10_seekbzip2_9SeekBzip2_2seek[] = "\n Seek the bunzip_data to a specific chunk (position must correspond to\n that start of a compressed data block).\n "; +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_2seek(PyObject *__pyx_v_self, PyObject *__pyx_arg_position) { + unsigned PY_LONG_LONG __pyx_v_position; + off_t __pyx_v_n_byte; + int __pyx_v_n_bit; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("seek"); + assert(__pyx_arg_position); { + __pyx_v_position = __Pyx_PyInt_AsUnsignedLongLong(__pyx_arg_position); if (unlikely((__pyx_v_position == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/_seekbzip2.pyx":64 + * # Break position into bit and byte offsets + * ## sys.stderr.write( "arg pos: %d\n" % position ) + * n_byte = position / 8; # <<<<<<<<<<<<<< + * n_bit = position % 8; + * ## sys.stderr.write( "byte pos: %d\n" % n_byte ) + */ + __pyx_v_n_byte = (__pyx_v_position / 8); + + /* "bx/misc/_seekbzip2.pyx":65 + * ## sys.stderr.write( "arg pos: %d\n" % position ) + * n_byte = position / 8; + * n_bit = position % 8; # <<<<<<<<<<<<<< + * ## sys.stderr.write( "byte pos: %d\n" % n_byte ) + * ## sys.stderr.write( "bit pos: %d\n" % n_bit ) + */ + __pyx_v_n_bit = (__pyx_v_position % 8); + + /* "bx/misc/_seekbzip2.pyx":70 + * ## sys.stderr.flush() + * # Seek the underlying file descriptor + * if ( lseek( self.file_fd, n_byte, 0 ) != n_byte ): # <<<<<<<<<<<<<< + * raise Exception( "lseek of underlying file failed" ) + * # Init the buffer at the right bit position + */ + __pyx_t_1 = (lseek(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->file_fd, __pyx_v_n_byte, 0) != __pyx_v_n_byte); + if (__pyx_t_1) { + + /* "bx/misc/_seekbzip2.pyx":71 + * # Seek the underlying file descriptor + * if ( lseek( self.file_fd, n_byte, 0 ) != n_byte ): + * raise Exception( "lseek of underlying file failed" ) # <<<<<<<<<<<<<< + * # Init the buffer at the right bit position + * self.bd.inbufBitCount = self.bd.inbufPos = self.bd.inbufCount = 0 + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/misc/_seekbzip2.pyx":73 + * raise Exception( "lseek of underlying file failed" ) + * # Init the buffer at the right bit position + * self.bd.inbufBitCount = self.bd.inbufPos = self.bd.inbufCount = 0 # <<<<<<<<<<<<<< + * get_bits( self.bd, n_bit ) + * # This ensures that the next read call will return 0, causing the + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->inbufBitCount = 0; + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->inbufPos = 0; + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->inbufCount = 0; + + /* "bx/misc/_seekbzip2.pyx":74 + * # Init the buffer at the right bit position + * self.bd.inbufBitCount = self.bd.inbufPos = self.bd.inbufCount = 0 + * get_bits( self.bd, n_bit ) # <<<<<<<<<<<<<< + * # This ensures that the next read call will return 0, causing the + * # buffer to be re-initialized + */ + get_bits(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd, __pyx_v_n_bit); + + /* "bx/misc/_seekbzip2.pyx":77 + * # This ensures that the next read call will return 0, causing the + * # buffer to be re-initialized + * self.bd.writeCount = -1 # <<<<<<<<<<<<<< + * # Reset EOF tracking + * self.at_eof = 0 + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->writeCount = -1; + + /* "bx/misc/_seekbzip2.pyx":79 + * self.bd.writeCount = -1 + * # Reset EOF tracking + * self.at_eof = 0 # <<<<<<<<<<<<<< + * + * def readline( self, int amount ): + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/_seekbzip2.pyx":81 + * self.at_eof = 0 + * + * def readline( self, int amount ): # <<<<<<<<<<<<<< + * cdef object rval + * cdef char * p_rval + */ + +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_3readline(PyObject *__pyx_v_self, PyObject *__pyx_arg_amount); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_3readline(PyObject *__pyx_v_self, PyObject *__pyx_arg_amount) { + int __pyx_v_amount; + PyObject *__pyx_v_rval = 0; + char *__pyx_v_p_rval; + int __pyx_v_gotcount; + int __pyx_v_totalcount; + int __pyx_v_status; + int __pyx_v_spaceleft; + int __pyx_v_desired; + PyObject *__pyx_v_chunks = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("readline"); + assert(__pyx_arg_amount); { + __pyx_v_amount = __Pyx_PyInt_AsInt(__pyx_arg_amount); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.readline", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/_seekbzip2.pyx":89 + * cdef int spaceleft + * cdef int desired + * gotcount = 0 # <<<<<<<<<<<<<< + * totalcount = 0 + * # If already at EOF return None + */ + __pyx_v_gotcount = 0; + + /* "bx/misc/_seekbzip2.pyx":90 + * cdef int desired + * gotcount = 0 + * totalcount = 0 # <<<<<<<<<<<<<< + * # If already at EOF return None + * if self.at_eof: + */ + __pyx_v_totalcount = 0; + + /* "bx/misc/_seekbzip2.pyx":92 + * totalcount = 0 + * # If already at EOF return None + * if self.at_eof: # <<<<<<<<<<<<<< + * return None + * chunks = [] + */ + if (((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof) { + + /* "bx/misc/_seekbzip2.pyx":93 + * # If already at EOF return None + * if self.at_eof: + * return None # <<<<<<<<<<<<<< + * chunks = [] + * # We have great difficulty resizing buffers, so we'll just create + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/misc/_seekbzip2.pyx":94 + * if self.at_eof: + * return None + * chunks = [] # <<<<<<<<<<<<<< + * # We have great difficulty resizing buffers, so we'll just create + * # one 8k string at a time + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_chunks = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":97 + * # We have great difficulty resizing buffers, so we'll just create + * # one 8k string at a time + * rval = PyString_FromStringAndSize( NULL, 8192 ) # <<<<<<<<<<<<<< + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, 8192); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":98 + * # one 8k string at a time + * rval = PyString_FromStringAndSize( NULL, 8192 ) + * p_rval = PyString_AsString( rval ) # <<<<<<<<<<<<<< + * spaceleft = 8192 + * while amount != 0: + */ + __pyx_v_p_rval = PyString_AsString(__pyx_v_rval); + + /* "bx/misc/_seekbzip2.pyx":99 + * rval = PyString_FromStringAndSize( NULL, 8192 ) + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 # <<<<<<<<<<<<<< + * while amount != 0: + * if amount > 0 and amount < spaceleft: + */ + __pyx_v_spaceleft = 8192; + + /* "bx/misc/_seekbzip2.pyx":100 + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 + * while amount != 0: # <<<<<<<<<<<<<< + * if amount > 0 and amount < spaceleft: + * desired = amount + */ + while (1) { + __pyx_t_2 = (__pyx_v_amount != 0); + if (!__pyx_t_2) break; + + /* "bx/misc/_seekbzip2.pyx":101 + * spaceleft = 8192 + * while amount != 0: + * if amount > 0 and amount < spaceleft: # <<<<<<<<<<<<<< + * desired = amount + * else: + */ + __pyx_t_2 = (__pyx_v_amount > 0); + if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_amount < __pyx_v_spaceleft); + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "bx/misc/_seekbzip2.pyx":102 + * while amount != 0: + * if amount > 0 and amount < spaceleft: + * desired = amount # <<<<<<<<<<<<<< + * else: + * desired = spaceleft + */ + __pyx_v_desired = __pyx_v_amount; + goto __pyx_L8; + } + /*else*/ { + + /* "bx/misc/_seekbzip2.pyx":104 + * desired = amount + * else: + * desired = spaceleft # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, amount: %d\n" % amount ) + * ## sys.stderr.write( "buffer: %r" % rval[:100] ) + */ + __pyx_v_desired = __pyx_v_spaceleft; + } + __pyx_L8:; + + /* "bx/misc/_seekbzip2.pyx":110 + * ## sys.stderr.flush() + * # ord( "\n" ) = 10 + * status = read_bunzip_to_char( self.bd, p_rval, desired, &gotcount, 10 ); # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, desired: %d, gotcount: %d\n" % ( desired, gotcount ) ); + * ## sys.stderr.write( "buffer: %r" % rval[:100] ) + */ + __pyx_v_status = read_bunzip_to_char(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd, __pyx_v_p_rval, __pyx_v_desired, (&__pyx_v_gotcount), 10); + + /* "bx/misc/_seekbzip2.pyx":133 + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 + * elif status == -8: # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, END_OF_BLOCK\n" ); sys.stderr.flush() + * # No more data in the decomp buffer (RETVAL_END_OF_BLOCK == -10) + */ + switch (__pyx_v_status) { + + /* "bx/misc/_seekbzip2.pyx":115 + * ## sys.stderr.write( "\n" ) + * ## sys.stderr.flush() + * if status == -9: # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, STOP_CHAR\n" ); sys.stderr.flush() + * # Reached the stop character (RETVAL_STOPCHAR == -9), so + */ + case -9: + + /* "bx/misc/_seekbzip2.pyx":119 + * # Reached the stop character (RETVAL_STOPCHAR == -9), so + * # we can stop + * chunks.append( rval[:8192-spaceleft+gotcount] ) # <<<<<<<<<<<<<< + * break + * elif status == -10: + */ + if (unlikely(((PyObject *)__pyx_v_chunks) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_rval, 0, ((8192 - __pyx_v_spaceleft) + __pyx_v_gotcount)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyList_Append(__pyx_v_chunks, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":120 + * # we can stop + * chunks.append( rval[:8192-spaceleft+gotcount] ) + * break # <<<<<<<<<<<<<< + * elif status == -10: + * ## sys.stderr.write( "readline, BUFFER_FULL\n" ); sys.stderr.flush() + */ + goto __pyx_L7_break; + break; + + /* "bx/misc/_seekbzip2.pyx":121 + * chunks.append( rval[:8192-spaceleft+gotcount] ) + * break + * elif status == -10: # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, BUFFER_FULL\n" ); sys.stderr.flush() + * # Filled the buffer (RETVAL_BUFFER_FULL == -10), so create + */ + case -10: + + /* "bx/misc/_seekbzip2.pyx":125 + * # Filled the buffer (RETVAL_BUFFER_FULL == -10), so create + * # new buffer and keep going + * chunks.append( rval ) # <<<<<<<<<<<<<< + * amount = amount - gotcount + * if amount == 0: + */ + if (unlikely(((PyObject *)__pyx_v_chunks) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_Append(__pyx_v_chunks, __pyx_v_rval); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/misc/_seekbzip2.pyx":126 + * # new buffer and keep going + * chunks.append( rval ) + * amount = amount - gotcount # <<<<<<<<<<<<<< + * if amount == 0: + * # Got the desired amount + */ + __pyx_v_amount = (__pyx_v_amount - __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":127 + * chunks.append( rval ) + * amount = amount - gotcount + * if amount == 0: # <<<<<<<<<<<<<< + * # Got the desired amount + * break + */ + __pyx_t_4 = (__pyx_v_amount == 0); + if (__pyx_t_4) { + + /* "bx/misc/_seekbzip2.pyx":129 + * if amount == 0: + * # Got the desired amount + * break # <<<<<<<<<<<<<< + * rval = PyString_FromStringAndSize( NULL, 8192 ) + * p_rval = PyString_AsString( rval ) + */ + goto __pyx_L7_break; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/misc/_seekbzip2.pyx":130 + * # Got the desired amount + * break + * rval = PyString_FromStringAndSize( NULL, 8192 ) # <<<<<<<<<<<<<< + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, 8192); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_rval); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":131 + * break + * rval = PyString_FromStringAndSize( NULL, 8192 ) + * p_rval = PyString_AsString( rval ) # <<<<<<<<<<<<<< + * spaceleft = 8192 + * elif status == -8: + */ + __pyx_v_p_rval = PyString_AsString(__pyx_v_rval); + + /* "bx/misc/_seekbzip2.pyx":132 + * rval = PyString_FromStringAndSize( NULL, 8192 ) + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 # <<<<<<<<<<<<<< + * elif status == -8: + * ## sys.stderr.write( "readline, END_OF_BLOCK\n" ); sys.stderr.flush() + */ + __pyx_v_spaceleft = 8192; + break; + + /* "bx/misc/_seekbzip2.pyx":133 + * p_rval = PyString_AsString( rval ) + * spaceleft = 8192 + * elif status == -8: # <<<<<<<<<<<<<< + * ## sys.stderr.write( "readline, END_OF_BLOCK\n" ); sys.stderr.flush() + * # No more data in the decomp buffer (RETVAL_END_OF_BLOCK == -10) + */ + case -8: + + /* "bx/misc/_seekbzip2.pyx":136 + * ## sys.stderr.write( "readline, END_OF_BLOCK\n" ); sys.stderr.flush() + * # No more data in the decomp buffer (RETVAL_END_OF_BLOCK == -10) + * if gotcount and p_rval[ gotcount - 1 ] == 10: # <<<<<<<<<<<<<< + * chunks.append( rval[:8192-spaceleft+gotcount] ) + * break + */ + if (__pyx_v_gotcount) { + __pyx_t_4 = ((__pyx_v_p_rval[(__pyx_v_gotcount - 1)]) == 10); + __pyx_t_2 = __pyx_t_4; + } else { + __pyx_t_2 = __pyx_v_gotcount; + } + if (__pyx_t_2) { + + /* "bx/misc/_seekbzip2.pyx":137 + * # No more data in the decomp buffer (RETVAL_END_OF_BLOCK == -10) + * if gotcount and p_rval[ gotcount - 1 ] == 10: + * chunks.append( rval[:8192-spaceleft+gotcount] ) # <<<<<<<<<<<<<< + * break + * # Update buffer info + */ + if (unlikely(((PyObject *)__pyx_v_chunks) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_rval, 0, ((8192 - __pyx_v_spaceleft) + __pyx_v_gotcount)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyList_Append(__pyx_v_chunks, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":138 + * if gotcount and p_rval[ gotcount - 1 ] == 10: + * chunks.append( rval[:8192-spaceleft+gotcount] ) + * break # <<<<<<<<<<<<<< + * # Update buffer info + * p_rval = p_rval + gotcount + */ + goto __pyx_L7_break; + goto __pyx_L10; + } + __pyx_L10:; + + /* "bx/misc/_seekbzip2.pyx":140 + * break + * # Update buffer info + * p_rval = p_rval + gotcount # <<<<<<<<<<<<<< + * spaceleft = spaceleft - gotcount + * amount = amount - gotcount + */ + __pyx_v_p_rval = (__pyx_v_p_rval + __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":141 + * # Update buffer info + * p_rval = p_rval + gotcount + * spaceleft = spaceleft - gotcount # <<<<<<<<<<<<<< + * amount = amount - gotcount + * # Get the next block + */ + __pyx_v_spaceleft = (__pyx_v_spaceleft - __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":142 + * p_rval = p_rval + gotcount + * spaceleft = spaceleft - gotcount + * amount = amount - gotcount # <<<<<<<<<<<<<< + * # Get the next block + * status = get_next_block( self.bd ) + */ + __pyx_v_amount = (__pyx_v_amount - __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":144 + * amount = amount - gotcount + * # Get the next block + * status = get_next_block( self.bd ) # <<<<<<<<<<<<<< + * if status == -1: + * # Block is end of stream block (RETVAL_LAST_BLOCK == -1) + */ + __pyx_v_status = get_next_block(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd); + + /* "bx/misc/_seekbzip2.pyx":145 + * # Get the next block + * status = get_next_block( self.bd ) + * if status == -1: # <<<<<<<<<<<<<< + * # Block is end of stream block (RETVAL_LAST_BLOCK == -1) + * self.at_eof = 1 + */ + __pyx_t_2 = (__pyx_v_status == -1); + if (__pyx_t_2) { + + /* "bx/misc/_seekbzip2.pyx":147 + * if status == -1: + * # Block is end of stream block (RETVAL_LAST_BLOCK == -1) + * self.at_eof = 1 # <<<<<<<<<<<<<< + * chunks.append( rval[:gotcount] ) + * break + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof = 1; + + /* "bx/misc/_seekbzip2.pyx":148 + * # Block is end of stream block (RETVAL_LAST_BLOCK == -1) + * self.at_eof = 1 + * chunks.append( rval[:gotcount] ) # <<<<<<<<<<<<<< + * break + * self.bd.writeCRC = 0xffffffff + */ + if (unlikely(((PyObject *)__pyx_v_chunks) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_rval, 0, __pyx_v_gotcount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyList_Append(__pyx_v_chunks, __pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":149 + * self.at_eof = 1 + * chunks.append( rval[:gotcount] ) + * break # <<<<<<<<<<<<<< + * self.bd.writeCRC = 0xffffffff + * self.bd.writeCopies = 0 + */ + goto __pyx_L7_break; + goto __pyx_L11; + } + __pyx_L11:; + + /* "bx/misc/_seekbzip2.pyx":150 + * chunks.append( rval[:gotcount] ) + * break + * self.bd.writeCRC = 0xffffffff # <<<<<<<<<<<<<< + * self.bd.writeCopies = 0 + * else: + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->writeCRC = 0xffffffff; + + /* "bx/misc/_seekbzip2.pyx":151 + * break + * self.bd.writeCRC = 0xffffffff + * self.bd.writeCopies = 0 # <<<<<<<<<<<<<< + * else: + * # Some other status + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->writeCopies = 0; + break; + default: + + /* "bx/misc/_seekbzip2.pyx":154 + * else: + * # Some other status + * raise Exception( "read_bunzip error %d" % status ) # <<<<<<<<<<<<<< + * # Return whatever we read + * return "".join( chunks ) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_status); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + } + __pyx_L7_break:; + + /* "bx/misc/_seekbzip2.pyx":156 + * raise Exception( "read_bunzip error %d" % status ) + * # Return whatever we read + * return "".join( chunks ) # <<<<<<<<<<<<<< + * + * def read( self, int amount ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_4), __pyx_n_s__join); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_v_chunks)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chunks)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_chunks)); + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.readline", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XDECREF(__pyx_v_chunks); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/_seekbzip2.pyx":158 + * return "".join( chunks ) + * + * def read( self, int amount ): # <<<<<<<<<<<<<< + * cdef object rval + * cdef char * p_rval + */ + +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_4read(PyObject *__pyx_v_self, PyObject *__pyx_arg_amount); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_4read(PyObject *__pyx_v_self, PyObject *__pyx_arg_amount) { + int __pyx_v_amount; + PyObject *__pyx_v_rval = 0; + char *__pyx_v_p_rval; + int __pyx_v_gotcount; + int __pyx_v_totalcount; + int __pyx_v_status; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read"); + assert(__pyx_arg_amount); { + __pyx_v_amount = __Pyx_PyInt_AsInt(__pyx_arg_amount); if (unlikely((__pyx_v_amount == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/_seekbzip2.pyx":164 + * cdef int totalcount + * cdef int status + * totalcount = 0 # <<<<<<<<<<<<<< + * # If already at EOF return None + * if self.at_eof: + */ + __pyx_v_totalcount = 0; + + /* "bx/misc/_seekbzip2.pyx":166 + * totalcount = 0 + * # If already at EOF return None + * if self.at_eof: # <<<<<<<<<<<<<< + * return None + * # Create a new python string large enough to hold the result + */ + if (((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof) { + + /* "bx/misc/_seekbzip2.pyx":167 + * # If already at EOF return None + * if self.at_eof: + * return None # <<<<<<<<<<<<<< + * # Create a new python string large enough to hold the result + * rval = PyString_FromStringAndSize( NULL, amount ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "bx/misc/_seekbzip2.pyx":169 + * return None + * # Create a new python string large enough to hold the result + * rval = PyString_FromStringAndSize( NULL, amount ) # <<<<<<<<<<<<<< + * p_rval = PyString_AsString( rval ) + * # Read into it + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, __pyx_v_amount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":170 + * # Create a new python string large enough to hold the result + * rval = PyString_FromStringAndSize( NULL, amount ) + * p_rval = PyString_AsString( rval ) # <<<<<<<<<<<<<< + * # Read into it + * ## sys.stderr.write( "read called, bd.current: %x\n" % self.bd.writeCurrent ); sys.stderr.flush() + */ + __pyx_v_p_rval = PyString_AsString(__pyx_v_rval); + + /* "bx/misc/_seekbzip2.pyx":173 + * # Read into it + * ## sys.stderr.write( "read called, bd.current: %x\n" % self.bd.writeCurrent ); sys.stderr.flush() + * while amount > 0: # <<<<<<<<<<<<<< + * gotcount = read_bunzip( self.bd, p_rval, amount ); + * if gotcount < 0: + */ + while (1) { + __pyx_t_2 = (__pyx_v_amount > 0); + if (!__pyx_t_2) break; + + /* "bx/misc/_seekbzip2.pyx":174 + * ## sys.stderr.write( "read called, bd.current: %x\n" % self.bd.writeCurrent ); sys.stderr.flush() + * while amount > 0: + * gotcount = read_bunzip( self.bd, p_rval, amount ); # <<<<<<<<<<<<<< + * if gotcount < 0: + * raise Exception( "read_bunzip error %d" % gotcount ) + */ + __pyx_v_gotcount = read_bunzip(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd, __pyx_v_p_rval, __pyx_v_amount); + + /* "bx/misc/_seekbzip2.pyx":175 + * while amount > 0: + * gotcount = read_bunzip( self.bd, p_rval, amount ); + * if gotcount < 0: # <<<<<<<<<<<<<< + * raise Exception( "read_bunzip error %d" % gotcount ) + * elif gotcount == 0: + */ + __pyx_t_2 = (__pyx_v_gotcount < 0); + if (__pyx_t_2) { + + /* "bx/misc/_seekbzip2.pyx":176 + * gotcount = read_bunzip( self.bd, p_rval, amount ); + * if gotcount < 0: + * raise Exception( "read_bunzip error %d" % gotcount ) # <<<<<<<<<<<<<< + * elif gotcount == 0: + * status = get_next_block( self.bd ) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_gotcount); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + + /* "bx/misc/_seekbzip2.pyx":177 + * if gotcount < 0: + * raise Exception( "read_bunzip error %d" % gotcount ) + * elif gotcount == 0: # <<<<<<<<<<<<<< + * status = get_next_block( self.bd ) + * if status == -1: + */ + __pyx_t_2 = (__pyx_v_gotcount == 0); + if (__pyx_t_2) { + + /* "bx/misc/_seekbzip2.pyx":178 + * raise Exception( "read_bunzip error %d" % gotcount ) + * elif gotcount == 0: + * status = get_next_block( self.bd ) # <<<<<<<<<<<<<< + * if status == -1: + * self.at_eof = 1 + */ + __pyx_v_status = get_next_block(((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd); + + /* "bx/misc/_seekbzip2.pyx":179 + * elif gotcount == 0: + * status = get_next_block( self.bd ) + * if status == -1: # <<<<<<<<<<<<<< + * self.at_eof = 1 + * break + */ + __pyx_t_2 = (__pyx_v_status == -1); + if (__pyx_t_2) { + + /* "bx/misc/_seekbzip2.pyx":180 + * status = get_next_block( self.bd ) + * if status == -1: + * self.at_eof = 1 # <<<<<<<<<<<<<< + * break + * self.bd.writeCRC = 0xffffffff + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->at_eof = 1; + + /* "bx/misc/_seekbzip2.pyx":181 + * if status == -1: + * self.at_eof = 1 + * break # <<<<<<<<<<<<<< + * self.bd.writeCRC = 0xffffffff + * self.bd.writeCopies = 0 + */ + goto __pyx_L7_break; + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/misc/_seekbzip2.pyx":182 + * self.at_eof = 1 + * break + * self.bd.writeCRC = 0xffffffff # <<<<<<<<<<<<<< + * self.bd.writeCopies = 0 + * else: + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->writeCRC = 0xffffffff; + + /* "bx/misc/_seekbzip2.pyx":183 + * break + * self.bd.writeCRC = 0xffffffff + * self.bd.writeCopies = 0 # <<<<<<<<<<<<<< + * else: + * totalcount = totalcount + gotcount + */ + ((struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2 *)__pyx_v_self)->bd->writeCopies = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "bx/misc/_seekbzip2.pyx":185 + * self.bd.writeCopies = 0 + * else: + * totalcount = totalcount + gotcount # <<<<<<<<<<<<<< + * amount = amount - gotcount + * p_rval = p_rval + gotcount + */ + __pyx_v_totalcount = (__pyx_v_totalcount + __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":186 + * else: + * totalcount = totalcount + gotcount + * amount = amount - gotcount # <<<<<<<<<<<<<< + * p_rval = p_rval + gotcount + * # Return whatever we read + */ + __pyx_v_amount = (__pyx_v_amount - __pyx_v_gotcount); + + /* "bx/misc/_seekbzip2.pyx":187 + * totalcount = totalcount + gotcount + * amount = amount - gotcount + * p_rval = p_rval + gotcount # <<<<<<<<<<<<<< + * # Return whatever we read + * return rval[:totalcount] + */ + __pyx_v_p_rval = (__pyx_v_p_rval + __pyx_v_gotcount); + } + __pyx_L8:; + } + __pyx_L7_break:; + + /* "bx/misc/_seekbzip2.pyx":189 + * p_rval = p_rval + gotcount + * # Return whatever we read + * return rval[:totalcount] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_rval, 0, __pyx_v_totalcount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("bx.misc._seekbzip2.SeekBzip2.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_4misc_10_seekbzip2_SeekBzip2(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_2bx_4misc_10_seekbzip2_SeekBzip2(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_2bx_4misc_10_seekbzip2_SeekBzip2[] = { + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_1close, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_2seek, METH_O, __Pyx_DOCSTR(__pyx_doc_2bx_4misc_10_seekbzip2_9SeekBzip2_2seek)}, + {__Pyx_NAMESTR("readline"), (PyCFunction)__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_3readline, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2_4read, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SeekBzip2 = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SeekBzip2 = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SeekBzip2 = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SeekBzip2 = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_4misc_10_seekbzip2_SeekBzip2 = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.misc._seekbzip2.SeekBzip2"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_4misc_10_seekbzip2_SeekBzip2), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_4misc_10_seekbzip2_SeekBzip2, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SeekBzip2, /*tp_as_number*/ + &__pyx_tp_as_sequence_SeekBzip2, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SeekBzip2, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SeekBzip2, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_4misc_10_seekbzip2_SeekBzip2, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_4misc_10_seekbzip2_9SeekBzip2___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_4misc_10_seekbzip2_SeekBzip2, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_seekbzip2"), + __Pyx_DOCSTR(__pyx_k_5), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1}, + {&__pyx_n_s__O_RDONLY, __pyx_k__O_RDONLY, sizeof(__pyx_k__O_RDONLY), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, + {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/misc/_seekbzip2.pyx":71 + * # Seek the underlying file descriptor + * if ( lseek( self.file_fd, n_byte, 0 ) != n_byte ): + * raise Exception( "lseek of underlying file failed" ) # <<<<<<<<<<<<<< + * # Init the buffer at the right bit position + * self.bd.inbufBitCount = self.bd.inbufPos = self.bd.inbufCount = 0 + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_seekbzip2(void); /*proto*/ +PyMODINIT_FUNC init_seekbzip2(void) +#else +PyMODINIT_FUNC PyInit__seekbzip2(void); /*proto*/ +PyMODINIT_FUNC PyInit__seekbzip2(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__seekbzip2(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_seekbzip2"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_5), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__misc___seekbzip2) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_4misc_10_seekbzip2_SeekBzip2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SeekBzip2", (PyObject *)&__pyx_type_2bx_4misc_10_seekbzip2_SeekBzip2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_4misc_10_seekbzip2_SeekBzip2 = &__pyx_type_2bx_4misc_10_seekbzip2_SeekBzip2; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/misc/_seekbzip2.pyx":35 + * void free( void *ptr ) + * + * import sys # <<<<<<<<<<<<<< + * import os + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":36 + * + * import sys + * import os # <<<<<<<<<<<<<< + * + * cdef class SeekBzip2: + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/misc/_seekbzip2.pyx":1 + * """ # <<<<<<<<<<<<<< + * Pyrex/C extension supporting `bx.misc.seekbzip2` (wrapping the low level + * functions in `micro-bunzip.c`). + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.misc._seekbzip2", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.misc._seekbzip2"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.pyx b/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.pyx new file mode 100755 index 0000000..0862934 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/_seekbzip2.pyx @@ -0,0 +1,191 @@ +""" +Pyrex/C extension supporting `bx.misc.seekbzip2` (wrapping the low level +functions in `micro-bunzip.c`). +""" + +cdef extern from "Python.h": + char * PyString_AsString( object ) + object PyString_FromStringAndSize( char *, int ) + +cdef extern from "micro-bunzip.h": + ctypedef struct bunzip_data: + int in_fd + int inbufBitCount + int inbufPos + int inbufCount + int writeCount + unsigned int writeCRC + int writeCurrent + int writeCopies + unsigned int * dbuf + unsigned int get_bits(bunzip_data *bd, char bits_wanted) + int get_next_block( bunzip_data *bd ) + int read_bunzip(bunzip_data *bd, char *outbuf, int len) + int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len) + int read_bunzip_to_char(bunzip_data *bd, char *outbuf, int len, int* gotcount_out, char stopchar ) + +cdef extern from "unistd.h": + # Not really + ctypedef unsigned long long off_t + off_t lseek( int fildes, off_t offset, int whence ) + +cdef extern from "stdlib.h": + void free( void *ptr ) + +import sys +import os + +cdef class SeekBzip2: + + cdef bunzip_data * bd + cdef int file_fd + cdef int at_eof + + def __init__( self, filename ): + self.at_eof = 0 + self.file_fd = os.open( filename, os.O_RDONLY ) + # Initialize bunzip_data from the file + start_bunzip( &( self.bd ), self.file_fd, NULL, 0 ) + + def close( self ): + free( self.bd.dbuf ) + free( self.bd ) + os.close( self.file_fd ) + + def seek( self, unsigned long long position ): + """ + Seek the bunzip_data to a specific chunk (position must correspond to + that start of a compressed data block). + """ + cdef off_t n_byte + cdef int n_bit + # Break position into bit and byte offsets + ## sys.stderr.write( "arg pos: %d\n" % position ) + n_byte = position / 8; + n_bit = position % 8; + ## sys.stderr.write( "byte pos: %d\n" % n_byte ) + ## sys.stderr.write( "bit pos: %d\n" % n_bit ) + ## sys.stderr.flush() + # Seek the underlying file descriptor + if ( lseek( self.file_fd, n_byte, 0 ) != n_byte ): + raise Exception( "lseek of underlying file failed" ) + # Init the buffer at the right bit position + self.bd.inbufBitCount = self.bd.inbufPos = self.bd.inbufCount = 0 + get_bits( self.bd, n_bit ) + # This ensures that the next read call will return 0, causing the + # buffer to be re-initialized + self.bd.writeCount = -1 + # Reset EOF tracking + self.at_eof = 0 + + def readline( self, int amount ): + cdef object rval + cdef char * p_rval + cdef int gotcount + cdef int totalcount + cdef int status + cdef int spaceleft + cdef int desired + gotcount = 0 + totalcount = 0 + # If already at EOF return None + if self.at_eof: + return None + chunks = [] + # We have great difficulty resizing buffers, so we'll just create + # one 8k string at a time + rval = PyString_FromStringAndSize( NULL, 8192 ) + p_rval = PyString_AsString( rval ) + spaceleft = 8192 + while amount != 0: + if amount > 0 and amount < spaceleft: + desired = amount + else: + desired = spaceleft + ## sys.stderr.write( "readline, amount: %d\n" % amount ) + ## sys.stderr.write( "buffer: %r" % rval[:100] ) + ## sys.stderr.write( "\n" ) + ## sys.stderr.flush() + # ord( "\n" ) = 10 + status = read_bunzip_to_char( self.bd, p_rval, desired, &gotcount, 10 ); + ## sys.stderr.write( "readline, desired: %d, gotcount: %d\n" % ( desired, gotcount ) ); + ## sys.stderr.write( "buffer: %r" % rval[:100] ) + ## sys.stderr.write( "\n" ) + ## sys.stderr.flush() + if status == -9: + ## sys.stderr.write( "readline, STOP_CHAR\n" ); sys.stderr.flush() + # Reached the stop character (RETVAL_STOPCHAR == -9), so + # we can stop + chunks.append( rval[:8192-spaceleft+gotcount] ) + break + elif status == -10: + ## sys.stderr.write( "readline, BUFFER_FULL\n" ); sys.stderr.flush() + # Filled the buffer (RETVAL_BUFFER_FULL == -10), so create + # new buffer and keep going + chunks.append( rval ) + amount = amount - gotcount + if amount == 0: + # Got the desired amount + break + rval = PyString_FromStringAndSize( NULL, 8192 ) + p_rval = PyString_AsString( rval ) + spaceleft = 8192 + elif status == -8: + ## sys.stderr.write( "readline, END_OF_BLOCK\n" ); sys.stderr.flush() + # No more data in the decomp buffer (RETVAL_END_OF_BLOCK == -10) + if gotcount and p_rval[ gotcount - 1 ] == 10: + chunks.append( rval[:8192-spaceleft+gotcount] ) + break + # Update buffer info + p_rval = p_rval + gotcount + spaceleft = spaceleft - gotcount + amount = amount - gotcount + # Get the next block + status = get_next_block( self.bd ) + if status == -1: + # Block is end of stream block (RETVAL_LAST_BLOCK == -1) + self.at_eof = 1 + chunks.append( rval[:gotcount] ) + break + self.bd.writeCRC = 0xffffffff + self.bd.writeCopies = 0 + else: + # Some other status + raise Exception( "read_bunzip error %d" % status ) + # Return whatever we read + return "".join( chunks ) + + def read( self, int amount ): + cdef object rval + cdef char * p_rval + cdef int gotcount + cdef int totalcount + cdef int status + totalcount = 0 + # If already at EOF return None + if self.at_eof: + return None + # Create a new python string large enough to hold the result + rval = PyString_FromStringAndSize( NULL, amount ) + p_rval = PyString_AsString( rval ) + # Read into it + ## sys.stderr.write( "read called, bd.current: %x\n" % self.bd.writeCurrent ); sys.stderr.flush() + while amount > 0: + gotcount = read_bunzip( self.bd, p_rval, amount ); + if gotcount < 0: + raise Exception( "read_bunzip error %d" % gotcount ) + elif gotcount == 0: + status = get_next_block( self.bd ) + if status == -1: + self.at_eof = 1 + break + self.bd.writeCRC = 0xffffffff + self.bd.writeCopies = 0 + else: + totalcount = totalcount + gotcount + amount = amount - gotcount + p_rval = p_rval + gotcount + # Return whatever we read + return rval[:totalcount] + + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.c b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.c new file mode 100755 index 0000000..85404e7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.c @@ -0,0 +1,2095 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__misc__bgzf +#define __PYX_HAVE_API__bx__misc__bgzf +#include "bgzf.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "bgzf.pyx", +}; + +/* "bx/misc/bgzf.pyx":6 + * """ + * + * ctypedef unsigned long long int64_t # <<<<<<<<<<<<<< + * + * cdef extern from "Python.h": + */ +typedef unsigned PY_LONG_LONG __pyx_t_2bx_4misc_4bgzf_int64_t; + +/*--- Type declarations ---*/ +struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile; + +/* "bx/misc/bgzf.pyx":20 + * int64_t bgzf_seek( BGZF * fp, int64_t pos, int where ) + * + * cdef class BGZFFile( object ): # <<<<<<<<<<<<<< + * cdef BGZF * bgzf + * def __init__( self, path, mode="r" ): + */ +struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile { + PyObject_HEAD + BGZF *bgzf; +}; + + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.misc.bgzf' */ +static PyTypeObject *__pyx_ptype_2bx_4misc_4bgzf_BGZFFile = 0; +#define __Pyx_MODULE_NAME "bx.misc.bgzf" +int __pyx_module_is_main_bx__misc__bgzf = 0; + +/* Implementation of 'bx.misc.bgzf' */ +static PyObject *__pyx_builtin_IOError; +static char __pyx_k_1[] = "Could not open file"; +static char __pyx_k_3[] = "\nSeekable access to BGZ files based on samtools code. Does not yet implement\ncomplete file-like interface.\n"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__pos[] = "pos"; +static char __pyx_k__mode[] = "mode"; +static char __pyx_k__path[] = "path"; +static char __pyx_k__where[] = "where"; +static char __pyx_k__IOError[] = "IOError"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s__IOError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__mode; +static PyObject *__pyx_n_s__path; +static PyObject *__pyx_n_s__pos; +static PyObject *__pyx_n_s__r; +static PyObject *__pyx_n_s__where; +static PyObject *__pyx_k_tuple_2; + +/* "bx/misc/bgzf.pyx":22 + * cdef class BGZFFile( object ): + * cdef BGZF * bgzf + * def __init__( self, path, mode="r" ): # <<<<<<<<<<<<<< + * self.bgzf = bgzf_open( path, mode ) + * if not self.bgzf: + */ + +static int __pyx_pf_2bx_4misc_4bgzf_8BGZFFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_2bx_4misc_4bgzf_8BGZFFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_path = 0; + PyObject *__pyx_v_mode = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__path,&__pyx_n_s__mode,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_n_s__r); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__path); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_path = values[0]; + __pyx_v_mode = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/bgzf.pyx":23 + * cdef BGZF * bgzf + * def __init__( self, path, mode="r" ): + * self.bgzf = bgzf_open( path, mode ) # <<<<<<<<<<<<<< + * if not self.bgzf: + * raise IOError( "Could not open file" ) + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_path); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf = bgzf_open(__pyx_t_1, __pyx_t_2); + + /* "bx/misc/bgzf.pyx":24 + * def __init__( self, path, mode="r" ): + * self.bgzf = bgzf_open( path, mode ) + * if not self.bgzf: # <<<<<<<<<<<<<< + * raise IOError( "Could not open file" ) + * def close( self ): + */ + __pyx_t_3 = (!(((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf != 0)); + if (__pyx_t_3) { + + /* "bx/misc/bgzf.pyx":25 + * self.bgzf = bgzf_open( path, mode ) + * if not self.bgzf: + * raise IOError( "Could not open file" ) # <<<<<<<<<<<<<< + * def close( self ): + * if self.bgzf: + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/bgzf.pyx":26 + * if not self.bgzf: + * raise IOError( "Could not open file" ) + * def close( self ): # <<<<<<<<<<<<<< + * if self.bgzf: + * bgzf_close( self.bgzf ) + */ + +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_1close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("close"); + + /* "bx/misc/bgzf.pyx":27 + * raise IOError( "Could not open file" ) + * def close( self ): + * if self.bgzf: # <<<<<<<<<<<<<< + * bgzf_close( self.bgzf ) + * def read( self, int length ): + */ + __pyx_t_1 = (((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf != 0); + if (__pyx_t_1) { + + /* "bx/misc/bgzf.pyx":28 + * def close( self ): + * if self.bgzf: + * bgzf_close( self.bgzf ) # <<<<<<<<<<<<<< + * def read( self, int length ): + * cdef object rval = PyString_FromStringAndSize( NULL, length ) + */ + bgzf_close(((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf); + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/bgzf.pyx":29 + * if self.bgzf: + * bgzf_close( self.bgzf ) + * def read( self, int length ): # <<<<<<<<<<<<<< + * cdef object rval = PyString_FromStringAndSize( NULL, length ) + * bgzf_read( self.bgzf, PyString_AsString( rval ), length ) + */ + +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_2read(PyObject *__pyx_v_self, PyObject *__pyx_arg_length); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_2read(PyObject *__pyx_v_self, PyObject *__pyx_arg_length) { + int __pyx_v_length; + PyObject *__pyx_v_rval = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read"); + assert(__pyx_arg_length); { + __pyx_v_length = __Pyx_PyInt_AsInt(__pyx_arg_length); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/bgzf.pyx":30 + * bgzf_close( self.bgzf ) + * def read( self, int length ): + * cdef object rval = PyString_FromStringAndSize( NULL, length ) # <<<<<<<<<<<<<< + * bgzf_read( self.bgzf, PyString_AsString( rval ), length ) + * return rval + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, __pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/misc/bgzf.pyx":31 + * def read( self, int length ): + * cdef object rval = PyString_FromStringAndSize( NULL, length ) + * bgzf_read( self.bgzf, PyString_AsString( rval ), length ) # <<<<<<<<<<<<<< + * return rval + * def tell( self ): + */ + bgzf_read(((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf, PyString_AsString(__pyx_v_rval), __pyx_v_length); + + /* "bx/misc/bgzf.pyx":32 + * cdef object rval = PyString_FromStringAndSize( NULL, length ) + * bgzf_read( self.bgzf, PyString_AsString( rval ), length ) + * return rval # <<<<<<<<<<<<<< + * def tell( self ): + * return bgzf_tell( self.bgzf ) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/bgzf.pyx":33 + * bgzf_read( self.bgzf, PyString_AsString( rval ), length ) + * return rval + * def tell( self ): # <<<<<<<<<<<<<< + * return bgzf_tell( self.bgzf ) + * def seek( self, int64_t pos, int where=0 ): + */ + +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_3tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_3tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("tell"); + + /* "bx/misc/bgzf.pyx":34 + * return rval + * def tell( self ): + * return bgzf_tell( self.bgzf ) # <<<<<<<<<<<<<< + * def seek( self, int64_t pos, int where=0 ): + * return bgzf_seek( self.bgzf, pos, where ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLongLong(bgzf_tell(((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/misc/bgzf.pyx":35 + * def tell( self ): + * return bgzf_tell( self.bgzf ) + * def seek( self, int64_t pos, int where=0 ): # <<<<<<<<<<<<<< + * return bgzf_seek( self.bgzf, pos, where ) + */ + +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_4seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_4seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_2bx_4misc_4bgzf_int64_t __pyx_v_pos; + int __pyx_v_where; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pos,&__pyx_n_s__where,0}; + __Pyx_RefNannySetupContext("seek"); + { + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__where); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_pos = __Pyx_PyInt_AsUnsignedLongLong(values[0]); if (unlikely((__pyx_v_pos == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_where = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/misc/bgzf.pyx":36 + * return bgzf_tell( self.bgzf ) + * def seek( self, int64_t pos, int where=0 ): + * return bgzf_seek( self.bgzf, pos, where ) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyLong_FromUnsignedLongLong(bgzf_seek(((struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile *)__pyx_v_self)->bgzf, __pyx_v_pos, __pyx_v_where)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.misc.bgzf.BGZFFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_2bx_4misc_4bgzf_BGZFFile(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_2bx_4misc_4bgzf_BGZFFile(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_2bx_4misc_4bgzf_BGZFFile[] = { + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_1close, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_2read, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_3tell, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_2bx_4misc_4bgzf_8BGZFFile_4seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BGZFFile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BGZFFile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BGZFFile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BGZFFile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_2bx_4misc_4bgzf_BGZFFile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("bx.misc.bgzf.BGZFFile"), /*tp_name*/ + sizeof(struct __pyx_obj_2bx_4misc_4bgzf_BGZFFile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_2bx_4misc_4bgzf_BGZFFile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BGZFFile, /*tp_as_number*/ + &__pyx_tp_as_sequence_BGZFFile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BGZFFile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BGZFFile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_2bx_4misc_4bgzf_BGZFFile, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_2bx_4misc_4bgzf_8BGZFFile___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_2bx_4misc_4bgzf_BGZFFile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("bgzf"), + __Pyx_DOCSTR(__pyx_k_3), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, + {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, + {&__pyx_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "bx/misc/bgzf.pyx":25 + * self.bgzf = bgzf_open( path, mode ) + * if not self.bgzf: + * raise IOError( "Could not open file" ) # <<<<<<<<<<<<<< + * def close( self ): + * if self.bgzf: + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initbgzf(void); /*proto*/ +PyMODINIT_FUNC initbgzf(void) +#else +PyMODINIT_FUNC PyInit_bgzf(void); /*proto*/ +PyMODINIT_FUNC PyInit_bgzf(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_bgzf(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("bgzf"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_3), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__misc__bgzf) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_2bx_4misc_4bgzf_BGZFFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BGZFFile", (PyObject *)&__pyx_type_2bx_4misc_4bgzf_BGZFFile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_2bx_4misc_4bgzf_BGZFFile = &__pyx_type_2bx_4misc_4bgzf_BGZFFile; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/misc/bgzf.pyx":1 + * """ # <<<<<<<<<<<<<< + * Seekable access to BGZ files based on samtools code. Does not yet implement + * complete file-like interface. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.misc.bgzf", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.misc.bgzf"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.pyx b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.pyx new file mode 100755 index 0000000..003a948 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf.pyx @@ -0,0 +1,36 @@ +""" +Seekable access to BGZ files based on samtools code. Does not yet implement +complete file-like interface. +""" + +ctypedef unsigned long long int64_t + +cdef extern from "Python.h": + char * PyString_AsString( object ) + object PyString_FromStringAndSize( char *, int ) + +cdef extern from "bgzf.h": + ctypedef struct BGZF + BGZF * bgzf_open( char * path, char * mode ) + int bgzf_close( BGZF * fp ) + int bgzf_read( BGZF * fp, void * data, int length ) + int64_t bgzf_tell( BGZF * fp ) + int64_t bgzf_seek( BGZF * fp, int64_t pos, int where ) + +cdef class BGZFFile( object ): + cdef BGZF * bgzf + def __init__( self, path, mode="r" ): + self.bgzf = bgzf_open( path, mode ) + if not self.bgzf: + raise IOError( "Could not open file" ) + def close( self ): + if self.bgzf: + bgzf_close( self.bgzf ) + def read( self, int length ): + cdef object rval = PyString_FromStringAndSize( NULL, length ) + bgzf_read( self.bgzf, PyString_AsString( rval ), length ) + return rval + def tell( self ): + return bgzf_tell( self.bgzf ) + def seek( self, int64_t pos, int where=0 ): + return bgzf_seek( self.bgzf, pos, where ) \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf_tests.py new file mode 100755 index 0000000..b4c5bfe --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/bgzf_tests.py @@ -0,0 +1,7 @@ +import bx.misc.bgzf + +def test_bgzf(): + f = bx.misc.bgzf.BGZFFile( "test_data/bgzf_tests/test.txt.gz" ) + assert f.read( 10 ) == "begin 644 " + print f.seek( 0 ) + assert f.read( 10 ) == "begin 644 " \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/binary_file.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/binary_file.py new file mode 100755 index 0000000..b6649da --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/binary_file.py @@ -0,0 +1,169 @@ +""" +Wrappers for doing binary IO on file-like objects +""" + +import numpy +import struct +import sys + +## Standard size: +## short is 8 bits +## int and long are 32 bits +## long long is 64 bits + +class BadMagicNumber( IOError ): + pass + +class BinaryFileReader( object ): + """ + Wrapper for doing binary reads on any file like object. + + Currently this is not heavily optimized (it uses the `struct` module to + unpack) + """ + def __init__( self, file, magic = None, is_little_endian = False ): + self.is_little_endian = is_little_endian + self.file = file + if magic is not None: + # Attempt to read magic number and chuck endianess + bytes = file.read( 4 ) + if struct.unpack( ">I", bytes )[0] == magic: + pass + elif struct.unpack( "I", bytes )[0], struct.unpack( "> 8 ) + for i in range( subtable_size ): + offset = subtable_offset + ( ( start + i ) % subtable_size ) * 8 + self.io.seek( offset ) + h = self.io.read_uint32() + p = self.io.read_uint32() + # Hit an empty bin, no match for key + if p == 0: + raise KeyError + # Hash matches, need to check full key + if h == hash: + self.io.seek( p ) + klen = self.io.read_uint32() + vlen = self.io.read_uint32() + k = self.io.read( klen ) + if k == key: + v = self.io.read( vlen ) + return v + else: + # Visited every slot and no match (should never happen since + # there are empty slots by contruction) + raise KeyError + + @classmethod + def to_file( Class, dict, file, is_little_endian=True ): + """ + For constructing a CDB structure in a file. Able to calculate size on + disk and write to a file + """ + io = BinaryFileWriter( file, is_little_endian=is_little_endian ) + start_offset = io.tell() + # Header is of fixed length + io.seek( start_offset + ( 8 * 256 ) ) + # For each item, key and value length (written as length prefixed + # strings). We also calculate the subtables on this pass. + # NOTE: This requires the key and value be byte strings, support for + # dealing with encoding specific value types should be + # added to this wrapper + subtables = [ [] for i in range(256) ] + for key, value in dict.iteritems(): + pair_offset = io.tell() + io.write_uint32( len( key ) ) + io.write_uint32( len( value ) ) + io.write( key ) + io.write( value ) + hash = cdbhash( key ) + subtables[ hash % 256 ].append( ( hash, pair_offset ) ) + # Save the offset where the subtables will start + subtable_offset = io.tell() + # Write subtables + for subtable in subtables: + if len( subtable ) > 0: + # Construct hashtable to be twice the size of the number + # of items in the subtable, and built it in memory + ncells = len( subtable ) * 2 + cells = [ (0,0) for i in range( ncells ) ] + for hash, pair_offset in subtable: + index = ( hash >> 8 ) % ncells + while cells[index][1] != 0: + index = ( index + 1 ) % ncells + # Guaranteed to find a non-empty cell + cells[index] = ( hash, pair_offset ) + # Write subtable + for hash, pair_offset in cells: + io.write_uint32( hash ) + io.write_uint32( pair_offset ) + # Go back and write the header + end_offset = io.tell() + io.seek( start_offset ) + index = subtable_offset + for subtable in subtables: + io.write_uint32( index ) + io.write_uint32( len( subtable * 2 ) ) + # For each cell in the subtable, a hash and a pointer to a value + index += ( len( subtable ) * 2 ) * 8 + # Leave fp at end of cdb + io.seek( end_offset ) \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/cdb_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/cdb_tests.py new file mode 100755 index 0000000..0fb5d1c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/cdb_tests.py @@ -0,0 +1,34 @@ +from bx.misc.cdb import * +from tempfile import NamedTemporaryFile + +def test(): + + d = {} + for i in range( 10000 ): + d[ 'foo' + str( i ) ] = 'bar' + str( i ) + + # Open temporary file and get name + file = NamedTemporaryFile() + file_name = file.name + + # Write cdb to file + FileCDBDict.to_file( d, file ) + file.flush() + + # Open on disk + file2 = open( file_name ) + cdb = FileCDBDict( file2 ) + + for key, value in d.iteritems(): + assert cdb[key] == value + + try: + cdb['notin'] + assert False, "KeyError was not raised" + except KeyError, e: + pass + + # Close everything (deletes the temporary file) + file2.close() + file.close() + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache.py new file mode 100755 index 0000000..f4c0b71 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache.py @@ -0,0 +1,105 @@ +from __future__ import division + +import sys +from bx_extras.lrucache import LRUCache +from cStringIO import StringIO + +DEFAULT_CACHE_SIZE=10 +DEFAULT_BLOCK_SIZE=1024*1024*2 + +class FileCache( object ): + """ + Wrapper for a file that cache blocks of data in memory. + + **NOTE:** this is currently an incomplete file-like object, it only + supports seek, tell, and readline (plus iteration). Reading bytes is + currently not implemented. + """ + def __init__( self, file, size, cache_size=DEFAULT_CACHE_SIZE, + block_size=DEFAULT_BLOCK_SIZE ): + """ + Create a new `FileCache` wrapping the file-like object `file` that + has total size `size` and caching blocks of size `block_size`. + """ + self.file = file + self.size = size + self.cache_size = cache_size + self.block_size = block_size + # Setup the cache + self.nblocks = ( self.size // self.block_size ) + 1 + self.cache = LRUCache( self.cache_size ) + # Position in file + self.dirty = True + self.at_eof = False + self.file_pos = 0 + self.current_block_index = -1 + self.current_block = None + def fix_dirty( self ): + chunk, offset = self.get_block_and_offset( self.file_pos ) + if self.current_block_index != chunk: + self.current_block = StringIO( self.load_block( chunk ) ) + self.current_block.read( offset ) + self.current_block_index = chunk + else: + self.current_block.seek( offset ) + self.dirty = False + def get_block_and_offset( self, index ): + return int( index // self.block_size ), int( index % self.block_size ) + def load_block( self, index ): + if index in self.cache: + return self.cache[index] + else: + real_offset = index * self.block_size + self.file.seek( real_offset ) + block = self.file.read( self.block_size ) + self.cache[index] = block + return block + def seek( self, offset, whence=0 ): + """ + Move the file pointer to a particular offset. + """ + # Determine absolute target position + if whence == 0: + target_pos = offset + elif whence == 1: + target_pos = self.file_pos + offset + elif whence == 2: + target_pos = self.size - offset + else: + raise Exception( "Invalid `whence` argument: %r", whence ) + # Check if this is a noop + if target_pos == self.file_pos: + return + # Verify it is valid + assert 0 <= target_pos < self.size, "Attempt to seek outside file" + # Move the position + self.file_pos = target_pos + # Mark as dirty, the next time a read is done we need to actually + # move the position in the bzip2 file + self.dirty = True + def readline( self ): + if self.dirty: + self.fix_dirty() + if self.at_eof: + return "" + rval = [] + while 1: + line = self.current_block.readline() + rval.append( line ) + if len( line ) > 0 and line[-1] == '\n': + break + elif self.current_block_index == self.nblocks - 1: + self.at_eof = True + break + else: + self.current_block_index += 1 + self.current_block = StringIO( self.load_block( self.current_block_index ) ) + return "".join( rval ) + def next( self ): + line = self.readline() + if line == "": + raise StopIteration + def __iter__( self ): + return self + def close( self ): + self.file.close() \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache_tests.py new file mode 100755 index 0000000..b8ab1db --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/filecache_tests.py @@ -0,0 +1,30 @@ +import filecache +import os +import random +import sys + +""" +T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" + +def test(): + s = os.stat( T ).st_size + real_f = open( T ) + f = filecache.FileCache( real_f, s ) + for i in range( 1000 ): + f.readline() + +def test_random_seeking(): + s = os.stat( T ).st_size + raw = open( T ) + f = filecache.FileCache( open( T ), s ) + for i in range( 10000 ): + seek_to = random.randrange( s ) + + f.seek( seek_to ) + raw.seek( seek_to ) + + l1 = f.readline() + l2 = raw.readline() + + assert l1 == l2 +""" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/readlengths.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/readlengths.py new file mode 100755 index 0000000..23adff8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/readlengths.py @@ -0,0 +1,29 @@ +""" +Read sequence lengths from a file. Each line is of the form +where is typically a chromsome name (e.g. chr12) and length is the +number of bases the sequence. +""" + +def read_lengths_file( name ): + """ + Returns a hash from sequence name to length. + """ + + chrom_to_length = {} + f = file ( name, "rt" ) + for line in f: + line = line.strip() + if line == '' or line[0] == '#': continue + try: + fields = line.split() + if len(fields) != 2: raise + chrom = fields[0] + length = int( fields[1] ) + except: + raise "bad length file line: %s" % line + if chrom in chrom_to_length and length != chrom_to_length[chrom]: + raise "%s has more than one length!" % chrom + chrom_to_length[chrom] = length + f.close() + return chrom_to_length + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2.py new file mode 100755 index 0000000..dcd28e3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2.py @@ -0,0 +1,148 @@ +""" +Semi-random access to bz2 compressed data. +""" + +import os +import bisect +import sys + +from _seekbzip2 import SeekBzip2 + +class SeekableBzip2File( object ): + """ + Filelike object supporting read-only semi-random access to bz2 compressed + files for which an offset table (bz2t) has been generated by `bzip-table`. + """ + + def __init__( self, filename, table_filename, **kwargs ): + self.filename = filename + self.table_filename = table_filename + self.init_table() + self.init_bz2() + self.pos = 0 + self.dirty = True + + def init_bz2( self ): + self.seek_bz2 = SeekBzip2( self.filename ) + + def init_table( self ): + # Position in plaintext file + self.table_positions = [] + # Position of corresponding block in bz2 file (bits) + self.table_bz2positions = [] + pos = 0 + for line in open( self.table_filename ): + fields = line.split() + # Position of the compressed block in the bz2 file + bz2_pos = int( fields[0] ) + # print >> sys.stderr, fields[0], bz2_pos + # Length of the block when uncompressed + length = int( fields[1] ) + self.table_positions.append( pos ) + self.table_bz2positions.append( bz2_pos ) + old_pos = pos + pos = pos + length + assert pos > old_pos + self.size = pos + #print >> sys.stderr, self.size + #print >> sys.stderr, self.table_bz2positions + + def close( self ): + self.seek_bz2.close() + + def fix_dirty( self ): + # Our virtual position in the uncompressed data is out of sync + # FIXME: If we're moving to a later position that is still in + # the same block, we could just read and throw out bytes in the + # compressed stream, less wasteful then backtracking + chunk, offset = self.get_chunk_and_offset( self.pos ) + # Get the seek position for that chunk and seek to it + bz2_seek_pos = self.table_bz2positions[chunk] + # print >>sys.stderr, "bz2 seek pos:", bz2_seek_pos + self.seek_bz2.seek( bz2_seek_pos ) + # Consume bytes to move to the correct position + assert len( self.seek_bz2.read( offset ) ) == offset + # Update state + self.dirty = False + + def read( self, sizehint=-1 ): + if sizehint < 0: + chunks = [] + while 1: + self._read( 1024*1024 ) + if val: + chunks.append( val ) + else: + break + return "".join( chunks ) + else: + return self._read( sizehint ) + + def _read( self, size ): + if self.dirty: self.fix_dirty() + val = self.seek_bz2.read( size ) + if val is None: + # EOF + self.pos = self.size + val = "" + else: + self.pos = self.pos + len( val ) + return val + + def readline( self, size=-1 ): + if self.dirty: self.fix_dirty() + val = self.seek_bz2.readline( size ) + if val is None: + # EOF + self.pos = self.size + val = "" + else: + self.pos = self.pos + len( val ) + return val + + def tell( self ): + return self.pos + + def get_chunk_and_offset( self, position ): + # Find the chunk that position is in using a binary search + chunk = bisect.bisect( self.table_positions, position ) - 1 + offset = position - self.table_positions[chunk] + return chunk, offset + + def seek( self, offset, whence=0 ): + # Determine absolute target position + if whence == 0: + target_pos = offset + elif whence == 1: + target_pos = self.pos + offset + elif whence == 2: + target_pos = self.size - offset + else: + raise Exception( "Invalid `whence` argument: %r", whence ) + # Check if this is a noop + if target_pos == self.pos: + return + # Verify it is valid + assert 0 <= target_pos < self.size, "Attempt to seek outside file" + # Move the position + self.pos = target_pos + # Mark as dirty, the next time a read is done we need to actually + # move the position in the bzip2 file + self.dirty = True + + # ---- File like methods ------------------------------------------------ + + def next(self): + ln = self.readline() + if ln == "": + raise StopIteration() + return ln + + def __iter__(self): + return self + + def readlines(self,sizehint=-1): + return [ln for ln in self] + + def xreadlines(self): + return iter(self) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2_tests.py new file mode 100755 index 0000000..b8386bf --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/seekbzip2_tests.py @@ -0,0 +1,86 @@ +""" +Tests for `bx.misc.seekbzip2`. +""" + +import tempfile +import commands +import os +import random +from itertools import * + +import seekbzip2 +import bz2 + +F=None +T=None + +#F="/Users/james/work/seek-bzip2/test_random.dat.bz2" +#T="/Users/james/cache/hg18/align/multiz28way/chr10.maf.bz2" + +#F=/depot/data1/cache/human/hg18/align/multiz28way/chr1.maf.bz2 + +import sys + +if F and os.path.exists( F ): + + def test_linear_reading(): + raw_data = bz2.BZ2File( F ).read() + f = seekbzip2.SeekableBzip2File( F, F + "t" ) + chunk = 1221 + pos = 0 + for i in range( ( len(raw_data) // chunk ) + 1 ): + a = raw_data[pos:pos+chunk] + b = f.read( chunk ) + assert a == b + pos += chunk + assert f.tell() == min( pos, len(raw_data) ) + f.close() + + def test_random_seeking(): + raw_data = bz2.BZ2File( F ).read() + f = seekbzip2.SeekableBzip2File( F, F + "t" ) + for i in range( 10 ): + seek_to = random.randrange( len( raw_data ) - 100 ) + chunk = random.randrange( 10, 20 ) + + f.seek( seek_to ) + a = f.read( chunk ) + b = raw_data[ seek_to : seek_to + chunk ] + + assert a == b, "'%s' != '%s' on %dth attempt" % ( a.encode("hex"), b.encode("hex"), i ) + + assert f.tell() == min( seek_to + chunk, len(raw_data) ) + f.close() + +if T and os.path.exists( T ): + + def test_text_reading(): + #raw_data = bz2.BZ2File( T ).read() + #raw_lines = raw_data.split( "\n" ) + raw_file = bz2.BZ2File( T ) + f = seekbzip2.SeekableBzip2File( T, T + "t" ) + pos = 0 + for i, ( line, raw_line ) in enumerate( izip( f, raw_file ) ): + assert line == raw_line, "%d: %r != %r" % ( i, line.rstrip( "\n" ), raw_line ) + pos += len( line ) + ftell = f.tell() + assert ftell == pos, "%d != %d" % ( ftell, pos ) + f.close() + + + def test_text_reading_2(): + raw_data = bz2.BZ2File( T ).read() + f = seekbzip2.SeekableBzip2File( T, T + "t" ) + raw_lines = raw_data.split( "\n" ) + pos = 0 + i = 0 + while 1: + line = f.readline() + if line == "": break + assert line.rstrip( "\r\n" ) == raw_lines[i], "%r != %r" % ( line.rstrip( "\r\n" ), raw_lines[i] ) + pos += len( line ) + ftell = f.tell() + assert ftell == pos, "%d != %d" % ( ftell, pos ) + i += 1 + f.close() + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop.py new file mode 100755 index 0000000..0365e9e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop.py @@ -0,0 +1,166 @@ +""" +Semi-random access to bz2 compressed data. +""" + +import os +import bisect +import sys +try: + import pkg_resources + pkg_resources.require( 'python_lzo' ) +except: + pass +import lzo +import struct + +from bx_extras import lrucache +from cStringIO import StringIO + +class SeekableLzopFile( object ): + """ + Filelike object supporting read-only semi-random access to bz2 compressed + files for which an offset table (bz2t) has been generated by `bzip-table`. + """ + + def __init__( self, filename, table_filename, block_cache_size=0, **kwargs ): + self.filename = filename + self.table_filename = table_filename + self.init_table() + self.file = open( self.filename, "r" ) + self.dirty = True + self.at_eof = False + self.file_pos = 0 + self.current_block_index = -1 + self.current_block = None + if block_cache_size > 0: + self.cache = lrucache.LRUCache( block_cache_size ) + else: + self.cache = None + + def init_table( self ): + self.block_size = None + self.block_info = [] + # Position of corresponding block in compressed file (in bytes) + for line in open( self.table_filename ): + fields = line.split() + if fields[0] == "s": + self.block_size = int( fields[1] ) + if fields[0] == "o": + offset = int( fields[1] ) + compressed_size = int( fields[2] ) + size = int( fields[3] ) + self.block_info.append( ( offset, compressed_size, size ) ) + self.nblocks = len( self.block_info ) + + def close( self ): + self.file.close() + + def load_block( self, index ): + if self.cache is not None and index in self.cache: + return self.cache[index] + else: + offset, csize, size = self.block_info[ index ] + # Get the block of compressed data + self.file.seek( offset ) + data = self.file.read( csize ) + # Need to prepend a header for python-lzo module (silly) + data = ''.join( ( '\xf0', struct.pack( "!I", size ), data ) ) + value = lzo.decompress( data ) + if self.cache is not None: + self.cache[index] = value + return value + + def fix_dirty( self ): + chunk, offset = self.get_block_and_offset( self.file_pos ) + if self.current_block_index != chunk: + self.current_block = StringIO( self.load_block( chunk ) ) + self.current_block.read( offset ) + self.current_block_index = chunk + else: + self.current_block.seek( offset ) + self.dirty = False + + def get_block_and_offset( self, index ): + return int( index // self.block_size ), int( index % self.block_size ) + + def seek( self, offset, whence=0 ): + """ + Move the file pointer to a particular offset. + """ + # Determine absolute target position + if whence == 0: + target_pos = offset + elif whence == 1: + target_pos = self.file_pos + offset + elif whence == 2: + raise Exception( "seek from end not supported" ) + ## target_pos = self.size - offset + else: + raise Exception( "Invalid `whence` argument: %r", whence ) + # Check if this is a noop + if target_pos == self.file_pos: + return + # Verify it is valid + ## assert 0 <= target_pos < self.size, "Attempt to seek outside file" + # Move the position + self.file_pos = target_pos + # Mark as dirty, the next time a read is done we need to actually + # move the position in the bzip2 file + self.dirty = True + + def tell( self ): + return self.file_pos + + def readline( self ): + if self.dirty: + self.fix_dirty() + if self.at_eof: + return "" + rval = [] + while 1: + line = self.current_block.readline() + self.file_pos += len( line ) + rval.append( line ) + if len( line ) > 0 and line[-1] == '\n': + break + elif self.current_block_index == self.nblocks - 1: + self.at_eof = True + break + else: + self.current_block_index += 1 + self.current_block = StringIO( self.load_block( self.current_block_index ) ) + return "".join( rval ) + + def next( self ): + line = self.readline() + if line == "": + raise StopIteration + + def __iter__( self ): + return self + +# --- Factor out --- + +MAGIC="\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a" + +F_ADLER32_D = 0x00000001L +F_ADLER32_C = 0x00000002L +F_H_EXTRA_FIELD = 0x00000040L +F_H_GMTDIFF = 0x00000080L +F_CRC32_D = 0x00000100L +F_CRC32_C = 0x00000200L +F_MULTIPART = 0x00000400L +F_H_FILTER = 0x00000800L +F_H_CRC32 = 0x00001000L + +assert struct.calcsize( "!H" ) == 2 +assert struct.calcsize( "!I" ) == 4 + +class UnpackWrapper( object ): + def __init__( self, file ): + self.file = file + def read( self, amt ): + return self.file.read( amt ) + def get( self, fmt ): + t = struct.unpack( fmt, self.file.read( struct.calcsize( fmt ) ) ) + return t[0] diff --git a/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop_tests.py new file mode 100755 index 0000000..3bf7e94 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/misc/seeklzop_tests.py @@ -0,0 +1,30 @@ +import seeklzop +import os +import random +import sys + +""" +T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" +C="/Users/james/cache/hg18/align/multiz28way/chr10.maf.lzo" + +def test(): + f = seeklzop.SeekableLzopFile( C, C + "t", block_cache_size=20 ) + for line in f: + pass + +def test_random_seeking(): + s = os.stat( T ).st_size + raw = open( T ) + f = seeklzop.SeekableLzopFile( C, C + "t", block_cache_size=20 ) + for i in range( 1000 ): + seek_to = random.randrange( s ) + + f.seek( seek_to ) + raw.seek( seek_to ) + + l1 = f.readline() + l2 = raw.readline() + + assert l1 == l2, "%r != %r" % ( l1, l2 ) + assert raw.tell() == f.tell(), "tells not equal" +""" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.c b/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.c new file mode 100755 index 0000000..a69a178 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.c @@ -0,0 +1,1989 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__motif___pwm +#define __PYX_HAVE_API__bx__motif___pwm +#include "numpy/arrayobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_pwm.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'bx.motif._pwm' */ +static PyTypeObject *__pyx_ptype_2bx_5motif_4_pwm_ndarray = 0; +#define __Pyx_MODULE_NAME "bx.motif._pwm" +int __pyx_module_is_main_bx__motif___pwm = 0; + +/* Implementation of 'bx.motif._pwm' */ +static char __pyx_k_1[] = "\nExtensions used by the `pwm` module.\n"; +static char __pyx_k_2[] = "bx.motif._pwm"; +static char __pyx_k_3[] = "score_string_with_gaps"; +static char __pyx_k__rval[] = "rval"; +static char __pyx_k__matrix[] = "matrix"; +static char __pyx_k__string[] = "string"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__score_string[] = "score_string"; +static char __pyx_k__char_to_index[] = "char_to_index"; +static PyObject *__pyx_n_s_2; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__char_to_index; +static PyObject *__pyx_n_s__matrix; +static PyObject *__pyx_n_s__rval; +static PyObject *__pyx_n_s__score_string; +static PyObject *__pyx_n_s__string; + +/* "bx/motif/_pwm.pyx":20 + * ctypedef float npy_float32 + * + * def score_string( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): # <<<<<<<<<<<<<< + * """ + * Score each position in string `string` using the scoring matrix `matrix`. + */ + +static PyObject *__pyx_pf_2bx_5motif_4_pwm_score_string(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_5motif_4_pwm_score_string[] = "\n Score each position in string `string` using the scoring matrix `matrix`.\n Characters in the string are mapped to columns in the matrix by `char_to_index`\n and the score for each position is stored in `rval`.\n \n matrix *must* be a 2d array of type float32\n char_to_index *must* be a 1d array of type int16\n rval *must* be a 1d array of type float32 and the same length as string\n "; +static PyMethodDef __pyx_mdef_2bx_5motif_4_pwm_score_string = {__Pyx_NAMESTR("score_string"), (PyCFunction)__pyx_pf_2bx_5motif_4_pwm_score_string, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_5motif_4_pwm_score_string)}; +static PyObject *__pyx_pf_2bx_5motif_4_pwm_score_string(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_matrix = 0; + PyArrayObject *__pyx_v_char_to_index = 0; + PyObject *__pyx_v_string = 0; + PyArrayObject *__pyx_v_rval = 0; + char *__pyx_v_buffer; + Py_ssize_t __pyx_v_len; + float __pyx_v_score; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_matrix_width; + npy_int16 __pyx_v_char_index; + int __pyx_v_stop; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__matrix,&__pyx_n_s__char_to_index,&__pyx_n_s__string,&__pyx_n_s__rval,0}; + __Pyx_RefNannySetupContext("score_string"); + __pyx_self = __pyx_self; + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__matrix); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__char_to_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rval); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "score_string") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_matrix = ((PyArrayObject *)values[0]); + __pyx_v_char_to_index = ((PyArrayObject *)values[1]); + __pyx_v_string = values[2]; + __pyx_v_rval = ((PyArrayObject *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("score_string", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.motif._pwm.score_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matrix), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "matrix", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_char_to_index), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "char_to_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rval), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "rval", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/motif/_pwm.pyx":34 + * cdef float score + * cdef int i, j + * cdef int matrix_width = matrix.dimensions[0] # <<<<<<<<<<<<<< + * cdef npy_int16 char_index + * # Get input string as character pointer + */ + __pyx_v_matrix_width = (__pyx_v_matrix->dimensions[0]); + + /* "bx/motif/_pwm.pyx":37 + * cdef npy_int16 char_index + * # Get input string as character pointer + * PyString_AsStringAndSize( string, &buffer, &len ) # <<<<<<<<<<<<<< + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_string, (&__pyx_v_buffer), (&__pyx_v_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/motif/_pwm.pyx":39 + * PyString_AsStringAndSize( string, &buffer, &len ) + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 # <<<<<<<<<<<<<< + * for i from 0 <= i < stop: + * score = 0.0 + */ + __pyx_v_stop = ((__pyx_v_len - (__pyx_v_matrix->dimensions[0])) + 1); + + /* "bx/motif/_pwm.pyx":40 + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 + * for i from 0 <= i < stop: # <<<<<<<<<<<<<< + * score = 0.0 + * for j from 0 <= j < matrix_width: + */ + __pyx_t_1 = __pyx_v_stop; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/motif/_pwm.pyx":41 + * cdef int stop = len - matrix.dimensions[0] + 1 + * for i from 0 <= i < stop: + * score = 0.0 # <<<<<<<<<<<<<< + * for j from 0 <= j < matrix_width: + * char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] + */ + __pyx_v_score = 0.0; + + /* "bx/motif/_pwm.pyx":42 + * for i from 0 <= i < stop: + * score = 0.0 + * for j from 0 <= j < matrix_width: # <<<<<<<<<<<<<< + * char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] + * if char_index < 0: + */ + __pyx_t_2 = __pyx_v_matrix_width; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "bx/motif/_pwm.pyx":43 + * score = 0.0 + * for j from 0 <= j < matrix_width: + * char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] # <<<<<<<<<<<<<< + * if char_index < 0: + * break + */ + __pyx_v_char_index = (((npy_int16 *)(__pyx_v_char_to_index->data + ((__pyx_v_buffer[(__pyx_v_i + __pyx_v_j)]) * (__pyx_v_char_to_index->strides[0]))))[0]); + + /* "bx/motif/_pwm.pyx":44 + * for j from 0 <= j < matrix_width: + * char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] + * if char_index < 0: # <<<<<<<<<<<<<< + * break + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + */ + __pyx_t_3 = (__pyx_v_char_index < 0); + if (__pyx_t_3) { + + /* "bx/motif/_pwm.pyx":45 + * char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] + * if char_index < 0: + * break # <<<<<<<<<<<<<< + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + * else: + */ + goto __pyx_L9_break; + goto __pyx_L10; + } + __pyx_L10:; + + /* "bx/motif/_pwm.pyx":46 + * if char_index < 0: + * break + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] # <<<<<<<<<<<<<< + * else: + * ( ( rval.data + i * rval.strides[0] ) )[0] = score + */ + __pyx_v_score = (__pyx_v_score + (((npy_float32 *)((__pyx_v_matrix->data + (__pyx_v_j * (__pyx_v_matrix->strides[0]))) + (__pyx_v_char_index * (__pyx_v_matrix->strides[1]))))[0])); + } + /*else*/ { + + /* "bx/motif/_pwm.pyx":48 + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + * else: + * ( ( rval.data + i * rval.strides[0] ) )[0] = score # <<<<<<<<<<<<<< + * + * def score_string_with_gaps( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): + */ + (((npy_float32 *)(__pyx_v_rval->data + (__pyx_v_i * (__pyx_v_rval->strides[0]))))[0]) = __pyx_v_score; + } + __pyx_L9_break:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.motif._pwm.score_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "bx/motif/_pwm.pyx":50 + * ( ( rval.data + i * rval.strides[0] ) )[0] = score + * + * def score_string_with_gaps( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): # <<<<<<<<<<<<<< + * """ + * Score each position in string `string` using the scoring matrix `matrix`. + */ + +static PyObject *__pyx_pf_2bx_5motif_4_pwm_1score_string_with_gaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_5motif_4_pwm_1score_string_with_gaps[] = "\n Score each position in string `string` using the scoring matrix `matrix`.\n Characters in the string are mapped to columns in the matrix by `char_to_index`\n and the score for each position is stored in `rval`.\n\n matrix *must* be a 2d array of type float32\n char_to_index *must* be a 1d array of type int16\n rval *must* be a 1d array of type float32 and the same length as string\n "; +static PyMethodDef __pyx_mdef_2bx_5motif_4_pwm_1score_string_with_gaps = {__Pyx_NAMESTR("score_string_with_gaps"), (PyCFunction)__pyx_pf_2bx_5motif_4_pwm_1score_string_with_gaps, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_5motif_4_pwm_1score_string_with_gaps)}; +static PyObject *__pyx_pf_2bx_5motif_4_pwm_1score_string_with_gaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_matrix = 0; + PyArrayObject *__pyx_v_char_to_index = 0; + PyObject *__pyx_v_string = 0; + PyArrayObject *__pyx_v_rval = 0; + char *__pyx_v_buffer; + Py_ssize_t __pyx_v_len; + float __pyx_v_score; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_string_pos; + int __pyx_v_matrix_width; + npy_int16 __pyx_v_char_index; + int __pyx_v_stop; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__matrix,&__pyx_n_s__char_to_index,&__pyx_n_s__string,&__pyx_n_s__rval,0}; + __Pyx_RefNannySetupContext("score_string_with_gaps"); + __pyx_self = __pyx_self; + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__matrix); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__char_to_index); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string_with_gaps", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string_with_gaps", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rval); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("score_string_with_gaps", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "score_string_with_gaps") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_matrix = ((PyArrayObject *)values[0]); + __pyx_v_char_to_index = ((PyArrayObject *)values[1]); + __pyx_v_string = values[2]; + __pyx_v_rval = ((PyArrayObject *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("score_string_with_gaps", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.motif._pwm.score_string_with_gaps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_matrix), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "matrix", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_char_to_index), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "char_to_index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rval), __pyx_ptype_2bx_5motif_4_pwm_ndarray, 1, "rval", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/motif/_pwm.pyx":64 + * cdef float score + * cdef int i, j, string_pos + * cdef int matrix_width = matrix.dimensions[0] # <<<<<<<<<<<<<< + * cdef npy_int16 char_index + * # Get input string as character pointer + */ + __pyx_v_matrix_width = (__pyx_v_matrix->dimensions[0]); + + /* "bx/motif/_pwm.pyx":67 + * cdef npy_int16 char_index + * # Get input string as character pointer + * PyString_AsStringAndSize( string, &buffer, &len ) # <<<<<<<<<<<<<< + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 + */ + __pyx_t_1 = PyString_AsStringAndSize(__pyx_v_string, (&__pyx_v_buffer), (&__pyx_v_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "bx/motif/_pwm.pyx":69 + * PyString_AsStringAndSize( string, &buffer, &len ) + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 # <<<<<<<<<<<<<< + * for i from 0 <= i < stop: + * if buffer[i] == '-': + */ + __pyx_v_stop = ((__pyx_v_len - (__pyx_v_matrix->dimensions[0])) + 1); + + /* "bx/motif/_pwm.pyx":70 + * # Loop over each position in the string + * cdef int stop = len - matrix.dimensions[0] + 1 + * for i from 0 <= i < stop: # <<<<<<<<<<<<<< + * if buffer[i] == '-': + * # Never start scoring at a gap + */ + __pyx_t_1 = __pyx_v_stop; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + + /* "bx/motif/_pwm.pyx":71 + * cdef int stop = len - matrix.dimensions[0] + 1 + * for i from 0 <= i < stop: + * if buffer[i] == '-': # <<<<<<<<<<<<<< + * # Never start scoring at a gap + * continue + */ + __pyx_t_2 = ((__pyx_v_buffer[__pyx_v_i]) == '-'); + if (__pyx_t_2) { + + /* "bx/motif/_pwm.pyx":73 + * if buffer[i] == '-': + * # Never start scoring at a gap + * continue # <<<<<<<<<<<<<< + * score = 0.0 + * string_pos = i + */ + goto __pyx_L6_continue; + goto __pyx_L8; + } + __pyx_L8:; + + /* "bx/motif/_pwm.pyx":74 + * # Never start scoring at a gap + * continue + * score = 0.0 # <<<<<<<<<<<<<< + * string_pos = i + * for j from 0 <= j < matrix_width: + */ + __pyx_v_score = 0.0; + + /* "bx/motif/_pwm.pyx":75 + * continue + * score = 0.0 + * string_pos = i # <<<<<<<<<<<<<< + * for j from 0 <= j < matrix_width: + * # Advance to the next non-gap character + */ + __pyx_v_string_pos = __pyx_v_i; + + /* "bx/motif/_pwm.pyx":76 + * score = 0.0 + * string_pos = i + * for j from 0 <= j < matrix_width: # <<<<<<<<<<<<<< + * # Advance to the next non-gap character + * while buffer[string_pos] == '-' and string_pos < len: + */ + __pyx_t_3 = __pyx_v_matrix_width; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) { + + /* "bx/motif/_pwm.pyx":78 + * for j from 0 <= j < matrix_width: + * # Advance to the next non-gap character + * while buffer[string_pos] == '-' and string_pos < len: # <<<<<<<<<<<<<< + * string_pos += 1 + * # Ran out of non-gap characters, no more scoring is possible + */ + while (1) { + __pyx_t_2 = ((__pyx_v_buffer[__pyx_v_string_pos]) == '-'); + if (__pyx_t_2) { + __pyx_t_4 = (__pyx_v_string_pos < __pyx_v_len); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (!__pyx_t_5) break; + + /* "bx/motif/_pwm.pyx":79 + * # Advance to the next non-gap character + * while buffer[string_pos] == '-' and string_pos < len: + * string_pos += 1 # <<<<<<<<<<<<<< + * # Ran out of non-gap characters, no more scoring is possible + * if string_pos == len: + */ + __pyx_v_string_pos = (__pyx_v_string_pos + 1); + } + + /* "bx/motif/_pwm.pyx":81 + * string_pos += 1 + * # Ran out of non-gap characters, no more scoring is possible + * if string_pos == len: # <<<<<<<<<<<<<< + * return + * # Find character for position and score + */ + __pyx_t_5 = (__pyx_v_string_pos == __pyx_v_len); + if (__pyx_t_5) { + + /* "bx/motif/_pwm.pyx":82 + * # Ran out of non-gap characters, no more scoring is possible + * if string_pos == len: + * return # <<<<<<<<<<<<<< + * # Find character for position and score + * char_index = ( ( char_to_index.data + buffer[string_pos] * char_to_index.strides[0] ) )[0] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "bx/motif/_pwm.pyx":84 + * return + * # Find character for position and score + * char_index = ( ( char_to_index.data + buffer[string_pos] * char_to_index.strides[0] ) )[0] # <<<<<<<<<<<<<< + * if char_index < 0: + * break + */ + __pyx_v_char_index = (((npy_int16 *)(__pyx_v_char_to_index->data + ((__pyx_v_buffer[__pyx_v_string_pos]) * (__pyx_v_char_to_index->strides[0]))))[0]); + + /* "bx/motif/_pwm.pyx":85 + * # Find character for position and score + * char_index = ( ( char_to_index.data + buffer[string_pos] * char_to_index.strides[0] ) )[0] + * if char_index < 0: # <<<<<<<<<<<<<< + * break + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + */ + __pyx_t_5 = (__pyx_v_char_index < 0); + if (__pyx_t_5) { + + /* "bx/motif/_pwm.pyx":86 + * char_index = ( ( char_to_index.data + buffer[string_pos] * char_to_index.strides[0] ) )[0] + * if char_index < 0: + * break # <<<<<<<<<<<<<< + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + * # Matched a character, move forward + */ + goto __pyx_L10_break; + goto __pyx_L14; + } + __pyx_L14:; + + /* "bx/motif/_pwm.pyx":87 + * if char_index < 0: + * break + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] # <<<<<<<<<<<<<< + * # Matched a character, move forward + * string_pos += 1 + */ + __pyx_v_score = (__pyx_v_score + (((npy_float32 *)((__pyx_v_matrix->data + (__pyx_v_j * (__pyx_v_matrix->strides[0]))) + (__pyx_v_char_index * (__pyx_v_matrix->strides[1]))))[0])); + + /* "bx/motif/_pwm.pyx":89 + * score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + * # Matched a character, move forward + * string_pos += 1 # <<<<<<<<<<<<<< + * else: + * ( ( rval.data + i * rval.strides[0] ) )[0] = score + */ + __pyx_v_string_pos = (__pyx_v_string_pos + 1); + } + /*else*/ { + + /* "bx/motif/_pwm.pyx":91 + * string_pos += 1 + * else: + * ( ( rval.data + i * rval.strides[0] ) )[0] = score # <<<<<<<<<<<<<< + */ + (((npy_float32 *)(__pyx_v_rval->data + (__pyx_v_i * (__pyx_v_rval->strides[0]))))[0]) = __pyx_v_score; + } + __pyx_L10_break:; + __pyx_L6_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("bx.motif._pwm.score_string_with_gaps", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_pwm"), + __Pyx_DOCSTR(__pyx_k_1), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__char_to_index, __pyx_k__char_to_index, sizeof(__pyx_k__char_to_index), 0, 0, 1, 1}, + {&__pyx_n_s__matrix, __pyx_k__matrix, sizeof(__pyx_k__matrix), 0, 0, 1, 1}, + {&__pyx_n_s__rval, __pyx_k__rval, sizeof(__pyx_k__rval), 0, 0, 1, 1}, + {&__pyx_n_s__score_string, __pyx_k__score_string, sizeof(__pyx_k__score_string), 0, 0, 1, 1}, + {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_pwm(void); /*proto*/ +PyMODINIT_FUNC init_pwm(void) +#else +PyMODINIT_FUNC PyInit__pwm(void); /*proto*/ +PyMODINIT_FUNC PyInit__pwm(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__pwm(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pwm"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__motif___pwm) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_2bx_5motif_4_pwm_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_2bx_5motif_4_pwm_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/motif/_pwm.pyx":20 + * ctypedef float npy_float32 + * + * def score_string( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): # <<<<<<<<<<<<<< + * """ + * Score each position in string `string` using the scoring matrix `matrix`. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5motif_4_pwm_score_string, NULL, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__score_string, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/motif/_pwm.pyx":50 + * ( ( rval.data + i * rval.strides[0] ) )[0] = score + * + * def score_string_with_gaps( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): # <<<<<<<<<<<<<< + * """ + * Score each position in string `string` using the scoring matrix `matrix`. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_5motif_4_pwm_1score_string_with_gaps, NULL, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/motif/_pwm.pyx":1 + * """ # <<<<<<<<<<<<<< + * Extensions used by the `pwm` module. + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.motif._pwm", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.motif._pwm"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.pyx b/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.pyx new file mode 100755 index 0000000..e062510 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/_pwm.pyx @@ -0,0 +1,91 @@ +""" +Extensions used by the `pwm` module. +""" + +cdef extern from "Python.h": + int PyString_AsStringAndSize(object obj, char **buffer, Py_ssize_t* length) except -1 + +cdef extern from "numpy/arrayobject.h": + ctypedef int intp + ctypedef extern class numpy.ndarray [object PyArrayObject]: + cdef char *data + cdef int nd + cdef intp *dimensions + cdef intp *strides + cdef int flags + # These might be other types in the actual header depending on platform + ctypedef int npy_int16 + ctypedef float npy_float32 + +def score_string( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): + """ + Score each position in string `string` using the scoring matrix `matrix`. + Characters in the string are mapped to columns in the matrix by `char_to_index` + and the score for each position is stored in `rval`. + + matrix *must* be a 2d array of type float32 + char_to_index *must* be a 1d array of type int16 + rval *must* be a 1d array of type float32 and the same length as string + """ + cdef char *buffer + cdef Py_ssize_t len + cdef float score + cdef int i, j + cdef int matrix_width = matrix.dimensions[0] + cdef npy_int16 char_index + # Get input string as character pointer + PyString_AsStringAndSize( string, &buffer, &len ) + # Loop over each position in the string + cdef int stop = len - matrix.dimensions[0] + 1 + for i from 0 <= i < stop: + score = 0.0 + for j from 0 <= j < matrix_width: + char_index = ( ( char_to_index.data + buffer[i+j] * char_to_index.strides[0] ) )[0] + if char_index < 0: + break + score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + else: + ( ( rval.data + i * rval.strides[0] ) )[0] = score + +def score_string_with_gaps( ndarray matrix, ndarray char_to_index, object string, ndarray rval ): + """ + Score each position in string `string` using the scoring matrix `matrix`. + Characters in the string are mapped to columns in the matrix by `char_to_index` + and the score for each position is stored in `rval`. + + matrix *must* be a 2d array of type float32 + char_to_index *must* be a 1d array of type int16 + rval *must* be a 1d array of type float32 and the same length as string + """ + cdef char *buffer + cdef Py_ssize_t len + cdef float score + cdef int i, j, string_pos + cdef int matrix_width = matrix.dimensions[0] + cdef npy_int16 char_index + # Get input string as character pointer + PyString_AsStringAndSize( string, &buffer, &len ) + # Loop over each position in the string + cdef int stop = len - matrix.dimensions[0] + 1 + for i from 0 <= i < stop: + if buffer[i] == '-': + # Never start scoring at a gap + continue + score = 0.0 + string_pos = i + for j from 0 <= j < matrix_width: + # Advance to the next non-gap character + while buffer[string_pos] == '-' and string_pos < len: + string_pos += 1 + # Ran out of non-gap characters, no more scoring is possible + if string_pos == len: + return + # Find character for position and score + char_index = ( ( char_to_index.data + buffer[string_pos] * char_to_index.strides[0] ) )[0] + if char_index < 0: + break + score += ( ( matrix.data + j * matrix.strides[0] + char_index * matrix.strides[1] ) )[0] + # Matched a character, move forward + string_pos += 1 + else: + ( ( rval.data + i * rval.strides[0] ) )[0] = score \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/io/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/io/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac.py new file mode 100755 index 0000000..950e06d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac.py @@ -0,0 +1,221 @@ +""" +Classes for reading and writing motif data. +""" + +from bx.motif.pwm import FrequencyMatrix + +class TransfacMotif( object ): + + def __init__( self ): + self.accession = None + self.id = None + self.dates = None + self.name = None + self.description = None + self.binding_factors = None + self.basis = None + self.comment = None + self.matrix = None + self.attributes = None + self.sites = None + +transfac_actions = { + "AC": ( "store_single", "accession" ), + "ID": ( "store_single", "id" ), + "DT": ( "store_single_list", "dates" ), + "NA": ( "store_single", "name" ), + "DE": ( "store_block", "description" ), + "BF": ( "store_single_list", "binding_factors" ), + "BA": ( "store_block", "basis" ), + "CC": ( "store_block", "comment" ), + "P0": ( "store_matrix", "matrix" ), + # For CREAD format files + "TY": ( "store_single", "type" ), + "AT": ( "store_single_key_value", "attributes" ), + "BS": ( "store_single_list", "sites" ) +} + +class TransfacReader( object ): + """ + Reads motifs in TRANSFAC format. + """ + + parse_actions = transfac_actions + + def __init__( self, input ): + self.input = iter( input ) + self.input_exhausted = False + + def as_dict( self, key="id" ): + """ + Return a dictionary containing all remaining motifs, using `key` + as the dictionary key. + """ + rval = {} + for motif in self: + rval[ getattr( motif, key ) ] = motif + return rval + + def __iter__( self ): + return self + + def next( self ): + rval = self.next_motif() + while rval is None: + rval = self.next_motif() + return rval + + def next_motif( self ): + if self.input_exhausted: + raise StopIteration + # Accumulate lines until either the end of record indicator "//" is + # encounted or the input is exhausted. + lines = [] + while 1: + try: + line = self.input.next() + except StopIteration, e: + self.input_exhausted = True + break + if line.startswith( "//" ): + break + if not line.isspace(): + lines.append( line ) + if lines: + return self.parse_record( lines ) + + def parse_record( self, lines ): + """ + Parse a TRANSFAC record out of `lines` and return a motif. + """ + # Break lines up + temp_lines = [] + for line in lines: + fields = line.rstrip( "\r\n" ).split( None, 1 ) + if len( fields ) == 1: + fields.append( "" ) + temp_lines.append( fields ) + lines = temp_lines + # Fill in motif from lines + motif = TransfacMotif() + current_line = 0 + while 1: + # Done parsing if no more lines to consume + if current_line >= len( lines ): + break + # Remove prefix and first separator from line + prefix, rest = lines[ current_line ] + # No action for this prefix, just ignore the line + if prefix not in self.parse_actions: + current_line += 1 + continue + # Get action for line + action = self.parse_actions[ prefix ] + # Store a single line value + if action[0] == "store_single": + key = action[1] + setattr( motif, key, rest ) + current_line += 1 + # Add a single line value to a list + if action[0] == "store_single_list": + key = action[1] + if not getattr( motif, key ): + setattr( motif, key, [] ) + getattr( motif, key ).append( rest ) + current_line += 1 + # Add a single line value to a dictionary + if action[0] == "store_single_key_value": + key = action[1] + k, v = rest.strip().split( '=', 1 ) + if not getattr( motif, key ): + setattr( motif, key, {} ) + getattr( motif, key )[k] = v + current_line += 1 + # Store a block of text + if action[0] == "store_block": + key = action[1] + value = [] + while current_line < len( lines ) and lines[ current_line ][0] == prefix: + value.append( lines[current_line][1] ) + current_line += 1 + setattr( motif, key, str.join( "\n", value ) ) + # Store a matrix + if action[0] == "store_matrix": + # First line is alphabet + alphabet = rest.split() + alphabet_size = len( alphabet ) + rows = [] + pattern = "" + current_line += 1 + # Next lines are the rows of the matrix (we allow 0 rows) + while current_line < len( lines ): + prefix, rest = lines[ current_line ] + # Prefix should be a two digit 0 padded row number + if not prefix.isdigit(): + break + # The first `alphabet_size` fields are the row values + values = rest.split() + rows.append( map( float, values[:alphabet_size] ) ) + # TRANSFAC includes an extra column with the IUPAC code + if len( values ) > alphabet_size: + pattern += values[alphabet_size] + current_line += 1 + # Only store the pattern if it is the correct length (meaning + # that every row had an extra field) + if len( pattern ) != len( rows ): + pattern = None + matrix = FrequencyMatrix.from_rows( alphabet, rows ) + setattr( motif, action[1], matrix ) + # Only return a motif if we saw at least ID or AC or NA + if motif.id or motif.accession or motif.name: + return motif + +class TransfacWriter( object ): + """ + Writes motifs in TRANSFAC format. + """ + + actions = transfac_actions + + def __init__( self, output ): + self.output = output + + def write( self, motif ): + output = self.output + for prefix, actions in self.actions.iteritems(): + action = actions[0] + if action == "store_single": + key = actions[1] + if getattr( motif, key ) is not None: + print >> output, prefix, " ", getattr( motif, key ) + print >> output, "XX" + elif action == "store_single_list": + key = actions[1] + if getattr( motif, key ) is not None: + value = getattr( motif, key ) + for v in value: + print >> output, prefix, " ", v + print >> output, "XX" + elif action == "store_single_key_value": + key = actions[1] + if getattr( motif, key ) is not None: + value = getattr( motif, key ) + for k, v in value.iteritems(): + print >> output, prefix, " ", "%s=%s" % ( k, v ) + print >> output, "XX" + elif action == "store_block": + key = actions[1] + if getattr( motif, key ) is not None: + value = getattr( motif, key ) + for line in value.split( "\n" ): + print >> output, prefix, " ", line + print >> output, "XX" + elif action == "store_matrix": + key = actions[1] + if getattr( motif, key ) is not None: + matrix = getattr( motif, key ) + print >> output, prefix, " ", " ".join( [ s.rjust(6) for s in matrix.alphabet ] ) + for i in range( matrix.width ): + print >> output, "%02d" % ( i + 1 ), " ", " ".join( [ str(matrix.values[i,matrix.char_to_index[ord(s)]]).rjust(6) for s in matrix.alphabet ] ) + print >> output, "XX" + print "//" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac_tests.py new file mode 100755 index 0000000..6afc013 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/io/transfac_tests.py @@ -0,0 +1,94 @@ +from StringIO import StringIO +import transfac +from numpy import allclose + +sample = """ +VV TRANSFAC MATRIX TABLE, Rel.3.2 26-06-1997 +XX +// +AC a +XX +ID V$MYOD_01 +XX +DT 19.10.92 (created); ewi. +DT 16.10.95 (updated); ewi. +XX +NA MyoD +XX +DE myoblast determination gene product +XX +BF T00526; MyoD; Species: mouse, Mus musculus. +XX +P0 A C G T +01 100 200 200 0 S +02 200 100 200 0 R +03 300 0 100 100 A +04 0 500 0 0 C +05 500 0 0 0 A +06 0 0 400 100 G +07 0 100 400 0 G +08 0 0 0 500 T +09 0 0 500 0 G +10 0 100 200 200 K +11 0 200 0 300 Y +12 100 0 300 100 G +XX +BA 5 functional elements in 3 genes +XX +// +AC M00002 +XX +ID V$E47_01 +XX +DT 19.10.92 (created); ewi. +DT 16.10.95 (updated); ewi. +XX +NA E47 +XX +DE E47 +XX +BF T00207; E47; Species: human, Homo sapiens. +XX +P0 A C G T +00 400 400 300 0 N +02 200 500 400 0 S +03 300 200 400 200 N +04 200 0 900 0 G +05 0 1100 0 0 C +06 1100 0 0 0 A +07 0 0 1100 0 G +08 100 200 800 0 G +09 0 0 0 1100 T +10 0 0 1100 0 G +11 0 0 400 700 K +12 100 400 300 300 N +13 100 600 200 200 C +14 100 400 400 200 N +15 100 400 200 300 N +XX +BA 11 selected strong binding sites for E47, E47-MyoD, E12+MyoD +BA and (weak) for E12 +XX +CC Group I in [903]; 5 sites selected in vitro for binding to E12N +CC (=N-terminally truncated E12); matrix corrected according to +CC the published sequences +XX +RN [1] +RA Sun X.-H., Baltimore D. +RT An inhibitory domain of E12 transcription factor prevents +RT DNA binding in E12 homodimers but not in E12 heterodimers +RL Cell 64:459-470 (1991). +XX +""" + +def test_reader(): + input = StringIO( sample ) + motifs = list( transfac.TransfacReader( input ) ) + assert len( motifs ) == 2 + # Single value parse + assert motifs[1].accession == "M00002" + # Value list parse + assert motifs[1].dates == [ '19.10.92 (created); ewi.', '16.10.95 (updated); ewi.' ] + # Matrix parse + assert motifs[1].matrix.sorted_alphabet == ['A','C','G','T'] + assert allclose( motifs[1].matrix.values[0], [400,400,300,0] ) \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/__init__.py new file mode 100755 index 0000000..7a7ef04 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/__init__.py @@ -0,0 +1,71 @@ +import pkg_resources +from StringIO import StringIO +from string import Template +from numpy import * + +PAD = 2 + +# Colors from rgb.txt, +DNA_DEFAULT_COLORS = { + 'A': "0.00 1.00 0.00", # green + 'C': "0.00 0.00 1.00", # blue + 'G': "1.00 0.65 0.00", # orange red + 'T': "1.00 0.00 0.00" # red +} + +# Template is adapted from Jim Kent's lib/dnaMotif.pss to support aritrary +# alphabets. +TEMPLATE = "template.ps" + +def freqs_to_heights( matrix ): + """ + Calculate logo height using the method of: + + Schneider TD, Stephens RM. "Sequence logos: a new way to display consensus + sequences." Nucleic Acids Res. 1990 Oct 25;18(20):6097-100. + """ + # Columns are sequence positions, rows are symbol counts/frequencies + f = matrix.values.transpose() + n, m = f.shape + # Ensure normalized + f = f / sum( f, axis=0 ) + # Shannon entropy (the where replaces 0 with 1 so that '0 log 0 == 0') + H = - sum( f * log2( where( f, f, 1 ) ), axis=0 ) + # Height + return transpose( f * ( log2( n ) - H ) ) + +def eps_logo( matrix, base_width, height, colors=DNA_DEFAULT_COLORS ): + """ + Return an EPS document containing a sequence logo for matrix where each + bases is shown as a column of `base_width` points and the total logo + height is `height` points. If `colors` is provided it is a mapping from + characters to rgb color strings. + """ + alphabet = matrix.sorted_alphabet + rval = StringIO() + # Read header ans substitute in width / height + header = Template( pkg_resources.resource_string( __name__, "template.ps" ) ) + rval.write( header.substitute( bounding_box_width = ceil( base_width * matrix.width ) + PAD, + bounding_box_height = ceil( height ) + PAD ) ) + # Determine heights + heights = freqs_to_heights( matrix ) + height_scale = height / log2( len( alphabet ) ) + # Draw each "row" of the matrix + for i, row in enumerate( heights ): + x = ( i * base_width ) + y = 0 + for j, base_height in enumerate( row ): + char = alphabet[j] + page_height = height_scale * base_height + # print matrix.alphabet[j], base_height, height_scale, page_height + if page_height > 1: + # Draw letter + rval.write( "%s setrgbcolor\n" % colors.get( char, '0 0 0' ) ) + rval.write( "%3.2f " % x ) + rval.write( "%3.2f " % y ) + rval.write( "%3.2f " % ( x + base_width ) ) + rval.write( "%3.2f " % ( y + page_height ) ) + rval.write( "(%s) textInBox\n" % char ) + y += page_height + rval.write( "showpage" ) + return rval.getvalue() \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/template.ps b/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/template.ps new file mode 100755 index 0000000..f1579ac Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/bx/motif/logo/template.ps differ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm.py new file mode 100755 index 0000000..bad9daf --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm.py @@ -0,0 +1,149 @@ +""" +Classes for working with position specific matrices. +""" + +from numpy import * +from copy import copy + +import _pwm + +class BaseMatrix( object ): + """ + Base class for position specific matrices. + """ + def __init__( self, alphabet=None, sorted_alphabet=None, + char_to_index=None, values=None ): + self.alphabet = alphabet + self.sorted_alphabet = sorted_alphabet + self.char_to_index = char_to_index + self.values = values + + @classmethod + def from_rows( Class, alphabet, rows ): + """ + Create a new matrix for a sequence over alphabet `alphabet` taking + values from `rows` which is a list whose length is the width of the + matrix, and whose elements are lists of values associated with each + character (in the order those characters appear in alphabet). + """ + # Sorted alphabet + sorted_alphabet = sorted( alphabet ) + # Character to index mapping (initialized to -1) + char_to_index = zeros( (256), int16 ) - 1 + for i, ch in enumerate( sorted_alphabet ): + char_to_index[ ord(ch) ] = i + # Array + values = zeros( ( len( rows) , len( alphabet ) ), float32 ) + for i, row in enumerate( rows ): + assert len( row ) == len( alphabet ) + for ch, val in zip( alphabet, row ): + values[i, char_to_index[ord(ch)]] = val + # Matrix + matrix = Class() + matrix.alphabet = alphabet + matrix.sorted_alphabet = sorted_alphabet + matrix.char_to_index = char_to_index + matrix.values = values + return matrix + + @classmethod + def create_from_other( Class, other, values=None ): + """ + Create a new Matrix with attributes taken from `other` but with the + values taken from `values` if provided + """ + m = Class() + m.alphabet = other.alphabet + m.sorted_alphabet = other.sorted_alphabet + m.char_to_index = other.char_to_index + if values is not None: + m.values = values + else: + m.values = other.values + return m + + @property + def width( self ): + """ + Return the width (size along the sequence axis) of this matrix. + """ + return self.values.shape[0] + + def reverse_complement( self ): + """ + Create the reverse complement of this matrix. The result probably + only makese sense if the alphabet is that of DNA ('A','C','G','T'). + """ + rval = copy( self ) + # Conveniently enough, reversing rows and columns is exactly what we + # want, since this results in A swapping with T and C swapping with G. + rval.values = self.values[::-1,::-1].copy() + return rval + +class FrequencyMatrix( BaseMatrix ): + """ + A position specific count/frequency matrix. + """ + + DEFAULT_CORRECTION = 0.0000000001 + """ + Default value to use for correcting when dealing with counts of zero, + chosen to produce scoring matrices that are the same as produced by CREAD. + """ + + def to_logodds_scoring_matrix( self, background=None, correction=DEFAULT_CORRECTION ): + """ + Create a standard logodds scoring matrix. + """ + alphabet_size = len( self.alphabet ) + if background is None: + background = ones( alphabet_size, float32 ) / alphabet_size + # Row totals as a one column array + totals = sum( self.values, 1 )[:,newaxis] + values = log2( maximum( self.values, correction ) ) \ + - log2( totals ) \ + - log2( maximum( background, correction ) ) + return ScoringMatrix.create_from_other( self, values.astype( float32 ) ) + + def to_stormo_scoring_matrix( self, background=None ): + """ + Create a scoring matrix from this count matrix using the method from: + + Hertz, G.Z. and G.D. Stormo (1999). Identifying DNA and protein patterns with statistically + significant alignments of multiple sequences. Bioinformatics 15(7): 563-577. + """ + alphabet_size = len( self.alphabet ) + if background is None: + background = ones( alphabet_size, float32 ) / alphabet_size + # Row totals as a one column array + totals = sum( self.values, 1 )[:,newaxis] + values = log2( self.values + background ) \ + - log2( totals + 1 ) - log2( background ) + return ScoringMatrix.create_from_other( self, values.astype( float32 ) ) + +class ScoringMatrix( BaseMatrix ): + """ + A position specific matrix containing values that are suitable for + scoring a sequence. + """ + + def score_string( self, string ): + """ + Score each valid position in `string` using this scoring matrix. + Positions which were not scored are set to nan. + """ + rval = zeros( len( string ), float32 ) + rval[:] = nan + _pwm.score_string( self.values, self.char_to_index, string, rval ) + return rval + + def score_string_with_gaps( self, string ): + """ + Score each valid position in `string` using this scoring matrix. + Positions which were not scored are set to nan. Gap characters are + ignored (matrices score across them). + """ + rval = zeros( len( string ), float32 ) + rval[:] = nan + _pwm.score_string_with_gaps( self.values, self.char_to_index, string, rval ) + return rval \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm_tests.py new file mode 100755 index 0000000..bc6667e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/motif/pwm_tests.py @@ -0,0 +1,81 @@ +import pwm +from numpy import allclose, isnan + +def test_create(): + m = pwm.FrequencyMatrix.from_rows( ['A','C','G','T'], get_ctcf_rows() ) + # Alphabet sort + assert m.sorted_alphabet == [ 'A', 'C', 'G', 'T' ] + # Character to index mapping + assert m.char_to_index[ ord('A') ] == 0 + assert m.char_to_index[ ord('C') ] == 1 + assert m.char_to_index[ ord('G') ] == 2 + assert m.char_to_index[ ord('T') ] == 3 + assert m.char_to_index[ ord('Q') ] == -1 + # Values + assert allclose( m.values[0], [ 2620, 2052, 3013, 2314 ] ) + assert allclose( m.values[19], [ 3144, 3231, 3056, 567 ] ) + +def test_scoring(): + m = pwm.FrequencyMatrix.from_rows( ['A','C','G','T'], get_ctcf_rows() ) + # Stormo method + sm = m.to_stormo_scoring_matrix() + # Forward matches + assert allclose( sm.score_string( "AATCACCACCTCCTGGCAGG" )[0], -156.8261261 ) + assert allclose( sm.score_string( "TGCCTGCCTCTGTAGGCTCC" )[0], -128.8106842 ) + assert allclose( sm.score_string( "GTTGCCAGTTGGGGGAAGCA" )[0], 4.65049839 ) + assert allclose( sm.score_string( "GCAGACACCAGGTGGTTCAG" )[0], 1.60168743 ) + # Reverse matches + rc = sm.reverse_complement() + assert allclose( rc.score_string( "AATCACCACCTCCTGGCAGG" )[0], 0.014178276062 ) + assert allclose( rc.score_string( "TGCCTGCCTCTGTAGGCTCC" )[0], 0.723828315735 ) + assert allclose( rc.score_string( "GTTGCCAGTTGGGGGAAGCA" )[0], -126.99407196 ) + assert allclose( rc.score_string( "GCAGACACCAGGTGGTTCAG" )[0], -86.9560623169 ) + # Nothing valid + assert isnan( sm.score_string_with_gaps( "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) ).all() + # Too short + assert isnan( sm.score_string( "TTTT" ) ).all() + +def test_scoring_with_gaps(): + m = pwm.FrequencyMatrix.from_rows( ['A','C','G','T'], get_ctcf_rows() ) + # Stormo method + sm = m.to_stormo_scoring_matrix() + # Forward matches + assert allclose( sm.score_string_with_gaps( "GTTGCCAGT----TGGGGGAAGCATTT---AA" )[0], 4.65049839 ) + assert allclose( sm.score_string_with_gaps( "GCAGA--CACCAGGTGG--TTCAG---" )[0], 1.60168743 ) + assert allclose( sm.score_string_with_gaps( "----GTTGCCAGTTGGGGGAAGCA" )[4], 4.65049839 ) + assert allclose( sm.score_string_with_gaps( "TTT--GTT--GCCA--GTTGGGG-G-A-A-G-C-A-" )[5], 4.65049839 ) + assert isnan( sm.score_string_with_gaps( "TTT--GTT--GCCA--GTTGGGG-G-A-A-G-C-A-" )[4] ) + # Nothing valid + assert isnan( sm.score_string_with_gaps( "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) ).all() + assert isnan( sm.score_string_with_gaps( "------------------------------------" ) ).all() + # Too short + assert isnan( sm.score_string_with_gaps( "TTTT" ) ).all() + assert isnan( sm.score_string_with_gaps( "TTTT----" ) ).all() + + +def get_ctcf_rows(): + """ + The CTCF primary site motif + """ + return [ + [ 2620 , 2052 , 3013 , 2314 ], + [ 0 , 3580 , 1746 , 4672 ], + [ 2008 , 1790 , 4497 , 1703 ], + [ 3362 , 0 , 6637 , 0 ], + [ 0 , 10000 , 0 , 0 ], + [ 0 , 10000 , 0 , 0 ], + [ 7467 , 0 , 1310 , 1222 ], + [ 786 , 4890 , 4323 , 0 ], + [ 1179 , 6288 , 829 , 1703 ], + [ 10000 , 0 , 0 , 0 ], + [ 0 , 0 , 10000 , 0 ], + [ 4847 , 0 , 5152 , 0 ], + [ 0 , 0 , 6200 , 3799 ], + [ 0 , 0 , 10000 , 0 ], + [ 0 , 0 , 10000 , 0 ], + [ 1572 , 7467 , 0 , 960 ], + [ 3842 , 0 , 5545 , 611 ], + [ 0 , 5895 , 4104 , 0 ], + [ 1615 , 4192 , 1397 , 2794 ], + [ 3144 , 3231 , 3056 , 567 ] + ] \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/phylo/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/phylo/__init__.py new file mode 100755 index 0000000..f3732ed --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/phylo/__init__.py @@ -0,0 +1,3 @@ +""" +Phylogenetic file format support. +""" \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick.py b/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick.py new file mode 100755 index 0000000..5e1374f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick.py @@ -0,0 +1,98 @@ +""" +Support for parsing phylogenetic tree's in newick format. + +TODO: Tree/Edge should be a generic data structure, not newick specific. +""" +from functools import total_ordering + +from bx_extras.pyparsing import * + +__all__ = [ "Tree", "Edge", "NewickParser", "newick_parser" ] + +def indent( s ): + return "\n".join( " " + line for line in s.split( "\n" ) ) + +def print_( p, s ): + print p, type(s), s + return s + +@total_ordering +class Tree( object ): + def __init__( self, label, edges=None ): + self.label = label + self.edges = edges + def pretty( self ): + if self.edges: + return "Tree( '%s',\n%s\n)" % ( self.label, indent( "\n".join( repr( edge ) for edge in self.edges ) ) ) + else: + return "Tree( '%s' )" % self.label + def __lt__(self, other): + return self.__dict__ < other.__dict__ + def __eq__(self, other): + return self.__dict__ == other.__dict__ + def __repr__( self ): + return "Tree( %s, %s )" % ( repr( self.label ), repr( self.edges ) ) + +@total_ordering +class Edge( object ): + def __init__( self, length, tip ): + self.length = length + self.tip = tip + def pretty( self ): + return "Edge( %s, \n%s\n)" % ( repr( self.length ), indent( repr( self.tip ) ) ) + def __lt__(self, other): + return self.__dict__ < other.__dict__ + def __eq__(self, other): + return self.__dict__ == other.__dict__ + def __repr__( self ): + return "Edge( %s, %s )" % ( repr( self.length ), repr( self.tip ) ) + +def create_parser(): + """ + Create a 'pyparsing' parser for newick format trees roughly based on the + grammar here: + http://evolution.genetics.washington.edu/phylip/newick_doc.html + + Problems: + - Is a single leaf a valid tree? + - Branch length on root? Doesn't make sense to me, and forces the root + to be an edge. + """ + # Basic tokens + real = Combine( Word( "+-" + nums, nums ) + + Optional( "." + Optional( Word( nums ) ) ) + + Optional( CaselessLiteral( "E" ) + Word( "+-" + nums, nums ) ) ) + lpar = Suppress( "(" ) + rpar = Suppress( ")" ) + colon = Suppress( ":" ) + semi = Suppress( ";" ) + quot = Suppress( "'" ) + # Labels are either unquoted or single quoted, if unquoted underscores will be replaced with spaces + quoted_label = QuotedString( "'", None, "''" ).setParseAction( lambda s, l, t: t[0] ) + simple_label = Word( alphas + nums + "_." ).setParseAction( lambda s, l, t: t[0].replace( "_", " " ) ) + label = quoted_label | simple_label + # Branch length is a real number (note though that exponents are not in the spec!) + branch_length = real.setParseAction( lambda s, l, t: float( t[0] ) ) + # Need to forward declare this due to circularity + node_list = Forward() + # A node might have an list of edges (for a subtree), a label, and/or a branch length + node = ( Optional( node_list, None ) + Optional( label, "" ) + Optional( colon + branch_length, None ) ) \ + .setParseAction( lambda s, l, t: Edge( t[2], Tree( t[1] or None, t[0] ) ) ) + node_list << ( lpar + delimitedList( node ) + rpar ) \ + .setParseAction( lambda s, l, t: [ t.asList() ] ) + # The root cannot have a branch length + tree = ( node_list + Optional( label, "" ) + semi )\ + .setParseAction( lambda s, l, t: Tree( t[1] or None, t[0] ) ) + # Return the outermost element + return tree + +class NewickParser( object ): + """ + Class wrapping a parser for building Trees from newick format strings + """ + def __init__( self ): + self.parser = create_parser() + def parse_string( self, s ): + return self.parser.parseString( s )[0] + +newick_parser = NewickParser() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick_tests.py new file mode 100755 index 0000000..3fca8da --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/phylo/newick_tests.py @@ -0,0 +1,33 @@ +""" +Tests for `bx.phylo.newick`. +""" + +from bx.phylo.newick import * +import unittest + +trees = [ r"(B:6.0,(A:5.0,C:3.0,'Foo ''bar':4.0)Q_X:5.0,D:11.0)label;", + "((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700, seal:12.00300):7.52973,(( monkey:100.85930,cat:47.14069):20.59201, weasel:18.87953):2.09460):3.87382,dog:25.46154);", + "(Bovine:0.69395,(Gibbon:0.36079,(Orang:0.33636,(Gorilla:0.17147,(Chimp:0.19268, Human:0.11927):0.08386):0.06124):0.15057):0.54939,Mouse:1.21460);", + "(Bovine:0.69395,(Hylobates:0.36079,(Pongo:0.33636,(G._Gorilla:0.17147, (P._paniscus:0.19268,H._sapiens:0.11927):0.08386):0.06124):0.15057):0.54939, Rodent:1.21460);", + "(B,(A,C,E),D);", + "(,(,,),);", + "(A,(B,C),D);", + "((A,D),(C,B));" +] + +results = [ ( Tree( 'label', [Edge( 6.0, Tree( 'B', None ) ), Edge( 5.0, Tree( 'Q X', [Edge( 5.0, Tree( 'A', None ) ), Edge( 3.0, Tree( 'C', None ) ), Edge( 4.0, Tree( "Foo 'bar", None ) )] ) ), Edge( 11.0, Tree( 'D', None ) )] ) ), + ( Tree( None, [Edge( 0.84599999999999997, Tree( None, [Edge( 19.199590000000001, Tree( 'raccoon', None ) ), Edge( 6.8004100000000003, Tree( 'bear', None ) )] ) ), Edge( 3.8738199999999998, Tree( None, [Edge( 7.5297299999999998, Tree( None, [Edge( 11.997, Tree( 'sea lion', None ) ), Edge( 12.003, Tree( 'seal', None ) )] ) ), Edge( 2.0945999999999998, Tree( None, [Edge( 20.592009999999998, Tree( None, [Edge( 100.8593, Tree( 'monkey', None ) ), Edge( 47.140689999999999, Tree( 'cat', None ) )] ) ), Edge( 18.879529999999999, Tree( 'weasel', None ) )] ) )] ) ), Edge( 25.461539999999999, Tree( 'dog', None ) )] ) ), + ( Tree( None, [Edge( 0.69394999999999996, Tree( 'Bovine', None ) ), Edge( 0.54939000000000004, Tree( None, [Edge( 0.36079, Tree( 'Gibbon', None ) ), Edge( 0.15057000000000001, Tree( None, [Edge( 0.33635999999999999, Tree( 'Orang', None ) ), Edge( 0.061240000000000003, Tree( None, [Edge( 0.17147000000000001, Tree( 'Gorilla', None ) ), Edge( 0.083860000000000004, Tree( None, [Edge( 0.19267999999999999, Tree( 'Chimp', None ) ), Edge( 0.11927, Tree( 'Human', None ) )] ) )] ) )] ) )] ) ), Edge( 1.2145999999999999, Tree( 'Mouse', None ) )] ) ), + ( Tree( None, [Edge( 0.69394999999999996, Tree( 'Bovine', None ) ), Edge( 0.54939000000000004, Tree( None, [Edge( 0.36079, Tree( 'Hylobates', None ) ), Edge( 0.15057000000000001, Tree( None, [Edge( 0.33635999999999999, Tree( 'Pongo', None ) ), Edge( 0.061240000000000003, Tree( None, [Edge( 0.17147000000000001, Tree( 'G. Gorilla', None ) ), Edge( 0.083860000000000004, Tree( None, [Edge( 0.19267999999999999, Tree( 'P. paniscus', None ) ), Edge( 0.11927, Tree( 'H. sapiens', None ) )] ) )] ) )] ) )] ) ), Edge( 1.2145999999999999, Tree( 'Rodent', None ) )] ) ), + ( Tree( None, [Edge( None, Tree( 'B', None ) ), Edge( None, Tree( None, [Edge( None, Tree( 'A', None ) ), Edge( None, Tree( 'C', None ) ), Edge( None, Tree( 'E', None ) )] ) ), Edge( None, Tree( 'D', None ) )] ) ), + ( Tree( None, [Edge( None, Tree( None, None ) ), Edge( None, Tree( None, [Edge( None, Tree( None, None ) ), Edge( None, Tree( None, None ) ), Edge( None, Tree( None, None ) )] ) ), Edge( None, Tree( None, None ) )] ) ), + ( Tree( None, [Edge( None, Tree( 'A', None ) ), Edge( None, Tree( None, [Edge( None, Tree( 'B', None ) ), Edge( None, Tree( 'C', None ) )] ) ), Edge( None, Tree( 'D', None ) )] ) ), + ( Tree( None, [Edge( None, Tree( None, [Edge( None, Tree( 'A', None ) ), Edge( None, Tree( 'D', None ) )] ) ), Edge( None, Tree( None, [Edge( None, Tree( 'C', None ) ), Edge( None, Tree( 'B', None ) )] ) )] ) ), + ] + +def tests(): + for i in range(len(trees)): + def _( s, r ): + assert newick_parser.parse_string( s ) == r + _.description = "check tree parsing " + str(i) + yield _, trees[i], results[i] diff --git a/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast.py b/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast.py new file mode 100755 index 0000000..4ba3a0c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast.py @@ -0,0 +1,42 @@ +""" +Rudimentary support for PHAST's tree model file format (a simple format for +storing trees and rate matrices). +""" + +from numpy import * + +class TreeModel: + def __init__( self ): + self.alphabet = None + self.radix = 0 + self.order = 0 + self.subst_mod = None + self.background = None + self.tree = None + self.matrix = None + ## TODO: Need scipy for this method + ## def matrix_for_time( self, t ): + ## return expm( self.matrix * t ) + ## matrix_for_time = cachedmethod( matrix_for_time ) + @staticmethod + def from_file( f ): + input = iter( f ) + tm = TreeModel() + for line in input: + if line.startswith( "ALPHABET:" ): + tm.alphabet = tuple( line.split()[1:] ) + tm.radix = len( tm.alphabet ) + if line.startswith( "ORDER:" ): + tm.order = int( line.split()[1] ) + if line.startswith( "SUBST_MOD:" ): + tm.subst_mod = line[11:].rstrip() + if line.startswith( "BACKGROUND:" ): + tm.background = tuple( map( float, line.split()[1:] ) ) + if line.startswith( "TREE:" ): + tm.tree = line[6:].strip() + if line.startswith( "RATE_MAT:" ): + matrix = zeros( (tm.radix,tm.radix), float ) + for i in range( len( tm.alphabet ) ): + matrix[i] = map( float, input.next().split() ) + tm.matrix = matrix + return tm diff --git a/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast_tests.py new file mode 100755 index 0000000..2e60976 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/phylo/phast_tests.py @@ -0,0 +1,36 @@ +""" +Tests for `bx.phylo.phast`. +""" + +import unittest +from StringIO import StringIO +from bx.phylo.phast import TreeModel +from numpy import * + +test_data = """ALPHABET: A C G T - +ORDER: 0 +SUBST_MOD: HKY85+Gap +TRAINING_LNL: -178667772.836697 +BACKGROUND: 0.227006 0.169993 0.169307 0.227262 0.206432 +RATE_MAT: + -0.971735 0.122443 0.465361 0.163692 0.220238 + 0.163508 -1.130351 0.121949 0.624656 0.220238 + 0.623952 0.122443 -1.130326 0.163692 0.220238 + 0.163508 0.467247 0.121949 -0.972942 0.220238 + 0.242187 0.181362 0.180630 0.242461 -0.846640 +TREE: ((((((hg16:0.007738,panTro1:0.008356):0.027141,(baboon:0.009853,rheMac1:0.010187):0.035049):0.103138,galago:0.174770):0.019102,((rn3:0.092633,mm6:0.089667):0.273942,rabbit:0.230839):0.021927):0.023762,(canFam1:0.204637,(elephant:0.123777,tenrec:0.278910):0.085977):0.009439):0.306466,monDom1:0.401151)mammals; +""" + +def test_parser(): + tm = TreeModel.from_file( StringIO( test_data ) ) + assert tm.alphabet == ( 'A', 'C', 'G', 'T', '-' ) + assert tm.order == 0 + assert tm.subst_mod == "HKY85+Gap" + assert allclose( tm.background, [ 0.227006, 0.169993, 0.169307, 0.227262, 0.206432 ] ) + assert allclose( tm.matrix, array( + [ [ -0.971735, 0.122443, 0.465361, 0.163692, 0.220238 ], + [ 0.163508, -1.130351, 0.121949, 0.624656, 0.220238 ], + [ 0.623952, 0.122443, -1.130326, 0.163692, 0.220238 ], + [ 0.163508, 0.467247, 0.121949, -0.972942, 0.220238 ], + [ 0.242187, 0.181362, 0.180630, 0.242461, -0.846640 ] ] ) ) + assert tm.tree == "((((((hg16:0.007738,panTro1:0.008356):0.027141,(baboon:0.009853,rheMac1:0.010187):0.035049):0.103138,galago:0.174770):0.019102,((rn3:0.092633,mm6:0.089667):0.273942,rabbit:0.230839):0.021927):0.023762,(canFam1:0.204637,(elephant:0.123777,tenrec:0.278910):0.085977):0.009439):0.306466,monDom1:0.401151)mammals;" diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/__init__.py new file mode 100755 index 0000000..de97217 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/__init__.py @@ -0,0 +1,7 @@ +""" +Data structures and tools for working with Position Weight Matrices (PWMs). + +TODO: Some of the packages in this directory are actually command line +programs that provide no library functions and should be moved to the +scripts directory. +""" \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.c b/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.c new file mode 100755 index 0000000..447d0cc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.c @@ -0,0 +1,1429 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__pwm___position_weight_matrix +#define __PYX_HAVE_API__bx__pwm___position_weight_matrix +#include "pwm_utils.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_position_weight_matrix.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.pwm._position_weight_matrix' */ +#define __Pyx_MODULE_NAME "bx.pwm._position_weight_matrix" +int __pyx_module_is_main_bx__pwm___position_weight_matrix = 0; + +/* Implementation of 'bx.pwm._position_weight_matrix' */ +static char __pyx_k_1[] = "bx.pwm._position_weight_matrix"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__pattern[] = "pattern"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__sequence[] = "sequence"; +static char __pyx_k__c_match_consensus[] = "c_match_consensus"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__c_match_consensus; +static PyObject *__pyx_n_s__pattern; +static PyObject *__pyx_n_s__sequence; +static PyObject *__pyx_n_s__size; + +/* "bx/pwm/_position_weight_matrix.pyx":4 + * int pattern_match( char* string, char* pattern, int n) + * + * def c_match_consensus( sequence, pattern, size ): # <<<<<<<<<<<<<< + * return pattern_match( sequence, pattern, size ) + */ + +static PyObject *__pyx_pf_2bx_3pwm_23_position_weight_matrix_c_match_consensus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_2bx_3pwm_23_position_weight_matrix_c_match_consensus = {__Pyx_NAMESTR("c_match_consensus"), (PyCFunction)__pyx_pf_2bx_3pwm_23_position_weight_matrix_c_match_consensus, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_2bx_3pwm_23_position_weight_matrix_c_match_consensus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sequence = 0; + PyObject *__pyx_v_pattern = 0; + PyObject *__pyx_v_size = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char *__pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sequence,&__pyx_n_s__pattern,&__pyx_n_s__size,0}; + __Pyx_RefNannySetupContext("c_match_consensus"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sequence); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("c_match_consensus", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("c_match_consensus", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "c_match_consensus") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_sequence = values[0]; + __pyx_v_pattern = values[1]; + __pyx_v_size = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("c_match_consensus", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.pwm._position_weight_matrix.c_match_consensus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/pwm/_position_weight_matrix.pyx":5 + * + * def c_match_consensus( sequence, pattern, size ): + * return pattern_match( sequence, pattern, size ) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_AsString(__pyx_v_sequence); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_AsString(__pyx_v_pattern); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_size); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(pattern_match(__pyx_t_1, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.pwm._position_weight_matrix.c_match_consensus", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_position_weight_matrix"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__c_match_consensus, __pyx_k__c_match_consensus, sizeof(__pyx_k__c_match_consensus), 0, 0, 1, 1}, + {&__pyx_n_s__pattern, __pyx_k__pattern, sizeof(__pyx_k__pattern), 0, 0, 1, 1}, + {&__pyx_n_s__sequence, __pyx_k__sequence, sizeof(__pyx_k__sequence), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_position_weight_matrix(void); /*proto*/ +PyMODINIT_FUNC init_position_weight_matrix(void) +#else +PyMODINIT_FUNC PyInit__position_weight_matrix(void); /*proto*/ +PyMODINIT_FUNC PyInit__position_weight_matrix(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__position_weight_matrix(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_position_weight_matrix"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__pwm___position_weight_matrix) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/pwm/_position_weight_matrix.pyx":4 + * int pattern_match( char* string, char* pattern, int n) + * + * def c_match_consensus( sequence, pattern, size ): # <<<<<<<<<<<<<< + * return pattern_match( sequence, pattern, size ) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_3pwm_23_position_weight_matrix_c_match_consensus, NULL, __pyx_n_s_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__c_match_consensus, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/pwm/_position_weight_matrix.pyx":1 + * cdef extern from "pwm_utils.h": # <<<<<<<<<<<<<< + * int pattern_match( char* string, char* pattern, int n) + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.pwm._position_weight_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.pwm._position_weight_matrix"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.pyx b/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.pyx new file mode 100755 index 0000000..f743165 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/_position_weight_matrix.pyx @@ -0,0 +1,5 @@ +cdef extern from "pwm_utils.h": + int pattern_match( char* string, char* pattern, int n) + +def c_match_consensus( sequence, pattern, size ): + return pattern_match( sequence, pattern, size ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_pwm.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_pwm.py new file mode 100755 index 0000000..bdfe895 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_pwm.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python2.4 +""" +Returns all positions of a maf with any pwm score > threshold +The positions are projected onto human coordinates +""" + +import psyco_full +from bx.align import maf as align_maf +import position_weight_matrix as pwmx +from bx.pwm.pwm_score_maf import MafBlockScorer +import sys +from bx import intervals +import Numeric + +def isnan(x): + return not x==x + +def main(): + + if len(sys.argv) < 5: + print >>sys.stderr, "%s bedfile inmaf spec1,spec2,... motif_file " % sys.argv[0] + sys.exit(0) + + # read in intervals + regions = {} + for line in open( sys.argv[1] ): + if line.startswith('#'): continue + fields = line.strip().split() + chrom, start, end = fields[0], int( fields[1] ), int( fields[2] ) + try: + name = fields[3] + except: + name = None + if chrom not in regions: regions[chrom] = intervals.Intersecter() + regions[chrom].add( start, end, name ) + + pwm = {} + for wm in pwmx.Reader(open( sys.argv[4] )): + pwm[ wm.id] = wm + print >>sys.stderr, wm.id, len(wm) + + inmaf = open(sys.argv[2]) + threshold = 0.5 + + species = [] + + for sp in sys.argv[3].split(','): + species.append( sp ) + + for maf in align_maf.Reader(inmaf): + mafchrom = maf.components[0].src.split('.')[1] + mafstart = maf.components[0].start + mafend = maf.components[0].end + reftext = maf.components[0].text + + # maf block scores for each matrix + for scoremax,width,headers in MafBlockScorer(pwm,species, maf): + #print >>sys.stderr,headers + blocklength = width + mafsrc,mafstart,mafend = headers[0] + mafchrom = mafsrc.split('.')[1] + + # lists of scores for each position in scoremax + for mx_name,mx in scoremax.items(): + #print >>sys.stderr, mx_name, len(pwm[mx_name]) + + for offset in range(blocklength): + + # scan all species with threshold + for i in range(len(species)): + if mx[i][offset] > threshold: + refstart = mafstart + offset - reftext.count('-',0,offset) + refend = refstart + len(pwm[mx_name]) + + data = " ".join([ "%.2f" % mx[x][offset] for x in range(len(species))]) + # quote the motif + r = regions[mafchrom].find( refstart, refend ) + if mafchrom in regions and len( r ) > 0: + region_label = r[0].value + else: + #region_label = 0 + continue + v_name = mx_name.replace(' ','_') + print mafchrom,refstart,refend,region_label,v_name,data + break + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_string.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_string.py new file mode 100755 index 0000000..ef68a5c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/bed_score_aligned_string.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python2.4 +""" +Returns all positions of a maf with any pwm score > threshold +The positions are projected onto human coordinates +""" + +import psyco_full +from bx.align import maf as align_maf +import position_weight_matrix as pwmx +from bx.pwm.pwm_score_maf import MafMotifScorer +import sys +from bx import intervals +import Numeric + +def isnan(x): + return not x==x + +def main(): + + if len(sys.argv) < 5: + print >>sys.stderr, "%s bedfile inmaf spec1,spec2,... string [string2,...]" % sys.argv[0] + sys.exit(0) + + # read in intervals + regions = {} + for line in open( sys.argv[1] ): + if line.startswith('#'): continue + fields = line.strip().split() + chrom, start, end = fields[0], int( fields[1] ), int( fields[2] ) + try: + name = fields[3] + except: + name = None + if chrom not in regions: regions[chrom] = intervals.Intersecter() + regions[chrom].add( start, end, name ) + + motif_strings = sys.argv[4:] + if not isinstance(motif_strings, list): motif_strings = [motif_strings] + inmaf = open(sys.argv[2]) + threshold = 0.5 + + species = [] + + for sp in sys.argv[3].split(','): + species.append( sp ) + + for maf in align_maf.Reader(inmaf): + mafchrom = maf.components[0].src.split('.')[1] + mafstart = maf.components[0].start + mafend = maf.components[0].end + reftext = maf.components[0].text + r = regions[mafchrom].find( mafstart, mafend ) + if mafchrom not in regions or len( r ) == 0: continue + + # maf block scores for each matrix + for scoremax,width,headers in MafMotifScorer(species, maf, motif_strings): + #print >>sys.stderr,headers + blocklength = width + mafsrc,mafstart,mafend = headers[0] + mafchrom = mafsrc.split('.')[1] + + # lists of scores for each position in scoremax + for mx_name,mx in scoremax.items(): + #print >>sys.stderr, mx_name, len(pwm[mx_name]) + + for offset in range(blocklength): + + # scan all species with threshold + for i in range(len(species)): + if mx[i][offset] > threshold: + refstart = mafstart + offset - reftext.count('-',0,offset) + refend = refstart + len(mx_name) + + data = " ".join([ "%.2f" % mx[x][offset] for x in range(len(species))]) + # quote the motif + r = regions[mafchrom].find( refstart, refend ) + if mafchrom in regions and len( r ) > 0: + region_label = r[0].value + else: + #region_label = 0 + continue + v_name = mx_name.replace(' ','_') + print mafchrom,refstart,refend,region_label,v_name,data + break + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/maf_select_motifs.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/maf_select_motifs.py new file mode 100755 index 0000000..d45b53b --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/maf_select_motifs.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python2.4 +""" +Returns all positions of a maf with any pwm score > threshold +The positions are projected onto human coordinates +""" + +import psyco_full +from bx.align import maf as align_maf +import bx.pwm.position_weight_matrix as pwmx +from bx.pwm.pwm_score_maf import MafMotifSelect +import sys +from bx import intervals + +def isnan(x): + return not x==x + +def main(): + + if len(sys.argv) < 5: + print >>sys.stderr, "%s transfac|basic pwmfile inmaf threshold [motif]" % sys.argv[0] + sys.exit(2) + + r = pwmx.Reader(open(sys.argv[2]),format=sys.argv[1]) + pwm = iter(r).next() + inmaf = open(sys.argv[3]) + threshold = float(sys.argv[4]) + if len(sys.argv) > 5: motif = sys.argv[5] + else: motif = None + + for maf in align_maf.Reader(inmaf): + for mafmotif,pwm_score,motif_score in MafMotifSelect(maf, pwm, motif, threshold): + #mafwrite( mafmotif,pwm_score,motif_score) + print mafmotif, pwm_score, motif_score + print 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz' + +def mafwrite(alignment,kvec=None,jvec=None,file=sys.stdout): + file.write( "a score=" + str( alignment.score ) ) + for key in alignment.attributes: + file.write( " %s=%s" % ( key, alignment.attributes[key] ) ) + file.write( "\n" ) + rows = [] + if not kvec: kvec = [0 for c in alignment.components] + if not jvec: jvec = [0 for c in alignment.components] + for c,x,y in zip(alignment.components,kvec,jvec): + #for c in alignment.components: + rows.append( ( "s", c.src, str( c.start ), str( c.size ), c.strand, str( c.src_size ), c.text, "%.2f" % x, str(y) ) ) + #rows.append( ( "s", c.src, str( c.start ), str( c.size ), c.strand, str( c.src_size ), c.text ) ) + file.write( format_tabular( rows, "llrrrrrrr" ) ) + +def format_tabular( rows, align=None ): + if len( rows ) == 0: return "" + lengths = [ len( col ) for col in rows[ 0 ] ] + for row in rows[1:]: + for i in range( 0, len( row ) ): + lengths[ i ] = max( lengths[ i ], len( row[ i ] ) ) + rval = "" + for row in rows: + for i in range( 0, len( row ) ): + if align and align[ i ] == "l": + rval += row[ i ].ljust( lengths[ i ] ) + else: + rval += row[ i ].rjust( lengths[ i ] ) + rval += " " + rval += "\n" + return rval + + + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/position_weight_matrix.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/position_weight_matrix.py new file mode 100755 index 0000000..757bb8d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/position_weight_matrix.py @@ -0,0 +1,849 @@ +#!/usr/bin/env python + +import sys +import math +import string +from numpy import * +from sets import * + +# This is the average of all species in the alignment outside of exons +# > mean(r) +# A T C G +# 0.2863776 0.2878264 0.2129560 0.2128400 +# > sd(r) +# A T C G +# 0.01316192 0.01371148 0.01293836 0.01386655 + +ENCODE_NONCODING_BACKGROUND = { 'A':0.2863776,'T':0.2878264,'G':0.2128400,'C':0.2129560} + +class Align(object): + def __init__ (self, seqrows, headers=None): + self.rows = seqrows + self.nrows = len(seqrows) + ncol = None + for rownum,row in enumerate(self.rows): + try: + if ncol == None: ncol = len(row) + elif ncol != len(row): + raise "Align: __init__:alignment block:row %d does not have %d columns, it has %d" % (rownum,ncol,len(row)) + except: + print row + raise Exception('') + self.ncols = ncol + self.dims = (self.nrows,self.ncols) + self.headers = headers + def __str__ (self): + return "\n".join(self.rows) + +class AlignScoreMatrix (object): + def __init__(self,align): + nan = float('nan') + + matrix = zeros((align.nrows,align.ncols),float32) + + # set to nans + for ir in range( len(matrix) ): + for ic in range(len( matrix[ir] )): + matrix[ir][ic] = nan + self.matrix = matrix + + def __len__(self): + return shape(self.matrix)[1] + + def __str__(self): + print self.matrix + +def score_align_motif (align,motif,gapmask=None,byPosition=True): + + #dbg + #print >>sys.stderr, align.headers + chr,chr_start,chr_stop = align.headers[0] + + # a blank score matrix + nrows,ncols = align.dims + ascoremax = AlignScoreMatrix( align ) + scoremax = ascoremax.matrix + + minSeqLen = len( motif ) + for ir in range(nrows): + pass + + # row is missing data + if isnan(align.rows[ir][0]): continue + + for start in range(ncols): + + if align.rows[ir][start] == '-': continue + elif align.rows[ir][start] == 'n': continue + elif align.rows[ir][start] == 'N': continue + + # get enough sequence for the weight matrix + subseq = "" + end = 0 + ic = start + while len(subseq) < minSeqLen: + #for ic in range(start,ncols): + + if ic >= len(align.rows[ir]): break + char = align.rows[ir][ic].upper() + ic += 1 + if char == '-' or char == 'N': continue + else: subseq += char + + if len(subseq) == minSeqLen: + end = ic+1 + for_score = int( match_consensus(subseq,motif) ) + revseq = reverse_complement( subseq ) + rev_score = int( match_consensus(revseq,motif) ) + + score = max(for_score, rev_score) + #dbg + #if ir == 0: print >>sys.stderr, int(chr_start) + start - align.rows[ir].count('-',0,start), subseq, score + + # replace the alignment positions with the result + if byPosition: + scoremax[ir][start] = score + else: + # replace positions matching the width of the pwm + for i in range(start,end): + if isnan(scoremax[ir][i]): scoremax[ir][i] = score + elif score > scoremax[ir][i]: scoremax[ir][i] = score + #break + # mask gap characters + if gapmask == None: + gapmask = score_align_gaps(align) + putmask( scoremax, gapmask, float('nan') ) + return scoremax + +#----------- +# +# WeightMatrix-- +# A position weight matrix (PWM) representation of a motif. +# +#---------- +# construction arguments: +# id: id (name) of the motif +# rows: the matrix; each row is a hash from symbol to weight, with +# .. the weight in string form +# alphabet: symbols allowed +# background: hash from symbol to background probability of that symbol; if +# .. not specified, ENCODE_NONCODING_BACKGROUND is used +# internal fields: +# rows: the matrix; each row is a hash from symbol to log-odds score +# .. of that symbol for that row of the weight matrix +# counts: the matrix; count[row][sym] is the weight, as an integer +# probs: the matrix; probs[row][sym] is the weight, as an probability +#---------- + +class PositionWeightMatrix (object): + + complementMap = string.maketrans("ACGTacgt","TGCAtgca") + + # IUPAC-IUB + symbols = { + 'A':Set(['A']), + 'C':Set(['C']), + 'G':Set(['G']), + 'T':Set(['T']), + 'R':Set(['A','G']), + 'Y':Set(['C','T']), + 'M':Set(['A','C']), + 'K':Set(['G','T']), + 'S':Set(['G','C']), + 'W':Set(['A','T']), + 'H':Set(['A','C','T']), + 'B':Set(['G','T','C']), + 'V':Set(['G','C','A']), + 'D':Set(['G','T','A'])} + + def __init__ (self, id, rows, alphabet, background=None, score_correction=True): + + self.id = id + self.alphabet = alphabet + nsymbols = len(self.alphabet) + for i in range(len(self.alphabet)): + self.alphabet[ i ] = self.alphabet[ i ].upper() + if background != None: + self.background = background + else: + self.background = {} + sorted_alphabet = [] + sorted_alphabet[:] = self.alphabet[:] + sorted_alphabet.sort() + if ['A','C','G','T'] == sorted_alphabet: + self.background = ENCODE_NONCODING_BACKGROUND + else: + for x in self.alphabet: self.background[ x ] = float(1)/len(self.alphabet) + + if (score_correction == True): + self.score_correction = self.corrected_probability_score + else: + self.score_correction = self.simple_probability + + # partition counts from consensus symbol + # in order to properly handle scaling in the presense of non-integers, + # we prescan the matrix to figure out the largest scale factor, then go + # back through and scale 'em all (some rows may be integer counts, + # others may be probabilities) + + self.consensus = [] + scale = 1 + + for i in range(len(rows)): + + #try: + fields,consensus = rows[i][:nsymbols],rows[i][-1] + for x,count in enumerate(fields): + try: + (w,s) = self.parse_weight(count) + except ValueError: + raise "pwm row %s has bad weight %s" % (" ".join(fields),t) + + # replace row counts with (values,scale) + rows[i][x] = (w,s) + scale = max(s,scale) + + #except: + #print >>sys.stderr,rows + #raise ValueError + #raise ValueError, "pwm row %s has wrong field count" % " ".join(fields) + + self.consensus.append(consensus) + + + hashRows = [] + self.matrix_base_counts = {} # for pseudocounts + self.counts = [] # for scaled counts + self.probs = [] # for probabilities + + # scale counts to integers + for i in range(len(rows)): + hashRows.append(dict()) + for x,sym in enumerate(alphabet): + (w,s) = rows[i][x] + hashRows[i][sym] = w * scale/s + assert hashRows[i][sym] >= 0 + if sym not in self.matrix_base_counts: self.matrix_base_counts[sym] = 0 + self.matrix_base_counts[sym] += hashRows[i][sym] + self.counts.append( hashRows[i].copy() ) + self.probs.append( hashRows[i].copy() ) + totalWeight = float(sum(self.probs[i].values())) + for sym in self.probs[i]: + self.probs[i][sym] /= totalWeight + self.sites = sum ( hashRows[0].values() ) + + # scan pwm to pre-compute logs of probabilities and min and max log-odds + # scores (over the whole PWM) for scaling; note that the same min and max + # applies for scaling long-odds scores for quantum comparisions + self.information_content = [] + minSum = 0 + maxSum = 0 + + for i in range( len( hashRows )): + self.information_content.append( self.information_content_calculation( i, hashRows ) ) + newHashRow = {} + for base in self.alphabet: + newHashRow[base] = self.pwm_score(base, i, hashRows) + hashRows[i] = newHashRow + + minSum += min(hashRows[i].values()) + maxSum += max(hashRows[i].values()) + + self.minSum = minSum + self.maxSum = maxSum + self.rows = hashRows + + # Reference 1: Wasserman and Sandelin: Nat Rev Genet. 2004 Apr;5(4):276-87. + # Reference 2: Gertz et al.: Genome Res. 2005 Aug;15(8):1145-52. + def information_content_calculation(self, i, counts): + # Reference 1) + return 2 + sum( [ self.information_base_content(base,i,counts) for base in self.alphabet ] ) + + # Reference 2) + #return sum( [ self.information_base_content(base,i,counts) for base in self.alphabet ] ) + + def information_base_content(self, base, i, counts): + + # Reference 1) + #return self.score_correction(counts,base,i) * math.log ( self.score_correction(counts,base,i), 2) + + # Reference 2) + return self.score_correction(counts,base,i) * self.pwm_score(base, i, counts) + + def __call__ (self,seq): + return self.score_seq(seq) + + def __add__ (self,other): + + assert self.alphabet == other.alphabet + r,(p,q) = self.max_correlation(other) + + if p == q == 0: width = max( len(self),len(other) ) + elif p > 0: width = max( len(other)+p, len(self) ) + elif q > 0: width = max( len(self)+q, len(other) ) + + sumx = zeros( (width,len(self.alphabet)),dtype='int') + selfx = self.to_count_matrix() + otherx = other.to_count_matrix() + + if p == q == 0: + sumx[:len(self)] += selfx + sumx[:len(other)] += otherx + elif p > 0: + sumx[p:p+len(other)] += otherx + sumx[:len(self)] += selfx + else: + sumx[:len(other)] += otherx + sumx[q:q+len(self)] += selfx + + newRows = [] + for i,x in enumerate(sumx): + y = list(x) + y.append( consensus_symbol(y) ) + y = [ str(yi) for yi in y] + newRows.append( y ) + return PositionWeightMatrix(self.id+other.id,newRows,self.alphabet,self.background) + + def __old_add__ (self,other,maxp=None): + + assert self.alphabet == other.alphabet + bigN = max(len(self),len(other)) + smallN = min(len(self),len(other)) + if not maxp: + prsq = self.correlation(other) + maxp = prsq.index( max(prsq) ) + + leftpad = ' ' * maxp + rightsize = bigN - smallN + rightpad = ' ' * rightsize + leftStrings = [] + rightStrings = [] + + if len(self) > len(other): + larger = self + smaller = other + leftStrings = self.consensus + rightStrings = list(leftpad) + other.consensus + list(rightpad) + else: + smaller = self + larger = other + leftStrings = list(leftpad) + self.consensus + list(rightpad) + rightStrings = other.consensus + + sumx = zeros([bigN,len(self.alphabet)]) + sumx += larger.to_count_matrix() + sumx[maxp:maxp+smallN] += smaller.to_count_matrix() + + newRows = [] + for i,x in enumerate(sumx): + y = list(x) + y.append( leftStrings[i] + rightStrings[i] ) + y = [ str(yi) for yi in y] + newRows.append( y ) + + #return PositionWeightMatrix(self.id+other.id,newRows[maxp:maxp+smallN],self.alphabet,self.background) + return PositionWeightMatrix(self.id+other.id,newRows,self.alphabet,self.background) + + def to_matrix(self): + m = zeros([len(self),len(self.alphabet)]) + for i in range(len(self)): + for j,a in enumerate(self.alphabet): + m[i][j] = self[i][a] + return m + + def to_count_matrix(self): + m = zeros([len(self),len(self.alphabet)],dtype='int') + for i in range(len(self)): + for j,a in enumerate(self.alphabet): + m[i][j] = self.counts[i][a] + return m + + def max_correlation(self, otherwmx): + rsq,ixtuple = self.slide_correlation(otherwmx) + max_rsq = max(rsq) + maxp,maxq = ixtuple[rsq.index(max_rsq)] + return max_rsq,(maxp,maxq) + + def slide_correlation(self, other): + assert self.alphabet == other.alphabet + selfx = self.to_count_matrix() + otherx = other.to_count_matrix() + rsq = [] + ixtuple = [] + # self staggered over other, scan self backwards until flush + for q in range(len(other)-1,-1,-1): + r = 0 + n = 0 + for p in range(len(self)): + if q+p < len(other): + r += rsquared( list(selfx[p]), list(otherx[q+p]) ) + n += 1 + else: + n += 1 + rsq.append( r/n ) + ixtuple.append( (0,q) ) + # other staggered below self , scan other forward + for p in range(1,len(self)): + r = 0 + n = 0 + for q in range(len(other)): + if p+q < len(self): + r += rsquared( list(selfx[p+q]), list(otherx[q]) ) + n += 1 + else: + n += 1 + rsq.append( r/n ) + ixtuple.append( (p,0) ) + return rsq,ixtuple + + def correlation(self, otherwmx): + assert self.alphabet == otherwmx.alphabet + width = len(self.alphabet) + if len(self) > len(otherwmx): + larger = self.to_count_matrix() + smaller = otherwmx.to_count_matrix() + else: + smaller = self.to_count_matrix() + larger = otherwmx.to_count_matrix() + bigN = len(larger) + smallN = len(smaller) + position_rsq = [] + + # slide small over large, for ave rsq + for p in range(bigN): + if p+smallN <= bigN: + r = 0 + for q in range(smallN): + r += rsquared(list(smaller[q]),list(larger[p+q])) + position_rsq.append( r / smallN ) + return position_rsq + + def score_align (self,align,gapmask=None,byPosition=True): + + # a blank score matrix + nrows,ncols = align.dims + ascoremax = AlignScoreMatrix( align ) + scoremax = ascoremax.matrix + + minSeqLen = len( self ) + for ir in range(nrows): + + # row is missing data + if isnan(align.rows[ir][0]): continue + + for start in range(ncols): + if align.rows[ir][start] == '-': continue + elif align.rows[ir][start] == 'n': continue + elif align.rows[ir][start] == 'N': continue + + # get enough sequence for the weight matrix + subseq = "" + end = 0 + for ic in range(start,ncols): + + char = align.rows[ir][ic] + if char == '-' or char == 'N': continue + else: subseq += char + + if len(subseq) == minSeqLen: + end = ic+1 + + #forward + scores = self.score_seq( subseq ) + raw,forward_score = scores[0] + #reverse + scores = self.score_reverse_seq( subseq ) + raw,reverse_score = scores[0] + + score = max(forward_score, reverse_score) + + # replace the alignment positions with the result + if byPosition: + scoremax[ir][start] = score + else: + # replace positions matching the width of the pwm + for i in range(start,end): + if isnan(scoremax[ir][i]): scoremax[ir][i] = score + elif score > scoremax[ir][i]: scoremax[ir][i] = score + # mask gap characters + if gapmask == None: + gapmask = score_align_gaps(align) + putmask( scoremax, gapmask, float('nan') ) + return scoremax + + # seq can be a string, a list of characters, or a quantum sequence (a list + # of hashes from symbols to probability) + + def score_seq(self,seq): + if (type(seq[0]) == dict): + return self.score_quantum_seq(seq) + + scores = [] + for start in range( len(seq)): + if start + len(self) > len(seq): break + subseq = seq[ start:start+len(self) ] + raw = 0 + try: + for i,nt in enumerate(subseq): raw += self.rows[i][nt.upper()] + scaled = self.scaled( raw ) + except KeyError: + raw,scaled = float('nan'),float('nan') + scores.append( (raw, scaled) ) + return scores + + def score_quantum_seq(self,seq): + scores = [] + for start in range(len(seq)): + if (start + len(self) > len(seq)): break + subseq = seq[start:start+len(self)] + raw = 0 + try: + for i,nt in enumerate(subseq): + numer = sum([subseq[i][nt] * self.probs[i][nt] for nt in subseq[i]]) + denom = sum([subseq[i][nt] * self.background[nt] for nt in subseq[i]]) + raw += math.log(numer/denom,2) + scaled = self.scaled(raw) + except KeyError: + raw,scaled = float('nan'),float('nan') + except OverflowError,e: + raw,scaled = float('nan'),float('nan') + except ValueError,e: + raw,scaled = float('nan'),float('nan') + scores.append((raw,scaled)) + return scores + + def score_reverse_seq(self,seq): + revSeq = reverse_complement( seq ) + scores = self.score_seq( revSeq ) + scores.reverse() + return scores + + def scaled(self,val): + return ( val - self.minSum ) / (self.maxSum - self.minSum) + + def pseudocount(self, base=None): + f = lambda count: math.sqrt( count + 1 ) + if base in self.alphabet: + return f( self.matrix_base_counts[base] ) + elif base == None: + return f ( self.sites ) + else: + return float("nan") + + def simple_probability (self,freq, base, i): + # p(base,i) = f(base,i) + # ---------------------- + # sum(f(base,{A,C,G,T})) + + return float( freq[i][base] ) / sum([freq[i][nt] for nt in self.alphabet]) + + def corrected_probability_score (self,freq, base, i): + # p(base,i) = f(base,i) + s(base) + # -------------------- + # N + sum(s(A,C,T,G)) + + f = float( freq[i][base] ) + s = self.pseudocount(base) + N = self.sites + #print >>sys.stderr, "f:%.3f + s:%.3f = %.3f" % (f,s,f + s) + #print >>sys.stderr, "-------------------------" + #print >>sys.stderr, "N:%d + %d = %d" % (N,self.pseudocount(), N + self.pseudocount()) + #print >>sys.stderr, "\t\t %.3f\n" % ((f + s) / (N + self.pseudocount())) + + assert (f + s) > 0 + return (f + s) / (N + self.pseudocount()) + + def pwm_score (self,base,i,freq,background=None): + if background == None: background = self.background + p = self.score_correction(freq,base,i) + #print >>sys.stderr, p + #print >>sys.stderr, "k %d %c" % (i,base),freq[i][base] + b = background[ base ] + try: + return math.log( p/b, 2) + except OverflowError,e: + ## print >>sys.stderr,"base=%c, math.log(%.3f / %.3f)" % (base,p,b) + ## print >>sys.stderr,self.id + return float('nan') + except ValueError,e: + ## print >>sys.stderr,"base=%c, math.log(%.3f / %.3f)" % (base,p,b) + ## print >>sys.stderr,self.id + return float('nan') + + def parse_weight (self, weightString): + + fields = weightString.split(".") + if (len(fields) > 2): raise ValueError + + w = int(fields[0]) + s = 1 + + if (len(fields) == 2): + for cnt in range(0,len(fields[1])): s *= 10 + w = s*w + int(fields[1]) + + return (w,s) # w = the weight + # s = the scale used (a power of 10) + + def __str__ (self): + lines = [self.id] + headers = ["%s" % nt for nt in self.alphabet] + lines.append("P0\t" + "\t".join(headers)) + for ix in range(0,len(self.rows)): + weights = ["%d" % self.counts[ix][nt] for nt in self.alphabet] + #lines.append(("%02d\t" % ix) + "\t".join(weights) + "\t" + self.consensus[ix]) + lines.append(("%02d\t" % ix) + "\t".join(weights) + "\t" + str(sum(self.counts[ix].values())) + "\t" + self.consensus[ix]) + + return "\n".join(lines) + + def __getitem__ (self,key): + return self.rows[key] + + def __setitem__ (self,key,value): + self.rows[key] = value + + def __len__ (self): + return len( self.rows ) + +def score_align_gaps (align): + # a blank score matrix + nrows,ncols = align.dims + scoremax = AlignScoreMatrix( align ).matrix + for ir in range(nrows): + # row is missing data + if isnan(align.rows[ir][0]): continue + # scan for gaps + for pos in range(ncols): + if align.rows[ir][pos] == '-': scoremax[ir][pos] = 1 + else: scoremax[ir][pos] = 0 + return scoremax + +#----------- +# +# WeightMatrix Reader-- +# Read position weight matrices (PWM) from a file. +# +#----------- + +class Reader (object): + """Iterate over all interesting weight matrices in a file""" + + def __init__ (self,file,tfIds=None,name=None,format='basic',background=None,score_correction=True): + self.tfIds = tfIds + self.file = file + self.name = name + self.lineNumber = 0 + self.format = format + self.background = background + self.score_correction = score_correction + + + def close (self): + self.file.close() + + + def where (self): + if (self.name == None): + return "line %d" % self.lineNumber + else: + return "line %d in %s" % (self.lineNumber,self.name) + + + def __iter__ (self): + if self.format == 'basic': + return self.read_as_basic() + elif self.format == 'transfac': + return self.read_as_transfac() + else: + raise "unknown weight matrix file format: '%s'" % self.format + + def read_as_basic(self): + tfId = None + pwmRows = None + + alphabet = ['A','C','G','T'] + while (True): + line = self.file.readline() + if (not line): break + line = line.strip() + self.lineNumber += 1 + if line.startswith(">"): + if pwmRows != None: + yield PositionWeightMatrix(tfId,pwmRows,alphabet,background=self.background) + #try: + #yield PositionWeightMatrix(tfId,pwmRows,alphabet) + #except: + #print >>sys.stderr, "Failed to read", tfId + tfId = line.strip()[1:] + pwmRows = [] + elif line[0].isdigit(): + tokens = line.strip().split() + tokens.append( consensus_symbol(line) ) + vals = [float(v) for v in tokens[:-1]] + #print >>sys.stderr,[ "%.2f" % (float(v)/sum(vals)) for v in vals], tokens[-1] + pwmRows.append( tokens ) + if pwmRows != None: # we've finished collecting a desired matrix + yield PositionWeightMatrix(tfId,pwmRows,alphabet,background=self.background,score_correction=self.score_correction) + + def read_as_transfac(self): + self.tfToPwm = {} + tfId = None + pwmRows = None + + while (True): + line = self.file.readline() + if (not line): break + line = line.strip() + self.lineNumber += 1 + # handle an ID line + if line.startswith("ID"): + if pwmRows != None: # we've finished collecting a desired matrix + try: + yield PositionWeightMatrix(tfId,pwmRows,alphabet,background=self.background,score_correction=self.score_correction) + except: + print >>sys.stderr, "Failed to read", tfId + tfId = None + pwmRows = None + + tokens = line.split (None, 2) + if len(tokens) != 2: + raise ValueError, "bad line, need two fields (%s)" % self.where() + tfId = tokens[1] + if self.tfIds != None and (not tfId in self.tfIds): + continue # ignore it, this isn't a desired matrix + if tfId in self.tfToPwm: + raise ValueError, "transcription factor %s appears twice (%s)" \ + % (tfId,self.where()) + pwmRows = [] # start collecting a desired matrix + continue + + # if we're not collecting, skip this line + if pwmRows == None: continue + if len(line) < 1: continue + + # name, if present, added to ID + if line.startswith('NA'): + words = line.strip().split() + tfId = tfId + "\t" + " ".join(words[1:]) + + # handle a P0 line + if line.startswith("P0"): + alphabet = line.split()[1:] + if len(alphabet) < 2: + raise ValueError, "bad line, need more dna (%s)" % self.where() + continue + + # handle a 01,02,etc. line + if line[0].isdigit(): + tokens = line.split () + try: + index = int(tokens[0]) + if index != len(pwmRows)+1: raise ValueError + except: + raise ValueError,"bad line, bad index (%s)" % self.where() + pwmRows.append(tokens[1:]) + continue + # skip low quality entries + if line.startswith("CC TRANSFAC Sites of quality"): + print >>sys.stderr, line.strip(), tfId + pwmRows = None + continue + if pwmRows != None: # we've finished collecting a desired matrix + yield PositionWeightMatrix(tfId,pwmRows,alphabet,background=self.background,score_correction=self.score_correction) + # clean up + self.tfToPwm = None + +def isnan(x): + #return ieeespecial.isnan(x) + if x==x: return False + return True + +def reverse_complement (nukes): + return nukes[::-1].translate(PositionWeightMatrix.complementMap) + +def rsquared( x, y ): + try: + return sum_of_squares(x,y)**2 / (sum_of_squares(x) * sum_of_squares(y)) + except ZeroDivisionError: + #return float('nan') + return 0 + +def sum_of_squares( x,y=None ): + if not y: y = x + xmean = float(sum( x )) / len( x ) + ymean = float(sum( y )) / len( y ) + assert len(x) == len(y) + return sum([ float(xi)*float(yi) for xi,yi in zip(x,y)]) - len(x)*xmean*ymean + +def match_consensus(sequence,pattern): + + return c_match_consensus( sequence, pattern, len(sequence)) + + #for s,p in zip(sequence,pattern): + #if p == 'N': continue + #if not s in PositionWeightMatrix.symbols[p]: return False + + #return True + +def consensus_symbol( pattern ): + + if type(pattern)==type(""): + try: + pattern = [int(x) for x in pattern.split()] + except ValueError,e: + print >>sys.stderr, pattern + raise ValueError,e + + # IUPAC-IUB nomenclature for wobblers + wobblers = { + 'R':Set(['A','G']), + 'Y':Set(['C','T']), + 'M':Set(['A','C']), + 'K':Set(['G','T']), + 'S':Set(['G','C']), + 'W':Set(['A','T']), + 'H':Set(['A','C','T']), + 'B':Set(['G','T','C']), + 'V':Set(['G','C','A']), + 'D':Set(['G','T','A'])} + + symbols = ['A','C','G','T'] + + if type(pattern)==type({}): + pattern = [pattern[u] for u in symbols] + + total = sum(pattern) + f = [ (space/1e5)+(float(x)/total) for space,x in enumerate(pattern) ] + copy = [] + copy[:] = f[:] + copy.sort() + + # http://www.genomatix.de/online_help/help_matinspector/matrix_help.html -- + # url says consensus must be greater than 50%, and at least twice the freq + # of the second-most frequent. A double-degenerate symbol can be used + # if the top two account for 75% or more of the nt, if each is less than 50% + # Otherwise, N is used in the consensus. + tops = copy[-2:] + if tops[1] > 0.5 and tops[1] >= 2 * tops[0]: return symbols[f.index(tops[1])] + elif tops[0] < 0.5 and sum(tops) >= 0.75: + degen = Set([ symbols[f.index(v)] for v in tops ]) + for degenSymbol,wobbles in wobblers.items(): + #print >>sys.stderr,wobbles + if degen == wobbles: + return degenSymbol + else: return 'N' + print >>sys.stderr,pattern + raise Exception('?') + +# import C extensions +try: + from _position_weight_matrix import c_match_consensus + ## print >>sys.stderr, "C match_consensus used" +except: + ## print >>sys.stderr, "python match_consensus used" + def match_consensus(sequence, pattern, size): + for s,p in zip(sequence,pattern): + if p == 'N': continue + if not s in PositionWeightMatrix.symbols[p]: return False + + return True diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_maf.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_maf.py new file mode 100755 index 0000000..6ed91f1 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_maf.py @@ -0,0 +1,218 @@ +#!/usr/bin/python2.4 +import sys,os +from bx.align import maf as align_maf +import bx.pwm.position_weight_matrix as pwmx + +def isnan(x): + #return ieeespecial.isnan(x) + if x==x: return False + return True + +NaN = float('nan') +#NaN = ieeespecial.nan +#Inf = ieeespecial.plus_inf +#NInf = ieeespecial.minus_inf + +def main(): + + pwm_file = sys.argv[1] + splist = sys.argv[2] + if len(sys.argv) ==4: + inmaf = open(sys.argv[3]) + else: + inmaf = sys.stdin + + # read alignment species + species = [] + for sp in splist.split(','): + species.append( sp ) + + # read weight matrices + pwm = {} + for wm in pwmx.Reader(open( pwm_file ), format='basic'): + pwm[ wm.id ] = wm + + fbunch = {} + for scoremax,index,headers in MafScorer(pwm, species, inmaf): + #print >>sys.stderr, index + for k,matrix in scoremax.items(): + fname = k + '.mx' + if fname not in fbunch: + fbunch[fname] = open(fname,'w') + print >>sys.stderr,"Writing",fname + + for i in range( len(matrix)): + for j in range( len(matrix[i])): + print >>fbunch[fname], "%.2f" % matrix[i][j], + print >>fbunch[fname] + + for file in fbunch.values(): + file.close() + +def MafScorer(pwm,species,inmaf): + + index = 0 + scoremax,width = None,None + for maf in align_maf.Reader( inmaf ): + #try: + if True: + val = MafBlockScorer(pwm,species,maf) + for scoremax,width,headers in val: yield scoremax,index,headers + #scoremax,width,headers = MafBlockScorer(pwm,species,maf) + try: pass + except: + print >>sys.stderr, "Failed on:" + syserr = align_maf.Writer( sys.stderr ) + syserr.write( maf ) + #print >>sys.stderr,headers + if width: print >>sys.stderr,width + if scoremax: print >>sys.stderr,len(scoremax) + syserr.close() + sys.exit(1) + index += width + yield scoremax,index,headers + +def MafMotifSelect(mafblock,pwm,motif=None,threshold=0): + + if motif != None and len(motif) != len(pwm): + raise Exception("pwm and motif must be the same length") + # generic alignment + alignlist = [ c.text for c in mafblock.components ] + align = pwmx.Align( alignlist ) + nrows,ncols = align.dims + #chr,chr_start,chr_stop = align.headers[0] + # required sequence length + minSeqLen = len( motif ) + # record the text sizes from the alignment rows + align_match_lens = [] + + for start in range(ncols - minSeqLen): + if align.rows[0][start] == '-': continue + subseq = "" + pwm_score_vec = [] + motif_score_vec = [] + max_cols = 0 + for ir in range(nrows): + expanded = align.rows[ir].count( '-', start, minSeqLen) + subtext = align.rows[ir][ start : minSeqLen+expanded ] + max_cols = max( len(subtext), max_cols ) + subseq = subtext.replace('-','') + revseq = pwmx.reverse_complement(subseq) + # pwm score + nill,f_score = pwm.score_seq( subseq )[0] + r_score, nill = pwm.score_seq( revseq )[0] + pwm_score_vec.append( max(f_score, r_score) ) + # consensus score + if motif is not None: + for_score = int( pwmx.match_consensus(subseq,motif) ) + rev_score = int( pwmx.match_consensus(revseq,motif) ) + motif_score_vec.append( max(for_score, rev_score) ) + #check threshold + try: + assert not isnan(max(pwm_score_vec) ) + assert not isnan(max(motif_score_vec) ) + except: + print >>sys.stderr, pwm_score_vec, motif_score_vec + print >>sys.stderr, len(subseq), len(pwm) + if max(pwm_score_vec) < threshold: continue + if max(motif_score_vec) < threshold: continue + # chop block + col_start = start + col_end = max_cols + 1 + motifmaf = mafblock.slice( col_start, col_end ) + yield motifmaf, pwm_score_vec, motif_score_vec + + """ + for ir in range(nrows): + # scan alignment row for motif subsequences + for start in range(ncols): + if align.rows[ir][start] == '-': continue + elif align.rows[ir][start] == 'n': continue + elif align.rows[ir][start] == 'N': continue + # gather enough subseq for motif + for ic in range(start,ncols): + char = align.rows[ir][ic].upper() + if char == '-' or char == 'N': continue + else: subseq += char + if len(subseq) == minSeqLen: + revseq = pwmx.reverse_complement( subseq ) + align_match_lens.append( ic ) + # pwm score + nill,f_score = pwm.score_seq( subseq )[0] + r_score, nill = pwm.score_seq( revseq )[0] + pwm_score_vec.append( max(f_score, r_score) ) + # consensus score + if motif is not None: + for_score = int( pwmx.match_consensus(subseq,motif) ) + rev_score = int( pwmx.match_consensus(revseq,motif) ) + motif_score_vec.append( max(for_score, rev_score) ) + #check threshold + try: + assert not isnan(max(pwm_score_vec) ) + assert not isnan(max(motif_score_vec) ) + except: + print >>sys.stderr, pwm_score_vec, motif_score_vec + print >>sys.stderr, len(subseq), len(pwm) + if max(pwm_score_vec) < threshold: continue + if max(motif_score_vec) < threshold: continue + # chop block + col_start = start + col_end = max( align_match_lens ) + 1 + motifmaf = mafblock.slice( col_start, col_end ) + + print subseq,revseq,ic + print align_match_lens + yield motifmaf, pwm_score_vec, motif_score_vec + """ + +def MafBlockScorer(pwm,species,maf): + width = len(maf.components[0].text) + headers = [ (c.src,c.start,c.end) for c in maf.components] + + # expand block rows to full + mafBlockSpecies = [specName.src.split('.')[0] for specName in maf.components] + alignlist = [] + for sp in species: + try: + i = mafBlockSpecies.index( sp ) + alignlist.append( maf.components[i].text ) + except ValueError: + alignlist.append( [ NaN for n in range( width ) ] ) + alignrows = pwmx.Align( alignlist ) + scoremax = {} + # record gap positions + filter = pwmx.score_align_gaps( alignrows ) + # score pwm models + for model in pwm.keys(): + #print >>sys.stderr,"%s_%d_%d" % headers[0],width,model + scoremax[model] = pwm[model].score_align( alignrows, filter ) + yield scoremax,width,headers + +def MafMotifScorer(species,maf,motifs): + width = len(maf.components[0].text) + headers = [ (c.src,c.start,c.end) for c in maf.components] + + # expand block rows to full + mafBlockSpecies = [specName.src.split('.')[0] for specName in maf.components] + alignlist = [] + for sp in species: + try: + i = mafBlockSpecies.index( sp ) + alignlist.append( maf.components[i].text ) + except ValueError: + alignlist.append( [ NaN for n in range( width ) ] ) + + alignrows = pwmx.Align( alignlist, headers ) + # record gap positions + filter = pwmx.score_align_gaps( alignrows ) + # score motif + #print >>sys.stderr, headers + if isinstance( motifs, list): + scoremax = {} + for string in motifs: + scoremax[string] = pwmx.score_align_motif( alignrows, string, filter ) + else: + scoremax = pwmx.score_align_motif( alignrows, motif, filter ) + yield scoremax,width,headers + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_motifs.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_motifs.py new file mode 100755 index 0000000..f88de4d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_motifs.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python2.4 +""" +Returns all positions of a maf with any pwm score > threshold +The positions are projected onto human coordinates +""" + +import psyco_full +from bx.align import maf as align_maf +import position_weight_matrix as pwmx +from bx.pwm.pwm_score_maf import MafMotifScorer +import sys +from bx import intervals + +def isnan(x): + return not x==x + +def main(): + + if len(sys.argv) < 4: + print >>sys.stderr, "%s motif inmaf spec1,spec2,... " % sys.argv[0] + sys.exit(0) + + targmotif = sys.argv[1] + inmaf = open(sys.argv[2]) + threshold = 0 + + species = [] + + for sp in sys.argv[3].split(','): + species.append( sp ) + + for maf in align_maf.Reader(inmaf): + mafchrom = maf.components[0].src.split('.')[1] + mafstart = maf.components[0].start + mafend = maf.components[0].end + reftext = maf.components[0].text + + # maf block scores for each matrix + for scoremax,width,headers in MafMotifScorer(species, maf,targmotif): + #print >>sys.stderr,headers + blocklength = width + mafsrc,mafstart,mafend = headers[0] + mafchrom = mafsrc.split('.')[1] + + # lists of scores for each position in scoremax + mx = scoremax + for offset in range(blocklength): + + # scan all species with threshold + for i in range(len(species)): + if mx[i][offset] > threshold: + refstart = mafstart + offset - reftext.count('-',0,offset) + refend = refstart + len( targmotif ) + data = " ".join([ "%.2f" % mx[x][offset] for x in range(len(species))]) + # quote the motif + print mafchrom,refstart,refend,"'"+targmotif+"'",data + break + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_positions.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_positions.py new file mode 100755 index 0000000..c2a796e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_score_positions.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python2.4 +""" +Returns all positions of a maf with any pwm score > threshold +The positions are projected onto human coordinates +""" + +import psyco_full +from bx.align import maf as align_maf +import bx.pwm.position_weight_matrix as pwmx +from bx.pwm.pwm_score_maf import MafBlockScorer +import sys +from bx import intervals + +def isnan(x): + return not x==x + +def main(): + + if len(sys.argv) < 6: + print >>sys.stderr, "%s transfac|basic pwmfile inmaf threshold spec1,spec2,... " % sys.argv[0] + sys.exit(0) + + pwm = {} + format = sys.argv[1] + for wm in pwmx.Reader(open(sys.argv[2]),format=format): + pwm[ wm.id ] = wm + + + inmaf = open(sys.argv[3]) + threshold = float(sys.argv[4]) + + species = [] + + for sp in sys.argv[5].split(','): + species.append( sp ) + + for maf in align_maf.Reader(inmaf): + mafchrom = maf.components[0].src.split('.')[1] + mafstart = maf.components[0].start + mafend = maf.components[0].end + reftext = maf.components[0].text + + # maf block scores for each matrix + for scoremax,width,headers in MafBlockScorer(pwm, species, maf): + blocklength = width + mafsrc,mafstart,mafend = headers[0] + mafchrom = mafsrc.split('.')[1] + + # lists of scores for each position in scoremax + for id,mx in scoremax.items(): + for offset in range(blocklength): + + # scan all species with threshold + for i in range(len(species)): + if mx[i][offset] > threshold: + refstart = mafstart + offset - reftext.count('-',0,offset) + refend = refstart + len(pwm[id]) + data = " ".join([ "%.2f" % mx[x][offset] for x in range(len(species))]) + # underscore spaces in the name + print mafchrom,refstart,refend,id.replace(' ','_'),data + break + +if __name__ == '__main__': main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_tests.py new file mode 100755 index 0000000..5adf338 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/pwm/pwm_tests.py @@ -0,0 +1,97 @@ +import unittest +import sys +import bx.pwm.position_weight_matrix as pwm +from StringIO import StringIO + +basicPwm = \ +""">MA0101 c-REL REL +0 5 8 4 +0 1 15 1 +1 0 15 1 +5 1 9 2 +6 5 3 3 +5 1 1 10 +1 0 0 16 +2 0 0 15 +0 15 0 2 +1 16 0 0 +""" + +transfacPwm = \ +"""ID TATA +XX +P0 A C G T +01 33 73 78 16 S +02 10 24 11 155 T +03 176 3 2 19 A +04 2 7 3 188 T +05 178 2 3 17 A +06 133 2 2 63 A +07 183 3 10 4 A +08 112 2 24 62 W +09 78 26 80 16 R +10 29 72 75 24 N +11 42 74 68 16 N +12 42 65 66 27 N +13 41 60 67 32 N +14 35 54 72 39 N +15 40 51 73 36 N +XX +""" + +background = { 'A':.28,'C':.21, 'G':.24, 'T':.27 } + +dSeq = "ACCGAGTTAGCGTAAA" +dScoresExpected = "-15.3697 0.4240 -16.5309 0.4027" + +qSeq = [{'A':0.27,'C':0.34,'G':0.07,'T':0.32}, + {'A':0.24,'C':0.32,'G':0.09,'T':0.35}, + {'A':0.80,'C':0.11,'G':0.03,'T':0.06}, + {'A':0.07,'C':0.22,'G':0.37,'T':0.34}, + {'A':0.07,'C':0.44,'G':0.03,'T':0.46}, + {'A':0.43,'C':0.04,'G':0.18,'T':0.35}, + {'A':0.84,'C':0.14,'G':0.01,'T':0.01}, + {'A':0.31,'C':0.52,'G':0.13,'T':0.04}, + {'A':0.22,'C':0.22,'G':0.45,'T':0.11}, + {'A':0.36,'C':0.15,'G':0.42,'T':0.07}, + {'A':0.11,'C':0.78,'G':0.07,'T':0.04}, + {'A':0.07,'C':0.16,'G':0.64,'T':0.13}, + {'A':0.34,'C':0.59,'G':0.03,'T':0.04}, + {'A':0.32,'C':0.15,'G':0.07,'T':0.46}, + {'A':0.07,'C':0.03,'G':0.59,'T':0.31}] + +qScoresExpected = "4.1106 0.7810" + +class PWMTestCase (unittest.TestCase): + + def testReader(self): + + # test basic format: i.e. for jaspar + wms = [wm for wm in pwm.Reader(StringIO(basicPwm),format="basic", \ + background=background,score_correction=False)] + assert len(wms) == 1 + + # test transfac format + wms = [wm for wm in pwm.Reader(StringIO(transfacPwm),format="transfac", \ + background=background,score_correction=False)] + assert len(wms) == 1 + + wm = wms[0] + dScores = wm.score_seq(dSeq) + assert len(dScores) == 2 + assert "%.4f %.4f %.4f %.4f" % (dScores[0][0],dScores[0][1],dScores[1][0],dScores[1][1]) == dScoresExpected + + qdSeq = [] + for (ix,nt) in enumerate(dSeq): + qdSeq.append(dict()) + qdSeq[ix][nt] = 1.0 + qScores = wm.score_seq(qdSeq) + assert len(qScores) == 2 + assert "%.4f %.4f %.4f %.4f" % (qScores[0][0],qScores[0][1],qScores[1][0],qScores[1][1]) == dScoresExpected + + qScores = wm.score_seq(qSeq) + assert len(qScores) == 1 + assert "%.4f %.4f" % (qScores[0][0],qScores[0][1]) == qScoresExpected + +test_classes = [PWMTestCase] +suite = unittest.TestSuite ([unittest.makeSuite (c) for c in test_classes]) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/__init__.py new file mode 100755 index 0000000..4eb406d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/__init__.py @@ -0,0 +1,7 @@ +""" +Classes for dealing with biological sequences. See `core` for the abstract +sequence classes and `nib` and `qdna` for specifics of various +formats. +""" + +from bx.seq.core import * diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.c b/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.c new file mode 100755 index 0000000..7e140f4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.c @@ -0,0 +1,1681 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__seq___nib +#define __PYX_HAVE_API__bx__seq___nib +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_nib.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.seq._nib' */ +static char *__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST; +static char *__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND; +#define __Pyx_MODULE_NAME "bx.seq._nib" +int __pyx_module_is_main_bx__seq___nib = 0; + +/* Implementation of 'bx.seq._nib' */ +static char __pyx_k_1[] = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; +static char __pyx_k_2[] = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx"; +static char __pyx_k_3[] = "bx.seq._nib"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__length[] = "length"; +static char __pyx_k__struct[] = "struct"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__translate_raw_data[] = "translate_raw_data"; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__length; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__struct; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__translate_raw_data; + +/* "bx/seq/_nib.pyx":15 + * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" + * + * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<< + * """ + * Data is a block read from the file that needs to be unpacked, dealing + */ + +static PyObject *__pyx_pf_2bx_3seq_4_nib_translate_raw_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3seq_4_nib_translate_raw_data[] = "\n Data is a block read from the file that needs to be unpacked, dealing\n with end conditions based on start/length.\n "; +static PyMethodDef __pyx_mdef_2bx_3seq_4_nib_translate_raw_data = {__Pyx_NAMESTR("translate_raw_data"), (PyCFunction)__pyx_pf_2bx_3seq_4_nib_translate_raw_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3seq_4_nib_translate_raw_data)}; +static PyObject *__pyx_pf_2bx_3seq_4_nib_translate_raw_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_data = 0; + int __pyx_v_start; + int __pyx_v_length; + int __pyx_v_i; + int __pyx_v_j; + char *__pyx_v_p_rval; + unsigned char *__pyx_v_p_data; + PyObject *__pyx_v_rval = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + long __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__start,&__pyx_n_s__length,0}; + __Pyx_RefNannySetupContext("translate_raw_data"); + __pyx_self = __pyx_self; + { + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "translate_raw_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_data = values[0]; + __pyx_v_start = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_length = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("translate_raw_data", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.seq._nib.translate_raw_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/seq/_nib.pyx":24 + * cdef unsigned char * p_data + * # Allocate string to write into + * rval = PyString_FromStringAndSize( NULL, length ) # <<<<<<<<<<<<<< + * # Get char pointer access to strings + * p_rval = PyString_AsString( rval ) + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, __pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_rval = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/seq/_nib.pyx":26 + * rval = PyString_FromStringAndSize( NULL, length ) + * # Get char pointer access to strings + * p_rval = PyString_AsString( rval ) # <<<<<<<<<<<<<< + * p_data = PyString_AsString( data ) + * i = 0 + */ + __pyx_v_p_rval = PyString_AsString(__pyx_v_rval); + + /* "bx/seq/_nib.pyx":27 + * # Get char pointer access to strings + * p_rval = PyString_AsString( rval ) + * p_data = PyString_AsString( data ) # <<<<<<<<<<<<<< + * i = 0 + * # Odd start + */ + __pyx_v_p_data = ((unsigned char *)PyString_AsString(__pyx_v_data)); + + /* "bx/seq/_nib.pyx":28 + * p_rval = PyString_AsString( rval ) + * p_data = PyString_AsString( data ) + * i = 0 # <<<<<<<<<<<<<< + * # Odd start + * if start & 1: + */ + __pyx_v_i = 0; + + /* "bx/seq/_nib.pyx":30 + * i = 0 + * # Odd start + * if start & 1: # <<<<<<<<<<<<<< + * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ] + * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + */ + __pyx_t_2 = (__pyx_v_start & 1); + if (__pyx_t_2) { + + /* "bx/seq/_nib.pyx":32 + * if start & 1: + * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ] + * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] # <<<<<<<<<<<<<< + * p_data = p_data + 1 + * i = 1 + */ + (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND[(__pyx_v_p_data[0])]); + + /* "bx/seq/_nib.pyx":33 + * #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ] + * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + * p_data = p_data + 1 # <<<<<<<<<<<<<< + * i = 1 + * # Two output values for each input value + */ + __pyx_v_p_data = (__pyx_v_p_data + 1); + + /* "bx/seq/_nib.pyx":34 + * p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + * p_data = p_data + 1 + * i = 1 # <<<<<<<<<<<<<< + * # Two output values for each input value + * for j from 0 <= j < (length-i)/2: + */ + __pyx_v_i = 1; + goto __pyx_L6; + } + __pyx_L6:; + + /* "bx/seq/_nib.pyx":36 + * i = 1 + * # Two output values for each input value + * for j from 0 <= j < (length-i)/2: # <<<<<<<<<<<<<< + * #p_rval[i] = NIB_I2C_TABLE[ ( p_data[0] >> 4 ) & 0xF ]; + * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ]; + */ + __pyx_t_2 = __Pyx_div_long((__pyx_v_length - __pyx_v_i), 2); + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { + + /* "bx/seq/_nib.pyx":39 + * #p_rval[i] = NIB_I2C_TABLE[ ( p_data[0] >> 4 ) & 0xF ]; + * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ]; + * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ] # <<<<<<<<<<<<<< + * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + * i = i + 2 + */ + (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST[(__pyx_v_p_data[0])]); + + /* "bx/seq/_nib.pyx":40 + * #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ]; + * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ] + * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] # <<<<<<<<<<<<<< + * i = i + 2 + * p_data = p_data + 1 + */ + (__pyx_v_p_rval[(__pyx_v_i + 1)]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND[(__pyx_v_p_data[0])]); + + /* "bx/seq/_nib.pyx":41 + * p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ] + * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + * i = i + 2 # <<<<<<<<<<<<<< + * p_data = p_data + 1 + * # Odd end + */ + __pyx_v_i = (__pyx_v_i + 2); + + /* "bx/seq/_nib.pyx":42 + * p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + * i = i + 2 + * p_data = p_data + 1 # <<<<<<<<<<<<<< + * # Odd end + * if i < length: + */ + __pyx_v_p_data = (__pyx_v_p_data + 1); + } + + /* "bx/seq/_nib.pyx":44 + * p_data = p_data + 1 + * # Odd end + * if i < length: # <<<<<<<<<<<<<< + * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ] + * return rval + */ + __pyx_t_3 = (__pyx_v_i < __pyx_v_length); + if (__pyx_t_3) { + + /* "bx/seq/_nib.pyx":45 + * # Odd end + * if i < length: + * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ] # <<<<<<<<<<<<<< + * return rval + */ + (__pyx_v_p_rval[__pyx_v_i]) = (__pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST[(__pyx_v_p_data[0])]); + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/seq/_nib.pyx":46 + * if i < length: + * p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ] + * return rval # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_rval); + __pyx_r = __pyx_v_rval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("bx.seq._nib.translate_raw_data", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_nib"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__translate_raw_data, __pyx_k__translate_raw_data, sizeof(__pyx_k__translate_raw_data), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_nib(void); /*proto*/ +PyMODINIT_FUNC init_nib(void) +#else +PyMODINIT_FUNC PyInit__nib(void); /*proto*/ +PyMODINIT_FUNC PyInit__nib(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__nib(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_nib"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__seq___nib) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/seq/_nib.pyx":6 + * int _PyString_Resize( object, int ) except -1 + * + * import struct, sys # <<<<<<<<<<<<<< + * + * cdef char * NIB_I2C_TABLE + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/seq/_nib.pyx":12 + * cdef char * NIB_I2C_TABLE_SECOND + * #NIB_I2C_TABLE = "TCAGNXXXtcagnxxx" + * NIB_I2C_TABLE_FIRST = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # <<<<<<<<<<<<<< + * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" + * + */ + __pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_FIRST = __pyx_k_1; + + /* "bx/seq/_nib.pyx":13 + * #NIB_I2C_TABLE = "TCAGNXXXtcagnxxx" + * NIB_I2C_TABLE_FIRST = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" # <<<<<<<<<<<<<< + * + * def translate_raw_data( data, int start, int length ): + */ + __pyx_v_2bx_3seq_4_nib_NIB_I2C_TABLE_SECOND = __pyx_k_2; + + /* "bx/seq/_nib.pyx":15 + * NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" + * + * def translate_raw_data( data, int start, int length ): # <<<<<<<<<<<<<< + * """ + * Data is a block read from the file that needs to be unpacked, dealing + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2bx_3seq_4_nib_translate_raw_data, NULL, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__translate_raw_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/seq/_nib.pyx":1 + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * char * PyString_AsString( object ) + * object PyString_FromStringAndSize( char *, int ) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.seq._nib", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.seq._nib"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.pyx b/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.pyx new file mode 100755 index 0000000..166b0b8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/_nib.pyx @@ -0,0 +1,46 @@ +cdef extern from "Python.h": + char * PyString_AsString( object ) + object PyString_FromStringAndSize( char *, int ) + int _PyString_Resize( object, int ) except -1 + +import struct, sys + +cdef char * NIB_I2C_TABLE +cdef char * NIB_I2C_TABLE_FIRST +cdef char * NIB_I2C_TABLE_SECOND +#NIB_I2C_TABLE = "TCAGNXXXtcagnxxx" +NIB_I2C_TABLE_FIRST = "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXttttttttttttttttccccccccccccccccaaaaaaaaaaaaaaaaggggggggggggggggnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +NIB_I2C_TABLE_SECOND = "TCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxxTCAGNXXXtcagnxxx" + +def translate_raw_data( data, int start, int length ): + """ + Data is a block read from the file that needs to be unpacked, dealing + with end conditions based on start/length. + """ + cdef int i, j + cdef char * p_rval + cdef unsigned char * p_data + # Allocate string to write into + rval = PyString_FromStringAndSize( NULL, length ) + # Get char pointer access to strings + p_rval = PyString_AsString( rval ) + p_data = PyString_AsString( data ) + i = 0 + # Odd start + if start & 1: + #p_rval[i] = NIB_I2C_TABLE[ p_data[0] & 0xF ] + p_rval[i] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + p_data = p_data + 1 + i = 1 + # Two output values for each input value + for j from 0 <= j < (length-i)/2: + #p_rval[i] = NIB_I2C_TABLE[ ( p_data[0] >> 4 ) & 0xF ]; + #p_rval[i+1] = NIB_I2C_TABLE[ ( p_data[0] >> 0 ) & 0xF ]; + p_rval[i] = NIB_I2C_TABLE_FIRST [ p_data[0] ] + p_rval[i+1] = NIB_I2C_TABLE_SECOND[ p_data[0] ] + i = i + 2 + p_data = p_data + 1 + # Odd end + if i < length: + p_rval[i] = NIB_I2C_TABLE_FIRST[ p_data[0] ] + return rval diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.c b/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.c new file mode 100755 index 0000000..313a141 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.c @@ -0,0 +1,2680 @@ +/* Generated by Cython 0.15.1 on Mon Oct 31 12:24:16 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__bx__seq___twobit +#define __PYX_HAVE_API__bx__seq___twobit +#include "ctype.h" +#include "string.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "_twobit.pyx", +}; + +/*--- Type declarations ---*/ + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'bx.seq._twobit' */ +static char *__pyx_v_2bx_3seq_7_twobit_valToNt; +#define __Pyx_MODULE_NAME "bx.seq._twobit" +int __pyx_module_is_main_bx__seq___twobit = 0; + +/* Implementation of 'bx.seq._twobit' */ +static char __pyx_k_1[] = "bx.seq._twobit"; +static char __pyx_k__seq[] = "seq"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__TCAG[] = "TCAG"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__bisect[] = "bisect"; +static char __pyx_k__struct[] = "struct"; +static char __pyx_k__do_mask[] = "do_mask"; +static char __pyx_k__fragEnd[] = "fragEnd"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__fragStart[] = "fragStart"; +static char __pyx_k__n_block_sizes[] = "n_block_sizes"; +static char __pyx_k__n_block_starts[] = "n_block_starts"; +static char __pyx_k__sequence_offset[] = "sequence_offset"; +static char __pyx_k__masked_block_sizes[] = "masked_block_sizes"; +static char __pyx_k__masked_block_starts[] = "masked_block_starts"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__bisect; +static PyObject *__pyx_n_s__do_mask; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__fragEnd; +static PyObject *__pyx_n_s__fragStart; +static PyObject *__pyx_n_s__masked_block_sizes; +static PyObject *__pyx_n_s__masked_block_starts; +static PyObject *__pyx_n_s__n_block_sizes; +static PyObject *__pyx_n_s__n_block_starts; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__seq; +static PyObject *__pyx_n_s__sequence_offset; +static PyObject *__pyx_n_s__struct; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; + +/* "bx/seq/_twobit.pyx":19 + * valToNt = "TCAG" + * + * def read( file, seq, int fragStart, int fragEnd, bint do_mask ): # <<<<<<<<<<<<<< + * """ + * Stolen directly from Jim Kent's twoBit.c + */ + +static PyObject *__pyx_pf_2bx_3seq_7_twobit_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_2bx_3seq_7_twobit_read[] = "\n Stolen directly from Jim Kent's twoBit.c\n "; +static PyMethodDef __pyx_mdef_2bx_3seq_7_twobit_read = {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_2bx_3seq_7_twobit_read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_2bx_3seq_7_twobit_read)}; +static PyObject *__pyx_pf_2bx_3seq_7_twobit_read(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file = 0; + PyObject *__pyx_v_seq = 0; + int __pyx_v_fragStart; + int __pyx_v_fragEnd; + int __pyx_v_do_mask; + int __pyx_v_packedStart; + int __pyx_v_packedEnd; + int __pyx_v_packByteCount; + int __pyx_v_pOff; + int __pyx_v_pStart; + int __pyx_v_pEnd; + int __pyx_v_midStart; + int __pyx_v_remainder; + int __pyx_v_partCount; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_s; + int __pyx_v_e; + char *__pyx_v_packed; + char *__pyx_v_dna; + char __pyx_v_partial; + PyObject *__pyx_v_dna_py = NULL; + PyObject *__pyx_v_packed_py = NULL; + int __pyx_v_midEnd; + Py_ssize_t __pyx_v_n_block_count; + PyObject *__pyx_v_start_ix = NULL; + Py_ssize_t __pyx_v_m_block_count; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,&__pyx_n_s__seq,&__pyx_n_s__fragStart,&__pyx_n_s__fragEnd,&__pyx_n_s__do_mask,0}; + __Pyx_RefNannySetupContext("read"); + __pyx_self = __pyx_self; + { + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fragStart); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fragEnd); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__do_mask); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("read", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + } + __pyx_v_file = values[0]; + __pyx_v_seq = values[1]; + __pyx_v_fragStart = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_fragStart == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fragEnd = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_fragEnd == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_do_mask = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_do_mask == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("read", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("bx.seq._twobit.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "bx/seq/_twobit.pyx":29 + * cdef char * packed, * dna, *dna_orig + * cdef char partial + * packedStart = (fragStart>>2); # <<<<<<<<<<<<<< + * packedEnd = ((fragEnd+3)>>2); + * packByteCount = packedEnd - packedStart; + */ + __pyx_v_packedStart = (__pyx_v_fragStart >> 2); + + /* "bx/seq/_twobit.pyx":30 + * cdef char partial + * packedStart = (fragStart>>2); + * packedEnd = ((fragEnd+3)>>2); # <<<<<<<<<<<<<< + * packByteCount = packedEnd - packedStart; + * # Empty string in which to write unpacked DNA + */ + __pyx_v_packedEnd = ((__pyx_v_fragEnd + 3) >> 2); + + /* "bx/seq/_twobit.pyx":31 + * packedStart = (fragStart>>2); + * packedEnd = ((fragEnd+3)>>2); + * packByteCount = packedEnd - packedStart; # <<<<<<<<<<<<<< + * # Empty string in which to write unpacked DNA + * dna_py = PyString_FromStringAndSize( NULL, fragEnd - fragStart ) + */ + __pyx_v_packByteCount = (__pyx_v_packedEnd - __pyx_v_packedStart); + + /* "bx/seq/_twobit.pyx":33 + * packByteCount = packedEnd - packedStart; + * # Empty string in which to write unpacked DNA + * dna_py = PyString_FromStringAndSize( NULL, fragEnd - fragStart ) # <<<<<<<<<<<<<< + * dna = PyString_AsString( dna_py ) + * # Read it + */ + __pyx_t_1 = PyString_FromStringAndSize(NULL, (__pyx_v_fragEnd - __pyx_v_fragStart)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_dna_py = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/seq/_twobit.pyx":34 + * # Empty string in which to write unpacked DNA + * dna_py = PyString_FromStringAndSize( NULL, fragEnd - fragStart ) + * dna = PyString_AsString( dna_py ) # <<<<<<<<<<<<<< + * # Read it + * file.seek( seq.sequence_offset + packedStart ) + */ + __pyx_v_dna = PyString_AsString(__pyx_v_dna_py); + + /* "bx/seq/_twobit.pyx":36 + * dna = PyString_AsString( dna_py ) + * # Read it + * file.seek( seq.sequence_offset + packedStart ) # <<<<<<<<<<<<<< + * packed_py = file.read( packByteCount ) + * packed = PyString_AsString( packed_py ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_file, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__sequence_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_packedStart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "bx/seq/_twobit.pyx":37 + * # Read it + * file.seek( seq.sequence_offset + packedStart ) + * packed_py = file.read( packByteCount ) # <<<<<<<<<<<<<< + * packed = PyString_AsString( packed_py ) + * # Handle case where everything is in one packed byte + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_file, __pyx_n_s__read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(__pyx_v_packByteCount); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_packed_py = __pyx_t_3; + __pyx_t_3 = 0; + + /* "bx/seq/_twobit.pyx":38 + * file.seek( seq.sequence_offset + packedStart ) + * packed_py = file.read( packByteCount ) + * packed = PyString_AsString( packed_py ) # <<<<<<<<<<<<<< + * # Handle case where everything is in one packed byte + * if packByteCount == 1: + */ + __pyx_v_packed = PyString_AsString(__pyx_v_packed_py); + + /* "bx/seq/_twobit.pyx":40 + * packed = PyString_AsString( packed_py ) + * # Handle case where everything is in one packed byte + * if packByteCount == 1: # <<<<<<<<<<<<<< + * pOff = (packedStart<<2) + * pStart = fragStart - pOff + */ + __pyx_t_5 = (__pyx_v_packByteCount == 1); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":41 + * # Handle case where everything is in one packed byte + * if packByteCount == 1: + * pOff = (packedStart<<2) # <<<<<<<<<<<<<< + * pStart = fragStart - pOff + * pEnd = fragEnd - pOff + */ + __pyx_v_pOff = (__pyx_v_packedStart << 2); + + /* "bx/seq/_twobit.pyx":42 + * if packByteCount == 1: + * pOff = (packedStart<<2) + * pStart = fragStart - pOff # <<<<<<<<<<<<<< + * pEnd = fragEnd - pOff + * partial = packed[0] + */ + __pyx_v_pStart = (__pyx_v_fragStart - __pyx_v_pOff); + + /* "bx/seq/_twobit.pyx":43 + * pOff = (packedStart<<2) + * pStart = fragStart - pOff + * pEnd = fragEnd - pOff # <<<<<<<<<<<<<< + * partial = packed[0] + * assert pEnd <= 4 + */ + __pyx_v_pEnd = (__pyx_v_fragEnd - __pyx_v_pOff); + + /* "bx/seq/_twobit.pyx":44 + * pStart = fragStart - pOff + * pEnd = fragEnd - pOff + * partial = packed[0] # <<<<<<<<<<<<<< + * assert pEnd <= 4 + * assert pStart >= 0 + */ + __pyx_v_partial = (__pyx_v_packed[0]); + + /* "bx/seq/_twobit.pyx":45 + * pEnd = fragEnd - pOff + * partial = packed[0] + * assert pEnd <= 4 # <<<<<<<<<<<<<< + * assert pStart >= 0 + * for i from pStart <= i < pEnd: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_pEnd <= 4))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/seq/_twobit.pyx":46 + * partial = packed[0] + * assert pEnd <= 4 + * assert pStart >= 0 # <<<<<<<<<<<<<< + * for i from pStart <= i < pEnd: + * dna[0] = valToNt[(partial >> (6-i-i)) & 3] + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_pStart >= 0))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "bx/seq/_twobit.pyx":47 + * assert pEnd <= 4 + * assert pStart >= 0 + * for i from pStart <= i < pEnd: # <<<<<<<<<<<<<< + * dna[0] = valToNt[(partial >> (6-i-i)) & 3] + * dna = dna + 1 + */ + __pyx_t_6 = __pyx_v_pEnd; + for (__pyx_v_i = __pyx_v_pStart; __pyx_v_i < __pyx_t_6; __pyx_v_i++) { + + /* "bx/seq/_twobit.pyx":48 + * assert pStart >= 0 + * for i from pStart <= i < pEnd: + * dna[0] = valToNt[(partial >> (6-i-i)) & 3] # <<<<<<<<<<<<<< + * dna = dna + 1 + * else: + */ + (__pyx_v_dna[0]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[((__pyx_v_partial >> ((6 - __pyx_v_i) - __pyx_v_i)) & 3)]); + + /* "bx/seq/_twobit.pyx":49 + * for i from pStart <= i < pEnd: + * dna[0] = valToNt[(partial >> (6-i-i)) & 3] + * dna = dna + 1 # <<<<<<<<<<<<<< + * else: + * # Handle partial first packed byte. + */ + __pyx_v_dna = (__pyx_v_dna + 1); + } + goto __pyx_L6; + } + /*else*/ { + + /* "bx/seq/_twobit.pyx":52 + * else: + * # Handle partial first packed byte. + * midStart = fragStart; # <<<<<<<<<<<<<< + * remainder = ( fragStart&3 ) + * if remainder > 0: + */ + __pyx_v_midStart = __pyx_v_fragStart; + + /* "bx/seq/_twobit.pyx":53 + * # Handle partial first packed byte. + * midStart = fragStart; + * remainder = ( fragStart&3 ) # <<<<<<<<<<<<<< + * if remainder > 0: + * partial = packed[0]; packed = packed + 1 + */ + __pyx_v_remainder = (__pyx_v_fragStart & 3); + + /* "bx/seq/_twobit.pyx":54 + * midStart = fragStart; + * remainder = ( fragStart&3 ) + * if remainder > 0: # <<<<<<<<<<<<<< + * partial = packed[0]; packed = packed + 1 + * partCount = 4 - remainder; + */ + __pyx_t_5 = (__pyx_v_remainder > 0); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":55 + * remainder = ( fragStart&3 ) + * if remainder > 0: + * partial = packed[0]; packed = packed + 1 # <<<<<<<<<<<<<< + * partCount = 4 - remainder; + * for i from partCount - 1 >= i >= 0: + */ + __pyx_v_partial = (__pyx_v_packed[0]); + __pyx_v_packed = (__pyx_v_packed + 1); + + /* "bx/seq/_twobit.pyx":56 + * if remainder > 0: + * partial = packed[0]; packed = packed + 1 + * partCount = 4 - remainder; # <<<<<<<<<<<<<< + * for i from partCount - 1 >= i >= 0: + * dna[i] = valToNt[ partial & 3 ] + */ + __pyx_v_partCount = (4 - __pyx_v_remainder); + + /* "bx/seq/_twobit.pyx":57 + * partial = packed[0]; packed = packed + 1 + * partCount = 4 - remainder; + * for i from partCount - 1 >= i >= 0: # <<<<<<<<<<<<<< + * dna[i] = valToNt[ partial & 3 ] + * partial = partial >> 2 + */ + for (__pyx_v_i = (__pyx_v_partCount - 1); __pyx_v_i >= 0; __pyx_v_i--) { + + /* "bx/seq/_twobit.pyx":58 + * partCount = 4 - remainder; + * for i from partCount - 1 >= i >= 0: + * dna[i] = valToNt[ partial & 3 ] # <<<<<<<<<<<<<< + * partial = partial >> 2 + * midStart = midStart + partCount + */ + (__pyx_v_dna[__pyx_v_i]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":59 + * for i from partCount - 1 >= i >= 0: + * dna[i] = valToNt[ partial & 3 ] + * partial = partial >> 2 # <<<<<<<<<<<<<< + * midStart = midStart + partCount + * dna = dna + partCount + */ + __pyx_v_partial = (__pyx_v_partial >> 2); + } + + /* "bx/seq/_twobit.pyx":60 + * dna[i] = valToNt[ partial & 3 ] + * partial = partial >> 2 + * midStart = midStart + partCount # <<<<<<<<<<<<<< + * dna = dna + partCount + * # Handle middle bytes. + */ + __pyx_v_midStart = (__pyx_v_midStart + __pyx_v_partCount); + + /* "bx/seq/_twobit.pyx":61 + * partial = partial >> 2 + * midStart = midStart + partCount + * dna = dna + partCount # <<<<<<<<<<<<<< + * # Handle middle bytes. + * remainder = fragEnd&3 + */ + __pyx_v_dna = (__pyx_v_dna + __pyx_v_partCount); + goto __pyx_L9; + } + __pyx_L9:; + + /* "bx/seq/_twobit.pyx":63 + * dna = dna + partCount + * # Handle middle bytes. + * remainder = fragEnd&3 # <<<<<<<<<<<<<< + * midEnd = fragEnd - remainder + * i = midStart + */ + __pyx_v_remainder = (__pyx_v_fragEnd & 3); + + /* "bx/seq/_twobit.pyx":64 + * # Handle middle bytes. + * remainder = fragEnd&3 + * midEnd = fragEnd - remainder # <<<<<<<<<<<<<< + * i = midStart + * while i < midEnd: + */ + __pyx_v_midEnd = (__pyx_v_fragEnd - __pyx_v_remainder); + + /* "bx/seq/_twobit.pyx":65 + * remainder = fragEnd&3 + * midEnd = fragEnd - remainder + * i = midStart # <<<<<<<<<<<<<< + * while i < midEnd: + * partial = packed[0] + */ + __pyx_v_i = __pyx_v_midStart; + + /* "bx/seq/_twobit.pyx":66 + * midEnd = fragEnd - remainder + * i = midStart + * while i < midEnd: # <<<<<<<<<<<<<< + * partial = packed[0] + * packed = packed + 1; + */ + while (1) { + __pyx_t_5 = (__pyx_v_i < __pyx_v_midEnd); + if (!__pyx_t_5) break; + + /* "bx/seq/_twobit.pyx":67 + * i = midStart + * while i < midEnd: + * partial = packed[0] # <<<<<<<<<<<<<< + * packed = packed + 1; + * dna[3] = valToNt[partial&3]; + */ + __pyx_v_partial = (__pyx_v_packed[0]); + + /* "bx/seq/_twobit.pyx":68 + * while i < midEnd: + * partial = packed[0] + * packed = packed + 1; # <<<<<<<<<<<<<< + * dna[3] = valToNt[partial&3]; + * partial = partial >> 2 + */ + __pyx_v_packed = (__pyx_v_packed + 1); + + /* "bx/seq/_twobit.pyx":69 + * partial = packed[0] + * packed = packed + 1; + * dna[3] = valToNt[partial&3]; # <<<<<<<<<<<<<< + * partial = partial >> 2 + * dna[2] = valToNt[partial&3]; + */ + (__pyx_v_dna[3]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":70 + * packed = packed + 1; + * dna[3] = valToNt[partial&3]; + * partial = partial >> 2 # <<<<<<<<<<<<<< + * dna[2] = valToNt[partial&3]; + * partial = partial >> 2 + */ + __pyx_v_partial = (__pyx_v_partial >> 2); + + /* "bx/seq/_twobit.pyx":71 + * dna[3] = valToNt[partial&3]; + * partial = partial >> 2 + * dna[2] = valToNt[partial&3]; # <<<<<<<<<<<<<< + * partial = partial >> 2 + * dna[1] = valToNt[partial&3]; + */ + (__pyx_v_dna[2]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":72 + * partial = partial >> 2 + * dna[2] = valToNt[partial&3]; + * partial = partial >> 2 # <<<<<<<<<<<<<< + * dna[1] = valToNt[partial&3]; + * partial = partial >> 2 + */ + __pyx_v_partial = (__pyx_v_partial >> 2); + + /* "bx/seq/_twobit.pyx":73 + * dna[2] = valToNt[partial&3]; + * partial = partial >> 2 + * dna[1] = valToNt[partial&3]; # <<<<<<<<<<<<<< + * partial = partial >> 2 + * dna[0] = valToNt[partial&3]; + */ + (__pyx_v_dna[1]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":74 + * partial = partial >> 2 + * dna[1] = valToNt[partial&3]; + * partial = partial >> 2 # <<<<<<<<<<<<<< + * dna[0] = valToNt[partial&3]; + * dna = dna + 4; + */ + __pyx_v_partial = (__pyx_v_partial >> 2); + + /* "bx/seq/_twobit.pyx":75 + * dna[1] = valToNt[partial&3]; + * partial = partial >> 2 + * dna[0] = valToNt[partial&3]; # <<<<<<<<<<<<<< + * dna = dna + 4; + * # Increment + */ + (__pyx_v_dna[0]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":76 + * partial = partial >> 2 + * dna[0] = valToNt[partial&3]; + * dna = dna + 4; # <<<<<<<<<<<<<< + * # Increment + * i = i + 4 + */ + __pyx_v_dna = (__pyx_v_dna + 4); + + /* "bx/seq/_twobit.pyx":78 + * dna = dna + 4; + * # Increment + * i = i + 4 # <<<<<<<<<<<<<< + * ## sys.stderr.write( "!!!< " + dna_py + " >!!!\n" ); sys.stderr.flush() + * # End + */ + __pyx_v_i = (__pyx_v_i + 4); + } + + /* "bx/seq/_twobit.pyx":81 + * ## sys.stderr.write( "!!!< " + dna_py + " >!!!\n" ); sys.stderr.flush() + * # End + * if remainder > 0: # <<<<<<<<<<<<<< + * partial = packed[0]; + * partial = partial >> (8-remainder-remainder) + */ + __pyx_t_5 = (__pyx_v_remainder > 0); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":82 + * # End + * if remainder > 0: + * partial = packed[0]; # <<<<<<<<<<<<<< + * partial = partial >> (8-remainder-remainder) + * for i from remainder - 1 >= i >= 0: + */ + __pyx_v_partial = (__pyx_v_packed[0]); + + /* "bx/seq/_twobit.pyx":83 + * if remainder > 0: + * partial = packed[0]; + * partial = partial >> (8-remainder-remainder) # <<<<<<<<<<<<<< + * for i from remainder - 1 >= i >= 0: + * dna[i] = valToNt[partial&3] + */ + __pyx_v_partial = (__pyx_v_partial >> ((8 - __pyx_v_remainder) - __pyx_v_remainder)); + + /* "bx/seq/_twobit.pyx":84 + * partial = packed[0]; + * partial = partial >> (8-remainder-remainder) + * for i from remainder - 1 >= i >= 0: # <<<<<<<<<<<<<< + * dna[i] = valToNt[partial&3] + * partial = partial >> 2 + */ + for (__pyx_v_i = (__pyx_v_remainder - 1); __pyx_v_i >= 0; __pyx_v_i--) { + + /* "bx/seq/_twobit.pyx":85 + * partial = partial >> (8-remainder-remainder) + * for i from remainder - 1 >= i >= 0: + * dna[i] = valToNt[partial&3] # <<<<<<<<<<<<<< + * partial = partial >> 2 + * # Restore DNA pointer + */ + (__pyx_v_dna[__pyx_v_i]) = (__pyx_v_2bx_3seq_7_twobit_valToNt[(__pyx_v_partial & 3)]); + + /* "bx/seq/_twobit.pyx":86 + * for i from remainder - 1 >= i >= 0: + * dna[i] = valToNt[partial&3] + * partial = partial >> 2 # <<<<<<<<<<<<<< + * # Restore DNA pointer + * dna = PyString_AsString( dna_py ) + */ + __pyx_v_partial = (__pyx_v_partial >> 2); + } + goto __pyx_L14; + } + __pyx_L14:; + } + __pyx_L6:; + + /* "bx/seq/_twobit.pyx":88 + * partial = partial >> 2 + * # Restore DNA pointer + * dna = PyString_AsString( dna_py ) # <<<<<<<<<<<<<< + * # N's + * n_block_count = len( seq.n_block_starts ) + */ + __pyx_v_dna = PyString_AsString(__pyx_v_dna_py); + + /* "bx/seq/_twobit.pyx":90 + * dna = PyString_AsString( dna_py ) + * # N's + * n_block_count = len( seq.n_block_starts ) # <<<<<<<<<<<<<< + * if n_block_count > 0: + * start_ix = bisect( seq.n_block_starts, fragStart ) - 1 + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__n_block_starts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_n_block_count = __pyx_t_7; + + /* "bx/seq/_twobit.pyx":91 + * # N's + * n_block_count = len( seq.n_block_starts ) + * if n_block_count > 0: # <<<<<<<<<<<<<< + * start_ix = bisect( seq.n_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 + */ + __pyx_t_5 = (__pyx_v_n_block_count > 0); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":92 + * n_block_count = len( seq.n_block_starts ) + * if n_block_count > 0: + * start_ix = bisect( seq.n_block_starts, fragStart ) - 1 # <<<<<<<<<<<<<< + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < n_block_count: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__bisect); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__n_block_starts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyInt_FromLong(__pyx_v_fragStart); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_start_ix = __pyx_t_2; + __pyx_t_2 = 0; + + /* "bx/seq/_twobit.pyx":93 + * if n_block_count > 0: + * start_ix = bisect( seq.n_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 # <<<<<<<<<<<<<< + * for i from start_ix <= i < n_block_count: + * s = seq.n_block_starts[i]; + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start_ix, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_start_ix); + __pyx_v_start_ix = __pyx_int_0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "bx/seq/_twobit.pyx":94 + * start_ix = bisect( seq.n_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < n_block_count: # <<<<<<<<<<<<<< + * s = seq.n_block_starts[i]; + * e = s + seq.n_block_sizes[i]; + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_start_ix); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_v_n_block_count; + for (__pyx_v_i = __pyx_t_6; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "bx/seq/_twobit.pyx":95 + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < n_block_count: + * s = seq.n_block_starts[i]; # <<<<<<<<<<<<<< + * e = s + seq.n_block_sizes[i]; + * if (s >= fragEnd): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__n_block_starts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_s = __pyx_t_8; + + /* "bx/seq/_twobit.pyx":96 + * for i from start_ix <= i < n_block_count: + * s = seq.n_block_starts[i]; + * e = s + seq.n_block_sizes[i]; # <<<<<<<<<<<<<< + * if (s >= fragEnd): + * break + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__n_block_sizes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_e = __pyx_t_8; + + /* "bx/seq/_twobit.pyx":97 + * s = seq.n_block_starts[i]; + * e = s + seq.n_block_sizes[i]; + * if (s >= fragEnd): # <<<<<<<<<<<<<< + * break + * if (s < fragStart): + */ + __pyx_t_5 = (__pyx_v_s >= __pyx_v_fragEnd); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":98 + * e = s + seq.n_block_sizes[i]; + * if (s >= fragEnd): + * break # <<<<<<<<<<<<<< + * if (s < fragStart): + * s = fragStart + */ + goto __pyx_L20_break; + goto __pyx_L21; + } + __pyx_L21:; + + /* "bx/seq/_twobit.pyx":99 + * if (s >= fragEnd): + * break + * if (s < fragStart): # <<<<<<<<<<<<<< + * s = fragStart + * if (e > fragEnd): + */ + __pyx_t_5 = (__pyx_v_s < __pyx_v_fragStart); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":100 + * break + * if (s < fragStart): + * s = fragStart # <<<<<<<<<<<<<< + * if (e > fragEnd): + * e = fragEnd + */ + __pyx_v_s = __pyx_v_fragStart; + goto __pyx_L22; + } + __pyx_L22:; + + /* "bx/seq/_twobit.pyx":101 + * if (s < fragStart): + * s = fragStart + * if (e > fragEnd): # <<<<<<<<<<<<<< + * e = fragEnd + * if (s < e): + */ + __pyx_t_5 = (__pyx_v_e > __pyx_v_fragEnd); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":102 + * s = fragStart + * if (e > fragEnd): + * e = fragEnd # <<<<<<<<<<<<<< + * if (s < e): + * memset( dna + s - fragStart, c'N', e - s) + */ + __pyx_v_e = __pyx_v_fragEnd; + goto __pyx_L23; + } + __pyx_L23:; + + /* "bx/seq/_twobit.pyx":103 + * if (e > fragEnd): + * e = fragEnd + * if (s < e): # <<<<<<<<<<<<<< + * memset( dna + s - fragStart, c'N', e - s) + * # Mask + */ + __pyx_t_5 = (__pyx_v_s < __pyx_v_e); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":104 + * e = fragEnd + * if (s < e): + * memset( dna + s - fragStart, c'N', e - s) # <<<<<<<<<<<<<< + * # Mask + * if do_mask: + */ + memset(((__pyx_v_dna + __pyx_v_s) - __pyx_v_fragStart), 'N', (__pyx_v_e - __pyx_v_s)); + goto __pyx_L24; + } + __pyx_L24:; + } + __pyx_L20_break:; + goto __pyx_L17; + } + __pyx_L17:; + + /* "bx/seq/_twobit.pyx":106 + * memset( dna + s - fragStart, c'N', e - s) + * # Mask + * if do_mask: # <<<<<<<<<<<<<< + * m_block_count = len( seq.masked_block_starts ) + * if m_block_count > 0: + */ + if (__pyx_v_do_mask) { + + /* "bx/seq/_twobit.pyx":107 + * # Mask + * if do_mask: + * m_block_count = len( seq.masked_block_starts ) # <<<<<<<<<<<<<< + * if m_block_count > 0: + * start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__masked_block_starts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_m_block_count = __pyx_t_7; + + /* "bx/seq/_twobit.pyx":108 + * if do_mask: + * m_block_count = len( seq.masked_block_starts ) + * if m_block_count > 0: # <<<<<<<<<<<<<< + * start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 + */ + __pyx_t_5 = (__pyx_v_m_block_count > 0); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":109 + * m_block_count = len( seq.masked_block_starts ) + * if m_block_count > 0: + * start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 # <<<<<<<<<<<<<< + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < m_block_count: + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__bisect); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__masked_block_starts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_fragStart); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_v_start_ix); + __pyx_v_start_ix = __pyx_t_1; + __pyx_t_1 = 0; + + /* "bx/seq/_twobit.pyx":110 + * if m_block_count > 0: + * start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 # <<<<<<<<<<<<<< + * for i from start_ix <= i < m_block_count: + * s = seq.masked_block_starts[i]; + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start_ix, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_start_ix); + __pyx_v_start_ix = __pyx_int_0; + goto __pyx_L27; + } + __pyx_L27:; + + /* "bx/seq/_twobit.pyx":111 + * start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < m_block_count: # <<<<<<<<<<<<<< + * s = seq.masked_block_starts[i]; + * e = s + seq.masked_block_sizes[i]; + */ + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_start_ix); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_v_m_block_count; + for (__pyx_v_i = __pyx_t_6; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { + + /* "bx/seq/_twobit.pyx":112 + * if start_ix < 0: start_ix = 0 + * for i from start_ix <= i < m_block_count: + * s = seq.masked_block_starts[i]; # <<<<<<<<<<<<<< + * e = s + seq.masked_block_sizes[i]; + * if (s >= fragEnd): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__masked_block_starts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_s = __pyx_t_8; + + /* "bx/seq/_twobit.pyx":113 + * for i from start_ix <= i < m_block_count: + * s = seq.masked_block_starts[i]; + * e = s + seq.masked_block_sizes[i]; # <<<<<<<<<<<<<< + * if (s >= fragEnd): + * break + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_seq, __pyx_n_s__masked_block_sizes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_e = __pyx_t_8; + + /* "bx/seq/_twobit.pyx":114 + * s = seq.masked_block_starts[i]; + * e = s + seq.masked_block_sizes[i]; + * if (s >= fragEnd): # <<<<<<<<<<<<<< + * break + * if (s < fragStart): + */ + __pyx_t_5 = (__pyx_v_s >= __pyx_v_fragEnd); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":115 + * e = s + seq.masked_block_sizes[i]; + * if (s >= fragEnd): + * break # <<<<<<<<<<<<<< + * if (s < fragStart): + * s = fragStart + */ + goto __pyx_L29_break; + goto __pyx_L30; + } + __pyx_L30:; + + /* "bx/seq/_twobit.pyx":116 + * if (s >= fragEnd): + * break + * if (s < fragStart): # <<<<<<<<<<<<<< + * s = fragStart + * if (e > fragEnd): + */ + __pyx_t_5 = (__pyx_v_s < __pyx_v_fragStart); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":117 + * break + * if (s < fragStart): + * s = fragStart # <<<<<<<<<<<<<< + * if (e > fragEnd): + * e = fragEnd + */ + __pyx_v_s = __pyx_v_fragStart; + goto __pyx_L31; + } + __pyx_L31:; + + /* "bx/seq/_twobit.pyx":118 + * if (s < fragStart): + * s = fragStart + * if (e > fragEnd): # <<<<<<<<<<<<<< + * e = fragEnd + * if (s < e): + */ + __pyx_t_5 = (__pyx_v_e > __pyx_v_fragEnd); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":119 + * s = fragStart + * if (e > fragEnd): + * e = fragEnd # <<<<<<<<<<<<<< + * if (s < e): + * for j from s <= j < e: + */ + __pyx_v_e = __pyx_v_fragEnd; + goto __pyx_L32; + } + __pyx_L32:; + + /* "bx/seq/_twobit.pyx":120 + * if (e > fragEnd): + * e = fragEnd + * if (s < e): # <<<<<<<<<<<<<< + * for j from s <= j < e: + * dna[j-fragStart] = tolower( dna[j-fragStart] ) + */ + __pyx_t_5 = (__pyx_v_s < __pyx_v_e); + if (__pyx_t_5) { + + /* "bx/seq/_twobit.pyx":121 + * e = fragEnd + * if (s < e): + * for j from s <= j < e: # <<<<<<<<<<<<<< + * dna[j-fragStart] = tolower( dna[j-fragStart] ) + * return dna_py + */ + __pyx_t_8 = __pyx_v_e; + for (__pyx_v_j = __pyx_v_s; __pyx_v_j < __pyx_t_8; __pyx_v_j++) { + + /* "bx/seq/_twobit.pyx":122 + * if (s < e): + * for j from s <= j < e: + * dna[j-fragStart] = tolower( dna[j-fragStart] ) # <<<<<<<<<<<<<< + * return dna_py + */ + (__pyx_v_dna[(__pyx_v_j - __pyx_v_fragStart)]) = tolower((__pyx_v_dna[(__pyx_v_j - __pyx_v_fragStart)])); + } + goto __pyx_L33; + } + __pyx_L33:; + } + __pyx_L29_break:; + goto __pyx_L26; + } + __pyx_L26:; + goto __pyx_L25; + } + __pyx_L25:; + + /* "bx/seq/_twobit.pyx":123 + * for j from s <= j < e: + * dna[j-fragStart] = tolower( dna[j-fragStart] ) + * return dna_py # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_dna_py); + __pyx_r = __pyx_v_dna_py; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("bx.seq._twobit.read", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_dna_py); + __Pyx_XDECREF(__pyx_v_packed_py); + __Pyx_XDECREF(__pyx_v_start_ix); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_twobit"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__bisect, __pyx_k__bisect, sizeof(__pyx_k__bisect), 0, 0, 1, 1}, + {&__pyx_n_s__do_mask, __pyx_k__do_mask, sizeof(__pyx_k__do_mask), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__fragEnd, __pyx_k__fragEnd, sizeof(__pyx_k__fragEnd), 0, 0, 1, 1}, + {&__pyx_n_s__fragStart, __pyx_k__fragStart, sizeof(__pyx_k__fragStart), 0, 0, 1, 1}, + {&__pyx_n_s__masked_block_sizes, __pyx_k__masked_block_sizes, sizeof(__pyx_k__masked_block_sizes), 0, 0, 1, 1}, + {&__pyx_n_s__masked_block_starts, __pyx_k__masked_block_starts, sizeof(__pyx_k__masked_block_starts), 0, 0, 1, 1}, + {&__pyx_n_s__n_block_sizes, __pyx_k__n_block_sizes, sizeof(__pyx_k__n_block_sizes), 0, 0, 1, 1}, + {&__pyx_n_s__n_block_starts, __pyx_k__n_block_starts, sizeof(__pyx_k__n_block_starts), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1}, + {&__pyx_n_s__sequence_offset, __pyx_k__sequence_offset, sizeof(__pyx_k__sequence_offset), 0, 0, 1, 1}, + {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + return 0; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_twobit(void); /*proto*/ +PyMODINIT_FUNC init_twobit(void) +#else +PyMODINIT_FUNC PyInit__twobit(void); /*proto*/ +PyMODINIT_FUNC PyInit__twobit(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__twobit(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_twobit"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_bx__seq___twobit) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "bx/seq/_twobit.pyx":12 + * void * memset( void *, int, int ) + * + * import struct, sys # <<<<<<<<<<<<<< + * + * from bisect import bisect + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "bx/seq/_twobit.pyx":14 + * import struct, sys + * + * from bisect import bisect # <<<<<<<<<<<<<< + * + * cdef char* valToNt + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bisect)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bisect)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bisect)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__bisect), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bisect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bisect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/seq/_twobit.pyx":17 + * + * cdef char* valToNt + * valToNt = "TCAG" # <<<<<<<<<<<<<< + * + * def read( file, seq, int fragStart, int fragEnd, bint do_mask ): + */ + __pyx_v_2bx_3seq_7_twobit_valToNt = __pyx_k__TCAG; + + /* "bx/seq/_twobit.pyx":19 + * valToNt = "TCAG" + * + * def read( file, seq, int fragStart, int fragEnd, bint do_mask ): # <<<<<<<<<<<<<< + * """ + * Stolen directly from Jim Kent's twoBit.c + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2bx_3seq_7_twobit_read, NULL, __pyx_n_s_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__read, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "bx/seq/_twobit.pyx":1 + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * char * PyString_AsString( object ) + * object PyString_FromStringAndSize( char *, int ) + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init bx.seq._twobit", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init bx.seq._twobit"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.pyx b/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.pyx new file mode 100755 index 0000000..3fd4e33 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/_twobit.pyx @@ -0,0 +1,123 @@ +cdef extern from "Python.h": + char * PyString_AsString( object ) + object PyString_FromStringAndSize( char *, int ) + int _PyString_Resize( object, int ) except -1 + +cdef extern from "ctype.h": + int tolower( int ) + +cdef extern from "string.h": + void * memset( void *, int, int ) + +import struct, sys + +from bisect import bisect + +cdef char* valToNt +valToNt = "TCAG" + +def read( file, seq, int fragStart, int fragEnd, bint do_mask ): + """ + Stolen directly from Jim Kent's twoBit.c + """ + cdef int packedStart, packedEnd, packByteCount + cdef int pOff, pStart, pEnd + cdef int midStart, remainder, partCount + cdef int i, j, s, e + cdef char * packed, * dna, *dna_orig + cdef char partial + packedStart = (fragStart>>2); + packedEnd = ((fragEnd+3)>>2); + packByteCount = packedEnd - packedStart; + # Empty string in which to write unpacked DNA + dna_py = PyString_FromStringAndSize( NULL, fragEnd - fragStart ) + dna = PyString_AsString( dna_py ) + # Read it + file.seek( seq.sequence_offset + packedStart ) + packed_py = file.read( packByteCount ) + packed = PyString_AsString( packed_py ) + # Handle case where everything is in one packed byte + if packByteCount == 1: + pOff = (packedStart<<2) + pStart = fragStart - pOff + pEnd = fragEnd - pOff + partial = packed[0] + assert pEnd <= 4 + assert pStart >= 0 + for i from pStart <= i < pEnd: + dna[0] = valToNt[(partial >> (6-i-i)) & 3] + dna = dna + 1 + else: + # Handle partial first packed byte. + midStart = fragStart; + remainder = ( fragStart&3 ) + if remainder > 0: + partial = packed[0]; packed = packed + 1 + partCount = 4 - remainder; + for i from partCount - 1 >= i >= 0: + dna[i] = valToNt[ partial & 3 ] + partial = partial >> 2 + midStart = midStart + partCount + dna = dna + partCount + # Handle middle bytes. + remainder = fragEnd&3 + midEnd = fragEnd - remainder + i = midStart + while i < midEnd: + partial = packed[0] + packed = packed + 1; + dna[3] = valToNt[partial&3]; + partial = partial >> 2 + dna[2] = valToNt[partial&3]; + partial = partial >> 2 + dna[1] = valToNt[partial&3]; + partial = partial >> 2 + dna[0] = valToNt[partial&3]; + dna = dna + 4; + # Increment + i = i + 4 + ## sys.stderr.write( "!!!< " + dna_py + " >!!!\n" ); sys.stderr.flush() + # End + if remainder > 0: + partial = packed[0]; + partial = partial >> (8-remainder-remainder) + for i from remainder - 1 >= i >= 0: + dna[i] = valToNt[partial&3] + partial = partial >> 2 + # Restore DNA pointer + dna = PyString_AsString( dna_py ) + # N's + n_block_count = len( seq.n_block_starts ) + if n_block_count > 0: + start_ix = bisect( seq.n_block_starts, fragStart ) - 1 + if start_ix < 0: start_ix = 0 + for i from start_ix <= i < n_block_count: + s = seq.n_block_starts[i]; + e = s + seq.n_block_sizes[i]; + if (s >= fragEnd): + break + if (s < fragStart): + s = fragStart + if (e > fragEnd): + e = fragEnd + if (s < e): + memset( dna + s - fragStart, c'N', e - s) + # Mask + if do_mask: + m_block_count = len( seq.masked_block_starts ) + if m_block_count > 0: + start_ix = bisect( seq.masked_block_starts, fragStart ) - 1 + if start_ix < 0: start_ix = 0 + for i from start_ix <= i < m_block_count: + s = seq.masked_block_starts[i]; + e = s + seq.masked_block_sizes[i]; + if (s >= fragEnd): + break + if (s < fragStart): + s = fragStart + if (e > fragEnd): + e = fragEnd + if (s < e): + for j from s <= j < e: + dna[j-fragStart] = tolower( dna[j-fragStart] ) + return dna_py diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/core.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/core.py new file mode 100755 index 0000000..88b4fda --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/core.py @@ -0,0 +1,64 @@ +""" +Support for "biological sequence" files. + +:Author: Bob Harris (rsharris@bx.psu.edu) + +See seq.py for more information +""" + +import struct +import fasta, nib, qdna + +# DNA reverse complement table + +DNA_COMP = " - " \ + " TVGH CD M KN YSA BWXR tvgh cd m kn ysa bwxr " \ + " " \ + " " + +def reverse_complement( text ): + return text.translate(DNA_COMP)[::-1] + + +def seq_file (file, format=None, revcomp=False, name="", gap=None, contig=None): + if (format == None): format = infer_format(file) + if (contig != None) and (format not in ["fasta",None]): + raise "Contigs are not supported for format %s" % format + if (format == "fasta"): return fasta.FastaFile (file, revcomp=revcomp, name=name, gap=gap, contig=contig) + elif (format == "nib"): return nib.NibFile (file, revcomp=revcomp, name=name, gap=gap) + elif (format == "qdna"): return qdna.QdnaFile (file, revcomp=revcomp, name=name, gap=gap) + else: + if (format == None): format = "" + else: format = " " + format + raise "Unknown sequence format%s in %s" % (format,file.name) + + +def seq_reader (file, format=None, revcomp=False, name="", gap=None): + if (format == None): format = infer_format(file) + if (format == "fasta"): return fasta.FastaReader (file, revcomp=revcomp, name=name, gap=gap) + elif (format == "nib"): return nib.NibReader (file, revcomp=revcomp, name=name, gap=gap) + elif (format == "qdna"): return qdna.QdnaReader (file, revcomp=revcomp, name=name, gap=gap) + else: raise "Unknown sequence format %s" % format + + +def seq_writer (outfile, format=None, name=""): + if (format == "fasta"): return fasta.FastaWriter (outfile) + elif (format == "nib"): return nib.NibWriter (outfile) + elif (format == "qdna"): return qdna.QdnaWriter (outfile) + else: raise "Unknown sequence format %s" % format + + +def infer_format (file): + format = None + magic = struct.unpack(">L", file.read(4))[0] + if (magic == nib.NIB_MAGIC_NUMBER) or (magic == nib.NIB_MAGIC_NUMBER_SWAP): + format = "nib" + elif (magic == qdna.qdnaMagic) or (magic == qdna.qdnaMagicSwap): + format = "qdna" + else: + file.seek(0) + if (file.read(1) == ">"): + format = "fasta" + file.seek(0) + return format + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta.py new file mode 100755 index 0000000..227ef95 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta.py @@ -0,0 +1,105 @@ +""" +Classes to support FASTA files. + +:Author: Bob Harris (rsharris@bx.psu.edu) + +A FASTA file contains multiple sequences. Each sequence is usually DNA. + +A typical FASTA file:: + + >mule + TAATACCCCGGATATATGTCCTCACATAGTTCGAGGTCGAGAAAAATGAC + TTCCCACCAAGTGGACTCAGCTCGAGTAAACGCCAACGATACGTCCATTA + GGTGTGTGCCgcaactagtcggacccgttgtgacggaaacaggtccccgc + caagtcacacgggcatgtcatggacTCTCGATCGTTCATCGCCTTCTTGG + GTACCGCAGCCGCAATTAAGCCGTGTCTTCTTCCCCCTTCAAACGGGAAT + CGTGTCGACTTCTTAGGAGCAGNNNNNNNNNNCTAACTCCAGAG + >donkey + TAATACCCCGGATATATGTCTTAACATAGTTCCAGGTCGAGAAGAATGAC + TTGCCACCAAGTGGACTCAGATTCAGTCAACGCGAACGATAAGTCCATTA + GGTGTGTACCgcaactagtgggacccgttgtgacggaaacaggtcaccgc + caagtcacacgtgcatgtcatgtacTCTCGATCGTTTATCGCCTTCTTGG + GTACCGCAGCCGAAATTAAGCCGTGTCTTCTTCCCACTTCAAACGGGAAT + CGTGTCGACTTTACAGGAACAGNNNNNNNNNNATAACGCCAGAG + ... more sequences + +Typical use: + + for seq in bx.seq.fasta.FastaReader(sys.stdin): + print seq.name + print seq.get(0,seq.length) + +""" + +from bx.seq.seq import SeqFile,SeqReader +import sys, string + +class FastaFile(SeqFile): + + def __init__(self, file, revcomp=False, name="", gap=None, lookahead=None, contig=None): + SeqFile.__init__(self,file,revcomp,name,gap) + self.lookahead = lookahead + if (contig == None): contig = 1 + assert (contig >= 1), "contig %d is not legal" % contig + + # nota bene: certainly not the most efficient or elegant implementation + + currContig = 1 + while (True): + if (self.lookahead != None): + (line,self.lookahead) = (self.lookahead,None) + else: + line = self.file.readline() + if (line == ""): break + if not line: + break + if (line.startswith(">")): + if (self.text != None): + if (currContig == contig): + self.lookahead = line # (next sequence header) + break + currContig += 1 + self.name = self.extract_name(line[1:]) + self.text = [] + continue + line = line.split() # (remove whitespace) + if (self.text == None): self.text = line # (allows headerless fasta) + else: self.text.extend(line) + assert (currContig == contig), \ + "contig %d is not legal (file contains only %d)" % (contig,currContig) + if (self.text != None): + self.text = "".join(self.text) + self.length = len(self.text) + +class FastaReader(SeqReader): + + def __init__(self, file, revcomp=False, name="", gap=None): + SeqReader.__init__(self,file,revcomp,name,gap) + self.lookahead = None + + def next(self): + seq = FastaFile(self.file,self.revcomp,self.name,self.gap,self.lookahead) + if (seq.text == None): return + self.lookahead = seq.lookahead + self.seqs_read += 1 + return seq + + +class FastaWriter(object): + + def __init__(self,file,columns=50): + self.file = file + self.columns = columns + + def write(self,seq): + print >>self.file,">%s" % seq.name + text = seq.text + if (self.columns != None) and (self.columns > 0): + text = "\n".join([text[ix:ix+self.columns] \ + for ix in range(0,len(text),self.columns)]) + print >>self.file,text + + def close(self): + assert (self.file != None) + self.file.close() + self.file = None diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta_tests.py new file mode 100755 index 0000000..803d355 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/fasta_tests.py @@ -0,0 +1,37 @@ +""" +Tests for `bx.seq.fasta`. +""" + +import unittest +import sys +import os.path +import fasta + +test_fa = "test_data/seq_tests/test.fa" + +# Same sequence data as stored in test.fa + +valid_seq = "TGGAGGCATTTGTGATTCAATAGATGCAGAAAGAAACCTTCCTAGAGCTG" \ + + "GCGTTCTCTAACTAAAAGTGGAAAGTTCTGAGGAATGAGGACTGTTATAA" \ + + "ATCCCACCCCACACCGCACCTTCTCCAGGGAAGTTTCATGGCCGTGAAGA" \ + + "GGACAGAAAGTGAGAACCAAGATggaactgaataaacaagcttcacactg" \ + + "ttagtttccccatatgcttaccttcccacagatgccaaccttggaggcct" \ + + "aagaggcctagaatattatcctttgtctgatcatttctctacaaatttat" \ + + "tgttctttgttaagatgctacataagcccaaattctaaccacccctttga" \ + + "gttacccatcatcaagtttctcccatgtg" + +valid_seq_len = len( valid_seq ) + +class FASTATestCase( unittest.TestCase ): + + def test_get( self ): + fastafile = fasta.FastaFile( file(test_fa, "rb" ) ) + check_get(fastafile, 0, valid_seq_len) + check_get(fastafile, 0, 40) + check_get(fastafile, valid_seq_len - 40, 40) + +def check_get( fastafile, start, len ): + assert fastafile.get( start, len ) == valid_seq[start:start+len] + +test_classes = [ FASTATestCase ] +suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/nib.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/nib.py new file mode 100755 index 0000000..bdc4776 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/nib.py @@ -0,0 +1,84 @@ +""" +Classes to support nib files. + +:Author: James Taylor (james@bx.psu.edu), Bob Harris (rsharris@bx.psu.edu) + +A nib sequence is a sequence of DNA, using the 10 character alphabet A,C,G,T,N +(upper and lower case). The file is packed as 4 bits per character. + +nib file format +--------------- + +Fields can be in big- or little-endian format; they must match the endianess +of the magic number. + +============ =========== ====================================================== +offset 0x00: 6B E9 3D 3A big endian magic number (3A 3D E9 6B => little endian) +offset 0x04: xx xx xx xx length of data sequence (counted in characters) +offset 0x08: ... data sequence; most significant nybble in each + byte is first in sequence +============ =========== ====================================================== +""" + +from __future__ import division + +from bx.seq.seq import SeqFile,SeqReader +import sys, struct, string, math + +import _nib + +NIB_MAGIC_NUMBER = 0x6BE93D3A +NIB_MAGIC_NUMBER_SWAP = 0x3A3DE96B +NIB_MAGIC_SIZE = 4 +NIB_LENGTH_SIZE = 4 + +class NibFile(SeqFile): + + def __init__(self, file, revcomp=False, name="", gap=None): + SeqFile.__init__(self,file,revcomp,name,gap) + + self.byte_order = ">" + magic = struct.unpack(">L", file.read(NIB_MAGIC_SIZE))[0] + if (magic != NIB_MAGIC_NUMBER): + if magic == NIB_MAGIC_NUMBER_SWAP: self.byte_order = "<" + else: raise Exception("Not a NIB file") + self.magic = magic + self.length = struct.unpack("%sL" % self.byte_order, file.read(NIB_LENGTH_SIZE))[0] + + def raw_fetch(self, start, length): + # Check parameters + assert start >= 0, "Start must be greater than 0" + assert length >= 0, "Length must be greater than 0" + assert start + length <= self.length, "Interval beyond end of sequence" + # Read block of bytes containing sequence + block_start = int(math.floor(start / 2)) + block_end = int(math.floor((start + length - 1) / 2)) + block_len = block_end + 1 - block_start + self.file.seek(NIB_MAGIC_SIZE + NIB_LENGTH_SIZE + block_start) + raw = self.file.read(block_len) + # Unpack compressed block into a character string and return + return _nib.translate_raw_data( raw, start, length ) + +class NibReader(SeqReader): + + def __init__(self, file, revcomp=False, name="", gap=None): + SeqReader.__init__(self,file,revcomp,name,gap) + + def next(self): + if (self.seqs_read != 0): return # nib files have just one sequence + seq = NibFile(self.file,self.revcomp,self.name,self.gap) + self.seqs_read += 1 + return seq + + +class NibWriter(object): + + def __init__(self,file): + self.file = file + + def write(self,seq): + assert (False), "NibWriter.write() is not implemented yet" + + def close(self): + self.file.close() + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/nib_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/nib_tests.py new file mode 100755 index 0000000..64b0620 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/nib_tests.py @@ -0,0 +1,51 @@ +""" +Tests for `bx.seq.nib`. +""" + +import unittest +import sys +import os.path +import nib + +test_nib = "test_data/seq_tests/test.nib" + +# Same sequence data as stored in test.nib + +valid_seq = "TGGAGGCATTTGTGATTCAATAGATGCAGAAAGAAACCTTCCTAGAGCTG" \ + + "GCGTTCTCTAACTAAAAGTGGAAAGTTCTGAGGAATGAGGACTGTTATAA" \ + + "ATCCCACCCCACACCGCACCTTCTCCAGGGAAGTTTCATGGCCGTGAAGA" \ + + "GGACAGAAAGTGAGAACCAAGATggaactgaataaacaagcttcacactg" \ + + "ttagtttccccatatgcttaccttcccacagatgccaaccttggaggcct" \ + + "aagaggcctagaatattatcctttgtctgatcatttctctacaaatttat" \ + + "tgttctttgttaagatgctacataagcccaaattctaaccacccctttga" \ + + "gttacccatcatcaagtttctcccatgtg" + +valid_seq_len = len( valid_seq ) + +class NIBTestCase( unittest.TestCase ): + + def test_get( self ): + nibfile = nib.NibFile( file( test_nib ) ) + # Try all combinations of even / odd boundaries + check_get( nibfile, 0, 10 ) + check_get( nibfile, 1, 10 ) + check_get( nibfile, 0, 11 ) + check_get( nibfile, 1, 11 ) + # Test near end of file also + check_get( nibfile, valid_seq_len - 10, 10 ) + check_get( nibfile, valid_seq_len - 11, 11 ) + # Test really short gets + check_get( nibfile, 0, 0 ) + check_get( nibfile, 1, 0 ) + check_get( nibfile, 0, 1 ) + check_get( nibfile, 1, 1 ) + # Test negative length + self.assertRaises( AssertionError, nibfile.get, 20, -1 ) + +def check_get( nibfile, start, len ): + ## print "expect: |%r|" % valid_seq[start:start+len] + ## print "actual: |%r|" % nibfile.get( start, len ) + assert nibfile.get( start, len ) == valid_seq[start:start+len] + +test_classes = [ NIBTestCase ] +suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna.py new file mode 100755 index 0000000..342d4b5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna.py @@ -0,0 +1,283 @@ +""" +Classes to support "quantum-DNA" files. + +:Author: Bob Harris (rsharris@bx.psu.edu) + +A quantum DNA sequence is a sequence of bytes, each representing a probability +distribution (vector) over A, C, G, T. The QdnaFile class encapsulates the +sequence of bytes, while the mapping from byte value to probability vector is +encapsulated by the QdnaCodebook class. + +qdna file format +~~~~~~~~~~~~~~~~ + +Fields can be in big- or little-endian format; they must match the endianess +of the magic number. + +============ =========== ====================================================== +offset 0x00: C4 B4 71 97 big endian magic number (97 71 B4 C4 => little endian) +offset 0x04: 00 00 02 00 version 2.0 (fourth byte is sub version) +offset 0x08: 00 00 00 14 header length (in bytes, including this field) +offset 0x0C: xx xx xx xx S, offset (from file start) to data sequence +offset 0x10: xx xx xx xx N, offset to name, 0 indicates no name +offset 0x14: xx xx xx xx length of data sequence (counted in 'items') +offset 0x18: xx xx xx xx (for version >= 2.0) P, offset to named + .. properties, 0 indicates no properties +offset N: ... name (zero-terminated string) +offset S: ... data sequence +offset P: ... named properties (see below) +============ =========== ====================================================== + +The named properties section consists of a list of pairs of zero-terminated +strings. The list itself is terminated by an empty string (i.e. another +zero). In each pair, the first is the name of the property and the second +is its value. Some names are recognized and handled in some specific manner +(see list below this paragraph). Any unrecognized name is simply added as +an instance variable with that name, as long as it is not already an instance +variable (in which case it is an error). + +Recognized properties (at present only one): + - codebook: A string in qdna code file format (see QdnaCodebook class for details). +""" + +from bx.seq.seq import SeqFile,SeqReader +import sys, struct, string +from StringIO import StringIO + +qdnaMagic = 0xC4B47197L # big endian magic number for qdna files +qdnaMagicSwap = 0x9771B4C4L + +class QdnaFile(SeqFile): + + def __init__(self, file, revcomp=False, name="", gap=None, codebook=None): + SeqFile.__init__(self,file,revcomp,name,gap) + if (gap == None): self.gap = chr(0) + assert (revcomp == False), "reverse complement is not supported for qdna files" + self.codebook = codebook + + self.byte_order = ">" + magic = struct.unpack(">L", file.read(4))[0] + if (magic != qdnaMagic): + if (magic == qdnaMagicSwap): + self.byte_order = "<" + else: + raise "not a quantum-dna file (magic=%08X)" % magic + + self.magic = magic + + # process header + + self.version = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + if (self.version not in [0x100,0x200]): + raise "unsupported quantum-dna (version=%08X)" % self.version + + self.headerLength = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + if (self.headerLength < 0x10): + raise "unsupported quantum-dna (header len=%08X)" % self.headerLength + if (self.version == 0x100) and (self.headerLength != 0x10): + raise "unsupported quantum-dna (version 1.0 header len=%08X)" % self.headerLength + + self.seqOffset = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + self.nameOffset = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + self.length = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + + self.propOffset = 0 + if (self.headerLength >= 0x14): + self.propOffset = struct.unpack("%sL" % self.byte_order, + self.file.read(4))[0] + + self.name = "" + if (self.nameOffset != 0): + self.file.seek(self.nameOffset) + self.name = self.read_string() + + if (self.propOffset != 0): + self.file.seek(self.propOffset) + while (True): + name = self.read_string() + if (len(name) == 0): break + value = self.read_string() + self.set_property(name,value) + + + def set_property(self,name,value): + if (name == "codebook"): + self.codebook = QdnaCodebook(StringIO(value)) + else: + raise Exception("named properties as instance variables are not implemented yet") + # $$$ do this by adding a properties dict and __getitem__/__setitem__ + # $$$ also need to write properties in QdnaWriter.write() + + + def read_string(self): + s = "" + while (True): + ch = self.file.read(1) + if (ch == chr(0)): break + s += ch + return s + + + def raw_fetch(self, start, length): + self.file.seek(self.seqOffset + start) + return self.file.read(length) + + + def get_quantum(self, start, length): + assert (self.codebook != None), \ + "qdna sequence %s has no code book" % self.name + return [self.codebook[codeNum] for codeNum in self.raw_fetch(start,length)] + + +class QdnaReader(SeqReader): + + def __init__(self, file, revcomp=False, name="", gap=None, codebook=None): + SeqReader.__init__(self,file,revcomp,name,gap) + self.codebook = codebook + + def next(self): + if (self.seqs_read != 0): return # qdna files have just one sequence + seq = QdnaFile(self.file,self.revcomp,self.name,self.gap,self.codebook) + self.seqs_read += 1 + return seq + +""" +A QdnaCodebook maps code numbers to the corresponding probability vector. The +latter is a hash from symbols (usually "A", "C", "G", or "T") to the +corresponsing probability. Note that code numbers are of type string. + +qdna code file format: + + The file is ascii text and looks something like what's shown below. Lines + beginning with # are comments, and columns are assumed to represent A, C, G + and T (in that order). Anything other than five columns is an error. Note + that code number zero is usually reserved for gaps in quantum sequences, and + thus usually won't appear in a code file. Note that code numbers are + two-digit hexadecimal (to match the textual displays of quantum sequences). + + 01 0.111002 0.072588 0.127196 0.689214 + 02 0.081057 0.023799 0.098657 0.796487 + 03 0.000260 0.003823 0.000336 0.995581 + ... more lines, usually a total of 255 ... + FF 0.465900 0.008602 0.482301 0.043197 +""" + +class QdnaCodebook(object): + + def __init__(self,file): + (self.alphabet,self.codeToProbs) = self.read_codebook(file) + + + def __str__(self): + codeSet = [codeNum for codeNum in self.codeToProbs] + codeSet.sort() + return "\n".join([self.vector_text(codeNum) for codeNum in codeSet]) + + def vector_text(self,codeNum): + if (codeNum in self.codeToProbs): vec = self.codeToProbs[codeNum] + else: vec = {} + for sym in self.alphabet: + if (sym not in vec): + vec[sym] = 0.0 + return ("%02X\t" % ord(codeNum)) \ + + "\t".join(["%.6f" % vec[sym] for sym in self.alphabet]) + + + def __getitem__ (self,codeNum): + return self.codeToProbs[codeNum] + + + def __setitem__ (self,codeNum,value): + self.codeToProbs[codeNum] = value # value should be hash from symbol + # .. to probability + + + def read_codebook(self,codeF): + alphabet = "ACGT" + codeToProbs = {} + + for (lineNum,line) in enumerate (codeF): + lineNum += 1 + line = line.rstrip() + stripped = line.strip() + if (stripped == "") or (stripped.startswith("#")): + continue + + fields = line.split(None) + if (len(fields) != 5): + raise "wrong vector size (line %d)" % lineNum + + try: + codeNum = int(fields[0],16) + except: + raise "bad character code %s (line %d)" \ + % (fields[0],lineNum) + + if (not 0 <= codeNum <= 255): + raise "character code %s is outside the valid range (line %d)" \ + % (fields[0],lineNum) + + if (chr(codeNum) in codeToProbs): + raise "character code %s appears more than once (line %d)" \ + % (fields[0],lineNum) + + try: + vec = {} + for ix in range(1,5): + p = float(fields[ix]) + if (p < 0) or (p > 1): raise ValueError + vec[alphabet[ix-1]] = p + except: + raise "%s is a bad probability value (line %d)" \ + % (fields[ix],lineNum) + + codeToProbs[chr(codeNum)] = vec + + return (alphabet,codeToProbs) + + +class QdnaWriter(object): + + def __init__(self,file): + self.file = file + + def write(self,seq): + text = seq.text + if (text == None): text = "" + + version = 0x200 + headerLen = 0x014 + offset = headerLen + 8 + + nameOffset = 0 + if (seq.name != None) and (seq.name != ""): + nameOffset = 0x01C + offset += len(seq.name) + 1 + name = seq.name + chr(0) + + dataOffset = offset + offset += len(text) + + assert (seq.codebook == None), \ + "QdnaWriter.write() does not support codebooks yet" + propOffset = 0 + + self.file.write(struct.pack("%sL" % seq.byte_order,qdnaMagic)) + self.file.write(struct.pack("%sL" % seq.byte_order,version)) + self.file.write(struct.pack("%sL" % seq.byte_order,headerLen)) + self.file.write(struct.pack("%sL" % seq.byte_order,dataOffset)) + self.file.write(struct.pack("%sL" % seq.byte_order,nameOffset)) + self.file.write(struct.pack("%sL" % seq.byte_order,len(text))) + self.file.write(struct.pack("%sL" % seq.byte_order,propOffset)) + if (nameOffset != 0): self.file.write(name) + self.file.write(text) + + + def close(self): + self.file.close() + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna_tests.py new file mode 100755 index 0000000..947c0df --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/qdna_tests.py @@ -0,0 +1,37 @@ +""" +Tests for `bx.seq.qdna`. +""" + +import unittest +import sys +import os.path +import qdna + +test_qdna = "test_data/seq_tests/test.qdna" + +# Same sequence data as stored in test.qdna + +valid_seq = "C7wMwHQrMKqEtSREuUv5nsLinpTS8l7jXpbI7IipvCbHnhOdgx" \ + + "5tzRgzYl4j85d:xSlvKPEKEIvZkfiX1YPkBi1Ibhfn9fTZd8gG" \ + + "Wy284hJnwf93W4eHOjeRk7LuVYmH{UTYkYM:b4J4MruMq1ihhv" \ + + "1Yl5W[xXEmi8[JuuLRgooBpy23PllMuUiIiKVIK5vzhjPPYp5Y" \ + + "1eqPxo[e5I24KeCdTV94MZWNybUb:McC:1n4Jczk8JqnR4q1gY" \ + + "HjLS4Bes3s5YvvWdKzS4VrFZy2erhd7YoWRoS[UK8JtSp1{Z1o" \ + + "5:TpvN8mrmWrghiNw{S6nT8DSfF{1ff6kNGpI:FsZE2RgipTVO" \ + + "mJN6vPm8MUgNYd7MDBEu37YOPzPjO1dr" + +valid_seq_len = len(valid_seq) + +class QDNATestCase(unittest.TestCase): + + def test_get(self): + qdnafile = qdna.QdnaFile(file(test_qdna,"rb")) + check_get(qdnafile, 0, valid_seq_len) + check_get(qdnafile, 0, 40) + check_get(qdnafile, valid_seq_len - 40, 40) + +def check_get(qdnafile, start, len): + assert qdnafile.get(start, len) == valid_seq[start:start+len] + +test_classes = [ QDNATestCase ] +suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/seq.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/seq.py new file mode 100755 index 0000000..727c700 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/seq.py @@ -0,0 +1,135 @@ +""" +Classes to support "biological sequence" files. + +:Author: Bob Harris (rsharris@bx.psu.edu) +""" + +# DNA reverse complement table + +DNA_COMP = " - " \ + " TVGH CD M KN YSA BWXR tvgh cd m kn ysa bwxr " \ + " " \ + " " + +class SeqFile(object): + """ + A biological sequence is a sequence of bytes or characters. Usually these + represent DNA (A,C,G,T), proteins, or some variation of those. + + class attributes: + + file: file object containing the sequence + revcomp: whether gets from this sequence should be reverse-complemented + False => no reverse complement + True => (same as "-5'") + "maf" => (same as "-5'") + "+5'" => minus strand is from plus strand's 5' end (same as "-3'") + "+3'" => minus strand is from plus strand's 3' end (same as "-5'") + "-5'" => minus strand is from its 5' end (as per MAF file format) + "-3'" => minus strand is from its 3' end (as per genome browser, + but with origin-zero) + name: usually a species and/or chromosome name (e.g. "mule.chr5"); if + the file contains a name, that overrides this one + gap: gap character that aligners should use for gaps in this sequence + """ + + def __init__(self, file=None, revcomp=False, name="", gap=None): + + + self.file = file + if (revcomp == True): self.revcomp = "-5'" + elif (revcomp == "+3'"): self.revcomp = "-5'" + elif (revcomp == "+5'"): self.revcomp = "-3'" + elif (revcomp == "maf"): self.revcomp = "-5'" + else: self.revcomp = revcomp + self.name = name + if (gap == None): self.gap = "-" + else: self.gap = gap + + self.text = None # (subclasses fill in text and + self.length = 0 # length or they most override get()) + + def close(self): + assert (self.file != None) + self.file.close() + self.file = None + + def extract_name(self,line): + try: + return line.split()[0] + except: + return "" + + def set_text(self,text): + self.text = text + self.length = len(text) + + def __str__ (self): + text = "" + if (self.name != None): text += self.name + " " + text += self.get(0,self.length) + return text + + def get(self, start, length): + """ + Fetch subsequence starting at position `start` with length `length`. + This method is picky about parameters, the requested interval must + have non-negative length and fit entirely inside the NIB sequence, + the returned string will contain exactly 'length' characters, or an + AssertionError will be generated. + """ + # Check parameters + assert length >= 0, "Length must be non-negative (got %d)" % length + assert start >= 0,"Start must be greater than 0 (got %d)" % start + assert start + length <= self.length, \ + "Interval beyond end of sequence (%s..%s > %s)" % ( start, start + length, self.length ) + # Fetch sequence and reverse complement if necesary + if not self.revcomp: + return self.raw_fetch( start, length ) + if self.revcomp == "-3'": + return self.reverse_complement(self.raw_fetch(start,length)) + assert self.revcomp == "-5'", "unrecognized reverse complement scheme" + start = self.length - (start+length) + return self.reverse_complement(self.raw_fetch(start,length)) + + def raw_fetch(self, start, length): + return self.text[start:start+length] + + def reverse_complement(self,text): + comp = [ch for ch in text.translate(DNA_COMP)] + comp.reverse() + return "".join(comp) + + +class SeqReader(object): + """Iterate over all sequences in a file in order""" + + def __init__(self, file, revcomp=False, name="", gap=None): + self.file = file + self.revcomp = revcomp + self.name = name + self.gap = gap + self.seqs_read = 0 + + def close(self): + self.file.close() + + def __iter__(self): + return SeqReaderIter(self) + + def next(self): # subclasses should override this method and return the + return # .. next sequence (of type SeqFile or a subclass) read + # .. from self.file + + +class SeqReaderIter(object): + def __init__(self,reader): + self.reader = reader + def __iter__(self): + return self + def next(self): + v = self.reader.next() + if not v: raise StopIteration + return v + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/seq_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/seq_tests.py new file mode 100755 index 0000000..cafc017 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/seq_tests.py @@ -0,0 +1,54 @@ +""" +Tests for `bx.seq.seq`. +""" + + +import unittest +import os.path +import sys +import bx.seq, fasta_tests, nib_tests, qdna_tests + +test_fa = "test_data/seq_tests/test.fa" +test2_fa = "test_data/seq_tests/test2.fa" +test_nib = "test_data/seq_tests/test.nib" +test_qdna = "test_data/seq_tests/test.qdna" + +valid_fasta = fasta_tests.valid_seq +valid_nib = nib_tests.valid_seq +valid_qdna = qdna_tests.valid_seq + +# Same sequences as stored in test2.fa + +valid2_fa = [("apple", "GGCGCTGCGATAAGGTTGCGACAACACGGACCTTCTTTTGCCTACCTCTGTTCTTGGCACG"), + ("orange", "CGTGCCGAGAACAGAAAATACGCCGGGCGGTGCAGTAGTATCTTGGTATCCGATATGCAGG"), + ("grapefruit", "CCTGCATATCGACTAGTACACCCTCCCGAGGTACCCCACCCATCCCTCTTTTCTCGGCGCG")] + +class SEQTestCase (unittest.TestCase): + + def test_get_fasta (self): + fastafile = bx.seq.seq_file (file (test_fa, "rb")) + check_get (fastafile, valid_fasta, 3, 40) + + def test_get_nib (self): + nibfile = bx.seq.seq_file (file (test_nib, "rb")) + check_get (nibfile, valid_nib, 3, 40) + + def test_get_qdna (self): + qdnafile = bx.seq.seq_file (file (test_qdna, "rb")) + check_get (qdnafile, valid_qdna, 3, 40) + + def test_get_reader (self): + reader = bx.seq.seq_reader (file (test2_fa, "rb")) + for (ix,seq) in enumerate(reader): + assert (ix < len(valid2_fa)), "FastaReader returns too many sequences" + text = "%s" % seq + fields = text.split() + assert (len(fields) == 2), "SeqReader.__str__ returns incorrect sequence string \"%s\" (%d)" % text + assert (fields[0] == valid2_fa[ix][0]), "FastaReader returned the wrong name (%s,%s)" % (fields[0],valid2_fa[ix][0]) + assert (fields[1] == valid2_fa[ix][1]), "FastaReader returned the wrong text (%s,%s)" % (fields[1],valid2_fa[ix][1]) + +def check_get (seqfile, valid_seq, start, len): + assert seqfile.get (start, len) == valid_seq[start:start+len] + +test_classes = [SEQTestCase] +suite = unittest.TestSuite ([unittest.makeSuite (c) for c in test_classes]) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit.py new file mode 100755 index 0000000..c5a73aa --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit.py @@ -0,0 +1,126 @@ +""" +Access to files containing sequence data in 'twobit' format. +""" + +import sys +import _twobit + +from struct import * +from UserDict import DictMixin + +TWOBIT_MAGIC_NUMBER = 0x1A412743 +TWOBIT_MAGIC_NUMBER_SWAP = 0x4327411A +TWOBIT_MAGIC_SIZE = 4 + +TWOBIT_VERSION = 0 + +class TwoBitSequence( object ): + def __init__( self, tbf, header_offset=None ): + self.tbf = tbf + self.header_offset = header_offset + self.sequence_offset = None + self.size = None + self.n_blocks = None + self.masked_blocks = None + self.loaded = False + + def __getitem__( self, slice ): + start, stop, stride = slice.indices( self.size ) + assert stride == 1, "Striding in slices not supported" + if stop - start < 1: + return "" + return _twobit.read( self.tbf.file, self, start, stop, self.tbf.do_mask ) + + def __len__( self ): + return self.size + + def get( self, start, end ): + # Trim start / stop + if start < 0: + start = 0 + if end > self.size: + end = self.size + out_size = end - start + if out_size < 1: + raise Exception( "end before start (%s,%s)" % ( start,end ) ) + # Find position of packed portion + dna = _twobit.read( self.tbf.file, self, start, end, self.tbf.do_mask ) + # Return + return dna + +class TwoBitFile( DictMixin ): + def __init__( self, file, do_mask=True ): + self.do_mask = do_mask + # Read magic and determine byte order + self.byte_order = ">" + magic = unpack( ">L", file.read( TWOBIT_MAGIC_SIZE ) )[0] + if magic != TWOBIT_MAGIC_NUMBER: + if magic == TWOBIT_MAGIC_NUMBER_SWAP: + self.byte_order = "<" + else: + raise Exception( "Not a NIB file" ) + self.magic = magic + self.file = file + # Read version + self.version = self.read( "L" ) + if self.version != TWOBIT_VERSION: + raise Exception( "File is version '%d' but I only know about '%d'" % ( self.version, TWOBIT_VERSION ) ) + # Number of sequences in file + self.seq_count = self.read( "L" ) + # Header contains some reserved space + self.reserved = self.read( "L" ) + # Read index of sequence names to offsets + index = dict() + for i in range( self.seq_count ): + name = self.read_p_string() + offset = self.read( "L" ) + index[name] = TwoBitSequence( self, offset ) + self.index = index + + def __getitem__( self, name ): + seq = self.index[name] + if not seq.loaded: + self.load_sequence( name ) + return seq + + def keys( self ): + return self.index.keys() + + def load_sequence( self, name ): + seq = self.index[name] + # Seek to start of sequence block + self.file.seek( seq.header_offset ) + # Size of sequence + seq.size = self.read( "L" ) + # Read N and masked block regions + seq.n_block_starts, seq.n_block_sizes = self.read_block_coords() + seq.masked_block_starts, seq.masked_block_sizes = self.read_block_coords() + # Reserved + self.read( "L" ) + # Save start of actualt sequence + seq.sequence_offset = self.file.tell() + # Mark as loaded + seq.loaded = True + + def read_block_coords( self ): + blocks = [] + block_count = self.read( "L" ) + if block_count == 0: + return [], [] + starts = self.read( str( block_count ) + "L", untuple=False ) + sizes = self.read( str( block_count ) + "L", untuple=False ) + return list( starts ), list( sizes ) + + def read( self, pattern, untuple=True ): + rval = unpack( self.byte_order + pattern, + self.file.read( calcsize( self.byte_order + pattern ) ) ) + if untuple and len( rval ) == 1: + return rval[0] + return rval + + def read_p_string( self ): + """ + Read a length-prefixed string + """ + length = self.read( "B" ) + return self.file.read( length ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit_tests.py new file mode 100755 index 0000000..2412521 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seq/twobit_tests.py @@ -0,0 +1,48 @@ +import sys +import twobit +import random + +def quick_fasta_iter( f ): + current_header = None + current_sequence = [] + for line in f: + if line.startswith( "#" ): + continue + if line.startswith( ">" ): + if current_sequence: + ## print current_header, "".join( current_sequence ) + yield current_header, "".join( current_sequence ) + current_sequence = [] + current_header = line.strip()[1:] + else: + current_sequence.append( "".join( line.split() ) ) + if current_sequence: + yield current_header, "".join( current_sequence ) + current_sequence = [] + +def test(): + """ + Nose test generator + """ + for t in "test", "testN", "testMask": + test_fa = "test_data/seq_tests/%s.fa" % t + test_twobit = "test_data/seq_tests/%s.2bit" % t + yield check_random_subseq_matches, test_fa, test_twobit + +def check_random_subseq_matches( test_fa, test_twobit ): + # Load Fasta data + expected = {} + for h, s in quick_fasta_iter( open( test_fa ) ): + expected[h] = s + # Open 2bit + t = twobit.TwoBitFile( open( test_twobit ) ) + for k, s in expected.iteritems(): + assert k in t.index + # assert t.index[k].size == len(s) + length = len(s) + for i in range( 100 ): + start = random.randint( 0, length-2 ) + end = random.randint( start+1, length ) + assert t[k].get(start, end) == s[start:end] + assert t[k][start:end] == s[start:end], \ + "seq: %s, start: %d, end: %d\nExpected:\n%s\nActual:\n%s\n" % ( k, start, end, s[start:end], t.get( k, start, end ) ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seqmapping.py b/code/utilities/CPAT-1.2.2/lib/bx/seqmapping.py new file mode 100755 index 0000000..594c481 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seqmapping.py @@ -0,0 +1,94 @@ +""" +Classes for char-to-int mapping and int-to-int mapping. + +:Author: James Taylor (james@bx.psu.edu) + +The char-to-int mapping can be used to translate a list of strings +over some alphabet to a single int array (example for encoding a multiple +sequence alignment). + +The int-to-int mapping is particularly useful for creating partitions, +and provides methods to merge/split symbols in the output mapping. + +The two forms of mapping can be combined, for example to encode a +multiple sequence alignment in a reduced alphabet defined by a partition +of alignment columns. Many of the helper methods provided are for +solving such alignment oriented problems. + +This code was originally written for the `ESPERR`_ project which includes +software for searcing for alignment encodings that work well for specific +classification problems using various Markov chain classifiers over the +reduced encodings. + +Most of the core implementation is in the pyrex/C extension +"_seqmapping.pyx" for performance reasons (specifically to avoid the +excessive bounds checking that would make a sequence/array lookup heavy +problem like this slow in pure python). + +.. _ESPERR: http://www.bx.psu.edu/projects/esperr/ +""" + +from _seqmapping import * + +# Char->Int mapping for DNA characters with missing data + +DNA = CharToIntArrayMapping() +DNA.set_mapping( "a", 0 ) +DNA.set_mapping( "A", 0 ) +DNA.set_mapping( "c", 1 ) +DNA.set_mapping( "C", 1 ) +DNA.set_mapping( "g", 2 ) +DNA.set_mapping( "G", 2 ) +DNA.set_mapping( "t", 3 ) +DNA.set_mapping( "T", 3 ) +DNA.set_mapping( "-", 4 ) +DNA.set_mapping( "*", 5 ) + +# Creating mappings + +def alignment_mapping_from_file( f, char_mapping=DNA ): + """ + Create a mapping from a file of alignment columns. + """ + columns, symbols = [], [] + for line in f: + column, symbol = line.split() + columns.append( column ) + symbols.append( int( symbol ) ) + + align_count = len( columns[0] ) + + mapping = IntToIntMapping( char_mapping.get_out_size() ** align_count ) + + for column, symbol in zip( columns, symbols ): + index = char_mapping.translate_list( list( column ) )[0] + mapping.set_mapping( index, symbol ) + + return align_count, mapping + +def second_mapping_from_file( f, first_mapping, char_mapping=DNA ): + + columns, symbols = [], [] + for line in f: + column, symbol = line.split() + columns.append( column ) + symbols.append( int( symbol ) ) + + align_count = len( columns[0] ) + + mapping = IntToIntMapping( first_mapping.get_out_size() ) + + for column, symbol in zip( columns, symbols ): + index = char_mapping.translate_list( list( column ) )[0] + if first_mapping[index] >= 0: + mapping.set_mapping( first_mapping[index], symbol ) + + return mapping + + +def identity_mapping( size ): + mapping = IntToIntMapping( size ) + for i in range( size ): + mapping.set_mapping( i, i ) + return mapping + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/seqmapping_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/seqmapping_tests.py new file mode 100755 index 0000000..e6003f7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/seqmapping_tests.py @@ -0,0 +1,89 @@ +""" +Tests for `bx.seqmapping`. +""" + +import sys + +import unittest +import bx.seqmapping + +from numpy import array, allclose +from StringIO import StringIO + +class CharMappingTests( unittest.TestCase ): + def test_DNA( self ): + assert( allclose( bx.seqmapping.DNA.translate( "ACGTacgt-?X" ), + [ 0, 1, 2, 3, 0, 1, 2, 3, 4, -1, -1 ] ) ) + def test_DNA_list( self ): + assert( allclose( bx.seqmapping.DNA.translate_list( [ "ACGTA", "TGCAX" ] ), + [ 0 + 3*6, 1 + 2*6, 2 + 1*6, 3 + 0*6, -1 ] ) ) + def test_other( self ): + m = bx.seqmapping.CharToIntArrayMapping() + m.set_mapping( "A", 0 ) + m.set_mapping( "B", 7 ) + assert( allclose( m.translate( "ABCCBA" ), [ 0, 7, -1, -1, 7, 0 ] ) ) + +class IntMappingTests( unittest.TestCase ): + def test_simple( self ): + m = bx.seqmapping.IntToIntMapping( 4 ) + m.set_mapping( 0, 0 ) + m.set_mapping( 2, 0 ) + m.set_mapping( 1, 1 ) + m.set_mapping( 3, 1 ) + assert( allclose( m.translate( array( [ 0, 1, 2, 3, 4 ], 'i' ) ), array( [ 0, 1, 0, 1, -1 ] ) ) ) + +eight_species_mapping = """TTTTTTTT 0 +CCCCCCCC 4 +AAAAAAAA 1 +GGGGGGGG 5 +AAAAA*AA 2 +TTTTT*TT 0 +GGGGG*GG 5 +CCCCC*CC 4 +GGGG*GGG 5 +TTTT*TTT 2 +GGGAAGGG 5 +AAAA*AAA 2 +TTTTT*T* 2 +CCCCC*C* 4 +CCCTTCCC 4 +CCCC*CCC 4 +TTTT**TT 2 +AAAA**AA 2 +AAAAA*A* 2 +GGGGG*G* 5 +AAAAAGAA 2 +TTTTTCTT 2 +GGGAA*GG 5 +TTTT**T* 2 +TTTCCTTT 0 +AAAAAAA* 1 +CCCTT*CC 3 +TTTTTTT* 2 +CC*CC*CC 3 +AAAGGAAA 2 +------G- 2 +""" + +rows = [ "AAATTGT-----ATGTCCATCCTTTAAAGGTCATTCCTTTAATGGTCTTTTCTGGACACCACTAGGGGTCAGAAGTAGTTCATCAAAC-----------------TTTCTTCCCTCCC-TACTTCAGTG", + "AAATTGT-----ATGTCCATCCTTTAAAGGTCATTCCTTTAATGGTCTTTTCTGGACACCACTAGGGGTCAGAAGTAGTTCATCAAAC-----------------TTTCTTCCCTCCC-TACTTCAGTG", + "AAATTTT-----ATGTCTATCCTTTAAAGGTCATTCCTCTAATAGTCTTTTCTGGACACCACTAGGGGTCAGAAGTAGTTCATTAAAC-----------------TTTCTTCCCTCCC-TACCTCAGTG", + "AAACTGT-----ATCACCACCTTTTTAAGGTCATTTCTCTAATGATCCTGTT-GCATACCAGTAGGGGGCAGAAGTGTTCCGCTGATTTCCGCCCTCCTCCCCACCCCCCCACCCCCC-TTATTCAAAG", + "*********************************************************************************************************************************", + "-TATTAT-----ATGGCCATGTTCAAAAGGTTGTTTCTCTAATGATTCCTTC-TGATACCAGTAGGGGTCAGAAGTGGTCCATTGATT---------------------CTTTTCCTC-TGATTC-AAG", + "AAATTGA--AAGATCTCACTCTTTGCCAGGTAGTCCATCTAAGGGTCACATATGGATACCAGCAGGGCCT-GAAGAAGCCCATTGAAT------------------------TTTCCC-ATCTTCAAGG", + "AAATTCATGATAGTGTCACTCTTAAATAGATGATTC--------TTCACAT---GATGCCAGCAGGGGGC-AGAGCAGGCTGTGAAAT------------------------TTTCCCTTTCTTCAAAG" ] + +""" +class AlignmentMappingTests( unittest.TestCase ): + def test_largescale( self ): + f = StringIO( eight_species_mapping ) + n, m = bx.seqmapping.alignment_mapping_from_file( f ) + t = bx.seqmapping.DNA.translate_list( rows ) + print >> sys.stderr, t, m, m.get_in_size(), m.get_out_size() + i = m.translate( t ) +""" + + +test_classes = [ AlignmentMappingTests, CharMappingTests, IntMappingTests ] +suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx/tabular/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx/tabular/__init__.py new file mode 100755 index 0000000..992c9c2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/tabular/__init__.py @@ -0,0 +1,3 @@ +""" +Support for working with delimited data files. +""" \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/bx/tabular/io.py b/code/utilities/CPAT-1.2.2/lib/bx/tabular/io.py new file mode 100755 index 0000000..f450f85 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/tabular/io.py @@ -0,0 +1,146 @@ +""" +Reading and writing delimited data files (with headers and comments). +""" + +import sys +from itertools import * +from UserDict import DictMixin + +FIRST_LINE_IS_HEADER = object() + +class ParseError( Exception ): + def __init__( self, *args, **kwargs ): + Exception.__init__( self, *args ) + self.linenum = kwargs.get("linenum",None) + def __str__( self ): + if self.linenum: + return Exception.__str__( self ) + " on line " + str(self.linenum) + else: + return Exception.__str__( self ) + +class TableRow( object ): + """ + A row of a table + """ + def __init__( self, reader, fields ): + self.reader = reader + self.fields = fields + def __getitem__( self, key ): + if type( key ) == int: + return self.fields[key] + elif type( key ) == str: + if self.reader.header: + return self.fields[ self.reader.header.field_to_column[key] ] + else: + raise TypeError( "column names only supported for files with headers" ) + else: + raise TypeError( "field indices must be integers or strings" ) + @property + def fieldnames( self ): + return self.reader.header.fields + def __str__( self ): + return "\t".join( self.fields ) + +class Header( object ): + """ + Header of a table -- contains column names and a mapping from them + to column indexes + """ + def __init__( self, fields ): + self.set_fields( fields ) + def set_fields( self, fields ): + self.fields = fields + self.field_to_column = dict( zip( fields, count() ) ) + def __getitem__( self, key ): + if type( key ) == int: + return self.fields[key] + elif type( key ) == str: + if key in self.field_to_column: + return key + else: + raise TypeError( "field indices must be integers or strings" ) + def __str__( self ): + return "#" + "\t".join( self.fields ) + +class Comment( object ): + def __init__( self, line ): + self.line = line + def __str__( self ): + if self.line.startswith("#"): + return self.line + return "#" + self.line + +class TableReader( object ): + """ + Reader for iterating tabular data + """ + def __init__( self, input, return_header=True, return_comments=True, force_header=None, comment_lines_startswith = ["#"] ): + self.input = input + self.return_comments = return_comments + self.return_header = return_header + self.input_iter = iter( input ) + self.linenum = 0 + self.header = force_header + self.comment_lines_startswith = comment_lines_startswith + def __iter__( self ): + return self + def next( self ): + line = self.input_iter.next() + self.linenum += 1 + line = line.rstrip( "\r\n" ) + # Catch blank lines (throw a warning?) + # This will end up adding a '#' at the beginning of blank lines + if line == '': + if self.return_comments: + return Comment( line ) + else: + return self.next() + # Force header? + if self.header is FIRST_LINE_IS_HEADER and self.linenum == 1: + self.header = self.parse_header( line ) + if self.return_header: + return self.header + else: + return self.next() + # Is it a comment line? + for comment_line_start in self.comment_lines_startswith: + if line.startswith( comment_line_start ): + # If a comment and the first line we assume it is a header + if self.header is None and self.linenum == 1: + self.header = self.parse_header( line ) + if self.return_header: + return self.header + else: + return self.next() + else: + if self.return_comments: + return self.parse_comment( line ) + else: + return self.next() + # Not a comment, must be an interval + try: + return self.parse_row( line ) + except ParseError, e: + e.linenum = self.linenum + raise e + def parse_header( self, line ): + if line.startswith("#"): + fields = line[1:].split( "\t" ) + else: + fields = line.split( "\t" ) + return Header( fields ) + def parse_comment( self, line ): + return Comment( line ) + def parse_row( self, line ): + return TableRow( self, line.split( "\t" ) ) + + + + + + + + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/bx/wiggle.py b/code/utilities/CPAT-1.2.2/lib/bx/wiggle.py new file mode 100755 index 0000000..b4647a4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/wiggle.py @@ -0,0 +1,78 @@ +""" +Support for scores in the `wiggle`_ file format used by the UCSC Genome +Browser. + +The positions in the wiggle format are 1-relative, however, +the positions returned match the BED/interval format which is zero-based, half-open. + +.. _wiggle: http://genome.ucsc.edu/goldenPath/help/wiggle.html +""" + +def parse_header( line ): + return dict( [ field.split( '=' ) for field in line.split()[1:] ] ) + +def IntervalReader( f ): + """ + Iterator yielding chrom, start, end, strand, value. + Values are zero-based, half-open. + Regions which lack a score are ignored. + """ + current_chrom = None + current_pos = None + current_step = None + + # always for wiggle data + strand = '+' + + mode = "bed" + + for line in f: + if line.isspace() or line.startswith( "track" ) or line.startswith( "#" ) or line.startswith( "browser" ): + continue + elif line.startswith( "variableStep" ): + header = parse_header( line ) + current_chrom = header['chrom'] + current_pos = None + current_step = None + if 'span' in header: current_span = int( header['span'] ) + else: current_span = 1 + mode = "variableStep" + elif line.startswith( "fixedStep" ): + header = parse_header( line ) + current_chrom = header['chrom'] + current_pos = int( header['start'] ) - 1 + current_step = int( header['step'] ) + if 'span' in header: current_span = int( header['span'] ) + else: current_span = 1 + mode = "fixedStep" + elif mode == "bed": + fields = line.split() + if len( fields ) > 3: + if len( fields ) > 5: + yield fields[0], int( fields[1] ), int( fields[2] ), fields[5], float( fields[3] ) + else: + yield fields[0], int( fields[1] ), int( fields[2] ), strand, float( fields[3] ) + elif mode == "variableStep": + fields = line.split() + pos = int( fields[0] ) - 1 + yield current_chrom, pos, pos + current_span, strand, float( fields[1] ) + elif mode == "fixedStep": + yield current_chrom, current_pos, current_pos + current_span, strand, float( line.split()[0] ) + current_pos += current_step + else: + raise "Unexpected input line: %s" % line.strip() + + +class Reader( object ): + """ + Iterator yielding chrom, position, value. + Values are zero-based. + Regions which lack a score are ignored. + """ + def __init__( self, f ): + self.file = f + + def __iter__( self ): + for chrom, start, end, strand, val in IntervalReader( self.file ): + for pos in xrange( start, end ): + yield chrom, pos, val diff --git a/code/utilities/CPAT-1.2.2/lib/bx/wiggle_tests.py b/code/utilities/CPAT-1.2.2/lib/bx/wiggle_tests.py new file mode 100755 index 0000000..4cdc3a9 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx/wiggle_tests.py @@ -0,0 +1,90 @@ +""" +Tests for `bx.wiggle`. +""" + +import unittest +from bx import wiggle +from StringIO import StringIO + +# A modified version of UCSC's example wiggle, taken from http://genome.ucsc.edu/goldenPath/help/wiggleExample.txt +test_wig = """browser position chr19:59302001-59311000 +browser hide all +browser pack refGene encodeRegions +browser full altGraph +# 5 base wide bar graph, autoScale is on by default == graphing +# limits will dynamically change to always show full range of data +# in viewing window, priority = 20 positions this as the second graph +# Note, zero-relative, half-open coordinate system in use for bed format +track type=wiggle_0 name="Bed Format" description="BED format" visibility=full color=200,100,0 altColor=0,100,200 priority=20 +chr19 59302000 59302005 -1.0 +chr19 59302300 59302305 -0.75 +# 4 base wide bar graph at arbitrarily spaced positions, +# threshold line drawn at y=11.76 +# autoScale off viewing range set to [0:25] +# priority = 10 positions this as the first graph +# Note, one-relative coordinate system in use for this format +track type=wiggle_0 name="variableStep" description="variableStep format" visibility=full autoScale=off viewLimits=0.0:25.0 color=255,200,0 yLineMark=11.76 yLineOnOff=on priority=10 +variableStep chrom=chr19 span=4 +59304701 10.0 +59304901 12.5 +# 3 base wide points graph at every 300 bases, 50 pixel high graph +# autoScale off and viewing range set to [0:1000] +# priority = 30 positions this as the third graph +# Note, one-relative coordinate system in use for this format +track type=wiggle_0 name="fixedStep" description="fixed step" visibility=full autoScale=off viewLimits=0:1000 color=0,200,100 maxHeightPixels=100:50:20 graphType=points priority=30 +fixedStep chrom=chr19 start=59307401 step=300 span=3 +1000 + 900 + 800 +""" + +interval_reader_result = [ +"chr19,59302000,59302005,+,-1.0", +"chr19,59302300,59302305,+,-0.75", +"chr19,59304700,59304704,+,10.0", +"chr19,59304900,59304904,+,12.5", +"chr19,59307400,59307403,+,1000.0", +"chr19,59307700,59307703,+,900.0", +"chr19,59308000,59308003,+,800.0" +] + +position_reader_result = [ +"chr19,59302000,-1.0", +"chr19,59302001,-1.0", +"chr19,59302002,-1.0", +"chr19,59302003,-1.0", +"chr19,59302004,-1.0", +"chr19,59302300,-0.75", +"chr19,59302301,-0.75", +"chr19,59302302,-0.75", +"chr19,59302303,-0.75", +"chr19,59302304,-0.75", +"chr19,59304700,10.0", +"chr19,59304701,10.0", +"chr19,59304702,10.0", +"chr19,59304703,10.0", +"chr19,59304900,12.5", +"chr19,59304901,12.5", +"chr19,59304902,12.5", +"chr19,59304903,12.5", +"chr19,59307400,1000.0", +"chr19,59307401,1000.0", +"chr19,59307402,1000.0", +"chr19,59307700,900.0", +"chr19,59307701,900.0", +"chr19,59307702,900.0", +"chr19,59308000,800.0", +"chr19,59308001,800.0", +"chr19,59308002,800.0" +] +class TestWiggleReader(unittest.TestCase): + def test_reader(self): + #Test position reader + assert position_reader_result == [ ",".join( map( str, value ) ) for value in wiggle.Reader( StringIO( test_wig ) ) ] + + def test_interval_reader(self): + #Test interval reader reader + assert interval_reader_result == [ ",".join( map( str, value ) ) for value in wiggle.IntervalReader( StringIO( test_wig ) ) ] + +if __name__ == '__main__': + unittest.main() diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/__init__.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/fpconst.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/fpconst.py new file mode 100755 index 0000000..2865361 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx_extras/fpconst.py @@ -0,0 +1,163 @@ +"""Utilities for handling IEEE 754 floating point special values + +This python module implements constants and functions for working with +IEEE754 double-precision special values. It provides constants for +Not-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity +(NegInf), as well as functions to test for these values. + +The code is implemented in pure python by taking advantage of the +'struct' standard module. Care has been taken to generate proper +results on both big-endian and little-endian machines. Some efficiency +could be gained by translating the core routines into C. + +See +for reference material on the IEEE 754 floating point standard. + +Further information on this package is available at +. + +Author: Gregory R. Warnes +Date:: 2003-04-08 +Copyright: (c) 2003, Pfizer, Inc. +""" + +__version__ = "0.7.0" +ident = "$Id: fpconst.py,v 1.12 2004/05/22 04:38:17 warnes Exp $" + +import struct, operator + +# check endianess +_big_endian = struct.pack('i',1)[0] != '\x01' + +# and define appropriate constants +if(_big_endian): + NaN = struct.unpack('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0] + PosInf = struct.unpack('d', '\x7F\xF0\x00\x00\x00\x00\x00\x00')[0] + NegInf = -PosInf +else: + NaN = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0] + PosInf = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf0\x7f')[0] + NegInf = -PosInf + +def _double_as_bytes(dval): + "Use struct.unpack to decode a double precision float into eight bytes" + tmp = list(struct.unpack('8B',struct.pack('d', dval))) + if not _big_endian: + tmp.reverse() + return tmp + +## +## Functions to extract components of the IEEE 754 floating point format +## + +def _sign(dval): + "Extract the sign bit from a double-precision floating point value" + bb = _double_as_bytes(dval) + return bb[0] >> 7 & 0x01 + +def _exponent(dval): + """Extract the exponentent bits from a double-precision floating + point value. + + Note that for normalized values, the exponent bits have an offset + of 1023. As a consequence, the actual exponentent is obtained + by subtracting 1023 from the value returned by this function + """ + bb = _double_as_bytes(dval) + return (bb[0] << 4 | bb[1] >> 4) & 0x7ff + +def _mantissa(dval): + """Extract the _mantissa bits from a double-precision floating + point value.""" + + bb = _double_as_bytes(dval) + mantissa = bb[1] & 0x0f << 48 + mantissa += bb[2] << 40 + mantissa += bb[3] << 32 + mantissa += bb[4] + return mantissa + +def _zero_mantissa(dval): + """Determine whether the mantissa bits of the given double are all + zero.""" + bb = _double_as_bytes(dval) + return ((bb[1] & 0x0f) | reduce(operator.or_, bb[2:])) == 0 + +## +## Functions to test for IEEE 754 special values +## + +def isNaN(value): + "Determine if the argument is a IEEE 754 NaN (Not a Number) value." + return (_exponent(value)==0x7ff and not _zero_mantissa(value)) + +def isInf(value): + """Determine if the argument is an infinite IEEE 754 value (positive + or negative inifinity)""" + return (_exponent(value)==0x7ff and _zero_mantissa(value)) + +def isFinite(value): + """Determine if the argument is an finite IEEE 754 value (i.e., is + not NaN, positive or negative inifinity)""" + return (_exponent(value)!=0x7ff) + +def isPosInf(value): + "Determine if the argument is a IEEE 754 positive infinity value" + return (_sign(value)==0 and _exponent(value)==0x7ff and \ + _zero_mantissa(value)) + +def isNegInf(value): + "Determine if the argument is a IEEE 754 negative infinity value" + return (_sign(value)==1 and _exponent(value)==0x7ff and \ + _zero_mantissa(value)) + +## +## Functions to test public functions. +## + +def test_isNaN(): + assert( not isNaN(PosInf) ) + assert( not isNaN(NegInf) ) + assert( isNaN(NaN ) ) + assert( not isNaN( 1.0) ) + assert( not isNaN( -1.0) ) + +def test_isInf(): + assert( isInf(PosInf) ) + assert( isInf(NegInf) ) + assert( not isInf(NaN ) ) + assert( not isInf( 1.0) ) + assert( not isInf( -1.0) ) + +def test_isFinite(): + assert( not isFinite(PosInf) ) + assert( not isFinite(NegInf) ) + assert( not isFinite(NaN ) ) + assert( isFinite( 1.0) ) + assert( isFinite( -1.0) ) + +def test_isPosInf(): + assert( isPosInf(PosInf) ) + assert( not isPosInf(NegInf) ) + assert( not isPosInf(NaN ) ) + assert( not isPosInf( 1.0) ) + assert( not isPosInf( -1.0) ) + +def test_isNegInf(): + assert( not isNegInf(PosInf) ) + assert( isNegInf(NegInf) ) + assert( not isNegInf(NaN ) ) + assert( not isNegInf( 1.0) ) + assert( not isNegInf( -1.0) ) + +# overall test +def test(): + test_isNaN() + test_isInf() + test_isFinite() + test_isPosInf() + test_isNegInf() + +if __name__ == "__main__": + test() + diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/lrucache.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/lrucache.py new file mode 100755 index 0000000..cc99467 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx_extras/lrucache.py @@ -0,0 +1,221 @@ +# lrucache.py -- a simple LRU (Least-Recently-Used) cache class + +# Copyright 2004 Evan Prodromou +# Licensed under the Academic Free License 2.1 + +# arch-tag: LRU cache main module + +"""a simple LRU (Least-Recently-Used) cache module + +This module provides very simple LRU (Least-Recently-Used) cache +functionality. + +An *in-memory cache* is useful for storing the results of an +'expensive' process (one that takes a lot of time or resources) for +later re-use. Typical examples are accessing data from the filesystem, +a database, or a network location. If you know you'll need to re-read +the data again, it can help to keep it in a cache. + +You *can* use a Python dictionary as a cache for some purposes. +However, if the results you're caching are large, or you have a lot of +possible results, this can be impractical memory-wise. + +An *LRU cache*, on the other hand, only keeps _some_ of the results in +memory, which keeps you from overusing resources. The cache is bounded +by a maximum size; if you try to add more values to the cache, it will +automatically discard the values that you haven't read or written to +in the longest time. In other words, the least-recently-used items are +discarded. [1]_ + +.. [1]: 'Discarded' here means 'removed from the cache'. + +""" + +from __future__ import generators + +# TODO: Remove this in favor of functools.lru_cache + +import time +from heapq import heappush, heappop, heapify +from functools import total_ordering + +__version__ = "0.2" +__all__ = ['CacheKeyError', 'LRUCache', 'DEFAULT_SIZE'] +__docformat__ = 'reStructuredText en' + +DEFAULT_SIZE = 16 +"""Default size of a new LRUCache object, if no 'size' argument is given.""" + +class CacheKeyError(KeyError): + """Error raised when cache requests fail + + When a cache record is accessed which no longer exists (or never did), + this error is raised. To avoid it, you may want to check for the existence + of a cache record before reading or deleting it.""" + pass + +class LRUCache(object): + """Least-Recently-Used (LRU) cache. + + Instances of this class provide a least-recently-used (LRU) cache. They + emulate a Python mapping type. You can use an LRU cache more or less like + a Python dictionary, with the exception that objects you put into the + cache may be discarded before you take them out. + + Some example usage:: + + cache = LRUCache(32) # new cache + cache['foo'] = get_file_contents('foo') # or whatever + + if 'foo' in cache: # if it's still in cache... + # use cached version + contents = cache['foo'] + else: + # recalculate + contents = get_file_contents('foo') + # store in cache for next time + cache['foo'] = contents + + print cache.size # Maximum size + + print len(cache) # 0 <= len(cache) <= cache.size + + cache.size = 10 # Auto-shrink on size assignment + + for i in range(50): # note: larger than cache size + cache[i] = i + + if 0 not in cache: print 'Zero was discarded.' + + if 42 in cache: + del cache[42] # Manual deletion + + for j in cache: # iterate (in LRU order) + print j, cache[j] # iterator produces keys, not values + """ + + @total_ordering + class __Node(object): + """Record of a cached value. Not for public consumption.""" + + def __init__(self, key, obj, timestamp): + object.__init__(self) + self.key = key + self.obj = obj + self.atime = timestamp + self.mtime = self.atime + + def __lt__(self, other): + return self.atime < other.atime + + def __eq__(self, other): + return self.atime == other.atime + + def __repr__(self): + return "<%s %s => %s (%s)>" % \ + (self.__class__, self.key, self.obj, + time.asctime(time.localtime(self.atime))) + + def __init__(self, size=DEFAULT_SIZE): + # Check arguments + if size <= 0: + raise ValueError, size + elif type(size) is not type(0): + raise TypeError, size + object.__init__(self) + self.__heap = [] + self.__dict = {} + self.size = size + """Maximum size of the cache. + If more than 'size' elements are added to the cache, + the least-recently-used ones will be discarded.""" + + def __len__(self): + return len(self.__heap) + + def __contains__(self, key): + return self.__dict.has_key(key) + + def __setitem__(self, key, obj): + if self.__dict.has_key(key): + node = self.__dict[key] + node.obj = obj + node.atime = time.time() + node.mtime = node.atime + heapify(self.__heap) + else: + # size may have been reset, so we loop + while len(self.__heap) >= self.size: + lru = heappop(self.__heap) + del self.__dict[lru.key] + node = self.__Node(key, obj, time.time()) + self.__dict[key] = node + heappush(self.__heap, node) + + def __getitem__(self, key): + if not self.__dict.has_key(key): + raise CacheKeyError(key) + else: + node = self.__dict[key] + node.atime = time.time() + heapify(self.__heap) + return node.obj + + def __delitem__(self, key): + if not self.__dict.has_key(key): + raise CacheKeyError(key) + else: + node = self.__dict[key] + del self.__dict[key] + self.__heap.remove(node) + heapify(self.__heap) + return node.obj + + def __iter__(self): + copy = self.__heap[:] + while len(copy) > 0: + node = heappop(copy) + yield node.key + raise StopIteration + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + # automagically shrink heap on resize + if name == 'size': + while len(self.__heap) > value: + lru = heappop(self.__heap) + del self.__dict[lru.key] + + def __repr__(self): + return "<%s (%d elements)>" % (str(self.__class__), len(self.__heap)) + + def mtime(self, key): + """Return the last modification time for the cache record with key. + May be useful for cache instances where the stored values can get + 'stale', such as caching file or network resource contents.""" + if not self.__dict.has_key(key): + raise CacheKeyError(key) + else: + node = self.__dict[key] + return node.mtime + +if __name__ == "__main__": + cache = LRUCache(25) + print cache + for i in range(50): + cache[i] = str(i) + print cache + if 46 in cache: + del cache[46] + print cache + cache.size = 10 + print cache + cache[46] = '46' + print cache + print len(cache) + for c in cache: + print c + print cache + print cache.mtime(46) + for c in cache: + print c diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/pstat.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/pstat.py new file mode 100755 index 0000000..8492dbd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx_extras/pstat.py @@ -0,0 +1,1062 @@ +# Copyright (c) 1999-2000 Gary Strangman; All Rights Reserved. +# +# This software is distributable under the terms of the GNU +# General Public License (GPL) v2, the text of which can be found at +# http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise +# using this module constitutes acceptance of the terms of this License. +# +# Disclaimer +# +# This software is provided "as-is". There are no expressed or implied +# warranties of any kind, including, but not limited to, the warranties +# of merchantability and fittness for a given application. In no event +# shall Gary Strangman be liable for any direct, indirect, incidental, +# special, exemplary or consequential damages (including, but not limited +# to, loss of use, data or profits, or business interruption) however +# caused and on any theory of liability, whether in contract, strict +# liability or tort (including negligence or otherwise) arising in any way +# out of the use of this software, even if advised of the possibility of +# such damage. +# +# Comments and/or additions are welcome (send e-mail to: +# strang@nmr.mgh.harvard.edu). +# +""" +pstat.py module + +################################################# +####### Written by: Gary Strangman ########### +####### Last modified: Jun 29, 2001 ########### +################################################# + +This module provides some useful list and array manipulation routines +modeled after those found in the |Stat package by Gary Perlman, plus a +number of other useful list/file manipulation functions. The list-based +functions include: + + abut (source,*args) + simpleabut (source, addon) + colex (listoflists,cnums) + collapse (listoflists,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None) + dm (listoflists,criterion) + flat (l) + linexand (listoflists,columnlist,valuelist) + linexor (listoflists,columnlist,valuelist) + linedelimited (inlist,delimiter) + lineincols (inlist,colsize) + lineincustcols (inlist,colsizes) + list2string (inlist) + makelol(inlist) + makestr(x) + printcc (lst,extra=2) + printincols (listoflists,colsize) + pl (listoflists) + printl(listoflists) + replace (lst,oldval,newval) + recode (inlist,listmap,cols='all') + remap (listoflists,criterion) + roundlist (inlist,num_digits_to_round_floats_to) + sortby(listoflists,sortcols) + unique (inlist) + duplicates(inlist) + writedelimited (listoflists, delimiter, file, writetype='w') + +Some of these functions have alternate versions which are defined only if +Numeric (NumPy) can be imported. These functions are generally named as +above, with an 'a' prefix. + + aabut (source, *args) + acolex (a,indices,axis=1) + acollapse (a,keepcols,collapsecols,sterr=0,ns=0) + adm (a,criterion) + alinexand (a,columnlist,valuelist) + alinexor (a,columnlist,valuelist) + areplace (a,oldval,newval) + arecode (a,listmap,col='all') + arowcompare (row1, row2) + arowsame (row1, row2) + asortrows(a,axis=0) + aunique(inarray) + aduplicates(inarray) + +Currently, the code is all but completely un-optimized. In many cases, the +array versions of functions amount simply to aliases to built-in array +functions/methods. Their inclusion here is for function name consistency. +""" + +## CHANGE LOG: +## ========== +## 01-11-15 ... changed list2string() to accept a delimiter +## 01-06-29 ... converted exec()'s to eval()'s to make compatible with Py2.1 +## 01-05-31 ... added duplicates() and aduplicates() functions +## 00-12-28 ... license made GPL, docstring and import requirements +## 99-11-01 ... changed version to 0.3 +## 99-08-30 ... removed get, getstrings, put, aget, aput (into io.py) +## 03/27/99 ... added areplace function, made replace fcn recursive +## 12/31/98 ... added writefc function for ouput to fixed column sizes +## 12/07/98 ... fixed import problem (failed on collapse() fcn) +## added __version__ variable (now 0.2) +## 12/05/98 ... updated doc-strings +## added features to collapse() function +## added flat() function for lists +## fixed a broken asortrows() +## 11/16/98 ... fixed minor bug in aput for 1D arrays +## +## 11/08/98 ... fixed aput to output large arrays correctly + +import stats # required 3rd party module +import string, copy +from types import * + +__version__ = 0.4 + +###=========================== LIST FUNCTIONS ========================== +### +### Here are the list functions, DEFINED FOR ALL SYSTEMS. +### Array functions (for NumPy-enabled computers) appear below. +### + +def abut (source,*args): + """ +Like the |Stat abut command. It concatenates two lists side-by-side +and returns the result. '2D' lists are also accomodated for either argument +(source or addon). CAUTION: If one list is shorter, it will be repeated +until it is as long as the longest list. If this behavior is not desired, +use pstat.simpleabut(). + +Usage: abut(source, args) where args=any # of lists +Returns: a list of lists as long as the LONGEST list past, source on the + 'left', lists in attached consecutively on the 'right' +""" + + if type(source) not in [ListType,TupleType]: + source = [source] + for addon in args: + if type(addon) not in [ListType,TupleType]: + addon = [addon] + if len(addon) < len(source): # is source list longer? + if len(source) % len(addon) == 0: # are they integer multiples? + repeats = len(source)/len(addon) # repeat addon n times + origadd = copy.deepcopy(addon) + for i in range(repeats-1): + addon = addon + origadd + else: + repeats = len(source)/len(addon)+1 # repeat addon x times, + origadd = copy.deepcopy(addon) # x is NOT an integer + for i in range(repeats-1): + addon = addon + origadd + addon = addon[0:len(source)] + elif len(source) < len(addon): # is addon list longer? + if len(addon) % len(source) == 0: # are they integer multiples? + repeats = len(addon)/len(source) # repeat source n times + origsour = copy.deepcopy(source) + for i in range(repeats-1): + source = source + origsour + else: + repeats = len(addon)/len(source)+1 # repeat source x times, + origsour = copy.deepcopy(source) # x is NOT an integer + for i in range(repeats-1): + source = source + origsour + source = source[0:len(addon)] + + source = simpleabut(source,addon) + return source + + +def simpleabut (source, addon): + """ +Concatenates two lists as columns and returns the result. '2D' lists +are also accomodated for either argument (source or addon). This DOES NOT +repeat either list to make the 2 lists of equal length. Beware of list pairs +with different lengths ... the resulting list will be the length of the +FIRST list passed. + +Usage: simpleabut(source,addon) where source, addon=list (or list-of-lists) +Returns: a list of lists as long as source, with source on the 'left' and + addon on the 'right' +""" + if type(source) not in [ListType,TupleType]: + source = [source] + if type(addon) not in [ListType,TupleType]: + addon = [addon] + minlen = min(len(source),len(addon)) + list = copy.deepcopy(source) # start abut process + if type(source[0]) not in [ListType,TupleType]: + if type(addon[0]) not in [ListType,TupleType]: + for i in range(minlen): + list[i] = [source[i]] + [addon[i]] # source/addon = column + else: + for i in range(minlen): + list[i] = [source[i]] + addon[i] # addon=list-of-lists + else: + if type(addon[0]) not in [ListType,TupleType]: + for i in range(minlen): + list[i] = source[i] + [addon[i]] # source=list-of-lists + else: + for i in range(minlen): + list[i] = source[i] + addon[i] # source/addon = list-of-lists + source = list + return source + + +def colex (listoflists,cnums): + """ +Extracts from listoflists the columns specified in the list 'cnums' +(cnums can be an integer, a sequence of integers, or a string-expression that +corresponds to a slice operation on the variable x ... e.g., 'x[3:]' will colex +columns 3 onward from the listoflists). + +Usage: colex (listoflists,cnums) +Returns: a list-of-lists corresponding to the columns from listoflists + specified by cnums, in the order the column numbers appear in cnums +""" + global index + column = 0 + if type(cnums) in [ListType,TupleType]: # if multiple columns to get + index = cnums[0] + column = map(lambda x: x[index], listoflists) + for col in cnums[1:]: + index = col + column = abut(column,map(lambda x: x[index], listoflists)) + elif type(cnums) == StringType: # if an 'x[3:]' type expr. + evalstring = 'map(lambda x: x'+cnums+', listoflists)' + column = eval(evalstring) + else: # else it's just 1 col to get + index = cnums + column = map(lambda x: x[index], listoflists) + return column + + +def collapse (listoflists,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None): + """ +Averages data in collapsecol, keeping all unique items in keepcols +(using unique, which keeps unique LISTS of column numbers), retaining the +unique sets of values in keepcols, the mean for each. Setting fcn1 +and/or fcn2 to point to a function rather than None (e.g., stats.sterr, len) +will append those results (e.g., the sterr, N) after each calculated mean. +cfcn is the collapse function to apply (defaults to mean, defined here in the +pstat module to avoid circular imports with stats.py, but harmonicmean or +others could be passed). + +Usage: collapse (listoflists,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None) +Returns: a list of lists with all unique permutations of entries appearing in + columns ("conditions") specified by keepcols, abutted with the result of + cfcn (if cfcn=None, defaults to the mean) of each column specified by + collapsecols. +""" + def collmean (inlist): + s = 0 + for item in inlist: + s = s + item + return s/float(len(inlist)) + + if type(keepcols) not in [ListType,TupleType]: + keepcols = [keepcols] + if type(collapsecols) not in [ListType,TupleType]: + collapsecols = [collapsecols] + if cfcn == None: + cfcn = collmean + if keepcols == []: + means = [0]*len(collapsecols) + for i in range(len(collapsecols)): + avgcol = colex(listoflists,collapsecols[i]) + means[i] = cfcn(avgcol) + if fcn1: + try: + test = fcn1(avgcol) + except: + test = 'N/A' + means[i] = [means[i], test] + if fcn2: + try: + test = fcn2(avgcol) + except: + test = 'N/A' + try: + means[i] = means[i] + [len(avgcol)] + except TypeError: + means[i] = [means[i],len(avgcol)] + return means + else: + values = colex(listoflists,keepcols) + uniques = unique(values) + uniques.sort() + newlist = [] + if type(keepcols) not in [ListType,TupleType]: keepcols = [keepcols] + for item in uniques: + if type(item) not in [ListType,TupleType]: item =[item] + tmprows = linexand(listoflists,keepcols,item) + for col in collapsecols: + avgcol = colex(tmprows,col) + item.append(cfcn(avgcol)) + if fcn1 <> None: + try: + test = fcn1(avgcol) + except: + test = 'N/A' + item.append(test) + if fcn2 <> None: + try: + test = fcn2(avgcol) + except: + test = 'N/A' + item.append(test) + newlist.append(item) + return newlist + + +def dm (listoflists,criterion): + """ +Returns rows from the passed list of lists that meet the criteria in +the passed criterion expression (a string as a function of x; e.g., 'x[3]>=9' +will return all rows where the 4th column>=9 and "x[2]=='N'" will return rows +with column 2 equal to the string 'N'). + +Usage: dm (listoflists, criterion) +Returns: rows from listoflists that meet the specified criterion. +""" + function = 'filter(lambda x: '+criterion+',listoflists)' + lines = eval(function) + return lines + + +def flat(l): + """ +Returns the flattened version of a '2D' list. List-correlate to the a.flat() +method of NumPy arrays. + +Usage: flat(l) +""" + newl = [] + for i in range(len(l)): + for j in range(len(l[i])): + newl.append(l[i][j]) + return newl + + +def linexand (listoflists,columnlist,valuelist): + """ +Returns the rows of a list of lists where col (from columnlist) = val +(from valuelist) for EVERY pair of values (columnlist[i],valuelists[i]). +len(columnlist) must equal len(valuelist). + +Usage: linexand (listoflists,columnlist,valuelist) +Returns: the rows of listoflists where columnlist[i]=valuelist[i] for ALL i +""" + if type(columnlist) not in [ListType,TupleType]: + columnlist = [columnlist] + if type(valuelist) not in [ListType,TupleType]: + valuelist = [valuelist] + criterion = '' + for i in range(len(columnlist)): + if type(valuelist[i])==StringType: + critval = '\'' + valuelist[i] + '\'' + else: + critval = str(valuelist[i]) + criterion = criterion + ' x['+str(columnlist[i])+']=='+critval+' and' + criterion = criterion[0:-3] # remove the "and" after the last crit + function = 'filter(lambda x: '+criterion+',listoflists)' + lines = eval(function) + return lines + + +def linexor (listoflists,columnlist,valuelist): + """ +Returns the rows of a list of lists where col (from columnlist) = val +(from valuelist) for ANY pair of values (colunmlist[i],valuelist[i[). +One value is required for each column in columnlist. If only one value +exists for columnlist but multiple values appear in valuelist, the +valuelist values are all assumed to pertain to the same column. + +Usage: linexor (listoflists,columnlist,valuelist) +Returns: the rows of listoflists where columnlist[i]=valuelist[i] for ANY i +""" + if type(columnlist) not in [ListType,TupleType]: + columnlist = [columnlist] + if type(valuelist) not in [ListType,TupleType]: + valuelist = [valuelist] + criterion = '' + if len(columnlist) == 1 and len(valuelist) > 1: + columnlist = columnlist*len(valuelist) + for i in range(len(columnlist)): # build an exec string + if type(valuelist[i])==StringType: + critval = '\'' + valuelist[i] + '\'' + else: + critval = str(valuelist[i]) + criterion = criterion + ' x['+str(columnlist[i])+']=='+critval+' or' + criterion = criterion[0:-2] # remove the "or" after the last crit + function = 'filter(lambda x: '+criterion+',listoflists)' + lines = eval(function) + return lines + + +def linedelimited (inlist,delimiter): + """ +Returns a string composed of elements in inlist, with each element +separated by 'delimiter.' Used by function writedelimited. Use '\t' +for tab-delimiting. + +Usage: linedelimited (inlist,delimiter) +""" + outstr = '' + for item in inlist: + if type(item) <> StringType: + item = str(item) + outstr = outstr + item + delimiter + outstr = outstr[0:-1] + return outstr + + +def lineincols (inlist,colsize): + """ +Returns a string composed of elements in inlist, with each element +right-aligned in columns of (fixed) colsize. + +Usage: lineincols (inlist,colsize) where colsize is an integer +""" + outstr = '' + for item in inlist: + if type(item) <> StringType: + item = str(item) + size = len(item) + if size <= colsize: + for i in range(colsize-size): + outstr = outstr + ' ' + outstr = outstr + item + else: + outstr = outstr + item[0:colsize+1] + return outstr + + +def lineincustcols (inlist,colsizes): + """ +Returns a string composed of elements in inlist, with each element +right-aligned in a column of width specified by a sequence colsizes. The +length of colsizes must be greater than or equal to the number of columns +in inlist. + +Usage: lineincustcols (inlist,colsizes) +Returns: formatted string created from inlist +""" + outstr = '' + for i in range(len(inlist)): + if type(inlist[i]) <> StringType: + item = str(inlist[i]) + else: + item = inlist[i] + size = len(item) + if size <= colsizes[i]: + for j in range(colsizes[i]-size): + outstr = outstr + ' ' + outstr = outstr + item + else: + outstr = outstr + item[0:colsizes[i]+1] + return outstr + + +def list2string (inlist,delimit=' '): + """ +Converts a 1D list to a single long string for file output, using +the string.join function. + +Usage: list2string (inlist,delimit=' ') +Returns: the string created from inlist +""" + stringlist = map(makestr,inlist) + return string.join(stringlist,delimit) + + +def makelol(inlist): + """ +Converts a 1D list to a 2D list (i.e., a list-of-lists). Useful when you +want to use put() to write a 1D list one item per line in the file. + +Usage: makelol(inlist) +Returns: if l = [1,2,'hi'] then returns [[1],[2],['hi']] etc. +""" + x = [] + for item in inlist: + x.append([item]) + return x + + +def makestr (x): + if type(x) <> StringType: + x = str(x) + return x + + +def printcc (lst,extra=2): + """ +Prints a list of lists in columns, customized by the max size of items +within the columns (max size of items in col, plus 'extra' number of spaces). +Use 'dashes' or '\\n' in the list-of-lists to print dashes or blank lines, +respectively. + +Usage: printcc (lst,extra=2) +Returns: None +""" + if type(lst[0]) not in [ListType,TupleType]: + lst = [lst] + rowstokill = [] + list2print = copy.deepcopy(lst) + for i in range(len(lst)): + if lst[i] == ['\n'] or lst[i]=='\n' or lst[i]=='dashes' or lst[i]=='' or lst[i]==['']: + rowstokill = rowstokill + [i] + rowstokill.reverse() # delete blank rows from the end + for row in rowstokill: + del list2print[row] + maxsize = [0]*len(list2print[0]) + for col in range(len(list2print[0])): + items = colex(list2print,col) + items = map(makestr,items) + maxsize[col] = max(map(len,items)) + extra + for row in lst: + if row == ['\n'] or row == '\n' or row == '' or row == ['']: + print + elif row == ['dashes'] or row == 'dashes': + dashes = [0]*len(maxsize) + for j in range(len(maxsize)): + dashes[j] = '-'*(maxsize[j]-2) + print lineincustcols(dashes,maxsize) + else: + print lineincustcols(row,maxsize) + return None + + +def printincols (listoflists,colsize): + """ +Prints a list of lists in columns of (fixed) colsize width, where +colsize is an integer. + +Usage: printincols (listoflists,colsize) +Returns: None +""" + for row in listoflists: + print lineincols(row,colsize) + return None + + +def pl (listoflists): + """ +Prints a list of lists, 1 list (row) at a time. + +Usage: pl(listoflists) +Returns: None +""" + for row in listoflists: + if row[-1] == '\n': + print row, + else: + print row + return None + + +def printl(listoflists): + """Alias for pl.""" + pl(listoflists) + return + + +def replace (inlst,oldval,newval): + """ +Replaces all occurrences of 'oldval' with 'newval', recursively. + +Usage: replace (inlst,oldval,newval) +""" + lst = inlst*1 + for i in range(len(lst)): + if type(lst[i]) not in [ListType,TupleType]: + if lst[i]==oldval: lst[i]=newval + else: + lst[i] = replace(lst[i],oldval,newval) + return lst + + +def recode (inlist,listmap,cols=None): + """ +Changes the values in a list to a new set of values (useful when +you need to recode data from (e.g.) strings to numbers. cols defaults +to None (meaning all columns are recoded). + +Usage: recode (inlist,listmap,cols=None) cols=recode cols, listmap=2D list +Returns: inlist with the appropriate values replaced with new ones +""" + lst = copy.deepcopy(inlist) + if cols != None: + if type(cols) not in [ListType,TupleType]: + cols = [cols] + for col in cols: + for row in range(len(lst)): + try: + idx = colex(listmap,0).index(lst[row][col]) + lst[row][col] = listmap[idx][1] + except ValueError: + pass + else: + for row in range(len(lst)): + for col in range(len(lst)): + try: + idx = colex(listmap,0).index(lst[row][col]) + lst[row][col] = listmap[idx][1] + except ValueError: + pass + return lst + + +def remap (listoflists,criterion): + """ +Remaps values in a given column of a 2D list (listoflists). This requires +a criterion as a function of 'x' so that the result of the following is +returned ... map(lambda x: 'criterion',listoflists). + +Usage: remap(listoflists,criterion) criterion=string +Returns: remapped version of listoflists +""" + function = 'map(lambda x: '+criterion+',listoflists)' + lines = eval(function) + return lines + + +def roundlist (inlist,digits): + """ +Goes through each element in a 1D or 2D inlist, and applies the following +function to all elements of FloatType ... round(element,digits). + +Usage: roundlist(inlist,digits) +Returns: list with rounded floats +""" + if type(inlist[0]) in [IntType, FloatType]: + inlist = [inlist] + l = inlist*1 + for i in range(len(l)): + for j in range(len(l[i])): + if type(l[i][j])==FloatType: + l[i][j] = round(l[i][j],digits) + return l + + +def sortby(listoflists,sortcols): + """ +Sorts a list of lists on the column(s) specified in the sequence +sortcols. + +Usage: sortby(listoflists,sortcols) +Returns: sorted list, unchanged column ordering +""" + newlist = abut(colex(listoflists,sortcols),listoflists) + newlist.sort() + try: + numcols = len(sortcols) + except TypeError: + numcols = 1 + crit = '[' + str(numcols) + ':]' + newlist = colex(newlist,crit) + return newlist + + +def unique (inlist): + """ +Returns all unique items in the passed list. If the a list-of-lists +is passed, unique LISTS are found (i.e., items in the first dimension are +compared). + +Usage: unique (inlist) +Returns: the unique elements (or rows) in inlist +""" + uniques = [] + for item in inlist: + if item not in uniques: + uniques.append(item) + return uniques + +def duplicates(inlist): + """ +Returns duplicate items in the FIRST dimension of the passed list. + +Usage: duplicates (inlist) +""" + dups = [] + for i in range(len(inlist)): + if inlist[i] in inlist[i+1:]: + dups.append(inlist[i]) + return dups + + +def nonrepeats(inlist): + """ +Returns items that are NOT duplicated in the first dim of the passed list. + +Usage: nonrepeats (inlist) +""" + nonrepeats = [] + for i in range(len(inlist)): + if inlist.count(inlist[i]) == 1: + nonrepeats.append(inlist[i]) + return nonrepeats + + +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== +#=================== PSTAT ARRAY FUNCTIONS ===================== + +try: # DEFINE THESE *ONLY* IF NUMERIC IS AVAILABLE + import Numeric + N = Numeric + + def aabut (source, *args): + """ +Like the |Stat abut command. It concatenates two arrays column-wise +and returns the result. CAUTION: If one array is shorter, it will be +repeated until it is as long as the other. + +Usage: aabut (source, args) where args=any # of arrays +Returns: an array as long as the LONGEST array past, source appearing on the + 'left', arrays in attached on the 'right'. +""" + if len(source.shape)==1: + width = 1 + source = N.resize(source,[source.shape[0],width]) + else: + width = source.shape[1] + for addon in args: + if len(addon.shape)==1: + width = 1 + addon = N.resize(addon,[source.shape[0],width]) + else: + width = source.shape[1] + if len(addon) < len(source): + addon = N.resize(addon,[source.shape[0],addon.shape[1]]) + elif len(source) < len(addon): + source = N.resize(source,[addon.shape[0],source.shape[1]]) + source = N.concatenate((source,addon),1) + return source + + + def acolex (a,indices,axis=1): + """ +Extracts specified indices (a list) from passed array, along passed +axis (column extraction is default). BEWARE: A 1D array is presumed to be a +column-array (and that the whole array will be returned as a column). + +Usage: acolex (a,indices,axis=1) +Returns: the columns of a specified by indices +""" + if type(indices) not in [ListType,TupleType,N.ArrayType]: + indices = [indices] + if len(N.shape(a)) == 1: + cols = N.resize(a,[a.shape[0],1]) + else: + cols = N.take(a,indices,axis) + return cols + + + def acollapse (a,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None): + """ +Averages data in collapsecol, keeping all unique items in keepcols +(using unique, which keeps unique LISTS of column numbers), retaining +the unique sets of values in keepcols, the mean for each. If stderror or +N of the mean are desired, set either or both parameters to 1. + +Usage: acollapse (a,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None) +Returns: unique 'conditions' specified by the contents of columns specified + by keepcols, abutted with the mean(s) of column(s) specified by + collapsecols +""" + def acollmean (inarray): + return N.sum(N.ravel(inarray)) + + if cfcn == None: + cfcn = acollmean + if keepcols == []: + avgcol = acolex(a,collapsecols) + means = N.sum(avgcol)/float(len(avgcol)) + if fcn1<>None: + try: + test = fcn1(avgcol) + except: + test = N.array(['N/A']*len(means)) + means = aabut(means,test) + if fcn2<>None: + try: + test = fcn2(avgcol) + except: + test = N.array(['N/A']*len(means)) + means = aabut(means,test) + return means + else: + if type(keepcols) not in [ListType,TupleType,N.ArrayType]: + keepcols = [keepcols] + values = colex(a,keepcols) # so that "item" can be appended (below) + uniques = unique(values) # get a LIST, so .sort keeps rows intact + uniques.sort() + newlist = [] + for item in uniques: + if type(item) not in [ListType,TupleType,N.ArrayType]: + item =[item] + tmprows = alinexand(a,keepcols,item) + for col in collapsecols: + avgcol = acolex(tmprows,col) + item.append(acollmean(avgcol)) + if fcn1<>None: + try: + test = fcn1(avgcol) + except: + test = 'N/A' + item.append(test) + if fcn2<>None: + try: + test = fcn2(avgcol) + except: + test = 'N/A' + item.append(test) + newlist.append(item) + try: + new_a = N.array(newlist) + except TypeError: + new_a = N.array(newlist,'O') + return new_a + + + def adm (a,criterion): + """ +Returns rows from the passed list of lists that meet the criteria in +the passed criterion expression (a string as a function of x). + +Usage: adm (a,criterion) where criterion is like 'x[2]==37' +""" + function = 'filter(lambda x: '+criterion+',a)' + lines = eval(function) + try: + lines = N.array(lines) + except: + lines = N.array(lines,'O') + return lines + + + def isstring(x): + if type(x)==StringType: + return 1 + else: + return 0 + + + def alinexand (a,columnlist,valuelist): + """ +Returns the rows of an array where col (from columnlist) = val +(from valuelist). One value is required for each column in columnlist. + +Usage: alinexand (a,columnlist,valuelist) +Returns: the rows of a where columnlist[i]=valuelist[i] for ALL i +""" + if type(columnlist) not in [ListType,TupleType,N.ArrayType]: + columnlist = [columnlist] + if type(valuelist) not in [ListType,TupleType,N.ArrayType]: + valuelist = [valuelist] + criterion = '' + for i in range(len(columnlist)): + if type(valuelist[i])==StringType: + critval = '\'' + valuelist[i] + '\'' + else: + critval = str(valuelist[i]) + criterion = criterion + ' x['+str(columnlist[i])+']=='+critval+' and' + criterion = criterion[0:-3] # remove the "and" after the last crit + return adm(a,criterion) + + + def alinexor (a,columnlist,valuelist): + """ +Returns the rows of an array where col (from columnlist) = val (from +valuelist). One value is required for each column in columnlist. +The exception is if either columnlist or valuelist has only 1 value, +in which case that item will be expanded to match the length of the +other list. + +Usage: alinexor (a,columnlist,valuelist) +Returns: the rows of a where columnlist[i]=valuelist[i] for ANY i +""" + if type(columnlist) not in [ListType,TupleType,N.ArrayType]: + columnlist = [columnlist] + if type(valuelist) not in [ListType,TupleType,N.ArrayType]: + valuelist = [valuelist] + criterion = '' + if len(columnlist) == 1 and len(valuelist) > 1: + columnlist = columnlist*len(valuelist) + elif len(valuelist) == 1 and len(columnlist) > 1: + valuelist = valuelist*len(columnlist) + for i in range(len(columnlist)): + if type(valuelist[i])==StringType: + critval = '\'' + valuelist[i] + '\'' + else: + critval = str(valuelist[i]) + criterion = criterion + ' x['+str(columnlist[i])+']=='+critval+' or' + criterion = criterion[0:-2] # remove the "or" after the last crit + return adm(a,criterion) + + + def areplace (a,oldval,newval): + """ +Replaces all occurrences of oldval with newval in array a. + +Usage: areplace(a,oldval,newval) +""" + newa = N.not_equal(a,oldval)*a + return newa+N.equal(a,oldval)*newval + + + def arecode (a,listmap,col='all'): + """ +Remaps the values in an array to a new set of values (useful when +you need to recode data from (e.g.) strings to numbers as most stats +packages require. Can work on SINGLE columns, or 'all' columns at once. + +Usage: arecode (a,listmap,col='all') +Returns: a version of array a where listmap[i][0] = (instead) listmap[i][1] +""" + ashape = a.shape + if col == 'all': + work = a.flat + else: + work = acolex(a,col) + work = work.flat + for pair in listmap: + if type(pair[1]) == StringType or work.typecode()=='O' or a.typecode()=='O': + work = N.array(work,'O') + a = N.array(a,'O') + for i in range(len(work)): + if work[i]==pair[0]: + work[i] = pair[1] + if col == 'all': + return N.reshape(work,ashape) + else: + return N.concatenate([a[:,0:col],work[:,N.NewAxis],a[:,col+1:]],1) + else: # must be a non-Object type array and replacement + work = N.where(N.equal(work,pair[0]),pair[1],work) + return N.concatenate([a[:,0:col],work[:,N.NewAxis],a[:,col+1:]],1) + + + def arowcompare(row1, row2): + """ +Compares two numeric rows from an array, + +Usage: arowcompare(row1,row2) +Returns: an array of equal length containing 1s where the two rows had + identical elements and 0 otherwise +""" + return N.equal(row1,row2) + + + def arowsame(row1, row2): + """ +Compares two rows from an array, regardless of whether it is an +array of numbers or of python objects (which requires the cmp function). + +Usage: arowsame(row1,row2) +Returns: 1 if the two rows are identical, 0 otherwise. +""" + cmpval = N.alltrue(arowcompare(row1,row2)) + return cmpval + + + def asortrows(a,axis=0): + """ +Sorts an array "by rows". This differs from the Numeric.sort() function, +which sorts elements WITHIN the given axis. Instead, this function keeps +the elements along the given axis intact, but shifts them 'up or down' +relative to one another. + +Usage: asortrows(a,axis=0) +Returns: sorted version of a +""" + if axis != 0: + a = N.swapaxes(a, axis, 0) + l = a.tolist() + l.sort() # or l.sort(_sort) + y = N.array(l) + if axis != 0: + y = N.swapaxes(y, axis, 0) + return y + + + def aunique(inarray): + """ +Returns unique items in the FIRST dimension of the passed array. Only +works on arrays NOT including string items. + +Usage: aunique (inarray) +""" + uniques = N.array([inarray[0]]) + if len(uniques.shape) == 1: # IF IT'S A 1D ARRAY + for item in inarray[1:]: + if N.add.reduce(N.equal(uniques,item).flat) == 0: + try: + uniques = N.concatenate([uniques,N.array[N.NewAxis,:]]) + except TypeError: + uniques = N.concatenate([uniques,N.array([item])]) + else: # IT MUST BE A 2+D ARRAY + if inarray.typecode() != 'O': # not an Object array + for item in inarray[1:]: + if not N.sum(N.alltrue(N.equal(uniques,item),1)): + try: + uniques = N.concatenate( [uniques,item[N.NewAxis,:]] ) + except TypeError: # the item to add isn't a list + uniques = N.concatenate([uniques,N.array([item])]) + else: + pass # this item is already in the uniques array + else: # must be an Object array, alltrue/equal functions don't work + for item in inarray[1:]: + newflag = 1 + for unq in uniques: # NOTE: cmp --> 0=same, -1=<, 1=> + # TODO fix this + test = N.sum(abs(N.array(map(cmp,item,unq)))) + if test == 0: # if item identical to any 1 row in uniques + newflag = 0 # then not a novel item to add + break + if newflag == 1: + try: + uniques = N.concatenate( [uniques,item[N.NewAxis,:]] ) + except TypeError: # the item to add isn't a list + uniques = N.concatenate([uniques,N.array([item])]) + return uniques + + + def aduplicates(inarray): + """ +Returns duplicate items in the FIRST dimension of the passed array. Only +works on arrays NOT including string items. + +Usage: aunique (inarray) +""" + inarray = N.array(inarray) + if len(inarray.shape) == 1: # IF IT'S A 1D ARRAY + dups = [] + inarray = inarray.tolist() + for i in range(len(inarray)): + if inarray[i] in inarray[i+1:]: + dups.append(inarray[i]) + dups = aunique(dups) + else: # IT MUST BE A 2+D ARRAY + dups = [] + aslist = inarray.tolist() + for i in range(len(aslist)): + if aslist[i] in aslist[i+1:]: + dups.append(aslist[i]) + dups = unique(dups) + dups = N.array(dups) + return dups + +except ImportError: # IF NUMERIC ISN'T AVAILABLE, SKIP ALL arrayfuncs + pass diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/pyparsing.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/pyparsing.py new file mode 100755 index 0000000..f963a92 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx_extras/pyparsing.py @@ -0,0 +1,3601 @@ +# module pyparsing.py +# +# Copyright (c) 2003-2008 Paul T. McGuire +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +#from __future__ import generators + +__doc__ = \ +""" +pyparsing module - Classes and methods to define and execute parsing grammars + +The pyparsing module is an alternative approach to creating and executing simple grammars, +vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you +don't need to learn a new syntax for defining grammars or matching expressions - the parsing module +provides a library of classes that you use to construct the grammar directly in Python. + +Here is a program to parse "Hello, World!" (or any greeting of the form ", !"):: + + from pyparsing import Word, alphas + + # define grammar of a greeting + greet = Word( alphas ) + "," + Word( alphas ) + "!" + + hello = "Hello, World!" + print hello, "->", greet.parseString( hello ) + +The program outputs the following:: + + Hello, World! -> ['Hello', ',', 'World', '!'] + +The Python representation of the grammar is quite readable, owing to the self-explanatory +class names, and the use of '+', '|' and '^' operators. + +The parsed results returned from parseString() can be accessed as a nested list, a dictionary, or an +object with named attributes. + +The pyparsing module handles some of the problems that are typically vexing when writing text parsers: + - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) + - quoted strings + - embedded comments +""" + +__version__ = "1.5.0" +__versionTime__ = "28 May 2008 10:05" +__author__ = "Paul McGuire " + +import string +from weakref import ref as wkref +import copy,sys +import warnings +import re +import sre_constants +import xml.sax.saxutils +#~ sys.stderr.write( "testing pyparsing module, version %s, %s\n" % (__version__,__versionTime__ ) ) + +__all__ = [ +'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty', +'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal', +'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or', +'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException', +'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException', +'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter', 'Upcase', +'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore', +'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col', +'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString', +'dblSlashComment', 'delimitedList', 'dictOf', 'downcaseTokens', 'empty', 'getTokensEndLoc', 'hexnums', +'htmlComment', 'javaStyleComment', 'keepOriginalText', 'line', 'lineEnd', 'lineStart', 'lineno', +'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral', +'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables', +'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity', +'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd', +'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute', +'indentedBlock', +] + + +""" +Detect if we are running version 3.X and make appropriate changes +Robert A. Clark +""" +if sys.version_info[0] > 2: + _PY3K = True + _MAX_INT = sys.maxsize + basestring = str +else: + _PY3K = False + _MAX_INT = sys.maxint + +if not _PY3K: + def _ustr(obj): + """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries + str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It + then < returns the unicode object | encodes it with the default encoding | ... >. + """ + try: + # If this works, then _ustr(obj) has the same behaviour as str(obj), so + # it won't break any existing code. + return str(obj) + + except UnicodeEncodeError: + # The Python docs (http://docs.python.org/ref/customization.html#l2h-182) + # state that "The return value must be a string object". However, does a + # unicode object (being a subclass of basestring) count as a "string + # object"? + # If so, then return a unicode object: + return unicode(obj) + # Else encode it... but how? There are many choices... :) + # Replace unprintables with escape codes? + #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') + # Replace unprintables with question marks? + #return unicode(obj).encode(sys.getdefaultencoding(), 'replace') + # ... +else: + _ustr = str + +def _str2dict(strg): + return dict( [(c,0) for c in strg] ) + #~ return set( [c for c in strg] ) + +class _Constants(object): + pass + +if not _PY3K: + alphas = string.lowercase + string.uppercase +else: + alphas = string.ascii_lowercase + string.ascii_uppercase +nums = string.digits +hexnums = nums + "ABCDEFabcdef" +alphanums = alphas + nums +_bslash = "\\" +printables = "".join( [ c for c in string.printable if c not in string.whitespace ] ) + +class ParseBaseException(Exception): + """base exception class for all parsing runtime exceptions""" + __slots__ = ( "loc","msg","pstr","parserElement" ) + # Performance tuning: we construct a *lot* of these, so keep this + # constructor as small and fast as possible + def __init__( self, pstr, loc=0, msg=None, elem=None ): + self.loc = loc + if msg is None: + self.msg = pstr + self.pstr = "" + else: + self.msg = msg + self.pstr = pstr + self.parserElement = elem + + def __getattr__( self, aname ): + """supported attributes by name are: + - lineno - returns the line number of the exception text + - col - returns the column number of the exception text + - line - returns the line containing the exception text + """ + if( aname == "lineno" ): + return lineno( self.loc, self.pstr ) + elif( aname in ("col", "column") ): + return col( self.loc, self.pstr ) + elif( aname == "line" ): + return line( self.loc, self.pstr ) + else: + raise AttributeError(aname) + + def __str__( self ): + return "%s (at char %d), (line:%d, col:%d)" % \ + ( self.msg, self.loc, self.lineno, self.column ) + def __repr__( self ): + return _ustr(self) + def markInputline( self, markerString = ">!<" ): + """Extracts the exception line from the input string, and marks + the location of the exception with a special symbol. + """ + line_str = self.line + line_column = self.column - 1 + if markerString: + line_str = "".join( [line_str[:line_column], + markerString, line_str[line_column:]]) + return line_str.strip() + +class ParseException(ParseBaseException): + """exception thrown when parse expressions don't match class; + supported attributes by name are: + - lineno - returns the line number of the exception text + - col - returns the column number of the exception text + - line - returns the line containing the exception text + """ + pass + +class ParseFatalException(ParseBaseException): + """user-throwable exception thrown when inconsistent parse content + is found; stops all parsing immediately""" + pass + +class ParseSyntaxException(ParseFatalException): + """just like ParseFatalException, but thrown internally when an + ErrorStop indicates that parsing is to stop immediately because + an unbacktrackable syntax error has been found""" + def __init__(self, pe): + super(ParseSyntaxException, self).__init__( + pe.pstr, pe.loc, pe.msg, pe.parserElement) + +#~ class ReparseException(ParseBaseException): + #~ """Experimental class - parse actions can raise this exception to cause + #~ pyparsing to reparse the input string: + #~ - with a modified input string, and/or + #~ - with a modified start location + #~ Set the values of the ReparseException in the constructor, and raise the + #~ exception in a parse action to cause pyparsing to use the new string/location. + #~ Setting the values as None causes no change to be made. + #~ """ + #~ def __init_( self, newstring, restartLoc ): + #~ self.newParseText = newstring + #~ self.reparseLoc = restartLoc + +class RecursiveGrammarException(Exception): + """exception thrown by validate() if the grammar could be improperly recursive""" + def __init__( self, parseElementList ): + self.parseElementTrace = parseElementList + + def __str__( self ): + return "RecursiveGrammarException: %s" % self.parseElementTrace + +class _ParseResultsWithOffset(object): + def __init__(self,p1,p2): + self.tup = (p1,p2) + def __getitem__(self,i): + return self.tup[i] + def __repr__(self): + return repr(self.tup) + +class ParseResults(object): + """Structured parse results, to provide multiple means of access to the parsed data: + - as a list (len(results)) + - by list index (results[0], results[1], etc.) + - by attribute (results.) + """ + __slots__ = ( "__toklist", "__tokdict", "__doinit", "__name", "__parent", "__accumNames", "__weakref__" ) + def __new__(cls, toklist, name=None, asList=True, modal=True ): + if isinstance(toklist, cls): + return toklist + retobj = object.__new__(cls) + retobj.__doinit = True + return retobj + + # Performance tuning: we construct a *lot* of these, so keep this + # constructor as small and fast as possible + def __init__( self, toklist, name=None, asList=True, modal=True ): + if self.__doinit: + self.__doinit = False + self.__name = None + self.__parent = None + self.__accumNames = {} + if isinstance(toklist, list): + self.__toklist = toklist[:] + else: + self.__toklist = [toklist] + self.__tokdict = dict() + + # this line is related to debugging the asXML bug + #~ asList = False + + if name: + if not modal: + self.__accumNames[name] = 0 + if isinstance(name,int): + name = _ustr(name) # will always return a str, but use _ustr for consistency + self.__name = name + if not toklist in (None,'',[]): + if isinstance(toklist,basestring): + toklist = [ toklist ] + if asList: + if isinstance(toklist,ParseResults): + self[name] = _ParseResultsWithOffset(toklist.copy(),-1) + else: + self[name] = _ParseResultsWithOffset(ParseResults(toklist[0]),-1) + self[name].__name = name + else: + try: + self[name] = toklist[0] + except (KeyError,TypeError): + self[name] = toklist + + def __getitem__( self, i ): + if isinstance( i, (int,slice) ): + return self.__toklist[i] + else: + if i not in self.__accumNames: + return self.__tokdict[i][-1][0] + else: + return ParseResults([ v[0] for v in self.__tokdict[i] ]) + + def __setitem__( self, k, v ): + if isinstance(v,_ParseResultsWithOffset): + self.__tokdict[k] = self.__tokdict.get(k,list()) + [v] + sub = v[0] + elif isinstance(k,int): + self.__toklist[k] = v + sub = v + else: + self.__tokdict[k] = self.__tokdict.get(k,list()) + [_ParseResultsWithOffset(v,0)] + sub = v + if isinstance(sub,ParseResults): + sub.__parent = wkref(self) + + def __delitem__( self, i ): + if isinstance(i,(int,slice)): + mylen = len( self.__toklist ) + del self.__toklist[i] + + # convert int to slice + if isinstance(i, int): + if i < 0: + i += mylen + i = slice(i, i+1) + # get removed indices + removed = list(range(*i.indices(mylen))) + removed.reverse() + # fixup indices in token dictionary + for name in self.__tokdict: + occurrences = self.__tokdict[name] + for j in removed: + for k, (value, position) in enumerate(occurrences): + occurrences[k] = _ParseResultsWithOffset(value, position - (position > j)) + else: + del self.__tokdict[i] + + def __contains__( self, k ): + return k in self.__tokdict + + def __len__( self ): return len( self.__toklist ) + def __bool__(self): return len( self.__toklist ) > 0 + __nonzero__ = __bool__ + def __iter__( self ): return iter( self.__toklist ) + def __reversed__( self ): return iter( reversed(self.__toklist) ) + def keys( self ): + """Returns all named result keys.""" + return self.__tokdict.keys() + + def pop( self, index=-1 ): + """Removes and returns item at specified index (default=last). + Will work with either numeric indices or dict-key indicies.""" + ret = self[index] + del self[index] + return ret + + def get(self, key, defaultValue=None): + """Returns named result matching the given key, or if there is no + such name, then returns the given defaultValue or None if no + defaultValue is specified.""" + if key in self: + return self[key] + else: + return defaultValue + + def insert( self, index, insStr ): + self.__toklist.insert(index, insStr) + # fixup indices in token dictionary + for name in self.__tokdict: + occurrences = self.__tokdict[name] + for k, (value, position) in enumerate(occurrences): + occurrences[k] = _ParseResultsWithOffset(value, position + (position > j)) + + def items( self ): + """Returns all named result keys and values as a list of tuples.""" + return [(k,self[k]) for k in self.__tokdict] + + def values( self ): + """Returns all named result values.""" + return [ v[-1][0] for v in self.__tokdict.values() ] + + def __getattr__( self, name ): + if name not in self.__slots__: + if name in self.__tokdict: + if name not in self.__accumNames: + return self.__tokdict[name][-1][0] + else: + return ParseResults([ v[0] for v in self.__tokdict[name] ]) + else: + return "" + return None + + def __add__( self, other ): + ret = self.copy() + ret += other + return ret + + def __iadd__( self, other ): + if other.__tokdict: + offset = len(self.__toklist) + addoffset = ( lambda a: (a<0 and offset) or (a+offset) ) + otheritems = other.__tokdict.items() + otherdictitems = [(k, _ParseResultsWithOffset(v[0],addoffset(v[1])) ) + for (k,vlist) in otheritems for v in vlist] + for k,v in otherdictitems: + self[k] = v + if isinstance(v[0],ParseResults): + v[0].__parent = wkref(self) + self.__toklist += other.__toklist + self.__accumNames.update( other.__accumNames ) + del other + return self + + def __repr__( self ): + return "(%s, %s)" % ( repr( self.__toklist ), repr( self.__tokdict ) ) + + def __str__( self ): + out = "[" + sep = "" + for i in self.__toklist: + if isinstance(i, ParseResults): + out += sep + _ustr(i) + else: + out += sep + repr(i) + sep = ", " + out += "]" + return out + + def _asStringList( self, sep='' ): + out = [] + for item in self.__toklist: + if out and sep: + out.append(sep) + if isinstance( item, ParseResults ): + out += item._asStringList() + else: + out.append( _ustr(item) ) + return out + + def asList( self ): + """Returns the parse results as a nested list of matching tokens, all converted to strings.""" + out = [] + for res in self.__toklist: + if isinstance(res,ParseResults): + out.append( res.asList() ) + else: + out.append( res ) + return out + + def asDict( self ): + """Returns the named parse results as dictionary.""" + return dict( self.items() ) + + def copy( self ): + """Returns a new copy of a ParseResults object.""" + ret = ParseResults( self.__toklist ) + ret.__tokdict = self.__tokdict.copy() + ret.__parent = self.__parent + ret.__accumNames.update( self.__accumNames ) + ret.__name = self.__name + return ret + + def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ): + """Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.""" + nl = "\n" + out = [] + namedItems = dict( [ (v[1],k) for (k,vlist) in self.__tokdict.items() + for v in vlist ] ) + nextLevelIndent = indent + " " + + # collapse out indents if formatting is not desired + if not formatted: + indent = "" + nextLevelIndent = "" + nl = "" + + selfTag = None + if doctag is not None: + selfTag = doctag + else: + if self.__name: + selfTag = self.__name + + if not selfTag: + if namedItemsOnly: + return "" + else: + selfTag = "ITEM" + + out += [ nl, indent, "<", selfTag, ">" ] + + worklist = self.__toklist + for i,res in enumerate(worklist): + if isinstance(res,ParseResults): + if i in namedItems: + out += [ res.asXML(namedItems[i], + namedItemsOnly and doctag is None, + nextLevelIndent, + formatted)] + else: + out += [ res.asXML(None, + namedItemsOnly and doctag is None, + nextLevelIndent, + formatted)] + else: + # individual token, see if there is a name for it + resTag = None + if i in namedItems: + resTag = namedItems[i] + if not resTag: + if namedItemsOnly: + continue + else: + resTag = "ITEM" + xmlBodyText = xml.sax.saxutils.escape(_ustr(res)) + out += [ nl, nextLevelIndent, "<", resTag, ">", + xmlBodyText, + "" ] + + out += [ nl, indent, "" ] + return "".join(out) + + def __lookup(self,sub): + for k,vlist in self.__tokdict.items(): + for v,loc in vlist: + if sub is v: + return k + return None + + def getName(self): + """Returns the results name for this token expression.""" + if self.__name: + return self.__name + elif self.__parent: + par = self.__parent() + if par: + return par.__lookup(self) + else: + return None + elif (len(self) == 1 and + len(self.__tokdict) == 1 and + self.__tokdict.values()[0][0][1] in (0,-1)): + return self.__tokdict.keys()[0] + else: + return None + + def dump(self,indent='',depth=0): + """Diagnostic method for listing out the contents of a ParseResults. + Accepts an optional indent argument so that this string can be embedded + in a nested display of other data.""" + out = [] + out.append( indent+_ustr(self.asList()) ) + keys = self.items() + keys.sort() + for k,v in keys: + if out: + out.append('\n') + out.append( "%s%s- %s: " % (indent,(' '*depth), k) ) + if isinstance(v,ParseResults): + if v.keys(): + #~ out.append('\n') + out.append( v.dump(indent,depth+1) ) + #~ out.append('\n') + else: + out.append(_ustr(v)) + else: + out.append(_ustr(v)) + #~ out.append('\n') + return "".join(out) + + # add support for pickle protocol + def __getstate__(self): + return ( self.__toklist, + ( self.__tokdict.copy(), + self.__parent is not None and self.__parent() or None, + self.__accumNames, + self.__name ) ) + + def __setstate__(self,state): + self.__toklist = state[0] + self.__tokdict, \ + par, \ + inAccumNames, \ + self.__name = state[1] + self.__accumNames = {} + self.__accumNames.update(inAccumNames) + if par is not None: + self.__parent = wkref(par) + else: + self.__parent = None + + +def col (loc,strg): + """Returns current column within a string, counting newlines as line separators. + The first column is number 1. + + Note: the default parsing behavior is to expand tabs in the input string + before starting the parsing process. See L{I{ParserElement.parseString}} for more information + on parsing strings containing s, and suggested methods to maintain a + consistent view of the parsed string, the parse location, and line and column + positions within the parsed string. + """ + return (loc} for more information + on parsing strings containing s, and suggested methods to maintain a + consistent view of the parsed string, the parse location, and line and column + positions within the parsed string. + """ + return strg.count("\n",0,loc) + 1 + +def line( loc, strg ): + """Returns the line of text containing loc within a string, counting newlines as line separators. + """ + lastCR = strg.rfind("\n", 0, loc) + nextCR = strg.find("\n", loc) + if nextCR > 0: + return strg[lastCR+1:nextCR] + else: + return strg[lastCR+1:] + +def _defaultStartDebugAction( instring, loc, expr ): + print ("Match " + _ustr(expr) + " at loc " + _ustr(loc) + "(%d,%d)" % ( lineno(loc,instring), col(loc,instring) )) + +def _defaultSuccessDebugAction( instring, startloc, endloc, expr, toks ): + print ("Matched " + _ustr(expr) + " -> " + str(toks.asList())) + +def _defaultExceptionDebugAction( instring, loc, expr, exc ): + print ("Exception raised:" + _ustr(exc)) + +def nullDebugAction(*args): + """'Do-nothing' debug action, to suppress debugging output during parsing.""" + pass + +class ParserElement(object): + """Abstract base level parser element class.""" + DEFAULT_WHITE_CHARS = " \n\t\r" + + def setDefaultWhitespaceChars( chars ): + """Overrides the default whitespace chars + """ + ParserElement.DEFAULT_WHITE_CHARS = chars + setDefaultWhitespaceChars = staticmethod(setDefaultWhitespaceChars) + + def __init__( self, savelist=False ): + self.parseAction = list() + self.failAction = None + #~ self.name = "" # don't define self.name, let subclasses try/except upcall + self.strRepr = None + self.resultsName = None + self.saveAsList = savelist + self.skipWhitespace = True + self.whiteChars = ParserElement.DEFAULT_WHITE_CHARS + self.copyDefaultWhiteChars = True + self.mayReturnEmpty = False # used when checking for left-recursion + self.keepTabs = False + self.ignoreExprs = list() + self.debug = False + self.streamlined = False + self.mayIndexError = True # used to optimize exception handling for subclasses that don't advance parse index + self.errmsg = "" + self.modalResults = True # used to mark results names as modal (report only last) or cumulative (list all) + self.debugActions = ( None, None, None ) #custom debug actions + self.re = None + self.callPreparse = True # used to avoid redundant calls to preParse + self.callDuringTry = False + + def copy( self ): + """Make a copy of this ParserElement. Useful for defining different parse actions + for the same parsing pattern, using copies of the original parse element.""" + cpy = copy.copy( self ) + cpy.parseAction = self.parseAction[:] + cpy.ignoreExprs = self.ignoreExprs[:] + if self.copyDefaultWhiteChars: + cpy.whiteChars = ParserElement.DEFAULT_WHITE_CHARS + return cpy + + def setName( self, name ): + """Define name for this expression, for use in debugging.""" + self.name = name + self.errmsg = "Expected " + self.name + if hasattr(self,"exception"): + self.exception.msg = self.errmsg + return self + + def setResultsName( self, name, listAllMatches=False ): + """Define name for referencing matching tokens as a nested attribute + of the returned parse results. + NOTE: this returns a *copy* of the original ParserElement object; + this is so that the client can define a basic element, such as an + integer, and reference it in multiple places with different names. + """ + newself = self.copy() + newself.resultsName = name + newself.modalResults = not listAllMatches + return newself + + def setBreak(self,breakFlag = True): + """Method to invoke the Python pdb debugger when this element is + about to be parsed. Set breakFlag to True to enable, False to + disable. + """ + if breakFlag: + _parseMethod = self._parse + def breaker(instring, loc, doActions=True, callPreParse=True): + import pdb + pdb.set_trace() + _parseMethod( instring, loc, doActions, callPreParse ) + breaker._originalParseMethod = _parseMethod + self._parse = breaker + else: + if hasattr(self._parse,"_originalParseMethod"): + self._parse = self._parse._originalParseMethod + return self + + def _normalizeParseActionArgs( f ): + """Internal method used to decorate parse actions that take fewer than 3 arguments, + so that all parse actions can be called as f(s,l,t).""" + STAR_ARGS = 4 + + try: + restore = None + if isinstance(f,type): + restore = f + f = f.__init__ + if not _PY3K: + codeObj = f.func_code + else: + codeObj = f.code + if codeObj.co_flags & STAR_ARGS: + return f + numargs = codeObj.co_argcount + if not _PY3K: + if hasattr(f,"im_self"): + numargs -= 1 + else: + if hasattr(f,"__self__"): + numargs -= 1 + if restore: + f = restore + except AttributeError: + try: + if not _PY3K: + call_im_func_code = f.__call__.im_func.func_code + else: + call_im_func_code = f.__code__ + + # not a function, must be a callable object, get info from the + # im_func binding of its bound __call__ method + if call_im_func_code.co_flags & STAR_ARGS: + return f + numargs = call_im_func_code.co_argcount + if not _PY3K: + if hasattr(f.__call__,"im_self"): + numargs -= 1 + else: + if hasattr(f.__call__,"__self__"): + numargs -= 0 + except AttributeError: + if not _PY3K: + call_func_code = f.__call__.func_code + else: + call_func_code = f.__call__.__code__ + # not a bound method, get info directly from __call__ method + if call_func_code.co_flags & STAR_ARGS: + return f + numargs = call_func_code.co_argcount + if not _PY3K: + if hasattr(f.__call__,"im_self"): + numargs -= 1 + else: + if hasattr(f.__call__,"__self__"): + numargs -= 1 + + + #~ print ("adding function %s with %d args" % (f.func_name,numargs)) + if numargs == 3: + return f + else: + if numargs > 3: + def tmp(s,l,t): + return f(f.__call__.__self__, s,l,t) + if numargs == 2: + def tmp(s,l,t): + return f(l,t) + elif numargs == 1: + def tmp(s,l,t): + return f(t) + else: #~ numargs == 0: + def tmp(s,l,t): + return f() + try: + tmp.__name__ = f.__name__ + except (AttributeError,TypeError): + # no need for special handling if attribute doesnt exist + pass + try: + tmp.__doc__ = f.__doc__ + except (AttributeError,TypeError): + # no need for special handling if attribute doesnt exist + pass + try: + tmp.__dict__.update(f.__dict__) + except (AttributeError,TypeError): + # no need for special handling if attribute doesnt exist + pass + return tmp + _normalizeParseActionArgs = staticmethod(_normalizeParseActionArgs) + + def setParseAction( self, *fns, **kwargs ): + """Define action to perform when successfully matching parse element definition. + Parse action fn is a callable method with 0-3 arguments, called as fn(s,loc,toks), + fn(loc,toks), fn(toks), or just fn(), where: + - s = the original string being parsed (see note below) + - loc = the location of the matching substring + - toks = a list of the matched tokens, packaged as a ParseResults object + If the functions in fns modify the tokens, they can return them as the return + value from fn, and the modified list of tokens will replace the original. + Otherwise, fn does not need to return any value. + + Note: the default parsing behavior is to expand tabs in the input string + before starting the parsing process. See L{I{parseString}} for more information + on parsing strings containing s, and suggested methods to maintain a + consistent view of the parsed string, the parse location, and line and column + positions within the parsed string. + """ + self.parseAction = list(map(self._normalizeParseActionArgs, list(fns))) + self.callDuringTry = ("callDuringTry" in kwargs and kwargs["callDuringTry"]) + return self + + def addParseAction( self, *fns, **kwargs ): + """Add parse action to expression's list of parse actions. See L{I{setParseAction}}.""" + self.parseAction += list(map(self._normalizeParseActionArgs, list(fns))) + self.callDuringTry = self.callDuringTry or ("callDuringTry" in kwargs and kwargs["callDuringTry"]) + return self + + def setFailAction( self, fn ): + """Define action to perform if parsing fails at this expression. + Fail acton fn is a callable function that takes the arguments + fn(s,loc,expr,err) where: + - s = string being parsed + - loc = location where expression match was attempted and failed + - expr = the parse expression that failed + - err = the exception thrown + The function returns no value. It may throw ParseFatalException + if it is desired to stop parsing immediately.""" + self.failAction = fn + return self + + def _skipIgnorables( self, instring, loc ): + exprsFound = True + while exprsFound: + exprsFound = False + for e in self.ignoreExprs: + try: + while 1: + loc,dummy = e._parse( instring, loc ) + exprsFound = True + except ParseException: + pass + return loc + + def preParse( self, instring, loc ): + if self.ignoreExprs: + loc = self._skipIgnorables( instring, loc ) + + if self.skipWhitespace: + wt = self.whiteChars + instrlen = len(instring) + while loc < instrlen and instring[loc] in wt: + loc += 1 + + return loc + + def parseImpl( self, instring, loc, doActions=True ): + return loc, [] + + def postParse( self, instring, loc, tokenlist ): + return tokenlist + + #~ @profile + def _parseNoCache( self, instring, loc, doActions=True, callPreParse=True ): + debugging = ( self.debug ) #and doActions ) + + if debugging or self.failAction: + #~ print ("Match",self,"at loc",loc,"(%d,%d)" % ( lineno(loc,instring), col(loc,instring) )) + if (self.debugActions[0] ): + self.debugActions[0]( instring, loc, self ) + if callPreParse and self.callPreparse: + preloc = self.preParse( instring, loc ) + else: + preloc = loc + tokensStart = loc + try: + try: + loc,tokens = self.parseImpl( instring, preloc, doActions ) + except IndexError: + raise ParseException( instring, len(instring), self.errmsg, self ) + except ParseBaseException, err: + #~ print ("Exception raised:", err) + if self.debugActions[2]: + self.debugActions[2]( instring, tokensStart, self, err ) + if self.failAction: + self.failAction( instring, tokensStart, self, err ) + raise + else: + if callPreParse and self.callPreparse: + preloc = self.preParse( instring, loc ) + else: + preloc = loc + tokensStart = loc + if self.mayIndexError or loc >= len(instring): + try: + loc,tokens = self.parseImpl( instring, preloc, doActions ) + except IndexError: + raise ParseException( instring, len(instring), self.errmsg, self ) + else: + loc,tokens = self.parseImpl( instring, preloc, doActions ) + + tokens = self.postParse( instring, loc, tokens ) + + retTokens = ParseResults( tokens, self.resultsName, asList=self.saveAsList, modal=self.modalResults ) + if self.parseAction and (doActions or self.callDuringTry): + if debugging: + try: + for fn in self.parseAction: + tokens = fn( instring, tokensStart, retTokens ) + if tokens is not None: + retTokens = ParseResults( tokens, + self.resultsName, + asList=self.saveAsList and isinstance(tokens,(ParseResults,list)), + modal=self.modalResults ) + except ParseBaseException, err: + #~ print "Exception raised in user parse action:", err + if (self.debugActions[2] ): + self.debugActions[2]( instring, tokensStart, self, err ) + raise + else: + for fn in self.parseAction: + tokens = fn( instring, tokensStart, retTokens ) + if tokens is not None: + retTokens = ParseResults( tokens, + self.resultsName, + asList=self.saveAsList and isinstance(tokens,(ParseResults,list)), + modal=self.modalResults ) + + if debugging: + #~ print ("Matched",self,"->",retTokens.asList()) + if (self.debugActions[1] ): + self.debugActions[1]( instring, tokensStart, loc, self, retTokens ) + + return loc, retTokens + + def tryParse( self, instring, loc ): + try: + return self._parse( instring, loc, doActions=False )[0] + except ParseFatalException: + raise ParseException( instring, loc, self.errmsg, self) + + # this method gets repeatedly called during backtracking with the same arguments - + # we can cache these arguments and save ourselves the trouble of re-parsing the contained expression + def _parseCache( self, instring, loc, doActions=True, callPreParse=True ): + lookup = (self,instring,loc,callPreParse,doActions) + if lookup in ParserElement._exprArgCache: + value = ParserElement._exprArgCache[ lookup ] + if isinstance(value,Exception): + raise value + return value + else: + try: + value = self._parseNoCache( instring, loc, doActions, callPreParse ) + ParserElement._exprArgCache[ lookup ] = (value[0],value[1].copy()) + return value + except ParseBaseException, pe: + ParserElement._exprArgCache[ lookup ] = pe + raise + + _parse = _parseNoCache + + # argument cache for optimizing repeated calls when backtracking through recursive expressions + _exprArgCache = {} + def resetCache(): + ParserElement._exprArgCache.clear() + resetCache = staticmethod(resetCache) + + _packratEnabled = False + def enablePackrat(): + """Enables "packrat" parsing, which adds memoizing to the parsing logic. + Repeated parse attempts at the same string location (which happens + often in many complex grammars) can immediately return a cached value, + instead of re-executing parsing/validating code. Memoizing is done of + both valid results and parsing exceptions. + + This speedup may break existing programs that use parse actions that + have side-effects. For this reason, packrat parsing is disabled when + you first import pyparsing. To activate the packrat feature, your + program must call the class method ParserElement.enablePackrat(). If + your program uses psyco to "compile as you go", you must call + enablePackrat before calling psyco.full(). If you do not do this, + Python will crash. For best results, call enablePackrat() immediately + after importing pyparsing. + """ + if not ParserElement._packratEnabled: + ParserElement._packratEnabled = True + ParserElement._parse = ParserElement._parseCache + enablePackrat = staticmethod(enablePackrat) + + def parseString( self, instring, parseAll=False ): + """Execute the parse expression with the given string. + This is the main interface to the client code, once the complete + expression has been built. + + If you want the grammar to require that the entire input string be + successfully parsed, then set parseAll to True (equivalent to ending + the grammar with StringEnd()). + + Note: parseString implicitly calls expandtabs() on the input string, + in order to report proper column numbers in parse actions. + If the input string contains tabs and + the grammar uses parse actions that use the loc argument to index into the + string being parsed, you can ensure you have a consistent view of the input + string by: + - calling parseWithTabs on your grammar before calling parseString + (see L{I{parseWithTabs}}) + - define your parse action using the full (s,loc,toks) signature, and + reference the input string using the parse action's s argument + - explictly expand the tabs in your input string before calling + parseString + """ + ParserElement.resetCache() + if not self.streamlined: + self.streamline() + #~ self.saveAsList = True + for e in self.ignoreExprs: + e.streamline() + if not self.keepTabs: + instring = instring.expandtabs() + loc, tokens = self._parse( instring, 0 ) + if parseAll: + StringEnd()._parse( instring, loc ) + return tokens + + def scanString( self, instring, maxMatches=_MAX_INT ): + """Scan the input string for expression matches. Each match will return the + matching tokens, start location, and end location. May be called with optional + maxMatches argument, to clip scanning after 'n' matches are found. + + Note that the start and end locations are reported relative to the string + being parsed. See L{I{parseString}} for more information on parsing + strings with embedded tabs.""" + if not self.streamlined: + self.streamline() + for e in self.ignoreExprs: + e.streamline() + + if not self.keepTabs: + instring = _ustr(instring).expandtabs() + instrlen = len(instring) + loc = 0 + preparseFn = self.preParse + parseFn = self._parse + ParserElement.resetCache() + matches = 0 + while loc <= instrlen and matches < maxMatches: + try: + preloc = preparseFn( instring, loc ) + nextLoc,tokens = parseFn( instring, preloc, callPreParse=False ) + except ParseException: + loc = preloc+1 + else: + matches += 1 + yield tokens, preloc, nextLoc + loc = nextLoc + + def transformString( self, instring ): + """Extension to scanString, to modify matching text with modified tokens that may + be returned from a parse action. To use transformString, define a grammar and + attach a parse action to it that modifies the returned token list. + Invoking transformString() on a target string will then scan for matches, + and replace the matched text patterns according to the logic in the parse + action. transformString() returns the resulting transformed string.""" + out = [] + lastE = 0 + # force preservation of s, to minimize unwanted transformation of string, and to + # keep string locs straight between transformString and scanString + self.keepTabs = True + for t,s,e in self.scanString( instring ): + out.append( instring[lastE:s] ) + if t: + if isinstance(t,ParseResults): + out += t.asList() + elif isinstance(t,list): + out += t + else: + out.append(t) + lastE = e + out.append(instring[lastE:]) + return "".join(map(_ustr,out)) + + def searchString( self, instring, maxMatches=_MAX_INT ): + """Another extension to scanString, simplifying the access to the tokens found + to match the given parse expression. May be called with optional + maxMatches argument, to clip searching after 'n' matches are found. + """ + return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ]) + + def __add__(self, other ): + """Implementation of + operator - returns And""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return And( [ self, other ] ) + + def __radd__(self, other ): + """Implementation of + operator when left operand is not a ParserElement""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return other + self + + def __sub__(self, other): + """Implementation of - operator, returns And with error stop""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return And( [ self, And._ErrorStop(), other ] ) + + def __rsub__(self, other ): + """Implementation of - operator when left operand is not a ParserElement""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return other - self + + def __mul__(self,other): + if isinstance(other,int): + minElements, optElements = other,0 + elif isinstance(other,tuple): + if len(other)==0: + other = (None,None) + elif len(other)==1: + other = (other[0],None) + if len(other)==2: + if other[0] is None: + other = (0, other[1]) + if isinstance(other[0],int) and other[1] is None: + if other[0] == 0: + return ZeroOrMore(self) + if other[0] == 1: + return OneOrMore(self) + else: + return self*other[0] + ZeroOrMore(self) + elif isinstance(other[0],int) and isinstance(other[1],int): + minElements, optElements = other + optElements -= minElements + else: + raise TypeError("cannot multiply 'ParserElement' and ('%s','%s') objects", type(other[0]),type(other[1])) + else: + raise TypeError("can only multiply 'ParserElement' and int or (int,int) objects") + else: + raise TypeError("cannot multiply 'ParserElement' and '%s' objects", type(other)) + + if minElements < 0: + raise ValueError("cannot multiply ParserElement by negative value") + if optElements < 0: + raise ValueError("second tuple value must be greater or equal to first tuple value") + if minElements == optElements == 0: + raise ValueError("cannot multiply ParserElement by 0 or (0,0)") + + if (optElements): + def makeOptionalList(n): + if n>1: + return Optional(self + makeOptionalList(n-1)) + else: + return Optional(self) + if minElements: + if minElements == 1: + ret = self + makeOptionalList(optElements) + else: + ret = And([self]*minElements) + makeOptionalList(optElements) + else: + ret = makeOptionalList(optElements) + else: + if minElements == 1: + ret = self + else: + ret = And([self]*minElements) + return ret + + def __rmul__(self, other): + return self.__mul__(other) + + def __or__(self, other ): + """Implementation of | operator - returns MatchFirst""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return MatchFirst( [ self, other ] ) + + def __ror__(self, other ): + """Implementation of | operator when left operand is not a ParserElement""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return other | self + + def __xor__(self, other ): + """Implementation of ^ operator - returns Or""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return Or( [ self, other ] ) + + def __rxor__(self, other ): + """Implementation of ^ operator when left operand is not a ParserElement""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return other ^ self + + def __and__(self, other ): + """Implementation of & operator - returns Each""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return Each( [ self, other ] ) + + def __rand__(self, other ): + """Implementation of & operator when left operand is not a ParserElement""" + if isinstance( other, basestring ): + other = Literal( other ) + if not isinstance( other, ParserElement ): + warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), + SyntaxWarning, stacklevel=2) + return None + return other & self + + def __invert__( self ): + """Implementation of ~ operator - returns NotAny""" + return NotAny( self ) + + def __call__(self, name): + """Shortcut for setResultsName, with listAllMatches=default:: + userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno") + could be written as:: + userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") + """ + return self.setResultsName(name) + + def suppress( self ): + """Suppresses the output of this ParserElement; useful to keep punctuation from + cluttering up returned output. + """ + return Suppress( self ) + + def leaveWhitespace( self ): + """Disables the skipping of whitespace before matching the characters in the + ParserElement's defined pattern. This is normally only used internally by + the pyparsing module, but may be needed in some whitespace-sensitive grammars. + """ + self.skipWhitespace = False + return self + + def setWhitespaceChars( self, chars ): + """Overrides the default whitespace chars + """ + self.skipWhitespace = True + self.whiteChars = chars + self.copyDefaultWhiteChars = False + return self + + def parseWithTabs( self ): + """Overrides default behavior to expand s to spaces before parsing the input string. + Must be called before parseString when the input grammar contains elements that + match characters.""" + self.keepTabs = True + return self + + def ignore( self, other ): + """Define expression to be ignored (e.g., comments) while doing pattern + matching; may be called repeatedly, to define multiple comment or other + ignorable patterns. + """ + if isinstance( other, Suppress ): + if other not in self.ignoreExprs: + self.ignoreExprs.append( other ) + else: + self.ignoreExprs.append( Suppress( other ) ) + return self + + def setDebugActions( self, startAction, successAction, exceptionAction ): + """Enable display of debugging messages while doing pattern matching.""" + self.debugActions = (startAction or _defaultStartDebugAction, + successAction or _defaultSuccessDebugAction, + exceptionAction or _defaultExceptionDebugAction) + self.debug = True + return self + + def setDebug( self, flag=True ): + """Enable display of debugging messages while doing pattern matching. + Set flag to True to enable, False to disable.""" + if flag: + self.setDebugActions( _defaultStartDebugAction, _defaultSuccessDebugAction, _defaultExceptionDebugAction ) + else: + self.debug = False + return self + + def __str__( self ): + return self.name + + def __repr__( self ): + return _ustr(self) + + def streamline( self ): + self.streamlined = True + self.strRepr = None + return self + + def checkRecursion( self, parseElementList ): + pass + + def validate( self, validateTrace=[] ): + """Check defined expressions for valid structure, check for infinite recursive definitions.""" + self.checkRecursion( [] ) + + def parseFile( self, file_or_filename ): + """Execute the parse expression on the given file or filename. + If a filename is specified (instead of a file object), + the entire file is opened, read, and closed before parsing. + """ + try: + file_contents = file_or_filename.read() + except AttributeError: + f = open(file_or_filename, "rb") + file_contents = f.read() + f.close() + return self.parseString(file_contents) + + def getException(self): + return ParseException("",0,self.errmsg,self) + + def __getattr__(self,aname): + if aname == "myException": + self.myException = ret = self.getException(); + return ret; + else: + raise AttributeError("no such attribute " + aname) + + def __eq__(self,other): + if isinstance(other, basestring): + try: + (self + StringEnd()).parseString(_ustr(other)) + return True + except ParseBaseException: + return False + else: + return super(ParserElement,self)==other + + def __hash__(self): + return hash(id(self)) + + def __req__(self,other): + return self == other + + +class Token(ParserElement): + """Abstract ParserElement subclass, for defining atomic matching patterns.""" + def __init__( self ): + super(Token,self).__init__( savelist=False ) + #self.myException = ParseException("",0,"",self) + + def setName(self, name): + s = super(Token,self).setName(name) + self.errmsg = "Expected " + self.name + #s.myException.msg = self.errmsg + return s + + +class Empty(Token): + """An empty token, will always match.""" + def __init__( self ): + super(Empty,self).__init__() + self.name = "Empty" + self.mayReturnEmpty = True + self.mayIndexError = False + + +class NoMatch(Token): + """A token that will never match.""" + def __init__( self ): + super(NoMatch,self).__init__() + self.name = "NoMatch" + self.mayReturnEmpty = True + self.mayIndexError = False + self.errmsg = "Unmatchable token" + #self.myException.msg = self.errmsg + + def parseImpl( self, instring, loc, doActions=True ): + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + +class Literal(Token): + """Token to exactly match a specified string.""" + def __init__( self, matchString ): + super(Literal,self).__init__() + self.match = matchString + self.matchLen = len(matchString) + try: + self.firstMatchChar = matchString[0] + except IndexError: + warnings.warn("null string passed to Literal; use Empty() instead", + SyntaxWarning, stacklevel=2) + self.__class__ = Empty + self.name = '"%s"' % _ustr(self.match) + self.errmsg = "Expected " + self.name + self.mayReturnEmpty = False + #self.myException.msg = self.errmsg + self.mayIndexError = False + + # Performance tuning: this routine gets called a *lot* + # if this is a single character match string and the first character matches, + # short-circuit as quickly as possible, and avoid calling startswith + #~ @profile + def parseImpl( self, instring, loc, doActions=True ): + if (instring[loc] == self.firstMatchChar and + (self.matchLen==1 or instring.startswith(self.match,loc)) ): + return loc+self.matchLen, self.match + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc +_L = Literal + +class Keyword(Token): + """Token to exactly match a specified string as a keyword, that is, it must be + immediately followed by a non-keyword character. Compare with Literal:: + Literal("if") will match the leading 'if' in 'ifAndOnlyIf'. + Keyword("if") will not; it will only match the leading 'if in 'if x=1', or 'if(y==2)' + Accepts two optional constructor arguments in addition to the keyword string: + identChars is a string of characters that would be valid identifier characters, + defaulting to all alphanumerics + "_" and "$"; caseless allows case-insensitive + matching, default is False. + """ + DEFAULT_KEYWORD_CHARS = alphanums+"_$" + + def __init__( self, matchString, identChars=DEFAULT_KEYWORD_CHARS, caseless=False ): + super(Keyword,self).__init__() + self.match = matchString + self.matchLen = len(matchString) + try: + self.firstMatchChar = matchString[0] + except IndexError: + warnings.warn("null string passed to Keyword; use Empty() instead", + SyntaxWarning, stacklevel=2) + self.name = '"%s"' % self.match + self.errmsg = "Expected " + self.name + self.mayReturnEmpty = False + #self.myException.msg = self.errmsg + self.mayIndexError = False + self.caseless = caseless + if caseless: + self.caselessmatch = matchString.upper() + identChars = identChars.upper() + self.identChars = _str2dict(identChars) + + def parseImpl( self, instring, loc, doActions=True ): + if self.caseless: + if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and + (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) and + (loc == 0 or instring[loc-1].upper() not in self.identChars) ): + return loc+self.matchLen, self.match + else: + if (instring[loc] == self.firstMatchChar and + (self.matchLen==1 or instring.startswith(self.match,loc)) and + (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen] not in self.identChars) and + (loc == 0 or instring[loc-1] not in self.identChars) ): + return loc+self.matchLen, self.match + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + def copy(self): + c = super(Keyword,self).copy() + c.identChars = Keyword.DEFAULT_KEYWORD_CHARS + return c + + def setDefaultKeywordChars( chars ): + """Overrides the default Keyword chars + """ + Keyword.DEFAULT_KEYWORD_CHARS = chars + setDefaultKeywordChars = staticmethod(setDefaultKeywordChars) + + +class CaselessLiteral(Literal): + """Token to match a specified string, ignoring case of letters. + Note: the matched results will always be in the case of the given + match string, NOT the case of the input text. + """ + def __init__( self, matchString ): + super(CaselessLiteral,self).__init__( matchString.upper() ) + # Preserve the defining literal. + self.returnString = matchString + self.name = "'%s'" % self.returnString + self.errmsg = "Expected " + self.name + #self.myException.msg = self.errmsg + + def parseImpl( self, instring, loc, doActions=True ): + if instring[ loc:loc+self.matchLen ].upper() == self.match: + return loc+self.matchLen, self.returnString + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + +class CaselessKeyword(Keyword): + def __init__( self, matchString, identChars=Keyword.DEFAULT_KEYWORD_CHARS ): + super(CaselessKeyword,self).__init__( matchString, identChars, caseless=True ) + + def parseImpl( self, instring, loc, doActions=True ): + if ( (instring[ loc:loc+self.matchLen ].upper() == self.caselessmatch) and + (loc >= len(instring)-self.matchLen or instring[loc+self.matchLen].upper() not in self.identChars) ): + return loc+self.matchLen, self.match + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + +class Word(Token): + """Token for matching words composed of allowed character sets. + Defined with string containing all allowed initial characters, + an optional string containing allowed body characters (if omitted, + defaults to the initial character set), and an optional minimum, + maximum, and/or exact length. The default value for min is 1 (a + minimum value < 1 is not valid); the default values for max and exact + are 0, meaning no maximum or exact length restriction. + """ + def __init__( self, initChars, bodyChars=None, min=1, max=0, exact=0, asKeyword=False ): + super(Word,self).__init__() + self.initCharsOrig = initChars + self.initChars = _str2dict(initChars) + if bodyChars : + self.bodyCharsOrig = bodyChars + self.bodyChars = _str2dict(bodyChars) + else: + self.bodyCharsOrig = initChars + self.bodyChars = _str2dict(initChars) + + self.maxSpecified = max > 0 + + if min < 1: + raise ValueError("cannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permitted") + + self.minLen = min + + if max > 0: + self.maxLen = max + else: + self.maxLen = _MAX_INT + + if exact > 0: + self.maxLen = exact + self.minLen = exact + + self.name = _ustr(self) + self.errmsg = "Expected " + self.name + #self.myException.msg = self.errmsg + self.mayIndexError = False + self.asKeyword = asKeyword + + if ' ' not in self.initCharsOrig+self.bodyCharsOrig and (min==1 and max==0 and exact==0): + if self.bodyCharsOrig == self.initCharsOrig: + self.reString = "[%s]+" % _escapeRegexRangeChars(self.initCharsOrig) + elif len(self.bodyCharsOrig) == 1: + self.reString = "%s[%s]*" % \ + (re.escape(self.initCharsOrig), + _escapeRegexRangeChars(self.bodyCharsOrig),) + else: + self.reString = "[%s][%s]*" % \ + (_escapeRegexRangeChars(self.initCharsOrig), + _escapeRegexRangeChars(self.bodyCharsOrig),) + if self.asKeyword: + self.reString = r"\b"+self.reString+r"\b" + try: + self.re = re.compile( self.reString ) + except: + self.re = None + + def parseImpl( self, instring, loc, doActions=True ): + if self.re: + result = self.re.match(instring,loc) + if not result: + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + loc = result.end() + return loc,result.group() + + if not(instring[ loc ] in self.initChars): + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + start = loc + loc += 1 + instrlen = len(instring) + bodychars = self.bodyChars + maxloc = start + self.maxLen + maxloc = min( maxloc, instrlen ) + while loc < maxloc and instring[loc] in bodychars: + loc += 1 + + throwException = False + if loc - start < self.minLen: + throwException = True + if self.maxSpecified and loc < instrlen and instring[loc] in bodychars: + throwException = True + if self.asKeyword: + if (start>0 and instring[start-1] in bodychars) or (loc4: + return s[:4]+"..." + else: + return s + + if ( self.initCharsOrig != self.bodyCharsOrig ): + self.strRepr = "W:(%s,%s)" % ( charsAsStr(self.initCharsOrig), charsAsStr(self.bodyCharsOrig) ) + else: + self.strRepr = "W:(%s)" % charsAsStr(self.initCharsOrig) + + return self.strRepr + + +class Regex(Token): + """Token for matching strings that match a given regular expression. + Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. + """ + def __init__( self, pattern, flags=0): + """The parameters pattern and flags are passed to the re.compile() function as-is. See the Python re module for an explanation of the acceptable patterns and flags.""" + super(Regex,self).__init__() + + if len(pattern) == 0: + warnings.warn("null string passed to Regex; use Empty() instead", + SyntaxWarning, stacklevel=2) + + self.pattern = pattern + self.flags = flags + + try: + self.re = re.compile(self.pattern, self.flags) + self.reString = self.pattern + except sre_constants.error: + warnings.warn("invalid pattern (%s) passed to Regex" % pattern, + SyntaxWarning, stacklevel=2) + raise + + self.name = _ustr(self) + self.errmsg = "Expected " + self.name + #self.myException.msg = self.errmsg + self.mayIndexError = False + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + result = self.re.match(instring,loc) + if not result: + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + loc = result.end() + d = result.groupdict() + ret = ParseResults(result.group()) + if d: + for k in d: + ret[k] = d[k] + return loc,ret + + def __str__( self ): + try: + return super(Regex,self).__str__() + except: + pass + + if self.strRepr is None: + self.strRepr = "Re:(%s)" % repr(self.pattern) + + return self.strRepr + + +class QuotedString(Token): + """Token for matching strings that are delimited by quoting characters. + """ + def __init__( self, quoteChar, escChar=None, escQuote=None, multiline=False, unquoteResults=True, endQuoteChar=None): + """ + Defined with the following parameters: + - quoteChar - string of one or more characters defining the quote delimiting string + - escChar - character to escape quotes, typically backslash (default=None) + - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None) + - multiline - boolean indicating whether quotes can span multiple lines (default=False) + - unquoteResults - boolean indicating whether the matched text should be unquoted (default=True) + - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=None => same as quoteChar) + """ + super(QuotedString,self).__init__() + + # remove white space from quote chars - wont work anyway + quoteChar = quoteChar.strip() + if len(quoteChar) == 0: + warnings.warn("quoteChar cannot be the empty string",SyntaxWarning,stacklevel=2) + raise SyntaxError() + + if endQuoteChar is None: + endQuoteChar = quoteChar + else: + endQuoteChar = endQuoteChar.strip() + if len(endQuoteChar) == 0: + warnings.warn("endQuoteChar cannot be the empty string",SyntaxWarning,stacklevel=2) + raise SyntaxError() + + self.quoteChar = quoteChar + self.quoteCharLen = len(quoteChar) + self.firstQuoteChar = quoteChar[0] + self.endQuoteChar = endQuoteChar + self.endQuoteCharLen = len(endQuoteChar) + self.escChar = escChar + self.escQuote = escQuote + self.unquoteResults = unquoteResults + + if multiline: + self.flags = re.MULTILINE | re.DOTALL + self.pattern = r'%s(?:[^%s%s]' % \ + ( re.escape(self.quoteChar), + _escapeRegexRangeChars(self.endQuoteChar[0]), + (escChar is not None and _escapeRegexRangeChars(escChar) or '') ) + else: + self.flags = 0 + self.pattern = r'%s(?:[^%s\n\r%s]' % \ + ( re.escape(self.quoteChar), + _escapeRegexRangeChars(self.endQuoteChar[0]), + (escChar is not None and _escapeRegexRangeChars(escChar) or '') ) + if len(self.endQuoteChar) > 1: + self.pattern += ( + '|(?:' + ')|(?:'.join(["%s[^%s]" % (re.escape(self.endQuoteChar[:i]), + _escapeRegexRangeChars(self.endQuoteChar[i])) + for i in range(len(self.endQuoteChar)-1,0,-1)]) + ')' + ) + if escQuote: + self.pattern += (r'|(?:%s)' % re.escape(escQuote)) + if escChar: + self.pattern += (r'|(?:%s.)' % re.escape(escChar)) + self.escCharReplacePattern = re.escape(self.escChar)+"(.)" + self.pattern += (r')*%s' % re.escape(self.endQuoteChar)) + + try: + self.re = re.compile(self.pattern, self.flags) + self.reString = self.pattern + except sre_constants.error: + warnings.warn("invalid pattern (%s) passed to Regex" % self.pattern, + SyntaxWarning, stacklevel=2) + raise + + self.name = _ustr(self) + self.errmsg = "Expected " + self.name + #self.myException.msg = self.errmsg + self.mayIndexError = False + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + result = instring[loc] == self.firstQuoteChar and self.re.match(instring,loc) or None + if not result: + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + loc = result.end() + ret = result.group() + + if self.unquoteResults: + + # strip off quotes + ret = ret[self.quoteCharLen:-self.endQuoteCharLen] + + if isinstance(ret,basestring): + # replace escaped characters + if self.escChar: + ret = re.sub(self.escCharReplacePattern,"\g<1>",ret) + + # replace escaped quotes + if self.escQuote: + ret = ret.replace(self.escQuote, self.endQuoteChar) + + return loc, ret + + def __str__( self ): + try: + return super(QuotedString,self).__str__() + except: + pass + + if self.strRepr is None: + self.strRepr = "quoted string, starting with %s ending with %s" % (self.quoteChar, self.endQuoteChar) + + return self.strRepr + + +class CharsNotIn(Token): + """Token for matching words composed of characters *not* in a given set. + Defined with string containing all disallowed characters, and an optional + minimum, maximum, and/or exact length. The default value for min is 1 (a + minimum value < 1 is not valid); the default values for max and exact + are 0, meaning no maximum or exact length restriction. + """ + def __init__( self, notChars, min=1, max=0, exact=0 ): + super(CharsNotIn,self).__init__() + self.skipWhitespace = False + self.notChars = notChars + + if min < 1: + raise ValueError("cannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permitted") + + self.minLen = min + + if max > 0: + self.maxLen = max + else: + self.maxLen = _MAX_INT + + if exact > 0: + self.maxLen = exact + self.minLen = exact + + self.name = _ustr(self) + self.errmsg = "Expected " + self.name + self.mayReturnEmpty = ( self.minLen == 0 ) + #self.myException.msg = self.errmsg + self.mayIndexError = False + + def parseImpl( self, instring, loc, doActions=True ): + if instring[loc] in self.notChars: + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + start = loc + loc += 1 + notchars = self.notChars + maxlen = min( start+self.maxLen, len(instring) ) + while loc < maxlen and \ + (instring[loc] not in notchars): + loc += 1 + + if loc - start < self.minLen: + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + return loc, instring[start:loc] + + def __str__( self ): + try: + return super(CharsNotIn, self).__str__() + except: + pass + + if self.strRepr is None: + if len(self.notChars) > 4: + self.strRepr = "!W:(%s...)" % self.notChars[:4] + else: + self.strRepr = "!W:(%s)" % self.notChars + + return self.strRepr + +class White(Token): + """Special matching class for matching whitespace. Normally, whitespace is ignored + by pyparsing grammars. This class is included when some whitespace structures + are significant. Define with a string containing the whitespace characters to be + matched; default is " \\t\\n". Also takes optional min, max, and exact arguments, + as defined for the Word class.""" + whiteStrs = { + " " : "", + "\t": "", + "\n": "", + "\r": "", + "\f": "", + } + def __init__(self, ws=" \t\r\n", min=1, max=0, exact=0): + super(White,self).__init__() + self.matchWhite = ws + self.setWhitespaceChars( "".join([c for c in self.whiteChars if c not in self.matchWhite]) ) + #~ self.leaveWhitespace() + self.name = ("".join([White.whiteStrs[c] for c in self.matchWhite])) + self.mayReturnEmpty = True + self.errmsg = "Expected " + self.name + #self.myException.msg = self.errmsg + + self.minLen = min + + if max > 0: + self.maxLen = max + else: + self.maxLen = _MAX_INT + + if exact > 0: + self.maxLen = exact + self.minLen = exact + + def parseImpl( self, instring, loc, doActions=True ): + if not(instring[ loc ] in self.matchWhite): + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + start = loc + loc += 1 + maxloc = start + self.maxLen + maxloc = min( maxloc, len(instring) ) + while loc < maxloc and instring[loc] in self.matchWhite: + loc += 1 + + if loc - start < self.minLen: + #~ raise ParseException( instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + + return loc, instring[start:loc] + + +class _PositionToken(Token): + def __init__( self ): + super(_PositionToken,self).__init__() + self.name=self.__class__.__name__ + self.mayReturnEmpty = True + self.mayIndexError = False + +class GoToColumn(_PositionToken): + """Token to advance to a specific column of input text; useful for tabular report scraping.""" + def __init__( self, colno ): + super(GoToColumn,self).__init__() + self.col = colno + + def preParse( self, instring, loc ): + if col(loc,instring) != self.col: + instrlen = len(instring) + if self.ignoreExprs: + loc = self._skipIgnorables( instring, loc ) + while loc < instrlen and instring[loc].isspace() and col( loc, instring ) != self.col : + loc += 1 + return loc + + def parseImpl( self, instring, loc, doActions=True ): + thiscol = col( loc, instring ) + if thiscol > self.col: + raise ParseException( instring, loc, "Text not in expected column", self ) + newloc = loc + self.col - thiscol + ret = instring[ loc: newloc ] + return newloc, ret + +class LineStart(_PositionToken): + """Matches if current position is at the beginning of a line within the parse string""" + def __init__( self ): + super(LineStart,self).__init__() + self.setWhitespaceChars( " \t" ) + self.errmsg = "Expected start of line" + #self.myException.msg = self.errmsg + + def preParse( self, instring, loc ): + preloc = super(LineStart,self).preParse(instring,loc) + if instring[preloc] == "\n": + loc += 1 + return loc + + def parseImpl( self, instring, loc, doActions=True ): + if not( loc==0 or + (loc == self.preParse( instring, 0 )) or + (instring[loc-1] == "\n") ): #col(loc, instring) != 1: + #~ raise ParseException( instring, loc, "Expected start of line" ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + return loc, [] + +class LineEnd(_PositionToken): + """Matches if current position is at the end of a line within the parse string""" + def __init__( self ): + super(LineEnd,self).__init__() + self.setWhitespaceChars( " \t" ) + self.errmsg = "Expected end of line" + #self.myException.msg = self.errmsg + + def parseImpl( self, instring, loc, doActions=True ): + if loc len(instring): + return loc, [] + else: + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + +class WordStart(_PositionToken): + """Matches if the current position is at the beginning of a Word, and + is not preceded by any character in a given set of wordChars + (default=printables). To emulate the \b behavior of regular expressions, + use WordStart(alphanums). WordStart will also match at the beginning of + the string being parsed, or at the beginning of a line. + """ + def __init__(self, wordChars = printables): + super(WordStart,self).__init__() + self.wordChars = _str2dict(wordChars) + self.errmsg = "Not at the start of a word" + + def parseImpl(self, instring, loc, doActions=True ): + if loc != 0: + if (instring[loc-1] in self.wordChars or + instring[loc] not in self.wordChars): + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + return loc, [] + +class WordEnd(_PositionToken): + """Matches if the current position is at the end of a Word, and + is not followed by any character in a given set of wordChars + (default=printables). To emulate the \b behavior of regular expressions, + use WordEnd(alphanums). WordEnd will also match at the end of + the string being parsed, or at the end of a line. + """ + def __init__(self, wordChars = printables): + super(WordEnd,self).__init__() + self.wordChars = _str2dict(wordChars) + self.skipWhitespace = False + self.errmsg = "Not at the end of a word" + + def parseImpl(self, instring, loc, doActions=True ): + instrlen = len(instring) + if instrlen>0 and loc maxExcLoc: + maxException = err + maxExcLoc = err.loc + except IndexError: + if len(instring) > maxExcLoc: + maxException = ParseException(instring,len(instring),e.errmsg,self) + maxExcLoc = len(instring) + else: + if loc2 > maxMatchLoc: + maxMatchLoc = loc2 + maxMatchExp = e + + if maxMatchLoc < 0: + if maxException is not None: + raise maxException + else: + raise ParseException(instring, loc, "no defined alternatives to match", self) + + return maxMatchExp._parse( instring, loc, doActions ) + + def __ixor__(self, other ): + if isinstance( other, basestring ): + other = Literal( other ) + return self.append( other ) #Or( [ self, other ] ) + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "{" + " ^ ".join( [ _ustr(e) for e in self.exprs ] ) + "}" + + return self.strRepr + + def checkRecursion( self, parseElementList ): + subRecCheckList = parseElementList[:] + [ self ] + for e in self.exprs: + e.checkRecursion( subRecCheckList ) + + +class MatchFirst(ParseExpression): + """Requires that at least one ParseExpression is found. + If two expressions match, the first one listed is the one that will match. + May be constructed using the '|' operator. + """ + def __init__( self, exprs, savelist = False ): + super(MatchFirst,self).__init__(exprs, savelist) + if exprs: + self.mayReturnEmpty = False + for e in self.exprs: + if e.mayReturnEmpty: + self.mayReturnEmpty = True + break + else: + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + maxExcLoc = -1 + maxException = None + for e in self.exprs: + try: + ret = e._parse( instring, loc, doActions ) + return ret + except ParseException, err: + if err.loc > maxExcLoc: + maxException = err + maxExcLoc = err.loc + except IndexError: + if len(instring) > maxExcLoc: + maxException = ParseException(instring,len(instring),e.errmsg,self) + maxExcLoc = len(instring) + + # only got here if no expression matched, raise exception for match that made it the furthest + else: + if maxException is not None: + raise maxException + else: + raise ParseException(instring, loc, "no defined alternatives to match", self) + + def __ior__(self, other ): + if isinstance( other, basestring ): + other = Literal( other ) + return self.append( other ) #MatchFirst( [ self, other ] ) + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "{" + " | ".join( [ _ustr(e) for e in self.exprs ] ) + "}" + + return self.strRepr + + def checkRecursion( self, parseElementList ): + subRecCheckList = parseElementList[:] + [ self ] + for e in self.exprs: + e.checkRecursion( subRecCheckList ) + + +class Each(ParseExpression): + """Requires all given ParseExpressions to be found, but in any order. + Expressions may be separated by whitespace. + May be constructed using the '&' operator. + """ + def __init__( self, exprs, savelist = True ): + super(Each,self).__init__(exprs, savelist) + self.mayReturnEmpty = True + for e in self.exprs: + if not e.mayReturnEmpty: + self.mayReturnEmpty = False + break + self.skipWhitespace = True + self.initExprGroups = True + + def parseImpl( self, instring, loc, doActions=True ): + if self.initExprGroups: + self.optionals = [ e.expr for e in self.exprs if isinstance(e,Optional) ] + self.multioptionals = [ e.expr for e in self.exprs if isinstance(e,ZeroOrMore) ] + self.multirequired = [ e.expr for e in self.exprs if isinstance(e,OneOrMore) ] + self.required = [ e for e in self.exprs if not isinstance(e,(Optional,ZeroOrMore,OneOrMore)) ] + self.required += self.multirequired + self.initExprGroups = False + tmpLoc = loc + tmpReqd = self.required[:] + tmpOpt = self.optionals[:] + matchOrder = [] + + keepMatching = True + while keepMatching: + tmpExprs = tmpReqd + tmpOpt + self.multioptionals + self.multirequired + failed = [] + for e in tmpExprs: + try: + tmpLoc = e.tryParse( instring, tmpLoc ) + except ParseException: + failed.append(e) + else: + matchOrder.append(e) + if e in tmpReqd: + tmpReqd.remove(e) + elif e in tmpOpt: + tmpOpt.remove(e) + if len(failed) == len(tmpExprs): + keepMatching = False + + if tmpReqd: + missing = ", ".join( [ _ustr(e) for e in tmpReqd ] ) + raise ParseException(instring,loc,"Missing one or more required elements (%s)" % missing ) + + # add any unmatched Optionals, in case they have default values defined + matchOrder += list(e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt) + + resultlist = [] + for e in matchOrder: + loc,results = e._parse(instring,loc,doActions) + resultlist.append(results) + + finalResults = ParseResults([]) + for r in resultlist: + dups = {} + for k in r.keys(): + if k in finalResults.keys(): + tmp = ParseResults(finalResults[k]) + tmp += ParseResults(r[k]) + dups[k] = tmp + finalResults += ParseResults(r) + for k,v in dups.items(): + finalResults[k] = v + return loc, finalResults + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "{" + " & ".join( [ _ustr(e) for e in self.exprs ] ) + "}" + + return self.strRepr + + def checkRecursion( self, parseElementList ): + subRecCheckList = parseElementList[:] + [ self ] + for e in self.exprs: + e.checkRecursion( subRecCheckList ) + + +class ParseElementEnhance(ParserElement): + """Abstract subclass of ParserElement, for combining and post-processing parsed tokens.""" + def __init__( self, expr, savelist=False ): + super(ParseElementEnhance,self).__init__(savelist) + if isinstance( expr, basestring ): + expr = Literal(expr) + self.expr = expr + self.strRepr = None + if expr is not None: + self.mayIndexError = expr.mayIndexError + self.mayReturnEmpty = expr.mayReturnEmpty + self.setWhitespaceChars( expr.whiteChars ) + self.skipWhitespace = expr.skipWhitespace + self.saveAsList = expr.saveAsList + self.callPreparse = expr.callPreparse + self.ignoreExprs.extend(expr.ignoreExprs) + + def parseImpl( self, instring, loc, doActions=True ): + if self.expr is not None: + return self.expr._parse( instring, loc, doActions, callPreParse=False ) + else: + raise ParseException("",loc,self.errmsg,self) + + def leaveWhitespace( self ): + self.skipWhitespace = False + self.expr = self.expr.copy() + if self.expr is not None: + self.expr.leaveWhitespace() + return self + + def ignore( self, other ): + if isinstance( other, Suppress ): + if other not in self.ignoreExprs: + super( ParseElementEnhance, self).ignore( other ) + if self.expr is not None: + self.expr.ignore( self.ignoreExprs[-1] ) + else: + super( ParseElementEnhance, self).ignore( other ) + if self.expr is not None: + self.expr.ignore( self.ignoreExprs[-1] ) + return self + + def streamline( self ): + super(ParseElementEnhance,self).streamline() + if self.expr is not None: + self.expr.streamline() + return self + + def checkRecursion( self, parseElementList ): + if self in parseElementList: + raise RecursiveGrammarException( parseElementList+[self] ) + subRecCheckList = parseElementList[:] + [ self ] + if self.expr is not None: + self.expr.checkRecursion( subRecCheckList ) + + def validate( self, validateTrace=[] ): + tmp = validateTrace[:]+[self] + if self.expr is not None: + self.expr.validate(tmp) + self.checkRecursion( [] ) + + def __str__( self ): + try: + return super(ParseElementEnhance,self).__str__() + except: + pass + + if self.strRepr is None and self.expr is not None: + self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.expr) ) + return self.strRepr + + +class FollowedBy(ParseElementEnhance): + """Lookahead matching of the given parse expression. FollowedBy + does *not* advance the parsing position within the input string, it only + verifies that the specified parse expression matches at the current + position. FollowedBy always returns a null token list.""" + def __init__( self, expr ): + super(FollowedBy,self).__init__(expr) + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + self.expr.tryParse( instring, loc ) + return loc, [] + + +class NotAny(ParseElementEnhance): + """Lookahead to disallow matching with the given parse expression. NotAny + does *not* advance the parsing position within the input string, it only + verifies that the specified parse expression does *not* match at the current + position. Also, NotAny does *not* skip over leading whitespace. NotAny + always returns a null token list. May be constructed using the '~' operator.""" + def __init__( self, expr ): + super(NotAny,self).__init__(expr) + #~ self.leaveWhitespace() + self.skipWhitespace = False # do NOT use self.leaveWhitespace(), don't want to propagate to exprs + self.mayReturnEmpty = True + self.errmsg = "Found unwanted token, "+_ustr(self.expr) + #self.myException = ParseException("",0,self.errmsg,self) + + def parseImpl( self, instring, loc, doActions=True ): + try: + self.expr.tryParse( instring, loc ) + except (ParseException,IndexError): + pass + else: + #~ raise ParseException(instring, loc, self.errmsg ) + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + return loc, [] + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "~{" + _ustr(self.expr) + "}" + + return self.strRepr + + +class ZeroOrMore(ParseElementEnhance): + """Optional repetition of zero or more of the given expression.""" + def __init__( self, expr ): + super(ZeroOrMore,self).__init__(expr) + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + tokens = [] + try: + loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False ) + hasIgnoreExprs = ( len(self.ignoreExprs) > 0 ) + while 1: + if hasIgnoreExprs: + preloc = self._skipIgnorables( instring, loc ) + else: + preloc = loc + loc, tmptokens = self.expr._parse( instring, preloc, doActions ) + if tmptokens or tmptokens.keys(): + tokens += tmptokens + except (ParseException,IndexError): + pass + + return loc, tokens + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "[" + _ustr(self.expr) + "]..." + + return self.strRepr + + def setResultsName( self, name, listAllMatches=False ): + ret = super(ZeroOrMore,self).setResultsName(name,listAllMatches) + ret.saveAsList = True + return ret + + +class OneOrMore(ParseElementEnhance): + """Repetition of one or more of the given expression.""" + def parseImpl( self, instring, loc, doActions=True ): + # must be at least one + loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False ) + try: + hasIgnoreExprs = ( len(self.ignoreExprs) > 0 ) + while 1: + if hasIgnoreExprs: + preloc = self._skipIgnorables( instring, loc ) + else: + preloc = loc + loc, tmptokens = self.expr._parse( instring, preloc, doActions ) + if tmptokens or tmptokens.keys(): + tokens += tmptokens + except (ParseException,IndexError): + pass + + return loc, tokens + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "{" + _ustr(self.expr) + "}..." + + return self.strRepr + + def setResultsName( self, name, listAllMatches=False ): + ret = super(OneOrMore,self).setResultsName(name,listAllMatches) + ret.saveAsList = True + return ret + +class _NullToken(object): + def __bool__(self): + return False + __nonzero__ = __bool__ + def __str__(self): + return "" + +_optionalNotMatched = _NullToken() +class Optional(ParseElementEnhance): + """Optional matching of the given expression. + A default return string can also be specified, if the optional expression + is not found. + """ + def __init__( self, exprs, default=_optionalNotMatched ): + super(Optional,self).__init__( exprs, savelist=False ) + self.defaultValue = default + self.mayReturnEmpty = True + + def parseImpl( self, instring, loc, doActions=True ): + try: + loc, tokens = self.expr._parse( instring, loc, doActions, callPreParse=False ) + except (ParseException,IndexError): + if self.defaultValue is not _optionalNotMatched: + if self.expr.resultsName: + tokens = ParseResults([ self.defaultValue ]) + tokens[self.expr.resultsName] = self.defaultValue + else: + tokens = [ self.defaultValue ] + else: + tokens = [] + return loc, tokens + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + if self.strRepr is None: + self.strRepr = "[" + _ustr(self.expr) + "]" + + return self.strRepr + + +class SkipTo(ParseElementEnhance): + """Token for skipping over all undefined text until the matched expression is found. + If include is set to true, the matched expression is also consumed. The ignore + argument is used to define grammars (typically quoted strings and comments) that + might contain false matches. + """ + def __init__( self, other, include=False, ignore=None ): + super( SkipTo, self ).__init__( other ) + if ignore is not None: + self.expr = self.expr.copy() + self.expr.ignore(ignore) + self.mayReturnEmpty = True + self.mayIndexError = False + self.includeMatch = include + self.asList = False + self.errmsg = "No match found for "+_ustr(self.expr) + #self.myException = ParseException("",0,self.errmsg,self) + + def parseImpl( self, instring, loc, doActions=True ): + startLoc = loc + instrlen = len(instring) + expr = self.expr + while loc <= instrlen: + try: + loc = expr._skipIgnorables( instring, loc ) + expr._parse( instring, loc, doActions=False, callPreParse=False ) + if self.includeMatch: + skipText = instring[startLoc:loc] + loc,mat = expr._parse(instring,loc,doActions,callPreParse=False) + if mat: + skipRes = ParseResults( skipText ) + skipRes += mat + return loc, [ skipRes ] + else: + return loc, [ skipText ] + else: + return loc, [ instring[startLoc:loc] ] + except (ParseException,IndexError): + loc += 1 + exc = self.myException + exc.loc = loc + exc.pstr = instring + raise exc + +class Forward(ParseElementEnhance): + """Forward declaration of an expression to be defined later - + used for recursive grammars, such as algebraic infix notation. + When the expression is known, it is assigned to the Forward variable using the '<<' operator. + + Note: take care when assigning to Forward not to overlook precedence of operators. + Specifically, '|' has a lower precedence than '<<', so that:: + fwdExpr << a | b | c + will actually be evaluated as:: + (fwdExpr << a) | b | c + thereby leaving b and c out as parseable alternatives. It is recommended that you + explicitly group the values inserted into the Forward:: + fwdExpr << (a | b | c) + """ + def __init__( self, other=None ): + super(Forward,self).__init__( other, savelist=False ) + + def __lshift__( self, other ): + if isinstance( other, basestring ): + other = Literal(other) + self.expr = other + self.mayReturnEmpty = other.mayReturnEmpty + self.strRepr = None + self.mayIndexError = self.expr.mayIndexError + self.mayReturnEmpty = self.expr.mayReturnEmpty + self.setWhitespaceChars( self.expr.whiteChars ) + self.skipWhitespace = self.expr.skipWhitespace + self.saveAsList = self.expr.saveAsList + self.ignoreExprs.extend(self.expr.ignoreExprs) + return None + + def leaveWhitespace( self ): + self.skipWhitespace = False + return self + + def streamline( self ): + if not self.streamlined: + self.streamlined = True + if self.expr is not None: + self.expr.streamline() + return self + + def validate( self, validateTrace=[] ): + if self not in validateTrace: + tmp = validateTrace[:]+[self] + if self.expr is not None: + self.expr.validate(tmp) + self.checkRecursion([]) + + def __str__( self ): + if hasattr(self,"name"): + return self.name + + self.__class__ = _ForwardNoRecurse + try: + if self.expr is not None: + retString = _ustr(self.expr) + else: + retString = "None" + finally: + self.__class__ = Forward + return "Forward: "+retString + + def copy(self): + if self.expr is not None: + return super(Forward,self).copy() + else: + ret = Forward() + ret << self + return ret + +class _ForwardNoRecurse(Forward): + def __str__( self ): + return "..." + +class TokenConverter(ParseElementEnhance): + """Abstract subclass of ParseExpression, for converting parsed results.""" + def __init__( self, expr, savelist=False ): + super(TokenConverter,self).__init__( expr )#, savelist ) + self.saveAsList = False + +class Upcase(TokenConverter): + """Converter to upper case all matching tokens.""" + def __init__(self, *args): + super(Upcase,self).__init__(*args) + warnings.warn("Upcase class is deprecated, use upcaseTokens parse action instead", + DeprecationWarning,stacklevel=2) + + def postParse( self, instring, loc, tokenlist ): + return list(map( string.upper, tokenlist )) + + +class Combine(TokenConverter): + """Converter to concatenate all matching tokens to a single string. + By default, the matching patterns must also be contiguous in the input string; + this can be disabled by specifying 'adjacent=False' in the constructor. + """ + def __init__( self, expr, joinString="", adjacent=True ): + super(Combine,self).__init__( expr ) + # suppress whitespace-stripping in contained parse expressions, but re-enable it on the Combine itself + if adjacent: + self.leaveWhitespace() + self.adjacent = adjacent + self.skipWhitespace = True + self.joinString = joinString + + def ignore( self, other ): + if self.adjacent: + ParserElement.ignore(self, other) + else: + super( Combine, self).ignore( other ) + return self + + def postParse( self, instring, loc, tokenlist ): + retToks = tokenlist.copy() + del retToks[:] + retToks += ParseResults([ "".join(tokenlist._asStringList(self.joinString)) ], modal=self.modalResults) + + if self.resultsName and len(retToks.keys())>0: + return [ retToks ] + else: + return retToks + +class Group(TokenConverter): + """Converter to return the matched tokens as a list - useful for returning tokens of ZeroOrMore and OneOrMore expressions.""" + def __init__( self, expr ): + super(Group,self).__init__( expr ) + self.saveAsList = True + + def postParse( self, instring, loc, tokenlist ): + return [ tokenlist ] + +class Dict(TokenConverter): + """Converter to return a repetitive expression as a list, but also as a dictionary. + Each element can also be referenced using the first token in the expression as its key. + Useful for tabular report scraping when the first column can be used as a item key. + """ + def __init__( self, exprs ): + super(Dict,self).__init__( exprs ) + self.saveAsList = True + + def postParse( self, instring, loc, tokenlist ): + for i,tok in enumerate(tokenlist): + if len(tok) == 0: + continue + ikey = tok[0] + if isinstance(ikey,int): + ikey = _ustr(tok[0]).strip() + if len(tok)==1: + tokenlist[ikey] = _ParseResultsWithOffset("",i) + elif len(tok)==2 and not isinstance(tok[1],ParseResults): + tokenlist[ikey] = _ParseResultsWithOffset(tok[1],i) + else: + dictvalue = tok.copy() #ParseResults(i) + del dictvalue[0] + if len(dictvalue)!= 1 or (isinstance(dictvalue,ParseResults) and dictvalue.keys()): + tokenlist[ikey] = _ParseResultsWithOffset(dictvalue,i) + else: + tokenlist[ikey] = _ParseResultsWithOffset(dictvalue[0],i) + + if self.resultsName: + return [ tokenlist ] + else: + return tokenlist + + +class Suppress(TokenConverter): + """Converter for ignoring the results of a parsed expression.""" + def postParse( self, instring, loc, tokenlist ): + return [] + + def suppress( self ): + return self + + +class OnlyOnce(object): + """Wrapper for parse actions, to ensure they are only called once.""" + def __init__(self, methodCall): + self.callable = ParserElement._normalizeParseActionArgs(methodCall) + self.called = False + def __call__(self,s,l,t): + if not self.called: + results = self.callable(s,l,t) + self.called = True + return results + raise ParseException(s,l,"") + def reset(self): + self.called = False + +def traceParseAction(f): + """Decorator for debugging parse actions.""" + f = ParserElement._normalizeParseActionArgs(f) + def z(*paArgs): + thisFunc = f.func_name + s,l,t = paArgs[-3:] + if len(paArgs)>3: + thisFunc = paArgs[0].__class__.__name__ + '.' + thisFunc + sys.stderr.write( ">>entering %s(line: '%s', %d, %s)\n" % (thisFunc,line(l,s),l,t) ) + try: + ret = f(*paArgs) + except Exception, exc: + sys.stderr.write( "<", "|".join( [ _escapeRegexChars(sym) for sym in symbols] )) + try: + if len(symbols)==len("".join(symbols)): + return Regex( "[%s]" % "".join( [ _escapeRegexRangeChars(sym) for sym in symbols] ) ) + else: + return Regex( "|".join( [ re.escape(sym) for sym in symbols] ) ) + except: + warnings.warn("Exception creating Regex for oneOf, building MatchFirst", + SyntaxWarning, stacklevel=2) + + + # last resort, just use MatchFirst + return MatchFirst( [ parseElementClass(sym) for sym in symbols ] ) + +def dictOf( key, value ): + """Helper to easily and clearly define a dictionary by specifying the respective patterns + for the key and value. Takes care of defining the Dict, ZeroOrMore, and Group tokens + in the proper order. The key pattern can include delimiting markers or punctuation, + as long as they are suppressed, thereby leaving the significant key text. The value + pattern can include named results, so that the Dict results can include named token + fields. + """ + return Dict( ZeroOrMore( Group ( key + value ) ) ) + +# convenience constants for positional expressions +empty = Empty().setName("empty") +lineStart = LineStart().setName("lineStart") +lineEnd = LineEnd().setName("lineEnd") +stringStart = StringStart().setName("stringStart") +stringEnd = StringEnd().setName("stringEnd") + +_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1]) +_printables_less_backslash = "".join([ c for c in printables if c not in r"\]" ]) +_escapedHexChar = Combine( Suppress(_bslash + "0x") + Word(hexnums) ).setParseAction(lambda s,l,t:unichr(int(t[0],16))) +_escapedOctChar = Combine( Suppress(_bslash) + Word("0","01234567") ).setParseAction(lambda s,l,t:unichr(int(t[0],8))) +_singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | Word(_printables_less_backslash,exact=1) +_charRange = Group(_singleChar + Suppress("-") + _singleChar) +_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]" + +_expanded = lambda p: (isinstance(p,ParseResults) and ''.join([ unichr(c) for c in range(ord(p[0]),ord(p[1])+1) ]) or p) + +def srange(s): + r"""Helper to easily define string ranges for use in Word construction. Borrows + syntax from regexp '[]' string range definitions:: + srange("[0-9]") -> "0123456789" + srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" + srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" + The input string must be enclosed in []'s, and the returned string is the expanded + character set joined into a single string. + The values enclosed in the []'s may be:: + a single character + an escaped character with a leading backslash (such as \- or \]) + an escaped hex character with a leading '\0x' (\0x21, which is a '!' character) + an escaped octal character with a leading '\0' (\041, which is a '!' character) + a range of any of the above, separated by a dash ('a-z', etc.) + any combination of the above ('aeiouy', 'a-zA-Z0-9_$', etc.) + """ + try: + return "".join([_expanded(part) for part in _reBracketExpr.parseString(s).body]) + except: + return "" + +def matchOnlyAtCol(n): + """Helper method for defining parse actions that require matching at a specific + column in the input text. + """ + def verifyCol(strg,locn,toks): + if col(locn,strg) != n: + raise ParseException(strg,locn,"matched token not at column %d" % n) + return verifyCol + +def replaceWith(replStr): + """Helper method for common parse actions that simply return a literal value. Especially + useful when used with transformString(). + """ + def _replFunc(*args): + return [replStr] + return _replFunc + +def removeQuotes(s,l,t): + """Helper parse action for removing quotation marks from parsed quoted strings. + To use, add this parse action to quoted string using:: + quotedString.setParseAction( removeQuotes ) + """ + return t[0][1:-1] + +def upcaseTokens(s,l,t): + """Helper parse action to convert tokens to upper case.""" + return [ tt.upper() for tt in map(_ustr,t) ] + +def downcaseTokens(s,l,t): + """Helper parse action to convert tokens to lower case.""" + return [ tt.lower() for tt in map(_ustr,t) ] + +def keepOriginalText(s,startLoc,t): + """Helper parse action to preserve original parsed text, + overriding any nested parse actions.""" + try: + endloc = getTokensEndLoc() + except ParseException: + raise ParseFatalException("incorrect usage of keepOriginalText - may only be called as a parse action") + del t[:] + t += ParseResults(s[startLoc:endloc]) + return t + +def getTokensEndLoc(): + """Method to be called from within a parse action to determine the end + location of the parsed tokens.""" + import inspect + fstack = inspect.stack() + try: + # search up the stack (through intervening argument normalizers) for correct calling routine + for f in fstack[2:]: + if f[3] == "_parseNoCache": + endloc = f[0].f_locals["loc"] + return endloc + else: + raise ParseFatalException("incorrect usage of getTokensEndLoc - may only be called from within a parse action") + finally: + del fstack + +def _makeTags(tagStr, xml): + """Internal helper to construct opening and closing tag expressions, given a tag name""" + if isinstance(tagStr,basestring): + resname = tagStr + tagStr = Keyword(tagStr, caseless=not xml) + else: + resname = tagStr.name + + tagAttrName = Word(alphas,alphanums+"_-:") + if (xml): + tagAttrValue = dblQuotedString.copy().setParseAction( removeQuotes ) + openTag = Suppress("<") + tagStr + \ + Dict(ZeroOrMore(Group( tagAttrName + Suppress("=") + tagAttrValue ))) + \ + Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">") + else: + printablesLessRAbrack = "".join( [ c for c in printables if c not in ">" ] ) + tagAttrValue = quotedString.copy().setParseAction( removeQuotes ) | Word(printablesLessRAbrack) + openTag = Suppress("<") + tagStr + \ + Dict(ZeroOrMore(Group( tagAttrName.setParseAction(downcaseTokens) + \ + Optional( Suppress("=") + tagAttrValue ) ))) + \ + Optional("/",default=[False]).setResultsName("empty").setParseAction(lambda s,l,t:t[0]=='/') + Suppress(">") + closeTag = Combine(_L("") + + openTag = openTag.setResultsName("start"+"".join(resname.replace(":"," ").title().split())).setName("<%s>" % tagStr) + closeTag = closeTag.setResultsName("end"+"".join(resname.replace(":"," ").title().split())).setName("" % tagStr) + + return openTag, closeTag + +def makeHTMLTags(tagStr): + """Helper to construct opening and closing tag expressions for HTML, given a tag name""" + return _makeTags( tagStr, False ) + +def makeXMLTags(tagStr): + """Helper to construct opening and closing tag expressions for XML, given a tag name""" + return _makeTags( tagStr, True ) + +def withAttribute(*args,**attrDict): + """Helper to create a validating parse action to be used with start tags created + with makeXMLTags or makeHTMLTags. Use withAttribute to qualify a starting tag + with a required attribute value, to avoid false matches on common tags such as + or
. + + Call withAttribute with a series of attribute names and values. Specify the list + of filter attributes names and values as: + - keyword arguments, as in (class="Customer",align="right"), or + - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) + For attribute names with a namespace prefix, you must use the second form. Attribute + names are matched insensitive to upper/lower case. + + To verify that the attribute exists, but without specifying a value, pass + withAttribute.ANY_VALUE as the value. + """ + if args: + attrs = args[:] + else: + attrs = attrDict.items() + attrs = [(k,v) for k,v in attrs] + def pa(s,l,tokens): + for attrName,attrValue in attrs: + if attrName not in tokens: + raise ParseException(s,l,"no matching attribute " + attrName) + if attrValue != withAttribute.ANY_VALUE and tokens[attrName] != attrValue: + raise ParseException(s,l,"attribute '%s' has value '%s', must be '%s'" % + (attrName, tokens[attrName], attrValue)) + return pa +withAttribute.ANY_VALUE = object() + +opAssoc = _Constants() +opAssoc.LEFT = object() +opAssoc.RIGHT = object() + +def operatorPrecedence( baseExpr, opList ): + """Helper method for constructing grammars of expressions made up of + operators working in a precedence hierarchy. Operators may be unary or + binary, left- or right-associative. Parse actions can also be attached + to operator expressions. + + Parameters: + - baseExpr - expression representing the most basic element for the nested + - opList - list of tuples, one for each operator precedence level in the + expression grammar; each tuple is of the form + (opExpr, numTerms, rightLeftAssoc, parseAction), where: + - opExpr is the pyparsing expression for the operator; + may also be a string, which will be converted to a Literal; + if numTerms is 3, opExpr is a tuple of two expressions, for the + two operators separating the 3 terms + - numTerms is the number of terms for this operator (must + be 1, 2, or 3) + - rightLeftAssoc is the indicator whether the operator is + right or left associative, using the pyparsing-defined + constants opAssoc.RIGHT and opAssoc.LEFT. + - parseAction is the parse action to be associated with + expressions matching this operator expression (the + parse action tuple member may be omitted) + """ + ret = Forward() + lastExpr = baseExpr | ( Suppress('(') + ret + Suppress(')') ) + for i,operDef in enumerate(opList): + opExpr,arity,rightLeftAssoc,pa = (operDef + (None,))[:4] + if arity == 3: + if opExpr is None or len(opExpr) != 2: + raise ValueError("if numterms=3, opExpr must be a tuple or list of two expressions") + opExpr1, opExpr2 = opExpr + thisExpr = Forward()#.setName("expr%d" % i) + if rightLeftAssoc == opAssoc.LEFT: + if arity == 1: + matchExpr = FollowedBy(lastExpr + opExpr) + Group( lastExpr + OneOrMore( opExpr ) ) + elif arity == 2: + if opExpr is not None: + matchExpr = FollowedBy(lastExpr + opExpr + lastExpr) + Group( lastExpr + OneOrMore( opExpr + lastExpr ) ) + else: + matchExpr = FollowedBy(lastExpr+lastExpr) + Group( lastExpr + OneOrMore(lastExpr) ) + elif arity == 3: + matchExpr = FollowedBy(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr) + \ + Group( lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr ) + else: + raise ValueError("operator must be unary (1), binary (2), or ternary (3)") + elif rightLeftAssoc == opAssoc.RIGHT: + if arity == 1: + # try to avoid LR with this extra test + if not isinstance(opExpr, Optional): + opExpr = Optional(opExpr) + matchExpr = FollowedBy(opExpr.expr + thisExpr) + Group( opExpr + thisExpr ) + elif arity == 2: + if opExpr is not None: + matchExpr = FollowedBy(lastExpr + opExpr + thisExpr) + Group( lastExpr + OneOrMore( opExpr + thisExpr ) ) + else: + matchExpr = FollowedBy(lastExpr + thisExpr) + Group( lastExpr + OneOrMore( thisExpr ) ) + elif arity == 3: + matchExpr = FollowedBy(lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr) + \ + Group( lastExpr + opExpr1 + thisExpr + opExpr2 + thisExpr ) + else: + raise ValueError("operator must be unary (1), binary (2), or ternary (3)") + else: + raise ValueError("operator must indicate right or left associativity") + if pa: + matchExpr.setParseAction( pa ) + thisExpr << ( matchExpr | lastExpr ) + lastExpr = thisExpr + ret << lastExpr + return ret + +dblQuotedString = Regex(r'"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))*"').setName("string enclosed in double quotes") +sglQuotedString = Regex(r"'(?:[^'\n\r\\]|(?:'')|(?:\\x[0-9a-fA-F]+)|(?:\\.))*'").setName("string enclosed in single quotes") +quotedString = Regex(r'''(?:"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))*")|(?:'(?:[^'\n\r\\]|(?:'')|(?:\\x[0-9a-fA-F]+)|(?:\\.))*')''').setName("quotedString using single or double quotes") +unicodeString = Combine(_L('u') + quotedString.copy()) + +def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString): + """Helper method for defining nested lists enclosed in opening and closing + delimiters ("(" and ")" are the default). + + Parameters: + - opener - opening character for a nested list (default="("); can also be a pyparsing expression + - closer - closing character for a nested list (default=")"); can also be a pyparsing expression + - content - expression for items within the nested lists (default=None) + - ignoreExpr - expression for ignoring opening and closing delimiters (default=quotedString) + + If an expression is not provided for the content argument, the nested + expression will capture all whitespace-delimited content between delimiters + as a list of separate values. + + Use the ignoreExpr argument to define expressions that may contain + opening or closing characters that should not be treated as opening + or closing characters for nesting, such as quotedString or a comment + expression. Specify multiple expressions using an Or or MatchFirst. + The default is quotedString, but if no expressions are to be ignored, + then pass None for this argument. + """ + if opener == closer: + raise ValueError("opening and closing strings cannot be the same") + if content is None: + if isinstance(opener,basestring) and isinstance(closer,basestring): + if ignoreExpr is not None: + content = (Combine(OneOrMore(~ignoreExpr + + CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS,exact=1)) + ).setParseAction(lambda t:t[0].strip())) + else: + content = (empty+CharsNotIn(opener+closer+ParserElement.DEFAULT_WHITE_CHARS).setParseAction(lambda t:t[0].strip())) + else: + raise ValueError("opening and closing arguments must be strings if no content expression is given") + ret = Forward() + if ignoreExpr is not None: + ret << Group( Suppress(opener) + ZeroOrMore( ignoreExpr | ret | content ) + Suppress(closer) ) + else: + ret << Group( Suppress(opener) + ZeroOrMore( ret | content ) + Suppress(closer) ) + return ret + +def indentedBlock(blockStatementExpr, indentStack, indent=True): + """Helper method for defining space-delimited indentation blocks, such as + those used to define block statements in Python source code. + + Parameters: + - blockStatementExpr - expression defining syntax of statement that + is repeated within the indented block + - indentStack - list created by caller to manage indentation stack + (multiple statementWithIndentedBlock expressions within a single grammar + should share a common indentStack) + - indent - boolean indicating whether block must be indented beyond the + the current level; set to False for block of left-most statements + (default=True) + + A valid block must contain at least one blockStatement. + """ + def checkPeerIndent(s,l,t): + if l >= len(s): return + curCol = col(l,s) + if curCol != indentStack[-1]: + if curCol > indentStack[-1]: + raise ParseFatalException(s,l,"illegal nesting") + raise ParseException(s,l,"not a peer entry") + + def checkSubIndent(s,l,t): + curCol = col(l,s) + if curCol > indentStack[-1]: + indentStack.append( curCol ) + else: + raise ParseException(s,l,"not a subentry") + + def checkUnindent(s,l,t): + if l >= len(s): return + curCol = col(l,s) + if not(indentStack and curCol < indentStack[-1] and curCol <= indentStack[-2]): + raise ParseException(s,l,"not an unindent") + indentStack.pop() + + NL = OneOrMore(LineEnd().setWhitespaceChars("\t ").suppress()) + INDENT = Empty() + Empty().setParseAction(checkSubIndent) + PEER = Empty().setParseAction(checkPeerIndent) + UNDENT = Empty().setParseAction(checkUnindent) + if indent: + smExpr = Group( Optional(NL) + + FollowedBy(blockStatementExpr) + + INDENT + (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) + UNDENT) + else: + smExpr = Group( Optional(NL) + + (OneOrMore( PEER + Group(blockStatementExpr) + Optional(NL) )) ) + blockStatementExpr.ignore("\\" + LineEnd()) + return smExpr + +alphas8bit = srange(r"[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]") +punc8bit = srange(r"[\0xa1-\0xbf\0xd7\0xf7]") + +anyOpenTag,anyCloseTag = makeHTMLTags(Word(alphas,alphanums+"_:")) +commonHTMLEntity = Combine(_L("&") + oneOf("gt lt amp nbsp quot").setResultsName("entity") +";") +_htmlEntityMap = dict(zip("gt lt amp nbsp quot".split(),"><& '")) +replaceHTMLEntity = lambda t : t.entity in _htmlEntityMap and _htmlEntityMap[t.entity] or None + +# it's easy to get these comment structures wrong - they're very common, so may as well make them available +cStyleComment = Regex(r"/\*(?:[^*]*\*+)+?/").setName("C style comment") + +htmlComment = Regex(r"") +restOfLine = Regex(r".*").leaveWhitespace() +dblSlashComment = Regex(r"\/\/(\\\n|.)*").setName("// comment") +cppStyleComment = Regex(r"/(?:\*(?:[^*]*\*+)+?/|/[^\n]*(?:\n[^\n]*)*?(?:(?" + str(tokenlist)) + print ("tokens = " + str(tokens)) + print ("tokens.columns = " + str(tokens.columns)) + print ("tokens.tables = " + str(tokens.tables)) + print (tokens.asXML("SQL",True)) + except ParseBaseException,err: + print (teststring + "->") + print (err.line) + print (" "*(err.column-1) + "^") + print (err) + print() + + selectToken = CaselessLiteral( "select" ) + fromToken = CaselessLiteral( "from" ) + + ident = Word( alphas, alphanums + "_$" ) + columnName = delimitedList( ident, ".", combine=True ).setParseAction( upcaseTokens ) + columnNameList = Group( delimitedList( columnName ) )#.setName("columns") + tableName = delimitedList( ident, ".", combine=True ).setParseAction( upcaseTokens ) + tableNameList = Group( delimitedList( tableName ) )#.setName("tables") + simpleSQL = ( selectToken + \ + ( '*' | columnNameList ).setResultsName( "columns" ) + \ + fromToken + \ + tableNameList.setResultsName( "tables" ) ) + + test( "SELECT * from XYZZY, ABC" ) + test( "select * from SYS.XYZZY" ) + test( "Select A from Sys.dual" ) + test( "Select AA,BB,CC from Sys.dual" ) + test( "Select A, B, C from Sys.dual" ) + test( "Select A, B, C from Sys.dual" ) + test( "Xelect A, B, C from Sys.dual" ) + test( "Select A, B, C frox Sys.dual" ) + test( "Select" ) + test( "Select ^^^ frox Sys.dual" ) + test( "Select A, B, C from Sys.dual, Table2 " ) diff --git a/code/utilities/CPAT-1.2.2/lib/bx_extras/stats.py b/code/utilities/CPAT-1.2.2/lib/bx_extras/stats.py new file mode 100755 index 0000000..32b71e2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/bx_extras/stats.py @@ -0,0 +1,4344 @@ +# Copyright (c) 1999-2002 Gary Strangman; All Rights Reserved. +# +# This software is distributable under the terms of the GNU +# General Public License (GPL) v2, the text of which can be found at +# http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise +# using this module constitutes acceptance of the terms of this License. +# +# Disclaimer +# +# This software is provided "as-is". There are no expressed or implied +# warranties of any kind, including, but not limited to, the warranties +# of merchantability and fittness for a given application. In no event +# shall Gary Strangman be liable for any direct, indirect, incidental, +# special, exemplary or consequential damages (including, but not limited +# to, loss of use, data or profits, or business interruption) however +# caused and on any theory of liability, whether in contract, strict +# liability or tort (including negligence or otherwise) arising in any way +# out of the use of this software, even if advised of the possibility of +# such damage. +# +# Comments and/or additions are welcome (send e-mail to: +# strang@nmr.mgh.harvard.edu). +# +""" +stats.py module + +(Requires pstat.py module.) + +################################################# +####### Written by: Gary Strangman ########### +####### Last modified: May 10, 2002 ########### +################################################# + +A collection of basic statistical functions for python. The function +names appear below. + +IMPORTANT: There are really *3* sets of functions. The first set has an 'l' +prefix, which can be used with list or tuple arguments. The second set has +an 'a' prefix, which can accept NumPy array arguments. These latter +functions are defined only when NumPy is available on the system. The third +type has NO prefix (i.e., has the name that appears below). Functions of +this set are members of a "Dispatch" class, c/o David Ascher. This class +allows different functions to be called depending on the type of the passed +arguments. Thus, stats.mean is a member of the Dispatch class and +stats.mean(range(20)) will call stats.lmean(range(20)) while +stats.mean(Numeric.arange(20)) will call stats.amean(Numeric.arange(20)). +This is a handy way to keep consistent function names when different +argument types require different functions to be called. Having +implementated the Dispatch class, however, means that to get info on +a given function, you must use the REAL function name ... that is +"print stats.lmean.__doc__" or "print stats.amean.__doc__" work fine, +while "print stats.mean.__doc__" will print the doc for the Dispatch +class. NUMPY FUNCTIONS ('a' prefix) generally have more argument options +but should otherwise be consistent with the corresponding list functions. + +Disclaimers: The function list is obviously incomplete and, worse, the +functions are not optimized. All functions have been tested (some more +so than others), but they are far from bulletproof. Thus, as with any +free software, no warranty or guarantee is expressed or implied. :-) A +few extra functions that don't appear in the list below can be found by +interested treasure-hunters. These functions don't necessarily have +both list and array versions but were deemed useful + +CENTRAL TENDENCY: geometricmean + harmonicmean + mean + median + medianscore + mode + +MOMENTS: moment + variation + skew + kurtosis + skewtest (for Numpy arrays only) + kurtosistest (for Numpy arrays only) + normaltest (for Numpy arrays only) + +ALTERED VERSIONS: tmean (for Numpy arrays only) + tvar (for Numpy arrays only) + tmin (for Numpy arrays only) + tmax (for Numpy arrays only) + tstdev (for Numpy arrays only) + tsem (for Numpy arrays only) + describe + +FREQUENCY STATS: itemfreq + scoreatpercentile + percentileofscore + histogram + cumfreq + relfreq + +VARIABILITY: obrientransform + samplevar + samplestdev + signaltonoise (for Numpy arrays only) + var + stdev + sterr + sem + z + zs + zmap (for Numpy arrays only) + +TRIMMING FCNS: threshold (for Numpy arrays only) + trimboth + trim1 + round (round all vals to 'n' decimals; Numpy only) + +CORRELATION FCNS: covariance (for Numpy arrays only) + correlation (for Numpy arrays only) + paired + pearsonr + spearmanr + pointbiserialr + kendalltau + linregress + +INFERENTIAL STATS: ttest_1samp + ttest_ind + ttest_rel + chisquare + ks_2samp + mannwhitneyu + ranksums + wilcoxont + kruskalwallish + friedmanchisquare + +PROBABILITY CALCS: chisqprob + erfcc + zprob + ksprob + fprob + betacf + gammln + betai + +ANOVA FUNCTIONS: F_oneway + F_value + +SUPPORT FUNCTIONS: writecc + incr + sign (for Numpy arrays only) + sum + cumsum + ss + summult + sumdiffsquared + square_of_sums + shellsort + rankdata + outputpairedstats + findwithin +""" +## CHANGE LOG: +## =========== +## 02-11-19 ... fixed attest_ind and attest_rel for div-by-zero Overflows +## 02-05-10 ... fixed lchisqprob indentation (failed when df=even) +## 00-12-28 ... removed aanova() to separate module, fixed licensing to +## match Python License, fixed doc string & imports +## 00-04-13 ... pulled all "global" statements, except from aanova() +## added/fixed lots of documentation, removed io.py dependency +## changed to version 0.5 +## 99-11-13 ... added asign() function +## 99-11-01 ... changed version to 0.4 ... enough incremental changes now +## 99-10-25 ... added acovariance and acorrelation functions +## 99-10-10 ... fixed askew/akurtosis to avoid divide-by-zero errors +## added aglm function (crude, but will be improved) +## 99-10-04 ... upgraded acumsum, ass, asummult, asamplevar, avar, etc. to +## all handle lists of 'dimension's and keepdims +## REMOVED ar0, ar2, ar3, ar4 and replaced them with around +## reinserted fixes for abetai to avoid math overflows +## 99-09-05 ... rewrote achisqprob/aerfcc/aksprob/afprob/abetacf/abetai to +## handle multi-dimensional arrays (whew!) +## 99-08-30 ... fixed l/amoment, l/askew, l/akurtosis per D'Agostino (1990) +## added anormaltest per same reference +## re-wrote azprob to calc arrays of probs all at once +## 99-08-22 ... edited attest_ind printing section so arrays could be rounded +## 99-08-19 ... fixed amean and aharmonicmean for non-error(!) overflow on +## short/byte arrays (mean of #s btw 100-300 = -150??) +## 99-08-09 ... fixed asum so that the None case works for Byte arrays +## 99-08-08 ... fixed 7/3 'improvement' to handle t-calcs on N-D arrays +## 99-07-03 ... improved attest_ind, attest_rel (zero-division errortrap) +## 99-06-24 ... fixed bug(?) in attest_ind (n1=a.shape[0]) +## 04/11/99 ... added asignaltonoise, athreshold functions, changed all +## max/min in array section to N.maximum/N.minimum, +## fixed square_of_sums to prevent integer overflow +## 04/10/99 ... !!! Changed function name ... sumsquared ==> square_of_sums +## 03/18/99 ... Added ar0, ar2, ar3 and ar4 rounding functions +## 02/28/99 ... Fixed aobrientransform to return an array rather than a list +## 01/15/99 ... Essentially ceased updating list-versions of functions (!!!) +## 01/13/99 ... CHANGED TO VERSION 0.3 +## fixed bug in a/lmannwhitneyu p-value calculation +## 12/31/98 ... fixed variable-name bug in ldescribe +## 12/19/98 ... fixed bug in findwithin (fcns needed pstat. prefix) +## 12/16/98 ... changed amedianscore to return float (not array) for 1 score +## 12/14/98 ... added atmin and atmax functions +## removed umath from import line (not needed) +## l/ageometricmean modified to reduce chance of overflows (take +## nth root first, then multiply) +## 12/07/98 ... added __version__variable (now 0.2) +## removed all 'stats.' from anova() fcn +## 12/06/98 ... changed those functions (except shellsort) that altered +## arguments in-place ... cumsum, ranksort, ... +## updated (and fixed some) doc-strings +## 12/01/98 ... added anova() function (requires NumPy) +## incorporated Dispatch class +## 11/12/98 ... added functionality to amean, aharmonicmean, ageometricmean +## added 'asum' function (added functionality to N.add.reduce) +## fixed both moment and amoment (two errors) +## changed name of skewness and askewness to skew and askew +## fixed (a)histogram (which sometimes counted points =len(inlist)/2.0: + cfbin = i + break + LRL = smallest + binsize*cfbin # get lower read limit of that bin + cfbelow = cumhist[cfbin-1] + freq = float(hist[cfbin]) # frequency IN the 50%ile bin + median = LRL + ((len(inlist)/2.0 - cfbelow)/float(freq))*binsize # median formula + return median + + +def lmedianscore (inlist): + """ +Returns the 'middle' score of the passed list. If there is an even +number of scores, the mean of the 2 middle scores is returned. + +Usage: lmedianscore(inlist) +""" + + newlist = copy.deepcopy(inlist) + newlist.sort() + if len(newlist) % 2 == 0: # if even number of scores, average middle 2 + index = len(newlist)/2 # integer division correct + median = float(newlist[index] + newlist[index-1]) /2 + else: + index = len(newlist)/2 # int divsion gives mid value when count from 0 + median = newlist[index] + return median + + +def lmode(inlist): + """ +Returns a list of the modal (most common) score(s) in the passed +list. If there is more than one such score, all are returned. The +bin-count for the mode(s) is also returned. + +Usage: lmode(inlist) +Returns: bin-count for mode(s), a list of modal value(s) +""" + + scores = pstat.unique(inlist) + scores.sort() + freq = [] + for item in scores: + freq.append(inlist.count(item)) + maxfreq = max(freq) + mode = [] + stillmore = 1 + while stillmore: + try: + indx = freq.index(maxfreq) + mode.append(scores[indx]) + del freq[indx] + del scores[indx] + except ValueError: + stillmore=0 + return maxfreq, mode + + +#################################### +############ MOMENTS ############# +#################################### + +def lmoment(inlist,moment=1): + """ +Calculates the nth moment about the mean for a sample (defaults to +the 1st moment). Used to calculate coefficients of skewness and kurtosis. + +Usage: lmoment(inlist,moment=1) +Returns: appropriate moment (r) from ... 1/n * SUM((inlist(i)-mean)**r) +""" + if moment == 1: + return 0.0 + else: + mn = mean(inlist) + n = len(inlist) + s = 0 + for x in inlist: + s = s + (x-mn)**moment + return s/float(n) + + +def lvariation(inlist): + """ +Returns the coefficient of variation, as defined in CRC Standard +Probability and Statistics, p.6. + +Usage: lvariation(inlist) +""" + return 100.0*samplestdev(inlist)/float(mean(inlist)) + + +def lskew(inlist): + """ +Returns the skewness of a distribution, as defined in Numerical +Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) + +Usage: lskew(inlist) +""" + return moment(inlist,3)/pow(moment(inlist,2),1.5) + + +def lkurtosis(inlist): + """ +Returns the kurtosis of a distribution, as defined in Numerical +Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) + +Usage: lkurtosis(inlist) +""" + return moment(inlist,4)/pow(moment(inlist,2),2.0) + + +def ldescribe(inlist): + """ +Returns some descriptive statistics of the passed list (assumed to be 1D). + +Usage: ldescribe(inlist) +Returns: n, mean, standard deviation, skew, kurtosis +""" + n = len(inlist) + mm = (min(inlist),max(inlist)) + m = mean(inlist) + sd = stdev(inlist) + sk = skew(inlist) + kurt = kurtosis(inlist) + return n, mm, m, sd, sk, kurt + + +#################################### +####### FREQUENCY STATS ########## +#################################### + +def litemfreq(inlist): + """ +Returns a list of pairs. Each pair consists of one of the scores in inlist +and it's frequency count. Assumes a 1D list is passed. + +Usage: litemfreq(inlist) +Returns: a 2D frequency table (col [0:n-1]=scores, col n=frequencies) +""" + scores = pstat.unique(inlist) + scores.sort() + freq = [] + for item in scores: + freq.append(inlist.count(item)) + return pstat.abut(scores, freq) + + +def lscoreatpercentile (inlist, percent): + """ +Returns the score at a given percentile relative to the distribution +given by inlist. + +Usage: lscoreatpercentile(inlist,percent) +""" + if percent > 1: + print "\nDividing percent>1 by 100 in lscoreatpercentile().\n" + percent = percent / 100.0 + targetcf = percent*len(inlist) + h, lrl, binsize, extras = histogram(inlist) + cumhist = cumsum(copy.deepcopy(h)) + for i in range(len(cumhist)): + if cumhist[i] >= targetcf: + break + score = binsize * ((targetcf - cumhist[i-1]) / float(h[i])) + (lrl+binsize*i) + return score + + +def lpercentileofscore (inlist, score,histbins=10,defaultlimits=None): + """ +Returns the percentile value of a score relative to the distribution +given by inlist. Formula depends on the values used to histogram the data(!). + +Usage: lpercentileofscore(inlist,score,histbins=10,defaultlimits=None) +""" + + h, lrl, binsize, extras = histogram(inlist,histbins,defaultlimits) + cumhist = cumsum(copy.deepcopy(h)) + i = int((score - lrl)/float(binsize)) + pct = (cumhist[i-1]+((score-(lrl+binsize*i))/float(binsize))*h[i])/float(len(inlist)) * 100 + return pct + + +def lhistogram (inlist,numbins=10,defaultreallimits=None,printextras=0): + """ +Returns (i) a list of histogram bin counts, (ii) the smallest value +of the histogram binning, and (iii) the bin width (the last 2 are not +necessarily integers). Default number of bins is 10. If no sequence object +is given for defaultreallimits, the routine picks (usually non-pretty) bins +spanning all the numbers in the inlist. + +Usage: lhistogram (inlist, numbins=10, defaultreallimits=None,suppressoutput=0) +Returns: list of bin values, lowerreallimit, binsize, extrapoints +""" + if (defaultreallimits <> None): + if type(defaultreallimits) not in [ListType,TupleType] or len(defaultreallimits)==1: # only one limit given, assumed to be lower one & upper is calc'd + lowerreallimit = defaultreallimits + upperreallimit = 1.0001 * max(inlist) + else: # assume both limits given + lowerreallimit = defaultreallimits[0] + upperreallimit = defaultreallimits[1] + binsize = (upperreallimit-lowerreallimit)/float(numbins) + else: # no limits given for histogram, both must be calc'd + estbinwidth=(max(inlist)-min(inlist))/float(numbins) + 1 # 1=>cover all + binsize = ((max(inlist)-min(inlist)+estbinwidth))/float(numbins) + lowerreallimit = min(inlist) - binsize/2 #lower real limit,1st bin + bins = [0]*(numbins) + extrapoints = 0 + for num in inlist: + try: + if (num-lowerreallimit) < 0: + extrapoints = extrapoints + 1 + else: + bintoincrement = int((num-lowerreallimit)/float(binsize)) + bins[bintoincrement] = bins[bintoincrement] + 1 + except: + extrapoints = extrapoints + 1 + if (extrapoints > 0 and printextras == 1): + print '\nPoints outside given histogram range =',extrapoints + return (bins, lowerreallimit, binsize, extrapoints) + + +def lcumfreq(inlist,numbins=10,defaultreallimits=None): + """ +Returns a cumulative frequency histogram, using the histogram function. + +Usage: lcumfreq(inlist,numbins=10,defaultreallimits=None) +Returns: list of cumfreq bin values, lowerreallimit, binsize, extrapoints +""" + h,l,b,e = histogram(inlist,numbins,defaultreallimits) + cumhist = cumsum(copy.deepcopy(h)) + return cumhist,l,b,e + + +def lrelfreq(inlist,numbins=10,defaultreallimits=None): + """ +Returns a relative frequency histogram, using the histogram function. + +Usage: lrelfreq(inlist,numbins=10,defaultreallimits=None) +Returns: list of cumfreq bin values, lowerreallimit, binsize, extrapoints +""" + h,l,b,e = histogram(inlist,numbins,defaultreallimits) + for i in range(len(h)): + h[i] = h[i]/float(len(inlist)) + return h,l,b,e + + +#################################### +##### VARIABILITY FUNCTIONS ###### +#################################### + +def lobrientransform(*args): + """ +Computes a transform on input data (any number of columns). Used to +test for homogeneity of variance prior to running one-way stats. From +Maxwell and Delaney, p.112. + +Usage: lobrientransform(*args) +Returns: transformed data for use in an ANOVA +""" + TINY = 1e-10 + k = len(args) + n = [0.0]*k + v = [0.0]*k + m = [0.0]*k + nargs = [] + for i in range(k): + nargs.append(copy.deepcopy(args[i])) + n[i] = float(len(nargs[i])) + v[i] = var(nargs[i]) + m[i] = mean(nargs[i]) + for j in range(k): + for i in range(n[j]): + t1 = (n[j]-1.5)*n[j]*(nargs[j][i]-m[j])**2 + t2 = 0.5*v[j]*(n[j]-1.0) + t3 = (n[j]-1.0)*(n[j]-2.0) + nargs[j][i] = (t1-t2) / float(t3) + check = 1 + for j in range(k): + if v[j] - mean(nargs[j]) > TINY: + check = 0 + if check <> 1: + raise ValueError, 'Problem in obrientransform.' + else: + return nargs + + +def lsamplevar (inlist): + """ +Returns the variance of the values in the passed list using +N for the denominator (i.e., DESCRIBES the sample variance only). + +Usage: lsamplevar(inlist) +""" + n = len(inlist) + mn = mean(inlist) + deviations = [] + for item in inlist: + deviations.append(item-mn) + return ss(deviations)/float(n) + + +def lsamplestdev (inlist): + """ +Returns the standard deviation of the values in the passed list using +N for the denominator (i.e., DESCRIBES the sample stdev only). + +Usage: lsamplestdev(inlist) +""" + return math.sqrt(samplevar(inlist)) + + +def lvar (inlist): + """ +Returns the variance of the values in the passed list using N-1 +for the denominator (i.e., for estimating population variance). + +Usage: lvar(inlist) +""" + n = len(inlist) + mn = mean(inlist) + deviations = [0]*len(inlist) + for i in range(len(inlist)): + deviations[i] = inlist[i] - mn + return ss(deviations)/float(n-1) + + +def lstdev (inlist): + """ +Returns the standard deviation of the values in the passed list +using N-1 in the denominator (i.e., to estimate population stdev). + +Usage: lstdev(inlist) +""" + return math.sqrt(var(inlist)) + + +def lsterr(inlist): + """ +Returns the standard error of the values in the passed list using N-1 +in the denominator (i.e., to estimate population standard error). + +Usage: lsterr(inlist) +""" + return stdev(inlist) / float(math.sqrt(len(inlist))) + + +def lsem (inlist): + """ +Returns the estimated standard error of the mean (sx-bar) of the +values in the passed list. sem = stdev / sqrt(n) + +Usage: lsem(inlist) +""" + sd = stdev(inlist) + n = len(inlist) + return sd/math.sqrt(n) + + +def lz (inlist, score): + """ +Returns the z-score for a given input score, given that score and the +list from which that score came. Not appropriate for population calculations. + +Usage: lz(inlist, score) +""" + z = (score-mean(inlist))/samplestdev(inlist) + return z + + +def lzs (inlist): + """ +Returns a list of z-scores, one for each score in the passed list. + +Usage: lzs(inlist) +""" + zscores = [] + for item in inlist: + zscores.append(z(inlist,item)) + return zscores + + +#################################### +####### TRIMMING FUNCTIONS ####### +#################################### + +def ltrimboth (l,proportiontocut): + """ +Slices off the passed proportion of items from BOTH ends of the passed +list (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND 'rightmost' +10% of scores. Assumes list is sorted by magnitude. Slices off LESS if +proportion results in a non-integer slice index (i.e., conservatively +slices off proportiontocut). + +Usage: ltrimboth (l,proportiontocut) +Returns: trimmed version of list l +""" + lowercut = int(proportiontocut*len(l)) + uppercut = len(l) - lowercut + return l[lowercut:uppercut] + + +def ltrim1 (l,proportiontocut,tail='right'): + """ +Slices off the passed proportion of items from ONE end of the passed +list (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' +10% of scores). Slices off LESS if proportion results in a non-integer +slice index (i.e., conservatively slices off proportiontocut). + +Usage: ltrim1 (l,proportiontocut,tail='right') or set tail='left' +Returns: trimmed version of list l +""" + if tail == 'right': + lowercut = 0 + uppercut = len(l) - int(proportiontocut*len(l)) + elif tail == 'left': + lowercut = int(proportiontocut*len(l)) + uppercut = len(l) + return l[lowercut:uppercut] + + +#################################### +##### CORRELATION FUNCTIONS ###### +#################################### + +def lpaired(x,y): + """ +Interactively determines the type of data and then runs the +appropriated statistic for paired group data. + +Usage: lpaired(x,y) +Returns: appropriate statistic name, value, and probability +""" + samples = '' + while samples not in ['i','r','I','R','c','C']: + print '\nIndependent or related samples, or correlation (i,r,c): ', + samples = raw_input() + + if samples in ['i','I','r','R']: + print '\nComparing variances ...', +# USE O'BRIEN'S TEST FOR HOMOGENEITY OF VARIANCE, Maxwell & delaney, p.112 + r = obrientransform(x,y) + f,p = F_oneway(pstat.colex(r,0),pstat.colex(r,1)) + if p<0.05: + vartype='unequal, p='+str(round(p,4)) + else: + vartype='equal' + print vartype + if samples in ['i','I']: + if vartype[0]=='e': + t,p = ttest_ind(x,y,0) + print '\nIndependent samples t-test: ', round(t,4),round(p,4) + else: + if len(x)>20 or len(y)>20: + z,p = ranksums(x,y) + print '\nRank Sums test (NONparametric, n>20): ', round(z,4),round(p,4) + else: + u,p = mannwhitneyu(x,y) + print '\nMann-Whitney U-test (NONparametric, ns<20): ', round(u,4),round(p,4) + + else: # RELATED SAMPLES + if vartype[0]=='e': + t,p = ttest_rel(x,y,0) + print '\nRelated samples t-test: ', round(t,4),round(p,4) + else: + t,p = ranksums(x,y) + print '\nWilcoxon T-test (NONparametric): ', round(t,4),round(p,4) + else: # CORRELATION ANALYSIS + corrtype = '' + while corrtype not in ['c','C','r','R','d','D']: + print '\nIs the data Continuous, Ranked, or Dichotomous (c,r,d): ', + corrtype = raw_input() + if corrtype in ['c','C']: + m,b,r,p,see = linregress(x,y) + print '\nLinear regression for continuous variables ...' + lol = [['Slope','Intercept','r','Prob','SEestimate'],[round(m,4),round(b,4),round(r,4),round(p,4),round(see,4)]] + pstat.printcc(lol) + elif corrtype in ['r','R']: + r,p = spearmanr(x,y) + print '\nCorrelation for ranked variables ...' + print "Spearman's r: ",round(r,4),round(p,4) + else: # DICHOTOMOUS + r,p = pointbiserialr(x,y) + print '\nAssuming x contains a dichotomous variable ...' + print 'Point Biserial r: ',round(r,4),round(p,4) + print '\n\n' + return None + + +def lpearsonr(x,y): + """ +Calculates a Pearson correlation coefficient and the associated +probability value. Taken from Heiman's Basic Statistics for the Behav. +Sci (2nd), p.195. + +Usage: lpearsonr(x,y) where x and y are equal-length lists +Returns: Pearson's r value, two-tailed p-value +""" + TINY = 1.0e-30 + if len(x) <> len(y): + raise ValueError, 'Input values not paired in pearsonr. Aborting.' + n = len(x) + x = map(float,x) + y = map(float,y) + xmean = mean(x) + ymean = mean(y) + r_num = n*(summult(x,y)) - sum(x)*sum(y) + r_den = math.sqrt((n*ss(x) - square_of_sums(x))*(n*ss(y)-square_of_sums(y))) + r = (r_num / r_den) # denominator already a float + df = n-2 + t = r*math.sqrt(df/((1.0-r+TINY)*(1.0+r+TINY))) + prob = betai(0.5*df,0.5,df/float(df+t*t)) + return r, prob + + +def lspearmanr(x,y): + """ +Calculates a Spearman rank-order correlation coefficient. Taken +from Heiman's Basic Statistics for the Behav. Sci (1st), p.192. + +Usage: lspearmanr(x,y) where x and y are equal-length lists +Returns: Spearman's r, two-tailed p-value +""" + TINY = 1e-30 + if len(x) <> len(y): + raise ValueError, 'Input values not paired in spearmanr. Aborting.' + n = len(x) + rankx = rankdata(x) + ranky = rankdata(y) + dsq = sumdiffsquared(rankx,ranky) + rs = 1 - 6*dsq / float(n*(n**2-1)) + t = rs * math.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + df = n-2 + probrs = betai(0.5*df,0.5,df/(df+t*t)) # t already a float +# probability values for rs are from part 2 of the spearman function in +# Numerical Recipies, p.510. They are close to tables, but not exact. (?) + return rs, probrs + + +def lpointbiserialr(x,y): + """ +Calculates a point-biserial correlation coefficient and the associated +probability value. Taken from Heiman's Basic Statistics for the Behav. +Sci (1st), p.194. + +Usage: lpointbiserialr(x,y) where x,y are equal-length lists +Returns: Point-biserial r, two-tailed p-value +""" + TINY = 1e-30 + if len(x) <> len(y): + raise ValueError, 'INPUT VALUES NOT PAIRED IN pointbiserialr. ABORTING.' + data = pstat.abut(x,y) + categories = pstat.unique(x) + if len(categories) <> 2: + raise ValueError, "Exactly 2 categories required for pointbiserialr()." + else: # there are 2 categories, continue + codemap = pstat.abut(categories,range(2)) + recoded = pstat.recode(data,codemap,0) + x = pstat.linexand(data,0,categories[0]) + y = pstat.linexand(data,0,categories[1]) + xmean = mean(pstat.colex(x,1)) + ymean = mean(pstat.colex(y,1)) + n = len(data) + adjust = math.sqrt((len(x)/float(n))*(len(y)/float(n))) + rpb = (ymean - xmean)/samplestdev(pstat.colex(data,1))*adjust + df = n-2 + t = rpb*math.sqrt(df/((1.0-rpb+TINY)*(1.0+rpb+TINY))) + prob = betai(0.5*df,0.5,df/(df+t*t)) # t already a float + return rpb, prob + + +def lkendalltau(x,y): + """ +Calculates Kendall's tau ... correlation of ordinal data. Adapted +from function kendl1 in Numerical Recipies. Needs good test-routine.@@@ + +Usage: lkendalltau(x,y) +Returns: Kendall's tau, two-tailed p-value +""" + n1 = 0 + n2 = 0 + iss = 0 + for j in range(len(x)-1): + for k in range(j,len(y)): + a1 = x[j] - x[k] + a2 = y[j] - y[k] + aa = a1 * a2 + if (aa): # neither list has a tie + n1 = n1 + 1 + n2 = n2 + 1 + if aa > 0: + iss = iss + 1 + else: + iss = iss -1 + else: + if (a1): + n1 = n1 + 1 + else: + n2 = n2 + 1 + tau = iss / math.sqrt(n1*n2) + svar = (4.0*len(x)+10.0) / (9.0*len(x)*(len(x)-1)) + z = tau / math.sqrt(svar) + prob = erfcc(abs(z)/1.4142136) + return tau, prob + + +def llinregress(x,y): + """ +Calculates a regression line on x,y pairs. + +Usage: llinregress(x,y) x,y are equal-length lists of x-y coordinates +Returns: slope, intercept, r, two-tailed prob, sterr-of-estimate +""" + TINY = 1.0e-20 + if len(x) <> len(y): + raise ValueError, 'Input values not paired in linregress. Aborting.' + n = len(x) + x = map(float,x) + y = map(float,y) + xmean = mean(x) + ymean = mean(y) + r_num = float(n*(summult(x,y)) - sum(x)*sum(y)) + r_den = math.sqrt((n*ss(x) - square_of_sums(x))*(n*ss(y)-square_of_sums(y))) + r = r_num / r_den + z = 0.5*math.log((1.0+r+TINY)/(1.0-r+TINY)) + df = n-2 + t = r*math.sqrt(df/((1.0-r+TINY)*(1.0+r+TINY))) + prob = betai(0.5*df,0.5,df/(df+t*t)) + slope = r_num / float(n*ss(x) - square_of_sums(x)) + intercept = ymean - slope*xmean + sterrest = math.sqrt(1-r*r)*samplestdev(y) + return slope, intercept, r, prob, sterrest + + +#################################### +##### INFERENTIAL STATISTICS ##### +#################################### + +def lttest_1samp(a,popmean,printit=0,name='Sample',writemode='a'): + """ +Calculates the t-obtained for the independent samples T-test on ONE group +of scores a, given a population mean. If printit=1, results are printed +to the screen. If printit='filename', the results are output to 'filename' +using the given writemode (default=append). Returns t-value, and prob. + +Usage: lttest_1samp(a,popmean,Name='Sample',printit=0,writemode='a') +Returns: t-value, two-tailed prob +""" + x = mean(a) + v = var(a) + n = len(a) + df = n-1 + svar = ((n-1)*v)/float(df) + t = (x-popmean)/math.sqrt(svar*(1.0/n)) + prob = betai(0.5*df,0.5,float(df)/(df+t*t)) + + if printit <> 0: + statname = 'Single-sample T-test.' + outputpairedstats(printit,writemode, + 'Population','--',popmean,0,0,0, + name,n,x,v,min(a),max(a), + statname,t,prob) + return t,prob + + +def lttest_ind (a, b, printit=0, name1='Samp1', name2='Samp2', writemode='a'): + """ +Calculates the t-obtained T-test on TWO INDEPENDENT samples of +scores a, and b. From Numerical Recipies, p.483. If printit=1, results +are printed to the screen. If printit='filename', the results are output +to 'filename' using the given writemode (default=append). Returns t-value, +and prob. + +Usage: lttest_ind(a,b,printit=0,name1='Samp1',name2='Samp2',writemode='a') +Returns: t-value, two-tailed prob +""" + x1 = mean(a) + x2 = mean(b) + v1 = stdev(a)**2 + v2 = stdev(b)**2 + n1 = len(a) + n2 = len(b) + df = n1+n2-2 + svar = ((n1-1)*v1+(n2-1)*v2)/float(df) + t = (x1-x2)/math.sqrt(svar*(1.0/n1 + 1.0/n2)) + prob = betai(0.5*df,0.5,df/(df+t*t)) + + if printit <> 0: + statname = 'Independent samples T-test.' + outputpairedstats(printit,writemode, + name1,n1,x1,v1,min(a),max(a), + name2,n2,x2,v2,min(b),max(b), + statname,t,prob) + return t,prob + + +def lttest_rel (a,b,printit=0,name1='Sample1',name2='Sample2',writemode='a'): + """ +Calculates the t-obtained T-test on TWO RELATED samples of scores, +a and b. From Numerical Recipies, p.483. If printit=1, results are +printed to the screen. If printit='filename', the results are output to +'filename' using the given writemode (default=append). Returns t-value, +and prob. + +Usage: lttest_rel(a,b,printit=0,name1='Sample1',name2='Sample2',writemode='a') +Returns: t-value, two-tailed prob +""" + if len(a)<>len(b): + raise ValueError, 'Unequal length lists in ttest_rel.' + x1 = mean(a) + x2 = mean(b) + v1 = var(a) + v2 = var(b) + n = len(a) + cov = 0 + for i in range(len(a)): + cov = cov + (a[i]-x1) * (b[i]-x2) + df = n-1 + cov = cov / float(df) + sd = math.sqrt((v1+v2 - 2.0*cov)/float(n)) + t = (x1-x2)/sd + prob = betai(0.5*df,0.5,df/(df+t*t)) + + if printit <> 0: + statname = 'Related samples T-test.' + outputpairedstats(printit,writemode, + name1,n,x1,v1,min(a),max(a), + name2,n,x2,v2,min(b),max(b), + statname,t,prob) + return t, prob + + +def lchisquare(f_obs,f_exp=None): + """ +Calculates a one-way chi square for list of observed frequencies and returns +the result. If no expected frequencies are given, the total N is assumed to +be equally distributed across all groups. + +Usage: lchisquare(f_obs, f_exp=None) f_obs = list of observed cell freq. +Returns: chisquare-statistic, associated p-value +""" + k = len(f_obs) # number of groups + if f_exp == None: + f_exp = [sum(f_obs)/float(k)] * len(f_obs) # create k bins with = freq. + chisq = 0 + for i in range(len(f_obs)): + chisq = chisq + (f_obs[i]-f_exp[i])**2 / float(f_exp[i]) + return chisq, chisqprob(chisq, k-1) + + +def lks_2samp (data1,data2): + """ +Computes the Kolmogorov-Smirnof statistic on 2 samples. From +Numerical Recipies in C, page 493. + +Usage: lks_2samp(data1,data2) data1&2 are lists of values for 2 conditions +Returns: KS D-value, associated p-value +""" + j1 = 0 + j2 = 0 + fn1 = 0.0 + fn2 = 0.0 + n1 = len(data1) + n2 = len(data2) + en1 = n1 + en2 = n2 + d = 0.0 + data1.sort() + data2.sort() + while j1 < n1 and j2 < n2: + d1=data1[j1] + d2=data2[j2] + if d1 <= d2: + fn1 = (j1)/float(en1) + j1 = j1 + 1 + if d2 <= d1: + fn2 = (j2)/float(en2) + j2 = j2 + 1 + dt = (fn2-fn1) + if math.fabs(dt) > math.fabs(d): + d = dt + try: + en = math.sqrt(en1*en2/float(en1+en2)) + prob = ksprob((en+0.12+0.11/en)*abs(d)) + except: + prob = 1.0 + return d, prob + + +def lmannwhitneyu(x,y): + """ +Calculates a Mann-Whitney U statistic on the provided scores and +returns the result. Use only when the n in each condition is < 20 and +you have 2 independent samples of ranks. NOTE: Mann-Whitney U is +significant if the u-obtained is LESS THAN or equal to the critical +value of U found in the tables. Equivalent to Kruskal-Wallis H with +just 2 groups. + +Usage: lmannwhitneyu(data) +Returns: u-statistic, one-tailed p-value (i.e., p(z(U))) +""" + n1 = len(x) + n2 = len(y) + ranked = rankdata(x+y) + rankx = ranked[0:n1] # get the x-ranks + ranky = ranked[n1:] # the rest are y-ranks + u1 = n1*n2 + (n1*(n1+1))/2.0 - sum(rankx) # calc U for x + u2 = n1*n2 - u1 # remainder is U for y + bigu = max(u1,u2) + smallu = min(u1,u2) + T = math.sqrt(tiecorrect(ranked)) # correction factor for tied scores + if T == 0: + raise ValueError, 'All numbers are identical in lmannwhitneyu' + sd = math.sqrt(T*n1*n2*(n1+n2+1)/12.0) + z = abs((bigu-n1*n2/2.0) / sd) # normal approximation for prob calc + return smallu, 1.0 - zprob(z) + + +def ltiecorrect(rankvals): + """ +Corrects for ties in Mann Whitney U and Kruskal Wallis H tests. See +Siegel, S. (1956) Nonparametric Statistics for the Behavioral Sciences. +New York: McGraw-Hill. Code adapted from |Stat rankind.c code. + +Usage: ltiecorrect(rankvals) +Returns: T correction factor for U or H +""" + sorted,posn = shellsort(rankvals) + n = len(sorted) + T = 0.0 + i = 0 + while (i 20 and you +have 2 independent samples of ranks. + +Usage: lranksums(x,y) +Returns: a z-statistic, two-tailed p-value +""" + n1 = len(x) + n2 = len(y) + alldata = x+y + ranked = rankdata(alldata) + x = ranked[:n1] + y = ranked[n1:] + s = sum(x) + expected = n1*(n1+n2+1) / 2.0 + z = (s - expected) / math.sqrt(n1*n2*(n1+n2+1)/12.0) + prob = 2*(1.0 -zprob(abs(z))) + return z, prob + + +def lwilcoxont(x,y): + """ +Calculates the Wilcoxon T-test for related samples and returns the +result. A non-parametric T-test. + +Usage: lwilcoxont(x,y) +Returns: a t-statistic, two-tail probability estimate +""" + if len(x) <> len(y): + raise ValueError, 'Unequal N in wilcoxont. Aborting.' + d=[] + for i in range(len(x)): + diff = x[i] - y[i] + if diff <> 0: + d.append(diff) + count = len(d) + absd = map(abs,d) + absranked = rankdata(absd) + r_plus = 0.0 + r_minus = 0.0 + for i in range(len(absd)): + if d[i] < 0: + r_minus = r_minus + absranked[i] + else: + r_plus = r_plus + absranked[i] + wt = min(r_plus, r_minus) + mn = count * (count+1) * 0.25 + se = math.sqrt(count*(count+1)*(2.0*count+1.0)/24.0) + z = math.fabs(wt-mn) / se + prob = 2*(1.0 -zprob(abs(z))) + return wt, prob + + +def lkruskalwallish(*args): + """ +The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more +groups, requiring at least 5 subjects in each group. This function +calculates the Kruskal-Wallis H-test for 3 or more independent samples +and returns the result. + +Usage: lkruskalwallish(*args) +Returns: H-statistic (corrected for ties), associated p-value +""" + args = list(args) + n = [0]*len(args) + all = [] + n = map(len,args) + for i in range(len(args)): + all = all + args[i] + ranked = rankdata(all) + T = tiecorrect(ranked) + for i in range(len(args)): + args[i] = ranked[0:n[i]] + del ranked[0:n[i]] + rsums = [] + for i in range(len(args)): + rsums.append(sum(args[i])**2) + rsums[i] = rsums[i] / float(n[i]) + ssbn = sum(rsums) + totaln = sum(n) + h = 12.0 / (totaln*(totaln+1)) * ssbn - 3*(totaln+1) + df = len(args) - 1 + if T == 0: + raise ValueError, 'All numbers are identical in lkruskalwallish' + h = h / float(T) + return h, chisqprob(h,df) + + +def lfriedmanchisquare(*args): + """ +Friedman Chi-Square is a non-parametric, one-way within-subjects +ANOVA. This function calculates the Friedman Chi-square test for repeated +measures and returns the result, along with the associated probability +value. It assumes 3 or more repeated measures. Only 3 levels requires a +minimum of 10 subjects in the study. Four levels requires 5 subjects per +level(??). + +Usage: lfriedmanchisquare(*args) +Returns: chi-square statistic, associated p-value +""" + k = len(args) + if k < 3: + raise ValueError, 'Less than 3 levels. Friedman test not appropriate.' + n = len(args[0]) + data = apply(pstat.abut,tuple(args)) + for i in range(len(data)): + data[i] = rankdata(data[i]) + ssbn = 0 + for i in range(k): + ssbn = ssbn + sum(args[i])**2 + chisq = 12.0 / (k*n*(k+1)) * ssbn - 3*n*(k+1) + return chisq, chisqprob(chisq,k-1) + + +#################################### +#### PROBABILITY CALCULATIONS #### +#################################### + +def lchisqprob(chisq,df): + """ +Returns the (1-tailed) probability value associated with the provided +chi-square value and df. Adapted from chisq.c in Gary Perlman's |Stat. + +Usage: lchisqprob(chisq,df) +""" + BIG = 20.0 + def ex(x): + BIG = 20.0 + if x < -BIG: + return 0.0 + else: + return math.exp(x) + + if chisq <=0 or df < 1: + return 1.0 + a = 0.5 * chisq + if df%2 == 0: + even = 1 + else: + even = 0 + if df > 1: + y = ex(-a) + if even: + s = y + else: + s = 2.0 * zprob(-math.sqrt(chisq)) + if (df > 2): + chisq = 0.5 * (df - 1.0) + if even: + z = 1.0 + else: + z = 0.5 + if a > BIG: + if even: + e = 0.0 + else: + e = math.log(math.sqrt(math.pi)) + c = math.log(a) + while (z <= chisq): + e = math.log(z) + e + s = s + ex(c*z-a-e) + z = z + 1.0 + return s + else: + if even: + e = 1.0 + else: + e = 1.0 / math.sqrt(math.pi) / math.sqrt(a) + c = 0.0 + while (z <= chisq): + e = e * (a/float(z)) + c = c + e + z = z + 1.0 + return (c*y+s) + else: + return s + + +def lerfcc(x): + """ +Returns the complementary error function erfc(x) with fractional +error everywhere less than 1.2e-7. Adapted from Numerical Recipies. + +Usage: lerfcc(x) +""" + z = abs(x) + t = 1.0 / (1.0+0.5*z) + ans = t * math.exp(-z*z-1.26551223 + t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277))))))))) + if x >= 0: + return ans + else: + return 2.0 - ans + + +def lzprob(z): + """ +Returns the area under the normal curve 'to the left of' the given z value. +Thus, + for z<0, zprob(z) = 1-tail probability + for z>0, 1.0-zprob(z) = 1-tail probability + for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability +Adapted from z.c in Gary Perlman's |Stat. + +Usage: lzprob(z) +""" + Z_MAX = 6.0 # maximum meaningful z-value + if z == 0.0: + x = 0.0 + else: + y = 0.5 * math.fabs(z) + if y >= (Z_MAX*0.5): + x = 1.0 + elif (y < 1.0): + w = y*y + x = ((((((((0.000124818987 * w + -0.001075204047) * w +0.005198775019) * w + -0.019198292004) * w +0.059054035642) * w + -0.151968751364) * w +0.319152932694) * w + -0.531923007300) * w +0.797884560593) * y * 2.0 + else: + y = y - 2.0 + x = (((((((((((((-0.000045255659 * y + +0.000152529290) * y -0.000019538132) * y + -0.000676904986) * y +0.001390604284) * y + -0.000794620820) * y -0.002034254874) * y + +0.006549791214) * y -0.010557625006) * y + +0.011630447319) * y -0.009279453341) * y + +0.005353579108) * y -0.002141268741) * y + +0.000535310849) * y +0.999936657524 + if z > 0.0: + prob = ((x+1.0)*0.5) + else: + prob = ((1.0-x)*0.5) + return prob + + +def lksprob(alam): + """ +Computes a Kolmolgorov-Smirnov t-test significance level. Adapted from +Numerical Recipies. + +Usage: lksprob(alam) +""" + fac = 2.0 + sum = 0.0 + termbf = 0.0 + a2 = -2.0*alam*alam + for j in range(1,201): + term = fac*math.exp(a2*j*j) + sum = sum + term + if math.fabs(term) <= (0.001*termbf) or math.fabs(term) < (1.0e-8*sum): + return sum + fac = -fac + termbf = math.fabs(term) + return 1.0 # Get here only if fails to converge; was 0.0!! + + +def lfprob (dfnum, dfden, F): + """ +Returns the (1-tailed) significance level (p-value) of an F +statistic given the degrees of freedom for the numerator (dfR-dfF) and +the degrees of freedom for the denominator (dfF). + +Usage: lfprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn +""" + p = betai(0.5*dfden, 0.5*dfnum, dfden/float(dfden+dfnum*F)) + return p + + +def lbetacf(a,b,x): + """ +This function evaluates the continued fraction form of the incomplete +Beta function, betai. (Adapted from: Numerical Recipies in C.) + +Usage: lbetacf(a,b,x) +""" + ITMAX = 200 + EPS = 3.0e-7 + + bm = az = am = 1.0 + qab = a+b + qap = a+1.0 + qam = a-1.0 + bz = 1.0-qab*x/qap + for i in range(ITMAX+1): + em = float(i+1) + tem = em + em + d = em*(b-em)*x/((qam+tem)*(a+tem)) + ap = az + d*am + bp = bz+d*bm + d = -(a+em)*(qab+em)*x/((qap+tem)*(a+tem)) + app = ap+d*az + bpp = bp+d*bz + aold = az + am = ap/bpp + bm = bp/bpp + az = app/bpp + bz = 1.0 + if (abs(az-aold)<(EPS*abs(az))): + return az + print 'a or b too big, or ITMAX too small in Betacf.' + + +def lgammln(xx): + """ +Returns the gamma function of xx. + Gamma(z) = Integral(0,infinity) of t^(z-1)exp(-t) dt. +(Adapted from: Numerical Recipies in C.) + +Usage: lgammln(xx) +""" + + coeff = [76.18009173, -86.50532033, 24.01409822, -1.231739516, + 0.120858003e-2, -0.536382e-5] + x = xx - 1.0 + tmp = x + 5.5 + tmp = tmp - (x+0.5)*math.log(tmp) + ser = 1.0 + for j in range(len(coeff)): + x = x + 1 + ser = ser + coeff[j]/x + return -tmp + math.log(2.50662827465*ser) + + +def lbetai(a,b,x): + """ +Returns the incomplete beta function: + + I-sub-x(a,b) = 1/B(a,b)*(Integral(0,x) of t^(a-1)(1-t)^(b-1) dt) + +where a,b>0 and B(a,b) = G(a)*G(b)/(G(a+b)) where G(a) is the gamma +function of a. The continued fraction formulation is implemented here, +using the betacf function. (Adapted from: Numerical Recipies in C.) + +Usage: lbetai(a,b,x) +""" + if (x<0.0 or x>1.0): + raise ValueError, 'Bad x in lbetai' + if (x==0.0 or x==1.0): + bt = 0.0 + else: + bt = math.exp(gammln(a+b)-gammln(a)-gammln(b)+a*math.log(x)+b* + math.log(1.0-x)) + if (x<(a+1.0)/(a+b+2.0)): + return bt*betacf(a,b,x)/float(a) + else: + return 1.0-bt*betacf(b,a,1.0-x)/float(b) + + +#################################### +####### ANOVA CALCULATIONS ####### +#################################### + +def lF_oneway(*lists): + """ +Performs a 1-way ANOVA, returning an F-value and probability given +any number of groups. From Heiman, pp.394-7. + +Usage: F_oneway(*lists) where *lists is any number of lists, one per + treatment group +Returns: F value, one-tailed p-value +""" + a = len(lists) # ANOVA on 'a' groups, each in it's own list + means = [0]*a + vars = [0]*a + ns = [0]*a + alldata = [] + tmp = map(N.array,lists) + means = map(amean,tmp) + vars = map(avar,tmp) + ns = map(len,lists) + for i in range(len(lists)): + alldata = alldata + lists[i] + alldata = N.array(alldata) + bign = len(alldata) + sstot = ass(alldata)-(asquare_of_sums(alldata)/float(bign)) + ssbn = 0 + for list in lists: + ssbn = ssbn + asquare_of_sums(N.array(list))/float(len(list)) + ssbn = ssbn - (asquare_of_sums(alldata)/float(bign)) + sswn = sstot-ssbn + dfbn = a-1 + dfwn = bign - a + msb = ssbn/float(dfbn) + msw = sswn/float(dfwn) + f = msb/msw + prob = fprob(dfbn,dfwn,f) + return f, prob + + +def lF_value (ER,EF,dfnum,dfden): + """ +Returns an F-statistic given the following: + ER = error associated with the null hypothesis (the Restricted model) + EF = error associated with the alternate hypothesis (the Full model) + dfR-dfF = degrees of freedom of the numerator + dfF = degrees of freedom associated with the denominator/Full model + +Usage: lF_value(ER,EF,dfnum,dfden) +""" + return ((ER-EF)/float(dfnum) / (EF/float(dfden))) + + +#################################### +######## SUPPORT FUNCTIONS ####### +#################################### + +def writecc (listoflists,file,writetype='w',extra=2): + """ +Writes a list of lists to a file in columns, customized by the max +size of items within the columns (max size of items in col, +2 characters) +to specified file. File-overwrite is the default. + +Usage: writecc (listoflists,file,writetype='w',extra=2) +Returns: None +""" + if type(listoflists[0]) not in [ListType,TupleType]: + listoflists = [listoflists] + outfile = open(file,writetype) + rowstokill = [] + list2print = copy.deepcopy(listoflists) + for i in range(len(listoflists)): + if listoflists[i] == ['\n'] or listoflists[i]=='\n' or listoflists[i]=='dashes': + rowstokill = rowstokill + [i] + rowstokill.reverse() + for row in rowstokill: + del list2print[row] + maxsize = [0]*len(list2print[0]) + for col in range(len(list2print[0])): + items = pstat.colex(list2print,col) + items = map(pstat.makestr,items) + maxsize[col] = max(map(len,items)) + extra + for row in listoflists: + if row == ['\n'] or row == '\n': + outfile.write('\n') + elif row == ['dashes'] or row == 'dashes': + dashes = [0]*len(maxsize) + for j in range(len(maxsize)): + dashes[j] = '-'*(maxsize[j]-2) + outfile.write(pstat.lineincustcols(dashes,maxsize)) + else: + outfile.write(pstat.lineincustcols(row,maxsize)) + outfile.write('\n') + outfile.close() + return None + + +def lincr(l,cap): # to increment a list up to a max-list of 'cap' + """ +Simulate a counting system from an n-dimensional list. + +Usage: lincr(l,cap) l=list to increment, cap=max values for each list pos'n +Returns: next set of values for list l, OR -1 (if overflow) +""" + l[0] = l[0] + 1 # e.g., [0,0,0] --> [2,4,3] (=cap) + for i in range(len(l)): + if l[i] > cap[i] and i < len(l)-1: # if carryover AND not done + l[i] = 0 + l[i+1] = l[i+1] + 1 + elif l[i] > cap[i] and i == len(l)-1: # overflow past last column, must be finished + l = -1 + return l + + +def lsum (inlist): + """ +Returns the sum of the items in the passed list. + +Usage: lsum(inlist) +""" + s = 0 + for item in inlist: + s = s + item + return s + + +def lcumsum (inlist): + """ +Returns a list consisting of the cumulative sum of the items in the +passed list. + +Usage: lcumsum(inlist) +""" + newlist = copy.deepcopy(inlist) + for i in range(1,len(newlist)): + newlist[i] = newlist[i] + newlist[i-1] + return newlist + + +def lss(inlist): + """ +Squares each value in the passed list, adds up these squares and +returns the result. + +Usage: lss(inlist) +""" + ss = 0 + for item in inlist: + ss = ss + item*item + return ss + + +def lsummult (list1,list2): + """ +Multiplies elements in list1 and list2, element by element, and +returns the sum of all resulting multiplications. Must provide equal +length lists. + +Usage: lsummult(list1,list2) +""" + if len(list1) <> len(list2): + raise ValueError, "Lists not equal length in summult." + s = 0 + for item1,item2 in pstat.abut(list1,list2): + s = s + item1*item2 + return s + + +def lsumdiffsquared(x,y): + """ +Takes pairwise differences of the values in lists x and y, squares +these differences, and returns the sum of these squares. + +Usage: lsumdiffsquared(x,y) +Returns: sum[(x[i]-y[i])**2] +""" + sds = 0 + for i in range(len(x)): + sds = sds + (x[i]-y[i])**2 + return sds + + +def lsquare_of_sums(inlist): + """ +Adds the values in the passed list, squares the sum, and returns +the result. + +Usage: lsquare_of_sums(inlist) +Returns: sum(inlist[i])**2 +""" + s = sum(inlist) + return float(s)*s + + +def lshellsort(inlist): + """ +Shellsort algorithm. Sorts a 1D-list. + +Usage: lshellsort(inlist) +Returns: sorted-inlist, sorting-index-vector (for original list) +""" + n = len(inlist) + svec = copy.deepcopy(inlist) + ivec = range(n) + gap = n/2 # integer division needed + while gap >0: + for i in range(gap,n): + for j in range(i-gap,-1,-gap): + while j>=0 and svec[j]>svec[j+gap]: + temp = svec[j] + svec[j] = svec[j+gap] + svec[j+gap] = temp + itemp = ivec[j] + ivec[j] = ivec[j+gap] + ivec[j+gap] = itemp + gap = gap / 2 # integer division needed +# svec is now sorted inlist, and ivec has the order svec[i] = vec[ivec[i]] + return svec, ivec + + +def lrankdata(inlist): + """ +Ranks the data in inlist, dealing with ties appropritely. Assumes +a 1D inlist. Adapted from Gary Perlman's |Stat ranksort. + +Usage: lrankdata(inlist) +Returns: a list of length equal to inlist, containing rank scores +""" + n = len(inlist) + svec, ivec = shellsort(inlist) + sumranks = 0 + dupcount = 0 + newlist = [0]*n + for i in range(n): + sumranks = sumranks + i + dupcount = dupcount + 1 + if i==n-1 or svec[i] <> svec[i+1]: + averank = sumranks / float(dupcount) + 1 + for j in range(i-dupcount+1,i+1): + newlist[ivec[j]] = averank + sumranks = 0 + dupcount = 0 + return newlist + + +def outputpairedstats(fname,writemode,name1,n1,m1,se1,min1,max1,name2,n2,m2,se2,min2,max2,statname,stat,prob): + """ +Prints or write to a file stats for two groups, using the name, n, +mean, sterr, min and max for each group, as well as the statistic name, +its value, and the associated p-value. + +Usage: outputpairedstats(fname,writemode, + name1,n1,mean1,stderr1,min1,max1, + name2,n2,mean2,stderr2,min2,max2, + statname,stat,prob) +Returns: None +""" + suffix = '' # for *s after the p-value + try: + x = prob.shape + prob = prob[0] + except: + pass + if prob < 0.001: suffix = ' ***' + elif prob < 0.01: suffix = ' **' + elif prob < 0.05: suffix = ' *' + title = [['Name','N','Mean','SD','Min','Max']] + lofl = title+[[name1,n1,round(m1,3),round(math.sqrt(se1),3),min1,max1], + [name2,n2,round(m2,3),round(math.sqrt(se2),3),min2,max2]] + if type(fname)<>StringType or len(fname)==0: + print + print statname + print + pstat.printcc(lofl) + print + try: + if stat.shape == (): + stat = stat[0] + if prob.shape == (): + prob = prob[0] + except: + pass + print 'Test statistic = ',round(stat,3),' p = ',round(prob,3),suffix + print + else: + file = open(fname,writemode) + file.write('\n'+statname+'\n\n') + file.close() + writecc(lofl,fname,'a') + file = open(fname,'a') + try: + if stat.shape == (): + stat = stat[0] + if prob.shape == (): + prob = prob[0] + except: + pass + file.write(pstat.list2string(['\nTest statistic = ',round(stat,4),' p = ',round(prob,4),suffix,'\n\n'])) + file.close() + return None + + +def lfindwithin (data): + """ +Returns an integer representing a binary vector, where 1=within- +subject factor, 0=between. Input equals the entire data 2D list (i.e., +column 0=random factor, column -1=measured values (those two are skipped). +Note: input data is in |Stat format ... a list of lists ("2D list") with +one row per measured value, first column=subject identifier, last column= +score, one in-between column per factor (these columns contain level +designations on each factor). See also stats.anova.__doc__. + +Usage: lfindwithin(data) data in |Stat format +""" + + numfact = len(data[0])-1 + withinvec = 0 + for col in range(1,numfact): + examplelevel = pstat.unique(pstat.colex(data,col))[0] + rows = pstat.linexand(data,col,examplelevel) # get 1 level of this factor + factsubjs = pstat.unique(pstat.colex(rows,0)) + allsubjs = pstat.unique(pstat.colex(data,0)) + if len(factsubjs) == len(allsubjs): # fewer Ss than scores on this factor? + withinvec = withinvec + (1 << col) + return withinvec + + +######################################################### +######################################################### +####### DISPATCH LISTS AND TUPLES TO ABOVE FCNS ######### +######################################################### +######################################################### + +## CENTRAL TENDENCY: +geometricmean = Dispatch ( (lgeometricmean, (ListType, TupleType)), ) +harmonicmean = Dispatch ( (lharmonicmean, (ListType, TupleType)), ) +mean = Dispatch ( (lmean, (ListType, TupleType)), ) +median = Dispatch ( (lmedian, (ListType, TupleType)), ) +medianscore = Dispatch ( (lmedianscore, (ListType, TupleType)), ) +mode = Dispatch ( (lmode, (ListType, TupleType)), ) + +## MOMENTS: +moment = Dispatch ( (lmoment, (ListType, TupleType)), ) +variation = Dispatch ( (lvariation, (ListType, TupleType)), ) +skew = Dispatch ( (lskew, (ListType, TupleType)), ) +kurtosis = Dispatch ( (lkurtosis, (ListType, TupleType)), ) +describe = Dispatch ( (ldescribe, (ListType, TupleType)), ) + +## FREQUENCY STATISTICS: +itemfreq = Dispatch ( (litemfreq, (ListType, TupleType)), ) +scoreatpercentile = Dispatch ( (lscoreatpercentile, (ListType, TupleType)), ) +percentileofscore = Dispatch ( (lpercentileofscore, (ListType, TupleType)), ) +histogram = Dispatch ( (lhistogram, (ListType, TupleType)), ) +cumfreq = Dispatch ( (lcumfreq, (ListType, TupleType)), ) +relfreq = Dispatch ( (lrelfreq, (ListType, TupleType)), ) + +## VARIABILITY: +obrientransform = Dispatch ( (lobrientransform, (ListType, TupleType)), ) +samplevar = Dispatch ( (lsamplevar, (ListType, TupleType)), ) +samplestdev = Dispatch ( (lsamplestdev, (ListType, TupleType)), ) +var = Dispatch ( (lvar, (ListType, TupleType)), ) +stdev = Dispatch ( (lstdev, (ListType, TupleType)), ) +sterr = Dispatch ( (lsterr, (ListType, TupleType)), ) +sem = Dispatch ( (lsem, (ListType, TupleType)), ) +z = Dispatch ( (lz, (ListType, TupleType)), ) +zs = Dispatch ( (lzs, (ListType, TupleType)), ) + +## TRIMMING FCNS: +trimboth = Dispatch ( (ltrimboth, (ListType, TupleType)), ) +trim1 = Dispatch ( (ltrim1, (ListType, TupleType)), ) + +## CORRELATION FCNS: +paired = Dispatch ( (lpaired, (ListType, TupleType)), ) +pearsonr = Dispatch ( (lpearsonr, (ListType, TupleType)), ) +spearmanr = Dispatch ( (lspearmanr, (ListType, TupleType)), ) +pointbiserialr = Dispatch ( (lpointbiserialr, (ListType, TupleType)), ) +kendalltau = Dispatch ( (lkendalltau, (ListType, TupleType)), ) +linregress = Dispatch ( (llinregress, (ListType, TupleType)), ) + +## INFERENTIAL STATS: +ttest_1samp = Dispatch ( (lttest_1samp, (ListType, TupleType)), ) +ttest_ind = Dispatch ( (lttest_ind, (ListType, TupleType)), ) +ttest_rel = Dispatch ( (lttest_rel, (ListType, TupleType)), ) +chisquare = Dispatch ( (lchisquare, (ListType, TupleType)), ) +ks_2samp = Dispatch ( (lks_2samp, (ListType, TupleType)), ) +mannwhitneyu = Dispatch ( (lmannwhitneyu, (ListType, TupleType)), ) +ranksums = Dispatch ( (lranksums, (ListType, TupleType)), ) +tiecorrect = Dispatch ( (ltiecorrect, (ListType, TupleType)), ) +wilcoxont = Dispatch ( (lwilcoxont, (ListType, TupleType)), ) +kruskalwallish = Dispatch ( (lkruskalwallish, (ListType, TupleType)), ) +friedmanchisquare = Dispatch ( (lfriedmanchisquare, (ListType, TupleType)), ) + +## PROBABILITY CALCS: +chisqprob = Dispatch ( (lchisqprob, (IntType, FloatType)), ) +zprob = Dispatch ( (lzprob, (IntType, FloatType)), ) +ksprob = Dispatch ( (lksprob, (IntType, FloatType)), ) +fprob = Dispatch ( (lfprob, (IntType, FloatType)), ) +betacf = Dispatch ( (lbetacf, (IntType, FloatType)), ) +betai = Dispatch ( (lbetai, (IntType, FloatType)), ) +erfcc = Dispatch ( (lerfcc, (IntType, FloatType)), ) +gammln = Dispatch ( (lgammln, (IntType, FloatType)), ) + +## ANOVA FUNCTIONS: +F_oneway = Dispatch ( (lF_oneway, (ListType, TupleType)), ) +F_value = Dispatch ( (lF_value, (ListType, TupleType)), ) + +## SUPPORT FUNCTIONS: +incr = Dispatch ( (lincr, (ListType, TupleType)), ) +sum = Dispatch ( (lsum, (ListType, TupleType)), ) +cumsum = Dispatch ( (lcumsum, (ListType, TupleType)), ) +ss = Dispatch ( (lss, (ListType, TupleType)), ) +summult = Dispatch ( (lsummult, (ListType, TupleType)), ) +square_of_sums = Dispatch ( (lsquare_of_sums, (ListType, TupleType)), ) +sumdiffsquared = Dispatch ( (lsumdiffsquared, (ListType, TupleType)), ) +shellsort = Dispatch ( (lshellsort, (ListType, TupleType)), ) +rankdata = Dispatch ( (lrankdata, (ListType, TupleType)), ) +findwithin = Dispatch ( (lfindwithin, (ListType, TupleType)), ) + + +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== +#============= THE ARRAY-VERSION OF THE STATS FUNCTIONS =============== + +try: # DEFINE THESE *ONLY* IF NUMERIC IS AVAILABLE + import Numeric + N = Numeric + import LinearAlgebra + LA = LinearAlgebra + + +##################################### +######## ACENTRAL TENDENCY ######## +##################################### + + def ageometricmean (inarray,dimension=None,keepdims=0): + """ +Calculates the geometric mean of the values in the passed array. +That is: n-th root of (x1 * x2 * ... * xn). Defaults to ALL values in +the passed array. Use dimension=None to flatten array first. REMEMBER: if +dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and +if dimension is a sequence, it collapses over all specified dimensions. If +keepdims is set to 1, the resulting array will have as many dimensions as +inarray, with only 1 'level' per dim that was collapsed over. + +Usage: ageometricmean(inarray,dimension=None,keepdims=0) +Returns: geometric mean computed over dim(s) listed in dimension +""" + inarray = N.array(inarray,N.Float) + if dimension == None: + inarray = N.ravel(inarray) + size = len(inarray) + mult = N.power(inarray,1.0/size) + mult = N.multiply.reduce(mult) + elif type(dimension) in [IntType,FloatType]: + size = inarray.shape[dimension] + mult = N.power(inarray,1.0/size) + mult = N.multiply.reduce(mult,dimension) + if keepdims == 1: + shp = list(inarray.shape) + shp[dimension] = 1 + sum = N.reshape(sum,shp) + else: # must be a SEQUENCE of dims to average over + dims = list(dimension) + dims.sort() + dims.reverse() + size = N.array(N.multiply.reduce(N.take(inarray.shape,dims)),N.Float) + mult = N.power(inarray,1.0/size) + for dim in dims: + mult = N.multiply.reduce(mult,dim) + if keepdims == 1: + shp = list(inarray.shape) + for dim in dims: + shp[dim] = 1 + mult = N.reshape(mult,shp) + return mult + + + def aharmonicmean (inarray,dimension=None,keepdims=0): + """ +Calculates the harmonic mean of the values in the passed array. +That is: n / (1/x1 + 1/x2 + ... + 1/xn). Defaults to ALL values in +the passed array. Use dimension=None to flatten array first. REMEMBER: if +dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and +if dimension is a sequence, it collapses over all specified dimensions. If +keepdims is set to 1, the resulting array will have as many dimensions as +inarray, with only 1 'level' per dim that was collapsed over. + +Usage: aharmonicmean(inarray,dimension=None,keepdims=0) +Returns: harmonic mean computed over dim(s) in dimension +""" + inarray = inarray.astype(N.Float) + if dimension == None: + inarray = N.ravel(inarray) + size = len(inarray) + s = N.add.reduce(1.0 / inarray) + elif type(dimension) in [IntType,FloatType]: + size = float(inarray.shape[dimension]) + s = N.add.reduce(1.0/inarray, dimension) + if keepdims == 1: + shp = list(inarray.shape) + shp[dimension] = 1 + s = N.reshape(s,shp) + else: # must be a SEQUENCE of dims to average over + dims = list(dimension) + dims.sort() + nondims = [] + for i in range(len(inarray.shape)): + if i not in dims: + nondims.append(i) + tinarray = N.transpose(inarray,nondims+dims) # put keep-dims first + idx = [0] *len(nondims) + if idx == []: + size = len(N.ravel(inarray)) + s = asum(1.0 / inarray) + if keepdims == 1: + s = N.reshape([s],N.ones(len(inarray.shape))) + else: + idx[0] = -1 + loopcap = N.array(tinarray.shape[0:len(nondims)]) -1 + s = N.zeros(loopcap+1,N.Float) + while incr(idx,loopcap) <> -1: + s[idx] = asum(1.0/tinarray[idx]) + size = N.multiply.reduce(N.take(inarray.shape,dims)) + if keepdims == 1: + shp = list(inarray.shape) + for dim in dims: + shp[dim] = 1 + s = N.reshape(s,shp) + return size / s + + + def amean (inarray,dimension=None,keepdims=0): + """ +Calculates the arithmatic mean of the values in the passed array. +That is: 1/n * (x1 + x2 + ... + xn). Defaults to ALL values in the +passed array. Use dimension=None to flatten array first. REMEMBER: if +dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and +if dimension is a sequence, it collapses over all specified dimensions. If +keepdims is set to 1, the resulting array will have as many dimensions as +inarray, with only 1 'level' per dim that was collapsed over. + +Usage: amean(inarray,dimension=None,keepdims=0) +Returns: arithematic mean calculated over dim(s) in dimension +""" + if inarray.typecode() in ['l','s','b']: + inarray = inarray.astype(N.Float) + if dimension == None: + inarray = N.ravel(inarray) + sum = N.add.reduce(inarray) + denom = float(len(inarray)) + elif type(dimension) in [IntType,FloatType]: + sum = asum(inarray,dimension) + denom = float(inarray.shape[dimension]) + if keepdims == 1: + shp = list(inarray.shape) + shp[dimension] = 1 + sum = N.reshape(sum,shp) + else: # must be a TUPLE of dims to average over + dims = list(dimension) + dims.sort() + dims.reverse() + sum = inarray *1.0 + for dim in dims: + sum = N.add.reduce(sum,dim) + denom = N.array(N.multiply.reduce(N.take(inarray.shape,dims)),N.Float) + if keepdims == 1: + shp = list(inarray.shape) + for dim in dims: + shp[dim] = 1 + sum = N.reshape(sum,shp) + return sum/denom + + + def amedian (inarray,numbins=1000): + """ +Calculates the COMPUTED median value of an array of numbers, given the +number of bins to use for the histogram (more bins approaches finding the +precise median value of the array; default number of bins = 1000). From +G.W. Heiman's Basic Stats, or CRC Probability & Statistics. +NOTE: THIS ROUTINE ALWAYS uses the entire passed array (flattens it first). + +Usage: amedian(inarray,numbins=1000) +Returns: median calculated over ALL values in inarray +""" + inarray = N.ravel(inarray) + (hist, smallest, binsize, extras) = ahistogram(inarray,numbins) + cumhist = N.cumsum(hist) # make cumulative histogram + otherbins = N.greater_equal(cumhist,len(inarray)/2.0) + otherbins = list(otherbins) # list of 0/1s, 1s start at median bin + cfbin = otherbins.index(1) # get 1st(!) index holding 50%ile score + LRL = smallest + binsize*cfbin # get lower read limit of that bin + cfbelow = N.add.reduce(hist[0:cfbin]) # cum. freq. below bin + freq = hist[cfbin] # frequency IN the 50%ile bin + median = LRL + ((len(inarray)/2.0-cfbelow)/float(freq))*binsize # MEDIAN + return median + + + def amedianscore (inarray,dimension=None): + """ +Returns the 'middle' score of the passed array. If there is an even +number of scores, the mean of the 2 middle scores is returned. Can function +with 1D arrays, or on the FIRST dimension of 2D arrays (i.e., dimension can +be None, to pre-flatten the array, or else dimension must equal 0). + +Usage: amedianscore(inarray,dimension=None) +Returns: 'middle' score of the array, or the mean of the 2 middle scores +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + inarray = N.sort(inarray,dimension) + if inarray.shape[dimension] % 2 == 0: # if even number of elements + indx = inarray.shape[dimension]/2 # integer division correct + median = N.asarray(inarray[indx]+inarray[indx-1]) / 2.0 + else: + indx = inarray.shape[dimension] / 2 # integer division correct + median = N.take(inarray,[indx],dimension) + if median.shape == (1,): + median = median[0] + return median + + + def amode(a, dimension=None): + """ +Returns an array of the modal (most common) score in the passed array. +If there is more than one such score, ONLY THE FIRST is returned. +The bin-count for the modal values is also returned. Operates on whole +array (dimension=None), or on a given dimension. + +Usage: amode(a, dimension=None) +Returns: array of bin-counts for mode(s), array of corresponding modal values +""" + + if dimension == None: + a = N.ravel(a) + dimension = 0 + scores = pstat.aunique(N.ravel(a)) # get ALL unique values + testshape = list(a.shape) + testshape[dimension] = 1 + oldmostfreq = N.zeros(testshape) + oldcounts = N.zeros(testshape) + for score in scores: + template = N.equal(a,score) + counts = asum(template,dimension,1) + mostfrequent = N.where(N.greater(counts,oldcounts),score,oldmostfreq) + oldcounts = N.where(N.greater(counts,oldcounts),counts,oldcounts) + oldmostfreq = mostfrequent + return oldcounts, mostfrequent + + + def atmean(a,limits=None,inclusive=(1,1)): + """ +Returns the arithmetic mean of all values in an array, ignoring values +strictly outside the sequence passed to 'limits'. Note: either limit +in the sequence, or the value of limits itself, can be set to None. The +inclusive list/tuple determines whether the lower and upper limiting bounds +(respectively) are open/exclusive (0) or closed/inclusive (1). + +Usage: atmean(a,limits=None,inclusive=(1,1)) +""" + if a.typecode() in ['l','s','b']: + a = a.astype(N.Float) + if limits == None: + return mean(a) + assert type(limits) in [ListType,TupleType,N.ArrayType], "Wrong type for limits in atmean" + if inclusive[0]: lowerfcn = N.greater_equal + else: lowerfcn = N.greater + if inclusive[1]: upperfcn = N.less_equal + else: upperfcn = N.less + if limits[0] > N.maximum.reduce(N.ravel(a)) or limits[1] < N.minimum.reduce(N.ravel(a)): + raise ValueError, "No array values within given limits (atmean)." + elif limits[0]==None and limits[1]<>None: + mask = upperfcn(a,limits[1]) + elif limits[0]<>None and limits[1]==None: + mask = lowerfcn(a,limits[0]) + elif limits[0]<>None and limits[1]<>None: + mask = lowerfcn(a,limits[0])*upperfcn(a,limits[1]) + s = float(N.add.reduce(N.ravel(a*mask))) + n = float(N.add.reduce(N.ravel(mask))) + return s/n + + + def atvar(a,limits=None,inclusive=(1,1)): + """ +Returns the sample variance of values in an array, (i.e., using N-1), +ignoring values strictly outside the sequence passed to 'limits'. +Note: either limit in the sequence, or the value of limits itself, +can be set to None. The inclusive list/tuple determines whether the lower +and upper limiting bounds (respectively) are open/exclusive (0) or +closed/inclusive (1). + +Usage: atvar(a,limits=None,inclusive=(1,1)) +""" + a = a.astype(N.Float) + if limits == None or limits == [None,None]: + term1 = N.add.reduce(N.ravel(a*a)) + n = float(len(N.ravel(a))) - 1 + term2 = N.add.reduce(N.ravel(a))**2 / n + print term1, term2, n + return (term1 - term2) / n + assert type(limits) in [ListType,TupleType,N.ArrayType], "Wrong type for limits in atvar" + if inclusive[0]: lowerfcn = N.greater_equal + else: lowerfcn = N.greater + if inclusive[1]: upperfcn = N.less_equal + else: upperfcn = N.less + if limits[0] > N.maximum.reduce(N.ravel(a)) or limits[1] < N.minimum.reduce(N.ravel(a)): + raise ValueError, "No array values within given limits (atvar)." + elif limits[0]==None and limits[1]<>None: + mask = upperfcn(a,limits[1]) + elif limits[0]<>None and limits[1]==None: + mask = lowerfcn(a,limits[0]) + elif limits[0]<>None and limits[1]<>None: + mask = lowerfcn(a,limits[0])*upperfcn(a,limits[1]) + term1 = N.add.reduce(N.ravel(a*a*mask)) + n = float(N.add.reduce(N.ravel(mask))) - 1 + term2 = N.add.reduce(N.ravel(a*mask))**2 / n + print term1, term2, n + return (term1 - term2) / n + + + def atmin(a,lowerlimit=None,dimension=None,inclusive=1): + """ +Returns the minimum value of a, along dimension, including only values less +than (or equal to, if inclusive=1) lowerlimit. If the limit is set to None, +all values in the array are used. + +Usage: atmin(a,lowerlimit=None,dimension=None,inclusive=1) +""" + if inclusive: lowerfcn = N.greater + else: lowerfcn = N.greater_equal + if dimension == None: + a = N.ravel(a) + dimension = 0 + if lowerlimit == None: + lowerlimit = N.minimum.reduce(N.ravel(a))-11 + biggest = N.maximum.reduce(N.ravel(a)) + ta = N.where(lowerfcn(a,lowerlimit),a,biggest) + return N.minimum.reduce(ta,dimension) + + + def atmax(a,upperlimit,dimension=None,inclusive=1): + """ +Returns the maximum value of a, along dimension, including only values greater +than (or equal to, if inclusive=1) upperlimit. If the limit is set to None, +a limit larger than the max value in the array is used. + +Usage: atmax(a,upperlimit,dimension=None,inclusive=1) +""" + if inclusive: upperfcn = N.less + else: upperfcn = N.less_equal + if dimension == None: + a = N.ravel(a) + dimension = 0 + if upperlimit == None: + upperlimit = N.maximum.reduce(N.ravel(a))+1 + smallest = N.minimum.reduce(N.ravel(a)) + ta = N.where(upperfcn(a,upperlimit),a,smallest) + return N.maximum.reduce(ta,dimension) + + + def atstdev(a,limits=None,inclusive=(1,1)): + """ +Returns the standard deviation of all values in an array, ignoring values +strictly outside the sequence passed to 'limits'. Note: either limit +in the sequence, or the value of limits itself, can be set to None. The +inclusive list/tuple determines whether the lower and upper limiting bounds +(respectively) are open/exclusive (0) or closed/inclusive (1). + +Usage: atstdev(a,limits=None,inclusive=(1,1)) +""" + return N.sqrt(tvar(a,limits,inclusive)) + + + def atsem(a,limits=None,inclusive=(1,1)): + """ +Returns the standard error of the mean for the values in an array, +(i.e., using N for the denominator), ignoring values strictly outside +the sequence passed to 'limits'. Note: either limit in the sequence, +or the value of limits itself, can be set to None. The inclusive list/tuple +determines whether the lower and upper limiting bounds (respectively) are +open/exclusive (0) or closed/inclusive (1). + +Usage: atsem(a,limits=None,inclusive=(1,1)) +""" + sd = tstdev(a,limits,inclusive) + if limits == None or limits == [None,None]: + n = float(len(N.ravel(a))) + assert type(limits) in [ListType,TupleType,N.ArrayType], "Wrong type for limits in atsem" + if inclusive[0]: lowerfcn = N.greater_equal + else: lowerfcn = N.greater + if inclusive[1]: upperfcn = N.less_equal + else: upperfcn = N.less + if limits[0] > N.maximum.reduce(N.ravel(a)) or limits[1] < N.minimum.reduce(N.ravel(a)): + raise ValueError, "No array values within given limits (atsem)." + elif limits[0]==None and limits[1]<>None: + mask = upperfcn(a,limits[1]) + elif limits[0]<>None and limits[1]==None: + mask = lowerfcn(a,limits[0]) + elif limits[0]<>None and limits[1]<>None: + mask = lowerfcn(a,limits[0])*upperfcn(a,limits[1]) + term1 = N.add.reduce(N.ravel(a*a*mask)) + n = float(N.add.reduce(N.ravel(mask))) + return sd/math.sqrt(n) + + +##################################### +############ AMOMENTS ############# +##################################### + + def amoment(a,moment=1,dimension=None): + """ +Calculates the nth moment about the mean for a sample (defaults to the +1st moment). Generally used to calculate coefficients of skewness and +kurtosis. Dimension can equal None (ravel array first), an integer +(the dimension over which to operate), or a sequence (operate over +multiple dimensions). + +Usage: amoment(a,moment=1,dimension=None) +Returns: appropriate moment along given dimension +""" + if dimension == None: + a = N.ravel(a) + dimension = 0 + if moment == 1: + return 0.0 + else: + mn = amean(a,dimension,1) # 1=keepdims + s = N.power((a-mn),moment) + return amean(s,dimension) + + + def avariation(a,dimension=None): + """ +Returns the coefficient of variation, as defined in CRC Standard +Probability and Statistics, p.6. Dimension can equal None (ravel array +first), an integer (the dimension over which to operate), or a +sequence (operate over multiple dimensions). + +Usage: avariation(a,dimension=None) +""" + return 100.0*asamplestdev(a,dimension)/amean(a,dimension) + + + def askew(a,dimension=None): + """ +Returns the skewness of a distribution (normal ==> 0.0; >0 means extra +weight in left tail). Use askewtest() to see if it's close enough. +Dimension can equal None (ravel array first), an integer (the +dimension over which to operate), or a sequence (operate over multiple +dimensions). + +Usage: askew(a, dimension=None) +Returns: skew of vals in a along dimension, returning ZERO where all vals equal +""" + denom = N.power(amoment(a,2,dimension),1.5) + zero = N.equal(denom,0) + if type(denom) == N.ArrayType and asum(zero) <> 0: + print "Number of zeros in askew: ",asum(zero) + denom = denom + zero # prevent divide-by-zero + return N.where(zero, 0, amoment(a,3,dimension)/denom) + + + def akurtosis(a,dimension=None): + """ +Returns the kurtosis of a distribution (normal ==> 3.0; >3 means +heavier in the tails, and usually more peaked). Use akurtosistest() +to see if it's close enough. Dimension can equal None (ravel array +first), an integer (the dimension over which to operate), or a +sequence (operate over multiple dimensions). + +Usage: akurtosis(a,dimension=None) +Returns: kurtosis of values in a along dimension, and ZERO where all vals equal +""" + denom = N.power(amoment(a,2,dimension),2) + zero = N.equal(denom,0) + if type(denom) == N.ArrayType and asum(zero) <> 0: + print "Number of zeros in akurtosis: ",asum(zero) + denom = denom + zero # prevent divide-by-zero + return N.where(zero,0,amoment(a,4,dimension)/denom) + + + def adescribe(inarray,dimension=None): + """ +Returns several descriptive statistics of the passed array. Dimension +can equal None (ravel array first), an integer (the dimension over +which to operate), or a sequence (operate over multiple dimensions). + +Usage: adescribe(inarray,dimension=None) +Returns: n, (min,max), mean, standard deviation, skew, kurtosis +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + n = inarray.shape[dimension] + mm = (N.minimum.reduce(inarray),N.maximum.reduce(inarray)) + m = amean(inarray,dimension) + sd = astdev(inarray,dimension) + skew = askew(inarray,dimension) + kurt = akurtosis(inarray,dimension) + return n, mm, m, sd, skew, kurt + + +##################################### +######## NORMALITY TESTS ########## +##################################### + + def askewtest(a,dimension=None): + """ +Tests whether the skew is significantly different from a normal +distribution. Dimension can equal None (ravel array first), an +integer (the dimension over which to operate), or a sequence (operate +over multiple dimensions). + +Usage: askewtest(a,dimension=None) +Returns: z-score and 2-tail z-probability +""" + if dimension == None: + a = N.ravel(a) + dimension = 0 + b2 = askew(a,dimension) + n = float(a.shape[dimension]) + y = b2 * N.sqrt(((n+1)*(n+3)) / (6.0*(n-2)) ) + beta2 = ( 3.0*(n*n+27*n-70)*(n+1)*(n+3) ) / ( (n-2.0)*(n+5)*(n+7)*(n+9) ) + W2 = -1 + N.sqrt(2*(beta2-1)) + delta = 1/N.sqrt(N.log(N.sqrt(W2))) + alpha = N.sqrt(2/(W2-1)) + y = N.where(N.equal(y,0),1,y) + Z = delta*N.log(y/alpha + N.sqrt((y/alpha)**2+1)) + return Z, (1.0-zprob(Z))*2 + + + def akurtosistest(a,dimension=None): + """ +Tests whether a dataset has normal kurtosis (i.e., +kurtosis=3(n-1)/(n+1)) Valid only for n>20. Dimension can equal None +(ravel array first), an integer (the dimension over which to operate), +or a sequence (operate over multiple dimensions). + +Usage: akurtosistest(a,dimension=None) +Returns: z-score and 2-tail z-probability, returns 0 for bad pixels +""" + if dimension == None: + a = N.ravel(a) + dimension = 0 + n = float(a.shape[dimension]) + if n<20: + print "akurtosistest only valid for n>=20 ... continuing anyway, n=",n + b2 = akurtosis(a,dimension) + E = 3.0*(n-1) /(n+1) + varb2 = 24.0*n*(n-2)*(n-3) / ((n+1)*(n+1)*(n+3)*(n+5)) + x = (b2-E)/N.sqrt(varb2) + sqrtbeta1 = 6.0*(n*n-5*n+2)/((n+7)*(n+9)) * N.sqrt((6.0*(n+3)*(n+5))/ + (n*(n-2)*(n-3))) + A = 6.0 + 8.0/sqrtbeta1 *(2.0/sqrtbeta1 + N.sqrt(1+4.0/(sqrtbeta1**2))) + term1 = 1 -2/(9.0*A) + denom = 1 +x*N.sqrt(2/(A-4.0)) + denom = N.where(N.less(denom,0), 99, denom) + term2 = N.where(N.equal(denom,0), term1, N.power((1-2.0/A)/denom,1/3.0)) + Z = ( term1 - term2 ) / N.sqrt(2/(9.0*A)) + Z = N.where(N.equal(denom,99), 0, Z) + return Z, (1.0-zprob(Z))*2 + + + def anormaltest(a,dimension=None): + """ +Tests whether skew and/OR kurtosis of dataset differs from normal +curve. Can operate over multiple dimensions. Dimension can equal +None (ravel array first), an integer (the dimension over which to +operate), or a sequence (operate over multiple dimensions). + +Usage: anormaltest(a,dimension=None) +Returns: z-score and 2-tail probability +""" + if dimension == None: + a = N.ravel(a) + dimension = 0 + s,p = askewtest(a,dimension) + k,p = akurtosistest(a,dimension) + k2 = N.power(s,2) + N.power(k,2) + return k2, achisqprob(k2,2) + + +##################################### +###### AFREQUENCY FUNCTIONS ####### +##################################### + + def aitemfreq(a): + """ +Returns a 2D array of item frequencies. Column 1 contains item values, +column 2 contains their respective counts. Assumes a 1D array is passed. + +Usage: aitemfreq(a) +Returns: a 2D frequency table (col [0:n-1]=scores, col n=frequencies) +""" + scores = pstat.aunique(a) + scores = N.sort(scores) + freq = N.zeros(len(scores)) + for i in range(len(scores)): + freq[i] = N.add.reduce(N.equal(a,scores[i])) + return N.array(pstat.aabut(scores, freq)) + + + def ascoreatpercentile (inarray, percent): + """ +Usage: ascoreatpercentile(inarray,percent) 0= targetcf: + break + score = binsize * ((targetcf - cumhist[i-1]) / float(h[i])) + (lrl+binsize*i) + return score + + + def apercentileofscore (inarray,score,histbins=10,defaultlimits=None): + """ +Note: result of this function depends on the values used to histogram +the data(!). + +Usage: apercentileofscore(inarray,score,histbins=10,defaultlimits=None) +Returns: percentile-position of score (0-100) relative to inarray +""" + h, lrl, binsize, extras = histogram(inarray,histbins,defaultlimits) + cumhist = cumsum(h*1) + i = int((score - lrl)/float(binsize)) + pct = (cumhist[i-1]+((score-(lrl+binsize*i))/float(binsize))*h[i])/float(len(inarray)) * 100 + return pct + + + def ahistogram (inarray,numbins=10,defaultlimits=None,printextras=1): + """ +Returns (i) an array of histogram bin counts, (ii) the smallest value +of the histogram binning, and (iii) the bin width (the last 2 are not +necessarily integers). Default number of bins is 10. Defaultlimits +can be None (the routine picks bins spanning all the numbers in the +inarray) or a 2-sequence (lowerlimit, upperlimit). Returns all of the +following: array of bin values, lowerreallimit, binsize, extrapoints. + +Usage: ahistogram(inarray,numbins=10,defaultlimits=None,printextras=1) +Returns: (array of bin counts, bin-minimum, min-width, #-points-outside-range) +""" + inarray = N.ravel(inarray) # flatten any >1D arrays + if (defaultlimits <> None): + lowerreallimit = defaultlimits[0] + upperreallimit = defaultlimits[1] + binsize = (upperreallimit-lowerreallimit) / float(numbins) + else: + Min = N.minimum.reduce(inarray) + Max = N.maximum.reduce(inarray) + estbinwidth = float(Max - Min)/float(numbins) + 1 + binsize = (Max-Min+estbinwidth)/float(numbins) + lowerreallimit = Min - binsize/2.0 #lower real limit,1st bin + bins = N.zeros(numbins) + extrapoints = 0 + for num in inarray: + try: + if (num-lowerreallimit) < 0: + extrapoints = extrapoints + 1 + else: + bintoincrement = int((num-lowerreallimit) / float(binsize)) + bins[bintoincrement] = bins[bintoincrement] + 1 + except: # point outside lower/upper limits + extrapoints = extrapoints + 1 + if (extrapoints > 0 and printextras == 1): + print '\nPoints outside given histogram range =',extrapoints + return (bins, lowerreallimit, binsize, extrapoints) + + + def acumfreq(a,numbins=10,defaultreallimits=None): + """ +Returns a cumulative frequency histogram, using the histogram function. +Defaultreallimits can be None (use all data), or a 2-sequence containing +lower and upper limits on values to include. + +Usage: acumfreq(a,numbins=10,defaultreallimits=None) +Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints +""" + h,l,b,e = histogram(a,numbins,defaultreallimits) + cumhist = cumsum(h*1) + return cumhist,l,b,e + + + def arelfreq(a,numbins=10,defaultreallimits=None): + """ +Returns a relative frequency histogram, using the histogram function. +Defaultreallimits can be None (use all data), or a 2-sequence containing +lower and upper limits on values to include. + +Usage: arelfreq(a,numbins=10,defaultreallimits=None) +Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints +""" + h,l,b,e = histogram(a,numbins,defaultreallimits) + h = N.array(h/float(a.shape[0])) + return h,l,b,e + + +##################################### +###### AVARIABILITY FUNCTIONS ##### +##################################### + + def aobrientransform(*args): + """ +Computes a transform on input data (any number of columns). Used to +test for homogeneity of variance prior to running one-way stats. Each +array in *args is one level of a factor. If an F_oneway() run on the +transformed data and found significant, variances are unequal. From +Maxwell and Delaney, p.112. + +Usage: aobrientransform(*args) *args = 1D arrays, one per level of factor +Returns: transformed data for use in an ANOVA +""" + TINY = 1e-10 + k = len(args) + n = N.zeros(k,N.Float) + v = N.zeros(k,N.Float) + m = N.zeros(k,N.Float) + nargs = [] + for i in range(k): + nargs.append(args[i].astype(N.Float)) + n[i] = float(len(nargs[i])) + v[i] = var(nargs[i]) + m[i] = mean(nargs[i]) + for j in range(k): + for i in range(n[j]): + t1 = (n[j]-1.5)*n[j]*(nargs[j][i]-m[j])**2 + t2 = 0.5*v[j]*(n[j]-1.0) + t3 = (n[j]-1.0)*(n[j]-2.0) + nargs[j][i] = (t1-t2) / float(t3) + check = 1 + for j in range(k): + if v[j] - mean(nargs[j]) > TINY: + check = 0 + if check <> 1: + raise ValueError, 'Lack of convergence in obrientransform.' + else: + return N.array(nargs) + + + def asamplevar (inarray,dimension=None,keepdims=0): + """ +Returns the sample standard deviation of the values in the passed +array (i.e., using N). Dimension can equal None (ravel array first), +an integer (the dimension over which to operate), or a sequence +(operate over multiple dimensions). Set keepdims=1 to return an array +with the same number of dimensions as inarray. + +Usage: asamplevar(inarray,dimension=None,keepdims=0) +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + if dimension == 1: + mn = amean(inarray,dimension)[:,N.NewAxis] + else: + mn = amean(inarray,dimension,keepdims=1) + deviations = inarray - mn + if type(dimension) == ListType: + n = 1 + for d in dimension: + n = n*inarray.shape[d] + else: + n = inarray.shape[dimension] + svar = ass(deviations,dimension,keepdims) / float(n) + return svar + + + def asamplestdev (inarray, dimension=None, keepdims=0): + """ +Returns the sample standard deviation of the values in the passed +array (i.e., using N). Dimension can equal None (ravel array first), +an integer (the dimension over which to operate), or a sequence +(operate over multiple dimensions). Set keepdims=1 to return an array +with the same number of dimensions as inarray. + +Usage: asamplestdev(inarray,dimension=None,keepdims=0) +""" + return N.sqrt(asamplevar(inarray,dimension,keepdims)) + + + def asignaltonoise(instack,dimension=0): + """ +Calculates signal-to-noise. Dimension can equal None (ravel array +first), an integer (the dimension over which to operate), or a +sequence (operate over multiple dimensions). + +Usage: asignaltonoise(instack,dimension=0): +Returns: array containing the value of (mean/stdev) along dimension, + or 0 when stdev=0 +""" + m = mean(instack,dimension) + sd = stdev(instack,dimension) + return N.where(N.equal(sd,0),0,m/sd) + + + def avar (inarray, dimension=None,keepdims=0): + """ +Returns the estimated population variance of the values in the passed +array (i.e., N-1). Dimension can equal None (ravel array first), an +integer (the dimension over which to operate), or a sequence (operate +over multiple dimensions). Set keepdims=1 to return an array with the +same number of dimensions as inarray. + +Usage: avar(inarray,dimension=None,keepdims=0) +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + mn = amean(inarray,dimension,1) + deviations = inarray - mn + if type(dimension) == ListType: + n = 1 + for d in dimension: + n = n*inarray.shape[d] + else: + n = inarray.shape[dimension] + var = ass(deviations,dimension,keepdims)/float(n-1) + return var + + + def astdev (inarray, dimension=None, keepdims=0): + """ +Returns the estimated population standard deviation of the values in +the passed array (i.e., N-1). Dimension can equal None (ravel array +first), an integer (the dimension over which to operate), or a +sequence (operate over multiple dimensions). Set keepdims=1 to return +an array with the same number of dimensions as inarray. + +Usage: astdev(inarray,dimension=None,keepdims=0) +""" + return N.sqrt(avar(inarray,dimension,keepdims)) + + + def asterr (inarray, dimension=None, keepdims=0): + """ +Returns the estimated population standard error of the values in the +passed array (i.e., N-1). Dimension can equal None (ravel array +first), an integer (the dimension over which to operate), or a +sequence (operate over multiple dimensions). Set keepdims=1 to return +an array with the same number of dimensions as inarray. + +Usage: asterr(inarray,dimension=None,keepdims=0) +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + return astdev(inarray,dimension,keepdims) / float(N.sqrt(inarray.shape[dimension])) + + + def asem (inarray, dimension=None, keepdims=0): + """ +Returns the standard error of the mean (i.e., using N) of the values +in the passed array. Dimension can equal None (ravel array first), an +integer (the dimension over which to operate), or a sequence (operate +over multiple dimensions). Set keepdims=1 to return an array with the +same number of dimensions as inarray. + +Usage: asem(inarray,dimension=None, keepdims=0) +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + if type(dimension) == ListType: + n = 1 + for d in dimension: + n = n*inarray.shape[d] + else: + n = inarray.shape[dimension] + s = asamplestdev(inarray,dimension,keepdims) / N.sqrt(n-1) + return s + + + def az (a, score): + """ +Returns the z-score of a given input score, given thearray from which +that score came. Not appropriate for population calculations, nor for +arrays > 1D. + +Usage: az(a, score) +""" + z = (score-amean(a)) / asamplestdev(a) + return z + + + def azs (a): + """ +Returns a 1D array of z-scores, one for each score in the passed array, +computed relative to the passed array. + +Usage: azs(a) +""" + zscores = [] + for item in a: + zscores.append(z(a,item)) + return N.array(zscores) + + + def azmap (scores, compare, dimension=0): + """ +Returns an array of z-scores the shape of scores (e.g., [x,y]), compared to +array passed to compare (e.g., [time,x,y]). Assumes collapsing over dim 0 +of the compare array. + +Usage: azs(scores, compare, dimension=0) +""" + mns = amean(compare,dimension) + sstd = asamplestdev(compare,0) + return (scores - mns) / sstd + + +##################################### +####### ATRIMMING FUNCTIONS ####### +##################################### + + def around(a,digits=1): + """ +Rounds all values in array a to 'digits' decimal places. + +Usage: around(a,digits) +Returns: a, where each value is rounded to 'digits' decimals +""" + def ar(x,d=digits): + return round(x,d) + + if type(a) <> N.ArrayType: + try: + a = N.array(a) + except: + a = N.array(a,'O') + shp = a.shape + if a.typecode() in ['f','F','d','D']: + b = N.ravel(a) + b = N.array(map(ar,b)) + b.shape = shp + elif a.typecode() in ['o','O']: + b = N.ravel(a)*1 + for i in range(len(b)): + if type(b[i]) == FloatType: + b[i] = round(b[i],digits) + b.shape = shp + else: # not a float, double or Object array + b = a*1 + return b + + + def athreshold(a,threshmin=None,threshmax=None,newval=0): + """ +Like Numeric.clip() except that values threshmax are replaced +by newval instead of by threshmin/threshmax (respectively). + +Usage: athreshold(a,threshmin=None,threshmax=None,newval=0) +Returns: a, with values threshmax replaced with newval +""" + mask = N.zeros(a.shape) + if threshmin <> None: + mask = mask + N.where(N.less(a,threshmin),1,0) + if threshmax <> None: + mask = mask + N.where(N.greater(a,threshmax),1,0) + mask = N.clip(mask,0,1) + return N.where(mask,newval,a) + + + def atrimboth (a,proportiontocut): + """ +Slices off the passed proportion of items from BOTH ends of the passed +array (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND +'rightmost' 10% of scores. You must pre-sort the array if you want +"proper" trimming. Slices off LESS if proportion results in a +non-integer slice index (i.e., conservatively slices off +proportiontocut). + +Usage: atrimboth (a,proportiontocut) +Returns: trimmed version of array a +""" + lowercut = int(proportiontocut*len(a)) + uppercut = len(a) - lowercut + return a[lowercut:uppercut] + + + def atrim1 (a,proportiontocut,tail='right'): + """ +Slices off the passed proportion of items from ONE end of the passed +array (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' +10% of scores). Slices off LESS if proportion results in a non-integer +slice index (i.e., conservatively slices off proportiontocut). + +Usage: atrim1(a,proportiontocut,tail='right') or set tail='left' +Returns: trimmed version of array a +""" + if string.lower(tail) == 'right': + lowercut = 0 + uppercut = len(a) - int(proportiontocut*len(a)) + elif string.lower(tail) == 'left': + lowercut = int(proportiontocut*len(a)) + uppercut = len(a) + return a[lowercut:uppercut] + + +##################################### +##### ACORRELATION FUNCTIONS ###### +##################################### + + def acovariance(X): + """ +Computes the covariance matrix of a matrix X. Requires a 2D matrix input. + +Usage: acovariance(X) +Returns: covariance matrix of X +""" + if len(X.shape) <> 2: + raise TypeError, "acovariance requires 2D matrices" + n = X.shape[0] + mX = amean(X,0) + return N.dot(N.transpose(X),X) / float(n) - N.multiply.outer(mX,mX) + + + def acorrelation(X): + """ +Computes the correlation matrix of a matrix X. Requires a 2D matrix input. + +Usage: acorrelation(X) +Returns: correlation matrix of X +""" + C = acovariance(X) + V = N.diagonal(C) + return C / N.sqrt(N.multiply.outer(V,V)) + + + def apaired(x,y): + """ +Interactively determines the type of data in x and y, and then runs the +appropriated statistic for paired group data. + +Usage: apaired(x,y) x,y = the two arrays of values to be compared +Returns: appropriate statistic name, value, and probability +""" + samples = '' + while samples not in ['i','r','I','R','c','C']: + print '\nIndependent or related samples, or correlation (i,r,c): ', + samples = raw_input() + + if samples in ['i','I','r','R']: + print '\nComparing variances ...', +# USE O'BRIEN'S TEST FOR HOMOGENEITY OF VARIANCE, Maxwell & delaney, p.112 + r = obrientransform(x,y) + f,p = F_oneway(pstat.colex(r,0),pstat.colex(r,1)) + if p<0.05: + vartype='unequal, p='+str(round(p,4)) + else: + vartype='equal' + print vartype + if samples in ['i','I']: + if vartype[0]=='e': + t,p = ttest_ind(x,y,None,0) + print '\nIndependent samples t-test: ', round(t,4),round(p,4) + else: + if len(x)>20 or len(y)>20: + z,p = ranksums(x,y) + print '\nRank Sums test (NONparametric, n>20): ', round(z,4),round(p,4) + else: + u,p = mannwhitneyu(x,y) + print '\nMann-Whitney U-test (NONparametric, ns<20): ', round(u,4),round(p,4) + + else: # RELATED SAMPLES + if vartype[0]=='e': + t,p = ttest_rel(x,y,0) + print '\nRelated samples t-test: ', round(t,4),round(p,4) + else: + t,p = ranksums(x,y) + print '\nWilcoxon T-test (NONparametric): ', round(t,4),round(p,4) + else: # CORRELATION ANALYSIS + corrtype = '' + while corrtype not in ['c','C','r','R','d','D']: + print '\nIs the data Continuous, Ranked, or Dichotomous (c,r,d): ', + corrtype = raw_input() + if corrtype in ['c','C']: + m,b,r,p,see = linregress(x,y) + print '\nLinear regression for continuous variables ...' + lol = [['Slope','Intercept','r','Prob','SEestimate'],[round(m,4),round(b,4),round(r,4),round(p,4),round(see,4)]] + pstat.printcc(lol) + elif corrtype in ['r','R']: + r,p = spearmanr(x,y) + print '\nCorrelation for ranked variables ...' + print "Spearman's r: ",round(r,4),round(p,4) + else: # DICHOTOMOUS + r,p = pointbiserialr(x,y) + print '\nAssuming x contains a dichotomous variable ...' + print 'Point Biserial r: ',round(r,4),round(p,4) + print '\n\n' + return None + + + def apearsonr(x,y,verbose=1): + """ +Calculates a Pearson correlation coefficient and returns p. Taken +from Heiman's Basic Statistics for the Behav. Sci (2nd), p.195. + +Usage: apearsonr(x,y,verbose=1) where x,y are equal length arrays +Returns: Pearson's r, two-tailed p-value +""" + TINY = 1.0e-20 + n = len(x) + xmean = amean(x) + ymean = amean(y) + r_num = n*(N.add.reduce(x*y)) - N.add.reduce(x)*N.add.reduce(y) + r_den = math.sqrt((n*ass(x) - asquare_of_sums(x))*(n*ass(y)-asquare_of_sums(y))) + r = (r_num / r_den) + df = n-2 + t = r*math.sqrt(df/((1.0-r+TINY)*(1.0+r+TINY))) + prob = abetai(0.5*df,0.5,df/(df+t*t),verbose) + return r,prob + + + def aspearmanr(x,y): + """ +Calculates a Spearman rank-order correlation coefficient. Taken +from Heiman's Basic Statistics for the Behav. Sci (1st), p.192. + +Usage: aspearmanr(x,y) where x,y are equal-length arrays +Returns: Spearman's r, two-tailed p-value +""" + TINY = 1e-30 + n = len(x) + rankx = rankdata(x) + ranky = rankdata(y) + dsq = N.add.reduce((rankx-ranky)**2) + rs = 1 - 6*dsq / float(n*(n**2-1)) + t = rs * math.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + df = n-2 + probrs = abetai(0.5*df,0.5,df/(df+t*t)) +# probability values for rs are from part 2 of the spearman function in +# Numerical Recipies, p.510. They close to tables, but not exact.(?) + return rs, probrs + + + def apointbiserialr(x,y): + """ +Calculates a point-biserial correlation coefficient and the associated +probability value. Taken from Heiman's Basic Statistics for the Behav. +Sci (1st), p.194. + +Usage: apointbiserialr(x,y) where x,y are equal length arrays +Returns: Point-biserial r, two-tailed p-value +""" + TINY = 1e-30 + categories = pstat.aunique(x) + data = pstat.aabut(x,y) + if len(categories) <> 2: + raise ValueError, "Exactly 2 categories required (in x) for pointbiserialr()." + else: # there are 2 categories, continue + codemap = pstat.aabut(categories,N.arange(2)) + recoded = pstat.arecode(data,codemap,0) + x = pstat.alinexand(data,0,categories[0]) + y = pstat.alinexand(data,0,categories[1]) + xmean = amean(pstat.acolex(x,1)) + ymean = amean(pstat.acolex(y,1)) + n = len(data) + adjust = math.sqrt((len(x)/float(n))*(len(y)/float(n))) + rpb = (ymean - xmean)/asamplestdev(pstat.acolex(data,1))*adjust + df = n-2 + t = rpb*math.sqrt(df/((1.0-rpb+TINY)*(1.0+rpb+TINY))) + prob = abetai(0.5*df,0.5,df/(df+t*t)) + return rpb, prob + + + def akendalltau(x,y): + """ +Calculates Kendall's tau ... correlation of ordinal data. Adapted +from function kendl1 in Numerical Recipies. Needs good test-cases.@@@ + +Usage: akendalltau(x,y) +Returns: Kendall's tau, two-tailed p-value +""" + n1 = 0 + n2 = 0 + iss = 0 + for j in range(len(x)-1): + for k in range(j,len(y)): + a1 = x[j] - x[k] + a2 = y[j] - y[k] + aa = a1 * a2 + if (aa): # neither array has a tie + n1 = n1 + 1 + n2 = n2 + 1 + if aa > 0: + iss = iss + 1 + else: + iss = iss -1 + else: + if (a1): + n1 = n1 + 1 + else: + n2 = n2 + 1 + tau = iss / math.sqrt(n1*n2) + svar = (4.0*len(x)+10.0) / (9.0*len(x)*(len(x)-1)) + z = tau / math.sqrt(svar) + prob = erfcc(abs(z)/1.4142136) + return tau, prob + + + def alinregress(*args): + """ +Calculates a regression line on two arrays, x and y, corresponding to x,y +pairs. If a single 2D array is passed, alinregress finds dim with 2 levels +and splits data into x,y pairs along that dim. + +Usage: alinregress(*args) args=2 equal-length arrays, or one 2D array +Returns: slope, intercept, r, two-tailed prob, sterr-of-the-estimate +""" + TINY = 1.0e-20 + if len(args) == 1: # more than 1D array? + args = args[0] + if len(args) == 2: + x = args[0] + y = args[1] + else: + x = args[:,0] + y = args[:,1] + else: + x = args[0] + y = args[1] + n = len(x) + xmean = amean(x) + ymean = amean(y) + r_num = n*(N.add.reduce(x*y)) - N.add.reduce(x)*N.add.reduce(y) + r_den = math.sqrt((n*ass(x) - asquare_of_sums(x))*(n*ass(y)-asquare_of_sums(y))) + r = r_num / r_den + z = 0.5*math.log((1.0+r+TINY)/(1.0-r+TINY)) + df = n-2 + t = r*math.sqrt(df/((1.0-r+TINY)*(1.0+r+TINY))) + prob = abetai(0.5*df,0.5,df/(df+t*t)) + slope = r_num / (float(n)*ass(x) - asquare_of_sums(x)) + intercept = ymean - slope*xmean + sterrest = math.sqrt(1-r*r)*asamplestdev(y) + return slope, intercept, r, prob, sterrest + + +##################################### +##### AINFERENTIAL STATISTICS ##### +##################################### + + def attest_1samp(a,popmean,printit=0,name='Sample',writemode='a'): + """ +Calculates the t-obtained for the independent samples T-test on ONE group +of scores a, given a population mean. If printit=1, results are printed +to the screen. If printit='filename', the results are output to 'filename' +using the given writemode (default=append). Returns t-value, and prob. + +Usage: attest_1samp(a,popmean,Name='Sample',printit=0,writemode='a') +Returns: t-value, two-tailed prob +""" + if type(a) != N.ArrayType: + a = N.array(a) + x = amean(a) + v = avar(a) + n = len(a) + df = n-1 + svar = ((n-1)*v) / float(df) + t = (x-popmean)/math.sqrt(svar*(1.0/n)) + prob = abetai(0.5*df,0.5,df/(df+t*t)) + + if printit <> 0: + statname = 'Single-sample T-test.' + outputpairedstats(printit,writemode, + 'Population','--',popmean,0,0,0, + name,n,x,v,N.minimum.reduce(N.ravel(a)), + N.maximum.reduce(N.ravel(a)), + statname,t,prob) + return t,prob + + + def attest_ind (a, b, dimension=None, printit=0, name1='Samp1', name2='Samp2',writemode='a'): + """ +Calculates the t-obtained T-test on TWO INDEPENDENT samples of scores +a, and b. From Numerical Recipies, p.483. If printit=1, results are +printed to the screen. If printit='filename', the results are output +to 'filename' using the given writemode (default=append). Dimension +can equal None (ravel array first), or an integer (the dimension over +which to operate on a and b). + +Usage: attest_ind (a,b,dimension=None,printit=0, + Name1='Samp1',Name2='Samp2',writemode='a') +Returns: t-value, two-tailed p-value +""" + if dimension == None: + a = N.ravel(a) + b = N.ravel(b) + dimension = 0 + x1 = amean(a,dimension) + x2 = amean(b,dimension) + v1 = avar(a,dimension) + v2 = avar(b,dimension) + n1 = a.shape[dimension] + n2 = b.shape[dimension] + df = n1+n2-2 + svar = ((n1-1)*v1+(n2-1)*v2) / float(df) + zerodivproblem = N.equal(svar,0) + svar = N.where(zerodivproblem,1,svar) # avoid zero-division in 1st place + t = (x1-x2)/N.sqrt(svar*(1.0/n1 + 1.0/n2)) # N-D COMPUTATION HERE!!!!!! + t = N.where(zerodivproblem,1.0,t) # replace NaN/wrong t-values with 1.0 + probs = abetai(0.5*df,0.5,float(df)/(df+t*t)) + + if type(t) == N.ArrayType: + probs = N.reshape(probs,t.shape) + if len(probs) == 1: + probs = probs[0] + + if printit <> 0: + if type(t) == N.ArrayType: + t = t[0] + if type(probs) == N.ArrayType: + probs = probs[0] + statname = 'Independent samples T-test.' + outputpairedstats(printit,writemode, + name1,n1,x1,v1,N.minimum.reduce(N.ravel(a)), + N.maximum.reduce(N.ravel(a)), + name2,n2,x2,v2,N.minimum.reduce(N.ravel(b)), + N.maximum.reduce(N.ravel(b)), + statname,t,probs) + return + return t, probs + + + def attest_rel (a,b,dimension=None,printit=0,name1='Samp1',name2='Samp2',writemode='a'): + """ +Calculates the t-obtained T-test on TWO RELATED samples of scores, a +and b. From Numerical Recipies, p.483. If printit=1, results are +printed to the screen. If printit='filename', the results are output +to 'filename' using the given writemode (default=append). Dimension +can equal None (ravel array first), or an integer (the dimension over +which to operate on a and b). + +Usage: attest_rel(a,b,dimension=None,printit=0, + name1='Samp1',name2='Samp2',writemode='a') +Returns: t-value, two-tailed p-value +""" + if dimension == None: + a = N.ravel(a) + b = N.ravel(b) + dimension = 0 + if len(a)<>len(b): + raise ValueError, 'Unequal length arrays.' + x1 = amean(a,dimension) + x2 = amean(b,dimension) + v1 = avar(a,dimension) + v2 = avar(b,dimension) + n = a.shape[dimension] + df = float(n-1) + d = (a-b).astype('d') + + denom = N.sqrt((n*N.add.reduce(d*d,dimension) - N.add.reduce(d,dimension)**2) /df) + zerodivproblem = N.equal(denom,0) + denom = N.where(zerodivproblem,1,denom) # avoid zero-division in 1st place + t = N.add.reduce(d,dimension) / denom # N-D COMPUTATION HERE!!!!!! + t = N.where(zerodivproblem,1.0,t) # replace NaN/wrong t-values with 1.0 + probs = abetai(0.5*df,0.5,float(df)/(df+t*t)) + if type(t) == N.ArrayType: + probs = N.reshape(probs,t.shape) + if len(probs) == 1: + probs = probs[0] + + if printit <> 0: + statname = 'Related samples T-test.' + outputpairedstats(printit,writemode, + name1,n,x1,v1,N.minimum.reduce(N.ravel(a)), + N.maximum.reduce(N.ravel(a)), + name2,n,x2,v2,N.minimum.reduce(N.ravel(b)), + N.maximum.reduce(N.ravel(b)), + statname,t,probs) + return + return t, probs + + + def achisquare(f_obs,f_exp=None): + """ +Calculates a one-way chi square for array of observed frequencies and returns +the result. If no expected frequencies are given, the total N is assumed to +be equally distributed across all groups. + +Usage: achisquare(f_obs, f_exp=None) f_obs = array of observed cell freq. +Returns: chisquare-statistic, associated p-value +""" + + k = len(f_obs) + if f_exp == None: + f_exp = N.array([sum(f_obs)/float(k)] * len(f_obs),N.Float) + f_exp = f_exp.astype(N.Float) + chisq = N.add.reduce((f_obs-f_exp)**2 / f_exp) + return chisq, chisqprob(chisq, k-1) + + + def aks_2samp (data1,data2): + """ +Computes the Kolmogorov-Smirnof statistic on 2 samples. Modified from +Numerical Recipies in C, page 493. Returns KS D-value, prob. Not ufunc- +like. + +Usage: aks_2samp(data1,data2) where data1 and data2 are 1D arrays +Returns: KS D-value, p-value +""" + j1 = 0 # N.zeros(data1.shape[1:]) TRIED TO MAKE THIS UFUNC-LIKE + j2 = 0 # N.zeros(data2.shape[1:]) + fn1 = 0.0 # N.zeros(data1.shape[1:],N.Float) + fn2 = 0.0 # N.zeros(data2.shape[1:],N.Float) + n1 = data1.shape[0] + n2 = data2.shape[0] + en1 = n1*1 + en2 = n2*1 + d = N.zeros(data1.shape[1:],N.Float) + data1 = N.sort(data1,0) + data2 = N.sort(data2,0) + while j1 < n1 and j2 < n2: + d1=data1[j1] + d2=data2[j2] + if d1 <= d2: + fn1 = (j1)/float(en1) + j1 = j1 + 1 + if d2 <= d1: + fn2 = (j2)/float(en2) + j2 = j2 + 1 + dt = (fn2-fn1) + if abs(dt) > abs(d): + d = dt + try: + en = math.sqrt(en1*en2/float(en1+en2)) + prob = aksprob((en+0.12+0.11/en)*N.fabs(d)) + except: + prob = 1.0 + return d, prob + + + def amannwhitneyu(x,y): + """ +Calculates a Mann-Whitney U statistic on the provided scores and +returns the result. Use only when the n in each condition is < 20 and +you have 2 independent samples of ranks. REMEMBER: Mann-Whitney U is +significant if the u-obtained is LESS THAN or equal to the critical +value of U. + +Usage: amannwhitneyu(x,y) where x,y are arrays of values for 2 conditions +Returns: u-statistic, one-tailed p-value (i.e., p(z(U))) +""" + n1 = len(x) + n2 = len(y) + ranked = rankdata(N.concatenate((x,y))) + rankx = ranked[0:n1] # get the x-ranks + ranky = ranked[n1:] # the rest are y-ranks + u1 = n1*n2 + (n1*(n1+1))/2.0 - sum(rankx) # calc U for x + u2 = n1*n2 - u1 # remainder is U for y + bigu = max(u1,u2) + smallu = min(u1,u2) + T = math.sqrt(tiecorrect(ranked)) # correction factor for tied scores + if T == 0: + raise ValueError, 'All numbers are identical in amannwhitneyu' + sd = math.sqrt(T*n1*n2*(n1+n2+1)/12.0) + z = abs((bigu-n1*n2/2.0) / sd) # normal approximation for prob calc + return smallu, 1.0 - zprob(z) + + + def atiecorrect(rankvals): + """ +Tie-corrector for ties in Mann Whitney U and Kruskal Wallis H tests. +See Siegel, S. (1956) Nonparametric Statistics for the Behavioral +Sciences. New York: McGraw-Hill. Code adapted from |Stat rankind.c +code. + +Usage: atiecorrect(rankvals) +Returns: T correction factor for U or H +""" + sorted,posn = ashellsort(N.array(rankvals)) + n = len(sorted) + T = 0.0 + i = 0 + while (i len(y): + raise ValueError, 'Unequal N in awilcoxont. Aborting.' + d = x-y + d = N.compress(N.not_equal(d,0),d) # Keep all non-zero differences + count = len(d) + absd = abs(d) + absranked = arankdata(absd) + r_plus = 0.0 + r_minus = 0.0 + for i in range(len(absd)): + if d[i] < 0: + r_minus = r_minus + absranked[i] + else: + r_plus = r_plus + absranked[i] + wt = min(r_plus, r_minus) + mn = count * (count+1) * 0.25 + se = math.sqrt(count*(count+1)*(2.0*count+1.0)/24.0) + z = math.fabs(wt-mn) / se + z = math.fabs(wt-mn) / se + prob = 2*(1.0 -zprob(abs(z))) + return wt, prob + + + def akruskalwallish(*args): + """ +The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more +groups, requiring at least 5 subjects in each group. This function +calculates the Kruskal-Wallis H and associated p-value for 3 or more +independent samples. + +Usage: akruskalwallish(*args) args are separate arrays for 3+ conditions +Returns: H-statistic (corrected for ties), associated p-value +""" + assert len(args) == 3, "Need at least 3 groups in stats.akruskalwallish()" + args = list(args) + n = [0]*len(args) + n = map(len,args) + all = [] + for i in range(len(args)): + all = all + args[i].tolist() + ranked = rankdata(all) + T = tiecorrect(ranked) + for i in range(len(args)): + args[i] = ranked[0:n[i]] + del ranked[0:n[i]] + rsums = [] + for i in range(len(args)): + rsums.append(sum(args[i])**2) + rsums[i] = rsums[i] / float(n[i]) + ssbn = sum(rsums) + totaln = sum(n) + h = 12.0 / (totaln*(totaln+1)) * ssbn - 3*(totaln+1) + df = len(args) - 1 + if T == 0: + raise ValueError, 'All numbers are identical in akruskalwallish' + h = h / float(T) + return h, chisqprob(h,df) + + + def afriedmanchisquare(*args): + """ +Friedman Chi-Square is a non-parametric, one-way within-subjects +ANOVA. This function calculates the Friedman Chi-square test for +repeated measures and returns the result, along with the associated +probability value. It assumes 3 or more repeated measures. Only 3 +levels requires a minimum of 10 subjects in the study. Four levels +requires 5 subjects per level(??). + +Usage: afriedmanchisquare(*args) args are separate arrays for 2+ conditions +Returns: chi-square statistic, associated p-value +""" + k = len(args) + if k < 3: + raise ValueError, '\nLess than 3 levels. Friedman test not appropriate.\n' + n = len(args[0]) + data = apply(pstat.aabut,args) + data = data.astype(N.Float) + for i in range(len(data)): + data[i] = arankdata(data[i]) + ssbn = asum(asum(args,1)**2) + chisq = 12.0 / (k*n*(k+1)) * ssbn - 3*n*(k+1) + return chisq, chisqprob(chisq,k-1) + + +##################################### +#### APROBABILITY CALCULATIONS #### +##################################### + + def achisqprob(chisq,df): + """ +Returns the (1-tail) probability value associated with the provided chi-square +value and df. Heavily modified from chisq.c in Gary Perlman's |Stat. Can +handle multiple dimensions. + +Usage: achisqprob(chisq,df) chisq=chisquare stat., df=degrees of freedom +""" + BIG = 200.0 + def ex(x): + BIG = 200.0 + exponents = N.where(N.less(x,-BIG),-BIG,x) + return N.exp(exponents) + + if type(chisq) == N.ArrayType: + arrayflag = 1 + else: + arrayflag = 0 + chisq = N.array([chisq]) + if df < 1: + return N.ones(chisq.shape,N.float) + probs = N.zeros(chisq.shape,N.Float) + probs = N.where(N.less_equal(chisq,0),1.0,probs) # set prob=1 for chisq<0 + a = 0.5 * chisq + if df > 1: + y = ex(-a) + if df%2 == 0: + even = 1 + s = y*1 + s2 = s*1 + else: + even = 0 + s = 2.0 * azprob(-N.sqrt(chisq)) + s2 = s*1 + if (df > 2): + chisq = 0.5 * (df - 1.0) + if even: + z = N.ones(probs.shape,N.Float) + else: + z = 0.5 *N.ones(probs.shape,N.Float) + if even: + e = N.zeros(probs.shape,N.Float) + else: + e = N.log(N.sqrt(N.pi)) *N.ones(probs.shape,N.Float) + c = N.log(a) + mask = N.zeros(probs.shape) + a_big = N.greater(a,BIG) + a_big_frozen = -1 *N.ones(probs.shape,N.Float) + totalelements = N.multiply.reduce(N.array(probs.shape)) + while asum(mask)<>totalelements: + e = N.log(z) + e + s = s + ex(c*z-a-e) + z = z + 1.0 +# print z, e, s + newmask = N.greater(z,chisq) + a_big_frozen = N.where(newmask*N.equal(mask,0)*a_big, s, a_big_frozen) + mask = N.clip(newmask+mask,0,1) + if even: + z = N.ones(probs.shape,N.Float) + e = N.ones(probs.shape,N.Float) + else: + z = 0.5 *N.ones(probs.shape,N.Float) + e = 1.0 / N.sqrt(N.pi) / N.sqrt(a) * N.ones(probs.shape,N.Float) + c = 0.0 + mask = N.zeros(probs.shape) + a_notbig_frozen = -1 *N.ones(probs.shape,N.Float) + while asum(mask)<>totalelements: + e = e * (a/z.astype(N.Float)) + c = c + e + z = z + 1.0 +# print '#2', z, e, c, s, c*y+s2 + newmask = N.greater(z,chisq) + a_notbig_frozen = N.where(newmask*N.equal(mask,0)*(1-a_big), + c*y+s2, a_notbig_frozen) + mask = N.clip(newmask+mask,0,1) + probs = N.where(N.equal(probs,1),1, + N.where(N.greater(a,BIG),a_big_frozen,a_notbig_frozen)) + return probs + else: + return s + + + def aerfcc(x): + """ +Returns the complementary error function erfc(x) with fractional error +everywhere less than 1.2e-7. Adapted from Numerical Recipies. Can +handle multiple dimensions. + +Usage: aerfcc(x) +""" + z = abs(x) + t = 1.0 / (1.0+0.5*z) + ans = t * N.exp(-z*z-1.26551223 + t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277))))))))) + return N.where(N.greater_equal(x,0), ans, 2.0-ans) + + + def azprob(z): + """ +Returns the area under the normal curve 'to the left of' the given z value. +Thus, + for z<0, zprob(z) = 1-tail probability + for z>0, 1.0-zprob(z) = 1-tail probability + for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability +Adapted from z.c in Gary Perlman's |Stat. Can handle multiple dimensions. + +Usage: azprob(z) where z is a z-value +""" + def yfunc(y): + x = (((((((((((((-0.000045255659 * y + +0.000152529290) * y -0.000019538132) * y + -0.000676904986) * y +0.001390604284) * y + -0.000794620820) * y -0.002034254874) * y + +0.006549791214) * y -0.010557625006) * y + +0.011630447319) * y -0.009279453341) * y + +0.005353579108) * y -0.002141268741) * y + +0.000535310849) * y +0.999936657524 + return x + + def wfunc(w): + x = ((((((((0.000124818987 * w + -0.001075204047) * w +0.005198775019) * w + -0.019198292004) * w +0.059054035642) * w + -0.151968751364) * w +0.319152932694) * w + -0.531923007300) * w +0.797884560593) * N.sqrt(w) * 2.0 + return x + + Z_MAX = 6.0 # maximum meaningful z-value + x = N.zeros(z.shape,N.Float) # initialize + y = 0.5 * N.fabs(z) + x = N.where(N.less(y,1.0),wfunc(y*y),yfunc(y-2.0)) # get x's + x = N.where(N.greater(y,Z_MAX*0.5),1.0,x) # kill those with big Z + prob = N.where(N.greater(z,0),(x+1)*0.5,(1-x)*0.5) + return prob + + + def aksprob(alam): + """ +Returns the probability value for a K-S statistic computed via ks_2samp. +Adapted from Numerical Recipies. Can handle multiple dimensions. + +Usage: aksprob(alam) +""" + if type(alam) == N.ArrayType: + frozen = -1 *N.ones(alam.shape,N.Float64) + alam = alam.astype(N.Float64) + arrayflag = 1 + else: + frozen = N.array(-1.) + alam = N.array(alam,N.Float64) + mask = N.zeros(alam.shape) + fac = 2.0 *N.ones(alam.shape,N.Float) + sum = N.zeros(alam.shape,N.Float) + termbf = N.zeros(alam.shape,N.Float) + a2 = N.array(-2.0*alam*alam,N.Float64) + totalelements = N.multiply.reduce(N.array(mask.shape)) + for j in range(1,201): + if asum(mask) == totalelements: + break + exponents = (a2*j*j) + overflowmask = N.less(exponents,-746) + frozen = N.where(overflowmask,0,frozen) + mask = mask+overflowmask + term = fac*N.exp(exponents) + sum = sum + term + newmask = N.where(N.less_equal(abs(term),(0.001*termbf)) + + N.less(abs(term),1.0e-8*sum), 1, 0) + frozen = N.where(newmask*N.equal(mask,0), sum, frozen) + mask = N.clip(mask+newmask,0,1) + fac = -fac + termbf = abs(term) + if arrayflag: + return N.where(N.equal(frozen,-1), 1.0, frozen) # 1.0 if doesn't converge + else: + return N.where(N.equal(frozen,-1), 1.0, frozen)[0] # 1.0 if doesn't converge + + + def afprob (dfnum, dfden, F): + """ +Returns the 1-tailed significance level (p-value) of an F statistic +given the degrees of freedom for the numerator (dfR-dfF) and the degrees +of freedom for the denominator (dfF). Can handle multiple dims for F. + +Usage: afprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn +""" + if type(F) == N.ArrayType: + return abetai(0.5*dfden, 0.5*dfnum, dfden/(1.0*dfden+dfnum*F)) + else: + return abetai(0.5*dfden, 0.5*dfnum, dfden/float(dfden+dfnum*F)) + + + def abetacf(a,b,x,verbose=1): + """ +Evaluates the continued fraction form of the incomplete Beta function, +betai. (Adapted from: Numerical Recipies in C.) Can handle multiple +dimensions for x. + +Usage: abetacf(a,b,x,verbose=1) +""" + ITMAX = 200 + EPS = 3.0e-7 + + arrayflag = 1 + if type(x) == N.ArrayType: + frozen = N.ones(x.shape,N.Float) *-1 #start out w/ -1s, should replace all + else: + arrayflag = 0 + frozen = N.array([-1]) + x = N.array([x]) + mask = N.zeros(x.shape) + bm = az = am = 1.0 + qab = a+b + qap = a+1.0 + qam = a-1.0 + bz = 1.0-qab*x/qap + for i in range(ITMAX+1): + if N.sum(N.ravel(N.equal(frozen,-1)))==0: + break + em = float(i+1) + tem = em + em + d = em*(b-em)*x/((qam+tem)*(a+tem)) + ap = az + d*am + bp = bz+d*bm + d = -(a+em)*(qab+em)*x/((qap+tem)*(a+tem)) + app = ap+d*az + bpp = bp+d*bz + aold = az*1 + am = ap/bpp + bm = bp/bpp + az = app/bpp + bz = 1.0 + newmask = N.less(abs(az-aold),EPS*abs(az)) + frozen = N.where(newmask*N.equal(mask,0), az, frozen) + mask = N.clip(mask+newmask,0,1) + noconverge = asum(N.equal(frozen,-1)) + if noconverge <> 0 and verbose: + print 'a or b too big, or ITMAX too small in Betacf for ',noconverge,' elements' + if arrayflag: + return frozen + else: + return frozen[0] + + + def agammln(xx): + """ +Returns the gamma function of xx. + Gamma(z) = Integral(0,infinity) of t^(z-1)exp(-t) dt. +Adapted from: Numerical Recipies in C. Can handle multiple dims ... but +probably doesn't normally have to. + +Usage: agammln(xx) +""" + coeff = [76.18009173, -86.50532033, 24.01409822, -1.231739516, + 0.120858003e-2, -0.536382e-5] + x = xx - 1.0 + tmp = x + 5.5 + tmp = tmp - (x+0.5)*N.log(tmp) + ser = 1.0 + for j in range(len(coeff)): + x = x + 1 + ser = ser + coeff[j]/x + return -tmp + N.log(2.50662827465*ser) + + + def abetai(a,b,x,verbose=1): + """ +Returns the incomplete beta function: + + I-sub-x(a,b) = 1/B(a,b)*(Integral(0,x) of t^(a-1)(1-t)^(b-1) dt) + +where a,b>0 and B(a,b) = G(a)*G(b)/(G(a+b)) where G(a) is the gamma +function of a. The continued fraction formulation is implemented +here, using the betacf function. (Adapted from: Numerical Recipies in +C.) Can handle multiple dimensions. + +Usage: abetai(a,b,x,verbose=1) +""" + TINY = 1e-15 + if type(a) == N.ArrayType: + if asum(N.less(x,0)+N.greater(x,1)) <> 0: + raise ValueError, 'Bad x in abetai' + x = N.where(N.equal(x,0),TINY,x) + x = N.where(N.equal(x,1.0),1-TINY,x) + + bt = N.where(N.equal(x,0)+N.equal(x,1), 0, -1) + exponents = ( gammln(a+b)-gammln(a)-gammln(b)+a*N.log(x)+b* + N.log(1.0-x) ) + # 746 (below) is the MAX POSSIBLE BEFORE OVERFLOW + exponents = N.where(N.less(exponents,-740),-740,exponents) + bt = N.exp(exponents) + if type(x) == N.ArrayType: + ans = N.where(N.less(x,(a+1)/(a+b+2.0)), + bt*abetacf(a,b,x,verbose)/float(a), + 1.0-bt*abetacf(b,a,1.0-x,verbose)/float(b)) + else: + if x<(a+1)/(a+b+2.0): + ans = bt*abetacf(a,b,x,verbose)/float(a) + else: + ans = 1.0-bt*abetacf(b,a,1.0-x,verbose)/float(b) + return ans + + +##################################### +####### AANOVA CALCULATIONS ####### +##################################### + + import LinearAlgebra, operator + LA = LinearAlgebra + + def aglm(data,para): + """ +Calculates a linear model fit ... anova/ancova/lin-regress/t-test/etc. Taken +from: + Peterson et al. Statistical limitations in functional neuroimaging + I. Non-inferential methods and statistical models. Phil Trans Royal Soc + Lond B 354: 1239-1260. + +Usage: aglm(data,para) +Returns: statistic, p-value ??? +""" + if len(para) <> len(data): + print "data and para must be same length in aglm" + return + n = len(para) + p = pstat.aunique(para) + x = N.zeros((n,len(p))) # design matrix + for l in range(len(p)): + x[:,l] = N.equal(para,p[l]) + b = N.dot(N.dot(LA.inverse(N.dot(N.transpose(x),x)), # i.e., b=inv(X'X)X'Y + N.transpose(x)), + data) + diffs = (data - N.dot(x,b)) + s_sq = 1./(n-len(p)) * N.dot(N.transpose(diffs), diffs) + + if len(p) == 2: # ttest_ind + c = N.array([1,-1]) + df = n-2 + fact = asum(1.0/asum(x,0)) # i.e., 1/n1 + 1/n2 + 1/n3 ... + t = N.dot(c,b) / N.sqrt(s_sq*fact) + probs = abetai(0.5*df,0.5,float(df)/(df+t*t)) + return t, probs + + + def aF_oneway(*args): + """ +Performs a 1-way ANOVA, returning an F-value and probability given +any number of groups. From Heiman, pp.394-7. + +Usage: aF_oneway (*args) where *args is 2 or more arrays, one per + treatment group +Returns: f-value, probability +""" + na = len(args) # ANOVA on 'na' groups, each in it's own array + means = [0]*na + vars = [0]*na + ns = [0]*na + alldata = [] + tmp = map(N.array,args) + means = map(amean,tmp) + vars = map(avar,tmp) + ns = map(len,args) + alldata = N.concatenate(args) + bign = len(alldata) + sstot = ass(alldata)-(asquare_of_sums(alldata)/float(bign)) + ssbn = 0 + for a in args: + ssbn = ssbn + asquare_of_sums(N.array(a))/float(len(a)) + ssbn = ssbn - (asquare_of_sums(alldata)/float(bign)) + sswn = sstot-ssbn + dfbn = na-1 + dfwn = bign - na + msb = ssbn/float(dfbn) + msw = sswn/float(dfwn) + f = msb/msw + prob = fprob(dfbn,dfwn,f) + return f, prob + + + def aF_value (ER,EF,dfR,dfF): + """ +Returns an F-statistic given the following: + ER = error associated with the null hypothesis (the Restricted model) + EF = error associated with the alternate hypothesis (the Full model) + dfR = degrees of freedom the Restricted model + dfF = degrees of freedom associated with the Restricted model +""" + return ((ER-EF)/float(dfR-dfF) / (EF/float(dfF))) + + + def outputfstats(Enum, Eden, dfnum, dfden, f, prob): + Enum = round(Enum,3) + Eden = round(Eden,3) + dfnum = round(Enum,3) + dfden = round(dfden,3) + f = round(f,3) + prob = round(prob,3) + suffix = '' # for *s after the p-value + if prob < 0.001: suffix = ' ***' + elif prob < 0.01: suffix = ' **' + elif prob < 0.05: suffix = ' *' + title = [['EF/ER','DF','Mean Square','F-value','prob','']] + lofl = title+[[Enum, dfnum, round(Enum/float(dfnum),3), f, prob, suffix], + [Eden, dfden, round(Eden/float(dfden),3),'','','']] + pstat.printcc(lofl) + return + + + def F_value_multivariate(ER, EF, dfnum, dfden): + """ +Returns an F-statistic given the following: + ER = error associated with the null hypothesis (the Restricted model) + EF = error associated with the alternate hypothesis (the Full model) + dfR = degrees of freedom the Restricted model + dfF = degrees of freedom associated with the Restricted model +where ER and EF are matrices from a multivariate F calculation. +""" + if type(ER) in [IntType, FloatType]: + ER = N.array([[ER]]) + if type(EF) in [IntType, FloatType]: + EF = N.array([[EF]]) + n_um = (LA.determinant(ER) - LA.determinant(EF)) / float(dfnum) + d_en = LA.determinant(EF) / float(dfden) + return n_um / d_en + + +##################################### +####### ASUPPORT FUNCTIONS ######## +##################################### + + def asign(a): + """ +Usage: asign(a) +Returns: array shape of a, with -1 where a<0 and +1 where a>=0 +""" + a = N.asarray(a) + if ((type(a) == type(1.4)) or (type(a) == type(1))): + return a-a-N.less(a,0)+N.greater(a,0) + else: + return N.zeros(N.shape(a))-N.less(a,0)+N.greater(a,0) + + + def asum (a, dimension=None,keepdims=0): + """ +An alternative to the Numeric.add.reduce function, which allows one to +(1) collapse over multiple dimensions at once, and/or (2) to retain +all dimensions in the original array (squashing one down to size. +Dimension can equal None (ravel array first), an integer (the +dimension over which to operate), or a sequence (operate over multiple +dimensions). If keepdims=1, the resulting array will have as many +dimensions as the input array. + +Usage: asum(a, dimension=None, keepdims=0) +Returns: array summed along 'dimension'(s), same _number_ of dims if keepdims=1 +""" + if type(a) == N.ArrayType and a.typecode() in ['l','s','b']: + a = a.astype(N.Float) + if dimension == None: + s = N.sum(N.ravel(a)) + elif type(dimension) in [IntType,FloatType]: + s = N.add.reduce(a, dimension) + if keepdims == 1: + shp = list(a.shape) + shp[dimension] = 1 + s = N.reshape(s,shp) + else: # must be a SEQUENCE of dims to sum over + dims = list(dimension) + dims.sort() + dims.reverse() + s = a *1.0 + for dim in dims: + s = N.add.reduce(s,dim) + if keepdims == 1: + shp = list(a.shape) + for dim in dims: + shp[dim] = 1 + s = N.reshape(s,shp) + return s + + + def acumsum (a,dimension=None): + """ +Returns an array consisting of the cumulative sum of the items in the +passed array. Dimension can equal None (ravel array first), an +integer (the dimension over which to operate), or a sequence (operate +over multiple dimensions, but this last one just barely makes sense). + +Usage: acumsum(a,dimension=None) +""" + if dimension == None: + a = N.ravel(a) + dimension = 0 + if type(dimension) in [ListType, TupleType, N.ArrayType]: + dimension = list(dimension) + dimension.sort() + dimension.reverse() + for d in dimension: + a = N.add.accumulate(a,d) + return a + else: + return N.add.accumulate(a,dimension) + + + def ass(inarray, dimension=None, keepdims=0): + """ +Squares each value in the passed array, adds these squares & returns +the result. Unfortunate function name. :-) Defaults to ALL values in +the array. Dimension can equal None (ravel array first), an integer +(the dimension over which to operate), or a sequence (operate over +multiple dimensions). Set keepdims=1 to maintain the original number +of dimensions. + +Usage: ass(inarray, dimension=None, keepdims=0) +Returns: sum-along-'dimension' for (inarray*inarray) +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + return asum(inarray*inarray,dimension,keepdims) + + + def asummult (array1,array2,dimension=None,keepdims=0): + """ +Multiplies elements in array1 and array2, element by element, and +returns the sum (along 'dimension') of all resulting multiplications. +Dimension can equal None (ravel array first), an integer (the +dimension over which to operate), or a sequence (operate over multiple +dimensions). A trivial function, but included for completeness. + +Usage: asummult(array1,array2,dimension=None,keepdims=0) +""" + if dimension == None: + array1 = N.ravel(array1) + array2 = N.ravel(array2) + dimension = 0 + return asum(array1*array2,dimension,keepdims) + + + def asquare_of_sums(inarray, dimension=None, keepdims=0): + """ +Adds the values in the passed array, squares that sum, and returns the +result. Dimension can equal None (ravel array first), an integer (the +dimension over which to operate), or a sequence (operate over multiple +dimensions). If keepdims=1, the returned array will have the same +NUMBER of dimensions as the original. + +Usage: asquare_of_sums(inarray, dimension=None, keepdims=0) +Returns: the square of the sum over dim(s) in dimension +""" + if dimension == None: + inarray = N.ravel(inarray) + dimension = 0 + s = asum(inarray,dimension,keepdims) + if type(s) == N.ArrayType: + return s.astype(N.Float)*s + else: + return float(s)*s + + + def asumdiffsquared(a,b, dimension=None, keepdims=0): + """ +Takes pairwise differences of the values in arrays a and b, squares +these differences, and returns the sum of these squares. Dimension +can equal None (ravel array first), an integer (the dimension over +which to operate), or a sequence (operate over multiple dimensions). +keepdims=1 means the return shape = len(a.shape) = len(b.shape) + +Usage: asumdiffsquared(a,b) +Returns: sum[ravel(a-b)**2] +""" + if dimension == None: + inarray = N.ravel(a) + dimension = 0 + return asum((a-b)**2,dimension,keepdims) + + + def ashellsort(inarray): + """ +Shellsort algorithm. Sorts a 1D-array. + +Usage: ashellsort(inarray) +Returns: sorted-inarray, sorting-index-vector (for original array) +""" + n = len(inarray) + svec = inarray *1.0 + ivec = range(n) + gap = n/2 # integer division needed + while gap >0: + for i in range(gap,n): + for j in range(i-gap,-1,-gap): + while j>=0 and svec[j]>svec[j+gap]: + temp = svec[j] + svec[j] = svec[j+gap] + svec[j+gap] = temp + itemp = ivec[j] + ivec[j] = ivec[j+gap] + ivec[j+gap] = itemp + gap = gap / 2 # integer division needed +# svec is now sorted input vector, ivec has the order svec[i] = vec[ivec[i]] + return svec, ivec + + + def arankdata(inarray): + """ +Ranks the data in inarray, dealing with ties appropritely. Assumes +a 1D inarray. Adapted from Gary Perlman's |Stat ranksort. + +Usage: arankdata(inarray) +Returns: array of length equal to inarray, containing rank scores +""" + n = len(inarray) + svec, ivec = ashellsort(inarray) + sumranks = 0 + dupcount = 0 + newarray = N.zeros(n,N.Float) + for i in range(n): + sumranks = sumranks + i + dupcount = dupcount + 1 + if i==n-1 or svec[i] <> svec[i+1]: + averank = sumranks / float(dupcount) + 1 + for j in range(i-dupcount+1,i+1): + newarray[ivec[j]] = averank + sumranks = 0 + dupcount = 0 + return newarray + + + def afindwithin(data): + """ +Returns a binary vector, 1=within-subject factor, 0=between. Input +equals the entire data array (i.e., column 1=random factor, last +column = measured values. + +Usage: afindwithin(data) data in |Stat format +""" + numfact = len(data[0])-2 + withinvec = [0]*numfact + for col in range(1,numfact+1): + rows = pstat.linexand(data,col,pstat.unique(pstat.colex(data,1))[0]) # get 1 level of this factor + if len(pstat.unique(pstat.colex(rows,0))) < len(rows): # if fewer subjects than scores on this factor + withinvec[col-1] = 1 + return withinvec + + + ######################################################### + ######################################################### + ###### RE-DEFINE DISPATCHES TO INCLUDE ARRAYS ######### + ######################################################### + ######################################################### + +## CENTRAL TENDENCY: + geometricmean = Dispatch ( (lgeometricmean, (ListType, TupleType)), + (ageometricmean, (N.ArrayType,)) ) + harmonicmean = Dispatch ( (lharmonicmean, (ListType, TupleType)), + (aharmonicmean, (N.ArrayType,)) ) + mean = Dispatch ( (lmean, (ListType, TupleType)), + (amean, (N.ArrayType,)) ) + median = Dispatch ( (lmedian, (ListType, TupleType)), + (amedian, (N.ArrayType,)) ) + medianscore = Dispatch ( (lmedianscore, (ListType, TupleType)), + (amedianscore, (N.ArrayType,)) ) + mode = Dispatch ( (lmode, (ListType, TupleType)), + (amode, (N.ArrayType,)) ) + tmean = Dispatch ( (atmean, (N.ArrayType,)) ) + tvar = Dispatch ( (atvar, (N.ArrayType,)) ) + tstdev = Dispatch ( (atstdev, (N.ArrayType,)) ) + tsem = Dispatch ( (atsem, (N.ArrayType,)) ) + +## VARIATION: + moment = Dispatch ( (lmoment, (ListType, TupleType)), + (amoment, (N.ArrayType,)) ) + variation = Dispatch ( (lvariation, (ListType, TupleType)), + (avariation, (N.ArrayType,)) ) + skew = Dispatch ( (lskew, (ListType, TupleType)), + (askew, (N.ArrayType,)) ) + kurtosis = Dispatch ( (lkurtosis, (ListType, TupleType)), + (akurtosis, (N.ArrayType,)) ) + describe = Dispatch ( (ldescribe, (ListType, TupleType)), + (adescribe, (N.ArrayType,)) ) + +## DISTRIBUTION TESTS + + skewtest = Dispatch ( (askewtest, (ListType, TupleType)), + (askewtest, (N.ArrayType,)) ) + kurtosistest = Dispatch ( (akurtosistest, (ListType, TupleType)), + (akurtosistest, (N.ArrayType,)) ) + normaltest = Dispatch ( (anormaltest, (ListType, TupleType)), + (anormaltest, (N.ArrayType,)) ) + +## FREQUENCY STATS: + itemfreq = Dispatch ( (litemfreq, (ListType, TupleType)), + (aitemfreq, (N.ArrayType,)) ) + scoreatpercentile = Dispatch ( (lscoreatpercentile, (ListType, TupleType)), + (ascoreatpercentile, (N.ArrayType,)) ) + percentileofscore = Dispatch ( (lpercentileofscore, (ListType, TupleType)), + (apercentileofscore, (N.ArrayType,)) ) + histogram = Dispatch ( (lhistogram, (ListType, TupleType)), + (ahistogram, (N.ArrayType,)) ) + cumfreq = Dispatch ( (lcumfreq, (ListType, TupleType)), + (acumfreq, (N.ArrayType,)) ) + relfreq = Dispatch ( (lrelfreq, (ListType, TupleType)), + (arelfreq, (N.ArrayType,)) ) + +## VARIABILITY: + obrientransform = Dispatch ( (lobrientransform, (ListType, TupleType)), + (aobrientransform, (N.ArrayType,)) ) + samplevar = Dispatch ( (lsamplevar, (ListType, TupleType)), + (asamplevar, (N.ArrayType,)) ) + samplestdev = Dispatch ( (lsamplestdev, (ListType, TupleType)), + (asamplestdev, (N.ArrayType,)) ) + signaltonoise = Dispatch( (asignaltonoise, (N.ArrayType,)),) + var = Dispatch ( (lvar, (ListType, TupleType)), + (avar, (N.ArrayType,)) ) + stdev = Dispatch ( (lstdev, (ListType, TupleType)), + (astdev, (N.ArrayType,)) ) + sterr = Dispatch ( (lsterr, (ListType, TupleType)), + (asterr, (N.ArrayType,)) ) + sem = Dispatch ( (lsem, (ListType, TupleType)), + (asem, (N.ArrayType,)) ) + z = Dispatch ( (lz, (ListType, TupleType)), + (az, (N.ArrayType,)) ) + zs = Dispatch ( (lzs, (ListType, TupleType)), + (azs, (N.ArrayType,)) ) + +## TRIMMING FCNS: + threshold = Dispatch( (athreshold, (N.ArrayType,)),) + trimboth = Dispatch ( (ltrimboth, (ListType, TupleType)), + (atrimboth, (N.ArrayType,)) ) + trim1 = Dispatch ( (ltrim1, (ListType, TupleType)), + (atrim1, (N.ArrayType,)) ) + +## CORRELATION FCNS: + paired = Dispatch ( (lpaired, (ListType, TupleType)), + (apaired, (N.ArrayType,)) ) + pearsonr = Dispatch ( (lpearsonr, (ListType, TupleType)), + (apearsonr, (N.ArrayType,)) ) + spearmanr = Dispatch ( (lspearmanr, (ListType, TupleType)), + (aspearmanr, (N.ArrayType,)) ) + pointbiserialr = Dispatch ( (lpointbiserialr, (ListType, TupleType)), + (apointbiserialr, (N.ArrayType,)) ) + kendalltau = Dispatch ( (lkendalltau, (ListType, TupleType)), + (akendalltau, (N.ArrayType,)) ) + linregress = Dispatch ( (llinregress, (ListType, TupleType)), + (alinregress, (N.ArrayType,)) ) + +## INFERENTIAL STATS: + ttest_1samp = Dispatch ( (lttest_1samp, (ListType, TupleType)), + (attest_1samp, (N.ArrayType,)) ) + ttest_ind = Dispatch ( (lttest_ind, (ListType, TupleType)), + (attest_ind, (N.ArrayType,)) ) + ttest_rel = Dispatch ( (lttest_rel, (ListType, TupleType)), + (attest_rel, (N.ArrayType,)) ) + chisquare = Dispatch ( (lchisquare, (ListType, TupleType)), + (achisquare, (N.ArrayType,)) ) + ks_2samp = Dispatch ( (lks_2samp, (ListType, TupleType)), + (aks_2samp, (N.ArrayType,)) ) + mannwhitneyu = Dispatch ( (lmannwhitneyu, (ListType, TupleType)), + (amannwhitneyu, (N.ArrayType,)) ) + tiecorrect = Dispatch ( (ltiecorrect, (ListType, TupleType)), + (atiecorrect, (N.ArrayType,)) ) + ranksums = Dispatch ( (lranksums, (ListType, TupleType)), + (aranksums, (N.ArrayType,)) ) + wilcoxont = Dispatch ( (lwilcoxont, (ListType, TupleType)), + (awilcoxont, (N.ArrayType,)) ) + kruskalwallish = Dispatch ( (lkruskalwallish, (ListType, TupleType)), + (akruskalwallish, (N.ArrayType,)) ) + friedmanchisquare = Dispatch ( (lfriedmanchisquare, (ListType, TupleType)), + (afriedmanchisquare, (N.ArrayType,)) ) + +## PROBABILITY CALCS: + chisqprob = Dispatch ( (lchisqprob, (IntType, FloatType)), + (achisqprob, (N.ArrayType,)) ) + zprob = Dispatch ( (lzprob, (IntType, FloatType)), + (azprob, (N.ArrayType,)) ) + ksprob = Dispatch ( (lksprob, (IntType, FloatType)), + (aksprob, (N.ArrayType,)) ) + fprob = Dispatch ( (lfprob, (IntType, FloatType)), + (afprob, (N.ArrayType,)) ) + betacf = Dispatch ( (lbetacf, (IntType, FloatType)), + (abetacf, (N.ArrayType,)) ) + betai = Dispatch ( (lbetai, (IntType, FloatType)), + (abetai, (N.ArrayType,)) ) + erfcc = Dispatch ( (lerfcc, (IntType, FloatType)), + (aerfcc, (N.ArrayType,)) ) + gammln = Dispatch ( (lgammln, (IntType, FloatType)), + (agammln, (N.ArrayType,)) ) + +## ANOVA FUNCTIONS: + F_oneway = Dispatch ( (lF_oneway, (ListType, TupleType)), + (aF_oneway, (N.ArrayType,)) ) + F_value = Dispatch ( (lF_value, (ListType, TupleType)), + (aF_value, (N.ArrayType,)) ) + +## SUPPORT FUNCTIONS: + incr = Dispatch ( (lincr, (ListType, TupleType, N.ArrayType)), ) + sum = Dispatch ( (lsum, (ListType, TupleType)), + (asum, (N.ArrayType,)) ) + cumsum = Dispatch ( (lcumsum, (ListType, TupleType)), + (acumsum, (N.ArrayType,)) ) + ss = Dispatch ( (lss, (ListType, TupleType)), + (ass, (N.ArrayType,)) ) + summult = Dispatch ( (lsummult, (ListType, TupleType)), + (asummult, (N.ArrayType,)) ) + square_of_sums = Dispatch ( (lsquare_of_sums, (ListType, TupleType)), + (asquare_of_sums, (N.ArrayType,)) ) + sumdiffsquared = Dispatch ( (lsumdiffsquared, (ListType, TupleType)), + (asumdiffsquared, (N.ArrayType,)) ) + shellsort = Dispatch ( (lshellsort, (ListType, TupleType)), + (ashellsort, (N.ArrayType,)) ) + rankdata = Dispatch ( (lrankdata, (ListType, TupleType)), + (arankdata, (N.ArrayType,)) ) + findwithin = Dispatch ( (lfindwithin, (ListType, TupleType)), + (afindwithin, (N.ArrayType,)) ) + +###################### END OF NUMERIC FUNCTION BLOCK ##################### + +###################### END OF STATISTICAL FUNCTIONS ###################### + +except ImportError: + pass diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.py new file mode 100755 index 0000000..fa4b6bd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.py @@ -0,0 +1,2389 @@ +#!/usr/bin/env python + +#import built-in modules +import os,sys +import re +import string +from optparse import OptionParser +import warnings +import string +import collections +import math +#import gc + +#import third-party modules +import psyco_full +from bx.bitset import * +from bx.bitset_builders import * +from bx.intervals import * +from itertools import * +import fasta + +#changes to the paths + +#changing history to this module +#05/26/2011: suppport multiple spliced mapped reads + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.1.0" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + + +class ParseBED: + '''manipulate BED (http://genome.ucsc.edu/FAQ/FAQformat.html) format file.''' + + def __init__(self,bedFile): + '''This is constructor of ParseBED''' + self.transtab = string.maketrans("ACGTNX","TGCANX") + self.f=open(bedFile,'r') + self.fileName=os.path.basename(bedFile) + self.ABS_fileName=bedFile + + def groupingBED(infile,outfile=None,strand=True,boundary="utr"): + '''Group overlapping bed entries together. When strand=Ture, overlapping bed entries within + the same strand will be merged. When strand=False, all overlapping bed entries are merged, + regardless of the strand. When boundary="utr" (recommended), UTR regions are considered in + determining overlapping relationship. When boundary="cds", UTR resgions are NOT considered + in determing overlapping relationship''' + + f=open(infile,'r') + + bed_line=re.compile(r'^\S+\s+\d+\s+\d+') + groups = collections.defaultdict(list) #key is internal ID, value is list of bed lines + groups_boundary_st = {} #key is internal ID, value is leftmost boundary + groups_boundary_end = {} #key is internal ID, value is rightmost boundary + Orig_bedNum=0 + cluster_Num=0 + + #check if the input bed file is properly sorted + print >>sys.stderr,"check if input bed file is sorted properly ...", + i=0 + for line in f: + line=line.rstrip('\r\n') + line=line.lstrip() + if bed_line.match(line): + fields=line.split() + i +=1 + if i==1: + chrom = fields[0] + txStart=int(fields[1]) + if i>1: + if ((fields[0] < chrom) or ((fields[0] == chrom) and (int(fields[1]) >sys.stderr, "File not properly sorted:" + line + exit(1) + chrom = fields[0] + txStart=int(fields[1]) + else: #well, file seems to be OK + print >>sys.stderr,"OK!" + f.seek(0) + + if strand: #want to consider strand information. + for line in f: + line=line.rstrip('\r\n') + line=line.lstrip() + fields=line.split() + if bed_line.match(line) and len(fields)==12: + if fields[5] == '-':continue #merge overlapping transcripts on plus strand + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + strand = fields[5] + + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= groups_boundary_end[cluster_Num]): + overlap_flag=0 + if (boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > groups_boundary_end[cluster_Num]): + overlap_flag=0 + + if overlap_flag ==0: + cluster_Num +=1 + groups[cluster_Num].append(line) + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=int(fields[1]) + groups_boundary_end[cluster_Num]=int(fields[2]) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=int(fields[6]) + groups_boundary_end[cluster_Num]=int(fields[7]) + strand = fields[5] + chrom = fields[0] + + elif overlap_flag ==1: + groups[cluster_Num].append(line) + strand = fields[5] + chrom = fields[0] + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[1])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[2])) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[6])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[7])) + + else: + print >>sys.stderr,"unknown line:" + line +'\n' + f.seek(0) + + #merge overlapping transcripts on minus strand + Orig_bedNum=0 + for line in f: + line=line.rstrip('\r\n') + line=line.lstrip() + fields=line.split() + if bed_line.match(line) and len(fields)==12: + if fields[5] == '+':continue #merge overlapping transcripts on plus strand + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + strand = fields[5] + + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= groups_boundary_end[cluster_Num]): + overlap_flag=0 + if (boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > groups_boundary_end[cluster_Num]): + overlap_flag=0 + + if overlap_flag ==0: + cluster_Num +=1 + groups[cluster_Num].append(line) + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=int(fields[1]) + groups_boundary_end[cluster_Num]=int(fields[2]) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=int(fields[6]) + groups_boundary_end[cluster_Num]=int(fields[7]) + strand = fields[5] + chrom = fields[0] + + elif overlap_flag ==1: + groups[cluster_Num].append(line) + strand = fields[5] + chrom = fields[0] + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[1])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[2])) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[6])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[7])) + + else: + print >>sys.stderr,"unknown line:" + line +'\n' + f.seek(0) + + + else: # NOT want to consider strand information. merge + and - together + Orig_bedNum=0 + cluster_Num=0 + for line in f: + line=line.rstrip('\r\n') + line=line.lstrip() + fields=line.split() + if bed_line.match(line) and len(fields)==12: + #if fields[5] == '-':continue #merge overlapping transcripts on plus strand + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + strand = fields[5] + + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= groups_boundary_end[cluster_Num]): + overlap_flag=0 + if (boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > groups_boundary_end[cluster_Num]): + overlap_flag=0 + + if overlap_flag ==0: + cluster_Num +=1 + groups[cluster_Num].append(line) + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=int(fields[1]) + groups_boundary_end[cluster_Num]=int(fields[2]) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=int(fields[6]) + groups_boundary_end[cluster_Num]=int(fields[7]) + strand = fields[5] + chrom = fields[0] + + elif overlap_flag ==1: + groups[cluster_Num].append(line) + strand = fields[5] + chrom = fields[0] + if (boundary == "utr"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[1])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[2])) + if (boundary == "cds"): + groups_boundary_st[cluster_Num]=min(groups_boundary_st[cluster_Num],int(fields[6])) + groups_boundary_end[cluster_Num] = max(groups_boundary_end[cluster_Num],int(fields[7])) + + else: + print >>sys.stderr,"unknown line:" + line +'\n' + f.seek(0) + + try: + FO=open(outfile,'w') + print >>sys.stderr, "Writing to " + outfile + "\n" + for k in sorted(groups.iterkeys()): + FO.write( "Group_"+str(k) + "\t" + str(groups_boundary_st[k]) +'\t' + str(groups_boundary_end[k]) + ":\n") + for line in groups[k]: + FO.write("\t"+line+"\n") + except: + #return (groups,groups_boundary_st,groups_boundary_end) + return groups + + groupingBED=staticmethod(groupingBED) + + + def complementBED(self,sizeFile,outfile=None): + '''Return the complement regions of a bed file. Requires a genomeSizeFile that maps chromosome + to sizes. In genomeSizeFile, each row contains two columns (separaed by white spaces): the 1st + column is chromosome, and the 2nd column is size. An example of sizeFile: + chr1 247249719 + chr2 242951149 + chr3 199501827 + ... + ''' + + if outfile is None: + outfile=self.fileName + ".compl.bed" + FO=open(outfile,'w') + + #read sizeFile + chrSize={} + for line in open(sizeFile): + line=line.rstrip(' \n') + line=line.lstrip() + fields = line.split() + if ((len(fields)) != 2):continue + chrSize[fields[0]] = int(fields[1]) + + bitsets = binned_bitsets_from_file( open( self.ABS_fileName ) ) + + for chrom in chrSize: + if chrom in bitsets: + bits = bitsets[chrom] + bits.invert() + length = chrSize[chrom] + end=0 + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + if end > length: end = length + FO.write(chrom + "\t" + str(start) + "\t" + str(end) + "\n") + if end == length: break + else: + FO.write(chrom + "\t0\t" + str(chrSize[chrom]) + "\n") + FO.close() + self.f.seek(0) + + def bedToWig(self,outfile=None,log2scale=False,header=True): + '''Transform bed file into wiggle format. Input bed must have at least 3 columns[chrom St End]. + For bed12 file, intron regions are automatically excluded. + NOTE bed is 0-based and half-open while wiggle is 1-based.''' + + if outfile is None: + outfile = self.fileName + ".wig" + FO=open(outfile,'w') + wig=collections.defaultdict(dict) + headline="track type=wiggle_0 name=" + outfile + " track_label description='' visibility=full color=255,0,0" + + print >>sys.stderr, "Writing wig file to \"",outfile,"\"..." + + for line in self.f: + line=line.rstrip('\r\n') + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\n').split() + coverReg=[] + if len(fields)<12 and len(fields)>2 : + chrom=fields[0] + coverReg = range(int(fields[1])+1,int(fields[2])+1) + elif len(fields)==12: + chrom=fields[0] + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + for st,size in zip(exon_starts,exon_sizes): + coverReg.extend(range(int(fields[1]) + st + 1, int(fields[1]) + st + size +1 )) + else:continue + + for i in coverReg: + if wig[chrom].has_key(i): + wig[chrom][i] +=1 + else: + wig[chrom][i]=1 + if header:FO.write(headline + "\n") + for chr in sorted(wig.keys()): + print >>sys.stderr, "Writing ",chr, " ..." + FO.write('variableStep chrom='+chr+'\n') + for coord in sorted(wig[chr]): + if log2scale: + FO.write("%d\t%5.3f\n" % (coord,math.log(wig[chr][coord],2))) + else: + FO.write("%d\t%d\n" % (coord,wig[chr][coord])) + self.f.seek(0) + FO.close() + + + def bedToGFF(self,outfile=None): + '''Transform bed file into GFF format. Borrowed from Galaxy with slight change''' + input_name = self.ABS_fileName + if outfile is None: + output_name = self.fileName + ".GFF" + else: output_name=outfile + skipped_lines = 0 + first_skipped_line = 0 + out = open( output_name, 'w' ) + out.write( "##gff-version 2\n" ) + out.write( "##bed_to_gff_converter.py\n\n" ) + i = 0 + for i, line in enumerate( self.f ): + complete_bed = False + line = line.rstrip( '\r\n' ) + if line and not line.startswith( '#' ) and not line.startswith( 'track' ) and not line.startswith( 'browser' ): + try: + elems = line.split( '\t' ) + if len( elems ) == 12: + complete_bed = True + chrom = elems[0] + if complete_bed: + feature = "mRNA" + else: + try: + feature = elems[3] + except: + feature = 'feature%d' % ( i + 1 ) + start = int( elems[1] ) + 1 + end = int( elems[2] ) + try: + score = elems[4] + except: + score = '0' + try: + strand = elems[5] + except: + strand = '+' + try: + group = elems[3] + except: + group = 'group%d' % ( i + 1 ) + if complete_bed: + out.write( '%s\tbed2gff\t%s\t%d\t%d\t%s\t%s\t.\t%s %s;\n' % ( chrom, feature, start, end, score, strand, feature, group ) ) + else: + out.write( '%s\tbed2gff\t%s\t%d\t%d\t%s\t%s\t.\t%s;\n' % ( chrom, feature, start, end, score, strand, group ) ) + if complete_bed: + # We have all the info necessary to annotate exons for genes and mRNAs + block_count = int( elems[9] ) + block_sizes = elems[10].split( ',' ) + block_starts = elems[11].split( ',' ) + for j in range( block_count ): + exon_start = int( start ) + int( block_starts[j] ) + exon_end = exon_start + int( block_sizes[j] ) - 1 + out.write( '%s\tbed2gff\texon\t%d\t%d\t%s\t%s\t.\texon %s;\n' % ( chrom, exon_start, exon_end, score, strand, group ) ) + except: + skipped_lines += 1 + if not first_skipped_line: + first_skipped_line = i + 1 + else: + skipped_lines += 1 + if not first_skipped_line: + first_skipped_line = i + 1 + out.close() + info_msg = "%i lines converted to GFF version 2. " % ( i + 1 - skipped_lines ) + if skipped_lines > 0: + info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." %( skipped_lines, first_skipped_line ) + print info_msg + + def getUTR(self,utr=35): + '''Extract UTR regions from input bed file (must be 12-column). output is 6-column bed format. + When utr=35 [default], extract both 5' and 3' UTR. When utr=3, only extract 3' UTR. When utr=5, + only extract 5' UTR''' + + ret_lst=[] + for line in self.f: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + chrom=fields[0] + strand=fields[5] + txStart=int(fields[1]) + txEnd=int(fields[2]) + cdsStart=int(fields[6]) + cdsEnd=int(fields[7]) + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + if (utr==35 or utr==5): + for st,end in zip(exon_start,exon_end): + if st < cdsStart: + utr_st = st + utr_end = min(end,cdsStart) + ret_lst.append([chrom,utr_st,utr_end]) + if (utr==35 or utr==3): + for st,end in zip(exon_start,exon_end): + if end > cdsEnd: + utr_st = max(st, cdsEnd) + utr_end = end + ret_lst.append([chrom,utr_st,utr_end]) + self.f.seek(0) + return ret_lst + + def getExon(self,outfile=None): + '''Extract exon regions from input bed file (must be 12-column). output is 6-column Tab + separated bed file, each row represents one exon''' + if outfile is None:outfile = self.fileName + ".exon.xls" + FO=open(outfile,'w') + + #ret_lst=[] + for line in self.f: + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + if(strand == '-'): + exonNum=len(exon_start) + for st,end in zip(exon_start,exon_end): + FO.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t"+ str(score) + "\t" + strand + '\n') + exonNum -= 1 + #ret_lst.append([chrom,st,end]) + else: + exonNum=1 + for st,end in zip(exon_start,exon_end): + FO.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t"+ str(score) +"\t" + strand + '\n') + exonNum += 1 + #ret_lst.append([chrom,st,end]) + + self.f.seek(0) + #return ret_lst + + def getCDSExon(self,outfile=None): + + '''Extract CDS exon regions from input bed file (must be 12-column).''' + + ret_lst=[] + for f in self.f: + f = f.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + # grab cdsStart - cdsEnd + cds_exons = [] + cds_seq = '' + genome_seq_index = [] + for base,offset in zip( blockStarts, blockSizes ): + if (base + offset) < cdsStart: continue + if base > cdsEnd: continue + exon_start = max( base, cdsStart ) + exon_end = min( base+offset, cdsEnd ) + #cds_exons.append( (exon_start, exon_end) ) + ret_lst.append([chrom,exon_start,exon_end]) + self.f.seek(0) + return ret_lst + + + def getIntron(self): + '''Extract Intron regions from input bed file (must be 12-column). output is 6-column Tab + separated bed file, each row represents one intron''' + + ret_lst=[] + for line in self.f: + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + cds_start = int( fields[6] ) + cds_end = int( fields[7] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + + if(strand == '-'): + intronNum=len(intron_start) + for st,end in zip(intron_start,intron_end): + #FO.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t0\t" + strand + '\n') + #intronNum -= 1 + ret_lst.append([chrom,st,end]) + else: + intronNum=1 + for st,end in zip(intron_start,intron_end): + #FO.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t0\t" + strand + '\n') + #intronNum += 1 + ret_lst.append([chrom,st,end]) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + self.f.seek(0) + return ret_lst + + def getIntergenic(self,direction='up', size=1000): + '''get intergenic regions. direction=up or down or both.''' + + ret_lst=[] + for line in self.f: + if line.startswith(('#','track','browser')): + continue + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + strand = fields[5] + if(direction=="up" or direction=="both"): + if strand=='-': + region_st=tx_end + region_end=tx_end +size + else: + region_st = max(tx_start-size,0) + region_end=tx_start + ret_lst.append([chrom,region_st,region_end]) + if (direction=="down" or direction=="both"): + if strand == '-': + region_st = max(0,tx_start-size) + region_end = tx_start + else: + region_st = tx_end + region_end = tx_end+size + ret_lst.append([chrom,region_st,region_end]) + self.f.seek(0) + return ret_lst + + + def getBedinfor(self,outfile=None): + '''Extract information (such as exonNumber, exonSize (min,max,mean)etc,.) from bed entries. + ''' + if outfile is None:outfile = self.fileName + ".infor.xls" + FO=open(outfile,'w') + print >>sys.stderr,"writing feature information to " + outfile + " ..." + + intron_sizes=[] + FO.write("geneID\t" + "Position\t" + "Exon_Num\t" + "Exon_Len_Sum\t" + "Exon_Len_Min\t" + "Exon_Len_Max\t" + "Exon_Len_Avg\t") + FO.write("Intron_Len_Sum\t" + "Intron_Len_Min\t" + "Intron_Len_Max\t" + "Intron_Len_Avg\n") + for line in self.f: + intron_sizes=[] + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + cds_start = int( fields[6] ) + cds_end = int( fields[7] ) + exon_num= int(fields[9]) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + for st,end in zip(intron_start,intron_end): + intron_sizes.append(end-st) + + FO.write(geneName + '\t'+chrom +':'+str(tx_start+1)+'-'+str(tx_end)+strand+'\t') + FO.write(str(exon_num) + "\t" + str(sum(exon_sizes)) +'\t' +str(min(exon_sizes)) + '\t' + str(max(exon_sizes)) +'\t' + str(sum(exon_sizes)/exon_num) +"\t") + if intron_sizes: + FO.write(str(sum(intron_sizes)) +'\t' + str(min(intron_sizes)) + '\t' + str(max(intron_sizes)) +'\t' + str(sum(intron_sizes)/len(intron_sizes)) +"\n") + else: + FO.write('0' +'\t' + '0' + '\t' + '0' +'\t' + '0' +"\n") + + self.f.seek(0) + FO.close() + + def filterBedbyIntronSize(self,outfile=None,min_intron=50): + '''Filter bed files with intron size. Mamalian gene has minimum intron size + ''' + if outfile is None:outfile = self.fileName + ".filterIntron.xls" + FO=open(outfile,'w') + print >>sys.stderr,"writing feature information to " + outfile + " ..." + + intron_sizes=[] + for line in self.f: + intron_sizes=[] + flag=0 + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + cds_start = int( fields[6] ) + cds_end = int( fields[7] ) + exon_num= int(fields[9]) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + if exon_num <=1: #intron size is 0 + continue + for st,end in zip(intron_start,intron_end): + if end-st <=min_intron: + flag=1 + break + if flag == 0: + FO.write(line) + + self.f.seek(0) + FO.close() + + + def getAllUniqJunctions(self,outfile=None,flankSize=20): + '''Extract unique (non-redundant) junctions from input bed file (must be 12-column). use + flankSize to represent junction. Note that too large flankSize could exceed chromosome + boundary and raise error when you convert bed to bigbed. output 12-column Tab separated bed + file''' + if outfile is None:outfile = self.fileName + ".uniqJunctions.bed" + FO=open(outfile,'w') + print >>sys.stderr,"writing unique junctions " + outfile + " ..." + uniqJunc = collections.defaultdict(int) + for line in self.f: + #try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + cds_start = int( fields[6] ) + cds_end = int( fields[7] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + + for st,end in zip(intron_start,intron_end): + key=chrom + str(st) + str(end) + if not uniqJunc.has_key(key): + FO.write(chrom + "\t" + str(st-flankSize) + "\t" + str(end+flankSize) + "\t" + geneName + "\t0\t" + strand + '\t' + str(st-flankSize) + "\t" + str(end+flankSize) + '\t0,0,0\t2\t' + str(flankSize)+','+str(flankSize)+'\t' + '0,' + str(end-st+flankSize) +'\n') + uniqJunc[key]+=1 + #except: + # print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + # continue + self.f.seek(0) + FO.close() + + def collapseJunctionBed(self,outfile=None): + '''Junctions spannig the same block will be merged. multiple spliced junctions will be reported + as is without any changes''' + + if outfile is None:outfile = self.fileName + ".collapsed.bed" + FO=open(outfile,'w') + print >>sys.stderr,"\tCollapse junctions for " + self.fileName, + + tss_start =collections.defaultdict(list) + tss_end =collections.defaultdict(list) + exon_size1 =collections.defaultdict(list) + exon_size2 =collections.defaultdict(list) + block_start1 =collections.defaultdict(list) + block_start2 =collections.defaultdict(list) + count = collections.defaultdict(int) + chrm=dict() + strands=dict() + for line in self.f: + skip_flag=0 + try: + if line.startswith(('#','track','broser')):continue + fields = line.rstrip().split() + exonSize = map(int, fields[10].rstrip(',\n').split(',')) + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + score = int(fields[4]) + strand = fields[5].replace(" ","_") + if int(fields[9]) ==1: #if bed has only 1 block + print >>FO,line, + continue + if int(fields[9]) >=3: #if bed has more than 3 blocks + print >>FO,line, + continue + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + exonSize = map(int,fields[10].rstrip(',\n').split(',')) + block_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + + intronKey = chrom + ":" + str(intron_start[0]+1) + "-" + str(intron_end[0]) + ":" + strand + count[intronKey] +=1 + chrm[intronKey] = chrom + strands[intronKey] = strand + tss_start[intronKey].append(tx_start) + tss_end[intronKey].append(tx_end) + exon_size1[intronKey].append(exonSize[0]) + exon_size2[intronKey].append(exonSize[1]) + block_start1[intronKey].append(block_starts[0]) + block_start2[intronKey].append(block_starts[1]) + + print >>sys.stderr,"Writing junctions to " + outfile + " ..." + for key in count: + print >>FO,chrm[key] + '\t' + str(min(tss_start[key])) + '\t' + str(max(tss_end[key])) + '\t' + "SR=" + str(count[key]) + '\t' + str(count[key]), + print >>FO,'\t'+strands[key] + '\t' + str(min(tss_start[key])) + '\t' + str(max(tss_end[key])) + '\t', + print >>FO, '255,0,0' + '\t2\t' + str(max(exon_size1[key])) + ',' + str(max(exon_size2[key])) + '\t', + print >>FO, str(min(block_start1[key])) + ',' + str(max(block_start2[key])) + + self.f.seek(0) + FO.close() + + def filterJunctionBed(self,outfile=None,overhang=8,min_intron=50,max_intron=1000000,cvg=1): + '''filter junction bed file according to overhang size and supporting read''' + + if outfile is None:outfile = self.fileName + ".filter.bed" + FO=open(outfile,'w') + print >>sys.stderr,"\tfilter junctions ... " + + for line in self.f: + skip_flag=0 + if line.startswith(('#','track','broser','\n')):continue + fields = line.rstrip().split() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + exonSize = map(int,fields[10].rstrip(',\n').split(',')) + block_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + if fields[9] >=3: #pass for multiple spliced read + print >>FO,line, + continue + if fields[4]>cvg: #pass for multi-read supporting junction + print >>FO,line, + continue + for i in exonSize: + if i < overhang: #filter out short overhang junctions + skip_flag=1 + break + for st,end in zip(intron_start,intron_end): + if (end - st) > max_intron or (end -st) < min_intron: + skip_flag=1 + break + if skip_flag ==1: + continue + else: + print >>FO,line + self.f.seek(0) + FO.close() + + def unionBED(self,outfile=None,outNameFile=None,boundary="utr",stranded=True): + '''Collapse bed entries through UNION all overlapping exons. Just like "dense" display mode + in UCSC genome browser. Bed entries will be merged if the following conditions are met: + 1) Coordinates overlapped + 2) on the same chromosome + output two files, one bed file contains the merged bed entries, the other *.name.txt file + contains which genes were merged together. + NOTE: + 1) input bed should 12-columns and sorted by chrom then by start position + (use "sort -k1,1 -k2,2n myfile.bed >myfile.sorted.bed") + 2) when stranded=True, only overlapping bed entries on the same strand will be merged. + Otherwise, all overlapping bed entries will be meraged without considering strand information. + ''' + + #open output file + if outfile is None:outfile = self.fileName + ".merge.unionExon.bed" + if outNameFile is None: outNameFile = self.fileName + ".name.txt" + FO=open(outfile,'w') + FName=open(outNameFile,'w') + + #some local variable within function + bed_line=re.compile(r'^\S+\s+\d+\s+\d+') + Merge_bed_TxStart=collections.defaultdict(list) + Merge_bed_TxEnd=collections.defaultdict(list) + Merge_bed_cdsStart=collections.defaultdict(list) + Merge_bed_cdsEnd=collections.defaultdict(list) + Merge_bed_ExonStart=collections.defaultdict(list) + Merge_bed_ExonEnd=collections.defaultdict(list) + Merge_bed_geneName=collections.defaultdict(list) + Orig_bedNum=0 #number of bed entries before merging + Merge_bedNum=0 #number of bed entries after merging + Merge_bed_chr={} + Merge_bed_strand={} + final_exon_starts=[] + final_exon_sizes=[] + + + #check if the input bed file is properly sorted + print >>sys.stderr,"check if input bed file is sorted properly ...", + i=0 + for line in self.f: + line=line.strip() + if bed_line.match(line): + fields=line.split() + i +=1 + if i==1: + chrom = fields[0] + txStart=int(fields[1]) + if i>1: + if ((fields[0] < chrom) or ((fields[0] == chrom) and (int(fields[1]) >sys.stderr, "File not properly sorted:" + line + exit(1) + chrom = fields[0] + txStart=int(fields[1]) + else: #well, file seems to be OK + print >>sys.stderr,"OK!" + self.f.seek(0) + + + + print >>sys.stderr,"merge bed file to " + outfile + " ..." + FO.write("track name=" + self.fileName + " description=" + ' \"' + "Overlapping entries in " + self.fileName + " were merged" + '\"'+'\n') + if stranded: #want to consider strand information + for line in self.f: + line=line.strip() + if bed_line.match(line): + fields=line.split() + if(len(fields)!=12): + print >>sys.stderr, "bed file must be 12 columns speparated by Tab(whilte space)" +line + if fields[5] == '-':continue #merge overlapping transcripts on plus strand + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + strand = fields[5] + txStart= int(fields[1]) + txEnd= int(fields[2]) + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=txEnd + cdsEnd_float=cdsEnd + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + txEnd_float = int(fields[2]) + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= txEnd_float): + overlap_flag=0 + if ((boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > cdsEdn_float)): + overlap_flag=0 + txStart= int(fields[1]) + txEnd= int(fields[2]) + strand = fields[5] + chrom = fields[0] + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=max(txEnd_float,int(fields[2])) + cdsEnd_float=max(cdsEnd_float,int(fields[7])) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + txStart ), exon_starts) #0-based half open [) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + #intron_start = exon_ends[:-1] #0-based half open [) + #intron_end=exon_starts[1:] + + if overlap_flag ==0: + Merge_bedNum +=1 + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]=strand + elif overlap_flag ==1: + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]=strand + self.f.seek(0) + + #merge overlapping transcripts on minus strand + Orig_bedNum=0 + for line in self.f: + line=line.strip() + if bed_line.match(line): + fields=line.split() + if(len(fields)!=12): + print >>sys.stderr, "bed file must be 12 columns speparated by Tab(whilte space)" +line + if fields[5] == '+':continue + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + strand = fields[5] + txStart= int(fields[1]) + txEnd= int(fields[2]) + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=txEnd + cdsEnd_float=cdsEnd + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + txEnd_float = int(fields[2]) + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= txEnd_float): + overlap_flag=0 + if ((boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > cdsEdn_float)): + overlap_flag=0 + txStart= int(fields[1]) + txEnd= int(fields[2]) + strand = fields[5] + chrom = fields[0] + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=max(txEnd_float,int(fields[2])) + cdsEnd_float=max(cdsEnd_float,int(fields[7])) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + txStart ), exon_starts) #0-based half open [) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + #intron_start = exon_ends[:-1] #0-based half open [) + #intron_end=exon_starts[1:] + + if overlap_flag ==0: + Merge_bedNum +=1 + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]=strand + elif overlap_flag ==1: + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]=strand + self.f.seek(0) + else: # NOT want to consider strand information. merge + and - together + Orig_bedNum=0 + Merge_bedNum=0 + for line in self.f: + line=line.rstrip('\r\n') + line=line.lstrip() + if bed_line.match(line): + fields=line.split() + Orig_bedNum +=1 + if Orig_bedNum ==1: #this is first bed entry + overlap_flag=0 #has nothing to overlap because it's first entry + chrom = fields[0] + #strand = fields[5] + txStart= int(fields[1]) + txEnd= int(fields[2]) + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=txEnd + cdsEnd_float=cdsEnd + elif Orig_bedNum > 1: #this is NOT first entry + overlap_flag=1 #we suppose current line is overlapped with previous one. Unless it can prove it's NOT! + if fields[0] != chrom: #not the same chromosome + overlap_flag=0 + txEnd_float = int(fields[2]) + if (boundary == "utr") and ( fields[0] == chrom) and (int(fields[1]) >= txEnd_float): + overlap_flag=0 + if ((boundary == "cds") and ( fields[0] == chrom) and (int(fields[6]) > cdsEdn_float)): + overlap_flag=0 + txStart= int(fields[1]) + txEnd= int(fields[2]) + #strand = fields[5] + chrom = fields[0] + cdsStart= int(fields[6]) + cdsEnd= int(fields[7]) + geneName=fields[3] + score=fields[4] + txEnd_float=max(txEnd_float,int(fields[2])) + cdsEnd_float=max(cdsEnd_float,int(fields[7])) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + txStart ), exon_starts) #0-based half open [) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + #intron_start = exon_ends[:-1] #0-based half open [) + #intron_end=exon_starts[1:] + + if overlap_flag ==0: + Merge_bedNum +=1 + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]='+' + elif overlap_flag ==1: + Merge_bed_TxStart[Merge_bedNum].append(txStart) + Merge_bed_TxEnd[Merge_bedNum].append(txEnd) + Merge_bed_cdsStart[Merge_bedNum].append(cdsStart) + Merge_bed_cdsEnd[Merge_bedNum].append(cdsEnd) + Merge_bed_ExonStart[Merge_bedNum].extend(exon_starts) + Merge_bed_ExonEnd[Merge_bedNum].extend(exon_ends) + Merge_bed_geneName[Merge_bedNum].append(geneName) + Merge_bed_chr[Merge_bedNum]=chrom + Merge_bed_strand[Merge_bedNum]='+' + + + #meged exon and output + for id in sorted(Merge_bed_TxStart.iterkeys()): + final_exon = {} #key is exon start, value is exon end + final_exon_sizes=[] + final_exon_starts=[] + FName.write("BED_box_" + str(id) + "\t") + FName.write(','.join(Merge_bed_geneName[id]) + "\n") + for E_st,E_end in sorted(zip(Merge_bed_ExonStart[id],Merge_bed_ExonEnd[id])): + startOfFirstExon = E_st + endOfFirstExon = E_end + final_exon[E_st] = E_end + break + for E_st,E_end in sorted(zip(Merge_bed_ExonStart[id][1:],Merge_bed_ExonEnd[id][1:])): + if final_exon.has_key(E_st): #the current start position already there. We only need to compare end position + if E_end > endOfFirstExon: + final_exon[startOfFirstExon] = E_end + endOfFirstExon = E_end + else: + continue + else: #the current start postion is different + if E_st <=endOfFirstExon: + if E_end <= endOfFirstExon: + continue + elif E_end > endOfFirstExon: + final_exon[startOfFirstExon] = E_end + endOfFirstExon = E_end + else: + final_exon[E_st]=E_end + startOfFirstExon=E_st + endOfFirstExon=E_end + + for k in sorted(final_exon.iterkeys()): + final_exon_sizes.append(final_exon[k]-k) + final_exon_starts.append(k-(min(Merge_bed_TxStart[id]))) + + FO.write(Merge_bed_chr[id] + "\t" + str(min(Merge_bed_TxStart[id])) + "\t" + str(max(Merge_bed_TxEnd[id])) +"\t") #column 1,2,3 + FO.write("BED_box_" + str(id) + "\t0\t") #column 4,5 + FO.write(Merge_bed_strand[id] +"\t") #column 6 + FO.write(str(min(Merge_bed_cdsStart[id])) + "\t" + str(max(Merge_bed_cdsEnd[id])) + "\t" + "255,0,0"+"\t") #column 7,8,9 + FO.write(str(len(final_exon_starts)) +'\t') #column 10 + FO.write(','.join(map(str,final_exon_sizes))+"\t") #column 11 + FO.write(','.join(map(str,final_exon_starts)) + "\n") #column 12 + + self.f.seek(0) + FO.close() + + def correctSplicingBed(self,genome,outfile,sp="GTAG,GCAG,ATAC"): + '''input should be bed12 file representing splicing junctions. The function will compare + the splicing motif to genome. To see if the direcion is correct or not. Only consider GT/AG + GC/AG, AT/AC motifs. Multiple spliced reads are accepted''' + + fout=open(outfile,'w') + motif=sp.upper().split(',') + motif_rev = [m.translate(self.transtab)[::-1] for m in motif] + print >>sys.stderr, "\tloading "+genome+'...' + tmp=fasta.Fasta(genome) + for line in self.f: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + line=line.strip() + fields=line.split() + if (len(fields)<12): + print >>fout,line + continue + + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + cds_start = int( fields[6] ) + cds_end = int( fields[7] ) + exon_num= int(fields[9]) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map(int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + splice_strand=[] + for st,end in zip(intron_start,intron_end): + splice_motif = tmp.fetchSeq(chrom, st, st+2) + tmp.fetchSeq(chrom, end-2, end) + if splice_motif in motif: + splice_strand.append('+') + elif splice_motif in motif_rev: + splice_strand.append('-') + else: + splice_strand.append('.') + + real_strand = set(splice_strand) + if (len(real_strand) ==1): + print >>fout,"\t".join((fields[0],fields[1],fields[2],fields[3],fields[4],real_strand.pop(),fields[6],fields[7],fields[8],fields[9],fields[10],fields[11])) + else: + print >>fout,"\t".join((fields[0],fields[1],fields[2],fields[3],fields[4],'.',fields[6],fields[7],fields[8],fields[9],fields[10],fields[11])) + self.f.seek(0) + fout.close() + + def nrBED(self,outfile=None): + '''redundant bed entries (exactly the same gene structure) in bed12 file will be merged.''' + if outfile is None: + outfile = self.fileName + ".nr.bed" + FO=open(outfile,'w') + + mergeGene=collections.defaultdict(list) + print >>sys.stderr, "Removing redundcany from " + self.fileName + " ..." + for line in self.f: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip().split() + chrom = fields[0] # + txStart= fields[1] # + txEnd= fields[2] # + geneName=fields[3] + score=fields[4] + strand = fields[5] # + cdsStart= fields[6] # + cdsEnd= fields[7] # + blockCount = fields[9] # + blockSize = fields[10] # + blockStart = fields[11] # + + key = ":".join((chrom,txStart,txEnd,strand,cdsStart,cdsEnd,blockCount,blockSize,blockStart)) + mergeGene[key].append(geneName) + for k in mergeGene: + fields=k.split(":") + name=";".join(mergeGene[k]) + FO.write(fields[0] +'\t' + fields[1] + '\t' + fields[2] + '\t' + name + '\t0\t' + fields[3] + '\t' + fields[4] +'\t'+fields[5] +'\t0,0,0\t'+fields[6] +'\t' + fields[7] +'\t'+fields[8] +'\n') + self.f.seek(0) + FO.close() + + +class CompareBED: + '''Compare two bed fies. Standard BED file has 12 fields. (http://genome.ucsc.edu/FAQ/FAQformat.html)''' + + def __init__(self,bedFileA,bedFileB): + '''This is constructor of ParseBED. Must provide two bed files for comprison. 1st bed file is + user input bed, while 2nd bed file is usually a reference gene model''' + self.A_fh=open(bedFileA,'r') + self.A_full_Name=bedFileA + self.A_base_Name=os.path.basename(bedFileA) + self.B_fh=open(bedFileB,'r') + self.B_full_Name=bedFileB + self.B_base_Name=os.path.basename(bedFileB) + + + def annotateEvents(self,outfile=None): + '''Compare bed file A to bed file B (usually a bed file for reference gene model). + NOTE that only intron boundaries are compared. This function is useful if one want to + find if a junctions is novel or not. bed file A will divided into two files: *.known.bed + and *.novel.bed''' + + if outfile is None: + KnownBed = self.A_base_Name + ".known.bed" + NovelBed = self.A_base_Name + ".novel.bed" + else: + KnownBed = outfile + ".known.bed" + NovelBed = outfile + ".novel.bed" + KNO=open(KnownBed,'w') + NOV=open(NovelBed,'w') + + #print >>sys.stderr,"writing intron to " + outfile + " ..." + ref_blocks=collections.defaultdict(dict) + + print >>sys.stderr, "reading reference bed file",self.B_full_Name, " ... ", + for line in self.B_fh: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for i_st,i_end in zip (intron_start, intron_end): + key_str=str(i_st) + '_' + str(i_end) + ref_blocks[chrom][key_str]=i_end + + print >>sys.stderr,"Done" + + print >>sys.stderr, "processing",self.A_full_Name, "...", + for line in self.A_fh: + found=0 + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + + for i_st, i_end in sorted (zip (intron_start,intron_end)): + key_str=str(i_st) + '_' + str(i_end) + if (ref_blocks[chrom].has_key(key_str)): + #found +=1 + #if (found == len(intron_start)): + print >>KNO, line, + else: + print >>NOV, line, + print >>sys.stderr,"Done" + + def annotateSplicingSites(self,outfile=None): + '''Compare bed file A to bed file B (usually a bed file for reference gene model). NOTE that + only intron boundaries are compared. This function is useful if one want to find if a spilcing + site is novel or not. bed file A will divided into two files: *.known.bed, *.35novel.bed, + *.3novel.bed and *.5novel.bed + + NOTE: splicing junctions with multiple introns will be split''' + + if outfile is None: + KnownBed = self.A_base_Name + ".known.bed" + NovelBed5 = self.A_base_Name + ".5novel.bed" + NovelBed3 = self.A_base_Name + ".3novel.bed" + NovelBed35 = self.A_base_Name + ".35novel.bed" + else: + KnownBed = outfile + ".known.bed" + NovelBed5 = outfile + ".5novel.bed" + NovelBed3 = outfile + ".3novel.bed" + NovelBed35 = outfile + ".35novel.bed" + KNO=open(KnownBed,'w') + N5=open(NovelBed5,'w') + N3=open(NovelBed3,'w') + N35=open(NovelBed35,'w') + + #print >>sys.stderr,"writing intron to " + outfile + " ..." + refIntronStarts=collections.defaultdict(dict) + refIntronEnds=collections.defaultdict(dict) + + print >>sys.stderr, "\treading reference bed file",self.B_full_Name, " ... ", + for line in self.B_fh: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for i_st,i_end in zip (intron_start, intron_end): + refIntronStarts[chrom][i_st] =i_st + refIntronEnds[chrom][i_end] =i_end + + print >>sys.stderr,"Done" + + print >>sys.stderr, "\tprocessing",self.A_full_Name, "...", + for line in self.A_fh: + found=0 + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + score = fields[4] + strand = fields[5] + if int(fields[9] ==1): + continue + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end = exon_starts[1:] + counter=0 + for i_st, i_end in zip (intron_start,intron_end): + counter +=1 + if(strand == '+' or strand == '.'): + if (refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + found =2 #known both + elif (refIntronStarts[chrom].has_key(i_st) and not refIntronEnds[chrom].has_key(i_end)): + found=5 # 5' splice site known, 3' splice site unkonwn + elif (not refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + found=3 # 5' splice site uknown, 3' splice site konwn + else: + found=10 + elif(strand == '-'): + if (refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + found =2 #known + elif (refIntronStarts[chrom].has_key(i_st) and not refIntronEnds[chrom].has_key(i_end)): + found=3 # 5' splice site uknown, 3' splice site konwn + elif (not refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + found=5 # 5' splice site known, 3' splice site unkonwn + else: + found=10 + else: + continue + + if (found == 2): + print >>KNO, '\t'.join((chrom,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),geneName + '_intron' + str(counter),score,strand,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),'0,255,0','2',str(exon_sizes[counter-1]) +','+str(exon_sizes[counter]),'0'+','+str(exon_sizes[counter-1] + i_end - i_st))) + elif(found ==3): + print >>N5, '\t'.join((chrom,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),geneName + '_intron' + str(counter),score,strand,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),'0,255,0','2',str(exon_sizes[counter-1]) +','+str(exon_sizes[counter]),'0'+','+str(exon_sizes[counter-1] + i_end - i_st))) + elif(found ==5): + print >>N3, '\t'.join((chrom,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),geneName + '_intron' + str(counter),score,strand,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),'0,255,0','2',str(exon_sizes[counter-1]) +','+str(exon_sizes[counter]),'0'+','+str(exon_sizes[counter-1] + i_end - i_st))) + elif(found ==10): + print >>N35, '\t'.join((chrom,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),geneName + '_intron' + str(counter),score,strand,str(i_st - exon_sizes[counter-1]),str(i_end + exon_sizes[counter]),'0,255,0','2',str(exon_sizes[counter-1]) +','+str(exon_sizes[counter]),'0'+','+str(exon_sizes[counter-1] + i_end - i_st))) + print >>sys.stderr,"Done" + + def distribBed(self,outfile=None): + '''Compare bed file A (usually a bed file of reads mapping results) to bed file B + (usually a bed file for reference gene model). For each exon/intron of a gene, calculate + how many reads mapped into it.''' + + if outfile is None: + exon_count = self.B_base_Name + "_exon.count.bed" + intron_count = self.B_base_Name + "_intron.count.bed" + rscript=self.B_base_Name + ".piechart.r" + rpdf=self.B_base_Name + ".piechart.pdf" + else: + exon_count = outfile + "_exon.count.bed" + intron_count = outfile + "_intron.count.bed" + rscript=outfile + ".piechart.r" + rpdf=outfile + ".piechart.pdf" + + EXON_OUT = open(exon_count,'w') + INTRON_OUT =open(intron_count,'w') + R_OUT = open(rscript,'w') + + ranges={} + intronReads=0 + exonReads=0 + intergenicReads=0 + totalReads=0 + splicedReads=0 + + #read SAM + print >>sys.stderr, "reading "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith("track"):continue + if line.startswith("#"):continue + if line.startswith('browser'):continue + fields=line.rstrip('\n ').split() + totalReads +=1 + if(len(fields)==12 and fields[9]>1): + splicedReads +=1 + continue + else: + chrom=fields[0].upper() + mid = int(fields[1]) + int((int(fields[2])-int(fields[1]))/2) + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( mid, mid ) ) + self.A_fh.seek(0) + print >>sys.stderr, "Done" + + #read refbed file + print >>sys.stderr, "Assign reads to "+ self.B_base_Name + '...', + for line in self.B_fh: + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + # assign reads to intron + if(strand == '-'): + intronNum=len(intron_starts) + exonNum=len(exon_starts) + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + intronReads += hits + INTRON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\n') + intronNum -= 1 + + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + exonReads += hits + EXON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\n') + exonNum -= 1 + elif(strand == '+'): + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + intronReads += hits + INTRON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + exonReads += hits + EXON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\n') + exonNum += 1 + intergenicReads=totalReads-exonReads-intronReads-splicedReads + print >>sys.stderr, "Done." + '\n' + print >>sys.stderr, "Total reads:\t" + str(totalReads) + print >>sys.stderr, "Exonic reads:\t" + str(exonReads) + print >>sys.stderr, "Intronic reads:\t" + str(intronReads) + print >>sys.stderr, "Splicing reads:\t" + str(splicedReads) + print >>sys.stderr, "Intergenic reads:\t" + str(intergenicReads) + + print >>sys.stderr,"writing R script ...", + totalReads=float(totalReads) + print >>R_OUT, "pdf('%s')" % rpdf + print >>R_OUT, "dat=c(%d,%d,%d,%d)" % (exonReads,splicedReads,intronReads,intergenicReads) + print >>R_OUT, "lb=c('exon(%.2f)','junction(%.2f)','intron(%.2f)','intergenic(%.2f)')" % (exonReads/totalReads,splicedReads/totalReads,intronReads/totalReads,intergenicReads/totalReads) + print >>R_OUT, "pie(dat,labels=lb,col=rainbow(4),clockwise=TRUE,main='Total reads = %d')" % int(totalReads) + print >>R_OUT, "dev.off()" + print >>sys.stderr, "Done." + self.B_fh.seek(0) + + def distribBedWithStrand(self,outfile=None,output=True): + '''Compare bed file A (usually a bed file of reads mapping results) to bed file B + (usually a bed file for reference gene model). + NOTE: When assigning reads (from bed fileA) to gene (bed file B), program will consider + strand information''' + + if output: + if outfile is None: + read_count = self.B_base_Name + "_count.xls" + else: + read_count = outfile + "_count.xls" + + READ_OUT = open(read_count,'w') + + Minus_ranges={} + Plus_ranges={} + unknown_ranges={} + redat = collections.defaultdict(list) + #read bed + print >>sys.stderr, "\treading "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith(("track","#","browser")):continue + fields=line.rstrip('\n ').split() + #juntionID = fields[0] + ":" + fields[1] + ":" fields[2] + ":" + fields[5]; + if(len(fields)<6): + print >>sys.stderr,"[NOTE:input bed must be at least 6 columns] skipped this line: " + line, + if (fields[5] == '-'): + chrom=fields[0].upper() + mid = int(fields[1]) + int((int(fields[2])-int(fields[1]))/2) + if chrom not in Minus_ranges: + Minus_ranges[chrom] = IntervalTree() + else: + Minus_ranges[chrom].insert(mid, mid,fields[4]) + elif (fields[5] == '+'): + chrom=fields[0].upper() + mid = int(fields[1]) + int((int(fields[2])-int(fields[1]))/2) + if chrom not in Plus_ranges: + Plus_ranges[chrom] = IntervalTree() + else: + Plus_ranges[chrom].insert(mid, mid,fields[4]) + else: + chrom=fields[0].upper() + mid = int(fields[1]) + int((int(fields[2])-int(fields[1]))/2) + if chrom not in unknown_ranges: + unknown_ranges[chrom] = IntervalTree() + else: + unknown_ranges[chrom].insert(mid, mid,fields[4]) + + self.A_fh.seek(0) + print >>sys.stderr, "Done" + + #read refbed file + print >>sys.stderr, "\tAssign reads to "+ self.B_base_Name + '...' + for line in self.B_fh: + try: + if line.startswith(("track","#","browser")):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + if output: + READ_OUT.write(line.rstrip() + '\t') + if chrom in Plus_ranges: + tmp=Plus_ranges[chrom].find(tx_start,tx_end) + if(len(tmp)>0): + READ_OUT.write(','.join(tmp) + '\t') + else: + READ_OUT.write('0\t') + if chrom in Minus_ranges: + tmp=Minus_ranges[chrom].find(tx_start,tx_end) + if (len(tmp)>0): + READ_OUT.write(','.join(tmp) + '\t') + else: + READ_OUT.write('0\t') + + if chrom in unknown_ranges: + tmp=unknown_ranges[chrom].find(tx_start,tx_end) + if (len(tmp)>0): + READ_OUT.write(','.join(tmp) + '\n') + else: + READ_OUT.write('0\n') + else: + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + if chrom in Plus_ranges and len(Plus_ranges[chrom].find(tx_start,tx_end))>0: + redat[key].append(','.join(Plus_ranges[chrom].find(tx_start,tx_end))) + else: + redat[key].append('0') + + if chrom in Minus_ranges and len(Minus_ranges[chrom].find(tx_start,tx_end))>0: + redat[key].append(','.join(Minus_ranges[chrom].find(tx_start,tx_end))) + else: + redat[key].append('0') + if chrom in unknown_ranges and len(unknown_ranges[chrom].find(tx_start,tx_end))>0: + redat[key].append(','.join(unknown_ranges[chrom].find(tx_start,tx_end))) + else: + redat[key].append('0') + if output is not True: + return redat + print >>sys.stderr, "Done." + self.B_fh.seek(0) + + def distribSpliceSites(self,outfile=None,output=True): + '''Compare bed file A (usually a bed file of splicing junctions) to bed file B + (usually a bed file for reference gene model). + NOTE: When assigning reads (from bed fileA) to gene (bed file B), program will consider + strand information''' + + if output: + if outfile is None: + read_count = self.B_base_Name + "_count.xls" + else: + read_count = outfile + "_count.xls" + + READ_OUT = open(read_count,'w') + + Minus_ranges={} + Plus_ranges={} + unknown_ranges={} + redat = collections.defaultdict(list) + #read bed + print >>sys.stderr, "\treading "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith(("track","#","browser")):continue + fields=line.rstrip('\n ').split() + juntionID = fields[0] + ":" + fields[1] + ":" + fields[2] + ":" + fields[5] + if(len(fields)<12): + print >>sys.stderr,"[NOTE:input bed must be at least 12 columns] skipped this line: " + line, + continue + + + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + + for st,end in zip(intron_starts,intron_ends): + junctionID=chrom + ":" + str(st) + ":" + str(end) + if (fields[5] == '-'): + if chrom not in Minus_ranges: + Minus_ranges[chrom] = IntervalTree() + else: + Minus_ranges[chrom].insert(st, st,(junctionID,fields[4])) + Minus_ranges[chrom].insert(end, end,(junctionID,fields[4])) + elif (fields[5] == '+'): + if chrom not in Plus_ranges: + Plus_ranges[chrom] = IntervalTree() + else: + Plus_ranges[chrom].insert(st, st,(junctionID,fields[4])) + Plus_ranges[chrom].insert(end, end,(junctionID,fields[4])) + else: + if chrom not in unknown_ranges: + unknown_ranges[chrom] = IntervalTree() + else: + unknown_ranges[chrom].insert(st, st,(junctionID,fields[4])) + unknown_ranges[chrom].insert(end, end,(junctionID,fields[4])) + + self.A_fh.seek(0) + print >>sys.stderr, "Done" + + #read refbed file + print >>sys.stderr, "\tAssign reads to "+ self.B_base_Name + '...' + for line in self.B_fh: + try: + if line.startswith(("track","#","browser")):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + if output: + READ_OUT.write(line.rstrip() + '\t') + if chrom in Plus_ranges: + tmp=Plus_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + READ_OUT.write(','.join(locus) + '\t') + else:READ_OUT.write('0\t') + else:READ_OUT.write('0\t') + + if chrom in Minus_ranges: + tmp=Minus_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + READ_OUT.write(','.join(locus) + '\t') + else:READ_OUT.write('0\t') + else:READ_OUT.write('0\t') + + if chrom in unknown_ranges: + tmp=unknown_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + READ_OUT.write(','.join(locus) + '\n') + else:READ_OUT.write('0\n') + else:READ_OUT.write('0\n') + + else: + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + if chrom in Plus_ranges: + tmp = Plus_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + redat[key].append(','.join(locus)) + else:redat[key].append('0') + else:redat[key].append('0') + + + if chrom in Minus_ranges: + tmp = Minus_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + redat[key].append(','.join(locus)) + else:redat[key].append('0') + else:redat[key].append('0') + + + if chrom in unknown_ranges: + tmp = unknown_ranges[chrom].find(tx_start,tx_end) + locus=[] + junction_list=[] + if(len(tmp)>0): + for j in tmp: + if j[0] not in junction_list: + locus.append(j[1]) + junction_list.append(j[0]) + + redat[key].append(','.join(locus)) + else:redat[key].append('0') + else:redat[key].append('0') + + if output is not True: + return redat + print >>sys.stderr, "Done." + self.B_fh.seek(0) + + def findClosestTSS(self,outfile=None,downStream=50000,upStream=50000): + '''For each entry in input bed file (1st bed file), find the nearest gene (2nd bed file) based + on TSS. Genes shared the same TSS will be grouped together. + NOTE: gene is represented by its TSS, input bed entry is represented by its middle point. + NOTE: this is peak centered, for each peak find the nearest gene(s)''' + + if outfile is None: + outfileName = self.A_base_Name + ".nearestTSS.xls" + else: + outfileName = outfile + ".nearestTSS.xls" + OUT=open(outfileName,'w') + + ranges={} + tss_group={} + tss_group_num=0 + #read reference bed file + print >>sys.stderr, "Reading "+ self.B_base_Name + '...', + for line in self.B_fh: + if line.startswith(("#","track","browser")):continue + fields=line.rstrip('\n ').split() + + chrom = fields[0] + geneName = fields[3] + if (len(fields) >=6): + if (fields[5] == '-'): + tss_st = int(fields[2]) - 1 + tss_end = int(fields[2]) + else: + tss_st = int(fields[1]) + tss_end =int(fields[1]) + 1 + elif (len(fields) < 6 and len(fields) >=3 ): + tss_st = int(fields[1]) + tss_end =int(fields[1]) + 1 + else: + print >>sys.stderr, "reference bed file must be at least 3 columns" + sys.exit() + + key=chrom + ":" + str(tss_st) + ':' + str(tss_end) + if key not in tss_group: + tss_group[key] = geneName + ";" + else: + tss_group[key] += geneName + ";" + + for key in tss_group: + tss_group_num +=1 + chrom,tss_st,tss_end = key.split(":") + #print chrom + '\t'+ tss_st +'\t' + tss_end + if chrom not in ranges: + ranges[chrom] = IntervalTree() + ranges[chrom].insert_interval( Interval( int(tss_st), int(tss_end),value=tss_group[key] + '\t' + key) ) + + self.B_fh.seek(0) + print >>sys.stderr, "Done. Total " + str(tss_group_num) + " TSS groups" + + #a=ranges['chr1'].find(1000000,1200000) + #print a + + + + #read input bed file + print >>sys.stderr, "Find nearest TSS(s) for "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith(("#","track","browser")):continue + fields=line.rstrip('\n ').split() + + if (len(fields)>=6): + chain = fields[5] + elif (len(fields) < 6 and len(fields) >=3 ): + chain = '+' + else: + print >>sys.stderr, "Input bed file must be at least 3 columns" + sys.exit() + + chrom = fields[0] + bed_st = int(fields[1]) + int((int(fields[2]) - int(fields[1]))/2) + bed_end = bed_st +1 + + up=ranges[chrom].upstream_of_interval(Interval(bed_st,bed_end,strand=chain),num_intervals=1,max_dist=upStream) + down=ranges[chrom].downstream_of_interval(Interval(bed_st,bed_end,strand=chain),num_intervals=1,max_dist=downStream) + + if (len(up) >0): + up_name=up[0].value + up_dist=abs(up[0].end - bed_end) + else: + up_name="NA\tNA" + up_dist="NA" + if (len(down) >0): + down_name=down[0].value + down_dist=abs(down[0].end - bed_end) + else: + down_name="NA\tNA" + down_dist="NA" + print >>OUT, line.rstrip() + "\t" + up_name + "\t" + str(up_dist) + '\t' + down_name + "\t" + str(down_dist) + + self.A_fh.seek(0) + print >>sys.stderr, "Done." + + + def findClosestTTS(self,outfile=None,downStream=50000,upStream=50000): + '''For each entry in input bed file (1st bed file), find the nearest gene (2nd bed file) based + on TTS. Genes shared the same TTS will be grouped together. + NOTE: gene is represented by its TTS, input bed entry is represented by its middle point.''' + + if outfile is None: + outfileName = self.A_base_Name + ".nearestTTS.xls" + else: + outfileName = outfile + ".nearestTTS.xls" + OUT=open(outfileName,'w') + + ranges={} + tts_group={} + tts_group_num=0 + #read reference bed file + print >>sys.stderr, "Reading "+ self.B_base_Name + '...', + for line in self.B_fh: + if line.startswith(("#","track","browser")):continue + fields=line.rstrip('\n ').split() + + chrom = fields[0] + geneName = fields[3] + if (len(fields) >=6): + if (fields[5] == '-'): + tts_st = int(fields[1]) + tts_end = int(fields[1]) + 1 + else: + tts_st = int(fields[2]) - 1 + tts_end =int(fields[2]) + elif (len(fields) < 6 and len(fields) >=3 ): + tts_st = int(fields[2]) - 1 + tts_end =int(fields[2]) + else: + print >>sys.stderr, "reference bed file must be at least 3 columns" + sys.exit() + + key=chrom + ":" + str(tts_st) + ':' + str(tts_end) + if key not in tts_group: + tts_group[key] = geneName + ";" + else: + tts_group[key] += geneName + ";" + + for key in tts_group: + tts_group_num +=1 + chrom,tts_st,tts_end = key.split(":") + #print chrom + '\t'+ tts_st +'\t' + tts_end + if chrom not in ranges: + ranges[chrom] = IntervalTree() + ranges[chrom].insert_interval( Interval( int(tts_st), int(tts_end),value=tts_group[key] + '\t' + key) ) + + self.B_fh.seek(0) + print >>sys.stderr, "Done. Total " + str(tts_group_num) + " TTS groups" + + #a=ranges['chr1'].find(1000000,1200000) + #print a + + + + #read input bed file + print >>sys.stderr, "Find nearest TTS(s) for "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith(("#","track","browser")):continue + fields=line.rstrip('\n ').split() + + if (len(fields)>=6): + chain = fields[5] + elif (len(fields) < 6 and len(fields) >=3 ): + chain = '+' + else: + print >>sys.stderr, "Inut bed file must be at least 3 columns" + sys.exit() + + chrom = fields[0] + bed_st = int(fields[1]) + int((int(fields[2]) - int(fields[1]))/2) + bed_end = bed_st +1 + + up=ranges[chrom].upstream_of_interval(Interval(bed_st,bed_end,strand=chain),num_intervals=1,max_dist=upStream) + down=ranges[chrom].downstream_of_interval(Interval(bed_st,bed_end,strand=chain),num_intervals=1,max_dist=downStream) + + if (len(up) >0): + up_name=up[0].value + up_dist=abs(up[0].end - bed_end) + else: + up_name="NA\tNA" + up_dist="NA" + if (len(down) >0): + down_name=down[0].value + down_dist=abs(down[0].end - bed_end) + else: + down_name="NA\tNA" + down_dist="NA" + print >>OUT, line.rstrip() + "\t" + up_name + "\t" + str(up_dist) + '\t' + down_name + "\t" + str(down_dist) + + self.A_fh.seek(0) + print >>sys.stderr, "Done." + + + def findClosestPeak(self,mod, downStream=50000,upStream=50000): + '''For each entry in second bed file (reference gene model) find the closest peak defined in the fist bed file''' + + mode={ + 0:'TSS-up, TSS-down', + 1:'TSS-up, TES-down', + 2:'TES-up, TES-down', + 3:'CDSS-up, CDSS-down', + 4:'CDSS-up, CDSE-down', + 5:'CDSE-up, CDSE-down' + } + ranges={} + + #read peak bed file + print >>sys.stderr, "\tReading "+ self.A_base_Name + '...', + for line in self.A_fh: + if line.startswith(("#","track","browser")):continue + if not line.strip(): continue + line = line.strip('\n') + fields=line.split() + + if len(fields)>=3 and len(fields) < 6: + chrom = fields[0] + start = fields[1] + end = fields[2] + peak_id = "ID=" + chrom + ":" + start + '-' + end + ":" + 'Score=0' + #middle = int(int(start) + (int(start) + int(end))/2) + if len(fields)>=6: + chrom = fields[0] + start = fields[1] + end = fields[2] + peak_id = "ID=" + chrom + ":" + start + '-' + end + ":" + 'Score=' + fields[4] + #middle = int(int(start) + (int(start) + int(end))/2) + if chrom not in ranges: + ranges[chrom] = IntervalTree() + ranges[chrom].insert_interval( Interval(int(start), int(end), value = peak_id) ) + print >>sys.stderr, "Done" + + #read reference gene model bed file + line_id=0 + nearest_peak={} + print >>sys.stderr, "\tFind nearest peaks for "+ self.B_base_Name + '...', + for line in self.B_fh: + if line.startswith(("#","track","browser")):continue + if not line.strip():continue + fields=line.rstrip('\n ').split() + line_id +=1 + try: + strand = fields[5] + chrom = fields[0] + if strand == '-': + TSS = int(fields[2]) + TES = int(fields[1]) + CDSS = int(fields[7]) + CDSE = int(fields[6]) + elif strand != '-': + strand='+' + TSS = int(fields[1]) + TES = int(fields[2]) + CDSS = int(fields[6]) + CDSE = int(fields[7]) + geneName=fields[3] + score=fields[4] + blockCount = fields[9] + blockSize = fields[10] + blockStart = fields[11] + #line_id = geneName + except: + print >>sys.stderr, "Reference gene model must 12 column BED files" + sys.exit(1) + if chrom in ranges: + if mod==0: #TSS-up, TSS-down + hits = ranges[chrom].find(TSS - upStream, TSS + downStream ) + elif mod==1: # TSS-up, TES-down + if strand == '+': hits = ranges[chrom].find(TSS - upStream, TES + downStream) + if strand == '-': hits = ranges[chrom].find(TSS + upStream, TES - downStream) + elif mod==2: #TES-up, TES-down + hits = ranges[chrom].find(TES - upStream, TES + downStream ) + elif mod==3: #CDSS-up, CDSS-down + hits = ranges[chrom].find(CDSS - upStream, CDSS + downStream ) + elif mod==4: #CDSS-up, CDSE-down + if strand == '+': hits = ranges[chrom].find(CDSS - upStream, CDSE + downStream) + if strand == '-': hits = ranges[chrom].find(CDSS + upStream, CDSE - downStream) + elif mod==5: #CDSE-up, CDSE-down + hits = ranges[chrom].find(CDSE - upStream, CDSE + downStream ) + else: + print >>sys.stderr, "unknow arguments for 'mod'" + return None + if (len(hits) >0): + val = ','.join([i.value for i in hits]) + nearest_peak[line_id]=val + else: + nearest_peak[line_id] ="NA" + else: nearest_peak[line_id] = "NA" + print >>sys.stderr, "Done." + return nearest_peak + #FO=open("aaa",'w') + #for k,v in nearest_peak.items(): + # print >>FO, str(k) + '\t' + str(v) + + + def bestMatch(self): + '''Exon chain comparison. Given a bed entry in bedFileA, find the best-matched gene from bedFileB. + If multiple genes from bedFileB matched equally good. Randomly report one.''' + + #read reference gene model + + ref_ranges={} + ref_cdsRange={} + print >>sys.stderr, "\tReading reference gene model " + self.B_base_Name + '...' + for line in self.B_fh: + boundaries=set() + #try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + chrom = fields[0] + txStart = int(fields[1]) + txEnd = fields[2] + geneName = fields[3] + score = fields[4] + strand = fields[5] + cdsStart = fields[6] + cdsEnd = fields[7] + geneID = chrom + ":" + str(txStart) + "-" + txEnd + ":" + strand + ':' + geneName + + #boundaries.add(int(cdsStart)) + #boundaries.add(int(cdsEnd)) + + ref_cdsRange[geneID] = [int(cdsStart),int(cdsEnd)] + + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + #except: + # print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + # continue + for st,end in zip(exon_start,exon_end): + boundaries.add(st) + boundaries.add(end) + chrom = chrom + ':' + strand + if chrom not in ref_ranges: + ref_ranges[chrom] = IntervalTree() + ref_ranges[chrom].insert(int(txStart), int(txEnd),{geneID : boundaries}) + + print >>sys.stderr, "\tReading " + self.A_base_Name + '...' + #read bed file + utr_diff_score = -0.5 + cds_diff_score = -1 + common_score = 8 + line_id=0 + ret_dict={} + for line in self.A_fh: + boundaries=set() + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + if not line.strip():continue + + line_id += 1 + fields=line.rstrip('\r\n').split() + chrom = fields[0] + txStart = int(fields[1]) + txEnd = fields[2] + geneName = fields[3] + score = fields[4] + strand = fields[5] + cdsStart = fields[6] + cdsEnd = fields[7] + geneID = chrom + ":" + str(txStart) + "-" + txEnd + ":" + strand + ':' + geneName + + #boundaries.add(int(cdsStart)) + #boundaries.add(int(cdsEnd)) + + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + for st,end in zip(exon_start,exon_end): + boundaries.add(st) + boundaries.add(end) + + chrom = chrom + ':' + strand + #print line.strip() + '\t', + if chrom in ref_ranges: + overlap_genes = ref_ranges[chrom].find(int(txStart),int(txEnd)) + if len(overlap_genes)==0: #not overlap with any gene + status = "novel_gene(non-overlap with known gene)" + else: #overlap with known gene + diff_dict=collections.defaultdict(int) #note the higher score, the better similarity + + #which ref gene is best match + for i in overlap_genes: + status = '' + ref_gene_marks = i.values()[0] + ref_gene_id = i.keys()[0] + input_gene_marks = boundaries + + ref_gene_uniq = ref_gene_marks.difference(input_gene_marks) + input_gene_uniq = input_gene_marks.difference(ref_gene_marks) + common = input_gene_marks.intersection(ref_gene_marks) + if ref_gene_marks.__eq__(input_gene_marks): #boundaries 100% match to known exon chain + status = 'complete_match' + '_' + ref_gene_id + break + + for bd in common: + diff_dict[ref_gene_id] += common_score + for bd in input_gene_uniq: + if bd >= int(cdsStart) or bd <= int(cdsEnd): + diff_dict[ref_gene_id] += cds_diff_score + else: + diff_dict[ref_gene_id] += utr_diff_score + + for bd in ref_gene_uniq: + if bd >= ref_cdsRange[ref_gene_id][0] or bd <= ref_cdsRange[ref_gene_id][1]: + diff_dict[ref_gene_id] += cds_diff_score + else: + diff_dict[ref_gene_id] += utr_diff_score + + if status.find('complete_match')==-1: + bestID = max(diff_dict,key=diff_dict.get) + for i in overlap_genes: + if i.keys()[0] == bestID: + ref_best_match_set = i.values()[0] + break + + #we found a ref gene best match to input gene + input_gene_marks = boundaries + i_union = ref_best_match_set.union(input_gene_marks) + i_intersection = ref_best_match_set.intersection(input_gene_marks) + ref_gene_uniq = ref_best_match_set.difference(input_gene_marks) + input_gene_uniq = input_gene_marks.difference(ref_best_match_set) + + if len(i_intersection) == 0: + status = "novel_gene(overlap with known gene)" + bestID + else: + tmp=set() + for bd in ref_gene_uniq: + if bd >= ref_cdsRange[bestID][0] or bd <= ref_cdsRange[bestID][1]: + tmp.add('different CDS') + #status = "partial_match (different CDS)" + bestID + else: + tmp.add('different UTR') + #status = "partial_match (different UTR)" + bestID + status = 'partial_match (' + ';'.join(tmp) + ')' + else: + status = 'unknown' + ret_dict[line_id] = status + return ret_dict + +def unionBed3(lst): + '''Take the union of 3 column bed files. return a new list''' + bitsets = binned_bitsets_from_list(lst) + ret_lst=[] + for chrom in bitsets: + bits = bitsets[chrom] + end = 0 + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + ret_lst.append([chrom, start, end]) + bitsets=dict() + return ret_lst + +def intersectBed3(lst1,lst2): + '''Take the intersection of two bed files (3 column bed files)''' + bits1 = binned_bitsets_from_list(lst1) + bits2 = binned_bitsets_from_list(lst2) + + bitsets = dict() + ret_lst = [] + for key in bits1: + if key in bits2: + bits1[key].iand( bits2[key] ) + bitsets[key] = bits1[key] + + for chrom in bitsets: + bits = bitsets[chrom] + end = 0 + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + ret_lst.append([chrom, start, end]) + bits1 = dict() + bits2 = dict() + bitsets = dict() + return ret_lst + +def subtractBed3(lst1,lst2): + '''subtrack lst2 from lst1''' + bitsets1 = binned_bitsets_from_list(lst1) + bitsets2 = binned_bitsets_from_list(lst2) + + ret_lst=[] + for chrom in bitsets1: + if chrom not in bitsets1: + continue + bits1 = bitsets1[chrom] + if chrom in bitsets2: + bits2 = bitsets2[chrom] + bits2.invert() + bits1.iand( bits2 ) + end=0 + while 1: + start = bits1.next_set( end ) + if start == bits1.size: break + end = bits1.next_clear( start ) + ret_lst.append([chrom,start,end]) + bitsets1 = dict() + bitsets2 = dict() + return ret_lst + +def tillingBed(chrName,chrSize,stepSize=10000): + '''tilling whome genome into small sizes''' + #tilling genome + for start in xrange(0,chrSize,stepSize): + end = start + stepSize + if end < chrSize: + yield (chrName,start,end) + else: + yield (chrName,start,chrSize) + diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.pyc new file mode 100644 index 0000000..efa41a2 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/BED.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.py new file mode 100755 index 0000000..7612e01 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +'''deal with Kmer. DNA sequence should only A, C, G, T. python2.7 or newer''' + +#import built-in modules +import os,sys +import numpy +import math +from collections import Counter +import re +import itertools + +from cpmodule import ireader + +def word_generator(seq,word_size,step_size,frame=0): + '''generate DNA word from sequence using word_size and step_size. Frame is 0, 1 or2''' + for i in xrange(frame,len(seq),step_size): + word = seq[i:i+word_size] + if len(word) == word_size: + yield word + +def seq_generator(fastafile): + '''DNA sequence only contains A,C,G,T,N. sequence with other characters will be removed''' + tmpseq='' + name='' + DNA_pat = re.compile(r'^[ACGTN]+$') + for line in ireader.reader(fastafile): + line=line.strip().upper() + if line.startswith(('#',' ','\n')):continue + if line.startswith(('>','@')): + if tmpseq: + yield [name,tmpseq] + tmpseq='' + name = line.split()[0][1:] + elif DNA_pat.match(line): + tmpseq += line + yield [name,tmpseq] + +def all_possible_kmer(l): + '''return all possible combinations of A,C,G,T,N. only support A,C,G,T,N. l is length of kmer''' + for i in itertools.product(['A','C','G','T','N'],repeat=l): + yield ''.join(i) + +def kmer_freq_file (fastafile,word_size,step_size=1,frame=0,min_count=0): + '''Calculate kmer frequency from fasta file''' + seq_num = 0 + ret_dict={} + for n,s in seq_generator(fastafile): + seq_num += 1 + if seq_num == 1: + count_table = Counter(word_generator(s,word_size=word_size,step_size=step_size,frame=frame)) + else: + count_table.update( word_generator(s,word_size=word_size,step_size=step_size,frame=frame) ) + + #return count_table + for kmer in all_possible_kmer(word_size): + if not count_table.has_key(kmer): count_table[kmer]=0 + if count_table[kmer] >= min_count: + #print kmer + '\t' + str(count_table[kmer]) + if 'N' in kmer:continue + ret_dict[kmer] = count_table[kmer] + return ret_dict + +def kmer_freq_seq (seq,word_size,step_size=1,frame=0,min_count=0): + '''Calculate kmer frequency from DNA sequence. coding. genome is hexamer table calculated + from coding region and whole genome (as background control) + ''' + count_table = Counter(word_generator(seq,word_size=word_size,step_size=step_size,frame=frame)) + for kmer in all_possible_kmer(word_size): + if not count_table.has_key(kmer): count_table[kmer]=0 + if count_table[kmer] >= min_count: + print kmer + '\t' + str(count_table[kmer]) + +def kmer_ratio(seq,word_size,step_size,coding,noncoding): + if len(seq) < word_size: + return 0 + + sum_of_log_ratio_0 = 0.0 + sum_of_log_ratio_1 = 0.0 + sum_of_log_ratio_2 = 0.0 + frame0_count=0.0 + frame1_count=0.0 + frame2_count=0.0 + for k in word_generator(seq=seq, word_size = word_size, step_size=step_size,frame=0): + if (not coding.has_key(k)) or (not noncoding.has_key(k)): + continue + if coding[k]>0 and noncoding[k] >0: + sum_of_log_ratio_0 += math.log( coding[k] / noncoding[k]) + elif coding[k]>0 and noncoding[k] == 0: + sum_of_log_ratio_0 += 1 + elif coding[k] == 0 and noncoding[k] == 0: + continue + elif coding[k] == 0 and noncoding[k] >0 : + sum_of_log_ratio_0 -= 1 + else: + continue + frame0_count += 1 + ''' + for k in word_generator(seq=seq, word_size = word_size, step_size=step_size,frame=1): + if (not coding.has_key(k)) or (not noncoding.has_key(k)): + continue + if coding[k]>0 and noncoding[k] >0: + sum_of_log_ratio_1 += math.log( coding[k] / noncoding[k]) + elif coding[k]>0 and noncoding[k] == 0: + sum_of_log_ratio_1 += 1 + elif coding[k] == 0 and noncoding[k] == 0: + continue + elif coding[k] == 0 and noncoding[k] >0 : + sum_of_log_ratio_1 -= 1 + else: + continue + frame1_count += 1 + + for k in word_generator(seq=seq, word_size = word_size, step_size=step_size,frame=2): + if (not coding.has_key(k)) or (not noncoding.has_key(k)): + continue + if coding[k]>0 and noncoding[k] >0: + sum_of_log_ratio_2 += math.log( coding[k] / noncoding[k]) + elif coding[k]>0 and noncoding[k] == 0: + sum_of_log_ratio_2 += 1 + elif coding[k] == 0 and noncoding[k] == 0: + continue + elif coding[k] == 0 and noncoding[k] >0 : + sum_of_log_ratio_2 -= 1 + else: + continue + frame2_count += 1 + return max(sum_of_log_ratio_0/frame0_count, sum_of_log_ratio_1/frame1_count,sum_of_log_ratio_2/frame2_count) + ''' + try: + return sum_of_log_ratio_0/frame0_count + except: + return -1 + + diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.pyc new file mode 100644 index 0000000..f62d9e8 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/FrameKmer.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/PSL.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/PSL.py new file mode 100755 index 0000000..f9f2f16 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/PSL.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python +'''manipulate blat PSL file.''' + +#import built-in modules +import os,sys +import re +import string +from optparse import OptionParser +import warnings + +#import third-party modules + +#changes to the paths + +#changing history to this module + + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.0.1" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + +class PSL: + '''manipulate PSL format file (blat output file)''' + + def __init__(self,inputfile_name,score=20,block=2): + '''initialize this class + arg1: inputfile psl file + arg2: score cutoff. only report alignments with score >= this value. default=20 + arg3: block count cutoff. only report alignments with block number <= this value. default=2 + eg: a=PSL("filename",30,2) or a=PSL.PSL("filename",30,2) + ''' + self.__inputfile=open(inputfile_name,'r') + self.__scoreCutoff=score #matched score smaller than this value will be removed + self.__blockCutoff=block #matched blcok bigger than this value will be removed + self.__pslLine=re.compile(r'^\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+[+-]') #use this re to remove head lines + self.__pslSplit=re.compile(r'\s+') + self.__blankLine=re.compile(r'\s*\n') + self.__data=[] + totalLine=0 + usedLine=0 + nonPslLine=0 + field=[] + while True: + self.__line=self.__inputfile.readline() + if self.__blankLine.match(self.__line): #skip blank line + continue + elif self.__pslLine.match(self.__line): + totalLine=totalLine+1 + field=self.__pslSplit.split(self.__line) + if string.atoi(field[0])< self.__scoreCutoff: + continue + elif string.atoi(field[17]) > self.__blockCutoff: + continue + usedLine = usedLine+1 + self.__data.append(self.__line) + + else: + nonPslLine = nonPslLine+1 + if not self.__line:break #end of file + + print "\nTotal: ", totalLine, "lines" + print "Used: ", usedLine, "lines" + print "Non-PSL: ", nonPslLine,"lines","\n" + + def head(self,limit=10): + '''print out header lines of PSL file, default first 10 lines + eg: a.head(50) + ''' + count=0 #count how many lines have been printed + field=[] + for line in self.__data: + line=line.rstrip("\n") + print line + count=count+1 + if count >= limit:break + + def psl2bedFile(self,output_file=None): + '''transform psl format into bed format. creat 6 column bed files. + col1: target name, typically a chromosome + col2: start coordinate + col3: end coordinate + col4: name of query. if a query is split. sequential number will be added + at the end of the name + col5: score. "matchScore.mismatch" + col6: strand + ''' + + if output_file is None: + sys.stdout=sys.__stdout__ + else: + outfile=open(output_file,'w') + sys.stdout=outfile + field=[] + blockSize=[] + blockStart=[] + for line in self.__data: + line=line.rstrip('\n') + field=self.__pslSplit.split(line) + if string.atoi(field[17]) == 1: + print field[13],"\t",field[15],"\t",field[16],"\t",field[9],"\t",field[0]+'.'+field[1],"\t",field[8] + else: + blockSize=field[18].split(',') + blockSize.pop(-1) + blockStart=field[20].split(',') + blockStart.pop(-1) + for i in range(0,len(blockSize)): + print field[13],"\t",blockStart[i],"\t",string.atoi(blockStart[i])+string.atoi(blockSize[i]),"\t",field[9]+'.'+str(i+1),"\t",field[0]+'.'+field[1],"\t",field[8] + +def main(): + parser=OptionParser() + parser.add_option('-i','--input_file',dest="inputFileName",help="Input file name") + parser.add_option('-o','--output_file',dest="outputFileName",help="Output file name") + parser.add_option('-s','--score',dest="scoreCutoff",help="blat mapping score cutoff",type="int",default=20) + parser.add_option('-b','--block_num',dest="blockCutoff",help="block number cutoff",type="int",default=2) + (options,args)=parser.parse_args() + + obj=PSL(options.inputFileName,options.scoreCutoff,options.blockCutoff) + obj.psl2bedFile(options.outputFileName) + +if __name__== '__main__': + main() +else: + print >>sys.stderr, "module " + __name__ + " imported!" + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/SAM.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/SAM.py new file mode 100755 index 0000000..30b158f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/SAM.py @@ -0,0 +1,3933 @@ +#!/usr/bin/env python +'''manipulate SAM file.''' + +#import built-in modules +import os,sys +import re +import string +from optparse import OptionParser +import warnings +import string +import collections +import math +import sets +import random + +#import third-party modules +from bx.bitset import * +from bx.bitset_builders import * +from bx.intervals import * +from bx.binned_array import BinnedArray +from bx_extras.fpconst import isNaN +from bx.bitset_utils import * +import pysam +from cpmodule import mystat +from cpmodule import fasta +from cpmodule import cigar +from cpmodule import BED +#changes to the paths + +#changing history to this module +#05/26/2011: suppport multiple spliced mapped reads +#10/13/2011: saturation test for RNAs-eq data + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.3.0" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + +class ParseSAM: + '''This class provides fuctions to parsing/processing/transforming SAM format file + Format of SAM file see: http://samtools.sourceforge.net/SAM1.pdf''' + _reExpr1=re.compile(r'\s+') #>=1 spaces + _reExpr2=re.compile(r'^\s*$') #blank line + _splicedHit_pat = re.compile(r'(\d+)[M|N]',re.IGNORECASE) #regular expression for spliced mapped reads + _monoHit_pat = re.compile(r'^(\d+)M$',re.IGNORECASE) #regular expresion for Non-spliced mapped reads + _insertionHit_pat =re.compile(r'\d+I',re.IGNORECASE) + _deletionHit_pat =re.compile(r'\d+D',re.IGNORECASE) + _softClipHi_pat =re.compile(r'\d+S',re.IGNORECASE) + _hardClipHi_pat =re.compile(r'\d+H',re.IGNORECASE) + _padHit_pat =re.compile(r'\d+P',re.IGNORECASE) + _uniqueHit_pat = re.compile(r'[NI]H:i:1\b') + + def __init__(self,samFile): + '''constructor''' + if samFile == '-': + self.fileName = "STDIN" + self.f = sys.stdin + else: + self.fileName = os.path.basename(samFile) + self.f=open(samFile,'r') + + def stat (self): + '''Calculate mapping statistics''' + total_read=0 + + pcr_duplicate =0 + low_qual =0 + secondary_hit =0 + + unmapped_read1=0 + mapped_read1=0 + reverse_read1=0 + forward_read1=0 + + unmapped_read2=0 + mapped_read2=0 + reverse_read2=0 + forward_read2=0 + + _numSplitHit =0 + _numMonoHit =0 + _numInsertion =0 + _numDeletion =0 + + minus_minus=0 + minus_plus =0 + plus_minus=0 + plus_plus=0 + paired=True + + unmap_SE=0 + map_SE=0 + reverse_SE=0 + forward_SE=0 + for line in self.f: + line=line.rstrip() + if line.startswith('@'):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + + total_read +=1 + field = line.split() + flagCode=string.atoi(field[1]) + if (flagCode & 0x0400 !=0): #PCR or optical duplicate + pcr_duplicate +=1 + continue + if (flagCode & 0x0200 !=0): #Low quality + low_qual +=1 + continue + if (flagCode & 0x0200 !=0): #Not primary alignment + secondary_hit +=1 + continue + if (len(ParseSAM._splicedHit_pat.findall(field[5]))>1):_numSplitHit +=1 #Splicing mapped reads + if (len(ParseSAM._splicedHit_pat.findall(field[5]))==1):_numMonoHit +=1 #mono mapped reads + if (ParseSAM._insertionHit_pat.search(field[5])):_numInsertion +=1 #insertion in reads + if (ParseSAM._deletionHit_pat.search(field[5])):_numDeletion +=1 #deletion in reads + + + + if (flagCode & 0x0001 !=0): #This is paired end sequencing + if (flagCode & 0x0040 != 0): #1st read + if (flagCode & 0x0004 != 0):unmapped_read1 +=1 + if (flagCode & 0x0004 == 0):mapped_read1 +=1 + if (flagCode & 0x0010 != 0):reverse_read1 +=1 + if (flagCode & 0x0010 == 0):forward_read1 +=1 + + if (flagCode & 0x0080 != 0): #2nd read + if (flagCode & 0x0004 != 0):unmapped_read2 +=1 + if (flagCode & 0x0004 == 0):mapped_read2 +=1 + if (flagCode & 0x0010 != 0):reverse_read2 +=1 + if (flagCode & 0x0010 == 0):forward_read2 +=1 + if (flagCode & 0x0010 != 0 and flagCode & 0x0020 != 0): + minus_minus +=1 + if (flagCode & 0x0010 != 0 and flagCode & 0x0020 == 0): + minus_plus +=1 + if (flagCode & 0x0010 == 0 and flagCode & 0x0020 != 0): + plus_minus +=1 + if (flagCode & 0x0010 == 0 and flagCode & 0x0020 == 0): + plus_plus +=1 + if (flagCode & 0x0001 ==0): #This is single end sequencing + paired=False + if (flagCode & 0x0004 != 0): + unmap_SE +=1 + if (flagCode & 0x0004 == 0): + map_SE +=1 + if (flagCode & 0x0010 != 0): + reverse_SE +=1 + if (flagCode & 0x0010 == 0): + forward_SE +=1 + + if paired: + print >>sys.stderr,"\n#==================================================" + print >>sys.stderr,"#================Report (pair-end)=================" + print >>sys.stderr, "%-25s%d" % ("Total Reads:",total_read) + print >>sys.stderr, "%-25s%d" % ("Total Mapped Reads:", (mapped_read1 + mapped_read2)) + print >>sys.stderr, "%-25s%d" % ("Total Unmapped Reads:",(unmapped_read1 + unmapped_read2)) + print >>sys.stderr, "%-25s%d" % ("PCR duplicate:",pcr_duplicate) + print >>sys.stderr, "%-25s%d" % ("QC-failed:",low_qual) + print >>sys.stderr, "%-25s%d" % ("Not primary mapping:",secondary_hit) + print >>sys.stderr, "\n", + print >>sys.stderr, "%-25s%d" % ("Unmapped Read-1:",unmapped_read1) + print >>sys.stderr, "%-25s%d" % ("Mapped Read-1:",mapped_read1) + print >>sys.stderr, "%-25s%d" % (" Forward (+):",forward_read1) + print >>sys.stderr, "%-25s%d" % (" Reverse (-):",reverse_read1) + + print >>sys.stderr, "\n", + print >>sys.stderr, "%-25s%d" % ("Unmapped Read-2:",unmapped_read2) + print >>sys.stderr, "%-25s%d" % ("Mapped Read-2:",mapped_read2) + print >>sys.stderr, "%-25s%d" % (" Forward (+):",forward_read2) + print >>sys.stderr, "%-25s%d" % (" Reverse (-):",reverse_read2) + + print >>sys.stderr, "\n", + print >>sys.stderr, "%-25s%d" % ("Mapped to (+/-):",plus_minus) + print >>sys.stderr, "%-25s%d" % ("Mapped to (-/+):",minus_plus) + print >>sys.stderr, "%-25s%d" % ("Mapped to (+/+):",plus_plus) + print >>sys.stderr, "%-25s%d" % ("Mapped to (-/-):",minus_minus) + print >>sys.stderr, "\n", + print >>sys.stderr, "%-25s%d" % ("Spliced Hits:",_numSplitHit) + print >>sys.stderr, "%-25s%d" % ("Non-spliced Hits:",_numMonoHit) + print >>sys.stderr, "%-25s%d" % ("Reads have insertion:",_numInsertion) + print >>sys.stderr, "%-25s%d" % ("Reads have deletion:",_numDeletion) + else: + print >>sys.stderr,"\n#====================================================" + print >>sys.stderr,"#================Report (single-end)=================" + print >>sys.stderr, "%-25s%d" % ("Total Reads:",total_read) + print >>sys.stderr, "%-25s%d" % ("Total Mapped Reads:", map_SE) + print >>sys.stderr, "%-25s%d" % ("Total Unmapped Reads:",unmap_SE) + print >>sys.stderr, "%-25s%d" % ("PCR duplicate:",pcr_duplicate) + print >>sys.stderr, "%-25s%d" % ("QC-failed:",low_qual) + print >>sys.stderr, "%-25s%d" % ("Not primary mapping:",secondary_hit) + print >>sys.stderr, "%-25s%d" % ("froward (+):",forward_SE) + print >>sys.stderr, "%-25s%d" % ("reverse (-):",reverse_SE) + print >>sys.stderr, "\n", + print >>sys.stderr, "%-25s%d" % ("Spliced Hits:",_numSplitHit) + print >>sys.stderr, "%-25s%d" % ("Non-spliced Hits:",_numMonoHit) + print >>sys.stderr, "%-25s%d" % ("Reads have insertion:",_numInsertion) + print >>sys.stderr, "%-25s%d" % ("Reads have deletion:",_numDeletion) + + def samTobed(self,outfile=None,mergePE=False): + """Convert SAM file to BED file. BED file will be saved as xxx.sam.bed unless otherwise specified. + If mergePE=False, each read will be one bed entry. If mergePE=True, pair-end (if there are and on + the same chr) reads will be displayed in bed entry.""" + if outfile is None: + outfile=self.fileName + ".bed" + + print >>sys.stderr,"\tWriting bed entries to\"",outfile,"\"...", + FO=open(outfile,'w') + for line in self.f: + if line.startswith(('@','track')):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank line + field=line.rstrip().split() + if (string.atoi(field[1]) & 0x0004)!=0: continue #skip unmapped line + if (string.atoi(field[1]) & 0x0040)!=0: + mate="/1" + else: + mate="/2" + flag = string.atoi(field[1]) + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + chrom = field[2] + chromStart = string.atoi(field[3])-1 + chromEnd=chromStart + for i in comb: + chromEnd += i + name = field[0] + mate + score = field[4] + if(flag & 0x0010)==0: + strand = '+' + else: + strand = '-' + thickStart = chromStart + thickEnd = chromEnd + itemRgb = "0,255,0" + blockCount = (len(comb) +1) /2 + blockSize = [] + for i in range(0,len(comb),2): + blockSize.append(str(comb[i])) + blockSizes = ','.join(blockSize) + blockStart=[] + for i in range(0,len(comb),2): + blockStart.append(str(sum(comb[:i]))) + blockStarts = ','.join(blockStart) + print >>FO, string.join((str(i) for i in [chrom,chromStart,chromEnd,name,score,strand,thickStart,thickEnd,itemRgb,blockCount,blockSizes,blockStarts]),sep="\t") + print >>sys.stderr, "Done" + FO.close() + self.f.seek(0) + + if mergePE: + #creat another bed file. pair-end reads will be merged into single bed entry + print >>sys.stderr, "Writing consoidated bed file ...", + bedfile = open(outfile,'r') + outfile_2 = outfile + ".consolidate.bed" + outfile_3 = outfile + '.filter' + FO = open(outfile_2,'w') + FOF = open(outfile_3,'w') + count={} + chr=collections.defaultdict(set) + txSt={} + txEnd={} + strand=collections.defaultdict(list) + blocks={} + sizes=collections.defaultdict(list) + starts=collections.defaultdict(list) + for line in bedfile: + field=line.strip().split() + if field[3] not in count: + count[field[3]] = 1 + chr[field[3]].add(field[0]) + txSt[field[3]] = string.atoi(field[1]) + txEnd[field[3]] = string.atoi(field[2]) + strand[field[3]].append(field[5]) + blocks[field[3]] = string.atoi(field[9]) + sizes[field[3]].extend( field[10].split(',') ) + starts[field[3]].extend([string.atoi(i) + string.atoi(field[1]) for i in field[11].split(',') ]) + else: + count[field[3]] += 1 + chr[field[3]].add(field[0]) + if string.atoi(field[1]) < txSt[field[3]]: + txSt[field[3]] = string.atoi(field[1]) + if string.atoi(field[2]) > txEnd[field[3]]: + txEnd[field[3]] = string.atoi(field[2]) + blocks[field[3]] += string.atoi(field[9]) + strand[field[3]].append(field[5]) + sizes[field[3]].extend( field[10].split(',') ) + starts[field[3]].extend([string.atoi(i) + string.atoi(field[1]) for i in field[11].split(',') ]) + #befile.seek(0) + + for key in count: + st=[] #real sorted starts + sz=[] #real sorted sizes + if(count[key] ==1): #single-end read + if(blocks[key] ==1): #single end, single hit + st = [i - txSt[key] for i in starts[key]] + st = string.join([str(i) for i in st],',') + print >>FO, chr[key].pop(),"\t",txSt[key],"\t",txEnd[key],"\t",key,"\t","11\t",strand[key][0],"\t",txSt[key],"\t",txEnd[key],"\t","0,255,0\t",blocks[key],"\t",string.join(sizes[key],','),"\t",st + else: + st = [i - txSt[key] for i in starts[key]] #single end, spliced hit + st = string.join([str(i) for i in st],',') + print >>FO, chr[key].pop(),"\t",txSt[key],"\t",txEnd[key],"\t",key,"\t","12\t",strand[key][0],"\t",txSt[key],"\t",txEnd[key],"\t","0,255,0\t",blocks[key],"\t",string.join(sizes[key],','),"\t",st + + elif(count[key]==2): #pair-end read + direction = string.join(strand[key],'/') + for i,j in sorted (zip(starts[key],sizes[key])): + st.append(i-txSt[key]) + sz.append(j) + #st=[string.atoi(i) for i in st] + if(len(chr[key])==1): #pair-end reads mapped to same chromosome + if blocks[key] ==2: #pair end, single hits + print >>FO, chr[key].pop(),"\t",txSt[key],"\t",txEnd[key],"\t",key + "|strand=" + direction + "|chrom=same","\t","21\t",'.',"\t",txSt[key],"\t",txEnd[key],"\t","0,255,0\t",blocks[key],"\t",string.join(sz,','),"\t",string.join([str(i) for i in st],',') + elif blocks[key] >2: # + print >>FO, chr[key].pop(),"\t",txSt[key],"\t",txEnd[key],"\t",key + "|strand=" + direction + "|chrom=same","\t","22\t",'.',"\t",txSt[key],"\t",txEnd[key],"\t","0,255,0\t",blocks[key],"\t",string.join(sz,','),"\t",string.join([str(i) for i in st],',') + else: + print >>FOF,key,"\t","pair-end mapped, but two ends mapped to different chromosome" + elif(count[key] >2): #reads occur more than 2 times + print >>FOF,key,"\t","occurs more than 2 times in sam file" + continue + FO.close() + FOF.close() + print >>sys.stderr, "Done" + + + def samTowig(self,outfile=None,log2scale=False,header=False,strandSpecific=False): + """Convert SAM file to wig file. WIG file will be saved as xxx.sam.wig unless otherwise specified. + log2scale has no effect if strandSpecific was set""" + + if outfile is None: + outfile = self.fileName + ".wig" + FO=open(outfile,'w') + print >>sys.stderr, "Writing wig file to\"",outfile,"\"..." + + headline="track type=wiggle_0 name=" + outfile + " track_label description='' visibility=full color=255,0,0" + wig=collections.defaultdict(dict) + Pwig=collections.defaultdict(dict) + Nwig=collections.defaultdict(dict) + + #strand_rule={'1+':'+','1-':'-','2+':'-','2-':'+'} + strand_rule={'1+':'-','1-':'+','2+':'+','2-':'-'} + + for line in self.f: + hits=[] + if line.startswith('@'):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip().split() + flagCode = string.atoi(field[1]) + if (flagCode & 0x0004)!=0: continue #skip unmapped line + if not ParseSAM._uniqueHit_pat.search(line):continue #skip multiple mapped reads + if (flagCode & 0x0100 !=0): continue #skip non primary hit + if (flagCode & 0x0200 !=0): continue #skip QC-failed + if (flagCode & 0x0400 !=0): continue #skip PCR artifact + + chrom=field[2] + txStart=string.atoi(field[3]) + if (flagCode & 0x0010 != 0): + strand='-' + else: + strand='+' + if (flagCode & 0x0040 !=0): read_type='1' + if (flagCode & 0x0080 !=0): read_type='2' + + blocks = cigar.fetch_exon(chrom,txStart,field[5]) + for block in blocks: + hits.extend(range(block[1]+1,block[2]+1)) + + if strandSpecific is not True: + for i in hits: + if wig[chrom].has_key(i): + wig[chrom][i] +=1 + else: + wig[chrom][i]=1 + else: + if strand_rule[read_type + strand] == '-': + for i in hits: + if Nwig[chrom].has_key(i): + Nwig[chrom][i] += 1 + else: + Nwig[chrom][i] = 1 + if strand_rule[read_type + strand] == '+': + for i in hits: + if Pwig[chrom].has_key(i): + Pwig[chrom][i] +=1 + else: + Pwig[chrom][i]=1 + + if header:FO.write(headline + "\n") + + if strandSpecific is not True: + for chr in sorted(wig.keys()): + print >>sys.stderr, "Writing ",chr, " ..." + FO.write('variableStep chrom='+chr+'\n') + for coord in sorted(wig[chr]): + if log2scale:FO.write("%d\t%5.3f\n" % (coord,math.log(wig[chr][coord],2))) + else:FO.write("%d\t%d\n" % (coord,wig[chr][coord])) + else: + chroms=set(Pwig.keys() + Nwig.keys()) + for chr in sorted(chroms): + print >>sys.stderr, "Writing ",chr, " ..." + FO.write('variableStep chrom='+chr+'\n') + coords=sorted(set(Pwig[chr].keys() + Nwig[chr].keys())) + for coord in coords: + if ((coord in Pwig[chr]) and (coord not in Nwig[chr])): + FO.write("%d\t%d\n" % (coord,Pwig[chr][coord])) + elif ((coord in Nwig[chr]) and (coord not in Pwig[chr])): + FO.write("%d\t%d\n" % (coord,-Nwig[chr][coord])) + elif ((coord in Nwig[chr]) and (coord in Pwig[chr])): + if (Pwig[chr][coord] >= Nwig[chr][coord]): + FO.write("%d\t%d\n" % (coord,Pwig[chr][coord])) + else: + FO.write("%d\t%d\n" % (coord,-Nwig[chr][coord])) + + self.f.seek(0) + FO.close() + + + def getUnmap(self, outfile=None,fastq=True): + '''Extract unmapped reads from SAM file and write to fastq [when fastq=True] or fasta [when fastq=False] file''' + if outfile is None: + if fastq: outfile = self.fileName + ".unmap.fq" + else: outfile = self.fileName + ".unmap.fa" + FO=open(outfile,'w') + unmapCount=0 + print >>sys.stderr, "Writing unmapped reads to\"",outfile,"\"... ", + + for line in self.f: + hits=[] + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip().split() + flagCode=string.atoi(field[1]) + seq=field[9] + qual=field[10] + if (flagCode & 0x0004) != 0: #read unmap + unmapCount +=1 + if (flagCode & 0x0001) != 0: #paried in sequencing + if (flagCode & 0x0040)!=0:seqID=field[0] + '/1' #first read + if (flagCode & 0x0080)!=0:seqID=field[0] + '/2' #second read + else: seqID=field[0] + + if fastq: FO.write('@' + seqID + '\n' + seq +'\n' + '+' +'\n' + qual+'\n') + else: FO.write('>' + seqID + '\n' + seq +'\n') + + print >>sys.stderr, str(unmapCount) + " reads saved!\n" + FO.close() + self.f.seek(0) + + + def getProperPair(self,outfile=None): + '''Extract proper paried mapped reads.''' + if outfile is None: + outfile = self.fileName + ".PP.sam" + FO=open(outfile,'w') + PPcount=0 + print >>sys.stderr, "Writing proper paired reads to\"",outfile,"\"... ", + for line in self.f: + hits=[] + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + if ((flagCode & 0x0001) != 0) and ((flagCode & 0x0002)!=0): + PPcount +=1 + FO.write(line) + FO.close() + print >>sys.stderr, str(PPcount) + " reads were saved!\n", + self.f.seek(0) + + def samNVC(self,outfile=None): + '''for each read, calculate nucleotide frequency vs position''' + if outfile is None: + outfile1 = self.fileName + ".NVC.xls" + outfile2 = self.fileName +".NVC_plot.r" + else: + outfile1 = outfile + ".NVC.xls" + outfile2 = outfile +".NVC_plot.r" + FO=open(outfile1,'w') + RS=open(outfile2,'w') + PPcount=0 + + transtab = string.maketrans("ACGTNX","TGCANX") + base_freq=collections.defaultdict(int) + a_count=[] + c_count=[] + g_count=[] + t_count=[] + print >>sys.stderr, "reading sam file ... " + for line in self.f: + if line.startswith('@'):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + + if flagCode & 0x0010 ==0: #plus strand + RNA_read = field[9].upper() + else: + RNA_read = field[9].upper().translate(transtab)[::-1] + for i in xrange(len(RNA_read)): + key = str(i) + RNA_read[i] + base_freq[key] += 1 + + print >>sys.stderr, "generating data matrix ..." + print >>FO, "Position\tA\tC\tG\tT\tN\tX" + for i in xrange(len(RNA_read)): + print >>FO, str(i) + '\t', + print >>FO, str(base_freq[str(i) + "A"]) + '\t', + a_count.append(str(base_freq[str(i) + "A"])) + print >>FO, str(base_freq[str(i) + "C"]) + '\t', + c_count.append(str(base_freq[str(i) + "C"])) + print >>FO, str(base_freq[str(i) + "G"]) + '\t', + g_count.append(str(base_freq[str(i) + "G"])) + print >>FO, str(base_freq[str(i) + "T"]) + '\t', + t_count.append(str(base_freq[str(i) + "T"])) + print >>FO, str(base_freq[str(i) + "N"]) + '\t', + print >>FO, str(base_freq[str(i) + "X"]) + '\t' + FO.close() + + #generating R scripts + print >>sys.stderr, "generating R script ..." + print >>RS, "position=c(" + ','.join([str(i) for i in xrange(len(RNA_read))]) + ')' + print >>RS, "A_count=c(" + ','.join(a_count) + ')' + print >>RS, "C_count=c(" + ','.join(c_count) + ')' + print >>RS, "G_count=c(" + ','.join(g_count) + ')' + print >>RS, "T_count=c(" + ','.join(t_count) + ')' + print >>RS, "total= A_count + C_count + G_count + T_count" + print >>RS, "ym=max(A_count/total,C_count/total,G_count/total,T_count/total) + 0.05" + print >>RS, "yn=min(A_count/total,C_count/total,G_count/total,T_count/total)" + + print >>RS, 'pdf("NVC_plot.pdf")' + print >>RS, 'plot(position,A_count/total,type="o",pch=20,ylim=c(yn,ym),col="dark green",xlab="Position of Read",ylab="Nucleotide Frequency")' + print >>RS, 'lines(position,T_count/total,type="o",pch=20,col="red")' + print >>RS, 'lines(position,G_count/total,type="o",pch=20,col="blue")' + print >>RS, 'lines(position,C_count/total,type="o",pch=20,col="cyan")' + print >>RS, 'legend('+ str(len(RNA_read)-10) + ',ym,legend=c("A","T","G","C"),col=c("dark green","red","blue","cyan"),lwd=2,pch=20,text.col=c("dark green","red","blue","cyan"))' + print >>RS, "dev.off()" + + RS.close() + #self.f.seek(0) + + def samGC(self,outfile=None): + '''GC content distribution of reads''' + if outfile is None: + outfile1 = self.fileName + ".GC.xls" + outfile2 = self.fileName +".GC_plot.r" + else: + outfile1 = outfile + ".GC.xls" + outfile2 = outfile +".GC_plot.r" + FO=open(outfile1,'w') + RS=open(outfile2,'w') + + gc_hist=collections.defaultdict(int) #key is GC percent, value is count of reads + print >>sys.stderr, "reading sam file ... " + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + gc_percent = "%4.2f" % ((field[9].upper().count('C') + field[9].upper().count('G'))/(len(field[9])+0.0)*100) + #print gc_percent + gc_hist[gc_percent] += 1 + + print >>sys.stderr, "writing GC content ..." + + print >>FO, "GC%\tread_count" + for i in gc_hist.keys(): + print >>FO, i + '\t' + str(gc_hist[i]) + + print >>sys.stderr, "writing R script ..." + print >>RS, "pdf('GC_content.pdf')" + print >>RS, 'gc=rep(c(' + ','.join([i for i in gc_hist.keys()]) + '),' + 'times=c(' + ','.join([str(i) for i in gc_hist.values()]) + '))' + print >>RS, 'hist(gc,probability=T,breaks=%d,xlab="GC content (%%)",ylab="Density of Reads",border="blue",main="")' % 100 + #print >>RS, "lines(density(gc),col='red')" + print >>RS ,"dev.off()" + #self.f.seek(0) + + def samDupRate(self,outfile=None,up_bound=500): + '''Calculate reads's duplicate rates''' + if outfile is None: + outfile1 = self.fileName + ".seq.DupRate.xls" + outfile2 = self.fileName + ".pos.DupRate.xls" + outfile3 = self.fileName +".DupRate_plot.r" + else: + outfile1 = outfile + ".seq.DupRate.xls" + outfile2 = outfile + ".pos.DupRate.xls" + outfile3 = outfile +".DupRate_plot.r" + SEQ=open(outfile1,'w') + POS=open(outfile2,'w') + RS=open(outfile3,'w') + + seqDup=collections.defaultdict(int) + posDup=collections.defaultdict(int) + + seqDup_count=collections.defaultdict(int) + posDup_count=collections.defaultdict(int) + print >>sys.stderr, "reading sam file ... " + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + if (flagCode & 0x0004) == 1: + continue #skip unmapped reads + seqDup[field[9]] +=1 #key is read sequence + + #calculte duplicate read based on coordinates + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + chrom = field[2] + chromStart = string.atoi(field[3])-1 + chromEnd=chromStart + sum(map(int,comb)) + blockSize = [] + for i in range(0,len(comb),2): + blockSize.append(str(comb[i])) + blockSizes = ','.join(blockSize) + blockStart=[] + for i in range(0,len(comb),2): + blockStart.append(str(sum(comb[:i]))) + blockStarts = ','.join(blockStart) + + coord = chrom + ":" + str(chromStart) + "-" + str(chromEnd) + ":" + blockSizes + ":" + blockStarts + posDup[coord] +=1 + + print >>sys.stderr, "report duplicte rate based on sequence ..." + print >>SEQ, "Occurrence\tUniqReadNumber" + for i in seqDup.values(): #key is occurence, value is uniq reads number (based on seq) + seqDup_count[i] +=1 + for k in sorted(seqDup_count.iterkeys()): + print >>SEQ, str(k) +'\t'+ str(seqDup_count[k]) + SEQ.close() + + print >>sys.stderr, "report duplicte rate based on mapping ..." + print >>POS, "Occurrence\tUniqReadNumber" + for i in posDup.values(): #key is occurence, value is uniq reads number (based on coord) + posDup_count[i] +=1 + for k in sorted(posDup_count.iterkeys()): + print >>POS, str(k) +'\t'+ str(posDup_count[k]) + POS.close() + + + print >>sys.stderr, "generate R script ..." + print >>RS, "pdf('duplicateRead.pdf')" + print >>RS, "par(mar=c(5,4,4,5),las=0)" + print >>RS, "seq_occ=c(" + ','.join([str(i) for i in sorted(seqDup_count.iterkeys()) ]) + ')' + print >>RS, "seq_uniqRead=c(" + ','.join([str(seqDup_count[i]) for i in sorted(seqDup_count.iterkeys()) ]) + ')' + print >>RS, "pos_occ=c(" + ','.join([str(i) for i in sorted(posDup_count.iterkeys()) ]) + ')' + print >>RS, "pos_uniqRead=c(" + ','.join([str(posDup_count[i]) for i in sorted(posDup_count.iterkeys()) ]) + ')' + print >>RS, "plot(pos_occ,log10(pos_uniqRead),ylab='Number of Reads (log10)',xlab='Frequency',pch=4,cex=0.8,col='blue',xlim=c(1,%d),yaxt='n')" % up_bound + print >>RS, "points(seq_occ,log10(seq_uniqRead),pch=20,cex=0.8,col='red')" + print >>RS, 'ym=floor(max(log10(pos_uniqRead)))' + print >>RS, "legend(%d,ym,legend=c('Sequence-base','Mapping-base'),col=c('red','blue'),pch=c(4,20))" % max(up_bound-200,1) + print >>RS, 'axis(side=2,at=0:ym,labels=0:ym)' + print >>RS, 'axis(side=4,at=c(log10(pos_uniqRead[1]),log10(pos_uniqRead[2]),log10(pos_uniqRead[3]),log10(pos_uniqRead[4])), labels=c(round(pos_uniqRead[1]*100/sum(pos_uniqRead)),round(pos_uniqRead[2]*100/sum(pos_uniqRead)),round(pos_uniqRead[3]*100/sum(pos_uniqRead)),round(pos_uniqRead[4]*100/sum(pos_uniqRead))))' + print >>RS, 'mtext(4, text = "Reads %", line = 2)' + #self.f.seek(0) + + def getUniqMapRead(self,outfile=None): + '''Extract uniquely mapped reads.''' + if outfile is None: + outfile = self.fileName + ".uniq.sam" + FO=open(outfile,'w') + Uniqcount=0 + print >>sys.stderr, "Writing uniquely mapped reads to\"",outfile,"\"... ", + for line in self.f: + hits=[] + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + if (flagCode & 0x0004) == 1: + continue #skip unmapped reads + #else: + #print >>sys.stderr,line, + if (ParseSAM._uniqueHit_pat.search(line)): + print >>sys.stderr,line, + Uniqcount +=1 + FO.write(line) + FO.close() + print >>sys.stderr, str(Uniqcount) + " reads were saved!\n", + self.f.seek(0) + + def getWrongStrand(self,outfile=None): + '''Extract pair-end reads mapped in incorrectly strand, such +/+ or -/-''' + if outfile is None: + outfile = self.fileName + ".wrongStrand.sam" + FO=open(outfile,'w') + wrongStrand=0 + print >>sys.stderr, "Writing incorrectly stranded reads to\"",outfile,"\"... ", + for line in self.f: + hits=[] + if line.startswith('@'):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + if (flagCode & 0x0004) != 0: + continue #skipped if read itself is unmapped + if (flagCode & 0x0008) !=0: + continue #skipped if mate is unmapped + if (flagCode & 0x0001) == 0: + continue #skip single end sequencing' + if ((flagCode & 0x0010) ==0) and ((flagCode & 0x0020)==0 ): + FO.write(line) + wrongStrand+=1 + if ((flagCode & 0x0010) !=0) and ((flagCode & 0x0020)!=0 ): + FO.write(line) + wrongStrand+=1 + + FO.close() + print >>sys.stderr, str(wrongStrand) + " reads were saved!\n", + self.f.seek(0) + + def filterSpliceRead(self,outfile=None,min_overhang=8,min_gap=50,max_gap=1000000): + '''filter spiced mapped reads from sam file. min_overhang is used to determine the reliability of splice sites + splice reads with overhang size <8 will also be reported if the same splice sites has been suported by + at least 1 read with overhang size >8. Multiple spliced reads (belong to the same splice junction) + will always be reported. min_overhang, min_gap and max_gap only applied to one-time splice read''' + + if outfile is None: + outfile = self.fileName + ".SR.sam" + #outfile2 = self.fileName + ".SR.filter.sam" + splice_sites=collections.defaultdict(set) + print >>sys.stderr, "\tDetermine splice sites with proper overhang, intron size ... ", + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + if not (ParseSAM._uniqueHit_pat.search(line)): #skip non unique mapped read + continue + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + map_st = int(field[3]) + chrom = field[2] + if (flagCode & 0x0004) == 1:continue #skip unmapped reads + + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + if (len(comb)==1): #skip non-spliced + #print line, + continue + if (len(comb)>3): #skip multiple spliced + continue + else: #one-time spliced + if (comb[1] < min_gap or comb[1] > max_gap): + continue + else: + if (comb[0] >= min_overhang): + splice_sites[chrom].add(map_st + comb[0]) + if (comb[2] >= min_overhang): + splice_sites[chrom].add(map_st + comb[0] + comb[1]) + self.f.seek(0) + print >>sys.stderr, "Done" + + + FO=open(outfile,'w') + #FO2=open(outfile2,'w') + print >>sys.stderr, "\tExtracting splicing reads ... ", + total_SR =0 + extract_SR =0 + total_read =0 + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + map_st = int(field[3]) + chrom = field[2] + if (flagCode & 0x0004) == 1:continue #skip unmapped reads + total_read +=1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + if (len(comb)==1): #skip non-spliced + continue + total_SR +=1 + + + if (len(comb)>3): #multipel splice read. report directly + FO.write(line) + extract_SR +=1 + else: #one-time splice read + if (comb[1] < min_gap or comb[1] > max_gap): + continue + if (chrom in splice_sites) and ((map_st + comb[0]) in splice_sites[chrom]) and ((map_st + comb[0] + comb[1]) in splice_sites[chrom]): + FO.write(line) + #print line + extract_SR +=1 + else: + #FO2.write(line) + continue + print >>sys.stderr, "Done" + print >>sys.stderr, "\tTotal mapped Read: " + str(total_read) + print >>sys.stderr, "\tTotal Splicing Read: " + str(total_SR) + print >>sys.stderr, "\Usable Splicing Read: " + str(extract_SR) + FO.close() + #FO2.close() + self.f.seek(0) + + def getSpliceRead(self,outfile=None): + '''Extract spiced mapped reads from sam file''' + + if outfile is None: + outfile = self.fileName + ".SR.sam" + FO=open(outfile,'w') + print >>sys.stderr, "\tExtract splicing reads without any filter ...", + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + flagCode=string.atoi(field[1]) + if (flagCode & 0x0004) == 1:continue #skip unmapped reads + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + if (len(comb)>=3): + FO.write(line) + + print >>sys.stderr, "Done" + self.f.seek(0) + FO.close() + + def collapseSAM(self, outfile=None,collevel=10): + '''At most collevel[default=10] identical reads will be retained in outputting SAM file + The original SAM file must be sorted before hand. if not, using linux command like "sort -k3,3 -k4,4n myfile.sam >myfile.sorted.sam" ''' + if outfile is None: + outfile = self.fileName + ".collapsed.sam" + print >>sys.stderr, "Writing collapsed SAM file to\"",outfile,"\"... " + FO=open(outfile,'w') + flag="" + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + if (string.atoi(field[1]) & 0x0004)!=0: continue #skip unmapped line + id=field[2] + field[3] + field[5] + if (id != flag): + FO.write(line) + flag=id + skipTrigger=0 + else: + skipTrigger+=1 + if skipTrigger < collevel: + FO.write(line) + else:continue + FO.close() + self.f.seek(0) + + def qualSAM(self,read_len,outfile=None): + '''calculate phred quality score for each base in read (5->3)''' + if outfile is None: + outfile = self.fileName + ".qual.plot.r" + else: + outfile = outfile + ".qual.plot.r" + FO=open(outfile,'w') + print >>sys.stderr, "\tcalculating quality score ... " + qual_min={} + qual_max={} + qual_sum={} + total_read=0 + for i in range(0,read_len): + qual_min.setdefault(i,1000) + qual_max.setdefault(i,-1) + qual_sum.setdefault(i,0.0) + + for line in self.f: + if line[0] == '@':continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip('\n').split() + #if (string.atoi(field[1]) & 0x0004)!=0: continue #skip unmapped line + + if (len(field[10]) != read_len): + continue + if (string.atoi(field[1]) & 0x0010)==0: #query map to + + qual_str=field[10] + else: + qual_str=field[10][::-1] + total_read +=1 + for i in range(0,read_len): + #print ord(qual_str[i])-33, + qual_sum[i] += ord(qual_str[i])-33 + if(qual_min[i] > (ord(qual_str[i])-33)): + qual_min[i] = ord(qual_str[i])-33 + if(qual_max[i] < (ord(qual_str[i])-33)): + qual_max[i] = ord(qual_str[i])-33 + #print '\n', + min_qualities = [str(qual_min[i]) for i in range(0,read_len)] + max_qualities =[str(qual_max[i]) for i in range(0,read_len)] + avg_qualities = [str(qual_sum[i]/total_read) for i in range(0,read_len)] + nt_pos = [str(i) for i in range(0,read_len)] + print >>FO, "nt_pos=c(" + ','.join(nt_pos) + ')' + print >>FO, "max_qual=c(" + ','.join(max_qualities) + ')' + print >>FO, "min_qual=c(" + ','.join(min_qualities) + ')' + print >>FO, "avg_qual=c(" + ','.join(avg_qualities) + ')' + print >>FO, "pdf('phred_qual.pdf')" + print >>FO, "plot(nt_pos,avg_qual, xlab=\"Nucleotide Position (5'->3')\", ylab='Phred Quality',ylim=c(0,97),lwd=2,type='s')" + print >>FO, 'lines(nt_pos,max_qual,type="s",lwd=2,col="red")' + print >>FO, 'lines(nt_pos,min_qual,type="s",lwd=2,col="blue")' + print >>FO, 'legend(0,100,legend=c("Max","Average","Min"),col=c("red","black","blue"),lwd=2)' + print >>FO, 'dev.off()' + #for i in range(0,read_len): + # print >>sys.stderr, str(i) + '\t' + str(qual_max[i]) + '\t' + str(qual_min[i]) + '\t' + str(qual_sum[i]/total_read) + #self.f.seek(0) + + + def samToBinnedArray(self): + """Convert SAM file to BinnedArray.""" + + lines=0 + for line in self.f: + if line.startswith('@'):continue #skip head lines + if ParseSAM._reExpr2.match(line):continue #skip blank lines + field=line.rstrip().split() + if (string.atoi(field[1]) & 0x0004)!=0: continue #skip unmapped line + txStart=string.atoi(field[3]) + #if (string.atoi(field[1]) & 0x0010 != 0): + # strand='-' + #else: + # strand='+' + lines +=1 + scores={} + chrom = field[2] + + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(field[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + if not chrom in scores:scores[chrom] = BinnedArray() + + for i in range(0,len(comb),2): + for pos in range(txStart + sum(comb[:i]), txStart + sum(comb[:i]) + comb[i]): + tmp = scores[chrom][pos] + if isNaN(tmp): + scores[chrom][pos] =1 + else: + scores[chrom][pos] +=1 + if lines % 10000 == 0: print >>sys.stderr, "%i lines loaded \r" % lines + return scores + self.f.seek(0) + +class QCSAM: + '''Perform basic quality control. Useful for RNA-seq experiment''' + + + def __init__(self,samFile): + '''constructor''' + if samFile == '-': + self.fileName = "STDIN" + self.f = sys.stdin + else: + self.fileName = os.path.basename(samFile) + self.f=open(samFile,'r') + + + def distribSAM(self,refbed,outfile=None): + '''calculate reads distribution over genome features (Exon reads, Inton reads, Intergenic + reads, spliced reads). A bed file representing the gene model (i.e. refseq) must be provided + Two bed format files will be generated: outfile_exon.count.bed and outfile_intron.count.bed. + The 5th column is number of reads fallen into the region defined by the first 3 columns''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + exon_count = self.fileName + "_exon.count.bed" + intron_count = self.fileName + "_intron.count.bed" + rscript=self.fileName + ".piechart.r" + rpdf=self.fileName + ".piechart.pdf" + else: + exon_count = outfile + "_exon.count.bed" + intron_count = outfile + "_intron.count.bed" + rscript=outfile + ".piechart.r" + rpdf=outfile + ".piechart.pdf" + + EXON_OUT = open(exon_count,'w') + INTRON_OUT =open(intron_count,'w') + R_OUT = open(rscript,'w') + + ranges={} + intronReads=0 + exonReads=0 + intergenicReads=0 + totalReads=0 + splicedReads=0 + + #read SAM + print >>sys.stderr, "reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + if( len(comb)>1): + splicedReads +=1 + continue + else: + chrom=fields[2].upper() + #st=int(fields[3])-1 + #end= st +len(fields[9]) + mid = int(fields[3]) + int(len(fields[9])/2) + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( mid, mid ) ) + + self.f.seek(0) + print >>sys.stderr, "Done" + + #read refbed file + print >>sys.stderr, "Assign reads to "+ refbed + '...', + for line in open(refbed,'r'): + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + # assign reads to intron + if(strand == '-'): + intronNum=len(intron_starts) + exonNum=len(exon_starts) + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + intronReads += hits + INTRON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\n') + intronNum -= 1 + + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + exonReads += hits + EXON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\n') + exonNum -= 1 + elif(strand == '+'): + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + intronReads += hits + INTRON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + exonReads += hits + EXON_OUT.write(chrom + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\n') + exonNum += 1 + intergenicReads=totalReads-exonReads-intronReads-splicedReads + print >>sys.stderr, "Done." + '\n' + print >>sys.stderr, "Total reads:\t" + str(totalReads) + print >>sys.stderr, "Exonic reads:\t" + str(exonReads) + print >>sys.stderr, "Intronic reads:\t" + str(intronReads) + print >>sys.stderr, "Splicing reads:\t" + str(splicedReads) + print >>sys.stderr, "Intergenic reads:\t" + str(intergenicReads) + + print >>sys.stderr,"writing R script ...", + totalReads=float(totalReads) + print >>R_OUT, "pdf('%s')" % rpdf + print >>R_OUT, "dat=c(%d,%d,%d,%d)" % (exonReads,splicedReads,intronReads,intergenicReads) + print >>R_OUT, "lb=c('exon(%.2f)','junction(%.2f)','intron(%.2f)','intergenic(%.2f)')" % (exonReads/totalReads,splicedReads/totalReads,intronReads/totalReads,intergenicReads/totalReads) + print >>R_OUT, "pie(dat,labels=lb,col=rainbow(4),clockwise=TRUE,main='Total reads = %d')" % int(totalReads) + print >>R_OUT, "dev.off()" + print >>sys.stderr, "Done." + + + def coverageGeneBody(self,refbed,outfile=None): + '''Calculate reads coverage over gene body, from 5'to 3'. each gene will be equally divied + into 100 regsions''' + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + outfile1 = self.fileName + ".geneBodyCoverage_plot.r" + outfile2 = self.fileName + ".geneBodyCoverage.txt" + else: + outfile1 = outfile + ".geneBodyCoverage_plot.r" + outfile2 = outfile + ".geneBodyCoverage.txt" + OUT1 = open(outfile1,'w') + OUT2 = open(outfile2,'w') + + ranges={} + totalReads=0 + fragment_num=0 #splice reads will counted twice + rpkm={} + + #read SAM + print >>sys.stderr, "reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + fragment_num += (len(comb) +1)/2 + blockStart=[] + blockSize=[] + + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( st, st+size ) ) + print >>sys.stderr, "Done" + + print >>sys.stderr, "calculating coverage over gene body ..." + coverage=collections.defaultdict(int) + flag=0 + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + gene_all_base=[] + percentile_base=[] + mRNA_len =0 + flag=0 + for st,end in zip(exon_starts,exon_ends): + gene_all_base.extend(range(st+1,end+1)) #0-based coordinates on genome + mRNA_len = len(gene_all_base) + if mRNA_len <100: + flag=1 + break + if flag==1: continue + if strand == '-': + gene_all_base.sort(reverse=True) #deal with gene on minus stand + else: + gene_all_base.sort(reverse=False) + percentile_base = mystat.percentile_list (gene_all_base) #get 101 points from each gene's coordinates + + for i in range(0,len(percentile_base)): + if chrom in ranges: + coverage[i] += len(ranges[chrom].find(percentile_base[i], percentile_base[i]+1)) + x_coord=[] + y_coord=[] + print >>OUT2, "Total reads: " + str(totalReads) + print >>OUT2, "Fragment number: " + str(fragment_num) + print >>OUT2, "percentile\tcount" + for i in coverage: + x_coord.append(str(i)) + y_coord.append(str(coverage[i])) + print >>OUT2, str(i) + '\t' + str(coverage[i]) + print >>OUT1, "pdf('geneBody_coverage.pdf')" + print >>OUT1, "x=0:100" + print >>OUT1, "y=c(" + ','.join(y_coord) + ')' + print >>OUT1, "plot(x,y,xlab=\"percentile of gene body (5'->3')\",ylab='read number',type='s')" + print >>OUT1, "dev.off()" + + def calculateRPKM(self,refbed,outfile=None): + '''calculate RPKM values for each gene in refbed. Only uniquely aligned reads are used. + Spilced reads are split. output raw read connt and eRPKM (eRPKM = exon Represented times Per Kb + exon per Million mapped reads) for each exon, intron and mRNA''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + rpkm_file = self.fileName + ".rpkm.xls" + else: + rpkm_file = outfile + ".rpkm.xls" + RPKM_OUT=open(rpkm_file,'w') + + ranges={} + totalReads=0 + cUR=0 + sR=0 + multiMapReads=0 + rpkm={} + + #read SAM + print >>sys.stderr, "reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + multiMapReads +=1 + continue + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + cUR += (len(comb) +1)/2 + if(len(comb)>1): + sR+=1 + blockStart=[] + blockSize=[] + + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + mid = int(st) + (size/2) + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( mid, mid ) ) + + self.f.seek(0) + print >>sys.stderr, "Done" + print >>RPKM_OUT, "Total mapped reads (TR): " + str(totalReads) + print >>RPKM_OUT, "Multiple mapped reads (MR): " + str(multiMapReads) + print >>RPKM_OUT, "Uniquely mapped reads (UR): " + str(totalReads - multiMapReads) + print >>RPKM_OUT, "Spliced mapped reads (SR): " + str(sR) + print >>RPKM_OUT, "Corrected uniquely mapped reads (cUR): " + str(cUR) + if totalReads ==0: + sys.exit(1) + + #read refbed file + print >>sys.stderr, "Assign reads to "+ refbed + '...', + for line in open(refbed,'r'): + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + # assign reads to intron + mRNA_count=0 + mRNA_len=sum(exon_sizes) + if(strand == '-'): + intronNum=len(intron_starts) + exonNum=len(exon_starts) + + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + intronNum -= 1 + + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + exonNum -= 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*cUR)) +'\n') + rpkm[key] = mRNA_count*1000000000.0/(mRNA_len*cUR) + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + rpkm[key] = 0 + elif(strand == '+'): + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + exonNum += 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*cUR)) +'\n') + rpkm[key] = mRNA_count*1000000000.0/(mRNA_len*cUR) + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + rpkm[key] = 0 + print >>sys.stderr, "Done" + return rpkm + self.f.seek(0) + + def calculateRPKM2(self,refbed,outfile=None): + '''calculate RPKM values for each gene in refbed. Only uniquely aligned reads are used. + Spilced reads are split. output raw read connt and eRPKM (eRPKM = exon Represented times Per Kb + exon per Million mapped reads) for each exon, intron and mRNA + NOTE: intronic reads are not counted as part of total reads''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + rpkm_file = self.fileName + ".rpkm.xls" + else: + rpkm_file = outfile + ".rpkm.xls" + RPKM_OUT=open(rpkm_file,'w') + + ranges={} + exon_ranges={} + totalReads=0 + #intronic=0 + cUR=0 + sR=0 + multiMapReads=0 + rpkm={} + + #read gene model file, the purpose is to remove intronic reads + print >>sys.stderr, "Reading reference gene model "+ refbed + '...' + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + for st,end in zip(exon_starts,exon_ends): + if chrom not in exon_ranges: + exon_ranges[chrom] = Intersecter() + else: + exon_ranges[chrom].add_interval( Interval( st, end ) ) + + #read SAM + print >>sys.stderr, "reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + multiMapReads +=1 + continue + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + #cUR += (len(comb) +1)/2 + if(len(comb)>1): + sR+=1 + blockStart=[] + blockSize=[] + + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + #build bitset only for exonic reads + for st,size in zip(blockStart,blockSize): + if (chrom in exon_ranges) and (len(exon_ranges[chrom].find(st,st+size)) >0): #if we found this fragment is overlapped with exon + cUR += 1 + mid = int(st) + (size/2) + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( mid, mid ) ) + else: #if this framgnet is intronic, skip it. + #intronic +=1 + continue + self.f.seek(0) + print >>sys.stderr, "Done" + print >>RPKM_OUT, "Total mapped reads (TR): " + str(totalReads) + print >>RPKM_OUT, "Multiple mapped reads (MR): " + str(multiMapReads) + print >>RPKM_OUT, "Uniquely mapped reads (UR): " + str(totalReads - multiMapReads) + print >>RPKM_OUT, "Spliced mapped reads (SR): " + str(sR) + print >>RPKM_OUT, "Corrected uniquely mapped reads (cUR, non-intronic fragments): " + str(cUR) + #print >>RPKM_OUT, "Intronic Fragments (IF): " + str(intronic) + if totalReads ==0: + sys.exit(1) + + #read refbed file + print >>sys.stderr, "Assign reads to "+ refbed + '...', + for line in open(refbed,'r'): + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + # assign reads to intron + mRNA_count=0 + mRNA_len=sum(exon_sizes) + if(strand == '-'): + intronNum=len(intron_starts) + exonNum=len(exon_starts) + + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + intronNum -= 1 + + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + exonNum -= 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*cUR)) +'\n') + rpkm[key] = mRNA_count*1000000000.0/(mRNA_len*cUR) + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + rpkm[key] = 0 + elif(strand == '+'): + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + hits= len(ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(cUR))) +'\n') + exonNum += 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*cUR)) +'\n') + rpkm[key] = mRNA_count*1000000000.0/(mRNA_len*cUR) + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + rpkm[key] = 0 + print >>sys.stderr, "Done" + return rpkm + self.f.seek(0) + + def filterKnownReads(self,refbed,outfile=None): + '''Compare SAM files with reference gene model, all reads mapped to gene model will be filted + out. The remainning unknown reads will be writtern to a new SAM file''' + + totalReads=0 #total mapped reads + unknownReads=0 + ranges={} + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + + if outfile is None: + out_file = self.fileName + ".unknownReads.SAM" + else: + out_file = outfile + ".unknownReads.SAM" + OUT=open(out_file,'w') + + print >>sys.stderr, "Reading reference gene model "+ refbed + '...' + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + for st,end in zip(exon_starts,exon_ends): + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( st, end ) ) + + print >>sys.stderr, "Processing SAM file "+ self.fileName + '...' + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + continue + + blockStart=[] + blockSize=[] + totalReads +=1 + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + if (chrom in ranges) and (len(ranges[chrom].find(st,st+size)) >0): #if we found this read is overlapped with known gene + break + else: + OUT.write(line) + unknownReads +=1 + OUT.close() + print >>sys.stderr, "Total reads mapped to genome: " + str(totalReads) + print >>sys.stderr, "Total reads not overlapped with any exon: " + str(unknownReads) + self.f.seek(0) + + def genomicFragSize(self,outfile=None,low_bound=0,up_bound=1000,step=10): + '''estimate the genomic fragment size of mRNA experiment. fragment size = insert_size + 2 x read_length''' + + + if outfile is None: + out_file1 = self.fileName + ".fragSize.txt" + out_file2 = self.fileName + ".fragSize.Freq.txt" + out_file3 = self.fileName + ".fragSize_plot.r" + else: + out_file1 = outfile + ".fragSize.txt" + out_file2 = outfile + ".fragSize.Freq.txt" + out_file3 = outfile + ".fragSize_plot.r" + + FO=open(out_file1,'w') + FQ=open(out_file2,'w') + RS=open(out_file3,'w') + + chrom="chr100" #this is the fake chromosome + ranges={} + ranges[chrom]=Intersecter() + + window_left_bound = range(low_bound,up_bound,step) + frag_size=0 + + pair_num=0.0 + ultra_low=0.0 + ultra_high=0.0 + size=[] + counts=[] + count=0 + print >>sys.stderr, "Reading SAM file "+ self.fileName + ' ... ', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + #if fields[0] in pairRead_info: + # continue + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0001) ==0: + print >>sys.stderr,"NOT pair-end sequencing" + sys.exit(1) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + continue + if (flagCode & 0x0008 !=0): #skip single-end mapped reads + continue + if (fields[7] =='0'): + continue + if (int(fields[3]) > int(fields[7])): #left < right + continue + pair_num +=1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + read_len = len(fields[9]) + if (len(comb)==1): # this read is NOT spliced + frag_size = (int(fields[7]) - int(fields[3]) +1) + read_len + elif (len(comb) >1): # this read is spliced + frag_size = (int(fields[7]) - int(fields[3]) +1) + read_len - sum(comb[1::2]) + FO.write(fields[0] + '\t' + str(frag_size) + '\n') + if frag_size <= low_bound: + ultra_low+=1 + continue + elif frag_size > up_bound: + ultra_high +=1 + continue + ranges[chrom].add_interval( Interval( frag_size-1, frag_size ) ) + print >>sys.stderr, "Done" + + if pair_num==0: + print >>sys.stderr, "Cannot find paired reads" + sys.exit(0) + print >>FQ, "Total paired read " + str(pair_num) + print >>FQ, "<=" + str(low_bound) + "\t"+ str(ultra_low) + for st in window_left_bound: + size.append(str(st + step/2)) + count = str(len(ranges[chrom].find(st,st + step))) + counts.append(count) + print >>FQ, str(st) + '\t' + str(st+step) +'\t' + count + print >>FQ, ">" + str(up_bound) + "\t"+ str(ultra_high) + + print >>RS, "pdf('gFragSize.pdf')" + print >>RS, "par(mfrow=c(2,1),cex.main=0.8,cex.lab=0.8,cex.axis=0.8,mar=c(4,4,4,1))" + print >>RS, 'pie(c(%d,%d,%d),col=rainbow(3),cex=0.5,radius=1,main="Total %d fragments",labels=c("fraSize <= %d\\n(%4.2f%%)","fragSize > %d\\n(%4.2f%%)","%d < fragSize <= %d\\n(%4.2f%%)"), density=rep(80,80,80),angle=c(90,140,170))' % (ultra_low, ultra_high, pair_num -ultra_low -ultra_high, pair_num, low_bound, ultra_low*100/pair_num, up_bound, ultra_high*100/pair_num, low_bound, up_bound, 100-ultra_low*100/pair_num - ultra_high*100/pair_num) + print >>RS, 'fragsize=rep(c(' + ','.join(size) + '),' + 'times=c(' + ','.join(counts) + '))' + print >>RS, 'frag_sd = round(sd(fragsize))' + print >>RS, 'frag_mean = round(mean(fragsize))' + print >>RS, 'hist(fragsize,probability=T,breaks=%d,xlab="Fragment size (bp)",main=paste(c("Mean=",frag_mean,";","SD=",frag_sd),collapse=""),border="blue")' % len(window_left_bound) + print >>RS, "lines(density(fragsize,bw=%d),col='red')" % (2*step) + print >>RS ,"dev.off()" + FO.close() + FQ.close() + RS.close() + #self.f.seek(0) + + + def saturation_RPKM(self,refbed,outfile=None,sample_start=5,sample_step=5,sample_end=100): + '''for each gene, check if its RPKM (epxresion level) has already been saturated or not''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + rpkm_file = self.fileName + ".eRPKM.xls" + raw_file = self.fileName + ".rawCount.xls" + else: + rpkm_file = outfile + ".eRPKM.xls" + raw_file = outfile + ".rawCount.xls" + + RPKM_OUT = open(rpkm_file,'w') + RAW_OUT = open(raw_file ,'w') + + ranges={} + totalReads=0 + cUR_num = 0 #number + block_list=[] #non-spliced read AS IS, splicing reads were counted multiple times + + #read SAM + my_pat = re.compile(r'NH:i:(\d+)\b') + NH_tag=0 + print >>sys.stderr, "Reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + hitNum =[int(i) for i in my_pat.findall(line)] + if len(hitNum) ==0: + NH_tag=1 #cannot determine uniqness without NH tag + elif len(hitNum) ==1: + if int(hitNum[0])>1: continue #skip multiple mapped reads + else: + print >>sys.stderr, "More than 1 NH tag found within a single line. Incorrect SAM format!" + sys.exit(1) + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + cUR_num += (len(comb) +1)/2 + blockStart=[] + blockSize=[] + + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + mid = int(st) + (size/2) + block_list.append(chrom + ":" + str(mid)) + + if NH_tag==1: + print >>sys.stderr, "Warn: NO NH tag found. Cannot determine uniqueness of alignment. All alignments will be used" + print >>sys.stderr, "Done" + + print >>sys.stderr, "shuffling alignments ...", + random.shuffle(block_list) + print >>sys.stderr, "Done" + + + ranges={} + sample_size=0 + frag_total = cUR_num + RPKM_table=collections.defaultdict(list) + rawCount_table=collections.defaultdict(list) + RPKM_head=['chr','start','end','name','score','strand'] + + tmp=range(sample_start,sample_end,sample_step) + tmp.append(100) + #=========================sampling uniquely mapped reads from population + for pertl in tmp: #[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,100] + index_st = int(frag_total * (pertl-sample_step)/100.0) + index_end = int(frag_total * pertl/100.0) + if index_st < 0: index_st = 0 + sample_size += index_end -index_st + + RPKM_head.append(str(pertl) + '%') + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(sample_size) + ") fragments ...", + for i in range(index_st, index_end): + (chr,coord) = block_list[i].split(':') + if chr not in ranges: + ranges[chr] = Intersecter() + else: + ranges[chr].add_interval( Interval( int(coord), int(coord)+1 ) ) + #========================= calculating RPKM based on sub-population + #print >>sys.stderr, "assign reads to "+ refbed + '...', + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line + continue + mRNA_count=0 #we need to initializ it to 0 for each gene + mRNA_len=sum(exon_sizes) + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + mRNA_count += len(ranges[chrom].find(st,end)) + if mRNA_len ==0: + print >>sys.stderr, geneName + " has 0 nucleotides. Exit!" + sys.exit(1) + if sample_size == 0: + print >>sys.stderr, "Too few reads to sample. Exit!" + sys.exit(1) + mRNA_RPKM = (mRNA_count * 1000000000.0)/(mRNA_len * sample_size) + RPKM_table[key].append(str(mRNA_RPKM)) + rawCount_table[key].append(str(mRNA_count)) + print >>sys.stderr, "Done" + + #self.f.seek(0) + print >>RPKM_OUT, '\t'.join(RPKM_head) + print >>RAW_OUT, '\t'.join(RPKM_head) + for key in RPKM_table: + print >>RPKM_OUT, key + '\t', + print >>RPKM_OUT, '\t'.join(RPKM_table[key]) + print >>RAW_OUT, key + '\t', + print >>RAW_OUT, '\t'.join(rawCount_table[key]) + + def saturation_junction(self,refgene,outfile=None,sample_start=5,sample_step=5,sample_end=100,min_intron=50,recur=1): + '''check if an RNA-seq experiment is saturated in terms of detecting known splicing junction''' + + if outfile is None: + out_file = self.fileName + ".junctionSaturation_plot.r" + else: + out_file = outfile + ".junctionSaturation_plot.r" + if refgene is None: + print >>sys.stderr, "You must provide reference gene model in bed format." + sys.exit(1) + + OUT = open(out_file,'w') + + + #reading reference gene + knownSpliceSites= set() + print >>sys.stderr, "reading reference bed file: ",refgene, " ... ", + for line in open(refgene,'r'): + if line.startswith(('#','track','browser')):continue + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for st,end in zip (intron_start, intron_end): + knownSpliceSites.add(chrom + ":" + str(st) + "-" + str(end)) + print >>sys.stderr,"Done! Total "+str(len(knownSpliceSites)) + " known splicing sites" + + + #read SAM file + samSpliceSites=[] + intron_start=[] + intron_end=[] + uniqSpliceSites=collections.defaultdict(int) + print >>sys.stderr, "Reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + continue + if (len(ParseSAM._splicedHit_pat.findall(fields[5]))==1): #skip non-spilced reads + continue + + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + blockStart=[] + blockSize=[] + blockEnd=[] + #if intron size < min_intron, skip. + flag=0 + for i in range(1,len(comb),2): + if comb[i] < min_intron: + flag=1 + break + if flag ==1: + continue + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + end = st + size + blockEnd.append(end) + intron_st = blockEnd[:-1] + intron_end = blockStart[1:] + + for st,end in zip(intron_st, intron_end): + samSpliceSites.append(chrom + ":" + str(st) + "-" + str(end)) + #self.f.seek(0) + print >>sys.stderr, "Done" + + + + print >>sys.stderr, "shuffling alignments ...", + random.shuffle(samSpliceSites) + print >>sys.stderr, "Done" + + #resampling + SR_num = len(samSpliceSites) + sample_size=0 + knownSpliceSites_num = 0 + known_junc=[] + all_junc=[] + #=========================sampling uniquely mapped reads from population + tmp=range(sample_start,sample_end,sample_step) + tmp.append(100) + for pertl in tmp: #[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,100] + knownSpliceSites_num = 0 + index_st = int(SR_num * ((pertl - sample_step)/100.0)) + index_end = int(SR_num * (pertl/100.0)) + if index_st < 0: index_st = 0 + sample_size += index_end -index_st + + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(sample_size) + ") unique splicing alignments ...", + for i in range(index_st, index_end): + uniqSpliceSites[samSpliceSites[i]] +=1 + all_junc.append(str(len(uniqSpliceSites.keys()))) + for sj in uniqSpliceSites: + if sj in knownSpliceSites and uniqSpliceSites[sj] >= recur: + knownSpliceSites_num +=1 + print >>sys.stderr, str(knownSpliceSites_num) + " known splicing junctions" + known_junc.append(str(knownSpliceSites_num)) + + #for j in uniq_SJ: + #print >>OUT, j + "\t" + str(uniq_SJ[j]) + print >>OUT, "pdf('junction_saturation.pdf')" + print >>OUT, "x=c(" + ','.join([str(i) for i in tmp]) + ')' + print >>OUT, "y=c(" + ','.join(known_junc) + ')' + print >>OUT, "z=c(" + ','.join(all_junc) + ')' + print >>OUT, "plot(x,z/1000,xlab='percent of total reads',ylab='Number of splicing junctions (x1000)',type='o',col='blue',ylim=c(%d,%d))" % (int(int(known_junc[0])/1000), int(int(all_junc[-1])/1000)) + print >>OUT, "points(x,y/1000,type='o',col='red')" + print >>OUT, 'legend(5,%d, legend=c("All detected junction","Annotated junction"),col=c("blue","red"),lwd=1,pch=1)' % int(int(all_junc[-1])/1000) + print >>OUT, "dev.off()" + + + def annotate_junction(self,refgene,outfile=None,min_intron=50): + '''Annotate splicing junctions in SAM file. Note that a (long) read might have multiple splicing + events (splice multiple times), and the same splicing events can be consolidated into a single + junction''' + + if outfile is None: + out_file = self.fileName + ".junction.xls" + out_file2 = self.fileName + ".junction_plot.r" + else: + out_file = outfile + ".junction.xls" + out_file2 = outfile + ".junction_plot.r" + if refgene is None: + print >>sys.stderr, "You must provide reference gene model in bed format." + sys.exit(1) + OUT = open(out_file,'w') + ROUT = open(out_file2,'w') + + #reading reference gene model + refIntronStarts=collections.defaultdict(dict) + refIntronEnds=collections.defaultdict(dict) + total_junc =0 + novel35_junc =0 + novel3or5_junc =0 + known_junc =0 + splicing_events=collections.defaultdict(int) + + print >>sys.stderr, "\treading reference bed file: ",refgene, " ... ", + for line in open(refgene,'r'): + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for i_st,i_end in zip (intron_start, intron_end): + refIntronStarts[chrom][i_st] =i_st + refIntronEnds[chrom][i_end] =i_end + print >>sys.stderr,"Done" + + #reading input SAM file + print >>sys.stderr, "\tProcessing "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + continue + if (len(ParseSAM._splicedHit_pat.findall(fields[5]))==1): #skip non-spilced reads + continue + + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + blockStart=[] + blockSize=[] + blockEnd=[] + #if intron size < min_intron, skip. + flag=0 + for i in range(1,len(comb),2): + if comb[i] < min_intron: + flag=1 + break + if flag ==1: + continue + + total_junc += (len(comb) -1)/2 + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + end = st + size + blockEnd.append(end) + intron_st = blockEnd[:-1] + intron_end = blockStart[1:] + for i_st,i_end in zip(intron_st, intron_end): + splicing_events[chrom + ":" + str(i_st) + ":" + str(i_end)] += 1 + if (refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + known_junc +=1 #known both + elif (not refIntronStarts[chrom].has_key(i_st) and not refIntronEnds[chrom].has_key(i_end)): + novel35_junc +=1 + else: + novel3or5_junc +=1 + #self.f.seek(0) + print >>sys.stderr, "Done" + + print >>ROUT, 'pdf("splicing_events_pie.pdf")' + print >>ROUT, "events=c(" + ','.join([str(i*100.0/total_junc) for i in (novel3or5_junc,novel35_junc,known_junc)])+ ')' + print >>ROUT, 'pie(events,col=c(2,3,4),init.angle=30,angle=c(60,120,150),density=c(70,70,70),main="splicing events",labels=c("partial_novel %d%%","complete_novel %d%%","known %d%%"))' % (round(novel3or5_junc*100.0/total_junc),round(novel35_junc*100.0/total_junc),round(known_junc*100.0/total_junc)) + print >>ROUT, "dev.off()" + + print >>sys.stderr, "\n===================================================================" + print >>sys.stderr, "Total splicing Events:\t" + str(total_junc) + print >>sys.stderr, "Known Splicing Events:\t" + str(known_junc) + print >>sys.stderr, "Partial Novel Splicing Events:\t" + str(novel3or5_junc) + print >>sys.stderr, "Novel Splicing Events:\t" + str(novel35_junc) + + #reset variables + total_junc =0 + novel35_junc =0 + novel3or5_junc =0 + known_junc =0 + + print >>OUT, "chrom\tintron_st(0-based)\tintron_end(1-based)\tread_count\tannotation" + for i in splicing_events: + total_junc += 1 + (chrom, i_st, i_end) = i.split(":") + print >>OUT, '\t'.join([chrom.replace("CHR","chr"),i_st,i_end]) + '\t' + str(splicing_events[i]) + '\t', + i_st = int(i_st) + i_end = int(i_end) + if (refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + print >>OUT, "annotated" + known_junc +=1 + elif (not refIntronStarts[chrom].has_key(i_st) and not refIntronEnds[chrom].has_key(i_end)): + print >>OUT, 'complete_novel' + novel35_junc +=1 + else: + print >>OUT, 'partial_novel' + novel3or5_junc +=1 + + + print >>sys.stderr, "\nTotal splicing Junctions:\t" + str(total_junc) + print >>sys.stderr, "Known Splicing Junctions:\t" + str(known_junc) + print >>sys.stderr, "Partial Novel Splicing Junctions:\t" + str(novel3or5_junc) + print >>sys.stderr, "Novel Splicing Junctions:\t" + str(novel35_junc) + print >>sys.stderr, "\n===================================================================" + + print >>ROUT, 'pdf("splicing_junction_pie.pdf")' + print >>ROUT, "junction=c(" + ','.join([str(i*100.0/total_junc) for i in (novel3or5_junc,novel35_junc,known_junc,)])+ ')' + print >>ROUT, 'pie(junction,col=c(2,3,4),init.angle=30,angle=c(60,120,150),density=c(70,70,70),main="splicing junctions",labels=c("partial_novel %d%%","complete_novel %d%%","known %d%%"))' % (round(novel3or5_junc*100.0/total_junc),round(novel35_junc*100.0/total_junc),round(known_junc*100.0/total_junc)) + print >>ROUT, "dev.off()" + #print >>ROUT, "mat=matrix(c(events,junction),byrow=T,ncol=3)" + #print >>ROUT, 'barplot(mat,beside=T,ylim=c(0,100),names=c("known","partial\nnovel","complete\nnovel"),legend.text=c("splicing events","splicing junction"),ylab="Percent")' + + def mRNA_RPKM(self,refbed,outfile=None): + '''calculate mRNA's RPKM value''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if outfile is None: + rpkm_file = self.fileName + ".RPKM.xls" + else: + rpkm_file = outfile + ".RPKM.xls" + RPKM_OUT = open(rpkm_file,'w') + + ranges={} + totalReads=0 + cUR_num = 0 #number + + RPKM_table={} + rawCount_table={} + mRNAlen_table={} + RPKM_head=['chr','start','end','name','score','strand','length','rawCount','RPKM'] + + #read SAM + print >>sys.stderr, "Reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + totalReads +=1 + if not ParseSAM._uniqueHit_pat.search(line): #skip multiple mapped reads + continue + + chrom = fields[2].upper() + chromStart = string.atoi(fields[3])-1 + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + cUR_num += (len(comb) +1)/2 + blockStart=[] + blockSize=[] + + for i in range(0,len(comb),2): + blockStart.append(chromStart + sum(comb[:i]) ) + + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + + for st,size in zip(blockStart,blockSize): + mid = int(st) + (size/2) + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( mid, mid ) ) + + print >>sys.stderr, "Done" + + + print >>sys.stderr, "Calculating RPKM ...", + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line + continue + mRNA_count=0 #we need to initializ it to 0 for each gene + mRNA_len=sum(exon_sizes) + for st,end in zip(exon_starts,exon_ends): + if chrom in ranges: + mRNA_count += len(ranges[chrom].find(st,end)) + mRNA_RPKM = (mRNA_count * 1000000000.0)/(mRNA_len * cUR_num) + + mRNAlen_table[key] = mRNA_len + RPKM_table[key] = str(mRNA_RPKM) + rawCount_table[key] = str(mRNA_count) + print >>sys.stderr, "Done" + + print >>RPKM_OUT, '\t'.join(RPKM_head) + for k in RPKM_table: + print >>RPKM_OUT, k + '\t', + print >>RPKM_OUT, str(mRNAlen_table[k]) + '\t', + print >>RPKM_OUT, str(rawCount_table[k]) + '\t', + print >>RPKM_OUT, str(RPKM_table[k]) + '\t' + return RPKM_table + self.f.seek(0) + + def strand_specificity(self,refbed,genome,outfile=None,sp="GTAG,GCAG,ATAC"): + '''Measure the strand specificity of strand specific RNA-seq protocol. For non-splice read, + use the parental gene as standard, for spliced read, use the splicing motif as strandard''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + if genome is None: + print >>sys.stderr,"You must specify genome sequence in fasta format\n" + exit(0) + + if outfile is None: + strand_file = self.fileName + ".strand.infor" + else: + strand_file = outfile + ".strand.infor" + OUT = open(strand_file,'w') + print >>OUT,"read_type\tread_id\tread_seq\tchr\tStart\tCigar\tprotocol_strand\tgene_strand" + + transtab = string.maketrans("ACGTNX","TGCANX") + motif=sp.upper().split(',') + motif_rev = [m.translate(transtab)[::-1] for m in motif] + + #load genome + print >>sys.stderr, "\tloading "+genome+'...' + tmp=fasta.Fasta(genome) + + #load reference gene model + gene_ranges={} + print >>sys.stderr, "reading reference gene model ...", + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line + continue + if chrom not in gene_ranges: + gene_ranges[chrom]=Intersecter() + gene_ranges[chrom].insert(tx_start,tx_end,strand) + print >>sys.stderr, "Done" + + #read SAM + + read_type="unknown" + strand_from_protocol = 'unknown' + strand_from_gene='unknown' + strand_stat=collections.defaultdict(int) + print >>sys.stderr, "Reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line):continue #skip multiple mapped reads + if (flagCode & 0x0100 !=0): continue #skip non primary hit + if (flagCode & 0x0200 !=0): continue #skip QC-failed + if (flagCode & 0x0400 !=0): continue #skip PCR artifact + if (flagCode & 0x0010 !=0): strand_from_protocol = '-' + if (flagCode & 0x0010 ==0): strand_from_protocol = '+' + if (flagCode & 0x0040 !=0): read_type="read_1" + if (flagCode & 0x0080 !=0): read_type="read_2" + chrom = fields[2] + comb=[int(i) for i in ParseSAM._splicedHit_pat.findall(fields[5])] #"9M4721N63M3157N8M" return ['9', '4721', '63', '3157', '8'] + readStart = string.atoi(fields[3])-1 + + + #for non spliced read + if len(comb)==1: + readEnd = readStart + len(fields[9]) + if chrom in gene_ranges: + if len(set(gene_ranges[chrom].find(readStart,readEnd)))>1: + strand_from_gene="overlap" + elif len(set(gene_ranges[chrom].find(readStart,readEnd)))==1: + strand_from_gene = set(gene_ranges[chrom].find(readStart,readEnd)).pop() + else: + strand_from_gene="intergenic" + + print >>OUT,read_type + '\t' + fields[0] + '\t' + fields[9] + '\t' + fields[2] + '\t' + fields[3] + '\t' + fields[5] +'\t', + print >>OUT,strand_from_protocol + '\t' + strand_from_gene + strand_stat[read_type + '\t' + strand_from_protocol +'\t' + strand_from_gene] +=1 + + + #for spliced read + if len(comb)>=3: + splice_strand=[] + blockStart=[] + blockSize=[] + blockEnd =[] + for i in range(0,len(comb),2): + blockStart.append(readStart + sum(comb[:i]) ) + for i in range(0,len(comb),2): + blockSize.append(comb[i]) + blockEnd=map((lambda x,y:x+y),blockStart,blockSize) + intron_start=blockEnd[:-1] + intron_end=blockStart[1:] + for st,end in zip(intron_start,intron_end): + try: + splice_motif = str(tmp.fetchSeq(chrom, st, st+2)) + str(tmp.fetchSeq(chrom, end-2,end)) + except: + print line + if splice_motif in motif: + splice_strand.append('+') + elif splice_motif in motif_rev: + splice_strand.append('-') + else: + splice_strand.append('unknown motif') + + + if len(set(splice_strand))>1: + strand_from_splice = 'unknown motif' + else: + strand_from_splice = set(splice_strand).pop() + print >>OUT,read_type + '\t' + fields[0] + '\t' + fields[9] + '\t' + fields[2] + '\t' + fields[3] + '\t' + fields[5] +'\t', + print >>OUT,strand_from_protocol + '\t' + strand_from_splice + + strand_stat[read_type + '\t' + strand_from_protocol +'\t' + strand_from_splice] +=1 + + print >>sys.stderr, "Done" + + print "read_type\tstrand_expected\tstrand_observed\tcount" + for i in sorted(strand_stat): + print str(i) +'\t' + str(strand_stat[i]) + + def clipping_profile(self,outfile=None): + '''calculate profile of soft clipping''' + if outfile is None: + out_file1 = self.fileName + ".clipping_profile.xls" + out_file2 = self.fileName + ".clipping_profile.r" + else: + out_file1 = outfile + ".clipping_profile.xls" + out_file2 = outfile + ".clipping_profile.r" + + OUT=open(out_file1,'w') + ROUT=open(out_file2,'w') + print >>OUT, "Position\tRead_Total\tRead_clipped" + soft_p = re.compile(r'(.*?)(\d+)S') + read_part = re.compile(r'(\d+)[MIS=X]') + total_read =0 + skip_part_of_read =0 + soft_clip_profile=collections.defaultdict(int) + + read_pos=[] + clip_count=[] + print >>sys.stderr, "Reading "+ self.fileName + '...' + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line):continue #skip multiple mapped reads + if (flagCode & 0x0100 !=0): continue #skip non primary hit + if (flagCode & 0x0200 !=0): continue #skip QC-failed + if (flagCode & 0x0400 !=0): continue #skip PCR artifact + total_read +=1 + m = soft_p.findall(fields[5]) + + skip_part_of_read =0 + if len(m)==0: #NO soft clip + continue + else: + for j in m: + skip_part_of_read += sum([int(i) for i in read_part.findall(j[0])]) + for n in range(skip_part_of_read,(skip_part_of_read + int(j[1]))): + soft_clip_profile[n]+=1 + skip_part_of_read += int(j[1]) + for i in soft_clip_profile: + read_pos.append(str(i)) + clip_count.append(str(soft_clip_profile[i])) + print >>OUT, str(i) + '\t' + str(total_read) + '\t' + str(soft_clip_profile[i]) + print >>ROUT, "pdf('clipping_profile.pdf')" + print >>ROUT, "read_pos=c(" + ','.join(read_pos) + ')' + print >>ROUT, "count=c(" + ','.join(clip_count) + ')' + print >>ROUT, 'plot(read_pos,1-(count/%d),col="blue",main="clipping profile",xlab="Position of reads",ylab="Mappability",type="b")' % total_read + print >>ROUT, "dev.off()" + + def insertion_profile(self,read_len,outfile=None): + '''calculate profile of insertion (insertion means insertion to the reference)''' + if outfile is None: + out_file1 = self.fileName + ".insertion_profile.xls" + out_file2 = self.fileName + ".insertion_profile.r" + else: + out_file1 = outfile + ".insertion_profile.xls" + out_file2 = outfile + ".insertion_profile.r" + + OUT=open(out_file1,'w') + ROUT=open(out_file2,'w') + print >>OUT, "Position\tRead_Total\tRead_clipped" + soft_p = re.compile(r'(.*?)(\d+)I') + read_part = re.compile(r'(\d+)[MIS=X]') + total_read =0 + skip_part_of_read =0 + soft_clip_profile=collections.defaultdict(int) + print >>sys.stderr, "Reading "+ self.fileName + '...', + for line in self.f: + if line.startswith("@"):continue + fields=line.rstrip('\n ').split() + flagCode=string.atoi(fields[1]) + if (flagCode & 0x0004) != 0: continue #skip unmap reads + if not ParseSAM._uniqueHit_pat.search(line):continue #skip multiple mapped reads + if (flagCode & 0x0100 !=0): continue #skip non primary hit + if (flagCode & 0x0200 !=0): continue #skip QC-failed + if (flagCode & 0x0400 !=0): continue #skip PCR artifact + total_read +=1 + m = soft_p.findall(fields[5]) + + skip_part_of_read =0 + if len(m)==0: #NO soft clip + continue + else: + for j in m: + skip_part_of_read += sum([int(i) for i in read_part.findall(j[0])]) + for n in range(skip_part_of_read,(skip_part_of_read + int(j[1]))): + soft_clip_profile[n]+=1 + skip_part_of_read += int(j[1]) + for i in range(0,read_len): + print >>OUT, str(i) + '\t' + str(total_read) + '\t' + str(soft_clip_profile[i]) + +class ParseBAM: + '''This class provides fuctions to parsing/processing/transforming SAM or BAM files. The input + file could be either SAM or BAM format file''' + + multi_hit_tags=['H0','H1','H2','IH','NH'] + def __init__(self,inputFile): + '''constructor. input could be bam or sam''' + try: + self.samfile = pysam.Samfile(inputFile,'rb') + if len(self.samfile.header) ==0: + print >>sys.stderr, "BAM/SAM file has no header section. Exit!" + sys.exit(1) + self.bam_format = True + except: + self.samfile = pysam.Samfile(inputFile,'r') + if len(self.samfile.header) ==0: + print >>sys.stderr, "BAM/SAM file has no header section. Exit!" + sys.exit(1) + self.bam_format = False + + def stat (self): + '''Calculate mapping statistics''' + R_total=0 + R_qc_fail=0 + R_duplicate=0 + R_nonprimary=0 + R_unmap =0 + + R_multipleHit=0 + R_uniqHit=0 #all the following count should be sum to uniqHit + + R_read1=0 + R_read2=0 + R_reverse =0 + R_forward=0 + R_nonSplice=0 + R_splice=0 + R_properPair =0 + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + flag=0 + aligned_read = self.samfile.next() + R_total +=1 + if aligned_read.is_qcfail: #skip QC fail read + R_qc_fail +=1 + continue + if aligned_read.is_duplicate: #skip duplicate read + R_duplicate +=1 + continue + if aligned_read.is_secondary: #skip non primary hit + R_nonprimary +=1 + continue + if aligned_read.is_unmapped: #skip unmap read + R_unmap +=1 + continue + + + if len(aligned_read.tags) > 0: + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1: + R_multipleHit +=1 + continue #skip multiple map read + if flag==0: + R_uniqHit +=1 + if aligned_read.is_read1: + R_read1 +=1 + if aligned_read.is_read2: + R_read2 +=1 + if aligned_read.is_reverse: + R_reverse +=1 + else: + R_forward +=1 + cigar_str = cigar.list2str(aligned_read.cigar) + introns = cigar.fetch_intron('chr1', aligned_read.pos, cigar_str) + if len(introns)==0: + R_nonSplice +=1 + if len(introns)>=1: + R_splice +=1 + if aligned_read.is_proper_pair: + R_properPair +=1 + + except StopIteration: + print >>sys.stderr, "Done" + #self.samfile.seek(current_pos) + + print >>sys.stderr,"\n#==================================================" + print >>sys.stderr, "%-30s%d" % ("Total Reads (Records):",R_total) + print >>sys.stderr, "\n", + print >>sys.stderr, "%-30s%d" % ("QC failed:",R_qc_fail) + print >>sys.stderr, "%-30s%d" % ("Optical/PCR duplicate:", R_duplicate) + print >>sys.stderr, "%-30s%d" % ("Non Primary Hits", R_nonprimary) + print >>sys.stderr, "%-30s%d" % ("Unmapped reads:",R_unmap) + print >>sys.stderr, "%-30s%d" % ("Multiple mapped reads:",R_multipleHit) + print >>sys.stderr, "\n", + print >>sys.stderr, "%-30s%d" % ("Uniquely mapped:",R_uniqHit) + print >>sys.stderr, "%-30s%d" % ("Read-1:",R_read1) + print >>sys.stderr, "%-30s%d" % ("Read-2:",R_read2) + print >>sys.stderr, "%-30s%d" % ("Reads map to '+':",R_forward) + print >>sys.stderr, "%-30s%d" % ("Reads map to '-':",R_reverse) + print >>sys.stderr, "%-30s%d" % ("Non-splice reads:",R_nonSplice) + print >>sys.stderr, "%-30s%d" % ("Splice reads:",R_splice) + print >>sys.stderr, "%-30s%d" % ("Reads mapped in proper pairs:",R_properPair) + + def configure_experiment(self,refbed,sample_size = 200000): + '''Given a BAM/SAM file, this function will try to guess the RNA-seq experiment: + 1) single-end or pair-end + 2) strand_specific or not + 3) if it is strand-specific, what's the strand_ness of the protocol + ''' + + #how many reads you want to sample + count =0 + p_strandness=collections.defaultdict(int) + s_strandness=collections.defaultdict(int) + #load reference gene model + gene_ranges={} + print >>sys.stderr, "Reading reference gene model " + refbed + ' ...', + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0] + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line + continue + if chrom not in gene_ranges: + gene_ranges[chrom]=Intersecter() + gene_ranges[chrom].insert(tx_start,tx_end,strand) + print >>sys.stderr, "Done" + + #read SAM/BAM file + #current_pos = self.samfile.tell() + print >>sys.stderr, "Loading SAM/BAM file ... ", + try: + while(1): + if count >= sample_size: + break + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail: #skip low quanlity + continue + if aligned_read.is_duplicate: #skip duplicate read + continue + if aligned_read.is_secondary: #skip non primary hit + continue + if aligned_read.is_unmapped: #skip unmap read + continue + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + + chrom = self.samfile.getrname(aligned_read.tid) + if aligned_read.is_paired: + if aligned_read.is_read1: + read_id = '1' + if aligned_read.is_read2: + read_id = '2' + if aligned_read.is_reverse: + map_strand = '-' + else: + map_strand = '+' + readStart = aligned_read.pos + readEnd = readStart + aligned_read.qlen + if chrom in gene_ranges: + if len(set(gene_ranges[chrom].find(readStart,readEnd)))==1: + strand_from_gene = set(gene_ranges[chrom].find(readStart,readEnd)).pop() + p_strandness[read_id + map_strand + strand_from_gene]+=1 + count += 1 + else: + if aligned_read.is_reverse: + map_strand = '-' + else: + map_strand = '+' + readStart = aligned_read.pos + readEnd = readStart + aligned_read.qlen + if chrom in gene_ranges: + if len(set(gene_ranges[chrom].find(readStart,readEnd)))==1: + strand_from_gene = set(gene_ranges[chrom].find(readStart,readEnd)).pop() + s_strandness[map_strand + strand_from_gene]+=1 + count += 1 + + except StopIteration: + print >>sys.stderr, "Finished" + #self.samfile.seek(current_pos) + + print >>sys.stderr, "Total " + str(count) + " usable reads were sampled" + protocol="unknown" + strandness=None + spec1=0.0 + spec2=0.0 + other=0.0 + if len(p_strandness) >0 and len(s_strandness) ==0 : + protocol="PairEnd" + #for k,v in p_strandness.items(): + # print >>sys.stderr, k + '\t' + str(v) + spec1= (p_strandness['1++'] + p_strandness['1--'] + p_strandness['2+-'] + p_strandness['2-+'])/float(sum(p_strandness.values())) + spec2= (p_strandness['1+-'] + p_strandness['1-+'] + p_strandness['2++'] + p_strandness['2--'])/float(sum(p_strandness.values())) + other = 1-spec1-spec2 + + elif len(s_strandness) >0 and len(p_strandness) ==0 : + protocol="SingleEnd" + #for k,v in s_strandness.items(): + # print >>sys.stderr, k + '\t' + str(v) + spec1 = (s_strandness['++'] + s_strandness['--'])/float(sum(s_strandness.values())) + spec2 = (s_strandness['+-'] + s_strandness['-+'])/float(sum(s_strandness.values())) + other = 1-spec1-spec2 + else: + protocol="Mixture" + spec1 = "NA" + spec2 = "NA" + other = "NA" + return [protocol,spec1,spec2,other] + + def bamTowig(self,outfile,chrom_sizes, skip_multi=True,strand_rule=None): + """Convert BAM/SAM file to wig file. chrom_size is dict with chrom as key and chrom_size as value + strandRule should be determined from \"infer_experiment\". such as \"1++,1--,2+-,2-+\"""" + + #strand_rule={'1+':'-','1-':'+','2+':'+','2-':'-'} + strandRule={} + if strand_rule is None: # Not strand-specific + pass + elif len(strand_rule.split(',')) ==4: #PairEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]+i[1]]=i[2] + elif len(strand_rule.split(',')) ==2: #singeEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]]=i[1] + else: + print >>sys.stderr, "Unknown value of option :'strand_rule' " + strand_rule + sys.exit(1) + if len(strandRule) == 0: + FWO = open(outfile + '.wig','w') + else: + FWO = open(outfile + '.Forward.wig','w') + RVO = open(outfile + '.Reverse.wig','w') + + + read_id='' + for chr_name, chr_size in chrom_sizes.items(): #iterate each chrom + try: + self.samfile.fetch(chr_name,0,chr_size) + except: + print >>sys.stderr, "No alignments for " + chr_name + '. skipped' + continue + print >>sys.stderr, "Processing " + chr_name + " ..." + if len(strandRule) == 0: FWO.write('variableStep chrom='+chr_name+'\n') + else: + FWO.write('variableStep chrom='+chr_name+'\n') + RVO.write('variableStep chrom='+chr_name+'\n') + Fwig = collections.defaultdict(int) + Rwig = collections.defaultdict(int) + alignedReads = self.samfile.fetch(chr_name,0,chr_size) + for aligned_read in alignedReads: + flag=0 + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + + if skip_multi: + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + if aligned_read.is_paired: + if aligned_read.is_read1:read_id = '1' + if aligned_read.is_read2:read_id = '2' + + if aligned_read.is_reverse:map_strand = '-' + else:map_strand = '+' + + key = read_id + map_strand + + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + for block in cigar.fetch_exon(chr_name, hit_st, cigar_str): + for pos in range(block[1]+1,block[2]+1): + if len(strandRule) == 0: Fwig[pos] +=1.0 #this is NOT strand specific. everythign into Fwig + else: #this is strand specific. separate Fwig and Rwig + if strandRule[key] == '+':Fwig[pos] +=1.0 + if strandRule[key] == '-':Rwig[pos] -=1.0 + + if len(strandRule) == 0: #this is NOT strand specific. + for pos in sorted (Fwig.keys()): + print >>FWO, "%d\t%.2f" % (pos,Fwig[pos]) + else: + for pos in sorted (Fwig.keys()): + print >>FWO, "%d\t%.2f" % (pos,Fwig[pos]) + for pos in sorted (Rwig.keys()): + print >>RVO, "%d\t%.2f" % (pos,Rwig[pos]) + + + def calculate_rpkm(self,geneFile,outfile,strand_rule=None): + '''calculate RPKM vaues. For single end RNA-seq, if it is strand specific, we assume that + read plus mapped indicates a gene on plus strand.(similar to minus). + Advantages: works for both SAM and BAM + works for both sorted and unsorted BAM/SAM file + works for both index or unindexed BAM/SAM file + much faster than indexing bam file + Disadvantage: random access BAM file was disabled, thus large mount of RAM is required + + strand_rule: could be the following values: + '1++,1--,2+-,2-+ + '1+-,1-+,2++,2-- + '++,--' + '+-,-+' + None + ''' + + strandRule={} + if strand_rule is None: # Not strand-specific + pass + elif len(strand_rule.split(',')) ==4: #PairEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]+i[1]]=i[2] + elif len(strand_rule.split(',')) ==2: #singeEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]]=i[1] + else: + print >>sys.stderr, "Unknown value of option :'strand_rule' " + strand_rule + sys.exit(1) + + uniq_read=0 + total_tags=0 + plus_ranges={} + minus_ranges={} + unstrand_ranges={} + + rpkm_value={} + + RPKM_OUT = open(outfile,'w') + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + #current_pos = self.samfile.tell() + try: + while(1): + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + uniq_read +=1 + + if aligned_read.is_paired: + if aligned_read.is_read1:read_id = '1' + if aligned_read.is_read2:read_id = '2' + else: + read_id = '' + if aligned_read.is_reverse:map_strand = '-' + else:map_strand = '+' + + strand_key = read_id + map_strand + + chrom = self.samfile.getrname(aligned_read.tid).upper() + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + exon_blocks = cigar.fetch_exon(chrom, hit_st, cigar_str) + total_tags += len(exon_blocks) + + #construct bitset + if strand_rule is not None: + if strandRule[strand_key] == '+': + for block in exon_blocks: + mid = block[1] + int((block[2] - block[1])/2) + if chrom not in plus_ranges:plus_ranges[chrom] = Intersecter() + else:plus_ranges[chrom].add_interval( Interval( mid,mid+1 ) ) + elif strandRule[strand_key] == '-': + for block in exon_blocks: + mid = block[1] + int((block[2] - block[1])/2) + if chrom not in minus_ranges:minus_ranges[chrom] = Intersecter() + else:minus_ranges[chrom].add_interval( Interval( mid,mid+1 ) ) + elif strand_rule is None: + for block in exon_blocks: + mid = block[1] + int((block[2] - block[1])/2) + if chrom not in unstrand_ranges:unstrand_ranges[chrom] = Intersecter() + else:unstrand_ranges[chrom].add_interval( Interval( mid,mid+1 ) ) + + except StopIteration: + print >>sys.stderr, "Done" + #self.samfile.seek(current_pos) + print >>RPKM_OUT, "#Total uniquely mapped reads = " + str(uniq_read) + print >>RPKM_OUT, "#Total fragments = " + str(total_tags) + print >>sys.stderr, "Assign reads to "+ geneFile + '...', + for line in open(geneFile,'r'): + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5].replace(" ","_") + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + intron_starts = exon_ends[:-1] + intron_ends=exon_starts[1:] + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + + + mRNA_count=0 + mRNA_len=sum(exon_sizes) + + if (strand_rule is not None) and (strand == '-'): + intronNum=len(intron_starts) + exonNum=len(exon_starts) + + # assign reads to intron + for st,end in zip(intron_starts,intron_ends): + if chrom in minus_ranges: + hits= len(minus_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + intronNum -= 1 + # assign reads to exon + for st,end in zip(exon_starts,exon_ends): + if chrom in minus_ranges: + hits= len(minus_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + exonNum -= 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*total_tags)) +'\n') + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + elif (strand_rule is not None) and (strand == '+'): + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in plus_ranges: + hits= len(plus_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in plus_ranges: + hits= len(plus_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + exonNum += 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*total_tags)) +'\n') + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + elif strand_rule is None: + intronNum=1 + exonNum=1 + for st,end in zip(intron_starts,intron_ends): + if chrom in unstrand_ranges: + hits= len(unstrand_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_intron_" + str(intronNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + intronNum += 1 + for st,end in zip(exon_starts,exon_ends): + if chrom in unstrand_ranges: + hits= len(unstrand_ranges[chrom].find(st,end)) + RPKM_OUT.write(chrom.lower() + "\t" + str(st) + "\t" + str(end) + "\t" + geneName + "_exon_" + str(exonNum) + "\t" + str(hits) + "\t" + strand + '\t' + str(hits*1000000000.0/((end-st)*(total_tags))) +'\n') + exonNum += 1 + mRNA_count += hits + try: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(mRNA_count) + "\t" + strand + '\t' + str(mRNA_count*1000000000.0/(mRNA_len*total_tags)) +'\n') + except: + RPKM_OUT.write(chrom.lower() + "\t" + str(tx_start) + "\t" + str(tx_end) + "\t" + geneName + "_mRNA" + "\t" + str(0) + "\t" + strand + '\t' + str(0) +'\n') + print >>sys.stderr, "Done" + + def readsNVC(self,outfile=None,nx=True): + '''for each read, calculate nucleotide frequency vs position''' + if outfile is None: + outfile1 = self.fileName + ".NVC.xls" + outfile2 = self.fileName +".NVC_plot.r" + else: + outfile1 = outfile + ".NVC.xls" + outfile2 = outfile +".NVC_plot.r" + FO=open(outfile1,'w') + RS=open(outfile2,'w') + PPcount=0 + + transtab = string.maketrans("ACGTNX","TGCANX") + base_freq=collections.defaultdict(int) + a_count=[] + c_count=[] + g_count=[] + t_count=[] + n_count=[] + x_count=[] + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + aligned_read = self.samfile.next() + #if aligned_read.is_unmapped:continue #skip unmapped read + #if aligned_read.is_qcfail:continue #skip low quality + RNA_read = aligned_read.seq.upper() + if aligned_read.is_reverse: + RNA_read = RNA_read.translate(transtab)[::-1] + for i,j in enumerate(RNA_read): + key = str(i) + j + base_freq[key] += 1 + except StopIteration: + print >>sys.stderr, "Done" + + print >>sys.stderr, "generating data matrix ..." + print >>FO, "Position\tA\tC\tG\tT\tN\tX" + for i in xrange(len(RNA_read)): + print >>FO, str(i) + '\t', + print >>FO, str(base_freq[str(i) + "A"]) + '\t', + a_count.append(str(base_freq[str(i) + "A"])) + print >>FO, str(base_freq[str(i) + "C"]) + '\t', + c_count.append(str(base_freq[str(i) + "C"])) + print >>FO, str(base_freq[str(i) + "G"]) + '\t', + g_count.append(str(base_freq[str(i) + "G"])) + print >>FO, str(base_freq[str(i) + "T"]) + '\t', + t_count.append(str(base_freq[str(i) + "T"])) + print >>FO, str(base_freq[str(i) + "N"]) + '\t', + n_count.append(str(base_freq[str(i) + "N"])) + print >>FO, str(base_freq[str(i) + "X"]) + '\t' + x_count.append(str(base_freq[str(i) + "X"])) + FO.close() + + #generating R scripts + print >>sys.stderr, "generating R script ..." + print >>RS, "position=c(" + ','.join([str(i) for i in xrange(len(RNA_read))]) + ')' + print >>RS, "A_count=c(" + ','.join(a_count) + ')' + print >>RS, "C_count=c(" + ','.join(c_count) + ')' + print >>RS, "G_count=c(" + ','.join(g_count) + ')' + print >>RS, "T_count=c(" + ','.join(t_count) + ')' + print >>RS, "N_count=c(" + ','.join(n_count) + ')' + print >>RS, "X_count=c(" + ','.join(x_count) + ')' + + if nx: + print >>RS, "total= A_count + C_count + G_count + T_count + N_count + X_count" + print >>RS, "ym=max(A_count/total,C_count/total,G_count/total,T_count/total,N_count/total,X_count/total) + 0.05" + print >>RS, "yn=min(A_count/total,C_count/total,G_count/total,T_count/total,N_count/total,X_count/total)" + + print >>RS, 'pdf(\"%s\")' % (outfile +".NVC_plot.pdf") + print >>RS, 'plot(position,A_count/total,type="o",pch=20,ylim=c(yn,ym),col="dark green",xlab="Position of Read",ylab="Nucleotide Frequency")' + print >>RS, 'lines(position,T_count/total,type="o",pch=20,col="red")' + print >>RS, 'lines(position,G_count/total,type="o",pch=20,col="blue")' + print >>RS, 'lines(position,C_count/total,type="o",pch=20,col="cyan")' + print >>RS, 'lines(position,N_count/total,type="o",pch=20,col="black")' + print >>RS, 'lines(position,X_count/total,type="o",pch=20,col="grey")' + print >>RS, 'legend('+ str(len(RNA_read)-10) + ',ym,legend=c("A","T","G","C","N","X"),col=c("dark green","red","blue","cyan","black","grey"),lwd=2,pch=20,text.col=c("dark green","red","blue","cyan","black","grey"))' + print >>RS, "dev.off()" + else: + print >>RS, "total= A_count + C_count + G_count + T_count" + print >>RS, "ym=max(A_count/total,C_count/total,G_count/total,T_count/total) + 0.05" + print >>RS, "yn=min(A_count/total,C_count/total,G_count/total,T_count/total)" + + print >>RS, 'pdf(\"%s\")' % (outfile +".NVC_plot.pdf") + print >>RS, 'plot(position,A_count/total,type="o",pch=20,ylim=c(yn,ym),col="dark green",xlab="Position of Read",ylab="Nucleotide Frequency")' + print >>RS, 'lines(position,T_count/total,type="o",pch=20,col="red")' + print >>RS, 'lines(position,G_count/total,type="o",pch=20,col="blue")' + print >>RS, 'lines(position,C_count/total,type="o",pch=20,col="cyan")' + print >>RS, 'legend('+ str(len(RNA_read)-10) + ',ym,legend=c("A","T","G","C"),col=c("dark green","red","blue","cyan"),lwd=2,pch=20,text.col=c("dark green","red","blue","cyan"))' + print >>RS, "dev.off()" + + RS.close() + #self.f.seek(0) + + def readsQual_boxplot(self,outfile,shrink=1000): + '''calculate phred quality score for each base in read (5->3)''' + + output = outfile + ".qual.r" + FO=open(output,'w') + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + quality = collections.defaultdict(dict) #read_pos=>quality score=>count + q_max = -1 + q_min = 10000 + q_list=[] + i_box={} #key is read postion,value is + try: + while(1): + aligned_read = self.samfile.next() + + #if aligned_read.is_unmapped:continue #skip unmapped read + #if aligned_read.is_qcfail:continue #skip low quality + + qual_str = aligned_read.qqual + read_len = aligned_read.rlen + if aligned_read.is_reverse: + qual_str = qual_str[::-1] + + for i,j in enumerate(qual_str): + q=ord(j)-33 + if q > q_max: q_max = q + if q < q_min: q_min = q + try: + quality[i][q] += 1 + except: + quality[i][q] = 1 + except StopIteration: + print >>sys.stderr, "Done" + + for p in range(0,read_len): + #print str(p) + ':', + val=[] + occurrence=[] + for q in range(q_min,q_max+1): + if quality.has_key(p) and quality[p].has_key(q): + val.append(str(q)) + occurrence.append(str(quality[p][q])) + q_list.append(str(quality[p][q])) + else: + q_list.append(str(0)) + i_box[p] = 'rep(c(' + ','.join(val) + '),times=c(' + ','.join(occurrence) + ')/' + str(shrink)+ ')' + + + #generate R script for boxplot + print >>FO, "pdf(\'%s\')" % (outfile + ".qual.boxplot.pdf") + for i in sorted(i_box): + print >>FO,'p'+str(i) + '<-' + i_box[i] + print >>FO, 'boxplot(' + ','.join(['p'+str(i) for i in i_box]) + ',xlab=\"Position of Read(5\'->3\')\",ylab=\"Phred Quality Score\",outline=F' + ')' + print >>FO,"dev.off()" + + + #generate R script for heatmap + print >>FO, '\n' + print >>FO, "pdf(\'%s\')" % (outfile + ".qual.heatmap.pdf") + print >>FO, "qual=c(" + ','.join(q_list) + ')' + print >>FO, "mat=matrix(qual,ncol=%s,byrow=F)" % (read_len) + print >>FO, 'Lab.palette <- colorRampPalette(c("blue", "orange", "red3","red2","red1","red"), space = "rgb",interpolate=c(\'spline\'))' + print >>FO, "heatmap(mat,Rowv=NA,Colv=NA,xlab=\"Position of Read\",ylab=\"Phred Quality Score\",labRow=seq(from=%s,to=%s),col = Lab.palette(256),scale=\"none\" )" % (q_min,q_max) + print >>FO, 'dev.off()' + + + def readGC(self,outfile=None): + '''GC content distribution of reads''' + if outfile is None: + outfile1 = self.fileName + ".GC.xls" + outfile2 = self.fileName +".GC_plot.r" + else: + outfile1 = outfile + ".GC.xls" + outfile2 = outfile + ".GC_plot.r" + FO=open(outfile1,'w') + RS=open(outfile2,'w') + + gc_hist=collections.defaultdict(int) #key is GC percent, value is count of reads + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + aligned_read = self.samfile.next() + if aligned_read.is_unmapped:continue #skip unmapped read + if aligned_read.is_qcfail:continue #skip low quality + RNA_read = aligned_read.seq.upper() + gc_percent = "%4.2f" % ((RNA_read.count('C') + RNA_read.count('G'))/(len(RNA_read)+0.0)*100) + #print gc_percent + gc_hist[gc_percent] += 1 + except StopIteration: + print >>sys.stderr, "Done" + + print >>sys.stderr, "writing GC content ..." + print >>FO, "GC%\tread_count" + for i in gc_hist.keys(): + print >>FO, i + '\t' + str(gc_hist[i]) + + print >>sys.stderr, "writing R script ..." + print >>RS, "pdf(\"%s\")" % (outfile + ".GC_plot.pdf") + print >>RS, 'gc=rep(c(' + ','.join([i for i in gc_hist.keys()]) + '),' + 'times=c(' + ','.join([str(i) for i in gc_hist.values()]) + '))' + print >>RS, 'hist(gc,probability=T,breaks=%d,xlab="GC content (%%)",ylab="Density of Reads",border="blue",main="")' % 100 + #print >>RS, "lines(density(gc),col='red')" + print >>RS ,"dev.off()" + #self.f.seek(0) + + + def readDupRate(self,outfile=None,up_bound=500): + '''Calculate reads's duplicate rates''' + if outfile is None: + outfile1 = self.fileName + ".seq.DupRate.xls" + outfile2 = self.fileName + ".pos.DupRate.xls" + outfile3 = self.fileName + ".DupRate_plot.r" + else: + outfile1 = outfile + ".seq.DupRate.xls" + outfile2 = outfile + ".pos.DupRate.xls" + outfile3 = outfile +".DupRate_plot.r" + SEQ=open(outfile1,'w') + POS=open(outfile2,'w') + RS=open(outfile3,'w') + + seqDup=collections.defaultdict(int) + posDup=collections.defaultdict(int) + + seqDup_count=collections.defaultdict(int) + posDup_count=collections.defaultdict(int) + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + exon_boundary="" + aligned_read = self.samfile.next() + if aligned_read.is_unmapped:continue #skip unmapped read + if aligned_read.is_qcfail:continue #skip low quality + RNA_read = aligned_read.seq.upper() + seqDup[RNA_read] +=1 #key is read sequence + + chrom = self.samfile.getrname(aligned_read.tid) + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + exon_blocks = cigar.fetch_exon(chrom, hit_st, cigar_str) + for ex in exon_blocks: + exon_boundary += str(ex[1]) + '-' + str(ex[2]) + ":" + key = chrom + ":" + str(hit_st) + ":" + exon_boundary + posDup[key] +=1 + + except StopIteration: + print >>sys.stderr, "Done" + + print >>sys.stderr, "report duplicte rate based on sequence ..." + print >>SEQ, "Occurrence\tUniqReadNumber" + for i in seqDup.values(): #key is occurence, value is uniq reads number (based on seq) + seqDup_count[i] +=1 + for k in sorted(seqDup_count.iterkeys()): + print >>SEQ, str(k) +'\t'+ str(seqDup_count[k]) + SEQ.close() + + print >>sys.stderr, "report duplicte rate based on mapping ..." + print >>POS, "Occurrence\tUniqReadNumber" + for i in posDup.values(): #key is occurence, value is uniq reads number (based on coord) + posDup_count[i] +=1 + for k in sorted(posDup_count.iterkeys()): + print >>POS, str(k) +'\t'+ str(posDup_count[k]) + POS.close() + + + print >>sys.stderr, "generate R script ..." + print >>RS, "pdf(\'%s\')" % (outfile +".DupRate_plot.pdf") + print >>RS, "par(mar=c(5,4,4,5),las=0)" + print >>RS, "seq_occ=c(" + ','.join([str(i) for i in sorted(seqDup_count.iterkeys()) ]) + ')' + print >>RS, "seq_uniqRead=c(" + ','.join([str(seqDup_count[i]) for i in sorted(seqDup_count.iterkeys()) ]) + ')' + print >>RS, "pos_occ=c(" + ','.join([str(i) for i in sorted(posDup_count.iterkeys()) ]) + ')' + print >>RS, "pos_uniqRead=c(" + ','.join([str(posDup_count[i]) for i in sorted(posDup_count.iterkeys()) ]) + ')' + print >>RS, "plot(pos_occ,log10(pos_uniqRead),ylab='Number of Reads (log10)',xlab='Frequency',pch=4,cex=0.8,col='blue',xlim=c(1,%d),yaxt='n')" % up_bound + print >>RS, "points(seq_occ,log10(seq_uniqRead),pch=20,cex=0.8,col='red')" + print >>RS, 'ym=floor(max(log10(pos_uniqRead)))' + print >>RS, "legend(%d,ym,legend=c('Sequence-base','Mapping-base'),col=c('red','blue'),pch=c(4,20))" % max(up_bound-200,1) + print >>RS, 'axis(side=2,at=0:ym,labels=0:ym)' + print >>RS, 'axis(side=4,at=c(log10(pos_uniqRead[1]),log10(pos_uniqRead[2]),log10(pos_uniqRead[3]),log10(pos_uniqRead[4])), labels=c(round(pos_uniqRead[1]*100/sum(pos_uniqRead)),round(pos_uniqRead[2]*100/sum(pos_uniqRead)),round(pos_uniqRead[3]*100/sum(pos_uniqRead)),round(pos_uniqRead[4]*100/sum(pos_uniqRead))))' + print >>RS, 'mtext(4, text = "Reads %", line = 2)' + print >>RS, 'dev.off()' + #self.f.seek(0) + + def clipping_profile(self,outfile): + '''calculate profile of soft clipping''' + out_file1 = outfile + ".clipping_profile.xls" + out_file2 = outfile + ".clipping_profile.r" + + OUT=open(out_file1,'w') + ROUT=open(out_file2,'w') + print >>OUT, "Position\tRead_Total\tRead_clipped" + soft_p = re.compile(r'(.*?)(\d+)S') + read_part = re.compile(r'(\d+)[MIS=X]') + total_read =0 + skip_part_of_read =0 + soft_clip_profile=collections.defaultdict(int) + + read_pos=[] + clip_count=[] + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + exon_boundary="" + aligned_read = self.samfile.next() + if aligned_read.is_unmapped:continue #skip unmapped read + if aligned_read.is_qcfail:continue #skip low quality + + total_read +=1 + cigar_str = cigar.list2str(aligned_read.cigar) + m = soft_p.findall(cigar_str) + skip_part_of_read =0 + if len(m)==0:continue #NO soft clip + else: + for j in m: + skip_part_of_read += sum([int(i) for i in read_part.findall(j[0])]) + for n in range(skip_part_of_read,(skip_part_of_read + int(j[1]))): + soft_clip_profile[n]+=1 + skip_part_of_read += int(j[1]) + except StopIteration: + print >>sys.stderr, "Done" + + + for i in soft_clip_profile: + read_pos.append(str(i)) + clip_count.append(str(soft_clip_profile[i])) + print >>OUT, str(i) + '\t' + str(total_read) + '\t' + str(soft_clip_profile[i]) + print >>ROUT, "pdf('clipping_profile.pdf')" + print >>ROUT, "read_pos=c(" + ','.join(read_pos) + ')' + print >>ROUT, "count=c(" + ','.join(clip_count) + ')' + print >>ROUT, 'plot(read_pos,1-(count/%d),col="blue",main="clipping profile",xlab="Position of reads",ylab="Mappability",type="b")' % total_read + print >>ROUT, "dev.off()" + + def coverageGeneBody(self,refbed,outfile): + '''Calculate reads coverage over gene body, from 5'to 3'. each gene will be equally divided + into 100 regsions''' + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + OUT1 = open(outfile + ".geneBodyCoverage_plot.r",'w') + OUT2 = open(outfile + ".geneBodyCoverage.txt",'w') + + ranges={} + totalReads=0 + fragment_num=0 #splice reads will counted twice + rpkm={} + + #read SAM + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + totalReads +=1 + + chrom = self.samfile.getrname(aligned_read.tid).upper() + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + exon_blocks = cigar.fetch_exon(chrom, hit_st, cigar_str) + fragment_num += len(exon_blocks) + + for exon in exon_blocks: + if chrom not in ranges: + ranges[chrom] = Intersecter() + else: + ranges[chrom].add_interval( Interval( exon[1], exon[2] ) ) + except StopIteration: + print >>sys.stderr, "Done" + + print >>sys.stderr, "calculating coverage over gene body ..." + coverage=collections.defaultdict(int) + flag=0 + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + gene_all_base=[] + percentile_base=[] + mRNA_len =0 + flag=0 + for st,end in zip(exon_starts,exon_ends): + gene_all_base.extend(range(st+1,end+1)) #0-based coordinates on genome + mRNA_len = len(gene_all_base) + if mRNA_len <100: + flag=1 + break + if flag==1: continue + if strand == '-': + gene_all_base.sort(reverse=True) #deal with gene on minus stand + else: + gene_all_base.sort(reverse=False) + percentile_base = mystat.percentile_list (gene_all_base) #get 101 points from each gene's coordinates + + for i in range(0,len(percentile_base)): + if chrom in ranges: + coverage[i] += len(ranges[chrom].find(percentile_base[i], percentile_base[i]+1)) + x_coord=[] + y_coord=[] + print >>OUT2, "Total reads: " + str(totalReads) + print >>OUT2, "Fragment number: " + str(fragment_num) + print >>OUT2, "percentile\tcount" + for i in coverage: + x_coord.append(str(i)) + y_coord.append(str(coverage[i])) + print >>OUT2, str(i) + '\t' + str(coverage[i]) + print >>OUT1, "pdf(\'%s\')" % (outfile + ".geneBodyCoverage.pdf") + print >>OUT1, "x=0:100" + print >>OUT1, "y=c(" + ','.join(y_coord) + ')' + print >>OUT1, "plot(x,y,xlab=\"percentile of gene body (5'->3')\",ylab='read number',type='s')" + print >>OUT1, "dev.off()" + + def mRNA_inner_distance(self,outfile,refbed,low_bound=0,up_bound=1000,step=10): + '''estimate the inner distance of mRNA pair end fragment. fragment size = insert_size + 2 x read_length''' + + out_file1 = outfile + ".inner_distance.txt" + out_file2 = outfile + ".inner_distance_freq.txt" + out_file3 = outfile + ".inner_distance_plot.r" + + FO=open(out_file1,'w') + FQ=open(out_file2,'w') + RS=open(out_file3,'w') + + fchrom="chr100" #this is the fake chromosome + ranges={} + ranges[fchrom]=Intersecter() + + window_left_bound = range(low_bound,up_bound,step) + frag_size=0 + + inner_distance_bitsets=BinnedBitSet() + tmp = BinnedBitSet() + tmp.set_range(0,0) + pair_num=0.0 + sizes=[] + counts=[] + count=0 + + print >>sys.stderr, "Get intron regions from " + refbed + " ..." + bed_obj = BED.ParseBED(refbed) + ref_exons = [] + + for exn in bed_obj.getExon(): + ref_exons.append([exn[0].upper(), exn[1], exn[2]]) + exon_bitsets = binned_bitsets_from_list(ref_exons) + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + splice_intron_size=0 + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + if aligned_read.is_read2:continue + if not aligned_read.is_paired: continue #skip single map read + + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + pair_num +=1 + read1_len = aligned_read.qlen + read1_start = aligned_read.pos + read2_start = aligned_read.mpos + + if read1_start > read2_start:continue #only consider read1_start < read2_start + + chrom = self.samfile.getrname(aligned_read.tid).upper() + cigar_str = cigar.list2str(aligned_read.cigar) + intron_blocks = cigar.fetch_intron(chrom, read1_start, cigar_str) + for intron in intron_blocks: + splice_intron_size += intron[2] - intron[1] + + read1_end = read1_start + read1_len + splice_intron_size + #if read1_end > read2_start: continue + + inner_distance = read2_start - read1_end +1 + if inner_distance > 0: + if chrom in exon_bitsets: + size =0 + inner_distance_bitsets.set_range(read1_end, read2_start-read1_end) + inner_distance_bitsets.iand(exon_bitsets[chrom]) + end=0 + while 1: + start = inner_distance_bitsets.next_set( end ) + if start == inner_distance_bitsets.size: break + end = inner_distance_bitsets.next_clear( start ) + size += (end - start) +1 + inner_distance_bitsets.iand(tmp) #clear BinnedBitSet + if size == inner_distance: + FO.write(aligned_read.qname + '\t' + str(size) + '\tPE_within_same_exon\n') + ranges[fchrom].add_interval( Interval( size-1, size ) ) + elif size < inner_distance and size >1: + FO.write(aligned_read.qname + '\t' + str(size) + '\tPE_within_diff_exon\n') + ranges[fchrom].add_interval( Interval( size-1, size ) ) + elif size == 1: + FO.write(aligned_read.qname + '\t' + str(inner_distance) + '\tPE_not_in_gene_region\n') + ranges[fchrom].add_interval( Interval( inner_distance-1, inner_distance ) ) + + else: + FO.write(aligned_read.qname + '\t' + str(inner_distance) + '\tPE_chrom_has_no_refgene\n') + ranges[fchrom].add_interval( Interval( inner_distance-1, inner_distance ) ) + else: + FO.write(aligned_read.qname + '\t' + str(inner_distance) + '\tPE_reads_overlap\n') + ranges[fchrom].add_interval( Interval( inner_distance-1, inner_distance ) ) + + except StopIteration: + print >>sys.stderr, "Done" + + + if pair_num==0: + print >>sys.stderr, "Cannot find paired reads" + sys.exit(0) + #print >>FQ, "Total paired read " + str(pair_num) + for st in window_left_bound: + sizes.append(str(st + step/2)) + count = str(len(ranges[fchrom].find(st,st + step))) + counts.append(count) + print >>FQ, str(st) + '\t' + str(st+step) +'\t' + count + + print >>RS, "pdf(\'%s\')" % (outfile + ".inner_distance_plot.pdf") + #print >>RS, "par(mfrow=c(2,1),cex.main=0.8,cex.lab=0.8,cex.axis=0.8,mar=c(4,4,4,1))" + #print >>RS, 'pie(c(%d,%d,%d),col=rainbow(3),cex=0.5,radius=1,main="Total %d fragments",labels=c("fraSize <= %d\\n(%4.2f%%)","fragSize > %d\\n(%4.2f%%)","%d < fragSize <= %d\\n(%4.2f%%)"), density=rep(80,80,80),angle=c(90,140,170))' % (ultra_low, ultra_high, pair_num -ultra_low -ultra_high, pair_num, low_bound, ultra_low*100/pair_num, up_bound, ultra_high*100/pair_num, low_bound, up_bound, 100-ultra_low*100/pair_num - ultra_high*100/pair_num) + print >>RS, 'fragsize=rep(c(' + ','.join(sizes) + '),' + 'times=c(' + ','.join(counts) + '))' + print >>RS, 'frag_sd = round(sd(fragsize))' + print >>RS, 'frag_mean = round(mean(fragsize))' + print >>RS, 'hist(fragsize,probability=T,breaks=%d,xlab="mRNA insert size (bp)",main=paste(c("Mean=",frag_mean,";","SD=",frag_sd),collapse=""),border="blue")' % len(window_left_bound) + print >>RS, "lines(density(fragsize,bw=%d),col='red')" % (2*step) + print >>RS ,"dev.off()" + FO.close() + FQ.close() + RS.close() + #self.f.seek(0) + + def annotate_junction(self,refgene,outfile,min_intron=50): + '''Annotate splicing junctions in BAM or SAM file. Note that a (long) read might have multiple splicing + events (splice multiple times), and the same splicing events can be consolidated into a single + junction''' + + out_file = outfile + ".junction.xls" + out_file2 = outfile + ".junction_plot.r" + if refgene is None: + print >>sys.stderr, "You must provide reference gene model in bed format." + sys.exit(1) + OUT = open(out_file,'w') + ROUT = open(out_file2,'w') + + #reading reference gene model + refIntronStarts=collections.defaultdict(dict) + refIntronEnds=collections.defaultdict(dict) + total_junc =0 + novel35_junc =0 + novel3or5_junc =0 + known_junc =0 + splicing_events=collections.defaultdict(int) + + print >>sys.stderr, "Reading reference bed file: ",refgene, " ... ", + for line in open(refgene,'r'): + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for i_st,i_end in zip (intron_start, intron_end): + refIntronStarts[chrom][i_st] =i_st + refIntronEnds[chrom][i_end] =i_end + print >>sys.stderr,"Done" + + #reading input SAM file + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + + try: + while(1): + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + chrom = self.samfile.getrname(aligned_read.tid).upper() + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + intron_blocks = cigar.fetch_intron(chrom, hit_st, cigar_str) + if len(intron_blocks)==0: + continue + for intrn in intron_blocks: + total_junc +=1 + if intrn[2] - intrn[1] < min_intron:continue + splicing_events[intrn[0] + ":" + str(intrn[1]) + ":" + str(intrn[2])] += 1 + if (refIntronStarts[chrom].has_key(intrn[1]) and refIntronEnds[chrom].has_key(intrn[2])): + known_junc +=1 #known both + elif (not refIntronStarts[chrom].has_key(intrn[1]) and not refIntronEnds[chrom].has_key(intrn[2])): + novel35_junc +=1 + else: + novel3or5_junc +=1 + except StopIteration: + print >>sys.stderr, "Done" + + print "total = " + str(total_junc) + #self.f.seek(0) + + print >>ROUT, 'pdf(\"%s\")' % (outfile + ".junction_plot.pdf") + print >>ROUT, "events=c(" + ','.join([str(i*100.0/total_junc) for i in (novel3or5_junc,novel35_junc,known_junc)])+ ')' + print >>ROUT, 'pie(events,col=c(2,3,4),init.angle=30,angle=c(60,120,150),density=c(70,70,70),main="splicing events",labels=c("partial_novel %d%%","complete_novel %d%%","known %d%%"))' % (round(novel3or5_junc*100.0/total_junc),round(novel35_junc*100.0/total_junc),round(known_junc*100.0/total_junc)) + print >>ROUT, "dev.off()" + + print >>sys.stderr, "\n===================================================================" + print >>sys.stderr, "Total splicing Events:\t" + str(total_junc) + print >>sys.stderr, "Known Splicing Events:\t" + str(known_junc) + print >>sys.stderr, "Partial Novel Splicing Events:\t" + str(novel3or5_junc) + print >>sys.stderr, "Novel Splicing Events:\t" + str(novel35_junc) + + #reset variables + total_junc =0 + novel35_junc =0 + novel3or5_junc =0 + known_junc =0 + + print >>OUT, "chrom\tintron_st(0-based)\tintron_end(1-based)\tread_count\tannotation" + for i in splicing_events: + total_junc += 1 + (chrom, i_st, i_end) = i.split(":") + print >>OUT, '\t'.join([chrom.replace("CHR","chr"),i_st,i_end]) + '\t' + str(splicing_events[i]) + '\t', + i_st = int(i_st) + i_end = int(i_end) + if (refIntronStarts[chrom].has_key(i_st) and refIntronEnds[chrom].has_key(i_end)): + print >>OUT, "annotated" + known_junc +=1 + elif (not refIntronStarts[chrom].has_key(i_st) and not refIntronEnds[chrom].has_key(i_end)): + print >>OUT, 'complete_novel' + novel35_junc +=1 + else: + print >>OUT, 'partial_novel' + novel3or5_junc +=1 + + if total_junc ==0: + print >>sys.stderr, "No splice read found" + sys.exit(1) + print >>sys.stderr, "\nTotal splicing Junctions:\t" + str(total_junc) + print >>sys.stderr, "Known Splicing Junctions:\t" + str(known_junc) + print >>sys.stderr, "Partial Novel Splicing Junctions:\t" + str(novel3or5_junc) + print >>sys.stderr, "Novel Splicing Junctions:\t" + str(novel35_junc) + print >>sys.stderr, "\n===================================================================" + + print >>ROUT, 'pdf("splicing_junction_pie.pdf")' + print >>ROUT, "junction=c(" + ','.join([str(i*100.0/total_junc) for i in (novel3or5_junc,novel35_junc,known_junc,)])+ ')' + print >>ROUT, 'pie(junction,col=c(2,3,4),init.angle=30,angle=c(60,120,150),density=c(70,70,70),main="splicing junctions",labels=c("partial_novel %d%%","complete_novel %d%%","known %d%%"))' % (round(novel3or5_junc*100.0/total_junc),round(novel35_junc*100.0/total_junc),round(known_junc*100.0/total_junc)) + print >>ROUT, "dev.off()" + #print >>ROUT, "mat=matrix(c(events,junction),byrow=T,ncol=3)" + #print >>ROUT, 'barplot(mat,beside=T,ylim=c(0,100),names=c("known","partial\nnovel","complete\nnovel"),legend.text=c("splicing events","splicing junction"),ylab="Percent")' + + def saturation_junction(self,refgene,outfile=None,sample_start=5,sample_step=5,sample_end=100,min_intron=50,recur=1): + '''check if an RNA-seq experiment is saturated in terms of detecting known splicing junction''' + + out_file = outfile + ".junctionSaturation_plot.r" + if refgene is None: + print >>sys.stderr, "You must provide reference gene model in bed format." + sys.exit(1) + + OUT = open(out_file,'w') + + + #reading reference gene + knownSpliceSites= set() + print >>sys.stderr, "reading reference bed file: ",refgene, " ... ", + for line in open(refgene,'r'): + if line.startswith(('#','track','browser')):continue + fields = line.split() + if(len(fields)<12): + print >>sys.stderr, "Invalid bed line (skipped):",line, + continue + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + if int(fields[9] ==1): + continue + + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends); + intron_start = exon_ends[:-1] + intron_end=exon_starts[1:] + for st,end in zip (intron_start, intron_end): + knownSpliceSites.add(chrom + ":" + str(st) + "-" + str(end)) + print >>sys.stderr,"Done! Total "+str(len(knownSpliceSites)) + " known splicing junctions." + + + #read SAM file + samSpliceSites=[] + intron_start=[] + intron_end=[] + uniqSpliceSites=collections.defaultdict(int) + + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + try: + while(1): + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + chrom = self.samfile.getrname(aligned_read.tid).upper() + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + intron_blocks = cigar.fetch_intron(chrom, hit_st, cigar_str) + if len(intron_blocks)==0: + continue + for intrn in intron_blocks: + if intrn[2] - intrn[1] < min_intron:continue + samSpliceSites.append(intrn[0] + ":" + str(intrn[1]) + "-" + str(intrn[2])) + except StopIteration: + print >>sys.stderr, "Done" + + print >>sys.stderr, "shuffling alignments ...", + random.shuffle(samSpliceSites) + print >>sys.stderr, "Done" + + #resampling + SR_num = len(samSpliceSites) + sample_size=0 + all_junctionNum = 0 + known_junc=[] + all_junc=[] + unknown_junc=[] + #=========================sampling uniquely mapped reads from population + tmp=range(sample_start,sample_end,sample_step) + tmp.append(100) + for pertl in tmp: #[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,100] + knownSpliceSites_num = 0 + index_st = int(SR_num * ((pertl - sample_step)/100.0)) + index_end = int(SR_num * (pertl/100.0)) + if index_st < 0: index_st = 0 + sample_size += index_end -index_st + + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(sample_size) + ") splicing reads.", + + #all splice juntion + for i in range(index_st, index_end): + uniqSpliceSites[samSpliceSites[i]] +=1 + all_junctionNum = len(uniqSpliceSites.keys()) + all_junc.append(str(all_junctionNum)) + print >>sys.stderr, str(all_junctionNum) + " splicing junctions.", + + #known splice junction + known_junctionNum = 0 + for sj in uniqSpliceSites: + if sj in knownSpliceSites and uniqSpliceSites[sj] >= recur: + known_junctionNum +=1 + print >>sys.stderr, str(known_junctionNum) + " known splicing junctions.", + known_junc.append(str(known_junctionNum)) + + #unknown splice junction + unknown_junctionNum = 0 + for sj in uniqSpliceSites: + if sj not in knownSpliceSites: + unknown_junctionNum +=1 + unknown_junc.append(str(unknown_junctionNum)) + print >>sys.stderr, str(unknown_junctionNum) + " novel splicing junctions." + + #for j in uniq_SJ: + #print >>OUT, j + "\t" + str(uniq_SJ[j]) + print >>OUT, "pdf(\'%s\')" % (outfile + '.junctionSaturation_plot.pdf') + print >>OUT, "x=c(" + ','.join([str(i) for i in tmp]) + ')' + print >>OUT, "y=c(" + ','.join(known_junc) + ')' + print >>OUT, "z=c(" + ','.join(all_junc) + ')' + print >>OUT, "w=c(" + ','.join(unknown_junc) + ')' + print >>OUT, "m=max(%d,%d,%d)" % (int(int(known_junc[-1])/1000), int(int(all_junc[-1])/1000),int(int(unknown_junc[-1])/1000)) + print >>OUT, "n=min(%d,%d,%d)" % (int(int(known_junc[0])/1000), int(int(all_junc[0])/1000),int(int(unknown_junc[0])/1000)) + print >>OUT, "plot(x,z/1000,xlab='percent of total reads',ylab='Number of splicing junctions (x1000)',type='o',col='blue',ylim=c(n,m))" + print >>OUT, "points(x,y/1000,type='o',col='red')" + print >>OUT, "points(x,w/1000,type='o',col='green')" + print >>OUT, 'legend(5,%d, legend=c("All junctions","known junctions", "novel junctions"),col=c("blue","red","green"),lwd=1,pch=1)' % int(int(all_junc[-1])/1000) + print >>OUT, "dev.off()" + + def saturation_RPKM(self,refbed,outfile,sample_start=5,sample_step=5,sample_end=100,skip_multi=True, strand_rule=None): + '''for each gene, check if its RPKM (epxresion level) has already been saturated or not''' + + if refbed is None: + print >>sys.stderr,"You must specify a bed file representing gene model\n" + exit(0) + rpkm_file = outfile + ".eRPKM.xls" + raw_file = outfile + ".rawCount.xls" + + RPKM_OUT = open(rpkm_file,'w') + RAW_OUT = open(raw_file ,'w') + + ranges={} + totalReads=0 + cUR_num = 0 #number of fragements + cUR_plus = 0 + cUR_minus = 0 + block_list_plus = [] #non-spliced read AS IS, splicing reads were counted multiple times + block_list_minus = [] + block_list = [] + strandRule = {} + + if strand_rule is None: # Not strand-specific + pass + elif len(strand_rule.split(',')) ==4: #PairEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]+i[1]]=i[2] + elif len(strand_rule.split(',')) ==2: #singeEnd, strand-specific + for i in strand_rule.split(','):strandRule[i[0]]=i[1] + else: + print >>sys.stderr, "Unknown value of: 'strand_rule' " + strand_rule + sys.exit(1) + + + #read SAM or BAM + if self.bam_format:print >>sys.stderr, "Load BAM file ... ", + else:print >>sys.stderr, "Load SAM file ... ", + try: + while(1): + flag=0 + aligned_read = self.samfile.next() + if aligned_read.is_qcfail:continue #skip low quanlity + if aligned_read.is_duplicate:continue #skip duplicate read + if aligned_read.is_secondary:continue #skip non primary hit + if aligned_read.is_unmapped:continue #skip unmap read + + if skip_multi: + if len(aligned_read.tags)>0: #( ("NM", 1),("RG", "L1") ) + for i in aligned_read.tags: + if i[0] in ParseBAM.multi_hit_tags and i[1] >1: + flag=1 #multiple hit read + break + if flag==1:continue #skip multiple map read + + chrom = self.samfile.getrname(aligned_read.tid).upper() + + #determine read_id and read_strand + if aligned_read.is_paired: #pair end + if aligned_read.is_read1:read_id = '1' + if aligned_read.is_read2:read_id = '2' + else:read_id = '' #single end + + if aligned_read.is_reverse:map_strand = '-' + else:map_strand = '+' + strand_key = read_id + map_strand #used to determine if a read should assign to gene(+) or gene(-) + + hit_st = aligned_read.pos + cigar_str = cigar.list2str(aligned_read.cigar) + exon_blocks = cigar.fetch_exon(chrom, hit_st, cigar_str) + cUR_num += len(exon_blocks) + + #strand specific + if strand_rule is not None: + if strandRule[strand_key] == '+': cUR_plus += len(exon_blocks) + if strandRule[strand_key] == '-': cUR_minus += len(exon_blocks) + for exn in exon_blocks: + if strandRule[strand_key] == '+': block_list_plus.append(exn[0] + ":" + str(exn[1] + (exn[2]-exn[1])/2 )) + if strandRule[strand_key] == '-': block_list_minus.append(exn[0] + ":" + str(exn[1] + (exn[2]-exn[1])/2 )) + #Not strand specific + else: + for exn in exon_blocks: + block_list.append(exn[0] + ":" + str(exn[1] + (exn[2]-exn[1])/2 )) + except StopIteration: + print >>sys.stderr, "Done" + + + print >>sys.stderr, "shuffling alignments ...", + random.shuffle(block_list_plus) + random.shuffle(block_list_minus) + random.shuffle(block_list) + print >>sys.stderr, "Done" + + + ranges_plus={} + ranges_minus={} + ranges={} + sample_size=0 + RPKM_table=collections.defaultdict(list) + rawCount_table=collections.defaultdict(list) + RPKM_head=['#chr','start','end','name','score','strand'] + + tmp=range(sample_start,sample_end,sample_step) + tmp.append(100) + #=========================sampling uniquely mapped reads from population + for pertl in tmp: #[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,100] + percent_st = (pertl-sample_step)/100.0 + percent_end = pertl/100.0 + if percent_st < 0: percent_st = 0 + sample_size = cUR_num * percent_end + RPKM_head.append(str(pertl) + '%') + + if strand_rule is not None: + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(int(cUR_plus * percent_end)) + ") forward strand fragments ..." + for i in block_list_plus[int(cUR_plus*percent_st):int(cUR_plus*percent_end)]: + (chr,coord) = i.split(':') + if chr not in ranges_plus:ranges_plus[chr] = Intersecter() + else:ranges_plus[chr].add_interval( Interval( int(coord), int(coord)+1 ) ) + + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(int(cUR_minus * percent_end)) + ") reverse strand fragments ..." + for i in block_list_minus[int(cUR_minus*percent_st):int(cUR_minus*percent_end)]: + (chr,coord) = i.split(':') + if chr not in ranges_minus:ranges_minus[chr] = Intersecter() + else:ranges_minus[chr].add_interval( Interval( int(coord), int(coord)+1 ) ) + + else: + print >>sys.stderr, "sampling " + str(pertl) +"% (" + str(int(sample_size)) + ") fragments ..." + for i in block_list[int(cUR_num*percent_st):int(cUR_num*percent_end)]: + (chr,coord) = i.split(':') + if chr not in ranges:ranges[chr] = Intersecter() + else:ranges[chr].add_interval( Interval( int(coord), int(coord)+1 ) ) + + #========================= calculating RPKM based on sub-population + print >>sys.stderr, "assign reads to transcripts in " + refbed + ' ...' + for line in open(refbed,'r'): + try: + if line.startswith(('#','track','browser')):continue + # Parse fields from gene tabls + fields = line.split() + chrom = fields[0].upper() + tx_start = int( fields[1] ) + tx_end = int( fields[2] ) + geneName = fields[3] + strand = fields[5] + exon_starts = map( int, fields[11].rstrip( ',\n' ).split( ',' ) ) + exon_starts = map((lambda x: x + tx_start ), exon_starts) + exon_ends = map( int, fields[10].rstrip( ',\n' ).split( ',' ) ) + exon_ends = map((lambda x, y: x + y ), exon_starts, exon_ends) + exon_sizes = map(int,fields[10].rstrip(',\n').split(',')) + key='\t'.join((chrom.lower(),str(tx_start),str(tx_end),geneName,'0',strand)) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line + continue + mRNA_count=0 #we need to initializ it to 0 for each gene + mRNA_len=sum(exon_sizes) + for st,end in zip(exon_starts,exon_ends): + #if chrom in ranges: + if strand_rule is not None: + if (strand == '+') and (chrom in ranges_plus): mRNA_count += len(ranges_plus[chrom].find(st,end)) + if (strand == '-') and (chrom in ranges_minus): mRNA_count += len(ranges_minus[chrom].find(st,end)) + else: + if chrom in ranges: + mRNA_count += len(ranges[chrom].find(st,end)) + if mRNA_len ==0: + print >>sys.stderr, geneName + " has 0 nucleotides. Exit!" + sys.exit(1) + if sample_size == 0: + print >>sys.stderr, "Too few reads to sample. Exit!" + sys.exit(1) + mRNA_RPKM = (mRNA_count * 1000000000.0)/(mRNA_len * sample_size) + RPKM_table[key].append(str(mRNA_RPKM)) + rawCount_table[key].append(str(mRNA_count)) + print >>sys.stderr, "" + + #self.f.seek(0) + print >>RPKM_OUT, '\t'.join(RPKM_head) + print >>RAW_OUT, '\t'.join(RPKM_head) + for key in RPKM_table: + print >>RPKM_OUT, key + '\t', + print >>RPKM_OUT, '\t'.join(RPKM_table[key]) + print >>RAW_OUT, key + '\t', + print >>RAW_OUT, '\t'.join(rawCount_table[key]) + + def fetchAlignments(self,chr,st,end): + '''fetch alignment from sorted BAM file based on chr, st, end + Note: BAM file must be indexed''' + try: + a=self.samfile.fetch(chr,st,end) + return a + except: + return None + + +def print_bits_as_bed( bits ): + end = 0 + while 1: + start = bits.next_set( end ) + if start == bits.size: break + end = bits.next_clear( start ) + print "%d\t%d" % ( start, end ) diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/__init__.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/__init__.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/__init__.pyc new file mode 100644 index 0000000..481ec79 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/__init__.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.py new file mode 100755 index 0000000..b55a9d8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.py @@ -0,0 +1,308 @@ +import collections +from bx.intervals import * +from cpmodule import BED + +'''Compare given bed entry to reference gene model''' + +def getCDSExonFromFile(bedfile): + + '''Only Extract CDS exon regions from input bed file (must be 12-column).''' + ret_lst=[] + for f in open(bedfile,'r'): + f = f.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + # grab cdsStart - cdsEnd + cds_exons = [] + cds_seq = '' + genome_seq_index = [] + + chrom = chrom + ':' + strand + for base,offset in zip( blockStarts, blockSizes ): + if (base + offset) < cdsStart: continue + if base > cdsEnd: continue + exon_start = max( base, cdsStart ) + exon_end = min( base+offset, cdsEnd ) + #cds_exons.append( (exon_start, exon_end) ) + ret_lst.append([chrom,exon_start,exon_end]) + return ret_lst + +def getUTRExonFromFile(bedfile,utr=35): + '''Only Extract UTR regions from input bed file (must be 12-column). output is 6-column bed format. + When utr=35 [default], extract both 5' and 3' UTR. When utr=3, only extract 3' UTR. When utr=5, + only extract 5' UTR''' + + ret_lst=[] + for line in open(bedfile,'r'): + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + chrom=fields[0] + strand=fields[5] + txStart=int(fields[1]) + txEnd=int(fields[2]) + cdsStart=int(fields[6]) + cdsEnd=int(fields[7]) + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + + chrom = chrom + ':' + strand + if (utr==35 or utr==5): + for st,end in zip(exon_start,exon_end): + if st < cdsStart: + utr_st = st + utr_end = min(end,cdsStart) + ret_lst.append([chrom,utr_st,utr_end]) + if (utr==35 or utr==3): + for st,end in zip(exon_start,exon_end): + if end > cdsEnd: + utr_st = max(st, cdsEnd) + utr_end = end + ret_lst.append([chrom,utr_st,utr_end]) + return ret_lst + + + +def getExonFromFile(bedfile): + '''Extract ALL exon regions from input bed file (must be 12-column). return list of [chrom:+ st end]''' + + ret_lst=[] + for line in open(bedfile,'r'): + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + chrom = chrom + ':' + strand + for st,end in zip(exon_start,exon_end): + ret_lst.append([chrom,st,end]) + return ret_lst + +def getExonFromFile2(bedfile): + '''Extract ALL exon regions from input bed file (must be 12-column). return dict''' + + ret_dict_full = collections.defaultdict(set) + #ret_dict_inner = collections.defaultdict(set) #trim off start_of_1st_exon and end_of_last_exon + for line in open(bedfile,'r'): + tmp=[] + try: + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + key = chrom + ":" + txstart + "-" + txEnd + ":" + strand + ':' + geneName + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + for st,end in zip(exon_start,exon_end): + tmp.append(exon_start,exon_end) + ret_dict_full[key] = set(tmp) + #ret_dict_inner[key] = set(tmp[1:-1]) + return ret_dict_full + + + +def getUTRExonFromLine(bedline,utr=35): + '''Extract UTR regions from input bed line. When utr=35 [default], extract both + 5' and 3' UTR. When utr=3, only extract 3' UTR. When utr=5,only extract 5' UTR''' + + ret_lst=[] + line = bedline + if line.startswith('#'):return None + if line.startswith('track'):return None + if line.startswith('browser'):return None + if not line.strip():return None + fields=line.rstrip('\r\n').split() + chrom=fields[0] + strand=fields[5] + txStart=int(fields[1]) + txEnd=int(fields[2]) + cdsStart=int(fields[6]) + cdsEnd=int(fields[7]) + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + + chrom = chromm + ':' + strand + if (utr==35 or utr==5): + for st,end in zip(exon_start,exon_end): + if st < cdsStart: + utr_st = st + utr_end = min(end,cdsStart) + ret_lst.append([chrom,utr_st,utr_end]) + if (utr==35 or utr==3): + for st,end in zip(exon_start,exon_end): + if end > cdsEnd: + utr_st = max(st, cdsEnd) + utr_end = end + ret_lst.append([chrom,utr_st,utr_end]) + return ret_lst + + +def getCDSExonFromLine(bedline): + + '''Extract CDS exon regions from input bed line (must be 12-column).''' + ret_lst=[] + line = bedline + if line.startswith('#'):return None + if line.startswith('track'):return None + if line.startswith('browser'):return None + if not line.strip():return None + f = line.strip().split() + chrom = f[0] + chrom_start = int(f[1]) + name = f[4] + strand = f[5] + cdsStart = int(f[6]) + cdsEnd = int(f[7]) + blockCount = int(f[9]) + blockSizes = [ int(i) for i in f[10].strip(',').split(',') ] + blockStarts = [ chrom_start + int(i) for i in f[11].strip(',').split(',') ] + # grab cdsStart - cdsEnd + cds_exons = [] + cds_seq = '' + genome_seq_index = [] + chrom = chromm + ':' + strand + for base,offset in zip( blockStarts, blockSizes ): + if (base + offset) < cdsStart: continue + if base > cdsEnd: continue + exon_start = max( base, cdsStart ) + exon_end = min( base+offset, cdsEnd ) + #cds_exons.append( (exon_start, exon_end) ) + ret_lst.append([chrom,exon_start,exon_end]) + return ret_lst + +def getExonFromLine(bedline): + '''Extract ALL exon regions from input bed line (must be 12-column). return list of [chrom:+ st end]''' + + ret_lst=collections.defaultdict(set) + line = bedline + #if line.startswith('#'):continue + #if line.startswith('track'):continue + #if line.startswith('browser'):continue + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + chrom = chrom + ':' + strand + for st,end in zip(exon_start,exon_end): + ret_lst[chrom].add(st) + ret_lst[chrom].add(end) + return ret_lst + + +def annotateBed(inputbed,refbed,outfile): + '''compare inputbed to refbed''' + ref_exon_ranges = {} + ref_exon_starts = collections.defaultdict(set) #key='chrom:+', value=set() + ref_exon_ends = collections.defaultdict(set) + OF = open(outfile,'w') + + #read reference bed file + #Extract CDS exons from reference bed + tmp = getCDSExonFromFile(refbed) + for i in tmp: #chr:+, st, end (0-base) + ref_exon_starts[i[0]].add(int(i[1])) + ref_exon_ends[i[0]].add(int(i[2])) + if i[0] not in ref_exon_ranges: + ref_exon_ranges[i[0]] = Intersecter() + ref_exon_ranges[i[0]].add_interval( Interval( int(i[1]), int(i[2]) )) + + #Extract UTR exons from reference bed + tmp = getUTRExonFromFile(refbed) + for i in tmp: #chr:+, st, end (0-base) + ref_exon_starts[i[0]].add(int(i[1])) + ref_exon_ends[i[0]].add(int(i[2])) + if i[0] not in ref_exon_ranges: + ref_exon_ranges[i[0]] = Intersecter() + ref_exon_ranges[i[0]].add_interval( Interval( int(i[1]), int(i[2]) )) + + #prepare data structure + ref_exon_chain = getExonFromFile2(refbed) + + #read input bed + for line in open(inputbed,'r'): + if line.startswith('#'):continue + if line.startswith('track'):continue + if line.startswith('browser'):continue + if not line.strip(): continue + line = line.strip() + fields=line.split() + + chrom = fields[0] + strand = fields[5] + tx_start = int(fields[1]) + tx_end = int(fields[2]) + key = chrom + ":" +strand + if key in ref_exon_ranges: + if len(ref_exon_ranges[key].find(tx_start,tx_end))==0: #input gene does NOT overlap with any known exons + print line + '\t' + 'novel(intergenic)' + else: + input_exon_chain=getExonFromLine(line) + #print line + '\t' + 'overlap' + #utr_3_exons = getUTRExon(line,utr=3) + #utr_5_exons = getUTRExon(line,utr=5) + #cds_exons = getCDSExon(line) + else: + print line + '\t' + 'unknownChrom' + + + #for utr3 in utr_3_exons: + # (chrom, st, end) = (utr3[0], int(utr3[1]),int(utr3[2])) + # if chrom in ref_exon_ranges: + # if len(ref_exon_ranges[chrom].find(st,end))>0 : #input exon overlap with known exon + # else: + + + + + + + + + + + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.pyc new file mode 100644 index 0000000..92dd234 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/annoGene.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/changePoint.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/changePoint.py new file mode 100755 index 0000000..204ade6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/changePoint.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +'''manipulate fasta for fastq format files.''' + +#import built-in modules +import re +import sys +from string import maketrans +from random import shuffle +from heapq import nlargest +#import third-party modules + +#changes to the paths + +#changing history to this module + + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.0.1" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + +def S_diff(lst): + '''Given a list of int or float, calculate S_diff and S_point''' + + S_avg = sum(lst) / len(lst) + S_dist = [i-S_avg for i in lst] #distance to average + S_cum=[] #list of cumulative sum + S_cum.append(0) + for i in range(0,len(S_dist)): + S_cum.append(S_cum[i] + S_dist[i]) + return [nlargest(1,range(0,len(S_cum)),key=lambda i: S_cum[i]),(max(S_cum) - min(S_cum))] + #return the index of maximum_diff index, and maximum_diff + +def bootstrap(lst,obs,rep=1000): + '''Given a list of int or float (lst) and an observation value(obs). calcualte the chance (pvalue) + of getting this observation through bootstrapping.''' + + shuffled_diff=[] + count=0 + tmp=lst + for i in range(0,rep): + shuffle(tmp) + shuffled_diff.append(S_diff(tmp)) + + for i in sorted(shuffled_diff): + if (i>=obs): + count += 1 + if count/rep <0.5: + return count/rep + else: + return 1- count/rep diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/cigar.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/cigar.py new file mode 100755 index 0000000..89032cd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/cigar.py @@ -0,0 +1,157 @@ +'''manipulate CIGAR string''' + +#import built-in modules +import os,sys +import re +import string +import warnings +import string +import collections +import math +import sets +import random + +head_clip = re.compile(r'^(\d+)S') +tail_clip = re.compile(r'(\d+)S$') +insertion = re.compile(r'(\d+)I') +deletion = re.compile(r'(\d+)D') +matching = re.compile(r'(\d+)M') +skipping = re.compile(r'(\d+)N') +read_part = re.compile(r'(\d+)[MIS=X]') +ref_part = re.compile(r'(\d+)[MISND=X]') + +prior_insertion = re.compile(r'(.+?)(\d+)I') +prior_deletion = re.compile(r'(.+?)(\d+)D') +prior_intron = re.compile(r'(.+?)(\d+)N') +prior_exon = re.compile(r'(.*?)(\d+)M') + +def fetch_head_clip(chr, st, cigar): + '''return genome coordinate of the head clip part encoded in cigar string + NOTE: returned coordinates are 0-based.NOTE: st is 0-based''' + + block=[] + chrom_end = int(st) + tmp = head_clip.findall(cigar) + if len(tmp)==0: + return block + else: + chrom_st = chrom_end - int(tmp[0]) + block.append([chr,chrom_st,chrom_end]) + return block + +def fetch_tail_clip(chr, st, cigar): + '''return genome coordinates of the tail clip part encoded in cigar string + NOTE: returned coordinates are 0-based . NOTE: st is 0-based''' + + block=[] + h = head_clip.findall(cigar) + t = tail_clip.findall(cigar) + if len(t)==0:return block + else:t_len = int(t[0]) + + if len(h)==0:h_len=0 + else:h_len=int(h[0]) + ref_length = sum([int(i) for i in ref_part.findall(cigar)]) + #print read_length + chrom_end = int(st) + (ref_length - h_len) #because SAM is 1-based + chrom_st = chrom_end - t_len + block.append([chr,chrom_st,chrom_end]) + return block + +def fetch_insertion(chr, st, cigar): + '''return genome coordinates of the insertion (to reference) encoded in cigar string + NOTE: returned coordinates are 0-based. Insertion to the reference. NOTE: st is 0-based''' + + block=[] + h = head_clip.findall(cigar) + if len(h)==0:h_len=0 + else:h_len=int(h[0]) + + ref_length=0 + m = prior_insertion.findall(cigar) + if len(m)==0: + return block + else: + for j in m: + ref_length += sum([int(i) for i in ref_part.findall(j[0])]) + chrom_st = int(st) + (ref_length - h_len) + chrom_end = chrom_st + int(j[1]) + block.append([chr,chrom_st,chrom_end]) + return block + +def fetch_deletion(chr, st, cigar): + '''return genome coordinates of the insertion (to reference) encoded in cigar string + NOTE: returned coordinates are 0-based. Deletion to the reference. NOTE: st is 0-based''' + + block=[] + h = head_clip.findall(cigar) + if len(h)==0:h_len=0 + else:h_len=int(h[0]) + + ref_length=0 + m = prior_deletion.findall(cigar) + if len(m)==0: + return block + else: + for j in m: + ref_length += sum([int(i) for i in ref_part.findall(j[0])]) + chrom_st = int(st) + (ref_length - h_len) + chrom_end = chrom_st + int(j[1]) + block.append([chr,chrom_st,chrom_end]) + ref_length += int(j[1]) + return block + + +def fetch_intron(chr, st, cigar): + '''return genome coordinates of the introns encoded in cigar string + NOTE: returned coordinates are 0-based. Deletion to the reference NOTE: + st is 0-based ''' + + block=[] + h = head_clip.findall(cigar) + if len(h)==0:h_len=0 + else:h_len=int(h[0]) + + ref_length=0 + m = prior_intron.findall(cigar) + if len(m)==0: + return block + else: + for j in m: + ref_length += sum([int(i) for i in ref_part.findall(j[0])]) + chrom_st = int(st) + (ref_length - h_len) + chrom_end = chrom_st + int(j[1]) + block.append([chr,chrom_st,chrom_end]) + ref_length += int(j[1]) + return block + +def fetch_exon(chr, st, cigar): + '''return genome coordinates of the exon encoded in cigar string + NOTE: returned coordinates are 0-based. NOTE: st is 0-based''' + + block=[] + h = head_clip.findall(cigar) + if len(h)==0:h_len=0 + else:h_len=int(h[0]) + + ref_length=0 + m = prior_exon.findall(cigar) + if len(m)==0: + return block + else: + for j in m: + ref_length += sum([int(i) for i in ref_part.findall(j[0])]) + chrom_st = int(st) + (ref_length - h_len) + chrom_end = chrom_st + int(j[1]) + block.append([chr,chrom_st,chrom_end]) + ref_length += int(j[1]) + return block + +def list2str (lst): + '''translate samtools returned cigar_list into cigar_string''' + code2Char={'0':'M','1':'I','2':'D','3':'N','4':'S','5':'H','6':'P','7':'=','8':'X'} + + cigar_str='' + for i in lst: + cigar_str += str(i[1]) + code2Char[str(i[0])] + return cigar_str diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/dotProduct.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/dotProduct.py new file mode 100755 index 0000000..27822d7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/dotProduct.py @@ -0,0 +1,49 @@ +import timeit # module with timing subroutines +import random # module to generate random numnbers +from itertools import imap,starmap,izip +from operator import mul + +def v(N=50,min=-10,max=10): + """Generates a random vector (in an array) of dimension N; the + values are integers in the range [min,max].""" + out = [] + for k in range(N): + out.append(random.randint(min,max)) + return out + +def check(v1,v2): + if len(v1)!=len(v2): + raise ValueError,"the lenght of both arrays must be the same" + pass + +def d0(v1,v2): + """ + d0 is Nominal approach: + multiply/add in a loop + """ + check(v1,v2) + out = 0 + for k in range(len(v1)): + out += v1[k] * v2[k] + return out + +def d1(v1,v2): + """ + d1 uses an imap (from itertools) + """ + check(v1,v2) + return sum(imap(mul,v1,v2)) + +def d2(v1,v2): + """ + d2 uses a conventional map + """ + check(v1,v2) + return sum(map(mul,v1,v2)) + +def d3(v1,v2): + """ + d3 uses a starmap (itertools) to apply the mul operator on an izipped (v1,v2) + """ + check(v1,v2) + return starmap(mul,izip(v1,v2)) diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.py new file mode 100755 index 0000000..b7161fc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python +'''manipulate fasta for fastq format files.''' + +#import built-in modules +import re +import sys +from string import maketrans +from optparse import OptionParser +import collections +#import third-party modules + +#changes to the paths + +#changing history to this module + + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.0.1" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + + +class Fasta: + '''manipulate fasta or fastq format file + ''' + + def __init__(self,fastafile=None): + '''initialize object, lowercase in sequence is automatically converted into uppercase''' + self.seqs={} + self.IDs=[] + self.transtab = maketrans("ACGTNX","TGCANX") + self.filename = fastafile + tmpseq='' + if fastafile is not None: + for line in open(fastafile,'r'): + line=line.strip(' \n') + if line.startswith('>'): + if(tmpseq): + self.seqs[name]=tmpseq + name='_'.join(line[1:].split(' ')) + tmpseq ='' + self.IDs.append(name) + #print >>sys.stderr,"\tloading "+name+' ...' + else: + tmpseq += line.upper() + self.seqs[name]=tmpseq + + def addSeq(self,id,seq): + '''add sequence to current data''' + if self.seqs.has_key(id): + print >>sys.stderr,id +" already exists!" + return + else: + self.seqs[id]=seq.upper() + self.IDs.append(id) + + def getNames (self,file=None): + '''return all sequence IDs''' + return self.IDs + + def getSeq(self,seqID=None): + '''return sequence for sepcified seqID, otherwise all sequences are returned''' + if seqID is None: + return self.seqs.values() + else: + return self.seqs[seqID] + def getSeqLen(self,seqID=None): + seqlen=collections.defaultdict(dict) + if seqID is None: + for (k,v) in self.seqs.items(): + seqlen[k]=len(v) + else: + try: + seqlen[seqID]=len(self.seqs[seqID]) + except: + print >>sys.stderr,"Not found" + return seqlen + + def countBase(self,pattern=None): + '''count occurence of substring (defined by pattern), otherwise count A,C,G,T,N,X + NOTE: pattern is counted non-overlappingly''' + if pattern is None: + print "ID\tTotal\tA\tC\tG\tT\tN\tX" + for (k,v) in self.seqs.items(): + print k+"\t", + print len(v),"\t", + print str(v.count('A'))+"\t", + print str(v.count('C'))+"\t", + print str(v.count('G'))+"\t", + print str(v.count('T'))+"\t", + print str(v.count('N'))+"\t", + print v.count('X') + else: + for (k,v) in self.seqs.items(): + print k+"\t", + print str(len(v))+"\t", + print v.count(pattern) + + def countBaseSlidingWindow(self,pattern,stepSize=50): + '''count occurence of substring (defined by pattern), otherwise count A,C,G,T,N,X + NOTE: pattern is counted non-overlappingly''' + + for (k,v) in self.seqs.items(): + total_length = len(v) + for start in xrange(0,total_length,stepSize): + end = start + stepSize + if end < total_length: + frq = 1.0 * v[start:end].count(pattern)/stepSize + print '\t'.join([str(i) for i in (k, start, end, frq)]) + else: + frq = 1.0 * v[start:total_length].count(pattern)/len(v[start:total_length]) + print '\t'.join([str(i) for i in (k, start, total_length, frq)]) + + + + def revComp(self,seqID=None): + '''return reverse-complemented sequence for sepcified seqID, otherwise all sequences are + reverse-complemented''' + if seqID is None: + for (k,v) in self.seqs.items(): + print ">" + k + "_rev" + tmp = v.translate(self.transtab) + return tmp[::-1] + else: + return self.seqs[seqID].translate(self.transtab)[::-1] + + + def getUniqSeqs(self): + '''remove redundancy from original fasta files. + duplicated sequences will be only report once''' + + seq2Name={} + seq2Count={} + for (key,value) in self.seqs.items(): + seq2Name[value]=key + if seq2Count.has_key(value): + seq2Count[value]+=1 + else: + seq2Count[value]=1 + for value in seq2Name.keys(): + print '>'+ str(seq2Name[value]) + '_' + str(seq2Count[value]) + print value + + + def findPattern(self,pat,outfile,seqID=None,rev=True): + ''' find pattern in all sequence unless seqID is specified, coordinates will be returned as bed format file''' + + fout=open(outfile,'w') + length=len(pat) + + Pat=pat.upper() + start=0 + + + if seqID is None: + for (k,v) in self.seqs.items(): + loopSwitch=0 + start=0 + while loopSwitch !=-1: + loopSwitch = v.find(Pat,start) + if loopSwitch !=-1: + print >>fout,k + "\t" + str(loopSwitch) + "\t" + str(loopSwitch + length) + "\t" + Pat + "\t0\t+" + start = loopSwitch +1 + + else: + loopSwitch=0 + start=0 + while loopSwitch !=-1: + loopSwitch = self.seqs[seqID].find(Pat,start) + print >>fout, seqID + "\t" + str(loopSwitch) + "\t" + str(loopSwitch + length) + "\t" + Pat + "\t0\t+" + start = loopSwitch +1 + + if rev==True: + Pat_rev=Pat.translate(self.transtab)[::-1] + if seqID is None: + for (k,v) in self.seqs.items(): + loopSwitch=0 + start=0 + while loopSwitch !=-1: + loopSwitch = v.find(Pat_rev,start) + if loopSwitch !=-1: + print >>fout,k + "\t" + str(loopSwitch) + "\t" + str(loopSwitch + length) + "\t" + Pat + "\t0\t-" + start = loopSwitch +1 + + else: + loopSwitch=0 + start=0 + while loopSwitch !=-1: + loopSwitch = self.seqs[seqID].find(Pat_rev,start) + print >>fout, seqID + "\t" + str(loopSwitch) + "\t" + str(loopSwitch + length) + "\t" + Pat + "\t0\t-" + start = loopSwitch +1 + + def fetchSeq(self,chr=None,st=None,end=None,infile=None,outfile=None): + ''' Fetching sequence based on chrName (should be exactly the same as fasta file), St, End. + NOTE: the coordinate is 0-based,half-open. use infile to specify multiple coordinates. infile + should be bed3, bed6 or bed12''' + + if (infile is not None) and (outfile is not None): + fout=open(outfile,'w') + for line in open(infile): + fields=line.strip().split() + if (len(fields)==3): + print >>fout,fields[0]+":"+fields[1]+"-"+fields[2]+"\t"+"strand=+" + print >>fout,self.seqs[fields[0]][int(fields[1]):int(fields[2])].upper() + elif (len(fields)>3): + if fields[5]=='-': + print >>fout,fields[0]+":"+fields[1]+"-"+fields[2]+"\t"+"strand=-" + print >>fout,self.seqs[fields[0]][int(fields[1]):int(fields[2])].translate(self.transtab)[::-1].upper() + else: + print >>fout,fields[0]+":"+fields[1]+"-"+fields[2]+"\t"+"strand=+" + print >>fout,self.seqs[fields[0]][int(fields[1]):int(fields[2])].upper() + else: + try: + return self.seqs[chr][st:end].upper() + except: + print >>sys.stderr, "cannot fetch sequence from " + self.filename + " for " + chr + ":" + str(st) + "-" + str(end) + return '' + #print >>sys.stderr, chr + "\t" + str(st) +'\t' + str(end) + " Please input chr,st,end" +def reverse_comp1(seq): + '''reverse complement DNA sequences''' + swap = {"A":"T", "T":"A", "C":"G", "G":"C","N":"N","X":"X"} + tmp = "".join(swap[b] for b in seq.upper()) + return tmp[::-1] + +def reverse_comp2(seq): + '''reverse complement DNA sequences''' + from string import maketrans + transtab = maketrans("ACGTNX","TGCANX") + return seq.upper().translate(transtab)[::-1] + +def main(): + obj=Fasta(sys.argv[1]) #Fasta file + obj.countBaseSlidingWindow(pattern = sys.argv[2]) #nucleotide pattern want to count + +if __name__ == "__main__": + main() + diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.pyc new file mode 100644 index 0000000..54636e9 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/fasta.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/fastq.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/fastq.py new file mode 100755 index 0000000..d31d745 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/fastq.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +'''manipulate fastq files''' + +#import built-in modules +import os,sys +import re +import string +from optparse import OptionParser +import warnings +import string +import collections +import math + +#import third-party modules +from bx.bitset import * +from bx.bitset_builders import * +from bx.intervals import * + +#changes to the paths + +#changing history to this module + + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.0.1" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + + +class FQ: + '''provides method to processing fastaq files''' + + def __init__(self,fqFile): + '''This is constructor of FQ''' + self.f=open(fqFile,'r') + self.fileName=os.path.basename(fqFile) + self.ABS_fileName=fqFile diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.py new file mode 100755 index 0000000..12cd867 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +'''calculate coding potential''' + +# Fickett TESTCODE data +# NAR 10(17) 5303-531 +position_prob ={ +'A':[0.94,0.68,0.84,0.93,0.58,0.68,0.45,0.34,0.20,0.22], +'C':[0.80,0.70,0.70,0.81,0.66,0.48,0.51,0.33,0.30,0.23], +'G':[0.90,0.88,0.74,0.64,0.53,0.48,0.27,0.16,0.08,0.08], +'T':[0.97,0.97,0.91,0.68,0.69,0.44,0.54,0.20,0.09,0.09] +} +position_weight={'A':0.26,'C':0.18,'G':0.31,'T':0.33} +position_para =[1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.2,1.1,0.0] + +content_prob={ +'A':[0.28,0.49,0.44,0.55,0.62,0.49,0.67,0.65,0.81,0.21], +'C':[0.82,0.64,0.51,0.64,0.59,0.59,0.43,0.44,0.39,0.31], +'G':[0.40,0.54,0.47,0.64,0.64,0.73,0.41,0.41,0.33,0.29], +'T':[0.28,0.24,0.39,0.40,0.55,0.75,0.56,0.69,0.51,0.58] +} +content_weight={'A':0.11,'C':0.12,'G':0.15,'T':0.14} +content_para =[0.33,0.31,0.29,0.27,0.25,0.23,0.21,0.17,0] + +def look_up_position_prob(value, base): + '''look up positional probability by base and value''' + if float(value)<0: + return None + for idx,val in enumerate (position_para): + if (float(value) >= val): + return float(position_prob[base][idx]) * float(position_weight[base]) + +def look_up_content_prob(value, base): + '''look up content probability by base and value''' + if float(value)<0: + return None + for idx,val in enumerate (content_para): + if (float(value) >= val): + return float(content_prob[base][idx]) * float(content_weight[base]) + +def fickett_value(dna): + '''calculate Fickett value. Input is DNA sequence''' + if len(dna)<2: + return 0 + fickett_score=0 + dna=dna.upper() + total_base = len(dna) + A_content = float(dna.count('A'))/total_base + C_content = float(dna.count('C'))/total_base + G_content = float(dna.count('G'))/total_base + T_content = float(dna.count('T'))/total_base + #print "A content\t" + str(A_content) + #print "C content\t" + str(C_content) + #print "G content\t" + str(G_content) + #print "T content\t" + str(T_content) + + phase_0 = [dna[i] for i in range(0,len(dna)) if i % 3==0] + phase_1 = [dna[i] for i in range(0,len(dna)) if i % 3==1] + phase_2 = [dna[i] for i in range(0,len(dna)) if i % 3==2] + + A_position=max(phase_0.count('A'),phase_1.count('A'),phase_2.count('A'))/(min(phase_0.count('A'),phase_1.count('A'),phase_2.count('A')) +1.0) + C_position=max(phase_0.count('C'),phase_1.count('C'),phase_2.count('C'))/(min(phase_0.count('C'),phase_1.count('C'),phase_2.count('C')) +1.0) + G_position=max(phase_0.count('G'),phase_1.count('G'),phase_2.count('G'))/(min(phase_0.count('G'),phase_1.count('G'),phase_2.count('G')) +1.0) + T_position=max(phase_0.count('T'),phase_1.count('T'),phase_2.count('T'))/(min(phase_0.count('T'),phase_1.count('T'),phase_2.count('T')) +1.0) + #print "A position\t" + str(A_position) + #print "C position\t" + str(C_position) + #print "G position\t" + str(G_position) + #print "T position\t" + str(T_position) + + + #for i (A_content,C_content,G_content,T_content): + fickett_score += look_up_content_prob(A_content,'A') + fickett_score += look_up_content_prob(C_content,'C') + fickett_score += look_up_content_prob(G_content,'G') + fickett_score += look_up_content_prob(T_content,'T') + + fickett_score += look_up_position_prob(A_position,'A') + fickett_score += look_up_position_prob(C_position,'C') + fickett_score += look_up_position_prob(G_position,'G') + fickett_score += look_up_position_prob(T_position,'T') + + return fickett_score + + + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.pyc new file mode 100644 index 0000000..960dd10 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/fickett.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.py new file mode 100755 index 0000000..e9423b7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.py @@ -0,0 +1,28 @@ +""" +read compressed (.gz .bz) files +""" +#!/usr/bin/env python +# encoding: utf-8 + +import bz2 +import gzip +import urllib + +def nopen(f, mode="rb"): + if not isinstance(f, basestring): + return f + if f.startswith("|"): + p = Popen(f[1:], stdout=PIPE, stdin=PIPE, shell=True) + if mode[0] == "r": return p.stdout + return p + return {"r": sys.stdin, "w": sys.stdout}[mode[0]] if f == "-" \ + else gzip.open(f, mode) if f.endswith((".gz", ".Z", ".z")) \ + else bz2.BZ2File(f, mode) if f.endswith((".bz", ".bz2", ".bzip2")) \ + else urllib.urlopen(f) if f.startswith(("http://", "https://","ftp://")) \ + else open(f, mode) + + +def reader(fname): + for l in nopen(fname): + yield l.strip() + \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.pyc new file mode 100644 index 0000000..c230be9 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/ireader.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/mystat.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/mystat.py new file mode 100755 index 0000000..29b4c88 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/mystat.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python + +#import built-in modules +import os,sys +import re +import string +from optparse import OptionParser +import warnings +import string +import collections +import math + +#import third-party modules + +#changes to the paths + +#changing history to this module +#05/26/2011: suppport multiple spliced mapped reads + +__author__ = "Liguo Wang" +__copyright__ = "Copyright 2010, Wei Li's Lab" +__credits__ = [] +__license__ = "GPL" +__version__ = "1.1.0" +__maintainer__ = "Liguo Wang" +__email__ = "liguow@bcm.edu" +__status__ = "Development" #Prototype or Production + + +def RSS(arg): + '''calculate Square root of sum of square. Input is ',' separated numbers''' + lst=arg.split(',') + lst_sum=0 + for i in [ int(i)**2 for i in lst]: + lst_sum += i + #nsr=10*math.log10((1+noi_sum**0.5)/(1+sig_sum**0.5)) + return lst_sum**0.5 + +def H_mean(arg): + '''calculate harmornic mean. Input is ',' separated numbers''' + lst=[1/float(i) for i in arg.split(',') if float(i) !=0] + if len(lst) == 0: + return "NA" + else: + return len(lst)/(sum(lst)) + +def shannon_entropy(arg): + '''calculate shannon's entropy (or Shannon-Wiener index). Input is ',' separated numbers''' + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + if sum(lst)<=0 or min(lst)<0:return "NA" + entropy=0.0 + for i in lst: + entropy += (i/sum(lst)) * math.log((i/sum(lst))) + return -entropy + + +def shannon_entropy_es(arg): + '''calculate estimator of shannon's entropy (Chao & Shen, 2003)''' + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + if sum(lst)<=0 or min(lst)<0:return "NA" #if there is no fragmental splicing + if (len(lst)==1): return 0 #if there is only 1 fragmental splicing + lst.append(2) + + #estimate C_bar + singleton=0 + entropy=0.0 + for i in lst: + if i ==1:singleton +=1 + + C_bar = 1- (singleton/sum(lst)) + for i in lst:entropy += ( (C_bar*i/sum(lst)) * math.log((C_bar*i/sum(lst))) )/(1-(1-C_bar*i/sum(lst))**sum(lst)) + return -entropy + +def shannon_entropy_ht(arg): + '''calculate estimator of shannon's entropy based on Horzitz-Thompson''' + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + if sum(lst)<=0 or min(lst)<0:return "NA" #if there is no fragmental splicing + if (len(lst)==1): return 0 #if there is only 1 fragmental splicing + + #estimate C_bar + entropy=0.0 + for i in lst: + entropy += ( (i/sum(lst)) * math.log((i/sum(lst))) )/(1-(1-i/sum(lst))**sum(lst)) + return -entropy + +def simpson_index(arg): + '''calculate Gini-Simpson's index. Input is ',' separated numbers''' + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + simpson=0.0 + + try: + for i in lst: + simpson = simpson + (i/sum(lst))**2 + return 1-simpson + except: return 0 + +def simpson_index_es(arg): + '''calculate estimator Gini-Simpson's index. Input is ',' separated numbers''' + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + simpson=0.0 + + try: + for i in lst: + simpson = simpson + i*(i-1) + return 1- (simpson/(sum(lst)*(sum(lst)-1))) + except: return 0 + +def Hill_number(arg,qvalue=1): + '''Calculate real diversity (Hill's number). Input is ',' separated numbers. qvalue is the only + parameter for Hill's function. When q=1, it return exp(H) which is the effective number of junctions + calculated by Shannon's entropy. When q<1, Hill's function was favors low frequency junctions. + When q>1, Hill's function was favors high frequency junctions (common junctions). Simpon's Index + is particular case of Hill's function as q=2''' + + lst=arg.split(',') + lst=[float(i) for i in lst if float(i)>0] + freq=[(i/sum(lst))**qvalue for i in lst] + try: + return (sum(freq))**(1/(1-qvalue)) + except: + return math.exp(shannon_entropy(arg)) +import math +import functools + +def percentile(N, percent, key=lambda x:x): + """ + Find the percentile of a list of values. + + @parameter N - is a list of values. Note N MUST BE already sorted. + @parameter percent - a float value from 0 to 100. + @parameter key - optional key function to compute value from each element of N. + + @return - the percentile of the values + """ + if not N: + return None + k = (len(N)-1) * percent/100.0 + f = math.floor(k) + c = math.ceil(k) + if f == c: + return key(N[int(k)]) + d0 = key(N[int(f)]) * (c-k) + d1 = key(N[int(c)]) * (k-f) + return d0+d1 + +def percentile_list(N): + """ + Find the percentile of a list of values. + @parameter N - is a list of values. Note N MUST BE already sorted. + @return - the list of percentile of the values + """ + if not N:return None + per_list=[] + for i in range(0,101): + k = (len(N)-1) * i/100.0 + f = math.floor(k) + c = math.ceil(k) + if f == c: + per_list.append( int(N[int(k)]) ) + else: + d0 = N[int(f)] * (c-k) + d1 = N[int(c)] * (k-f) + per_list.append(int(round(d0+d1))) + return per_list \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.py new file mode 100755 index 0000000..ddd9963 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.py @@ -0,0 +1,88 @@ +import sys +class ORFFinder: + """Find the longest ORF in a given sequence + + "seq" is a string, if "start" is not provided any codon can be the start of + and ORF. If muliple ORFs have the longest length the first one encountered + is printed + """ + def __init__(self, seq): + self.seq = seq.upper() + self.result = ("+",0,0,0,0) + self.winner = 0 + + def _reverse_comp(self): + swap = {"A":"T", "T":"A", "C":"G", "G":"C","N":"N","X":"X"} + return "".join(swap[b] for b in self.seq)[::-1] + + def codons(self, frame): + """ A generator that yields DNA in one codon blocks + + "frame" counts for 0. This function yelids a tuple (triplet, index) with + index relative to the original DNA sequence + """ + start = frame + while start + 3 <= len(self.seq): + yield (self.seq[start:start+3], start) + start += 3 + + def run_one(self, frame_number, direction,start_coden, stop_coden): + """ Search in one reading frame """ + codon_gen = self.codons(frame_number) + start_codens = start_coden + stop_codens = stop_coden + while True: + try: + c , index = codon_gen.next() + except StopIteration: + break + # Lots of conditions here: checks if we care about looking for start + # codon then that codon is not a stop + if c in start_codens or not start_codens and c not in stop_codens: + orf_start = index # we'll return the result as 0-indexed + end = False + while True: + try: + c, index = codon_gen.next() + except StopIteration: + end = True + if c in stop_codens: + end = True + if end: + orf_end = index + 3 # because index is realitve to start of codon + L = (orf_end - orf_start) + if L > self.winner: + self.winner = L + self.result = (direction, frame_number+1, orf_start, orf_end, L) + if L == self.winner and orf_start < self.result[2]: #if ORFs have same length, return the one that if upstream + #self.winner = L + self.result = (direction, frame_number+1, orf_start, orf_end, L) + + break + + def longest_orf(self,direction,start_coden=['ATG'], stop_coden=['TAG','TAA','TGA']): + if direction == "+": + for frame in range(3): + self.run_one(frame, direction,start_coden, stop_coden) + return (self.result[4], self.result[1],self.seq[self.result[2]:self.result[3]]) #CDS length, coding frame, CDS sequence + + + if direction == "-": + self.seq = self._reverse_comp() + for frame in range(3): + self.run_one(frame, direction,start_coden, stop_coden) + return (self.result[4], self.result[1],self.seq[self.result[2]:self.result[3]]) #CDS length, coding frame, CDS sequence + +#=================== +def little_test(): + seq='' + for line in open(sys.argv[1],'r'): + line=line.rstrip('\n\r') + if line.startswith('>'): + continue + seq += line + (l,f,s) = ORFFinder(seq).longest_orf(sys.argv[2]) + print str(l) + '\t' + str(f) + '\t' + s + +if __name__ == "__main__": + little_test() \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.pyc b/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.pyc new file mode 100644 index 0000000..be3ab5c Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/cpmodule/orf.pyc differ diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/poisson.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/poisson.py new file mode 100755 index 0000000..45d28f3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/poisson.py @@ -0,0 +1,24 @@ +import math +def point_poip(actual, mean): + '''give poisson pvalue. P[obs ==mean]''' + # naive: math.exp(-mean) * mean**actual / factorial(actual) + # iterative, to keep the components from getting too large or small: + p = math.exp(-mean) + for i in xrange(actual): + p *= mean + p /= i+1 + return p + +def cumu_poip(num, mean,logp=False): + '''give poisson pvalue P[obs >=mean]''' + s=0.0 + for i in range(0,num+1): + s += point_poip(i,mean) + if logp is True: + try: + return -10*math.log10(1-s) + except: + return 3000 + else: + return 1-s + diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/quantile.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/quantile.py new file mode 100755 index 0000000..e9f463a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/quantile.py @@ -0,0 +1,59 @@ +""" +File quantile.py +Desc computes sample quantiles +Author Ernesto P. Adorio, PhD. + UPDEPP (U.P. at Clarkfield) +Version 0.0.1 August 7. 2009 +""" +from math import modf, floor +def quantile(x, q, qtype = 7, issorted = False): + """ + Args: + x - input data + q - quantile + qtype - algorithm + issorted- True if x already sorted. + Compute quantiles from input array x given q.For median, + specify q=0.5. + References: + http://reference.wolfram.com/mathematica/ref/Quantile.html + http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:quantile + Author: + Ernesto P.Adorio Ph.D. + UP Extension Program in Pampanga, Clark Field. + """ + if not issorted: + y = sorted(x) + else: + y = x + if not (1 <= qtype <= 9): + return None # error! + # Parameters for the Hyndman and Fan algorithm + abcd = [(0, 0, 1, 0), # inverse empirical distrib.function., R type 1 + (0.5, 0, 1, 0), # similar to type 1, averaged, R type 2 + (0.5, 0, 0, 0), # nearest order statistic,(SAS) R type 3 + (0, 0, 0, 1), # California linear interpolation, R type 4 + (0.5, 0, 0, 1), # hydrologists method, R type 5 + (0, 1, 0, 1), # mean-based estimate(Weibull method), (SPSS,Minitab), type 6 + (1, -1, 0, 1), # mode-based method,(S, S-Plus), R type 7 + (1.0/3, 1.0/3, 0, 1), # median-unbiased , R type 8 + (3/8.0, 0.25, 0, 1) # normal-unbiased, R type 9. + ] + a, b, c, d = abcd[qtype-1] + n = len(x) + g, j = modf( a + (n+b) * q -1) + if j < 0: + return y[0] + elif j >= n: + return y[n-1] # oct. 8, 2010 y[n]???!! uncaught off by 1 error!!! + j = int(floor(j)) + if g == 0: + return y[j] + else: + return y[j] + (y[j+1]- y[j])* (c + d * g) +def Test(): + x = [11.4, 17.3, 21.3, 25.9, 40.1, 50.5, 60.0, 70.0, 75] + for qtype in range(1,10): + print qtype, quantile(x, 0.35, qtype) +if __name__ == "__main__": + Test() diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/twoList.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/twoList.py new file mode 100755 index 0000000..c2af24a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/twoList.py @@ -0,0 +1,53 @@ +'''manipulate ndarray list''' +from itertools import imap,starmap,izip +from operator import mul,add,sub + +def check_list(v1,v2): + '''check if the length of two list is same''' + if v1.size != v2.size: + raise ValueError,"the lenght of both arrays must be the same" + pass + +def Add(v1,v2): + '''add two list''' + check_list(v1,v2) + return v1.__add__(v2) + +def Subtract(v1,v2): + '''subtract v2 from v1''' + check_list(v1,v2) + return v1.__sub__(v2) + +def Product(v1,v2): + '''return product of two list''' + check_list(v1,v2) + return v1.__mul__(v2) + +def Division(v1,v2): + '''return divide v1 by v2. add 1 to both v1 and v2''' + check_list(v1,v2) + return (v1+1).__div__(v2+1) + +def Average(v1,v2): + '''return arithmetic mean of two list''' + check_list(v1,v2) + return v1.__add__(v2)/2 + +def geometricMean(v1,v2): + '''return geometric mean of two list''' + check_list(v1,v2) + return (v1.__mul__(v2))**0.5 + +def Max(v1,v2): + '''pairwise comparison two list. return the max one between two paried number''' + check_list(v1,v2) + return imap(max,izip(v1,v2)) + +def Min(v1,v2): + '''pairwise comparison two list. return the max one between two paried number''' + check_list(v1,v2) + return imap(min,izip(v1,v2)) +def euclidean_distance(v1,v2): + '''return euclidean distance''' + check_list(v1,v2) + return (sum((v1.__sub__(v2))**2) / v1.size)**0.5 \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/lib/cpmodule/wiggle.py b/code/utilities/CPAT-1.2.2/lib/cpmodule/wiggle.py new file mode 100755 index 0000000..0cd2dfd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/cpmodule/wiggle.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python +#Liguo Wang +#04/13/2011 + +#import built-in modules +import os,sys +import re +import string +#from optparse import OptionParser +import warnings +import string +import collections +import math + +#import third-party modules +#from bx.bitset import * +#from bx.bitset_builders import * +#from bx.intervals import * +#import fasta +import bx.wiggle +from bx.binned_array import BinnedArray +from bx_extras.fpconst import isNaN + + +class ParseWig: + '''provie methods to manipulate wiggle format file. For wiggle format see: + http://genome.ucsc.edu/goldenPath/help/wiggle.html''' + + def __init__(self,wigFile): + '''read wig file, creat wig obj''' + self.scores = {} + self.num_re=re.compile(r'[\d\.\-\+]+'); + fh=open(wigFile) + #infile=open(wigFile,'r') + for i, ( chrom, pos, val ) in enumerate( bx.wiggle.Reader( fh ) ): + chrom=chrom.upper() + if not chrom in self.scores: self.scores[ chrom ] = BinnedArray() + self.scores[chrom][pos] = val + if i % 100000 == 0: print "%i datapoints loaded \r" % i + #print self.scores.keys() + print "total " + str(i) + " points loaded" + + def fetch_all_scores(self,chr,st,end): + '''fetch all wiggle scores defined by st and end. NOTE: + 1)st and end are 0-based, half-open. (st,end] + 2)points without score are indicated as "nan" + ''' + chr=chr.upper() + return [ self.scores[chr][i] for i in range(st,end)] + + def fetch_max_scores(self,chr,st,end): + ''' fetch maximum score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + + chr=chr.upper() + return max([ self.scores[chr][i] for i in range(st,end)]) + + def fetch_min_scores(self,chr,st,end): + ''' fetch minimum score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + + chr=chr.upper() + return min([ self.scores[chr][i] for i in range(st,end)]) + + def fetch_avg_scores(self,chr,st,end): + ''' fetch average score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + + chr=chr.upper() + lst=[ float(self.scores[chr][i]) for i in range(st,end) if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst)/len(range(st,end)) + + def fetch_sum_scores(self,chr,st,end): + ''' fetch sum score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + + chr=chr.upper() + lst=[ float(self.scores[chr][i]) for i in range(st,end) if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst) +#if __name__ == "__main__": main() + +class ParseWig2: + '''provie methods to manipulate wiggle format file. For wiggle format see: + http://genome.ucsc.edu/goldenPath/help/wiggle.html. The same coordinate could occur more than + one time in wig file, and the scores will be sumed up. Slower than ParseWig''' + + def __init__(self,wigFile): + '''read wig file, creat wig obj''' + self.scores = {} + self.num_re=re.compile(r'[\d\.\-\+]+'); + fh=open(wigFile) + #infile=open(wigFile,'r') + for i, ( chrom, pos, val ) in enumerate( bx.wiggle.Reader( fh ) ): + chrom=chrom.upper() + if not chrom in self.scores: self.scores[chrom] = BinnedArray() + tmp=self.scores[chrom][pos] + if isNaN(tmp): + self.scores[chrom][pos] = val + else: + self.scores[chrom][pos] += val + if i % 100000 == 0: print "%i datapoints loaded \r" % i + #print self.scores.keys() + print "total " + str(i) + " points loaded" + + def fetch_all_scores_by_range(self,chr,st,end): + '''fetch all wiggle scores defined by st and end. NOTE: + 1)st and end are 0-based, half-open. (st,end] + 2)points without score are indicated as "nan"''' + chr=chr.upper() + return [ self.scores[chr][i] for i in range(st,end)] + + def fetch_all_scores_by_positions(self,chr,lst): + '''fetch all wiggle scores defined by st and end. NOTE: + 2)points without score are indicated as "nan"''' + chr=chr.upper() + return [ self.scores[chr][i] for i in lst] + + def fetch_max_scores_by_range(self,chr,st,end): + ''' fetch maximum score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + chr=chr.upper() + return max([ self.scores[chr][i] for i in range(st,end)]) + + def fetch_max_scores_by_positions(self,chr,lst): + '''fetch maximum score defined by chr, st, end''' + + chr=chr.upper() + return max([ self.scores[chr][i] for i in lst]) + + def fetch_min_scores_by_range(self,chr,st,end): + ''' fetch minimum score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + chr=chr.upper() + return min([ self.scores[chr][i] for i in range(st,end)]) + + def fetch_min_scores_by_positions(self,chr,lst): + ''' fetch minimum score defined by chr, st, end + ''' + chr=chr.upper() + return min([ self.scores[chr][i] for i in lst]) + + + def fetch_avg_scores_by_range(self,chr,st,end): + ''' fetch average score defined by chr, st, end + 1)st and end are 0-based, half-open. (st,end] + ''' + chr=chr.upper() + lst=[ float(self.scores[chr][i]) for i in range(st,end) if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst)/len(range(st,end)) + + def fetch_avg_scores_by_positions(self,chr,lst): + ''' fetch average score defined by chr, st, end + ''' + chr=chr.upper() + lst_score =[ float(self.scores[chr][i]) for i in lst if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst_score)/len(lst_score) + + def fetch_sum_scores_by_range(self,chr,st,end): + ''' fetch sum score defined by chr, st, end + ''' + chr=chr.upper() + lst=[ float(self.scores[chr][i]) for i in range(st,end) if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst) + + def fetch_sum_scores_by_positions(self,chr,lst): + ''' fetch sum score defined by chr, st, end + ''' + chr=chr.upper() + lst_score=[ float(self.scores[chr][i]) for i in lst if self.num_re.match(str(self.scores[chr][i]))] + return sum(lst_score) + + def distriub_wig(self,bed,till_count=100): + '''calculate coverage over bed file (only consider exon regions). The mRNA sequences in input + bed file will be cut into 100 tills of equal size''' + + print >>sys.stderr,"Reading " + bed + " ..." + for line in open(bed,'r'): + try: + if line.startswith(('#','track','browser')):continue + fields=line.rstrip('\r\n').split() + txStart=int(fields[1]) + chrom=fields[0] + strand=fields[5] + geneName=fields[3] + score=fields[4] + exon_start=map(int,fields[11].rstrip(',').split(',')) + exon_start=map((lambda x: x + txStart),exon_start) + exon_end=map(int,fields[10].rstrip(',').split(',')) + exon_end=map((lambda x,y:x+y),exon_start,exon_end) + except: + print >>sys.stderr,"[NOTE:input bed must be 12-column] skipped this line: " + line, + continue + +#if __name__ == "__main__": main() diff --git a/code/utilities/CPAT-1.2.2/lib/psyco_full.py b/code/utilities/CPAT-1.2.2/lib/psyco_full.py new file mode 100755 index 0000000..804bf33 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/psyco_full.py @@ -0,0 +1,14 @@ +""" +Attempt to call psyco.full, but ignore any errors. +""" + +import sys + +try: + import psyco + psyco.full() +except: + pass + #print >> sys.stderr, "Psyco not found, continuing without it" + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/Pileup.py b/code/utilities/CPAT-1.2.2/lib/pysam/Pileup.py new file mode 100755 index 0000000..998127b --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/Pileup.py @@ -0,0 +1,271 @@ +'''Tools for working with files in the samtools pileup -c format.''' +import collections +import pysam + +PileupSubstitution = collections.namedtuple( "PileupSubstitution", + " ".join( (\ + "chromosome", + "pos", + "reference_base", + "genotype", + "consensus_quality", + "snp_quality", + "mapping_quality", + "coverage", + "read_bases", + "base_qualities" ) ) ) + +PileupIndel = collections.namedtuple( "PileupIndel", + " ".join( (\ + "chromosome", + "pos", + "reference_base", + "genotype", + "consensus_quality", + "snp_quality", + "mapping_quality", + "coverage", + "first_allele", + "second_allele", + "reads_first", + "reads_second", + "reads_diff" ) ) ) + +def iterate( infile ): + '''iterate over ``samtools pileup -c`` formatted file. + + *infile* can be any iterator over a lines. + + The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` + or :class:`pysam.Pileup.PileupIndel`. + + .. note:: + The parser converts to 0-based coordinates + ''' + + conv_subst = (str,lambda x: int(x)-1,str,str,int,int,int,int,str,str) + conv_indel = (str,lambda x: int(x)-1,str,str,int,int,int,int,str,str,int,int,int) + + for line in infile: + d = line[:-1].split() + if d[2] == "*": + try: + yield PileupIndel( *[x(y) for x,y in zip(conv_indel,d) ] ) + except TypeError: + raise pysam.SamtoolsError( "parsing error in line: `%s`" % line) + else: + try: + yield PileupSubstitution( *[x(y) for x,y in zip(conv_subst,d) ] ) + except TypeError: + raise pysam.SamtoolsError( "parsing error in line: `%s`" % line) + +ENCODE_GENOTYPE = { + 'A': 'A', 'C': 'C', 'G': 'G', 'T': 'T', + 'AA': 'A', 'CC': 'C', 'GG': 'G', 'TT': 'T', 'UU': 'U', + 'AG': 'r', 'GA': 'R', + 'CT': 'y', 'TC': 'Y', + 'AC': 'm', 'CA': 'M', + 'GT': 'k', 'TG': 'K', + 'CG': 's', 'GC': 'S', + 'AT': 'w', 'TA': 'W', + } + +DECODE_GENOTYPE = { + 'A': 'AA', + 'C': 'CC', + 'G': 'GG', + 'T': 'TT', + 'r': 'AG', 'R': 'AG', + 'y': 'CT', 'Y': 'CT', + 'm': 'AC', 'M': 'AC', + 'k': 'GT', 'K': 'GT', + 's': 'CG', 'S': 'CG', + 'w': 'AT', 'W': 'AT', + } + +##------------------------------------------------------------ +def encodeGenotype( code ): + '''encode genotypes like GG, GA into a one-letter code. + The returned code is lower case if code[0] < code[1], otherwise + it is uppercase. + ''' + return ENCODE_GENOTYPE[ code.upper() ] + +def decodeGenotype( code ): + '''decode single letter genotypes like m, M into two letters. + This is the reverse operation to :meth:`encodeGenotype`. + ''' + return DECODE_GENOTYPE[ code ] + +def translateIndelGenotypeFromVCF( vcf_genotypes, ref ): + '''translate indel from vcf to pileup format.''' + + # indels + def getPrefix( s1, s2 ): + '''get common prefix of strings s1 and s2.''' + n = min( len( s1), len( s2 ) ) + for x in range( n ): + if s1[x] != s2[x]: return s1[:x] + return s1[:n] + + def getSuffix( s1, s2 ): + '''get common sufix of strings s1 and s2.''' + n = min( len( s1), len( s2 ) ) + if s1[-1] != s2[-1]: return "" + for x in range( -2, -n - 1, -1 ): + if s1[x] != s2[x]: return s1[x+1:] + return s1[-n:] + + def getGenotype( variant, ref ): + + if variant == ref: return "*", 0 + + if len(ref) > len(variant): + # is a deletion + if ref.startswith(variant): + return "-%s" % ref[len(variant):], len(variant) - 1 + elif ref.endswith( variant ): + return "-%s" % ref[:-len(variant)], -1 + else: + prefix = getPrefix( ref, variant ) + suffix = getSuffix( ref, variant ) + shared = len(prefix) + len(suffix) - len(variant) + # print "-", prefix, suffix, ref, variant, shared, len(prefix), len(suffix), len(ref) + if shared < 0: + raise ValueError() + return "-%s" % ref[len(prefix):-(len(suffix)-shared)], len(prefix) - 1 + + elif len(ref) < len(variant): + # is an insertion + if variant.startswith(ref): + return "+%s" % variant[len(ref):], len(ref) - 1 + elif variant.endswith(ref): + return "+%s" % variant[:len(ref)], 0 + else: + prefix = getPrefix( ref, variant ) + suffix = getSuffix( ref, variant ) + shared = len(prefix) + len(suffix) - len(ref) + if shared < 0: + raise ValueError() + + return "+%s" % variant[len(prefix):-(len(suffix)-shared)], len(prefix) + else: + assert 0, "snp?" + + # in pileup, the position refers to the base + # after the coordinate, hence subtract 1 + #pos -= 1 + + genotypes, offsets = [], [] + is_error = True + + for variant in vcf_genotypes: + try: + g, offset = getGenotype( variant, ref ) + except ValueError: + break + + genotypes.append( g ) + if g != "*": offsets.append( offset ) + + else: + is_error = False + + if is_error: + raise ValueError() + + assert len(set(offsets )) == 1, "multiple offsets for indel" + offset = offsets[0] + + genotypes = "/".join( genotypes ) + return genotypes, offset + +def vcf2pileup( vcf, sample ): + '''convert vcf record to pileup record.''' + + chromosome = vcf.contig + pos = vcf.pos + reference = vcf.ref + allelles = [reference] + vcf.alt + + data = vcf[sample] + + # get genotype + genotypes = data["GT"] + if len(genotypes) > 1: + raise ValueError( "only single genotype per position, %s" % (str(vcf))) + + genotypes = genotypes[0] + + # not a variant + if genotypes[0] == ".": return None + + genotypes = [ allelles[int(x)] for x in genotypes if x != "/" ] + + # snp_quality is "genotype quality" + snp_quality = consensus_quality = data.get( "GQ", [0])[0] + mapping_quality = vcf.info.get( "MQ", [0])[0] + coverage = data.get( "DP", 0) + + if len(reference) > 1 or max([len(x) for x in vcf.alt] ) > 1: + # indel + genotype, offset = translateIndelGenotypeFromVCF( genotypes, reference ) + + return PileupIndel( chromosome, + pos + offset, + "*", + genotype, + consensus_quality, + snp_quality, + mapping_quality, + coverage, + genotype, + "<" * len(genotype), + 0, + 0, + 0 ) + + else: + + genotype = encodeGenotype( "".join(genotypes) ) + + + read_bases = "" + base_qualities = "" + + return PileupSubstitution( chromosome, pos, reference, + genotype, + consensus_quality, + snp_quality, + mapping_quality, + coverage, read_bases, base_qualities ) + + +def iterate_from_vcf( infile, sample ): + '''iterate over a vcf-formatted file. + + *infile* can be any iterator over a lines. + + The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution` + or :class:`pysam.Pileup.PileupIndel`. + + Positions without a snp will be skipped. + + This method is wasteful and written to support same + legacy code that expects samtools pileup output. + + Better use the vcf parser directly. + + ''' + + + vcf = pysam.VCF() + vcf.connect( infile ) + + if sample not in vcf.getsamples(): + raise KeyErorr( "sample %s not vcf file" ) + + for row in vcf.fetch(): + result = vcf2pileup( row, sample ) + if result: yield result + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.c b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.c new file mode 100755 index 0000000..4edcb4d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.c @@ -0,0 +1,10129 @@ +/* Generated by Cython 0.14.1 on Thu Nov 17 22:34:01 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__TabProxies +#include "stdlib.h" +#include "string.h" +#include "stdint.h" +#include "stdio.h" +#include "pythread.h" + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "TabProxies.pyx", + "bool.pxd", + "complex.pxd", +}; + +/* Type declarations */ + +/* "TabProxies.pxd":42 + * ctypedef int uint64_t + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_TupleProxy { + PyObject_HEAD + struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab; + char *data; + char **fields; + int nfields; + int index; + int nbytes; + int offset; + int is_modified; +}; + +/* "TabProxies.pxd":78 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_obj_10TabProxies_NamedTupleProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; +}; + +/* "TabProxies.pxd":92 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_VCFProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t pos; +}; + +/* "TabProxies.pxd":61 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_GTFProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; + char *contig; + char *source; + char *feature; + uint32_t start; + uint32_t end; + char *score; + char *strand; + char *frame; + char *attributes; + int hasOwnAttributes; +}; + +/* "TabProxies.pxd":81 + * pass + * + * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_BedProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t start; + uint32_t end; + int bedfields; +}; + + +/* "TabProxies.pyx":20 + * return not (buffer <= p < buffer + nbytes ) + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * '''Proxy class for access to parsed row as a tuple. + * + */ + +struct __pyx_vtabstruct_10TabProxies_TupleProxy { + int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t); + PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); +}; +static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy; + + +/* "TabProxies.pyx":493 + * self.fromDict( r ) + * + * cdef class NamedTupleProxy( TupleProxy ): # <<<<<<<<<<<<<< + * + * map_key2field = {} + */ + +struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy; + + +/* "TabProxies.pyx":578 + * TupleProxy._setindex(self, idx, str(value) ) + * + * cdef class VCFProxy( NamedTupleProxy ): # <<<<<<<<<<<<<< + * '''Proxy class for access to VCF fields. + * + */ + +struct __pyx_vtabstruct_10TabProxies_VCFProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy; + + +/* "TabProxies.pyx":512 + * return f( self.fields[idx] ) + * + * cdef class BedProxy( NamedTupleProxy ): # <<<<<<<<<<<<<< + * '''Proxy class for access to Bed fields. + * + */ + +struct __pyx_vtabstruct_10TabProxies_BedProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy; + + +/* "TabProxies.pyx":240 + * return str(v) + * + * cdef class GTFProxy( TupleProxy ): # <<<<<<<<<<<<<< + * '''Proxy class for access to GTF fields. + * + */ + +struct __pyx_vtabstruct_10TabProxies_GTFProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ + +#define __Pyx_PyObject_AsDouble(obj) \ + ((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); + +static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *); + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cpython.version */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from cpython.exc */ + +/* Module declarations from cpython.module */ + +/* Module declarations from cpython.mem */ + +/* Module declarations from cpython.tuple */ + +/* Module declarations from cpython.list */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from cpython.sequence */ + +/* Module declarations from cpython.mapping */ + +/* Module declarations from cpython.iterator */ + +/* Module declarations from cpython.type */ + +/* Module declarations from cpython.number */ + +/* Module declarations from cpython.int */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.bool */ + +static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from cpython.long */ + +/* Module declarations from cpython.float */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.complex */ + +static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from cpython.string */ + +/* Module declarations from cpython.unicode */ + +/* Module declarations from cpython.dict */ + +/* Module declarations from cpython.instance */ + +/* Module declarations from cpython.function */ + +/* Module declarations from cpython.method */ + +/* Module declarations from cpython.weakref */ + +/* Module declarations from cpython.getargs */ + +/* Module declarations from cpython.pythread */ + +/* Module declarations from cpython.cobject */ + +/* Module declarations from cpython.oldbuffer */ + +/* Module declarations from cpython.set */ + +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.bytes */ + +/* Module declarations from cpython.pycapsule */ + +/* Module declarations from cpython */ + +/* Module declarations from TabProxies */ + +static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0; +static char *__pyx_f_10TabProxies_nextItem(char *); /*proto*/ +static char *__pyx_f_10TabProxies_StrOrEmpty(char *); /*proto*/ +static int __pyx_f_10TabProxies_isNew(char *, char *, size_t); /*proto*/ +#define __Pyx_MODULE_NAME "TabProxies" +static int __pyx_module_is_main_TabProxies = 0; + +/* Implementation of TabProxies */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_xrange; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_AttributeError; +static PyObject *__pyx_builtin_KeyError; +static char __pyx_k_1[] = "malformatted entry at %s"; +static char __pyx_k_2[] = ""; +static char __pyx_k_3[] = "out of memory"; +static char __pyx_k_5[] = "incomplete line at %s"; +static char __pyx_k_7[] = "row too large - more than %i fields"; +static char __pyx_k_8[] = "list index out of range"; +static char __pyx_k_10[] = "list index out of range %i >= %i"; +static char __pyx_k_14[] = "\t"; +static char __pyx_k_16[] = "."; +static char __pyx_k_17[] = "\"%s\""; +static char __pyx_k_18[] = ";"; +static char __pyx_k_20[] = " "; +static char __pyx_k_22[] = "\""; +static char __pyx_k_23[] = "%s \"%s\""; +static char __pyx_k_24[] = "%s %s"; +static char __pyx_k_25[] = "; "; +static char __pyx_k_29[] = "'GTFProxy' has no attribute '%s'"; +static char __pyx_k_30[] = "field %s not set"; +static char __pyx_k_31[] = "bed format requires at least three columns"; +static char __pyx_k_33[] = "contig of feature."; +static char __pyx_k_34[] = "feature name."; +static char __pyx_k_35[] = "feature source."; +static char __pyx_k_36[] = "feature start (in 0-based open/closed coordinates)."; +static char __pyx_k_37[] = "feature end (in 0-based open/closed coordinates)."; +static char __pyx_k_38[] = "feature score."; +static char __pyx_k_39[] = "feature strand."; +static char __pyx_k_40[] = "feature frame."; +static char __pyx_k_41[] = "feature attributes (as a string)."; +static char __pyx_k__id[] = "id"; +static char __pyx_k__alt[] = "alt"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__pos[] = "pos"; +static char __pyx_k__ref[] = "ref"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__info[] = "info"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__name[] = "name"; +static char __pyx_k__qual[] = "qual"; +static char __pyx_k__frame[] = "frame"; +static char __pyx_k__index[] = "index"; +static char __pyx_k__items[] = "items"; +static char __pyx_k__quote[] = "quote"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__score[] = "score"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__strip[] = "strip"; +static char __pyx_k__toDot[] = "toDot"; +static char __pyx_k__types[] = "types"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__asDict[] = "asDict"; +static char __pyx_k__contig[] = "contig"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__filter[] = "filter"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__nbytes[] = "nbytes"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__source[] = "source"; +static char __pyx_k__strand[] = "strand"; +static char __pyx_k__update[] = "update"; +static char __pyx_k__xrange[] = "xrange"; +static char __pyx_k____str__[] = "__str__"; +static char __pyx_k__feature[] = "feature"; +static char __pyx_k__indices[] = "indices"; +static char __pyx_k__itemRGB[] = "itemRGB"; +static char __pyx_k__nfields[] = "nfields"; +static char __pyx_k__KeyError[] = "KeyError"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__fromDict[] = "fromDict"; +static char __pyx_k__thickEnd[] = "thickEnd"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k___getindex[] = "_getindex"; +static char __pyx_k___setindex[] = "_setindex"; +static char __pyx_k__bedfields[] = "bedfields"; +static char __pyx_k__IndexError[] = "IndexError"; +static char __pyx_k__StringType[] = "StringType"; +static char __pyx_k__TabProxies[] = "TabProxies"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__attributes[] = "attributes"; +static char __pyx_k__blockCount[] = "blockCount"; +static char __pyx_k__blockSizes[] = "blockSizes"; +static char __pyx_k__thickStart[] = "thickStart"; +static char __pyx_k__StringTypes[] = "StringTypes"; +static char __pyx_k____getattr__[] = "__getattr__"; +static char __pyx_k____setitem__[] = "__setitem__"; +static char __pyx_k__blockStarts[] = "blockStarts"; +static char __pyx_k__is_modified[] = "is_modified"; +static char __pyx_k__getMaxFields[] = "getMaxFields"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static char __pyx_k__map_key2field[] = "map_key2field"; +static char __pyx_k__AttributeError[] = "AttributeError"; +static char __pyx_k__hasOwnAttributes[] = "hasOwnAttributes"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_kp_s_18; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_kp_s_22; +static PyObject *__pyx_kp_s_23; +static PyObject *__pyx_kp_s_24; +static PyObject *__pyx_kp_s_25; +static PyObject *__pyx_kp_s_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_30; +static PyObject *__pyx_kp_s_31; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_n_s__AttributeError; +static PyObject *__pyx_n_s__IndexError; +static PyObject *__pyx_n_s__KeyError; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__StringType; +static PyObject *__pyx_n_s__StringTypes; +static PyObject *__pyx_n_s__TabProxies; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____getattr__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____setitem__; +static PyObject *__pyx_n_s____str__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___getindex; +static PyObject *__pyx_n_s___setindex; +static PyObject *__pyx_n_s__alt; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__asDict; +static PyObject *__pyx_n_s__attributes; +static PyObject *__pyx_n_s__bedfields; +static PyObject *__pyx_n_s__blockCount; +static PyObject *__pyx_n_s__blockSizes; +static PyObject *__pyx_n_s__blockStarts; +static PyObject *__pyx_n_s__contig; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__feature; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__filter; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__frame; +static PyObject *__pyx_n_s__fromDict; +static PyObject *__pyx_n_s__getMaxFields; +static PyObject *__pyx_n_s__hasOwnAttributes; +static PyObject *__pyx_n_s__id; +static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__indices; +static PyObject *__pyx_n_s__info; +static PyObject *__pyx_n_s__is_modified; +static PyObject *__pyx_n_s__itemRGB; +static PyObject *__pyx_n_s__items; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__map_key2field; +static PyObject *__pyx_n_s__name; +static PyObject *__pyx_n_s__nbytes; +static PyObject *__pyx_n_s__nfields; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__pos; +static PyObject *__pyx_n_s__qual; +static PyObject *__pyx_n_s__quote; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__ref; +static PyObject *__pyx_n_s__score; +static PyObject *__pyx_n_s__source; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__strand; +static PyObject *__pyx_n_s__strip; +static PyObject *__pyx_n_s__thickEnd; +static PyObject *__pyx_n_s__thickStart; +static PyObject *__pyx_n_s__toDot; +static PyObject *__pyx_n_s__types; +static PyObject *__pyx_n_s__update; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__xrange; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_7; +static PyObject *__pyx_int_8; +static PyObject *__pyx_int_9; +static PyObject *__pyx_int_10; +static PyObject *__pyx_int_11; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_32; + +/* "TabProxies.pyx":4 + * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING + * + * cdef char * nextItem( char * buffer ): # <<<<<<<<<<<<<< + * cdef char * pos + * pos = strchr( buffer, '\t' ) + */ + +static char *__pyx_f_10TabProxies_nextItem(char *__pyx_v_buffer) { + char *__pyx_v_pos; + char *__pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("nextItem"); + + /* "TabProxies.pyx":6 + * cdef char * nextItem( char * buffer ): + * cdef char * pos + * pos = strchr( buffer, '\t' ) # <<<<<<<<<<<<<< + * if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer ) + * pos[0] = '\0' + */ + __pyx_v_pos = strchr(__pyx_v_buffer, '\t'); + + /* "TabProxies.pyx":7 + * cdef char * pos + * pos = strchr( buffer, '\t' ) + * if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer ) # <<<<<<<<<<<<<< + * pos[0] = '\0' + * pos += 1 + */ + __pyx_t_1 = (__pyx_v_pos == NULL); + if (__pyx_t_1) { + __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":8 + * pos = strchr( buffer, '\t' ) + * if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer ) + * pos[0] = '\0' # <<<<<<<<<<<<<< + * pos += 1 + * return pos + */ + (__pyx_v_pos[0]) = '\x00'; + + /* "TabProxies.pyx":9 + * if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer ) + * pos[0] = '\0' + * pos += 1 # <<<<<<<<<<<<<< + * return pos + * + */ + __pyx_v_pos = (__pyx_v_pos + 1); + + /* "TabProxies.pyx":10 + * pos[0] = '\0' + * pos += 1 + * return pos # <<<<<<<<<<<<<< + * + * cdef char *StrOrEmpty( char * buffer ): + */ + __pyx_r = __pyx_v_pos; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("TabProxies.nextItem"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":12 + * return pos + * + * cdef char *StrOrEmpty( char * buffer ): # <<<<<<<<<<<<<< + * if buffer == NULL: return "" + * else: return buffer + */ + +static char *__pyx_f_10TabProxies_StrOrEmpty(char *__pyx_v_buffer) { + char *__pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("StrOrEmpty"); + + /* "TabProxies.pyx":13 + * + * cdef char *StrOrEmpty( char * buffer ): + * if buffer == NULL: return "" # <<<<<<<<<<<<<< + * else: return buffer + * + */ + __pyx_t_1 = (__pyx_v_buffer == NULL); + if (__pyx_t_1) { + __pyx_r = __pyx_k_2; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "TabProxies.pyx":14 + * cdef char *StrOrEmpty( char * buffer ): + * if buffer == NULL: return "" + * else: return buffer # <<<<<<<<<<<<<< + * + * cdef int isNew( char * p, char * buffer, size_t nbytes ): + */ + __pyx_r = __pyx_v_buffer; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":16 + * else: return buffer + * + * cdef int isNew( char * p, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * if p == NULL: return 0 + * return not (buffer <= p < buffer + nbytes ) + */ + +static int __pyx_f_10TabProxies_isNew(char *__pyx_v_p, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + int __pyx_r; + int __pyx_t_1; + __Pyx_RefNannySetupContext("isNew"); + + /* "TabProxies.pyx":17 + * + * cdef int isNew( char * p, char * buffer, size_t nbytes ): + * if p == NULL: return 0 # <<<<<<<<<<<<<< + * return not (buffer <= p < buffer + nbytes ) + * + */ + __pyx_t_1 = (__pyx_v_p == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":18 + * cdef int isNew( char * p, char * buffer, size_t nbytes ): + * if p == NULL: return 0 + * return not (buffer <= p < buffer + nbytes ) # <<<<<<<<<<<<<< + * + * cdef class TupleProxy: + */ + __pyx_t_1 = (__pyx_v_buffer <= __pyx_v_p); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_p < (__pyx_v_buffer + __pyx_v_nbytes)); + } + __pyx_r = (!__pyx_t_1); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":30 + * ''' + * + * def __cinit__(self ): # <<<<<<<<<<<<<< + * self.data = NULL + * self.fields = NULL + */ + +static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_10TabProxies_10TupleProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "TabProxies.pyx":31 + * + * def __cinit__(self ): + * self.data = NULL # <<<<<<<<<<<<<< + * self.fields = NULL + * self.index = 0 + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data = NULL; + + /* "TabProxies.pyx":32 + * def __cinit__(self ): + * self.data = NULL + * self.fields = NULL # <<<<<<<<<<<<<< + * self.index = 0 + * self.nbytes = 0 + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields = NULL; + + /* "TabProxies.pyx":33 + * self.data = NULL + * self.fields = NULL + * self.index = 0 # <<<<<<<<<<<<<< + * self.nbytes = 0 + * self.is_modified = 0 + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = 0; + + /* "TabProxies.pyx":34 + * self.fields = NULL + * self.index = 0 + * self.nbytes = 0 # <<<<<<<<<<<<<< + * self.is_modified = 0 + * self.nfields = 0 + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes = 0; + + /* "TabProxies.pyx":35 + * self.index = 0 + * self.nbytes = 0 + * self.is_modified = 0 # <<<<<<<<<<<<<< + * self.nfields = 0 + * # start counting at field offset + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified = 0; + + /* "TabProxies.pyx":36 + * self.nbytes = 0 + * self.is_modified = 0 + * self.nfields = 0 # <<<<<<<<<<<<<< + * # start counting at field offset + * self.offset = 0 + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields = 0; + + /* "TabProxies.pyx":38 + * self.nfields = 0 + * # start counting at field offset + * self.offset = 0 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":40 + * self.offset = 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * cdef int x + * if self.is_modified: + */ + +static void __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(PyObject *__pyx_v_self) { + int __pyx_v_x; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "TabProxies.pyx":42 + * def __dealloc__(self): + * cdef int x + * if self.is_modified: # <<<<<<<<<<<<<< + * for x from 0 <= x < self.nfields: + * if isNew( self.fields[x], self.data, self.nbytes ): + */ + if (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified) { + + /* "TabProxies.pyx":43 + * cdef int x + * if self.is_modified: + * for x from 0 <= x < self.nfields: # <<<<<<<<<<<<<< + * if isNew( self.fields[x], self.data, self.nbytes ): + * free( self.fields[x] ) + */ + __pyx_t_1 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_1; __pyx_v_x++) { + + /* "TabProxies.pyx":44 + * if self.is_modified: + * for x from 0 <= x < self.nfields: + * if isNew( self.fields[x], self.data, self.nbytes ): # <<<<<<<<<<<<<< + * free( self.fields[x] ) + * self.fields[x] = NULL + */ + __pyx_t_2 = __pyx_f_10TabProxies_isNew((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]), ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes); + if (__pyx_t_2) { + + /* "TabProxies.pyx":45 + * for x from 0 <= x < self.nfields: + * if isNew( self.fields[x], self.data, self.nbytes ): + * free( self.fields[x] ) # <<<<<<<<<<<<<< + * self.fields[x] = NULL + * + */ + free((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x])); + + /* "TabProxies.pyx":46 + * if isNew( self.fields[x], self.data, self.nbytes ): + * free( self.fields[x] ) + * self.fields[x] = NULL # <<<<<<<<<<<<<< + * + * if self.data != NULL: free(self.data) + */ + (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]) = NULL; + goto __pyx_L8; + } + __pyx_L8:; + } + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":48 + * self.fields[x] = NULL + * + * if self.data != NULL: free(self.data) # <<<<<<<<<<<<<< + * if self.fields != NULL: free( self.fields ) + * + */ + __pyx_t_3 = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data != NULL); + if (__pyx_t_3) { + free(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data); + goto __pyx_L9; + } + __pyx_L9:; + + /* "TabProxies.pyx":49 + * + * if self.data != NULL: free(self.data) + * if self.fields != NULL: free( self.fields ) # <<<<<<<<<<<<<< + * + * cdef take( self, char * buffer, size_t nbytes ): + */ + __pyx_t_3 = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields != NULL); + if (__pyx_t_3) { + free(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields); + goto __pyx_L10; + } + __pyx_L10:; + + __Pyx_RefNannyFinishContext(); +} + +/* "TabProxies.pyx":51 + * if self.fields != NULL: free( self.fields ) + * + * cdef take( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''start presenting buffer. + * + */ + +static PyObject *__pyx_f_10TabProxies_10TupleProxy_take(struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("take"); + + /* "TabProxies.pyx":56 + * Take ownership of the pointer. + * ''' + * self.data = buffer # <<<<<<<<<<<<<< + * self.nbytes = nbytes + * self.update( buffer, nbytes ) + */ + __pyx_v_self->data = __pyx_v_buffer; + + /* "TabProxies.pyx":57 + * ''' + * self.data = buffer + * self.nbytes = nbytes # <<<<<<<<<<<<<< + * self.update( buffer, nbytes ) + * + */ + __pyx_v_self->nbytes = __pyx_v_nbytes; + + /* "TabProxies.pyx":58 + * self.data = buffer + * self.nbytes = nbytes + * self.update( buffer, nbytes ) # <<<<<<<<<<<<<< + * + * cdef present( self, char * buffer, size_t nbytes ): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.TupleProxy.take"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":60 + * self.update( buffer, nbytes ) + * + * cdef present( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''start presenting buffer. + * + */ + +static PyObject *__pyx_f_10TabProxies_10TupleProxy_present(struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("present"); + + /* "TabProxies.pyx":65 + * Do not take ownership of the pointer. + * ''' + * self.update( buffer, nbytes ) # <<<<<<<<<<<<<< + * + * cdef copy( self, char * buffer, size_t nbytes ): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.TupleProxy.present"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":67 + * self.update( buffer, nbytes ) + * + * cdef copy( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''start presenting buffer. + * + */ + +static PyObject *__pyx_f_10TabProxies_10TupleProxy_copy(struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + int __pyx_v_s; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("copy"); + + /* "TabProxies.pyx":74 + * cdef int s + * # +1 for '\0' + * s = sizeof(char) * (nbytes + 1) # <<<<<<<<<<<<<< + * self.data = malloc( s ) + * if self.data == NULL: + */ + __pyx_v_s = ((sizeof(char)) * (__pyx_v_nbytes + 1)); + + /* "TabProxies.pyx":75 + * # +1 for '\0' + * s = sizeof(char) * (nbytes + 1) + * self.data = malloc( s ) # <<<<<<<<<<<<<< + * if self.data == NULL: + * raise ValueError("out of memory" ) + */ + __pyx_v_self->data = ((char *)malloc(__pyx_v_s)); + + /* "TabProxies.pyx":76 + * s = sizeof(char) * (nbytes + 1) + * self.data = malloc( s ) + * if self.data == NULL: # <<<<<<<<<<<<<< + * raise ValueError("out of memory" ) + * self.nbytes = nbytes + */ + __pyx_t_1 = (__pyx_v_self->data == NULL); + if (__pyx_t_1) { + + /* "TabProxies.pyx":77 + * self.data = malloc( s ) + * if self.data == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * self.nbytes = nbytes + * memcpy( self.data, buffer, s ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":78 + * if self.data == NULL: + * raise ValueError("out of memory" ) + * self.nbytes = nbytes # <<<<<<<<<<<<<< + * memcpy( self.data, buffer, s ) + * self.update( self.data, nbytes ) + */ + __pyx_v_self->nbytes = __pyx_v_nbytes; + + /* "TabProxies.pyx":79 + * raise ValueError("out of memory" ) + * self.nbytes = nbytes + * memcpy( self.data, buffer, s ) # <<<<<<<<<<<<<< + * self.update( self.data, nbytes ) + * + */ + memcpy(__pyx_v_self->data, __pyx_v_buffer, __pyx_v_s); + + /* "TabProxies.pyx":80 + * self.nbytes = nbytes + * memcpy( self.data, buffer, s ) + * self.update( self.data, nbytes ) # <<<<<<<<<<<<<< + * + * cdef int getMaxFields( self, size_t nbytes ): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->update(__pyx_v_self, __pyx_v_self->data, __pyx_v_nbytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("TabProxies.TupleProxy.copy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":82 + * self.update( self.data, nbytes ) + * + * cdef int getMaxFields( self, size_t nbytes ): # <<<<<<<<<<<<<< + * '''initialize fields.''' + * return nbytes / 2 + */ + +static int __pyx_f_10TabProxies_10TupleProxy_getMaxFields(struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_self, size_t __pyx_v_nbytes) { + int __pyx_r; + __Pyx_RefNannySetupContext("getMaxFields"); + + /* "TabProxies.pyx":84 + * cdef int getMaxFields( self, size_t nbytes ): + * '''initialize fields.''' + * return nbytes / 2 # <<<<<<<<<<<<<< + * + * cdef update( self, char * buffer, size_t nbytes ): + */ + __pyx_r = (__pyx_v_nbytes / 2); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":86 + * return nbytes / 2 + * + * cdef update( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''update internal data. + * + */ + +static PyObject *__pyx_f_10TabProxies_10TupleProxy_update(struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + char *__pyx_v_pos; + char *__pyx_v_old_pos; + int __pyx_v_field; + int __pyx_v_max_fields; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("update"); + + /* "TabProxies.pyx":101 + * cdef int max_fields, x + * + * if buffer[nbytes] != 0: # <<<<<<<<<<<<<< + * raise ValueError( "incomplete line at %s" % buffer ) + * + */ + __pyx_t_1 = ((__pyx_v_buffer[__pyx_v_nbytes]) != 0); + if (__pyx_t_1) { + + /* "TabProxies.pyx":102 + * + * if buffer[nbytes] != 0: + * raise ValueError( "incomplete line at %s" % buffer ) # <<<<<<<<<<<<<< + * + * ################################# + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":106 + * ################################# + * # clear data + * if self.fields != NULL: free(self.fields) # <<<<<<<<<<<<<< + * + * for field from 0 <= field < self.nfields: + */ + __pyx_t_1 = (__pyx_v_self->fields != NULL); + if (__pyx_t_1) { + free(__pyx_v_self->fields); + goto __pyx_L4; + } + __pyx_L4:; + + /* "TabProxies.pyx":108 + * if self.fields != NULL: free(self.fields) + * + * for field from 0 <= field < self.nfields: # <<<<<<<<<<<<<< + * if isNew( self.fields[field], self.data, self.nbytes ): + * free( self.fields[field] ) + */ + __pyx_t_4 = __pyx_v_self->nfields; + for (__pyx_v_field = 0; __pyx_v_field < __pyx_t_4; __pyx_v_field++) { + + /* "TabProxies.pyx":109 + * + * for field from 0 <= field < self.nfields: + * if isNew( self.fields[field], self.data, self.nbytes ): # <<<<<<<<<<<<<< + * free( self.fields[field] ) + * + */ + __pyx_t_5 = __pyx_f_10TabProxies_isNew((__pyx_v_self->fields[__pyx_v_field]), __pyx_v_self->data, __pyx_v_self->nbytes); + if (__pyx_t_5) { + + /* "TabProxies.pyx":110 + * for field from 0 <= field < self.nfields: + * if isNew( self.fields[field], self.data, self.nbytes ): + * free( self.fields[field] ) # <<<<<<<<<<<<<< + * + * self.is_modified = self.nfields = 0 + */ + free((__pyx_v_self->fields[__pyx_v_field])); + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "TabProxies.pyx":112 + * free( self.fields[field] ) + * + * self.is_modified = self.nfields = 0 # <<<<<<<<<<<<<< + * + * ################################# + */ + __pyx_v_self->is_modified = 0; + __pyx_v_self->nfields = 0; + + /* "TabProxies.pyx":116 + * ################################# + * # allocate new + * max_fields = self.getMaxFields( nbytes ) # <<<<<<<<<<<<<< + * self.fields = calloc( max_fields, sizeof(char *) ) + * if self.fields == NULL: + */ + __pyx_v_max_fields = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_self->__pyx_vtab)->getMaxFields(__pyx_v_self, __pyx_v_nbytes); + + /* "TabProxies.pyx":117 + * # allocate new + * max_fields = self.getMaxFields( nbytes ) + * self.fields = calloc( max_fields, sizeof(char *) ) # <<<<<<<<<<<<<< + * if self.fields == NULL: + * raise ValueError("out of memory" ) + */ + __pyx_v_self->fields = ((char **)calloc(__pyx_v_max_fields, (sizeof(char *)))); + + /* "TabProxies.pyx":118 + * max_fields = self.getMaxFields( nbytes ) + * self.fields = calloc( max_fields, sizeof(char *) ) + * if self.fields == NULL: # <<<<<<<<<<<<<< + * raise ValueError("out of memory" ) + * + */ + __pyx_t_1 = (__pyx_v_self->fields == NULL); + if (__pyx_t_1) { + + /* "TabProxies.pyx":119 + * self.fields = calloc( max_fields, sizeof(char *) ) + * if self.fields == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * + * ################################# + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "TabProxies.pyx":123 + * ################################# + * # start filling + * field = 0 # <<<<<<<<<<<<<< + * self.fields[field] = pos = buffer + * field += 1 + */ + __pyx_v_field = 0; + + /* "TabProxies.pyx":124 + * # start filling + * field = 0 + * self.fields[field] = pos = buffer # <<<<<<<<<<<<<< + * field += 1 + * old_pos = pos + */ + (__pyx_v_self->fields[__pyx_v_field]) = __pyx_v_buffer; + __pyx_v_pos = __pyx_v_buffer; + + /* "TabProxies.pyx":125 + * field = 0 + * self.fields[field] = pos = buffer + * field += 1 # <<<<<<<<<<<<<< + * old_pos = pos + * + */ + __pyx_v_field = (__pyx_v_field + 1); + + /* "TabProxies.pyx":126 + * self.fields[field] = pos = buffer + * field += 1 + * old_pos = pos # <<<<<<<<<<<<<< + * + * while 1: + */ + __pyx_v_old_pos = __pyx_v_pos; + + /* "TabProxies.pyx":128 + * old_pos = pos + * + * while 1: # <<<<<<<<<<<<<< + * + * pos = memchr( pos, '\t', nbytes ) + */ + while (1) { + if (!1) break; + + /* "TabProxies.pyx":130 + * while 1: + * + * pos = memchr( pos, '\t', nbytes ) # <<<<<<<<<<<<<< + * if pos == NULL: break + * pos[0] = '\0' + */ + __pyx_v_pos = ((char *)memchr(__pyx_v_pos, '\t', __pyx_v_nbytes)); + + /* "TabProxies.pyx":131 + * + * pos = memchr( pos, '\t', nbytes ) + * if pos == NULL: break # <<<<<<<<<<<<<< + * pos[0] = '\0' + * pos += 1 + */ + __pyx_t_1 = (__pyx_v_pos == NULL); + if (__pyx_t_1) { + goto __pyx_L10_break; + goto __pyx_L11; + } + __pyx_L11:; + + /* "TabProxies.pyx":132 + * pos = memchr( pos, '\t', nbytes ) + * if pos == NULL: break + * pos[0] = '\0' # <<<<<<<<<<<<<< + * pos += 1 + * self.fields[field] = pos + */ + (__pyx_v_pos[0]) = '\x00'; + + /* "TabProxies.pyx":133 + * if pos == NULL: break + * pos[0] = '\0' + * pos += 1 # <<<<<<<<<<<<<< + * self.fields[field] = pos + * field += 1 + */ + __pyx_v_pos = (__pyx_v_pos + 1); + + /* "TabProxies.pyx":134 + * pos[0] = '\0' + * pos += 1 + * self.fields[field] = pos # <<<<<<<<<<<<<< + * field += 1 + * if field >= max_fields: + */ + (__pyx_v_self->fields[__pyx_v_field]) = __pyx_v_pos; + + /* "TabProxies.pyx":135 + * pos += 1 + * self.fields[field] = pos + * field += 1 # <<<<<<<<<<<<<< + * if field >= max_fields: + * raise ValueError("row too large - more than %i fields" % max_fields ) + */ + __pyx_v_field = (__pyx_v_field + 1); + + /* "TabProxies.pyx":136 + * self.fields[field] = pos + * field += 1 + * if field >= max_fields: # <<<<<<<<<<<<<< + * raise ValueError("row too large - more than %i fields" % max_fields ) + * nbytes -= pos - old_pos + */ + __pyx_t_1 = (__pyx_v_field >= __pyx_v_max_fields); + if (__pyx_t_1) { + + /* "TabProxies.pyx":137 + * field += 1 + * if field >= max_fields: + * raise ValueError("row too large - more than %i fields" % max_fields ) # <<<<<<<<<<<<<< + * nbytes -= pos - old_pos + * if nbytes < 0: break + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_max_fields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "TabProxies.pyx":138 + * if field >= max_fields: + * raise ValueError("row too large - more than %i fields" % max_fields ) + * nbytes -= pos - old_pos # <<<<<<<<<<<<<< + * if nbytes < 0: break + * old_pos = pos + */ + __pyx_v_nbytes = (__pyx_v_nbytes - (__pyx_v_pos - __pyx_v_old_pos)); + + /* "TabProxies.pyx":139 + * raise ValueError("row too large - more than %i fields" % max_fields ) + * nbytes -= pos - old_pos + * if nbytes < 0: break # <<<<<<<<<<<<<< + * old_pos = pos + * + */ + __pyx_t_1 = (__pyx_v_nbytes < 0); + if (__pyx_t_1) { + goto __pyx_L10_break; + goto __pyx_L13; + } + __pyx_L13:; + + /* "TabProxies.pyx":140 + * nbytes -= pos - old_pos + * if nbytes < 0: break + * old_pos = pos # <<<<<<<<<<<<<< + * + * self.nfields = field + */ + __pyx_v_old_pos = __pyx_v_pos; + } + __pyx_L10_break:; + + /* "TabProxies.pyx":142 + * old_pos = pos + * + * self.nfields = field # <<<<<<<<<<<<<< + * + * def _getindex( self, int index ): + */ + __pyx_v_self->nfields = __pyx_v_field; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.TupleProxy.update"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":144 + * self.nfields = field + * + * def _getindex( self, int index ): # <<<<<<<<<<<<<< + * '''return item at idx index''' + * cdef int i = index + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_2_getindex(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ +static char __pyx_doc_10TabProxies_10TupleProxy_2_getindex[] = "return item at idx index"; +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_2_getindex(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { + int __pyx_v_index; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("_getindex"); + assert(__pyx_arg_index); { + __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("TabProxies.TupleProxy._getindex"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "TabProxies.pyx":146 + * def _getindex( self, int index ): + * '''return item at idx index''' + * cdef int i = index # <<<<<<<<<<<<<< + * if i < 0: i += self.nfields + * if i < 0: raise IndexError( "list index out of range" ) + */ + __pyx_v_i = __pyx_v_index; + + /* "TabProxies.pyx":147 + * '''return item at idx index''' + * cdef int i = index + * if i < 0: i += self.nfields # <<<<<<<<<<<<<< + * if i < 0: raise IndexError( "list index out of range" ) + * i += self.offset + */ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":148 + * cdef int i = index + * if i < 0: i += self.nfields + * if i < 0: raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * i += self.offset + * if i >= self.nfields: + */ + __pyx_t_1 = (__pyx_v_i < 0); + if (__pyx_t_1) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "TabProxies.pyx":149 + * if i < 0: i += self.nfields + * if i < 0: raise IndexError( "list index out of range" ) + * i += self.offset # <<<<<<<<<<<<<< + * if i >= self.nfields: + * raise IndexError( "list index out of range %i >= %i" % (i, self.nfields )) + */ + __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset); + + /* "TabProxies.pyx":150 + * if i < 0: raise IndexError( "list index out of range" ) + * i += self.offset + * if i >= self.nfields: # <<<<<<<<<<<<<< + * raise IndexError( "list index out of range %i >= %i" % (i, self.nfields )) + * return self.fields[i] + */ + __pyx_t_1 = (__pyx_v_i >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); + if (__pyx_t_1) { + + /* "TabProxies.pyx":151 + * i += self.offset + * if i >= self.nfields: + * raise IndexError( "list index out of range %i >= %i" % (i, self.nfields )) # <<<<<<<<<<<<<< + * return self.fields[i] + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "TabProxies.pyx":152 + * if i >= self.nfields: + * raise IndexError( "list index out of range %i >= %i" % (i, self.nfields )) + * return self.fields[i] # <<<<<<<<<<<<<< + * + * def __getitem__( self, key ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyBytes_FromString((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("TabProxies.TupleProxy._getindex"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":154 + * return self.fields[i] + * + * def __getitem__( self, key ): # <<<<<<<<<<<<<< + * if type(key) == int: return self._getindex( key ) + * # slice object + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_start; + PyObject *__pyx_v_end; + PyObject *__pyx_v_step; + PyObject *__pyx_v_result; + PyObject *__pyx_v_index; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + __Pyx_RefNannySetupContext("__getitem__"); + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_end = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_step = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_index = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":155 + * + * def __getitem__( self, key ): + * if type(key) == int: return self._getindex( key ) # <<<<<<<<<<<<<< + * # slice object + * start, end, step = key.indices( self.nfields ) + */ + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_key)), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___getindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":157 + * if type(key) == int: return self._getindex( key ) + * # slice object + * start, end, step = key.indices( self.nfields ) # <<<<<<<<<<<<<< + * result = [] + * for index in range( start, end, step ): + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__indices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 3)) { + PyObject* tuple = __pyx_t_3; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_step); + __pyx_v_step = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_6, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_step); + __pyx_v_step = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "TabProxies.pyx":158 + * # slice object + * start, end, step = key.indices( self.nfields ) + * result = [] # <<<<<<<<<<<<<< + * for index in range( start, end, step ): + * result.append( self._getindex( index ) ) + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "TabProxies.pyx":159 + * start, end, step = key.indices( self.nfields ) + * result = [] + * for index in range( start, end, step ): # <<<<<<<<<<<<<< + * result.append( self._getindex( index ) ) + * return result + */ + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_step); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_step); + __Pyx_GIVEREF(__pyx_v_step); + __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = 0; __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_index); + __pyx_v_index = __pyx_t_5; + __pyx_t_5 = 0; + + /* "TabProxies.pyx":160 + * result = [] + * for index in range( start, end, step ): + * result.append( self._getindex( index ) ) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___getindex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_index); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_index); + __Pyx_GIVEREF(__pyx_v_index); + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_8 = PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "TabProxies.pyx":161 + * for index in range( start, end, step ): + * result.append( self._getindex( index ) ) + * return result # <<<<<<<<<<<<<< + * + * def _setindex( self, index, value ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("TabProxies.TupleProxy.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_start); + __Pyx_DECREF(__pyx_v_end); + __Pyx_DECREF(__pyx_v_step); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_index); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":163 + * return result + * + * def _setindex( self, index, value ): # <<<<<<<<<<<<<< + * '''set item at idx index.''' + * cdef int idx = index + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_4_setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_10TabProxies_10TupleProxy_4_setindex[] = "set item at idx index."; +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_4_setindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_index = 0; + PyObject *__pyx_v_value = 0; + int __pyx_v_idx; + char *__pyx_v_tmp; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("_setindex"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_setindex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_index = values[0]; + __pyx_v_value = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_index = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_setindex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("TabProxies.TupleProxy._setindex"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "TabProxies.pyx":165 + * def _setindex( self, index, value ): + * '''set item at idx index.''' + * cdef int idx = index # <<<<<<<<<<<<<< + * if idx < 0: raise IndexError( "list index out of range" ) + * if idx >= self.nfields: + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_idx = __pyx_t_1; + + /* "TabProxies.pyx":166 + * '''set item at idx index.''' + * cdef int idx = index + * if idx < 0: raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * if idx >= self.nfields: + * raise IndexError( "list index out of range" ) + */ + __pyx_t_2 = (__pyx_v_idx < 0); + if (__pyx_t_2) { + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "TabProxies.pyx":167 + * cdef int idx = index + * if idx < 0: raise IndexError( "list index out of range" ) + * if idx >= self.nfields: # <<<<<<<<<<<<<< + * raise IndexError( "list index out of range" ) + * + */ + __pyx_t_2 = (__pyx_v_idx >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); + if (__pyx_t_2) { + + /* "TabProxies.pyx":168 + * if idx < 0: raise IndexError( "list index out of range" ) + * if idx >= self.nfields: + * raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * + * if isNew( self.fields[idx], self.data, self.nbytes ): + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "TabProxies.pyx":170 + * raise IndexError( "list index out of range" ) + * + * if isNew( self.fields[idx], self.data, self.nbytes ): # <<<<<<<<<<<<<< + * free( self.fields[idx] ) + * + */ + __pyx_t_1 = __pyx_f_10TabProxies_isNew((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]), ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes); + if (__pyx_t_1) { + + /* "TabProxies.pyx":171 + * + * if isNew( self.fields[idx], self.data, self.nbytes ): + * free( self.fields[idx] ) # <<<<<<<<<<<<<< + * + * self.is_modified = 1 + */ + free((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx])); + goto __pyx_L8; + } + __pyx_L8:; + + /* "TabProxies.pyx":173 + * free( self.fields[idx] ) + * + * self.is_modified = 1 # <<<<<<<<<<<<<< + * + * if value == None: + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified = 1; + + /* "TabProxies.pyx":175 + * self.is_modified = 1 + * + * if value == None: # <<<<<<<<<<<<<< + * self.fields[idx] = NULL + * return + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_value, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "TabProxies.pyx":176 + * + * if value == None: + * self.fields[idx] = NULL # <<<<<<<<<<<<<< + * return + * + */ + (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) = NULL; + + /* "TabProxies.pyx":177 + * if value == None: + * self.fields[idx] = NULL + * return # <<<<<<<<<<<<<< + * + * # conversion with error checking + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "TabProxies.pyx":180 + * + * # conversion with error checking + * cdef char * tmp = PyString_AsString( value ) # <<<<<<<<<<<<<< + * self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) + * if self.fields[idx] == NULL: + */ + __pyx_t_4 = PyString_AsString(__pyx_v_value); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_tmp = __pyx_t_4; + + /* "TabProxies.pyx":181 + * # conversion with error checking + * cdef char * tmp = PyString_AsString( value ) + * self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) # <<<<<<<<<<<<<< + * if self.fields[idx] == NULL: + * raise ValueError("out of memory" ) + */ + (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) = ((char *)malloc(((strlen(__pyx_v_tmp) + 1) * (sizeof(char))))); + + /* "TabProxies.pyx":182 + * cdef char * tmp = PyString_AsString( value ) + * self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) + * if self.fields[idx] == NULL: # <<<<<<<<<<<<<< + * raise ValueError("out of memory" ) + * strcpy( self.fields[idx], tmp ) + */ + __pyx_t_2 = ((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]) == NULL); + if (__pyx_t_2) { + + /* "TabProxies.pyx":183 + * self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) + * if self.fields[idx] == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * strcpy( self.fields[idx], tmp ) + * + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "TabProxies.pyx":184 + * if self.fields[idx] == NULL: + * raise ValueError("out of memory" ) + * strcpy( self.fields[idx], tmp ) # <<<<<<<<<<<<<< + * + * def __setitem__(self, index, value ): + */ + strcpy((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_idx]), __pyx_v_tmp); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.TupleProxy._setindex"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":186 + * strcpy( self.fields[idx], tmp ) + * + * def __setitem__(self, index, value ): # <<<<<<<<<<<<<< + * '''set item at *index* to *value*''' + * cdef int i = index + */ + +static int __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_10TabProxies_10TupleProxy_5__setitem__[] = "set item at *index* to *value*"; +struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__; +static int __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { + int __pyx_v_i; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__setitem__"); + + /* "TabProxies.pyx":188 + * def __setitem__(self, index, value ): + * '''set item at *index* to *value*''' + * cdef int i = index # <<<<<<<<<<<<<< + * if i < 0: i += self.nfields + * i += self.offset + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_i = __pyx_t_1; + + /* "TabProxies.pyx":189 + * '''set item at *index* to *value*''' + * cdef int i = index + * if i < 0: i += self.nfields # <<<<<<<<<<<<<< + * i += self.offset + * + */ + __pyx_t_2 = (__pyx_v_i < 0); + if (__pyx_t_2) { + __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":190 + * cdef int i = index + * if i < 0: i += self.nfields + * i += self.offset # <<<<<<<<<<<<<< + * + * self._setindex( i, value ) + */ + __pyx_v_i = (__pyx_v_i + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->offset); + + /* "TabProxies.pyx":192 + * i += self.offset + * + * self._setindex( i, value ) # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___setindex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("TabProxies.TupleProxy.__setitem__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":194 + * self._setindex( i, value ) + * + * def __len__(self): # <<<<<<<<<<<<<< + * return self.nfields + * + */ + +static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy_6__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_10TabProxies_10TupleProxy_6__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannySetupContext("__len__"); + + /* "TabProxies.pyx":195 + * + * def __len__(self): + * return self.nfields # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":197 + * return self.nfields + * + * def __iter__(self): # <<<<<<<<<<<<<< + * self.index = 0 + * return self + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_7__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_7__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__iter__"); + + /* "TabProxies.pyx":198 + * + * def __iter__(self): + * self.index = 0 # <<<<<<<<<<<<<< + * return self + * + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = 0; + + /* "TabProxies.pyx":199 + * def __iter__(self): + * self.index = 0 + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":201 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * """ + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_8__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_10TabProxies_10TupleProxy_8__next__[] = "python version of next().\n "; +struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__; +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_8__next__(PyObject *__pyx_v_self) { + char *__pyx_v_retval; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__next__"); + + /* "TabProxies.pyx":204 + * """python version of next(). + * """ + * if self.index >= self.nfields: # <<<<<<<<<<<<<< + * raise StopIteration + * cdef char * retval = self.fields[self.index] + */ + __pyx_t_1 = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index >= ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields); + if (__pyx_t_1) { + + /* "TabProxies.pyx":205 + * """ + * if self.index >= self.nfields: + * raise StopIteration # <<<<<<<<<<<<<< + * cdef char * retval = self.fields[self.index] + * self.index += 1 + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":206 + * if self.index >= self.nfields: + * raise StopIteration + * cdef char * retval = self.fields[self.index] # <<<<<<<<<<<<<< + * self.index += 1 + * if retval == NULL: return None + */ + __pyx_v_retval = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index]); + + /* "TabProxies.pyx":207 + * raise StopIteration + * cdef char * retval = self.fields[self.index] + * self.index += 1 # <<<<<<<<<<<<<< + * if retval == NULL: return None + * else: return retval + */ + ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index = (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->index + 1); + + /* "TabProxies.pyx":208 + * cdef char * retval = self.fields[self.index] + * self.index += 1 + * if retval == NULL: return None # <<<<<<<<<<<<<< + * else: return retval + * + */ + __pyx_t_1 = (__pyx_v_retval == NULL); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L6; + } + /*else*/ { + + /* "TabProxies.pyx":209 + * self.index += 1 + * if retval == NULL: return None + * else: return retval # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("TabProxies.TupleProxy.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":211 + * else: return retval + * + * def __str__(self): # <<<<<<<<<<<<<< + * '''return original data''' + * # copy and replace \0 bytes with \t characters + */ + +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_9__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_10TabProxies_10TupleProxy_9__str__[] = "return original data"; +struct wrapperbase __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__; +static PyObject *__pyx_pf_10TabProxies_10TupleProxy_9__str__(PyObject *__pyx_v_self) { + char *__pyx_v_cpy; + long __pyx_v_x; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + long __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__str__"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":214 + * '''return original data''' + * # copy and replace \0 bytes with \t characters + * if self.is_modified: # <<<<<<<<<<<<<< + * # todo: treat NULL values + * return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] ) + */ + if (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->is_modified) { + + /* "TabProxies.pyx":216 + * if self.is_modified: + * # todo: treat NULL values + * return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] ) # <<<<<<<<<<<<<< + * else: + * cpy = calloc( sizeof(char), self.nbytes+1 ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nfields; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_x = __pyx_t_4; + __pyx_t_5 = PyBytes_FromString(__pyx_f_10TabProxies_StrOrEmpty((((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->fields[__pyx_v_x]))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + } + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "TabProxies.pyx":218 + * return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] ) + * else: + * cpy = calloc( sizeof(char), self.nbytes+1 ) # <<<<<<<<<<<<<< + * if cpy == NULL: + * raise ValueError("out of memory" ) + */ + __pyx_v_cpy = ((char *)calloc((sizeof(char)), (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes + 1))); + + /* "TabProxies.pyx":219 + * else: + * cpy = calloc( sizeof(char), self.nbytes+1 ) + * if cpy == NULL: # <<<<<<<<<<<<<< + * raise ValueError("out of memory" ) + * memcpy( cpy, self.data, self.nbytes+1) + */ + __pyx_t_6 = (__pyx_v_cpy == NULL); + if (__pyx_t_6) { + + /* "TabProxies.pyx":220 + * cpy = calloc( sizeof(char), self.nbytes+1 ) + * if cpy == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * memcpy( cpy, self.data, self.nbytes+1) + * for x from 0 <= x < self.nbytes: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "TabProxies.pyx":221 + * if cpy == NULL: + * raise ValueError("out of memory" ) + * memcpy( cpy, self.data, self.nbytes+1) # <<<<<<<<<<<<<< + * for x from 0 <= x < self.nbytes: + * if cpy[x] == '\0': cpy[x] = '\t' + */ + memcpy(__pyx_v_cpy, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->data, (((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes + 1)); + + /* "TabProxies.pyx":222 + * raise ValueError("out of memory" ) + * memcpy( cpy, self.data, self.nbytes+1) + * for x from 0 <= x < self.nbytes: # <<<<<<<<<<<<<< + * if cpy[x] == '\0': cpy[x] = '\t' + * result = PyString_FromStringAndSize(cpy, self.nbytes) + */ + __pyx_t_3 = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) { + + /* "TabProxies.pyx":223 + * memcpy( cpy, self.data, self.nbytes+1) + * for x from 0 <= x < self.nbytes: + * if cpy[x] == '\0': cpy[x] = '\t' # <<<<<<<<<<<<<< + * result = PyString_FromStringAndSize(cpy, self.nbytes) + * free(cpy) + */ + __pyx_t_6 = ((__pyx_v_cpy[__pyx_v_x]) == '\x00'); + if (__pyx_t_6) { + (__pyx_v_cpy[__pyx_v_x]) = '\t'; + goto __pyx_L11; + } + __pyx_L11:; + } + + /* "TabProxies.pyx":224 + * for x from 0 <= x < self.nbytes: + * if cpy[x] == '\0': cpy[x] = '\t' + * result = PyString_FromStringAndSize(cpy, self.nbytes) # <<<<<<<<<<<<<< + * free(cpy) + * return result + */ + __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_cpy, ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self)->nbytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "TabProxies.pyx":225 + * if cpy[x] == '\0': cpy[x] = '\t' + * result = PyString_FromStringAndSize(cpy, self.nbytes) + * free(cpy) # <<<<<<<<<<<<<< + * return result + * + */ + free(__pyx_v_cpy); + + /* "TabProxies.pyx":226 + * result = PyString_FromStringAndSize(cpy, self.nbytes) + * free(cpy) + * return result # <<<<<<<<<<<<<< + * + * def toDot( v ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("TabProxies.TupleProxy.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":228 + * return result + * + * def toDot( v ): # <<<<<<<<<<<<<< + * '''convert value to '.' if None''' + * if v == None: return "." + */ + +static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/ +static char __pyx_doc_10TabProxies_toDot[] = "convert value to '.' if None"; +static PyMethodDef __pyx_mdef_10TabProxies_toDot = {__Pyx_NAMESTR("toDot"), (PyCFunction)__pyx_pf_10TabProxies_toDot, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_toDot)}; +static PyObject *__pyx_pf_10TabProxies_toDot(PyObject *__pyx_self, PyObject *__pyx_v_v) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("toDot"); + __pyx_self = __pyx_self; + + /* "TabProxies.pyx":230 + * def toDot( v ): + * '''convert value to '.' if None''' + * if v == None: return "." # <<<<<<<<<<<<<< + * else: return str(v) + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_16)); + __pyx_r = ((PyObject *)__pyx_kp_s_16); + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "TabProxies.pyx":231 + * '''convert value to '.' if None''' + * if v == None: return "." + * else: return str(v) # <<<<<<<<<<<<<< + * + * def quote( v ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.toDot"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":233 + * else: return str(v) + * + * def quote( v ): # <<<<<<<<<<<<<< + * '''return a quoted attribute.''' + * if type(v) in types.StringTypes: + */ + +static PyObject *__pyx_pf_10TabProxies_1quote(PyObject *__pyx_self, PyObject *__pyx_v_v); /*proto*/ +static char __pyx_doc_10TabProxies_1quote[] = "return a quoted attribute."; +static PyMethodDef __pyx_mdef_10TabProxies_1quote = {__Pyx_NAMESTR("quote"), (PyCFunction)__pyx_pf_10TabProxies_1quote, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_1quote)}; +static PyObject *__pyx_pf_10TabProxies_1quote(PyObject *__pyx_self, PyObject *__pyx_v_v) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_RefNannySetupContext("quote"); + __pyx_self = __pyx_self; + + /* "TabProxies.pyx":235 + * def quote( v ): + * '''return a quoted attribute.''' + * if type(v) in types.StringTypes: # <<<<<<<<<<<<<< + * return '"%s"' % v + * else: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringTypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((PySequence_Contains(__pyx_t_2, ((PyObject *)Py_TYPE(__pyx_v_v))))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "TabProxies.pyx":236 + * '''return a quoted attribute.''' + * if type(v) in types.StringTypes: + * return '"%s"' % v # <<<<<<<<<<<<<< + * else: + * return str(v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "TabProxies.pyx":238 + * return '"%s"' % v + * else: + * return str(v) # <<<<<<<<<<<<<< + * + * cdef class GTFProxy( TupleProxy ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("TabProxies.quote"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":254 + * ''' + * + * def __cinit__(self ): # <<<<<<<<<<<<<< + * # automatically calls TupleProxy.__cinit__ + * self.hasOwnAttributes = False + */ + +static int __pyx_pf_10TabProxies_8GTFProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "TabProxies.pyx":256 + * def __cinit__(self ): + * # automatically calls TupleProxy.__cinit__ + * self.hasOwnAttributes = False # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":258 + * self.hasOwnAttributes = False + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * # automatically calls TupleProxy.__dealloc__ + * if self.hasOwnAttributes: + */ + +static void __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "TabProxies.pyx":260 + * def __dealloc__(self): + * # automatically calls TupleProxy.__dealloc__ + * if self.hasOwnAttributes: # <<<<<<<<<<<<<< + * free(self.attributes) + * + */ + if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes) { + + /* "TabProxies.pyx":261 + * # automatically calls TupleProxy.__dealloc__ + * if self.hasOwnAttributes: + * free(self.attributes) # <<<<<<<<<<<<<< + * + * cdef int getMaxFields( self, size_t nbytes ): + */ + free(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_RefNannyFinishContext(); +} + +/* "TabProxies.pyx":263 + * free(self.attributes) + * + * cdef int getMaxFields( self, size_t nbytes ): # <<<<<<<<<<<<<< + * '''return max number of fields.''' + * return 9 + */ + +static int __pyx_f_10TabProxies_8GTFProxy_getMaxFields(struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_self, size_t __pyx_v_nbytes) { + int __pyx_r; + __Pyx_RefNannySetupContext("getMaxFields"); + + /* "TabProxies.pyx":265 + * cdef int getMaxFields( self, size_t nbytes ): + * '''return max number of fields.''' + * return 9 # <<<<<<<<<<<<<< + * + * cdef update( self, char * buffer, size_t nbytes ): + */ + __pyx_r = 9; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":267 + * return 9 + * + * cdef update( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''update internal data. + * + */ + +static PyObject *__pyx_f_10TabProxies_8GTFProxy_update(struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + char *__pyx_v_cstart; + char *__pyx_v_cend; + char *__pyx_v_pos; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + __Pyx_RefNannySetupContext("update"); + + /* "TabProxies.pyx":274 + * cdef int end + * cdef char * cstart, * cend, * cscore + * self.contig = buffer # <<<<<<<<<<<<<< + * cdef char * pos + * + */ + __pyx_v_self->contig = __pyx_v_buffer; + + /* "TabProxies.pyx":277 + * cdef char * pos + * + * if buffer[nbytes] != 0: # <<<<<<<<<<<<<< + * raise ValueError( "incomplete line at %s" % buffer ) + * + */ + __pyx_t_1 = ((__pyx_v_buffer[__pyx_v_nbytes]) != 0); + if (__pyx_t_1) { + + /* "TabProxies.pyx":278 + * + * if buffer[nbytes] != 0: + * raise ValueError( "incomplete line at %s" % buffer ) # <<<<<<<<<<<<<< + * + * self.source = pos = nextItem( buffer ) + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":280 + * raise ValueError( "incomplete line at %s" % buffer ) + * + * self.source = pos = nextItem( buffer ) # <<<<<<<<<<<<<< + * self.feature = pos = nextItem( pos ) + * cstart = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_buffer); + __pyx_v_self->source = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":281 + * + * self.source = pos = nextItem( buffer ) + * self.feature = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * cstart = pos = nextItem( pos ) + * cend = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_self->feature = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":282 + * self.source = pos = nextItem( buffer ) + * self.feature = pos = nextItem( pos ) + * cstart = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * cend = pos = nextItem( pos ) + * self.score = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_cstart = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":283 + * self.feature = pos = nextItem( pos ) + * cstart = pos = nextItem( pos ) + * cend = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * self.score = pos = nextItem( pos ) + * self.strand = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_cend = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":284 + * cstart = pos = nextItem( pos ) + * cend = pos = nextItem( pos ) + * self.score = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * self.strand = pos = nextItem( pos ) + * self.frame = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_self->score = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":285 + * cend = pos = nextItem( pos ) + * self.score = pos = nextItem( pos ) + * self.strand = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * self.frame = pos = nextItem( pos ) + * self.attributes = pos = nextItem( pos ) + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_self->strand = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":286 + * self.score = pos = nextItem( pos ) + * self.strand = pos = nextItem( pos ) + * self.frame = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * self.attributes = pos = nextItem( pos ) + * + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_self->frame = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":287 + * self.strand = pos = nextItem( pos ) + * self.frame = pos = nextItem( pos ) + * self.attributes = pos = nextItem( pos ) # <<<<<<<<<<<<<< + * + * self.start = atoi( cstart ) - 1 + */ + __pyx_t_4 = __pyx_f_10TabProxies_nextItem(__pyx_v_pos); + __pyx_v_self->attributes = __pyx_t_4; + __pyx_v_pos = __pyx_t_4; + + /* "TabProxies.pyx":289 + * self.attributes = pos = nextItem( pos ) + * + * self.start = atoi( cstart ) - 1 # <<<<<<<<<<<<<< + * self.end = atoi( cend ) + * self.nfields = 9 + */ + __pyx_v_self->start = (atoi(__pyx_v_cstart) - 1); + + /* "TabProxies.pyx":290 + * + * self.start = atoi( cstart ) - 1 + * self.end = atoi( cend ) # <<<<<<<<<<<<<< + * self.nfields = 9 + * + */ + __pyx_v_self->end = atoi(__pyx_v_cend); + + /* "TabProxies.pyx":291 + * self.start = atoi( cstart ) - 1 + * self.end = atoi( cend ) + * self.nfields = 9 # <<<<<<<<<<<<<< + * + * property contig: + */ + __pyx_v_self->__pyx_base.nfields = 9; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.GTFProxy.update"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":295 + * property contig: + * '''contig of feature.''' + * def __get__( self ): return self.contig # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6contig___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6contig___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.contig.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":296 + * '''contig of feature.''' + * def __get__( self ): return self.contig + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.contig = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":297 + * def __get__( self ): return self.contig + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.contig = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":298 + * def __set__( self, value ): + * self.is_modified = True + * self.contig = value # <<<<<<<<<<<<<< + * + * property feature: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.contig.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":302 + * property feature: + * '''feature name.''' + * def __get__( self ): return self.feature # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7feature___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7feature___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.feature.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":303 + * '''feature name.''' + * def __get__( self ): return self.feature + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.feature = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":304 + * def __get__( self ): return self.feature + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.feature = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":305 + * def __set__( self, value ): + * self.is_modified = True + * self.feature = value # <<<<<<<<<<<<<< + * + * property source: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.feature.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":309 + * property source: + * '''feature source.''' + * def __get__( self ): return self.source # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6source___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6source___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.source.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":310 + * '''feature source.''' + * def __get__( self ): return self.source + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.source = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":311 + * def __get__( self ): return self.source + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.source = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":312 + * def __set__( self, value ): + * self.is_modified = True + * self.source = value # <<<<<<<<<<<<<< + * + * property start: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.source.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":316 + * property start: + * '''feature start (in 0-based open/closed coordinates).''' + * def __get__( self ): return self.start # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5start___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5start___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.start.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":317 + * '''feature start (in 0-based open/closed coordinates).''' + * def __get__( self ): return self.start + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.start = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + uint32_t __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":318 + * def __get__( self ): return self.start + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.start = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":319 + * def __set__( self, value ): + * self.is_modified = True + * self.start = value # <<<<<<<<<<<<<< + * + * property end: + */ + __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.start.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":323 + * property end: + * '''feature end (in 0-based open/closed coordinates).''' + * def __get__( self ): return self.end # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3end___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3end___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.end.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":324 + * '''feature end (in 0-based open/closed coordinates).''' + * def __get__( self ): return self.end + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.end = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + uint32_t __pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":325 + * def __get__( self ): return self.end + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.end = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":326 + * def __set__( self, value ): + * self.is_modified = True + * self.end = value # <<<<<<<<<<<<<< + * + * property score: + */ + __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.end.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":330 + * property score: + * '''feature score.''' + * def __get__( self ): # <<<<<<<<<<<<<< + * if self.score[0] == '.' and self.score[1] == '\0' : + * return None + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5score___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__get__"); + + /* "TabProxies.pyx":331 + * '''feature score.''' + * def __get__( self ): + * if self.score[0] == '.' and self.score[1] == '\0' : # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = ((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score[0]) == '.'); + if (__pyx_t_1) { + __pyx_t_2 = ((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score[1]) == '\x00'); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "TabProxies.pyx":332 + * def __get__( self ): + * if self.score[0] == '.' and self.score[1] == '\0' : + * return None # <<<<<<<<<<<<<< + * else: + * return atof(self.score) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "TabProxies.pyx":334 + * return None + * else: + * return atof(self.score) # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyFloat_FromDouble(atof(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("TabProxies.GTFProxy.score.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":335 + * else: + * return atof(self.score) + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.score = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":336 + * return atof(self.score) + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.score = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":337 + * def __set__( self, value ): + * self.is_modified = True + * self.score = value # <<<<<<<<<<<<<< + * + * property strand: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.score.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":341 + * property strand: + * '''feature strand.''' + * def __get__( self ): return self.strand # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6strand___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6strand___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.strand.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":342 + * '''feature strand.''' + * def __get__( self ): return self.strand + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.strand = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":343 + * def __get__( self ): return self.strand + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.strand = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":344 + * def __set__( self, value ): + * self.is_modified = True + * self.strand = value # <<<<<<<<<<<<<< + * + * property frame: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.strand.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":348 + * property frame: + * '''feature frame.''' + * def __get__( self ): return self.frame # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5frame___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5frame___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.frame.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":349 + * '''feature frame.''' + * def __get__( self ): return self.frame + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.frame = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":350 + * def __get__( self ): return self.frame + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.frame = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":351 + * def __set__( self, value ): + * self.is_modified = True + * self.frame = value # <<<<<<<<<<<<<< + * + * property attributes: + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.frame.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":355 + * property attributes: + * '''feature attributes (as a string).''' + * def __get__( self ): return self.attributes # <<<<<<<<<<<<<< + * def __set__( self, value ): + * self.is_modified = True + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.GTFProxy.attributes.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":356 + * '''feature attributes (as a string).''' + * def __get__( self ): return self.attributes + * def __set__( self, value ): # <<<<<<<<<<<<<< + * self.is_modified = True + * self.attributes = value + */ + +static int __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + char *__pyx_t_1; + __Pyx_RefNannySetupContext("__set__"); + + /* "TabProxies.pyx":357 + * def __get__( self ): return self.attributes + * def __set__( self, value ): + * self.is_modified = True # <<<<<<<<<<<<<< + * self.attributes = value + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + /* "TabProxies.pyx":358 + * def __set__( self, value ): + * self.is_modified = True + * self.attributes = value # <<<<<<<<<<<<<< + * + * def asDict( self ): + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.attributes.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":360 + * self.attributes = value + * + * def asDict( self ): # <<<<<<<<<<<<<< + * """parse attributes - return as dict + * """ + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_2asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_2asDict[] = "parse attributes - return as dict\n "; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_2asDict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + char *__pyx_v_attributes; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_result; + PyObject *__pyx_v_f; + PyObject *__pyx_v_d; + PyObject *__pyx_v_n; + PyObject *__pyx_v_v; + PyObject *__pyx_v_x; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + int __pyx_t_12; + __Pyx_RefNannySetupContext("asDict"); + __pyx_v_fields = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_n = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_x = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":365 + * + * # remove comments + * attributes = self.attributes # <<<<<<<<<<<<<< + * + * # separate into fields + */ + __pyx_v_attributes = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes; + + /* "TabProxies.pyx":368 + * + * # separate into fields + * fields = [ x.strip() for x in attributes.split(";")[:-1]] # <<<<<<<<<<<<<< + * + * result = {} + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyBytes_FromString(__pyx_v_attributes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_3, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = __pyx_t_1; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "TabProxies.pyx":370 + * fields = [ x.strip() for x in attributes.split(";")[:-1]] + * + * result = {} # <<<<<<<<<<<<<< + * + * for f in fields: + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "TabProxies.pyx":372 + * result = {} + * + * for f in fields: # <<<<<<<<<<<<<< + * + * d = [ x.strip() for x in f.split(" ")] + */ + if (unlikely(__pyx_v_fields == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields); __Pyx_INCREF(__pyx_t_1); + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + + /* "TabProxies.pyx":374 + * for f in fields: + * + * d = [ x.strip() for x in f.split(" ")] # <<<<<<<<<<<<<< + * + * n,v = d[0], d[1] + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(PyList_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_v_d)); + __pyx_v_d = __pyx_t_3; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "TabProxies.pyx":376 + * d = [ x.strip() for x in f.split(" ")] + * + * n,v = d[0], d[1] # <<<<<<<<<<<<<< + * if len(d) > 2: v = d[1:] + * + */ + __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_d), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + + /* "TabProxies.pyx":377 + * + * n,v = d[0], d[1] + * if len(d) > 2: v = d[1:] # <<<<<<<<<<<<<< + * + * if v[0] == '"' and v[-1] == '"': + */ + if (unlikely(__pyx_v_d == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_d)); + __pyx_t_8 = (__pyx_t_6 > 2); + if (__pyx_t_8) { + __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_d), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "TabProxies.pyx":379 + * if len(d) > 2: v = d[1:] + * + * if v[0] == '"' and v[-1] == '"': # <<<<<<<<<<<<<< + * v = v[1:-1] + * else: + */ + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_v, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_22), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_8) { + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_v, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_22), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_8; + } + if (__pyx_t_10) { + + /* "TabProxies.pyx":380 + * + * if v[0] == '"' and v[-1] == '"': + * v = v[1:-1] # <<<<<<<<<<<<<< + * else: + * ## try to convert to a value + */ + __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_v, 1, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L12; + } + /*else*/ { + + /* "TabProxies.pyx":383 + * else: + * ## try to convert to a value + * try: # <<<<<<<<<<<<<< + * v = float( v ) + * v = int( v ) + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "TabProxies.pyx":384 + * ## try to convert to a value + * try: + * v = float( v ) # <<<<<<<<<<<<<< + * v = int( v ) + * except ValueError: + */ + __pyx_t_11 = __Pyx_PyObject_AsDouble(__pyx_v_v); if (unlikely(__pyx_t_11 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + + /* "TabProxies.pyx":385 + * try: + * v = float( v ) + * v = int( v ) # <<<<<<<<<<<<<< + * except ValueError: + * pass + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_3; + __pyx_t_3 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L20_try_end; + __pyx_L13_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "TabProxies.pyx":386 + * v = float( v ) + * v = int( v ) + * except ValueError: # <<<<<<<<<<<<<< + * pass + * except TypeError: + */ + __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_12) { + PyErr_Restore(0,0,0); + goto __pyx_L14_exception_handled; + } + + /* "TabProxies.pyx":388 + * except ValueError: + * pass + * except TypeError: # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_12) { + PyErr_Restore(0,0,0); + goto __pyx_L14_exception_handled; + } + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L14_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L20_try_end:; + } + } + __pyx_L12:; + + /* "TabProxies.pyx":391 + * pass + * + * result[n] = v # <<<<<<<<<<<<<< + * + * return result + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_n, __pyx_v_v) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":393 + * result[n] = v + * + * return result # <<<<<<<<<<<<<< + * + * def fromDict( self, d ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("TabProxies.GTFProxy.asDict"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_d); + __Pyx_DECREF(__pyx_v_n); + __Pyx_DECREF(__pyx_v_v); + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":395 + * return result + * + * def fromDict( self, d ): # <<<<<<<<<<<<<< + * '''set attributes from a dictionary.''' + * cdef char * p + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_3fromDict[] = "set attributes from a dictionary."; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_3fromDict(PyObject *__pyx_v_self, PyObject *__pyx_v_d) { + char *__pyx_v_p; + int __pyx_v_l; + PyObject *__pyx_v_aa; + PyObject *__pyx_v_k; + PyObject *__pyx_v_v; + PyObject *__pyx_v_a; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("fromDict"); + __pyx_v_aa = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_a = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":401 + * + * # clean up if this field is set twice + * if self.hasOwnAttributes: # <<<<<<<<<<<<<< + * free(self.attributes) + * + */ + if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes) { + + /* "TabProxies.pyx":402 + * # clean up if this field is set twice + * if self.hasOwnAttributes: + * free(self.attributes) # <<<<<<<<<<<<<< + * + * aa = [] + */ + free(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":404 + * free(self.attributes) + * + * aa = [] # <<<<<<<<<<<<<< + * for k,v in d.items(): + * if type(v) == types.StringType: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_aa)); + __pyx_v_aa = __pyx_t_1; + __pyx_t_1 = 0; + + /* "TabProxies.pyx":405 + * + * aa = [] + * for k,v in d.items(): # <<<<<<<<<<<<<< + * if type(v) == types.StringType: + * aa.append( '%s "%s"' % (k,v) ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_d, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "TabProxies.pyx":406 + * aa = [] + * for k,v in d.items(): + * if type(v) == types.StringType: # <<<<<<<<<<<<<< + * aa.append( '%s "%s"' % (k,v) ) + * else: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__StringType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + + /* "TabProxies.pyx":407 + * for k,v in d.items(): + * if type(v) == types.StringType: + * aa.append( '%s "%s"' % (k,v) ) # <<<<<<<<<<<<<< + * else: + * aa.append( '%s %s' % (k,str(v)) ) + */ + if (unlikely(__pyx_v_aa == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_8 = PyList_Append(__pyx_v_aa, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "TabProxies.pyx":409 + * aa.append( '%s "%s"' % (k,v) ) + * else: + * aa.append( '%s %s' % (k,str(v)) ) # <<<<<<<<<<<<<< + * + * a = "; ".join( aa ) + ";" + */ + if (unlikely(__pyx_v_aa == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_8 = PyList_Append(__pyx_v_aa, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":411 + * aa.append( '%s %s' % (k,str(v)) ) + * + * a = "; ".join( aa ) + ";" # <<<<<<<<<<<<<< + * p = a + * l = len(a) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_25), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_v_aa)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_aa)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_aa)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_3; + __pyx_t_3 = 0; + + /* "TabProxies.pyx":412 + * + * a = "; ".join( aa ) + ";" + * p = a # <<<<<<<<<<<<<< + * l = len(a) + * self.attributes = calloc( l + 1, sizeof(char) ) + */ + __pyx_t_9 = PyBytes_AsString(__pyx_v_a); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_p = __pyx_t_9; + + /* "TabProxies.pyx":413 + * a = "; ".join( aa ) + ";" + * p = a + * l = len(a) # <<<<<<<<<<<<<< + * self.attributes = calloc( l + 1, sizeof(char) ) + * if self.attributes == NULL: + */ + __pyx_t_2 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_l = __pyx_t_2; + + /* "TabProxies.pyx":414 + * p = a + * l = len(a) + * self.attributes = calloc( l + 1, sizeof(char) ) # <<<<<<<<<<<<<< + * if self.attributes == NULL: + * raise ValueError("out of memory" ) + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes = ((char *)calloc((__pyx_v_l + 1), (sizeof(char)))); + + /* "TabProxies.pyx":415 + * l = len(a) + * self.attributes = calloc( l + 1, sizeof(char) ) + * if self.attributes == NULL: # <<<<<<<<<<<<<< + * raise ValueError("out of memory" ) + * memcpy( self.attributes, p, l ) + */ + __pyx_t_7 = (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes == NULL); + if (__pyx_t_7) { + + /* "TabProxies.pyx":416 + * self.attributes = calloc( l + 1, sizeof(char) ) + * if self.attributes == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * memcpy( self.attributes, p, l ) + * + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "TabProxies.pyx":417 + * if self.attributes == NULL: + * raise ValueError("out of memory" ) + * memcpy( self.attributes, p, l ) # <<<<<<<<<<<<<< + * + * self.hasOwnAttributes = True + */ + memcpy(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes, __pyx_v_p, __pyx_v_l); + + /* "TabProxies.pyx":419 + * memcpy( self.attributes, p, l ) + * + * self.hasOwnAttributes = True # <<<<<<<<<<<<<< + * self.is_modified = True + * + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->hasOwnAttributes = 1; + + /* "TabProxies.pyx":420 + * + * self.hasOwnAttributes = True + * self.is_modified = True # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified = 1; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("TabProxies.GTFProxy.fromDict"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_aa); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_v); + __Pyx_DECREF(__pyx_v_a); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":422 + * self.is_modified = True + * + * def __str__(self): # <<<<<<<<<<<<<< + * cdef char * cpy + * cdef int x + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_4__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_4__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__str__"); + + /* "TabProxies.pyx":426 + * cdef int x + * + * if self.is_modified: # <<<<<<<<<<<<<< + * return "\t".join( + * (self.contig, + */ + if (((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->__pyx_base.is_modified) { + + /* "TabProxies.pyx":427 + * + * if self.is_modified: + * return "\t".join( # <<<<<<<<<<<<<< + * (self.contig, + * self.source, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "TabProxies.pyx":428 + * if self.is_modified: + * return "\t".join( + * (self.contig, # <<<<<<<<<<<<<< + * self.source, + * self.feature, + */ + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "TabProxies.pyx":429 + * return "\t".join( + * (self.contig, + * self.source, # <<<<<<<<<<<<<< + * self.feature, + * str(self.start+1), + */ + __pyx_t_3 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->source); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + + /* "TabProxies.pyx":430 + * (self.contig, + * self.source, + * self.feature, # <<<<<<<<<<<<<< + * str(self.start+1), + * str(self.end), + */ + __pyx_t_4 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->feature); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + + /* "TabProxies.pyx":431 + * self.source, + * self.feature, + * str(self.start+1), # <<<<<<<<<<<<<< + * str(self.end), + * toDot(self.score), + */ + __pyx_t_5 = PyInt_FromLong((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + + /* "TabProxies.pyx":432 + * self.feature, + * str(self.start+1), + * str(self.end), # <<<<<<<<<<<<<< + * toDot(self.score), + * self.strand, + */ + __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + + /* "TabProxies.pyx":433 + * str(self.start+1), + * str(self.end), + * toDot(self.score), # <<<<<<<<<<<<<< + * self.strand, + * self.frame, + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__toDot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->score); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + + /* "TabProxies.pyx":434 + * str(self.end), + * toDot(self.score), + * self.strand, # <<<<<<<<<<<<<< + * self.frame, + * self.attributes ) ) + */ + __pyx_t_9 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + + /* "TabProxies.pyx":435 + * toDot(self.score), + * self.strand, + * self.frame, # <<<<<<<<<<<<<< + * self.attributes ) ) + * else: + */ + __pyx_t_7 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->frame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + + /* "TabProxies.pyx":436 + * self.strand, + * self.frame, + * self.attributes ) ) # <<<<<<<<<<<<<< + * else: + * return TupleProxy.__str__(self) + */ + __pyx_t_10 = PyBytes_FromString(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_11 = PyTuple_New(9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_11, 7, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_11, 8, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_7 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "TabProxies.pyx":438 + * self.attributes ) ) + * else: + * return TupleProxy.__str__(self) # <<<<<<<<<<<<<< + * + * def invert( self, int lcontig ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_11 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("TabProxies.GTFProxy.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":440 + * return TupleProxy.__str__(self) + * + * def invert( self, int lcontig ): # <<<<<<<<<<<<<< + * '''invert coordinates to negative strand coordinates + * + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_5invert[] = "invert coordinates to negative strand coordinates\n \n This method will only act if the feature is on the\n negative strand."; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_5invert(PyObject *__pyx_v_self, PyObject *__pyx_arg_lcontig) { + int __pyx_v_lcontig; + PyObject *__pyx_v_start; + PyObject *__pyx_v_end; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + uint32_t __pyx_t_2; + uint32_t __pyx_t_3; + uint32_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("invert"); + assert(__pyx_arg_lcontig); { + __pyx_v_lcontig = __Pyx_PyInt_AsInt(__pyx_arg_lcontig); if (unlikely((__pyx_v_lcontig == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.invert"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_end = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":446 + * negative strand.''' + * + * if self.strand[0] == '-': # <<<<<<<<<<<<<< + * start = min(self.start, self.end) + * end = max(self.start, self.end) + */ + __pyx_t_1 = ((((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->strand[0]) == '-'); + if (__pyx_t_1) { + + /* "TabProxies.pyx":447 + * + * if self.strand[0] == '-': + * start = min(self.start, self.end) # <<<<<<<<<<<<<< + * end = max(self.start, self.end) + * self.start, self.end = lcontig - end, lcontig - start + */ + __pyx_t_2 = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end; + __pyx_t_3 = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start; + if ((__pyx_t_2 < __pyx_t_3)) { + __pyx_t_4 = __pyx_t_2; + } else { + __pyx_t_4 = __pyx_t_3; + } + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_5; + __pyx_t_5 = 0; + + /* "TabProxies.pyx":448 + * if self.strand[0] == '-': + * start = min(self.start, self.end) + * end = max(self.start, self.end) # <<<<<<<<<<<<<< + * self.start, self.end = lcontig - end, lcontig - start + * + */ + __pyx_t_4 = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end; + __pyx_t_2 = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start; + if ((__pyx_t_4 > __pyx_t_2)) { + __pyx_t_3 = __pyx_t_4; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_5; + __pyx_t_5 = 0; + + /* "TabProxies.pyx":449 + * start = min(self.start, self.end) + * end = max(self.start, self.end) + * self.start, self.end = lcontig - end, lcontig - start # <<<<<<<<<<<<<< + * + * def keys( self ): + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Subtract(__pyx_t_5, __pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_6); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromLong(__pyx_v_lcontig); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_4 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->start = __pyx_t_3; + ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->end = __pyx_t_4; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("TabProxies.GTFProxy.invert"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_start); + __Pyx_DECREF(__pyx_v_end); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":451 + * self.start, self.end = lcontig - end, lcontig - start + * + * def keys( self ): # <<<<<<<<<<<<<< + * '''return a list of attributes defined in this entry.''' + * r = self.attributes + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_6keys[] = "return a list of attributes defined in this entry."; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_6keys(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + char *__pyx_v_r; + PyObject *__pyx_v_x; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("keys"); + __pyx_v_x = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":453 + * def keys( self ): + * '''return a list of attributes defined in this entry.''' + * r = self.attributes # <<<<<<<<<<<<<< + * return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ] + * + */ + __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes; + + /* "TabProxies.pyx":454 + * '''return a list of attributes defined in this entry.''' + * r = self.attributes + * return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ] # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_t_3), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); + } else { + __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_4); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_2), Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + __pyx_t_3 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__strip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7; + } + __pyx_L7:; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("TabProxies.GTFProxy.keys"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":456 + * return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ] + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * return self.__getattr__( key ) + * + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__getitem__"); + + /* "TabProxies.pyx":457 + * + * def __getitem__(self, key): + * return self.__getattr__( key ) # <<<<<<<<<<<<<< + * + * def __getattr__(self, item ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattr__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.GTFProxy.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":459 + * return self.__getattr__( key ) + * + * def __getattr__(self, item ): # <<<<<<<<<<<<<< + * """Generic lookup of attribute from GFF/GTF attributes + * Only called if there *isn't* an attribute with this name + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_8__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_8__getattr__[] = "Generic lookup of attribute from GFF/GTF attributes \n Only called if there *isn't* an attribute with this name\n "; +struct wrapperbase __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_8__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { + char *__pyx_v_start; + char *__pyx_v_query; + char *__pyx_v_end; + int __pyx_v_l; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + char *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__getattr__"); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":468 + * cdef char * end + * cdef int l + * query = item # <<<<<<<<<<<<<< + * + * start = strstr( self.attributes, query) + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_item); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_query = __pyx_t_1; + + /* "TabProxies.pyx":470 + * query = item + * + * start = strstr( self.attributes, query) # <<<<<<<<<<<<<< + * if start == NULL: + * raise AttributeError("'GTFProxy' has no attribute '%s'" % item ) + */ + __pyx_v_start = strstr(((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_v_self)->attributes, __pyx_v_query); + + /* "TabProxies.pyx":471 + * + * start = strstr( self.attributes, query) + * if start == NULL: # <<<<<<<<<<<<<< + * raise AttributeError("'GTFProxy' has no attribute '%s'" % item ) + * + */ + __pyx_t_2 = (__pyx_v_start == NULL); + if (__pyx_t_2) { + + /* "TabProxies.pyx":472 + * start = strstr( self.attributes, query) + * if start == NULL: + * raise AttributeError("'GTFProxy' has no attribute '%s'" % item ) # <<<<<<<<<<<<<< + * + * start += strlen(query) + 1 + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), __pyx_v_item); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":474 + * raise AttributeError("'GTFProxy' has no attribute '%s'" % item ) + * + * start += strlen(query) + 1 # <<<<<<<<<<<<<< + * # skip gaps before + * while start[0] == ' ': start += 1 + */ + __pyx_v_start = (__pyx_v_start + (strlen(__pyx_v_query) + 1)); + + /* "TabProxies.pyx":476 + * start += strlen(query) + 1 + * # skip gaps before + * while start[0] == ' ': start += 1 # <<<<<<<<<<<<<< + * if start[0] == '"': + * start += 1 + */ + while (1) { + __pyx_t_2 = ((__pyx_v_start[0]) == ' '); + if (!__pyx_t_2) break; + __pyx_v_start = (__pyx_v_start + 1); + } + + /* "TabProxies.pyx":477 + * # skip gaps before + * while start[0] == ' ': start += 1 + * if start[0] == '"': # <<<<<<<<<<<<<< + * start += 1 + * end = start + */ + __pyx_t_2 = ((__pyx_v_start[0]) == '"'); + if (__pyx_t_2) { + + /* "TabProxies.pyx":478 + * while start[0] == ' ': start += 1 + * if start[0] == '"': + * start += 1 # <<<<<<<<<<<<<< + * end = start + * while end[0] != '\0' and end[0] != '"': end += 1 + */ + __pyx_v_start = (__pyx_v_start + 1); + + /* "TabProxies.pyx":479 + * if start[0] == '"': + * start += 1 + * end = start # <<<<<<<<<<<<<< + * while end[0] != '\0' and end[0] != '"': end += 1 + * l = end - start + */ + __pyx_v_end = __pyx_v_start; + + /* "TabProxies.pyx":480 + * start += 1 + * end = start + * while end[0] != '\0' and end[0] != '"': end += 1 # <<<<<<<<<<<<<< + * l = end - start + * result = PyString_FromStringAndSize( start, l ) + */ + while (1) { + __pyx_t_2 = ((__pyx_v_end[0]) != '\x00'); + if (__pyx_t_2) { + __pyx_t_5 = ((__pyx_v_end[0]) != '"'); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_2; + } + if (!__pyx_t_6) break; + __pyx_v_end = (__pyx_v_end + 1); + } + + /* "TabProxies.pyx":481 + * end = start + * while end[0] != '\0' and end[0] != '"': end += 1 + * l = end - start # <<<<<<<<<<<<<< + * result = PyString_FromStringAndSize( start, l ) + * return result + */ + __pyx_v_l = (__pyx_v_end - __pyx_v_start); + + /* "TabProxies.pyx":482 + * while end[0] != '\0' and end[0] != '"': end += 1 + * l = end - start + * result = PyString_FromStringAndSize( start, l ) # <<<<<<<<<<<<<< + * return result + * else: + */ + __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_start, __pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "TabProxies.pyx":483 + * l = end - start + * result = PyString_FromStringAndSize( start, l ) + * return result # <<<<<<<<<<<<<< + * else: + * return start + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + goto __pyx_L8; + } + /*else*/ { + + /* "TabProxies.pyx":485 + * return result + * else: + * return start # <<<<<<<<<<<<<< + * + * def setAttribute( self, name, value ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyBytes_FromString(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + } + __pyx_L8:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("TabProxies.GTFProxy.__getattr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":487 + * return start + * + * def setAttribute( self, name, value ): # <<<<<<<<<<<<<< + * '''convenience method to set an attribute.''' + * r = self.asDict() + */ + +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_9setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_10TabProxies_8GTFProxy_9setAttribute[] = "convenience method to set an attribute."; +static PyObject *__pyx_pf_10TabProxies_8GTFProxy_9setAttribute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,&__pyx_n_s__value,0}; + __Pyx_RefNannySetupContext("setAttribute"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setAttribute") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_name = values[0]; + __pyx_v_value = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_name = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setAttribute", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("TabProxies.GTFProxy.setAttribute"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":489 + * def setAttribute( self, name, value ): + * '''convenience method to set an attribute.''' + * r = self.asDict() # <<<<<<<<<<<<<< + * r[name] = value + * self.fromDict( r ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__asDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_r); + __pyx_v_r = __pyx_t_2; + __pyx_t_2 = 0; + + /* "TabProxies.pyx":490 + * '''convenience method to set an attribute.''' + * r = self.asDict() + * r[name] = value # <<<<<<<<<<<<<< + * self.fromDict( r ) + * + */ + if (PyObject_SetItem(__pyx_v_r, __pyx_v_name, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "TabProxies.pyx":491 + * r = self.asDict() + * r[name] = value + * self.fromDict( r ) # <<<<<<<<<<<<<< + * + * cdef class NamedTupleProxy( TupleProxy ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fromDict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_r); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_r); + __Pyx_GIVEREF(__pyx_v_r); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.GTFProxy.setAttribute"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":497 + * map_key2field = {} + * + * def __setattr__(self, key, value ): # <<<<<<<<<<<<<< + * '''set attribute.''' + * cdef int idx + */ + +static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_10TabProxies_15NamedTupleProxy___setattr__[] = "set attribute."; +struct wrapperbase __pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__; +static int __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + int __pyx_v_idx; + PyObject *__pyx_v_f; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__setattr__"); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":500 + * '''set attribute.''' + * cdef int idx + * idx, f = self.map_key2field[key] # <<<<<<<<<<<<<< + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_idx = __pyx_t_4; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = __pyx_t_4; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "TabProxies.pyx":501 + * cdef int idx + * idx, f = self.map_key2field[key] + * if self.nfields < idx: # <<<<<<<<<<<<<< + * raise KeyError( "field %s not set" % key ) + * TupleProxy.__setitem__(self, idx, str(value) ) + */ + __pyx_t_6 = (((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.nfields < __pyx_v_idx); + if (__pyx_t_6) { + + /* "TabProxies.pyx":502 + * idx, f = self.map_key2field[key] + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) # <<<<<<<<<<<<<< + * TupleProxy.__setitem__(self, idx, str(value) ) + * + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":503 + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) + * TupleProxy.__setitem__(self, idx, str(value) ) # <<<<<<<<<<<<<< + * + * def __getattr__(self, key ): + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____setitem__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("TabProxies.NamedTupleProxy.__setattr__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":505 + * TupleProxy.__setitem__(self, idx, str(value) ) + * + * def __getattr__(self, key ): # <<<<<<<<<<<<<< + * cdef int idx + * idx, f = self.map_key2field[key] + */ + +static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + int __pyx_v_idx; + PyObject *__pyx_v_f; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__getattr__"); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":507 + * def __getattr__(self, key ): + * cdef int idx + * idx, f = self.map_key2field[key] # <<<<<<<<<<<<<< + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_idx = __pyx_t_4; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_idx = __pyx_t_4; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "TabProxies.pyx":508 + * cdef int idx + * idx, f = self.map_key2field[key] + * if self.nfields < idx: # <<<<<<<<<<<<<< + * raise KeyError( "field %s not set" % key ) + * return f( self.fields[idx] ) + */ + __pyx_t_6 = (((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.nfields < __pyx_v_idx); + if (__pyx_t_6) { + + /* "TabProxies.pyx":509 + * idx, f = self.map_key2field[key] + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) # <<<<<<<<<<<<<< + * return f( self.fields[idx] ) + * + */ + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":510 + * if self.nfields < idx: + * raise KeyError( "field %s not set" % key ) + * return f( self.fields[idx] ) # <<<<<<<<<<<<<< + * + * cdef class BedProxy( NamedTupleProxy ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_10TabProxies_NamedTupleProxy *)__pyx_v_self)->__pyx_base.fields[__pyx_v_idx])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_v_f, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("TabProxies.NamedTupleProxy.__getattr__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":531 + * 'blockStarts': (11,str), } + * + * cdef int getMaxFields( self, size_t nbytes ): # <<<<<<<<<<<<<< + * '''return max number of fields.''' + * return 12 + */ + +static int __pyx_f_10TabProxies_8BedProxy_getMaxFields(struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_self, size_t __pyx_v_nbytes) { + int __pyx_r; + __Pyx_RefNannySetupContext("getMaxFields"); + + /* "TabProxies.pyx":533 + * cdef int getMaxFields( self, size_t nbytes ): + * '''return max number of fields.''' + * return 12 # <<<<<<<<<<<<<< + * + * cdef update( self, char * buffer, size_t nbytes ): + */ + __pyx_r = 12; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":535 + * return 12 + * + * cdef update( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''update internal data. + * + */ + +static PyObject *__pyx_f_10TabProxies_8BedProxy_update(struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("update"); + + /* "TabProxies.pyx":540 + * nbytes does not include the terminal '\0'. + * ''' + * TupleProxy.update( self, buffer, nbytes ) # <<<<<<<<<<<<<< + * + * if self.nfields < 3: + */ + __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":542 + * TupleProxy.update( self, buffer, nbytes ) + * + * if self.nfields < 3: # <<<<<<<<<<<<<< + * raise ValueError( "bed format requires at least three columns" ) + * + */ + __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx_base.nfields < 3); + if (__pyx_t_2) { + + /* "TabProxies.pyx":543 + * + * if self.nfields < 3: + * raise ValueError( "bed format requires at least three columns" ) # <<<<<<<<<<<<<< + * + * # determines bed format + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "TabProxies.pyx":546 + * + * # determines bed format + * self.bedfields = self.nfields # <<<<<<<<<<<<<< + * + * # do automatic conversion + */ + __pyx_v_self->bedfields = __pyx_v_self->__pyx_base.__pyx_base.nfields; + + /* "TabProxies.pyx":549 + * + * # do automatic conversion + * self.contig = self.fields[0] # <<<<<<<<<<<<<< + * self.start = atoi( self.fields[1] ) + * self.end = atoi( self.fields[2] ) + */ + __pyx_v_self->contig = (__pyx_v_self->__pyx_base.__pyx_base.fields[0]); + + /* "TabProxies.pyx":550 + * # do automatic conversion + * self.contig = self.fields[0] + * self.start = atoi( self.fields[1] ) # <<<<<<<<<<<<<< + * self.end = atoi( self.fields[2] ) + * + */ + __pyx_v_self->start = atoi((__pyx_v_self->__pyx_base.__pyx_base.fields[1])); + + /* "TabProxies.pyx":551 + * self.contig = self.fields[0] + * self.start = atoi( self.fields[1] ) + * self.end = atoi( self.fields[2] ) # <<<<<<<<<<<<<< + * + * # __setattr__ in base class seems to take precedence + */ + __pyx_v_self->end = atoi((__pyx_v_self->__pyx_base.__pyx_base.fields[2])); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.BedProxy.update"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":560 + * # def __get__( self ): return self.end + * + * def __str__(self): # <<<<<<<<<<<<<< + * + * cdef int save_fields = self.nfields + */ + +static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8BedProxy___str__(PyObject *__pyx_v_self) { + int __pyx_v_save_fields; + PyObject *__pyx_v_retval; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__str__"); + __pyx_v_retval = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":562 + * def __str__(self): + * + * cdef int save_fields = self.nfields # <<<<<<<<<<<<<< + * # ensure fields to use correct format + * self.nfields = self.bedfields + */ + __pyx_v_save_fields = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields; + + /* "TabProxies.pyx":564 + * cdef int save_fields = self.nfields + * # ensure fields to use correct format + * self.nfields = self.bedfields # <<<<<<<<<<<<<< + * retval = TupleProxy.__str__( self ) + * self.nfields = save_fields + */ + ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->bedfields; + + /* "TabProxies.pyx":565 + * # ensure fields to use correct format + * self.nfields = self.bedfields + * retval = TupleProxy.__str__( self ) # <<<<<<<<<<<<<< + * self.nfields = save_fields + * return retval + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s____str__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_retval); + __pyx_v_retval = __pyx_t_3; + __pyx_t_3 = 0; + + /* "TabProxies.pyx":566 + * self.nfields = self.bedfields + * retval = TupleProxy.__str__( self ) + * self.nfields = save_fields # <<<<<<<<<<<<<< + * return retval + * + */ + ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields = __pyx_v_save_fields; + + /* "TabProxies.pyx":567 + * retval = TupleProxy.__str__( self ) + * self.nfields = save_fields + * return retval # <<<<<<<<<<<<<< + * + * def __setattr__(self, key, value ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_retval); + __pyx_r = __pyx_v_retval; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("TabProxies.BedProxy.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_retval); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":569 + * return retval + * + * def __setattr__(self, key, value ): # <<<<<<<<<<<<<< + * '''set attribute.''' + * if key == "start": self.start = value + */ + +static int __pyx_pf_10TabProxies_8BedProxy_1__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_10TabProxies_8BedProxy_1__setattr__[] = "set attribute."; +struct wrapperbase __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__; +static int __pyx_pf_10TabProxies_8BedProxy_1__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + int __pyx_v_idx; + PyObject *__pyx_v_f; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + uint32_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__setattr__"); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":571 + * def __setattr__(self, key, value ): + * '''set attribute.''' + * if key == "start": self.start = value # <<<<<<<<<<<<<< + * elif key == "end": self.end = value + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__start), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->start = __pyx_t_3; + goto __pyx_L5; + } + + /* "TabProxies.pyx":572 + * '''set attribute.''' + * if key == "start": self.start = value + * elif key == "end": self.end = value # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__end), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_v_self)->end = __pyx_t_3; + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":575 + * + * cdef int idx + * idx, f = self.map_key2field[key] # <<<<<<<<<<<<<< + * TupleProxy._setindex(self, idx, str(value) ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_idx = __pyx_t_6; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_idx = __pyx_t_6; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "TabProxies.pyx":576 + * cdef int idx + * idx, f = self.map_key2field[key] + * TupleProxy._setindex(self, idx, str(value) ) # <<<<<<<<<<<<<< + * + * cdef class VCFProxy( NamedTupleProxy ): + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("TabProxies.BedProxy.__setattr__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":594 + * 'format' : (8,str) } + * + * def __cinit__(self ): # <<<<<<<<<<<<<< + * # automatically calls TupleProxy.__cinit__ + * # start indexed access at genotypes + */ + +static int __pyx_pf_10TabProxies_8VCFProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_10TabProxies_8VCFProxy___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "TabProxies.pyx":597 + * # automatically calls TupleProxy.__cinit__ + * # start indexed access at genotypes + * self.offset = 9 # <<<<<<<<<<<<<< + * + * cdef update( self, char * buffer, size_t nbytes ): + */ + ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->__pyx_base.__pyx_base.offset = 9; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":599 + * self.offset = 9 + * + * cdef update( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''update internal data. + * + */ + +static PyObject *__pyx_f_10TabProxies_8VCFProxy_update(struct __pyx_obj_10TabProxies_VCFProxy *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("update"); + + /* "TabProxies.pyx":604 + * nbytes does not include the terminal '\0'. + * ''' + * TupleProxy.update( self, buffer, nbytes ) # <<<<<<<<<<<<<< + * + * self.contig = self.fields[0] + */ + __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":606 + * TupleProxy.update( self, buffer, nbytes ) + * + * self.contig = self.fields[0] # <<<<<<<<<<<<<< + * # vcf counts from 1 - correct here + * self.pos = atoi( self.fields[1] ) - 1 + */ + __pyx_v_self->contig = (__pyx_v_self->__pyx_base.__pyx_base.fields[0]); + + /* "TabProxies.pyx":608 + * self.contig = self.fields[0] + * # vcf counts from 1 - correct here + * self.pos = atoi( self.fields[1] ) - 1 # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_v_self->pos = (atoi((__pyx_v_self->__pyx_base.__pyx_base.fields[1])) - 1); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.VCFProxy.update"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":610 + * self.pos = atoi( self.fields[1] ) - 1 + * + * def __len__(self): # <<<<<<<<<<<<<< + * return max(0, self.nfields - 9) + * + */ + +static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy_1__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_10TabProxies_8VCFProxy_1__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + __Pyx_RefNannySetupContext("__len__"); + + /* "TabProxies.pyx":611 + * + * def __len__(self): + * return max(0, self.nfields - 9) # <<<<<<<<<<<<<< + * + * property pos: + */ + __pyx_t_1 = (((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->__pyx_base.__pyx_base.nfields - 9); + __pyx_t_2 = 0; + if ((__pyx_t_1 > __pyx_t_2)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":615 + * property pos: + * '''feature end (in 0-based open/closed coordinates).''' + * def __get__( self ): # <<<<<<<<<<<<<< + * return self.pos + * + */ + +static PyObject *__pyx_pf_10TabProxies_8VCFProxy_3pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_10TabProxies_8VCFProxy_3pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + + /* "TabProxies.pyx":616 + * '''feature end (in 0-based open/closed coordinates).''' + * def __get__( self ): + * return self.pos # <<<<<<<<<<<<<< + * + * def __setattr__(self, key, value ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("TabProxies.VCFProxy.pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "TabProxies.pyx":618 + * return self.pos + * + * def __setattr__(self, key, value ): # <<<<<<<<<<<<<< + * '''set attribute.''' + * if key == "pos": + */ + +static int __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_10TabProxies_8VCFProxy_2__setattr__[] = "set attribute."; +struct wrapperbase __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__; +static int __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) { + int __pyx_v_idx; + PyObject *__pyx_v_f; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + uint32_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__setattr__"); + __Pyx_INCREF(__pyx_v_value); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "TabProxies.pyx":620 + * def __setattr__(self, key, value ): + * '''set attribute.''' + * if key == "pos": # <<<<<<<<<<<<<< + * self.pos = value + * value += 1 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__pos), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "TabProxies.pyx":621 + * '''set attribute.''' + * if key == "pos": + * self.pos = value # <<<<<<<<<<<<<< + * value += 1 + * + */ + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_v_self)->pos = __pyx_t_3; + + /* "TabProxies.pyx":622 + * if key == "pos": + * self.pos = value + * value += 1 # <<<<<<<<<<<<<< + * + * cdef int idx + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_value, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "TabProxies.pyx":625 + * + * cdef int idx + * idx, f = self.map_key2field[key] # <<<<<<<<<<<<<< + * TupleProxy._setindex(self, idx, str(value) ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__map_key2field); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_idx = __pyx_t_6; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_idx = __pyx_t_6; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "TabProxies.pyx":626 + * cdef int idx + * idx, f = self.map_key2field[key] + * TupleProxy._setindex(self, idx, str(value) ) # <<<<<<<<<<<<<< + * + */ + __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), __pyx_n_s___setindex); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("TabProxies.VCFProxy.__setattr__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_vtable_10TabProxies_TupleProxy; + +static PyObject *__pyx_tp_new_10TabProxies_TupleProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_10TabProxies_TupleProxy *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_10TabProxies_TupleProxy *)o); + p->__pyx_vtab = __pyx_vtabptr_10TabProxies_TupleProxy; + if (__pyx_pf_10TabProxies_10TupleProxy___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_10TabProxies_TupleProxy(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_10TabProxies_10TupleProxy_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} +static PyObject *__pyx_sq_item_10TabProxies_TupleProxy(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static int __pyx_mp_ass_subscript_10TabProxies_TupleProxy(PyObject *o, PyObject *i, PyObject *v) { + if (v) { + return __pyx_pf_10TabProxies_10TupleProxy_5__setitem__(o, i, v); + } + else { + PyErr_Format(PyExc_NotImplementedError, + "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + return -1; + } +} + +static PyMethodDef __pyx_methods_10TabProxies_TupleProxy[] = { + {__Pyx_NAMESTR("_getindex"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_2_getindex, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_2_getindex)}, + {__Pyx_NAMESTR("_setindex"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_4_setindex, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_4_setindex)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_10TabProxies_10TupleProxy_8__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_10TupleProxy_8__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_TupleProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_TupleProxy = { + __pyx_pf_10TabProxies_10TupleProxy_6__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_10TabProxies_TupleProxy, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_TupleProxy = { + __pyx_pf_10TabProxies_10TupleProxy_6__len__, /*mp_length*/ + __pyx_pf_10TabProxies_10TupleProxy_3__getitem__, /*mp_subscript*/ + __pyx_mp_ass_subscript_10TabProxies_TupleProxy, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_TupleProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_10TabProxies_TupleProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("TabProxies.TupleProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_10TabProxies_TupleProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10TabProxies_TupleProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_TupleProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_TupleProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_TupleProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_10TabProxies_10TupleProxy_9__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_TupleProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Proxy class for access to parsed row as a tuple.\n\n This class represents a table row for fast read-access.\n\n Access to individual fields is via the [] operator.\n \n Only read-only access is implemented.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_10TabProxies_10TupleProxy_7__iter__, /*tp_iter*/ + __pyx_pf_10TabProxies_10TupleProxy_8__next__, /*tp_iternext*/ + __pyx_methods_10TabProxies_TupleProxy, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_10TabProxies_TupleProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_10TabProxies_GTFProxy __pyx_vtable_10TabProxies_GTFProxy; + +static PyObject *__pyx_tp_new_10TabProxies_GTFProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_10TabProxies_GTFProxy *p; + PyObject *o = __pyx_tp_new_10TabProxies_TupleProxy(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_10TabProxies_GTFProxy *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_10TabProxies_GTFProxy; + if (__pyx_pf_10TabProxies_8GTFProxy___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_10TabProxies_GTFProxy(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_10TabProxies_8GTFProxy_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_10TabProxies_TupleProxy(o); +} +static PyObject *__pyx_sq_item_10TabProxies_GTFProxy(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_tp_getattro_10TabProxies_GTFProxy(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_pf_10TabProxies_8GTFProxy_8__getattr__(o, n); + } + return v; +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_contig(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_6contig___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_contig(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_6contig_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_feature(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_7feature___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_feature(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_7feature_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_source(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_6source___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_source(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_6source_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_start(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_5start___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_start(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_5start_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_end(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_3end___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_end(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_3end_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_score(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_5score___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_score(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_5score_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_strand(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_6strand___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_strand(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_6strand_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_frame(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_5frame___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_frame(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_5frame_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_10TabProxies_8GTFProxy_attributes(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8GTFProxy_10attributes___get__(o); +} + +static int __pyx_setprop_10TabProxies_8GTFProxy_attributes(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_10TabProxies_8GTFProxy_10attributes_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyMethodDef __pyx_methods_10TabProxies_GTFProxy[] = { + {__Pyx_NAMESTR("asDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_2asDict, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_2asDict)}, + {__Pyx_NAMESTR("fromDict"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_3fromDict, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_3fromDict)}, + {__Pyx_NAMESTR("invert"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_5invert, METH_O, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_5invert)}, + {__Pyx_NAMESTR("keys"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_6keys, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_6keys)}, + {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_8__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_8__getattr__)}, + {__Pyx_NAMESTR("setAttribute"), (PyCFunction)__pyx_pf_10TabProxies_8GTFProxy_9setAttribute, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_10TabProxies_8GTFProxy_9setAttribute)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_10TabProxies_GTFProxy[] = { + {(char *)"contig", __pyx_getprop_10TabProxies_8GTFProxy_contig, __pyx_setprop_10TabProxies_8GTFProxy_contig, __Pyx_DOCSTR(__pyx_k_33), 0}, + {(char *)"feature", __pyx_getprop_10TabProxies_8GTFProxy_feature, __pyx_setprop_10TabProxies_8GTFProxy_feature, __Pyx_DOCSTR(__pyx_k_34), 0}, + {(char *)"source", __pyx_getprop_10TabProxies_8GTFProxy_source, __pyx_setprop_10TabProxies_8GTFProxy_source, __Pyx_DOCSTR(__pyx_k_35), 0}, + {(char *)"start", __pyx_getprop_10TabProxies_8GTFProxy_start, __pyx_setprop_10TabProxies_8GTFProxy_start, __Pyx_DOCSTR(__pyx_k_36), 0}, + {(char *)"end", __pyx_getprop_10TabProxies_8GTFProxy_end, __pyx_setprop_10TabProxies_8GTFProxy_end, __Pyx_DOCSTR(__pyx_k_37), 0}, + {(char *)"score", __pyx_getprop_10TabProxies_8GTFProxy_score, __pyx_setprop_10TabProxies_8GTFProxy_score, __Pyx_DOCSTR(__pyx_k_38), 0}, + {(char *)"strand", __pyx_getprop_10TabProxies_8GTFProxy_strand, __pyx_setprop_10TabProxies_8GTFProxy_strand, __Pyx_DOCSTR(__pyx_k_39), 0}, + {(char *)"frame", __pyx_getprop_10TabProxies_8GTFProxy_frame, __pyx_setprop_10TabProxies_8GTFProxy_frame, __Pyx_DOCSTR(__pyx_k_40), 0}, + {(char *)"attributes", __pyx_getprop_10TabProxies_8GTFProxy_attributes, __pyx_setprop_10TabProxies_8GTFProxy_attributes, __Pyx_DOCSTR(__pyx_k_41), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_GTFProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_GTFProxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_10TabProxies_GTFProxy, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_GTFProxy = { + 0, /*mp_length*/ + __pyx_pf_10TabProxies_8GTFProxy_7__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_GTFProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_10TabProxies_GTFProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("TabProxies.GTFProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_10TabProxies_GTFProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10TabProxies_GTFProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_GTFProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_GTFProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_GTFProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_10TabProxies_8GTFProxy_4__str__, /*tp_str*/ + __pyx_tp_getattro_10TabProxies_GTFProxy, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_GTFProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Proxy class for access to GTF fields.\n\n This class represents a GTF entry for fast read-access.\n Write-access has been added as well, though some care must\n be taken. If any of the string fields (contig, source, ...)\n are set, the new value is tied to the lifetime of the\n argument that was supplied.\n\n The only exception is the attributes field when set from\n a dictionary - this field will manage its own memory.\n\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_10TabProxies_GTFProxy, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_10TabProxies_GTFProxy, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_10TabProxies_GTFProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_vtable_10TabProxies_NamedTupleProxy; + +static PyObject *__pyx_tp_new_10TabProxies_NamedTupleProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_10TabProxies_NamedTupleProxy *p; + PyObject *o = __pyx_tp_new_10TabProxies_TupleProxy(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_10TabProxies_NamedTupleProxy *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_10TabProxies_NamedTupleProxy; + return o; +} + +static PyObject *__pyx_tp_getattro_10TabProxies_NamedTupleProxy(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__(o, n); + } + return v; +} + +static int __pyx_tp_setattro_10TabProxies_NamedTupleProxy(PyObject *o, PyObject *n, PyObject *v) { + if (v) { + return __pyx_pf_10TabProxies_15NamedTupleProxy___setattr__(o, n, v); + } + else { + if (__pyx_ptype_10TabProxies_TupleProxy->tp_setattro) + return __pyx_ptype_10TabProxies_TupleProxy->tp_setattro(o, n, v); + return PyObject_GenericSetAttr(o, n, 0); + } +} + +static PyMethodDef __pyx_methods_10TabProxies_NamedTupleProxy[] = { + {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_10TabProxies_15NamedTupleProxy_1__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_NamedTupleProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_NamedTupleProxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_NamedTupleProxy = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_NamedTupleProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_10TabProxies_NamedTupleProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("TabProxies.NamedTupleProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10TabProxies_TupleProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_NamedTupleProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_NamedTupleProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_NamedTupleProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + __pyx_tp_getattro_10TabProxies_NamedTupleProxy, /*tp_getattro*/ + __pyx_tp_setattro_10TabProxies_NamedTupleProxy, /*tp_setattro*/ + &__pyx_tp_as_buffer_NamedTupleProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_10TabProxies_NamedTupleProxy, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_10TabProxies_NamedTupleProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_10TabProxies_BedProxy __pyx_vtable_10TabProxies_BedProxy; + +static PyObject *__pyx_tp_new_10TabProxies_BedProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_10TabProxies_BedProxy *p; + PyObject *o = __pyx_tp_new_10TabProxies_TupleProxy(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_10TabProxies_BedProxy *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_10TabProxies_BedProxy; + return o; +} + +static int __pyx_tp_setattro_10TabProxies_BedProxy(PyObject *o, PyObject *n, PyObject *v) { + if (v) { + return __pyx_pf_10TabProxies_8BedProxy_1__setattr__(o, n, v); + } + else { + if (__pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro) + return __pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro(o, n, v); + return PyObject_GenericSetAttr(o, n, 0); + } +} + +static PyMethodDef __pyx_methods_10TabProxies_BedProxy[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BedProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BedProxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BedProxy = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BedProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_10TabProxies_BedProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("TabProxies.BedProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_10TabProxies_BedProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10TabProxies_TupleProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BedProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_BedProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BedProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_10TabProxies_8BedProxy___str__, /*tp_str*/ + 0, /*tp_getattro*/ + __pyx_tp_setattro_10TabProxies_BedProxy, /*tp_setattro*/ + &__pyx_tp_as_buffer_BedProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Proxy class for access to Bed fields.\n\n This class represents a GTF entry for fast read-access.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_10TabProxies_BedProxy, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_10TabProxies_BedProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_10TabProxies_VCFProxy __pyx_vtable_10TabProxies_VCFProxy; + +static PyObject *__pyx_tp_new_10TabProxies_VCFProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_10TabProxies_VCFProxy *p; + PyObject *o = __pyx_tp_new_10TabProxies_TupleProxy(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_10TabProxies_VCFProxy *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_10TabProxies_VCFProxy; + if (__pyx_pf_10TabProxies_8VCFProxy___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static int __pyx_tp_setattro_10TabProxies_VCFProxy(PyObject *o, PyObject *n, PyObject *v) { + if (v) { + return __pyx_pf_10TabProxies_8VCFProxy_2__setattr__(o, n, v); + } + else { + if (__pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro) + return __pyx_ptype_10TabProxies_NamedTupleProxy->tp_setattro(o, n, v); + return PyObject_GenericSetAttr(o, n, 0); + } +} + +static PyObject *__pyx_getprop_10TabProxies_8VCFProxy_pos(PyObject *o, void *x) { + return __pyx_pf_10TabProxies_8VCFProxy_3pos___get__(o); +} + +static PyMethodDef __pyx_methods_10TabProxies_VCFProxy[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_10TabProxies_VCFProxy[] = { + {(char *)"pos", __pyx_getprop_10TabProxies_8VCFProxy_pos, 0, __Pyx_DOCSTR(__pyx_k_37), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_VCFProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_VCFProxy = { + __pyx_pf_10TabProxies_8VCFProxy_1__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_VCFProxy = { + __pyx_pf_10TabProxies_8VCFProxy_1__len__, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_VCFProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_10TabProxies_VCFProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("TabProxies.VCFProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_10TabProxies_VCFProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10TabProxies_TupleProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_VCFProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_VCFProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VCFProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + __pyx_tp_setattro_10TabProxies_VCFProxy, /*tp_setattro*/ + &__pyx_tp_as_buffer_VCFProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Proxy class for access to VCF fields.\n\n The genotypes are accessed via index.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_10TabProxies_VCFProxy, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_10TabProxies_VCFProxy, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_10TabProxies_VCFProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("TabProxies"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, + {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, + {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, + {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0}, + {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1}, + {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, + {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s__StringType, __pyx_k__StringType, sizeof(__pyx_k__StringType), 0, 0, 1, 1}, + {&__pyx_n_s__StringTypes, __pyx_k__StringTypes, sizeof(__pyx_k__StringTypes), 0, 0, 1, 1}, + {&__pyx_n_s__TabProxies, __pyx_k__TabProxies, sizeof(__pyx_k__TabProxies), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____getattr__, __pyx_k____getattr__, sizeof(__pyx_k____getattr__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____setitem__, __pyx_k____setitem__, sizeof(__pyx_k____setitem__), 0, 0, 1, 1}, + {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___getindex, __pyx_k___getindex, sizeof(__pyx_k___getindex), 0, 0, 1, 1}, + {&__pyx_n_s___setindex, __pyx_k___setindex, sizeof(__pyx_k___setindex), 0, 0, 1, 1}, + {&__pyx_n_s__alt, __pyx_k__alt, sizeof(__pyx_k__alt), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__asDict, __pyx_k__asDict, sizeof(__pyx_k__asDict), 0, 0, 1, 1}, + {&__pyx_n_s__attributes, __pyx_k__attributes, sizeof(__pyx_k__attributes), 0, 0, 1, 1}, + {&__pyx_n_s__bedfields, __pyx_k__bedfields, sizeof(__pyx_k__bedfields), 0, 0, 1, 1}, + {&__pyx_n_s__blockCount, __pyx_k__blockCount, sizeof(__pyx_k__blockCount), 0, 0, 1, 1}, + {&__pyx_n_s__blockSizes, __pyx_k__blockSizes, sizeof(__pyx_k__blockSizes), 0, 0, 1, 1}, + {&__pyx_n_s__blockStarts, __pyx_k__blockStarts, sizeof(__pyx_k__blockStarts), 0, 0, 1, 1}, + {&__pyx_n_s__contig, __pyx_k__contig, sizeof(__pyx_k__contig), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__feature, __pyx_k__feature, sizeof(__pyx_k__feature), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__filter, __pyx_k__filter, sizeof(__pyx_k__filter), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__frame, __pyx_k__frame, sizeof(__pyx_k__frame), 0, 0, 1, 1}, + {&__pyx_n_s__fromDict, __pyx_k__fromDict, sizeof(__pyx_k__fromDict), 0, 0, 1, 1}, + {&__pyx_n_s__getMaxFields, __pyx_k__getMaxFields, sizeof(__pyx_k__getMaxFields), 0, 0, 1, 1}, + {&__pyx_n_s__hasOwnAttributes, __pyx_k__hasOwnAttributes, sizeof(__pyx_k__hasOwnAttributes), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, + {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1}, + {&__pyx_n_s__is_modified, __pyx_k__is_modified, sizeof(__pyx_k__is_modified), 0, 0, 1, 1}, + {&__pyx_n_s__itemRGB, __pyx_k__itemRGB, sizeof(__pyx_k__itemRGB), 0, 0, 1, 1}, + {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__map_key2field, __pyx_k__map_key2field, sizeof(__pyx_k__map_key2field), 0, 0, 1, 1}, + {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, + {&__pyx_n_s__nbytes, __pyx_k__nbytes, sizeof(__pyx_k__nbytes), 0, 0, 1, 1}, + {&__pyx_n_s__nfields, __pyx_k__nfields, sizeof(__pyx_k__nfields), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1}, + {&__pyx_n_s__quote, __pyx_k__quote, sizeof(__pyx_k__quote), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1}, + {&__pyx_n_s__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1}, + {&__pyx_n_s__source, __pyx_k__source, sizeof(__pyx_k__source), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__strand, __pyx_k__strand, sizeof(__pyx_k__strand), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__thickEnd, __pyx_k__thickEnd, sizeof(__pyx_k__thickEnd), 0, 0, 1, 1}, + {&__pyx_n_s__thickStart, __pyx_k__thickStart, sizeof(__pyx_k__thickStart), 0, 0, 1, 1}, + {&__pyx_n_s__toDot, __pyx_k__toDot, sizeof(__pyx_k__toDot), 0, 0, 1, 1}, + {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1}, + {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "TabProxies.pyx":77 + * self.data = malloc( s ) + * if self.data == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * self.nbytes = nbytes + * memcpy( self.data, buffer, s ) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "TabProxies.pyx":119 + * self.fields = calloc( max_fields, sizeof(char *) ) + * if self.fields == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * + * ################################# + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "TabProxies.pyx":148 + * cdef int i = index + * if i < 0: i += self.nfields + * if i < 0: raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * i += self.offset + * if i >= self.nfields: + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "TabProxies.pyx":166 + * '''set item at idx index.''' + * cdef int idx = index + * if idx < 0: raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * if idx >= self.nfields: + * raise IndexError( "list index out of range" ) + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "TabProxies.pyx":168 + * if idx < 0: raise IndexError( "list index out of range" ) + * if idx >= self.nfields: + * raise IndexError( "list index out of range" ) # <<<<<<<<<<<<<< + * + * if isNew( self.fields[idx], self.data, self.nbytes ): + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "TabProxies.pyx":183 + * self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) + * if self.fields[idx] == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * strcpy( self.fields[idx], tmp ) + * + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "TabProxies.pyx":220 + * cpy = calloc( sizeof(char), self.nbytes+1 ) + * if cpy == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * memcpy( cpy, self.data, self.nbytes+1) + * for x from 0 <= x < self.nbytes: + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "TabProxies.pyx":368 + * + * # separate into fields + * fields = [ x.strip() for x in attributes.split(";")[:-1]] # <<<<<<<<<<<<<< + * + * result = {} + */ + __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + + /* "TabProxies.pyx":374 + * for f in fields: + * + * d = [ x.strip() for x in f.split(" ")] # <<<<<<<<<<<<<< + * + * n,v = d[0], d[1] + */ + __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + + /* "TabProxies.pyx":416 + * self.attributes = calloc( l + 1, sizeof(char) ) + * if self.attributes == NULL: + * raise ValueError("out of memory" ) # <<<<<<<<<<<<<< + * memcpy( self.attributes, p, l ) + * + */ + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "TabProxies.pyx":454 + * '''return a list of attributes defined in this entry.''' + * r = self.attributes + * return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ] # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + + /* "TabProxies.pyx":543 + * + * if self.nfields < 3: + * raise ValueError( "bed format requires at least three columns" ) # <<<<<<<<<<<<<< + * + * # determines bed format + */ + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initTabProxies(void); /*proto*/ +PyMODINIT_FUNC initTabProxies(void) +#else +PyMODINIT_FUNC PyInit_TabProxies(void); /*proto*/ +PyMODINIT_FUNC PyInit_TabProxies(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_TabProxies(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("TabProxies"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_TabProxies) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_10TabProxies_TupleProxy = &__pyx_vtable_10TabProxies_TupleProxy; + __pyx_vtable_10TabProxies_TupleProxy.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_10TupleProxy_getMaxFields; + __pyx_vtable_10TabProxies_TupleProxy.take = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_take; + __pyx_vtable_10TabProxies_TupleProxy.present = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_present; + __pyx_vtable_10TabProxies_TupleProxy.copy = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_copy; + __pyx_vtable_10TabProxies_TupleProxy.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_10TupleProxy_update; + if (PyType_Ready(&__pyx_type_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__.doc = __pyx_doc_10TabProxies_10TupleProxy_5__setitem__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_5__setitem__; + } + } + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__.doc = __pyx_doc_10TabProxies_10TupleProxy_8__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_8__next__; + } + } + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_TupleProxy, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__.doc = __pyx_doc_10TabProxies_10TupleProxy_9__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_10TupleProxy_9__str__; + } + } + if (__Pyx_SetVtable(__pyx_type_10TabProxies_TupleProxy.tp_dict, __pyx_vtabptr_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TupleProxy", (PyObject *)&__pyx_type_10TabProxies_TupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_TupleProxy = &__pyx_type_10TabProxies_TupleProxy; + __pyx_vtabptr_10TabProxies_GTFProxy = &__pyx_vtable_10TabProxies_GTFProxy; + __pyx_vtable_10TabProxies_GTFProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy; + __pyx_vtable_10TabProxies_GTFProxy.__pyx_base.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_8GTFProxy_getMaxFields; + __pyx_vtable_10TabProxies_GTFProxy.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8GTFProxy_update; + __pyx_type_10TabProxies_GTFProxy.tp_base = __pyx_ptype_10TabProxies_TupleProxy; + if (PyType_Ready(&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_GTFProxy, "__getattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__.doc = __pyx_doc_10TabProxies_8GTFProxy_8__getattr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8GTFProxy_8__getattr__; + } + } + if (__Pyx_SetVtable(__pyx_type_10TabProxies_GTFProxy.tp_dict, __pyx_vtabptr_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "GTFProxy", (PyObject *)&__pyx_type_10TabProxies_GTFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_GTFProxy = &__pyx_type_10TabProxies_GTFProxy; + __pyx_vtabptr_10TabProxies_NamedTupleProxy = &__pyx_vtable_10TabProxies_NamedTupleProxy; + __pyx_vtable_10TabProxies_NamedTupleProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy; + __pyx_type_10TabProxies_NamedTupleProxy.tp_base = __pyx_ptype_10TabProxies_TupleProxy; + if (PyType_Ready(&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__.doc = __pyx_doc_10TabProxies_15NamedTupleProxy___setattr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_15NamedTupleProxy___setattr__; + } + } + if (__Pyx_SetVtable(__pyx_type_10TabProxies_NamedTupleProxy.tp_dict, __pyx_vtabptr_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "NamedTupleProxy", (PyObject *)&__pyx_type_10TabProxies_NamedTupleProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_NamedTupleProxy = &__pyx_type_10TabProxies_NamedTupleProxy; + __pyx_vtabptr_10TabProxies_BedProxy = &__pyx_vtable_10TabProxies_BedProxy; + __pyx_vtable_10TabProxies_BedProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_NamedTupleProxy; + __pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.getMaxFields = (int (*)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t))__pyx_f_10TabProxies_8BedProxy_getMaxFields; + __pyx_vtable_10TabProxies_BedProxy.__pyx_base.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8BedProxy_update; + __pyx_type_10TabProxies_BedProxy.tp_base = __pyx_ptype_10TabProxies_NamedTupleProxy; + if (PyType_Ready(&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_BedProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__.doc = __pyx_doc_10TabProxies_8BedProxy_1__setattr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8BedProxy_1__setattr__; + } + } + if (__Pyx_SetVtable(__pyx_type_10TabProxies_BedProxy.tp_dict, __pyx_vtabptr_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BedProxy", (PyObject *)&__pyx_type_10TabProxies_BedProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_BedProxy = &__pyx_type_10TabProxies_BedProxy; + __pyx_vtabptr_10TabProxies_VCFProxy = &__pyx_vtable_10TabProxies_VCFProxy; + __pyx_vtable_10TabProxies_VCFProxy.__pyx_base = *__pyx_vtabptr_10TabProxies_NamedTupleProxy; + __pyx_vtable_10TabProxies_VCFProxy.__pyx_base.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_10TabProxies_8VCFProxy_update; + __pyx_type_10TabProxies_VCFProxy.tp_base = __pyx_ptype_10TabProxies_NamedTupleProxy; + if (PyType_Ready(&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_10TabProxies_VCFProxy, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__.doc = __pyx_doc_10TabProxies_8VCFProxy_2__setattr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_10TabProxies_8VCFProxy_2__setattr__; + } + } + if (__Pyx_SetVtable(__pyx_type_10TabProxies_VCFProxy.tp_dict, __pyx_vtabptr_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "VCFProxy", (PyObject *)&__pyx_type_10TabProxies_VCFProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_VCFProxy = &__pyx_type_10TabProxies_VCFProxy; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "TabProxies.pyx":1 + * import types # <<<<<<<<<<<<<< + * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":228 + * return result + * + * def toDot( v ): # <<<<<<<<<<<<<< + * '''convert value to '.' if None''' + * if v == None: return "." + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10TabProxies_toDot, NULL, __pyx_n_s__TabProxies); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__toDot, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":233 + * else: return str(v) + * + * def quote( v ): # <<<<<<<<<<<<<< + * '''return a quoted attribute.''' + * if type(v) in types.StringTypes: + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10TabProxies_1quote, NULL, __pyx_n_s__TabProxies); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__quote, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "TabProxies.pyx":495 + * cdef class NamedTupleProxy( TupleProxy ): + * + * map_key2field = {} # <<<<<<<<<<<<<< + * + * def __setattr__(self, key, value ): + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_10TabProxies_NamedTupleProxy); + + /* "TabProxies.pyx":517 + * This class represents a GTF entry for fast read-access. + * ''' + * map_key2field = { # <<<<<<<<<<<<<< + * 'contig' : (0, str), + * 'start' : (1, int), + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "TabProxies.pyx":518 + * ''' + * map_key2field = { + * 'contig' : (0, str), # <<<<<<<<<<<<<< + * 'start' : (1, int), + * 'end' : (2, int), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":519 + * map_key2field = { + * 'contig' : (0, str), + * 'start' : (1, int), # <<<<<<<<<<<<<< + * 'end' : (2, int), + * 'name' : (3, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__start), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":520 + * 'contig' : (0, str), + * 'start' : (1, int), + * 'end' : (2, int), # <<<<<<<<<<<<<< + * 'name' : (3, str), + * 'score' : (4, float), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__end), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":521 + * 'start' : (1, int), + * 'end' : (2, int), + * 'name' : (3, str), # <<<<<<<<<<<<<< + * 'score' : (4, float), + * 'strand' : (5, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":522 + * 'end' : (2, int), + * 'name' : (3, str), + * 'score' : (4, float), # <<<<<<<<<<<<<< + * 'strand' : (5, str), + * 'thickStart' : (6,int ), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_4); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyFloat_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__score), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":523 + * 'name' : (3, str), + * 'score' : (4, float), + * 'strand' : (5, str), # <<<<<<<<<<<<<< + * 'thickStart' : (6,int ), + * 'thickEnd' : (7,int), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__strand), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":524 + * 'score' : (4, float), + * 'strand' : (5, str), + * 'thickStart' : (6,int ), # <<<<<<<<<<<<<< + * 'thickEnd' : (7,int), + * 'itemRGB' : (8,str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_6); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickStart), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":525 + * 'strand' : (5, str), + * 'thickStart' : (6,int ), + * 'thickEnd' : (7,int), # <<<<<<<<<<<<<< + * 'itemRGB' : (8,str), + * 'blockCount': (9,int), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_7); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_7); + __Pyx_GIVEREF(__pyx_int_7); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__thickEnd), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":526 + * 'thickStart' : (6,int ), + * 'thickEnd' : (7,int), + * 'itemRGB' : (8,str), # <<<<<<<<<<<<<< + * 'blockCount': (9,int), + * 'blockSizes': (10,str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_8); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__itemRGB), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":527 + * 'thickEnd' : (7,int), + * 'itemRGB' : (8,str), + * 'blockCount': (9,int), # <<<<<<<<<<<<<< + * 'blockSizes': (10,str), + * 'blockStarts': (11,str), } + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_9); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_9); + __Pyx_GIVEREF(__pyx_int_9); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockCount), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":528 + * 'itemRGB' : (8,str), + * 'blockCount': (9,int), + * 'blockSizes': (10,str), # <<<<<<<<<<<<<< + * 'blockStarts': (11,str), } + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_10); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_10); + __Pyx_GIVEREF(__pyx_int_10); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockSizes), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":529 + * 'blockCount': (9,int), + * 'blockSizes': (10,str), + * 'blockStarts': (11,str), } # <<<<<<<<<<<<<< + * + * cdef int getMaxFields( self, size_t nbytes ): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_11); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_11); + __Pyx_GIVEREF(__pyx_int_11); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__blockStarts), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_BedProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_10TabProxies_BedProxy); + + /* "TabProxies.pyx":583 + * The genotypes are accessed via index. + * ''' + * map_key2field = { # <<<<<<<<<<<<<< + * 'contig' : (0, str), + * 'pos' : (1, int), + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "TabProxies.pyx":584 + * ''' + * map_key2field = { + * 'contig' : (0, str), # <<<<<<<<<<<<<< + * 'pos' : (1, int), + * 'id' : (2, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__contig), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":585 + * map_key2field = { + * 'contig' : (0, str), + * 'pos' : (1, int), # <<<<<<<<<<<<<< + * 'id' : (2, str), + * 'ref' : (3, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyInt_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":586 + * 'contig' : (0, str), + * 'pos' : (1, int), + * 'id' : (2, str), # <<<<<<<<<<<<<< + * 'ref' : (3, str), + * 'alt' : (4, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__id), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":587 + * 'pos' : (1, int), + * 'id' : (2, str), + * 'ref' : (3, str), # <<<<<<<<<<<<<< + * 'alt' : (4, str), + * 'qual' : (5, str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ref), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":588 + * 'id' : (2, str), + * 'ref' : (3, str), + * 'alt' : (4, str), # <<<<<<<<<<<<<< + * 'qual' : (5, str), + * 'filter' : (6,str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_4); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__alt), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":589 + * 'ref' : (3, str), + * 'alt' : (4, str), + * 'qual' : (5, str), # <<<<<<<<<<<<<< + * 'filter' : (6,str), + * 'info' : (7,str), + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":590 + * 'alt' : (4, str), + * 'qual' : (5, str), + * 'filter' : (6,str), # <<<<<<<<<<<<<< + * 'info' : (7,str), + * 'format' : (8,str) } + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_6); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_6); + __Pyx_GIVEREF(__pyx_int_6); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__filter), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":591 + * 'qual' : (5, str), + * 'filter' : (6,str), + * 'info' : (7,str), # <<<<<<<<<<<<<< + * 'format' : (8,str) } + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_7); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_7); + __Pyx_GIVEREF(__pyx_int_7); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "TabProxies.pyx":592 + * 'filter' : (6,str), + * 'info' : (7,str), + * 'format' : (8,str) } # <<<<<<<<<<<<<< + * + * def __cinit__(self ): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_8); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_8); + __Pyx_GIVEREF(__pyx_int_8); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyDict_SetItem((PyObject *)__pyx_ptype_10TabProxies_VCFProxy->tp_dict, __pyx_n_s__map_key2field, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyType_Modified(__pyx_ptype_10TabProxies_VCFProxy); + + /* "TabProxies.pyx":1 + * import types # <<<<<<<<<<<<<< + * from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cpython/type.pxd":2 + * + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * # The C structure of the objects used to describe built-in types. + * + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init TabProxies"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init TabProxies"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + +static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; + if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { + return PyFloat_AsDouble(obj); + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint32_t) == sizeof(char)) || + (sizeof(uint32_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint32_t) == sizeof(int)) || + (sizeof(uint32_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(uint32_t) == sizeof(char)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(uint32_t) == sizeof(short)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(uint32_t) == sizeof(int)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(uint32_t) == sizeof(long)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + uint32_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (uint32_t)-1; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pxd b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pxd new file mode 100755 index 0000000..cf11852 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pxd @@ -0,0 +1,98 @@ +cdef extern from "stdlib.h": + void free(void *) + void *malloc(size_t) + void *calloc(size_t,size_t) + void *realloc(void *,size_t) + int c_abs "abs" (int) + int c_abs "abs" (int) + int atoi( char *nptr) + long atol( char *nptr) + double atof( char *nptr) + +cdef extern from "Python.h": + ctypedef struct FILE + FILE* PyFile_AsFile(object) + char *fgets(char *str, int size, FILE *ifile) + int feof(FILE *stream) + size_t strlen(char *s) + size_t getline(char **lineptr, size_t *n, FILE *stream) + char *strstr(char *, char *) + char *strchr(char *string, int c) + int fileno(FILE *stream) + +cdef extern from "string.h": + int strcmp(char *s1, char *s2) + int strncmp(char *s1,char *s2,size_t len) + char *strcpy(char *dest,char *src) + char *strncpy(char *dest,char *src, size_t len) + char *strdup(char *) + char *strcat(char *,char *) + size_t strlen(char *s) + int memcmp( void * s1, void *s2, size_t len ) + void *memcpy(void *dest, void *src, size_t n) + void *memchr(void *s, int c, size_t n) + +cdef extern from "stdint.h": + ctypedef int int64_t + ctypedef int int32_t + ctypedef int uint32_t + ctypedef int uint8_t + ctypedef int uint64_t + +cdef class TupleProxy: + + cdef: + char * data + char ** fields + int nfields + int index + int nbytes + int offset + cdef bint is_modified + + cdef int getMaxFields( self, size_t nbytes ) +# cdef char * _getindex( self, int idx ) + + cdef take( self, char * buffer, size_t nbytes ) + cdef present( self, char * buffer, size_t nbytes ) + cdef copy( self, char * buffer, size_t nbytes ) + cdef update( self, char * buffer, size_t nbytes ) + +cdef class GTFProxy( TupleProxy) : + + cdef: + char * contig + char * source + char * feature + uint32_t start + uint32_t end + char * score + char * strand + char * frame + char * attributes + cdef bint hasOwnAttributes + + cdef int getMaxFields( self, size_t nbytes ) + cdef update( self, char * buffer, size_t nbytes ) + +cdef class NamedTupleProxy( TupleProxy) : + pass + +cdef class BedProxy( NamedTupleProxy) : + + cdef: + char * contig + uint32_t start + uint32_t end + int bedfields + + cdef int getMaxFields( self, size_t nbytes ) + cdef update( self, char * buffer, size_t nbytes ) + +cdef class VCFProxy( NamedTupleProxy) : + + cdef: + char * contig + uint32_t pos + + cdef update( self, char * buffer, size_t nbytes ) diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pyx b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pyx new file mode 100755 index 0000000..6e3a866 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/TabProxies.pyx @@ -0,0 +1,627 @@ +import types +from cpython cimport PyString_FromStringAndSize, PyString_AsString, PyString_AS_STRING + +cdef char * nextItem( char * buffer ): + cdef char * pos + pos = strchr( buffer, '\t' ) + if pos == NULL: raise ValueError( "malformatted entry at %s" % buffer ) + pos[0] = '\0' + pos += 1 + return pos + +cdef char *StrOrEmpty( char * buffer ): + if buffer == NULL: return "" + else: return buffer + +cdef int isNew( char * p, char * buffer, size_t nbytes ): + if p == NULL: return 0 + return not (buffer <= p < buffer + nbytes ) + +cdef class TupleProxy: + '''Proxy class for access to parsed row as a tuple. + + This class represents a table row for fast read-access. + + Access to individual fields is via the [] operator. + + Only read-only access is implemented. + ''' + + def __cinit__(self ): + self.data = NULL + self.fields = NULL + self.index = 0 + self.nbytes = 0 + self.is_modified = 0 + self.nfields = 0 + # start counting at field offset + self.offset = 0 + + def __dealloc__(self): + cdef int x + if self.is_modified: + for x from 0 <= x < self.nfields: + if isNew( self.fields[x], self.data, self.nbytes ): + free( self.fields[x] ) + self.fields[x] = NULL + + if self.data != NULL: free(self.data) + if self.fields != NULL: free( self.fields ) + + cdef take( self, char * buffer, size_t nbytes ): + '''start presenting buffer. + + Take ownership of the pointer. + ''' + self.data = buffer + self.nbytes = nbytes + self.update( buffer, nbytes ) + + cdef present( self, char * buffer, size_t nbytes ): + '''start presenting buffer. + + Do not take ownership of the pointer. + ''' + self.update( buffer, nbytes ) + + cdef copy( self, char * buffer, size_t nbytes ): + '''start presenting buffer. + + Take a copy of buffer. + ''' + cdef int s + # +1 for '\0' + s = sizeof(char) * (nbytes + 1) + self.data = malloc( s ) + if self.data == NULL: + raise ValueError("out of memory" ) + self.nbytes = nbytes + memcpy( self.data, buffer, s ) + self.update( self.data, nbytes ) + + cdef int getMaxFields( self, size_t nbytes ): + '''initialize fields.''' + return nbytes / 2 + + cdef update( self, char * buffer, size_t nbytes ): + '''update internal data. + + Update starts work in buffer, thus can be used + to collect any number of fields until nbytes + is exhausted. + + If max_fields is set, the number of fields is initialized to max_fields. + + ''' + cdef char * pos + cdef char * old_pos + cdef int field + cdef int max_fields, x + + if buffer[nbytes] != 0: + raise ValueError( "incomplete line at %s" % buffer ) + + ################################# + # clear data + if self.fields != NULL: free(self.fields) + + for field from 0 <= field < self.nfields: + if isNew( self.fields[field], self.data, self.nbytes ): + free( self.fields[field] ) + + self.is_modified = self.nfields = 0 + + ################################# + # allocate new + max_fields = self.getMaxFields( nbytes ) + self.fields = calloc( max_fields, sizeof(char *) ) + if self.fields == NULL: + raise ValueError("out of memory" ) + + ################################# + # start filling + field = 0 + self.fields[field] = pos = buffer + field += 1 + old_pos = pos + + while 1: + + pos = memchr( pos, '\t', nbytes ) + if pos == NULL: break + pos[0] = '\0' + pos += 1 + self.fields[field] = pos + field += 1 + if field >= max_fields: + raise ValueError("row too large - more than %i fields" % max_fields ) + nbytes -= pos - old_pos + if nbytes < 0: break + old_pos = pos + + self.nfields = field + + def _getindex( self, int index ): + '''return item at idx index''' + cdef int i = index + if i < 0: i += self.nfields + if i < 0: raise IndexError( "list index out of range" ) + i += self.offset + if i >= self.nfields: + raise IndexError( "list index out of range %i >= %i" % (i, self.nfields )) + return self.fields[i] + + def __getitem__( self, key ): + if type(key) == int: return self._getindex( key ) + # slice object + start, end, step = key.indices( self.nfields ) + result = [] + for index in range( start, end, step ): + result.append( self._getindex( index ) ) + return result + + def _setindex( self, index, value ): + '''set item at idx index.''' + cdef int idx = index + if idx < 0: raise IndexError( "list index out of range" ) + if idx >= self.nfields: + raise IndexError( "list index out of range" ) + + if isNew( self.fields[idx], self.data, self.nbytes ): + free( self.fields[idx] ) + + self.is_modified = 1 + + if value == None: + self.fields[idx] = NULL + return + + # conversion with error checking + cdef char * tmp = PyString_AsString( value ) + self.fields[idx] = malloc( (strlen( tmp ) + 1) * sizeof(char) ) + if self.fields[idx] == NULL: + raise ValueError("out of memory" ) + strcpy( self.fields[idx], tmp ) + + def __setitem__(self, index, value ): + '''set item at *index* to *value*''' + cdef int i = index + if i < 0: i += self.nfields + i += self.offset + + self._setindex( i, value ) + + def __len__(self): + return self.nfields + + def __iter__(self): + self.index = 0 + return self + + def __next__(self): + """python version of next(). + """ + if self.index >= self.nfields: + raise StopIteration + cdef char * retval = self.fields[self.index] + self.index += 1 + if retval == NULL: return None + else: return retval + + def __str__(self): + '''return original data''' + # copy and replace \0 bytes with \t characters + if self.is_modified: + # todo: treat NULL values + return "\t".join( [StrOrEmpty( self.fields[x]) for x in xrange(0, self.nfields ) ] ) + else: + cpy = calloc( sizeof(char), self.nbytes+1 ) + if cpy == NULL: + raise ValueError("out of memory" ) + memcpy( cpy, self.data, self.nbytes+1) + for x from 0 <= x < self.nbytes: + if cpy[x] == '\0': cpy[x] = '\t' + result = PyString_FromStringAndSize(cpy, self.nbytes) + free(cpy) + return result + +def toDot( v ): + '''convert value to '.' if None''' + if v == None: return "." + else: return str(v) + +def quote( v ): + '''return a quoted attribute.''' + if type(v) in types.StringTypes: + return '"%s"' % v + else: + return str(v) + +cdef class GTFProxy( TupleProxy ): + '''Proxy class for access to GTF fields. + + This class represents a GTF entry for fast read-access. + Write-access has been added as well, though some care must + be taken. If any of the string fields (contig, source, ...) + are set, the new value is tied to the lifetime of the + argument that was supplied. + + The only exception is the attributes field when set from + a dictionary - this field will manage its own memory. + + ''' + + def __cinit__(self ): + # automatically calls TupleProxy.__cinit__ + self.hasOwnAttributes = False + + def __dealloc__(self): + # automatically calls TupleProxy.__dealloc__ + if self.hasOwnAttributes: + free(self.attributes) + + cdef int getMaxFields( self, size_t nbytes ): + '''return max number of fields.''' + return 9 + + cdef update( self, char * buffer, size_t nbytes ): + '''update internal data. + + nbytes does not include the terminal '\0'. + ''' + cdef int end + cdef char * cstart, * cend, * cscore + self.contig = buffer + cdef char * pos + + if buffer[nbytes] != 0: + raise ValueError( "incomplete line at %s" % buffer ) + + self.source = pos = nextItem( buffer ) + self.feature = pos = nextItem( pos ) + cstart = pos = nextItem( pos ) + cend = pos = nextItem( pos ) + self.score = pos = nextItem( pos ) + self.strand = pos = nextItem( pos ) + self.frame = pos = nextItem( pos ) + self.attributes = pos = nextItem( pos ) + + self.start = atoi( cstart ) - 1 + self.end = atoi( cend ) + self.nfields = 9 + + property contig: + '''contig of feature.''' + def __get__( self ): return self.contig + def __set__( self, value ): + self.is_modified = True + self.contig = value + + property feature: + '''feature name.''' + def __get__( self ): return self.feature + def __set__( self, value ): + self.is_modified = True + self.feature = value + + property source: + '''feature source.''' + def __get__( self ): return self.source + def __set__( self, value ): + self.is_modified = True + self.source = value + + property start: + '''feature start (in 0-based open/closed coordinates).''' + def __get__( self ): return self.start + def __set__( self, value ): + self.is_modified = True + self.start = value + + property end: + '''feature end (in 0-based open/closed coordinates).''' + def __get__( self ): return self.end + def __set__( self, value ): + self.is_modified = True + self.end = value + + property score: + '''feature score.''' + def __get__( self ): + if self.score[0] == '.' and self.score[1] == '\0' : + return None + else: + return atof(self.score) + def __set__( self, value ): + self.is_modified = True + self.score = value + + property strand: + '''feature strand.''' + def __get__( self ): return self.strand + def __set__( self, value ): + self.is_modified = True + self.strand = value + + property frame: + '''feature frame.''' + def __get__( self ): return self.frame + def __set__( self, value ): + self.is_modified = True + self.frame = value + + property attributes: + '''feature attributes (as a string).''' + def __get__( self ): return self.attributes + def __set__( self, value ): + self.is_modified = True + self.attributes = value + + def asDict( self ): + """parse attributes - return as dict + """ + + # remove comments + attributes = self.attributes + + # separate into fields + fields = [ x.strip() for x in attributes.split(";")[:-1]] + + result = {} + + for f in fields: + + d = [ x.strip() for x in f.split(" ")] + + n,v = d[0], d[1] + if len(d) > 2: v = d[1:] + + if v[0] == '"' and v[-1] == '"': + v = v[1:-1] + else: + ## try to convert to a value + try: + v = float( v ) + v = int( v ) + except ValueError: + pass + except TypeError: + pass + + result[n] = v + + return result + + def fromDict( self, d ): + '''set attributes from a dictionary.''' + cdef char * p + cdef int l + + # clean up if this field is set twice + if self.hasOwnAttributes: + free(self.attributes) + + aa = [] + for k,v in d.items(): + if type(v) == types.StringType: + aa.append( '%s "%s"' % (k,v) ) + else: + aa.append( '%s %s' % (k,str(v)) ) + + a = "; ".join( aa ) + ";" + p = a + l = len(a) + self.attributes = calloc( l + 1, sizeof(char) ) + if self.attributes == NULL: + raise ValueError("out of memory" ) + memcpy( self.attributes, p, l ) + + self.hasOwnAttributes = True + self.is_modified = True + + def __str__(self): + cdef char * cpy + cdef int x + + if self.is_modified: + return "\t".join( + (self.contig, + self.source, + self.feature, + str(self.start+1), + str(self.end), + toDot(self.score), + self.strand, + self.frame, + self.attributes ) ) + else: + return TupleProxy.__str__(self) + + def invert( self, int lcontig ): + '''invert coordinates to negative strand coordinates + + This method will only act if the feature is on the + negative strand.''' + + if self.strand[0] == '-': + start = min(self.start, self.end) + end = max(self.start, self.end) + self.start, self.end = lcontig - end, lcontig - start + + def keys( self ): + '''return a list of attributes defined in this entry.''' + r = self.attributes + return [ x.strip().split(" ")[0] for x in r.split(";") if x.strip() != '' ] + + def __getitem__(self, key): + return self.__getattr__( key ) + + def __getattr__(self, item ): + """Generic lookup of attribute from GFF/GTF attributes + Only called if there *isn't* an attribute with this name + """ + cdef char * start + cdef char * query + cdef char * cpy + cdef char * end + cdef int l + query = item + + start = strstr( self.attributes, query) + if start == NULL: + raise AttributeError("'GTFProxy' has no attribute '%s'" % item ) + + start += strlen(query) + 1 + # skip gaps before + while start[0] == ' ': start += 1 + if start[0] == '"': + start += 1 + end = start + while end[0] != '\0' and end[0] != '"': end += 1 + l = end - start + result = PyString_FromStringAndSize( start, l ) + return result + else: + return start + + def setAttribute( self, name, value ): + '''convenience method to set an attribute.''' + r = self.asDict() + r[name] = value + self.fromDict( r ) + +cdef class NamedTupleProxy( TupleProxy ): + + map_key2field = {} + + def __setattr__(self, key, value ): + '''set attribute.''' + cdef int idx + idx, f = self.map_key2field[key] + if self.nfields < idx: + raise KeyError( "field %s not set" % key ) + TupleProxy.__setitem__(self, idx, str(value) ) + + def __getattr__(self, key ): + cdef int idx + idx, f = self.map_key2field[key] + if self.nfields < idx: + raise KeyError( "field %s not set" % key ) + return f( self.fields[idx] ) + +cdef class BedProxy( NamedTupleProxy ): + '''Proxy class for access to Bed fields. + + This class represents a GTF entry for fast read-access. + ''' + map_key2field = { + 'contig' : (0, str), + 'start' : (1, int), + 'end' : (2, int), + 'name' : (3, str), + 'score' : (4, float), + 'strand' : (5, str), + 'thickStart' : (6,int ), + 'thickEnd' : (7,int), + 'itemRGB' : (8,str), + 'blockCount': (9,int), + 'blockSizes': (10,str), + 'blockStarts': (11,str), } + + cdef int getMaxFields( self, size_t nbytes ): + '''return max number of fields.''' + return 12 + + cdef update( self, char * buffer, size_t nbytes ): + '''update internal data. + + nbytes does not include the terminal '\0'. + ''' + TupleProxy.update( self, buffer, nbytes ) + + if self.nfields < 3: + raise ValueError( "bed format requires at least three columns" ) + + # determines bed format + self.bedfields = self.nfields + + # do automatic conversion + self.contig = self.fields[0] + self.start = atoi( self.fields[1] ) + self.end = atoi( self.fields[2] ) + + # __setattr__ in base class seems to take precedence + # hence implement setters in __setattr__ + #property start: + # def __get__( self ): return self.start + #property end: + # def __get__( self ): return self.end + + def __str__(self): + + cdef int save_fields = self.nfields + # ensure fields to use correct format + self.nfields = self.bedfields + retval = TupleProxy.__str__( self ) + self.nfields = save_fields + return retval + + def __setattr__(self, key, value ): + '''set attribute.''' + if key == "start": self.start = value + elif key == "end": self.end = value + + cdef int idx + idx, f = self.map_key2field[key] + TupleProxy._setindex(self, idx, str(value) ) + +cdef class VCFProxy( NamedTupleProxy ): + '''Proxy class for access to VCF fields. + + The genotypes are accessed via index. + ''' + map_key2field = { + 'contig' : (0, str), + 'pos' : (1, int), + 'id' : (2, str), + 'ref' : (3, str), + 'alt' : (4, str), + 'qual' : (5, str), + 'filter' : (6,str), + 'info' : (7,str), + 'format' : (8,str) } + + def __cinit__(self ): + # automatically calls TupleProxy.__cinit__ + # start indexed access at genotypes + self.offset = 9 + + cdef update( self, char * buffer, size_t nbytes ): + '''update internal data. + + nbytes does not include the terminal '\0'. + ''' + TupleProxy.update( self, buffer, nbytes ) + + self.contig = self.fields[0] + # vcf counts from 1 - correct here + self.pos = atoi( self.fields[1] ) - 1 + + def __len__(self): + return max(0, self.nfields - 9) + + property pos: + '''feature end (in 0-based open/closed coordinates).''' + def __get__( self ): + return self.pos + + def __setattr__(self, key, value ): + '''set attribute.''' + if key == "pos": + self.pos = value + value += 1 + + cdef int idx + idx, f = self.map_key2field[key] + TupleProxy._setindex(self, idx, str(value) ) + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/__init__.py b/code/utilities/CPAT-1.2.2/lib/pysam/__init__.py new file mode 100755 index 0000000..8454f8e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/__init__.py @@ -0,0 +1,128 @@ +from csamtools import * +from ctabix import * +import csamtools +import ctabix +from cvcf import * +import cvcf +import Pileup +import sys +import os + +class SamtoolsError( Exception ): + '''exception raised in case of an error incurred in the samtools library.''' + + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) + +class SamtoolsDispatcher(object): + '''samtools dispatcher. + + Emulates the samtools command line as module calls. + + Captures stdout and stderr. + + Raises a :class:`pysam.SamtoolsError` exception in case + samtools exits with an error code other than 0. + + Some command line options are associated with parsers. + For example, the samtools command "pileup -c" creates + a tab-separated table on standard output. In order to + associate parsers with options, an optional list of + parsers can be supplied. The list will be processed + in order checking for the presence of each option. + + If no parser is given or no appropriate parser is found, + the stdout output of samtools commands will be returned. + ''' + dispatch=None + parsers=None + + def __init__(self,dispatch, parsers): + self.dispatch = dispatch + self.parsers = parsers + self.stderr = [] + + def __call__(self, *args, **kwargs): + '''execute a samtools command + ''' + retval, stderr, stdout = csamtools._samtools_dispatch( self.dispatch, args ) + if retval: raise SamtoolsError( "\n".join( stderr ) ) + self.stderr = stderr + # samtools commands do not propagate the return code correctly. + # I have thus added this patch to throw if there is output on stderr. + # Note that there is sometimes output on stderr that is not an error, + # for example: [sam_header_read2] 2 sequences loaded. + # Ignore messages like these + stderr = [ x for x in stderr \ + if not (x.startswith( "[sam_header_read2]" ) or \ + x.startswith("[bam_index_load]") or \ + x.startswith("[bam_sort_core]") or \ + x.startswith("[samopen] SAM header is present") ) + ] + if stderr: raise SamtoolsError( "\n".join( stderr ) ) + + # call parser for stdout: + if not kwargs.get("raw") and stdout and self.parsers: + for options, parser in self.parsers: + for option in options: + if option not in args: break + else: + return parser(stdout) + + return stdout + + def getMessages( self ): + return self.stderr + + def usage(self): + '''return the samtools usage information for this command''' + retval, stderr, stdout = csamtools._samtools_dispatch( self.dispatch ) + return "".join(stderr) + +# +# samtools command line options to export in python +# +# import is a python reserved word. +SAMTOOLS_DISPATCH = { + # samtools 'documented' commands + "view" : ( "view", None ), + "sort" : ( "sort", None), + "mpileup" : ( "mpileup", None), + "depth" : ("depth", None), + "faidx" : ("faidx", None), + "tview" : ("tview", None), + "index" : ("index", None), + "idxstats" : ("idxstats", None), + "fixmate" : ("fixmate", None), + "flagstat" : ("flagstat", None), + "calmd" : ("calmd", None), + "merge" : ("merge", None), + "rmdup" : ("rmdup", None), + "reheader" : ("reheader", None), + "cat" : ("cat", None), + "targetcut" : ("targetcut", None), + "phase" : ("phase", None), + # others + "samimport": ( "import", None), + "bam2fq" : ("bam2fq", None), + # obsolete + # "pileup" : ( "pileup", ( (("-c",), Pileup.iterate ), ), ), + + } + +# instantiate samtools commands as python functions +for key, options in SAMTOOLS_DISPATCH.iteritems(): + cmd, parser = options + globals()[key] = SamtoolsDispatcher(cmd, parser) + +# hack to export all the symbols from csamtools +__all__ = \ + csamtools.__all__ + \ + ctabix.__all__ + \ + cvcf.__all__ +\ + [ "SamtoolsError", "SamtoolsDispatcher" ] + list(SAMTOOLS_DISPATCH) +\ + ["Pileup" ] + +from version import __version__, __samtools_version__ diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.c b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.c new file mode 100755 index 0000000..ca5fb4e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.c @@ -0,0 +1,35184 @@ +/* Generated by Cython 0.14.1 on Fri Nov 25 19:51:23 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__csamtools +#include "string.h" +#include "stdlib.h" +#include "math.h" +#include "stdio.h" +#include "ctype.h" +#include "unistd.h" +#include "fileobject.h" +#include "razf.h" +#include "stdint.h" +#include "bam.h" +#include "sam.h" +#include "faidx.h" +#include "pysam_util.h" +#include "pythread.h" + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "csamtools.pyx", + "csamtools.pxd", + "bool.pxd", + "complex.pxd", +}; + +/* Type declarations */ + +/* "csamtools.pyx":388 + * counter[0] += 1; + * + * ctypedef struct MateData: # <<<<<<<<<<<<<< + * char * name + * bam1_t * mate + */ + +typedef struct { + char *name; + bam1_t *mate; + uint32_t flag; +} __pyx_t_9csamtools_MateData; + +/* "csamtools.pyx":1537 + * ##------------------------------------------------------------------- + * ##------------------------------------------------------------------- + * ctypedef struct __iterdata: # <<<<<<<<<<<<<< + * samfile_t * samfile + * bam_iter_t iter + */ + +typedef struct { + samfile_t *samfile; + bam_iter_t iter; + faidx_t *fastafile; + int tid; + char *seq; + int seq_len; +} __pyx_t_9csamtools___iterdata; + +/* "csamtools.pyx":1717 + * bam_plp_set_mask( self.pileup_iter, self.mask ) + * + * cdef setupIteratorData( self, # <<<<<<<<<<<<<< + * int tid, + * int start, + */ + +struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData { + int __pyx_n; + int reopen; +}; + +/* "csamtools.pyx":91 + * return dest + * + * cdef class PileupRead # <<<<<<<<<<<<<< + * cdef makePileupRead( bam_pileup1_t * src ): + * '''fill a PileupRead object from a bam_pileup1_t * object.''' + */ + +struct __pyx_obj_9csamtools_PileupRead { + PyObject_HEAD + struct __pyx_obj_9csamtools_AlignedRead *_alignment; + int32_t _qpos; + int _indel; + int _level; + uint32_t _is_del; + uint32_t _is_head; + uint32_t _is_tail; +}; + +/* "csamtools.pxd":423 + * cdef char * _getrname( self, int tid ) + * + * cdef class IteratorRow: # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_obj_9csamtools_IteratorRow { + PyObject_HEAD +}; + +/* "csamtools.pyx":1415 + * if self.owns_samfile: samclose( self.fp ) + * + * cdef class IteratorRowAllRefs(IteratorRow): # <<<<<<<<<<<<<< + * """iterates over all mapped reads by chaining iterators over each reference + * """ + */ + +struct __pyx_obj_9csamtools_IteratorRowAllRefs { + struct __pyx_obj_9csamtools_IteratorRow __pyx_base; + struct __pyx_obj_9csamtools_Samfile *samfile; + int tid; + struct __pyx_obj_9csamtools_IteratorRowRegion *rowiter; +}; + +/* "csamtools.pxd":426 + * pass + * + * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<< + * cdef bam1_t * b + * cdef samfile_t * fp + */ + +struct __pyx_obj_9csamtools_IteratorRowAll { + struct __pyx_obj_9csamtools_IteratorRow __pyx_base; + struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtab; + bam1_t *b; + samfile_t *fp; + int owns_samfile; +}; + +/* "csamtools.pyx":82 + * return dest + * + * cdef class PileupProxy # <<<<<<<<<<<<<< + * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): + * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) + */ + +struct __pyx_obj_9csamtools_PileupProxy { + PyObject_HEAD + bam_pileup1_t *plp; + int tid; + int pos; + int n_pu; +}; + +/* "csamtools.pyx":1265 + * pass + * + * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<< + * """*(Samfile samfile, int tid, int beg, int end, int reopen = True )* + * + */ + +struct __pyx_obj_9csamtools_IteratorRowRegion { + struct __pyx_obj_9csamtools_IteratorRow __pyx_base; + struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtab; + bam_iter_t iter; + bam1_t *b; + int retval; + struct __pyx_obj_9csamtools_Samfile *samfile; + samfile_t *fp; + int owns_samfile; +}; + +/* "csamtools.pyx":244 + * ## Public methods + * ###################################################################### + * cdef class Fastafile: # <<<<<<<<<<<<<< + * '''*(filename)* + * + */ + +struct __pyx_obj_9csamtools_Fastafile { + PyObject_HEAD + struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtab; + char *_filename; + faidx_t *fastafile; +}; + +/* "csamtools.pyx":1461 + * raise StopIteration + * + * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<< + * """*(Samfile samfile)* + * + */ + +struct __pyx_obj_9csamtools_IteratorRowSelection { + struct __pyx_obj_9csamtools_IteratorRow __pyx_base; + struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtab; + bam1_t *b; + int current_pos; + samfile_t *fp; + PyObject *positions; + int owns_samfile; +}; + +/* "csamtools.pyx":1601 + * return ret + * + * cdef class IteratorColumn: # <<<<<<<<<<<<<< + * '''abstract base class for iterators over columns. + * + */ + +struct __pyx_obj_9csamtools_IteratorColumn { + PyObject_HEAD + struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtab; + struct __pyx_obj_9csamtools_IteratorRowRegion *iter; + int tid; + int pos; + int n_plp; + int mask; + const bam_pileup1_t * plp; + bam_plp_t pileup_iter; + __pyx_t_9csamtools___iterdata iterdata; + struct __pyx_obj_9csamtools_Samfile *samfile; + struct __pyx_obj_9csamtools_Fastafile *fastafile; + PyObject *stepper; + int max_depth; +}; + +/* "csamtools.pyx":1806 + * self.n_plp ) + * + * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<< + * """iterates over all columns by chaining iterators over each reference + * """ + */ + +struct __pyx_obj_9csamtools_IteratorColumnAllRefs { + struct __pyx_obj_9csamtools_IteratorColumn __pyx_base; +}; + +/* "csamtools.pxd":394 + * cdef bam1_t * _delegate + * + * cdef class Samfile: # <<<<<<<<<<<<<< + * cdef char * _filename + * # pointer to samfile + */ + +struct __pyx_obj_9csamtools_Samfile { + PyObject_HEAD + struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtab; + char *_filename; + samfile_t *samfile; + bam_index_t *index; + int isbam; + int isstream; + int isremote; + bam1_t *b; + char *mode; + int64_t start_offset; +}; + +/* "csamtools.pyx":2902 + * return retval, out_stderr, out_stdout + * + * cdef class SNPCall: # <<<<<<<<<<<<<< + * '''the results of a SNP call.''' + * cdef int _tid + */ + +struct __pyx_obj_9csamtools_SNPCall { + PyObject_HEAD + int _tid; + int _pos; + char _reference_base; + char _genotype; + int _consensus_quality; + int _snp_quality; + int _rms_mapping_quality; + int _coverage; +}; + +/* "csamtools.pyx":3456 + * + * + * cdef class IndexedReads: # <<<<<<<<<<<<<< + * """index a bamfile by read. + * + */ + +struct __pyx_obj_9csamtools_IndexedReads { + PyObject_HEAD + struct __pyx_obj_9csamtools_Samfile *samfile; + samfile_t *fp; + PyObject *index; + int owns_samfile; +}; + +/* "csamtools.pyx":1777 + * self.iterdata.seq = NULL + * + * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<< + * '''iterates over a region only. + * ''' + */ + +struct __pyx_obj_9csamtools_IteratorColumnRegion { + struct __pyx_obj_9csamtools_IteratorColumn __pyx_base; +}; + +/* "csamtools.pxd":389 + * + * # need to declare all C fields and methods here + * cdef class AlignedRead: # <<<<<<<<<<<<<< + * + * # object that this AlignedRead represents + */ + +struct __pyx_obj_9csamtools_AlignedRead { + PyObject_HEAD + bam1_t *_delegate; +}; + + +/* "csamtools.pyx":1601 + * return ret + * + * cdef class IteratorColumn: # <<<<<<<<<<<<<< + * '''abstract base class for iterators over columns. + * + */ + +struct __pyx_vtabstruct_9csamtools_IteratorColumn { + int (*cnext)(struct __pyx_obj_9csamtools_IteratorColumn *); + char *(*getSequence)(struct __pyx_obj_9csamtools_IteratorColumn *); + PyObject *(*setMask)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *); + PyObject *(*setupIteratorData)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args); + PyObject *(*reset)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *); +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumn *__pyx_vtabptr_9csamtools_IteratorColumn; + + +/* "csamtools.pyx":1777 + * self.iterdata.seq = NULL + * + * cdef class IteratorColumnRegion(IteratorColumn): # <<<<<<<<<<<<<< + * '''iterates over a region only. + * ''' + */ + +struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion { + struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base; +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *__pyx_vtabptr_9csamtools_IteratorColumnRegion; + + +/* "csamtools.pyx":1265 + * pass + * + * cdef class IteratorRowRegion(IteratorRow): # <<<<<<<<<<<<<< + * """*(Samfile samfile, int tid, int beg, int end, int reopen = True )* + * + */ + +struct __pyx_vtabstruct_9csamtools_IteratorRowRegion { + bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowRegion *); + int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowRegion *); +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *__pyx_vtabptr_9csamtools_IteratorRowRegion; + + +/* "csamtools.pyx":1461 + * raise StopIteration + * + * cdef class IteratorRowSelection(IteratorRow): # <<<<<<<<<<<<<< + * """*(Samfile samfile)* + * + */ + +struct __pyx_vtabstruct_9csamtools_IteratorRowSelection { + bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowSelection *); + int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowSelection *); +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *__pyx_vtabptr_9csamtools_IteratorRowSelection; + + +/* "csamtools.pyx":1806 + * self.n_plp ) + * + * cdef class IteratorColumnAllRefs(IteratorColumn): # <<<<<<<<<<<<<< + * """iterates over all columns by chaining iterators over each reference + * """ + */ + +struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs { + struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_base; +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *__pyx_vtabptr_9csamtools_IteratorColumnAllRefs; + + +/* "csamtools.pyx":415 + * + * + * cdef class Samfile: # <<<<<<<<<<<<<< + * '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None, + * add_sq_text = False )* + */ + +struct __pyx_vtabstruct_9csamtools_Samfile { + bam_header_t *(*_buildHeader)(struct __pyx_obj_9csamtools_Samfile *, PyObject *); + bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_Samfile *); + int (*cnext)(struct __pyx_obj_9csamtools_Samfile *); + int (*write)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch); + char *(*_getrname)(struct __pyx_obj_9csamtools_Samfile *, int); +}; +static struct __pyx_vtabstruct_9csamtools_Samfile *__pyx_vtabptr_9csamtools_Samfile; + + +/* "csamtools.pyx":244 + * ## Public methods + * ###################################################################### + * cdef class Fastafile: # <<<<<<<<<<<<<< + * '''*(filename)* + * + */ + +struct __pyx_vtabstruct_9csamtools_Fastafile { + char *(*_fetch)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *); +}; +static struct __pyx_vtabstruct_9csamtools_Fastafile *__pyx_vtabptr_9csamtools_Fastafile; + + +/* "csamtools.pyx":1351 + * if self.owns_samfile: samclose( self.fp ) + * + * cdef class IteratorRowAll(IteratorRow): # <<<<<<<<<<<<<< + * """*(Samfile samfile, int reopen = True)* + * + */ + +struct __pyx_vtabstruct_9csamtools_IteratorRowAll { + bam1_t *(*getCurrent)(struct __pyx_obj_9csamtools_IteratorRowAll *); + int (*cnext)(struct __pyx_obj_9csamtools_IteratorRowAll *); +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowAll *__pyx_vtabptr_9csamtools_IteratorRowAll; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +#ifndef CYTHON_PROFILE + #define CYTHON_PROFILE 1 +#endif + +#ifndef CYTHON_PROFILE_REUSE_FRAME + #define CYTHON_PROFILE_REUSE_FRAME 0 +#endif + +#if CYTHON_PROFILE + + #include "compile.h" + #include "frameobject.h" + #include "traceback.h" + + #if CYTHON_PROFILE_REUSE_FRAME + #define CYTHON_FRAME_MODIFIER static + #define CYTHON_FRAME_DEL + #else + #define CYTHON_FRAME_MODIFIER + #define CYTHON_FRAME_DEL Py_DECREF(__pyx_frame) + #endif + + #define __Pyx_TraceDeclarations \ + static PyCodeObject *__pyx_frame_code = NULL; \ + CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL; \ + int __Pyx_use_tracing = 0; + + #define __Pyx_TraceCall(funcname, srcfile, firstlineno) \ + if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) { \ + __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, funcname, srcfile, firstlineno); \ + } + + #define __Pyx_TraceException() \ + if (unlikely(__Pyx_use_tracing( && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \ + PyObject *exc_info = __Pyx_GetExceptionTuple(); \ + if (exc_info) { \ + PyThreadState_GET()->c_profilefunc( \ + PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info); \ + Py_DECREF(exc_info); \ + } \ + } + + #define __Pyx_TraceReturn(result) \ + if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) { \ + PyThreadState_GET()->c_profilefunc( \ + PyThreadState_GET()->c_profileobj, __pyx_frame, PyTrace_RETURN, (PyObject*)result); \ + CYTHON_FRAME_DEL; \ + } + + static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno); /*proto*/ + static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, const char *funcname, const char *srcfile, int firstlineno); /*proto*/ + +#else + + #define __Pyx_TraceDeclarations + #define __Pyx_TraceCall(funcname, srcfile, firstlineno) + #define __Pyx_TraceException() + #define __Pyx_TraceReturn(result) + +#endif /* CYTHON_PROFILE */ + +static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) { + return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new( + (PyTypeObject*)(type_obj), __pyx_empty_tuple, NULL)); +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(d == Py_None)) { + __Pyx_RaiseNoneIndexingError(); + return NULL; + } + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) + PyErr_SetObject(PyExc_KeyError, key); + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + /* these presumably have safe hash functions */ + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } else { + PyObject *m; + m = __Pyx_GetAttrString(d, "get"); + if (!m) return NULL; + value = PyObject_CallFunctionObjArgs(m, key, + (default_value == Py_None) ? NULL : default_value, NULL); + Py_DECREF(m); + } +#endif + return value; +} + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ + +#define __Pyx_DelItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_DelItemInt_Fast(o, i) : \ + __Pyx_DelItem_Generic(o, to_py_func(i))) + +static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) { + int r; + if (!j) return -1; + r = PyObject_DelItem(o, j); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i) { + if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0)) + return PySequence_DelItem(o, i); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_DelItem_Generic(o, j); + } +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *modname); /*proto*/ + +#define __pyx_binding_PyCFunctionType_USED 1 + +typedef struct { + PyCFunctionObject func; +} __pyx_binding_PyCFunctionType_object; + +static PyTypeObject __pyx_binding_PyCFunctionType_type; +static PyTypeObject *__pyx_binding_PyCFunctionType = NULL; + +static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */ +#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL) + +static int __pyx_binding_PyCFunctionType_init(void); /* proto */ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); + +static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t); + +static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject *); + +static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t); + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.version */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from cpython.exc */ + +/* Module declarations from cpython.module */ + +/* Module declarations from cpython.mem */ + +/* Module declarations from cpython.tuple */ + +/* Module declarations from cpython.list */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from cpython.sequence */ + +/* Module declarations from cpython.mapping */ + +/* Module declarations from cpython.iterator */ + +/* Module declarations from cpython.type */ + +/* Module declarations from cpython.number */ + +/* Module declarations from cpython.int */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.bool */ + +static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from cpython.long */ + +/* Module declarations from cpython.float */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.complex */ + +static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from cpython.string */ + +/* Module declarations from cpython.unicode */ + +/* Module declarations from cpython.dict */ + +/* Module declarations from cpython.instance */ + +/* Module declarations from cpython.function */ + +/* Module declarations from cpython.method */ + +/* Module declarations from cpython.weakref */ + +/* Module declarations from cpython.getargs */ + +/* Module declarations from cpython.pythread */ + +/* Module declarations from cpython.cobject */ + +/* Module declarations from cpython.oldbuffer */ + +/* Module declarations from cpython.set */ + +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.bytes */ + +/* Module declarations from cpython.pycapsule */ + +/* Module declarations from cpython */ + +/* Module declarations from csamtools */ + +static PyTypeObject *__pyx_ptype_9csamtools_file = 0; +static PyTypeObject *__pyx_ptype_9csamtools_AlignedRead = 0; +static PyTypeObject *__pyx_ptype_9csamtools_Samfile = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorRow = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAll = 0; +static PyTypeObject *__pyx_ptype_9csamtools_PileupProxy = 0; +static PyTypeObject *__pyx_ptype_9csamtools_PileupRead = 0; +static PyTypeObject *__pyx_ptype_9csamtools_Fastafile = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowRegion = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowAllRefs = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorRowSelection = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumn = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnRegion = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IteratorColumnAllRefs = 0; +static PyTypeObject *__pyx_ptype_9csamtools_SNPCall = 0; +static PyTypeObject *__pyx_ptype_9csamtools_IndexedReads = 0; +static char *__pyx_v_9csamtools_bam_nt16_rev_table; +static int __pyx_v_9csamtools_max_pos; +static PyObject *__pyx_f_9csamtools_makeAlignedRead(bam1_t *); /*proto*/ +static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *, int, int, int); /*proto*/ +static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *); /*proto*/ +static int __pyx_f_9csamtools_fetch_callback(bam1_t *, void *); /*proto*/ +static int __pyx_f_9csamtools_pileup_callback(uint32_t, uint32_t, int, bam_pileup1_t *, void *); /*proto*/ +static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *, void *); /*proto*/ +static int __pyx_f_9csamtools_count_callback(bam1_t *, void *); /*proto*/ +static int __pyx_f_9csamtools_mate_callback(bam1_t *, void *); /*proto*/ +static int __pyx_f_9csamtools___advance_all(void *, bam1_t *); /*proto*/ +static int __pyx_f_9csamtools___advance_snpcalls(void *, bam1_t *); /*proto*/ +static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *); /*proto*/ +static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *, uint32_t, uint32_t); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *, uint32_t, uint32_t); /*proto*/ +#define __Pyx_MODULE_NAME "csamtools" +static int __pyx_module_is_main_csamtools = 0; + +/* Implementation of csamtools */ +static PyObject *__pyx_builtin_open; +static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_map; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_IOError; +static PyObject *__pyx_builtin_OverflowError; +static PyObject *__pyx_builtin_NotImplementedError; +static PyObject *__pyx_builtin_OSError; +static PyObject *__pyx_builtin_AttributeError; +static PyObject *__pyx_builtin_KeyError; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_cmp; +static PyObject *__pyx_builtin_chr; +static PyObject *__pyx_builtin_TypeError; +static char __pyx_k_1[] = "\t"; +static char __pyx_k_2[] = "\n"; +static char __pyx_k_3[] = "calling len() on closed file"; +static char __pyx_k_5[] = "could not open file `%s`"; +static char __pyx_k_6[] = "I/O operation on closed file"; +static char __pyx_k_9[] = "no sequence/region supplied."; +static char __pyx_k_11[] = "invalid region: start (%i) > end (%i)"; +static char __pyx_k_12[] = ""; +static char __pyx_k_13[] = "start out of range (%i)"; +static char __pyx_k_14[] = "end out of range (%i)"; +static char __pyx_k_15[] = "%s:%i-%i"; +static char __pyx_k_17[] = "invalid file opening mode `%s`"; +static char __pyx_k_18[] = "-"; +static char __pyx_k_19[] = "http:"; +static char __pyx_k_20[] = "ftp:"; +static char __pyx_k_21[] = "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing"; +static char __pyx_k_22[] = "unequal names and lengths of reference sequences"; +static char __pyx_k_23[] = "@SQ\tSN:%s\tLN:%s\n"; +static char __pyx_k_24[] = "file `%s` not found"; +static char __pyx_k_25[] = "could not open file (mode='%s') - is it SAM/BAM format?"; +static char __pyx_k_26[] = "file does not have valid header (mode='%s') - is it SAM/BAM format?"; +static char __pyx_k_27[] = ".bai"; +static char __pyx_k_28[] = "error while opening index `%s` "; +static char __pyx_k_31[] = "tid %i out of range 0<=tid<%i"; +static char __pyx_k_33[] = "[:-]"; +static char __pyx_k_35[] = "invalid reference `%s`"; +static char __pyx_k_36[] = "invalid coordinates: start (%i) > end (%i)"; +static char __pyx_k_38[] = "seek only available in bam files"; +static char __pyx_k_40[] = "seek no available in streams"; +static char __pyx_k_46[] = "fetch called on bamfile without index"; +static char __pyx_k_48[] = "callback functionality requires a region/reference"; +static char __pyx_k_50[] = "no index available for fetch"; +static char __pyx_k_52[] = "fetching by region is not available for sam files"; +static char __pyx_k_54[] = "fetch called for samfile without header"; +static char __pyx_k_56[] = "callback not implemented yet"; +static char __pyx_k_58[] = "read %s: is unpaired"; +static char __pyx_k_59[] = "mate %s: is unmapped"; +static char __pyx_k_60[] = "mate not found"; +static char __pyx_k_65[] = "counting functionality requires a region/reference"; +static char __pyx_k_68[] = "count for a region is not available for sam files"; +static char __pyx_k_71[] = "no index available for pileup"; +static char __pyx_k_74[] = "pileup of samfiles not implemented yet"; +static char __pyx_k_81[] = "Samfile.mapped only available in bam files"; +static char __pyx_k_84[] = "Samfile.unmapped only available in bam files"; +static char __pyx_k_89[] = "@"; +static char __pyx_k_91[] = "header line without '@': '%s'"; +static char __pyx_k_93[] = "header line with invalid type '%s': '%s'"; +static char __pyx_k_94[] = ":"; +static char __pyx_k_96[] = "unknown field code '%s' in record '%s'"; +static char __pyx_k_97[] = "multiple '%s' lines are not permitted"; +static char __pyx_k_98[] = "@%s"; +static char __pyx_k_99[] = "%s:%s"; +static char __pyx_k__A[] = "A"; +static char __pyx_k__C[] = "C"; +static char __pyx_k__D[] = "D"; +static char __pyx_k__F[] = "F"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__S[] = "S"; +static char __pyx_k__Z[] = "Z"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__s[] = "s"; +static char __pyx_k__w[] = "w"; +static char __pyx_k__x[] = "x"; +static char __pyx_k_100[] = "invalid type for record %s: %s, expected %s"; +static char __pyx_k_101[] = "incomplete sequence information in '%s'"; +static char __pyx_k_103[] = "can not iterate over samfile without header"; +static char __pyx_k_106[] = "no index available for iteration"; +static char __pyx_k_112[] = "can only use this iterator on bam files"; +static char __pyx_k_113[] = "reference sequence for '%s' (tid=%i) not found"; +static char __pyx_k_114[] = "unknown stepper option `%s` in IteratorColumn"; +static char __pyx_k_116[] = "error during iteration"; +static char __pyx_k_119[] = "Invalid clipping in CIGAR string"; +static char __pyx_k_120[] = "quality and sequence mismatch: %i != %i"; +static char __pyx_k_121[] = "%c"; +static char __pyx_k_122[] = "create_string_buffer"; +static char __pyx_k_123[] = "_delegate = bam_dup1(__pyx_v_src); + + /* "csamtools.pyx":80 + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + * dest._delegate = bam_dup1(src) + * return dest # <<<<<<<<<<<<<< + * + * cdef class PileupProxy + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_dest)); + __pyx_r = ((PyObject *)__pyx_v_dest); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.makeAlignedRead"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dest); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":83 + * + * cdef class PileupProxy + * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): # <<<<<<<<<<<<<< + * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) + * dest.plp = plp + */ + +static PyObject *__pyx_f_9csamtools_makePileupProxy(bam_pileup1_t *__pyx_v_plp, int __pyx_v_tid, int __pyx_v_pos, int __pyx_v_n) { + struct __pyx_obj_9csamtools_PileupProxy *__pyx_v_dest = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("makePileupProxy"); + __Pyx_TraceCall("makePileupProxy", __pyx_f[0], 83); + + /* "csamtools.pyx":84 + * cdef class PileupProxy + * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): + * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) # <<<<<<<<<<<<<< + * dest.plp = plp + * dest.tid = tid + */ + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupProxy)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupProxy)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "csamtools.pyx":85 + * cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): + * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) + * dest.plp = plp # <<<<<<<<<<<<<< + * dest.tid = tid + * dest.pos = pos + */ + __pyx_v_dest->plp = __pyx_v_plp; + + /* "csamtools.pyx":86 + * cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) + * dest.plp = plp + * dest.tid = tid # <<<<<<<<<<<<<< + * dest.pos = pos + * dest.n = n + */ + __pyx_v_dest->tid = __pyx_v_tid; + + /* "csamtools.pyx":87 + * dest.plp = plp + * dest.tid = tid + * dest.pos = pos # <<<<<<<<<<<<<< + * dest.n = n + * return dest + */ + __pyx_v_dest->pos = __pyx_v_pos; + + /* "csamtools.pyx":88 + * dest.tid = tid + * dest.pos = pos + * dest.n = n # <<<<<<<<<<<<<< + * return dest + * + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(((PyObject *)__pyx_v_dest), __pyx_n_s__n, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":89 + * dest.pos = pos + * dest.n = n + * return dest # <<<<<<<<<<<<<< + * + * cdef class PileupRead + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_dest)); + __pyx_r = ((PyObject *)__pyx_v_dest); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.makePileupProxy"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dest); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":92 + * + * cdef class PileupRead + * cdef makePileupRead( bam_pileup1_t * src ): # <<<<<<<<<<<<<< + * '''fill a PileupRead object from a bam_pileup1_t * object.''' + * cdef PileupRead dest = PileupRead.__new__(PileupRead) + */ + +static PyObject *__pyx_f_9csamtools_makePileupRead(bam_pileup1_t *__pyx_v_src) { + struct __pyx_obj_9csamtools_PileupRead *__pyx_v_dest = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("makePileupRead"); + __Pyx_TraceCall("makePileupRead", __pyx_f[0], 92); + + /* "csamtools.pyx":94 + * cdef makePileupRead( bam_pileup1_t * src ): + * '''fill a PileupRead object from a bam_pileup1_t * object.''' + * cdef PileupRead dest = PileupRead.__new__(PileupRead) # <<<<<<<<<<<<<< + * dest._alignment = makeAlignedRead( src.b ) + * dest._qpos = src.qpos + */ + __pyx_t_1 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_PileupRead)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_PileupRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dest = ((struct __pyx_obj_9csamtools_PileupRead *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "csamtools.pyx":95 + * '''fill a PileupRead object from a bam_pileup1_t * object.''' + * cdef PileupRead dest = PileupRead.__new__(PileupRead) + * dest._alignment = makeAlignedRead( src.b ) # <<<<<<<<<<<<<< + * dest._qpos = src.qpos + * dest._indel = src.indel + */ + __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_src->b); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_9csamtools_AlignedRead))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_dest->_alignment); + __Pyx_DECREF(((PyObject *)__pyx_v_dest->_alignment)); + __pyx_v_dest->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "csamtools.pyx":96 + * cdef PileupRead dest = PileupRead.__new__(PileupRead) + * dest._alignment = makeAlignedRead( src.b ) + * dest._qpos = src.qpos # <<<<<<<<<<<<<< + * dest._indel = src.indel + * dest._level = src.level + */ + __pyx_v_dest->_qpos = __pyx_v_src->qpos; + + /* "csamtools.pyx":97 + * dest._alignment = makeAlignedRead( src.b ) + * dest._qpos = src.qpos + * dest._indel = src.indel # <<<<<<<<<<<<<< + * dest._level = src.level + * dest._is_del = src.is_del + */ + __pyx_v_dest->_indel = __pyx_v_src->indel; + + /* "csamtools.pyx":98 + * dest._qpos = src.qpos + * dest._indel = src.indel + * dest._level = src.level # <<<<<<<<<<<<<< + * dest._is_del = src.is_del + * dest._is_head = src.is_head + */ + __pyx_v_dest->_level = __pyx_v_src->level; + + /* "csamtools.pyx":99 + * dest._indel = src.indel + * dest._level = src.level + * dest._is_del = src.is_del # <<<<<<<<<<<<<< + * dest._is_head = src.is_head + * dest._is_tail = src.is_tail + */ + __pyx_v_dest->_is_del = __pyx_v_src->is_del; + + /* "csamtools.pyx":100 + * dest._level = src.level + * dest._is_del = src.is_del + * dest._is_head = src.is_head # <<<<<<<<<<<<<< + * dest._is_tail = src.is_tail + * return dest + */ + __pyx_v_dest->_is_head = __pyx_v_src->is_head; + + /* "csamtools.pyx":101 + * dest._is_del = src.is_del + * dest._is_head = src.is_head + * dest._is_tail = src.is_tail # <<<<<<<<<<<<<< + * return dest + * + */ + __pyx_v_dest->_is_tail = __pyx_v_src->is_tail; + + /* "csamtools.pyx":102 + * dest._is_head = src.is_head + * dest._is_tail = src.is_tail + * return dest # <<<<<<<<<<<<<< + * + * ##################################################################### + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_dest)); + __pyx_r = ((PyObject *)__pyx_v_dest); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.makePileupRead"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dest); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":109 + * ## Generic callbacks for inserting python callbacks. + * ##################################################################### + * cdef int fetch_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<< + * '''callback for bam_fetch. + * + */ + +static int __pyx_f_9csamtools_fetch_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) { + PyObject *__pyx_v_a; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("fetch_callback"); + __Pyx_TraceCall("fetch_callback", __pyx_f[0], 109); + __pyx_v_a = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":114 + * calls function in *f* with a new :class:`AlignedRead` object as parameter. + * ''' + * a = makeAlignedRead( alignment ) # <<<<<<<<<<<<<< + * (f)(a) + * + */ + __pyx_t_1 = __pyx_f_9csamtools_makeAlignedRead(__pyx_v_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":115 + * ''' + * a = makeAlignedRead( alignment ) + * (f)(a) # <<<<<<<<<<<<<< + * + * class PileupColumn(object): + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + __pyx_t_2 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("csamtools.fetch_callback"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_a); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":130 + * list of reads (:class:`pysam.PileupRead`) aligned to this column + * ''' + * def __str__(self): # <<<<<<<<<<<<<< + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" + "\n".join( map(str, self.pileups) ) + */ + +static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_12PileupColumn___str__[] = "PileupColumn.__str__(self)"; +static PyMethodDef __pyx_mdef_9csamtools_12PileupColumn___str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_9csamtools_12PileupColumn___str__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12PileupColumn___str__)}; +static PyObject *__pyx_pf_9csamtools_12PileupColumn___str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__str__"); + __Pyx_TraceCall("__str__", __pyx_f[0], 130); + __pyx_self = __pyx_self; + + /* "csamtools.pyx":131 + * ''' + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<< + * "\n" + "\n".join( map(str, self.pileups) ) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":132 + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<< + * + * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "csamtools.pyx":131 + * ''' + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<< + * "\n" + "\n".join( map(str, self.pileups) ) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "csamtools.pyx":132 + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" + "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<< + * + * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("csamtools.PileupColumn.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":134 + * "\n" + "\n".join( map(str, self.pileups) ) + * + * cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): # <<<<<<<<<<<<<< + * '''callback for pileup. + * + */ + +static int __pyx_f_9csamtools_pileup_callback(uint32_t __pyx_v_tid, uint32_t __pyx_v_pos, int __pyx_v_n, bam_pileup1_t *__pyx_v_pl, void *__pyx_v_f) { + PyObject *__pyx_v_p; + PyObject *__pyx_v_pileups; + int __pyx_v_x; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("pileup_callback"); + __Pyx_TraceCall("pileup_callback", __pyx_f[0], 134); + __pyx_v_p = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":151 + * ''' + * + * p = PileupColumn() # <<<<<<<<<<<<<< + * p.tid = tid + * p.pos = pos + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__PileupColumn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_p); + __pyx_v_p = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":152 + * + * p = PileupColumn() + * p.tid = tid # <<<<<<<<<<<<<< + * p.pos = pos + * p.n = n + */ + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__tid, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":153 + * p = PileupColumn() + * p.tid = tid + * p.pos = pos # <<<<<<<<<<<<<< + * p.n = n + * pileups = [] + */ + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pos, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":154 + * p.tid = tid + * p.pos = pos + * p.n = n # <<<<<<<<<<<<<< + * pileups = [] + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__n, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":155 + * p.pos = pos + * p.n = n + * pileups = [] # <<<<<<<<<<<<<< + * + * cdef int x + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_pileups)); + __pyx_v_pileups = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":158 + * + * cdef int x + * for x from 0 <= x < n: # <<<<<<<<<<<<<< + * pileups.append( makePileupRead( &(pl[x]) ) ) + * p.pileups = pileups + */ + __pyx_t_3 = __pyx_v_n; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_3; __pyx_v_x++) { + + /* "csamtools.pyx":159 + * cdef int x + * for x from 0 <= x < n: + * pileups.append( makePileupRead( &(pl[x]) ) ) # <<<<<<<<<<<<<< + * p.pileups = pileups + * + */ + if (unlikely(__pyx_v_pileups == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __pyx_f_9csamtools_makePileupRead((&(__pyx_v_pl[__pyx_v_x]))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyList_Append(__pyx_v_pileups, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "csamtools.pyx":160 + * for x from 0 <= x < n: + * pileups.append( makePileupRead( &(pl[x]) ) ) + * p.pileups = pileups # <<<<<<<<<<<<<< + * + * (f)(p) + */ + if (PyObject_SetAttr(__pyx_v_p, __pyx_n_s__pileups, ((PyObject *)__pyx_v_pileups)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":162 + * p.pileups = pileups + * + * (f)(p) # <<<<<<<<<<<<<< + * + * cdef int pileup_fetch_callback( bam1_t *b, void *data): + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_p); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_p); + __Pyx_GIVEREF(__pyx_v_p); + __pyx_t_1 = PyObject_Call(((PyObject *)__pyx_v_f), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("csamtools.pileup_callback"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_p); + __Pyx_DECREF(__pyx_v_pileups); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":164 + * (f)(p) + * + * cdef int pileup_fetch_callback( bam1_t *b, void *data): # <<<<<<<<<<<<<< + * '''callback for bam_fetch. + * + */ + +static int __pyx_f_9csamtools_pileup_fetch_callback(bam1_t *__pyx_v_b, void *__pyx_v_data) { + bam_plbuf_t *__pyx_v_buf; + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("pileup_fetch_callback"); + __Pyx_TraceCall("pileup_fetch_callback", __pyx_f[0], 164); + + /* "csamtools.pyx":170 + * ''' + * cdef bam_plbuf_t * buf + * buf = data # <<<<<<<<<<<<<< + * bam_plbuf_push(b, buf) + * return 0 + */ + __pyx_v_buf = ((bam_plbuf_t *)__pyx_v_data); + + /* "csamtools.pyx":171 + * cdef bam_plbuf_t * buf + * buf = data + * bam_plbuf_push(b, buf) # <<<<<<<<<<<<<< + * return 0 + * + */ + bam_plbuf_push(__pyx_v_b, __pyx_v_buf); + + /* "csamtools.pyx":172 + * buf = data + * bam_plbuf_push(b, buf) + * return 0 # <<<<<<<<<<<<<< + * + * class StderrStore(): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":178 + * stderr is captured. + * ''' + * def __init__(self): # <<<<<<<<<<<<<< + * return + * self.stderr_h, self.stderr_f = tempfile.mkstemp() + */ + +static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_11StderrStore___init__[] = "StderrStore.__init__(self)"; +static PyMethodDef __pyx_mdef_9csamtools_11StderrStore___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore___init__)}; +static PyObject *__pyx_pf_9csamtools_11StderrStore___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 178); + __pyx_self = __pyx_self; + + /* "csamtools.pyx":179 + * ''' + * def __init__(self): + * return # <<<<<<<<<<<<<< + * self.stderr_h, self.stderr_f = tempfile.mkstemp() + * self.stderr_save = Outs( sys.stderr.fileno() ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "csamtools.pyx":180 + * def __init__(self): + * return + * self.stderr_h, self.stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<< + * self.stderr_save = Outs( sys.stderr.fileno() ) + * self.stderr_save.setfd( self.stderr_h ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_h, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_f, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_h, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_f, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "csamtools.pyx":181 + * return + * self.stderr_h, self.stderr_f = tempfile.mkstemp() + * self.stderr_save = Outs( sys.stderr.fileno() ) # <<<<<<<<<<<<<< + * self.stderr_save.setfd( self.stderr_h ) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__stderr_save, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":182 + * self.stderr_h, self.stderr_f = tempfile.mkstemp() + * self.stderr_save = Outs( sys.stderr.fileno() ) + * self.stderr_save.setfd( self.stderr_h ) # <<<<<<<<<<<<<< + * + * def readAndRelease( self ): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.StderrStore.__init__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":184 + * self.stderr_save.setfd( self.stderr_h ) + * + * def readAndRelease( self ): # <<<<<<<<<<<<<< + * return [] + * self.stderr_save.restore() + */ + +static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_11StderrStore_1readAndRelease[] = "StderrStore.readAndRelease(self)"; +static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_1readAndRelease)}; +static PyObject *__pyx_pf_9csamtools_11StderrStore_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_lines; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("readAndRelease"); + __Pyx_TraceCall("readAndRelease", __pyx_f[0], 184); + __pyx_self = __pyx_self; + __pyx_v_lines = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":185 + * + * def readAndRelease( self ): + * return [] # <<<<<<<<<<<<<< + * self.stderr_save.restore() + * lines = [] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "csamtools.pyx":186 + * def readAndRelease( self ): + * return [] + * self.stderr_save.restore() # <<<<<<<<<<<<<< + * lines = [] + * if os.path.exists(self.stderr_f): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__restore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":187 + * return [] + * self.stderr_save.restore() + * lines = [] # <<<<<<<<<<<<<< + * if os.path.exists(self.stderr_f): + * lines = open( self.stderr_f, "r" ).readlines() + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_v_lines); + __pyx_v_lines = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "csamtools.pyx":188 + * self.stderr_save.restore() + * lines = [] + * if os.path.exists(self.stderr_f): # <<<<<<<<<<<<<< + * lines = open( self.stderr_f, "r" ).readlines() + * os.remove( self.stderr_f ) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":189 + * lines = [] + * if os.path.exists(self.stderr_f): + * lines = open( self.stderr_f, "r" ).readlines() # <<<<<<<<<<<<<< + * os.remove( self.stderr_f ) + * return lines + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_lines); + __pyx_v_lines = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":190 + * if os.path.exists(self.stderr_f): + * lines = open( self.stderr_f, "r" ).readlines() + * os.remove( self.stderr_f ) # <<<<<<<<<<<<<< + * return lines + * + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":191 + * lines = open( self.stderr_f, "r" ).readlines() + * os.remove( self.stderr_f ) + * return lines # <<<<<<<<<<<<<< + * + * def release(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lines); + __pyx_r = __pyx_v_lines; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.StderrStore.readAndRelease"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_lines); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":193 + * return lines + * + * def release(self): # <<<<<<<<<<<<<< + * return + * self.stderr_save.restore() + */ + +static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_11StderrStore_2release[] = "StderrStore.release(self)"; +static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_2release)}; +static PyObject *__pyx_pf_9csamtools_11StderrStore_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("release"); + __Pyx_TraceCall("release", __pyx_f[0], 193); + __pyx_self = __pyx_self; + + /* "csamtools.pyx":194 + * + * def release(self): + * return # <<<<<<<<<<<<<< + * self.stderr_save.restore() + * if os.path.exists(self.stderr_f): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "csamtools.pyx":195 + * def release(self): + * return + * self.stderr_save.restore() # <<<<<<<<<<<<<< + * if os.path.exists(self.stderr_f): + * os.remove( self.stderr_f ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_save); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__restore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":196 + * return + * self.stderr_save.restore() + * if os.path.exists(self.stderr_f): # <<<<<<<<<<<<<< + * os.remove( self.stderr_f ) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":197 + * self.stderr_save.restore() + * if os.path.exists(self.stderr_f): + * os.remove( self.stderr_f ) # <<<<<<<<<<<<<< + * + * def __del__(self): + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__stderr_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.StderrStore.release"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":199 + * os.remove( self.stderr_f ) + * + * def __del__(self): # <<<<<<<<<<<<<< + * self.release() + * + */ + +static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_11StderrStore_3__del__[] = "StderrStore.__del__(self)"; +static PyMethodDef __pyx_mdef_9csamtools_11StderrStore_3__del__ = {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_9csamtools_11StderrStore_3__del__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11StderrStore_3__del__)}; +static PyObject *__pyx_pf_9csamtools_11StderrStore_3__del__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__del__"); + __Pyx_TraceCall("__del__", __pyx_f[0], 199); + __pyx_self = __pyx_self; + + /* "csamtools.pyx":200 + * + * def __del__(self): + * self.release() # <<<<<<<<<<<<<< + * + * class StderrStoreWindows(): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.StderrStore.__del__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":204 + * class StderrStoreWindows(): + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass # <<<<<<<<<<<<<< + * def readAndRelease(self): return [] + * def release(self): pass + */ + +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_18StderrStoreWindows___init__[] = "StderrStoreWindows.__init__(self)"; +static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows___init__, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows___init__)}; +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 204); + __pyx_self = __pyx_self; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":205 + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass + * def readAndRelease(self): return [] # <<<<<<<<<<<<<< + * def release(self): pass + * + */ + +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease[] = "StderrStoreWindows.readAndRelease(self)"; +static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease = {__Pyx_NAMESTR("readAndRelease"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_1readAndRelease)}; +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_1readAndRelease(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("readAndRelease"); + __Pyx_TraceCall("readAndRelease", __pyx_f[0], 205); + __pyx_self = __pyx_self; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.StderrStoreWindows.readAndRelease"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":206 + * def __init__(self): pass + * def readAndRelease(self): return [] + * def release(self): pass # <<<<<<<<<<<<<< + * + * if platform.system()=='Windows': + */ + +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_18StderrStoreWindows_2release[] = "StderrStoreWindows.release(self)"; +static PyMethodDef __pyx_mdef_9csamtools_18StderrStoreWindows_2release = {__Pyx_NAMESTR("release"), (PyCFunction)__pyx_pf_9csamtools_18StderrStoreWindows_2release, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_18StderrStoreWindows_2release)}; +static PyObject *__pyx_pf_9csamtools_18StderrStoreWindows_2release(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("release"); + __Pyx_TraceCall("release", __pyx_f[0], 206); + __pyx_self = __pyx_self; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":260 + * cdef faidx_t * fastafile + * + * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<< + * self.fastafile = NULL + * self._filename = NULL + */ + +static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_9Fastafile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 260); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + + /* "csamtools.pyx":261 + * + * def __cinit__(self, *args, **kwargs ): + * self.fastafile = NULL # <<<<<<<<<<<<<< + * self._filename = NULL + * self._open( *args, **kwargs ) + */ + ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL; + + /* "csamtools.pyx":262 + * def __cinit__(self, *args, **kwargs ): + * self.fastafile = NULL + * self._filename = NULL # <<<<<<<<<<<<<< + * self._open( *args, **kwargs ) + * + */ + ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = NULL; + + /* "csamtools.pyx":263 + * self.fastafile = NULL + * self._filename = NULL + * self._open( *args, **kwargs ) # <<<<<<<<<<<<<< + * + * def _isOpen( self ): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Fastafile.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":265 + * self._open( *args, **kwargs ) + * + * def _isOpen( self ): # <<<<<<<<<<<<<< + * '''return true if samfile has been opened.''' + * return self.fastafile != NULL + */ + +static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_9Fastafile_1_isOpen[] = "Fastafile._isOpen(self)\nreturn true if samfile has been opened."; +static PyObject *__pyx_pf_9csamtools_9Fastafile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_isOpen"); + __Pyx_TraceCall("_isOpen", __pyx_f[0], 265); + + /* "csamtools.pyx":267 + * def _isOpen( self ): + * '''return true if samfile has been opened.''' + * return self.fastafile != NULL # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.Fastafile._isOpen"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":269 + * return self.fastafile != NULL + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.fastafile == NULL: + * raise ValueError( "calling len() on closed file" ) + */ + +static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_9csamtools_9Fastafile_2__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__len__"); + __Pyx_TraceCall("__len__", __pyx_f[0], 269); + + /* "csamtools.pyx":270 + * + * def __len__(self): + * if self.fastafile == NULL: # <<<<<<<<<<<<<< + * raise ValueError( "calling len() on closed file" ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":271 + * def __len__(self): + * if self.fastafile == NULL: + * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<< + * + * return faidx_fetch_nseq(self.fastafile) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":273 + * raise ValueError( "calling len() on closed file" ) + * + * return faidx_fetch_nseq(self.fastafile) # <<<<<<<<<<<<<< + * + * def _open( self, + */ + __pyx_r = faidx_fetch_nseq(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Fastafile.__len__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":275 + * return faidx_fetch_nseq(self.fastafile) + * + * def _open( self, # <<<<<<<<<<<<<< + * char * filename ): + * '''open an indexed fasta file. + */ + +static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename); /*proto*/ +static char __pyx_doc_9csamtools_9Fastafile_3_open[] = "Fastafile._open(self, char *filename)\nopen an indexed fasta file.\n\n This method expects an indexed fasta file.\n "; +static PyObject *__pyx_pf_9csamtools_9Fastafile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_arg_filename) { + char *__pyx_v_filename; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_open"); + __Pyx_TraceCall("_open", __pyx_f[0], 275); + assert(__pyx_arg_filename); { + __pyx_v_filename = PyBytes_AsString(__pyx_arg_filename); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Fastafile._open"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":283 + * + * # close a previously opened file + * if self.fastafile != NULL: self.close() # <<<<<<<<<<<<<< + * if self._filename != NULL: free(self._filename) + * self._filename = strdup(filename) + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL); + if (__pyx_t_1) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":284 + * # close a previously opened file + * if self.fastafile != NULL: self.close() + * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<< + * self._filename = strdup(filename) + * self.fastafile = fai_load( filename ) + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_1) { + free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":285 + * if self.fastafile != NULL: self.close() + * if self._filename != NULL: free(self._filename) + * self._filename = strdup(filename) # <<<<<<<<<<<<<< + * self.fastafile = fai_load( filename ) + * + */ + ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename); + + /* "csamtools.pyx":286 + * if self._filename != NULL: free(self._filename) + * self._filename = strdup(filename) + * self.fastafile = fai_load( filename ) # <<<<<<<<<<<<<< + * + * if self.fastafile == NULL: + */ + ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = fai_load(__pyx_v_filename); + + /* "csamtools.pyx":288 + * self.fastafile = fai_load( filename ) + * + * if self.fastafile == NULL: # <<<<<<<<<<<<<< + * raise IOError("could not open file `%s`" % filename ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":289 + * + * if self.fastafile == NULL: + * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<< + * + * def close( self ): + */ + __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Fastafile._open"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":291 + * raise IOError("could not open file `%s`" % filename ) + * + * def close( self ): # <<<<<<<<<<<<<< + * if self.fastafile != NULL: + * fai_destroy( self.fastafile ) + */ + +static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_9Fastafile_4close[] = "Fastafile.close(self)"; +static PyObject *__pyx_pf_9csamtools_9Fastafile_4close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("close"); + __Pyx_TraceCall("close", __pyx_f[0], 291); + + /* "csamtools.pyx":292 + * + * def close( self ): + * if self.fastafile != NULL: # <<<<<<<<<<<<<< + * fai_destroy( self.fastafile ) + * self.fastafile = NULL + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile != NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":293 + * def close( self ): + * if self.fastafile != NULL: + * fai_destroy( self.fastafile ) # <<<<<<<<<<<<<< + * self.fastafile = NULL + * + */ + fai_destroy(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile); + + /* "csamtools.pyx":294 + * if self.fastafile != NULL: + * fai_destroy( self.fastafile ) + * self.fastafile = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile = NULL; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":296 + * self.fastafile = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * self.close() + * if self._filename != NULL: free(self._filename) + */ + +static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_9Fastafile_5__dealloc__(PyObject *__pyx_v_self) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 296); + + /* "csamtools.pyx":297 + * + * def __dealloc__(self): + * self.close() # <<<<<<<<<<<<<< + * if self._filename != NULL: free(self._filename) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":298 + * def __dealloc__(self): + * self.close() + * if self._filename != NULL: free(self._filename) # <<<<<<<<<<<<<< + * + * property filename: + */ + __pyx_t_3 = (((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_3) { + free(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); + goto __pyx_L5; + } + __pyx_L5:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Fastafile.__dealloc__"); + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":302 + * property filename: + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename + */ + +static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_9Fastafile_8filename___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 302); + + /* "csamtools.pyx":303 + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":304 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename # <<<<<<<<<<<<<< + * + * def fetch( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Fastafile.filename.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":306 + * return self._filename + * + * def fetch( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_9Fastafile_6fetch[] = "Fastafile.fetch(self, reference=None, start=None, end=None, region=None)\n*(reference = None, start = None, end = None, region = None)*\n \n fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing. \n \n The region is specified by :term:`reference`, *start* and *end*. \n \n fetch returns an empty string if the region is out of range or addresses an unknown *reference*.\n\n If *reference* is given and *start* is None, the sequence from the \n first base is returned. Similarly, if *end* is None, the sequence \n until the last base is returned.\n \n Alternatively, a samtools :term:`region` string can be supplied.\n "; +static PyObject *__pyx_pf_9csamtools_9Fastafile_6fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + int __pyx_v_length; + char *__pyx_v_seq; + PyObject *__pyx_v_py_seq; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("fetch"); + __Pyx_TraceCall("fetch", __pyx_f[0], 306); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + + /* "csamtools.pyx":307 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "csamtools.pyx":308 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None): + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":309 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None): + * + */ + values[2] = ((PyObject *)Py_None); + + /* "csamtools.pyx":310 + * start = None, + * end = None, + * region = None): # <<<<<<<<<<<<<< + * + * '''*(reference = None, start = None, end = None, region = None)* + */ + values[3] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + } else { + + /* "csamtools.pyx":307 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "csamtools.pyx":308 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None): + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "csamtools.pyx":309 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None): + * + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "csamtools.pyx":310 + * start = None, + * end = None, + * region = None): # <<<<<<<<<<<<<< + * + * '''*(reference = None, start = None, end = None, region = None)* + */ + __pyx_v_region = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Fastafile.fetch"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + __pyx_v_py_seq = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":327 + * ''' + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":328 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * cdef int length + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":333 + * cdef char * seq + * + * if not region: # <<<<<<<<<<<<<< + * if reference is None: raise ValueError( 'no sequence/region supplied.' ) + * if start is None: start = 0 + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "csamtools.pyx":334 + * + * if not region: + * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<< + * if start is None: start = 0 + * if end is None: end = max_pos -1 + */ + __pyx_t_3 = (__pyx_v_reference == Py_None); + if (__pyx_t_3) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":335 + * if not region: + * if reference is None: raise ValueError( 'no sequence/region supplied.' ) + * if start is None: start = 0 # <<<<<<<<<<<<<< + * if end is None: end = max_pos -1 + * + */ + __pyx_t_3 = (__pyx_v_start == Py_None); + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_int_0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":336 + * if reference is None: raise ValueError( 'no sequence/region supplied.' ) + * if start is None: start = 0 + * if end is None: end = max_pos -1 # <<<<<<<<<<<<<< + * + * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) + */ + __pyx_t_3 = (__pyx_v_end == Py_None); + if (__pyx_t_3) { + __pyx_t_2 = PyInt_FromLong((__pyx_v_9csamtools_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "csamtools.pyx":338 + * if end is None: end = max_pos -1 + * + * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) # <<<<<<<<<<<<<< + * if start == end: return "" + * # valid ranges are from 0 to 2^29-1 + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":339 + * + * if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) + * if start == end: return "" # <<<<<<<<<<<<<< + * # valid ranges are from 0 to 2^29-1 + * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_v_end, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); + __pyx_r = ((PyObject *)__pyx_kp_s_12); + goto __pyx_L0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "csamtools.pyx":341 + * if start == end: return "" + * # valid ranges are from 0 to 2^29-1 + * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<< + * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end ) + * # note: faidx_fetch_seq has a bug such that out-of-range access + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { + __Pyx_DECREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "csamtools.pyx":342 + * # valid ranges are from 0 to 2^29-1 + * if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) + * if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<< + * # note: faidx_fetch_seq has a bug such that out-of-range access + * # always returns the last residue. Hence do not use faidx_fetch_seq, + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_int_0, __pyx_v_end, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { + __Pyx_DECREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_9csamtools_max_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "csamtools.pyx":351 + * # end-1, + * # &length) + * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<< + * seq = fai_fetch( self.fastafile, + * region, + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "csamtools.pyx":353 + * region = "%s:%i-%i" % (reference, start+1, end) + * seq = fai_fetch( self.fastafile, + * region, # <<<<<<<<<<<<<< + * &length ) + * else: + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":354 + * seq = fai_fetch( self.fastafile, + * region, + * &length ) # <<<<<<<<<<<<<< + * else: + * # samtools adds a '\0' at the end + */ + __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length)); + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":357 + * else: + * # samtools adds a '\0' at the end + * seq = fai_fetch( self.fastafile, region, &length ) # <<<<<<<<<<<<<< + * + * # copy to python + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_seq = fai_fetch(((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_self)->fastafile, __pyx_t_5, (&__pyx_v_length)); + } + __pyx_L7:; + + /* "csamtools.pyx":360 + * + * # copy to python + * if seq == NULL: # <<<<<<<<<<<<<< + * return "" + * else: + */ + __pyx_t_3 = (__pyx_v_seq == NULL); + if (__pyx_t_3) { + + /* "csamtools.pyx":361 + * # copy to python + * if seq == NULL: + * return "" # <<<<<<<<<<<<<< + * else: + * try: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); + __pyx_r = ((PyObject *)__pyx_kp_s_12); + goto __pyx_L0; + goto __pyx_L15; + } + /*else*/ { + + /* "csamtools.pyx":363 + * return "" + * else: + * try: # <<<<<<<<<<<<<< + * py_seq = PyString_FromStringAndSize(seq, length) + * finally: + */ + /*try:*/ { + + /* "csamtools.pyx":364 + * else: + * try: + * py_seq = PyString_FromStringAndSize(seq, length) # <<<<<<<<<<<<<< + * finally: + * free(seq) + */ + __pyx_t_1 = PyString_FromStringAndSize(__pyx_v_seq, __pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L17;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_py_seq); + __pyx_v_py_seq = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "csamtools.pyx":366 + * py_seq = PyString_FromStringAndSize(seq, length) + * finally: + * free(seq) # <<<<<<<<<<<<<< + * + * return py_seq + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L18; + __pyx_L17: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L18; + } + __pyx_L18:; + free(__pyx_v_seq); + switch (__pyx_why) { + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + } + __pyx_L15:; + + /* "csamtools.pyx":368 + * free(seq) + * + * return py_seq # <<<<<<<<<<<<<< + * + * cdef char * _fetch( self, char * reference, int start, int end, int * length ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_py_seq); + __pyx_r = __pyx_v_py_seq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Fastafile.fetch"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_py_seq); + __Pyx_DECREF(__pyx_v_start); + __Pyx_DECREF(__pyx_v_end); + __Pyx_DECREF(__pyx_v_region); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":370 + * return py_seq + * + * cdef char * _fetch( self, char * reference, int start, int end, int * length ): # <<<<<<<<<<<<<< + * '''fetch sequence for reference, start and end''' + * + */ + +static char *__pyx_f_9csamtools_9Fastafile__fetch(struct __pyx_obj_9csamtools_Fastafile *__pyx_v_self, char *__pyx_v_reference, int __pyx_v_start, int __pyx_v_end, int *__pyx_v_length) { + char *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_fetch"); + __Pyx_TraceCall("_fetch", __pyx_f[0], 370); + + /* "csamtools.pyx":377 + * start, + * end-1, + * length ) # <<<<<<<<<<<<<< + * + * #------------------------------------------------------------------------ + */ + __pyx_r = faidx_fetch_seq(__pyx_v_self->fastafile, __pyx_v_reference, __pyx_v_start, (__pyx_v_end - 1), __pyx_v_length); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":382 + * #------------------------------------------------------------------------ + * #------------------------------------------------------------------------ + * cdef int count_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<< + * '''callback for bam_fetch - count number of reads. + * ''' + */ + +static int __pyx_f_9csamtools_count_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) { + int *__pyx_v_counter; + int __pyx_r; + long __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("count_callback"); + __Pyx_TraceCall("count_callback", __pyx_f[0], 382); + + /* "csamtools.pyx":385 + * '''callback for bam_fetch - count number of reads. + * ''' + * cdef int* counter = (f) # <<<<<<<<<<<<<< + * counter[0] += 1; + * + */ + __pyx_v_counter = ((int *)__pyx_v_f); + + /* "csamtools.pyx":386 + * ''' + * cdef int* counter = (f) + * counter[0] += 1; # <<<<<<<<<<<<<< + * + * ctypedef struct MateData: + */ + __pyx_t_1 = 0; + (__pyx_v_counter[__pyx_t_1]) = ((__pyx_v_counter[__pyx_t_1]) + 1); + + __pyx_r = 0; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":396 + * #------------------------------------------------------------------------ + * #------------------------------------------------------------------------ + * cdef int mate_callback( bam1_t *alignment, void *f): # <<<<<<<<<<<<<< + * '''callback for bam_fetch = filter mate + * ''' + */ + +static int __pyx_f_9csamtools_mate_callback(bam1_t *__pyx_v_alignment, void *__pyx_v_f) { + __pyx_t_9csamtools_MateData *__pyx_v_d; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("mate_callback"); + __Pyx_TraceCall("mate_callback", __pyx_f[0], 396); + + /* "csamtools.pyx":399 + * '''callback for bam_fetch = filter mate + * ''' + * cdef MateData * d = (f) # <<<<<<<<<<<<<< + * # printf("mate = %p, name1 = %s, name2=%s\t%i\t%i\t%i\n", + * # d.mate, d.name, bam1_qname(alignment), + */ + __pyx_v_d = ((__pyx_t_9csamtools_MateData *)__pyx_v_f); + + /* "csamtools.pyx":404 + * # d.flag, alignment.core.flag, alignment.core.flag & d.flag) + * + * if d.mate == NULL: # <<<<<<<<<<<<<< + * # could be sped up by comparing the lengths of query strings first + * # using l_qname + */ + __pyx_t_1 = (__pyx_v_d->mate == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":410 + * # also, make sure that we get the other read by comparing + * # the flags + * if alignment.core.flag & d.flag != 0 and \ # <<<<<<<<<<<<<< + * strcmp( bam1_qname( alignment ), d.name ) == 0: + * d.mate = bam_dup1( alignment ) + */ + __pyx_t_1 = ((__pyx_v_alignment->core.flag & __pyx_v_d->flag) != 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":411 + * # the flags + * if alignment.core.flag & d.flag != 0 and \ + * strcmp( bam1_qname( alignment ), d.name ) == 0: # <<<<<<<<<<<<<< + * d.mate = bam_dup1( alignment ) + * + */ + __pyx_t_2 = (strcmp(bam1_qname(__pyx_v_alignment), __pyx_v_d->name) == 0); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "csamtools.pyx":412 + * if alignment.core.flag & d.flag != 0 and \ + * strcmp( bam1_qname( alignment ), d.name ) == 0: + * d.mate = bam_dup1( alignment ) # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_d->mate = bam_dup1(__pyx_v_alignment); + goto __pyx_L4; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + __pyx_r = 0; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":458 + * ''' + * + * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<< + * self.samfile = NULL + * self._filename = NULL + */ + +static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_7Samfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 458); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + + /* "csamtools.pyx":459 + * + * def __cinit__(self, *args, **kwargs ): + * self.samfile = NULL # <<<<<<<<<<<<<< + * self._filename = NULL + * self.isbam = False + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL; + + /* "csamtools.pyx":460 + * def __cinit__(self, *args, **kwargs ): + * self.samfile = NULL + * self._filename = NULL # <<<<<<<<<<<<<< + * self.isbam = False + * self.isstream = False + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = NULL; + + /* "csamtools.pyx":461 + * self.samfile = NULL + * self._filename = NULL + * self.isbam = False # <<<<<<<<<<<<<< + * self.isstream = False + * self._open( *args, **kwargs ) + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = 0; + + /* "csamtools.pyx":462 + * self._filename = NULL + * self.isbam = False + * self.isstream = False # <<<<<<<<<<<<<< + * self._open( *args, **kwargs ) + * + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = 0; + + /* "csamtools.pyx":463 + * self.isbam = False + * self.isstream = False + * self._open( *args, **kwargs ) # <<<<<<<<<<<<<< + * + * # allocate memory for iterator + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":466 + * + * # allocate memory for iterator + * self.b = calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<< + * + * def _isOpen( self ): + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Samfile.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":468 + * self.b = calloc(1, sizeof(bam1_t)) + * + * def _isOpen( self ): # <<<<<<<<<<<<<< + * '''return true if samfile has been opened.''' + * return self.samfile != NULL + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_1_isOpen[] = "Samfile._isOpen(self)\nreturn true if samfile has been opened."; +static PyObject *__pyx_pf_9csamtools_7Samfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_isOpen"); + __Pyx_TraceCall("_isOpen", __pyx_f[0], 468); + + /* "csamtools.pyx":470 + * def _isOpen( self ): + * '''return true if samfile has been opened.''' + * return self.samfile != NULL # <<<<<<<<<<<<<< + * + * def _hasIndex( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.Samfile._isOpen"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":472 + * return self.samfile != NULL + * + * def _hasIndex( self ): # <<<<<<<<<<<<<< + * '''return true if samfile has an existing (and opened) index.''' + * return self.index != NULL + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_2_hasIndex[] = "Samfile._hasIndex(self)\nreturn true if samfile has an existing (and opened) index."; +static PyObject *__pyx_pf_9csamtools_7Samfile_2_hasIndex(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_hasIndex"); + __Pyx_TraceCall("_hasIndex", __pyx_f[0], 472); + + /* "csamtools.pyx":474 + * def _hasIndex( self ): + * '''return true if samfile has an existing (and opened) index.''' + * return self.index != NULL # <<<<<<<<<<<<<< + * + * def _open( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.Samfile._hasIndex"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":476 + * return self.index != NULL + * + * def _open( self, # <<<<<<<<<<<<<< + * char * filename, + * mode = None, + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_3_open[] = "Samfile._open(self, char *filename, mode=None, Samfile template=None, referencenames=None, referencelengths=None, text=None, header=None, port=None, add_sq_text=True)\nopen a sam/bam file.\n\n If _open is called on an existing bamfile, the current file will be\n closed and a new file will be opened.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_3_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_filename; + PyObject *__pyx_v_mode = 0; + struct __pyx_obj_9csamtools_Samfile *__pyx_v_template = 0; + PyObject *__pyx_v_referencenames = 0; + PyObject *__pyx_v_referencelengths = 0; + PyObject *__pyx_v_text = 0; + PyObject *__pyx_v_header = 0; + PyObject *__pyx_v_port = 0; + PyObject *__pyx_v_add_sq_text = 0; + PyObject *__pyx_v_msg; + bam_header_t *__pyx_v_header_to_write; + char *__pyx_v_ctext; + PyObject *__pyx_v_n; + PyObject *__pyx_v_x; + PyObject *__pyx_v_name; + PyObject *__pyx_v_store; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + size_t __pyx_t_11; + int32_t __pyx_t_12; + long __pyx_t_13; + uint32_t __pyx_t_14; + char *__pyx_t_15; + int __pyx_t_16; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,&__pyx_n_s__template,&__pyx_n_s__referencenames,&__pyx_n_s__referencelengths,&__pyx_n_s__text,&__pyx_n_s__header,&__pyx_n_s__port,&__pyx_n_s__add_sq_text,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_open"); + __Pyx_TraceCall("_open", __pyx_f[0], 476); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + + /* "csamtools.pyx":478 + * def _open( self, + * char * filename, + * mode = None, # <<<<<<<<<<<<<< + * Samfile template = None, + * referencenames = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":479 + * char * filename, + * mode = None, + * Samfile template = None, # <<<<<<<<<<<<<< + * referencenames = None, + * referencelengths = None, + */ + values[2] = (PyObject *)((struct __pyx_obj_9csamtools_Samfile *)Py_None); + + /* "csamtools.pyx":480 + * mode = None, + * Samfile template = None, + * referencenames = None, # <<<<<<<<<<<<<< + * referencelengths = None, + * text = None, + */ + values[3] = ((PyObject *)Py_None); + + /* "csamtools.pyx":481 + * Samfile template = None, + * referencenames = None, + * referencelengths = None, # <<<<<<<<<<<<<< + * text = None, + * header = None, + */ + values[4] = ((PyObject *)Py_None); + + /* "csamtools.pyx":482 + * referencenames = None, + * referencelengths = None, + * text = None, # <<<<<<<<<<<<<< + * header = None, + * port = None, + */ + values[5] = ((PyObject *)Py_None); + + /* "csamtools.pyx":483 + * referencelengths = None, + * text = None, + * header = None, # <<<<<<<<<<<<<< + * port = None, + * add_sq_text = True, + */ + values[6] = ((PyObject *)Py_None); + + /* "csamtools.pyx":484 + * text = None, + * header = None, + * port = None, # <<<<<<<<<<<<<< + * add_sq_text = True, + * ): + */ + values[7] = ((PyObject *)Py_None); + values[8] = __pyx_k_16; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__template); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencenames); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__referencelengths); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__text); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__port); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__add_sq_text); + if (value) { values[8] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = values[1]; + __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)values[2]); + __pyx_v_referencenames = values[3]; + __pyx_v_referencelengths = values[4]; + __pyx_v_text = values[5]; + __pyx_v_header = values[6]; + __pyx_v_port = values[7]; + __pyx_v_add_sq_text = values[8]; + } else { + + /* "csamtools.pyx":478 + * def _open( self, + * char * filename, + * mode = None, # <<<<<<<<<<<<<< + * Samfile template = None, + * referencenames = None, + */ + __pyx_v_mode = ((PyObject *)Py_None); + + /* "csamtools.pyx":479 + * char * filename, + * mode = None, + * Samfile template = None, # <<<<<<<<<<<<<< + * referencenames = None, + * referencelengths = None, + */ + __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); + + /* "csamtools.pyx":480 + * mode = None, + * Samfile template = None, + * referencenames = None, # <<<<<<<<<<<<<< + * referencelengths = None, + * text = None, + */ + __pyx_v_referencenames = ((PyObject *)Py_None); + + /* "csamtools.pyx":481 + * Samfile template = None, + * referencenames = None, + * referencelengths = None, # <<<<<<<<<<<<<< + * text = None, + * header = None, + */ + __pyx_v_referencelengths = ((PyObject *)Py_None); + + /* "csamtools.pyx":482 + * referencenames = None, + * referencelengths = None, + * text = None, # <<<<<<<<<<<<<< + * header = None, + * port = None, + */ + __pyx_v_text = ((PyObject *)Py_None); + + /* "csamtools.pyx":483 + * referencelengths = None, + * text = None, + * header = None, # <<<<<<<<<<<<<< + * port = None, + * add_sq_text = True, + */ + __pyx_v_header = ((PyObject *)Py_None); + + /* "csamtools.pyx":484 + * text = None, + * header = None, + * port = None, # <<<<<<<<<<<<<< + * add_sq_text = True, + * ): + */ + __pyx_v_port = ((PyObject *)Py_None); + __pyx_v_add_sq_text = __pyx_k_16; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: __pyx_v_add_sq_text = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: __pyx_v_port = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: __pyx_v_header = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: __pyx_v_referencelengths = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_referencenames = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_template = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 2)); + case 2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile._open"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_text); + __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_n = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_x = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_store = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_template), __pyx_ptype_9csamtools_Samfile, 1, "template", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":494 + * + * # read mode autodetection + * if mode is None: # <<<<<<<<<<<<<< + * try: + * self._open(filename, 'rb', template=template, + */ + __pyx_t_1 = (__pyx_v_mode == Py_None); + if (__pyx_t_1) { + + /* "csamtools.pyx":495 + * # read mode autodetection + * if mode is None: + * try: # <<<<<<<<<<<<<< + * self._open(filename, 'rb', template=template, + * referencenames=referencenames, + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "csamtools.pyx":496 + * if mode is None: + * try: + * self._open(filename, 'rb', template=template, # <<<<<<<<<<<<<< + * referencenames=referencenames, + * referencelengths=referencelengths, + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__rb)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rb)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + + /* "csamtools.pyx":497 + * try: + * self._open(filename, 'rb', template=template, + * referencenames=referencenames, # <<<<<<<<<<<<<< + * referencelengths=referencelengths, + * text=text, header=header, port=port) + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + + /* "csamtools.pyx":498 + * self._open(filename, 'rb', template=template, + * referencenames=referencenames, + * referencelengths=referencelengths, # <<<<<<<<<<<<<< + * text=text, header=header, port=port) + * return + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + + /* "csamtools.pyx":499 + * referencenames=referencenames, + * referencelengths=referencelengths, + * text=text, header=header, port=port) # <<<<<<<<<<<<<< + * return + * except ValueError, msg: + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "csamtools.pyx":500 + * referencelengths=referencelengths, + * text=text, header=header, port=port) + * return # <<<<<<<<<<<<<< + * except ValueError, msg: + * pass + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L11_try_return; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L14_try_end; + __pyx_L11_try_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "csamtools.pyx":501 + * text=text, header=header, port=port) + * return + * except ValueError, msg: # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_6) { + __Pyx_AddTraceback("csamtools.Samfile._open"); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_msg); + __pyx_v_msg = __pyx_t_3; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L14_try_end:; + } + + /* "csamtools.pyx":504 + * pass + * + * self._open(filename, 'r', template=template, # <<<<<<<<<<<<<< + * referencenames=referencenames, + * referencelengths=referencelengths, + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__template), ((PyObject *)__pyx_v_template)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":505 + * + * self._open(filename, 'r', template=template, + * referencenames=referencenames, # <<<<<<<<<<<<<< + * referencelengths=referencelengths, + * text=text, header=header, port=port) + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencenames), __pyx_v_referencenames) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":506 + * self._open(filename, 'r', template=template, + * referencenames=referencenames, + * referencelengths=referencelengths, # <<<<<<<<<<<<<< + * text=text, header=header, port=port) + * return + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__referencelengths), __pyx_v_referencelengths) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":507 + * referencenames=referencenames, + * referencelengths=referencelengths, + * text=text, header=header, port=port) # <<<<<<<<<<<<<< + * return + * + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__text), __pyx_v_text) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__header), __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__port), __pyx_v_port) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":508 + * referencelengths=referencelengths, + * text=text, header=header, port=port) + * return # <<<<<<<<<<<<<< + * + * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":510 + * return + * + * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<< + * assert filename != NULL + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __Pyx_INCREF(__pyx_v_mode); + __pyx_t_2 = __pyx_v_mode; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __pyx_t_1; + if (!__pyx_t_7) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_1; + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_7; + } + if (!__pyx_t_1) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (!__pyx_t_7) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wb), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_1; + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_7; + } + if (!__pyx_t_1) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wh), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (!__pyx_t_7) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__wbu), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_1; + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_7; + } + if (!__pyx_t_1) { + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__rU), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_1; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_7)) { + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_v_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":511 + * + * assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode + * assert filename != NULL # <<<<<<<<<<<<<< + * + * # close a previously opened file + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_filename != NULL))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":514 + * + * # close a previously opened file + * if self.samfile != NULL: self.close() # <<<<<<<<<<<<<< + * self.samfile = NULL + * + */ + __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL); + if (__pyx_t_7) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "csamtools.pyx":515 + * # close a previously opened file + * if self.samfile != NULL: self.close() + * self.samfile = NULL # <<<<<<<<<<<<<< + * + * cdef bam_header_t * header_to_write + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL; + + /* "csamtools.pyx":518 + * + * cdef bam_header_t * header_to_write + * header_to_write = NULL # <<<<<<<<<<<<<< + * + * if self._filename != NULL: free(self._filename ) + */ + __pyx_v_header_to_write = NULL; + + /* "csamtools.pyx":520 + * header_to_write = NULL + * + * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<< + * self._filename = strdup( filename ) + * self.isstream = strcmp( filename, "-" ) == 0 + */ + __pyx_t_7 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_7) { + free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); + goto __pyx_L18; + } + __pyx_L18:; + + /* "csamtools.pyx":521 + * + * if self._filename != NULL: free(self._filename ) + * self._filename = strdup( filename ) # <<<<<<<<<<<<<< + * self.isstream = strcmp( filename, "-" ) == 0 + * + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename); + + /* "csamtools.pyx":522 + * if self._filename != NULL: free(self._filename ) + * self._filename = strdup( filename ) + * self.isstream = strcmp( filename, "-" ) == 0 # <<<<<<<<<<<<<< + * + * self.isbam = len(mode) > 1 and mode[1] == 'b' + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream = (strcmp(__pyx_v_filename, __pyx_k_18) == 0); + + /* "csamtools.pyx":524 + * self.isstream = strcmp( filename, "-" ) == 0 + * + * self.isbam = len(mode) > 1 and mode[1] == 'b' # <<<<<<<<<<<<<< + * + * self.isremote = strncmp(filename,"http:",5) == 0 or \ + */ + __pyx_t_9 = PyObject_Length(__pyx_v_mode); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_t_9 > 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__b), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + } else { + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam = __pyx_t_6; + + /* "csamtools.pyx":526 + * self.isbam = len(mode) > 1 and mode[1] == 'b' + * + * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<< + * strncmp(filename,"ftp:",4) == 0 + * + */ + __pyx_t_7 = (strncmp(__pyx_v_filename, __pyx_k_19, 5) == 0); + if (!__pyx_t_7) { + + /* "csamtools.pyx":527 + * + * self.isremote = strncmp(filename,"http:",5) == 0 or \ + * strncmp(filename,"ftp:",4) == 0 # <<<<<<<<<<<<<< + * + * cdef char * ctext + */ + __pyx_t_1 = (strncmp(__pyx_v_filename, __pyx_k_20, 4) == 0); + __pyx_t_8 = __pyx_t_1; + } else { + __pyx_t_8 = __pyx_t_7; + } + + /* "csamtools.pyx":526 + * self.isbam = len(mode) > 1 and mode[1] == 'b' + * + * self.isremote = strncmp(filename,"http:",5) == 0 or \ # <<<<<<<<<<<<<< + * strncmp(filename,"ftp:",4) == 0 + * + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote = __pyx_t_8; + + /* "csamtools.pyx":530 + * + * cdef char * ctext + * ctext = NULL # <<<<<<<<<<<<<< + * + * if mode[0] == 'w': + */ + __pyx_v_ctext = NULL; + + /* "csamtools.pyx":532 + * ctext = NULL + * + * if mode[0] == 'w': # <<<<<<<<<<<<<< + * # open file for writing + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_8) { + + /* "csamtools.pyx":536 + * + * # header structure (used for writing) + * if template: # <<<<<<<<<<<<<< + * # copy header from another file + * header_to_write = template.samfile.header + */ + __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_8) { + + /* "csamtools.pyx":538 + * if template: + * # copy header from another file + * header_to_write = template.samfile.header # <<<<<<<<<<<<<< + * + * elif header: + */ + __pyx_v_header_to_write = __pyx_v_template->samfile->header; + goto __pyx_L20; + } + + /* "csamtools.pyx":540 + * header_to_write = template.samfile.header + * + * elif header: # <<<<<<<<<<<<<< + * header_to_write = self._buildHeader( header ) + * + */ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_header); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_8) { + + /* "csamtools.pyx":541 + * + * elif header: + * header_to_write = self._buildHeader( header ) # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_v_header_to_write = ((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->_buildHeader(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), __pyx_v_header); + goto __pyx_L20; + } + /*else*/ { + + /* "csamtools.pyx":545 + * else: + * # build header from a target names and lengths + * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing" # <<<<<<<<<<<<<< + * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences" + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_referencenames); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_8) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_referencelengths); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_8; + } + if (unlikely(!__pyx_t_1)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_21)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":546 + * # build header from a target names and lengths + * assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing" + * assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences" # <<<<<<<<<<<<<< + * + * # allocate and fill header + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_9 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Length(__pyx_v_referencelengths); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!(__pyx_t_9 == __pyx_t_10))) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_22)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":549 + * + * # allocate and fill header + * header_to_write = bam_header_init() # <<<<<<<<<<<<<< + * header_to_write.n_targets = len(referencenames) + * n = 0 + */ + __pyx_v_header_to_write = bam_header_init(); + + /* "csamtools.pyx":550 + * # allocate and fill header + * header_to_write = bam_header_init() + * header_to_write.n_targets = len(referencenames) # <<<<<<<<<<<<<< + * n = 0 + * for x in referencenames: n += len(x) + 1 + */ + __pyx_t_10 = PyObject_Length(__pyx_v_referencenames); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_header_to_write->n_targets = __pyx_t_10; + + /* "csamtools.pyx":551 + * header_to_write = bam_header_init() + * header_to_write.n_targets = len(referencenames) + * n = 0 # <<<<<<<<<<<<<< + * for x in referencenames: n += len(x) + 1 + * header_to_write.target_name = calloc(n, sizeof(char*)) + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_int_0; + + /* "csamtools.pyx":552 + * header_to_write.n_targets = len(referencenames) + * n = 0 + * for x in referencenames: n += len(x) + 1 # <<<<<<<<<<<<<< + * header_to_write.target_name = calloc(n, sizeof(char*)) + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) + */ + if (PyList_CheckExact(__pyx_v_referencenames) || PyTuple_CheckExact(__pyx_v_referencenames)) { + __pyx_t_10 = 0; __pyx_t_3 = __pyx_v_referencenames; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_referencenames); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_2); __pyx_t_10++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_9 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_9 + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":553 + * n = 0 + * for x in referencenames: n += len(x) + 1 + * header_to_write.target_name = calloc(n, sizeof(char*)) # <<<<<<<<<<<<<< + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) + * for x from 0 <= x < header_to_write.n_targets: + */ + __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_header_to_write->target_name = ((char **)calloc(__pyx_t_11, (sizeof(char *)))); + + /* "csamtools.pyx":554 + * for x in referencenames: n += len(x) + 1 + * header_to_write.target_name = calloc(n, sizeof(char*)) + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) # <<<<<<<<<<<<<< + * for x from 0 <= x < header_to_write.n_targets: + * header_to_write.target_len[x] = referencelengths[x] + */ + __pyx_t_11 = __Pyx_PyInt_AsSize_t(__pyx_v_n); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_header_to_write->target_len = ((uint32_t *)calloc(__pyx_t_11, (sizeof(uint32_t)))); + + /* "csamtools.pyx":555 + * header_to_write.target_name = calloc(n, sizeof(char*)) + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) + * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<< + * header_to_write.target_len[x] = referencelengths[x] + * name = referencenames[x] + */ + __pyx_t_12 = __pyx_v_header_to_write->n_targets; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) { + __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":556 + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) + * for x from 0 <= x < header_to_write.n_targets: + * header_to_write.target_len[x] = referencelengths[x] # <<<<<<<<<<<<<< + * name = referencenames[x] + * header_to_write.target_name[x] = calloc(len(name)+1, sizeof(char)) + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_header_to_write->target_len[__pyx_t_10]) = __pyx_t_14; + + /* "csamtools.pyx":557 + * for x from 0 <= x < header_to_write.n_targets: + * header_to_write.target_len[x] = referencelengths[x] + * name = referencenames[x] # <<<<<<<<<<<<<< + * header_to_write.target_name[x] = calloc(len(name)+1, sizeof(char)) + * strncpy( header_to_write.target_name[x], name, len(name) ) + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":558 + * header_to_write.target_len[x] = referencelengths[x] + * name = referencenames[x] + * header_to_write.target_name[x] = calloc(len(name)+1, sizeof(char)) # <<<<<<<<<<<<<< + * strncpy( header_to_write.target_name[x], name, len(name) ) + * + */ + __pyx_t_10 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_header_to_write->target_name[__pyx_t_9]) = ((char *)calloc((__pyx_t_10 + 1), (sizeof(char)))); + + /* "csamtools.pyx":559 + * name = referencenames[x] + * header_to_write.target_name[x] = calloc(len(name)+1, sizeof(char)) + * strncpy( header_to_write.target_name[x], name, len(name) ) # <<<<<<<<<<<<<< + * + * # Optionally, if there is no text, add a SAM compatible header to output + */ + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_x); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + strncpy((__pyx_v_header_to_write->target_name[__pyx_t_10]), __pyx_t_15, __pyx_t_9); + __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "csamtools.pyx":555 + * header_to_write.target_name = calloc(n, sizeof(char*)) + * header_to_write.target_len = calloc(n, sizeof(uint32_t)) + * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<< + * header_to_write.target_len[x] = referencelengths[x] + * name = referencenames[x] + */ + __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":563 + * # Optionally, if there is no text, add a SAM compatible header to output + * # file. + * if text is None and add_sq_text: # <<<<<<<<<<<<<< + * text = '' + * for x from 0 <= x < header_to_write.n_targets: + */ + __pyx_t_1 = (__pyx_v_text == Py_None); + if (__pyx_t_1) { + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_add_sq_text); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_1; + } + if (__pyx_t_7) { + + /* "csamtools.pyx":564 + * # file. + * if text is None and add_sq_text: + * text = '' # <<<<<<<<<<<<<< + * for x from 0 <= x < header_to_write.n_targets: + * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = ((PyObject *)__pyx_kp_s_12); + + /* "csamtools.pyx":565 + * if text is None and add_sq_text: + * text = '' + * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<< + * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) + * + */ + __pyx_t_12 = __pyx_v_header_to_write->n_targets; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++) { + __pyx_t_3 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":566 + * text = '' + * for x from 0 <= x < header_to_write.n_targets: + * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) # <<<<<<<<<<<<<< + * + * if text != None: + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_referencenames, __pyx_v_x); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetItem(__pyx_v_referencelengths, __pyx_v_x); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_text, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_13 = __Pyx_PyInt_AsLong(__pyx_v_x); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "csamtools.pyx":565 + * if text is None and add_sq_text: + * text = '' + * for x from 0 <= x < header_to_write.n_targets: # <<<<<<<<<<<<<< + * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L25; + } + __pyx_L25:; + + /* "csamtools.pyx":568 + * text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) + * + * if text != None: # <<<<<<<<<<<<<< + * # copy without \0 + * ctext = text + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_text, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + + /* "csamtools.pyx":570 + * if text != None: + * # copy without \0 + * ctext = text # <<<<<<<<<<<<<< + * header_to_write.l_text = strlen(ctext) + * header_to_write.text = calloc( strlen(ctext), sizeof(char) ) + */ + __pyx_t_15 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ctext = __pyx_t_15; + + /* "csamtools.pyx":571 + * # copy without \0 + * ctext = text + * header_to_write.l_text = strlen(ctext) # <<<<<<<<<<<<<< + * header_to_write.text = calloc( strlen(ctext), sizeof(char) ) + * memcpy( header_to_write.text, ctext, strlen(ctext) ) + */ + __pyx_v_header_to_write->l_text = strlen(__pyx_v_ctext); + + /* "csamtools.pyx":572 + * ctext = text + * header_to_write.l_text = strlen(ctext) + * header_to_write.text = calloc( strlen(ctext), sizeof(char) ) # <<<<<<<<<<<<<< + * memcpy( header_to_write.text, ctext, strlen(ctext) ) + * + */ + __pyx_v_header_to_write->text = ((char *)calloc(strlen(__pyx_v_ctext), (sizeof(char)))); + + /* "csamtools.pyx":573 + * header_to_write.l_text = strlen(ctext) + * header_to_write.text = calloc( strlen(ctext), sizeof(char) ) + * memcpy( header_to_write.text, ctext, strlen(ctext) ) # <<<<<<<<<<<<<< + * + * header_to_write.hash = NULL + */ + memcpy(__pyx_v_header_to_write->text, __pyx_v_ctext, strlen(__pyx_v_ctext)); + goto __pyx_L28; + } + __pyx_L28:; + + /* "csamtools.pyx":575 + * memcpy( header_to_write.text, ctext, strlen(ctext) ) + * + * header_to_write.hash = NULL # <<<<<<<<<<<<<< + * header_to_write.rg2lib = NULL + * + */ + __pyx_v_header_to_write->hash = NULL; + + /* "csamtools.pyx":576 + * + * header_to_write.hash = NULL + * header_to_write.rg2lib = NULL # <<<<<<<<<<<<<< + * + * # open file. Header gets written to file at the same time for bam files + */ + __pyx_v_header_to_write->rg2lib = NULL; + } + __pyx_L20:; + + /* "csamtools.pyx":580 + * # open file. Header gets written to file at the same time for bam files + * # and sam files (in the latter case, the mode needs to be wh) + * store = StderrStore() # <<<<<<<<<<<<<< + * self.samfile = samopen( filename, mode, header_to_write ) + * store.release() + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_store); + __pyx_v_store = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":581 + * # and sam files (in the latter case, the mode needs to be wh) + * store = StderrStore() + * self.samfile = samopen( filename, mode, header_to_write ) # <<<<<<<<<<<<<< + * store.release() + * + */ + __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, __pyx_v_header_to_write); + + /* "csamtools.pyx":582 + * store = StderrStore() + * self.samfile = samopen( filename, mode, header_to_write ) + * store.release() # <<<<<<<<<<<<<< + * + * # bam_header_destroy takes care of cleaning up of all the members + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":585 + * + * # bam_header_destroy takes care of cleaning up of all the members + * if not template and header_to_write != NULL: # <<<<<<<<<<<<<< + * bam_header_destroy( header_to_write ) + * + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_template)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (!__pyx_t_7); + if (__pyx_t_1) { + __pyx_t_7 = (__pyx_v_header_to_write != NULL); + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_1; + } + if (__pyx_t_8) { + + /* "csamtools.pyx":586 + * # bam_header_destroy takes care of cleaning up of all the members + * if not template and header_to_write != NULL: + * bam_header_destroy( header_to_write ) # <<<<<<<<<<<<<< + * + * elif mode[0] == "r": + */ + bam_header_destroy(__pyx_v_header_to_write); + goto __pyx_L29; + } + __pyx_L29:; + goto __pyx_L19; + } + + /* "csamtools.pyx":588 + * bam_header_destroy( header_to_write ) + * + * elif mode[0] == "r": # <<<<<<<<<<<<<< + * # open file for reading + * if strncmp( filename, "-", 1) != 0 and \ + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_8) { + + /* "csamtools.pyx":590 + * elif mode[0] == "r": + * # open file for reading + * if strncmp( filename, "-", 1) != 0 and \ # <<<<<<<<<<<<<< + * not self.isremote and \ + * not os.path.exists( filename ): + */ + __pyx_t_8 = (strncmp(__pyx_v_filename, __pyx_k_18, 1) != 0); + if (__pyx_t_8) { + + /* "csamtools.pyx":591 + * # open file for reading + * if strncmp( filename, "-", 1) != 0 and \ + * not self.isremote and \ # <<<<<<<<<<<<<< + * not os.path.exists( filename ): + * raise IOError( "file `%s` not found" % filename) + */ + __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote); + if (__pyx_t_1) { + + /* "csamtools.pyx":592 + * if strncmp( filename, "-", 1) != 0 and \ + * not self.isremote and \ + * not os.path.exists( filename ): # <<<<<<<<<<<<<< + * raise IOError( "file `%s` not found" % filename) + * + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_16 = (!__pyx_t_7); + __pyx_t_7 = __pyx_t_16; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_8; + } + if (__pyx_t_1) { + + /* "csamtools.pyx":593 + * not self.isremote and \ + * not os.path.exists( filename ): + * raise IOError( "file `%s` not found" % filename) # <<<<<<<<<<<<<< + * + * # try to detect errors + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L30; + } + __pyx_L30:; + + /* "csamtools.pyx":596 + * + * # try to detect errors + * self.samfile = samopen( filename, mode, NULL ) # <<<<<<<<<<<<<< + * if self.samfile == NULL: + * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) + */ + __pyx_t_15 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = samopen(__pyx_v_filename, __pyx_t_15, NULL); + + /* "csamtools.pyx":597 + * # try to detect errors + * self.samfile = samopen( filename, mode, NULL ) + * if self.samfile == NULL: # <<<<<<<<<<<<<< + * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":598 + * self.samfile = samopen( filename, mode, NULL ) + * if self.samfile == NULL: + * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) # <<<<<<<<<<<<<< + * + * if self.samfile.header == NULL: + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L31; + } + __pyx_L31:; + + /* "csamtools.pyx":600 + * raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) + * + * if self.samfile.header == NULL: # <<<<<<<<<<<<<< + * raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":601 + * + * if self.samfile.header == NULL: + * raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode ) # <<<<<<<<<<<<<< + * + * #disabled for autodetection to work + */ + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L32; + } + __pyx_L32:; + goto __pyx_L19; + } + __pyx_L19:; + + /* "csamtools.pyx":608 + * # raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode) + * + * if self.samfile == NULL: # <<<<<<<<<<<<<< + * raise IOError("could not open file `%s`" % filename ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":609 + * + * if self.samfile == NULL: + * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<< + * + * # check for index and open if present + */ + __pyx_t_3 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L33; + } + __pyx_L33:; + + /* "csamtools.pyx":612 + * + * # check for index and open if present + * if mode[0] == "r" and self.isbam: # <<<<<<<<<<<<<< + * + * if not self.isremote: + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + __pyx_t_8 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam; + } else { + __pyx_t_8 = __pyx_t_1; + } + if (__pyx_t_8) { + + /* "csamtools.pyx":614 + * if mode[0] == "r" and self.isbam: + * + * if not self.isremote: # <<<<<<<<<<<<<< + * if not os.path.exists(filename +".bai"): + * self.index = NULL + */ + __pyx_t_8 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote); + if (__pyx_t_8) { + + /* "csamtools.pyx":615 + * + * if not self.isremote: + * if not os.path.exists(filename +".bai"): # <<<<<<<<<<<<<< + * self.index = NULL + * else: + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = (!__pyx_t_8); + if (__pyx_t_1) { + + /* "csamtools.pyx":616 + * if not self.isremote: + * if not os.path.exists(filename +".bai"): + * self.index = NULL # <<<<<<<<<<<<<< + * else: + * # returns NULL if there is no index or index could not be opened + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = NULL; + goto __pyx_L36; + } + /*else*/ { + + /* "csamtools.pyx":619 + * else: + * # returns NULL if there is no index or index could not be opened + * self.index = bam_index_load(filename) # <<<<<<<<<<<<<< + * if self.index == NULL: + * raise IOError("error while opening index `%s` " % filename ) + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename); + + /* "csamtools.pyx":620 + * # returns NULL if there is no index or index could not be opened + * self.index = bam_index_load(filename) + * if self.index == NULL: # <<<<<<<<<<<<<< + * raise IOError("error while opening index `%s` " % filename ) + * else: + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":621 + * self.index = bam_index_load(filename) + * if self.index == NULL: + * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<< + * else: + * self.index = bam_index_load(filename) + */ + __pyx_t_5 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L37; + } + __pyx_L37:; + } + __pyx_L36:; + goto __pyx_L35; + } + /*else*/ { + + /* "csamtools.pyx":623 + * raise IOError("error while opening index `%s` " % filename ) + * else: + * self.index = bam_index_load(filename) # <<<<<<<<<<<<<< + * if self.index == NULL: + * raise IOError("error while opening index `%s` " % filename ) + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index = bam_index_load(__pyx_v_filename); + + /* "csamtools.pyx":624 + * else: + * self.index = bam_index_load(filename) + * if self.index == NULL: # <<<<<<<<<<<<<< + * raise IOError("error while opening index `%s` " % filename ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":625 + * self.index = bam_index_load(filename) + * if self.index == NULL: + * raise IOError("error while opening index `%s` " % filename ) # <<<<<<<<<<<<<< + * + * if not self.isstream: + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L38; + } + __pyx_L38:; + } + __pyx_L35:; + + /* "csamtools.pyx":627 + * raise IOError("error while opening index `%s` " % filename ) + * + * if not self.isstream: # <<<<<<<<<<<<<< + * self.start_offset = bam_tell( self.samfile.x.bam ) + * + */ + __pyx_t_1 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream); + if (__pyx_t_1) { + + /* "csamtools.pyx":628 + * + * if not self.isstream: + * self.start_offset = bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<< + * + * def gettid( self, reference ): + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset = bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam); + goto __pyx_L39; + } + __pyx_L39:; + goto __pyx_L34; + } + __pyx_L34:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("csamtools.Samfile._open"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_msg); + __Pyx_DECREF(__pyx_v_n); + __Pyx_DECREF(__pyx_v_x); + __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF(__pyx_v_store); + __Pyx_DECREF(__pyx_v_text); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":630 + * self.start_offset = bam_tell( self.samfile.x.bam ) + * + * def gettid( self, reference ): # <<<<<<<<<<<<<< + * ''' + * convert :term:`reference` name into numerical :term:`tid` + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_4gettid[] = "Samfile.gettid(self, reference)\n\n convert :term:`reference` name into numerical :term:`tid`\n\n returns -1 if reference is not known.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_4gettid(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("gettid"); + __Pyx_TraceCall("gettid", __pyx_f[0], 630); + + /* "csamtools.pyx":636 + * returns -1 if reference is not known. + * ''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return pysam_reference2tid( self.samfile.header, reference ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":637 + * ''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return pysam_reference2tid( self.samfile.header, reference ) # <<<<<<<<<<<<<< + * + * def getrname( self, tid ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyBytes_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(pysam_reference2tid(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header, __pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.gettid"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":639 + * return pysam_reference2tid( self.samfile.header, reference ) + * + * def getrname( self, tid ): # <<<<<<<<<<<<<< + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_5getrname[] = "Samfile.getrname(self, tid)\n\n convert numerical :term:`tid` into :term:`reference` name."; +static PyObject *__pyx_pf_9csamtools_7Samfile_5getrname(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getrname"); + __Pyx_TraceCall("getrname", __pyx_f[0], 639); + + /* "csamtools.pyx":642 + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":643 + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + * return self.samfile.header.target_name[tid] + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_int_0, __pyx_v_tid, Py_LE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_IsTrue(__pyx_t_2)) { + __Pyx_DECREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_tid, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "csamtools.pyx":644 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<< + * return self.samfile.header.target_name[tid] + * + */ + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_tid); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tid); + __Pyx_GIVEREF(__pyx_v_tid); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":645 + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<< + * + * cdef char * _getrname( self, int tid ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_tid); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_t_5])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.getrname"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":647 + * return self.samfile.header.target_name[tid] + * + * cdef char * _getrname( self, int tid ): # <<<<<<<<<<<<<< + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + */ + +static char *__pyx_f_9csamtools_7Samfile__getrname(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, int __pyx_v_tid) { + char *__pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_getrname"); + __Pyx_TraceCall("_getrname", __pyx_f[0], 647); + + /* "csamtools.pyx":650 + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":651 + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + * return self.samfile.header.target_name[tid] + */ + __pyx_t_4 = (0 <= __pyx_v_tid); + if (__pyx_t_4) { + __pyx_t_4 = (__pyx_v_tid < __pyx_v_self->samfile->header->n_targets); + } + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "csamtools.pyx":652 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) # <<<<<<<<<<<<<< + * return self.samfile.header.target_name[tid] + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->samfile->header->n_targets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; + } + __pyx_L4:; + + /* "csamtools.pyx":653 + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + * return self.samfile.header.target_name[tid] # <<<<<<<<<<<<<< + * + * def _parseRegion( self, + */ + __pyx_r = (__pyx_v_self->samfile->header->target_name[__pyx_v_tid]); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_WriteUnraisable("csamtools.Samfile._getrname"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":655 + * return self.samfile.header.target_name[tid] + * + * def _parseRegion( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_6_parseRegion[] = "Samfile._parseRegion(self, reference=None, start=None, end=None, region=None)\n\n parse region information.\n\n raise ValueError for for invalid regions.\n\n returns a tuple of flag, tid, start and end. Flag indicates\n whether some coordinates were supplied.\n\n Note that regions are 1-based, while start,end are python coordinates.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_6_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + int __pyx_v_rtid; + PY_LONG_LONG __pyx_v_rstart; + PY_LONG_LONG __pyx_v_rend; + PyObject *__pyx_v_parts; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PY_LONG_LONG __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_parseRegion"); + __Pyx_TraceCall("_parseRegion", __pyx_f[0], 655); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + + /* "csamtools.pyx":656 + * + * def _parseRegion( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "csamtools.pyx":657 + * def _parseRegion( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":658 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * ''' + */ + values[2] = ((PyObject *)Py_None); + + /* "csamtools.pyx":659 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * ''' + * parse region information. + */ + values[3] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + } else { + + /* "csamtools.pyx":656 + * + * def _parseRegion( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "csamtools.pyx":657 + * def _parseRegion( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "csamtools.pyx":658 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * ''' + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "csamtools.pyx":659 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * ''' + * parse region information. + */ + __pyx_v_region = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile._parseRegion"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_reference); + __pyx_v_parts = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":678 + * cdef long long rend + * + * rtid = -1 # <<<<<<<<<<<<<< + * rstart = 0 + * rend = max_pos + */ + __pyx_v_rtid = -1; + + /* "csamtools.pyx":679 + * + * rtid = -1 + * rstart = 0 # <<<<<<<<<<<<<< + * rend = max_pos + * if start != None: + */ + __pyx_v_rstart = 0; + + /* "csamtools.pyx":680 + * rtid = -1 + * rstart = 0 + * rend = max_pos # <<<<<<<<<<<<<< + * if start != None: + * try: + */ + __pyx_v_rend = __pyx_v_9csamtools_max_pos; + + /* "csamtools.pyx":681 + * rstart = 0 + * rend = max_pos + * if start != None: # <<<<<<<<<<<<<< + * try: + * rstart = start + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "csamtools.pyx":682 + * rend = max_pos + * if start != None: + * try: # <<<<<<<<<<<<<< + * rstart = start + * except OverflowError: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "csamtools.pyx":683 + * if start != None: + * try: + * rstart = start # <<<<<<<<<<<<<< + * except OverflowError: + * raise ValueError( 'start out of range (%i)' % start ) + */ + __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_start); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_v_rstart = __pyx_t_3; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":684 + * try: + * rstart = start + * except OverflowError: # <<<<<<<<<<<<<< + * raise ValueError( 'start out of range (%i)' % start ) + * + */ + __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError); + if (__pyx_t_4) { + __Pyx_AddTraceback("csamtools.Samfile._parseRegion"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + + /* "csamtools.pyx":685 + * rstart = start + * except OverflowError: + * raise ValueError( 'start out of range (%i)' % start ) # <<<<<<<<<<<<<< + * + * if end != None: + */ + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L14_try_end:; + } + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":687 + * raise ValueError( 'start out of range (%i)' % start ) + * + * if end != None: # <<<<<<<<<<<<<< + * try: + * rend = end + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { + + /* "csamtools.pyx":688 + * + * if end != None: + * try: # <<<<<<<<<<<<<< + * rend = end + * except OverflowError: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "csamtools.pyx":689 + * if end != None: + * try: + * rend = end # <<<<<<<<<<<<<< + * except OverflowError: + * raise ValueError( 'end out of range (%i)' % end ) + */ + __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_end); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L18_error;} + __pyx_v_rend = __pyx_t_3; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L25_try_end; + __pyx_L18_error:; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "csamtools.pyx":690 + * try: + * rend = end + * except OverflowError: # <<<<<<<<<<<<<< + * raise ValueError( 'end out of range (%i)' % end ) + * + */ + __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_OverflowError); + if (__pyx_t_4) { + __Pyx_AddTraceback("csamtools.Samfile._parseRegion"); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_1); + + /* "csamtools.pyx":691 + * rend = end + * except OverflowError: + * raise ValueError( 'end out of range (%i)' % end ) # <<<<<<<<<<<<<< + * + * if region: + */ + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L19_exception_handled; + } + __pyx_L20_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L19_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L25_try_end:; + } + goto __pyx_L17; + } + __pyx_L17:; + + /* "csamtools.pyx":693 + * raise ValueError( 'end out of range (%i)' % end ) + * + * if region: # <<<<<<<<<<<<<< + * parts = re.split( "[:-]", region ) + * reference = parts[0] + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "csamtools.pyx":694 + * + * if region: + * parts = re.split( "[:-]", region ) # <<<<<<<<<<<<<< + * reference = parts[0] + * if len(parts) >= 2: rstart = int(parts[1]) - 1 + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_33)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_33)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33)); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_parts); + __pyx_v_parts = __pyx_t_6; + __pyx_t_6 = 0; + + /* "csamtools.pyx":695 + * if region: + * parts = re.split( "[:-]", region ) + * reference = parts[0] # <<<<<<<<<<<<<< + * if len(parts) >= 2: rstart = int(parts[1]) - 1 + * if len(parts) >= 3: rend = int(parts[2]) + */ + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_reference); + __pyx_v_reference = __pyx_t_6; + __pyx_t_6 = 0; + + /* "csamtools.pyx":696 + * parts = re.split( "[:-]", region ) + * reference = parts[0] + * if len(parts) >= 2: rstart = int(parts[1]) - 1 # <<<<<<<<<<<<<< + * if len(parts) >= 3: rend = int(parts[2]) + * + */ + __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_9 >= 2); + if (__pyx_t_2) { + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rstart = __pyx_t_3; + goto __pyx_L29; + } + __pyx_L29:; + + /* "csamtools.pyx":697 + * reference = parts[0] + * if len(parts) >= 2: rstart = int(parts[1]) - 1 + * if len(parts) >= 3: rend = int(parts[2]) # <<<<<<<<<<<<<< + * + * if not reference: return 0, 0, 0, 0 + */ + __pyx_t_9 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_9 >= 3); + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_parts, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rend = __pyx_t_3; + goto __pyx_L30; + } + __pyx_L30:; + goto __pyx_L28; + } + __pyx_L28:; + + /* "csamtools.pyx":699 + * if len(parts) >= 3: rend = int(parts[2]) + * + * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<< + * + * rtid = self.gettid( reference ) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (!__pyx_t_2); + if (__pyx_t_10) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_r = ((PyObject *)__pyx_k_tuple_34); + goto __pyx_L0; + goto __pyx_L31; + } + __pyx_L31:; + + /* "csamtools.pyx":701 + * if not reference: return 0, 0, 0, 0 + * + * rtid = self.gettid( reference ) # <<<<<<<<<<<<<< + * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) + * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__gettid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_rtid = __pyx_t_4; + + /* "csamtools.pyx":702 + * + * rtid = self.gettid( reference ) + * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) # <<<<<<<<<<<<<< + * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + */ + __pyx_t_10 = (__pyx_v_rtid < 0); + if (__pyx_t_10) { + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L32; + } + __pyx_L32:; + + /* "csamtools.pyx":703 + * rtid = self.gettid( reference ) + * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) + * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<< + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) + */ + __pyx_t_10 = (__pyx_v_rstart > __pyx_v_rend); + if (__pyx_t_10) { + __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L33; + } + __pyx_L33:; + + /* "csamtools.pyx":704 + * if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) + * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<< + * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) + * + */ + __pyx_t_10 = (0 <= __pyx_v_rstart); + if (__pyx_t_10) { + __pyx_t_10 = (__pyx_v_rstart < __pyx_v_9csamtools_max_pos); + } + __pyx_t_2 = (!__pyx_t_10); + if (__pyx_t_2) { + __pyx_t_6 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L34; + } + __pyx_L34:; + + /* "csamtools.pyx":705 + * if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<< + * + * return 1, rtid, rstart, rend + */ + __pyx_t_2 = (0 <= __pyx_v_rend); + if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_rend <= __pyx_v_9csamtools_max_pos); + } + __pyx_t_10 = (!__pyx_t_2); + if (__pyx_t_10) { + __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L35; + } + __pyx_L35:; + + /* "csamtools.pyx":707 + * if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) + * + * return 1, rtid, rstart, rend # <<<<<<<<<<<<<< + * + * def reset( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyLong_FromLongLong(__pyx_v_rstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyLong_FromLongLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_6 = 0; + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_r = ((PyObject *)__pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("csamtools.Samfile._parseRegion"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_parts); + __Pyx_DECREF(__pyx_v_reference); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":709 + * return 1, rtid, rstart, rend + * + * def reset( self ): # <<<<<<<<<<<<<< + * '''reset file position to beginning of read section.''' + * return self.seek( self.start_offset, 0 ) + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_7reset[] = "Samfile.reset(self)\nreset file position to beginning of read section."; +static PyObject *__pyx_pf_9csamtools_7Samfile_7reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("reset"); + __Pyx_TraceCall("reset", __pyx_f[0], 709); + + /* "csamtools.pyx":711 + * def reset( self ): + * '''reset file position to beginning of read section.''' + * return self.seek( self.start_offset, 0 ) # <<<<<<<<<<<<<< + * + * def seek( self, uint64_t offset, int where = 0): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->start_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Samfile.reset"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":713 + * return self.seek( self.start_offset, 0 ) + * + * def seek( self, uint64_t offset, int where = 0): # <<<<<<<<<<<<<< + * ''' + * move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`. + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_8seek[] = "Samfile.seek(self, uint64_t offset, int where=0)\n\n move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_8seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + uint64_t __pyx_v_offset; + int __pyx_v_where; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__where,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("seek"); + __Pyx_TraceCall("seek", __pyx_f[0], 713); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__where); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "seek") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(values[0]); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[1]) { + __pyx_v_where = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_where = ((int)0); + } + } else { + __pyx_v_where = ((int)0); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_where = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_where == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_offset = __Pyx_PyInt_from_py_uint64_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile.seek"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":718 + * ''' + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":719 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":720 + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: # <<<<<<<<<<<<<< + * raise NotImplementedError("seek only available in bam files") + * if self.isstream: + */ + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam); + if (__pyx_t_4) { + + /* "csamtools.pyx":721 + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<< + * if self.isstream: + * raise OSError("seek no available in streams") + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":722 + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") + * if self.isstream: # <<<<<<<<<<<<<< + * raise OSError("seek no available in streams") + * + */ + if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) { + + /* "csamtools.pyx":723 + * raise NotImplementedError("seek only available in bam files") + * if self.isstream: + * raise OSError("seek no available in streams") # <<<<<<<<<<<<<< + * + * return bam_seek( self.samfile.x.bam, offset, where ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":725 + * raise OSError("seek no available in streams") + * + * return bam_seek( self.samfile.x.bam, offset, where ) # <<<<<<<<<<<<<< + * + * def tell( self ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_seek(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, __pyx_v_offset, __pyx_v_where)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.seek"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":727 + * return bam_seek( self.samfile.x.bam, offset, where ) + * + * def tell( self ): # <<<<<<<<<<<<<< + * ''' + * return current file position + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_9tell[] = "Samfile.tell(self)\n\n return current file position\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_9tell(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("tell"); + __Pyx_TraceCall("tell", __pyx_f[0], 727); + + /* "csamtools.pyx":731 + * return current file position + * ''' + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":732 + * ''' + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":733 + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: # <<<<<<<<<<<<<< + * raise NotImplementedError("seek only available in bam files") + * + */ + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam); + if (__pyx_t_4) { + + /* "csamtools.pyx":734 + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<< + * + * return bam_tell( self.samfile.x.bam ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":736 + * raise NotImplementedError("seek only available in bam files") + * + * return bam_tell( self.samfile.x.bam ) # <<<<<<<<<<<<<< + * + * def fetch( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_int64_t(bam_tell(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.tell"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":738 + * return bam_tell( self.samfile.x.bam ) + * + * def fetch( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_10fetch[] = "Samfile.fetch(self, reference=None, start=None, end=None, region=None, callback=None, until_eof=False)\n\n fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by\n :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can \n be supplied.\n\n Without *reference* or *region* all mapped reads will be fetched. The reads will be returned\n ordered by reference sequence, which will not necessarily be the order within the file.\n\n If *until_eof* is given, all reads from the current file position will be returned\n in order as they are within the file. Using this option will also fetch unmapped reads. \n \n If only *reference* is set, all reads aligned to *reference* will be fetched.\n\n The method returns an iterator of type :class:`pysam.IteratorRow` unless\n a *callback is provided. If *callback* is given, the callback will be executed \n for each position within the :term:`region`. Note that callbacks currently work\n only, if *region* or *reference* is given.\n\n Note that a :term:`SAM` file does not allow random access. If *region* or *reference* are given,\n an exception is raised.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_10fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_until_eof = 0; + int __pyx_v_rtid; + int __pyx_v_rstart; + int __pyx_v_rend; + int __pyx_v_has_coord; + int __pyx_v_reopen; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,&__pyx_n_s__until_eof,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("fetch"); + __Pyx_TraceCall("fetch", __pyx_f[0], 738); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + + /* "csamtools.pyx":739 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "csamtools.pyx":740 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":741 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * callback = None, + */ + values[2] = ((PyObject *)Py_None); + + /* "csamtools.pyx":742 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * callback = None, + * until_eof = False ): + */ + values[3] = ((PyObject *)Py_None); + + /* "csamtools.pyx":743 + * end = None, + * region = None, + * callback = None, # <<<<<<<<<<<<<< + * until_eof = False ): + * ''' + */ + values[4] = ((PyObject *)Py_None); + values[5] = __pyx_k_44; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + __pyx_v_callback = values[4]; + __pyx_v_until_eof = values[5]; + } else { + + /* "csamtools.pyx":739 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "csamtools.pyx":740 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "csamtools.pyx":741 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * callback = None, + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "csamtools.pyx":742 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * callback = None, + * until_eof = False ): + */ + __pyx_v_region = ((PyObject *)Py_None); + + /* "csamtools.pyx":743 + * end = None, + * region = None, + * callback = None, # <<<<<<<<<<<<<< + * until_eof = False ): + * ''' + */ + __pyx_v_callback = ((PyObject *)Py_None); + __pyx_v_until_eof = __pyx_k_44; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile.fetch"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":768 + * cdef int rtid, rstart, rend, has_coord + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":769 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":771 + * raise ValueError( "I/O operation on closed file" ) + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<< + * + * if self.isstream: reopen = False + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_has_coord = __pyx_t_8; + __pyx_v_rtid = __pyx_t_9; + __pyx_v_rstart = __pyx_t_10; + __pyx_v_rend = __pyx_t_11; + } else { + __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_has_coord = __pyx_t_11; + __pyx_v_rtid = __pyx_t_10; + __pyx_v_rstart = __pyx_t_9; + __pyx_v_rend = __pyx_t_8; + } + + /* "csamtools.pyx":773 + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + * + * if self.isstream: reopen = False # <<<<<<<<<<<<<< + * else: reopen = True + * + */ + if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isstream) { + __pyx_v_reopen = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":774 + * + * if self.isstream: reopen = False + * else: reopen = True # <<<<<<<<<<<<<< + * + * if self.isbam: + */ + __pyx_v_reopen = 1; + } + __pyx_L7:; + + /* "csamtools.pyx":776 + * else: reopen = True + * + * if self.isbam: # <<<<<<<<<<<<<< + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) + */ + if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) { + + /* "csamtools.pyx":777 + * + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<< + * raise ValueError( "fetch called on bamfile without index" ) + * + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_13 = (!__pyx_t_4); + if (__pyx_t_13) { + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote); + __pyx_t_14 = __pyx_t_4; + } else { + __pyx_t_14 = __pyx_t_13; + } + __pyx_t_13 = __pyx_t_14; + } else { + __pyx_t_13 = __pyx_t_3; + } + if (__pyx_t_13) { + + /* "csamtools.pyx":778 + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":780 + * raise ValueError( "fetch called on bamfile without index" ) + * + * if callback: # <<<<<<<<<<<<<< + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + */ + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_13) { + + /* "csamtools.pyx":781 + * + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + * return bam_fetch(self.samfile.x.bam, + */ + __pyx_t_13 = (!__pyx_v_has_coord); + if (__pyx_t_13) { + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":782 + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<< + * return bam_fetch(self.samfile.x.bam, + * self.index, + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = (!__pyx_t_13); + if (__pyx_t_3) { + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "csamtools.pyx":783 + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + * return bam_fetch(self.samfile.x.bam, # <<<<<<<<<<<<<< + * self.index, + * rtid, + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":789 + * rend, + * callback, + * fetch_callback ) # <<<<<<<<<<<<<< + * else: + * if has_coord: + */ + __pyx_t_5 = PyInt_FromLong(bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)__pyx_v_callback), __pyx_f_9csamtools_fetch_callback)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + /*else*/ { + + /* "csamtools.pyx":791 + * fetch_callback ) + * else: + * if has_coord: # <<<<<<<<<<<<<< + * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) + * else: + */ + if (__pyx_v_has_coord) { + + /* "csamtools.pyx":792 + * else: + * if has_coord: + * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) # <<<<<<<<<<<<<< + * else: + * if until_eof: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "csamtools.pyx":794 + * return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) + * else: + * if until_eof: # <<<<<<<<<<<<<< + * return IteratorRowAll( self, reopen=reopen ) + * else: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "csamtools.pyx":795 + * else: + * if until_eof: + * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<< + * else: + * # AH: check - reason why no reopen for AllRefs? + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__reopen), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L14; + } + /*else*/ { + + /* "csamtools.pyx":798 + * else: + * # AH: check - reason why no reopen for AllRefs? + * return IteratorRowAllRefs(self ) # , reopen=reopen ) # <<<<<<<<<<<<<< + * else: + * # check if header is present - otherwise sam_read1 aborts + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAllRefs)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + } + __pyx_L14:; + } + __pyx_L13:; + } + __pyx_L10:; + goto __pyx_L8; + } + /*else*/ { + + /* "csamtools.pyx":802 + * # check if header is present - otherwise sam_read1 aborts + * # this happens if a bamfile is opened with mode 'r' + * if has_coord: # <<<<<<<<<<<<<< + * raise ValueError ("fetching by region is not available for sam files" ) + * + */ + if (__pyx_v_has_coord) { + + /* "csamtools.pyx":803 + * # this happens if a bamfile is opened with mode 'r' + * if has_coord: + * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<< + * + * if self.samfile.header.n_targets == 0: + */ + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L15; + } + __pyx_L15:; + + /* "csamtools.pyx":805 + * raise ValueError ("fetching by region is not available for sam files" ) + * + * if self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<< + * raise ValueError( "fetch called for samfile without header") + * + */ + __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0); + if (__pyx_t_3) { + + /* "csamtools.pyx":806 + * + * if self.samfile.header.n_targets == 0: + * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L16; + } + __pyx_L16:; + + /* "csamtools.pyx":808 + * raise ValueError( "fetch called for samfile without header") + * + * if callback: # <<<<<<<<<<<<<< + * raise NotImplementedError( "callback not implemented yet" ) + * else: + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "csamtools.pyx":809 + * + * if callback: + * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<< + * else: + * return IteratorRowAll( self, reopen=reopen ) + */ + __pyx_t_6 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L17; + } + /*else*/ { + + /* "csamtools.pyx":811 + * raise NotImplementedError( "callback not implemented yet" ) + * else: + * return IteratorRowAll( self, reopen=reopen ) # <<<<<<<<<<<<<< + * + * def mate( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowAll)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + } + __pyx_L17:; + } + __pyx_L8:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("csamtools.Samfile.fetch"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":813 + * return IteratorRowAll( self, reopen=reopen ) + * + * def mate( self, # <<<<<<<<<<<<<< + * AlignedRead read ): + * '''return the mate of :class:`AlignedRead` *read*. + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_11mate[] = "Samfile.mate(self, AlignedRead read)\nreturn the mate of :class:`AlignedRead` *read*.\n\n Throws a ValueError if read is unpaired or the mate\n is unmapped.\n\n .. note::\n Calling this method will change the file position.\n This might interfere with any iterators that have\n not re-opened the file.\n\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_11mate(PyObject *__pyx_v_self, PyObject *__pyx_v_read) { + uint32_t __pyx_v_flag; + __pyx_t_9csamtools_MateData __pyx_v_mate_data; + int __pyx_v_x; + struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_dest = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("mate"); + __Pyx_TraceCall("mate", __pyx_f[0], 813); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":826 + * + * ''' + * cdef uint32_t flag = read._delegate.core.flag # <<<<<<<<<<<<<< + * + * if flag & BAM_FPAIRED == 0: + */ + __pyx_v_flag = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.flag; + + /* "csamtools.pyx":828 + * cdef uint32_t flag = read._delegate.core.flag + * + * if flag & BAM_FPAIRED == 0: # <<<<<<<<<<<<<< + * raise ValueError( "read %s: is unpaired" % (read.qname)) + * if flag & BAM_FMUNMAP != 0: + */ + __pyx_t_1 = ((__pyx_v_flag & 1) == 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":829 + * + * if flag & BAM_FPAIRED == 0: + * raise ValueError( "read %s: is unpaired" % (read.qname)) # <<<<<<<<<<<<<< + * if flag & BAM_FMUNMAP != 0: + * raise ValueError( "mate %s: is unmapped" % (read.qname)) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_58), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":830 + * if flag & BAM_FPAIRED == 0: + * raise ValueError( "read %s: is unpaired" % (read.qname)) + * if flag & BAM_FMUNMAP != 0: # <<<<<<<<<<<<<< + * raise ValueError( "mate %s: is unmapped" % (read.qname)) + * + */ + __pyx_t_1 = ((__pyx_v_flag & 8) != 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":831 + * raise ValueError( "read %s: is unpaired" % (read.qname)) + * if flag & BAM_FMUNMAP != 0: + * raise ValueError( "mate %s: is unmapped" % (read.qname)) # <<<<<<<<<<<<<< + * + * cdef MateData mate_data + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_59), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":835 + * cdef MateData mate_data + * + * mate_data.name = bam1_qname(read._delegate) # <<<<<<<<<<<<<< + * mate_data.mate = NULL + * # xor flags to get the other mate + */ + __pyx_v_mate_data.name = bam1_qname(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate); + + /* "csamtools.pyx":836 + * + * mate_data.name = bam1_qname(read._delegate) + * mate_data.mate = NULL # <<<<<<<<<<<<<< + * # xor flags to get the other mate + * cdef int x = BAM_FREAD1 + BAM_FREAD2 + */ + __pyx_v_mate_data.mate = NULL; + + /* "csamtools.pyx":838 + * mate_data.mate = NULL + * # xor flags to get the other mate + * cdef int x = BAM_FREAD1 + BAM_FREAD2 # <<<<<<<<<<<<<< + * mate_data.flag = ( flag ^ x) & x + * + */ + __pyx_v_x = 192; + + /* "csamtools.pyx":839 + * # xor flags to get the other mate + * cdef int x = BAM_FREAD1 + BAM_FREAD2 + * mate_data.flag = ( flag ^ x) & x # <<<<<<<<<<<<<< + * + * bam_fetch(self.samfile.x.bam, + */ + __pyx_v_mate_data.flag = ((__pyx_v_flag ^ __pyx_v_x) & __pyx_v_x); + + /* "csamtools.pyx":847 + * read._delegate.core.mpos + 1, + * &mate_data, + * mate_callback ) # <<<<<<<<<<<<<< + * + * if mate_data.mate == NULL: + */ + bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mtid, ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos, (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read)->_delegate->core.mpos + 1), ((void *)(&__pyx_v_mate_data)), __pyx_f_9csamtools_mate_callback); + + /* "csamtools.pyx":849 + * mate_callback ) + * + * if mate_data.mate == NULL: # <<<<<<<<<<<<<< + * raise ValueError( "mate not found" ) + * + */ + __pyx_t_1 = (__pyx_v_mate_data.mate == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":850 + * + * if mate_data.mate == NULL: + * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<< + * + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":852 + * raise ValueError( "mate not found" ) + * + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) # <<<<<<<<<<<<<< + * dest._delegate = mate_data.mate + * return dest + */ + __pyx_t_2 = __Pyx_tp_new(((PyObject*)__pyx_ptype_9csamtools_AlignedRead)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_AlignedRead)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dest = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "csamtools.pyx":853 + * + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + * dest._delegate = mate_data.mate # <<<<<<<<<<<<<< + * return dest + * + */ + __pyx_v_dest->_delegate = __pyx_v_mate_data.mate; + + /* "csamtools.pyx":854 + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + * dest._delegate = mate_data.mate + * return dest # <<<<<<<<<<<<<< + * + * def count( self, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_dest)); + __pyx_r = ((PyObject *)__pyx_v_dest); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Samfile.mate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dest); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":856 + * return dest + * + * def count( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_12count[] = "Samfile.count(self, reference=None, start=None, end=None, region=None, until_eof=False)\n*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)*\n \n count reads :term:`region` using 0-based indexing. The region is specified by\n :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n Note that a :term:`TAM` file does not allow random access. If *region* or *reference* are given,\n an exception is raised.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_12count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + PyObject *__pyx_v_until_eof = 0; + int __pyx_v_rtid; + int __pyx_v_rstart; + int __pyx_v_rend; + int __pyx_v_counter; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_t_13; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__until_eof,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("count"); + __Pyx_TraceCall("count", __pyx_f[0], 856); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + + /* "csamtools.pyx":857 + * + * def count( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "csamtools.pyx":858 + * def count( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":859 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * until_eof = False ): + */ + values[2] = ((PyObject *)Py_None); + + /* "csamtools.pyx":860 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * until_eof = False ): + * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)* + */ + values[3] = ((PyObject *)Py_None); + values[4] = __pyx_k_62; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__until_eof); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + __pyx_v_until_eof = values[4]; + } else { + + /* "csamtools.pyx":857 + * + * def count( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "csamtools.pyx":858 + * def count( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "csamtools.pyx":859 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * until_eof = False ): + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "csamtools.pyx":860 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * until_eof = False ): + * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)* + */ + __pyx_v_region = ((PyObject *)Py_None); + __pyx_v_until_eof = __pyx_k_62; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_until_eof = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("count", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile.count"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_region); + + /* "csamtools.pyx":874 + * cdef int rend + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":875 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":877 + * raise ValueError( "I/O operation on closed file" ) + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<< + * + * cdef int counter + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_v_rtid = __pyx_t_8; + __pyx_v_rstart = __pyx_t_9; + __pyx_v_rend = __pyx_t_10; + } else { + __pyx_t_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_11, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_11, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_11, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_EndUnpack(__pyx_t_11, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_v_rtid = __pyx_t_10; + __pyx_v_rstart = __pyx_t_9; + __pyx_v_rend = __pyx_t_8; + } + + /* "csamtools.pyx":880 + * + * cdef int counter + * counter = 0; # <<<<<<<<<<<<<< + * + * if self.isbam: + */ + __pyx_v_counter = 0; + + /* "csamtools.pyx":882 + * counter = 0; + * + * if self.isbam: # <<<<<<<<<<<<<< + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) + */ + if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) { + + /* "csamtools.pyx":883 + * + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: # <<<<<<<<<<<<<< + * raise ValueError( "fetch called on bamfile without index" ) + * + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_until_eof); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_12 = (!__pyx_t_4); + if (__pyx_t_12) { + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isremote); + __pyx_t_13 = __pyx_t_4; + } else { + __pyx_t_13 = __pyx_t_12; + } + __pyx_t_12 = __pyx_t_13; + } else { + __pyx_t_12 = __pyx_t_3; + } + if (__pyx_t_12) { + + /* "csamtools.pyx":884 + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<< + * + * if not region: + */ + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":886 + * raise ValueError( "fetch called on bamfile without index" ) + * + * if not region: # <<<<<<<<<<<<<< + * raise ValueError( "counting functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + */ + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_12); + if (__pyx_t_3) { + + /* "csamtools.pyx":887 + * + * if not region: + * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + * bam_fetch(self.samfile.x.bam, + */ + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":888 + * if not region: + * raise ValueError( "counting functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<< + * bam_fetch(self.samfile.x.bam, + * self.index, + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_12 = (!__pyx_t_3); + if (__pyx_t_12) { + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "csamtools.pyx":895 + * rend, + * &counter, + * count_callback ) # <<<<<<<<<<<<<< + * return counter + * else: + */ + bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, ((void *)(&__pyx_v_counter)), __pyx_f_9csamtools_count_callback); + + /* "csamtools.pyx":896 + * &counter, + * count_callback ) + * return counter # <<<<<<<<<<<<<< + * else: + * raise ValueError ("count for a region is not available for sam files" ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyInt_FromLong(__pyx_v_counter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":898 + * return counter + * else: + * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<< + * + * def pileup( self, + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("csamtools.Samfile.count"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_region); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":900 + * raise ValueError ("count for a region is not available for sam files" ) + * + * def pileup( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_13pileup[] = "Samfile.pileup(self, reference=None, start=None, end=None, region=None, callback=None, **kwargs)\n\n perform a :term:`pileup` within a :term:`region`. The region is specified by\n :term:`reference`, *start* and *end* (using 0-based indexing). \n Alternatively, a samtools *region* string can be supplied.\n\n Without *reference* or *region* all reads will be used for the pileup. The reads will be returned\n ordered by :term:`reference` sequence, which will not necessarily be the order within the file.\n\n The method returns an iterator of type :class:`pysam.IteratorColumn` unless\n a *callback is provided. If a *callback* is given, the callback will be executed \n for each column within the :term:`region`. \n\n Note that :term:`SAM` formatted files do not allow random access. \n In these files, if a *region* or *reference* are given an exception is raised.\n \n Optional *kwargs* to the iterator:\n\n stepper\n The stepper controlls how the iterator advances. \n Possible options for the stepper are \n \n ``all``\n use all reads for pileup.\n ``samtools``\n same filter and read processing as in :term:`csamtools` pileup\n\n fastafile\n A :class:`FastaFile` object\n\n mask\n Skip all reads with bits set in mask.\n\n max_depth\n Maximum read depth permitted. The default limit is *8000*.\n\n .. note::\n\n *all* reads which overlap the region are returned. The first base returned will be the \n first base of the first read *not* necessarily the first base of the region used in the query.\n\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_13pileup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_v_rtid; + int __pyx_v_rstart; + int __pyx_v_rend; + int __pyx_v_has_coord; + bam_plbuf_t *__pyx_v_buf; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__callback,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("pileup"); + __Pyx_TraceCall("pileup", __pyx_f[0], 900); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + + /* "csamtools.pyx":901 + * + * def pileup( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "csamtools.pyx":902 + * def pileup( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "csamtools.pyx":903 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * callback = None, + */ + values[2] = ((PyObject *)Py_None); + + /* "csamtools.pyx":904 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * callback = None, + * **kwargs ): + */ + values[3] = ((PyObject *)Py_None); + + /* "csamtools.pyx":905 + * end = None, + * region = None, + * callback = None, # <<<<<<<<<<<<<< + * **kwargs ): + * ''' + */ + values[4] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__callback); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "pileup") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + __pyx_v_callback = values[4]; + } else { + + /* "csamtools.pyx":901 + * + * def pileup( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "csamtools.pyx":902 + * def pileup( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "csamtools.pyx":903 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * callback = None, + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "csamtools.pyx":904 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * callback = None, + * **kwargs ): + */ + __pyx_v_region = ((PyObject *)Py_None); + + /* "csamtools.pyx":905 + * end = None, + * region = None, + * callback = None, # <<<<<<<<<<<<<< + * **kwargs ): + * ''' + */ + __pyx_v_callback = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_callback = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pileup", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_AddTraceback("csamtools.Samfile.pileup"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":951 + * cdef bam_plbuf_t *buf + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":952 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":954 + * raise ValueError( "I/O operation on closed file" ) + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<< + * + * if self.isbam: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_has_coord = __pyx_t_8; + __pyx_v_rtid = __pyx_t_9; + __pyx_v_rstart = __pyx_t_10; + __pyx_v_rend = __pyx_t_11; + } else { + __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_12, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_12, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_EndUnpack(__pyx_t_12, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_has_coord = __pyx_t_11; + __pyx_v_rtid = __pyx_t_10; + __pyx_v_rstart = __pyx_t_9; + __pyx_v_rend = __pyx_t_8; + } + + /* "csamtools.pyx":956 + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + * + * if self.isbam: # <<<<<<<<<<<<<< + * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) + * + */ + if (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam) { + + /* "csamtools.pyx":957 + * + * if self.isbam: + * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":959 + * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) + * + * if callback: # <<<<<<<<<<<<<< + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_callback); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "csamtools.pyx":960 + * + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * + * buf = bam_plbuf_init( pileup_callback, callback ) + */ + __pyx_t_3 = (!__pyx_v_has_coord); + if (__pyx_t_3) { + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "csamtools.pyx":962 + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * + * buf = bam_plbuf_init( pileup_callback, callback ) # <<<<<<<<<<<<<< + * bam_fetch(self.samfile.x.bam, + * self.index, rtid, rstart, rend, + */ + __pyx_v_buf = bam_plbuf_init(((bam_pileup_f)__pyx_f_9csamtools_pileup_callback), ((void *)__pyx_v_callback)); + + /* "csamtools.pyx":965 + * bam_fetch(self.samfile.x.bam, + * self.index, rtid, rstart, rend, + * buf, pileup_fetch_callback ) # <<<<<<<<<<<<<< + * + * # finalize pileup + */ + bam_fetch(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->x.bam, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_rtid, __pyx_v_rstart, __pyx_v_rend, __pyx_v_buf, __pyx_f_9csamtools_pileup_fetch_callback); + + /* "csamtools.pyx":968 + * + * # finalize pileup + * bam_plbuf_push( NULL, buf) # <<<<<<<<<<<<<< + * bam_plbuf_destroy(buf) + * else: + */ + bam_plbuf_push(NULL, __pyx_v_buf); + + /* "csamtools.pyx":969 + * # finalize pileup + * bam_plbuf_push( NULL, buf) + * bam_plbuf_destroy(buf) # <<<<<<<<<<<<<< + * else: + * if has_coord: + */ + bam_plbuf_destroy(__pyx_v_buf); + goto __pyx_L9; + } + /*else*/ { + + /* "csamtools.pyx":971 + * bam_plbuf_destroy(buf) + * else: + * if has_coord: # <<<<<<<<<<<<<< + * return IteratorColumnRegion( self, + * tid = rtid, + */ + if (__pyx_v_has_coord) { + + /* "csamtools.pyx":972 + * else: + * if has_coord: + * return IteratorColumnRegion( self, # <<<<<<<<<<<<<< + * tid = rtid, + * start = rstart, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + + /* "csamtools.pyx":973 + * if has_coord: + * return IteratorColumnRegion( self, + * tid = rtid, # <<<<<<<<<<<<<< + * start = rstart, + * end = rend, + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__tid), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "csamtools.pyx":974 + * return IteratorColumnRegion( self, + * tid = rtid, + * start = rstart, # <<<<<<<<<<<<<< + * end = rend, + * **kwargs ) + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__start), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "csamtools.pyx":975 + * tid = rtid, + * start = rstart, + * end = rend, # <<<<<<<<<<<<<< + * **kwargs ) + * else: + */ + __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__end), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "csamtools.pyx":976 + * start = rstart, + * end = rend, + * **kwargs ) # <<<<<<<<<<<<<< + * else: + * return IteratorColumnAllRefs(self, **kwargs ) + */ + if (PyDict_Update(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_kwargs)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnRegion)), ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "csamtools.pyx":978 + * **kwargs ) + * else: + * return IteratorColumnAllRefs(self, **kwargs ) # <<<<<<<<<<<<<< + * + * else: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_5 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorColumnAllRefs)), ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + } + __pyx_L11:; + } + __pyx_L9:; + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":981 + * + * else: + * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<< + * + * def close( self ): + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("csamtools.Samfile.pileup"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":983 + * raise NotImplementedError( "pileup of samfiles not implemented yet" ) + * + * def close( self ): # <<<<<<<<<<<<<< + * ''' + * closes the :class:`pysam.Samfile`.''' + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_14close[] = "Samfile.close(self)\n\n closes the :class:`pysam.Samfile`."; +static PyObject *__pyx_pf_9csamtools_7Samfile_14close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("close"); + __Pyx_TraceCall("close", __pyx_f[0], 983); + + /* "csamtools.pyx":986 + * ''' + * closes the :class:`pysam.Samfile`.''' + * if self.samfile != NULL: # <<<<<<<<<<<<<< + * samclose( self.samfile ) + * bam_index_destroy(self.index); + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile != NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":987 + * closes the :class:`pysam.Samfile`.''' + * if self.samfile != NULL: + * samclose( self.samfile ) # <<<<<<<<<<<<<< + * bam_index_destroy(self.index); + * self.samfile = NULL + */ + samclose(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile); + + /* "csamtools.pyx":988 + * if self.samfile != NULL: + * samclose( self.samfile ) + * bam_index_destroy(self.index); # <<<<<<<<<<<<<< + * self.samfile = NULL + * + */ + bam_index_destroy(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index); + + /* "csamtools.pyx":989 + * samclose( self.samfile ) + * bam_index_destroy(self.index); + * self.samfile = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__( self ): + */ + ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile = NULL; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":991 + * self.samfile = NULL + * + * def __dealloc__( self ): # <<<<<<<<<<<<<< + * # remember: dealloc cannot call other methods + * # note: no doc string + */ + +static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_7Samfile_15__dealloc__(PyObject *__pyx_v_self) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 991); + + /* "csamtools.pyx":995 + * # note: no doc string + * # note: __del__ is not called. + * self.close() # <<<<<<<<<<<<<< + * bam_destroy1(self.b) + * if self._filename != NULL: free( self._filename ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":996 + * # note: __del__ is not called. + * self.close() + * bam_destroy1(self.b) # <<<<<<<<<<<<<< + * if self._filename != NULL: free( self._filename ) + * + */ + bam_destroy1(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); + + /* "csamtools.pyx":997 + * self.close() + * bam_destroy1(self.b) + * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<< + * + * cpdef int write( self, AlignedRead read ) except -1: + */ + __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_3) { + free(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); + goto __pyx_L5; + } + __pyx_L5:; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.__dealloc__"); + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":999 + * if self._filename != NULL: free( self._filename ) + * + * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<< + * ''' + * write a single :class:`pysam.AlignedRead` to disk. + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/ +static int __pyx_f_9csamtools_7Samfile_write(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, struct __pyx_obj_9csamtools_AlignedRead *__pyx_v_read, int __pyx_skip_dispatch) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("write"); + __Pyx_TraceCall("write", __pyx_f[0], 999); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_9csamtools_7Samfile_16write)) { + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_read)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_read)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "csamtools.pyx":1005 + * returns the number of bytes written. + * ''' + * if not self._isOpen(): # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { + + /* "csamtools.pyx":1006 + * ''' + * if not self._isOpen(): + * return 0 # <<<<<<<<<<<<<< + * + * return samwrite( self.samfile, read._delegate ) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1008 + * return 0 + * + * return samwrite( self.samfile, read._delegate ) # <<<<<<<<<<<<<< + * + * def __enter__(self): + */ + __pyx_r = samwrite(__pyx_v_self->samfile, __pyx_v_read->_delegate); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("csamtools.Samfile.write"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":999 + * if self._filename != NULL: free( self._filename ) + * + * cpdef int write( self, AlignedRead read ) except -1: # <<<<<<<<<<<<<< + * ''' + * write a single :class:`pysam.AlignedRead` to disk. + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_16write[] = "Samfile.write(self, AlignedRead read) -> int\n\n write a single :class:`pysam.AlignedRead` to disk.\n\n returns the number of bytes written.\n "; +static PyObject *__pyx_pf_9csamtools_7Samfile_16write(PyObject *__pyx_v_self, PyObject *__pyx_v_read) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("write"); + __Pyx_TraceCall("write", __pyx_f[0], 999); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read), __pyx_ptype_9csamtools_AlignedRead, 1, "read", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_9csamtools_Samfile *)((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->__pyx_vtab)->write(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self), ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_read), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.Samfile.write"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1010 + * return samwrite( self.samfile, read._delegate ) + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_17__enter__[] = "Samfile.__enter__(self)"; +static PyObject *__pyx_pf_9csamtools_7Samfile_17__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__enter__"); + __Pyx_TraceCall("__enter__", __pyx_f[0], 1010); + + /* "csamtools.pyx":1011 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __exit__(self, exc_type, exc_value, traceback): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1013 + * return self + * + * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<< + * self.close() + * return False + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_18__exit__[] = "Samfile.__exit__(self, exc_type, exc_value, traceback)"; +static PyObject *__pyx_pf_9csamtools_7Samfile_18__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_exc_type = 0; + PyObject *__pyx_v_exc_value = 0; + PyObject *__pyx_v_traceback = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__exc_type,&__pyx_n_s__exc_value,&__pyx_n_s__traceback,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__exit__"); + __Pyx_TraceCall("__exit__", __pyx_f[0], 1013); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_type); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exc_value); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__traceback); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__exit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_exc_type = values[0]; + __pyx_v_exc_value = values[1]; + __pyx_v_traceback = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_exc_type = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_exc_value = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_traceback = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile.__exit__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":1014 + * + * def __exit__(self, exc_type, exc_value, traceback): + * self.close() # <<<<<<<<<<<<<< + * return False + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":1015 + * def __exit__(self, exc_type, exc_value, traceback): + * self.close() + * return False # <<<<<<<<<<<<<< + * + * ############################################################### + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.__exit__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1024 + * property filename: + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_8filename___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1024); + + /* "csamtools.pyx":1025 + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1026 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename # <<<<<<<<<<<<<< + * + * property nreferences: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.filename.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1030 + * property nreferences: + * '''number of :term:`reference` sequences in the file.''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self.samfile.header.n_targets + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_11nreferences___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1030); + + /* "csamtools.pyx":1031 + * '''number of :term:`reference` sequences in the file.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self.samfile.header.n_targets + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1032 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self.samfile.header.n_targets # <<<<<<<<<<<<<< + * + * property references: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.nreferences.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1036 + * property references: + * """tuple with the names of :term:`reference` sequences.""" + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_10references___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_t; + long __pyx_v_x; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int32_t __pyx_t_5; + int __pyx_t_6; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1036); + __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1037 + * """tuple with the names of :term:`reference` sequences.""" + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1038 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] # <<<<<<<<<<<<<< + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_name[x] ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_t)); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1039 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * t.append( self.samfile.header.target_name[x] ) + * return tuple(t) + */ + __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) { + + /* "csamtools.pyx":1040 + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_name[x] ) # <<<<<<<<<<<<<< + * return tuple(t) + * + */ + if (unlikely(__pyx_v_t == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_name[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_6 = PyList_Append(__pyx_v_t, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + } + + /* "csamtools.pyx":1041 + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_name[x] ) + * return tuple(t) # <<<<<<<<<<<<<< + * + * property lengths: + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_t == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.references.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_t); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1047 + * :attr:`pysam.Samfile.references` + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_7lengths___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_t; + long __pyx_v_x; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int32_t __pyx_t_5; + int __pyx_t_6; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1047); + __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1048 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1049 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] # <<<<<<<<<<<<<< + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_len[x] ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_t)); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1050 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * t.append( self.samfile.header.target_len[x] ) + * return tuple(t) + */ + __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_5; __pyx_v_x++) { + + /* "csamtools.pyx":1051 + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_len[x] ) # <<<<<<<<<<<<<< + * return tuple(t) + * + */ + if (unlikely(__pyx_v_t == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t((((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->target_len[__pyx_v_x])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyList_Append(__pyx_v_t, __pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "csamtools.pyx":1052 + * for x from 0 <= x < self.samfile.header.n_targets: + * t.append( self.samfile.header.target_len[x] ) + * return tuple(t) # <<<<<<<<<<<<<< + * + * property mapped: + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_t == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = ((PyObject *)PyList_AsTuple(__pyx_v_t)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.lengths.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_t); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1057 + * """total number of mapped reads in file. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_6mapped___get__(PyObject *__pyx_v_self) { + int __pyx_v_tid; + uint32_t __pyx_v_total; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int32_t __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1057); + + /* "csamtools.pyx":1058 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1059 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<< + * + * cdef int tid + */ + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1062 + * + * cdef int tid + * cdef uint32_t total = 0 # <<<<<<<<<<<<<< + * for tid from 0 <= tid < self.samfile.header.n_targets: + * total += pysam_get_mapped( self.index, tid ) + */ + __pyx_v_total = 0; + + /* "csamtools.pyx":1063 + * cdef int tid + * cdef uint32_t total = 0 + * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * total += pysam_get_mapped( self.index, tid ) + * return total + */ + __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets; + for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) { + + /* "csamtools.pyx":1064 + * cdef uint32_t total = 0 + * for tid from 0 <= tid < self.samfile.header.n_targets: + * total += pysam_get_mapped( self.index, tid ) # <<<<<<<<<<<<<< + * return total + * + */ + __pyx_v_total = (__pyx_v_total + pysam_get_mapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid)); + } + + /* "csamtools.pyx":1065 + * for tid from 0 <= tid < self.samfile.header.n_targets: + * total += pysam_get_mapped( self.index, tid ) + * return total # <<<<<<<<<<<<<< + * + * property unmapped: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.mapped.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1070 + * """total number of unmapped reads in file. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_8unmapped___get__(PyObject *__pyx_v_self) { + int __pyx_v_tid; + uint32_t __pyx_v_total; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int32_t __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1070); + + /* "csamtools.pyx":1071 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) + * cdef int tid + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1072 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<< + * cdef int tid + * cdef uint32_t total = 0 + */ + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1074 + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) + * cdef int tid + * cdef uint32_t total = 0 # <<<<<<<<<<<<<< + * for tid from 0 <= tid < self.samfile.header.n_targets: + * total += pysam_get_unmapped( self.index, tid ) + */ + __pyx_v_total = 0; + + /* "csamtools.pyx":1075 + * cdef int tid + * cdef uint32_t total = 0 + * for tid from 0 <= tid < self.samfile.header.n_targets: # <<<<<<<<<<<<<< + * total += pysam_get_unmapped( self.index, tid ) + * # get unmapped reads without coordinates + */ + __pyx_t_5 = ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets; + for (__pyx_v_tid = 0; __pyx_v_tid < __pyx_t_5; __pyx_v_tid++) { + + /* "csamtools.pyx":1076 + * cdef uint32_t total = 0 + * for tid from 0 <= tid < self.samfile.header.n_targets: + * total += pysam_get_unmapped( self.index, tid ) # <<<<<<<<<<<<<< + * # get unmapped reads without coordinates + * total += pysam_get_unmapped( self.index, -1 ) + */ + __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, __pyx_v_tid)); + } + + /* "csamtools.pyx":1078 + * total += pysam_get_unmapped( self.index, tid ) + * # get unmapped reads without coordinates + * total += pysam_get_unmapped( self.index, -1 ) # <<<<<<<<<<<<<< + * return total + * + */ + __pyx_v_total = (__pyx_v_total + pysam_get_unmapped(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->index, -1)); + + /* "csamtools.pyx":1079 + * # get unmapped reads without coordinates + * total += pysam_get_unmapped( self.index, -1 ) + * return total # <<<<<<<<<<<<<< + * + * property text: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_total); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.unmapped.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1083 + * property text: + * '''full contents of the :term:`sam file` header as a string.''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_4text___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1083); + + /* "csamtools.pyx":1084 + * '''full contents of the :term:`sam file` header as a string.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1085 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) # <<<<<<<<<<<<<< + * + * property header: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyString_FromStringAndSize(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->l_text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.text.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1091 + * a two-level dictionary. + * ''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_6header___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_result; + PyObject *__pyx_v_t; + PyObject *__pyx_v_line; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_record; + PyObject *__pyx_v_x; + PyObject *__pyx_v_field; + PyObject *__pyx_v_key; + PyObject *__pyx_v_value; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1091); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_record = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_x = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_field = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1092 + * ''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * result = {} + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1094 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * + * result = {} # <<<<<<<<<<<<<< + * + * if self.samfile.header.text != NULL: + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1096 + * result = {} + * + * if self.samfile.header.text != NULL: # <<<<<<<<<<<<<< + * # convert to python string (note: call self.text to create 0-terminated string) + * t = self.text + */ + __pyx_t_4 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->text != NULL); + if (__pyx_t_4) { + + /* "csamtools.pyx":1098 + * if self.samfile.header.text != NULL: + * # convert to python string (note: call self.text to create 0-terminated string) + * t = self.text # <<<<<<<<<<<<<< + * for line in t.split("\n"): + * if not line.strip(): continue + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__text); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1099 + * # convert to python string (note: call self.text to create 0-terminated string) + * t = self.text + * for line in t.split("\n"): # <<<<<<<<<<<<<< + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_t, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1100 + * t = self.text + * for line in t.split("\n"): + * if not line.strip(): continue # <<<<<<<<<<<<<< + * assert line.startswith("@"), "header line without '@': '%s'" % line + * fields = line[1:].split("\t") + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + goto __pyx_L7_continue; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":1101 + * for line in t.split("\n"): + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<< + * fields = line[1:].split("\t") + * record = fields[0] + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) { + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_91), __pyx_v_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1102 + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line + * fields = line[1:].split("\t") # <<<<<<<<<<<<<< + * record = fields[0] + * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) + */ + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1103 + * assert line.startswith("@"), "header line without '@': '%s'" % line + * fields = line[1:].split("\t") + * record = fields[0] # <<<<<<<<<<<<<< + * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) + * + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fields, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_record); + __pyx_v_record = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1104 + * fields = line[1:].split("\t") + * record = fields[0] + * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) # <<<<<<<<<<<<<< + * + * # treat comments + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) { + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_93), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1107 + * + * # treat comments + * if record == "CO": # <<<<<<<<<<<<<< + * if record not in result: result[record] = [] + * result[record].append( "\t".join( fields[1:] ) ) + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + + /* "csamtools.pyx":1108 + * # treat comments + * if record == "CO": + * if record not in result: result[record] = [] # <<<<<<<<<<<<<< + * result[record].append( "\t".join( fields[1:] ) ) + * continue + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":1109 + * if record == "CO": + * if record not in result: result[record] = [] + * result[record].append( "\t".join( fields[1:] ) ) # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "csamtools.pyx":1110 + * if record not in result: result[record] = [] + * result[record].append( "\t".join( fields[1:] ) ) + * continue # <<<<<<<<<<<<<< + * + * # the following is clumsy as generators do not work? + */ + goto __pyx_L7_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "csamtools.pyx":1113 + * + * # the following is clumsy as generators do not work? + * x = {} # <<<<<<<<<<<<<< + * for field in fields[1:]: + * key, value = field.split(":",1) + */ + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_v_x)); + __pyx_v_x = __pyx_t_8; + __pyx_t_8 = 0; + + /* "csamtools.pyx":1114 + * # the following is clumsy as generators do not work? + * x = {} + * for field in fields[1:]: # <<<<<<<<<<<<<< + * key, value = field.split(":",1) + * # uppercase keys must be valid + */ + __pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_9 = 0; __pyx_t_7 = __pyx_t_8; __Pyx_INCREF(__pyx_t_7); + } else { + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_7))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break; + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; + } else if (likely(PyTuple_CheckExact(__pyx_t_7))) { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; + } else { + __pyx_t_8 = PyIter_Next(__pyx_t_7); + if (!__pyx_t_8) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_DECREF(__pyx_v_field); + __pyx_v_field = __pyx_t_8; + __pyx_t_8 = 0; + + /* "csamtools.pyx":1115 + * x = {} + * for field in fields[1:]: + * key, value = field.split(":",1) # <<<<<<<<<<<<<< + * # uppercase keys must be valid + * # lowercase are permitted for user fields + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_field, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) { + PyObject* tuple = __pyx_t_6; + __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_10, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_10, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_EndUnpack(__pyx_t_10, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "csamtools.pyx":1118 + * # uppercase keys must be valid + * # lowercase are permitted for user fields + * if key in VALID_HEADER_FIELDS[record]: # <<<<<<<<<<<<<< + * x[key] = VALID_HEADER_FIELDS[record][key](value) + * elif not key.isupper(): + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = ((PySequence_Contains(__pyx_t_1, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "csamtools.pyx":1119 + * # lowercase are permitted for user fields + * if key in VALID_HEADER_FIELDS[record]: + * x[key] = VALID_HEADER_FIELDS[record][key](value) # <<<<<<<<<<<<<< + * elif not key.isupper(): + * x[key] = value + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L14; + } + + /* "csamtools.pyx":1120 + * if key in VALID_HEADER_FIELDS[record]: + * x[key] = VALID_HEADER_FIELDS[record][key](value) + * elif not key.isupper(): # <<<<<<<<<<<<<< + * x[key] = value + * else: + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":1121 + * x[key] = VALID_HEADER_FIELDS[record][key](value) + * elif not key.isupper(): + * x[key] = value # <<<<<<<<<<<<<< + * else: + * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_x), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + /*else*/ { + + /* "csamtools.pyx":1123 + * x[key] = value + * else: + * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) # <<<<<<<<<<<<<< + * + * if VALID_HEADER_TYPES[record] == dict: + */ + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_96), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "csamtools.pyx":1125 + * raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) + * + * if VALID_HEADER_TYPES[record] == dict: # <<<<<<<<<<<<<< + * if record in result: + * raise ValueError( "multiple '%s' lines are not permitted" % record ) + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":1126 + * + * if VALID_HEADER_TYPES[record] == dict: + * if record in result: # <<<<<<<<<<<<<< + * raise ValueError( "multiple '%s' lines are not permitted" % record ) + * result[record] = x + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "csamtools.pyx":1127 + * if VALID_HEADER_TYPES[record] == dict: + * if record in result: + * raise ValueError( "multiple '%s' lines are not permitted" % record ) # <<<<<<<<<<<<<< + * result[record] = x + * elif VALID_HEADER_TYPES[record] == list: + */ + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_97), __pyx_v_record); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L16; + } + __pyx_L16:; + + /* "csamtools.pyx":1128 + * if record in result: + * raise ValueError( "multiple '%s' lines are not permitted" % record ) + * result[record] = x # <<<<<<<<<<<<<< + * elif VALID_HEADER_TYPES[record] == list: + * if record not in result: result[record] = [] + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_v_x)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L15; + } + + /* "csamtools.pyx":1129 + * raise ValueError( "multiple '%s' lines are not permitted" % record ) + * result[record] = x + * elif VALID_HEADER_TYPES[record] == list: # <<<<<<<<<<<<<< + * if record not in result: result[record] = [] + * result[record].append( x ) + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetItem(__pyx_t_7, __pyx_v_record); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)((PyObject*)(&PyList_Type))), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":1130 + * result[record] = x + * elif VALID_HEADER_TYPES[record] == list: + * if record not in result: result[record] = [] # <<<<<<<<<<<<<< + * result[record].append( x ) + * + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)__pyx_v_result), __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_record, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "csamtools.pyx":1131 + * elif VALID_HEADER_TYPES[record] == list: + * if record not in result: result[record] = [] + * result[record].append( x ) # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_record); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_7, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L15; + } + __pyx_L15:; + __pyx_L7_continue:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1133 + * result[record].append( x ) + * + * return result # <<<<<<<<<<<<<< + * + * def _buildLine( self, fields, record ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("csamtools.Samfile.header.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF(__pyx_v_line); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_record); + __Pyx_DECREF(__pyx_v_x); + __Pyx_DECREF(__pyx_v_field); + __Pyx_DECREF(__pyx_v_key); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1135 + * return result + * + * def _buildLine( self, fields, record ): # <<<<<<<<<<<<<< + * '''build a header line from *fields* dictionary for *record*''' + * + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_19_buildLine[] = "Samfile._buildLine(self, fields, record)\nbuild a header line from *fields* dictionary for *record*"; +static PyObject *__pyx_pf_9csamtools_7Samfile_19_buildLine(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_record = 0; + PyObject *__pyx_v_line; + PyObject *__pyx_v_key; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fields,&__pyx_n_s__record,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_buildLine"); + __Pyx_TraceCall("_buildLine", __pyx_f[0], 1135); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fields); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_buildLine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_fields = values[0]; + __pyx_v_record = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_fields = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_record = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_buildLine", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Samfile._buildLine"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_line = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1139 + * + * # TODO: add checking for field and sort order + * line = ["@%s" % record ] # <<<<<<<<<<<<<< + * if record == "CO": + * line.append( fields ) + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_98), __pyx_v_record); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_line)); + __pyx_v_line = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1140 + * # TODO: add checking for field and sort order + * line = ["@%s" % record ] + * if record == "CO": # <<<<<<<<<<<<<< + * line.append( fields ) + * else: + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_record, ((PyObject *)__pyx_n_s__CO), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "csamtools.pyx":1141 + * line = ["@%s" % record ] + * if record == "CO": + * line.append( fields ) # <<<<<<<<<<<<<< + * else: + * # write fields of the specification + */ + if (unlikely(__pyx_v_line == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_Append(__pyx_v_line, __pyx_v_fields); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + /*else*/ { + + /* "csamtools.pyx":1144 + * else: + * # write fields of the specification + * for key in VALID_HEADER_ORDER[record]: # <<<<<<<<<<<<<< + * if key in fields: + * line.append( "%s:%s" % (key, str(fields[key]))) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_record); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1145 + * # write fields of the specification + * for key in VALID_HEADER_ORDER[record]: + * if key in fields: # <<<<<<<<<<<<<< + * line.append( "%s:%s" % (key, str(fields[key]))) + * # write user fields + */ + __pyx_t_3 = ((PySequence_Contains(__pyx_v_fields, __pyx_v_key))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "csamtools.pyx":1146 + * for key in VALID_HEADER_ORDER[record]: + * if key in fields: + * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<< + * # write user fields + * for key in fields: + */ + if (unlikely(__pyx_v_line == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":1148 + * line.append( "%s:%s" % (key, str(fields[key]))) + * # write user fields + * for key in fields: # <<<<<<<<<<<<<< + * if not key.isupper(): + * line.append( "%s:%s" % (key, str(fields[key]))) + */ + if (PyList_CheckExact(__pyx_v_fields) || PyTuple_CheckExact(__pyx_v_fields)) { + __pyx_t_5 = 0; __pyx_t_2 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1149 + * # write user fields + * for key in fields: + * if not key.isupper(): # <<<<<<<<<<<<<< + * line.append( "%s:%s" % (key, str(fields[key]))) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__isupper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = (!__pyx_t_3); + if (__pyx_t_7) { + + /* "csamtools.pyx":1150 + * for key in fields: + * if not key.isupper(): + * line.append( "%s:%s" % (key, str(fields[key]))) # <<<<<<<<<<<<<< + * + * return "\t".join( line ) + */ + if (unlikely(__pyx_v_line == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyObject_GetItem(__pyx_v_fields, __pyx_v_key); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_99), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(__pyx_v_line, ((PyObject *)__pyx_t_6)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + goto __pyx_L12; + } + __pyx_L12:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L6:; + + /* "csamtools.pyx":1152 + * line.append( "%s:%s" % (key, str(fields[key]))) + * + * return "\t".join( line ) # <<<<<<<<<<<<<< + * + * cdef bam_header_t * _buildHeader( self, new_header ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_v_line)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_line)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_line)); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("csamtools.Samfile._buildLine"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_line); + __Pyx_DECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1154 + * return "\t".join( line ) + * + * cdef bam_header_t * _buildHeader( self, new_header ): # <<<<<<<<<<<<<< + * '''return a new header built from a dictionary in *new_header*. + * + */ + +static bam_header_t *__pyx_f_9csamtools_7Samfile__buildHeader(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self, PyObject *__pyx_v_new_header) { + PyObject *__pyx_v_lines; + bam_header_t *__pyx_v_dest; + PyObject *__pyx_v_record; + PyObject *__pyx_v_ttype; + PyObject *__pyx_v_data; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_text; + PyObject *__pyx_v_seqs; + long __pyx_v_x; + PyObject *__pyx_v_seqname; + PyObject *__pyx_v_seqlen; + bam_header_t *__pyx_r; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + char *__pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int32_t __pyx_t_12; + uint32_t __pyx_t_13; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_buildHeader"); + __Pyx_TraceCall("_buildHeader", __pyx_f[0], 1154); + __pyx_v_lines = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_record = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ttype = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_fields = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_text = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_seqs = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_seqname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_seqlen = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1160 + * ''' + * + * lines = [] # <<<<<<<<<<<<<< + * + * # check if hash exists + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_lines)); + __pyx_v_lines = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1167 + * cdef bam_header_t * dest + * + * dest = bam_header_init() # <<<<<<<<<<<<<< + * + * for record in VALID_HEADERS: + */ + __pyx_v_dest = bam_header_init(); + + /* "csamtools.pyx":1169 + * dest = bam_header_init() + * + * for record in VALID_HEADERS: # <<<<<<<<<<<<<< + * if record in new_header: + * ttype = VALID_HEADER_TYPES[record] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_record); + __pyx_v_record = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1170 + * + * for record in VALID_HEADERS: + * if record in new_header: # <<<<<<<<<<<<<< + * ttype = VALID_HEADER_TYPES[record] + * data = new_header[record] + */ + __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, __pyx_v_record))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "csamtools.pyx":1171 + * for record in VALID_HEADERS: + * if record in new_header: + * ttype = VALID_HEADER_TYPES[record] # <<<<<<<<<<<<<< + * data = new_header[record] + * if type( data ) != type( ttype() ): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ttype); + __pyx_v_ttype = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":1172 + * if record in new_header: + * ttype = VALID_HEADER_TYPES[record] + * data = new_header[record] # <<<<<<<<<<<<<< + * if type( data ) != type( ttype() ): + * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) + */ + __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":1173 + * ttype = VALID_HEADER_TYPES[record] + * data = new_header[record] + * if type( data ) != type( ttype() ): # <<<<<<<<<<<<<< + * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) + * if type( data ) == types.DictType: + */ + __pyx_t_5 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(__pyx_t_5)), Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":1174 + * data = new_header[record] + * if type( data ) != type( ttype() ): + * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) # <<<<<<<<<<<<<< + * if type( data ) == types.DictType: + * lines.append( self._buildLine( data, record ) ) + */ + __pyx_t_1 = PyObject_Call(__pyx_v_ttype, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_data))); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)Py_TYPE(__pyx_v_data))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_data))); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_1))); + PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)Py_TYPE(__pyx_t_1))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_100), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1175 + * if type( data ) != type( ttype() ): + * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) + * if type( data ) == types.DictType: # <<<<<<<<<<<<<< + * lines.append( self._buildLine( data, record ) ) + * else: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__types); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__DictType); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":1176 + * raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) + * if type( data ) == types.DictType: + * lines.append( self._buildLine( data, record ) ) # <<<<<<<<<<<<<< + * else: + * for fields in new_header[record]: + */ + if (unlikely(__pyx_v_lines == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":1178 + * lines.append( self._buildLine( data, record ) ) + * else: + * for fields in new_header[record]: # <<<<<<<<<<<<<< + * lines.append( self._buildLine( fields, record ) ) + * + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_new_header, __pyx_v_record); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_8 = 0; __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; + } else { + __pyx_t_6 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_6) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_6; + __pyx_t_6 = 0; + + /* "csamtools.pyx":1179 + * else: + * for fields in new_header[record]: + * lines.append( self._buildLine( fields, record ) ) # <<<<<<<<<<<<<< + * + * text = "\n".join(lines) + "\n" + */ + if (unlikely(__pyx_v_lines == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___buildLine); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_fields); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fields); + __Pyx_GIVEREF(__pyx_v_fields); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_lines, __pyx_t_9); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L7:; + goto __pyx_L5; + } + __pyx_L5:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":1181 + * lines.append( self._buildLine( fields, record ) ) + * + * text = "\n".join(lines) + "\n" # <<<<<<<<<<<<<< + * if dest.text != NULL: free( dest.text ) + * dest.text = calloc( len(text), sizeof(char)) + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_v_lines)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_lines)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_lines)); + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_text); + __pyx_v_text = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":1182 + * + * text = "\n".join(lines) + "\n" + * if dest.text != NULL: free( dest.text ) # <<<<<<<<<<<<<< + * dest.text = calloc( len(text), sizeof(char)) + * dest.l_text = len(text) + */ + __pyx_t_4 = (__pyx_v_dest->text != NULL); + if (__pyx_t_4) { + free(__pyx_v_dest->text); + goto __pyx_L10; + } + __pyx_L10:; + + /* "csamtools.pyx":1183 + * text = "\n".join(lines) + "\n" + * if dest.text != NULL: free( dest.text ) + * dest.text = calloc( len(text), sizeof(char)) # <<<<<<<<<<<<<< + * dest.l_text = len(text) + * strncpy( dest.text, text, dest.l_text ) + */ + __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dest->text = ((char *)calloc(__pyx_t_2, (sizeof(char)))); + + /* "csamtools.pyx":1184 + * if dest.text != NULL: free( dest.text ) + * dest.text = calloc( len(text), sizeof(char)) + * dest.l_text = len(text) # <<<<<<<<<<<<<< + * strncpy( dest.text, text, dest.l_text ) + * + */ + __pyx_t_2 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dest->l_text = __pyx_t_2; + + /* "csamtools.pyx":1185 + * dest.text = calloc( len(text), sizeof(char)) + * dest.l_text = len(text) + * strncpy( dest.text, text, dest.l_text ) # <<<<<<<<<<<<<< + * + * # collect targets + */ + __pyx_t_10 = PyBytes_AsString(__pyx_v_text); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + strncpy(__pyx_v_dest->text, __pyx_t_10, __pyx_v_dest->l_text); + + /* "csamtools.pyx":1188 + * + * # collect targets + * if "SQ" in new_header: # <<<<<<<<<<<<<< + * seqs = [] + * for fields in new_header["SQ"]: + */ + __pyx_t_4 = ((PySequence_Contains(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "csamtools.pyx":1189 + * # collect targets + * if "SQ" in new_header: + * seqs = [] # <<<<<<<<<<<<<< + * for fields in new_header["SQ"]: + * try: + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_v_seqs)); + __pyx_v_seqs = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":1190 + * if "SQ" in new_header: + * seqs = [] + * for fields in new_header["SQ"]: # <<<<<<<<<<<<<< + * try: + * seqs.append( (fields["SN"], fields["LN"] ) ) + */ + __pyx_t_5 = PyObject_GetItem(__pyx_v_new_header, ((PyObject *)__pyx_n_s__SQ)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_5; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_5); __pyx_t_2++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_fields); + __pyx_v_fields = __pyx_t_5; + __pyx_t_5 = 0; + + /* "csamtools.pyx":1191 + * seqs = [] + * for fields in new_header["SQ"]: + * try: # <<<<<<<<<<<<<< + * seqs.append( (fields["SN"], fields["LN"] ) ) + * except KeyError: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "csamtools.pyx":1192 + * for fields in new_header["SQ"]: + * try: + * seqs.append( (fields["SN"], fields["LN"] ) ) # <<<<<<<<<<<<<< + * except KeyError: + * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) + */ + if (unlikely(__pyx_v_seqs == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + } + __pyx_t_5 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__SN)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetItem(__pyx_v_fields, ((PyObject *)__pyx_n_s__LN)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_seqs, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L14_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L21_try_end; + __pyx_L14_error:; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":1193 + * try: + * seqs.append( (fields["SN"], fields["LN"] ) ) + * except KeyError: # <<<<<<<<<<<<<< + * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) + * + */ + __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_7) { + __Pyx_AddTraceback("csamtools.Samfile._buildHeader"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); + + /* "csamtools.pyx":1194 + * seqs.append( (fields["SN"], fields["LN"] ) ) + * except KeyError: + * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) # <<<<<<<<<<<<<< + * + * dest.n_targets = len(seqs) + */ + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_fields); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_fields); + __Pyx_GIVEREF(__pyx_v_fields); + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_101), __pyx_t_11); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L15_exception_handled; + } + __pyx_L16_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L15_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L21_try_end:; + } + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "csamtools.pyx":1196 + * raise KeyError( "incomplete sequence information in '%s'" % str(fields)) + * + * dest.n_targets = len(seqs) # <<<<<<<<<<<<<< + * dest.target_name = calloc( dest.n_targets, sizeof(char*) ) + * dest.target_len = calloc( dest.n_targets, sizeof(uint32_t) ) + */ + if (unlikely(__pyx_v_seqs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyList_GET_SIZE(((PyObject *)__pyx_v_seqs)); + __pyx_v_dest->n_targets = __pyx_t_2; + + /* "csamtools.pyx":1197 + * + * dest.n_targets = len(seqs) + * dest.target_name = calloc( dest.n_targets, sizeof(char*) ) # <<<<<<<<<<<<<< + * dest.target_len = calloc( dest.n_targets, sizeof(uint32_t) ) + * + */ + __pyx_v_dest->target_name = ((char **)calloc(__pyx_v_dest->n_targets, (sizeof(char *)))); + + /* "csamtools.pyx":1198 + * dest.n_targets = len(seqs) + * dest.target_name = calloc( dest.n_targets, sizeof(char*) ) + * dest.target_len = calloc( dest.n_targets, sizeof(uint32_t) ) # <<<<<<<<<<<<<< + * + * for x from 0 <= x < dest.n_targets: + */ + __pyx_v_dest->target_len = ((uint32_t *)calloc(__pyx_v_dest->n_targets, (sizeof(uint32_t)))); + + /* "csamtools.pyx":1200 + * dest.target_len = calloc( dest.n_targets, sizeof(uint32_t) ) + * + * for x from 0 <= x < dest.n_targets: # <<<<<<<<<<<<<< + * seqname, seqlen = seqs[x] + * dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) + */ + __pyx_t_12 = __pyx_v_dest->n_targets; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_12; __pyx_v_x++) { + + /* "csamtools.pyx":1201 + * + * for x from 0 <= x < dest.n_targets: + * seqname, seqlen = seqs[x] # <<<<<<<<<<<<<< + * dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) + * strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) + */ + __pyx_t_9 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_seqs), __pyx_v_x, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyTuple_CheckExact(__pyx_t_9) && likely(PyTuple_GET_SIZE(__pyx_t_9) == 2)) { + PyObject* tuple = __pyx_t_9; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_seqname); + __pyx_v_seqname = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_seqlen); + __pyx_v_seqlen = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_1, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_1, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_seqname); + __pyx_v_seqname = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_seqlen); + __pyx_v_seqlen = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "csamtools.pyx":1202 + * for x from 0 <= x < dest.n_targets: + * seqname, seqlen = seqs[x] + * dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) # <<<<<<<<<<<<<< + * strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) + * dest.target_len[x] = seqlen + */ + __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_dest->target_name[__pyx_v_x]) = ((char *)calloc((__pyx_t_2 + 1), (sizeof(char)))); + + /* "csamtools.pyx":1203 + * seqname, seqlen = seqs[x] + * dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) + * strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) # <<<<<<<<<<<<<< + * dest.target_len[x] = seqlen + * + */ + __pyx_t_10 = PyBytes_AsString(__pyx_v_seqname); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_v_seqname); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + strncpy((__pyx_v_dest->target_name[__pyx_v_x]), __pyx_t_10, (__pyx_t_2 + 1)); + + /* "csamtools.pyx":1204 + * dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) + * strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) + * dest.target_len[x] = seqlen # <<<<<<<<<<<<<< + * + * return dest + */ + __pyx_t_13 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_seqlen); if (unlikely((__pyx_t_13 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_dest->target_len[__pyx_v_x]) = __pyx_t_13; + } + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":1206 + * dest.target_len[x] = seqlen + * + * return dest # <<<<<<<<<<<<<< + * + * ############################################################### + */ + __pyx_r = __pyx_v_dest; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_WriteUnraisable("csamtools.Samfile._buildHeader"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_lines); + __Pyx_DECREF(__pyx_v_record); + __Pyx_DECREF(__pyx_v_ttype); + __Pyx_DECREF(__pyx_v_data); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_text); + __Pyx_DECREF(__pyx_v_seqs); + __Pyx_DECREF(__pyx_v_seqname); + __Pyx_DECREF(__pyx_v_seqlen); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1216 + * ## Possible solutions: deprecate or open new file handle + * ############################################################### + * def __iter__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam and self.samfile.header.n_targets == 0: + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7Samfile_20__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1216); + + /* "csamtools.pyx":1217 + * ############################################################### + * def __iter__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam and self.samfile.header.n_targets == 0: + * raise NotImplementedError( "can not iterate over samfile without header") + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_102), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1218 + * def __iter__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam and self.samfile.header.n_targets == 0: # <<<<<<<<<<<<<< + * raise NotImplementedError( "can not iterate over samfile without header") + * return self + */ + __pyx_t_4 = (!((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->isbam); + if (__pyx_t_4) { + __pyx_t_3 = (((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile->header->n_targets == 0); + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":1219 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam and self.samfile.header.n_targets == 0: + * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1220 + * if not self.isbam and self.samfile.header.n_targets == 0: + * raise NotImplementedError( "can not iterate over samfile without header") + * return self # <<<<<<<<<<<<<< + * + * cdef bam1_t * getCurrent( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.__iter__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1222 + * return self + * + * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<< + * return self.b + * + */ + +static bam1_t *__pyx_f_9csamtools_7Samfile_getCurrent(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) { + bam1_t *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getCurrent"); + __Pyx_TraceCall("getCurrent", __pyx_f[0], 1222); + + /* "csamtools.pyx":1223 + * + * cdef bam1_t * getCurrent( self ): + * return self.b # <<<<<<<<<<<<<< + * + * cdef int cnext(self): + */ + __pyx_r = __pyx_v_self->b; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1225 + * return self.b + * + * cdef int cnext(self): # <<<<<<<<<<<<<< + * ''' + * cversion of iterator. Used by :class:`pysam.Samfile.IteratorColumn`. + */ + +static int __pyx_f_9csamtools_7Samfile_cnext(struct __pyx_obj_9csamtools_Samfile *__pyx_v_self) { + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("cnext"); + __Pyx_TraceCall("cnext", __pyx_f[0], 1225); + + /* "csamtools.pyx":1230 + * ''' + * cdef int ret + * return samread(self.samfile, self.b) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_r = samread(__pyx_v_self->samfile, __pyx_v_self->b); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1232 + * return samread(self.samfile, self.b) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """ + * python version of next(). + */ + +static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_7Samfile_21__next__[] = "\n python version of next().\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_7Samfile_21__next__; +static PyObject *__pyx_pf_9csamtools_7Samfile_21__next__(PyObject *__pyx_v_self) { + int __pyx_v_ret; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1232); + + /* "csamtools.pyx":1237 + * """ + * cdef int ret + * ret = samread(self.samfile, self.b) # <<<<<<<<<<<<<< + * if (ret > 0): + * return makeAlignedRead( self.b ) + */ + __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->samfile, ((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); + + /* "csamtools.pyx":1238 + * cdef int ret + * ret = samread(self.samfile, self.b) + * if (ret > 0): # <<<<<<<<<<<<<< + * return makeAlignedRead( self.b ) + * else: + */ + __pyx_t_1 = (__pyx_v_ret > 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":1239 + * ret = samread(self.samfile, self.b) + * if (ret > 0): + * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<< + * else: + * raise StopIteration + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_Samfile *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":1241 + * return makeAlignedRead( self.b ) + * else: + * raise StopIteration # <<<<<<<<<<<<<< + * + * ##------------------------------------------------------------------- + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.Samfile.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1293 + * cdef int owns_samfile + * + * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ): # <<<<<<<<<<<<<< + * + * if not samfile._isOpen(): + */ + +static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_17IteratorRowRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + int __pyx_v_tid; + int __pyx_v_beg; + int __pyx_v_end; + int __pyx_v_reopen; + PyObject *__pyx_v_mode; + PyObject *__pyx_v_store; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__beg,&__pyx_n_s__end,&__pyx_n_s__reopen,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1293); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beg); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beg = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[4]) { + __pyx_v_reopen = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_reopen = ((int)1); + } + } else { + __pyx_v_reopen = ((int)1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: + __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: + __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beg = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_beg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_store = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1295 + * def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ): + * + * if not samfile._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":1296 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if not samfile._hasIndex(): + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1298 + * raise ValueError( "I/O operation on closed file" ) + * + * if not samfile._hasIndex(): # <<<<<<<<<<<<<< + * raise ValueError( "no index available for iteration" ) + * + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "csamtools.pyx":1299 + * + * if not samfile._hasIndex(): + * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<< + * + * # makes sure that samfile stays alive as long as the + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":1303 + * # makes sure that samfile stays alive as long as the + * # iterator is alive + * self.samfile = samfile # <<<<<<<<<<<<<< + * + * if samfile.isbam: mode = "rb" + */ + __Pyx_INCREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile)); + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile = __pyx_v_samfile; + + /* "csamtools.pyx":1305 + * self.samfile = samfile + * + * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<< + * else: mode = "r" + * + */ + if (__pyx_v_samfile->isbam) { + __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__rb); + goto __pyx_L8; + } + /*else*/ { + + /* "csamtools.pyx":1306 + * + * if samfile.isbam: mode = "rb" + * else: mode = "r" # <<<<<<<<<<<<<< + * + * # reopen the file - note that this makes the iterator + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__r); + } + __pyx_L8:; + + /* "csamtools.pyx":1310 + * # reopen the file - note that this makes the iterator + * # slow and causes pileup to slow down significantly. + * if reopen: # <<<<<<<<<<<<<< + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + */ + if (__pyx_v_reopen) { + + /* "csamtools.pyx":1311 + * # slow and causes pileup to slow down significantly. + * if reopen: + * store = StderrStore() # <<<<<<<<<<<<<< + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_store); + __pyx_v_store = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1312 + * if reopen: + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<< + * store.release() + * assert self.fp != NULL + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL); + + /* "csamtools.pyx":1313 + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() # <<<<<<<<<<<<<< + * assert self.fp != NULL + * self.owns_samfile = True + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":1314 + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + * assert self.fp != NULL # <<<<<<<<<<<<<< + * self.owns_samfile = True + * else: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp != NULL))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1315 + * store.release() + * assert self.fp != NULL + * self.owns_samfile = True # <<<<<<<<<<<<<< + * else: + * self.fp = self.samfile.samfile + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 1; + goto __pyx_L9; + } + /*else*/ { + + /* "csamtools.pyx":1317 + * self.owns_samfile = True + * else: + * self.fp = self.samfile.samfile # <<<<<<<<<<<<<< + * self.owns_samfile = False + * + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->samfile; + + /* "csamtools.pyx":1318 + * else: + * self.fp = self.samfile.samfile + * self.owns_samfile = False # <<<<<<<<<<<<<< + * + * self.retval = 0 + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile = 0; + } + __pyx_L9:; + + /* "csamtools.pyx":1320 + * self.owns_samfile = False + * + * self.retval = 0 # <<<<<<<<<<<<<< + * + * self.iter = bam_iter_query(self.samfile.index, + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval = 0; + + /* "csamtools.pyx":1322 + * self.retval = 0 + * + * self.iter = bam_iter_query(self.samfile.index, # <<<<<<<<<<<<<< + * tid, + * beg, + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->iter = bam_iter_query(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->samfile->index, __pyx_v_tid, __pyx_v_beg, __pyx_v_end); + + /* "csamtools.pyx":1326 + * beg, + * end) + * self.b = bam_init1() # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b = bam_init1(); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowRegion.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mode); + __Pyx_DECREF(__pyx_v_store); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1328 + * self.b = bam_init1() + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1328); + + /* "csamtools.pyx":1329 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * cdef bam1_t * getCurrent( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1331 + * return self + * + * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<< + * return self.b + * + */ + +static bam1_t *__pyx_f_9csamtools_17IteratorRowRegion_getCurrent(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) { + bam1_t *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getCurrent"); + __Pyx_TraceCall("getCurrent", __pyx_f[0], 1331); + + /* "csamtools.pyx":1332 + * + * cdef bam1_t * getCurrent( self ): + * return self.b # <<<<<<<<<<<<<< + * + * cdef int cnext(self): + */ + __pyx_r = __pyx_v_self->b; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1334 + * return self.b + * + * cdef int cnext(self): # <<<<<<<<<<<<<< + * '''cversion of iterator. Used by IteratorColumn''' + * self.retval = bam_iter_read( self.fp.x.bam, + */ + +static int __pyx_f_9csamtools_17IteratorRowRegion_cnext(struct __pyx_obj_9csamtools_IteratorRowRegion *__pyx_v_self) { + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("cnext"); + __Pyx_TraceCall("cnext", __pyx_f[0], 1334); + + /* "csamtools.pyx":1336 + * cdef int cnext(self): + * '''cversion of iterator. Used by IteratorColumn''' + * self.retval = bam_iter_read( self.fp.x.bam, # <<<<<<<<<<<<<< + * self.iter, + * self.b) + */ + __pyx_v_self->retval = bam_iter_read(__pyx_v_self->fp->x.bam, __pyx_v_self->iter, __pyx_v_self->b); + + __pyx_r = 0; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1340 + * self.b) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * """ + */ + +static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_17IteratorRowRegion_2__next__[] = "python version of next().\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__; +static PyObject *__pyx_pf_9csamtools_17IteratorRowRegion_2__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1340); + + /* "csamtools.pyx":1343 + * """python version of next(). + * """ + * self.cnext() # <<<<<<<<<<<<<< + * if self.retval < 0: raise StopIteration + * return makeAlignedRead( self.b ) + */ + ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)); + + /* "csamtools.pyx":1344 + * """ + * self.cnext() + * if self.retval < 0: raise StopIteration # <<<<<<<<<<<<<< + * return makeAlignedRead( self.b ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->retval < 0); + if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1345 + * self.cnext() + * if self.retval < 0: raise StopIteration + * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowRegion.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1347 + * return makeAlignedRead( self.b ) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) + */ + +static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1347); + + /* "csamtools.pyx":1348 + * + * def __dealloc__(self): + * bam_destroy1(self.b) # <<<<<<<<<<<<<< + * if self.owns_samfile: samclose( self.fp ) + * + */ + bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->b); + + /* "csamtools.pyx":1349 + * def __dealloc__(self): + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<< + * + * cdef class IteratorRowAll(IteratorRow): + */ + if (((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->owns_samfile) { + samclose(((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_v_self)->fp); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":1366 + * # cdef int owns_samfile + * + * def __cinit__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<< + * + * if not samfile._isOpen(): + */ + +static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_14IteratorRowAll___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + int __pyx_v_reopen; + PyObject *__pyx_v_mode; + PyObject *__pyx_v_store; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + char *__pyx_t_5; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1366); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + if (values[1]) { + __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_reopen = ((int)1); + } + } else { + __pyx_v_reopen = ((int)1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_store = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1368 + * def __cinit__(self, Samfile samfile, int reopen = True ): + * + * if not samfile._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":1369 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if samfile.isbam: mode = "rb" + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1371 + * raise ValueError( "I/O operation on closed file" ) + * + * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<< + * else: mode = "r" + * + */ + if (__pyx_v_samfile->isbam) { + __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__rb); + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":1372 + * + * if samfile.isbam: mode = "rb" + * else: mode = "r" # <<<<<<<<<<<<<< + * + * # reopen the file to avoid iterator conflict + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__r); + } + __pyx_L7:; + + /* "csamtools.pyx":1375 + * + * # reopen the file to avoid iterator conflict + * if reopen: # <<<<<<<<<<<<<< + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + */ + if (__pyx_v_reopen) { + + /* "csamtools.pyx":1376 + * # reopen the file to avoid iterator conflict + * if reopen: + * store = StderrStore() # <<<<<<<<<<<<<< + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_store); + __pyx_v_store = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":1377 + * if reopen: + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<< + * store.release() + * assert self.fp != NULL + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL); + + /* "csamtools.pyx":1378 + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() # <<<<<<<<<<<<<< + * assert self.fp != NULL + * self.owns_samfile = True + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":1379 + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + * assert self.fp != NULL # <<<<<<<<<<<<<< + * self.owns_samfile = True + * else: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp != NULL))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1380 + * store.release() + * assert self.fp != NULL + * self.owns_samfile = True # <<<<<<<<<<<<<< + * else: + * self.fp = samfile.samfile + */ + ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 1; + goto __pyx_L8; + } + /*else*/ { + + /* "csamtools.pyx":1382 + * self.owns_samfile = True + * else: + * self.fp = samfile.samfile # <<<<<<<<<<<<<< + * self.owns_samfile = False + * + */ + ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp = __pyx_v_samfile->samfile; + + /* "csamtools.pyx":1383 + * else: + * self.fp = samfile.samfile + * self.owns_samfile = False # <<<<<<<<<<<<<< + * + * # allocate memory for alignment + */ + ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile = 0; + } + __pyx_L8:; + + /* "csamtools.pyx":1386 + * + * # allocate memory for alignment + * self.b = calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowAll.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mode); + __Pyx_DECREF(__pyx_v_store); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1388 + * self.b = calloc(1, sizeof(bam1_t)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1388); + + /* "csamtools.pyx":1389 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * cdef bam1_t * getCurrent( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1391 + * return self + * + * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<< + * return self.b + * + */ + +static bam1_t *__pyx_f_9csamtools_14IteratorRowAll_getCurrent(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) { + bam1_t *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getCurrent"); + __Pyx_TraceCall("getCurrent", __pyx_f[0], 1391); + + /* "csamtools.pyx":1392 + * + * cdef bam1_t * getCurrent( self ): + * return self.b # <<<<<<<<<<<<<< + * + * cdef int cnext(self): + */ + __pyx_r = __pyx_v_self->b; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1394 + * return self.b + * + * cdef int cnext(self): # <<<<<<<<<<<<<< + * '''cversion of iterator. Used by IteratorColumn''' + * cdef int ret + */ + +static int __pyx_f_9csamtools_14IteratorRowAll_cnext(struct __pyx_obj_9csamtools_IteratorRowAll *__pyx_v_self) { + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("cnext"); + __Pyx_TraceCall("cnext", __pyx_f[0], 1394); + + /* "csamtools.pyx":1397 + * '''cversion of iterator. Used by IteratorColumn''' + * cdef int ret + * return samread(self.fp, self.b) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1399 + * return samread(self.fp, self.b) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_14IteratorRowAll_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__; +static PyObject *__pyx_pf_9csamtools_14IteratorRowAll_2__next__(PyObject *__pyx_v_self) { + int __pyx_v_ret; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1399); + + /* "csamtools.pyx":1405 + * """ + * cdef int ret + * ret = samread(self.fp, self.b) # <<<<<<<<<<<<<< + * if (ret > 0): + * return makeAlignedRead( self.b ) + */ + __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp, ((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); + + /* "csamtools.pyx":1406 + * cdef int ret + * ret = samread(self.fp, self.b) + * if (ret > 0): # <<<<<<<<<<<<<< + * return makeAlignedRead( self.b ) + * else: + */ + __pyx_t_1 = (__pyx_v_ret > 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":1407 + * ret = samread(self.fp, self.b) + * if (ret > 0): + * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<< + * else: + * raise StopIteration + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":1409 + * return makeAlignedRead( self.b ) + * else: + * raise StopIteration # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowAll.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1411 + * raise StopIteration + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) + */ + +static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1411); + + /* "csamtools.pyx":1412 + * + * def __dealloc__(self): + * bam_destroy1(self.b) # <<<<<<<<<<<<<< + * if self.owns_samfile: samclose( self.fp ) + * + */ + bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->b); + + /* "csamtools.pyx":1413 + * def __dealloc__(self): + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<< + * + * cdef class IteratorRowAllRefs(IteratorRow): + */ + if (((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->owns_samfile) { + samclose(((struct __pyx_obj_9csamtools_IteratorRowAll *)__pyx_v_self)->fp); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":1422 + * cdef IteratorRowRegion rowiter + * + * def __cinit__(self, Samfile samfile): # <<<<<<<<<<<<<< + * assert samfile._isOpen() + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") + */ + +static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1422); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1423 + * + * def __cinit__(self, Samfile samfile): + * assert samfile._isOpen() # <<<<<<<<<<<<<< + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") + * self.samfile = samfile + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1424 + * def __cinit__(self, Samfile samfile): + * assert samfile._isOpen() + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<< + * self.samfile = samfile + * self.tid = -1 + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___hasIndex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1425 + * assert samfile._isOpen() + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") + * self.samfile = samfile # <<<<<<<<<<<<<< + * self.tid = -1 + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile)); + ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile = __pyx_v_samfile; + + /* "csamtools.pyx":1426 + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") + * self.samfile = samfile + * self.tid = -1 # <<<<<<<<<<<<<< + * + * def nextiter(self): + */ + ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = -1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1428 + * self.tid = -1 + * + * def nextiter(self): # <<<<<<<<<<<<<< + * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) + * + */ + +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter[] = "IteratorRowAllRefs.nextiter(self)"; +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("nextiter"); + __Pyx_TraceCall("nextiter", __pyx_f[0], 1428); + + /* "csamtools.pyx":1429 + * + * def nextiter(self): + * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile)); + __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_536870912); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_int_536870912); + __Pyx_GIVEREF(__pyx_int_536870912); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter)); + ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowAllRefs.nextiter"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1431 + * self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1431); + + /* "csamtools.pyx":1432 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1434 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__; +static PyObject *__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1434); + + /* "csamtools.pyx":1440 + * """ + * # Create an initial iterator + * if self.tid==-1: # <<<<<<<<<<<<<< + * if not self.samfile.nreferences: + * raise StopIteration + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid == -1); + if (__pyx_t_1) { + + /* "csamtools.pyx":1441 + * # Create an initial iterator + * if self.tid==-1: + * if not self.samfile.nreferences: # <<<<<<<<<<<<<< + * raise StopIteration + * self.tid = 0 + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (!__pyx_t_1); + if (__pyx_t_3) { + + /* "csamtools.pyx":1442 + * if self.tid==-1: + * if not self.samfile.nreferences: + * raise StopIteration # <<<<<<<<<<<<<< + * self.tid = 0 + * self.nextiter() + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1443 + * if not self.samfile.nreferences: + * raise StopIteration + * self.tid = 0 # <<<<<<<<<<<<<< + * self.nextiter() + * + */ + ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = 0; + + /* "csamtools.pyx":1444 + * raise StopIteration + * self.tid = 0 + * self.nextiter() # <<<<<<<<<<<<<< + * + * while 1: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__nextiter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1446 + * self.nextiter() + * + * while 1: # <<<<<<<<<<<<<< + * self.rowiter.cnext() + * + */ + while (1) { + if (!1) break; + + /* "csamtools.pyx":1447 + * + * while 1: + * self.rowiter.cnext() # <<<<<<<<<<<<<< + * + * # If current iterator is not exhausted, return aligned read + */ + ((struct __pyx_vtabstruct_9csamtools_IteratorRowRegion *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter); + + /* "csamtools.pyx":1450 + * + * # If current iterator is not exhausted, return aligned read + * if self.rowiter.retval>0: # <<<<<<<<<<<<<< + * return makeAlignedRead(self.rowiter.b) + * + */ + __pyx_t_3 = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->retval > 0); + if (__pyx_t_3) { + + /* "csamtools.pyx":1451 + * # If current iterator is not exhausted, return aligned read + * if self.rowiter.retval>0: + * return makeAlignedRead(self.rowiter.b) # <<<<<<<<<<<<<< + * + * self.tid += 1 + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->rowiter->b); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":1453 + * return makeAlignedRead(self.rowiter.b) + * + * self.tid += 1 # <<<<<<<<<<<<<< + * + * # Otherwise, proceed to next reference or stop + */ + ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid = (((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->tid + 1); + + /* "csamtools.pyx":1456 + * + * # Otherwise, proceed to next reference or stop + * if self.tidtid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)__pyx_v_self)->samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + + /* "csamtools.pyx":1457 + * # Otherwise, proceed to next reference or stop + * if self.tid 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + __pyx_v_positions = values[1]; + if (values[2]) { + __pyx_v_reopen = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_reopen = ((int)1); + } + } else { + __pyx_v_reopen = ((int)1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: + __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: + __pyx_v_positions = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_store = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1476 + * def __cinit__(self, Samfile samfile, positions, int reopen = True ): + * + * if not samfile._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "csamtools.pyx":1477 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if not samfile._isOpen(): + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1479 + * raise ValueError( "I/O operation on closed file" ) + * + * if not samfile._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "csamtools.pyx":1480 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * assert samfile.isbam, "can only use this iterator on bam files" + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":1482 + * raise ValueError( "I/O operation on closed file" ) + * + * assert samfile.isbam, "can only use this iterator on bam files" # <<<<<<<<<<<<<< + * mode = "rb" + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!__pyx_v_samfile->isbam)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_112)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1483 + * + * assert samfile.isbam, "can only use this iterator on bam files" + * mode = "rb" # <<<<<<<<<<<<<< + * + * # reopen the file to avoid iterator conflict + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__rb); + + /* "csamtools.pyx":1486 + * + * # reopen the file to avoid iterator conflict + * if reopen: # <<<<<<<<<<<<<< + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + */ + if (__pyx_v_reopen) { + + /* "csamtools.pyx":1487 + * # reopen the file to avoid iterator conflict + * if reopen: + * store = StderrStore() # <<<<<<<<<<<<<< + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_store); + __pyx_v_store = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1488 + * if reopen: + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<< + * store.release() + * assert self.fp != NULL + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_5, NULL); + + /* "csamtools.pyx":1489 + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() # <<<<<<<<<<<<<< + * assert self.fp != NULL + * self.owns_samfile = True + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":1490 + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + * assert self.fp != NULL # <<<<<<<<<<<<<< + * self.owns_samfile = True + * else: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp != NULL))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":1491 + * store.release() + * assert self.fp != NULL + * self.owns_samfile = True # <<<<<<<<<<<<<< + * else: + * self.fp = samfile.samfile + */ + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 1; + goto __pyx_L8; + } + /*else*/ { + + /* "csamtools.pyx":1493 + * self.owns_samfile = True + * else: + * self.fp = samfile.samfile # <<<<<<<<<<<<<< + * self.owns_samfile = False + * + */ + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp = __pyx_v_samfile->samfile; + + /* "csamtools.pyx":1494 + * else: + * self.fp = samfile.samfile + * self.owns_samfile = False # <<<<<<<<<<<<<< + * + * # allocate memory for alignment + */ + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile = 0; + } + __pyx_L8:; + + /* "csamtools.pyx":1497 + * + * # allocate memory for alignment + * self.b = calloc(1, sizeof(bam1_t)) # <<<<<<<<<<<<<< + * + * self.positions = positions + */ + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); + + /* "csamtools.pyx":1499 + * self.b = calloc(1, sizeof(bam1_t)) + * + * self.positions = positions # <<<<<<<<<<<<<< + * self.current_pos = 0 + * + */ + __Pyx_INCREF(__pyx_v_positions); + __Pyx_GIVEREF(__pyx_v_positions); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions); + __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions); + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->positions = __pyx_v_positions; + + /* "csamtools.pyx":1500 + * + * self.positions = positions + * self.current_pos = 0 # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + ((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->current_pos = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowSelection.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mode); + __Pyx_DECREF(__pyx_v_store); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1502 + * self.current_pos = 0 + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1502); + + /* "csamtools.pyx":1503 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * cdef bam1_t * getCurrent( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1505 + * return self + * + * cdef bam1_t * getCurrent( self ): # <<<<<<<<<<<<<< + * return self.b + * + */ + +static bam1_t *__pyx_f_9csamtools_20IteratorRowSelection_getCurrent(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) { + bam1_t *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getCurrent"); + __Pyx_TraceCall("getCurrent", __pyx_f[0], 1505); + + /* "csamtools.pyx":1506 + * + * cdef bam1_t * getCurrent( self ): + * return self.b # <<<<<<<<<<<<<< + * + * cdef int cnext(self): + */ + __pyx_r = __pyx_v_self->b; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1508 + * return self.b + * + * cdef int cnext(self): # <<<<<<<<<<<<<< + * '''cversion of iterator''' + * + */ + +static int __pyx_f_9csamtools_20IteratorRowSelection_cnext(struct __pyx_obj_9csamtools_IteratorRowSelection *__pyx_v_self) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + uint64_t __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("cnext"); + __Pyx_TraceCall("cnext", __pyx_f[0], 1508); + + /* "csamtools.pyx":1512 + * + * # end iteration if out of positions + * if self.current_pos >= len(self.positions): return -1 # <<<<<<<<<<<<<< + * + * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) + */ + __pyx_t_1 = __pyx_v_self->positions; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_v_self->current_pos >= __pyx_t_2); + if (__pyx_t_3) { + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1514 + * if self.current_pos >= len(self.positions): return -1 + * + * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) # <<<<<<<<<<<<<< + * self.current_pos += 1 + * return samread(self.fp, self.b) + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->positions, __pyx_v_self->current_pos, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_from_py_uint64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (uint64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + bam_seek(__pyx_v_self->fp->x.bam, __pyx_t_4, 0); + + /* "csamtools.pyx":1515 + * + * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) + * self.current_pos += 1 # <<<<<<<<<<<<<< + * return samread(self.fp, self.b) + * + */ + __pyx_v_self->current_pos = (__pyx_v_self->current_pos + 1); + + /* "csamtools.pyx":1516 + * bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) + * self.current_pos += 1 + * return samread(self.fp, self.b) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_r = samread(__pyx_v_self->fp, __pyx_v_self->b); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_WriteUnraisable("csamtools.IteratorRowSelection.cnext"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1518 + * return samread(self.fp, self.b) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_20IteratorRowSelection_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__; +static PyObject *__pyx_pf_9csamtools_20IteratorRowSelection_2__next__(PyObject *__pyx_v_self) { + int __pyx_v_ret; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1518); + + /* "csamtools.pyx":1524 + * """ + * + * cdef int ret = self.cnext() # <<<<<<<<<<<<<< + * if (ret > 0): + * return makeAlignedRead( self.b ) + */ + __pyx_v_ret = ((struct __pyx_vtabstruct_9csamtools_IteratorRowSelection *)((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->__pyx_vtab)->cnext(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)); + + /* "csamtools.pyx":1525 + * + * cdef int ret = self.cnext() + * if (ret > 0): # <<<<<<<<<<<<<< + * return makeAlignedRead( self.b ) + * else: + */ + __pyx_t_1 = (__pyx_v_ret > 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":1526 + * cdef int ret = self.cnext() + * if (ret > 0): + * return makeAlignedRead( self.b ) # <<<<<<<<<<<<<< + * else: + * raise StopIteration + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_makeAlignedRead(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":1528 + * return makeAlignedRead( self.b ) + * else: + * raise StopIteration # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorRowSelection.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1530 + * raise StopIteration + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) + */ + +static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1530); + + /* "csamtools.pyx":1531 + * + * def __dealloc__(self): + * bam_destroy1(self.b) # <<<<<<<<<<<<<< + * if self.owns_samfile: samclose( self.fp ) + * + */ + bam_destroy1(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->b); + + /* "csamtools.pyx":1532 + * def __dealloc__(self): + * bam_destroy1(self.b) + * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<< + * + * ##------------------------------------------------------------------- + */ + if (((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->owns_samfile) { + samclose(((struct __pyx_obj_9csamtools_IteratorRowSelection *)__pyx_v_self)->fp); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":1545 + * int seq_len + * + * cdef int __advance_all( void * data, bam1_t * b ): # <<<<<<<<<<<<<< + * '''advance without any read filtering. + * ''' + */ + +static int __pyx_f_9csamtools___advance_all(void *__pyx_v_data, bam1_t *__pyx_v_b) { + __pyx_t_9csamtools___iterdata *__pyx_v_d; + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__advance_all"); + __Pyx_TraceCall("__advance_all", __pyx_f[0], 1545); + + /* "csamtools.pyx":1549 + * ''' + * cdef __iterdata * d + * d = <__iterdata*>data # <<<<<<<<<<<<<< + * return bam_iter_read( d.samfile.x.bam, d.iter, b ) + * + */ + __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data); + + /* "csamtools.pyx":1550 + * cdef __iterdata * d + * d = <__iterdata*>data + * return bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<< + * + * cdef int __advance_snpcalls( void * data, bam1_t * b ): + */ + __pyx_r = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1552 + * return bam_iter_read( d.samfile.x.bam, d.iter, b ) + * + * cdef int __advance_snpcalls( void * data, bam1_t * b ): # <<<<<<<<<<<<<< + * '''advance using same filter and read processing as in + * the samtools pileup. + */ + +static int __pyx_f_9csamtools___advance_snpcalls(void *__pyx_v_data, bam1_t *__pyx_v_b) { + __pyx_t_9csamtools___iterdata *__pyx_v_d; + int __pyx_v_ret; + int __pyx_v_skip; + int __pyx_v_q; + int __pyx_v_is_cns; + int __pyx_v_is_nobaq; + int __pyx_v_capQ_thres; + int __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + long __pyx_t_7; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__advance_snpcalls"); + __Pyx_TraceCall("__advance_snpcalls", __pyx_f[0], 1552); + + /* "csamtools.pyx":1557 + * ''' + * cdef __iterdata * d + * d = <__iterdata*>data # <<<<<<<<<<<<<< + * + * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) + */ + __pyx_v_d = ((__pyx_t_9csamtools___iterdata *)__pyx_v_data); + + /* "csamtools.pyx":1559 + * d = <__iterdata*>data + * + * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<< + * cdef int skip = 0 + * cdef int q + */ + __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b); + + /* "csamtools.pyx":1560 + * + * cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) + * cdef int skip = 0 # <<<<<<<<<<<<<< + * cdef int q + * cdef int is_cns = 1 + */ + __pyx_v_skip = 0; + + /* "csamtools.pyx":1562 + * cdef int skip = 0 + * cdef int q + * cdef int is_cns = 1 # <<<<<<<<<<<<<< + * cdef int is_nobaq = 0 + * cdef int capQ_thres = 0 + */ + __pyx_v_is_cns = 1; + + /* "csamtools.pyx":1563 + * cdef int q + * cdef int is_cns = 1 + * cdef int is_nobaq = 0 # <<<<<<<<<<<<<< + * cdef int capQ_thres = 0 + * + */ + __pyx_v_is_nobaq = 0; + + /* "csamtools.pyx":1564 + * cdef int is_cns = 1 + * cdef int is_nobaq = 0 + * cdef int capQ_thres = 0 # <<<<<<<<<<<<<< + * + * # reload sequence + */ + __pyx_v_capQ_thres = 0; + + /* "csamtools.pyx":1567 + * + * # reload sequence + * if d.fastafile != NULL and b.core.tid != d.tid: # <<<<<<<<<<<<<< + * if d.seq != NULL: free(d.seq) + * d.tid = b.core.tid + */ + __pyx_t_1 = (__pyx_v_d->fastafile != NULL); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_b->core.tid != __pyx_v_d->tid); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "csamtools.pyx":1568 + * # reload sequence + * if d.fastafile != NULL and b.core.tid != d.tid: + * if d.seq != NULL: free(d.seq) # <<<<<<<<<<<<<< + * d.tid = b.core.tid + * d.seq = faidx_fetch_seq(d.fastafile, + */ + __pyx_t_3 = (__pyx_v_d->seq != NULL); + if (__pyx_t_3) { + free(__pyx_v_d->seq); + goto __pyx_L4; + } + __pyx_L4:; + + /* "csamtools.pyx":1569 + * if d.fastafile != NULL and b.core.tid != d.tid: + * if d.seq != NULL: free(d.seq) + * d.tid = b.core.tid # <<<<<<<<<<<<<< + * d.seq = faidx_fetch_seq(d.fastafile, + * d.samfile.header.target_name[d.tid], + */ + __pyx_v_d->tid = __pyx_v_b->core.tid; + + /* "csamtools.pyx":1570 + * if d.seq != NULL: free(d.seq) + * d.tid = b.core.tid + * d.seq = faidx_fetch_seq(d.fastafile, # <<<<<<<<<<<<<< + * d.samfile.header.target_name[d.tid], + * 0, max_pos, + */ + __pyx_v_d->seq = faidx_fetch_seq(__pyx_v_d->fastafile, (__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid]), 0, __pyx_v_9csamtools_max_pos, (&__pyx_v_d->seq_len)); + + /* "csamtools.pyx":1574 + * 0, max_pos, + * &d.seq_len) + * if d.seq == NULL: # <<<<<<<<<<<<<< + * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \ + * (d.samfile.header.target_name[d.tid], + */ + __pyx_t_3 = (__pyx_v_d->seq == NULL); + if (__pyx_t_3) { + + /* "csamtools.pyx":1576 + * if d.seq == NULL: + * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \ + * (d.samfile.header.target_name[d.tid], # <<<<<<<<<<<<<< + * d.tid)) + * + */ + __pyx_t_4 = PyBytes_FromString((__pyx_v_d->samfile->header->target_name[__pyx_v_d->tid])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + + /* "csamtools.pyx":1577 + * raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \ + * (d.samfile.header.target_name[d.tid], + * d.tid)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = PyInt_FromLong(__pyx_v_d->tid); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1580 + * + * + * while ret >= 0: # <<<<<<<<<<<<<< + * + * skip = 0 + */ + while (1) { + __pyx_t_3 = (__pyx_v_ret >= 0); + if (!__pyx_t_3) break; + + /* "csamtools.pyx":1582 + * while ret >= 0: + * + * skip = 0 # <<<<<<<<<<<<<< + * + * # realign read - changes base qualities + */ + __pyx_v_skip = 0; + + /* "csamtools.pyx":1585 + * + * # realign read - changes base qualities + * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq ) # <<<<<<<<<<<<<< + * + * if d.seq != NULL and capQ_thres > 10: + */ + __pyx_t_3 = (__pyx_v_d->seq != NULL); + if (__pyx_t_3) { + if (__pyx_v_is_cns) { + __pyx_t_1 = (!__pyx_v_is_nobaq); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_v_is_cns; + } + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + bam_prob_realn(__pyx_v_b, __pyx_v_d->seq); + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":1587 + * if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq ) + * + * if d.seq != NULL and capQ_thres > 10: # <<<<<<<<<<<<<< + * q = bam_cap_mapQ(b, d.seq, capQ_thres) + * if q < 0: skip = 1 + */ + __pyx_t_1 = (__pyx_v_d->seq != NULL); + if (__pyx_t_1) { + __pyx_t_3 = (__pyx_v_capQ_thres > 10); + __pyx_t_2 = __pyx_t_3; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (__pyx_t_2) { + + /* "csamtools.pyx":1588 + * + * if d.seq != NULL and capQ_thres > 10: + * q = bam_cap_mapQ(b, d.seq, capQ_thres) # <<<<<<<<<<<<<< + * if q < 0: skip = 1 + * elif b.core.qual > q: b.core.qual = q + */ + __pyx_v_q = bam_cap_mapQ(__pyx_v_b, __pyx_v_d->seq, __pyx_v_capQ_thres); + + /* "csamtools.pyx":1589 + * if d.seq != NULL and capQ_thres > 10: + * q = bam_cap_mapQ(b, d.seq, capQ_thres) + * if q < 0: skip = 1 # <<<<<<<<<<<<<< + * elif b.core.qual > q: b.core.qual = q + * if b.core.flag & BAM_FUNMAP: skip = 1 + */ + __pyx_t_2 = (__pyx_v_q < 0); + if (__pyx_t_2) { + __pyx_v_skip = 1; + goto __pyx_L10; + } + + /* "csamtools.pyx":1590 + * q = bam_cap_mapQ(b, d.seq, capQ_thres) + * if q < 0: skip = 1 + * elif b.core.qual > q: b.core.qual = q # <<<<<<<<<<<<<< + * if b.core.flag & BAM_FUNMAP: skip = 1 + * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 + */ + __pyx_t_2 = (__pyx_v_b->core.qual > __pyx_v_q); + if (__pyx_t_2) { + __pyx_v_b->core.qual = __pyx_v_q; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":1591 + * if q < 0: skip = 1 + * elif b.core.qual > q: b.core.qual = q + * if b.core.flag & BAM_FUNMAP: skip = 1 # <<<<<<<<<<<<<< + * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 + * + */ + __pyx_t_7 = (__pyx_v_b->core.flag & 4); + if (__pyx_t_7) { + __pyx_v_skip = 1; + goto __pyx_L11; + } + + /* "csamtools.pyx":1592 + * elif b.core.qual > q: b.core.qual = q + * if b.core.flag & BAM_FUNMAP: skip = 1 + * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 # <<<<<<<<<<<<<< + * + * if not skip: break + */ + if ((__pyx_v_b->core.flag & 1)) { + __pyx_t_2 = (!(__pyx_v_b->core.flag & 2)); + __pyx_t_1 = __pyx_t_2; + } else { + __pyx_t_1 = (__pyx_v_b->core.flag & 1); + } + if (__pyx_t_1) { + __pyx_v_skip = 1; + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":1594 + * elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 + * + * if not skip: break # <<<<<<<<<<<<<< + * # additional filters + * + */ + __pyx_t_1 = (!__pyx_v_skip); + if (__pyx_t_1) { + goto __pyx_L7_break; + goto __pyx_L12; + } + __pyx_L12:; + + /* "csamtools.pyx":1597 + * # additional filters + * + * ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) # <<<<<<<<<<<<<< + * + * return ret + */ + __pyx_v_ret = bam_iter_read(__pyx_v_d->samfile->x.bam, __pyx_v_d->iter, __pyx_v_b); + } + __pyx_L7_break:; + + /* "csamtools.pyx":1599 + * ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) + * + * return ret # <<<<<<<<<<<<<< + * + * cdef class IteratorColumn: + */ + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_WriteUnraisable("csamtools.__advance_snpcalls"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1659 + * cdef int max_depth + * + * def __cinit__( self, Samfile samfile, **kwargs ): # <<<<<<<<<<<<<< + * self.samfile = samfile + * self.mask = kwargs.get("mask", BAM_DEF_MASK ) + */ + +static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_14IteratorColumn___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1659); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1660 + * + * def __cinit__( self, Samfile samfile, **kwargs ): + * self.samfile = samfile # <<<<<<<<<<<<<< + * self.mask = kwargs.get("mask", BAM_DEF_MASK ) + * self.fastafile = kwargs.get( "fastafile", None ) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile)); + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->samfile = __pyx_v_samfile; + + /* "csamtools.pyx":1661 + * def __cinit__( self, Samfile samfile, **kwargs ): + * self.samfile = samfile + * self.mask = kwargs.get("mask", BAM_DEF_MASK ) # <<<<<<<<<<<<<< + * self.fastafile = kwargs.get( "fastafile", None ) + * self.stepper = kwargs.get( "stepper", None ) + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyInt_FromLong(BAM_DEF_MASK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__mask), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->mask = __pyx_t_3; + + /* "csamtools.pyx":1662 + * self.samfile = samfile + * self.mask = kwargs.get("mask", BAM_DEF_MASK ) + * self.fastafile = kwargs.get( "fastafile", None ) # <<<<<<<<<<<<<< + * self.stepper = kwargs.get( "stepper", None ) + * self.max_depth = kwargs.get( "max_depth", 8000 ) + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__fastafile), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_9csamtools_Fastafile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile)); + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "csamtools.pyx":1663 + * self.mask = kwargs.get("mask", BAM_DEF_MASK ) + * self.fastafile = kwargs.get( "fastafile", None ) + * self.stepper = kwargs.get( "stepper", None ) # <<<<<<<<<<<<<< + * self.max_depth = kwargs.get( "max_depth", 8000 ) + * self.iterdata.seq = NULL + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__stepper), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper); + __Pyx_DECREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper); + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->stepper = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1664 + * self.fastafile = kwargs.get( "fastafile", None ) + * self.stepper = kwargs.get( "stepper", None ) + * self.max_depth = kwargs.get( "max_depth", 8000 ) # <<<<<<<<<<<<<< + * self.iterdata.seq = NULL + * self.tid = 0 + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'get'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_depth), __pyx_int_8000); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->max_depth = __pyx_t_3; + + /* "csamtools.pyx":1665 + * self.stepper = kwargs.get( "stepper", None ) + * self.max_depth = kwargs.get( "max_depth", 8000 ) + * self.iterdata.seq = NULL # <<<<<<<<<<<<<< + * self.tid = 0 + * self.pos = 0 + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL; + + /* "csamtools.pyx":1666 + * self.max_depth = kwargs.get( "max_depth", 8000 ) + * self.iterdata.seq = NULL + * self.tid = 0 # <<<<<<<<<<<<<< + * self.pos = 0 + * self.n_plp = 0 + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->tid = 0; + + /* "csamtools.pyx":1667 + * self.iterdata.seq = NULL + * self.tid = 0 + * self.pos = 0 # <<<<<<<<<<<<<< + * self.n_plp = 0 + * self.plp = NULL + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pos = 0; + + /* "csamtools.pyx":1668 + * self.tid = 0 + * self.pos = 0 + * self.n_plp = 0 # <<<<<<<<<<<<<< + * self.plp = NULL + * self.pileup_iter = NULL + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->n_plp = 0; + + /* "csamtools.pyx":1669 + * self.pos = 0 + * self.n_plp = 0 + * self.plp = NULL # <<<<<<<<<<<<<< + * self.pileup_iter = NULL + * + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->plp = NULL; + + /* "csamtools.pyx":1670 + * self.n_plp = 0 + * self.plp = NULL + * self.pileup_iter = NULL # <<<<<<<<<<<<<< + * + * + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorColumn.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1673 + * + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__iter__"); + __Pyx_TraceCall("__iter__", __pyx_f[0], 1673); + + /* "csamtools.pyx":1674 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * cdef int cnext(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1676 + * return self + * + * cdef int cnext(self): # <<<<<<<<<<<<<< + * '''perform next iteration. + * + */ + +static int __pyx_f_9csamtools_14IteratorColumn_cnext(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) { + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("cnext"); + __Pyx_TraceCall("cnext", __pyx_f[0], 1676); + + /* "csamtools.pyx":1682 + * It has been re-implemented to permit for filtering. + * ''' + * self.plp = bam_plp_auto( self.pileup_iter, # <<<<<<<<<<<<<< + * &self.tid, + * &self.pos, + */ + __pyx_v_self->plp = bam_plp_auto(__pyx_v_self->pileup_iter, (&__pyx_v_self->tid), (&__pyx_v_self->pos), (&__pyx_v_self->n_plp)); + + __pyx_r = 0; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1687 + * &self.n_plp ) + * + * cdef char * getSequence( self ): # <<<<<<<<<<<<<< + * '''return current reference sequence underlying the iterator. + * ''' + */ + +static char *__pyx_f_9csamtools_14IteratorColumn_getSequence(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self) { + char *__pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("getSequence"); + __Pyx_TraceCall("getSequence", __pyx_f[0], 1687); + + /* "csamtools.pyx":1690 + * '''return current reference sequence underlying the iterator. + * ''' + * return self.iterdata.seq # <<<<<<<<<<<<<< + * + * property seq_len: + */ + __pyx_r = __pyx_v_self->iterdata.seq; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1694 + * property seq_len: + * '''current sequence length.''' + * def __get__(self): return self.iterdata.seq_len # <<<<<<<<<<<<<< + * + * def addReference( self, Fastafile fastafile ): + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 1694); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.IteratorColumn.seq_len.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1696 + * def __get__(self): return self.iterdata.seq_len + * + * def addReference( self, Fastafile fastafile ): # <<<<<<<<<<<<<< + * ''' + * add reference sequences in *fastafile* to iterator.''' + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile); /*proto*/ +static char __pyx_doc_9csamtools_14IteratorColumn_2addReference[] = "IteratorColumn.addReference(self, Fastafile fastafile)\n\n add reference sequences in *fastafile* to iterator."; +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_2addReference(PyObject *__pyx_v_self, PyObject *__pyx_v_fastafile) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("addReference"); + __Pyx_TraceCall("addReference", __pyx_f[0], 1696); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fastafile), __pyx_ptype_9csamtools_Fastafile, 1, "fastafile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1699 + * ''' + * add reference sequences in *fastafile* to iterator.''' + * self.fastafile = fastafile # <<<<<<<<<<<<<< + * if self.iterdata.seq != NULL: free(self.iterdata.seq) + * self.iterdata.tid = -1 + */ + __Pyx_INCREF(__pyx_v_fastafile); + __Pyx_GIVEREF(__pyx_v_fastafile); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile)); + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)__pyx_v_fastafile); + + /* "csamtools.pyx":1700 + * add reference sequences in *fastafile* to iterator.''' + * self.fastafile = fastafile + * if self.iterdata.seq != NULL: free(self.iterdata.seq) # <<<<<<<<<<<<<< + * self.iterdata.tid = -1 + * self.iterdata.fastafile = self.fastafile.fastafile + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL); + if (__pyx_t_1) { + free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq); + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1701 + * self.fastafile = fastafile + * if self.iterdata.seq != NULL: free(self.iterdata.seq) + * self.iterdata.tid = -1 # <<<<<<<<<<<<<< + * self.iterdata.fastafile = self.fastafile.fastafile + * + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.tid = -1; + + /* "csamtools.pyx":1702 + * if self.iterdata.seq != NULL: free(self.iterdata.seq) + * self.iterdata.tid = -1 + * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<< + * + * def hasReference( self ): + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.fastafile = ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile->fastafile; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.IteratorColumn.addReference"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1704 + * self.iterdata.fastafile = self.fastafile.fastafile + * + * def hasReference( self ): # <<<<<<<<<<<<<< + * ''' + * return true if iterator is associated with a reference''' + */ + +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_14IteratorColumn_3hasReference[] = "IteratorColumn.hasReference(self)\n\n return true if iterator is associated with a reference"; +static PyObject *__pyx_pf_9csamtools_14IteratorColumn_3hasReference(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("hasReference"); + __Pyx_TraceCall("hasReference", __pyx_f[0], 1704); + + /* "csamtools.pyx":1707 + * ''' + * return true if iterator is associated with a reference''' + * return self.fastafile # <<<<<<<<<<<<<< + * + * cdef setMask( self, mask ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile)); + __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->fastafile); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1709 + * return self.fastafile + * + * cdef setMask( self, mask ): # <<<<<<<<<<<<<< + * '''set masking flag in iterator. + * + */ + +static PyObject *__pyx_f_9csamtools_14IteratorColumn_setMask(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("setMask"); + __Pyx_TraceCall("setMask", __pyx_f[0], 1709); + + /* "csamtools.pyx":1714 + * reads with bits set in *mask* will be skipped. + * ''' + * self.mask = mask # <<<<<<<<<<<<<< + * bam_plp_set_mask( self.pileup_iter, self.mask ) + * + */ + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_mask); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->mask = __pyx_t_1; + + /* "csamtools.pyx":1715 + * ''' + * self.mask = mask + * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<< + * + * cdef setupIteratorData( self, + */ + bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.IteratorColumn.setMask"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1717 + * bam_plp_set_mask( self.pileup_iter, self.mask ) + * + * cdef setupIteratorData( self, # <<<<<<<<<<<<<< + * int tid, + * int start, + */ + +static PyObject *__pyx_f_9csamtools_14IteratorColumn_setupIteratorData(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, int __pyx_v_tid, int __pyx_v_start, int __pyx_v_end, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args) { + int __pyx_v_reopen = ((int)0); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("setupIteratorData"); + __Pyx_TraceCall("setupIteratorData", __pyx_f[0], 1717); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_reopen = __pyx_optional_args->reopen; + } + } + + /* "csamtools.pyx":1724 + * '''setup the iterator structure''' + * + * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) # <<<<<<<<<<<<<< + * self.iterdata.samfile = self.samfile.samfile + * self.iterdata.iter = self.iter.iter + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_reopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->iter); + __Pyx_DECREF(((PyObject *)__pyx_v_self->iter)); + __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "csamtools.pyx":1725 + * + * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) + * self.iterdata.samfile = self.samfile.samfile # <<<<<<<<<<<<<< + * self.iterdata.iter = self.iter.iter + * self.iterdata.seq = NULL + */ + __pyx_v_self->iterdata.samfile = __pyx_v_self->samfile->samfile; + + /* "csamtools.pyx":1726 + * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) + * self.iterdata.samfile = self.samfile.samfile + * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<< + * self.iterdata.seq = NULL + * self.iterdata.tid = -1 + */ + __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter; + + /* "csamtools.pyx":1727 + * self.iterdata.samfile = self.samfile.samfile + * self.iterdata.iter = self.iter.iter + * self.iterdata.seq = NULL # <<<<<<<<<<<<<< + * self.iterdata.tid = -1 + * + */ + __pyx_v_self->iterdata.seq = NULL; + + /* "csamtools.pyx":1728 + * self.iterdata.iter = self.iter.iter + * self.iterdata.seq = NULL + * self.iterdata.tid = -1 # <<<<<<<<<<<<<< + * + * if self.fastafile != None: + */ + __pyx_v_self->iterdata.tid = -1; + + /* "csamtools.pyx":1730 + * self.iterdata.tid = -1 + * + * if self.fastafile != None: # <<<<<<<<<<<<<< + * self.iterdata.fastafile = self.fastafile.fastafile + * else: + */ + __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_self->fastafile), Py_None, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { + + /* "csamtools.pyx":1731 + * + * if self.fastafile != None: + * self.iterdata.fastafile = self.fastafile.fastafile # <<<<<<<<<<<<<< + * else: + * self.iterdata.fastafile = NULL + */ + __pyx_v_self->iterdata.fastafile = __pyx_v_self->fastafile->fastafile; + goto __pyx_L3; + } + /*else*/ { + + /* "csamtools.pyx":1733 + * self.iterdata.fastafile = self.fastafile.fastafile + * else: + * self.iterdata.fastafile = NULL # <<<<<<<<<<<<<< + * + * if self.stepper == None or self.stepper == "all": + */ + __pyx_v_self->iterdata.fastafile = NULL; + } + __pyx_L3:; + + /* "csamtools.pyx":1735 + * self.iterdata.fastafile = NULL + * + * if self.stepper == None or self.stepper == "all": # <<<<<<<<<<<<<< + * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) + * elif self.stepper == "samtools": + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, Py_None, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_6) { + __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__all), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + if (__pyx_t_8) { + + /* "csamtools.pyx":1736 + * + * if self.stepper == None or self.stepper == "all": + * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) # <<<<<<<<<<<<<< + * elif self.stepper == "samtools": + * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) + */ + __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_all), (&__pyx_v_self->iterdata)); + goto __pyx_L4; + } + + /* "csamtools.pyx":1737 + * if self.stepper == None or self.stepper == "all": + * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) + * elif self.stepper == "samtools": # <<<<<<<<<<<<<< + * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) + * else: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_self->stepper, ((PyObject *)__pyx_n_s__samtools), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_8) { + + /* "csamtools.pyx":1738 + * self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) + * elif self.stepper == "samtools": + * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) # <<<<<<<<<<<<<< + * else: + * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) + */ + __pyx_v_self->pileup_iter = bam_plp_init((&__pyx_f_9csamtools___advance_snpcalls), (&__pyx_v_self->iterdata)); + goto __pyx_L4; + } + /*else*/ { + + /* "csamtools.pyx":1740 + * self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) + * else: + * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) # <<<<<<<<<<<<<< + * + * if self.max_depth: + */ + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_114), __pyx_v_self->stepper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "csamtools.pyx":1742 + * raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) + * + * if self.max_depth: # <<<<<<<<<<<<<< + * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) + * + */ + if (__pyx_v_self->max_depth) { + + /* "csamtools.pyx":1743 + * + * if self.max_depth: + * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) # <<<<<<<<<<<<<< + * + * bam_plp_set_mask( self.pileup_iter, self.mask ) + */ + bam_plp_set_maxcnt(__pyx_v_self->pileup_iter, __pyx_v_self->max_depth); + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1745 + * bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) + * + * bam_plp_set_mask( self.pileup_iter, self.mask ) # <<<<<<<<<<<<<< + * + * cdef reset( self, tid, start, end ): + */ + bam_plp_set_mask(__pyx_v_self->pileup_iter, __pyx_v_self->mask); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("csamtools.IteratorColumn.setupIteratorData"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1747 + * bam_plp_set_mask( self.pileup_iter, self.mask ) + * + * cdef reset( self, tid, start, end ): # <<<<<<<<<<<<<< + * '''reset iterator position. + * + */ + +static PyObject *__pyx_f_9csamtools_14IteratorColumn_reset(struct __pyx_obj_9csamtools_IteratorColumn *__pyx_v_self, PyObject *__pyx_v_tid, PyObject *__pyx_v_start, PyObject *__pyx_v_end) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("reset"); + __Pyx_TraceCall("reset", __pyx_f[0], 1747); + + /* "csamtools.pyx":1753 + * having to incur the full set-up costs. + * ''' + * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 ) # <<<<<<<<<<<<<< + * self.iterdata.iter = self.iter.iter + * + */ + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->samfile)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->samfile)); + __Pyx_INCREF(__pyx_v_tid); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tid); + __Pyx_GIVEREF(__pyx_v_tid); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowRegion)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->iter); + __Pyx_DECREF(((PyObject *)__pyx_v_self->iter)); + __pyx_v_self->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":1754 + * ''' + * self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 ) + * self.iterdata.iter = self.iter.iter # <<<<<<<<<<<<<< + * + * # invalidate sequence if different tid + */ + __pyx_v_self->iterdata.iter = __pyx_v_self->iter->iter; + + /* "csamtools.pyx":1757 + * + * # invalidate sequence if different tid + * if self.tid != tid: # <<<<<<<<<<<<<< + * if self.iterdata.seq != NULL: free( self.iterdata.seq ) + * self.iterdata.seq = NULL + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->tid); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_v_tid, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":1758 + * # invalidate sequence if different tid + * if self.tid != tid: + * if self.iterdata.seq != NULL: free( self.iterdata.seq ) # <<<<<<<<<<<<<< + * self.iterdata.seq = NULL + * self.iterdata.tid = -1 + */ + __pyx_t_4 = (__pyx_v_self->iterdata.seq != NULL); + if (__pyx_t_4) { + free(__pyx_v_self->iterdata.seq); + goto __pyx_L4; + } + __pyx_L4:; + + /* "csamtools.pyx":1759 + * if self.tid != tid: + * if self.iterdata.seq != NULL: free( self.iterdata.seq ) + * self.iterdata.seq = NULL # <<<<<<<<<<<<<< + * self.iterdata.tid = -1 + * + */ + __pyx_v_self->iterdata.seq = NULL; + + /* "csamtools.pyx":1760 + * if self.iterdata.seq != NULL: free( self.iterdata.seq ) + * self.iterdata.seq = NULL + * self.iterdata.tid = -1 # <<<<<<<<<<<<<< + * + * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata ) + */ + __pyx_v_self->iterdata.tid = -1; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1763 + * + * # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata ) + * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + bam_plp_reset(__pyx_v_self->pileup_iter); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.IteratorColumn.reset"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1765 + * bam_plp_reset(self.pileup_iter) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * # reset in order to avoid memory leak messages for iterators that have + * # not been fully consumed + */ + +static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1765); + + /* "csamtools.pyx":1768 + * # reset in order to avoid memory leak messages for iterators that have + * # not been fully consumed + * if self.pileup_iter != NULL: # <<<<<<<<<<<<<< + * bam_plp_reset(self.pileup_iter) + * bam_plp_destroy(self.pileup_iter) + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter != ((bam_plp_t)NULL)); + if (__pyx_t_1) { + + /* "csamtools.pyx":1769 + * # not been fully consumed + * if self.pileup_iter != NULL: + * bam_plp_reset(self.pileup_iter) # <<<<<<<<<<<<<< + * bam_plp_destroy(self.pileup_iter) + * self.pileup_iter = NULL + */ + bam_plp_reset(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter); + + /* "csamtools.pyx":1770 + * if self.pileup_iter != NULL: + * bam_plp_reset(self.pileup_iter) + * bam_plp_destroy(self.pileup_iter) # <<<<<<<<<<<<<< + * self.pileup_iter = NULL + * + */ + bam_plp_destroy(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter); + + /* "csamtools.pyx":1771 + * bam_plp_reset(self.pileup_iter) + * bam_plp_destroy(self.pileup_iter) + * self.pileup_iter = NULL # <<<<<<<<<<<<<< + * + * if self.iterdata.seq != NULL: + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->pileup_iter = ((bam_plp_t)NULL); + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":1773 + * self.pileup_iter = NULL + * + * if self.iterdata.seq != NULL: # <<<<<<<<<<<<<< + * free(self.iterdata.seq) + * self.iterdata.seq = NULL + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq != NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":1774 + * + * if self.iterdata.seq != NULL: + * free(self.iterdata.seq) # <<<<<<<<<<<<<< + * self.iterdata.seq = NULL + * + */ + free(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq); + + /* "csamtools.pyx":1775 + * if self.iterdata.seq != NULL: + * free(self.iterdata.seq) + * self.iterdata.seq = NULL # <<<<<<<<<<<<<< + * + * cdef class IteratorColumnRegion(IteratorColumn): + */ + ((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)->iterdata.seq = NULL; + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":1780 + * '''iterates over a region only. + * ''' + * def __cinit__(self, Samfile samfile, # <<<<<<<<<<<<<< + * int tid = 0, + * int start = 0, + */ + +static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + int __pyx_v_tid; + int __pyx_v_start; + int __pyx_v_end; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1780); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + if (values[1]) { + __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_tid = ((int)0); + } + if (values[2]) { + __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_start = ((int)0); + } + if (values[3]) { + __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_end = __pyx_k_115; + } + } else { + __pyx_v_tid = ((int)0); + __pyx_v_start = ((int)0); + __pyx_v_end = __pyx_k_115; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1787 + * + * # initialize iterator + * self.setupIteratorData( tid, start, end, 1 ) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.reopen = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), __pyx_v_tid, __pyx_v_start, __pyx_v_end, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1789 + * self.setupIteratorData( tid, start, end, 1 ) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * """ + */ + +static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__[] = "python version of next().\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__; +static PyObject *__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1789); + + /* "csamtools.pyx":1793 + * """ + * + * while 1: # <<<<<<<<<<<<<< + * self.cnext() + * if self.n_plp < 0: + */ + while (1) { + if (!1) break; + + /* "csamtools.pyx":1794 + * + * while 1: + * self.cnext() # <<<<<<<<<<<<<< + * if self.n_plp < 0: + * raise ValueError("error during iteration" ) + */ + ((struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)); + + /* "csamtools.pyx":1795 + * while 1: + * self.cnext() + * if self.n_plp < 0: # <<<<<<<<<<<<<< + * raise ValueError("error during iteration" ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp < 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":1796 + * self.cnext() + * if self.n_plp < 0: + * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<< + * + * if self.plp == NULL: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":1798 + * raise ValueError("error during iteration" ) + * + * if self.plp == NULL: # <<<<<<<<<<<<<< + * raise StopIteration + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp == NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":1799 + * + * if self.plp == NULL: + * raise StopIteration # <<<<<<<<<<<<<< + * + * return makePileupProxy( self.plp, + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":1801 + * raise StopIteration + * + * return makePileupProxy( self.plp, # <<<<<<<<<<<<<< + * self.tid, + * self.pos, + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":1804 + * self.tid, + * self.pos, + * self.n_plp ) # <<<<<<<<<<<<<< + * + * cdef class IteratorColumnAllRefs(IteratorColumn): + */ + __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IteratorColumnRegion.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1810 + * """ + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * Samfile samfile, + * **kwargs ): + */ + +static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_TraceCall("__cinit__", __pyx_f[0], 1810); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1815 + * + * # no iteration over empty files + * if not samfile.nreferences: raise StopIteration # <<<<<<<<<<<<<< + * + * # initialize iterator + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":1818 + * + * # initialize iterator + * self.setupIteratorData( self.tid, 0, max_pos, 1 ) # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.reopen = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1820 + * self.setupIteratorData( self.tid, 0, max_pos, 1 ) + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * """ + */ + +static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__[] = "python version of next().\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__; +static PyObject *__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__next__"); + __Pyx_TraceCall("__next__", __pyx_f[0], 1820); + + /* "csamtools.pyx":1824 + * """ + * + * while 1: # <<<<<<<<<<<<<< + * self.cnext() + * + */ + while (1) { + if (!1) break; + + /* "csamtools.pyx":1825 + * + * while 1: + * self.cnext() # <<<<<<<<<<<<<< + * + * if self.n_plp < 0: + */ + ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.cnext(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self)); + + /* "csamtools.pyx":1827 + * self.cnext() + * + * if self.n_plp < 0: # <<<<<<<<<<<<<< + * raise ValueError("error during iteration" ) + * + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp < 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":1828 + * + * if self.n_plp < 0: + * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<< + * + * # return result, if within same reference + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_118), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":1831 + * + * # return result, if within same reference + * if self.plp != NULL: # <<<<<<<<<<<<<< + * return makePileupProxy( self.plp, + * self.tid, + */ + __pyx_t_1 = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp != NULL); + if (__pyx_t_1) { + + /* "csamtools.pyx":1832 + * # return result, if within same reference + * if self.plp != NULL: + * return makePileupProxy( self.plp, # <<<<<<<<<<<<<< + * self.tid, + * self.pos, + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":1835 + * self.tid, + * self.pos, + * self.n_plp ) # <<<<<<<<<<<<<< + * + * # otherwise, proceed to next reference or stop + */ + __pyx_t_2 = __pyx_f_9csamtools_makePileupProxy(((bam_pileup1_t *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.plp), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.pos, ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.n_plp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":1838 + * + * # otherwise, proceed to next reference or stop + * self.tid += 1 # <<<<<<<<<<<<<< + * if self.tid < self.samfile.nreferences: + * self.setupIteratorData( self.tid, 0, max_pos, 0 ) + */ + ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid = (((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid + 1); + + /* "csamtools.pyx":1839 + * # otherwise, proceed to next reference or stop + * self.tid += 1 + * if self.tid < self.samfile.nreferences: # <<<<<<<<<<<<<< + * self.setupIteratorData( self.tid, 0, max_pos, 0 ) + * else: + */ + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.samfile), __pyx_n_s__nreferences); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "csamtools.pyx":1840 + * self.tid += 1 + * if self.tid < self.samfile.nreferences: + * self.setupIteratorData( self.tid, 0, max_pos, 0 ) # <<<<<<<<<<<<<< + * else: + * raise StopIteration + */ + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.reopen = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs *)((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.setupIteratorData(((struct __pyx_obj_9csamtools_IteratorColumn *)__pyx_v_self), ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)__pyx_v_self)->__pyx_base.tid, 0, __pyx_v_9csamtools_max_pos, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L9; + } + /*else*/ { + + /* "csamtools.pyx":1842 + * self.setupIteratorData( self.tid, 0, max_pos, 0 ) + * else: + * raise StopIteration # <<<<<<<<<<<<<< + * + * ##------------------------------------------------------------------- + */ + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L9:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.IteratorColumnAllRefs.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1847 + * ##------------------------------------------------------------------- + * ##------------------------------------------------------------------- + * cdef inline int32_t query_start(bam1_t *src) except -1: # <<<<<<<<<<<<<< + * cdef uint32_t * cigar_p, op + * cdef uint32_t k + */ + +static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_start(bam1_t *__pyx_v_src) { + uint32_t *__pyx_v_cigar_p; + uint32_t __pyx_v_op; + uint32_t __pyx_v_k; + uint32_t __pyx_v_start_offset; + int32_t __pyx_r; + uint32_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("query_start"); + __Pyx_TraceCall("query_start", __pyx_f[0], 1847); + + /* "csamtools.pyx":1850 + * cdef uint32_t * cigar_p, op + * cdef uint32_t k + * cdef uint32_t start_offset = 0 # <<<<<<<<<<<<<< + * + * if src.core.n_cigar: + */ + __pyx_v_start_offset = 0; + + /* "csamtools.pyx":1852 + * cdef uint32_t start_offset = 0 + * + * if src.core.n_cigar: # <<<<<<<<<<<<<< + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: + */ + if (__pyx_v_src->core.n_cigar) { + + /* "csamtools.pyx":1853 + * + * if src.core.n_cigar: + * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<< + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + */ + __pyx_v_cigar_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":1854 + * if src.core.n_cigar: + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<< + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: + */ + __pyx_t_1 = __pyx_v_src->core.n_cigar; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + + /* "csamtools.pyx":1855 + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< + * if op==BAM_CHARD_CLIP: + * if start_offset!=0 and start_offset!=src.core.l_qseq: + */ + __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15); + + /* "csamtools.pyx":1860 + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<< + * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + */ + switch (__pyx_v_op) { + + /* "csamtools.pyx":1856 + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<< + * if start_offset!=0 and start_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + */ + case 5: + + /* "csamtools.pyx":1857 + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: + * if start_offset!=0 and start_offset!=src.core.l_qseq: # <<<<<<<<<<<<<< + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + */ + __pyx_t_2 = (__pyx_v_start_offset != 0); + if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_start_offset != __pyx_v_src->core.l_qseq); + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "csamtools.pyx":1858 + * if op==BAM_CHARD_CLIP: + * if start_offset!=0 and start_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<< + * return -1 + * elif op==BAM_CSOFT_CLIP: + */ + PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119); + + /* "csamtools.pyx":1859 + * if start_offset!=0 and start_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 # <<<<<<<<<<<<<< + * elif op==BAM_CSOFT_CLIP: + * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + break; + + /* "csamtools.pyx":1860 + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<< + * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + */ + case 4: + + /* "csamtools.pyx":1861 + * return -1 + * elif op==BAM_CSOFT_CLIP: + * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_start_offset = (__pyx_v_start_offset + ((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); + break; + default: + + /* "csamtools.pyx":1863 + * start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + * break # <<<<<<<<<<<<<< + * + * return start_offset + */ + goto __pyx_L5_break; + break; + } + } + __pyx_L5_break:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1865 + * break + * + * return start_offset # <<<<<<<<<<<<<< + * + * ##------------------------------------------------------------------- + */ + __pyx_r = __pyx_v_start_offset; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1870 + * ##------------------------------------------------------------------- + * ##------------------------------------------------------------------- + * cdef inline int32_t query_end(bam1_t *src) except -1: # <<<<<<<<<<<<<< + * cdef uint32_t * cigar_p, op + * cdef uint32_t k + */ + +static CYTHON_INLINE int32_t __pyx_f_9csamtools_query_end(bam1_t *__pyx_v_src) { + uint32_t *__pyx_v_cigar_p; + uint32_t __pyx_v_op; + uint32_t __pyx_v_k; + uint32_t __pyx_v_end_offset; + int32_t __pyx_r; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("query_end"); + __Pyx_TraceCall("query_end", __pyx_f[0], 1870); + + /* "csamtools.pyx":1873 + * cdef uint32_t * cigar_p, op + * cdef uint32_t k + * cdef uint32_t end_offset = src.core.l_qseq # <<<<<<<<<<<<<< + * + * if src.core.n_cigar>1: + */ + __pyx_v_end_offset = __pyx_v_src->core.l_qseq; + + /* "csamtools.pyx":1875 + * cdef uint32_t end_offset = src.core.l_qseq + * + * if src.core.n_cigar>1: # <<<<<<<<<<<<<< + * cigar_p = bam1_cigar(src); + * for k from src.core.n_cigar > k >= 1: + */ + __pyx_t_1 = (__pyx_v_src->core.n_cigar > 1); + if (__pyx_t_1) { + + /* "csamtools.pyx":1876 + * + * if src.core.n_cigar>1: + * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<< + * for k from src.core.n_cigar > k >= 1: + * op = cigar_p[k] & BAM_CIGAR_MASK + */ + __pyx_v_cigar_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":1877 + * if src.core.n_cigar>1: + * cigar_p = bam1_cigar(src); + * for k from src.core.n_cigar > k >= 1: # <<<<<<<<<<<<<< + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: + */ + for (__pyx_v_k = __pyx_v_src->core.n_cigar-1; __pyx_v_k >= 1; __pyx_v_k--) { + + /* "csamtools.pyx":1878 + * cigar_p = bam1_cigar(src); + * for k from src.core.n_cigar > k >= 1: + * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< + * if op==BAM_CHARD_CLIP: + * if end_offset!=0 and end_offset!=src.core.l_qseq: + */ + __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15); + + /* "csamtools.pyx":1883 + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<< + * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + */ + switch (__pyx_v_op) { + + /* "csamtools.pyx":1879 + * for k from src.core.n_cigar > k >= 1: + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: # <<<<<<<<<<<<<< + * if end_offset!=0 and end_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + */ + case 5: + + /* "csamtools.pyx":1880 + * op = cigar_p[k] & BAM_CIGAR_MASK + * if op==BAM_CHARD_CLIP: + * if end_offset!=0 and end_offset!=src.core.l_qseq: # <<<<<<<<<<<<<< + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + */ + __pyx_t_1 = (__pyx_v_end_offset != 0); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_end_offset != __pyx_v_src->core.l_qseq); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "csamtools.pyx":1881 + * if op==BAM_CHARD_CLIP: + * if end_offset!=0 and end_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') # <<<<<<<<<<<<<< + * return -1 + * elif op==BAM_CSOFT_CLIP: + */ + PyErr_SetString(__pyx_builtin_ValueError, __pyx_k_119); + + /* "csamtools.pyx":1882 + * if end_offset!=0 and end_offset!=src.core.l_qseq: + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 # <<<<<<<<<<<<<< + * elif op==BAM_CSOFT_CLIP: + * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT + */ + __pyx_r = -1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + break; + + /* "csamtools.pyx":1883 + * PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + * return -1 + * elif op==BAM_CSOFT_CLIP: # <<<<<<<<<<<<<< + * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + */ + case 4: + + /* "csamtools.pyx":1884 + * return -1 + * elif op==BAM_CSOFT_CLIP: + * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_end_offset = (__pyx_v_end_offset - ((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); + break; + default: + + /* "csamtools.pyx":1886 + * end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT + * else: + * break # <<<<<<<<<<<<<< + * + * if end_offset==0: + */ + goto __pyx_L5_break; + break; + } + } + __pyx_L5_break:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1888 + * break + * + * if end_offset==0: # <<<<<<<<<<<<<< + * end_offset = src.core.l_qseq + * + */ + __pyx_t_3 = (__pyx_v_end_offset == 0); + if (__pyx_t_3) { + + /* "csamtools.pyx":1889 + * + * if end_offset==0: + * end_offset = src.core.l_qseq # <<<<<<<<<<<<<< + * + * return end_offset + */ + __pyx_v_end_offset = __pyx_v_src->core.l_qseq; + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":1891 + * end_offset = src.core.l_qseq + * + * return end_offset # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_end_offset; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1894 + * + * + * cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<< + * cdef uint8_t * p + * cdef uint32_t k + */ + +static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_seq_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) { + uint8_t *__pyx_v_p; + uint32_t __pyx_v_k; + char *__pyx_v_s; + PyObject *__pyx_v_seq; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + uint32_t __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("get_seq_range"); + __Pyx_TraceCall("get_seq_range", __pyx_f[0], 1894); + __pyx_v_seq = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1899 + * cdef char * s + * + * if not src.core.l_qseq: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = (!__pyx_v_src->core.l_qseq); + if (__pyx_t_1) { + + /* "csamtools.pyx":1900 + * + * if not src.core.l_qseq: + * return None # <<<<<<<<<<<<<< + * + * seq = PyString_FromStringAndSize(NULL, end-start) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1902 + * return None + * + * seq = PyString_FromStringAndSize(NULL, end-start) # <<<<<<<<<<<<<< + * s = PyString_AS_STRING(seq) + * p = bam1_seq(src) + */ + __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_seq); + __pyx_v_seq = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1903 + * + * seq = PyString_FromStringAndSize(NULL, end-start) + * s = PyString_AS_STRING(seq) # <<<<<<<<<<<<<< + * p = bam1_seq(src) + * + */ + __pyx_v_s = PyString_AS_STRING(__pyx_v_seq); + + /* "csamtools.pyx":1904 + * seq = PyString_FromStringAndSize(NULL, end-start) + * s = PyString_AS_STRING(seq) + * p = bam1_seq(src) # <<<<<<<<<<<<<< + * + * for k from start <= k < end: + */ + __pyx_v_p = bam1_seq(__pyx_v_src); + + /* "csamtools.pyx":1906 + * p = bam1_seq(src) + * + * for k from start <= k < end: # <<<<<<<<<<<<<< + * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) + * # note: do not use string literal as it will be a python string + */ + __pyx_t_3 = __pyx_v_end; + for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "csamtools.pyx":1909 + * # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) + * # note: do not use string literal as it will be a python string + * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf] # <<<<<<<<<<<<<< + * + * return seq + */ + (__pyx_v_s[(__pyx_v_k - __pyx_v_start)]) = (__pyx_v_9csamtools_bam_nt16_rev_table[(((__pyx_v_p[__Pyx_div_long(__pyx_v_k, 2)]) >> (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2)))) & 0xf)]); + } + + /* "csamtools.pyx":1911 + * s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf] + * + * return seq # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_seq); + __pyx_r = __pyx_v_seq; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.get_seq_range"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_seq); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1914 + * + * + * cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end): # <<<<<<<<<<<<<< + * cdef uint8_t * p + * cdef uint32_t k + */ + +static CYTHON_INLINE PyObject *__pyx_f_9csamtools_get_qual_range(bam1_t *__pyx_v_src, uint32_t __pyx_v_start, uint32_t __pyx_v_end) { + uint8_t *__pyx_v_p; + uint32_t __pyx_v_k; + char *__pyx_v_q; + PyObject *__pyx_v_qual; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + uint32_t __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("get_qual_range"); + __Pyx_TraceCall("get_qual_range", __pyx_f[0], 1914); + __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":1919 + * cdef char * q + * + * p = bam1_qual(src) # <<<<<<<<<<<<<< + * if p[0] == 0xff: + * return None + */ + __pyx_v_p = bam1_qual(__pyx_v_src); + + /* "csamtools.pyx":1920 + * + * p = bam1_qual(src) + * if p[0] == 0xff: # <<<<<<<<<<<<<< + * return None + * + */ + __pyx_t_1 = ((__pyx_v_p[0]) == 0xff); + if (__pyx_t_1) { + + /* "csamtools.pyx":1921 + * p = bam1_qual(src) + * if p[0] == 0xff: + * return None # <<<<<<<<<<<<<< + * + * qual = PyString_FromStringAndSize(NULL, end-start) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "csamtools.pyx":1923 + * return None + * + * qual = PyString_FromStringAndSize(NULL, end-start) # <<<<<<<<<<<<<< + * q = PyString_AS_STRING(qual) + * + */ + __pyx_t_2 = PyString_FromStringAndSize(NULL, (__pyx_v_end - __pyx_v_start)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":1924 + * + * qual = PyString_FromStringAndSize(NULL, end-start) + * q = PyString_AS_STRING(qual) # <<<<<<<<<<<<<< + * + * for k from start <= k < end: + */ + __pyx_v_q = PyString_AS_STRING(__pyx_v_qual); + + /* "csamtools.pyx":1926 + * q = PyString_AS_STRING(qual) + * + * for k from start <= k < end: # <<<<<<<<<<<<<< + * ## equivalent to t[i] + 33 (see bam.c) + * q[k-start] = p[k] + 33 + */ + __pyx_t_3 = __pyx_v_end; + for (__pyx_v_k = __pyx_v_start; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "csamtools.pyx":1928 + * for k from start <= k < end: + * ## equivalent to t[i] + 33 (see bam.c) + * q[k-start] = p[k] + 33 # <<<<<<<<<<<<<< + * + * return qual + */ + (__pyx_v_q[(__pyx_v_k - __pyx_v_start)]) = ((__pyx_v_p[__pyx_v_k]) + 33); + } + + /* "csamtools.pyx":1930 + * q[k-start] = p[k] + 33 + * + * return qual # <<<<<<<<<<<<<< + * + * cdef class AlignedRead: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_qual); + __pyx_r = __pyx_v_qual; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.get_qual_range"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_qual); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1955 + * + * # Now only called when instances are created from Python + * def __init__(self): # <<<<<<<<<<<<<< + * # see bam_init1 + * self._delegate = calloc( 1, sizeof( bam1_t) ) + */ + +static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 1955); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + + /* "csamtools.pyx":1957 + * def __init__(self): + * # see bam_init1 + * self._delegate = calloc( 1, sizeof( bam1_t) ) # <<<<<<<<<<<<<< + * # allocate some memory + * # If size is 0, calloc does not return a pointer that can be passed to free() + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); + + /* "csamtools.pyx":1961 + * # If size is 0, calloc does not return a pointer that can be passed to free() + * # so allocate 40 bytes for a new read + * self._delegate.m_data = 40 # <<<<<<<<<<<<<< + * self._delegate.data = calloc( self._delegate.m_data, 1 ) + * self._delegate.data_len = 0 + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data = 40; + + /* "csamtools.pyx":1962 + * # so allocate 40 bytes for a new read + * self._delegate.m_data = 40 + * self._delegate.data = calloc( self._delegate.m_data, 1 ) # <<<<<<<<<<<<<< + * self._delegate.data_len = 0 + * + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data = ((uint8_t *)calloc(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->m_data, 1)); + + /* "csamtools.pyx":1963 + * self._delegate.m_data = 40 + * self._delegate.data = calloc( self._delegate.m_data, 1 ) + * self._delegate.data_len = 0 # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->data_len = 0; + + __pyx_r = 0; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1965 + * self._delegate.data_len = 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * bam_destroy1(self._delegate) + * + */ + +static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 1965); + + /* "csamtools.pyx":1966 + * + * def __dealloc__(self): + * bam_destroy1(self._delegate) # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + bam_destroy1(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +/* "csamtools.pyx":1968 + * bam_destroy1(self._delegate) + * + * def __str__(self): # <<<<<<<<<<<<<< + * """return string representation of alignment. + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_11AlignedRead_2__str__[] = "return string representation of alignment.\n\n The representation is an approximate :term:`sam` format.\n\n An aligned read might not be associated with a :term:`Samfile`.\n As a result :term:`tid` is shown instead of the reference name.\n\n Similarly, the tags field is returned in its parsed state.\n "; +struct wrapperbase __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__; +static PyObject *__pyx_pf_9csamtools_11AlignedRead_2__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__str__"); + __Pyx_TraceCall("__str__", __pyx_f[0], 1968); + + /* "csamtools.pyx":1980 + * # sam-parsing is done in sam.c/bam_format1_core which + * # requires a valid header. + * return "\t".join(map(str, (self.qname, # <<<<<<<<<<<<<< + * self.flag, + * self.rname, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "csamtools.pyx":1981 + * # requires a valid header. + * return "\t".join(map(str, (self.qname, + * self.flag, # <<<<<<<<<<<<<< + * self.rname, + * self.pos, + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "csamtools.pyx":1982 + * return "\t".join(map(str, (self.qname, + * self.flag, + * self.rname, # <<<<<<<<<<<<<< + * self.pos, + * self.mapq, + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "csamtools.pyx":1983 + * self.flag, + * self.rname, + * self.pos, # <<<<<<<<<<<<<< + * self.mapq, + * self.cigar, + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1983; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "csamtools.pyx":1984 + * self.rname, + * self.pos, + * self.mapq, # <<<<<<<<<<<<<< + * self.cigar, + * self.mrnm, + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapq); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "csamtools.pyx":1985 + * self.pos, + * self.mapq, + * self.cigar, # <<<<<<<<<<<<<< + * self.mrnm, + * self.mpos, + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__cigar); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "csamtools.pyx":1986 + * self.mapq, + * self.cigar, + * self.mrnm, # <<<<<<<<<<<<<< + * self.mpos, + * self.rlen, + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "csamtools.pyx":1987 + * self.cigar, + * self.mrnm, + * self.mpos, # <<<<<<<<<<<<<< + * self.rlen, + * self.seq, + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mpos); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + + /* "csamtools.pyx":1988 + * self.mrnm, + * self.mpos, + * self.rlen, # <<<<<<<<<<<<<< + * self.seq, + * self.qual, + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rlen); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + + /* "csamtools.pyx":1989 + * self.mpos, + * self.rlen, + * self.seq, # <<<<<<<<<<<<<< + * self.qual, + * self.tags ))) + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__seq); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + + /* "csamtools.pyx":1990 + * self.rlen, + * self.seq, + * self.qual, # <<<<<<<<<<<<<< + * self.tags ))) + * + */ + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qual); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + + /* "csamtools.pyx":1991 + * self.seq, + * self.qual, + * self.tags ))) # <<<<<<<<<<<<<< + * + * def compare(self, AlignedRead other): + */ + __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tags); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyTuple_New(12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_14, 7, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_14, 8, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_14, 9, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_14, 10, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_14, 11, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_t_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_14)); + __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("csamtools.AlignedRead.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":1993 + * self.tags ))) + * + * def compare(self, AlignedRead other): # <<<<<<<<<<<<<< + * '''return -1,0,1, if contents in this are binary <,=,> to *other*''' + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static char __pyx_doc_9csamtools_11AlignedRead_3compare[] = "AlignedRead.compare(self, AlignedRead other)\nreturn -1,0,1, if contents in this are binary <,=,> to *other*"; +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3compare(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + int __pyx_v_retval; + bam1_t *__pyx_v_t; + bam1_t *__pyx_v_o; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("compare"); + __Pyx_TraceCall("compare", __pyx_f[0], 1993); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_9csamtools_AlignedRead, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":1999 + * cdef bam1_t *t, *o + * + * t = self._delegate # <<<<<<<<<<<<<< + * o = other._delegate + * + */ + __pyx_v_t = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2000 + * + * t = self._delegate + * o = other._delegate # <<<<<<<<<<<<<< + * + * # uncomment for debugging purposes + */ + __pyx_v_o = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_other)->_delegate; + + /* "csamtools.pyx":2012 + * + * # Fast-path test for object identity + * if t==o: # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_1 = (__pyx_v_t == __pyx_v_o); + if (__pyx_t_1) { + + /* "csamtools.pyx":2013 + * # Fast-path test for object identity + * if t==o: + * return 0 # <<<<<<<<<<<<<< + * + * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2015 + * return 0 + * + * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) # <<<<<<<<<<<<<< + * + * if retval: return retval + */ + __pyx_v_retval = memcmp((&__pyx_v_t->core), (&__pyx_v_o->core), (sizeof(bam1_core_t))); + + /* "csamtools.pyx":2017 + * retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) + * + * if retval: return retval # <<<<<<<<<<<<<< + * retval = cmp(t.data_len, o.data_len) + * if retval: return retval + */ + if (__pyx_v_retval) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2017; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":2018 + * + * if retval: return retval + * retval = cmp(t.data_len, o.data_len) # <<<<<<<<<<<<<< + * if retval: return retval + * return memcmp(t.data, o.data, t.data_len) + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_t->data_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_o->data_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_cmp, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_retval = __pyx_t_5; + + /* "csamtools.pyx":2019 + * if retval: return retval + * retval = cmp(t.data_len, o.data_len) + * if retval: return retval # <<<<<<<<<<<<<< + * return memcmp(t.data, o.data, t.data_len) + * + */ + if (__pyx_v_retval) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":2020 + * retval = cmp(t.data_len, o.data_len) + * if retval: return retval + * return memcmp(t.data, o.data, t.data_len) # <<<<<<<<<<<<<< + * + * # Disabled so long as __cmp__ is a special method + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(memcmp(__pyx_v_t->data, __pyx_v_o->data, __pyx_v_t->data_len)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.AlignedRead.compare"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2023 + * + * # Disabled so long as __cmp__ is a special method + * def __hash__(self): # <<<<<<<<<<<<<< + * return _Py_HashPointer(self) + * + */ + +static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self); /*proto*/ +static long __pyx_pf_9csamtools_11AlignedRead_4__hash__(PyObject *__pyx_v_self) { + long __pyx_r; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__hash__"); + __Pyx_TraceCall("__hash__", __pyx_f[0], 2023); + + /* "csamtools.pyx":2024 + * # Disabled so long as __cmp__ is a special method + * def __hash__(self): + * return _Py_HashPointer(self) # <<<<<<<<<<<<<< + * + * property qname: + */ + __pyx_r = _Py_HashPointer(((void *)__pyx_v_self)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2028 + * property qname: + * """the query name (None if not present)""" + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * src = self._delegate + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qname___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2028); + + /* "csamtools.pyx":2030 + * def __get__(self): + * cdef bam1_t * src + * src = self._delegate # <<<<<<<<<<<<<< + * if src.core.l_qname == 0: return None + * return bam1_qname( src ) + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2031 + * cdef bam1_t * src + * src = self._delegate + * if src.core.l_qname == 0: return None # <<<<<<<<<<<<<< + * return bam1_qname( src ) + * + */ + __pyx_t_1 = (__pyx_v_src->core.l_qname == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2032 + * src = self._delegate + * if src.core.l_qname == 0: return None + * return bam1_qname( src ) # <<<<<<<<<<<<<< + * + * def __set__(self, qname ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(bam1_qname(__pyx_v_src)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.qname.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2034 + * return bam1_qname( src ) + * + * def __set__(self, qname ): # <<<<<<<<<<<<<< + * if qname == None or len(qname) == 0: return + * cdef bam1_t * src + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) { + bam1_t *__pyx_v_src; + int __pyx_v_l; + char *__pyx_v_p; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2034); + + /* "csamtools.pyx":2035 + * + * def __set__(self, qname ): + * if qname == None or len(qname) == 0: return # <<<<<<<<<<<<<< + * cdef bam1_t * src + * cdef int l + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_qname, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2040 + * cdef char * p + * + * src = self._delegate # <<<<<<<<<<<<<< + * p = bam1_qname( src ) + * + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2041 + * + * src = self._delegate + * p = bam1_qname( src ) # <<<<<<<<<<<<<< + * + * # the qname is \0 terminated + */ + __pyx_v_p = bam1_qname(__pyx_v_src); + + /* "csamtools.pyx":2044 + * + * # the qname is \0 terminated + * l = len(qname) + 1 # <<<<<<<<<<<<<< + * pysam_bam_update( src, + * src.core.l_qname, + */ + __pyx_t_3 = PyObject_Length(__pyx_v_qname); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_l = (__pyx_t_3 + 1); + + /* "csamtools.pyx":2048 + * src.core.l_qname, + * l, + * p ) # <<<<<<<<<<<<<< + * + * src.core.l_qname = l + */ + pysam_bam_update(__pyx_v_src, __pyx_v_src->core.l_qname, __pyx_v_l, ((uint8_t *)__pyx_v_p)); + + /* "csamtools.pyx":2050 + * p ) + * + * src.core.l_qname = l # <<<<<<<<<<<<<< + * + * # re-acquire pointer to location in memory + */ + __pyx_v_src->core.l_qname = __pyx_v_l; + + /* "csamtools.pyx":2054 + * # re-acquire pointer to location in memory + * # as it might have moved + * p = bam1_qname(src) # <<<<<<<<<<<<<< + * + * strncpy( p, qname, l ) + */ + __pyx_v_p = bam1_qname(__pyx_v_src); + + /* "csamtools.pyx":2056 + * p = bam1_qname(src) + * + * strncpy( p, qname, l ) # <<<<<<<<<<<<<< + * + * property cigar: + */ + __pyx_t_6 = PyBytes_AsString(__pyx_v_qname); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + strncpy(__pyx_v_p, __pyx_t_6, __pyx_v_l); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.qname.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2061 + * """the :term:`cigar` alignment (None if not present). + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * cdef uint32_t * cigar_p + * cdef bam1_t * src + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5cigar___get__(PyObject *__pyx_v_self) { + uint32_t *__pyx_v_cigar_p; + bam1_t *__pyx_v_src; + PyObject *__pyx_v_op; + PyObject *__pyx_v_l; + PyObject *__pyx_v_cigar; + int __pyx_v_k; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + uint32_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2061); + __pyx_v_op = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_cigar = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2067 + * cdef int k + * + * src = self._delegate # <<<<<<<<<<<<<< + * if src.core.n_cigar == 0: return None + * + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2068 + * + * src = self._delegate + * if src.core.n_cigar == 0: return None # <<<<<<<<<<<<<< + * + * cigar = [] + */ + __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2070 + * if src.core.n_cigar == 0: return None + * + * cigar = [] # <<<<<<<<<<<<<< + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_v_cigar); + __pyx_v_cigar = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "csamtools.pyx":2071 + * + * cigar = [] + * cigar_p = bam1_cigar(src); # <<<<<<<<<<<<<< + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + */ + __pyx_v_cigar_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":2072 + * cigar = [] + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<< + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + */ + __pyx_t_3 = __pyx_v_src->core.n_cigar; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "csamtools.pyx":2073 + * cigar_p = bam1_cigar(src); + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * cigar.append((op, l)) + */ + __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) & 15)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_op); + __pyx_v_op = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2074 + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< + * cigar.append((op, l)) + * return cigar + */ + __pyx_t_2 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2075 + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * cigar.append((op, l)) # <<<<<<<<<<<<<< + * return cigar + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_op); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_op); + __Pyx_GIVEREF(__pyx_v_op); + __Pyx_INCREF(__pyx_v_l); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_l); + __Pyx_GIVEREF(__pyx_v_l); + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_cigar, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "csamtools.pyx":2076 + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * cigar.append((op, l)) + * return cigar # <<<<<<<<<<<<<< + * + * def __set__(self, values ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_cigar); + __pyx_r = __pyx_v_cigar; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_op); + __Pyx_DECREF(__pyx_v_l); + __Pyx_DECREF(__pyx_v_cigar); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2078 + * return cigar + * + * def __set__(self, values ): # <<<<<<<<<<<<<< + * if values == None or len(values) == 0: return + * cdef uint32_t * p + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) { + uint32_t *__pyx_v_p; + bam1_t *__pyx_v_src; + PyObject *__pyx_v_op; + PyObject *__pyx_v_l; + int __pyx_v_k; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + uint32_t __pyx_t_10; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2078); + __pyx_v_op = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2079 + * + * def __set__(self, values ): + * if values == None or len(values) == 0: return # <<<<<<<<<<<<<< + * cdef uint32_t * p + * cdef bam1_t * src + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_values, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2085 + * cdef int k + * + * k = 0 # <<<<<<<<<<<<<< + * + * src = self._delegate + */ + __pyx_v_k = 0; + + /* "csamtools.pyx":2087 + * k = 0 + * + * src = self._delegate # <<<<<<<<<<<<<< + * + * # get location of cigar string + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2090 + * + * # get location of cigar string + * p = bam1_cigar(src) # <<<<<<<<<<<<<< + * + * # create space for cigar data within src.data + */ + __pyx_v_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":2095 + * pysam_bam_update( src, + * src.core.n_cigar * 4, + * len(values) * 4, # <<<<<<<<<<<<<< + * p ) + * + */ + __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":2096 + * src.core.n_cigar * 4, + * len(values) * 4, + * p ) # <<<<<<<<<<<<<< + * + * # length is number of cigar operations, not bytes + */ + pysam_bam_update(__pyx_v_src, (__pyx_v_src->core.n_cigar * 4), (__pyx_t_3 * 4), ((uint8_t *)__pyx_v_p)); + + /* "csamtools.pyx":2099 + * + * # length is number of cigar operations, not bytes + * src.core.n_cigar = len(values) # <<<<<<<<<<<<<< + * + * # re-acquire pointer to location in memory + */ + __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_src->core.n_cigar = __pyx_t_3; + + /* "csamtools.pyx":2103 + * # re-acquire pointer to location in memory + * # as it might have moved + * p = bam1_cigar(src) # <<<<<<<<<<<<<< + * + * # insert cigar operations + */ + __pyx_v_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":2106 + * + * # insert cigar operations + * for op, l in values: # <<<<<<<<<<<<<< + * p[k] = l << BAM_CIGAR_SHIFT | op + * k += 1 + */ + if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) { + __pyx_t_3 = 0; __pyx_t_1 = __pyx_v_values; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; + } else { + __pyx_t_6 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_6) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + if (PyTuple_CheckExact(__pyx_t_6) && likely(PyTuple_GET_SIZE(__pyx_t_6) == 2)) { + PyObject* tuple = __pyx_t_6; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7); + __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_op); + __pyx_v_op = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_8; + __pyx_t_8 = 0; + } else { + __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_op); + __pyx_v_op = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_8; + __pyx_t_8 = 0; + } + + /* "csamtools.pyx":2107 + * # insert cigar operations + * for op, l in values: + * p[k] = l << BAM_CIGAR_SHIFT | op # <<<<<<<<<<<<<< + * k += 1 + * + */ + __pyx_t_6 = PyNumber_Lshift(__pyx_v_l, __pyx_int_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyNumber_Or(__pyx_t_6, __pyx_v_op); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_10 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_8); if (unlikely((__pyx_t_10 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + (__pyx_v_p[__pyx_v_k]) = __pyx_t_10; + + /* "csamtools.pyx":2108 + * for op, l in values: + * p[k] = l << BAM_CIGAR_SHIFT | op + * k += 1 # <<<<<<<<<<<<<< + * + * ## setting the cigar string also updates the "bin" attribute + */ + __pyx_v_k = (__pyx_v_k + 1); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2111 + * + * ## setting the cigar string also updates the "bin" attribute + * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p)) # <<<<<<<<<<<<<< + * + * property seq: + */ + __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), __pyx_v_p)); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("csamtools.AlignedRead.cigar.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_op); + __Pyx_DECREF(__pyx_v_l); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2115 + * property seq: + * """read sequence bases, including :term:`soft clipped` bases (None if not present)""" + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * cdef char * s + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3seq___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2115); + + /* "csamtools.pyx":2118 + * cdef bam1_t * src + * cdef char * s + * src = self._delegate # <<<<<<<<<<<<<< + * + * if src.core.l_qseq == 0: return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2120 + * src = self._delegate + * + * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<< + * + * return get_seq_range(src, 0, src.core.l_qseq) + */ + __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2122 + * if src.core.l_qseq == 0: return None + * + * return get_seq_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<< + * + * def __set__(self,seq): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.seq.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2124 + * return get_seq_range(src, 0, src.core.l_qseq) + * + * def __set__(self,seq): # <<<<<<<<<<<<<< + * # samtools manages sequence and quality length memory together + * # if no quality information is present, the first byte says 0xff. + */ + +static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_seq) { + bam1_t *__pyx_v_src; + uint8_t *__pyx_v_p; + char *__pyx_v_s; + int __pyx_v_l; + int __pyx_v_k; + int __pyx_v_nbytes_new; + int __pyx_v_nbytes_old; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + char *__pyx_t_7; + long __pyx_t_8; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2124); + + /* "csamtools.pyx":2128 + * # if no quality information is present, the first byte says 0xff. + * + * if seq == None or len(seq) == 0: return # <<<<<<<<<<<<<< + * cdef bam1_t * src + * cdef uint8_t * p + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_seq, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2134 + * cdef int l, k, nbytes_new, nbytes_old + * + * src = self._delegate # <<<<<<<<<<<<<< + * + * l = len(seq) + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2136 + * src = self._delegate + * + * l = len(seq) # <<<<<<<<<<<<<< + * + * # as the sequence is stored in half-bytes, the total length (sequence + */ + __pyx_t_3 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_l = __pyx_t_3; + + /* "csamtools.pyx":2140 + * # as the sequence is stored in half-bytes, the total length (sequence + * # plus quality scores) is (l+1)/2 + l + * nbytes_new = (l+1)/2 + l # <<<<<<<<<<<<<< + * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq + * # acquire pointer to location in memory + */ + __pyx_v_nbytes_new = (__Pyx_div_long((__pyx_v_l + 1), 2) + __pyx_v_l); + + /* "csamtools.pyx":2141 + * # plus quality scores) is (l+1)/2 + l + * nbytes_new = (l+1)/2 + l + * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq # <<<<<<<<<<<<<< + * # acquire pointer to location in memory + * p = bam1_seq( src ) + */ + __pyx_v_nbytes_old = (__Pyx_div_long((__pyx_v_src->core.l_qseq + 1), 2) + __pyx_v_src->core.l_qseq); + + /* "csamtools.pyx":2143 + * nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq + * # acquire pointer to location in memory + * p = bam1_seq( src ) # <<<<<<<<<<<<<< + * src.core.l_qseq = l + * + */ + __pyx_v_p = bam1_seq(__pyx_v_src); + + /* "csamtools.pyx":2144 + * # acquire pointer to location in memory + * p = bam1_seq( src ) + * src.core.l_qseq = l # <<<<<<<<<<<<<< + * + * pysam_bam_update( src, + */ + __pyx_v_src->core.l_qseq = __pyx_v_l; + + /* "csamtools.pyx":2149 + * nbytes_old, + * nbytes_new, + * p) # <<<<<<<<<<<<<< + * # re-acquire pointer to location in memory + * # as it might have moved + */ + pysam_bam_update(__pyx_v_src, __pyx_v_nbytes_old, __pyx_v_nbytes_new, __pyx_v_p); + + /* "csamtools.pyx":2152 + * # re-acquire pointer to location in memory + * # as it might have moved + * p = bam1_seq( src ) # <<<<<<<<<<<<<< + * for k from 0 <= k < nbytes_new: p[k] = 0 + * # convert to C string + */ + __pyx_v_p = bam1_seq(__pyx_v_src); + + /* "csamtools.pyx":2153 + * # as it might have moved + * p = bam1_seq( src ) + * for k from 0 <= k < nbytes_new: p[k] = 0 # <<<<<<<<<<<<<< + * # convert to C string + * s = seq + */ + __pyx_t_6 = __pyx_v_nbytes_new; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) { + (__pyx_v_p[__pyx_v_k]) = 0; + } + + /* "csamtools.pyx":2155 + * for k from 0 <= k < nbytes_new: p[k] = 0 + * # convert to C string + * s = seq # <<<<<<<<<<<<<< + * for k from 0 <= k < l: + * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) + */ + __pyx_t_7 = PyBytes_AsString(__pyx_v_seq); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_s = __pyx_t_7; + + /* "csamtools.pyx":2156 + * # convert to C string + * s = seq + * for k from 0 <= k < l: # <<<<<<<<<<<<<< + * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) + * + */ + __pyx_t_6 = __pyx_v_l; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) { + + /* "csamtools.pyx":2157 + * s = seq + * for k from 0 <= k < l: + * p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) # <<<<<<<<<<<<<< + * + * # erase qualities + */ + __pyx_t_8 = __Pyx_div_long(__pyx_v_k, 2); + (__pyx_v_p[__pyx_t_8]) = ((__pyx_v_p[__pyx_t_8]) | (pysam_translate_sequence((__pyx_v_s[__pyx_v_k])) << (4 * (1 - __Pyx_mod_long(__pyx_v_k, 2))))); + } + + /* "csamtools.pyx":2160 + * + * # erase qualities + * p = bam1_qual( src ) # <<<<<<<<<<<<<< + * p[0] = 0xff + * + */ + __pyx_v_p = bam1_qual(__pyx_v_src); + + /* "csamtools.pyx":2161 + * # erase qualities + * p = bam1_qual( src ) + * p[0] = 0xff # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_p[0]) = 0xff; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.seq.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2166 + * property qual: + * """read sequence base qualities, including :term:`soft clipped` bases (None if not present)""" + * def __get__(self): # <<<<<<<<<<<<<< + * + * cdef bam1_t * src + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qual___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2166); + + /* "csamtools.pyx":2171 + * cdef char * q + * + * src = self._delegate # <<<<<<<<<<<<<< + * + * if src.core.l_qseq == 0: return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2173 + * src = self._delegate + * + * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<< + * + * return get_qual_range(src, 0, src.core.l_qseq) + */ + __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2175 + * if src.core.l_qseq == 0: return None + * + * return get_qual_range(src, 0, src.core.l_qseq) # <<<<<<<<<<<<<< + * + * def __set__(self,qual): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, 0, __pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.qual.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2177 + * return get_qual_range(src, 0, src.core.l_qseq) + * + * def __set__(self,qual): # <<<<<<<<<<<<<< + * # note that space is already allocated via the sequences + * cdef bam1_t * src + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) { + bam1_t *__pyx_v_src; + uint8_t *__pyx_v_p; + char *__pyx_v_q; + int __pyx_v_k; + int __pyx_v_l; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2177); + + /* "csamtools.pyx":2184 + * cdef int k + * + * src = self._delegate # <<<<<<<<<<<<<< + * p = bam1_qual( src ) + * if qual == None or len(qual) == 0: + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2185 + * + * src = self._delegate + * p = bam1_qual( src ) # <<<<<<<<<<<<<< + * if qual == None or len(qual) == 0: + * # if absent - set to 0xff + */ + __pyx_v_p = bam1_qual(__pyx_v_src); + + /* "csamtools.pyx":2186 + * src = self._delegate + * p = bam1_qual( src ) + * if qual == None or len(qual) == 0: # <<<<<<<<<<<<<< + * # if absent - set to 0xff + * p[0] = 0xff + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":2188 + * if qual == None or len(qual) == 0: + * # if absent - set to 0xff + * p[0] = 0xff # <<<<<<<<<<<<<< + * return + * cdef int l + */ + (__pyx_v_p[0]) = 0xff; + + /* "csamtools.pyx":2189 + * # if absent - set to 0xff + * p[0] = 0xff + * return # <<<<<<<<<<<<<< + * cdef int l + * # convert to C string + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2192 + * cdef int l + * # convert to C string + * q = qual # <<<<<<<<<<<<<< + * l = len(qual) + * if src.core.l_qseq != l: + */ + __pyx_t_6 = PyBytes_AsString(__pyx_v_qual); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_q = __pyx_t_6; + + /* "csamtools.pyx":2193 + * # convert to C string + * q = qual + * l = len(qual) # <<<<<<<<<<<<<< + * if src.core.l_qseq != l: + * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) + */ + __pyx_t_3 = PyObject_Length(__pyx_v_qual); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_l = __pyx_t_3; + + /* "csamtools.pyx":2194 + * q = qual + * l = len(qual) + * if src.core.l_qseq != l: # <<<<<<<<<<<<<< + * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) + * assert src.core.l_qseq == l + */ + __pyx_t_5 = (__pyx_v_src->core.l_qseq != __pyx_v_l); + if (__pyx_t_5) { + + /* "csamtools.pyx":2195 + * l = len(qual) + * if src.core.l_qseq != l: + * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) # <<<<<<<<<<<<<< + * assert src.core.l_qseq == l + * for k from 0 <= k < l: + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_src->core.l_qseq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_1 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_120), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":2196 + * if src.core.l_qseq != l: + * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) + * assert src.core.l_qseq == l # <<<<<<<<<<<<<< + * for k from 0 <= k < l: + * p[k] = q[k] - 33 + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(__pyx_v_src->core.l_qseq == __pyx_v_l))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":2197 + * raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) + * assert src.core.l_qseq == l + * for k from 0 <= k < l: # <<<<<<<<<<<<<< + * p[k] = q[k] - 33 + * + */ + __pyx_t_9 = __pyx_v_l; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_9; __pyx_v_k++) { + + /* "csamtools.pyx":2198 + * assert src.core.l_qseq == l + * for k from 0 <= k < l: + * p[k] = q[k] - 33 # <<<<<<<<<<<<<< + * + * property query: + */ + (__pyx_v_p[__pyx_v_k]) = (((uint8_t)(__pyx_v_q[__pyx_v_k])) - 33); + } + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("csamtools.AlignedRead.qual.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2210 + * were not considered for alignment may have been retained.""" + * + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * cdef uint32_t start, end + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5query___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + uint32_t __pyx_v_start; + uint32_t __pyx_v_end; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int32_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2210); + + /* "csamtools.pyx":2215 + * cdef char * s + * + * src = self._delegate # <<<<<<<<<<<<<< + * + * if src.core.l_qseq == 0: return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2217 + * src = self._delegate + * + * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<< + * + * start = query_start(src) + */ + __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2219 + * if src.core.l_qseq == 0: return None + * + * start = query_start(src) # <<<<<<<<<<<<<< + * end = query_end(src) + * + */ + __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_start = __pyx_t_2; + + /* "csamtools.pyx":2220 + * + * start = query_start(src) + * end = query_end(src) # <<<<<<<<<<<<<< + * + * return get_seq_range(src, start, end) + */ + __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_end = __pyx_t_2; + + /* "csamtools.pyx":2222 + * end = query_end(src) + * + * return get_seq_range(src, start, end) # <<<<<<<<<<<<<< + * + * property qqual: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_f_9csamtools_get_seq_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.AlignedRead.query.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2226 + * property qqual: + * """aligned query sequence quality values (None if not present)""" + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * cdef uint32_t start, end + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5qqual___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + uint32_t __pyx_v_start; + uint32_t __pyx_v_end; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int32_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2226); + + /* "csamtools.pyx":2231 + * cdef char * q + * + * src = self._delegate # <<<<<<<<<<<<<< + * + * if src.core.l_qseq == 0: return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2233 + * src = self._delegate + * + * if src.core.l_qseq == 0: return None # <<<<<<<<<<<<<< + * + * start = query_start(src) + */ + __pyx_t_1 = (__pyx_v_src->core.l_qseq == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2235 + * if src.core.l_qseq == 0: return None + * + * start = query_start(src) # <<<<<<<<<<<<<< + * end = query_end(src) + * + */ + __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_start = __pyx_t_2; + + /* "csamtools.pyx":2236 + * + * start = query_start(src) + * end = query_end(src) # <<<<<<<<<<<<<< + * + * return get_qual_range(src, start, end) + */ + __pyx_t_2 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_end = __pyx_t_2; + + /* "csamtools.pyx":2238 + * end = query_end(src) + * + * return get_qual_range(src, start, end) # <<<<<<<<<<<<<< + * + * property qstart: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __pyx_f_9csamtools_get_qual_range(__pyx_v_src, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.AlignedRead.qqual.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2242 + * property qstart: + * """start index of the aligned query portion of the sequence (0-based, inclusive)""" + * def __get__(self): # <<<<<<<<<<<<<< + * return query_start(self._delegate) + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_6qstart___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int32_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2242); + + /* "csamtools.pyx":2243 + * """start index of the aligned query portion of the sequence (0-based, inclusive)""" + * def __get__(self): + * return query_start(self._delegate) # <<<<<<<<<<<<<< + * + * property qend: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9csamtools_query_start(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.qstart.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2247 + * property qend: + * """end index of the aligned query portion of the sequence (0-based, exclusive)""" + * def __get__(self): # <<<<<<<<<<<<<< + * return query_end(self._delegate) + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qend___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + int32_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2247); + + /* "csamtools.pyx":2248 + * """end index of the aligned query portion of the sequence (0-based, exclusive)""" + * def __get__(self): + * return query_end(self._delegate) # <<<<<<<<<<<<<< + * + * property qlen: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9csamtools_query_end(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.qend.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2252 + * property qlen: + * """Length of the aligned query sequence""" + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * src = self._delegate + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4qlen___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + int32_t __pyx_t_1; + int32_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2252); + + /* "csamtools.pyx":2254 + * def __get__(self): + * cdef bam1_t * src + * src = self._delegate # <<<<<<<<<<<<<< + * return query_end(src)-query_start(src) + * + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2255 + * cdef bam1_t * src + * src = self._delegate + * return query_end(src)-query_start(src) # <<<<<<<<<<<<<< + * + * property tags: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_9csamtools_query_end(__pyx_v_src); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_9csamtools_query_start(__pyx_v_src); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_int32_t((__pyx_t_1 - __pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.AlignedRead.qlen.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2272 + * multiple times. + * """ + * def __get__(self): # <<<<<<<<<<<<<< + * cdef char * ctag + * cdef bam1_t * src + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tags___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + uint8_t *__pyx_v_s; + char __pyx_v_auxtag[3]; + char __pyx_v_auxtype; + PyObject *__pyx_v_result; + PyObject *__pyx_v_value; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + char __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2272); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2279 + * cdef char auxtype + * + * src = self._delegate # <<<<<<<<<<<<<< + * if src.l_aux == 0: return [] + * + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2280 + * + * src = self._delegate + * if src.l_aux == 0: return [] # <<<<<<<<<<<<<< + * + * s = bam1_aux( src ) + */ + __pyx_t_1 = (__pyx_v_src->l_aux == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2282 + * if src.l_aux == 0: return [] + * + * s = bam1_aux( src ) # <<<<<<<<<<<<<< + * result = [] + * auxtag[2] = 0 + */ + __pyx_v_s = bam1_aux(__pyx_v_src); + + /* "csamtools.pyx":2283 + * + * s = bam1_aux( src ) + * result = [] # <<<<<<<<<<<<<< + * auxtag[2] = 0 + * while s < (src.data + src.data_len): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2284 + * s = bam1_aux( src ) + * result = [] + * auxtag[2] = 0 # <<<<<<<<<<<<<< + * while s < (src.data + src.data_len): + * # get tag + */ + (__pyx_v_auxtag[2]) = 0; + + /* "csamtools.pyx":2285 + * result = [] + * auxtag[2] = 0 + * while s < (src.data + src.data_len): # <<<<<<<<<<<<<< + * # get tag + * auxtag[0] = s[0] + */ + while (1) { + __pyx_t_1 = (__pyx_v_s < (__pyx_v_src->data + __pyx_v_src->data_len)); + if (!__pyx_t_1) break; + + /* "csamtools.pyx":2287 + * while s < (src.data + src.data_len): + * # get tag + * auxtag[0] = s[0] # <<<<<<<<<<<<<< + * auxtag[1] = s[1] + * s += 2 + */ + (__pyx_v_auxtag[0]) = (__pyx_v_s[0]); + + /* "csamtools.pyx":2288 + * # get tag + * auxtag[0] = s[0] + * auxtag[1] = s[1] # <<<<<<<<<<<<<< + * s += 2 + * auxtype = s[0] + */ + (__pyx_v_auxtag[1]) = (__pyx_v_s[1]); + + /* "csamtools.pyx":2289 + * auxtag[0] = s[0] + * auxtag[1] = s[1] + * s += 2 # <<<<<<<<<<<<<< + * auxtype = s[0] + * + */ + __pyx_v_s = (__pyx_v_s + 2); + + /* "csamtools.pyx":2290 + * auxtag[1] = s[1] + * s += 2 + * auxtype = s[0] # <<<<<<<<<<<<<< + * + * if auxtype in ('c', 'C'): + */ + __pyx_v_auxtype = (__pyx_v_s[0]); + + /* "csamtools.pyx":2292 + * auxtype = s[0] + * + * if auxtype in ('c', 'C'): # <<<<<<<<<<<<<< + * value = bam_aux2i(s) + * s += 1 + */ + __pyx_t_3 = __pyx_v_auxtype; + __pyx_t_1 = (__pyx_t_3 == 'c'); + if (!__pyx_t_1) { + __pyx_t_4 = (__pyx_t_3 == 'C'); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_5; + if (__pyx_t_1) { + + /* "csamtools.pyx":2293 + * + * if auxtype in ('c', 'C'): + * value = bam_aux2i(s) # <<<<<<<<<<<<<< + * s += 1 + * elif auxtype in ('s', 'S'): + */ + __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2294 + * if auxtype in ('c', 'C'): + * value = bam_aux2i(s) + * s += 1 # <<<<<<<<<<<<<< + * elif auxtype in ('s', 'S'): + * value = bam_aux2i(s) + */ + __pyx_v_s = (__pyx_v_s + 1); + goto __pyx_L8; + } + + /* "csamtools.pyx":2295 + * value = bam_aux2i(s) + * s += 1 + * elif auxtype in ('s', 'S'): # <<<<<<<<<<<<<< + * value = bam_aux2i(s) + * s += 2 + */ + __pyx_t_3 = __pyx_v_auxtype; + __pyx_t_1 = (__pyx_t_3 == 's'); + if (!__pyx_t_1) { + __pyx_t_5 = (__pyx_t_3 == 'S'); + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_4; + if (__pyx_t_1) { + + /* "csamtools.pyx":2296 + * s += 1 + * elif auxtype in ('s', 'S'): + * value = bam_aux2i(s) # <<<<<<<<<<<<<< + * s += 2 + * elif auxtype in ('i', 'I'): + */ + __pyx_t_2 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2297 + * elif auxtype in ('s', 'S'): + * value = bam_aux2i(s) + * s += 2 # <<<<<<<<<<<<<< + * elif auxtype in ('i', 'I'): + * value = bam_aux2i(s) + */ + __pyx_v_s = (__pyx_v_s + 2); + goto __pyx_L8; + } + + /* "csamtools.pyx":2298 + * value = bam_aux2i(s) + * s += 2 + * elif auxtype in ('i', 'I'): # <<<<<<<<<<<<<< + * value = bam_aux2i(s) + * s += 4 + */ + __pyx_t_3 = __pyx_v_auxtype; + __pyx_t_1 = (__pyx_t_3 == 'i'); + if (!__pyx_t_1) { + __pyx_t_4 = (__pyx_t_3 == 'I'); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_5; + if (__pyx_t_1) { + + /* "csamtools.pyx":2299 + * s += 2 + * elif auxtype in ('i', 'I'): + * value = bam_aux2i(s) # <<<<<<<<<<<<<< + * s += 4 + * elif auxtype == 'f': + */ + __pyx_t_2 = PyFloat_FromDouble(((float)bam_aux2i(__pyx_v_s))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2300 + * elif auxtype in ('i', 'I'): + * value = bam_aux2i(s) + * s += 4 # <<<<<<<<<<<<<< + * elif auxtype == 'f': + * value = bam_aux2f(s) + */ + __pyx_v_s = (__pyx_v_s + 4); + goto __pyx_L8; + } + + /* "csamtools.pyx":2301 + * value = bam_aux2i(s) + * s += 4 + * elif auxtype == 'f': # <<<<<<<<<<<<<< + * value = bam_aux2f(s) + * s += 4 + */ + __pyx_t_1 = (__pyx_v_auxtype == 'f'); + if (__pyx_t_1) { + + /* "csamtools.pyx":2302 + * s += 4 + * elif auxtype == 'f': + * value = bam_aux2f(s) # <<<<<<<<<<<<<< + * s += 4 + * elif auxtype == 'd': + */ + __pyx_t_2 = PyFloat_FromDouble(bam_aux2f(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2303 + * elif auxtype == 'f': + * value = bam_aux2f(s) + * s += 4 # <<<<<<<<<<<<<< + * elif auxtype == 'd': + * value = bam_aux2d(s) + */ + __pyx_v_s = (__pyx_v_s + 4); + goto __pyx_L8; + } + + /* "csamtools.pyx":2304 + * value = bam_aux2f(s) + * s += 4 + * elif auxtype == 'd': # <<<<<<<<<<<<<< + * value = bam_aux2d(s) + * s += 8 + */ + __pyx_t_1 = (__pyx_v_auxtype == 'd'); + if (__pyx_t_1) { + + /* "csamtools.pyx":2305 + * s += 4 + * elif auxtype == 'd': + * value = bam_aux2d(s) # <<<<<<<<<<<<<< + * s += 8 + * elif auxtype == 'A': + */ + __pyx_t_2 = PyFloat_FromDouble(bam_aux2d(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":2306 + * elif auxtype == 'd': + * value = bam_aux2d(s) + * s += 8 # <<<<<<<<<<<<<< + * elif auxtype == 'A': + * value = "%c" % bam_aux2A(s) + */ + __pyx_v_s = (__pyx_v_s + 8); + goto __pyx_L8; + } + + /* "csamtools.pyx":2307 + * value = bam_aux2d(s) + * s += 8 + * elif auxtype == 'A': # <<<<<<<<<<<<<< + * value = "%c" % bam_aux2A(s) + * s += 1 + */ + __pyx_t_1 = (__pyx_v_auxtype == 'A'); + if (__pyx_t_1) { + + /* "csamtools.pyx":2308 + * s += 8 + * elif auxtype == 'A': + * value = "%c" % bam_aux2A(s) # <<<<<<<<<<<<<< + * s += 1 + * elif auxtype in ('Z', 'H'): + */ + __pyx_t_2 = PyInt_FromLong(bam_aux2A(__pyx_v_s)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "csamtools.pyx":2309 + * elif auxtype == 'A': + * value = "%c" % bam_aux2A(s) + * s += 1 # <<<<<<<<<<<<<< + * elif auxtype in ('Z', 'H'): + * value = bam_aux2Z(s) + */ + __pyx_v_s = (__pyx_v_s + 1); + goto __pyx_L8; + } + + /* "csamtools.pyx":2310 + * value = "%c" % bam_aux2A(s) + * s += 1 + * elif auxtype in ('Z', 'H'): # <<<<<<<<<<<<<< + * value = bam_aux2Z(s) + * # +1 for NULL terminated string + */ + __pyx_t_3 = __pyx_v_auxtype; + __pyx_t_1 = (__pyx_t_3 == 'Z'); + if (!__pyx_t_1) { + __pyx_t_5 = (__pyx_t_3 == 'H'); + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_4; + if (__pyx_t_1) { + + /* "csamtools.pyx":2311 + * s += 1 + * elif auxtype in ('Z', 'H'): + * value = bam_aux2Z(s) # <<<<<<<<<<<<<< + * # +1 for NULL terminated string + * s += len(value) + 1 + */ + __pyx_t_6 = PyBytes_FromString(bam_aux2Z(__pyx_v_s)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "csamtools.pyx":2313 + * value = bam_aux2Z(s) + * # +1 for NULL terminated string + * s += len(value) + 1 # <<<<<<<<<<<<<< + * # + * s += 1 + */ + __pyx_t_7 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_s = (__pyx_v_s + (__pyx_t_7 + 1)); + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":2315 + * s += len(value) + 1 + * # + * s += 1 # <<<<<<<<<<<<<< + * + * result.append( (auxtag, value) ) + */ + __pyx_v_s = (__pyx_v_s + 1); + + /* "csamtools.pyx":2317 + * s += 1 + * + * result.append( (auxtag, value) ) # <<<<<<<<<<<<<< + * + * return result + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyBytes_FromString(__pyx_v_auxtag); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_6 = 0; + __pyx_t_8 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + } + + /* "csamtools.pyx":2319 + * result.append( (auxtag, value) ) + * + * return result # <<<<<<<<<<<<<< + * + * def __set__(self, tags): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("csamtools.AlignedRead.tags.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2321 + * return result + * + * def __set__(self, tags): # <<<<<<<<<<<<<< + * cdef char * ctag + * cdef bam1_t * src + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tags) { + bam1_t *__pyx_v_src; + uint8_t *__pyx_v_s; + char *__pyx_v_temp; + int __pyx_v_max_size; + int __pyx_v_size; + int __pyx_v_offset; + PyObject *__pyx_v_buffer; + PyObject *__pyx_v_pytag; + PyObject *__pyx_v_value; + PyObject *__pyx_v_t; + PyObject *__pyx_v_fmt; + PyObject *__pyx_v_pytype; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + char *__pyx_t_11; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2321); + __pyx_v_buffer = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytag = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fmt = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pytype = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2330 + * cdef int max_size, size, offset + * + * src = self._delegate # <<<<<<<<<<<<<< + * max_size = 4000 + * offset = 0 + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2331 + * + * src = self._delegate + * max_size = 4000 # <<<<<<<<<<<<<< + * offset = 0 + * + */ + __pyx_v_max_size = 4000; + + /* "csamtools.pyx":2332 + * src = self._delegate + * max_size = 4000 + * offset = 0 # <<<<<<<<<<<<<< + * + * if tags != None: + */ + __pyx_v_offset = 0; + + /* "csamtools.pyx":2334 + * offset = 0 + * + * if tags != None: # <<<<<<<<<<<<<< + * + * # map samtools code to python.struct code and byte size + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_tags, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "csamtools.pyx":2337 + * + * # map samtools code to python.struct code and byte size + * buffer = ctypes.create_string_buffer(max_size) # <<<<<<<<<<<<<< + * + * for pytag, value in tags: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ctypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_122); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_buffer); + __pyx_v_buffer = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2339 + * buffer = ctypes.create_string_buffer(max_size) + * + * for pytag, value in tags: # <<<<<<<<<<<<<< + * t = type(value) + * if t == types.FloatType: + */ + if (PyList_CheckExact(__pyx_v_tags) || PyTuple_CheckExact(__pyx_v_tags)) { + __pyx_t_5 = 0; __pyx_t_1 = __pyx_v_tags; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytag); + __pyx_v_pytag = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_pytag); + __pyx_v_pytag = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "csamtools.pyx":2340 + * + * for pytag, value in tags: + * t = type(value) # <<<<<<<<<<<<<< + * if t == types.FloatType: + * fmt, pytype = "= -127: fmt, pytype = "= -127: fmt, pytype = "= -32767: fmt, pytype = "= -127: fmt, pytype = "= -32767: fmt, pytype = "= -127: fmt, pytype = "= -32767: fmt, pytype = "= -127: fmt, pytype = "= -32767: fmt, pytype = "= -32767: fmt, pytype = " 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_int_255, Py_LE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + __pyx_t_4 = ((PyObject *)__pyx_kp_s_128); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = ((PyObject *)__pyx_n_s__C); + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_fmt); + __pyx_v_fmt = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_pytype); + __pyx_v_pytype = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L11; + } + + /* "csamtools.pyx":2351 + * else: + * if value <= 255: fmt, pytype = " 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) + * else: fmt, pytype = " 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) # <<<<<<<<<<<<<< + * else: fmt, pytype = " 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) + * else: fmt, pytype = " max_size: + * raise NotImplementedError("tags field too large") + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__calcsize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_fmt); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fmt); + __Pyx_GIVEREF(__pyx_v_fmt); + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_size = __pyx_t_9; + + /* "csamtools.pyx":2362 + * + * size = struct.calcsize(fmt) + * if offset + size > max_size: # <<<<<<<<<<<<<< + * raise NotImplementedError("tags field too large") + * + */ + __pyx_t_2 = ((__pyx_v_offset + __pyx_v_size) > __pyx_v_max_size); + if (__pyx_t_2) { + + /* "csamtools.pyx":2363 + * size = struct.calcsize(fmt) + * if offset + size > max_size: + * raise NotImplementedError("tags field too large") # <<<<<<<<<<<<<< + * + * struct.pack_into( fmt, + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "csamtools.pyx":2365 + * raise NotImplementedError("tags field too large") + * + * struct.pack_into( fmt, # <<<<<<<<<<<<<< + * buffer, + * offset, + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pack_into); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2367 + * struct.pack_into( fmt, + * buffer, + * offset, # <<<<<<<<<<<<<< + * pytag[0], + * pytag[1], + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "csamtools.pyx":2368 + * buffer, + * offset, + * pytag[0], # <<<<<<<<<<<<<< + * pytag[1], + * pytype, + */ + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_pytag, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "csamtools.pyx":2369 + * offset, + * pytag[0], + * pytag[1], # <<<<<<<<<<<<<< + * pytype, + * value ) + */ + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_pytag, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "csamtools.pyx":2371 + * pytag[1], + * pytype, + * value ) # <<<<<<<<<<<<<< + * offset += size + * + */ + __pyx_t_10 = PyTuple_New(7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_fmt); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_fmt); + __Pyx_GIVEREF(__pyx_v_fmt); + __Pyx_INCREF(__pyx_v_buffer); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_buffer); + __Pyx_GIVEREF(__pyx_v_buffer); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_pytype); + PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_v_pytype); + __Pyx_GIVEREF(__pyx_v_pytype); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "csamtools.pyx":2372 + * pytype, + * value ) + * offset += size # <<<<<<<<<<<<<< + * + * # delete the old data and allocate new + */ + __pyx_v_offset = (__pyx_v_offset + __pyx_v_size); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2380 + * src.l_aux, + * offset, + * bam1_aux( src ) ) # <<<<<<<<<<<<<< + * + * src.l_aux = offset + */ + pysam_bam_update(__pyx_v_src, __pyx_v_src->l_aux, __pyx_v_offset, bam1_aux(__pyx_v_src)); + + /* "csamtools.pyx":2382 + * bam1_aux( src ) ) + * + * src.l_aux = offset # <<<<<<<<<<<<<< + * + * # copy data only if there is any + */ + __pyx_v_src->l_aux = __pyx_v_offset; + + /* "csamtools.pyx":2385 + * + * # copy data only if there is any + * if offset != 0: # <<<<<<<<<<<<<< + * + * # get location of new data + */ + __pyx_t_2 = (__pyx_v_offset != 0); + if (__pyx_t_2) { + + /* "csamtools.pyx":2388 + * + * # get location of new data + * s = bam1_aux( src ) # <<<<<<<<<<<<<< + * + * # check if there is direct path from buffer.raw to tmp + */ + __pyx_v_s = bam1_aux(__pyx_v_src); + + /* "csamtools.pyx":2391 + * + * # check if there is direct path from buffer.raw to tmp + * temp = buffer.raw # <<<<<<<<<<<<<< + * memcpy( s, temp, offset ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_buffer, __pyx_n_s__raw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_temp = __pyx_t_11; + + /* "csamtools.pyx":2392 + * # check if there is direct path from buffer.raw to tmp + * temp = buffer.raw + * memcpy( s, temp, offset ) # <<<<<<<<<<<<<< + * + * property flag: + */ + memcpy(__pyx_v_s, __pyx_v_temp, __pyx_v_offset); + goto __pyx_L14; + } + __pyx_L14:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("csamtools.AlignedRead.tags.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_buffer); + __Pyx_DECREF(__pyx_v_pytag); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF(__pyx_v_fmt); + __Pyx_DECREF(__pyx_v_pytype); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2396 + * property flag: + * """properties flag""" + * def __get__(self): return self._delegate.core.flag # <<<<<<<<<<<<<< + * def __set__(self, flag): self._delegate.core.flag = flag + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4flag___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2396); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.flag.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2397 + * """properties flag""" + * def __get__(self): return self._delegate.core.flag + * def __set__(self, flag): self._delegate.core.flag = flag # <<<<<<<<<<<<<< + * + * property rname: + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_flag) { + int __pyx_r; + uint32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2397); + __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_flag); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.flag.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2415 + * + * """ + * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<< + * def __set__(self, tid): self._delegate.core.tid = tid + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rname___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2415); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.rname.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2416 + * """ + * def __get__(self): return self._delegate.core.tid + * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<< + * + * property tid: + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2416); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.rname.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2429 + * + * """ + * def __get__(self): return self._delegate.core.tid # <<<<<<<<<<<<<< + * def __set__(self, tid): self._delegate.core.tid = tid + * + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3tid___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2429); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.tid.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2430 + * """ + * def __get__(self): return self._delegate.core.tid + * def __set__(self, tid): self._delegate.core.tid = tid # <<<<<<<<<<<<<< + * + * property pos: + */ + +static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_tid) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2430); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_tid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.tid = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.tid.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2434 + * property pos: + * """0-based leftmost coordinate""" + * def __get__(self): return self._delegate.core.pos # <<<<<<<<<<<<<< + * def __set__(self, pos): + * ## setting the cigar string also updates the "bin" attribute + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2434); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2435 + * """0-based leftmost coordinate""" + * def __get__(self): return self._delegate.core.pos + * def __set__(self, pos): # <<<<<<<<<<<<<< + * ## setting the cigar string also updates the "bin" attribute + * cdef bam1_t * src + */ + +static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_pos) { + bam1_t *__pyx_v_src; + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2435); + + /* "csamtools.pyx":2438 + * ## setting the cigar string also updates the "bin" attribute + * cdef bam1_t * src + * src = self._delegate # <<<<<<<<<<<<<< + * if src.core.n_cigar: + * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2439 + * cdef bam1_t * src + * src = self._delegate + * if src.core.n_cigar: # <<<<<<<<<<<<<< + * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) + * else: + */ + if (__pyx_v_src->core.n_cigar) { + + /* "csamtools.pyx":2440 + * src = self._delegate + * if src.core.n_cigar: + * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) # <<<<<<<<<<<<<< + * else: + * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) + */ + __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2442 + * src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) + * else: + * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) # <<<<<<<<<<<<<< + * self._delegate.core.pos = pos + * property bin: + */ + __pyx_v_src->core.bin = bam_reg2bin(__pyx_v_src->core.pos, (__pyx_v_src->core.pos + 1)); + } + __pyx_L5:; + + /* "csamtools.pyx":2443 + * else: + * src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) + * self._delegate.core.pos = pos # <<<<<<<<<<<<<< + * property bin: + * """properties bin""" + */ + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_pos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.pos.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2446 + * property bin: + * """properties bin""" + * def __get__(self): return self._delegate.core.bin # <<<<<<<<<<<<<< + * def __set__(self, bin): self._delegate.core.bin = bin + * property rlen: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_3bin___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2446); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.bin.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2447 + * """properties bin""" + * def __get__(self): return self._delegate.core.bin + * def __set__(self, bin): self._delegate.core.bin = bin # <<<<<<<<<<<<<< + * property rlen: + * '''length of the read (read only). Returns 0 if not given.''' + */ + +static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_bin) { + int __pyx_r; + uint32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2447); + __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_bin); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.bin = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.bin.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2450 + * property rlen: + * '''length of the read (read only). Returns 0 if not given.''' + * def __get__(self): return self._delegate.core.l_qseq # <<<<<<<<<<<<<< + * property aend: + * '''aligned end position of the read on the reference genome. Returns + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4rlen___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2450); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.l_qseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.rlen.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2454 + * '''aligned end position of the read on the reference genome. Returns + * None if not available.''' + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * src = self._delegate + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4aend___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2454); + + /* "csamtools.pyx":2456 + * def __get__(self): + * cdef bam1_t * src + * src = self._delegate # <<<<<<<<<<<<<< + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2457 + * cdef bam1_t * src + * src = self._delegate + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<< + * return None + * return bam_calend(&src.core, bam1_cigar(src)) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":2458 + * src = self._delegate + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None # <<<<<<<<<<<<<< + * return bam_calend(&src.core, bam1_cigar(src)) + * property alen: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2459 + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None + * return bam_calend(&src.core, bam1_cigar(src)) # <<<<<<<<<<<<<< + * property alen: + * '''aligned length of the read on the reference genome. Returns None if + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.aend.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2463 + * '''aligned length of the read on the reference genome. Returns None if + * not available.''' + * def __get__(self): # <<<<<<<<<<<<<< + * cdef bam1_t * src + * src = self._delegate + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4alen___get__(PyObject *__pyx_v_self) { + bam1_t *__pyx_v_src; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2463); + + /* "csamtools.pyx":2465 + * def __get__(self): + * cdef bam1_t * src + * src = self._delegate # <<<<<<<<<<<<<< + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2466 + * cdef bam1_t * src + * src = self._delegate + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: # <<<<<<<<<<<<<< + * return None + * return bam_calend(&src.core, + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_src->core.n_cigar == 0); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_3; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":2467 + * src = self._delegate + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None # <<<<<<<<<<<<<< + * return bam_calend(&src.core, + * bam1_cigar(src)) - \ + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2468 + * if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + * return None + * return bam_calend(&src.core, # <<<<<<<<<<<<<< + * bam1_cigar(src)) - \ + * self._delegate.core.pos + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":2470 + * return bam_calend(&src.core, + * bam1_cigar(src)) - \ + * self._delegate.core.pos # <<<<<<<<<<<<<< + * + * property mapq: + */ + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t((bam_calend((&__pyx_v_src->core), bam1_cigar(__pyx_v_src)) - ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.pos)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.alen.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2474 + * property mapq: + * """mapping quality""" + * def __get__(self): return self._delegate.core.qual # <<<<<<<<<<<<<< + * def __set__(self, qual): self._delegate.core.qual = qual + * property mrnm: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mapq___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2474); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2475 + * """mapping quality""" + * def __get__(self): return self._delegate.core.qual + * def __set__(self, qual): self._delegate.core.qual = qual # <<<<<<<<<<<<<< + * property mrnm: + * """the :term:`reference` id of the mate + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_qual) { + int __pyx_r; + uint32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2475); + __pyx_t_1 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_qual); if (unlikely((__pyx_t_1 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.qual = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.mapq.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2480 + * deprecated, use RNEXT instead. + * """ + * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<< + * def __set__(self, mtid): self._delegate.core.mtid = mtid + * property rnext: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2480); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2481 + * """ + * def __get__(self): return self._delegate.core.mtid + * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<< + * property rnext: + * """the :term:`reference` id of the mate """ + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2481); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.mrnm.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2484 + * property rnext: + * """the :term:`reference` id of the mate """ + * def __get__(self): return self._delegate.core.mtid # <<<<<<<<<<<<<< + * def __set__(self, mtid): self._delegate.core.mtid = mtid + * property mpos: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5rnext___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2484); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2485 + * """the :term:`reference` id of the mate """ + * def __get__(self): return self._delegate.core.mtid + * def __set__(self, mtid): self._delegate.core.mtid = mtid # <<<<<<<<<<<<<< + * property mpos: + * """the position of the mate + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mtid) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2485); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mtid); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mtid = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.rnext.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2489 + * """the position of the mate + * deprecated, use PNEXT instead.""" + * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<< + * def __set__(self, mpos): self._delegate.core.mpos = mpos + * property pnext: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4mpos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2489); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2490 + * deprecated, use PNEXT instead.""" + * def __get__(self): return self._delegate.core.mpos + * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<< + * property pnext: + * """the position of the mate""" + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2490); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.mpos.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2493 + * property pnext: + * """the position of the mate""" + * def __get__(self): return self._delegate.core.mpos # <<<<<<<<<<<<<< + * def __set__(self, mpos): self._delegate.core.mpos = mpos + * property isize: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5pnext___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2493); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2494 + * """the position of the mate""" + * def __get__(self): return self._delegate.core.mpos + * def __set__(self, mpos): self._delegate.core.mpos = mpos # <<<<<<<<<<<<<< + * property isize: + * """the insert size + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mpos) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2494); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_mpos); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.mpos = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.pnext.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2498 + * """the insert size + * deprecated: use tlen instead""" + * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<< + * def __set__(self, isize): self._delegate.core.isize = isize + * property tlen: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5isize___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2498); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.isize.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2499 + * deprecated: use tlen instead""" + * def __get__(self): return self._delegate.core.isize + * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<< + * property tlen: + * """the insert size""" + */ + +static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2499); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.isize.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2502 + * property tlen: + * """the insert size""" + * def __get__(self): return self._delegate.core.isize # <<<<<<<<<<<<<< + * def __set__(self, isize): self._delegate.core.isize = isize + * property is_paired: + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_4tlen___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2502); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2503 + * """the insert size""" + * def __get__(self): return self._delegate.core.isize + * def __set__(self, isize): self._delegate.core.isize = isize # <<<<<<<<<<<<<< + * property is_paired: + * """true if read is paired in sequencing""" + */ + +static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_isize) { + int __pyx_r; + int32_t __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2503); + __pyx_t_1 = __Pyx_PyInt_from_py_int32_t(__pyx_v_isize); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.isize = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.tlen.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2506 + * property is_paired: + * """true if read is paired in sequencing""" + * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPAIRED + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2506); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & 1) != 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2507 + * """true if read is paired in sequencing""" + * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FPAIRED + * else: self._delegate.core.flag &= ~BAM_FPAIRED + */ + +static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2507); + + /* "csamtools.pyx":2508 + * def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPAIRED # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FPAIRED + * property is_proper_pair: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2509 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPAIRED + * else: self._delegate.core.flag &= ~BAM_FPAIRED # <<<<<<<<<<<<<< + * property is_proper_pair: + * """true if read is mapped in a proper pair""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_paired.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2512 + * property is_proper_pair: + * """true if read is mapped in a proper pair""" + * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2512); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2513 + * """true if read is mapped in a proper pair""" + * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR + * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR + */ + +static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2513); + + /* "csamtools.pyx":2514 + * def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR + * property is_unmapped: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 2); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2515 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FPROPER_PAIR + * else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR # <<<<<<<<<<<<<< + * property is_unmapped: + * """true if read itself is unmapped""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~2)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_proper_pair.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2518 + * property is_unmapped: + * """true if read itself is unmapped""" + * def __get__(self): return (self.flag & BAM_FUNMAP) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FUNMAP + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2518); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2519 + * """true if read itself is unmapped""" + * def __get__(self): return (self.flag & BAM_FUNMAP) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FUNMAP + * else: self._delegate.core.flag &= ~BAM_FUNMAP + */ + +static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2519); + + /* "csamtools.pyx":2520 + * def __get__(self): return (self.flag & BAM_FUNMAP) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FUNMAP # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FUNMAP + * property mate_is_unmapped: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 4); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2521 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FUNMAP + * else: self._delegate.core.flag &= ~BAM_FUNMAP # <<<<<<<<<<<<<< + * property mate_is_unmapped: + * """true if the mate is unmapped""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~4)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_unmapped.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2524 + * property mate_is_unmapped: + * """true if the mate is unmapped""" + * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMUNMAP + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2524); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2525 + * """true if the mate is unmapped""" + * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FMUNMAP + * else: self._delegate.core.flag &= ~BAM_FMUNMAP + */ + +static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2525); + + /* "csamtools.pyx":2526 + * def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMUNMAP # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FMUNMAP + * property is_reverse: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 8); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2527 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMUNMAP + * else: self._delegate.core.flag &= ~BAM_FMUNMAP # <<<<<<<<<<<<<< + * property is_reverse: + * """true if read is mapped to reverse strand""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~8)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_unmapped.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2530 + * property is_reverse: + * """true if read is mapped to reverse strand""" + * def __get__(self): return (self.flag & BAM_FREVERSE) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREVERSE + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2530); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2531 + * """true if read is mapped to reverse strand""" + * def __get__(self): return (self.flag & BAM_FREVERSE) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FREVERSE + * else: self._delegate.core.flag &= ~BAM_FREVERSE + */ + +static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2531); + + /* "csamtools.pyx":2532 + * def __get__(self): return (self.flag & BAM_FREVERSE) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREVERSE # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FREVERSE + * property mate_is_reverse: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 16); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2533 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREVERSE + * else: self._delegate.core.flag &= ~BAM_FREVERSE # <<<<<<<<<<<<<< + * property mate_is_reverse: + * """true is read is mapped to reverse strand""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~16)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_reverse.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2536 + * property mate_is_reverse: + * """true is read is mapped to reverse strand""" + * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMREVERSE + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2536); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2537 + * """true is read is mapped to reverse strand""" + * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FMREVERSE + * else: self._delegate.core.flag &= ~BAM_FMREVERSE + */ + +static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2537); + + /* "csamtools.pyx":2538 + * def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMREVERSE # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FMREVERSE + * property is_read1: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 32); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2539 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FMREVERSE + * else: self._delegate.core.flag &= ~BAM_FMREVERSE # <<<<<<<<<<<<<< + * property is_read1: + * """true if this is read1""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~32)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.mate_is_reverse.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2542 + * property is_read1: + * """true if this is read1""" + * def __get__(self): return (self.flag & BAM_FREAD1) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD1 + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2542); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2543 + * """true if this is read1""" + * def __get__(self): return (self.flag & BAM_FREAD1) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FREAD1 + * else: self._delegate.core.flag &= ~BAM_FREAD1 + */ + +static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2543); + + /* "csamtools.pyx":2544 + * def __get__(self): return (self.flag & BAM_FREAD1) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD1 # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FREAD1 + * property is_read2: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 64); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2545 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD1 + * else: self._delegate.core.flag &= ~BAM_FREAD1 # <<<<<<<<<<<<<< + * property is_read2: + * """true if this is read2""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~64)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_read1.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2548 + * property is_read2: + * """true if this is read2""" + * def __get__(self): return (self.flag & BAM_FREAD2) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD2 + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2548); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_128); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2549 + * """true if this is read2""" + * def __get__(self): return (self.flag & BAM_FREAD2) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FREAD2 + * else: self._delegate.core.flag &= ~BAM_FREAD2 + */ + +static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2549); + + /* "csamtools.pyx":2550 + * def __get__(self): return (self.flag & BAM_FREAD2) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD2 # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FREAD2 + * property is_secondary: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 128); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2551 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FREAD2 + * else: self._delegate.core.flag &= ~BAM_FREAD2 # <<<<<<<<<<<<<< + * property is_secondary: + * """true if not primary alignment""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~128)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_read2.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2554 + * property is_secondary: + * """true if not primary alignment""" + * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FSECONDARY + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2554); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2555 + * """true if not primary alignment""" + * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FSECONDARY + * else: self._delegate.core.flag &= ~BAM_FSECONDARY + */ + +static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2555); + + /* "csamtools.pyx":2556 + * def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FSECONDARY # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FSECONDARY + * property is_qcfail: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 256); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2557 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FSECONDARY + * else: self._delegate.core.flag &= ~BAM_FSECONDARY # <<<<<<<<<<<<<< + * property is_qcfail: + * """true if QC failure""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~256)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_secondary.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2560 + * property is_qcfail: + * """true if QC failure""" + * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FQCFAIL + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2560); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_512); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2561 + * """true if QC failure""" + * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FQCFAIL + * else: self._delegate.core.flag &= ~BAM_FQCFAIL + */ + +static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2561); + + /* "csamtools.pyx":2562 + * def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FQCFAIL # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FQCFAIL + * property is_duplicate: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 512); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2563 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FQCFAIL + * else: self._delegate.core.flag &= ~BAM_FQCFAIL # <<<<<<<<<<<<<< + * property is_duplicate: + * """true if optical or PCR duplicate""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~512)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_qcfail.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2566 + * property is_duplicate: + * """true if optical or PCR duplicate""" + * def __get__(self): return (self.flag & BAM_FDUP) != 0 # <<<<<<<<<<<<<< + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FDUP + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2566); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_1024); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2567 + * """true if optical or PCR duplicate""" + * def __get__(self): return (self.flag & BAM_FDUP) != 0 + * def __set__(self,val): # <<<<<<<<<<<<<< + * if val: self._delegate.core.flag |= BAM_FDUP + * else: self._delegate.core.flag &= ~BAM_FDUP + */ + +static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/ +static int __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2567); + + /* "csamtools.pyx":2568 + * def __get__(self): return (self.flag & BAM_FDUP) != 0 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FDUP # <<<<<<<<<<<<<< + * else: self._delegate.core.flag &= ~BAM_FDUP + * property positions: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_val); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag | 1024); + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":2569 + * def __set__(self,val): + * if val: self._delegate.core.flag |= BAM_FDUP + * else: self._delegate.core.flag &= ~BAM_FDUP # <<<<<<<<<<<<<< + * property positions: + * """a list of reference positions that this read aligns to.""" + */ + ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag = (((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate->core.flag & (~1024)); + } + __pyx_L5:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.is_duplicate.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2572 + * property positions: + * """a list of reference positions that this read aligns to.""" + * def __get__(self): # <<<<<<<<<<<<<< + * cdef uint32_t k, i, pos + * cdef int op + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11AlignedRead_9positions___get__(PyObject *__pyx_v_self) { + uint32_t __pyx_v_k; + uint32_t __pyx_v_i; + uint32_t __pyx_v_pos; + int __pyx_v_op; + uint32_t *__pyx_v_cigar_p; + bam1_t *__pyx_v_src; + PyObject *__pyx_v_result; + PyObject *__pyx_v_l; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + uint32_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + uint32_t __pyx_t_5; + int __pyx_t_6; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2572); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2578 + * cdef bam1_t * src + * + * result = [] # <<<<<<<<<<<<<< + * src = self._delegate + * if src.core.n_cigar == 0: return [] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2579 + * + * result = [] + * src = self._delegate # <<<<<<<<<<<<<< + * if src.core.n_cigar == 0: return [] + * + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2580 + * result = [] + * src = self._delegate + * if src.core.n_cigar == 0: return [] # <<<<<<<<<<<<<< + * + * pos = src.core.pos + */ + __pyx_t_2 = (__pyx_v_src->core.n_cigar == 0); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2582 + * if src.core.n_cigar == 0: return [] + * + * pos = src.core.pos # <<<<<<<<<<<<<< + * + * cigar_p = bam1_cigar(src) + */ + __pyx_v_pos = __pyx_v_src->core.pos; + + /* "csamtools.pyx":2584 + * pos = src.core.pos + * + * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<< + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + */ + __pyx_v_cigar_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":2585 + * + * cigar_p = bam1_cigar(src) + * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<< + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + */ + __pyx_t_3 = __pyx_v_src->core.n_cigar; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + + /* "csamtools.pyx":2586 + * cigar_p = bam1_cigar(src) + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * if op == BAM_CMATCH: + */ + __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15); + + /* "csamtools.pyx":2587 + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< + * if op == BAM_CMATCH: + * for i from pos <= i < pos + l: + */ + __pyx_t_1 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2588 + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * if op == BAM_CMATCH: # <<<<<<<<<<<<<< + * for i from pos <= i < pos + l: + * result.append( i ) + */ + __pyx_t_2 = (__pyx_v_op == 0); + if (__pyx_t_2) { + + /* "csamtools.pyx":2589 + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * if op == BAM_CMATCH: + * for i from pos <= i < pos + l: # <<<<<<<<<<<<<< + * result.append( i ) + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (__pyx_v_i = __pyx_v_pos; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { + + /* "csamtools.pyx":2590 + * if op == BAM_CMATCH: + * for i from pos <= i < pos + l: + * result.append( i ) # <<<<<<<<<<<<<< + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":2592 + * result.append( i ) + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<< + * pos += l + * + */ + switch (__pyx_v_op) { + case 0: + case 2: + case 3: + + /* "csamtools.pyx":2593 + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + * pos += l # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_t_4 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_l); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_pos = __pyx_t_5; + break; + } + } + + /* "csamtools.pyx":2595 + * pos += l + * + * return result # <<<<<<<<<<<<<< + * + * def overlap( self, uint32_t start, uint32_t end ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.AlignedRead.positions.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_l); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2597 + * return result + * + * def overlap( self, uint32_t start, uint32_t end ): # <<<<<<<<<<<<<< + * """return number of aligned bases of read overlapping the interval *start* and *end* + * on the reference sequence. + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_11AlignedRead_5overlap[] = "AlignedRead.overlap(self, uint32_t start, uint32_t end)\nreturn number of aligned bases of read overlapping the interval *start* and *end*\n on the reference sequence.\n "; +static PyObject *__pyx_pf_9csamtools_11AlignedRead_5overlap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + uint32_t __pyx_v_start; + uint32_t __pyx_v_end; + uint32_t __pyx_v_k; + uint32_t __pyx_v_pos; + uint32_t __pyx_v_overlap; + int __pyx_v_op; + int __pyx_v_o; + uint32_t *__pyx_v_cigar_p; + bam1_t *__pyx_v_src; + PyObject *__pyx_v_l; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + uint32_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + uint32_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + uint32_t __pyx_t_8; + uint32_t __pyx_t_9; + int __pyx_t_10; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("overlap"); + __Pyx_TraceCall("overlap", __pyx_f[0], 2597); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "overlap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(values[0]); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(values[1]); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_start = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_start == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_from_py_uint32_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_end == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("overlap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.AlignedRead.overlap"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2606 + * cdef bam1_t * src + * + * overlap = 0 # <<<<<<<<<<<<<< + * + * src = self._delegate + */ + __pyx_v_overlap = 0; + + /* "csamtools.pyx":2608 + * overlap = 0 + * + * src = self._delegate # <<<<<<<<<<<<<< + * if src.core.n_cigar == 0: return 0 + * pos = src.core.pos + */ + __pyx_v_src = ((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate; + + /* "csamtools.pyx":2609 + * + * src = self._delegate + * if src.core.n_cigar == 0: return 0 # <<<<<<<<<<<<<< + * pos = src.core.pos + * o = 0 + */ + __pyx_t_1 = (__pyx_v_src->core.n_cigar == 0); + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":2610 + * src = self._delegate + * if src.core.n_cigar == 0: return 0 + * pos = src.core.pos # <<<<<<<<<<<<<< + * o = 0 + * + */ + __pyx_v_pos = __pyx_v_src->core.pos; + + /* "csamtools.pyx":2611 + * if src.core.n_cigar == 0: return 0 + * pos = src.core.pos + * o = 0 # <<<<<<<<<<<<<< + * + * cigar_p = bam1_cigar(src) + */ + __pyx_v_o = 0; + + /* "csamtools.pyx":2613 + * o = 0 + * + * cigar_p = bam1_cigar(src) # <<<<<<<<<<<<<< + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + */ + __pyx_v_cigar_p = bam1_cigar(__pyx_v_src); + + /* "csamtools.pyx":2614 + * + * cigar_p = bam1_cigar(src) + * for k from 0 <= k < src.core.n_cigar: # <<<<<<<<<<<<<< + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + */ + __pyx_t_2 = __pyx_v_src->core.n_cigar; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { + + /* "csamtools.pyx":2615 + * cigar_p = bam1_cigar(src) + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK # <<<<<<<<<<<<<< + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * + */ + __pyx_v_op = ((__pyx_v_cigar_p[__pyx_v_k]) & 15); + + /* "csamtools.pyx":2616 + * for k from 0 <= k < src.core.n_cigar: + * op = cigar_p[k] & BAM_CIGAR_MASK + * l = cigar_p[k] >> BAM_CIGAR_SHIFT # <<<<<<<<<<<<<< + * + * if op == BAM_CMATCH: + */ + __pyx_t_3 = PyInt_FromLong(((__pyx_v_cigar_p[__pyx_v_k]) >> 4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2618 + * l = cigar_p[k] >> BAM_CIGAR_SHIFT + * + * if op == BAM_CMATCH: # <<<<<<<<<<<<<< + * o = min( pos + l, end) - max( pos, start ) + * if o > 0: overlap += o + */ + __pyx_t_1 = (__pyx_v_op == 0); + if (__pyx_t_1) { + + /* "csamtools.pyx":2619 + * + * if op == BAM_CMATCH: + * o = min( pos + l, end) - max( pos, start ) # <<<<<<<<<<<<<< + * if o > 0: overlap += o + * + */ + __pyx_t_4 = __pyx_v_end; + __pyx_t_3 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { + __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __Pyx_INCREF(__pyx_t_5); + __pyx_t_3 = __pyx_t_5; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __pyx_v_start; + __pyx_t_8 = __pyx_v_pos; + if ((__pyx_t_4 > __pyx_t_8)) { + __pyx_t_9 = __pyx_t_4; + } else { + __pyx_t_9 = __pyx_t_8; + } + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_o = __pyx_t_10; + + /* "csamtools.pyx":2620 + * if op == BAM_CMATCH: + * o = min( pos + l, end) - max( pos, start ) + * if o > 0: overlap += o # <<<<<<<<<<<<<< + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + */ + __pyx_t_1 = (__pyx_v_o > 0); + if (__pyx_t_1) { + __pyx_v_overlap = (__pyx_v_overlap + __pyx_v_o); + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":2622 + * if o > 0: overlap += o + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: # <<<<<<<<<<<<<< + * pos += l + * + */ + switch (__pyx_v_op) { + case 0: + case 2: + case 3: + + /* "csamtools.pyx":2623 + * + * if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + * pos += l # <<<<<<<<<<<<<< + * + * return overlap + */ + __pyx_t_7 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_l); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_pos = __pyx_t_9; + break; + } + } + + /* "csamtools.pyx":2625 + * pos += l + * + * return overlap # <<<<<<<<<<<<<< + * + * def opt(self, tag): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_to_py_uint32_t(__pyx_v_overlap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("csamtools.AlignedRead.overlap"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_l); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2627 + * return overlap + * + * def opt(self, tag): # <<<<<<<<<<<<<< + * """retrieves optional data given a two-letter *tag*""" + * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/ +static char __pyx_doc_9csamtools_11AlignedRead_6opt[] = "AlignedRead.opt(self, tag)\nretrieves optional data given a two-letter *tag*"; +static PyObject *__pyx_pf_9csamtools_11AlignedRead_6opt(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) { + uint8_t *__pyx_v_v; + PyObject *__pyx_v_type; + PyObject *__pyx_r = NULL; + char *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("opt"); + __Pyx_TraceCall("opt", __pyx_f[0], 2627); + __pyx_v_type = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2631 + * #see bam_aux.c: bam_aux_get() and bam_aux2i() etc + * cdef uint8_t * v + * v = bam_aux_get(self._delegate, tag) # <<<<<<<<<<<<<< + * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) + * type = chr(v[0]) + */ + __pyx_t_1 = PyBytes_AsString(__pyx_v_tag); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_v = bam_aux_get(((struct __pyx_obj_9csamtools_AlignedRead *)__pyx_v_self)->_delegate, __pyx_t_1); + + /* "csamtools.pyx":2632 + * cdef uint8_t * v + * v = bam_aux_get(self._delegate, tag) + * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) # <<<<<<<<<<<<<< + * type = chr(v[0]) + * if type == 'c' or type == 'C' or type == 's' or type == 'S': + */ + __pyx_t_2 = (__pyx_v_v == NULL); + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_135), __pyx_v_tag); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "csamtools.pyx":2633 + * v = bam_aux_get(self._delegate, tag) + * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) + * type = chr(v[0]) # <<<<<<<<<<<<<< + * if type == 'c' or type == 'C' or type == 's' or type == 'S': + * return bam_aux2i(v) + */ + __pyx_t_3 = __Pyx_PyInt_to_py_uint8_t((__pyx_v_v[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_type); + __pyx_v_type = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2634 + * if v == NULL: raise KeyError( "tag '%s' not present" % tag ) + * type = chr(v[0]) + * if type == 'c' or type == 'C' or type == 's' or type == 'S': # <<<<<<<<<<<<<< + * return bam_aux2i(v) + * elif type == 'i' or type == 'I': + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__C), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_5) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__s), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_8; + } else { + __pyx_t_6 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":2635 + * type = chr(v[0]) + * if type == 'c' or type == 'C' or type == 's' or type == 'S': + * return bam_aux2i(v) # <<<<<<<<<<<<<< + * elif type == 'i' or type == 'I': + * return bam_aux2i(v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(((int)bam_aux2i(__pyx_v_v))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "csamtools.pyx":2636 + * if type == 'c' or type == 'C' or type == 's' or type == 'S': + * return bam_aux2i(v) + * elif type == 'i' or type == 'I': # <<<<<<<<<<<<<< + * return bam_aux2i(v) + * elif type == 'f' or type == 'F': + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_5) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_t_2; + } else { + __pyx_t_6 = __pyx_t_5; + } + if (__pyx_t_6) { + + /* "csamtools.pyx":2637 + * return bam_aux2i(v) + * elif type == 'i' or type == 'I': + * return bam_aux2i(v) # <<<<<<<<<<<<<< + * elif type == 'f' or type == 'F': + * return bam_aux2f(v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(bam_aux2i(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "csamtools.pyx":2638 + * elif type == 'i' or type == 'I': + * return bam_aux2i(v) + * elif type == 'f' or type == 'F': # <<<<<<<<<<<<<< + * return bam_aux2f(v) + * elif type == 'd' or type == 'D': + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__F), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __pyx_t_5; + } else { + __pyx_t_2 = __pyx_t_6; + } + if (__pyx_t_2) { + + /* "csamtools.pyx":2639 + * return bam_aux2i(v) + * elif type == 'f' or type == 'F': + * return bam_aux2f(v) # <<<<<<<<<<<<<< + * elif type == 'd' or type == 'D': + * return bam_aux2d(v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(bam_aux2f(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "csamtools.pyx":2640 + * elif type == 'f' or type == 'F': + * return bam_aux2f(v) + * elif type == 'd' or type == 'D': # <<<<<<<<<<<<<< + * return bam_aux2d(v) + * elif type == 'A': + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__d), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_2) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_6; + } else { + __pyx_t_5 = __pyx_t_2; + } + if (__pyx_t_5) { + + /* "csamtools.pyx":2641 + * return bam_aux2f(v) + * elif type == 'd' or type == 'D': + * return bam_aux2d(v) # <<<<<<<<<<<<<< + * elif type == 'A': + * # there might a more efficient way + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(bam_aux2d(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "csamtools.pyx":2642 + * elif type == 'd' or type == 'D': + * return bam_aux2d(v) + * elif type == 'A': # <<<<<<<<<<<<<< + * # there might a more efficient way + * # to convert a char into a string + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + + /* "csamtools.pyx":2645 + * # there might a more efficient way + * # to convert a char into a string + * return '%c' % bam_aux2A(v) # <<<<<<<<<<<<<< + * elif type == 'Z': + * return bam_aux2Z(v) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyInt_FromLong(bam_aux2A(__pyx_v_v)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + + /* "csamtools.pyx":2646 + * # to convert a char into a string + * return '%c' % bam_aux2A(v) + * elif type == 'Z': # <<<<<<<<<<<<<< + * return bam_aux2Z(v) + * + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_type, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "csamtools.pyx":2647 + * return '%c' % bam_aux2A(v) + * elif type == 'Z': + * return bam_aux2Z(v) # <<<<<<<<<<<<<< + * + * def fancy_str (self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyBytes_FromString(bam_aux2Z(__pyx_v_v)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.AlignedRead.opt"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_type); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2649 + * return bam_aux2Z(v) + * + * def fancy_str (self): # <<<<<<<<<<<<<< + * """returns list of fieldnames/values in pretty format for debugging + * """ + */ + +static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_11AlignedRead_7fancy_str[] = "AlignedRead.fancy_str(self)\nreturns list of fieldnames/values in pretty format for debugging\n "; +static PyObject *__pyx_pf_9csamtools_11AlignedRead_7fancy_str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_v_ret_string; + PyObject *__pyx_v_field_names; + PyObject *__pyx_v_fields_names_in_order; + PyObject *__pyx_v_f; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("fancy_str"); + __Pyx_TraceCall("fancy_str", __pyx_f[0], 2649); + __pyx_v_ret_string = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_field_names = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields_names_in_order = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2652 + * """returns list of fieldnames/values in pretty format for debugging + * """ + * ret_string = [] # <<<<<<<<<<<<<< + * field_names = { + * "tid": "Contig index", + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_ret_string)); + __pyx_v_ret_string = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2653 + * """ + * ret_string = [] + * field_names = { # <<<<<<<<<<<<<< + * "tid": "Contig index", + * "pos": "Mapped position on contig", + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tid), ((PyObject *)__pyx_kp_s_136)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pos), ((PyObject *)__pyx_kp_s_137)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mtid), ((PyObject *)__pyx_kp_s_138)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mpos), ((PyObject *)__pyx_kp_s_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__isize), ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__flag), ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_cigar), ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__cigar), ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bin), ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qname), ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qname), ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_qseq), ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__qseq), ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__bqual), ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__l_aux), ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__m_data), ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__data_len), ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_field_names)); + __pyx_v_field_names = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2673 + * "data_len": "Current data length", + * } + * fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag", # <<<<<<<<<<<<<< + * "n_cigar", "cigar", "qual", "bin", "l_qname", "qname", + * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"] + */ + __pyx_t_1 = PyList_New(18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tid)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tid)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tid)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mtid)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__mtid)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mtid)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mpos)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__mpos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mpos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__isize)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__isize)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isize)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__flag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_cigar)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__n_cigar)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_cigar)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__cigar)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__cigar)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cigar)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__qual)); + PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__qual)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bin)); + PyList_SET_ITEM(__pyx_t_1, 9, ((PyObject *)__pyx_n_s__bin)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qname)); + PyList_SET_ITEM(__pyx_t_1, 10, ((PyObject *)__pyx_n_s__l_qname)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qname)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__qname)); + PyList_SET_ITEM(__pyx_t_1, 11, ((PyObject *)__pyx_n_s__qname)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qname)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l_qseq)); + PyList_SET_ITEM(__pyx_t_1, 12, ((PyObject *)__pyx_n_s__l_qseq)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_qseq)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__qseq)); + PyList_SET_ITEM(__pyx_t_1, 13, ((PyObject *)__pyx_n_s__qseq)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qseq)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bqual)); + PyList_SET_ITEM(__pyx_t_1, 14, ((PyObject *)__pyx_n_s__bqual)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bqual)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l_aux)); + PyList_SET_ITEM(__pyx_t_1, 15, ((PyObject *)__pyx_n_s__l_aux)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l_aux)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m_data)); + PyList_SET_ITEM(__pyx_t_1, 16, ((PyObject *)__pyx_n_s__m_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__data_len)); + PyList_SET_ITEM(__pyx_t_1, 17, ((PyObject *)__pyx_n_s__data_len)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data_len)); + __Pyx_DECREF(((PyObject *)__pyx_v_fields_names_in_order)); + __pyx_v_fields_names_in_order = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2677 + * "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"] + * + * for f in fields_names_in_order: # <<<<<<<<<<<<<< + * if not f in self.__dict__: + * continue + */ + if (unlikely(__pyx_v_fields_names_in_order == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_fields_names_in_order); __Pyx_INCREF(__pyx_t_1); + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2678 + * + * for f in fields_names_in_order: + * if not f in self.__dict__: # <<<<<<<<<<<<<< + * continue + * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_v_f))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = (!__pyx_t_4); + if (__pyx_t_5) { + + /* "csamtools.pyx":2679 + * for f in fields_names_in_order: + * if not f in self.__dict__: + * continue # <<<<<<<<<<<<<< + * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) + * + */ + goto __pyx_L5_continue; + goto __pyx_L7; + } + __pyx_L7:; + + /* "csamtools.pyx":2680 + * if not f in self.__dict__: + * continue + * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) # <<<<<<<<<<<<<< + * + * for f in self.__dict__: + */ + if (unlikely(__pyx_v_ret_string == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_field_names), __pyx_v_f); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_kp_s_155), __pyx_v_f); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_156)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_3 = 0; + __pyx_t_7 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_9)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_L5_continue:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2682 + * ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) + * + * for f in self.__dict__: # <<<<<<<<<<<<<< + * if not f in field_names: + * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = 0; __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_2 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2683 + * + * for f in self.__dict__: + * if not f in field_names: # <<<<<<<<<<<<<< + * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) + * return ret_string + */ + if (unlikely(__pyx_v_field_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = ((PyDict_Contains(((PyObject *)__pyx_v_field_names), __pyx_v_f))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (!__pyx_t_5); + if (__pyx_t_4) { + + /* "csamtools.pyx":2684 + * for f in self.__dict__: + * if not f in field_names: + * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) # <<<<<<<<<<<<<< + * return ret_string + * + */ + if (unlikely(__pyx_v_ret_string == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getattribute__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12)); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_154), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_10 = PyList_Append(__pyx_v_ret_string, ((PyObject *)__pyx_t_7)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "csamtools.pyx":2685 + * if not f in field_names: + * ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) + * return ret_string # <<<<<<<<<<<<<< + * + * cdef class PileupProxy: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_ret_string)); + __pyx_r = ((PyObject *)__pyx_v_ret_string); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("csamtools.AlignedRead.fancy_str"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ret_string); + __Pyx_DECREF(__pyx_v_field_names); + __Pyx_DECREF(__pyx_v_fields_names_in_order); + __Pyx_DECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2709 + * cdef int n_pu + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise TypeError("This class cannot be instantiated from Python") + * + */ + +static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_11PileupProxy___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 2709); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + + /* "csamtools.pyx":2710 + * + * def __init__(self): + * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_158), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupProxy.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2712 + * raise TypeError("This class cannot be instantiated from Python") + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" +\ + */ + +static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11PileupProxy_1__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__str__"); + __Pyx_TraceCall("__str__", __pyx_f[0], 2712); + + /* "csamtools.pyx":2713 + * + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<< + * "\n" +\ + * "\n".join( map(str, self.pileups) ) + */ + __Pyx_XDECREF(__pyx_r); + + /* "csamtools.pyx":2714 + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" +\ # <<<<<<<<<<<<<< + * "\n".join( map(str, self.pileups) ) + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "csamtools.pyx":2713 + * + * def __str__(self): + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ # <<<<<<<<<<<<<< + * "\n" +\ + * "\n".join( map(str, self.pileups) ) + */ + __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "csamtools.pyx":2715 + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" +\ + * "\n".join( map(str, self.pileups) ) # <<<<<<<<<<<<<< + * + * property tid: + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pileups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("csamtools.PileupProxy.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2719 + * property tid: + * '''the chromosome ID as is defined in the header''' + * def __get__(self): return self.tid # <<<<<<<<<<<<<< + * + * property n: + */ + +static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11PileupProxy_3tid___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2719); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupProxy.tid.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2723 + * property n: + * '''number of reads mapping to this column.''' + * def __get__(self): return self.n_pu # <<<<<<<<<<<<<< + * def __set__(self, n): self.n_pu = n + * + */ + +static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11PileupProxy_1n___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2723); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupProxy.n.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2724 + * '''number of reads mapping to this column.''' + * def __get__(self): return self.n_pu + * def __set__(self, n): self.n_pu = n # <<<<<<<<<<<<<< + * + * property pos: + */ + +static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/ +static int __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) { + int __pyx_r; + int __pyx_t_1; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__set__"); + __Pyx_TraceCall("__set__", __pyx_f[0], 2724); + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_n); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu = __pyx_t_1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("csamtools.PileupProxy.n.__set__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2727 + * + * property pos: + * def __get__(self): return self.pos # <<<<<<<<<<<<<< + * + * property pileups: + */ + +static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11PileupProxy_3pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2727); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupProxy.pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2731 + * property pileups: + * '''list of reads (:class:`pysam.PileupRead`) aligned to this column''' + * def __get__(self): # <<<<<<<<<<<<<< + * cdef int x + * pileups = [] + */ + +static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_11PileupProxy_7pileups___get__(PyObject *__pyx_v_self) { + int __pyx_v_x; + PyObject *__pyx_v_pileups; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2731); + __pyx_v_pileups = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2733 + * def __get__(self): + * cdef int x + * pileups = [] # <<<<<<<<<<<<<< + * # warning: there could be problems if self.n and self.buf are + * # out of sync. + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_pileups)); + __pyx_v_pileups = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2736 + * # warning: there could be problems if self.n and self.buf are + * # out of sync. + * for x from 0 <= x < self.n_pu: # <<<<<<<<<<<<<< + * pileups.append( makePileupRead( &(self.plp[x])) ) + * return pileups + */ + __pyx_t_2 = ((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->n_pu; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) { + + /* "csamtools.pyx":2737 + * # out of sync. + * for x from 0 <= x < self.n_pu: + * pileups.append( makePileupRead( &(self.plp[x])) ) # <<<<<<<<<<<<<< + * return pileups + * + */ + if (unlikely(__pyx_v_pileups == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __pyx_f_9csamtools_makePileupRead((&(((struct __pyx_obj_9csamtools_PileupProxy *)__pyx_v_self)->plp[__pyx_v_x]))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_Append(__pyx_v_pileups, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "csamtools.pyx":2738 + * for x from 0 <= x < self.n_pu: + * pileups.append( makePileupRead( &(self.plp[x])) ) + * return pileups # <<<<<<<<<<<<<< + * + * cdef class PileupRead: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_pileups)); + __pyx_r = ((PyObject *)__pyx_v_pileups); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupProxy.pileups.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_pileups); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2753 + * uint32_t _is_tail + * + * def __init__(self): # <<<<<<<<<<<<<< + * raise TypeError("This class cannot be instantiated from Python") + * + */ + +static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_10PileupRead___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 2753); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + + /* "csamtools.pyx":2754 + * + * def __init__(self): + * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_159), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2756 + * raise TypeError("This class cannot be instantiated from Python") + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) ) + * + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_1__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__str__"); + __Pyx_TraceCall("__str__", __pyx_f[0], 2756); + + /* "csamtools.pyx":2757 + * + * def __str__(self): + * return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) ) # <<<<<<<<<<<<<< + * + * property alignment: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alignment); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__indel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__level); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_del); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_head); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_tail); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("csamtools.PileupRead.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2761 + * property alignment: + * """a :class:`pysam.AlignedRead` object of the aligned read""" + * def __get__(self): # <<<<<<<<<<<<<< + * return self._alignment + * property qpos: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_9alignment___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2761); + + /* "csamtools.pyx":2762 + * """a :class:`pysam.AlignedRead` object of the aligned read""" + * def __get__(self): + * return self._alignment # <<<<<<<<<<<<<< + * property qpos: + * """position of the read base at the pileup site, 0-based""" + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment)); + __pyx_r = ((PyObject *)((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_alignment); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2765 + * property qpos: + * """position of the read base at the pileup site, 0-based""" + * def __get__(self): # <<<<<<<<<<<<<< + * return self._qpos + * property indel: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_4qpos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2765); + + /* "csamtools.pyx":2766 + * """position of the read base at the pileup site, 0-based""" + * def __get__(self): + * return self._qpos # <<<<<<<<<<<<<< + * property indel: + * """indel length; 0 for no indel, positive for ins and negative for del""" + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_qpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.qpos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2769 + * property indel: + * """indel length; 0 for no indel, positive for ins and negative for del""" + * def __get__(self): # <<<<<<<<<<<<<< + * return self._indel + * property is_del: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_5indel___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2769); + + /* "csamtools.pyx":2770 + * """indel length; 0 for no indel, positive for ins and negative for del""" + * def __get__(self): + * return self._indel # <<<<<<<<<<<<<< + * property is_del: + * """1 iff the base on the padded read is a deletion""" + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_indel); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.indel.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2773 + * property is_del: + * """1 iff the base on the padded read is a deletion""" + * def __get__(self): # <<<<<<<<<<<<<< + * return self._is_del + * property is_head: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_6is_del___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2773); + + /* "csamtools.pyx":2774 + * """1 iff the base on the padded read is a deletion""" + * def __get__(self): + * return self._is_del # <<<<<<<<<<<<<< + * property is_head: + * def __get__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_del); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.is_del.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2776 + * return self._is_del + * property is_head: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._is_head + * property is_tail: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_head___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2776); + + /* "csamtools.pyx":2777 + * property is_head: + * def __get__(self): + * return self._is_head # <<<<<<<<<<<<<< + * property is_tail: + * def __get__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_head); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.is_head.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2779 + * return self._is_head + * property is_tail: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._is_tail + * property level: + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_7is_tail___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2779); + + /* "csamtools.pyx":2780 + * property is_tail: + * def __get__(self): + * return self._is_tail # <<<<<<<<<<<<<< + * property level: + * def __get__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_is_tail); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.is_tail.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2782 + * return self._is_tail + * property level: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._level + * + */ + +static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_10PileupRead_5level___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2782); + + /* "csamtools.pyx":2783 + * property level: + * def __get__(self): + * return self._level # <<<<<<<<<<<<<< + * + * class Outs: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_PileupRead *)__pyx_v_self)->_level); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.PileupRead.level.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2787 + * class Outs: + * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + * def __init__(self, id = 1): # <<<<<<<<<<<<<< + * self.streams = [] + * self.id = id + */ + +static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_4Outs___init__[] = "Outs.__init__(self, id=1)"; +static PyMethodDef __pyx_mdef_9csamtools_4Outs___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_9csamtools_4Outs___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs___init__)}; +static PyObject *__pyx_pf_9csamtools_4Outs___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_id = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__id,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 2787); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_int_1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_id = values[1]; + } else { + __pyx_v_id = ((PyObject *)__pyx_int_1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Outs.__init__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "csamtools.pyx":2788 + * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + * def __init__(self, id = 1): + * self.streams = [] # <<<<<<<<<<<<<< + * self.id = id + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__streams, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":2789 + * def __init__(self, id = 1): + * self.streams = [] + * self.id = id # <<<<<<<<<<<<<< + * + * def setdevice(self, filename): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__id, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.Outs.__init__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2791 + * self.id = id + * + * def setdevice(self, filename): # <<<<<<<<<<<<<< + * '''open an existing file, like "/dev/null"''' + * fd = os.open(filename, os.O_WRONLY) + */ + +static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_4Outs_1setdevice[] = "Outs.setdevice(self, filename)\nopen an existing file, like \"/dev/null\""; +static PyMethodDef __pyx_mdef_9csamtools_4Outs_1setdevice = {__Pyx_NAMESTR("setdevice"), (PyCFunction)__pyx_pf_9csamtools_4Outs_1setdevice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_1setdevice)}; +static PyObject *__pyx_pf_9csamtools_4Outs_1setdevice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_fd; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("setdevice"); + __Pyx_TraceCall("setdevice", __pyx_f[0], 2791); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setdevice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_filename = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setdevice", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Outs.setdevice"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2793 + * def setdevice(self, filename): + * '''open an existing file, like "/dev/null"''' + * fd = os.open(filename, os.O_WRONLY) # <<<<<<<<<<<<<< + * self.setfd(fd) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_fd); + __pyx_v_fd = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2794 + * '''open an existing file, like "/dev/null"''' + * fd = os.open(filename, os.O_WRONLY) + * self.setfd(fd) # <<<<<<<<<<<<<< + * + * def setfile(self, filename): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_fd); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fd); + __Pyx_GIVEREF(__pyx_v_fd); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Outs.setdevice"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_fd); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2796 + * self.setfd(fd) + * + * def setfile(self, filename): # <<<<<<<<<<<<<< + * '''open a new file.''' + * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); + */ + +static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_4Outs_2setfile[] = "Outs.setfile(self, filename)\nopen a new file."; +static PyMethodDef __pyx_mdef_9csamtools_4Outs_2setfile = {__Pyx_NAMESTR("setfile"), (PyCFunction)__pyx_pf_9csamtools_4Outs_2setfile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_2setfile)}; +static PyObject *__pyx_pf_9csamtools_4Outs_2setfile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_fd; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("setfile"); + __Pyx_TraceCall("setfile", __pyx_f[0], 2796); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_filename = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setfile", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Outs.setfile"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2798 + * def setfile(self, filename): + * '''open a new file.''' + * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); # <<<<<<<<<<<<<< + * self.setfd(fd) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_WRONLY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__O_CREAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0660); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0660); + __Pyx_GIVEREF(__pyx_int_0660); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_fd); + __pyx_v_fd = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2799 + * '''open a new file.''' + * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); + * self.setfd(fd) # <<<<<<<<<<<<<< + * + * def setfd(self, fd): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_fd); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fd); + __Pyx_GIVEREF(__pyx_v_fd); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.Outs.setfile"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_fd); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2801 + * self.setfd(fd) + * + * def setfd(self, fd): # <<<<<<<<<<<<<< + * ofd = os.dup(self.id) # Save old stream on new unit. + * self.streams.append(ofd) + */ + +static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools_4Outs_3setfd[] = "Outs.setfd(self, fd)"; +static PyMethodDef __pyx_mdef_9csamtools_4Outs_3setfd = {__Pyx_NAMESTR("setfd"), (PyCFunction)__pyx_pf_9csamtools_4Outs_3setfd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_3setfd)}; +static PyObject *__pyx_pf_9csamtools_4Outs_3setfd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_fd = 0; + PyObject *__pyx_v_ofd; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fd,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("setfd"); + __Pyx_TraceCall("setfd", __pyx_f[0], 2801); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fd); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_fd = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_fd = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setfd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.Outs.setfd"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_ofd = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2802 + * + * def setfd(self, fd): + * ofd = os.dup(self.id) # Save old stream on new unit. # <<<<<<<<<<<<<< + * self.streams.append(ofd) + * sys.stdout.flush() # Buffered data goes to old stream. + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ofd); + __pyx_v_ofd = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2803 + * def setfd(self, fd): + * ofd = os.dup(self.id) # Save old stream on new unit. + * self.streams.append(ofd) # <<<<<<<<<<<<<< + * sys.stdout.flush() # Buffered data goes to old stream. + * sys.stderr.flush() # Buffered data goes to old stream. + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_ofd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2804 + * ofd = os.dup(self.id) # Save old stream on new unit. + * self.streams.append(ofd) + * sys.stdout.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<< + * sys.stderr.flush() # Buffered data goes to old stream. + * os.dup2(fd, self.id) # Open unit 1 on new stream. + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2805 + * self.streams.append(ofd) + * sys.stdout.flush() # Buffered data goes to old stream. + * sys.stderr.flush() # Buffered data goes to old stream. # <<<<<<<<<<<<<< + * os.dup2(fd, self.id) # Open unit 1 on new stream. + * os.close(fd) # Close other unit (look out, caller.) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2806 + * sys.stdout.flush() # Buffered data goes to old stream. + * sys.stderr.flush() # Buffered data goes to old stream. + * os.dup2(fd, self.id) # Open unit 1 on new stream. # <<<<<<<<<<<<<< + * os.close(fd) # Close other unit (look out, caller.) + * + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dup2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_fd); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fd); + __Pyx_GIVEREF(__pyx_v_fd); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2807 + * sys.stderr.flush() # Buffered data goes to old stream. + * os.dup2(fd, self.id) # Open unit 1 on new stream. + * os.close(fd) # Close other unit (look out, caller.) # <<<<<<<<<<<<<< + * + * def restore(self): + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_fd); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fd); + __Pyx_GIVEREF(__pyx_v_fd); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.Outs.setfd"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ofd); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2809 + * os.close(fd) # Close other unit (look out, caller.) + * + * def restore(self): # <<<<<<<<<<<<<< + * '''restore previous output stream''' + * if self.streams: + */ + +static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_9csamtools_4Outs_4restore[] = "Outs.restore(self)\nrestore previous output stream"; +static PyMethodDef __pyx_mdef_9csamtools_4Outs_4restore = {__Pyx_NAMESTR("restore"), (PyCFunction)__pyx_pf_9csamtools_4Outs_4restore, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_4Outs_4restore)}; +static PyObject *__pyx_pf_9csamtools_4Outs_4restore(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("restore"); + __Pyx_TraceCall("restore", __pyx_f[0], 2809); + __pyx_self = __pyx_self; + + /* "csamtools.pyx":2811 + * def restore(self): + * '''restore previous output stream''' + * if self.streams: # <<<<<<<<<<<<<< + * # the following was not sufficient, hence flush both stderr and stdout + * # os.fsync( self.id ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "csamtools.pyx":2814 + * # the following was not sufficient, hence flush both stderr and stdout + * # os.fsync( self.id ) + * sys.stdout.flush() # <<<<<<<<<<<<<< + * sys.stderr.flush() + * os.dup2(self.streams[-1], self.id) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stdout); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2815 + * # os.fsync( self.id ) + * sys.stdout.flush() + * sys.stderr.flush() # <<<<<<<<<<<<<< + * os.dup2(self.streams[-1], self.id) + * os.close(self.streams[-1]) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stderr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2816 + * sys.stdout.flush() + * sys.stderr.flush() + * os.dup2(self.streams[-1], self.id) # <<<<<<<<<<<<<< + * os.close(self.streams[-1]) + * del self.streams[-1] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dup2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2817 + * sys.stderr.flush() + * os.dup2(self.streams[-1], self.id) + * os.close(self.streams[-1]) # <<<<<<<<<<<<<< + * del self.streams[-1] + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2818 + * os.dup2(self.streams[-1], self.id) + * os.close(self.streams[-1]) + * del self.streams[-1] # <<<<<<<<<<<<<< + * + * def _samtools_dispatch( method, + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__streams); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_DelItemInt(__pyx_t_3, -1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("csamtools.Outs.restore"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2820 + * del self.streams[-1] + * + * def _samtools_dispatch( method, # <<<<<<<<<<<<<< + * args = (), + * catch_stdout = True, + */ + +static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_9csamtools__samtools_dispatch[] = "_samtools_dispatch(method, args=(), catch_stdout=True, catch_stderr=False)\ncall ``method`` in samtools providing arguments in args.\n \n .. note:: \n This method redirects stdout and (optionally) stderr to capture it \n from samtools. If for some reason stdout/stderr disappears\n the reason might be in this method.\n\n .. note::\n The current implementation might only work on linux.\n \n .. note:: \n This method captures stdout and stderr using temporary files, \n which are then read into memory in their entirety. This method\n is slow and might cause large memory overhead. \n\n See http://bytes.com/topic/c/answers/487231-how-capture-stdout-temporarily\n on the topic of redirecting stderr/stdout.\n "; +static PyMethodDef __pyx_mdef_9csamtools__samtools_dispatch = {__Pyx_NAMESTR("_samtools_dispatch"), (PyCFunction)__pyx_pf_9csamtools__samtools_dispatch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools__samtools_dispatch)}; +static PyObject *__pyx_pf_9csamtools__samtools_dispatch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_method = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_catch_stdout = 0; + PyObject *__pyx_v_catch_stderr = 0; + PyObject *__pyx_v_stderr_h; + PyObject *__pyx_v_stderr_f; + PyObject *__pyx_v_stderr_save; + PyObject *__pyx_v_stdout_h; + PyObject *__pyx_v_stdout_f; + PyObject *__pyx_v_stdout_save; + char **__pyx_v_cargs; + int __pyx_v_i; + int __pyx_v_n; + int __pyx_v_retval; + PyObject *__pyx_v_out_stdout; + PyObject *__pyx_v_out_stderr; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + char *__pyx_t_8; + int __pyx_t_9; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__method,&__pyx_n_s__args,&__pyx_n_s__catch_stdout,&__pyx_n_s__catch_stderr,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("_samtools_dispatch"); + __Pyx_TraceCall("_samtools_dispatch", __pyx_f[0], 2820); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + + /* "csamtools.pyx":2821 + * + * def _samtools_dispatch( method, + * args = (), # <<<<<<<<<<<<<< + * catch_stdout = True, + * catch_stderr = False, + */ + values[1] = ((PyObject *)__pyx_empty_tuple); + values[2] = __pyx_k_160; + values[3] = __pyx_k_161; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__method); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__catch_stdout); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__catch_stderr); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_samtools_dispatch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_method = values[0]; + __pyx_v_args = values[1]; + __pyx_v_catch_stdout = values[2]; + __pyx_v_catch_stderr = values[3]; + } else { + __pyx_v_args = ((PyObject *)__pyx_empty_tuple); + __pyx_v_catch_stdout = __pyx_k_160; + __pyx_v_catch_stderr = __pyx_k_161; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_catch_stderr = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_catch_stdout = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_args = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_method = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_samtools_dispatch", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools._samtools_dispatch"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_args); + __pyx_v_stderr_h = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stderr_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stderr_save = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stdout_h = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stdout_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_stdout_save = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_out_stdout = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_out_stderr = Py_None; __Pyx_INCREF(Py_None); + + /* "csamtools.pyx":2848 + * + * # some special cases + * if method == "index": # <<<<<<<<<<<<<< + * if not os.path.exists( args[0] ): + * raise IOError( "No such file or directory: '%s'" % args[0] ) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__index), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "csamtools.pyx":2849 + * # some special cases + * if method == "index": + * if not os.path.exists( args[0] ): # <<<<<<<<<<<<<< + * raise IOError( "No such file or directory: '%s'" % args[0] ) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = (!__pyx_t_2); + if (__pyx_t_5) { + + /* "csamtools.pyx":2850 + * if method == "index": + * if not os.path.exists( args[0] ): + * raise IOError( "No such file or directory: '%s'" % args[0] ) # <<<<<<<<<<<<<< + * + * # redirect stderr and stdout to file + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_162), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "csamtools.pyx":2853 + * + * # redirect stderr and stdout to file + * if catch_stderr: # <<<<<<<<<<<<<< + * stderr_h, stderr_f = tempfile.mkstemp() + * stderr_save = Outs( sys.stderr.fileno() ) + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "csamtools.pyx":2854 + * # redirect stderr and stdout to file + * if catch_stderr: + * stderr_h, stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<< + * stderr_save = Outs( sys.stderr.fileno() ) + * stderr_save.setfd( stderr_h ) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_stderr_h); + __pyx_v_stderr_h = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_stderr_f); + __pyx_v_stderr_f = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_stderr_h); + __pyx_v_stderr_h = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_stderr_f); + __pyx_v_stderr_f = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "csamtools.pyx":2855 + * if catch_stderr: + * stderr_h, stderr_f = tempfile.mkstemp() + * stderr_save = Outs( sys.stderr.fileno() ) # <<<<<<<<<<<<<< + * stderr_save.setfd( stderr_h ) + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__fileno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_stderr_save); + __pyx_v_stderr_save = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2856 + * stderr_h, stderr_f = tempfile.mkstemp() + * stderr_save = Outs( sys.stderr.fileno() ) + * stderr_save.setfd( stderr_h ) # <<<<<<<<<<<<<< + * + * if catch_stdout: + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_stderr_h); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_h); + __Pyx_GIVEREF(__pyx_v_stderr_h); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "csamtools.pyx":2858 + * stderr_save.setfd( stderr_h ) + * + * if catch_stdout: # <<<<<<<<<<<<<< + * stdout_h, stdout_f = tempfile.mkstemp() + * stdout_save = Outs( sys.stdout.fileno() ) + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "csamtools.pyx":2859 + * + * if catch_stdout: + * stdout_h, stdout_f = tempfile.mkstemp() # <<<<<<<<<<<<<< + * stdout_save = Outs( sys.stdout.fileno() ) + * stdout_save.setfd( stdout_h ) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__tempfile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mkstemp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_stdout_h); + __pyx_v_stdout_h = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_stdout_f); + __pyx_v_stdout_f = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_stdout_h); + __pyx_v_stdout_h = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_stdout_f); + __pyx_v_stdout_f = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "csamtools.pyx":2860 + * if catch_stdout: + * stdout_h, stdout_f = tempfile.mkstemp() + * stdout_save = Outs( sys.stdout.fileno() ) # <<<<<<<<<<<<<< + * stdout_save.setfd( stdout_h ) + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Outs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__stdout); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fileno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_stdout_save); + __pyx_v_stdout_save = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2861 + * stdout_h, stdout_f = tempfile.mkstemp() + * stdout_save = Outs( sys.stdout.fileno() ) + * stdout_save.setfd( stdout_h ) # <<<<<<<<<<<<<< + * + * # patch for `samtools view` + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__setfd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_stdout_h); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_h); + __Pyx_GIVEREF(__pyx_v_stdout_h); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "csamtools.pyx":2866 + * # samtools `view` closes stdout, from which I can not + * # recover. Thus redirect output to file with -o option. + * if method == "view": # <<<<<<<<<<<<<< + * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") + * args = ( "-o", stdout_f ) + args + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__view), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "csamtools.pyx":2867 + * # recover. Thus redirect output to file with -o option. + * if method == "view": + * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<< + * args = ( "-o", stdout_f ) + args + * + */ + __pyx_t_5 = ((PySequence_Contains(__pyx_v_args, ((PyObject *)__pyx_kp_s_163)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_165), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "csamtools.pyx":2868 + * if method == "view": + * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") + * args = ( "-o", stdout_f ) + args # <<<<<<<<<<<<<< + * + * # do the function call to samtools + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_163)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_163)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_163)); + __Pyx_INCREF(__pyx_v_stdout_f); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_stdout_f); + __Pyx_GIVEREF(__pyx_v_stdout_f); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_v_args); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_args); + __pyx_v_args = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L9; + } + __pyx_L9:; + + /* "csamtools.pyx":2874 + * cdef int i, n, retval + * + * n = len(args) # <<<<<<<<<<<<<< + * # allocate two more for first (dummy) argument (contains command) + * cargs = calloc( n+2, sizeof( char *) ) + */ + __pyx_t_7 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_7; + + /* "csamtools.pyx":2876 + * n = len(args) + * # allocate two more for first (dummy) argument (contains command) + * cargs = calloc( n+2, sizeof( char *) ) # <<<<<<<<<<<<<< + * cargs[0] = "samtools" + * cargs[1] = method + */ + __pyx_v_cargs = ((char **)calloc((__pyx_v_n + 2), (sizeof(char *)))); + + /* "csamtools.pyx":2877 + * # allocate two more for first (dummy) argument (contains command) + * cargs = calloc( n+2, sizeof( char *) ) + * cargs[0] = "samtools" # <<<<<<<<<<<<<< + * cargs[1] = method + * for i from 0 <= i < n: cargs[i+2] = args[i] + */ + (__pyx_v_cargs[0]) = __pyx_k__samtools; + + /* "csamtools.pyx":2878 + * cargs = calloc( n+2, sizeof( char *) ) + * cargs[0] = "samtools" + * cargs[1] = method # <<<<<<<<<<<<<< + * for i from 0 <= i < n: cargs[i+2] = args[i] + * + */ + __pyx_t_8 = PyBytes_AsString(__pyx_v_method); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_cargs[1]) = __pyx_t_8; + + /* "csamtools.pyx":2879 + * cargs[0] = "samtools" + * cargs[1] = method + * for i from 0 <= i < n: cargs[i+2] = args[i] # <<<<<<<<<<<<<< + * + * retval = pysam_dispatch(n+2, cargs) + */ + __pyx_t_9 = __pyx_v_n; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) { + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + (__pyx_v_cargs[(__pyx_v_i + 2)]) = __pyx_t_8; + } + + /* "csamtools.pyx":2881 + * for i from 0 <= i < n: cargs[i+2] = args[i] + * + * retval = pysam_dispatch(n+2, cargs) # <<<<<<<<<<<<<< + * free( cargs ) + * + */ + __pyx_v_retval = pysam_dispatch((__pyx_v_n + 2), __pyx_v_cargs); + + /* "csamtools.pyx":2882 + * + * retval = pysam_dispatch(n+2, cargs) + * free( cargs ) # <<<<<<<<<<<<<< + * + * # restore stdout/stderr. This will also flush, so + */ + free(__pyx_v_cargs); + + /* "csamtools.pyx":2886 + * # restore stdout/stderr. This will also flush, so + * # needs to be before reading back the file contents + * if catch_stdout: # <<<<<<<<<<<<<< + * stdout_save.restore() + * out_stdout = open( stdout_f, "r").readlines() + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "csamtools.pyx":2887 + * # needs to be before reading back the file contents + * if catch_stdout: + * stdout_save.restore() # <<<<<<<<<<<<<< + * out_stdout = open( stdout_f, "r").readlines() + * os.remove( stdout_f ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_stdout_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "csamtools.pyx":2888 + * if catch_stdout: + * stdout_save.restore() + * out_stdout = open( stdout_f, "r").readlines() # <<<<<<<<<<<<<< + * os.remove( stdout_f ) + * else: + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_stdout_f); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_stdout_f); + __Pyx_GIVEREF(__pyx_v_stdout_f); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__readlines); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_out_stdout); + __pyx_v_out_stdout = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":2889 + * stdout_save.restore() + * out_stdout = open( stdout_f, "r").readlines() + * os.remove( stdout_f ) # <<<<<<<<<<<<<< + * else: + * out_stdout = [] + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__remove); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_stdout_f); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stdout_f); + __Pyx_GIVEREF(__pyx_v_stdout_f); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L14; + } + /*else*/ { + + /* "csamtools.pyx":2891 + * os.remove( stdout_f ) + * else: + * out_stdout = [] # <<<<<<<<<<<<<< + * + * if catch_stderr: + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_v_out_stdout); + __pyx_v_out_stdout = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L14:; + + /* "csamtools.pyx":2893 + * out_stdout = [] + * + * if catch_stderr: # <<<<<<<<<<<<<< + * stderr_save.restore() + * out_stderr = open( stderr_f, "r").readlines() + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stderr); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + + /* "csamtools.pyx":2894 + * + * if catch_stderr: + * stderr_save.restore() # <<<<<<<<<<<<<< + * out_stderr = open( stderr_f, "r").readlines() + * os.remove( stderr_f ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_stderr_save, __pyx_n_s__restore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":2895 + * if catch_stderr: + * stderr_save.restore() + * out_stderr = open( stderr_f, "r").readlines() # <<<<<<<<<<<<<< + * os.remove( stderr_f ) + * else: + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_stderr_f); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stderr_f); + __Pyx_GIVEREF(__pyx_v_stderr_f); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__readlines); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_out_stderr); + __pyx_v_out_stderr = __pyx_t_1; + __pyx_t_1 = 0; + + /* "csamtools.pyx":2896 + * stderr_save.restore() + * out_stderr = open( stderr_f, "r").readlines() + * os.remove( stderr_f ) # <<<<<<<<<<<<<< + * else: + * out_stderr = [] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_stderr_f); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stderr_f); + __Pyx_GIVEREF(__pyx_v_stderr_f); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L15; + } + /*else*/ { + + /* "csamtools.pyx":2898 + * os.remove( stderr_f ) + * else: + * out_stderr = [] # <<<<<<<<<<<<<< + * + * return retval, out_stderr, out_stdout + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_v_out_stderr); + __pyx_v_out_stderr = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + } + __pyx_L15:; + + /* "csamtools.pyx":2900 + * out_stderr = [] + * + * return retval, out_stderr, out_stdout # <<<<<<<<<<<<<< + * + * cdef class SNPCall: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyInt_FromLong(__pyx_v_retval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_out_stderr); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_out_stderr); + __Pyx_GIVEREF(__pyx_v_out_stderr); + __Pyx_INCREF(__pyx_v_out_stdout); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_out_stdout); + __Pyx_GIVEREF(__pyx_v_out_stdout); + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("csamtools._samtools_dispatch"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_stderr_h); + __Pyx_DECREF(__pyx_v_stderr_f); + __Pyx_DECREF(__pyx_v_stderr_save); + __Pyx_DECREF(__pyx_v_stdout_h); + __Pyx_DECREF(__pyx_v_stdout_f); + __Pyx_DECREF(__pyx_v_stdout_save); + __Pyx_DECREF(__pyx_v_out_stdout); + __Pyx_DECREF(__pyx_v_out_stderr); + __Pyx_DECREF(__pyx_v_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2915 + * property tid: + * '''the chromosome ID as is defined in the header''' + * def __get__(self): # <<<<<<<<<<<<<< + * return self._tid + * + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_3tid___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2915); + + /* "csamtools.pyx":2916 + * '''the chromosome ID as is defined in the header''' + * def __get__(self): + * return self._tid # <<<<<<<<<<<<<< + * + * property pos: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.tid.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2920 + * property pos: + * '''nucleotide position of SNP.''' + * def __get__(self): return self._pos # <<<<<<<<<<<<<< + * + * property reference_base: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_3pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2920); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2924 + * property reference_base: + * '''reference base at pos. ``N`` if no reference sequence supplied.''' + * def __get__(self): return PyString_FromStringAndSize( &self._reference_base, 1 ) # <<<<<<<<<<<<<< + * + * property genotype: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_14reference_base___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2924); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_reference_base), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.reference_base.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2928 + * property genotype: + * '''the genotype called.''' + * def __get__(self): return PyString_FromStringAndSize( &self._genotype, 1 ) # <<<<<<<<<<<<<< + * + * property consensus_quality: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_8genotype___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2928); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyString_FromStringAndSize((&((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_genotype), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2928; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.genotype.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2932 + * property consensus_quality: + * '''the genotype quality (Phred-scaled).''' + * def __get__(self): return self._consensus_quality # <<<<<<<<<<<<<< + * + * property snp_quality: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2932); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_consensus_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.consensus_quality.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2936 + * property snp_quality: + * '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.''' + * def __get__(self): return self._snp_quality # <<<<<<<<<<<<<< + * + * property mapping_quality: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2936); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_snp_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.snp_quality.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2940 + * property mapping_quality: + * '''the root mean square (rms) of the mapping quality of all reads involved in the call.''' + * def __get__(self): return self._rms_mapping_quality # <<<<<<<<<<<<<< + * + * property coverage: + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2940); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_rms_mapping_quality); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2940; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.mapping_quality.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2944 + * property coverage: + * '''coverage or read depth - the number of reads involved in the call.''' + * def __get__(self): return self._coverage # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall_8coverage___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__get__"); + __Pyx_TraceCall("__get__", __pyx_f[0], 2944); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_9csamtools_SNPCall *)__pyx_v_self)->_coverage); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("csamtools.SNPCall.coverage.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":2946 + * def __get__(self): return self._coverage + * + * def __str__(self): # <<<<<<<<<<<<<< + * + * return "\t".join( map(str, ( + */ + +static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_9csamtools_7SNPCall___str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__str__"); + __Pyx_TraceCall("__str__", __pyx_f[0], 2946); + + /* "csamtools.pyx":2948 + * def __str__(self): + * + * return "\t".join( map(str, ( # <<<<<<<<<<<<<< + * self.tid, + * self.pos, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "csamtools.pyx":2949 + * + * return "\t".join( map(str, ( + * self.tid, # <<<<<<<<<<<<<< + * self.pos, + * self.reference_base, + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "csamtools.pyx":2950 + * return "\t".join( map(str, ( + * self.tid, + * self.pos, # <<<<<<<<<<<<<< + * self.reference_base, + * self.genotype, + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "csamtools.pyx":2951 + * self.tid, + * self.pos, + * self.reference_base, # <<<<<<<<<<<<<< + * self.genotype, + * self.consensus_quality, + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__reference_base); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + + /* "csamtools.pyx":2952 + * self.pos, + * self.reference_base, + * self.genotype, # <<<<<<<<<<<<<< + * self.consensus_quality, + * self.snp_quality, + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__genotype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "csamtools.pyx":2953 + * self.reference_base, + * self.genotype, + * self.consensus_quality, # <<<<<<<<<<<<<< + * self.snp_quality, + * self.mapping_quality, + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__consensus_quality); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2953; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "csamtools.pyx":2954 + * self.genotype, + * self.consensus_quality, + * self.snp_quality, # <<<<<<<<<<<<<< + * self.mapping_quality, + * self.coverage ) ) ) + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__snp_quality); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "csamtools.pyx":2955 + * self.consensus_quality, + * self.snp_quality, + * self.mapping_quality, # <<<<<<<<<<<<<< + * self.coverage ) ) ) + * + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mapping_quality); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "csamtools.pyx":2956 + * self.snp_quality, + * self.mapping_quality, + * self.coverage ) ) ) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__coverage); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_t_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_r = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("csamtools.SNPCall.__str__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":3472 + * cdef int owns_samfile + * + * def __init__(self, Samfile samfile, int reopen = True ): # <<<<<<<<<<<<<< + * self.samfile = samfile + * + */ + +static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_9csamtools_12IndexedReads___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_9csamtools_Samfile *__pyx_v_samfile = 0; + int __pyx_v_reopen; + PyObject *__pyx_v_mode; + PyObject *__pyx_v_store; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + char *__pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__samfile,&__pyx_n_s__reopen,0}; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__init__"); + __Pyx_TraceCall("__init__", __pyx_f[0], 3472); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reopen); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)values[0]); + if (values[1]) { + __pyx_v_reopen = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_reopen = ((int)1); + } + } else { + __pyx_v_reopen = ((int)1); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_reopen = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_reopen == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_samfile = ((struct __pyx_obj_9csamtools_Samfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("csamtools.IndexedReads.__init__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_v_mode = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_store = Py_None; __Pyx_INCREF(Py_None); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samfile), __pyx_ptype_9csamtools_Samfile, 1, "samfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":3473 + * + * def __init__(self, Samfile samfile, int reopen = True ): + * self.samfile = samfile # <<<<<<<<<<<<<< + * + * if samfile.isbam: mode = "rb" + */ + __Pyx_INCREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_samfile)); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile)); + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile = __pyx_v_samfile; + + /* "csamtools.pyx":3475 + * self.samfile = samfile + * + * if samfile.isbam: mode = "rb" # <<<<<<<<<<<<<< + * else: mode = "r" + * + */ + if (__pyx_v_samfile->isbam) { + __Pyx_INCREF(((PyObject *)__pyx_n_s__rb)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__rb); + goto __pyx_L6; + } + /*else*/ { + + /* "csamtools.pyx":3476 + * + * if samfile.isbam: mode = "rb" + * else: mode = "r" # <<<<<<<<<<<<<< + * + * # reopen the file - note that this makes the iterator + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + __Pyx_DECREF(__pyx_v_mode); + __pyx_v_mode = ((PyObject *)__pyx_n_s__r); + } + __pyx_L6:; + + /* "csamtools.pyx":3480 + * # reopen the file - note that this makes the iterator + * # slow and causes pileup to slow down significantly. + * if reopen: # <<<<<<<<<<<<<< + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + */ + if (__pyx_v_reopen) { + + /* "csamtools.pyx":3481 + * # slow and causes pileup to slow down significantly. + * if reopen: + * store = StderrStore() # <<<<<<<<<<<<<< + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStore); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_store); + __pyx_v_store = __pyx_t_2; + __pyx_t_2 = 0; + + /* "csamtools.pyx":3482 + * if reopen: + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) # <<<<<<<<<<<<<< + * store.release() + * assert self.fp != NULL + */ + __pyx_t_3 = PyBytes_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = samopen(__pyx_v_samfile->_filename, __pyx_t_3, NULL); + + /* "csamtools.pyx":3483 + * store = StderrStore() + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() # <<<<<<<<<<<<<< + * assert self.fp != NULL + * self.owns_samfile = True + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_store, __pyx_n_s__release); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":3484 + * self.fp = samopen( samfile._filename, mode, NULL ) + * store.release() + * assert self.fp != NULL # <<<<<<<<<<<<<< + * self.owns_samfile = True + * else: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp != NULL))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "csamtools.pyx":3485 + * store.release() + * assert self.fp != NULL + * self.owns_samfile = True # <<<<<<<<<<<<<< + * else: + * self.fp = samfile.samfile + */ + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 1; + goto __pyx_L7; + } + /*else*/ { + + /* "csamtools.pyx":3487 + * self.owns_samfile = True + * else: + * self.fp = samfile.samfile # <<<<<<<<<<<<<< + * self.owns_samfile = False + * + */ + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp = __pyx_v_samfile->samfile; + + /* "csamtools.pyx":3488 + * else: + * self.fp = samfile.samfile + * self.owns_samfile = False # <<<<<<<<<<<<<< + * + * assert samfile.isbam, "can only IndexReads on bam files" + */ + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile = 0; + } + __pyx_L7:; + + /* "csamtools.pyx":3490 + * self.owns_samfile = False + * + * assert samfile.isbam, "can only IndexReads on bam files" # <<<<<<<<<<<<<< + * + * def build( self ): + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + if (unlikely(!__pyx_v_samfile->isbam)) { + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_167)); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("csamtools.IndexedReads.__init__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_mode); + __Pyx_DECREF(__pyx_v_store); + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":3492 + * assert samfile.isbam, "can only IndexReads on bam files" + * + * def build( self ): # <<<<<<<<<<<<<< + * '''build index.''' + * + */ + +static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_9csamtools_12IndexedReads_1build[] = "IndexedReads.build(self)\nbuild index."; +static PyObject *__pyx_pf_9csamtools_12IndexedReads_1build(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + int __pyx_v_ret; + bam1_t *__pyx_v_b; + uint64_t __pyx_v_pos; + char *__pyx_v_qname; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("build"); + __Pyx_TraceCall("build", __pyx_f[0], 3492); + + /* "csamtools.pyx":3495 + * '''build index.''' + * + * self.index = collections.defaultdict( list ) # <<<<<<<<<<<<<< + * + * # this method will start indexing from the current file position + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyList_Type)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyList_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyList_Type)))); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index); + __Pyx_DECREF(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index); + ((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index = __pyx_t_3; + __pyx_t_3 = 0; + + /* "csamtools.pyx":3499 + * # this method will start indexing from the current file position + * # if you decide + * cdef int ret = 1 # <<<<<<<<<<<<<< + * cdef bam1_t * b = calloc(1, sizeof( bam1_t) ) + * + */ + __pyx_v_ret = 1; + + /* "csamtools.pyx":3500 + * # if you decide + * cdef int ret = 1 + * cdef bam1_t * b = calloc(1, sizeof( bam1_t) ) # <<<<<<<<<<<<<< + * + * cdef uint64_t pos + */ + __pyx_v_b = ((bam1_t *)calloc(1, (sizeof(bam1_t)))); + + /* "csamtools.pyx":3504 + * cdef uint64_t pos + * + * while ret > 0: # <<<<<<<<<<<<<< + * pos = bam_tell( self.fp.x.bam ) + * ret = samread( self.fp, b) + */ + while (1) { + __pyx_t_4 = (__pyx_v_ret > 0); + if (!__pyx_t_4) break; + + /* "csamtools.pyx":3505 + * + * while ret > 0: + * pos = bam_tell( self.fp.x.bam ) # <<<<<<<<<<<<<< + * ret = samread( self.fp, b) + * if ret > 0: + */ + __pyx_v_pos = bam_tell(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp->x.bam); + + /* "csamtools.pyx":3506 + * while ret > 0: + * pos = bam_tell( self.fp.x.bam ) + * ret = samread( self.fp, b) # <<<<<<<<<<<<<< + * if ret > 0: + * qname = bam1_qname( b ) + */ + __pyx_v_ret = samread(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp, __pyx_v_b); + + /* "csamtools.pyx":3507 + * pos = bam_tell( self.fp.x.bam ) + * ret = samread( self.fp, b) + * if ret > 0: # <<<<<<<<<<<<<< + * qname = bam1_qname( b ) + * self.index[qname].append( pos ) + */ + __pyx_t_4 = (__pyx_v_ret > 0); + if (__pyx_t_4) { + + /* "csamtools.pyx":3508 + * ret = samread( self.fp, b) + * if ret > 0: + * qname = bam1_qname( b ) # <<<<<<<<<<<<<< + * self.index[qname].append( pos ) + * + */ + __pyx_v_qname = bam1_qname(__pyx_v_b); + + /* "csamtools.pyx":3509 + * if ret > 0: + * qname = bam1_qname( b ) + * self.index[qname].append( pos ) # <<<<<<<<<<<<<< + * + * bam_destroy1( b ) + */ + __pyx_t_3 = PyBytes_FromString(__pyx_v_qname); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_to_py_uint64_t(__pyx_v_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + } + + /* "csamtools.pyx":3511 + * self.index[qname].append( pos ) + * + * bam_destroy1( b ) # <<<<<<<<<<<<<< + * + * def find( self, qname ): + */ + bam_destroy1(__pyx_v_b); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("csamtools.IndexedReads.build"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":3513 + * bam_destroy1( b ) + * + * def find( self, qname ): # <<<<<<<<<<<<<< + * if qname in self.index: + * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) + */ + +static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname); /*proto*/ +static char __pyx_doc_9csamtools_12IndexedReads_2find[] = "IndexedReads.find(self, qname)"; +static PyObject *__pyx_pf_9csamtools_12IndexedReads_2find(PyObject *__pyx_v_self, PyObject *__pyx_v_qname) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("find"); + __Pyx_TraceCall("find", __pyx_f[0], 3513); + + /* "csamtools.pyx":3514 + * + * def find( self, qname ): + * if qname in self.index: # <<<<<<<<<<<<<< + * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) + * else: + */ + __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "csamtools.pyx":3515 + * def find( self, qname ): + * if qname in self.index: + * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) # <<<<<<<<<<<<<< + * else: + * raise KeyError( "read %s not found" % qname ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetItem(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->index, __pyx_v_qname); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile)); + __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->samfile)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__reopen), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_9csamtools_IteratorRowSelection)), ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "csamtools.pyx":3517 + * return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) + * else: + * raise KeyError( "read %s not found" % qname ) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_168), __pyx_v_qname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("csamtools.IndexedReads.find"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_TraceReturn(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "csamtools.pyx":3519 + * raise KeyError( "read %s not found" % qname ) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.owns_samfile: samclose( self.fp ) + * + */ + +static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_TraceDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_TraceCall("__dealloc__", __pyx_f[0], 3519); + + /* "csamtools.pyx":3520 + * + * def __dealloc__(self): + * if self.owns_samfile: samclose( self.fp ) # <<<<<<<<<<<<<< + * + * __all__ = ["Samfile", + */ + if (((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->owns_samfile) { + samclose(((struct __pyx_obj_9csamtools_IndexedReads *)__pyx_v_self)->fp); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_TraceReturn(Py_None); + __Pyx_RefNannyFinishContext(); +} + +static PyObject *__pyx_tp_new_9csamtools_AlignedRead(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_9csamtools_AlignedRead(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_11AlignedRead_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qname(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5qname___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_qname(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5qname_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_cigar(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5cigar___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_cigar(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5cigar_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_seq(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_3seq___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_seq(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_3seq_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qual(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4qual___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_qual(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4qual_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_query(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5query___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qqual(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5qqual___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qstart(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_6qstart___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qend(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4qend___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_qlen(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4qlen___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tags(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4tags___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_tags(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4tags_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_flag(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4flag___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_flag(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4flag_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rname(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5rname___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_rname(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5rname_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tid(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_3tid___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_tid(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_3tid_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pos(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_3pos___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_pos(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_3pos_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_bin(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_3bin___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_bin(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_3bin_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rlen(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4rlen___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_aend(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4aend___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_alen(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4alen___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mapq(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4mapq___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_mapq(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4mapq_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mrnm(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4mrnm___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_mrnm(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4mrnm_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_rnext(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5rnext___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_rnext(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5rnext_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mpos(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4mpos___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_mpos(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4mpos_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_pnext(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5pnext___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_pnext(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5pnext_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_isize(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_5isize___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_isize(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_5isize_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_tlen(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_4tlen___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_tlen(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_4tlen_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_paired(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_9is_paired___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_paired(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_9is_paired_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_14is_proper_pair_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_unmapped(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_11is_unmapped_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_16mate_is_unmapped_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_10is_reverse___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_reverse(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_10is_reverse_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_15mate_is_reverse_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read1(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_8is_read1___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_read1(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_8is_read1_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_read2(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_8is_read2___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_read2(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_8is_read2_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_12is_secondary___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_secondary(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_12is_secondary_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_qcfail(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_9is_qcfail_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate___get__(o); +} + +static int __pyx_setprop_9csamtools_11AlignedRead_is_duplicate(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11AlignedRead_12is_duplicate_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11AlignedRead_positions(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11AlignedRead_9positions___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_AlignedRead[] = { + {__Pyx_NAMESTR("compare"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_3compare, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_3compare)}, + {__Pyx_NAMESTR("overlap"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_5overlap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_5overlap)}, + {__Pyx_NAMESTR("opt"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_6opt, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_6opt)}, + {__Pyx_NAMESTR("fancy_str"), (PyCFunction)__pyx_pf_9csamtools_11AlignedRead_7fancy_str, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_11AlignedRead_7fancy_str)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_AlignedRead[] = { + {(char *)"qname", __pyx_getprop_9csamtools_11AlignedRead_qname, __pyx_setprop_9csamtools_11AlignedRead_qname, __Pyx_DOCSTR(__pyx_k_169), 0}, + {(char *)"cigar", __pyx_getprop_9csamtools_11AlignedRead_cigar, __pyx_setprop_9csamtools_11AlignedRead_cigar, __Pyx_DOCSTR(__pyx_k_170), 0}, + {(char *)"seq", __pyx_getprop_9csamtools_11AlignedRead_seq, __pyx_setprop_9csamtools_11AlignedRead_seq, __Pyx_DOCSTR(__pyx_k_171), 0}, + {(char *)"qual", __pyx_getprop_9csamtools_11AlignedRead_qual, __pyx_setprop_9csamtools_11AlignedRead_qual, __Pyx_DOCSTR(__pyx_k_172), 0}, + {(char *)"query", __pyx_getprop_9csamtools_11AlignedRead_query, 0, __Pyx_DOCSTR(__pyx_k_173), 0}, + {(char *)"qqual", __pyx_getprop_9csamtools_11AlignedRead_qqual, 0, __Pyx_DOCSTR(__pyx_k_174), 0}, + {(char *)"qstart", __pyx_getprop_9csamtools_11AlignedRead_qstart, 0, __Pyx_DOCSTR(__pyx_k_175), 0}, + {(char *)"qend", __pyx_getprop_9csamtools_11AlignedRead_qend, 0, __Pyx_DOCSTR(__pyx_k_176), 0}, + {(char *)"qlen", __pyx_getprop_9csamtools_11AlignedRead_qlen, 0, __Pyx_DOCSTR(__pyx_k_177), 0}, + {(char *)"tags", __pyx_getprop_9csamtools_11AlignedRead_tags, __pyx_setprop_9csamtools_11AlignedRead_tags, __Pyx_DOCSTR(__pyx_k_178), 0}, + {(char *)"flag", __pyx_getprop_9csamtools_11AlignedRead_flag, __pyx_setprop_9csamtools_11AlignedRead_flag, __Pyx_DOCSTR(__pyx_k_179), 0}, + {(char *)"rname", __pyx_getprop_9csamtools_11AlignedRead_rname, __pyx_setprop_9csamtools_11AlignedRead_rname, __Pyx_DOCSTR(__pyx_k_180), 0}, + {(char *)"tid", __pyx_getprop_9csamtools_11AlignedRead_tid, __pyx_setprop_9csamtools_11AlignedRead_tid, __Pyx_DOCSTR(__pyx_k_181), 0}, + {(char *)"pos", __pyx_getprop_9csamtools_11AlignedRead_pos, __pyx_setprop_9csamtools_11AlignedRead_pos, __Pyx_DOCSTR(__pyx_k_182), 0}, + {(char *)"bin", __pyx_getprop_9csamtools_11AlignedRead_bin, __pyx_setprop_9csamtools_11AlignedRead_bin, __Pyx_DOCSTR(__pyx_k_183), 0}, + {(char *)"rlen", __pyx_getprop_9csamtools_11AlignedRead_rlen, 0, __Pyx_DOCSTR(__pyx_k_184), 0}, + {(char *)"aend", __pyx_getprop_9csamtools_11AlignedRead_aend, 0, __Pyx_DOCSTR(__pyx_k_185), 0}, + {(char *)"alen", __pyx_getprop_9csamtools_11AlignedRead_alen, 0, __Pyx_DOCSTR(__pyx_k_186), 0}, + {(char *)"mapq", __pyx_getprop_9csamtools_11AlignedRead_mapq, __pyx_setprop_9csamtools_11AlignedRead_mapq, __Pyx_DOCSTR(__pyx_k_187), 0}, + {(char *)"mrnm", __pyx_getprop_9csamtools_11AlignedRead_mrnm, __pyx_setprop_9csamtools_11AlignedRead_mrnm, __Pyx_DOCSTR(__pyx_k_188), 0}, + {(char *)"rnext", __pyx_getprop_9csamtools_11AlignedRead_rnext, __pyx_setprop_9csamtools_11AlignedRead_rnext, __Pyx_DOCSTR(__pyx_k_189), 0}, + {(char *)"mpos", __pyx_getprop_9csamtools_11AlignedRead_mpos, __pyx_setprop_9csamtools_11AlignedRead_mpos, __Pyx_DOCSTR(__pyx_k_190), 0}, + {(char *)"pnext", __pyx_getprop_9csamtools_11AlignedRead_pnext, __pyx_setprop_9csamtools_11AlignedRead_pnext, __Pyx_DOCSTR(__pyx_k_191), 0}, + {(char *)"isize", __pyx_getprop_9csamtools_11AlignedRead_isize, __pyx_setprop_9csamtools_11AlignedRead_isize, __Pyx_DOCSTR(__pyx_k_192), 0}, + {(char *)"tlen", __pyx_getprop_9csamtools_11AlignedRead_tlen, __pyx_setprop_9csamtools_11AlignedRead_tlen, __Pyx_DOCSTR(__pyx_k_193), 0}, + {(char *)"is_paired", __pyx_getprop_9csamtools_11AlignedRead_is_paired, __pyx_setprop_9csamtools_11AlignedRead_is_paired, __Pyx_DOCSTR(__pyx_k_194), 0}, + {(char *)"is_proper_pair", __pyx_getprop_9csamtools_11AlignedRead_is_proper_pair, __pyx_setprop_9csamtools_11AlignedRead_is_proper_pair, __Pyx_DOCSTR(__pyx_k_195), 0}, + {(char *)"is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_is_unmapped, __Pyx_DOCSTR(__pyx_k_196), 0}, + {(char *)"mate_is_unmapped", __pyx_getprop_9csamtools_11AlignedRead_mate_is_unmapped, __pyx_setprop_9csamtools_11AlignedRead_mate_is_unmapped, __Pyx_DOCSTR(__pyx_k_197), 0}, + {(char *)"is_reverse", __pyx_getprop_9csamtools_11AlignedRead_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_is_reverse, __Pyx_DOCSTR(__pyx_k_198), 0}, + {(char *)"mate_is_reverse", __pyx_getprop_9csamtools_11AlignedRead_mate_is_reverse, __pyx_setprop_9csamtools_11AlignedRead_mate_is_reverse, __Pyx_DOCSTR(__pyx_k_199), 0}, + {(char *)"is_read1", __pyx_getprop_9csamtools_11AlignedRead_is_read1, __pyx_setprop_9csamtools_11AlignedRead_is_read1, __Pyx_DOCSTR(__pyx_k_200), 0}, + {(char *)"is_read2", __pyx_getprop_9csamtools_11AlignedRead_is_read2, __pyx_setprop_9csamtools_11AlignedRead_is_read2, __Pyx_DOCSTR(__pyx_k_201), 0}, + {(char *)"is_secondary", __pyx_getprop_9csamtools_11AlignedRead_is_secondary, __pyx_setprop_9csamtools_11AlignedRead_is_secondary, __Pyx_DOCSTR(__pyx_k_202), 0}, + {(char *)"is_qcfail", __pyx_getprop_9csamtools_11AlignedRead_is_qcfail, __pyx_setprop_9csamtools_11AlignedRead_is_qcfail, __Pyx_DOCSTR(__pyx_k_203), 0}, + {(char *)"is_duplicate", __pyx_getprop_9csamtools_11AlignedRead_is_duplicate, __pyx_setprop_9csamtools_11AlignedRead_is_duplicate, __Pyx_DOCSTR(__pyx_k_204), 0}, + {(char *)"positions", __pyx_getprop_9csamtools_11AlignedRead_positions, 0, __Pyx_DOCSTR(__pyx_k_205), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_AlignedRead = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_AlignedRead = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_AlignedRead = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_AlignedRead = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_AlignedRead = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.AlignedRead"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_AlignedRead), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_AlignedRead, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_AlignedRead, /*tp_as_number*/ + &__pyx_tp_as_sequence_AlignedRead, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_AlignedRead, /*tp_as_mapping*/ + __pyx_pf_9csamtools_11AlignedRead_4__hash__, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_9csamtools_11AlignedRead_2__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_AlignedRead, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("AlignedRead()\n\n Class representing an aligned read. see SAM format specification for \n the meaning of fields (http://samtools.sourceforge.net/).\n\n This class stores a handle to the samtools C-structure representing\n an aligned read. Member read access is forwarded to the C-structure\n and converted into python objects. This implementation should be fast,\n as only the data needed is converted.\n\n For write access, the C-structure is updated in-place. This is\n not the most efficient way to build BAM entries, as the variable\n length data is concatenated and thus needs to resized if\n a field is updated. Furthermore, the BAM entry might be\n in an inconsistent state. The :meth:`~validate` method can\n be used to check if an entry is consistent.\n\n One issue to look out for is that the sequence should always\n be set *before* the quality scores. Setting the sequence will\n also erase any quality scores that were set previously.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_AlignedRead, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_AlignedRead, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_9csamtools_11AlignedRead___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_AlignedRead, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_Samfile __pyx_vtable_9csamtools_Samfile; + +static PyObject *__pyx_tp_new_9csamtools_Samfile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_Samfile *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_Samfile *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_Samfile; + if (__pyx_pf_9csamtools_7Samfile___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_Samfile(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_7Samfile_15__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_filename(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_8filename___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_nreferences(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_11nreferences___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_references(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_10references___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_lengths(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_7lengths___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_mapped(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_6mapped___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_unmapped(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_8unmapped___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_text(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_4text___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7Samfile_header(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7Samfile_6header___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_Samfile[] = { + {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_1_isOpen)}, + {__Pyx_NAMESTR("_hasIndex"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_2_hasIndex, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_2_hasIndex)}, + {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_3_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_3_open)}, + {__Pyx_NAMESTR("gettid"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_4gettid, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_4gettid)}, + {__Pyx_NAMESTR("getrname"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_5getrname, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_5getrname)}, + {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_6_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_6_parseRegion)}, + {__Pyx_NAMESTR("reset"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_7reset, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_7reset)}, + {__Pyx_NAMESTR("seek"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_8seek, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_8seek)}, + {__Pyx_NAMESTR("tell"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_9tell, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_9tell)}, + {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_10fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_10fetch)}, + {__Pyx_NAMESTR("mate"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_11mate, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_11mate)}, + {__Pyx_NAMESTR("count"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_12count, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_12count)}, + {__Pyx_NAMESTR("pileup"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_13pileup, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_13pileup)}, + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_14close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_14close)}, + {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_16write, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_16write)}, + {__Pyx_NAMESTR("__enter__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_17__enter__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_17__enter__)}, + {__Pyx_NAMESTR("__exit__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_18__exit__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_18__exit__)}, + {__Pyx_NAMESTR("_buildLine"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_19_buildLine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_19_buildLine)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_7Samfile_21__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_7Samfile_21__next__)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_Samfile[] = { + {(char *)"filename", __pyx_getprop_9csamtools_7Samfile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0}, + {(char *)"nreferences", __pyx_getprop_9csamtools_7Samfile_nreferences, 0, __Pyx_DOCSTR(__pyx_k_207), 0}, + {(char *)"references", __pyx_getprop_9csamtools_7Samfile_references, 0, __Pyx_DOCSTR(__pyx_k_208), 0}, + {(char *)"lengths", __pyx_getprop_9csamtools_7Samfile_lengths, 0, __Pyx_DOCSTR(__pyx_k_209), 0}, + {(char *)"mapped", __pyx_getprop_9csamtools_7Samfile_mapped, 0, __Pyx_DOCSTR(__pyx_k_210), 0}, + {(char *)"unmapped", __pyx_getprop_9csamtools_7Samfile_unmapped, 0, __Pyx_DOCSTR(__pyx_k_211), 0}, + {(char *)"text", __pyx_getprop_9csamtools_7Samfile_text, 0, __Pyx_DOCSTR(__pyx_k_212), 0}, + {(char *)"header", __pyx_getprop_9csamtools_7Samfile_header, 0, __Pyx_DOCSTR(__pyx_k_213), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Samfile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Samfile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Samfile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Samfile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_Samfile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.Samfile"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_Samfile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_Samfile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Samfile, /*tp_as_number*/ + &__pyx_tp_as_sequence_Samfile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Samfile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Samfile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None,\n add_sq_text = False )*\n \n A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened.\n \n *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode (:term:`SAM`). For binary \n (:term:`BAM`) I/O you should append ``b`` for compressed or ``u`` for uncompressed :term:`BAM` output. \n Use ``h`` to output header information in text (:term:`TAM`) mode.\n\n If ``b`` is present, it must immediately follow ``r`` or ``w``. \n Valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``. For instance, to open \n a :term:`BAM` formatted file for reading, type::\n\n f = pysam.Samfile('ex1.bam','rb')\n\n If mode is not specified, we will try to auto-detect in the order 'rb', 'r', thus both the following\n should work::\n\n f1 = pysam.Samfile('ex1.bam' )\n f2 = pysam.Samfile('ex1.sam' )\n\n If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random\n access to reads via :meth:`fetch` and :meth:`pileup` is disabled.\n\n For writing, the header of a :term:`SAM` file/:term:`BAM` file can be constituted from several\n sources (see also the samtools format specification):\n\n 1. If *template* is given, the header is copied from a another *Samfile* \n (*template* must be of type *Samfile*).\n\n 2. If *header* is given, the header is built from a multi-level dictionary. The first level \n are the four types ('HD', 'SQ', ...). The second level are a list of lines, with each line \n being a list of tag-value pairs.\n\n 3. If *text* is given, new header text is copied from raw text.\n\n 4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists. \n By default, 'SQ' and 'LN' tags will be added to the header text. This option can be\n changed by unsetting the flag *add_sq_text*. \n\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_7Samfile_20__iter__, /*tp_iter*/ + __pyx_pf_9csamtools_7Samfile_21__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_Samfile, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_Samfile, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_Samfile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_IteratorRow(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorRow(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorRow[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorRow = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorRow = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorRow = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorRow = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorRow = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorRow"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorRow), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorRow, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorRow, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorRow, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorRow, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorRow, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("abstract base class for iterators over mapped reads.\n\n Various iterators implement different behaviours for wrapping around\n contig boundaries. Examples include:\n\n :class:`pysam.IteratorRowRegion`\n iterate within a single contig and a defined region.\n\n :class:`pysam.IteratorRowAll`\n iterate until EOF. This iterator will also include unmapped reads.\n\n :class:`pysam.IteratorRowAllRefs`\n iterate over all reads in all reference sequences.\n \n The method :meth:`Samfile.fetch` returns an IteratorRow.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorRow, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorRow, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowAll __pyx_vtable_9csamtools_IteratorRowAll; + +static PyObject *__pyx_tp_new_9csamtools_IteratorRowAll(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorRowAll *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorRowAll *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowAll; + if (__pyx_pf_9csamtools_14IteratorRowAll___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorRowAll(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_14IteratorRowAll_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + __pyx_tp_dealloc_9csamtools_IteratorRow(o); +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorRowAll[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_14IteratorRowAll_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorRowAll_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorRowAll = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAll = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAll = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAll = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorRowAll = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorRowAll"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorRowAll), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorRowAll, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorRowAll, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorRowAll, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorRowAll, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorRowAll, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("*(Samfile samfile, int reopen = True)*\n\n iterate over all reads in *samfile*\n\n By default, the file is re-openend to avoid conflicts between\n multiple iterators working on the same file. Set *reopen* = False\n to not re-open *samfile*.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_14IteratorRowAll_1__iter__, /*tp_iter*/ + __pyx_pf_9csamtools_14IteratorRowAll_2__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorRowAll, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorRowAll, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_PileupProxy(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_9csamtools_PileupProxy(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9csamtools_11PileupProxy_tid(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11PileupProxy_3tid___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11PileupProxy_n(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11PileupProxy_1n___get__(o); +} + +static int __pyx_setprop_9csamtools_11PileupProxy_n(PyObject *o, PyObject *v, void *x) { + if (v) { + return __pyx_pf_9csamtools_11PileupProxy_1n_1__set__(o, v); + } + else { + PyErr_SetString(PyExc_NotImplementedError, "__del__"); + return -1; + } +} + +static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pos(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11PileupProxy_3pos___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_11PileupProxy_pileups(PyObject *o, void *x) { + return __pyx_pf_9csamtools_11PileupProxy_7pileups___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_PileupProxy[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_PileupProxy[] = { + {(char *)"tid", __pyx_getprop_9csamtools_11PileupProxy_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0}, + {(char *)"n", __pyx_getprop_9csamtools_11PileupProxy_n, __pyx_setprop_9csamtools_11PileupProxy_n, __Pyx_DOCSTR(__pyx_k_215), 0}, + {(char *)"pos", __pyx_getprop_9csamtools_11PileupProxy_pos, 0, 0, 0}, + {(char *)"pileups", __pyx_getprop_9csamtools_11PileupProxy_pileups, 0, __Pyx_DOCSTR(__pyx_k_216), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PileupProxy = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PileupProxy = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PileupProxy = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PileupProxy = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_PileupProxy = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.PileupProxy"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_PileupProxy), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_PileupProxy, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PileupProxy, /*tp_as_number*/ + &__pyx_tp_as_sequence_PileupProxy, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PileupProxy, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_9csamtools_11PileupProxy_1__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PileupProxy, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("PileupProxy()\nA pileup column. A pileup column contains\n all the reads that map to a certain target base.\n\n tid\n chromosome ID as is defined in the header\n pos\n the target base coordinate (0-based)\n n\n number of reads mapping to this column \n pileups\n list of reads (:class:`pysam.PileupRead`) aligned to this column\n\n This class is a proxy for results returned by the samtools pileup engine.\n If the underlying engine iterator advances, the results of this column\n will change.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_PileupProxy, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_PileupProxy, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_9csamtools_11PileupProxy___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_PileupProxy, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_PileupRead(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_PileupRead *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_PileupRead *)o); + p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_9csamtools_PileupRead(PyObject *o) { + struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o; + Py_XDECREF(((PyObject *)p->_alignment)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_9csamtools_PileupRead(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o; + if (p->_alignment) { + e = (*v)(((PyObject*)p->_alignment), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_PileupRead(PyObject *o) { + struct __pyx_obj_9csamtools_PileupRead *p = (struct __pyx_obj_9csamtools_PileupRead *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_alignment); + p->_alignment = ((struct __pyx_obj_9csamtools_AlignedRead *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_alignment(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_9alignment___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_qpos(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_4qpos___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_indel(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_5indel___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_del(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_6is_del___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_head(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_7is_head___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_is_tail(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_7is_tail___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_10PileupRead_level(PyObject *o, void *x) { + return __pyx_pf_9csamtools_10PileupRead_5level___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_PileupRead[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_PileupRead[] = { + {(char *)"alignment", __pyx_getprop_9csamtools_10PileupRead_alignment, 0, __Pyx_DOCSTR(__pyx_k_217), 0}, + {(char *)"qpos", __pyx_getprop_9csamtools_10PileupRead_qpos, 0, __Pyx_DOCSTR(__pyx_k_218), 0}, + {(char *)"indel", __pyx_getprop_9csamtools_10PileupRead_indel, 0, __Pyx_DOCSTR(__pyx_k_219), 0}, + {(char *)"is_del", __pyx_getprop_9csamtools_10PileupRead_is_del, 0, __Pyx_DOCSTR(__pyx_k_220), 0}, + {(char *)"is_head", __pyx_getprop_9csamtools_10PileupRead_is_head, 0, 0, 0}, + {(char *)"is_tail", __pyx_getprop_9csamtools_10PileupRead_is_tail, 0, 0, 0}, + {(char *)"level", __pyx_getprop_9csamtools_10PileupRead_level, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PileupRead = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PileupRead = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PileupRead = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PileupRead = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_PileupRead = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.PileupRead"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_PileupRead), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_PileupRead, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PileupRead, /*tp_as_number*/ + &__pyx_tp_as_sequence_PileupRead, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PileupRead, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_9csamtools_10PileupRead_1__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PileupRead, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("PileupRead()\nA read aligned to a column.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_PileupRead, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_PileupRead, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_PileupRead, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_PileupRead, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_9csamtools_10PileupRead___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_PileupRead, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_Fastafile __pyx_vtable_9csamtools_Fastafile; + +static PyObject *__pyx_tp_new_9csamtools_Fastafile(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_Fastafile *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_Fastafile *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_Fastafile; + if (__pyx_pf_9csamtools_9Fastafile___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_Fastafile(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_9Fastafile_5__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9csamtools_9Fastafile_filename(PyObject *o, void *x) { + return __pyx_pf_9csamtools_9Fastafile_8filename___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_Fastafile[] = { + {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_1_isOpen)}, + {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_3_open, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_3_open)}, + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_4close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_4close)}, + {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_9csamtools_9Fastafile_6fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9csamtools_9Fastafile_6fetch)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_Fastafile[] = { + {(char *)"filename", __pyx_getprop_9csamtools_9Fastafile_filename, 0, __Pyx_DOCSTR(__pyx_k_206), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Fastafile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Fastafile = { + __pyx_pf_9csamtools_9Fastafile_2__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Fastafile = { + __pyx_pf_9csamtools_9Fastafile_2__len__, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Fastafile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_Fastafile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.Fastafile"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_Fastafile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_Fastafile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Fastafile, /*tp_as_number*/ + &__pyx_tp_as_sequence_Fastafile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Fastafile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Fastafile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("*(filename)*\n \n A *FASTA* file. The file is automatically opened.\n\n The file expects an indexed fasta file.\n\n TODO: \n add automatic indexing.\n add function to get sequence names.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_Fastafile, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_Fastafile, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_Fastafile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowRegion __pyx_vtable_9csamtools_IteratorRowRegion; + +static PyObject *__pyx_tp_new_9csamtools_IteratorRowRegion(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorRowRegion *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowRegion; + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + if (__pyx_pf_9csamtools_17IteratorRowRegion___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorRowRegion(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_17IteratorRowRegion_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(((PyObject *)p->samfile)); + __pyx_tp_dealloc_9csamtools_IteratorRow(o); +} + +static int __pyx_tp_traverse_9csamtools_IteratorRowRegion(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o; + if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) { + e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e; + } + if (p->samfile) { + e = (*v)(((PyObject*)p->samfile), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_IteratorRowRegion(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowRegion *p = (struct __pyx_obj_9csamtools_IteratorRowRegion *)o; + PyObject* tmp; + if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) { + __pyx_ptype_9csamtools_IteratorRow->tp_clear(o); + } + tmp = ((PyObject*)p->samfile); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorRowRegion[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_17IteratorRowRegion_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_17IteratorRowRegion_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorRowRegion = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorRowRegion = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorRowRegion = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorRowRegion = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorRowRegion = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorRowRegion"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorRowRegion), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorRowRegion, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorRowRegion, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorRowRegion, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorRowRegion, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorRowRegion, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("*(Samfile samfile, int tid, int beg, int end, int reopen = True )*\n\n iterate over mapped reads in a region.\n\n By default, the file is re-openend to avoid conflicts between\n multiple iterators working on the same file. Set *reopen* = False\n to not re-open *samfile*.\n\n The samtools iterators assume that the file\n position between iterations do not change.\n As a consequence, no two iterators can work\n on the same file. To permit this, each iterator\n creates its own file handle by re-opening the\n file.\n\n Note that the index will be shared between \n samfile and the iterator.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorRowRegion, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorRowRegion, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_17IteratorRowRegion_1__iter__, /*tp_iter*/ + __pyx_pf_9csamtools_17IteratorRowRegion_2__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorRowRegion, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorRowRegion, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_IteratorRowAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorRowAllRefs *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None); + if (__pyx_pf_9csamtools_18IteratorRowAllRefs___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o; + Py_XDECREF(((PyObject *)p->samfile)); + Py_XDECREF(((PyObject *)p->rowiter)); + __pyx_tp_dealloc_9csamtools_IteratorRow(o); +} + +static int __pyx_tp_traverse_9csamtools_IteratorRowAllRefs(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o; + if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) { + e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e; + } + if (p->samfile) { + e = (*v)(((PyObject*)p->samfile), a); if (e) return e; + } + if (p->rowiter) { + e = (*v)(((PyObject*)p->rowiter), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_IteratorRowAllRefs(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowAllRefs *p = (struct __pyx_obj_9csamtools_IteratorRowAllRefs *)o; + PyObject* tmp; + if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) { + __pyx_ptype_9csamtools_IteratorRow->tp_clear(o); + } + tmp = ((PyObject*)p->samfile); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->rowiter); + p->rowiter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorRowAllRefs[] = { + {__Pyx_NAMESTR("nextiter"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_1nextiter, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_1nextiter)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorRowAllRefs = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorRowAllRefs = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorRowAllRefs = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorRowAllRefs = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorRowAllRefs = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorRowAllRefs"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorRowAllRefs), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorRowAllRefs, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorRowAllRefs, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorRowAllRefs, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorRowAllRefs, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorRowAllRefs, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("iterates over all mapped reads by chaining iterators over each reference\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorRowAllRefs, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorRowAllRefs, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_18IteratorRowAllRefs_2__iter__, /*tp_iter*/ + __pyx_pf_9csamtools_18IteratorRowAllRefs_3__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorRowAllRefs, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorRowAllRefs, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorRowSelection __pyx_vtable_9csamtools_IteratorRowSelection; + +static PyObject *__pyx_tp_new_9csamtools_IteratorRowSelection(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorRowSelection *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorRow(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorRowSelection *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorRowSelection; + p->positions = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_9csamtools_20IteratorRowSelection___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorRowSelection(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_20IteratorRowSelection_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(p->positions); + __pyx_tp_dealloc_9csamtools_IteratorRow(o); +} + +static int __pyx_tp_traverse_9csamtools_IteratorRowSelection(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o; + if (__pyx_ptype_9csamtools_IteratorRow->tp_traverse) { + e = __pyx_ptype_9csamtools_IteratorRow->tp_traverse(o, v, a); if (e) return e; + } + if (p->positions) { + e = (*v)(p->positions, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_IteratorRowSelection(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorRowSelection *p = (struct __pyx_obj_9csamtools_IteratorRowSelection *)o; + PyObject* tmp; + if (__pyx_ptype_9csamtools_IteratorRow->tp_clear) { + __pyx_ptype_9csamtools_IteratorRow->tp_clear(o); + } + tmp = ((PyObject*)p->positions); + p->positions = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorRowSelection[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorRowSelection_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorRowSelection_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorRowSelection = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorRowSelection = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorRowSelection = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorRowSelection = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorRowSelection = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorRowSelection"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorRowSelection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorRowSelection, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorRowSelection, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorRowSelection, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorRowSelection, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorRowSelection, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("*(Samfile samfile)*\n\n iterate over reads in *samfile* at a given list of file positions.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorRowSelection, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorRowSelection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_20IteratorRowSelection_1__iter__, /*tp_iter*/ + __pyx_pf_9csamtools_20IteratorRowSelection_2__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorRowSelection, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorRowSelection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumn __pyx_vtable_9csamtools_IteratorColumn; + +static PyObject *__pyx_tp_new_9csamtools_IteratorColumn(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorColumn *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorColumn *)o); + p->__pyx_vtab = __pyx_vtabptr_9csamtools_IteratorColumn; + p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None); + p->stepper = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_9csamtools_14IteratorColumn___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IteratorColumn(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_14IteratorColumn_4__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(((PyObject *)p->iter)); + Py_XDECREF(((PyObject *)p->samfile)); + Py_XDECREF(((PyObject *)p->fastafile)); + Py_XDECREF(p->stepper); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_9csamtools_IteratorColumn(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o; + if (p->iter) { + e = (*v)(((PyObject*)p->iter), a); if (e) return e; + } + if (p->samfile) { + e = (*v)(((PyObject*)p->samfile), a); if (e) return e; + } + if (p->fastafile) { + e = (*v)(((PyObject*)p->fastafile), a); if (e) return e; + } + if (p->stepper) { + e = (*v)(p->stepper, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_IteratorColumn(PyObject *o) { + struct __pyx_obj_9csamtools_IteratorColumn *p = (struct __pyx_obj_9csamtools_IteratorColumn *)o; + PyObject* tmp; + tmp = ((PyObject*)p->iter); + p->iter = ((struct __pyx_obj_9csamtools_IteratorRowRegion *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->samfile); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->fastafile); + p->fastafile = ((struct __pyx_obj_9csamtools_Fastafile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->stepper); + p->stepper = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_9csamtools_14IteratorColumn_seq_len(PyObject *o, void *x) { + return __pyx_pf_9csamtools_14IteratorColumn_7seq_len___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorColumn[] = { + {__Pyx_NAMESTR("addReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_2addReference, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_2addReference)}, + {__Pyx_NAMESTR("hasReference"), (PyCFunction)__pyx_pf_9csamtools_14IteratorColumn_3hasReference, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_14IteratorColumn_3hasReference)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_IteratorColumn[] = { + {(char *)"seq_len", __pyx_getprop_9csamtools_14IteratorColumn_seq_len, 0, __Pyx_DOCSTR(__pyx_k_221), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorColumn = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorColumn = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorColumn = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorColumn = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorColumn = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorColumn"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorColumn), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorColumn, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorColumn, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorColumn, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorColumn, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("abstract base class for iterators over columns.\n\n IteratorColumn objects wrap the pileup functionality of samtools.\n \n For reasons of efficiency, the iterator points to the current \n pileup buffer. The pileup buffer is updated at every iteration.\n This might cause some unexpected behavious. For example,\n consider the conversion to a list::\n \n f = Samfile(\"file.bam\", \"rb\")\n result = list( f.pileup() )\n\n Here, ``result`` will contain ``n`` objects of type :class:`PileupProxy` for ``n`` columns, \n but each object in ``result`` will contain the same information.\n \n The desired behaviour can be achieved by list comprehension::\n\n result = [ x.pileups() for x in f.pileup() ]\n\n ``result`` will be a list of ``n`` lists of objects of type :class:`PileupRead`.\n\n If the iterator is associated with a :class:`Fastafile` using the :meth:`addReference`\n method, then the iterator will export the current sequence via the methods :meth:`getSequence`\n and :meth:`seq_len`.\n\n Optional kwargs to the iterator\n\n stepper\n The stepper controlls how the iterator advances. \n Possible options for the stepper are \n \n all\n use all reads for pileup.\n samtools\n same filter and read processing as in :term:`csamtools` pileup\n fastafile\n A :class:`FastaFile` object\n mask\n Skip all reads with bits set in mask.\n max_depth\n maximum read depth. The default is 8000.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_9csamtools_14IteratorColumn_1__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorColumn, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_IteratorColumn, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorColumn, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumnRegion __pyx_vtable_9csamtools_IteratorColumnRegion; + +static PyObject *__pyx_tp_new_9csamtools_IteratorColumnRegion(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorColumnRegion *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorColumnRegion *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnRegion; + if (__pyx_pf_9csamtools_20IteratorColumnRegion___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorColumnRegion[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_20IteratorColumnRegion_1__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorColumnRegion = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnRegion = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnRegion = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnRegion = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorColumnRegion = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorColumnRegion"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorColumnRegion), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorColumnRegion, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorColumnRegion, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorColumnRegion, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorColumnRegion, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("iterates over a region only.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + __pyx_pf_9csamtools_20IteratorColumnRegion_1__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorColumnRegion, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorColumnRegion, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_9csamtools_IteratorColumnAllRefs __pyx_vtable_9csamtools_IteratorColumnAllRefs; + +static PyObject *__pyx_tp_new_9csamtools_IteratorColumnAllRefs(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IteratorColumnAllRefs *p; + PyObject *o = __pyx_tp_new_9csamtools_IteratorColumn(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IteratorColumnAllRefs *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_9csamtools_IteratorColumn*)__pyx_vtabptr_9csamtools_IteratorColumnAllRefs; + if (__pyx_pf_9csamtools_21IteratorColumnAllRefs___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static PyMethodDef __pyx_methods_9csamtools_IteratorColumnAllRefs[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IteratorColumnAllRefs = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IteratorColumnAllRefs = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IteratorColumnAllRefs = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IteratorColumnAllRefs = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IteratorColumnAllRefs = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IteratorColumnAllRefs"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IteratorColumnAllRefs), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IteratorColumn, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IteratorColumnAllRefs, /*tp_as_number*/ + &__pyx_tp_as_sequence_IteratorColumnAllRefs, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IteratorColumnAllRefs, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IteratorColumnAllRefs, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("iterates over all columns by chaining iterators over each reference\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IteratorColumn, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IteratorColumn, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + __pyx_pf_9csamtools_21IteratorColumnAllRefs_1__next__, /*tp_iternext*/ + __pyx_methods_9csamtools_IteratorColumnAllRefs, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IteratorColumnAllRefs, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_SNPCall(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_9csamtools_SNPCall(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_tid(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_3tid___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_pos(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_3pos___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_reference_base(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_14reference_base___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_genotype(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_8genotype___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_consensus_quality(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_17consensus_quality___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_snp_quality(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_11snp_quality___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_mapping_quality(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_15mapping_quality___get__(o); +} + +static PyObject *__pyx_getprop_9csamtools_7SNPCall_coverage(PyObject *o, void *x) { + return __pyx_pf_9csamtools_7SNPCall_8coverage___get__(o); +} + +static PyMethodDef __pyx_methods_9csamtools_SNPCall[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_9csamtools_SNPCall[] = { + {(char *)"tid", __pyx_getprop_9csamtools_7SNPCall_tid, 0, __Pyx_DOCSTR(__pyx_k_214), 0}, + {(char *)"pos", __pyx_getprop_9csamtools_7SNPCall_pos, 0, __Pyx_DOCSTR(__pyx_k_222), 0}, + {(char *)"reference_base", __pyx_getprop_9csamtools_7SNPCall_reference_base, 0, __Pyx_DOCSTR(__pyx_k_223), 0}, + {(char *)"genotype", __pyx_getprop_9csamtools_7SNPCall_genotype, 0, __Pyx_DOCSTR(__pyx_k_224), 0}, + {(char *)"consensus_quality", __pyx_getprop_9csamtools_7SNPCall_consensus_quality, 0, __Pyx_DOCSTR(__pyx_k_225), 0}, + {(char *)"snp_quality", __pyx_getprop_9csamtools_7SNPCall_snp_quality, 0, __Pyx_DOCSTR(__pyx_k_226), 0}, + {(char *)"mapping_quality", __pyx_getprop_9csamtools_7SNPCall_mapping_quality, 0, __Pyx_DOCSTR(__pyx_k_227), 0}, + {(char *)"coverage", __pyx_getprop_9csamtools_7SNPCall_coverage, 0, __Pyx_DOCSTR(__pyx_k_228), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SNPCall = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_SNPCall = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_SNPCall = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SNPCall = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_SNPCall = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.SNPCall"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_SNPCall), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_SNPCall, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_SNPCall, /*tp_as_number*/ + &__pyx_tp_as_sequence_SNPCall, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SNPCall, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pf_9csamtools_7SNPCall___str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SNPCall, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("the results of a SNP call."), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_SNPCall, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_9csamtools_SNPCall, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_SNPCall, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_9csamtools_IndexedReads(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_9csamtools_IndexedReads *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_9csamtools_IndexedReads *)o); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + p->index = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_9csamtools_IndexedReads(PyObject *o) { + struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_9csamtools_12IndexedReads_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(((PyObject *)p->samfile)); + Py_XDECREF(p->index); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_9csamtools_IndexedReads(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o; + if (p->samfile) { + e = (*v)(((PyObject*)p->samfile), a); if (e) return e; + } + if (p->index) { + e = (*v)(p->index, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_9csamtools_IndexedReads(PyObject *o) { + struct __pyx_obj_9csamtools_IndexedReads *p = (struct __pyx_obj_9csamtools_IndexedReads *)o; + PyObject* tmp; + tmp = ((PyObject*)p->samfile); + p->samfile = ((struct __pyx_obj_9csamtools_Samfile *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->index); + p->index = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_9csamtools_IndexedReads[] = { + {__Pyx_NAMESTR("build"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_1build, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_1build)}, + {__Pyx_NAMESTR("find"), (PyCFunction)__pyx_pf_9csamtools_12IndexedReads_2find, METH_O, __Pyx_DOCSTR(__pyx_doc_9csamtools_12IndexedReads_2find)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_IndexedReads = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_IndexedReads = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_IndexedReads = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_IndexedReads = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_9csamtools_IndexedReads = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("csamtools.IndexedReads"), /*tp_name*/ + sizeof(struct __pyx_obj_9csamtools_IndexedReads), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_9csamtools_IndexedReads, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_IndexedReads, /*tp_as_number*/ + &__pyx_tp_as_sequence_IndexedReads, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_IndexedReads, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_IndexedReads, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("IndexedReads(Samfile samfile, int reopen=True)\nindex a bamfile by read.\n\n The index is kept in memory.\n\n By default, the file is re-openend to avoid conflicts if\n multiple operators work on the same file. Set *reopen* = False\n to not re-open *samfile*.\n "), /*tp_doc*/ + __pyx_tp_traverse_9csamtools_IndexedReads, /*tp_traverse*/ + __pyx_tp_clear_9csamtools_IndexedReads, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_9csamtools_IndexedReads, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_9csamtools_12IndexedReads___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_9csamtools_IndexedReads, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("csamtools"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0}, + {&__pyx_kp_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0}, + {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0}, + {&__pyx_kp_s_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0}, + {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0}, + {&__pyx_kp_s_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 0, 1, 0}, + {&__pyx_kp_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 0}, + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, + {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0}, + {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0}, + {&__pyx_n_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 1}, + {&__pyx_kp_s_123, __pyx_k_123, sizeof(__pyx_k_123), 0, 0, 1, 0}, + {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0}, + {&__pyx_kp_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 0}, + {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, + {&__pyx_kp_s_127, __pyx_k_127, sizeof(__pyx_k_127), 0, 0, 1, 0}, + {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0}, + {&__pyx_kp_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 0}, + {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, + {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0}, + {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0}, + {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, + {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, + {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, + {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, + {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0}, + {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, + {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, + {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0}, + {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0}, + {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0}, + {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0}, + {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0}, + {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0}, + {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0}, + {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0}, + {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, + {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0}, + {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0}, + {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0}, + {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0}, + {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0}, + {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0}, + {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0}, + {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0}, + {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0}, + {&__pyx_kp_s_163, __pyx_k_163, sizeof(__pyx_k_163), 0, 0, 1, 0}, + {&__pyx_kp_s_164, __pyx_k_164, sizeof(__pyx_k_164), 0, 0, 1, 0}, + {&__pyx_n_s_166, __pyx_k_166, sizeof(__pyx_k_166), 0, 0, 1, 1}, + {&__pyx_kp_s_167, __pyx_k_167, sizeof(__pyx_k_167), 0, 0, 1, 0}, + {&__pyx_kp_s_168, __pyx_k_168, sizeof(__pyx_k_168), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, + {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, + {&__pyx_kp_s_230, __pyx_k_230, sizeof(__pyx_k_230), 0, 0, 1, 0}, + {&__pyx_kp_s_231, __pyx_k_231, sizeof(__pyx_k_231), 0, 0, 1, 0}, + {&__pyx_kp_s_232, __pyx_k_232, sizeof(__pyx_k_232), 0, 0, 1, 0}, + {&__pyx_kp_s_238, __pyx_k_238, sizeof(__pyx_k_238), 0, 0, 1, 0}, + {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, + {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, + {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, + {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, + {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0}, + {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0}, + {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0}, + {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0}, + {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, + {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0}, + {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0}, + {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0}, + {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, + {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0}, + {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0}, + {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0}, + {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0}, + {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0}, + {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0}, + {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0}, + {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0}, + {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0}, + {&__pyx_kp_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 0}, + {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0}, + {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0}, + {&__pyx_kp_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 0}, + {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0}, + {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, + {&__pyx_n_s__AS, __pyx_k__AS, sizeof(__pyx_k__AS), 0, 0, 1, 1}, + {&__pyx_n_s__AlignedRead, __pyx_k__AlignedRead, sizeof(__pyx_k__AlignedRead), 0, 0, 1, 1}, + {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1}, + {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, + {&__pyx_n_s__CL, __pyx_k__CL, sizeof(__pyx_k__CL), 0, 0, 1, 1}, + {&__pyx_n_s__CN, __pyx_k__CN, sizeof(__pyx_k__CN), 0, 0, 1, 1}, + {&__pyx_n_s__CO, __pyx_k__CO, sizeof(__pyx_k__CO), 0, 0, 1, 1}, + {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1}, + {&__pyx_n_s__DS, __pyx_k__DS, sizeof(__pyx_k__DS), 0, 0, 1, 1}, + {&__pyx_n_s__DT, __pyx_k__DT, sizeof(__pyx_k__DT), 0, 0, 1, 1}, + {&__pyx_n_s__DictType, __pyx_k__DictType, sizeof(__pyx_k__DictType), 0, 0, 1, 1}, + {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, + {&__pyx_n_s__Fastafile, __pyx_k__Fastafile, sizeof(__pyx_k__Fastafile), 0, 0, 1, 1}, + {&__pyx_n_s__FloatType, __pyx_k__FloatType, sizeof(__pyx_k__FloatType), 0, 0, 1, 1}, + {&__pyx_n_s__GO, __pyx_k__GO, sizeof(__pyx_k__GO), 0, 0, 1, 1}, + {&__pyx_n_s__HD, __pyx_k__HD, sizeof(__pyx_k__HD), 0, 0, 1, 1}, + {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1}, + {&__pyx_n_s__ID, __pyx_k__ID, sizeof(__pyx_k__ID), 0, 0, 1, 1}, + {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, + {&__pyx_n_s__IndexedReads, __pyx_k__IndexedReads, sizeof(__pyx_k__IndexedReads), 0, 0, 1, 1}, + {&__pyx_n_s__IntType, __pyx_k__IntType, sizeof(__pyx_k__IntType), 0, 0, 1, 1}, + {&__pyx_n_s__IteratorColumn, __pyx_k__IteratorColumn, sizeof(__pyx_k__IteratorColumn), 0, 0, 1, 1}, + {&__pyx_n_s__IteratorRow, __pyx_k__IteratorRow, sizeof(__pyx_k__IteratorRow), 0, 0, 1, 1}, + {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, + {&__pyx_n_s__LB, __pyx_k__LB, sizeof(__pyx_k__LB), 0, 0, 1, 1}, + {&__pyx_n_s__LN, __pyx_k__LN, sizeof(__pyx_k__LN), 0, 0, 1, 1}, + {&__pyx_n_s__M5, __pyx_k__M5, sizeof(__pyx_k__M5), 0, 0, 1, 1}, + {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, + {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1}, + {&__pyx_n_s__O_CREAT, __pyx_k__O_CREAT, sizeof(__pyx_k__O_CREAT), 0, 0, 1, 1}, + {&__pyx_n_s__O_WRONLY, __pyx_k__O_WRONLY, sizeof(__pyx_k__O_WRONLY), 0, 0, 1, 1}, + {&__pyx_n_s__Outs, __pyx_k__Outs, sizeof(__pyx_k__Outs), 0, 0, 1, 1}, + {&__pyx_n_s__OverflowError, __pyx_k__OverflowError, sizeof(__pyx_k__OverflowError), 0, 0, 1, 1}, + {&__pyx_n_s__PG, __pyx_k__PG, sizeof(__pyx_k__PG), 0, 0, 1, 1}, + {&__pyx_n_s__PI, __pyx_k__PI, sizeof(__pyx_k__PI), 0, 0, 1, 1}, + {&__pyx_n_s__PL, __pyx_k__PL, sizeof(__pyx_k__PL), 0, 0, 1, 1}, + {&__pyx_n_s__PN, __pyx_k__PN, sizeof(__pyx_k__PN), 0, 0, 1, 1}, + {&__pyx_n_s__PU, __pyx_k__PU, sizeof(__pyx_k__PU), 0, 0, 1, 1}, + {&__pyx_n_s__PileupColumn, __pyx_k__PileupColumn, sizeof(__pyx_k__PileupColumn), 0, 0, 1, 1}, + {&__pyx_n_s__PileupProxy, __pyx_k__PileupProxy, sizeof(__pyx_k__PileupProxy), 0, 0, 1, 1}, + {&__pyx_n_s__PileupRead, __pyx_k__PileupRead, sizeof(__pyx_k__PileupRead), 0, 0, 1, 1}, + {&__pyx_n_s__RG, __pyx_k__RG, sizeof(__pyx_k__RG), 0, 0, 1, 1}, + {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1}, + {&__pyx_n_s__SM, __pyx_k__SM, sizeof(__pyx_k__SM), 0, 0, 1, 1}, + {&__pyx_n_s__SN, __pyx_k__SN, sizeof(__pyx_k__SN), 0, 0, 1, 1}, + {&__pyx_n_s__SO, __pyx_k__SO, sizeof(__pyx_k__SO), 0, 0, 1, 1}, + {&__pyx_n_s__SP, __pyx_k__SP, sizeof(__pyx_k__SP), 0, 0, 1, 1}, + {&__pyx_n_s__SQ, __pyx_k__SQ, sizeof(__pyx_k__SQ), 0, 0, 1, 1}, + {&__pyx_n_s__Samfile, __pyx_k__Samfile, sizeof(__pyx_k__Samfile), 0, 0, 1, 1}, + {&__pyx_n_s__StderrStore, __pyx_k__StderrStore, sizeof(__pyx_k__StderrStore), 0, 0, 1, 1}, + {&__pyx_n_s__StderrStoreWindows, __pyx_k__StderrStoreWindows, sizeof(__pyx_k__StderrStoreWindows), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__UR, __pyx_k__UR, sizeof(__pyx_k__UR), 0, 0, 1, 1}, + {&__pyx_n_s__VALID_HEADERS, __pyx_k__VALID_HEADERS, sizeof(__pyx_k__VALID_HEADERS), 0, 0, 1, 1}, + {&__pyx_n_s__VALID_HEADER_FIELDS, __pyx_k__VALID_HEADER_FIELDS, sizeof(__pyx_k__VALID_HEADER_FIELDS), 0, 0, 1, 1}, + {&__pyx_n_s__VALID_HEADER_ORDER, __pyx_k__VALID_HEADER_ORDER, sizeof(__pyx_k__VALID_HEADER_ORDER), 0, 0, 1, 1}, + {&__pyx_n_s__VALID_HEADER_TYPES, __pyx_k__VALID_HEADER_TYPES, sizeof(__pyx_k__VALID_HEADER_TYPES), 0, 0, 1, 1}, + {&__pyx_n_s__VN, __pyx_k__VN, sizeof(__pyx_k__VN), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__Windows, __pyx_k__Windows, sizeof(__pyx_k__Windows), 0, 0, 1, 1}, + {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____del__, __pyx_k____del__, sizeof(__pyx_k____del__), 0, 0, 1, 1}, + {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1}, + {&__pyx_n_s____getattribute__, __pyx_k____getattribute__, sizeof(__pyx_k____getattribute__), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___alignment, __pyx_k___alignment, sizeof(__pyx_k___alignment), 0, 0, 1, 1}, + {&__pyx_n_s___buildHeader, __pyx_k___buildHeader, sizeof(__pyx_k___buildHeader), 0, 0, 1, 1}, + {&__pyx_n_s___buildLine, __pyx_k___buildLine, sizeof(__pyx_k___buildLine), 0, 0, 1, 1}, + {&__pyx_n_s___consensus_quality, __pyx_k___consensus_quality, sizeof(__pyx_k___consensus_quality), 0, 0, 1, 1}, + {&__pyx_n_s___coverage, __pyx_k___coverage, sizeof(__pyx_k___coverage), 0, 0, 1, 1}, + {&__pyx_n_s___delegate, __pyx_k___delegate, sizeof(__pyx_k___delegate), 0, 0, 1, 1}, + {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1}, + {&__pyx_n_s___genotype, __pyx_k___genotype, sizeof(__pyx_k___genotype), 0, 0, 1, 1}, + {&__pyx_n_s___hasIndex, __pyx_k___hasIndex, sizeof(__pyx_k___hasIndex), 0, 0, 1, 1}, + {&__pyx_n_s___indel, __pyx_k___indel, sizeof(__pyx_k___indel), 0, 0, 1, 1}, + {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1}, + {&__pyx_n_s___is_del, __pyx_k___is_del, sizeof(__pyx_k___is_del), 0, 0, 1, 1}, + {&__pyx_n_s___is_head, __pyx_k___is_head, sizeof(__pyx_k___is_head), 0, 0, 1, 1}, + {&__pyx_n_s___is_tail, __pyx_k___is_tail, sizeof(__pyx_k___is_tail), 0, 0, 1, 1}, + {&__pyx_n_s___level, __pyx_k___level, sizeof(__pyx_k___level), 0, 0, 1, 1}, + {&__pyx_n_s___logfile, __pyx_k___logfile, sizeof(__pyx_k___logfile), 0, 0, 1, 1}, + {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1}, + {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1}, + {&__pyx_n_s___pos, __pyx_k___pos, sizeof(__pyx_k___pos), 0, 0, 1, 1}, + {&__pyx_n_s___qpos, __pyx_k___qpos, sizeof(__pyx_k___qpos), 0, 0, 1, 1}, + {&__pyx_n_s___reference_base, __pyx_k___reference_base, sizeof(__pyx_k___reference_base), 0, 0, 1, 1}, + {&__pyx_n_s___samtools_dispatch, __pyx_k___samtools_dispatch, sizeof(__pyx_k___samtools_dispatch), 0, 0, 1, 1}, + {&__pyx_n_s___snp_quality, __pyx_k___snp_quality, sizeof(__pyx_k___snp_quality), 0, 0, 1, 1}, + {&__pyx_n_s___tid, __pyx_k___tid, sizeof(__pyx_k___tid), 0, 0, 1, 1}, + {&__pyx_n_s__add_sq_text, __pyx_k__add_sq_text, sizeof(__pyx_k__add_sq_text), 0, 0, 1, 1}, + {&__pyx_n_s__alignment, __pyx_k__alignment, sizeof(__pyx_k__alignment), 0, 0, 1, 1}, + {&__pyx_n_s__all, __pyx_k__all, sizeof(__pyx_k__all), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, + {&__pyx_n_s__bam, __pyx_k__bam, sizeof(__pyx_k__bam), 0, 0, 1, 1}, + {&__pyx_n_s__beg, __pyx_k__beg, sizeof(__pyx_k__beg), 0, 0, 1, 1}, + {&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1}, + {&__pyx_n_s__bqual, __pyx_k__bqual, sizeof(__pyx_k__bqual), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__calcsize, __pyx_k__calcsize, sizeof(__pyx_k__calcsize), 0, 0, 1, 1}, + {&__pyx_n_s__callback, __pyx_k__callback, sizeof(__pyx_k__callback), 0, 0, 1, 1}, + {&__pyx_n_s__catch_stderr, __pyx_k__catch_stderr, sizeof(__pyx_k__catch_stderr), 0, 0, 1, 1}, + {&__pyx_n_s__catch_stdout, __pyx_k__catch_stdout, sizeof(__pyx_k__catch_stdout), 0, 0, 1, 1}, + {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1}, + {&__pyx_n_s__cigar, __pyx_k__cigar, sizeof(__pyx_k__cigar), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__cmp, __pyx_k__cmp, sizeof(__pyx_k__cmp), 0, 0, 1, 1}, + {&__pyx_n_s__cnext, __pyx_k__cnext, sizeof(__pyx_k__cnext), 0, 0, 1, 1}, + {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, + {&__pyx_n_s__consensus_quality, __pyx_k__consensus_quality, sizeof(__pyx_k__consensus_quality), 0, 0, 1, 1}, + {&__pyx_n_s__core, __pyx_k__core, sizeof(__pyx_k__core), 0, 0, 1, 1}, + {&__pyx_n_s__coverage, __pyx_k__coverage, sizeof(__pyx_k__coverage), 0, 0, 1, 1}, + {&__pyx_n_s__csamtools, __pyx_k__csamtools, sizeof(__pyx_k__csamtools), 0, 0, 1, 1}, + {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1}, + {&__pyx_n_s__current_pos, __pyx_k__current_pos, sizeof(__pyx_k__current_pos), 0, 0, 1, 1}, + {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__data_len, __pyx_k__data_len, sizeof(__pyx_k__data_len), 0, 0, 1, 1}, + {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1}, + {&__pyx_n_s__devnull, __pyx_k__devnull, sizeof(__pyx_k__devnull), 0, 0, 1, 1}, + {&__pyx_n_s__dup, __pyx_k__dup, sizeof(__pyx_k__dup), 0, 0, 1, 1}, + {&__pyx_n_s__dup2, __pyx_k__dup2, sizeof(__pyx_k__dup2), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__exc_type, __pyx_k__exc_type, sizeof(__pyx_k__exc_type), 0, 0, 1, 1}, + {&__pyx_n_s__exc_value, __pyx_k__exc_value, sizeof(__pyx_k__exc_value), 0, 0, 1, 1}, + {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1}, + {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, + {&__pyx_n_s__fastafile, __pyx_k__fastafile, sizeof(__pyx_k__fastafile), 0, 0, 1, 1}, + {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, + {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1}, + {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1}, + {&__pyx_n_s__flush, __pyx_k__flush, sizeof(__pyx_k__flush), 0, 0, 1, 1}, + {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1}, + {&__pyx_n_s__genotype, __pyx_k__genotype, sizeof(__pyx_k__genotype), 0, 0, 1, 1}, + {&__pyx_n_s__gettid, __pyx_k__gettid, sizeof(__pyx_k__gettid), 0, 0, 1, 1}, + {&__pyx_n_s__hash, __pyx_k__hash, sizeof(__pyx_k__hash), 0, 0, 1, 1}, + {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__indel, __pyx_k__indel, sizeof(__pyx_k__indel), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__is_del, __pyx_k__is_del, sizeof(__pyx_k__is_del), 0, 0, 1, 1}, + {&__pyx_n_s__is_head, __pyx_k__is_head, sizeof(__pyx_k__is_head), 0, 0, 1, 1}, + {&__pyx_n_s__is_tail, __pyx_k__is_tail, sizeof(__pyx_k__is_tail), 0, 0, 1, 1}, + {&__pyx_n_s__isbam, __pyx_k__isbam, sizeof(__pyx_k__isbam), 0, 0, 1, 1}, + {&__pyx_n_s__isize, __pyx_k__isize, sizeof(__pyx_k__isize), 0, 0, 1, 1}, + {&__pyx_n_s__isremote, __pyx_k__isremote, sizeof(__pyx_k__isremote), 0, 0, 1, 1}, + {&__pyx_n_s__isstream, __pyx_k__isstream, sizeof(__pyx_k__isstream), 0, 0, 1, 1}, + {&__pyx_n_s__isupper, __pyx_k__isupper, sizeof(__pyx_k__isupper), 0, 0, 1, 1}, + {&__pyx_n_s__iter, __pyx_k__iter, sizeof(__pyx_k__iter), 0, 0, 1, 1}, + {&__pyx_n_s__iterdata, __pyx_k__iterdata, sizeof(__pyx_k__iterdata), 0, 0, 1, 1}, + {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__l_aux, __pyx_k__l_aux, sizeof(__pyx_k__l_aux), 0, 0, 1, 1}, + {&__pyx_n_s__l_qname, __pyx_k__l_qname, sizeof(__pyx_k__l_qname), 0, 0, 1, 1}, + {&__pyx_n_s__l_qseq, __pyx_k__l_qseq, sizeof(__pyx_k__l_qseq), 0, 0, 1, 1}, + {&__pyx_n_s__l_text, __pyx_k__l_text, sizeof(__pyx_k__l_text), 0, 0, 1, 1}, + {&__pyx_n_s__level, __pyx_k__level, sizeof(__pyx_k__level), 0, 0, 1, 1}, + {&__pyx_n_s__m_data, __pyx_k__m_data, sizeof(__pyx_k__m_data), 0, 0, 1, 1}, + {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1}, + {&__pyx_n_s__mapping_quality, __pyx_k__mapping_quality, sizeof(__pyx_k__mapping_quality), 0, 0, 1, 1}, + {&__pyx_n_s__mapq, __pyx_k__mapq, sizeof(__pyx_k__mapq), 0, 0, 1, 1}, + {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1}, + {&__pyx_n_s__mate, __pyx_k__mate, sizeof(__pyx_k__mate), 0, 0, 1, 1}, + {&__pyx_n_s__max_depth, __pyx_k__max_depth, sizeof(__pyx_k__max_depth), 0, 0, 1, 1}, + {&__pyx_n_s__method, __pyx_k__method, sizeof(__pyx_k__method), 0, 0, 1, 1}, + {&__pyx_n_s__mkstemp, __pyx_k__mkstemp, sizeof(__pyx_k__mkstemp), 0, 0, 1, 1}, + {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, + {&__pyx_n_s__mpos, __pyx_k__mpos, sizeof(__pyx_k__mpos), 0, 0, 1, 1}, + {&__pyx_n_s__mrnm, __pyx_k__mrnm, sizeof(__pyx_k__mrnm), 0, 0, 1, 1}, + {&__pyx_n_s__mtid, __pyx_k__mtid, sizeof(__pyx_k__mtid), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__n_cigar, __pyx_k__n_cigar, sizeof(__pyx_k__n_cigar), 0, 0, 1, 1}, + {&__pyx_n_s__n_plp, __pyx_k__n_plp, sizeof(__pyx_k__n_plp), 0, 0, 1, 1}, + {&__pyx_n_s__n_pu, __pyx_k__n_pu, sizeof(__pyx_k__n_pu), 0, 0, 1, 1}, + {&__pyx_n_s__n_targets, __pyx_k__n_targets, sizeof(__pyx_k__n_targets), 0, 0, 1, 1}, + {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, + {&__pyx_n_s__nextiter, __pyx_k__nextiter, sizeof(__pyx_k__nextiter), 0, 0, 1, 1}, + {&__pyx_n_s__nreferences, __pyx_k__nreferences, sizeof(__pyx_k__nreferences), 0, 0, 1, 1}, + {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, + {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, + {&__pyx_n_s__owns_samfile, __pyx_k__owns_samfile, sizeof(__pyx_k__owns_samfile), 0, 0, 1, 1}, + {&__pyx_n_s__pack_into, __pyx_k__pack_into, sizeof(__pyx_k__pack_into), 0, 0, 1, 1}, + {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1}, + {&__pyx_n_s__pileup_iter, __pyx_k__pileup_iter, sizeof(__pyx_k__pileup_iter), 0, 0, 1, 1}, + {&__pyx_n_s__pileups, __pyx_k__pileups, sizeof(__pyx_k__pileups), 0, 0, 1, 1}, + {&__pyx_n_s__platform, __pyx_k__platform, sizeof(__pyx_k__platform), 0, 0, 1, 1}, + {&__pyx_n_s__plp, __pyx_k__plp, sizeof(__pyx_k__plp), 0, 0, 1, 1}, + {&__pyx_n_s__port, __pyx_k__port, sizeof(__pyx_k__port), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__positions, __pyx_k__positions, sizeof(__pyx_k__positions), 0, 0, 1, 1}, + {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1}, + {&__pyx_n_s__qpos, __pyx_k__qpos, sizeof(__pyx_k__qpos), 0, 0, 1, 1}, + {&__pyx_n_s__qseq, __pyx_k__qseq, sizeof(__pyx_k__qseq), 0, 0, 1, 1}, + {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, + {&__pyx_n_s__rU, __pyx_k__rU, sizeof(__pyx_k__rU), 0, 0, 1, 1}, + {&__pyx_n_s__raw, __pyx_k__raw, sizeof(__pyx_k__raw), 0, 0, 1, 1}, + {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1}, + {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1}, + {&__pyx_n_s__readAndRelease, __pyx_k__readAndRelease, sizeof(__pyx_k__readAndRelease), 0, 0, 1, 1}, + {&__pyx_n_s__readlines, __pyx_k__readlines, sizeof(__pyx_k__readlines), 0, 0, 1, 1}, + {&__pyx_n_s__record, __pyx_k__record, sizeof(__pyx_k__record), 0, 0, 1, 1}, + {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1}, + {&__pyx_n_s__reference_base, __pyx_k__reference_base, sizeof(__pyx_k__reference_base), 0, 0, 1, 1}, + {&__pyx_n_s__referencelengths, __pyx_k__referencelengths, sizeof(__pyx_k__referencelengths), 0, 0, 1, 1}, + {&__pyx_n_s__referencenames, __pyx_k__referencenames, sizeof(__pyx_k__referencenames), 0, 0, 1, 1}, + {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1}, + {&__pyx_n_s__release, __pyx_k__release, sizeof(__pyx_k__release), 0, 0, 1, 1}, + {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1}, + {&__pyx_n_s__reopen, __pyx_k__reopen, sizeof(__pyx_k__reopen), 0, 0, 1, 1}, + {&__pyx_n_s__restore, __pyx_k__restore, sizeof(__pyx_k__restore), 0, 0, 1, 1}, + {&__pyx_n_s__retval, __pyx_k__retval, sizeof(__pyx_k__retval), 0, 0, 1, 1}, + {&__pyx_n_s__rg2lib, __pyx_k__rg2lib, sizeof(__pyx_k__rg2lib), 0, 0, 1, 1}, + {&__pyx_n_s__rlen, __pyx_k__rlen, sizeof(__pyx_k__rlen), 0, 0, 1, 1}, + {&__pyx_n_s__rname, __pyx_k__rname, sizeof(__pyx_k__rname), 0, 0, 1, 1}, + {&__pyx_n_s__rowiter, __pyx_k__rowiter, sizeof(__pyx_k__rowiter), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1}, + {&__pyx_n_s__samtools, __pyx_k__samtools, sizeof(__pyx_k__samtools), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1}, + {&__pyx_n_s__seq_len, __pyx_k__seq_len, sizeof(__pyx_k__seq_len), 0, 0, 1, 1}, + {&__pyx_n_s__setdevice, __pyx_k__setdevice, sizeof(__pyx_k__setdevice), 0, 0, 1, 1}, + {&__pyx_n_s__setfd, __pyx_k__setfd, sizeof(__pyx_k__setfd), 0, 0, 1, 1}, + {&__pyx_n_s__setfile, __pyx_k__setfile, sizeof(__pyx_k__setfile), 0, 0, 1, 1}, + {&__pyx_n_s__setupIteratorData, __pyx_k__setupIteratorData, sizeof(__pyx_k__setupIteratorData), 0, 0, 1, 1}, + {&__pyx_n_s__snp_quality, __pyx_k__snp_quality, sizeof(__pyx_k__snp_quality), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__start_offset, __pyx_k__start_offset, sizeof(__pyx_k__start_offset), 0, 0, 1, 1}, + {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, + {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1}, + {&__pyx_n_s__stderr_f, __pyx_k__stderr_f, sizeof(__pyx_k__stderr_f), 0, 0, 1, 1}, + {&__pyx_n_s__stderr_h, __pyx_k__stderr_h, sizeof(__pyx_k__stderr_h), 0, 0, 1, 1}, + {&__pyx_n_s__stderr_save, __pyx_k__stderr_save, sizeof(__pyx_k__stderr_save), 0, 0, 1, 1}, + {&__pyx_n_s__stdout, __pyx_k__stdout, sizeof(__pyx_k__stdout), 0, 0, 1, 1}, + {&__pyx_n_s__stepper, __pyx_k__stepper, sizeof(__pyx_k__stepper), 0, 0, 1, 1}, + {&__pyx_n_s__streams, __pyx_k__streams, sizeof(__pyx_k__streams), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__system, __pyx_k__system, sizeof(__pyx_k__system), 0, 0, 1, 1}, + {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1}, + {&__pyx_n_s__target_len, __pyx_k__target_len, sizeof(__pyx_k__target_len), 0, 0, 1, 1}, + {&__pyx_n_s__target_name, __pyx_k__target_name, sizeof(__pyx_k__target_name), 0, 0, 1, 1}, + {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1}, + {&__pyx_n_s__template, __pyx_k__template, sizeof(__pyx_k__template), 0, 0, 1, 1}, + {&__pyx_n_s__text, __pyx_k__text, sizeof(__pyx_k__text), 0, 0, 1, 1}, + {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1}, + {&__pyx_n_s__traceback, __pyx_k__traceback, sizeof(__pyx_k__traceback), 0, 0, 1, 1}, + {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1}, + {&__pyx_n_s__until_eof, __pyx_k__until_eof, sizeof(__pyx_k__until_eof), 0, 0, 1, 1}, + {&__pyx_n_s__view, __pyx_k__view, sizeof(__pyx_k__view), 0, 0, 1, 1}, + {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, + {&__pyx_n_s__wb, __pyx_k__wb, sizeof(__pyx_k__wb), 0, 0, 1, 1}, + {&__pyx_n_s__wbu, __pyx_k__wbu, sizeof(__pyx_k__wbu), 0, 0, 1, 1}, + {&__pyx_n_s__wh, __pyx_k__wh, sizeof(__pyx_k__wh), 0, 0, 1, 1}, + {&__pyx_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1}, + {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_OverflowError = __Pyx_GetName(__pyx_b, __pyx_n_s__OverflowError); if (!__pyx_builtin_OverflowError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_cmp = __Pyx_GetName(__pyx_b, __pyx_n_s__cmp); if (!__pyx_builtin_cmp) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "csamtools.pyx":271 + * def __len__(self): + * if self.fastafile == NULL: + * raise ValueError( "calling len() on closed file" ) # <<<<<<<<<<<<<< + * + * return faidx_fetch_nseq(self.fastafile) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "csamtools.pyx":303 + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "csamtools.pyx":328 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * cdef int length + */ + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "csamtools.pyx":334 + * + * if not region: + * if reference is None: raise ValueError( 'no sequence/region supplied.' ) # <<<<<<<<<<<<<< + * if start is None: start = 0 + * if end is None: end = max_pos -1 + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "csamtools.pyx":636 + * returns -1 if reference is not known. + * ''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return pysam_reference2tid( self.samfile.header, reference ) + * + */ + __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + + /* "csamtools.pyx":642 + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + */ + __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + + /* "csamtools.pyx":650 + * ''' + * convert numerical :term:`tid` into :term:`reference` name.''' + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not 0 <= tid < self.samfile.header.n_targets: + * raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + */ + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + + /* "csamtools.pyx":699 + * if len(parts) >= 3: rend = int(parts[2]) + * + * if not reference: return 0, 0, 0, 0 # <<<<<<<<<<<<<< + * + * rtid = self.gettid( reference ) + */ + __pyx_k_tuple_34 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + + /* "csamtools.pyx":719 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") + */ + __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + + /* "csamtools.pyx":721 + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<< + * if self.isstream: + * raise OSError("seek no available in streams") + */ + __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_38)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + + /* "csamtools.pyx":723 + * raise NotImplementedError("seek only available in bam files") + * if self.isstream: + * raise OSError("seek no available in streams") # <<<<<<<<<<<<<< + * + * return bam_seek( self.samfile.x.bam, offset, where ) + */ + __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + + /* "csamtools.pyx":732 + * ''' + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") + */ + __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42)); + + /* "csamtools.pyx":734 + * raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: + * raise NotImplementedError("seek only available in bam files") # <<<<<<<<<<<<<< + * + * return bam_tell( self.samfile.x.bam ) + */ + __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_38)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_38)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); + + /* "csamtools.pyx":769 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); + + /* "csamtools.pyx":778 + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_46)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_46)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); + + /* "csamtools.pyx":781 + * + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + * return bam_fetch(self.samfile.x.bam, + */ + __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_48)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + + /* "csamtools.pyx":782 + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<< + * return bam_fetch(self.samfile.x.bam, + * self.index, + */ + __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); + PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + + /* "csamtools.pyx":803 + * # this happens if a bamfile is opened with mode 'r' + * if has_coord: + * raise ValueError ("fetching by region is not available for sam files" ) # <<<<<<<<<<<<<< + * + * if self.samfile.header.n_targets == 0: + */ + __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_52)); + PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_52)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_52)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + + /* "csamtools.pyx":806 + * + * if self.samfile.header.n_targets == 0: + * raise ValueError( "fetch called for samfile without header") # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_54)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_kp_s_54)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_54)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); + + /* "csamtools.pyx":809 + * + * if callback: + * raise NotImplementedError( "callback not implemented yet" ) # <<<<<<<<<<<<<< + * else: + * return IteratorRowAll( self, reopen=reopen ) + */ + __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_56)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + + /* "csamtools.pyx":850 + * + * if mate_data.mate == NULL: + * raise ValueError( "mate not found" ) # <<<<<<<<<<<<<< + * + * cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + */ + __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_60)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); + + /* "csamtools.pyx":875 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); + + /* "csamtools.pyx":884 + * if self.isbam: + * if not until_eof and not self._hasIndex() and not self.isremote: + * raise ValueError( "fetch called on bamfile without index" ) # <<<<<<<<<<<<<< + * + * if not region: + */ + __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_64)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_46)); + PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_kp_s_46)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_46)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); + + /* "csamtools.pyx":887 + * + * if not region: + * raise ValueError( "counting functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + * bam_fetch(self.samfile.x.bam, + */ + __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_65)); + PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_65)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_65)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); + + /* "csamtools.pyx":888 + * if not region: + * raise ValueError( "counting functionality requires a region/reference" ) + * if not self._hasIndex(): raise ValueError( "no index available for fetch" ) # <<<<<<<<<<<<<< + * bam_fetch(self.samfile.x.bam, + * self.index, + */ + __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); + + /* "csamtools.pyx":898 + * return counter + * else: + * raise ValueError ("count for a region is not available for sam files" ) # <<<<<<<<<<<<<< + * + * def pileup( self, + */ + __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_68)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_68)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_68)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); + + /* "csamtools.pyx":952 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); + + /* "csamtools.pyx":957 + * + * if self.isbam: + * if not self._hasIndex(): raise ValueError( "no index available for pileup" ) # <<<<<<<<<<<<<< + * + * if callback: + */ + __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_71)); + PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_71)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72)); + + /* "csamtools.pyx":960 + * + * if callback: + * if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) # <<<<<<<<<<<<<< + * + * buf = bam_plbuf_init( pileup_callback, callback ) + */ + __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_73)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_48)); + PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_48)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_48)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73)); + + /* "csamtools.pyx":981 + * + * else: + * raise NotImplementedError( "pileup of samfiles not implemented yet" ) # <<<<<<<<<<<<<< + * + * def close( self ): + */ + __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_74)); + PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_74)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_74)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); + + /* "csamtools.pyx":1025 + * '''number of :term:`filename` associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76)); + + /* "csamtools.pyx":1031 + * '''number of :term:`reference` sequences in the file.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self.samfile.header.n_targets + * + */ + __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77)); + + /* "csamtools.pyx":1037 + * """tuple with the names of :term:`reference` sequences.""" + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + */ + __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78)); + + /* "csamtools.pyx":1048 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * t = [] + * for x from 0 <= x < self.samfile.header.n_targets: + */ + __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_79)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79)); + + /* "csamtools.pyx":1058 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) + * + */ + __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80)); + + /* "csamtools.pyx":1059 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) # <<<<<<<<<<<<<< + * + * cdef int tid + */ + __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_82)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_81)); + PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, ((PyObject *)__pyx_kp_s_81)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_81)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); + + /* "csamtools.pyx":1071 + * """ + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) + * cdef int tid + */ + __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); + + /* "csamtools.pyx":1072 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) # <<<<<<<<<<<<<< + * cdef int tid + * cdef uint32_t total = 0 + */ + __pyx_k_tuple_85 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_85)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_84)); + PyTuple_SET_ITEM(__pyx_k_tuple_85, 0, ((PyObject *)__pyx_kp_s_84)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85)); + + /* "csamtools.pyx":1084 + * '''full contents of the :term:`sam file` header as a string.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) + * + */ + __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86)); + + /* "csamtools.pyx":1092 + * ''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * result = {} + */ + __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_87)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87)); + + /* "csamtools.pyx":1099 + * # convert to python string (note: call self.text to create 0-terminated string) + * t = self.text + * for line in t.split("\n"): # <<<<<<<<<<<<<< + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line + */ + __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_88)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88)); + + /* "csamtools.pyx":1101 + * for line in t.split("\n"): + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line # <<<<<<<<<<<<<< + * fields = line[1:].split("\t") + * record = fields[0] + */ + __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_90)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_89)); + PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_89)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_89)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90)); + + /* "csamtools.pyx":1102 + * if not line.strip(): continue + * assert line.startswith("@"), "header line without '@': '%s'" % line + * fields = line[1:].split("\t") # <<<<<<<<<<<<<< + * record = fields[0] + * assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) + */ + __pyx_k_tuple_92 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_92)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92)); + + /* "csamtools.pyx":1115 + * x = {} + * for field in fields[1:]: + * key, value = field.split(":",1) # <<<<<<<<<<<<<< + * # uppercase keys must be valid + * # lowercase are permitted for user fields + */ + __pyx_k_tuple_95 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_94)); + PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_94)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_94)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_k_tuple_95, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); + + /* "csamtools.pyx":1217 + * ############################################################### + * def __iter__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * if not self.isbam and self.samfile.header.n_targets == 0: + * raise NotImplementedError( "can not iterate over samfile without header") + */ + __pyx_k_tuple_102 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_102)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102)); + + /* "csamtools.pyx":1219 + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * if not self.isbam and self.samfile.header.n_targets == 0: + * raise NotImplementedError( "can not iterate over samfile without header") # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_103)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_103)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_103)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + + /* "csamtools.pyx":1296 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if not samfile._hasIndex(): + */ + __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_105)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105)); + + /* "csamtools.pyx":1299 + * + * if not samfile._hasIndex(): + * raise ValueError( "no index available for iteration" ) # <<<<<<<<<<<<<< + * + * # makes sure that samfile stays alive as long as the + */ + __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_106)); + PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_106)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_106)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107)); + + /* "csamtools.pyx":1369 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if samfile.isbam: mode = "rb" + */ + __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108)); + + /* "csamtools.pyx":1424 + * def __cinit__(self, Samfile samfile): + * assert samfile._isOpen() + * if not samfile._hasIndex(): raise ValueError("no index available for fetch") # <<<<<<<<<<<<<< + * self.samfile = samfile + * self.tid = -1 + */ + __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_50)); + PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_50)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109)); + + /* "csamtools.pyx":1477 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * if not samfile._isOpen(): + */ + __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110)); + + /* "csamtools.pyx":1480 + * + * if not samfile._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * assert samfile.isbam, "can only use this iterator on bam files" + */ + __pyx_k_tuple_111 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111)); + + /* "csamtools.pyx":1796 + * self.cnext() + * if self.n_plp < 0: + * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<< + * + * if self.plp == NULL: + */ + __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_116)); + PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_116)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117)); + + /* "csamtools.pyx":1828 + * + * if self.n_plp < 0: + * raise ValueError("error during iteration" ) # <<<<<<<<<<<<<< + * + * # return result, if within same reference + */ + __pyx_k_tuple_118 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_118)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_116)); + PyTuple_SET_ITEM(__pyx_k_tuple_118, 0, ((PyObject *)__pyx_kp_s_116)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_116)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_118)); + + /* "csamtools.pyx":2363 + * size = struct.calcsize(fmt) + * if offset + size > max_size: + * raise NotImplementedError("tags field too large") # <<<<<<<<<<<<<< + * + * struct.pack_into( fmt, + */ + __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_133)); + PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134)); + + /* "csamtools.pyx":2710 + * + * def __init__(self): + * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_k_tuple_158 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_158)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_158)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_157)); + PyTuple_SET_ITEM(__pyx_k_tuple_158, 0, ((PyObject *)__pyx_kp_s_157)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_158)); + + /* "csamtools.pyx":2754 + * + * def __init__(self): + * raise TypeError("This class cannot be instantiated from Python") # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_k_tuple_159 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_159)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_159)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_157)); + PyTuple_SET_ITEM(__pyx_k_tuple_159, 0, ((PyObject *)__pyx_kp_s_157)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_157)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_159)); + + /* "csamtools.pyx":2867 + * # recover. Thus redirect output to file with -o option. + * if method == "view": + * if "-o" in args: raise ValueError("option -o is forbidden in samtools view") # <<<<<<<<<<<<<< + * args = ( "-o", stdout_f ) + args + * + */ + __pyx_k_tuple_165 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_165)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_164)); + PyTuple_SET_ITEM(__pyx_k_tuple_165, 0, ((PyObject *)__pyx_kp_s_164)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_164)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_165)); + + /* "csamtools.pyx":224 + * + * # order of records within sam headers + * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<< + * + * # type conversions within sam header records + */ + __pyx_k_tuple_233 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_233)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__HD)); + PyTuple_SET_ITEM(__pyx_k_tuple_233, 0, ((PyObject *)__pyx_n_s__HD)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HD)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SQ)); + PyTuple_SET_ITEM(__pyx_k_tuple_233, 1, ((PyObject *)__pyx_n_s__SQ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SQ)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__RG)); + PyTuple_SET_ITEM(__pyx_k_tuple_233, 2, ((PyObject *)__pyx_n_s__RG)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RG)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PG)); + PyTuple_SET_ITEM(__pyx_k_tuple_233, 3, ((PyObject *)__pyx_n_s__PG)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PG)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CO)); + PyTuple_SET_ITEM(__pyx_k_tuple_233, 4, ((PyObject *)__pyx_n_s__CO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CO)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_233)); + + /* "csamtools.pyx":233 + * + * # output order of fields within records + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<< + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + */ + __pyx_k_tuple_234 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_234)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VN)); + PyTuple_SET_ITEM(__pyx_k_tuple_234, 0, ((PyObject *)__pyx_n_s__VN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SO)); + PyTuple_SET_ITEM(__pyx_k_tuple_234, 1, ((PyObject *)__pyx_n_s__SO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SO)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__GO)); + PyTuple_SET_ITEM(__pyx_k_tuple_234, 2, ((PyObject *)__pyx_n_s__GO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GO)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_234)); + + /* "csamtools.pyx":234 + * # output order of fields within records + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<< + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + * "PG" : ( "PN", "ID", "VN", "CL" ), } + */ + __pyx_k_tuple_235 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_235)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SN)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 0, ((PyObject *)__pyx_n_s__SN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__LN)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 1, ((PyObject *)__pyx_n_s__LN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__AS)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 2, ((PyObject *)__pyx_n_s__AS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AS)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__M5)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 3, ((PyObject *)__pyx_n_s__M5)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M5)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__UR)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 4, ((PyObject *)__pyx_n_s__UR)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UR)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SP)); + PyTuple_SET_ITEM(__pyx_k_tuple_235, 5, ((PyObject *)__pyx_n_s__SP)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SP)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_235)); + + /* "csamtools.pyx":235 + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<< + * "PG" : ( "PN", "ID", "VN", "CL" ), } + * + */ + __pyx_k_tuple_236 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_236)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 0, ((PyObject *)__pyx_n_s__ID)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__SM)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 1, ((PyObject *)__pyx_n_s__SM)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SM)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__LB)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 2, ((PyObject *)__pyx_n_s__LB)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LB)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__DS)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 3, ((PyObject *)__pyx_n_s__DS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DS)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PU)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 4, ((PyObject *)__pyx_n_s__PU)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PU)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PI)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 5, ((PyObject *)__pyx_n_s__PI)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PI)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CN)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 6, ((PyObject *)__pyx_n_s__CN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__DT)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 7, ((PyObject *)__pyx_n_s__DT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DT)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PL)); + PyTuple_SET_ITEM(__pyx_k_tuple_236, 8, ((PyObject *)__pyx_n_s__PL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PL)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_236)); + + /* "csamtools.pyx":236 + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<< + * + * + */ + __pyx_k_tuple_237 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_237)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PN)); + PyTuple_SET_ITEM(__pyx_k_tuple_237, 0, ((PyObject *)__pyx_n_s__PN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); + PyTuple_SET_ITEM(__pyx_k_tuple_237, 1, ((PyObject *)__pyx_n_s__ID)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VN)); + PyTuple_SET_ITEM(__pyx_k_tuple_237, 2, ((PyObject *)__pyx_n_s__VN)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VN)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CL)); + PyTuple_SET_ITEM(__pyx_k_tuple_237, 3, ((PyObject *)__pyx_n_s__CL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CL)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_237)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_127 = PyInt_FromLong(-127); if (unlikely(!__pyx_int_neg_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0660 = PyInt_FromLong(0660); if (unlikely(!__pyx_int_0660)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8000 = PyInt_FromLong(8000); if (unlikely(!__pyx_int_8000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_65535 = PyInt_FromLong(65535); if (unlikely(!__pyx_int_65535)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_32767 = PyInt_FromLong(-32767); if (unlikely(!__pyx_int_neg_32767)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_536870912 = PyInt_FromLong(536870912); if (unlikely(!__pyx_int_536870912)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_2147483648 = PyInt_FromLong(-2147483648); if (unlikely(!__pyx_int_neg_2147483648)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcsamtools(void); /*proto*/ +PyMODINIT_FUNC initcsamtools(void) +#else +PyMODINIT_FUNC PyInit_csamtools(void); /*proto*/ +PyMODINIT_FUNC PyInit_csamtools(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_csamtools(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("csamtools"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_csamtools) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_9csamtools_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_9csamtools_file)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_AlignedRead, "__str__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_11AlignedRead_2__str__.doc = __pyx_doc_9csamtools_11AlignedRead_2__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_11AlignedRead_2__str__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "AlignedRead", (PyObject *)&__pyx_type_9csamtools_AlignedRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_AlignedRead = &__pyx_type_9csamtools_AlignedRead; + __pyx_vtabptr_9csamtools_Samfile = &__pyx_vtable_9csamtools_Samfile; + __pyx_vtable_9csamtools_Samfile._buildHeader = (bam_header_t *(*)(struct __pyx_obj_9csamtools_Samfile *, PyObject *))__pyx_f_9csamtools_7Samfile__buildHeader; + __pyx_vtable_9csamtools_Samfile.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_getCurrent; + __pyx_vtable_9csamtools_Samfile.cnext = (int (*)(struct __pyx_obj_9csamtools_Samfile *))__pyx_f_9csamtools_7Samfile_cnext; + __pyx_vtable_9csamtools_Samfile.write = (int (*)(struct __pyx_obj_9csamtools_Samfile *, struct __pyx_obj_9csamtools_AlignedRead *, int __pyx_skip_dispatch))__pyx_f_9csamtools_7Samfile_write; + __pyx_vtable_9csamtools_Samfile._getrname = (char *(*)(struct __pyx_obj_9csamtools_Samfile *, int))__pyx_f_9csamtools_7Samfile__getrname; + if (PyType_Ready(&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_Samfile, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_7Samfile_21__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_7Samfile_21__next__.doc = __pyx_doc_9csamtools_7Samfile_21__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_7Samfile_21__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_Samfile.tp_dict, __pyx_vtabptr_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Samfile", (PyObject *)&__pyx_type_9csamtools_Samfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_Samfile = &__pyx_type_9csamtools_Samfile; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorRow", (PyObject *)&__pyx_type_9csamtools_IteratorRow) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorRow = &__pyx_type_9csamtools_IteratorRow; + __pyx_vtabptr_9csamtools_IteratorRowAll = &__pyx_vtable_9csamtools_IteratorRowAll; + __pyx_vtable_9csamtools_IteratorRowAll.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_getCurrent; + __pyx_vtable_9csamtools_IteratorRowAll.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowAll *))__pyx_f_9csamtools_14IteratorRowAll_cnext; + __pyx_type_9csamtools_IteratorRowAll.tp_base = __pyx_ptype_9csamtools_IteratorRow; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAll, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__.doc = __pyx_doc_9csamtools_14IteratorRowAll_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_14IteratorRowAll_2__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowAll.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAll", (PyObject *)&__pyx_type_9csamtools_IteratorRowAll) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorRowAll = &__pyx_type_9csamtools_IteratorRowAll; + if (PyType_Ready(&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PileupProxy", (PyObject *)&__pyx_type_9csamtools_PileupProxy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_PileupProxy = &__pyx_type_9csamtools_PileupProxy; + if (PyType_Ready(&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PileupRead", (PyObject *)&__pyx_type_9csamtools_PileupRead) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_PileupRead = &__pyx_type_9csamtools_PileupRead; + __pyx_vtabptr_9csamtools_Fastafile = &__pyx_vtable_9csamtools_Fastafile; + __pyx_vtable_9csamtools_Fastafile._fetch = (char *(*)(struct __pyx_obj_9csamtools_Fastafile *, char *, int, int, int *))__pyx_f_9csamtools_9Fastafile__fetch; + if (PyType_Ready(&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_9csamtools_Fastafile.tp_dict, __pyx_vtabptr_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Fastafile", (PyObject *)&__pyx_type_9csamtools_Fastafile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_Fastafile = &__pyx_type_9csamtools_Fastafile; + __pyx_vtabptr_9csamtools_IteratorRowRegion = &__pyx_vtable_9csamtools_IteratorRowRegion; + __pyx_vtable_9csamtools_IteratorRowRegion.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_getCurrent; + __pyx_vtable_9csamtools_IteratorRowRegion.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowRegion *))__pyx_f_9csamtools_17IteratorRowRegion_cnext; + __pyx_type_9csamtools_IteratorRowRegion.tp_base = __pyx_ptype_9csamtools_IteratorRow; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__.doc = __pyx_doc_9csamtools_17IteratorRowRegion_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_17IteratorRowRegion_2__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorRowRegion", (PyObject *)&__pyx_type_9csamtools_IteratorRowRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorRowRegion = &__pyx_type_9csamtools_IteratorRowRegion; + __pyx_type_9csamtools_IteratorRowAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorRow; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__.doc = __pyx_doc_9csamtools_18IteratorRowAllRefs_3__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_18IteratorRowAllRefs_3__next__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "IteratorRowAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorRowAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorRowAllRefs = &__pyx_type_9csamtools_IteratorRowAllRefs; + __pyx_vtabptr_9csamtools_IteratorRowSelection = &__pyx_vtable_9csamtools_IteratorRowSelection; + __pyx_vtable_9csamtools_IteratorRowSelection.getCurrent = (bam1_t *(*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_getCurrent; + __pyx_vtable_9csamtools_IteratorRowSelection.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorRowSelection *))__pyx_f_9csamtools_20IteratorRowSelection_cnext; + __pyx_type_9csamtools_IteratorRowSelection.tp_base = __pyx_ptype_9csamtools_IteratorRow; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorRowSelection, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__.doc = __pyx_doc_9csamtools_20IteratorRowSelection_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorRowSelection_2__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorRowSelection.tp_dict, __pyx_vtabptr_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorRowSelection", (PyObject *)&__pyx_type_9csamtools_IteratorRowSelection) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorRowSelection = &__pyx_type_9csamtools_IteratorRowSelection; + __pyx_vtabptr_9csamtools_IteratorColumn = &__pyx_vtable_9csamtools_IteratorColumn; + __pyx_vtable_9csamtools_IteratorColumn.cnext = (int (*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_cnext; + __pyx_vtable_9csamtools_IteratorColumn.getSequence = (char *(*)(struct __pyx_obj_9csamtools_IteratorColumn *))__pyx_f_9csamtools_14IteratorColumn_getSequence; + __pyx_vtable_9csamtools_IteratorColumn.setMask = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_setMask; + __pyx_vtable_9csamtools_IteratorColumn.setupIteratorData = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, int, int, int, struct __pyx_opt_args_9csamtools_14IteratorColumn_setupIteratorData *__pyx_optional_args))__pyx_f_9csamtools_14IteratorColumn_setupIteratorData; + __pyx_vtable_9csamtools_IteratorColumn.reset = (PyObject *(*)(struct __pyx_obj_9csamtools_IteratorColumn *, PyObject *, PyObject *, PyObject *))__pyx_f_9csamtools_14IteratorColumn_reset; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumn.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorColumn", (PyObject *)&__pyx_type_9csamtools_IteratorColumn) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorColumn = &__pyx_type_9csamtools_IteratorColumn; + __pyx_vtabptr_9csamtools_IteratorColumnRegion = &__pyx_vtable_9csamtools_IteratorColumnRegion; + __pyx_vtable_9csamtools_IteratorColumnRegion.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn; + __pyx_type_9csamtools_IteratorColumnRegion.tp_base = __pyx_ptype_9csamtools_IteratorColumn; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__.doc = __pyx_doc_9csamtools_20IteratorColumnRegion_1__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_20IteratorColumnRegion_1__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnRegion.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnRegion", (PyObject *)&__pyx_type_9csamtools_IteratorColumnRegion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorColumnRegion = &__pyx_type_9csamtools_IteratorColumnRegion; + __pyx_vtabptr_9csamtools_IteratorColumnAllRefs = &__pyx_vtable_9csamtools_IteratorColumnAllRefs; + __pyx_vtable_9csamtools_IteratorColumnAllRefs.__pyx_base = *__pyx_vtabptr_9csamtools_IteratorColumn; + __pyx_type_9csamtools_IteratorColumnAllRefs.tp_base = __pyx_ptype_9csamtools_IteratorColumn; + if (PyType_Ready(&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__.doc = __pyx_doc_9csamtools_21IteratorColumnAllRefs_1__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_9csamtools_21IteratorColumnAllRefs_1__next__; + } + } + if (__Pyx_SetVtable(__pyx_type_9csamtools_IteratorColumnAllRefs.tp_dict, __pyx_vtabptr_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IteratorColumnAllRefs", (PyObject *)&__pyx_type_9csamtools_IteratorColumnAllRefs) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IteratorColumnAllRefs = &__pyx_type_9csamtools_IteratorColumnAllRefs; + if (PyType_Ready(&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SNPCall", (PyObject *)&__pyx_type_9csamtools_SNPCall) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_SNPCall = &__pyx_type_9csamtools_SNPCall; + if (PyType_Ready(&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "IndexedReads", (PyObject *)&__pyx_type_9csamtools_IndexedReads) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_9csamtools_IndexedReads = &__pyx_type_9csamtools_IndexedReads; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "csamtools.pyx":4 + * # cython: profile=True + * # adds doc-strings for sphinx + * import tempfile # <<<<<<<<<<<<<< + * import os + * import sys + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":5 + * # adds doc-strings for sphinx + * import tempfile + * import os # <<<<<<<<<<<<<< + * import sys + * import types + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":6 + * import tempfile + * import os + * import sys # <<<<<<<<<<<<<< + * import types + * import itertools + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":7 + * import os + * import sys + * import types # <<<<<<<<<<<<<< + * import itertools + * import struct + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":8 + * import sys + * import types + * import itertools # <<<<<<<<<<<<<< + * import struct + * import ctypes + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":9 + * import types + * import itertools + * import struct # <<<<<<<<<<<<<< + * import ctypes + * import collections + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":10 + * import itertools + * import struct + * import ctypes # <<<<<<<<<<<<<< + * import collections + * import re + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":11 + * import struct + * import ctypes + * import collections # <<<<<<<<<<<<<< + * import re + * import platform + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":12 + * import ctypes + * import collections + * import re # <<<<<<<<<<<<<< + * import platform + * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":13 + * import collections + * import re + * import platform # <<<<<<<<<<<<<< + * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING + * from cpython cimport PyErr_SetString + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__platform), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__platform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":63 + * ##################################################################### + * # hard-coded constants + * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN" # <<<<<<<<<<<<<< + * cdef int max_pos = 2 << 29 + * + */ + __pyx_v_9csamtools_bam_nt16_rev_table = __pyx_k_229; + + /* "csamtools.pyx":64 + * # hard-coded constants + * cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN" + * cdef int max_pos = 2 << 29 # <<<<<<<<<<<<<< + * + * # redirect stderr to 0 + */ + __pyx_v_9csamtools_max_pos = 1073741824; + + /* "csamtools.pyx":67 + * + * # redirect stderr to 0 + * _logfile = open(os.path.devnull, "w") # <<<<<<<<<<<<<< + * pysam_set_stderr( PyFile_AsFile( _logfile ) ) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__devnull); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":68 + * # redirect stderr to 0 + * _logfile = open(os.path.devnull, "w") + * pysam_set_stderr( PyFile_AsFile( _logfile ) ) # <<<<<<<<<<<<<< + * + * ##################################################################### + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + pysam_set_stderr(PyFile_AsFile(__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":117 + * (f)(a) + * + * class PileupColumn(object): # <<<<<<<<<<<<<< + * '''A pileup column. A pileup column contains + * all the reads that map to a certain target base. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "csamtools.pyx":130 + * list of reads (:class:`pysam.PileupRead`) aligned to this column + * ''' + * def __str__(self): # <<<<<<<<<<<<<< + * return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + * "\n" + "\n".join( map(str, self.pileups) ) + */ + __pyx_t_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_12PileupColumn___str__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "csamtools.pyx":117 + * (f)(a) + * + * class PileupColumn(object): # <<<<<<<<<<<<<< + * '''A pileup column. A pileup column contains + * all the reads that map to a certain target base. + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_builtin_object); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object); + __Pyx_GIVEREF(__pyx_builtin_object); + if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_230)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1), __pyx_n_s__PileupColumn, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PileupColumn, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":174 + * return 0 + * + * class StderrStore(): # <<<<<<<<<<<<<< + * ''' + * stderr is captured. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "csamtools.pyx":178 + * stderr is captured. + * ''' + * def __init__(self): # <<<<<<<<<<<<<< + * return + * self.stderr_h, self.stderr_f = tempfile.mkstemp() + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":184 + * self.stderr_save.setfd( self.stderr_h ) + * + * def readAndRelease( self ): # <<<<<<<<<<<<<< + * return [] + * self.stderr_save.restore() + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":193 + * return lines + * + * def release(self): # <<<<<<<<<<<<<< + * return + * self.stderr_save.restore() + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":199 + * os.remove( self.stderr_f ) + * + * def __del__(self): # <<<<<<<<<<<<<< + * self.release() + * + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_11StderrStore_3__del__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____del__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":174 + * return 0 + * + * class StderrStore(): # <<<<<<<<<<<<<< + * ''' + * stderr is captured. + */ + if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_231)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStore, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":202 + * self.release() + * + * class StderrStoreWindows(): # <<<<<<<<<<<<<< + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "csamtools.pyx":204 + * class StderrStoreWindows(): + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass # <<<<<<<<<<<<<< + * def readAndRelease(self): return [] + * def release(self): pass + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":205 + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass + * def readAndRelease(self): return [] # <<<<<<<<<<<<<< + * def release(self): pass + * + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_1readAndRelease, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__readAndRelease, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":206 + * def __init__(self): pass + * def readAndRelease(self): return [] + * def release(self): pass # <<<<<<<<<<<<<< + * + * if platform.system()=='Windows': + */ + __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_18StderrStoreWindows_2release, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_1, __pyx_n_s__release, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":202 + * self.release() + * + * class StderrStoreWindows(): # <<<<<<<<<<<<<< + * '''does nothing. stderr can't be redirected on windows''' + * def __init__(self): pass + */ + if (PyDict_SetItemString(((PyObject *)__pyx_t_1), "__doc__", ((PyObject *)__pyx_kp_s_232)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1), __pyx_n_s__StderrStoreWindows, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStoreWindows, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":208 + * def release(self): pass + * + * if platform.system()=='Windows': # <<<<<<<<<<<<<< + * del StderrStore + * StderrStore = StderrStoreWindows + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__platform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__system); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Windows), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "csamtools.pyx":209 + * + * if platform.system()=='Windows': + * del StderrStore # <<<<<<<<<<<<<< + * StderrStore = StderrStoreWindows + * + */ + if (__Pyx_DelAttrString(__pyx_m, "StderrStore") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":210 + * if platform.system()=='Windows': + * del StderrStore + * StderrStore = StderrStoreWindows # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__StderrStoreWindows); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StderrStore, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L2; + } + __pyx_L2:; + + /* "csamtools.pyx":217 + * ###################################################################### + * # valid types for sam headers + * VALID_HEADER_TYPES = { "HD" : dict, # <<<<<<<<<<<<<< + * "SQ" : list, + * "RG" : list, + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)((PyObject*)(&PyDict_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":218 + * # valid types for sam headers + * VALID_HEADER_TYPES = { "HD" : dict, + * "SQ" : list, # <<<<<<<<<<<<<< + * "RG" : list, + * "PG" : list, + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":219 + * VALID_HEADER_TYPES = { "HD" : dict, + * "SQ" : list, + * "RG" : list, # <<<<<<<<<<<<<< + * "PG" : list, + * "CO" : list } + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":220 + * "SQ" : list, + * "RG" : list, + * "PG" : list, # <<<<<<<<<<<<<< + * "CO" : list } + * + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":221 + * "RG" : list, + * "PG" : list, + * "CO" : list } # <<<<<<<<<<<<<< + * + * # order of records within sam headers + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__CO), ((PyObject *)((PyObject*)(&PyList_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_TYPES, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "csamtools.pyx":224 + * + * # order of records within sam headers + * VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) # <<<<<<<<<<<<<< + * + * # type conversions within sam header records + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADERS, ((PyObject *)__pyx_k_tuple_233)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":227 + * + * # type conversions within sam header records + * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, # <<<<<<<<<<<<<< + * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, + * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__GO), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":228 + * # type conversions within sam header records + * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, + * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, # <<<<<<<<<<<<<< + * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, + * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LN), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__AS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__M5), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__UR), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SP), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":229 + * VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, + * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, + * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, # <<<<<<<<<<<<<< + * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__SM), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__LB), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DS), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PU), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PI), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__DT), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "csamtools.pyx":230 + * "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, + * "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, + * "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } # <<<<<<<<<<<<<< + * + * # output order of fields within records + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__PN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ID), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__VN), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__CL), ((PyObject *)((PyObject*)(&PyString_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_FIELDS, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "csamtools.pyx":233 + * + * # output order of fields within records + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), # <<<<<<<<<<<<<< + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__HD), ((PyObject *)__pyx_k_tuple_234)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":234 + * # output order of fields within records + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), # <<<<<<<<<<<<<< + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + * "PG" : ( "PN", "ID", "VN", "CL" ), } + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__SQ), ((PyObject *)__pyx_k_tuple_235)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":235 + * VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), # <<<<<<<<<<<<<< + * "PG" : ( "PN", "ID", "VN", "CL" ), } + * + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__RG), ((PyObject *)__pyx_k_tuple_236)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "csamtools.pyx":236 + * "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + * "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + * "PG" : ( "PN", "ID", "VN", "CL" ), } # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__PG), ((PyObject *)__pyx_k_tuple_237)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VALID_HEADER_ORDER, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "csamtools.pyx":485 + * header = None, + * port = None, + * add_sq_text = True, # <<<<<<<<<<<<<< + * ): + * '''open a sam/bam file. + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_k_16 = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":744 + * region = None, + * callback = None, + * until_eof = False ): # <<<<<<<<<<<<<< + * ''' + * fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_k_44 = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":861 + * end = None, + * region = None, + * until_eof = False ): # <<<<<<<<<<<<<< + * '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)* + * + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_k_62 = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":1783 + * int tid = 0, + * int start = 0, + * int end = max_pos, # <<<<<<<<<<<<<< + * **kwargs ): + * + */ + __pyx_k_115 = __pyx_v_9csamtools_max_pos; + + /* "csamtools.pyx":2785 + * return self._level + * + * class Outs: # <<<<<<<<<<<<<< + * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + * def __init__(self, id = 1): + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + + /* "csamtools.pyx":2787 + * class Outs: + * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + * def __init__(self, id = 1): # <<<<<<<<<<<<<< + * self.streams = [] + * self.id = id + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs___init__, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2791 + * self.id = id + * + * def setdevice(self, filename): # <<<<<<<<<<<<<< + * '''open an existing file, like "/dev/null"''' + * fd = os.open(filename, os.O_WRONLY) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_1setdevice, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setdevice, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2796 + * self.setfd(fd) + * + * def setfile(self, filename): # <<<<<<<<<<<<<< + * '''open a new file.''' + * fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_2setfile, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2801 + * self.setfd(fd) + * + * def setfd(self, fd): # <<<<<<<<<<<<<< + * ofd = os.dup(self.id) # Save old stream on new unit. + * self.streams.append(ofd) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_3setfd, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__setfd, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2809 + * os.close(fd) # Close other unit (look out, caller.) + * + * def restore(self): # <<<<<<<<<<<<<< + * '''restore previous output stream''' + * if self.streams: + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_9csamtools_4Outs_4restore, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__restore, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "csamtools.pyx":2785 + * return self._level + * + * class Outs: # <<<<<<<<<<<<<< + * '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + * def __init__(self, id = 1): + */ + if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_238)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3), __pyx_n_s__Outs, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Outs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "csamtools.pyx":2822 + * def _samtools_dispatch( method, + * args = (), + * catch_stdout = True, # <<<<<<<<<<<<<< + * catch_stderr = False, + * ): + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_k_160 = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":2823 + * args = (), + * catch_stdout = True, + * catch_stderr = False, # <<<<<<<<<<<<<< + * ): + * '''call ``method`` in samtools providing arguments in args. + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_k_161 = __pyx_t_3; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "csamtools.pyx":2820 + * del self.streams[-1] + * + * def _samtools_dispatch( method, # <<<<<<<<<<<<<< + * args = (), + * catch_stdout = True, + */ + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_9csamtools__samtools_dispatch, NULL, __pyx_n_s__csamtools); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___samtools_dispatch, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "csamtools.pyx":3522 + * if self.owns_samfile: samclose( self.fp ) + * + * __all__ = ["Samfile", # <<<<<<<<<<<<<< + * "Fastafile", + * "IteratorRow", + */ + __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Samfile)); + PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Samfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Samfile)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Fastafile)); + PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Fastafile)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Fastafile)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorRow)); + PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_n_s__IteratorRow)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorRow)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__IteratorColumn)); + PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__IteratorColumn)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IteratorColumn)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__AlignedRead)); + PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_n_s__AlignedRead)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AlignedRead)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupColumn)); + PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_n_s__PileupColumn)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupColumn)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupProxy)); + PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__PileupProxy)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupProxy)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PileupRead)); + PyList_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_n_s__PileupRead)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PileupRead)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__IndexedReads)); + PyList_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_n_s__IndexedReads)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IndexedReads)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "csamtools.pyx":1 + * # cython: embedsignature=True # <<<<<<<<<<<<<< + * # cython: profile=True + * # adds doc-strings for sphinx + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "cpython/type.pxd":2 + * + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * # The C structure of the objects used to describe built-in types. + * + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init csamtools"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init csamtools"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + + +#if CYTHON_PROFILE + +static int __Pyx_TraceSetupAndCall(PyCodeObject** code, + PyFrameObject** frame, + const char *funcname, + const char *srcfile, + int firstlineno) { + if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) { + if (*code == NULL) { + *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno); + if (*code == NULL) return 0; + } + *frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate*/ + *code, /*PyCodeObject *code*/ + PyModule_GetDict(__pyx_m), /*PyObject *globals*/ + 0 /*PyObject *locals*/ + ); + if (*frame == NULL) return 0; + } + else { + (*frame)->f_tstate = PyThreadState_GET(); + } + return PyThreadState_GET()->c_profilefunc(PyThreadState_GET()->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; +} + +static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyCodeObject *py_code = 0; + + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + py_srcfile = PyString_FromString(srcfile); + #else + py_funcname = PyUnicode_FromString(funcname); + py_srcfile = PyUnicode_FromString(srcfile); + #endif + if (!py_funcname | !py_srcfile) goto bad; + + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + firstlineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + + return py_code; +} + +#endif /* CYTHON_PROFILE */ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(&local_type, &local_value, &local_tb); + if (unlikely(tstate->curexc_type)) + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + *type = local_type; + *value = local_value; + *tb = local_tb; + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + + + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +} + +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + +static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { + long r = a % b; + r += ((r != 0) & ((r ^ b) < 0)) * b; + return r; +} + + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { + PyObject *metaclass; + /* Default metaclass */ +#if PY_MAJOR_VERSION < 3 + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = PyObject_GetAttrString(base, "__class__"); + if (!metaclass) { + PyErr_Clear(); + metaclass = (PyObject*) Py_TYPE(base); + } + } else { + metaclass = (PyObject *) &PyClass_Type; + } +#else + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = (PyObject*) Py_TYPE(base); + } else { + metaclass = (PyObject *) &PyType_Type; + } +#endif + Py_INCREF(metaclass); + return metaclass; +} + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *modname) { + PyObject *result; + PyObject *metaclass; + + if (PyDict_SetItemString(dict, "__module__", modname) < 0) + return NULL; + + /* Python2 __metaclass__ */ + metaclass = PyDict_GetItemString(dict, "__metaclass__"); + if (metaclass) { + Py_INCREF(metaclass); + } else { + metaclass = __Pyx_FindPy2Metaclass(bases); + } + result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); + Py_DECREF(metaclass); + return result; +} + + +static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) { + __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType); + if (op == NULL) + return NULL; + op->func.m_ml = ml; + Py_XINCREF(self); + op->func.m_self = self; + Py_XINCREF(module); + op->func.m_module = module; + PyObject_GC_Track(op); + return (PyObject *)op; +} + +static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) { + PyObject_GC_UnTrack(m); + Py_XDECREF(m->func.m_self); + Py_XDECREF(m->func.m_module); + PyObject_GC_Del(m); +} + +static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) { + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} + +static int __pyx_binding_PyCFunctionType_init(void) { + __pyx_binding_PyCFunctionType_type = PyCFunction_Type; + __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method"); + __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc; + __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get; + if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) { + return -1; + } + __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type; + return 0; + +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint32_t) == sizeof(char)) || + (sizeof(uint32_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint32_t) == sizeof(int)) || + (sizeof(uint32_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject* x) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(uint32_t) == sizeof(char)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(uint32_t) == sizeof(short)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(uint32_t) == sizeof(int)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(uint32_t) == sizeof(long)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (uint32_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (uint32_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + uint32_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (uint32_t)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) { + const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(int32_t) == sizeof(char)) || + (sizeof(int32_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(int32_t) == sizeof(int)) || + (sizeof(int32_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(int32_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int64_t(int64_t val) { + const int64_t neg_one = (int64_t)-1, const_zero = (int64_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(int64_t) == sizeof(char)) || + (sizeof(int64_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(int64_t) == sizeof(int)) || + (sizeof(int64_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(int64_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(int64_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE uint64_t __Pyx_PyInt_from_py_uint64_t(PyObject* x) { + const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(uint64_t) == sizeof(char)) { + if (is_unsigned) + return (uint64_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (uint64_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(uint64_t) == sizeof(short)) { + if (is_unsigned) + return (uint64_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (uint64_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(uint64_t) == sizeof(int)) { + if (is_unsigned) + return (uint64_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (uint64_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(uint64_t) == sizeof(long)) { + if (is_unsigned) + return (uint64_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (uint64_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (uint64_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (uint64_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + uint64_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (uint64_t)-1; + } +} + +static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) { + const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(int32_t) == sizeof(char)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (int32_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(int32_t) == sizeof(short)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (int32_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(int32_t) == sizeof(int)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (int32_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(int32_t) == sizeof(long)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (int32_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (int32_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + int32_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (int32_t)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint8_t(uint8_t val) { + const uint8_t neg_one = (uint8_t)-1, const_zero = (uint8_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint8_t) == sizeof(char)) || + (sizeof(uint8_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint8_t) == sizeof(int)) || + (sizeof(uint8_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint8_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint8_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint64_t(uint64_t val) { + const uint64_t neg_one = (uint64_t)-1, const_zero = (uint64_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint64_t) == sizeof(char)) || + (sizeof(uint64_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint64_t) == sizeof(int)) || + (sizeof(uint64_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint64_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint64_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pxd b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pxd new file mode 100755 index 0000000..4ec74e3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pxd @@ -0,0 +1,436 @@ +cdef extern from "string.h": + ctypedef int size_t + void *memcpy(void *dst,void *src,size_t len) + void *memmove(void *dst,void *src,size_t len) + void *memset(void *b,int c,size_t len) + +cdef extern from "stdlib.h": + void free(void *) + void *malloc(size_t) + void *calloc(size_t,size_t) + void *realloc(void *,size_t) + int c_abs "abs" (int) + void qsort(void *base, size_t nmemb, size_t size, + int (*compar)(void *,void *)) + +cdef extern from "math.h": + double sqrt(double x) + +cdef extern from "stdio.h": + ctypedef struct FILE: + pass + FILE *fopen(char *,char *) + FILE *freopen(char *path, char *mode, FILE *stream) + int fileno(FILE *stream) + int dup2(int oldfd, int newfd) + int fflush(FILE *stream) + + FILE * stderr + FILE * stdout + int fclose(FILE *) + int sscanf(char *str,char *fmt,...) + int printf(char *fmt,...) + int sprintf(char *str,char *fmt,...) + int fprintf(FILE *ifile,char *fmt,...) + char *fgets(char *str,int size,FILE *ifile) + +cdef extern from "ctype.h": + int toupper(int c) + int tolower(int c) + +cdef extern from "unistd.h": + char *ttyname(int fd) + int isatty(int fd) + +cdef extern from "string.h": + int strcmp(char *s1, char *s2) + int strncmp(char *s1,char *s2,size_t len) + char *strcpy(char *dest,char *src) + char *strncpy(char *dest,char *src, size_t len) + char *strdup(char *) + char *strcat(char *,char *) + size_t strlen(char *s) + int memcmp( void * s1, void *s2, size_t len ) + +cdef extern from "Python.h": + long _Py_HashPointer(void*) + FILE* PyFile_AsFile(object) + +cdef extern from "fileobject.h": + ctypedef class __builtin__.file [object PyFileObject]: + pass + +cdef extern from "razf.h": + pass + +cdef extern from "stdint.h": + ctypedef int int64_t + ctypedef int int32_t + ctypedef int uint32_t + ctypedef int uint8_t + ctypedef int uint64_t + +cdef extern from "bam.h": + + # constants + int BAM_DEF_MASK + # IF _IOLIB=2, bamFile = BGZF, see bgzf.h + # samtools uses KNETFILE, check how this works + + ctypedef struct tamFile: + pass + + ctypedef struct bamFile: + pass + + ctypedef struct bam1_core_t: + int32_t tid + int32_t pos + uint32_t bin + uint32_t qual + uint32_t l_qname + uint32_t flag + uint32_t n_cigar + int32_t l_qseq + int32_t mtid + int32_t mpos + int32_t isize + + ctypedef struct bam1_t: + bam1_core_t core + int l_aux + int data_len + int m_data + uint8_t *data + + ctypedef struct bam_pileup1_t: + bam1_t *b + int32_t qpos + int indel + int level + uint32_t is_del + uint32_t is_head + uint32_t is_tail + + ctypedef int (*bam_pileup_f)(uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *data) + + ctypedef int (*bam_fetch_f)(bam1_t *b, void *data) + + ctypedef struct bam_header_t: + int32_t n_targets + char **target_name + uint32_t *target_len + void *hash + void *rg2lib + int l_text + char *text + + ctypedef struct bam_index_t: + int32_t n + uint64_t n_no_coor + + ctypedef struct bam_plbuf_t: + pass + + ctypedef struct pair64_t: + uint64_t u, v + + ctypedef struct bam_iter_t: + int from_first + int tid, beg, end, n_off, i, finished + uint64_t curr_off + pair64_t *off + + # ctypedef __bam_iter_t * bam_iter_t + + bam1_t * bam_init1() + void bam_destroy1(bam1_t *) + + bamFile razf_dopen(int data_fd, char *mode) + + int64_t bam_seek( bamFile fp, uint64_t voffset, int where) + int64_t bam_tell( bamFile fp ) + + # void bam_init_header_hash(bam_header_t *header) + + ############################################### + # stand-ins for samtools macros + uint32_t * bam1_cigar( bam1_t * b) + char * bam1_qname( bam1_t * b) + uint8_t * bam1_seq( bam1_t * b) + uint8_t * bam1_qual( bam1_t * b) + uint8_t * bam1_aux( bam1_t * b) + + ############################################### + # bam iterator interface + bam_iter_t bam_iter_query( bam_index_t *idx, int tid, int beg, int end) + + int bam_iter_read(bamFile fp, bam_iter_t iter, bam1_t *b) + + void bam_iter_destroy(bam_iter_t iter) + + ############################################### + + bam1_t * bam_dup1( bam1_t *src ) + + bam1_t * bam_copy1(bam1_t *bdst, bam1_t *bsrc) + bam_index_t *bam_index_load(char *f ) + + void bam_index_destroy(bam_index_t *idx) + + int bam_parse_region(bam_header_t *header, char *str, int *ref_id, int *begin, int *end) + + ############################################### + bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data) + + int bam_fetch(bamFile fp, bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func) + + int bam_plbuf_push(bam1_t *b, bam_plbuf_t *buf) + + void bam_plbuf_destroy(bam_plbuf_t *buf) + ######################################## + # pileup iterator interface + ctypedef struct bam_plp_t: + pass + + ctypedef bam_pileup1_t * const_bam_pileup1_t_ptr "const bam_pileup1_t *" + + ctypedef int (*bam_plp_auto_f)(void *data, bam1_t *b) + + bam_plp_t bam_plp_init( bam_plp_auto_f func, void *data) + int bam_plp_push( bam_plp_t iter, bam1_t *b) + bam_pileup1_t * bam_plp_next( bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) + bam_pileup1_t * bam_plp_auto( bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) + void bam_plp_set_mask(bam_plp_t iter, int mask) + void bam_plp_reset(bam_plp_t iter) + void bam_plp_destroy(bam_plp_t iter) + void bam_plp_set_maxcnt(bam_plp_t iter, int maxcnt) + + ################################################## + + int bam_read1( bamFile fp, bam1_t *b) + int bam_validate1( bam_header_t *header, bam1_t *b) + int bam_write1( bamFile fp, bam1_t *b) + + bam_header_t *bam_header_init() + + int bam_header_write( bamFile fp, bam_header_t *header) + + bam_header_t *bam_header_read( bamFile fp ) + + void bam_header_destroy(bam_header_t *header) + + bam1_t * bam_dup1( bam1_t *src ) + + bam1_t * bam_copy1(bam1_t *bdst, bam1_t *bsrc) + + uint8_t *bam_aux_get(bam1_t *b, char tag[2]) + + int32_t bam_aux2i(uint8_t *s) + float bam_aux2f(uint8_t *s) + double bam_aux2d(uint8_t *s) + char bam_aux2A( uint8_t *s) + char *bam_aux2Z( uint8_t *s) + + int bam_reg2bin(uint32_t beg, uint32_t end) + + uint32_t bam_calend(bam1_core_t *c, uint32_t *cigar) + +cdef extern from *: + ctypedef char* const_char_ptr "const char*" + +cdef extern from "sam.h": + + ctypedef struct samfile_t_un: + tamFile tamr + bamFile bam + FILE *tamw + + ctypedef struct samfile_t: + int type + samfile_t_un x + bam_header_t *header + + samfile_t *samopen( const_char_ptr fn, char * mode, void *aux) + + int sampileup( samfile_t *fp, int mask, bam_pileup_f func, void *data) + + void samclose(samfile_t *fp) + + int samread(samfile_t *fp, bam1_t *b) + + int samwrite(samfile_t *fp, bam1_t *b) + + int bam_prob_realn(bam1_t *b, char *ref) + int bam_cap_mapQ(bam1_t *b, char *ref, int thres) + + +#cdef extern from "glf.h": +# ctypedef struct glf1_t: +# pass + +#cdef extern from "bam_maqcns.h": +# +# ctypedef struct bam_maqcns_t: +# float het_rate, theta +# int n_hap, cap_mapQ, errmod, min_baseQ +# float eta, q_r +# double *fk, *coef +# double *lhet +# void *aux + +# glf1_t *bam_maqcns_glfgen(int n, +# bam_pileup1_t *pl, +# uint8_t ref_base, +# bam_maqcns_t *bm) + +# ctypedef struct bam_maqindel_opt_t: +# int q_indel +# float r_indel +# float r_snp +# int mm_penalty, indel_err, ambi_thres + +# uint32_t bam_maqcns_call(int n, bam_pileup1_t *pl, bam_maqcns_t *bm) +# bam_maqcns_t * bam_maqcns_init() +# void bam_maqcns_destroy(bam_maqcns_t *bm) +# void bam_maqcns_prepare(bam_maqcns_t *bm) + +# uint32_t glf2cns(glf1_t *g, int q_r) + +# int BAM_ERRMOD_MAQ2 +# int BAM_ERRMOD_MAQ +# int BAM_ERRMOD_SOAP + +# ctypedef struct bam_maqindel_ret_t: +# int indel1 +# int indel2 +# int cnt1 +# int cnt2 +# int cnt_anti +# int cnt_ref +# int cnt_ambi +# char *s[2] +# int gt +# int gl[2] +# int q_cns +# int q_ref + +# void bam_maqindel_ret_destroy( bam_maqindel_ret_t * ) + +# bam_maqindel_opt_t *bam_maqindel_opt_init() + +# bam_maqindel_ret_t * bam_maqindel(int n, +# int pos, +# bam_maqindel_opt_t * mi, +# bam_pileup1_t * pl, +# char *ref, +# int _n_types, +# int * _types ) + + +cdef extern from "faidx.h": + + ctypedef struct faidx_t: + pass + + int fai_build(char *fn) + + void fai_destroy(faidx_t *fai) + + faidx_t *fai_load(char *fn) + + char *fai_fetch(faidx_t *fai, char *reg, int *len) + + int faidx_fetch_nseq(faidx_t *fai) + + char *faidx_fetch_seq(faidx_t *fai, char *c_name, + int p_beg_i, int p_end_i, int *len) + + +cdef extern from "pysam_util.h": + + int pysam_pileup_next(bam1_t *b, + bam_plbuf_t *buf, + bam_pileup1_t ** plp, + int * tid, + int * pos, + int * n_plp ) + + + int pysam_dispatch(int argc, char *argv[] ) + + # stand-in functions for samtools macros + void pysam_bam_destroy1( bam1_t * b) + + # add *nbytes* into the variable length data of *src* at *pos* + bam1_t * pysam_bam_update( bam1_t * b, + size_t nbytes_old, + size_t nbytes_new, + uint8_t * pos ) + + # translate char to unsigned char + unsigned char pysam_translate_sequence( char s ) + + unsigned char * bam_nt16_table + + int pysam_reference2tid( bam_header_t *header, char * s ) + + void pysam_set_stderr( FILE * file ) + + # return mapped/unmapped reads on tid + uint32_t pysam_get_mapped( bam_index_t *idx, int tid ) + uint32_t pysam_get_unmapped( bam_index_t *idx, int tid ) + +# uint32_t pysam_glf_depth( glf1_t * g ) + +# void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c ) + +# need to declare all C fields and methods here +cdef class AlignedRead: + + # object that this AlignedRead represents + cdef bam1_t * _delegate + +cdef class Samfile: + cdef char * _filename + # pointer to samfile + cdef samfile_t * samfile + # pointer to index + cdef bam_index_t *index + # true if file is a bam file + cdef int isbam + # true if not a file but a stream + cdef int isstream + # true if file is not on the local filesystem + cdef int isremote + # current read within iteration + cdef bam1_t * b + # file opening mode + cdef char * mode + + # beginning of read section + cdef int64_t start_offset + + cdef bam_header_t * _buildHeader( self, new_header ) + cdef bam1_t * getCurrent( self ) + cdef int cnext(self) + + # write an aligned read + cpdef int write( self, AlignedRead read ) + + cdef char * _getrname( self, int tid ) + +cdef class IteratorRow: + pass + +cdef class IteratorRowAll(IteratorRow): + cdef bam1_t * b + cdef samfile_t * fp + # true if samfile belongs to this object + cdef int owns_samfile + + cdef bam1_t * getCurrent( self ) + + cdef int cnext(self) + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pyx b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pyx new file mode 100755 index 0000000..ddd5998 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/csamtools.pyx @@ -0,0 +1,3537 @@ +# cython: embedsignature=True +# cython: profile=True +# adds doc-strings for sphinx +import tempfile +import os +import sys +import types +import itertools +import struct +import ctypes +import collections +import re +import platform +from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING +from cpython cimport PyErr_SetString + +#from cpython.string cimport PyString_FromStringAndSize, PyString_AS_STRING +#from cpython.exc cimport PyErr_SetString, PyErr_NoMemory + +# defines imported from samtools +DEF SEEK_SET = 0 +DEF SEEK_CUR = 1 +DEF SEEK_END = 2 + +## These are bits set in the flag. +## have to put these definitions here, in csamtools.pxd they got ignored +## @abstract the read is paired in sequencing, no matter whether it is mapped in a pair */ +DEF BAM_FPAIRED =1 +## @abstract the read is mapped in a proper pair */ +DEF BAM_FPROPER_PAIR =2 +## @abstract the read itself is unmapped; conflictive with BAM_FPROPER_PAIR */ +DEF BAM_FUNMAP =4 +## @abstract the mate is unmapped */ +DEF BAM_FMUNMAP =8 +## @abstract the read is mapped to the reverse strand */ +DEF BAM_FREVERSE =16 +## @abstract the mate is mapped to the reverse strand */ +DEF BAM_FMREVERSE =32 +## @abstract this is read1 */ +DEF BAM_FREAD1 =64 +## @abstract this is read2 */ +DEF BAM_FREAD2 =128 +## @abstract not primary alignment */ +DEF BAM_FSECONDARY =256 +## @abstract QC failure */ +DEF BAM_FQCFAIL =512 +## @abstract optical or PCR duplicate */ +DEF BAM_FDUP =1024 + +DEF BAM_CIGAR_SHIFT=4 +DEF BAM_CIGAR_MASK=((1 << BAM_CIGAR_SHIFT) - 1) + +DEF BAM_CMATCH = 0 +DEF BAM_CINS = 1 +DEF BAM_CDEL = 2 +DEF BAM_CREF_SKIP = 3 +DEF BAM_CSOFT_CLIP = 4 +DEF BAM_CHARD_CLIP = 5 +DEF BAM_CPAD = 6 + +##################################################################### +# hard-coded constants +cdef char * bam_nt16_rev_table = "=ACMGRSVTWYHKDBN" +cdef int max_pos = 2 << 29 + +# redirect stderr to 0 +_logfile = open(os.path.devnull, "w") +pysam_set_stderr( PyFile_AsFile( _logfile ) ) + +##################################################################### +##################################################################### +##################################################################### +## private factory methods +##################################################################### +cdef class AlignedRead +cdef makeAlignedRead(bam1_t * src): + '''enter src into AlignedRead.''' + cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + dest._delegate = bam_dup1(src) + return dest + +cdef class PileupProxy +cdef makePileupProxy( bam_pileup1_t * plp, int tid, int pos, int n ): + cdef PileupProxy dest = PileupProxy.__new__(PileupProxy) + dest.plp = plp + dest.tid = tid + dest.pos = pos + dest.n = n + return dest + +cdef class PileupRead +cdef makePileupRead( bam_pileup1_t * src ): + '''fill a PileupRead object from a bam_pileup1_t * object.''' + cdef PileupRead dest = PileupRead.__new__(PileupRead) + dest._alignment = makeAlignedRead( src.b ) + dest._qpos = src.qpos + dest._indel = src.indel + dest._level = src.level + dest._is_del = src.is_del + dest._is_head = src.is_head + dest._is_tail = src.is_tail + return dest + +##################################################################### +##################################################################### +##################################################################### +## Generic callbacks for inserting python callbacks. +##################################################################### +cdef int fetch_callback( bam1_t *alignment, void *f): + '''callback for bam_fetch. + + calls function in *f* with a new :class:`AlignedRead` object as parameter. + ''' + a = makeAlignedRead( alignment ) + (f)(a) + +class PileupColumn(object): + '''A pileup column. A pileup column contains + all the reads that map to a certain target base. + + tid + chromosome ID as is defined in the header + pos + the target base coordinate (0-based) + n + number of reads mapping to this column + pileups + list of reads (:class:`pysam.PileupRead`) aligned to this column + ''' + def __str__(self): + return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + "\n" + "\n".join( map(str, self.pileups) ) + +cdef int pileup_callback( uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *f): + '''callback for pileup. + + calls function in *f* with a new :class:`Pileup` object as parameter. + + tid + chromosome ID as is defined in the header + pos + start coordinate of the alignment, 0-based + n + number of elements in pl array + pl + array of alignments + data + user provided data + ''' + + p = PileupColumn() + p.tid = tid + p.pos = pos + p.n = n + pileups = [] + + cdef int x + for x from 0 <= x < n: + pileups.append( makePileupRead( &(pl[x]) ) ) + p.pileups = pileups + + (f)(p) + +cdef int pileup_fetch_callback( bam1_t *b, void *data): + '''callback for bam_fetch. + + Fetches reads and submits them to pileup. + ''' + cdef bam_plbuf_t * buf + buf = data + bam_plbuf_push(b, buf) + return 0 + +class StderrStore(): + ''' + stderr is captured. + ''' + def __init__(self): + return + self.stderr_h, self.stderr_f = tempfile.mkstemp() + self.stderr_save = Outs( sys.stderr.fileno() ) + self.stderr_save.setfd( self.stderr_h ) + + def readAndRelease( self ): + return [] + self.stderr_save.restore() + lines = [] + if os.path.exists(self.stderr_f): + lines = open( self.stderr_f, "r" ).readlines() + os.remove( self.stderr_f ) + return lines + + def release(self): + return + self.stderr_save.restore() + if os.path.exists(self.stderr_f): + os.remove( self.stderr_f ) + + def __del__(self): + self.release() + +class StderrStoreWindows(): + '''does nothing. stderr can't be redirected on windows''' + def __init__(self): pass + def readAndRelease(self): return [] + def release(self): pass + +if platform.system()=='Windows': + del StderrStore + StderrStore = StderrStoreWindows + + +###################################################################### +###################################################################### +###################################################################### +# valid types for sam headers +VALID_HEADER_TYPES = { "HD" : dict, + "SQ" : list, + "RG" : list, + "PG" : list, + "CO" : list } + +# order of records within sam headers +VALID_HEADERS = ("HD", "SQ", "RG", "PG", "CO" ) + +# type conversions within sam header records +VALID_HEADER_FIELDS = { "HD" : { "VN" : str, "SO" : str, "GO" : str }, + "SQ" : { "SN" : str, "LN" : int, "AS" : str, "M5" : str, "UR" : str, "SP" : str }, + "RG" : { "ID" : str, "SM" : str, "LB" : str, "DS" : str, "PU" : str, "PI" : str, "CN" : str, "DT" : str, "PL" : str, }, + "PG" : { "PN" : str, "ID" : str, "VN" : str, "CL" : str }, } + +# output order of fields within records +VALID_HEADER_ORDER = { "HD" : ( "VN", "SO", "GO" ), + "SQ" : ( "SN", "LN", "AS", "M5" , "UR" , "SP" ), + "RG" : ( "ID", "SM", "LB", "DS" , "PU" , "PI" , "CN" , "DT", "PL" ), + "PG" : ( "PN", "ID", "VN", "CL" ), } + + +###################################################################### +###################################################################### +###################################################################### +## Public methods +###################################################################### +cdef class Fastafile: + '''*(filename)* + + A *FASTA* file. The file is automatically opened. + + The file expects an indexed fasta file. + + TODO: + add automatic indexing. + add function to get sequence names. + ''' + + cdef char * _filename + # pointer to fastafile + cdef faidx_t * fastafile + + def __cinit__(self, *args, **kwargs ): + self.fastafile = NULL + self._filename = NULL + self._open( *args, **kwargs ) + + def _isOpen( self ): + '''return true if samfile has been opened.''' + return self.fastafile != NULL + + def __len__(self): + if self.fastafile == NULL: + raise ValueError( "calling len() on closed file" ) + + return faidx_fetch_nseq(self.fastafile) + + def _open( self, + char * filename ): + '''open an indexed fasta file. + + This method expects an indexed fasta file. + ''' + + # close a previously opened file + if self.fastafile != NULL: self.close() + if self._filename != NULL: free(self._filename) + self._filename = strdup(filename) + self.fastafile = fai_load( filename ) + + if self.fastafile == NULL: + raise IOError("could not open file `%s`" % filename ) + + def close( self ): + if self.fastafile != NULL: + fai_destroy( self.fastafile ) + self.fastafile = NULL + + def __dealloc__(self): + self.close() + if self._filename != NULL: free(self._filename) + + property filename: + '''number of :term:`filename` associated with this object.''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return self._filename + + def fetch( self, + reference = None, + start = None, + end = None, + region = None): + + '''*(reference = None, start = None, end = None, region = None)* + + fetch :meth:`AlignedRead` objects in a :term:`region` using 0-based indexing. + + The region is specified by :term:`reference`, *start* and *end*. + + fetch returns an empty string if the region is out of range or addresses an unknown *reference*. + + If *reference* is given and *start* is None, the sequence from the + first base is returned. Similarly, if *end* is None, the sequence + until the last base is returned. + + Alternatively, a samtools :term:`region` string can be supplied. + ''' + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + cdef int length + cdef char * seq + + if not region: + if reference is None: raise ValueError( 'no sequence/region supplied.' ) + if start is None: start = 0 + if end is None: end = max_pos -1 + + if start > end: raise ValueError( 'invalid region: start (%i) > end (%i)' % (start, end) ) + if start == end: return "" + # valid ranges are from 0 to 2^29-1 + if not 0 <= start < max_pos: raise ValueError( 'start out of range (%i)' % start ) + if not 0 <= end < max_pos: raise ValueError( 'end out of range (%i)' % end ) + # note: faidx_fetch_seq has a bug such that out-of-range access + # always returns the last residue. Hence do not use faidx_fetch_seq, + # but use fai_fetch instead + # seq = faidx_fetch_seq(self.fastafile, + # reference, + # start, + # end-1, + # &length) + region = "%s:%i-%i" % (reference, start+1, end) + seq = fai_fetch( self.fastafile, + region, + &length ) + else: + # samtools adds a '\0' at the end + seq = fai_fetch( self.fastafile, region, &length ) + + # copy to python + if seq == NULL: + return "" + else: + try: + py_seq = PyString_FromStringAndSize(seq, length) + finally: + free(seq) + + return py_seq + + cdef char * _fetch( self, char * reference, int start, int end, int * length ): + '''fetch sequence for reference, start and end''' + + return faidx_fetch_seq(self.fastafile, + reference, + start, + end-1, + length ) + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +cdef int count_callback( bam1_t *alignment, void *f): + '''callback for bam_fetch - count number of reads. + ''' + cdef int* counter = (f) + counter[0] += 1; + +ctypedef struct MateData: + char * name + bam1_t * mate + uint32_t flag + +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +#------------------------------------------------------------------------ +cdef int mate_callback( bam1_t *alignment, void *f): + '''callback for bam_fetch = filter mate + ''' + cdef MateData * d = (f) + # printf("mate = %p, name1 = %s, name2=%s\t%i\t%i\t%i\n", + # d.mate, d.name, bam1_qname(alignment), + # d.flag, alignment.core.flag, alignment.core.flag & d.flag) + + if d.mate == NULL: + # could be sped up by comparing the lengths of query strings first + # using l_qname + # + # also, make sure that we get the other read by comparing + # the flags + if alignment.core.flag & d.flag != 0 and \ + strcmp( bam1_qname( alignment ), d.name ) == 0: + d.mate = bam_dup1( alignment ) + + +cdef class Samfile: + '''*(filename, mode=None, template = None, referencenames = None, referencelengths = None, text = NULL, header = None, + add_sq_text = False )* + + A :term:`SAM`/:term:`BAM` formatted file. The file is automatically opened. + + *mode* should be ``r`` for reading or ``w`` for writing. The default is text mode (:term:`SAM`). For binary + (:term:`BAM`) I/O you should append ``b`` for compressed or ``u`` for uncompressed :term:`BAM` output. + Use ``h`` to output header information in text (:term:`TAM`) mode. + + If ``b`` is present, it must immediately follow ``r`` or ``w``. + Valid modes are ``r``, ``w``, ``wh``, ``rb``, ``wb`` and ``wbu``. For instance, to open + a :term:`BAM` formatted file for reading, type:: + + f = pysam.Samfile('ex1.bam','rb') + + If mode is not specified, we will try to auto-detect in the order 'rb', 'r', thus both the following + should work:: + + f1 = pysam.Samfile('ex1.bam' ) + f2 = pysam.Samfile('ex1.sam' ) + + If an index for a BAM file exists (.bai), it will be opened automatically. Without an index random + access to reads via :meth:`fetch` and :meth:`pileup` is disabled. + + For writing, the header of a :term:`SAM` file/:term:`BAM` file can be constituted from several + sources (see also the samtools format specification): + + 1. If *template* is given, the header is copied from a another *Samfile* + (*template* must be of type *Samfile*). + + 2. If *header* is given, the header is built from a multi-level dictionary. The first level + are the four types ('HD', 'SQ', ...). The second level are a list of lines, with each line + being a list of tag-value pairs. + + 3. If *text* is given, new header text is copied from raw text. + + 4. The names (*referencenames*) and lengths (*referencelengths*) are supplied directly as lists. + By default, 'SQ' and 'LN' tags will be added to the header text. This option can be + changed by unsetting the flag *add_sq_text*. + + ''' + + def __cinit__(self, *args, **kwargs ): + self.samfile = NULL + self._filename = NULL + self.isbam = False + self.isstream = False + self._open( *args, **kwargs ) + + # allocate memory for iterator + self.b = calloc(1, sizeof(bam1_t)) + + def _isOpen( self ): + '''return true if samfile has been opened.''' + return self.samfile != NULL + + def _hasIndex( self ): + '''return true if samfile has an existing (and opened) index.''' + return self.index != NULL + + def _open( self, + char * filename, + mode = None, + Samfile template = None, + referencenames = None, + referencelengths = None, + text = None, + header = None, + port = None, + add_sq_text = True, + ): + '''open a sam/bam file. + + If _open is called on an existing bamfile, the current file will be + closed and a new file will be opened. + ''' + + # read mode autodetection + if mode is None: + try: + self._open(filename, 'rb', template=template, + referencenames=referencenames, + referencelengths=referencelengths, + text=text, header=header, port=port) + return + except ValueError, msg: + pass + + self._open(filename, 'r', template=template, + referencenames=referencenames, + referencelengths=referencelengths, + text=text, header=header, port=port) + return + + assert mode in ( "r","w","rb","wb", "wh", "wbu", "rU" ), "invalid file opening mode `%s`" % mode + assert filename != NULL + + # close a previously opened file + if self.samfile != NULL: self.close() + self.samfile = NULL + + cdef bam_header_t * header_to_write + header_to_write = NULL + + if self._filename != NULL: free(self._filename ) + self._filename = strdup( filename ) + self.isstream = strcmp( filename, "-" ) == 0 + + self.isbam = len(mode) > 1 and mode[1] == 'b' + + self.isremote = strncmp(filename,"http:",5) == 0 or \ + strncmp(filename,"ftp:",4) == 0 + + cdef char * ctext + ctext = NULL + + if mode[0] == 'w': + # open file for writing + + # header structure (used for writing) + if template: + # copy header from another file + header_to_write = template.samfile.header + + elif header: + header_to_write = self._buildHeader( header ) + + else: + # build header from a target names and lengths + assert referencenames and referencelengths, "either supply options `template`, `header` or both `referencenames` and `referencelengths` for writing" + assert len(referencenames) == len(referencelengths), "unequal names and lengths of reference sequences" + + # allocate and fill header + header_to_write = bam_header_init() + header_to_write.n_targets = len(referencenames) + n = 0 + for x in referencenames: n += len(x) + 1 + header_to_write.target_name = calloc(n, sizeof(char*)) + header_to_write.target_len = calloc(n, sizeof(uint32_t)) + for x from 0 <= x < header_to_write.n_targets: + header_to_write.target_len[x] = referencelengths[x] + name = referencenames[x] + header_to_write.target_name[x] = calloc(len(name)+1, sizeof(char)) + strncpy( header_to_write.target_name[x], name, len(name) ) + + # Optionally, if there is no text, add a SAM compatible header to output + # file. + if text is None and add_sq_text: + text = '' + for x from 0 <= x < header_to_write.n_targets: + text += "@SQ\tSN:%s\tLN:%s\n" % (referencenames[x], referencelengths[x] ) + + if text != None: + # copy without \0 + ctext = text + header_to_write.l_text = strlen(ctext) + header_to_write.text = calloc( strlen(ctext), sizeof(char) ) + memcpy( header_to_write.text, ctext, strlen(ctext) ) + + header_to_write.hash = NULL + header_to_write.rg2lib = NULL + + # open file. Header gets written to file at the same time for bam files + # and sam files (in the latter case, the mode needs to be wh) + store = StderrStore() + self.samfile = samopen( filename, mode, header_to_write ) + store.release() + + # bam_header_destroy takes care of cleaning up of all the members + if not template and header_to_write != NULL: + bam_header_destroy( header_to_write ) + + elif mode[0] == "r": + # open file for reading + if strncmp( filename, "-", 1) != 0 and \ + not self.isremote and \ + not os.path.exists( filename ): + raise IOError( "file `%s` not found" % filename) + + # try to detect errors + self.samfile = samopen( filename, mode, NULL ) + if self.samfile == NULL: + raise ValueError( "could not open file (mode='%s') - is it SAM/BAM format?" % mode) + + if self.samfile.header == NULL: + raise ValueError( "file does not have valid header (mode='%s') - is it SAM/BAM format?" % mode ) + + #disabled for autodetection to work + # needs to be disabled so that reading from sam-files without headers works + #if self.samfile.header.n_targets == 0: + # raise ValueError( "file header is empty (mode='%s') - is it SAM/BAM format?" % mode) + + if self.samfile == NULL: + raise IOError("could not open file `%s`" % filename ) + + # check for index and open if present + if mode[0] == "r" and self.isbam: + + if not self.isremote: + if not os.path.exists(filename +".bai"): + self.index = NULL + else: + # returns NULL if there is no index or index could not be opened + self.index = bam_index_load(filename) + if self.index == NULL: + raise IOError("error while opening index `%s` " % filename ) + else: + self.index = bam_index_load(filename) + if self.index == NULL: + raise IOError("error while opening index `%s` " % filename ) + + if not self.isstream: + self.start_offset = bam_tell( self.samfile.x.bam ) + + def gettid( self, reference ): + ''' + convert :term:`reference` name into numerical :term:`tid` + + returns -1 if reference is not known. + ''' + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return pysam_reference2tid( self.samfile.header, reference ) + + def getrname( self, tid ): + ''' + convert numerical :term:`tid` into :term:`reference` name.''' + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + if not 0 <= tid < self.samfile.header.n_targets: + raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + return self.samfile.header.target_name[tid] + + cdef char * _getrname( self, int tid ): + ''' + convert numerical :term:`tid` into :term:`reference` name.''' + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + if not 0 <= tid < self.samfile.header.n_targets: + raise ValueError( "tid %i out of range 0<=tid<%i" % (tid, self.samfile.header.n_targets ) ) + return self.samfile.header.target_name[tid] + + def _parseRegion( self, + reference = None, + start = None, + end = None, + region = None ): + ''' + parse region information. + + raise ValueError for for invalid regions. + + returns a tuple of flag, tid, start and end. Flag indicates + whether some coordinates were supplied. + + Note that regions are 1-based, while start,end are python coordinates. + ''' + # This method's main objective is to translate from a reference to a tid. + # For now, it calls bam_parse_region, which is clumsy. Might be worth + # implementing it all in pysam (makes use of khash). + + cdef int rtid + cdef long long rstart + cdef long long rend + + rtid = -1 + rstart = 0 + rend = max_pos + if start != None: + try: + rstart = start + except OverflowError: + raise ValueError( 'start out of range (%i)' % start ) + + if end != None: + try: + rend = end + except OverflowError: + raise ValueError( 'end out of range (%i)' % end ) + + if region: + parts = re.split( "[:-]", region ) + reference = parts[0] + if len(parts) >= 2: rstart = int(parts[1]) - 1 + if len(parts) >= 3: rend = int(parts[2]) + + if not reference: return 0, 0, 0, 0 + + rtid = self.gettid( reference ) + if rtid < 0: raise ValueError( "invalid reference `%s`" % reference ) + if rstart > rend: raise ValueError( 'invalid coordinates: start (%i) > end (%i)' % (rstart, rend) ) + if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + if not 0 <= rend <= max_pos: raise ValueError( 'end out of range (%i)' % rend ) + + return 1, rtid, rstart, rend + + def reset( self ): + '''reset file position to beginning of read section.''' + return self.seek( self.start_offset, 0 ) + + def seek( self, uint64_t offset, int where = 0): + ''' + move file pointer to position *offset*, see :meth:`pysam.Samfile.tell`. + ''' + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + if not self.isbam: + raise NotImplementedError("seek only available in bam files") + if self.isstream: + raise OSError("seek no available in streams") + + return bam_seek( self.samfile.x.bam, offset, where ) + + def tell( self ): + ''' + return current file position + ''' + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + if not self.isbam: + raise NotImplementedError("seek only available in bam files") + + return bam_tell( self.samfile.x.bam ) + + def fetch( self, + reference = None, + start = None, + end = None, + region = None, + callback = None, + until_eof = False ): + ''' + fetch aligned reads in a :term:`region` using 0-based indexing. The region is specified by + :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can + be supplied. + + Without *reference* or *region* all mapped reads will be fetched. The reads will be returned + ordered by reference sequence, which will not necessarily be the order within the file. + + If *until_eof* is given, all reads from the current file position will be returned + in order as they are within the file. Using this option will also fetch unmapped reads. + + If only *reference* is set, all reads aligned to *reference* will be fetched. + + The method returns an iterator of type :class:`pysam.IteratorRow` unless + a *callback is provided. If *callback* is given, the callback will be executed + for each position within the :term:`region`. Note that callbacks currently work + only, if *region* or *reference* is given. + + Note that a :term:`SAM` file does not allow random access. If *region* or *reference* are given, + an exception is raised. + ''' + cdef int rtid, rstart, rend, has_coord + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + + if self.isstream: reopen = False + else: reopen = True + + if self.isbam: + if not until_eof and not self._hasIndex() and not self.isremote: + raise ValueError( "fetch called on bamfile without index" ) + + if callback: + if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + return bam_fetch(self.samfile.x.bam, + self.index, + rtid, + rstart, + rend, + callback, + fetch_callback ) + else: + if has_coord: + return IteratorRowRegion( self, rtid, rstart, rend, reopen=reopen ) + else: + if until_eof: + return IteratorRowAll( self, reopen=reopen ) + else: + # AH: check - reason why no reopen for AllRefs? + return IteratorRowAllRefs(self ) # , reopen=reopen ) + else: + # check if header is present - otherwise sam_read1 aborts + # this happens if a bamfile is opened with mode 'r' + if has_coord: + raise ValueError ("fetching by region is not available for sam files" ) + + if self.samfile.header.n_targets == 0: + raise ValueError( "fetch called for samfile without header") + + if callback: + raise NotImplementedError( "callback not implemented yet" ) + else: + return IteratorRowAll( self, reopen=reopen ) + + def mate( self, + AlignedRead read ): + '''return the mate of :class:`AlignedRead` *read*. + + Throws a ValueError if read is unpaired or the mate + is unmapped. + + .. note:: + Calling this method will change the file position. + This might interfere with any iterators that have + not re-opened the file. + + ''' + cdef uint32_t flag = read._delegate.core.flag + + if flag & BAM_FPAIRED == 0: + raise ValueError( "read %s: is unpaired" % (read.qname)) + if flag & BAM_FMUNMAP != 0: + raise ValueError( "mate %s: is unmapped" % (read.qname)) + + cdef MateData mate_data + + mate_data.name = bam1_qname(read._delegate) + mate_data.mate = NULL + # xor flags to get the other mate + cdef int x = BAM_FREAD1 + BAM_FREAD2 + mate_data.flag = ( flag ^ x) & x + + bam_fetch(self.samfile.x.bam, + self.index, + read._delegate.core.mtid, + read._delegate.core.mpos, + read._delegate.core.mpos + 1, + &mate_data, + mate_callback ) + + if mate_data.mate == NULL: + raise ValueError( "mate not found" ) + + cdef AlignedRead dest = AlignedRead.__new__(AlignedRead) + dest._delegate = mate_data.mate + return dest + + def count( self, + reference = None, + start = None, + end = None, + region = None, + until_eof = False ): + '''*(reference = None, start = None, end = None, region = None, callback = None, until_eof = False)* + + count reads :term:`region` using 0-based indexing. The region is specified by + :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied. + + Note that a :term:`TAM` file does not allow random access. If *region* or *reference* are given, + an exception is raised. + ''' + cdef int rtid + cdef int rstart + cdef int rend + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + + cdef int counter + counter = 0; + + if self.isbam: + if not until_eof and not self._hasIndex() and not self.isremote: + raise ValueError( "fetch called on bamfile without index" ) + + if not region: + raise ValueError( "counting functionality requires a region/reference" ) + if not self._hasIndex(): raise ValueError( "no index available for fetch" ) + bam_fetch(self.samfile.x.bam, + self.index, + rtid, + rstart, + rend, + &counter, + count_callback ) + return counter + else: + raise ValueError ("count for a region is not available for sam files" ) + + def pileup( self, + reference = None, + start = None, + end = None, + region = None, + callback = None, + **kwargs ): + ''' + perform a :term:`pileup` within a :term:`region`. The region is specified by + :term:`reference`, *start* and *end* (using 0-based indexing). + Alternatively, a samtools *region* string can be supplied. + + Without *reference* or *region* all reads will be used for the pileup. The reads will be returned + ordered by :term:`reference` sequence, which will not necessarily be the order within the file. + + The method returns an iterator of type :class:`pysam.IteratorColumn` unless + a *callback is provided. If a *callback* is given, the callback will be executed + for each column within the :term:`region`. + + Note that :term:`SAM` formatted files do not allow random access. + In these files, if a *region* or *reference* are given an exception is raised. + + Optional *kwargs* to the iterator: + + stepper + The stepper controlls how the iterator advances. + Possible options for the stepper are + + ``all`` + use all reads for pileup. + ``samtools`` + same filter and read processing as in :term:`csamtools` pileup + + fastafile + A :class:`FastaFile` object + + mask + Skip all reads with bits set in mask. + + max_depth + Maximum read depth permitted. The default limit is *8000*. + + .. note:: + + *all* reads which overlap the region are returned. The first base returned will be the + first base of the first read *not* necessarily the first base of the region used in the query. + + ''' + cdef int rtid, rstart, rend, has_coord + cdef bam_plbuf_t *buf + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + has_coord, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + + if self.isbam: + if not self._hasIndex(): raise ValueError( "no index available for pileup" ) + + if callback: + if not has_coord: raise ValueError( "callback functionality requires a region/reference" ) + + buf = bam_plbuf_init( pileup_callback, callback ) + bam_fetch(self.samfile.x.bam, + self.index, rtid, rstart, rend, + buf, pileup_fetch_callback ) + + # finalize pileup + bam_plbuf_push( NULL, buf) + bam_plbuf_destroy(buf) + else: + if has_coord: + return IteratorColumnRegion( self, + tid = rtid, + start = rstart, + end = rend, + **kwargs ) + else: + return IteratorColumnAllRefs(self, **kwargs ) + + else: + raise NotImplementedError( "pileup of samfiles not implemented yet" ) + + def close( self ): + ''' + closes the :class:`pysam.Samfile`.''' + if self.samfile != NULL: + samclose( self.samfile ) + bam_index_destroy(self.index); + self.samfile = NULL + + def __dealloc__( self ): + # remember: dealloc cannot call other methods + # note: no doc string + # note: __del__ is not called. + self.close() + bam_destroy1(self.b) + if self._filename != NULL: free( self._filename ) + + cpdef int write( self, AlignedRead read ) except -1: + ''' + write a single :class:`pysam.AlignedRead` to disk. + + returns the number of bytes written. + ''' + if not self._isOpen(): + return 0 + + return samwrite( self.samfile, read._delegate ) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + return False + + ############################################################### + ############################################################### + ############################################################### + ## properties + ############################################################### + property filename: + '''number of :term:`filename` associated with this object.''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return self._filename + + property nreferences: + '''number of :term:`reference` sequences in the file.''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return self.samfile.header.n_targets + + property references: + """tuple with the names of :term:`reference` sequences.""" + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + t = [] + for x from 0 <= x < self.samfile.header.n_targets: + t.append( self.samfile.header.target_name[x] ) + return tuple(t) + + property lengths: + """tuple of the lengths of the :term:`reference` sequences. The lengths are in the same order as + :attr:`pysam.Samfile.references` + """ + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + t = [] + for x from 0 <= x < self.samfile.header.n_targets: + t.append( self.samfile.header.target_len[x] ) + return tuple(t) + + property mapped: + """total number of mapped reads in file. + """ + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + if not self.isbam: raise AttributeError( "Samfile.mapped only available in bam files" ) + + cdef int tid + cdef uint32_t total = 0 + for tid from 0 <= tid < self.samfile.header.n_targets: + total += pysam_get_mapped( self.index, tid ) + return total + + property unmapped: + """total number of unmapped reads in file. + """ + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + if not self.isbam: raise AttributeError( "Samfile.unmapped only available in bam files" ) + cdef int tid + cdef uint32_t total = 0 + for tid from 0 <= tid < self.samfile.header.n_targets: + total += pysam_get_unmapped( self.index, tid ) + # get unmapped reads without coordinates + total += pysam_get_unmapped( self.index, -1 ) + return total + + property text: + '''full contents of the :term:`sam file` header as a string.''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return PyString_FromStringAndSize(self.samfile.header.text, self.samfile.header.l_text) + + property header: + '''header information within the :term:`sam file`. The records and fields are returned as + a two-level dictionary. + ''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + + result = {} + + if self.samfile.header.text != NULL: + # convert to python string (note: call self.text to create 0-terminated string) + t = self.text + for line in t.split("\n"): + if not line.strip(): continue + assert line.startswith("@"), "header line without '@': '%s'" % line + fields = line[1:].split("\t") + record = fields[0] + assert record in VALID_HEADER_TYPES, "header line with invalid type '%s': '%s'" % (record, line) + + # treat comments + if record == "CO": + if record not in result: result[record] = [] + result[record].append( "\t".join( fields[1:] ) ) + continue + + # the following is clumsy as generators do not work? + x = {} + for field in fields[1:]: + key, value = field.split(":",1) + # uppercase keys must be valid + # lowercase are permitted for user fields + if key in VALID_HEADER_FIELDS[record]: + x[key] = VALID_HEADER_FIELDS[record][key](value) + elif not key.isupper(): + x[key] = value + else: + raise ValueError( "unknown field code '%s' in record '%s'" % (key, record) ) + + if VALID_HEADER_TYPES[record] == dict: + if record in result: + raise ValueError( "multiple '%s' lines are not permitted" % record ) + result[record] = x + elif VALID_HEADER_TYPES[record] == list: + if record not in result: result[record] = [] + result[record].append( x ) + + return result + + def _buildLine( self, fields, record ): + '''build a header line from *fields* dictionary for *record*''' + + # TODO: add checking for field and sort order + line = ["@%s" % record ] + if record == "CO": + line.append( fields ) + else: + # write fields of the specification + for key in VALID_HEADER_ORDER[record]: + if key in fields: + line.append( "%s:%s" % (key, str(fields[key]))) + # write user fields + for key in fields: + if not key.isupper(): + line.append( "%s:%s" % (key, str(fields[key]))) + + return "\t".join( line ) + + cdef bam_header_t * _buildHeader( self, new_header ): + '''return a new header built from a dictionary in *new_header*. + + This method inserts the text field, target_name and target_len. + ''' + + lines = [] + + # check if hash exists + + # create new header and copy old data + cdef bam_header_t * dest + + dest = bam_header_init() + + for record in VALID_HEADERS: + if record in new_header: + ttype = VALID_HEADER_TYPES[record] + data = new_header[record] + if type( data ) != type( ttype() ): + raise ValueError( "invalid type for record %s: %s, expected %s" % (record, type(data), type(ttype()) ) ) + if type( data ) == types.DictType: + lines.append( self._buildLine( data, record ) ) + else: + for fields in new_header[record]: + lines.append( self._buildLine( fields, record ) ) + + text = "\n".join(lines) + "\n" + if dest.text != NULL: free( dest.text ) + dest.text = calloc( len(text), sizeof(char)) + dest.l_text = len(text) + strncpy( dest.text, text, dest.l_text ) + + # collect targets + if "SQ" in new_header: + seqs = [] + for fields in new_header["SQ"]: + try: + seqs.append( (fields["SN"], fields["LN"] ) ) + except KeyError: + raise KeyError( "incomplete sequence information in '%s'" % str(fields)) + + dest.n_targets = len(seqs) + dest.target_name = calloc( dest.n_targets, sizeof(char*) ) + dest.target_len = calloc( dest.n_targets, sizeof(uint32_t) ) + + for x from 0 <= x < dest.n_targets: + seqname, seqlen = seqs[x] + dest.target_name[x] = calloc( len( seqname ) + 1, sizeof(char) ) + strncpy( dest.target_name[x], seqname, len(seqname) + 1 ) + dest.target_len[x] = seqlen + + return dest + + ############################################################### + ############################################################### + ############################################################### + ## file-object like iterator access + ## note: concurrent access will cause errors (see IteratorRow + ## and reopen) + ## Possible solutions: deprecate or open new file handle + ############################################################### + def __iter__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + if not self.isbam and self.samfile.header.n_targets == 0: + raise NotImplementedError( "can not iterate over samfile without header") + return self + + cdef bam1_t * getCurrent( self ): + return self.b + + cdef int cnext(self): + ''' + cversion of iterator. Used by :class:`pysam.Samfile.IteratorColumn`. + ''' + cdef int ret + return samread(self.samfile, self.b) + + def __next__(self): + """ + python version of next(). + """ + cdef int ret + ret = samread(self.samfile, self.b) + if (ret > 0): + return makeAlignedRead( self.b ) + else: + raise StopIteration + +##------------------------------------------------------------------- +##------------------------------------------------------------------- +##------------------------------------------------------------------- +cdef class IteratorRow: + '''abstract base class for iterators over mapped reads. + + Various iterators implement different behaviours for wrapping around + contig boundaries. Examples include: + + :class:`pysam.IteratorRowRegion` + iterate within a single contig and a defined region. + + :class:`pysam.IteratorRowAll` + iterate until EOF. This iterator will also include unmapped reads. + + :class:`pysam.IteratorRowAllRefs` + iterate over all reads in all reference sequences. + + The method :meth:`Samfile.fetch` returns an IteratorRow. + ''' + pass + +cdef class IteratorRowRegion(IteratorRow): + """*(Samfile samfile, int tid, int beg, int end, int reopen = True )* + + iterate over mapped reads in a region. + + By default, the file is re-openend to avoid conflicts between + multiple iterators working on the same file. Set *reopen* = False + to not re-open *samfile*. + + The samtools iterators assume that the file + position between iterations do not change. + As a consequence, no two iterators can work + on the same file. To permit this, each iterator + creates its own file handle by re-opening the + file. + + Note that the index will be shared between + samfile and the iterator. + """ + + cdef bam_iter_t iter # iterator state object + cdef bam1_t * b + cdef int retval + cdef Samfile samfile + cdef samfile_t * fp + # true if samfile belongs to this object + cdef int owns_samfile + + def __cinit__(self, Samfile samfile, int tid, int beg, int end, int reopen = True ): + + if not samfile._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + if not samfile._hasIndex(): + raise ValueError( "no index available for iteration" ) + + # makes sure that samfile stays alive as long as the + # iterator is alive + self.samfile = samfile + + if samfile.isbam: mode = "rb" + else: mode = "r" + + # reopen the file - note that this makes the iterator + # slow and causes pileup to slow down significantly. + if reopen: + store = StderrStore() + self.fp = samopen( samfile._filename, mode, NULL ) + store.release() + assert self.fp != NULL + self.owns_samfile = True + else: + self.fp = self.samfile.samfile + self.owns_samfile = False + + self.retval = 0 + + self.iter = bam_iter_query(self.samfile.index, + tid, + beg, + end) + self.b = bam_init1() + + def __iter__(self): + return self + + cdef bam1_t * getCurrent( self ): + return self.b + + cdef int cnext(self): + '''cversion of iterator. Used by IteratorColumn''' + self.retval = bam_iter_read( self.fp.x.bam, + self.iter, + self.b) + + def __next__(self): + """python version of next(). + """ + self.cnext() + if self.retval < 0: raise StopIteration + return makeAlignedRead( self.b ) + + def __dealloc__(self): + bam_destroy1(self.b) + if self.owns_samfile: samclose( self.fp ) + +cdef class IteratorRowAll(IteratorRow): + """*(Samfile samfile, int reopen = True)* + + iterate over all reads in *samfile* + + By default, the file is re-openend to avoid conflicts between + multiple iterators working on the same file. Set *reopen* = False + to not re-open *samfile*. + """ + + # cdef bam1_t * b + # cdef samfile_t * fp + # # true if samfile belongs to this object + # cdef int owns_samfile + + def __cinit__(self, Samfile samfile, int reopen = True ): + + if not samfile._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + if samfile.isbam: mode = "rb" + else: mode = "r" + + # reopen the file to avoid iterator conflict + if reopen: + store = StderrStore() + self.fp = samopen( samfile._filename, mode, NULL ) + store.release() + assert self.fp != NULL + self.owns_samfile = True + else: + self.fp = samfile.samfile + self.owns_samfile = False + + # allocate memory for alignment + self.b = calloc(1, sizeof(bam1_t)) + + def __iter__(self): + return self + + cdef bam1_t * getCurrent( self ): + return self.b + + cdef int cnext(self): + '''cversion of iterator. Used by IteratorColumn''' + cdef int ret + return samread(self.fp, self.b) + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + cdef int ret + ret = samread(self.fp, self.b) + if (ret > 0): + return makeAlignedRead( self.b ) + else: + raise StopIteration + + def __dealloc__(self): + bam_destroy1(self.b) + if self.owns_samfile: samclose( self.fp ) + +cdef class IteratorRowAllRefs(IteratorRow): + """iterates over all mapped reads by chaining iterators over each reference + """ + cdef Samfile samfile + cdef int tid + cdef IteratorRowRegion rowiter + + def __cinit__(self, Samfile samfile): + assert samfile._isOpen() + if not samfile._hasIndex(): raise ValueError("no index available for fetch") + self.samfile = samfile + self.tid = -1 + + def nextiter(self): + self.rowiter = IteratorRowRegion(self.samfile, self.tid, 0, 1<<29) + + def __iter__(self): + return self + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + # Create an initial iterator + if self.tid==-1: + if not self.samfile.nreferences: + raise StopIteration + self.tid = 0 + self.nextiter() + + while 1: + self.rowiter.cnext() + + # If current iterator is not exhausted, return aligned read + if self.rowiter.retval>0: + return makeAlignedRead(self.rowiter.b) + + self.tid += 1 + + # Otherwise, proceed to next reference or stop + if self.tidcalloc(1, sizeof(bam1_t)) + + self.positions = positions + self.current_pos = 0 + + def __iter__(self): + return self + + cdef bam1_t * getCurrent( self ): + return self.b + + cdef int cnext(self): + '''cversion of iterator''' + + # end iteration if out of positions + if self.current_pos >= len(self.positions): return -1 + + bam_seek( self.fp.x.bam, self.positions[self.current_pos], 0 ) + self.current_pos += 1 + return samread(self.fp, self.b) + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + + cdef int ret = self.cnext() + if (ret > 0): + return makeAlignedRead( self.b ) + else: + raise StopIteration + + def __dealloc__(self): + bam_destroy1(self.b) + if self.owns_samfile: samclose( self.fp ) + +##------------------------------------------------------------------- +##------------------------------------------------------------------- +##------------------------------------------------------------------- +ctypedef struct __iterdata: + samfile_t * samfile + bam_iter_t iter + faidx_t * fastafile + int tid + char * seq + int seq_len + +cdef int __advance_all( void * data, bam1_t * b ): + '''advance without any read filtering. + ''' + cdef __iterdata * d + d = <__iterdata*>data + return bam_iter_read( d.samfile.x.bam, d.iter, b ) + +cdef int __advance_snpcalls( void * data, bam1_t * b ): + '''advance using same filter and read processing as in + the samtools pileup. + ''' + cdef __iterdata * d + d = <__iterdata*>data + + cdef int ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) + cdef int skip = 0 + cdef int q + cdef int is_cns = 1 + cdef int is_nobaq = 0 + cdef int capQ_thres = 0 + + # reload sequence + if d.fastafile != NULL and b.core.tid != d.tid: + if d.seq != NULL: free(d.seq) + d.tid = b.core.tid + d.seq = faidx_fetch_seq(d.fastafile, + d.samfile.header.target_name[d.tid], + 0, max_pos, + &d.seq_len) + if d.seq == NULL: + raise ValueError( "reference sequence for '%s' (tid=%i) not found" % \ + (d.samfile.header.target_name[d.tid], + d.tid)) + + + while ret >= 0: + + skip = 0 + + # realign read - changes base qualities + if d.seq != NULL and is_cns and not is_nobaq: bam_prob_realn( b, d.seq ) + + if d.seq != NULL and capQ_thres > 10: + q = bam_cap_mapQ(b, d.seq, capQ_thres) + if q < 0: skip = 1 + elif b.core.qual > q: b.core.qual = q + if b.core.flag & BAM_FUNMAP: skip = 1 + elif b.core.flag & 1 and not b.core.flag & 2: skip = 1 + + if not skip: break + # additional filters + + ret = bam_iter_read( d.samfile.x.bam, d.iter, b ) + + return ret + +cdef class IteratorColumn: + '''abstract base class for iterators over columns. + + IteratorColumn objects wrap the pileup functionality of samtools. + + For reasons of efficiency, the iterator points to the current + pileup buffer. The pileup buffer is updated at every iteration. + This might cause some unexpected behavious. For example, + consider the conversion to a list:: + + f = Samfile("file.bam", "rb") + result = list( f.pileup() ) + + Here, ``result`` will contain ``n`` objects of type :class:`PileupProxy` for ``n`` columns, + but each object in ``result`` will contain the same information. + + The desired behaviour can be achieved by list comprehension:: + + result = [ x.pileups() for x in f.pileup() ] + + ``result`` will be a list of ``n`` lists of objects of type :class:`PileupRead`. + + If the iterator is associated with a :class:`Fastafile` using the :meth:`addReference` + method, then the iterator will export the current sequence via the methods :meth:`getSequence` + and :meth:`seq_len`. + + Optional kwargs to the iterator + + stepper + The stepper controlls how the iterator advances. + Possible options for the stepper are + + all + use all reads for pileup. + samtools + same filter and read processing as in :term:`csamtools` pileup + fastafile + A :class:`FastaFile` object + mask + Skip all reads with bits set in mask. + max_depth + maximum read depth. The default is 8000. + ''' + + # result of the last plbuf_push + cdef IteratorRowRegion iter + cdef int tid + cdef int pos + cdef int n_plp + cdef int mask + cdef const_bam_pileup1_t_ptr plp + cdef bam_plp_t pileup_iter + cdef __iterdata iterdata + cdef Samfile samfile + cdef Fastafile fastafile + cdef stepper + cdef int max_depth + + def __cinit__( self, Samfile samfile, **kwargs ): + self.samfile = samfile + self.mask = kwargs.get("mask", BAM_DEF_MASK ) + self.fastafile = kwargs.get( "fastafile", None ) + self.stepper = kwargs.get( "stepper", None ) + self.max_depth = kwargs.get( "max_depth", 8000 ) + self.iterdata.seq = NULL + self.tid = 0 + self.pos = 0 + self.n_plp = 0 + self.plp = NULL + self.pileup_iter = NULL + + + def __iter__(self): + return self + + cdef int cnext(self): + '''perform next iteration. + + This method is analogous to the samtools bam_plp_auto method. + It has been re-implemented to permit for filtering. + ''' + self.plp = bam_plp_auto( self.pileup_iter, + &self.tid, + &self.pos, + &self.n_plp ) + + cdef char * getSequence( self ): + '''return current reference sequence underlying the iterator. + ''' + return self.iterdata.seq + + property seq_len: + '''current sequence length.''' + def __get__(self): return self.iterdata.seq_len + + def addReference( self, Fastafile fastafile ): + ''' + add reference sequences in *fastafile* to iterator.''' + self.fastafile = fastafile + if self.iterdata.seq != NULL: free(self.iterdata.seq) + self.iterdata.tid = -1 + self.iterdata.fastafile = self.fastafile.fastafile + + def hasReference( self ): + ''' + return true if iterator is associated with a reference''' + return self.fastafile + + cdef setMask( self, mask ): + '''set masking flag in iterator. + + reads with bits set in *mask* will be skipped. + ''' + self.mask = mask + bam_plp_set_mask( self.pileup_iter, self.mask ) + + cdef setupIteratorData( self, + int tid, + int start, + int end, + int reopen = 0 ): + '''setup the iterator structure''' + + self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen ) + self.iterdata.samfile = self.samfile.samfile + self.iterdata.iter = self.iter.iter + self.iterdata.seq = NULL + self.iterdata.tid = -1 + + if self.fastafile != None: + self.iterdata.fastafile = self.fastafile.fastafile + else: + self.iterdata.fastafile = NULL + + if self.stepper == None or self.stepper == "all": + self.pileup_iter = bam_plp_init( &__advance_all, &self.iterdata ) + elif self.stepper == "samtools": + self.pileup_iter = bam_plp_init( &__advance_snpcalls, &self.iterdata ) + else: + raise ValueError( "unknown stepper option `%s` in IteratorColumn" % self.stepper) + + if self.max_depth: + bam_plp_set_maxcnt( self.pileup_iter, self.max_depth ) + + bam_plp_set_mask( self.pileup_iter, self.mask ) + + cdef reset( self, tid, start, end ): + '''reset iterator position. + + This permits using the iterator multiple times without + having to incur the full set-up costs. + ''' + self.iter = IteratorRowRegion( self.samfile, tid, start, end, reopen = 0 ) + self.iterdata.iter = self.iter.iter + + # invalidate sequence if different tid + if self.tid != tid: + if self.iterdata.seq != NULL: free( self.iterdata.seq ) + self.iterdata.seq = NULL + self.iterdata.tid = -1 + + # self.pileup_iter = bam_plp_init( &__advancepileup, &self.iterdata ) + bam_plp_reset(self.pileup_iter) + + def __dealloc__(self): + # reset in order to avoid memory leak messages for iterators that have + # not been fully consumed + if self.pileup_iter != NULL: + bam_plp_reset(self.pileup_iter) + bam_plp_destroy(self.pileup_iter) + self.pileup_iter = NULL + + if self.iterdata.seq != NULL: + free(self.iterdata.seq) + self.iterdata.seq = NULL + +cdef class IteratorColumnRegion(IteratorColumn): + '''iterates over a region only. + ''' + def __cinit__(self, Samfile samfile, + int tid = 0, + int start = 0, + int end = max_pos, + **kwargs ): + + # initialize iterator + self.setupIteratorData( tid, start, end, 1 ) + + def __next__(self): + """python version of next(). + """ + + while 1: + self.cnext() + if self.n_plp < 0: + raise ValueError("error during iteration" ) + + if self.plp == NULL: + raise StopIteration + + return makePileupProxy( self.plp, + self.tid, + self.pos, + self.n_plp ) + +cdef class IteratorColumnAllRefs(IteratorColumn): + """iterates over all columns by chaining iterators over each reference + """ + + def __cinit__(self, + Samfile samfile, + **kwargs ): + + # no iteration over empty files + if not samfile.nreferences: raise StopIteration + + # initialize iterator + self.setupIteratorData( self.tid, 0, max_pos, 1 ) + + def __next__(self): + """python version of next(). + """ + + while 1: + self.cnext() + + if self.n_plp < 0: + raise ValueError("error during iteration" ) + + # return result, if within same reference + if self.plp != NULL: + return makePileupProxy( self.plp, + self.tid, + self.pos, + self.n_plp ) + + # otherwise, proceed to next reference or stop + self.tid += 1 + if self.tid < self.samfile.nreferences: + self.setupIteratorData( self.tid, 0, max_pos, 0 ) + else: + raise StopIteration + +##------------------------------------------------------------------- +##------------------------------------------------------------------- +##------------------------------------------------------------------- +cdef inline int32_t query_start(bam1_t *src) except -1: + cdef uint32_t * cigar_p, op + cdef uint32_t k + cdef uint32_t start_offset = 0 + + if src.core.n_cigar: + cigar_p = bam1_cigar(src); + for k from 0 <= k < src.core.n_cigar: + op = cigar_p[k] & BAM_CIGAR_MASK + if op==BAM_CHARD_CLIP: + if start_offset!=0 and start_offset!=src.core.l_qseq: + PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + return -1 + elif op==BAM_CSOFT_CLIP: + start_offset += cigar_p[k] >> BAM_CIGAR_SHIFT + else: + break + + return start_offset + +##------------------------------------------------------------------- +##------------------------------------------------------------------- +##------------------------------------------------------------------- +cdef inline int32_t query_end(bam1_t *src) except -1: + cdef uint32_t * cigar_p, op + cdef uint32_t k + cdef uint32_t end_offset = src.core.l_qseq + + if src.core.n_cigar>1: + cigar_p = bam1_cigar(src); + for k from src.core.n_cigar > k >= 1: + op = cigar_p[k] & BAM_CIGAR_MASK + if op==BAM_CHARD_CLIP: + if end_offset!=0 and end_offset!=src.core.l_qseq: + PyErr_SetString(ValueError, 'Invalid clipping in CIGAR string') + return -1 + elif op==BAM_CSOFT_CLIP: + end_offset -= cigar_p[k] >> BAM_CIGAR_SHIFT + else: + break + + if end_offset==0: + end_offset = src.core.l_qseq + + return end_offset + + +cdef inline object get_seq_range(bam1_t *src, uint32_t start, uint32_t end): + cdef uint8_t * p + cdef uint32_t k + cdef char * s + + if not src.core.l_qseq: + return None + + seq = PyString_FromStringAndSize(NULL, end-start) + s = PyString_AS_STRING(seq) + p = bam1_seq(src) + + for k from start <= k < end: + # equivalent to bam_nt16_rev_table[bam1_seqi(s, i)] (see bam.c) + # note: do not use string literal as it will be a python string + s[k-start] = bam_nt16_rev_table[p[k/2] >> 4 * (1 - k%2) & 0xf] + + return seq + + +cdef inline object get_qual_range(bam1_t *src, uint32_t start, uint32_t end): + cdef uint8_t * p + cdef uint32_t k + cdef char * q + + p = bam1_qual(src) + if p[0] == 0xff: + return None + + qual = PyString_FromStringAndSize(NULL, end-start) + q = PyString_AS_STRING(qual) + + for k from start <= k < end: + ## equivalent to t[i] + 33 (see bam.c) + q[k-start] = p[k] + 33 + + return qual + +cdef class AlignedRead: + ''' + Class representing an aligned read. see SAM format specification for + the meaning of fields (http://samtools.sourceforge.net/). + + This class stores a handle to the samtools C-structure representing + an aligned read. Member read access is forwarded to the C-structure + and converted into python objects. This implementation should be fast, + as only the data needed is converted. + + For write access, the C-structure is updated in-place. This is + not the most efficient way to build BAM entries, as the variable + length data is concatenated and thus needs to resized if + a field is updated. Furthermore, the BAM entry might be + in an inconsistent state. The :meth:`~validate` method can + be used to check if an entry is consistent. + + One issue to look out for is that the sequence should always + be set *before* the quality scores. Setting the sequence will + also erase any quality scores that were set previously. + ''' + + # Now only called when instances are created from Python + def __init__(self): + # see bam_init1 + self._delegate = calloc( 1, sizeof( bam1_t) ) + # allocate some memory + # If size is 0, calloc does not return a pointer that can be passed to free() + # so allocate 40 bytes for a new read + self._delegate.m_data = 40 + self._delegate.data = calloc( self._delegate.m_data, 1 ) + self._delegate.data_len = 0 + + def __dealloc__(self): + bam_destroy1(self._delegate) + + def __str__(self): + """return string representation of alignment. + + The representation is an approximate :term:`sam` format. + + An aligned read might not be associated with a :term:`Samfile`. + As a result :term:`tid` is shown instead of the reference name. + + Similarly, the tags field is returned in its parsed state. + """ + # sam-parsing is done in sam.c/bam_format1_core which + # requires a valid header. + return "\t".join(map(str, (self.qname, + self.flag, + self.rname, + self.pos, + self.mapq, + self.cigar, + self.mrnm, + self.mpos, + self.rlen, + self.seq, + self.qual, + self.tags ))) + + def compare(self, AlignedRead other): + '''return -1,0,1, if contents in this are binary <,=,> to *other*''' + + cdef int retval, x + cdef bam1_t *t, *o + + t = self._delegate + o = other._delegate + + # uncomment for debugging purposes + # cdef unsigned char * oo, * tt + # tt = (&t.core) + # oo = (&o.core) + # for x from 0 <= x < sizeof( bam1_core_t): print x, tt[x], oo[x] + # tt = (t.data) + # oo = (o.data) + # for x from 0 <= x < max(t.data_len, o.data_len): print x, tt[x], oo[x], chr(tt[x]), chr(oo[x]) + + # Fast-path test for object identity + if t==o: + return 0 + + retval = memcmp(&t.core, &o.core, sizeof(bam1_core_t)) + + if retval: return retval + retval = cmp(t.data_len, o.data_len) + if retval: return retval + return memcmp(t.data, o.data, t.data_len) + + # Disabled so long as __cmp__ is a special method + def __hash__(self): + return _Py_HashPointer(self) + + property qname: + """the query name (None if not present)""" + def __get__(self): + cdef bam1_t * src + src = self._delegate + if src.core.l_qname == 0: return None + return bam1_qname( src ) + + def __set__(self, qname ): + if qname == None or len(qname) == 0: return + cdef bam1_t * src + cdef int l + cdef char * p + + src = self._delegate + p = bam1_qname( src ) + + # the qname is \0 terminated + l = len(qname) + 1 + pysam_bam_update( src, + src.core.l_qname, + l, + p ) + + src.core.l_qname = l + + # re-acquire pointer to location in memory + # as it might have moved + p = bam1_qname(src) + + strncpy( p, qname, l ) + + property cigar: + """the :term:`cigar` alignment (None if not present). + """ + def __get__(self): + cdef uint32_t * cigar_p + cdef bam1_t * src + cdef op, l, cigar + cdef int k + + src = self._delegate + if src.core.n_cigar == 0: return None + + cigar = [] + cigar_p = bam1_cigar(src); + for k from 0 <= k < src.core.n_cigar: + op = cigar_p[k] & BAM_CIGAR_MASK + l = cigar_p[k] >> BAM_CIGAR_SHIFT + cigar.append((op, l)) + return cigar + + def __set__(self, values ): + if values == None or len(values) == 0: return + cdef uint32_t * p + cdef bam1_t * src + cdef op, l + cdef int k + + k = 0 + + src = self._delegate + + # get location of cigar string + p = bam1_cigar(src) + + # create space for cigar data within src.data + pysam_bam_update( src, + src.core.n_cigar * 4, + len(values) * 4, + p ) + + # length is number of cigar operations, not bytes + src.core.n_cigar = len(values) + + # re-acquire pointer to location in memory + # as it might have moved + p = bam1_cigar(src) + + # insert cigar operations + for op, l in values: + p[k] = l << BAM_CIGAR_SHIFT | op + k += 1 + + ## setting the cigar string also updates the "bin" attribute + src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, p)) + + property seq: + """read sequence bases, including :term:`soft clipped` bases (None if not present)""" + def __get__(self): + cdef bam1_t * src + cdef char * s + src = self._delegate + + if src.core.l_qseq == 0: return None + + return get_seq_range(src, 0, src.core.l_qseq) + + def __set__(self,seq): + # samtools manages sequence and quality length memory together + # if no quality information is present, the first byte says 0xff. + + if seq == None or len(seq) == 0: return + cdef bam1_t * src + cdef uint8_t * p + cdef char * s + cdef int l, k, nbytes_new, nbytes_old + + src = self._delegate + + l = len(seq) + + # as the sequence is stored in half-bytes, the total length (sequence + # plus quality scores) is (l+1)/2 + l + nbytes_new = (l+1)/2 + l + nbytes_old = (src.core.l_qseq+1)/2 + src.core.l_qseq + # acquire pointer to location in memory + p = bam1_seq( src ) + src.core.l_qseq = l + + pysam_bam_update( src, + nbytes_old, + nbytes_new, + p) + # re-acquire pointer to location in memory + # as it might have moved + p = bam1_seq( src ) + for k from 0 <= k < nbytes_new: p[k] = 0 + # convert to C string + s = seq + for k from 0 <= k < l: + p[k/2] |= pysam_translate_sequence(s[k]) << 4 * (1 - k % 2) + + # erase qualities + p = bam1_qual( src ) + p[0] = 0xff + + + property qual: + """read sequence base qualities, including :term:`soft clipped` bases (None if not present)""" + def __get__(self): + + cdef bam1_t * src + cdef char * q + + src = self._delegate + + if src.core.l_qseq == 0: return None + + return get_qual_range(src, 0, src.core.l_qseq) + + def __set__(self,qual): + # note that space is already allocated via the sequences + cdef bam1_t * src + cdef uint8_t * p + cdef char * q + cdef int k + + src = self._delegate + p = bam1_qual( src ) + if qual == None or len(qual) == 0: + # if absent - set to 0xff + p[0] = 0xff + return + cdef int l + # convert to C string + q = qual + l = len(qual) + if src.core.l_qseq != l: + raise ValueError("quality and sequence mismatch: %i != %i" % (l, src.core.l_qseq)) + assert src.core.l_qseq == l + for k from 0 <= k < l: + p[k] = q[k] - 33 + + property query: + """aligned portion of the read and excludes any flanking bases that were :term:`soft clipped` (None if not present) + + SAM/BAM files may included extra flanking bases sequences that were + not part of the alignment. These bases may be the result of the + Smith-Waterman or other algorithms, which may not require alignments + that begin at the first residue or end at the last. In addition, + extra sequencing adapters, multiplex identifiers, and low-quality bases that + were not considered for alignment may have been retained.""" + + def __get__(self): + cdef bam1_t * src + cdef uint32_t start, end + cdef char * s + + src = self._delegate + + if src.core.l_qseq == 0: return None + + start = query_start(src) + end = query_end(src) + + return get_seq_range(src, start, end) + + property qqual: + """aligned query sequence quality values (None if not present)""" + def __get__(self): + cdef bam1_t * src + cdef uint32_t start, end + cdef char * q + + src = self._delegate + + if src.core.l_qseq == 0: return None + + start = query_start(src) + end = query_end(src) + + return get_qual_range(src, start, end) + + property qstart: + """start index of the aligned query portion of the sequence (0-based, inclusive)""" + def __get__(self): + return query_start(self._delegate) + + property qend: + """end index of the aligned query portion of the sequence (0-based, exclusive)""" + def __get__(self): + return query_end(self._delegate) + + property qlen: + """Length of the aligned query sequence""" + def __get__(self): + cdef bam1_t * src + src = self._delegate + return query_end(src)-query_start(src) + + property tags: + """the tags in the AUX field. + + This property permits convenience access to + the tags. Changes it the returned list will + not update the tags automatically. Instead, + the following is required for adding a + new tag:: + + read.tags = read.tags + [("RG",0)] + + + This method will happily write the same tag + multiple times. + """ + def __get__(self): + cdef char * ctag + cdef bam1_t * src + cdef uint8_t * s + cdef char auxtag[3] + cdef char auxtype + + src = self._delegate + if src.l_aux == 0: return [] + + s = bam1_aux( src ) + result = [] + auxtag[2] = 0 + while s < (src.data + src.data_len): + # get tag + auxtag[0] = s[0] + auxtag[1] = s[1] + s += 2 + auxtype = s[0] + + if auxtype in ('c', 'C'): + value = bam_aux2i(s) + s += 1 + elif auxtype in ('s', 'S'): + value = bam_aux2i(s) + s += 2 + elif auxtype in ('i', 'I'): + value = bam_aux2i(s) + s += 4 + elif auxtype == 'f': + value = bam_aux2f(s) + s += 4 + elif auxtype == 'd': + value = bam_aux2d(s) + s += 8 + elif auxtype == 'A': + value = "%c" % bam_aux2A(s) + s += 1 + elif auxtype in ('Z', 'H'): + value = bam_aux2Z(s) + # +1 for NULL terminated string + s += len(value) + 1 + # + s += 1 + + result.append( (auxtag, value) ) + + return result + + def __set__(self, tags): + cdef char * ctag + cdef bam1_t * src + cdef uint8_t * s + cdef uint8_t * new_data + cdef char * temp + cdef int guessed_size, control_size + cdef int max_size, size, offset + + src = self._delegate + max_size = 4000 + offset = 0 + + if tags != None: + + # map samtools code to python.struct code and byte size + buffer = ctypes.create_string_buffer(max_size) + + for pytag, value in tags: + t = type(value) + if t == types.FloatType: + fmt, pytype = "= -127: fmt, pytype = "= -32767: fmt, pytype = " 4294967295: raise ValueError( "integer %i out of range of BAM/SAM specification" % value ) + else: fmt, pytype = " max_size: + raise NotImplementedError("tags field too large") + + struct.pack_into( fmt, + buffer, + offset, + pytag[0], + pytag[1], + pytype, + value ) + offset += size + + # delete the old data and allocate new + # if offset == 0, the aux field will be + # empty + pysam_bam_update( src, + src.l_aux, + offset, + bam1_aux( src ) ) + + src.l_aux = offset + + # copy data only if there is any + if offset != 0: + + # get location of new data + s = bam1_aux( src ) + + # check if there is direct path from buffer.raw to tmp + temp = buffer.raw + memcpy( s, temp, offset ) + + property flag: + """properties flag""" + def __get__(self): return self._delegate.core.flag + def __set__(self, flag): self._delegate.core.flag = flag + + property rname: + """ + :term:`target` ID + + DEPRECATED from pysam-0.4 - use tid in the future. + The rname field caused a lot of confusion as it returns + the :term:`target` ID instead of the reference sequence + name. + + .. note:: + + This field contains the index of the reference sequence + in the sequence dictionary. To obtain the name + of the reference sequence, use :meth:`pysam.Samfile.getrname()` + + """ + def __get__(self): return self._delegate.core.tid + def __set__(self, tid): self._delegate.core.tid = tid + + property tid: + """ + :term:`target` ID + + .. note:: + + This field contains the index of the reference sequence + in the sequence dictionary. To obtain the name + of the reference sequence, use :meth:`pysam.Samfile.getrname()` + + """ + def __get__(self): return self._delegate.core.tid + def __set__(self, tid): self._delegate.core.tid = tid + + property pos: + """0-based leftmost coordinate""" + def __get__(self): return self._delegate.core.pos + def __set__(self, pos): + ## setting the cigar string also updates the "bin" attribute + cdef bam1_t * src + src = self._delegate + if src.core.n_cigar: + src.core.bin = bam_reg2bin( src.core.pos, bam_calend( &src.core, bam1_cigar(src)) ) + else: + src.core.bin = bam_reg2bin( src.core.pos, src.core.pos + 1) + self._delegate.core.pos = pos + property bin: + """properties bin""" + def __get__(self): return self._delegate.core.bin + def __set__(self, bin): self._delegate.core.bin = bin + property rlen: + '''length of the read (read only). Returns 0 if not given.''' + def __get__(self): return self._delegate.core.l_qseq + property aend: + '''aligned end position of the read on the reference genome. Returns + None if not available.''' + def __get__(self): + cdef bam1_t * src + src = self._delegate + if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + return None + return bam_calend(&src.core, bam1_cigar(src)) + property alen: + '''aligned length of the read on the reference genome. Returns None if + not available.''' + def __get__(self): + cdef bam1_t * src + src = self._delegate + if (self.flag & BAM_FUNMAP) or src.core.n_cigar == 0: + return None + return bam_calend(&src.core, + bam1_cigar(src)) - \ + self._delegate.core.pos + + property mapq: + """mapping quality""" + def __get__(self): return self._delegate.core.qual + def __set__(self, qual): self._delegate.core.qual = qual + property mrnm: + """the :term:`reference` id of the mate + deprecated, use RNEXT instead. + """ + def __get__(self): return self._delegate.core.mtid + def __set__(self, mtid): self._delegate.core.mtid = mtid + property rnext: + """the :term:`reference` id of the mate """ + def __get__(self): return self._delegate.core.mtid + def __set__(self, mtid): self._delegate.core.mtid = mtid + property mpos: + """the position of the mate + deprecated, use PNEXT instead.""" + def __get__(self): return self._delegate.core.mpos + def __set__(self, mpos): self._delegate.core.mpos = mpos + property pnext: + """the position of the mate""" + def __get__(self): return self._delegate.core.mpos + def __set__(self, mpos): self._delegate.core.mpos = mpos + property isize: + """the insert size + deprecated: use tlen instead""" + def __get__(self): return self._delegate.core.isize + def __set__(self, isize): self._delegate.core.isize = isize + property tlen: + """the insert size""" + def __get__(self): return self._delegate.core.isize + def __set__(self, isize): self._delegate.core.isize = isize + property is_paired: + """true if read is paired in sequencing""" + def __get__(self): return (self._delegate.core.flag & BAM_FPAIRED) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FPAIRED + else: self._delegate.core.flag &= ~BAM_FPAIRED + property is_proper_pair: + """true if read is mapped in a proper pair""" + def __get__(self): return (self.flag & BAM_FPROPER_PAIR) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FPROPER_PAIR + else: self._delegate.core.flag &= ~BAM_FPROPER_PAIR + property is_unmapped: + """true if read itself is unmapped""" + def __get__(self): return (self.flag & BAM_FUNMAP) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FUNMAP + else: self._delegate.core.flag &= ~BAM_FUNMAP + property mate_is_unmapped: + """true if the mate is unmapped""" + def __get__(self): return (self.flag & BAM_FMUNMAP) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FMUNMAP + else: self._delegate.core.flag &= ~BAM_FMUNMAP + property is_reverse: + """true if read is mapped to reverse strand""" + def __get__(self): return (self.flag & BAM_FREVERSE) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FREVERSE + else: self._delegate.core.flag &= ~BAM_FREVERSE + property mate_is_reverse: + """true is read is mapped to reverse strand""" + def __get__(self): return (self.flag & BAM_FMREVERSE) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FMREVERSE + else: self._delegate.core.flag &= ~BAM_FMREVERSE + property is_read1: + """true if this is read1""" + def __get__(self): return (self.flag & BAM_FREAD1) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FREAD1 + else: self._delegate.core.flag &= ~BAM_FREAD1 + property is_read2: + """true if this is read2""" + def __get__(self): return (self.flag & BAM_FREAD2) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FREAD2 + else: self._delegate.core.flag &= ~BAM_FREAD2 + property is_secondary: + """true if not primary alignment""" + def __get__(self): return (self.flag & BAM_FSECONDARY) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FSECONDARY + else: self._delegate.core.flag &= ~BAM_FSECONDARY + property is_qcfail: + """true if QC failure""" + def __get__(self): return (self.flag & BAM_FQCFAIL) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FQCFAIL + else: self._delegate.core.flag &= ~BAM_FQCFAIL + property is_duplicate: + """true if optical or PCR duplicate""" + def __get__(self): return (self.flag & BAM_FDUP) != 0 + def __set__(self,val): + if val: self._delegate.core.flag |= BAM_FDUP + else: self._delegate.core.flag &= ~BAM_FDUP + property positions: + """a list of reference positions that this read aligns to.""" + def __get__(self): + cdef uint32_t k, i, pos + cdef int op + cdef uint32_t * cigar_p + cdef bam1_t * src + + result = [] + src = self._delegate + if src.core.n_cigar == 0: return [] + + pos = src.core.pos + + cigar_p = bam1_cigar(src) + for k from 0 <= k < src.core.n_cigar: + op = cigar_p[k] & BAM_CIGAR_MASK + l = cigar_p[k] >> BAM_CIGAR_SHIFT + if op == BAM_CMATCH: + for i from pos <= i < pos + l: + result.append( i ) + + if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + pos += l + + return result + + def overlap( self, uint32_t start, uint32_t end ): + """return number of aligned bases of read overlapping the interval *start* and *end* + on the reference sequence. + """ + cdef uint32_t k, i, pos, overlap + cdef int op, o + cdef uint32_t * cigar_p + cdef bam1_t * src + + overlap = 0 + + src = self._delegate + if src.core.n_cigar == 0: return 0 + pos = src.core.pos + o = 0 + + cigar_p = bam1_cigar(src) + for k from 0 <= k < src.core.n_cigar: + op = cigar_p[k] & BAM_CIGAR_MASK + l = cigar_p[k] >> BAM_CIGAR_SHIFT + + if op == BAM_CMATCH: + o = min( pos + l, end) - max( pos, start ) + if o > 0: overlap += o + + if op == BAM_CMATCH or op == BAM_CDEL or op == BAM_CREF_SKIP: + pos += l + + return overlap + + def opt(self, tag): + """retrieves optional data given a two-letter *tag*""" + #see bam_aux.c: bam_aux_get() and bam_aux2i() etc + cdef uint8_t * v + v = bam_aux_get(self._delegate, tag) + if v == NULL: raise KeyError( "tag '%s' not present" % tag ) + type = chr(v[0]) + if type == 'c' or type == 'C' or type == 's' or type == 'S': + return bam_aux2i(v) + elif type == 'i' or type == 'I': + return bam_aux2i(v) + elif type == 'f' or type == 'F': + return bam_aux2f(v) + elif type == 'd' or type == 'D': + return bam_aux2d(v) + elif type == 'A': + # there might a more efficient way + # to convert a char into a string + return '%c' % bam_aux2A(v) + elif type == 'Z': + return bam_aux2Z(v) + + def fancy_str (self): + """returns list of fieldnames/values in pretty format for debugging + """ + ret_string = [] + field_names = { + "tid": "Contig index", + "pos": "Mapped position on contig", + "mtid": "Contig index for mate pair", + "mpos": "Position of mate pair", + "isize": "Insert size", + "flag": "Binary flag", + "n_cigar": "Count of cigar entries", + "cigar": "Cigar entries", + "qual": "Mapping quality", + "bin": "Bam index bin number", + "l_qname": "Length of query name", + "qname": "Query name", + "l_qseq": "Length of query sequence", + "qseq": "Query sequence", + "bqual": "Quality scores", + "l_aux": "Length of auxilary data", + "m_data": "Maximum data length", + "data_len": "Current data length", + } + fields_names_in_order = ["tid", "pos", "mtid", "mpos", "isize", "flag", + "n_cigar", "cigar", "qual", "bin", "l_qname", "qname", + "l_qseq", "qseq", "bqual", "l_aux", "m_data", "data_len"] + + for f in fields_names_in_order: + if not f in self.__dict__: + continue + ret_string.append("%-30s %-10s= %s" % (field_names[f], "(" + f + ")", self.__getattribute__(f))) + + for f in self.__dict__: + if not f in field_names: + ret_string.append("%-30s %-10s= %s" % (f, "", self.__getattribute__(f))) + return ret_string + +cdef class PileupProxy: + '''A pileup column. A pileup column contains + all the reads that map to a certain target base. + + tid + chromosome ID as is defined in the header + pos + the target base coordinate (0-based) + n + number of reads mapping to this column + pileups + list of reads (:class:`pysam.PileupRead`) aligned to this column + + This class is a proxy for results returned by the samtools pileup engine. + If the underlying engine iterator advances, the results of this column + will change. + ''' + cdef bam_pileup1_t * plp + cdef int tid + cdef int pos + cdef int n_pu + + def __init__(self): + raise TypeError("This class cannot be instantiated from Python") + + def __str__(self): + return "\t".join( map(str, (self.tid, self.pos, self.n))) +\ + "\n" +\ + "\n".join( map(str, self.pileups) ) + + property tid: + '''the chromosome ID as is defined in the header''' + def __get__(self): return self.tid + + property n: + '''number of reads mapping to this column.''' + def __get__(self): return self.n_pu + def __set__(self, n): self.n_pu = n + + property pos: + def __get__(self): return self.pos + + property pileups: + '''list of reads (:class:`pysam.PileupRead`) aligned to this column''' + def __get__(self): + cdef int x + pileups = [] + # warning: there could be problems if self.n and self.buf are + # out of sync. + for x from 0 <= x < self.n_pu: + pileups.append( makePileupRead( &(self.plp[x])) ) + return pileups + +cdef class PileupRead: + '''A read aligned to a column. + ''' + + cdef: + AlignedRead _alignment + int32_t _qpos + int _indel + int _level + uint32_t _is_del + uint32_t _is_head + uint32_t _is_tail + + def __init__(self): + raise TypeError("This class cannot be instantiated from Python") + + def __str__(self): + return "\t".join( map(str, (self.alignment, self.qpos, self.indel, self.level, self.is_del, self.is_head, self.is_tail ) ) ) + + property alignment: + """a :class:`pysam.AlignedRead` object of the aligned read""" + def __get__(self): + return self._alignment + property qpos: + """position of the read base at the pileup site, 0-based""" + def __get__(self): + return self._qpos + property indel: + """indel length; 0 for no indel, positive for ins and negative for del""" + def __get__(self): + return self._indel + property is_del: + """1 iff the base on the padded read is a deletion""" + def __get__(self): + return self._is_del + property is_head: + def __get__(self): + return self._is_head + property is_tail: + def __get__(self): + return self._is_tail + property level: + def __get__(self): + return self._level + +class Outs: + '''http://mail.python.org/pipermail/python-list/2000-June/038406.html''' + def __init__(self, id = 1): + self.streams = [] + self.id = id + + def setdevice(self, filename): + '''open an existing file, like "/dev/null"''' + fd = os.open(filename, os.O_WRONLY) + self.setfd(fd) + + def setfile(self, filename): + '''open a new file.''' + fd = os.open(filename, os.O_WRONLY|os.O_CREAT, 0660); + self.setfd(fd) + + def setfd(self, fd): + ofd = os.dup(self.id) # Save old stream on new unit. + self.streams.append(ofd) + sys.stdout.flush() # Buffered data goes to old stream. + sys.stderr.flush() # Buffered data goes to old stream. + os.dup2(fd, self.id) # Open unit 1 on new stream. + os.close(fd) # Close other unit (look out, caller.) + + def restore(self): + '''restore previous output stream''' + if self.streams: + # the following was not sufficient, hence flush both stderr and stdout + # os.fsync( self.id ) + sys.stdout.flush() + sys.stderr.flush() + os.dup2(self.streams[-1], self.id) + os.close(self.streams[-1]) + del self.streams[-1] + +def _samtools_dispatch( method, + args = (), + catch_stdout = True, + catch_stderr = False, + ): + '''call ``method`` in samtools providing arguments in args. + + .. note:: + This method redirects stdout and (optionally) stderr to capture it + from samtools. If for some reason stdout/stderr disappears + the reason might be in this method. + + .. note:: + The current implementation might only work on linux. + + .. note:: + This method captures stdout and stderr using temporary files, + which are then read into memory in their entirety. This method + is slow and might cause large memory overhead. + + See http://bytes.com/topic/c/answers/487231-how-capture-stdout-temporarily + on the topic of redirecting stderr/stdout. + ''' + + # note that debugging this module can be a problem + # as stdout/stderr will not appear on the terminal + + # some special cases + if method == "index": + if not os.path.exists( args[0] ): + raise IOError( "No such file or directory: '%s'" % args[0] ) + + # redirect stderr and stdout to file + if catch_stderr: + stderr_h, stderr_f = tempfile.mkstemp() + stderr_save = Outs( sys.stderr.fileno() ) + stderr_save.setfd( stderr_h ) + + if catch_stdout: + stdout_h, stdout_f = tempfile.mkstemp() + stdout_save = Outs( sys.stdout.fileno() ) + stdout_save.setfd( stdout_h ) + + # patch for `samtools view` + # samtools `view` closes stdout, from which I can not + # recover. Thus redirect output to file with -o option. + if method == "view": + if "-o" in args: raise ValueError("option -o is forbidden in samtools view") + args = ( "-o", stdout_f ) + args + + # do the function call to samtools + cdef char ** cargs + cdef int i, n, retval + + n = len(args) + # allocate two more for first (dummy) argument (contains command) + cargs = calloc( n+2, sizeof( char *) ) + cargs[0] = "samtools" + cargs[1] = method + for i from 0 <= i < n: cargs[i+2] = args[i] + + retval = pysam_dispatch(n+2, cargs) + free( cargs ) + + # restore stdout/stderr. This will also flush, so + # needs to be before reading back the file contents + if catch_stdout: + stdout_save.restore() + out_stdout = open( stdout_f, "r").readlines() + os.remove( stdout_f ) + else: + out_stdout = [] + + if catch_stderr: + stderr_save.restore() + out_stderr = open( stderr_f, "r").readlines() + os.remove( stderr_f ) + else: + out_stderr = [] + + return retval, out_stderr, out_stdout + +cdef class SNPCall: + '''the results of a SNP call.''' + cdef int _tid + cdef int _pos + cdef char _reference_base + cdef char _genotype + cdef int _consensus_quality + cdef int _snp_quality + cdef int _rms_mapping_quality + cdef int _coverage + + property tid: + '''the chromosome ID as is defined in the header''' + def __get__(self): + return self._tid + + property pos: + '''nucleotide position of SNP.''' + def __get__(self): return self._pos + + property reference_base: + '''reference base at pos. ``N`` if no reference sequence supplied.''' + def __get__(self): return PyString_FromStringAndSize( &self._reference_base, 1 ) + + property genotype: + '''the genotype called.''' + def __get__(self): return PyString_FromStringAndSize( &self._genotype, 1 ) + + property consensus_quality: + '''the genotype quality (Phred-scaled).''' + def __get__(self): return self._consensus_quality + + property snp_quality: + '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.''' + def __get__(self): return self._snp_quality + + property mapping_quality: + '''the root mean square (rms) of the mapping quality of all reads involved in the call.''' + def __get__(self): return self._rms_mapping_quality + + property coverage: + '''coverage or read depth - the number of reads involved in the call.''' + def __get__(self): return self._coverage + + def __str__(self): + + return "\t".join( map(str, ( + self.tid, + self.pos, + self.reference_base, + self.genotype, + self.consensus_quality, + self.snp_quality, + self.mapping_quality, + self.coverage ) ) ) + + +# cdef class SNPCallerBase: +# '''Base class for SNP callers. + +# *min_baseQ* +# minimum base quality (possibly capped by BAQ) +# *capQ_threshold* +# coefficient for adjusting mapQ of poor mappings +# *theta* +# theta in maq consensus calling model +# *n_haplotypes* +# number of haplotypes in the sample +# *het_rate* +# prior of a difference between two haplotypes +# ''' + +# cdef bam_maqcns_t * c +# cdef IteratorColumn iter + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): + +# self.iter = iterator_column +# self.c = bam_maqcns_init() + +# # set the default parameterization according to +# # samtools + +# # new default mode for samtools >0.1.10 +# self.c.errmod = kwargs.get( "errmod", BAM_ERRMOD_MAQ2 ) + +# self.c.min_baseQ = kwargs.get( "min_baseQ", 13 ) +# # self.c.capQ_thres = kwargs.get( "capQ_threshold", 60 ) +# self.c.n_hap = kwargs.get( "n_haplotypes", 2 ) +# self.c.het_rate = kwargs.get( "het_rate", 0.001 ) +# self.c.theta = kwargs.get( "theta", 0.83 ) + +# if self.c.errmod != BAM_ERRMOD_MAQ2: +# self.c.theta += 0.02 + +# # call prepare AFTER setting parameters +# bam_maqcns_prepare( self.c ) + +# def __dealloc__(self): +# bam_maqcns_destroy( self.c ) + + # cdef __dump( self, glf1_t * g, uint32_t cns, int rb ): + # '''debugging output.''' + + # pysam_dump_glf( g, self.c ); + # print "" + # for x in range(self.iter.n_plp): + # print "--> read %i %s %i" % (x, + # bam1_qname(self.iter.plp[x].b), + # self.iter.plp[x].qpos, + # ) + + # print "pos=%i, cns=%i, q_r = %f, depth=%i, n=%i, rb=%i, cns-cq=%i %i %i %i" \ + # % (self.iter.pos, + # cns, + # self.c.q_r, + # self.iter.n_plp, + # self.iter.n_plp, + # rb, + # cns >> 8 & 0xff, + # cns >> 16 & 0xff, + # cns & 0xff, + # cns >> 28, + # ) + + # printf("-------------------------------------\n"); + # sys.stdout.flush() + +# cdef class IteratorSNPCalls( SNPCallerBase ): +# """*(IteratorColumn iterator)* + +# call SNPs within a region. + +# *iterator* is a pileup iterator. SNPs will be called +# on all positions returned by this iterator. + +# This caller is fast if SNPs are called over large continuous +# regions. It is slow, if instantiated frequently and in random +# order as the sequence will have to be reloaded. + +# """ + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): + +# assert self.iter.hasReference(), "IteratorSNPCalls requires an pileup iterator with reference sequence" + +# def __iter__(self): +# return self + +# def __next__(self): +# """python version of next(). +# """ + +# # the following code was adapted from bam_plcmd.c:pileup_func() +# self.iter.cnext() + +# if self.iter.n_plp < 0: +# raise ValueError("error during iteration" ) + +# if self.iter.plp == NULL: +# raise StopIteration + +# cdef char * seq = self.iter.getSequence() +# cdef int seq_len = self.iter.seq_len + +# assert seq != NULL + +# # reference base +# if self.iter.pos >= seq_len: +# raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) ) + +# cdef int rb = seq[self.iter.pos] +# cdef uint32_t cns +# cdef glf1_t * g + +# g = bam_maqcns_glfgen( self.iter.n_plp, +# self.iter.plp, +# bam_nt16_table[rb], +# self.c ) + +# if pysam_glf_depth( g ) == 0: +# cns = 0xfu << 28 | 0xf << 24 +# else: +# cns = glf2cns(g, (self.c.q_r + .499)) + +# free(g) + +# cdef SNPCall call + +# call = SNPCall() +# call._tid = self.iter.tid +# call._pos = self.iter.pos +# call._reference_base = rb +# call._genotype = bam_nt16_rev_table[cns>>28] +# call._consensus_quality = cns >> 8 & 0xff +# call._snp_quality = cns & 0xff +# call._rms_mapping_quality = cns >> 16&0xff +# call._coverage = self.iter.n_plp + +# return call + +# cdef class SNPCaller( SNPCallerBase ): +# '''*(IteratorColumn iterator_column )* + +# The samtools SNP caller. + +# This object will call SNPs in *samfile* against the reference +# sequence in *fasta*. + +# This caller is fast for calling few SNPs in selected regions. + +# It is slow, if called over large genomic regions. +# ''' + + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): + +# pass + +# def call(self, reference, int pos ): +# """call a snp on chromosome *reference* +# and position *pos*. + +# returns a :class:`SNPCall` object. +# """ + +# cdef int tid = self.iter.samfile.gettid( reference ) + +# self.iter.reset( tid, pos, pos + 1 ) + +# while 1: +# self.iter.cnext() + +# if self.iter.n_plp < 0: +# raise ValueError("error during iteration" ) + +# if self.iter.plp == NULL: +# raise ValueError( "no reads in region - no call" ) + +# if self.iter.pos == pos: break + +# cdef char * seq = self.iter.getSequence() +# cdef int seq_len = self.iter.seq_len + +# assert seq != NULL + +# # reference base +# if self.iter.pos >= seq_len: +# raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) ) + +# cdef int rb = seq[self.iter.pos] +# cdef uint32_t cns +# # cdef glf1_t * g +# # +# # g = bam_maqcns_glfgen( self.iter.n_plp, +# # self.iter.plp, +# # bam_nt16_table[rb], +# # self.c ) +# ## +# # +# # if pysam_glf_depth( g ) == 0: +# # cns = 0xfu << 28 | 0xf << 24 +# # else: +# # cns = glf2cns(g, (self.c.q_r + .499)) +# # +# # free(g) + +# cdef SNPCall call + +# call = SNPCall() +# call._tid = self.iter.tid +# call._pos = self.iter.pos +# call._reference_base = rb +# call._genotype = bam_nt16_rev_table[cns>>28] +# call._consensus_quality = cns >> 8 & 0xff +# call._snp_quality = cns & 0xff +# call._rms_mapping_quality = cns >> 16&0xff +# call._coverage = self.iter.n_plp + +# return call + +# cdef class IndelCall: +# '''the results of an indel call.''' +# cdef int _tid +# cdef int _pos +# cdef int _coverage +# cdef int _rms_mapping_quality +# cdef bam_maqindel_ret_t * _r + +# def __cinit__(self): +# #assert r != NULL +# #self._r = r +# pass + +# property tid: +# '''the chromosome ID as is defined in the header''' +# def __get__(self): +# return self._tid + +# property pos: +# '''nucleotide position of SNP.''' +# def __get__(self): return self._pos + +# property genotype: +# '''the genotype called.''' +# def __get__(self): +# if self._r.gt == 0: +# s = PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1) +# return "%s/%s" % (s,s) +# elif self._r.gt == 1: +# s = PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1) +# return "%s/%s" % (s,s) +# else: +# return "%s/%s" % (self.first_allele, self.second_allele ) + +# property consensus_quality: +# '''the genotype quality (Phred-scaled).''' +# def __get__(self): return self._r.q_cns + +# property snp_quality: +# '''the snp quality (Phred scaled) - probability of consensus being identical to reference sequence.''' +# def __get__(self): return self._r.q_ref + +# property mapping_quality: +# '''the root mean square (rms) of the mapping quality of all reads involved in the call.''' +# def __get__(self): return self._rms_mapping_quality + +# property coverage: +# '''coverage or read depth - the number of reads involved in the call.''' +# def __get__(self): return self._coverage + +# property first_allele: +# '''sequence of first allele.''' +# def __get__(self): return PyString_FromStringAndSize( self._r.s[0], self._r.indel1 + 1) + +# property second_allele: +# '''sequence of second allele.''' +# def __get__(self): return PyString_FromStringAndSize( self._r.s[1], self._r.indel2 + 1) + +# property reads_first: +# '''reads supporting first allele.''' +# def __get__(self): return self._r.cnt1 + +# property reads_second: +# '''reads supporting first allele.''' +# def __get__(self): return self._r.cnt2 + +# property reads_diff: +# '''reads supporting first allele.''' +# def __get__(self): return self._r.cnt_anti + +# def __str__(self): + +# return "\t".join( map(str, ( +# self.tid, +# self.pos, +# self.genotype, +# self.consensus_quality, +# self.snp_quality, +# self.mapping_quality, +# self.coverage, +# self.first_allele, +# self.second_allele, +# self.reads_first, +# self.reads_second, +# self.reads_diff ) ) ) + +# def __dealloc__(self ): +# bam_maqindel_ret_destroy(self._r) + +# cdef class IndelCallerBase: +# '''Base class for SNP callers. + +# *min_baseQ* +# minimum base quality (possibly capped by BAQ) +# *capQ_threshold* +# coefficient for adjusting mapQ of poor mappings +# *theta* +# theta in maq consensus calling model +# *n_haplotypes* +# number of haplotypes in the sample +# *het_rate* +# prior of a difference between two haplotypes +# ''' + +# cdef bam_maqindel_opt_t * options +# cdef IteratorColumn iter +# cdef int cap_mapQ +# cdef int max_depth + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): + + +# self.iter = iterator_column + +# assert iterator_column.hasReference(), "IndelCallerBase requires an pileup iterator with reference sequence" + +# self.options = bam_maqindel_opt_init() + +# # set the default parameterization according to +# # samtools + +# self.options.r_indel = kwargs.get( "r_indel", 0.00015 ) +# self.options.q_indel = kwargs.get( "q_indel", 40 ) +# self.cap_mapQ = kwargs.get( "cap_mapQ", 60 ) +# self.max_depth = kwargs.get( "max_depth", 1024 ) + +# def __dealloc__(self): +# free( self.options ) + +# def _call( self ): + +# cdef char * seq = self.iter.getSequence() +# cdef int seq_len = self.iter.seq_len + +# assert seq != NULL + +# # reference base +# if self.iter.pos >= seq_len: +# raise ValueError( "position %i out of bounds on reference sequence (len=%i)" % (self.iter.pos, seq_len) ) + +# cdef bam_maqindel_ret_t * r + +# cdef int m = min( self.max_depth, self.iter.n_plp ) + +# # printf("pysam: m=%i, q_indel=%i, r_indel=%f, r_snp=%i, mm_penalty=%i, indel_err=%i, ambi_thres=%i\n", +# # m, self.options.q_indel, self.options.r_indel, self.options.r_snp, self.options.mm_penalty, +# # self.options.indel_err, self.options.ambi_thres ); + +# r = bam_maqindel(m, +# self.iter.pos, +# self.options, +# self.iter.plp, +# seq, +# 0, +# NULL) + +# if r == NULL: return None + +# cdef IndelCall call +# call = IndelCall() +# call._r = r +# call._tid = self.iter.tid +# call._pos = self.iter.pos +# call._coverage = self.iter.n_plp + +# cdef uint64_t rms_aux = 0 +# cdef int i = 0 +# cdef bam_pileup1_t * p +# cdef int tmp + +# for i from 0 <= i < self.iter.n_plp: +# p = self.iter.plp + i +# if p.b.core.qual < self.cap_mapQ: +# tmp = p.b.core.qual +# else: +# tmp = self.cap_mapQ +# rms_aux += tmp * tmp + +# call._rms_mapping_quality = (sqrt(rms_aux / self.iter.n_plp) + .499) + +# return call + +# cdef class IndelCaller( IndelCallerBase ): +# '''*(IteratorColumn iterator_column )* + +# The samtools SNP caller. + +# This object will call SNPs in *samfile* against the reference +# sequence in *fasta*. + +# This caller is fast for calling few SNPs in selected regions. + +# It is slow, if called over large genomic regions. +# ''' + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): + +# pass + +# def call(self, reference, int pos ): +# """call a snp on chromosome *reference* +# and position *pos*. + +# returns a :class:`SNPCall` object or None, if no indel call could be made. +# """ + +# cdef int tid = self.iter.samfile.gettid( reference ) + +# self.iter.reset( tid, pos, pos + 1 ) + +# while 1: +# self.iter.cnext() + +# if self.iter.n_plp < 0: +# raise ValueError("error during iteration" ) + +# if self.iter.plp == NULL: +# raise ValueError( "no reads in region - no call" ) + +# if self.iter.pos == pos: break + +# return self._call() + +# cdef class IteratorIndelCalls( IndelCallerBase ): +# """*(IteratorColumn iterator)* + +# call indels within a region. + +# *iterator* is a pileup iterator. SNPs will be called +# on all positions returned by this iterator. + +# This caller is fast if SNPs are called over large continuous +# regions. It is slow, if instantiated frequently and in random +# order as the sequence will have to be reloaded. + +# """ + +# def __cinit__(self, +# IteratorColumn iterator_column, +# **kwargs ): +# pass + + +# def __iter__(self): +# return self + +# def __next__(self): +# """python version of next(). +# """ + +# # the following code was adapted from bam_plcmd.c:pileup_func() +# self.iter.cnext() + +# if self.iter.n_plp < 0: +# raise ValueError("error during iteration" ) + +# if self.iter.plp == NULL: +# raise StopIteration + +# return self._call() + + + +cdef class IndexedReads: + """index a bamfile by read. + + The index is kept in memory. + + By default, the file is re-openend to avoid conflicts if + multiple operators work on the same file. Set *reopen* = False + to not re-open *samfile*. + """ + + cdef Samfile samfile + cdef samfile_t * fp + cdef index + # true if samfile belongs to this object + cdef int owns_samfile + + def __init__(self, Samfile samfile, int reopen = True ): + self.samfile = samfile + + if samfile.isbam: mode = "rb" + else: mode = "r" + + # reopen the file - note that this makes the iterator + # slow and causes pileup to slow down significantly. + if reopen: + store = StderrStore() + self.fp = samopen( samfile._filename, mode, NULL ) + store.release() + assert self.fp != NULL + self.owns_samfile = True + else: + self.fp = samfile.samfile + self.owns_samfile = False + + assert samfile.isbam, "can only IndexReads on bam files" + + def build( self ): + '''build index.''' + + self.index = collections.defaultdict( list ) + + # this method will start indexing from the current file position + # if you decide + cdef int ret = 1 + cdef bam1_t * b = calloc(1, sizeof( bam1_t) ) + + cdef uint64_t pos + + while ret > 0: + pos = bam_tell( self.fp.x.bam ) + ret = samread( self.fp, b) + if ret > 0: + qname = bam1_qname( b ) + self.index[qname].append( pos ) + + bam_destroy1( b ) + + def find( self, qname ): + if qname in self.index: + return IteratorRowSelection( self.samfile, self.index[qname], reopen = False ) + else: + raise KeyError( "read %s not found" % qname ) + + def __dealloc__(self): + if self.owns_samfile: samclose( self.fp ) + +__all__ = ["Samfile", + "Fastafile", + "IteratorRow", + "IteratorColumn", + "AlignedRead", + "PileupColumn", + "PileupProxy", + "PileupRead", + # "IteratorSNPCalls", + # "SNPCaller", + # "IndelCaller", + # "IteratorIndelCalls", + "IndexedReads" ] + + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.c b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.c new file mode 100755 index 0000000..7badd4a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.c @@ -0,0 +1,9306 @@ +/* Generated by Cython 0.14.1 on Fri Nov 25 20:32:50 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__ctabix +#include "string.h" +#include "stdlib.h" +#include "stdio.h" +#include "ctype.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "unistd.h" +#include "stdint.h" +#include "bgzf.h" +#include "tabix.h" +#include "pythread.h" + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "ctabix.pyx", + "bool.pxd", + "complex.pxd", + "TabProxies.pxd", +}; + +/* Type declarations */ + +/* "ctabix.pxd":178 + * cdef tabix_t * tabixfile + * + * cdef class Parser: # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_obj_6ctabix_Parser { + PyObject_HEAD +}; + +/* "ctabix.pyx":389 + * return r + * + * cdef class asVCF( Parser ): # <<<<<<<<<<<<<< + * '''converts a :term:`tabix row` into a VCF record with + * the following fields: + */ + +struct __pyx_obj_6ctabix_asVCF { + struct __pyx_obj_6ctabix_Parser __pyx_base; +}; + +/* "TabProxies.pxd":42 + * ctypedef int uint64_t + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_TupleProxy { + PyObject_HEAD + struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab; + char *data; + char **fields; + int nfields; + int index; + int nbytes; + int offset; + int is_modified; +}; + +/* "TabProxies.pxd":78 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_obj_10TabProxies_NamedTupleProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; +}; + +/* "TabProxies.pxd":81 + * pass + * + * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_BedProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t start; + uint32_t end; + int bedfields; +}; + +/* "TabProxies.pxd":92 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_VCFProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t pos; +}; + +/* "TabProxies.pxd":61 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_GTFProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; + char *contig; + char *source; + char *feature; + uint32_t start; + uint32_t end; + char *score; + char *strand; + char *frame; + char *attributes; + int hasOwnAttributes; +}; + +/* "ctabix.pyx":193 + * if self._filename != NULL: free( self._filename ) + * + * cdef class TabixIterator: # <<<<<<<<<<<<<< + * """iterates over rows in *tabixfile* in region + * given by *tid*, *start* and *end*. + */ + +struct __pyx_obj_6ctabix_TabixIterator { + PyObject_HEAD + ti_iter_t iterator; + tabix_t *tabixfile; +}; + +/* "ctabix.pyx":428 + * ######################################################### + * ######################################################### + * cdef class TabixIteratorParsed: # <<<<<<<<<<<<<< + * """iterates over mapped reads in a region. + * + */ + +struct __pyx_obj_6ctabix_TabixIteratorParsed { + PyObject_HEAD + ti_iter_t iterator; + tabix_t *tabixfile; + struct __pyx_obj_6ctabix_Parser *parser; +}; + +/* "ctabix.pyx":248 + * ti_iter_destroy(self.iterator) + * + * cdef class TabixHeaderIterator: # <<<<<<<<<<<<<< + * """return header lines. + * """ + */ + +struct __pyx_obj_6ctabix_TabixHeaderIterator { + PyObject_HEAD + ti_iter_t iterator; + tabix_t *tabixfile; +}; + +/* "ctabix.pxd":172 + * # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len) + * + * cdef class Tabixfile: # <<<<<<<<<<<<<< + * cdef char * _filename + * + */ + +struct __pyx_obj_6ctabix_Tabixfile { + PyObject_HEAD + char *_filename; + tabix_t *tabixfile; +}; + +/* "ctabix.pyx":312 + * return r + * + * cdef class asGTF(Parser): # <<<<<<<<<<<<<< + * '''converts a :term:`tabix row` into a GTF record with the following + * fields: + */ + +struct __pyx_obj_6ctabix_asGTF { + struct __pyx_obj_6ctabix_Parser __pyx_base; +}; + +/* "ctabix.pyx":349 + * return r + * + * cdef class asBed( Parser ): # <<<<<<<<<<<<<< + * '''converts a :term:`tabix row` into a bed record + * with the following fields: + */ + +struct __pyx_obj_6ctabix_asBed { + struct __pyx_obj_6ctabix_Parser __pyx_base; +}; + +/* "ctabix.pyx":299 + * pass + * + * cdef class asTuple(Parser): # <<<<<<<<<<<<<< + * '''converts a :term:`tabix row` into a python tuple. + * + */ + +struct __pyx_obj_6ctabix_asTuple { + struct __pyx_obj_6ctabix_Parser __pyx_base; +}; + + +/* "TabProxies.pxd":42 + * ctypedef int uint64_t + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_TupleProxy { + int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t); + PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); +}; +static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy; + + +/* "TabProxies.pxd":78 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy; + + +/* "TabProxies.pxd":92 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_VCFProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy; + + +/* "TabProxies.pxd":81 + * pass + * + * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_BedProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy; + + +/* "TabProxies.pxd":61 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_GTFProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(d == Py_None)) { + __Pyx_RaiseNoneIndexingError(); + return NULL; + } + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) + PyErr_SetObject(PyExc_KeyError, key); + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *); + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cpython.version */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from cpython.exc */ + +/* Module declarations from cpython.module */ + +/* Module declarations from cpython.mem */ + +/* Module declarations from cpython.tuple */ + +/* Module declarations from cpython.list */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from cpython.sequence */ + +/* Module declarations from cpython.mapping */ + +/* Module declarations from cpython.iterator */ + +/* Module declarations from cpython.type */ + +/* Module declarations from cpython.number */ + +/* Module declarations from cpython.int */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.bool */ + +static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from cpython.long */ + +/* Module declarations from cpython.float */ + +/* Module declarations from __builtin__ */ + +/* Module declarations from cpython.complex */ + +static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from cpython.string */ + +/* Module declarations from cpython.unicode */ + +/* Module declarations from cpython.dict */ + +/* Module declarations from cpython.instance */ + +/* Module declarations from cpython.function */ + +/* Module declarations from cpython.method */ + +/* Module declarations from cpython.weakref */ + +/* Module declarations from cpython.getargs */ + +/* Module declarations from cpython.pythread */ + +/* Module declarations from cpython.cobject */ + +/* Module declarations from cpython.oldbuffer */ + +/* Module declarations from cpython.set */ + +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.bytes */ + +/* Module declarations from cpython.pycapsule */ + +/* Module declarations from cpython */ + +/* Module declarations from TabProxies */ + +static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0; +/* Module declarations from ctabix */ + +static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0; +static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0; +static PyTypeObject *__pyx_ptype_6ctabix_TabixIterator = 0; +static PyTypeObject *__pyx_ptype_6ctabix_TabixHeaderIterator = 0; +static PyTypeObject *__pyx_ptype_6ctabix_asTuple = 0; +static PyTypeObject *__pyx_ptype_6ctabix_asGTF = 0; +static PyTypeObject *__pyx_ptype_6ctabix_asBed = 0; +static PyTypeObject *__pyx_ptype_6ctabix_asVCF = 0; +static PyTypeObject *__pyx_ptype_6ctabix_TabixIteratorParsed = 0; +#define __Pyx_MODULE_NAME "ctabix" +static int __pyx_module_is_main_ctabix = 0; + +/* Implementation of ctabix */ +static PyObject *__pyx_builtin_IOError; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_OSError; +static PyObject *__pyx_builtin_ord; +static PyObject *__pyx_builtin_KeyError; +static char __pyx_k_1[] = "invalid file opening mode `%s`"; +static char __pyx_k_2[] = ".tbi"; +static char __pyx_k_3[] = "file `%s` not found"; +static char __pyx_k_4[] = "index `%s` not found"; +static char __pyx_k_5[] = "could not open file `%s`"; +static char __pyx_k_6[] = "%s:%i-%i"; +static char __pyx_k_7[] = "invalid region `%s`"; +static char __pyx_k_8[] = "invalid region: start (%i) > end (%i)"; +static char __pyx_k_9[] = "start out of range (%i)"; +static char __pyx_k_10[] = "end out of range (%i)"; +static char __pyx_k_11[] = "I/O operation on closed file"; +static char __pyx_k_14[] = "malformatted query or wrong sequence name.\n"; +static char __pyx_k_16[] = "can't open header.\n"; +static char __pyx_k_20[] = "Filename '%s' already exists, use *force* to overwrite"; +static char __pyx_k_21[] = "could not open '%s' for writing"; +static char __pyx_k_23[] = "could not open '%s' for reading"; +static char __pyx_k_25[] = "writing failed"; +static char __pyx_k_29[] = "#"; +static char __pyx_k_31[] = "No such file '%s'"; +static char __pyx_k_32[] = ".gz"; +static char __pyx_k_34[] = "Filename '%s.tbi' already exists, use *force* to overwrite"; +static char __pyx_k_42[] = "unknown preset '%s', valid presets are '%s'"; +static char __pyx_k_43[] = ","; +static char __pyx_k_44[] = "filename associated with this object."; +static char __pyx_k_45[] = "the file header.\n \n .. note::\n The header is returned as an iterator over lines without the\n newline character.\n "; +static char __pyx_k_46[] = "chromosome names"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__w[] = "w"; +static char __pyx_k__bc[] = "bc"; +static char __pyx_k__ec[] = "ec"; +static char __pyx_k__fp[] = "fp"; +static char __pyx_k__os[] = "os"; +static char __pyx_k__sc[] = "sc"; +static char __pyx_k__bed[] = "bed"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__gff[] = "gff"; +static char __pyx_k__idx[] = "idx"; +static char __pyx_k__len[] = "len"; +static char __pyx_k__ord[] = "ord"; +static char __pyx_k__sam[] = "sam"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__tid[] = "tid"; +static char __pyx_k__vcf[] = "vcf"; +static char __pyx_k__copy[] = "copy"; +static char __pyx_k__gzip[] = "gzip"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__keys[] = "keys"; +static char __pyx_k__mode[] = "mode"; +static char __pyx_k__path[] = "path"; +static char __pyx_k___open[] = "_open"; +static char __pyx_k__asBed[] = "asBed"; +static char __pyx_k__asGTF[] = "asGTF"; +static char __pyx_k__asVCF[] = "asVCF"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__force[] = "force"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__types[] = "types"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__buffer[] = "buffer"; +static char __pyx_k__ctabix[] = "ctabix"; +static char __pyx_k__ctypes[] = "ctypes"; +static char __pyx_k__exists[] = "exists"; +static char __pyx_k__parser[] = "parser"; +static char __pyx_k__pileup[] = "pileup"; +static char __pyx_k__preset[] = "preset"; +static char __pyx_k__psltbl[] = "psltbl"; +static char __pyx_k__region[] = "region"; +static char __pyx_k__struct[] = "struct"; +static char __pyx_k__unlink[] = "unlink"; +static char __pyx_k__IOError[] = "IOError"; +static char __pyx_k__OSError[] = "OSError"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k___isOpen[] = "_isOpen"; +static char __pyx_k__asTuple[] = "asTuple"; +static char __pyx_k__end_col[] = "end_col"; +static char __pyx_k__seq_col[] = "seq_col"; +static char __pyx_k__KeyError[] = "KeyError"; +static char __pyx_k__O_RDONLY[] = "O_RDONLY"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__endswith[] = "endswith"; +static char __pyx_k__filename[] = "filename"; +static char __pyx_k__iterator[] = "iterator"; +static char __pyx_k__tempfile[] = "tempfile"; +static char __pyx_k__Tabixfile[] = "Tabixfile"; +static char __pyx_k___filename[] = "_filename"; +static char __pyx_k__itertools[] = "itertools"; +static char __pyx_k__line_skip[] = "line_skip"; +static char __pyx_k__meta_char[] = "meta_char"; +static char __pyx_k__reference[] = "reference"; +static char __pyx_k__start_col[] = "start_col"; +static char __pyx_k__tabixfile[] = "tabixfile"; +static char __pyx_k__zerobased[] = "zerobased"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__filename_in[] = "filename_in"; +static char __pyx_k__tabix_index[] = "tabix_index"; +static char __pyx_k___parseRegion[] = "_parseRegion"; +static char __pyx_k__filename_out[] = "filename_out"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static char __pyx_k__tabix_compress[] = "tabix_compress"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_kp_s_21; +static PyObject *__pyx_kp_s_23; +static PyObject *__pyx_kp_s_25; +static PyObject *__pyx_kp_s_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_31; +static PyObject *__pyx_kp_s_32; +static PyObject *__pyx_kp_s_34; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_42; +static PyObject *__pyx_kp_s_43; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__IOError; +static PyObject *__pyx_n_s__KeyError; +static PyObject *__pyx_n_s__OSError; +static PyObject *__pyx_n_s__O_RDONLY; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__Tabixfile; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___filename; +static PyObject *__pyx_n_s___isOpen; +static PyObject *__pyx_n_s___open; +static PyObject *__pyx_n_s___parseRegion; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__asBed; +static PyObject *__pyx_n_s__asGTF; +static PyObject *__pyx_n_s__asTuple; +static PyObject *__pyx_n_s__asVCF; +static PyObject *__pyx_n_s__bc; +static PyObject *__pyx_n_s__bed; +static PyObject *__pyx_n_s__buffer; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__ctabix; +static PyObject *__pyx_n_s__ctypes; +static PyObject *__pyx_n_s__ec; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__end_col; +static PyObject *__pyx_n_s__endswith; +static PyObject *__pyx_n_s__exists; +static PyObject *__pyx_n_s__filename; +static PyObject *__pyx_n_s__filename_in; +static PyObject *__pyx_n_s__filename_out; +static PyObject *__pyx_n_s__force; +static PyObject *__pyx_n_s__fp; +static PyObject *__pyx_n_s__gff; +static PyObject *__pyx_n_s__gzip; +static PyObject *__pyx_n_s__idx; +static PyObject *__pyx_n_s__iterator; +static PyObject *__pyx_n_s__itertools; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__keys; +static PyObject *__pyx_n_s__len; +static PyObject *__pyx_n_s__line_skip; +static PyObject *__pyx_n_s__meta_char; +static PyObject *__pyx_n_s__mode; +static PyObject *__pyx_n_s__ord; +static PyObject *__pyx_n_s__os; +static PyObject *__pyx_n_s__parser; +static PyObject *__pyx_n_s__path; +static PyObject *__pyx_n_s__pileup; +static PyObject *__pyx_n_s__preset; +static PyObject *__pyx_n_s__psltbl; +static PyObject *__pyx_n_s__r; +static PyObject *__pyx_n_s__reference; +static PyObject *__pyx_n_s__region; +static PyObject *__pyx_n_s__sam; +static PyObject *__pyx_n_s__sc; +static PyObject *__pyx_n_s__seq_col; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__start_col; +static PyObject *__pyx_n_s__struct; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__tabix_compress; +static PyObject *__pyx_n_s__tabix_index; +static PyObject *__pyx_n_s__tabixfile; +static PyObject *__pyx_n_s__tempfile; +static PyObject *__pyx_n_s__tid; +static PyObject *__pyx_n_s__types; +static PyObject *__pyx_n_s__unlink; +static PyObject *__pyx_n_s__vcf; +static PyObject *__pyx_n_s__w; +static PyObject *__pyx_n_s__zerobased; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_17; +static PyObject *__pyx_int_18; +static PyObject *__pyx_int_65536; +static PyObject *__pyx_k_19; +static PyObject *__pyx_k_28; +static PyObject *__pyx_k_30; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_36; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_tuple_38; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_40; +static PyObject *__pyx_k_tuple_41; + +/* "ctabix.pyx":15 + * ''' + * + * def __cinit__(self, *args, **kwargs ): # <<<<<<<<<<<<<< + * self.tabixfile = NULL + * self._open( *args, **kwargs ) + */ + +static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_6ctabix_9Tabixfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); + if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + + /* "ctabix.pyx":16 + * + * def __cinit__(self, *args, **kwargs ): + * self.tabixfile = NULL # <<<<<<<<<<<<<< + * self._open( *args, **kwargs ) + * + */ + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL; + + /* "ctabix.pyx":17 + * def __cinit__(self, *args, **kwargs ): + * self.tabixfile = NULL + * self._open( *args, **kwargs ) # <<<<<<<<<<<<<< + * + * def _isOpen( self ): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_Tuple(((PyObject *)__pyx_v_args)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_kwargs)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("ctabix.Tabixfile.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":19 + * self._open( *args, **kwargs ) + * + * def _isOpen( self ): # <<<<<<<<<<<<<< + * '''return true if samfile has been opened.''' + * return self.tabixfile != NULL + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6ctabix_9Tabixfile_1_isOpen[] = "Tabixfile._isOpen(self)\nreturn true if samfile has been opened."; +static PyObject *__pyx_pf_6ctabix_9Tabixfile_1_isOpen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_isOpen"); + + /* "ctabix.pyx":21 + * def _isOpen( self ): + * '''return true if samfile has been opened.''' + * return self.tabixfile != NULL # <<<<<<<<<<<<<< + * + * def _open( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.Tabixfile._isOpen"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":23 + * return self.tabixfile != NULL + * + * def _open( self, # <<<<<<<<<<<<<< + * char * filename, + * mode ='r', + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6ctabix_9Tabixfile_2_open[] = "Tabixfile._open(self, char *filename, mode='r')\nopen a :term:`tabix file` for reading.\n "; +static PyObject *__pyx_pf_6ctabix_9Tabixfile_2_open(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_filename; + PyObject *__pyx_v_mode = 0; + PyObject *__pyx_v_filename_index; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + char *__pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__mode,0}; + __Pyx_RefNannySetupContext("_open"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_n_s__r); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_open") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_filename = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mode = values[1]; + } else { + __pyx_v_mode = ((PyObject *)__pyx_n_s__r); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_filename = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_filename) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_open", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.Tabixfile._open"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_filename_index = Py_None; __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":30 + * ''' + * + * assert mode in ( "r",), "invalid file opening mode `%s`" % mode # <<<<<<<<<<<<<< + * + * # close a previously opened file + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __Pyx_INCREF(__pyx_v_mode); + __pyx_t_1 = __pyx_v_mode; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) { + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "ctabix.pyx":33 + * + * # close a previously opened file + * if self.tabixfile != NULL: self.close() # <<<<<<<<<<<<<< + * self.tabixfile = NULL + * + */ + __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL); + if (__pyx_t_3) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":34 + * # close a previously opened file + * if self.tabixfile != NULL: self.close() + * self.tabixfile = NULL # <<<<<<<<<<<<<< + * + * if self._filename != NULL: free(self._filename ) + */ + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL; + + /* "ctabix.pyx":36 + * self.tabixfile = NULL + * + * if self._filename != NULL: free(self._filename ) # <<<<<<<<<<<<<< + * self._filename = strdup( filename ) + * + */ + __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_3) { + free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); + goto __pyx_L7; + } + __pyx_L7:; + + /* "ctabix.pyx":37 + * + * if self._filename != NULL: free(self._filename ) + * self._filename = strdup( filename ) # <<<<<<<<<<<<<< + * + * filename_index = filename + ".tbi" + */ + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename = strdup(__pyx_v_filename); + + /* "ctabix.pyx":39 + * self._filename = strdup( filename ) + * + * filename_index = filename + ".tbi" # <<<<<<<<<<<<<< + * + * if mode[0] == 'w': + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_filename_index); + __pyx_v_filename_index = __pyx_t_1; + __pyx_t_1 = 0; + + /* "ctabix.pyx":41 + * filename_index = filename + ".tbi" + * + * if mode[0] == 'w': # <<<<<<<<<<<<<< + * # open file for writing + * pass + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__w), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + goto __pyx_L8; + } + + /* "ctabix.pyx":45 + * pass + * + * elif mode[0] == "r": # <<<<<<<<<<<<<< + * # open file for reading + * if not os.path.exists( self._filename ): + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__r), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "ctabix.pyx":47 + * elif mode[0] == "r": + * # open file for reading + * if not os.path.exists( self._filename ): # <<<<<<<<<<<<<< + * raise IOError( "file `%s` not found" % self._filename) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = (!__pyx_t_3); + if (__pyx_t_5) { + + /* "ctabix.pyx":48 + * # open file for reading + * if not os.path.exists( self._filename ): + * raise IOError( "file `%s` not found" % self._filename) # <<<<<<<<<<<<<< + * + * if not os.path.exists( filename_index ): + */ + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "ctabix.pyx":50 + * raise IOError( "file `%s` not found" % self._filename) + * + * if not os.path.exists( filename_index ): # <<<<<<<<<<<<<< + * raise IOError( "index `%s` not found" % filename_index) + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_filename_index); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename_index); + __Pyx_GIVEREF(__pyx_v_filename_index); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_5); + if (__pyx_t_3) { + + /* "ctabix.pyx":51 + * + * if not os.path.exists( filename_index ): + * raise IOError( "index `%s` not found" % filename_index) # <<<<<<<<<<<<<< + * + * # open file and load index + */ + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_filename_index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "ctabix.pyx":54 + * + * # open file and load index + * self.tabixfile = ti_open( self._filename, filename_index ) # <<<<<<<<<<<<<< + * + * if self.tabixfile == NULL: + */ + __pyx_t_6 = PyBytes_AsString(__pyx_v_filename_index); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = ti_open(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename, __pyx_t_6); + goto __pyx_L8; + } + __pyx_L8:; + + /* "ctabix.pyx":56 + * self.tabixfile = ti_open( self._filename, filename_index ) + * + * if self.tabixfile == NULL: # <<<<<<<<<<<<<< + * raise IOError("could not open file `%s`" % filename ) + * + */ + __pyx_t_3 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile == NULL); + if (__pyx_t_3) { + + /* "ctabix.pyx":57 + * + * if self.tabixfile == NULL: + * raise IOError("could not open file `%s`" % filename ) # <<<<<<<<<<<<<< + * + * def _parseRegion( self, + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_filename); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("ctabix.Tabixfile._open"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_filename_index); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":59 + * raise IOError("could not open file `%s`" % filename ) + * + * def _parseRegion( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6ctabix_9Tabixfile_3_parseRegion[] = "Tabixfile._parseRegion(self, reference=None, start=None, end=None, region=None)\nparse region information.\n\n raise ValueError for for invalid regions.\n\n returns a tuple of region, tid, start and end. Region\n is a valid samtools :term:`region` or None if the region\n extends over the whole file.\n\n Note that regions are 1-based, while start,end are python coordinates.\n "; +static PyObject *__pyx_pf_6ctabix_9Tabixfile_3_parseRegion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + int __pyx_v_rtid; + int __pyx_v_rstart; + int __pyx_v_rend; + int __pyx_v_max_pos; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0}; + __Pyx_RefNannySetupContext("_parseRegion"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + + /* "ctabix.pyx":60 + * + * def _parseRegion( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "ctabix.pyx":61 + * def _parseRegion( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + values[1] = ((PyObject *)Py_None); + + /* "ctabix.pyx":62 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * '''parse region information. + */ + values[2] = ((PyObject *)Py_None); + + /* "ctabix.pyx":63 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * '''parse region information. + * + */ + values[3] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parseRegion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + } else { + + /* "ctabix.pyx":60 + * + * def _parseRegion( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "ctabix.pyx":61 + * def _parseRegion( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "ctabix.pyx":62 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * '''parse region information. + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "ctabix.pyx":63 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * '''parse region information. + * + */ + __pyx_v_region = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_parseRegion", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_region); + + /* "ctabix.pyx":74 + * Note that regions are 1-based, while start,end are python coordinates. + * ''' + * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<< + * + * cdef int rtid + */ + ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile); + + /* "ctabix.pyx":80 + * cdef int rend + * cdef int max_pos + * max_pos = 2 << 29 # <<<<<<<<<<<<<< + * + * rtid = rstart = rend = 0 + */ + __pyx_v_max_pos = 1073741824; + + /* "ctabix.pyx":82 + * max_pos = 2 << 29 + * + * rtid = rstart = rend = 0 # <<<<<<<<<<<<<< + * + * # translate to a region + */ + __pyx_v_rtid = 0; + __pyx_v_rstart = 0; + __pyx_v_rend = 0; + + /* "ctabix.pyx":85 + * + * # translate to a region + * if reference: # <<<<<<<<<<<<<< + * if start != None and end != None: + * region = "%s:%i-%i" % (reference, start+1, end) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "ctabix.pyx":86 + * # translate to a region + * if reference: + * if start != None and end != None: # <<<<<<<<<<<<<< + * region = "%s:%i-%i" % (reference, start+1, end) + * elif start == None and end != None: + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_1; + } + if (__pyx_t_4) { + + /* "ctabix.pyx":87 + * if reference: + * if start != None and end != None: + * region = "%s:%i-%i" % (reference, start+1, end) # <<<<<<<<<<<<<< + * elif start == None and end != None: + * region = "%s:%i-%i" % (reference, 1, end) + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L7; + } + + /* "ctabix.pyx":88 + * if start != None and end != None: + * region = "%s:%i-%i" % (reference, start+1, end) + * elif start == None and end != None: # <<<<<<<<<<<<<< + * region = "%s:%i-%i" % (reference, 1, end) + * elif end == None and start != None: + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "ctabix.pyx":89 + * region = "%s:%i-%i" % (reference, start+1, end) + * elif start == None and end != None: + * region = "%s:%i-%i" % (reference, 1, end) # <<<<<<<<<<<<<< + * elif end == None and start != None: + * region = "%s:%i-%i" % (reference, start+1, max_pos-1) + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L7; + } + + /* "ctabix.pyx":90 + * elif start == None and end != None: + * region = "%s:%i-%i" % (reference, 1, end) + * elif end == None and start != None: # <<<<<<<<<<<<<< + * region = "%s:%i-%i" % (reference, start+1, max_pos-1) + * else: + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_end, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + __pyx_t_5 = PyObject_RichCompare(__pyx_v_start, Py_None, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __pyx_t_4; + } else { + __pyx_t_1 = __pyx_t_3; + } + if (__pyx_t_1) { + + /* "ctabix.pyx":91 + * region = "%s:%i-%i" % (reference, 1, end) + * elif end == None and start != None: + * region = "%s:%i-%i" % (reference, start+1, max_pos-1) # <<<<<<<<<<<<<< + * else: + * region = reference + */ + __pyx_t_5 = PyNumber_Add(__pyx_v_start, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyInt_FromLong((__pyx_v_max_pos - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_5 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "ctabix.pyx":93 + * region = "%s:%i-%i" % (reference, start+1, max_pos-1) + * else: + * region = reference # <<<<<<<<<<<<<< + * + * if region: + */ + __Pyx_INCREF(__pyx_v_reference); + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = __pyx_v_reference; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":95 + * region = reference + * + * if region: # <<<<<<<<<<<<<< + * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) + * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "ctabix.pyx":96 + * + * if region: + * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) # <<<<<<<<<<<<<< + * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) + * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) + */ + __pyx_t_7 = PyBytes_AsString(__pyx_v_region); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ti_parse_region(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, __pyx_t_7, (&__pyx_v_rtid), (&__pyx_v_rstart), (&__pyx_v_rend)); + + /* "ctabix.pyx":97 + * if region: + * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) + * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) # <<<<<<<<<<<<<< + * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + */ + __pyx_t_1 = (__pyx_v_rtid < 0); + if (__pyx_t_1) { + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_region); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "ctabix.pyx":98 + * ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) + * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) + * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) # <<<<<<<<<<<<<< + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) + */ + __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rend); + if (__pyx_t_1) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "ctabix.pyx":99 + * if rtid < 0: raise ValueError( "invalid region `%s`" % region ) + * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) # <<<<<<<<<<<<<< + * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) + * + */ + __pyx_t_1 = (0 <= __pyx_v_rstart); + if (__pyx_t_1) { + __pyx_t_1 = (__pyx_v_rstart < __pyx_v_max_pos); + } + __pyx_t_3 = (!__pyx_t_1); + if (__pyx_t_3) { + __pyx_t_6 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "ctabix.pyx":100 + * if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) + * if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) # <<<<<<<<<<<<<< + * + * return region, rtid, rstart, rend + */ + __pyx_t_3 = (0 <= __pyx_v_rend); + if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_rend < __pyx_v_max_pos); + } + __pyx_t_1 = (!__pyx_t_3); + if (__pyx_t_1) { + __pyx_t_5 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + goto __pyx_L8; + } + __pyx_L8:; + + /* "ctabix.pyx":102 + * if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) + * + * return region, rtid, rstart, rend # <<<<<<<<<<<<<< + * + * def fetch( self, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyInt_FromLong(__pyx_v_rtid); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyInt_FromLong(__pyx_v_rstart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyInt_FromLong(__pyx_v_rend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_6 = 0; + __pyx_t_5 = 0; + __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_8); + __pyx_t_8 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("ctabix.Tabixfile._parseRegion"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_region); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":104 + * return region, rtid, rstart, rend + * + * def fetch( self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6ctabix_9Tabixfile_4fetch[] = "Tabixfile.fetch(self, reference=None, start=None, end=None, region=None, parser=None)\n\n \n fetch one or more rows in a :term:`region` using 0-based indexing. The region is specified by\n :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied.\n\n Without *reference* or *region* all entries will be fetched. \n \n If only *reference* is set, all reads matching on *reference* will be fetched.\n\n If *parser* is None, the results are returned as an unparsed string.\n Otherwise, *parser* is assumed to be a functor that will return parsed \n data (see for example :meth:`asTuple` and :meth:`asGTF`).\n "; +static PyObject *__pyx_pf_6ctabix_9Tabixfile_4fetch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + PyObject *__pyx_v_parser = 0; + PyObject *__pyx_v_rtid; + PyObject *__pyx_v_rstart; + PyObject *__pyx_v_rend; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,&__pyx_n_s__parser,0}; + __Pyx_RefNannySetupContext("fetch"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + + /* "ctabix.pyx":105 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[0] = ((PyObject *)Py_None); + + /* "ctabix.pyx":106 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "ctabix.pyx":107 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * parser = None ): + */ + values[2] = ((PyObject *)Py_None); + + /* "ctabix.pyx":108 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * parser = None ): + * ''' + */ + values[3] = ((PyObject *)Py_None); + + /* "ctabix.pyx":109 + * end = None, + * region = None, + * parser = None ): # <<<<<<<<<<<<<< + * ''' + * + */ + values[4] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_reference = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_region = values[3]; + __pyx_v_parser = values[4]; + } else { + + /* "ctabix.pyx":105 + * + * def fetch( self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "ctabix.pyx":106 + * def fetch( self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None, + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "ctabix.pyx":107 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None, + * parser = None ): + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "ctabix.pyx":108 + * start = None, + * end = None, + * region = None, # <<<<<<<<<<<<<< + * parser = None ): + * ''' + */ + __pyx_v_region = ((PyObject *)Py_None); + + /* "ctabix.pyx":109 + * end = None, + * region = None, + * parser = None ): # <<<<<<<<<<<<<< + * ''' + * + */ + __pyx_v_parser = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_parser = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.Tabixfile.fetch"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_region); + __pyx_v_rtid = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_rstart = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_rend = Py_None; __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":123 + * data (see for example :meth:`asTuple` and :meth:`asGTF`). + * ''' + * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<< + * + * if not self._isOpen(): + */ + ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile); + + /* "ctabix.pyx":125 + * ti_lazy_index_load( self.tabixfile ) + * + * if not self._isOpen(): # <<<<<<<<<<<<<< + * raise ValueError( "I/O operation on closed file" ) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "ctabix.pyx":126 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":128 + * raise ValueError( "I/O operation on closed file" ) + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) # <<<<<<<<<<<<<< + * + * if parser == None: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parseRegion); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 4)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6); + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_rtid); + __pyx_v_rtid = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_rstart); + __pyx_v_rstart = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_rend); + __pyx_v_rend = __pyx_t_7; + __pyx_t_7 = 0; + } else { + __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_8, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_region); + __pyx_v_region = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_rtid); + __pyx_v_rtid = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_rstart); + __pyx_v_rstart = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_rend); + __pyx_v_rend = __pyx_t_7; + __pyx_t_7 = 0; + } + + /* "ctabix.pyx":130 + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + * + * if parser == None: # <<<<<<<<<<<<<< + * if region: + * return TabixIterator( self, rtid, rstart, rend ) + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_parser, Py_None, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_4) { + + /* "ctabix.pyx":131 + * + * if parser == None: + * if region: # <<<<<<<<<<<<<< + * return TabixIterator( self, rtid, rstart, rend ) + * else: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "ctabix.pyx":132 + * if parser == None: + * if region: + * return TabixIterator( self, rtid, rstart, rend ) # <<<<<<<<<<<<<< + * else: + * return TabixIterator( self, -1, 0, 0 ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_rtid); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid); + __Pyx_GIVEREF(__pyx_v_rtid); + __Pyx_INCREF(__pyx_v_rstart); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart); + __Pyx_GIVEREF(__pyx_v_rstart); + __Pyx_INCREF(__pyx_v_rend); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend); + __Pyx_GIVEREF(__pyx_v_rend); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + /*else*/ { + + /* "ctabix.pyx":134 + * return TabixIterator( self, rtid, rstart, rend ) + * else: + * return TabixIterator( self, -1, 0, 0 ) # <<<<<<<<<<<<<< + * else: + * if region: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIterator)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "ctabix.pyx":136 + * return TabixIterator( self, -1, 0, 0 ) + * else: + * if region: # <<<<<<<<<<<<<< + * return TabixIteratorParsed( self, rtid, rstart, rend, parser ) + * else: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "ctabix.pyx":137 + * else: + * if region: + * return TabixIteratorParsed( self, rtid, rstart, rend, parser ) # <<<<<<<<<<<<<< + * else: + * return TabixIteratorParsed( self, -1, 0, 0, parser ) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_v_rtid); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_rtid); + __Pyx_GIVEREF(__pyx_v_rtid); + __Pyx_INCREF(__pyx_v_rstart); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_rstart); + __Pyx_GIVEREF(__pyx_v_rstart); + __Pyx_INCREF(__pyx_v_rend); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_rend); + __Pyx_GIVEREF(__pyx_v_rend); + __Pyx_INCREF(__pyx_v_parser); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_parser); + __Pyx_GIVEREF(__pyx_v_parser); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + /*else*/ { + + /* "ctabix.pyx":139 + * return TabixIteratorParsed( self, rtid, rstart, rend, parser ) + * else: + * return TabixIteratorParsed( self, -1, 0, 0, parser ) # <<<<<<<<<<<<<< + * + * ############################################################### + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_v_parser); + PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_parser); + __Pyx_GIVEREF(__pyx_v_parser); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixIteratorParsed)), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + } + __pyx_L9:; + } + __pyx_L7:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("ctabix.Tabixfile.fetch"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_rtid); + __Pyx_DECREF(__pyx_v_rstart); + __Pyx_DECREF(__pyx_v_rend); + __Pyx_DECREF(__pyx_v_region); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":148 + * property filename: + * '''filename associated with this object.''' + * def __get__(self): # <<<<<<<<<<<<<< + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_9Tabixfile_8filename___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("__get__"); + + /* "ctabix.pyx":149 + * '''filename associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "ctabix.pyx":150 + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + * return self._filename # <<<<<<<<<<<<<< + * + * property header: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.Tabixfile.filename.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":160 + * ''' + * + * def __get__( self ): # <<<<<<<<<<<<<< + * return TabixHeaderIterator( self ) + * + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_9Tabixfile_6header___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__get__"); + + /* "ctabix.pyx":161 + * + * def __get__( self ): + * return TabixHeaderIterator( self ) # <<<<<<<<<<<<<< + * + * property contigs: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6ctabix_TabixHeaderIterator)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.Tabixfile.header.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":165 + * property contigs: + * '''chromosome names''' + * def __get__(self): # <<<<<<<<<<<<<< + * cdef char ** sequences + * cdef int nsequences + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_9Tabixfile_7contigs___get__(PyObject *__pyx_v_self) { + char **__pyx_v_sequences; + int __pyx_v_nsequences; + int __pyx_v_x; + PyObject *__pyx_v_result; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__get__"); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":169 + * cdef int nsequences + * + * ti_lazy_index_load( self.tabixfile ) # <<<<<<<<<<<<<< + * sequences = ti_seqname( self.tabixfile.idx, &nsequences ) + * cdef int x + */ + ti_lazy_index_load(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile); + + /* "ctabix.pyx":170 + * + * ti_lazy_index_load( self.tabixfile ) + * sequences = ti_seqname( self.tabixfile.idx, &nsequences ) # <<<<<<<<<<<<<< + * cdef int x + * result = [] + */ + __pyx_v_sequences = ti_seqname(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile->idx, (&__pyx_v_nsequences)); + + /* "ctabix.pyx":172 + * sequences = ti_seqname( self.tabixfile.idx, &nsequences ) + * cdef int x + * result = [] # <<<<<<<<<<<<<< + * for x from 0 <= x < nsequences: + * result.append( sequences[x] ) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "ctabix.pyx":173 + * cdef int x + * result = [] + * for x from 0 <= x < nsequences: # <<<<<<<<<<<<<< + * result.append( sequences[x] ) + * return result + */ + __pyx_t_2 = __pyx_v_nsequences; + for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) { + + /* "ctabix.pyx":174 + * result = [] + * for x from 0 <= x < nsequences: + * result.append( sequences[x] ) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyBytes_FromString((__pyx_v_sequences[__pyx_v_x])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + + /* "ctabix.pyx":175 + * for x from 0 <= x < nsequences: + * result.append( sequences[x] ) + * return result # <<<<<<<<<<<<<< + * + * def close( self ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.Tabixfile.contigs.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":177 + * return result + * + * def close( self ): # <<<<<<<<<<<<<< + * ''' + * closes the :class:`pysam.Tabixfile`.''' + */ + +static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_6ctabix_9Tabixfile_5close[] = "Tabixfile.close(self)\n\n closes the :class:`pysam.Tabixfile`."; +static PyObject *__pyx_pf_6ctabix_9Tabixfile_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("close"); + + /* "ctabix.pyx":180 + * ''' + * closes the :class:`pysam.Tabixfile`.''' + * if self.tabixfile != NULL: # <<<<<<<<<<<<<< + * ti_close( self.tabixfile ) + * self.tabixfile = NULL + */ + __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL); + if (__pyx_t_1) { + + /* "ctabix.pyx":181 + * closes the :class:`pysam.Tabixfile`.''' + * if self.tabixfile != NULL: + * ti_close( self.tabixfile ) # <<<<<<<<<<<<<< + * self.tabixfile = NULL + * + */ + ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile); + + /* "ctabix.pyx":182 + * if self.tabixfile != NULL: + * ti_close( self.tabixfile ) + * self.tabixfile = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__( self ): + */ + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL; + goto __pyx_L5; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":184 + * self.tabixfile = NULL + * + * def __dealloc__( self ): # <<<<<<<<<<<<<< + * # remember: dealloc cannot call other python methods + * # note: no doc string + */ + +static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "ctabix.pyx":188 + * # note: no doc string + * # note: __del__ is not called. + * if self.tabixfile != NULL: # <<<<<<<<<<<<<< + * ti_close( self.tabixfile ) + * self.tabixfile = NULL + */ + __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile != NULL); + if (__pyx_t_1) { + + /* "ctabix.pyx":189 + * # note: __del__ is not called. + * if self.tabixfile != NULL: + * ti_close( self.tabixfile ) # <<<<<<<<<<<<<< + * self.tabixfile = NULL + * if self._filename != NULL: free( self._filename ) + */ + ti_close(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile); + + /* "ctabix.pyx":190 + * if self.tabixfile != NULL: + * ti_close( self.tabixfile ) + * self.tabixfile = NULL # <<<<<<<<<<<<<< + * if self._filename != NULL: free( self._filename ) + * + */ + ((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->tabixfile = NULL; + goto __pyx_L5; + } + __pyx_L5:; + + /* "ctabix.pyx":191 + * ti_close( self.tabixfile ) + * self.tabixfile = NULL + * if self._filename != NULL: free( self._filename ) # <<<<<<<<<<<<<< + * + * cdef class TabixIterator: + */ + __pyx_t_1 = (((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename != NULL); + if (__pyx_t_1) { + free(((struct __pyx_obj_6ctabix_Tabixfile *)__pyx_v_self)->_filename); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "ctabix.pyx":201 + * cdef tabix_t * tabixfile + * + * def __cinit__(self, Tabixfile tabixfile, # <<<<<<<<<<<<<< + * int tid, int start, int end ): + * + */ + +static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_6ctabix_13TabixIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0; + int __pyx_v_tid; + int __pyx_v_start; + int __pyx_v_end; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]); + __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "ctabix.pyx":204 + * int tid, int start, int end ): + * + * assert tabixfile._isOpen() # <<<<<<<<<<<<<< + * + * # makes sure that samfile stays alive as long as the + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "ctabix.pyx":208 + * # makes sure that samfile stays alive as long as the + * # iterator is alive. + * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<< + * + * if tid < 0: + */ + ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile; + + /* "ctabix.pyx":210 + * self.tabixfile = tabixfile.tabixfile + * + * if tid < 0: # <<<<<<<<<<<<<< + * # seek to start of file to ensure iteration is over + * # all entries. + */ + __pyx_t_3 = (__pyx_v_tid < 0); + if (__pyx_t_3) { + + /* "ctabix.pyx":213 + * # seek to start of file to ensure iteration is over + * # all entries. + * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<< + * self.iterator = ti_iter_first() + * else: + */ + bgzf_seek(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile->fp, 0, 0); + + /* "ctabix.pyx":214 + * # all entries. + * bgzf_seek( self.tabixfile.fp, 0, 0) + * self.iterator = ti_iter_first() # <<<<<<<<<<<<<< + * else: + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) + */ + ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator = ti_iter_first(); + goto __pyx_L6; + } + /*else*/ { + + /* "ctabix.pyx":216 + * self.iterator = ti_iter_first() + * else: + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<< + * + * if self.iterator == NULL: + */ + ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator = ti_queryi(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end); + } + __pyx_L6:; + + /* "ctabix.pyx":218 + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) + * + * if self.iterator == NULL: # <<<<<<<<<<<<<< + * raise ValueError("malformatted query or wrong sequence name.\n") + * + */ + __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) == NULL); + if (__pyx_t_3) { + + /* "ctabix.pyx":219 + * + * if self.iterator == NULL: + * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.TabixIterator.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":221 + * raise ValueError("malformatted query or wrong sequence name.\n") + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_13TabixIterator_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__iter__"); + + /* "ctabix.pyx":222 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":224 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_6ctabix_13TabixIterator_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__; +static PyObject *__pyx_pf_6ctabix_13TabixIterator_2__next__(PyObject *__pyx_v_self) { + char *__pyx_v_s; + int __pyx_v_len; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__next__"); + + /* "ctabix.pyx":237 + * + * # simply use '#' for now. + * while 1: # <<<<<<<<<<<<<< + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration + */ + while (1) { + if (!1) break; + + /* "ctabix.pyx":238 + * # simply use '#' for now. + * while 1: + * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<< + * if s == NULL: raise StopIteration + * if s[0] != '#': break + */ + __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator, (&__pyx_v_len)); + + /* "ctabix.pyx":239 + * while 1: + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration # <<<<<<<<<<<<<< + * if s[0] != '#': break + * + */ + __pyx_t_1 = (__pyx_v_s == NULL); + if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "ctabix.pyx":240 + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration + * if s[0] != '#': break # <<<<<<<<<<<<<< + * + * return s + */ + __pyx_t_1 = ((__pyx_v_s[0]) != '#'); + if (__pyx_t_1) { + goto __pyx_L6_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L6_break:; + + /* "ctabix.pyx":242 + * if s[0] != '#': break + * + * return s # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.TabixIterator.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":244 + * return s + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) + */ + +static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "ctabix.pyx":245 + * + * def __dealloc__(self): + * if self.iterator != NULL: # <<<<<<<<<<<<<< + * ti_iter_destroy(self.iterator) + * + */ + __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator) != NULL); + if (__pyx_t_1) { + + /* "ctabix.pyx":246 + * def __dealloc__(self): + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<< + * + * cdef class TabixHeaderIterator: + */ + ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixIterator *)__pyx_v_self)->iterator); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_RefNannyFinishContext(); +} + +/* "ctabix.pyx":255 + * cdef tabix_t * tabixfile + * + * def __cinit__(self, Tabixfile tabixfile ): # <<<<<<<<<<<<<< + * + * assert tabixfile._isOpen() + */ + +static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "ctabix.pyx":257 + * def __cinit__(self, Tabixfile tabixfile ): + * + * assert tabixfile._isOpen() # <<<<<<<<<<<<<< + * + * # makes sure that samfile stays alive as long as the + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "ctabix.pyx":261 + * # makes sure that samfile stays alive as long as the + * # iterator is alive. + * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<< + * + * self.iterator = ti_query(self.tabixfile, NULL, 0, 0) + */ + ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile; + + /* "ctabix.pyx":263 + * self.tabixfile = tabixfile.tabixfile + * + * self.iterator = ti_query(self.tabixfile, NULL, 0, 0) # <<<<<<<<<<<<<< + * + * if self.iterator == NULL: + */ + ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator = ti_query(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, NULL, 0, 0); + + /* "ctabix.pyx":265 + * self.iterator = ti_query(self.tabixfile, NULL, 0, 0) + * + * if self.iterator == NULL: # <<<<<<<<<<<<<< + * raise ValueError("can't open header.\n") + * + */ + __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) == NULL); + if (__pyx_t_3) { + + /* "ctabix.pyx":266 + * + * if self.iterator == NULL: + * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":268 + * raise ValueError("can't open header.\n") + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__iter__"); + + /* "ctabix.pyx":269 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":271 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__; +static PyObject *__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__(PyObject *__pyx_v_self) { + char *__pyx_v_s; + int __pyx_v_len; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__next__"); + + /* "ctabix.pyx":282 + * # Getting the metachar is a pain as ti_index_t is incomplete type. + * # simply use '#' for now. + * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<< + * if s == NULL: raise StopIteration + * # stop at first non-header line + */ + __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator, (&__pyx_v_len)); + + /* "ctabix.pyx":283 + * # simply use '#' for now. + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration # <<<<<<<<<<<<<< + * # stop at first non-header line + * if s[0] != '#': raise StopIteration + */ + __pyx_t_1 = (__pyx_v_s == NULL); + if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "ctabix.pyx":285 + * if s == NULL: raise StopIteration + * # stop at first non-header line + * if s[0] != '#': raise StopIteration # <<<<<<<<<<<<<< + * + * return s + */ + __pyx_t_1 = ((__pyx_v_s[0]) != '#'); + if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":287 + * if s[0] != '#': raise StopIteration + * + * return s # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.TabixHeaderIterator.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":289 + * return s + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) + */ + +static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "ctabix.pyx":290 + * + * def __dealloc__(self): + * if self.iterator != NULL: # <<<<<<<<<<<<<< + * ti_iter_destroy(self.iterator) + * + */ + __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator) != NULL); + if (__pyx_t_1) { + + /* "ctabix.pyx":291 + * def __dealloc__(self): + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<< + * + * ######################################################### + */ + ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixHeaderIterator *)__pyx_v_self)->iterator); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_RefNannyFinishContext(); +} + +/* "ctabix.pyx":304 + * Access is by numeric index. + * ''' + * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<< + * cdef TabProxies.TupleProxy r + * r = TabProxies.TupleProxy() + */ + +static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_6ctabix_7asTuple___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_buffer; + int __pyx_v_len; + struct __pyx_obj_10TabProxies_TupleProxy *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0}; + __Pyx_RefNannySetupContext("__call__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.asTuple.__call__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":306 + * def __call__(self, char * buffer, int len): + * cdef TabProxies.TupleProxy r + * r = TabProxies.TupleProxy() # <<<<<<<<<<<<<< + * # need to copy - there were some + * # persistence issues with "present" + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_TupleProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_r)); + __pyx_v_r = ((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":309 + * # need to copy - there were some + * # persistence issues with "present" + * r.copy( buffer, len ) # <<<<<<<<<<<<<< + * return r + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_TupleProxy *)__pyx_v_r->__pyx_vtab)->copy(__pyx_v_r, __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":310 + * # persistence issues with "present" + * r.copy( buffer, len ) + * return r # <<<<<<<<<<<<<< + * + * cdef class asGTF(Parser): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_r)); + __pyx_r = ((PyObject *)__pyx_v_r); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.asTuple.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":343 + * + * ''' + * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<< + * cdef TabProxies.GTFProxy r + * r = TabProxies.GTFProxy() + */ + +static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_6ctabix_5asGTF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_buffer; + int __pyx_v_len; + struct __pyx_obj_10TabProxies_GTFProxy *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0}; + __Pyx_RefNannySetupContext("__call__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.asGTF.__call__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":345 + * def __call__(self, char * buffer, int len): + * cdef TabProxies.GTFProxy r + * r = TabProxies.GTFProxy() # <<<<<<<<<<<<<< + * r.copy( buffer, len ) + * return r + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_GTFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_r)); + __pyx_v_r = ((struct __pyx_obj_10TabProxies_GTFProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":346 + * cdef TabProxies.GTFProxy r + * r = TabProxies.GTFProxy() + * r.copy( buffer, len ) # <<<<<<<<<<<<<< + * return r + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_GTFProxy *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":347 + * r = TabProxies.GTFProxy() + * r.copy( buffer, len ) + * return r # <<<<<<<<<<<<<< + * + * cdef class asBed( Parser ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_r)); + __pyx_r = ((PyObject *)__pyx_v_r); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.asGTF.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":383 + * + * ''' + * def __call__(self, char * buffer, int len): # <<<<<<<<<<<<<< + * cdef TabProxies.BedProxy r + * r = TabProxies.BedProxy() + */ + +static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_6ctabix_5asBed___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_buffer; + int __pyx_v_len; + struct __pyx_obj_10TabProxies_BedProxy *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0}; + __Pyx_RefNannySetupContext("__call__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.asBed.__call__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":385 + * def __call__(self, char * buffer, int len): + * cdef TabProxies.BedProxy r + * r = TabProxies.BedProxy() # <<<<<<<<<<<<<< + * r.copy( buffer, len ) + * return r + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_BedProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_r)); + __pyx_v_r = ((struct __pyx_obj_10TabProxies_BedProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":386 + * cdef TabProxies.BedProxy r + * r = TabProxies.BedProxy() + * r.copy( buffer, len ) # <<<<<<<<<<<<<< + * return r + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_BedProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":387 + * r = TabProxies.BedProxy() + * r.copy( buffer, len ) + * return r # <<<<<<<<<<<<<< + * + * cdef class asVCF( Parser ): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_r)); + __pyx_r = ((PyObject *)__pyx_v_r); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.asBed.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":419 + * + * ''' + * def __call__(self, char * buffer, int len ): # <<<<<<<<<<<<<< + * cdef TabProxies.VCFProxy r + * r = TabProxies.VCFProxy() + */ + +static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_6ctabix_5asVCF___call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_buffer; + int __pyx_v_len; + struct __pyx_obj_10TabProxies_VCFProxy *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0}; + __Pyx_RefNannySetupContext("__call__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.asVCF.__call__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)Py_None); __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":421 + * def __call__(self, char * buffer, int len ): + * cdef TabProxies.VCFProxy r + * r = TabProxies.VCFProxy() # <<<<<<<<<<<<<< + * r.copy( buffer, len ) + * return r + */ + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10TabProxies_VCFProxy)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_v_r)); + __pyx_v_r = ((struct __pyx_obj_10TabProxies_VCFProxy *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":422 + * cdef TabProxies.VCFProxy r + * r = TabProxies.VCFProxy() + * r.copy( buffer, len ) # <<<<<<<<<<<<<< + * return r + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_10TabProxies_VCFProxy *)__pyx_v_r->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":423 + * r = TabProxies.VCFProxy() + * r.copy( buffer, len ) + * return r # <<<<<<<<<<<<<< + * + * ######################################################### + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_r)); + __pyx_r = ((PyObject *)__pyx_v_r); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("ctabix.asVCF.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":438 + * cdef Parser parser + * + * def __cinit__(self, # <<<<<<<<<<<<<< + * Tabixfile tabixfile, + * int tid, + */ + +static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6ctabix_Tabixfile *__pyx_v_tabixfile = 0; + int __pyx_v_tid; + int __pyx_v_start; + int __pyx_v_end; + struct __pyx_obj_6ctabix_Parser *__pyx_v_parser = 0; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tabixfile,&__pyx_n_s__tid,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__parser,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tabixfile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tid); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parser); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)values[0]); + __pyx_v_tid = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)values[4]); + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_tabixfile = ((struct __pyx_obj_6ctabix_Tabixfile *)PyTuple_GET_ITEM(__pyx_args, 0)); + __pyx_v_tid = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_tid == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_start = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_end = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_end == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_parser = ((struct __pyx_obj_6ctabix_Parser *)PyTuple_GET_ITEM(__pyx_args, 4)); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tabixfile), __pyx_ptype_6ctabix_Tabixfile, 1, "tabixfile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parser), __pyx_ptype_6ctabix_Parser, 1, "parser", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "ctabix.pyx":445 + * Parser parser ): + * + * assert tabixfile._isOpen() # <<<<<<<<<<<<<< + * self.parser = parser + * + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_tabixfile), __pyx_n_s___isOpen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "ctabix.pyx":446 + * + * assert tabixfile._isOpen() + * self.parser = parser # <<<<<<<<<<<<<< + * + * # makes sure that samfile stays alive as long as the + */ + __Pyx_INCREF(((PyObject *)__pyx_v_parser)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parser)); + __Pyx_GOTREF(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser); + __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser)); + ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser = __pyx_v_parser; + + /* "ctabix.pyx":450 + * # makes sure that samfile stays alive as long as the + * # iterator is alive. + * self.tabixfile = tabixfile.tabixfile # <<<<<<<<<<<<<< + * + * if tid < 0: + */ + ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile = __pyx_v_tabixfile->tabixfile; + + /* "ctabix.pyx":452 + * self.tabixfile = tabixfile.tabixfile + * + * if tid < 0: # <<<<<<<<<<<<<< + * # seek to start of file to ensure iteration is over + * # all entries. + */ + __pyx_t_3 = (__pyx_v_tid < 0); + if (__pyx_t_3) { + + /* "ctabix.pyx":455 + * # seek to start of file to ensure iteration is over + * # all entries. + * bgzf_seek( self.tabixfile.fp, 0, 0) # <<<<<<<<<<<<<< + * self.iterator = ti_iter_first() + * else: + */ + bgzf_seek(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile->fp, 0, 0); + + /* "ctabix.pyx":456 + * # all entries. + * bgzf_seek( self.tabixfile.fp, 0, 0) + * self.iterator = ti_iter_first() # <<<<<<<<<<<<<< + * else: + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) + */ + ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator = ti_iter_first(); + goto __pyx_L6; + } + /*else*/ { + + /* "ctabix.pyx":458 + * self.iterator = ti_iter_first() + * else: + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) # <<<<<<<<<<<<<< + * + * if self.iterator == NULL: + */ + ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator = ti_queryi(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile, __pyx_v_tid, __pyx_v_start, __pyx_v_end); + } + __pyx_L6:; + + /* "ctabix.pyx":460 + * self.iterator = ti_queryi(self.tabixfile, tid, start, end) + * + * if self.iterator == NULL: # <<<<<<<<<<<<<< + * raise ValueError("malformatted query or wrong sequence name.\n") + * + */ + __pyx_t_3 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) == NULL); + if (__pyx_t_3) { + + /* "ctabix.pyx":461 + * + * if self.iterator == NULL: + * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__cinit__"); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":463 + * raise ValueError("malformatted query or wrong sequence name.\n") + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("__iter__"); + + /* "ctabix.pyx":464 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":466 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * """python version of next(). + * + */ + +static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__[] = "python version of next().\n\n pyrex uses this non-standard name instead of next()\n "; +struct wrapperbase __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__; +static PyObject *__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__(PyObject *__pyx_v_self) { + char *__pyx_v_s; + int __pyx_v_len; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__next__"); + + /* "ctabix.pyx":474 + * cdef char * s + * cdef int len + * while 1: # <<<<<<<<<<<<<< + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration + */ + while (1) { + if (!1) break; + + /* "ctabix.pyx":475 + * cdef int len + * while 1: + * s = ti_read(self.tabixfile, self.iterator, &len) # <<<<<<<<<<<<<< + * if s == NULL: raise StopIteration + * # todo: read metachar from configuration + */ + __pyx_v_s = ti_read(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->tabixfile, ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator, (&__pyx_v_len)); + + /* "ctabix.pyx":476 + * while 1: + * s = ti_read(self.tabixfile, self.iterator, &len) + * if s == NULL: raise StopIteration # <<<<<<<<<<<<<< + * # todo: read metachar from configuration + * if s[0] != '#': break + */ + __pyx_t_1 = (__pyx_v_s == NULL); + if (__pyx_t_1) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "ctabix.pyx":478 + * if s == NULL: raise StopIteration + * # todo: read metachar from configuration + * if s[0] != '#': break # <<<<<<<<<<<<<< + * + * return self.parser(s, len) + */ + __pyx_t_1 = ((__pyx_v_s[0]) != '#'); + if (__pyx_t_1) { + goto __pyx_L6_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L6_break:; + + /* "ctabix.pyx":480 + * if s[0] != '#': break + * + * return self.parser(s, len) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyInt_FromLong(__pyx_v_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->parser), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("ctabix.TabixIteratorParsed.__next__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":482 + * return self.parser(s, len) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) + */ + +static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(PyObject *__pyx_v_self) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "ctabix.pyx":483 + * + * def __dealloc__(self): + * if self.iterator != NULL: # <<<<<<<<<<<<<< + * ti_iter_destroy(self.iterator) + * + */ + __pyx_t_1 = (((void *)((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator) != NULL); + if (__pyx_t_1) { + + /* "ctabix.pyx":484 + * def __dealloc__(self): + * if self.iterator != NULL: + * ti_iter_destroy(self.iterator) # <<<<<<<<<<<<<< + * + * def tabix_compress( filename_in, + */ + ti_iter_destroy(((struct __pyx_obj_6ctabix_TabixIteratorParsed *)__pyx_v_self)->iterator); + goto __pyx_L5; + } + __pyx_L5:; + + __Pyx_RefNannyFinishContext(); +} + +/* "ctabix.pyx":486 + * ti_iter_destroy(self.iterator) + * + * def tabix_compress( filename_in, # <<<<<<<<<<<<<< + * filename_out, + * force = False ): + */ + +static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6ctabix_tabix_compress[] = "tabix_compress(filename_in, filename_out, force=False)\n\n compress *filename_in* writing the output to *filename_out*.\n \n Raise an IOError if *filename_out* already exists, unless *force* is set.\n "; +static PyMethodDef __pyx_mdef_6ctabix_tabix_compress = {__Pyx_NAMESTR("tabix_compress"), (PyCFunction)__pyx_pf_6ctabix_tabix_compress, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_tabix_compress)}; +static PyObject *__pyx_pf_6ctabix_tabix_compress(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename_in = 0; + PyObject *__pyx_v_filename_out = 0; + PyObject *__pyx_v_force = 0; + int __pyx_v_WINDOW_SIZE; + int __pyx_v_c; + int __pyx_v_r; + void *__pyx_v_buffer; + BGZF *__pyx_v_fp; + int __pyx_v_fd_src; + int __pyx_v_O_RDONLY; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + char *__pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename_in,&__pyx_n_s__filename_out,&__pyx_n_s__force,0}; + __Pyx_RefNannySetupContext("tabix_compress"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = __pyx_k_19; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_in); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename_out); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_compress") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_filename_in = values[0]; + __pyx_v_filename_out = values[1]; + __pyx_v_force = values[2]; + } else { + __pyx_v_force = __pyx_k_19; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: + __pyx_v_force = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: + __pyx_v_filename_out = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_filename_in = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("tabix_compress", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.tabix_compress"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "ctabix.pyx":496 + * ''' + * + * if not force and os.path.exists(filename_out ): # <<<<<<<<<<<<<< + * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out) + * + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (!__pyx_t_1); + if (__pyx_t_2) { + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__exists); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_filename_out); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_filename_out); + __Pyx_GIVEREF(__pyx_v_filename_out); + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __pyx_t_1; + } else { + __pyx_t_6 = __pyx_t_2; + } + if (__pyx_t_6) { + + /* "ctabix.pyx":497 + * + * if not force and os.path.exists(filename_out ): + * raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out) # <<<<<<<<<<<<<< + * + * cdef int WINDOW_SIZE + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_v_filename_out); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":506 + * + * cdef int O_RDONLY + * O_RDONLY = os.O_RDONLY # <<<<<<<<<<<<<< + * + * WINDOW_SIZE = 64 * 1024 + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__O_RDONLY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_O_RDONLY = __pyx_t_7; + + /* "ctabix.pyx":508 + * O_RDONLY = os.O_RDONLY + * + * WINDOW_SIZE = 64 * 1024 # <<<<<<<<<<<<<< + * + * fp = bgzf_open( filename_out, "w") + */ + __pyx_v_WINDOW_SIZE = 65536; + + /* "ctabix.pyx":510 + * WINDOW_SIZE = 64 * 1024 + * + * fp = bgzf_open( filename_out, "w") # <<<<<<<<<<<<<< + * if fp == NULL: + * raise IOError( "could not open '%s' for writing" ) + */ + __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_out); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_fp = bgzf_open(__pyx_t_8, __pyx_k__w); + + /* "ctabix.pyx":511 + * + * fp = bgzf_open( filename_out, "w") + * if fp == NULL: # <<<<<<<<<<<<<< + * raise IOError( "could not open '%s' for writing" ) + * + */ + __pyx_t_6 = (__pyx_v_fp == NULL); + if (__pyx_t_6) { + + /* "ctabix.pyx":512 + * fp = bgzf_open( filename_out, "w") + * if fp == NULL: + * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<< + * + * fd_src = open(filename_in, O_RDONLY) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "ctabix.pyx":514 + * raise IOError( "could not open '%s' for writing" ) + * + * fd_src = open(filename_in, O_RDONLY) # <<<<<<<<<<<<<< + * if fd_src == 0: + * raise IOError( "could not open '%s' for reading" ) + */ + __pyx_t_8 = PyBytes_AsString(__pyx_v_filename_in); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_fd_src = open(__pyx_t_8, __pyx_v_O_RDONLY); + + /* "ctabix.pyx":515 + * + * fd_src = open(filename_in, O_RDONLY) + * if fd_src == 0: # <<<<<<<<<<<<<< + * raise IOError( "could not open '%s' for reading" ) + * + */ + __pyx_t_6 = (__pyx_v_fd_src == 0); + if (__pyx_t_6) { + + /* "ctabix.pyx":516 + * fd_src = open(filename_in, O_RDONLY) + * if fd_src == 0: + * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<< + * + * buffer = malloc(WINDOW_SIZE) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "ctabix.pyx":518 + * raise IOError( "could not open '%s' for reading" ) + * + * buffer = malloc(WINDOW_SIZE) # <<<<<<<<<<<<<< + * + * while c > 0: + */ + __pyx_v_buffer = malloc(__pyx_v_WINDOW_SIZE); + + /* "ctabix.pyx":520 + * buffer = malloc(WINDOW_SIZE) + * + * while c > 0: # <<<<<<<<<<<<<< + * c = read(fd_src, buffer, WINDOW_SIZE) + * r = bgzf_write(fp, buffer, c) + */ + while (1) { + __pyx_t_6 = (__pyx_v_c > 0); + if (!__pyx_t_6) break; + + /* "ctabix.pyx":521 + * + * while c > 0: + * c = read(fd_src, buffer, WINDOW_SIZE) # <<<<<<<<<<<<<< + * r = bgzf_write(fp, buffer, c) + * if r < 0: + */ + __pyx_v_c = read(__pyx_v_fd_src, __pyx_v_buffer, __pyx_v_WINDOW_SIZE); + + /* "ctabix.pyx":522 + * while c > 0: + * c = read(fd_src, buffer, WINDOW_SIZE) + * r = bgzf_write(fp, buffer, c) # <<<<<<<<<<<<<< + * if r < 0: + * free( buffer ) + */ + __pyx_v_r = bgzf_write(__pyx_v_fp, __pyx_v_buffer, __pyx_v_c); + + /* "ctabix.pyx":523 + * c = read(fd_src, buffer, WINDOW_SIZE) + * r = bgzf_write(fp, buffer, c) + * if r < 0: # <<<<<<<<<<<<<< + * free( buffer ) + * raise OSError("writing failed") + */ + __pyx_t_6 = (__pyx_v_r < 0); + if (__pyx_t_6) { + + /* "ctabix.pyx":524 + * r = bgzf_write(fp, buffer, c) + * if r < 0: + * free( buffer ) # <<<<<<<<<<<<<< + * raise OSError("writing failed") + * + */ + free(__pyx_v_buffer); + + /* "ctabix.pyx":525 + * if r < 0: + * free( buffer ) + * raise OSError("writing failed") # <<<<<<<<<<<<<< + * + * free( buffer ) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + } + + /* "ctabix.pyx":527 + * raise OSError("writing failed") + * + * free( buffer ) # <<<<<<<<<<<<<< + * r = bgzf_close(fp) + * if r < 0: raise OSError("writing failed") + */ + free(__pyx_v_buffer); + + /* "ctabix.pyx":528 + * + * free( buffer ) + * r = bgzf_close(fp) # <<<<<<<<<<<<<< + * if r < 0: raise OSError("writing failed") + * + */ + __pyx_v_r = bgzf_close(__pyx_v_fp); + + /* "ctabix.pyx":529 + * free( buffer ) + * r = bgzf_close(fp) + * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<< + * + * def tabix_index( filename, + */ + __pyx_t_6 = (__pyx_v_r < 0); + if (__pyx_t_6) { + __pyx_t_4 = PyObject_Call(__pyx_builtin_OSError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("ctabix.tabix_compress"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "ctabix.pyx":531 + * if r < 0: raise OSError("writing failed") + * + * def tabix_index( filename, # <<<<<<<<<<<<<< + * force = False, + * seq_col = None, + */ + +static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6ctabix_1tabix_index[] = "tabix_index(filename, force=False, seq_col=None, start_col=None, end_col=None, preset=None, meta_char='#', zerobased=False)\n\n index tab-separated *filename* using tabix.\n\n An existing index will not be overwritten unless\n *force* is set.\n\n The index will be built from coordinates\n in columns *seq_col*, *start_col* and *end_col*.\n\n The contents of *filename* have to be sorted by \n contig and position - the method does not check\n if the file is sorted.\n\n Column indices are 0-based. Coordinates in the file\n are assumed to be 1-based.\n\n If *preset* is provided, the column coordinates\n are taken from a preset. Valid values for preset\n are \"gff\", \"bed\", \"sam\", \"vcf\", psltbl\", \"pileup\".\n \n Lines beginning with *meta_char* and the first\n *line_skip* lines will be skipped.\n \n If *filename* does not end in \".gz\", it will be automatically\n compressed. The original file will be removed and only the \n compressed file will be retained. \n\n If *filename* ends in *gz*, the file is assumed to be already\n compressed with bgzf.\n\n returns the filename of the compressed data\n "; +static PyMethodDef __pyx_mdef_6ctabix_1tabix_index = {__Pyx_NAMESTR("tabix_index"), (PyCFunction)__pyx_pf_6ctabix_1tabix_index, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_1tabix_index)}; +static PyObject *__pyx_pf_6ctabix_1tabix_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_v_force = 0; + PyObject *__pyx_v_seq_col = 0; + PyObject *__pyx_v_start_col = 0; + PyObject *__pyx_v_end_col = 0; + PyObject *__pyx_v_preset = 0; + PyObject *__pyx_v_meta_char = 0; + PyObject *__pyx_v_zerobased = 0; + PyObject *__pyx_v_preset2conf; + PyObject *__pyx_v_conf_data; + ti_conf_t __pyx_v_conf; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int32_t __pyx_t_11; + int32_t __pyx_t_12; + int32_t __pyx_t_13; + int32_t __pyx_t_14; + int32_t __pyx_t_15; + int32_t __pyx_t_16; + PyObject *__pyx_t_17 = NULL; + char *__pyx_t_18; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__force,&__pyx_n_s__seq_col,&__pyx_n_s__start_col,&__pyx_n_s__end_col,&__pyx_n_s__preset,&__pyx_n_s__meta_char,&__pyx_n_s__zerobased,0}; + __Pyx_RefNannySetupContext("tabix_index"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + values[1] = __pyx_k_28; + + /* "ctabix.pyx":533 + * def tabix_index( filename, + * force = False, + * seq_col = None, # <<<<<<<<<<<<<< + * start_col = None, + * end_col = None, + */ + values[2] = ((PyObject *)Py_None); + + /* "ctabix.pyx":534 + * force = False, + * seq_col = None, + * start_col = None, # <<<<<<<<<<<<<< + * end_col = None, + * preset = None, + */ + values[3] = ((PyObject *)Py_None); + + /* "ctabix.pyx":535 + * seq_col = None, + * start_col = None, + * end_col = None, # <<<<<<<<<<<<<< + * preset = None, + * meta_char = "#", + */ + values[4] = ((PyObject *)Py_None); + + /* "ctabix.pyx":536 + * start_col = None, + * end_col = None, + * preset = None, # <<<<<<<<<<<<<< + * meta_char = "#", + * zerobased = False, + */ + values[5] = ((PyObject *)Py_None); + values[6] = ((PyObject *)__pyx_kp_s_29); + values[7] = __pyx_k_30; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__force); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq_col); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_col); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_col); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preset); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__meta_char); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zerobased); + if (value) { values[7] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "tabix_index") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_filename = values[0]; + __pyx_v_force = values[1]; + __pyx_v_seq_col = values[2]; + __pyx_v_start_col = values[3]; + __pyx_v_end_col = values[4]; + __pyx_v_preset = values[5]; + __pyx_v_meta_char = values[6]; + __pyx_v_zerobased = values[7]; + } else { + __pyx_v_force = __pyx_k_28; + + /* "ctabix.pyx":533 + * def tabix_index( filename, + * force = False, + * seq_col = None, # <<<<<<<<<<<<<< + * start_col = None, + * end_col = None, + */ + __pyx_v_seq_col = ((PyObject *)Py_None); + + /* "ctabix.pyx":534 + * force = False, + * seq_col = None, + * start_col = None, # <<<<<<<<<<<<<< + * end_col = None, + * preset = None, + */ + __pyx_v_start_col = ((PyObject *)Py_None); + + /* "ctabix.pyx":535 + * seq_col = None, + * start_col = None, + * end_col = None, # <<<<<<<<<<<<<< + * preset = None, + * meta_char = "#", + */ + __pyx_v_end_col = ((PyObject *)Py_None); + + /* "ctabix.pyx":536 + * start_col = None, + * end_col = None, + * preset = None, # <<<<<<<<<<<<<< + * meta_char = "#", + * zerobased = False, + */ + __pyx_v_preset = ((PyObject *)Py_None); + __pyx_v_meta_char = ((PyObject *)__pyx_kp_s_29); + __pyx_v_zerobased = __pyx_k_30; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: __pyx_v_zerobased = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: __pyx_v_meta_char = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: __pyx_v_preset = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: __pyx_v_end_col = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_start_col = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_seq_col = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_force = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("tabix_index", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("ctabix.tabix_index"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_filename); + __Pyx_INCREF(__pyx_v_end_col); + __Pyx_INCREF(__pyx_v_preset); + __pyx_v_preset2conf = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_conf_data = Py_None; __Pyx_INCREF(Py_None); + + /* "ctabix.pyx":573 + * ''' + * + * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) # <<<<<<<<<<<<<< + * + * if not filename.endswith(".gz"): + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = (!__pyx_t_4); + if (__pyx_t_5) { + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "ctabix.pyx":575 + * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) + * + * if not filename.endswith(".gz"): # <<<<<<<<<<<<<< + * + * tabix_compress( filename, filename + ".gz", force = force ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_filename, __pyx_n_s__endswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_5); + if (__pyx_t_4) { + + /* "ctabix.pyx":577 + * if not filename.endswith(".gz"): + * + * tabix_compress( filename, filename + ".gz", force = force ) # <<<<<<<<<<<<<< + * os.unlink( filename ) + * filename += ".gz" + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__tabix_compress); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__force), __pyx_v_force) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "ctabix.pyx":578 + * + * tabix_compress( filename, filename + ".gz", force = force ) + * os.unlink( filename ) # <<<<<<<<<<<<<< + * filename += ".gz" + * + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__unlink); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":579 + * tabix_compress( filename, filename + ".gz", force = force ) + * os.unlink( filename ) + * filename += ".gz" # <<<<<<<<<<<<<< + * + * if not force and os.path.exists(filename + ".tbi" ): + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_filename, ((PyObject *)__pyx_kp_s_32)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_filename); + __pyx_v_filename = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "ctabix.pyx":581 + * filename += ".gz" + * + * if not force and os.path.exists(filename + ".tbi" ): # <<<<<<<<<<<<<< + * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) + * + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_force); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_4); + if (__pyx_t_5) { + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__path); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__exists); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_v_filename, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __pyx_t_4; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "ctabix.pyx":582 + * + * if not force and os.path.exists(filename + ".tbi" ): + * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<< + * + * # columns (1-based) + */ + __pyx_t_6 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "ctabix.pyx":587 + * # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning + * # 0 is a missing column + * preset2conf = { # <<<<<<<<<<<<<< + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + */ + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + + /* "ctabix.pyx":588 + * # 0 is a missing column + * preset2conf = { + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_4); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + __Pyx_INCREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__gff), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "ctabix.pyx":589 + * preset2conf = { + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_65536); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_65536); + __Pyx_GIVEREF(__pyx_int_65536); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__bed), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "ctabix.pyx":590 + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_65536); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_65536); + __Pyx_GIVEREF(__pyx_int_65536); + __Pyx_INCREF(__pyx_int_15); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_15); + __Pyx_GIVEREF(__pyx_int_15); + __Pyx_INCREF(__pyx_int_17); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_17); + __Pyx_GIVEREF(__pyx_int_17); + __Pyx_INCREF(__pyx_int_18); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_18); + __Pyx_GIVEREF(__pyx_int_18); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__psltbl), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "ctabix.pyx":591 + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_INCREF(__pyx_int_4); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_4); + __Pyx_GIVEREF(__pyx_int_4); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__sam), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "ctabix.pyx":592 + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), + * } + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__vcf), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "ctabix.pyx":593 + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_2); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_2); + __Pyx_GIVEREF(__pyx_int_2); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__pileup), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_preset2conf)); + __pyx_v_preset2conf = __pyx_t_6; + __pyx_t_6 = 0; + + /* "ctabix.pyx":596 + * } + * + * if preset: # <<<<<<<<<<<<<< + * try: + * conf_data = preset2conf[preset] + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_preset); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + + /* "ctabix.pyx":597 + * + * if preset: + * try: # <<<<<<<<<<<<<< + * conf_data = preset2conf[preset] + * except KeyError: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "ctabix.pyx":598 + * if preset: + * try: + * conf_data = preset2conf[preset] # <<<<<<<<<<<<<< + * except KeyError: + * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) + */ + __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_preset2conf), __pyx_v_preset); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_conf_data); + __pyx_v_conf_data = __pyx_t_6; + __pyx_t_6 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L17_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "ctabix.pyx":599 + * try: + * conf_data = preset2conf[preset] + * except KeyError: # <<<<<<<<<<<<<< + * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) + * else: + */ + __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_8) { + __Pyx_AddTraceback("ctabix.tabix_index"); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + + /* "ctabix.pyx":600 + * conf_data = preset2conf[preset] + * except KeyError: + * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) # <<<<<<<<<<<<<< + * else: + * if end_col == None: end_col = -1 + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_43), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(__pyx_v_preset2conf == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'keys'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + } + __pyx_t_9 = PyDict_Keys(__pyx_v_preset2conf); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_preset); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_preset); + __Pyx_GIVEREF(__pyx_v_preset); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L11_exception_handled; + } + __pyx_L12_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L17_try_end:; + } + goto __pyx_L9; + } + /*else*/ { + + /* "ctabix.pyx":602 + * raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) + * else: + * if end_col == None: end_col = -1 # <<<<<<<<<<<<<< + * preset = 0 + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end_col, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_DECREF(__pyx_v_end_col); + __pyx_v_end_col = __pyx_int_neg_1; + goto __pyx_L20; + } + __pyx_L20:; + + /* "ctabix.pyx":603 + * else: + * if end_col == None: end_col = -1 + * preset = 0 # <<<<<<<<<<<<<< + * + * # note that tabix internally works with 0-based coordinates and open/closed intervals. + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_preset); + __pyx_v_preset = __pyx_int_0; + + /* "ctabix.pyx":610 + * # -1 is subtracted from the start coordinate. To avoid doing this, set + * # the TI_FLAG_UCSC=0x10000 flag: + * if zerobased: preset = preset | 0x10000 # <<<<<<<<<<<<<< + * + * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0) + */ + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_zerobased); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_1 = PyNumber_Or(__pyx_v_preset, __pyx_int_65536); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_preset); + __pyx_v_preset = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L21; + } + __pyx_L21:; + + /* "ctabix.pyx":612 + * if zerobased: preset = preset | 0x10000 + * + * conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0) # <<<<<<<<<<<<<< + * + * cdef ti_conf_t conf + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_seq_col, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_v_start_col, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Add(__pyx_v_end_col, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_meta_char); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_meta_char); + __Pyx_GIVEREF(__pyx_v_meta_char); + __pyx_t_10 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_preset); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_preset); + __Pyx_GIVEREF(__pyx_v_preset); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_conf_data); + __pyx_v_conf_data = ((PyObject *)__pyx_t_9); + __pyx_t_9 = 0; + } + __pyx_L9:; + + /* "ctabix.pyx":615 + * + * cdef ti_conf_t conf + * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data # <<<<<<<<<<<<<< + * + * ti_index_build( filename, &conf) + */ + if (PyTuple_CheckExact(__pyx_v_conf_data) && likely(PyTuple_GET_SIZE(__pyx_v_conf_data) == 6)) { + PyObject* tuple = __pyx_v_conf_data; + __pyx_t_9 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10); + __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_6); + __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_1); + __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 5); __Pyx_INCREF(__pyx_t_2); + __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_conf.preset = __pyx_t_11; + __pyx_v_conf.sc = __pyx_t_12; + __pyx_v_conf.bc = __pyx_t_13; + __pyx_v_conf.ec = __pyx_t_14; + __pyx_v_conf.meta_char = __pyx_t_15; + __pyx_v_conf.line_skip = __pyx_t_16; + } else { + __pyx_t_17 = PyObject_GetIter(__pyx_v_conf_data); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_17, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_16 = __Pyx_PyInt_from_py_int32_t(__pyx_t_9); if (unlikely((__pyx_t_16 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_17, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_PyInt_from_py_int32_t(__pyx_t_10); if (unlikely((__pyx_t_15 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_17, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_14 = __Pyx_PyInt_from_py_int32_t(__pyx_t_6); if (unlikely((__pyx_t_14 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_17, 3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyInt_from_py_int32_t(__pyx_t_3); if (unlikely((__pyx_t_13 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_17, 4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyInt_from_py_int32_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_17, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyInt_from_py_int32_t(__pyx_t_2); if (unlikely((__pyx_t_11 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_EndUnpack(__pyx_t_17, 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_v_conf.preset = __pyx_t_16; + __pyx_v_conf.sc = __pyx_t_15; + __pyx_v_conf.bc = __pyx_t_14; + __pyx_v_conf.ec = __pyx_t_13; + __pyx_v_conf.meta_char = __pyx_t_12; + __pyx_v_conf.line_skip = __pyx_t_11; + } + + /* "ctabix.pyx":617 + * conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data + * + * ti_index_build( filename, &conf) # <<<<<<<<<<<<<< + * + * return filename + */ + __pyx_t_18 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ti_index_build(__pyx_t_18, (&__pyx_v_conf)); + + /* "ctabix.pyx":619 + * ti_index_build( filename, &conf) + * + * return filename # <<<<<<<<<<<<<< + * + * __all__ = ["tabix_index", + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_filename); + __pyx_r = __pyx_v_filename; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_AddTraceback("ctabix.tabix_index"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_preset2conf); + __Pyx_DECREF(__pyx_v_conf_data); + __Pyx_DECREF(__pyx_v_filename); + __Pyx_DECREF(__pyx_v_end_col); + __Pyx_DECREF(__pyx_v_preset); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_6ctabix_Tabixfile(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_6ctabix_9Tabixfile___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6ctabix_Tabixfile(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_6ctabix_9Tabixfile_6__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyObject *__pyx_getprop_6ctabix_9Tabixfile_filename(PyObject *o, void *x) { + return __pyx_pf_6ctabix_9Tabixfile_8filename___get__(o); +} + +static PyObject *__pyx_getprop_6ctabix_9Tabixfile_header(PyObject *o, void *x) { + return __pyx_pf_6ctabix_9Tabixfile_6header___get__(o); +} + +static PyObject *__pyx_getprop_6ctabix_9Tabixfile_contigs(PyObject *o, void *x) { + return __pyx_pf_6ctabix_9Tabixfile_7contigs___get__(o); +} + +static PyMethodDef __pyx_methods_6ctabix_Tabixfile[] = { + {__Pyx_NAMESTR("_isOpen"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_1_isOpen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_1_isOpen)}, + {__Pyx_NAMESTR("_open"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_2_open, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_2_open)}, + {__Pyx_NAMESTR("_parseRegion"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_3_parseRegion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_3_parseRegion)}, + {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_4fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_4fetch)}, + {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_6ctabix_9Tabixfile_5close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_6ctabix_9Tabixfile_5close)}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_6ctabix_Tabixfile[] = { + {(char *)"filename", __pyx_getprop_6ctabix_9Tabixfile_filename, 0, __Pyx_DOCSTR(__pyx_k_44), 0}, + {(char *)"header", __pyx_getprop_6ctabix_9Tabixfile_header, 0, __Pyx_DOCSTR(__pyx_k_45), 0}, + {(char *)"contigs", __pyx_getprop_6ctabix_9Tabixfile_contigs, 0, __Pyx_DOCSTR(__pyx_k_46), 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Tabixfile = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Tabixfile = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Tabixfile = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Tabixfile = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_Tabixfile = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.Tabixfile"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_Tabixfile), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Tabixfile, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Tabixfile, /*tp_as_number*/ + &__pyx_tp_as_sequence_Tabixfile, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Tabixfile, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Tabixfile, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("*(filename, mode='r')*\n\n opens a :term:`tabix file` for reading. A missing\n index (*filename* + \".tbi\") will raise an exception.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_Tabixfile, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_6ctabix_Tabixfile, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_Tabixfile, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_Parser(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + return o; +} + +static void __pyx_tp_dealloc_6ctabix_Parser(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6ctabix_Parser[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Parser = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Parser = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Parser = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Parser = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_Parser = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.Parser"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_Parser), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Parser, /*tp_as_number*/ + &__pyx_tp_as_sequence_Parser, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Parser, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Parser, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_Parser, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_Parser, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_6ctabix_13TabixIterator___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6ctabix_TabixIterator(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_6ctabix_13TabixIterator_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6ctabix_TabixIterator[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_13TabixIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_13TabixIterator_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_TabixIterator = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_TabixIterator = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_TabixIterator = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_TabixIterator = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_TabixIterator = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.TabixIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_TabixIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_TabixIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_TabixIterator, /*tp_as_number*/ + &__pyx_tp_as_sequence_TabixIterator, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_TabixIterator, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_TabixIterator, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("iterates over rows in *tabixfile* in region\n given by *tid*, *start* and *end*.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_6ctabix_13TabixIterator_1__iter__, /*tp_iter*/ + __pyx_pf_6ctabix_13TabixIterator_2__next__, /*tp_iternext*/ + __pyx_methods_6ctabix_TabixIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_TabixIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_TabixHeaderIterator(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + if (__pyx_pf_6ctabix_19TabixHeaderIterator___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6ctabix_TabixHeaderIterator(PyObject *o) { + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_6ctabix_19TabixHeaderIterator_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_6ctabix_TabixHeaderIterator[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixHeaderIterator_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_TabixHeaderIterator = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_TabixHeaderIterator = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_TabixHeaderIterator = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_TabixHeaderIterator = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_TabixHeaderIterator = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.TabixHeaderIterator"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_TabixHeaderIterator), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_TabixHeaderIterator, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_TabixHeaderIterator, /*tp_as_number*/ + &__pyx_tp_as_sequence_TabixHeaderIterator, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_TabixHeaderIterator, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_TabixHeaderIterator, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("return header lines.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_6ctabix_19TabixHeaderIterator_1__iter__, /*tp_iter*/ + __pyx_pf_6ctabix_19TabixHeaderIterator_2__next__, /*tp_iternext*/ + __pyx_methods_6ctabix_TabixHeaderIterator, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_TabixHeaderIterator, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_asTuple(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k); + if (!o) return 0; + return o; +} + +static PyMethodDef __pyx_methods_6ctabix_asTuple[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_asTuple = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_asTuple = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_asTuple = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_asTuple = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_asTuple = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.asTuple"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_asTuple), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_asTuple, /*tp_as_number*/ + &__pyx_tp_as_sequence_asTuple, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_asTuple, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_6ctabix_7asTuple___call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_asTuple, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("converts a :term:`tabix row` into a python tuple.\n\n Access is by numeric index.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_asTuple, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_asTuple, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_asGTF(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k); + if (!o) return 0; + return o; +} + +static PyMethodDef __pyx_methods_6ctabix_asGTF[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_asGTF = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_asGTF = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_asGTF = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_asGTF = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_asGTF = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.asGTF"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_asGTF), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_asGTF, /*tp_as_number*/ + &__pyx_tp_as_sequence_asGTF, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_asGTF, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_6ctabix_5asGTF___call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_asGTF, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("converts a :term:`tabix row` into a GTF record with the following \n fields:\n\n contig\n contig\n feature\n feature\n source\n source\n start\n genomic start coordinate (0-based)\n end\n genomic end coordinate plus one (0-based)\n score\n feature score\n strand\n strand\n frame\n frame\n attributes\n attribute string.\n\n GTF formatted entries also defined the attributes:\n\n gene_id\n the gene identifier\n transcript_ind\n the transcript identifier\n \n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_asGTF, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_asGTF, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_asBed(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k); + if (!o) return 0; + return o; +} + +static PyMethodDef __pyx_methods_6ctabix_asBed[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_asBed = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_asBed = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_asBed = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_asBed = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_asBed = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.asBed"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_asBed), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_asBed, /*tp_as_number*/ + &__pyx_tp_as_sequence_asBed, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_asBed, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_6ctabix_5asBed___call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_asBed, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("converts a :term:`tabix row` into a bed record\n with the following fields:\n\n contig\n contig\n start\n genomic start coordinate (zero-based)\n end\n genomic end coordinate plus one (zero-based)\n name\n name of feature.\n score\n score of feature\n strand\n strand of feature\n thickStart\n thickStart\n thickEnd\n thickEnd\n itemRGB\n itemRGB\n blockCount\n number of bocks\n blockSizes\n ',' separated string of block sizes\n blockStarts\n ',' separated string of block genomic start positions\n\n Only the first three fields are required. Additional\n fields are optional, but if one is defined, all the preceeding\n need to be defined as well.\n\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_asBed, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_asBed, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_asVCF(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_6ctabix_Parser(t, a, k); + if (!o) return 0; + return o; +} + +static PyMethodDef __pyx_methods_6ctabix_asVCF[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_asVCF = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_asVCF = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_asVCF = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_asVCF = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_asVCF = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.asVCF"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_asVCF), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_Parser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_asVCF, /*tp_as_number*/ + &__pyx_tp_as_sequence_asVCF, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_asVCF, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_6ctabix_5asVCF___call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_asVCF, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record with\n the following fields:\n \n contig\n contig\n pos\n chromosomal position, zero-based\n id \n id\n ref\n reference\n alt\n alt\n qual\n qual\n filter\n filter\n info\n info\n format\n format specifier.\n\n Access to genotypes is via index::\n\n contig = vcf.contig\n first_sample_genotype = vcf[0]\n second_sample_genotype = vcf[1]\n\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6ctabix_asVCF, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_asVCF, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_6ctabix_TabixIteratorParsed(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6ctabix_TabixIteratorParsed *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_6ctabix_TabixIteratorParsed *)o); + p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None); + if (__pyx_pf_6ctabix_19TabixIteratorParsed___cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6ctabix_TabixIteratorParsed(PyObject *o) { + struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_6ctabix_19TabixIteratorParsed_3__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(((PyObject *)p->parser)); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6ctabix_TabixIteratorParsed(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o; + if (p->parser) { + e = (*v)(((PyObject*)p->parser), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6ctabix_TabixIteratorParsed(PyObject *o) { + struct __pyx_obj_6ctabix_TabixIteratorParsed *p = (struct __pyx_obj_6ctabix_TabixIteratorParsed *)o; + PyObject* tmp; + tmp = ((PyObject*)p->parser); + p->parser = ((struct __pyx_obj_6ctabix_Parser *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6ctabix_TabixIteratorParsed[] = { + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_6ctabix_19TabixIteratorParsed_2__next__)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_TabixIteratorParsed = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_TabixIteratorParsed = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_TabixIteratorParsed = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_TabixIteratorParsed = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6ctabix_TabixIteratorParsed = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("ctabix.TabixIteratorParsed"), /*tp_name*/ + sizeof(struct __pyx_obj_6ctabix_TabixIteratorParsed), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6ctabix_TabixIteratorParsed, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_TabixIteratorParsed, /*tp_as_number*/ + &__pyx_tp_as_sequence_TabixIteratorParsed, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_TabixIteratorParsed, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_TabixIteratorParsed, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("iterates over mapped reads in a region.\n\n Returns parsed data.\n "), /*tp_doc*/ + __pyx_tp_traverse_6ctabix_TabixIteratorParsed, /*tp_traverse*/ + __pyx_tp_clear_6ctabix_TabixIteratorParsed, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_6ctabix_19TabixIteratorParsed_1__iter__, /*tp_iter*/ + __pyx_pf_6ctabix_19TabixIteratorParsed_2__next__, /*tp_iternext*/ + __pyx_methods_6ctabix_TabixIteratorParsed, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6ctabix_TabixIteratorParsed, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("ctabix"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, + {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0}, + {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, + {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, + {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, + {&__pyx_n_s__OSError, __pyx_k__OSError, sizeof(__pyx_k__OSError), 0, 0, 1, 1}, + {&__pyx_n_s__O_RDONLY, __pyx_k__O_RDONLY, sizeof(__pyx_k__O_RDONLY), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s__Tabixfile, __pyx_k__Tabixfile, sizeof(__pyx_k__Tabixfile), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___filename, __pyx_k___filename, sizeof(__pyx_k___filename), 0, 0, 1, 1}, + {&__pyx_n_s___isOpen, __pyx_k___isOpen, sizeof(__pyx_k___isOpen), 0, 0, 1, 1}, + {&__pyx_n_s___open, __pyx_k___open, sizeof(__pyx_k___open), 0, 0, 1, 1}, + {&__pyx_n_s___parseRegion, __pyx_k___parseRegion, sizeof(__pyx_k___parseRegion), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__asBed, __pyx_k__asBed, sizeof(__pyx_k__asBed), 0, 0, 1, 1}, + {&__pyx_n_s__asGTF, __pyx_k__asGTF, sizeof(__pyx_k__asGTF), 0, 0, 1, 1}, + {&__pyx_n_s__asTuple, __pyx_k__asTuple, sizeof(__pyx_k__asTuple), 0, 0, 1, 1}, + {&__pyx_n_s__asVCF, __pyx_k__asVCF, sizeof(__pyx_k__asVCF), 0, 0, 1, 1}, + {&__pyx_n_s__bc, __pyx_k__bc, sizeof(__pyx_k__bc), 0, 0, 1, 1}, + {&__pyx_n_s__bed, __pyx_k__bed, sizeof(__pyx_k__bed), 0, 0, 1, 1}, + {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__ctabix, __pyx_k__ctabix, sizeof(__pyx_k__ctabix), 0, 0, 1, 1}, + {&__pyx_n_s__ctypes, __pyx_k__ctypes, sizeof(__pyx_k__ctypes), 0, 0, 1, 1}, + {&__pyx_n_s__ec, __pyx_k__ec, sizeof(__pyx_k__ec), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__end_col, __pyx_k__end_col, sizeof(__pyx_k__end_col), 0, 0, 1, 1}, + {&__pyx_n_s__endswith, __pyx_k__endswith, sizeof(__pyx_k__endswith), 0, 0, 1, 1}, + {&__pyx_n_s__exists, __pyx_k__exists, sizeof(__pyx_k__exists), 0, 0, 1, 1}, + {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, + {&__pyx_n_s__filename_in, __pyx_k__filename_in, sizeof(__pyx_k__filename_in), 0, 0, 1, 1}, + {&__pyx_n_s__filename_out, __pyx_k__filename_out, sizeof(__pyx_k__filename_out), 0, 0, 1, 1}, + {&__pyx_n_s__force, __pyx_k__force, sizeof(__pyx_k__force), 0, 0, 1, 1}, + {&__pyx_n_s__fp, __pyx_k__fp, sizeof(__pyx_k__fp), 0, 0, 1, 1}, + {&__pyx_n_s__gff, __pyx_k__gff, sizeof(__pyx_k__gff), 0, 0, 1, 1}, + {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1}, + {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, + {&__pyx_n_s__iterator, __pyx_k__iterator, sizeof(__pyx_k__iterator), 0, 0, 1, 1}, + {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1}, + {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1}, + {&__pyx_n_s__line_skip, __pyx_k__line_skip, sizeof(__pyx_k__line_skip), 0, 0, 1, 1}, + {&__pyx_n_s__meta_char, __pyx_k__meta_char, sizeof(__pyx_k__meta_char), 0, 0, 1, 1}, + {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, + {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1}, + {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1}, + {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1}, + {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1}, + {&__pyx_n_s__pileup, __pyx_k__pileup, sizeof(__pyx_k__pileup), 0, 0, 1, 1}, + {&__pyx_n_s__preset, __pyx_k__preset, sizeof(__pyx_k__preset), 0, 0, 1, 1}, + {&__pyx_n_s__psltbl, __pyx_k__psltbl, sizeof(__pyx_k__psltbl), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, + {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1}, + {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1}, + {&__pyx_n_s__sam, __pyx_k__sam, sizeof(__pyx_k__sam), 0, 0, 1, 1}, + {&__pyx_n_s__sc, __pyx_k__sc, sizeof(__pyx_k__sc), 0, 0, 1, 1}, + {&__pyx_n_s__seq_col, __pyx_k__seq_col, sizeof(__pyx_k__seq_col), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__start_col, __pyx_k__start_col, sizeof(__pyx_k__start_col), 0, 0, 1, 1}, + {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__tabix_compress, __pyx_k__tabix_compress, sizeof(__pyx_k__tabix_compress), 0, 0, 1, 1}, + {&__pyx_n_s__tabix_index, __pyx_k__tabix_index, sizeof(__pyx_k__tabix_index), 0, 0, 1, 1}, + {&__pyx_n_s__tabixfile, __pyx_k__tabixfile, sizeof(__pyx_k__tabixfile), 0, 0, 1, 1}, + {&__pyx_n_s__tempfile, __pyx_k__tempfile, sizeof(__pyx_k__tempfile), 0, 0, 1, 1}, + {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1}, + {&__pyx_n_s__types, __pyx_k__types, sizeof(__pyx_k__types), 0, 0, 1, 1}, + {&__pyx_n_s__unlink, __pyx_k__unlink, sizeof(__pyx_k__unlink), 0, 0, 1, 1}, + {&__pyx_n_s__vcf, __pyx_k__vcf, sizeof(__pyx_k__vcf), 0, 0, 1, 1}, + {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, + {&__pyx_n_s__zerobased, __pyx_k__zerobased, sizeof(__pyx_k__zerobased), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_OSError = __Pyx_GetName(__pyx_b, __pyx_n_s__OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "ctabix.pyx":126 + * + * if not self._isOpen(): + * raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * + * region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "ctabix.pyx":149 + * '''filename associated with this object.''' + * def __get__(self): + * if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) # <<<<<<<<<<<<<< + * return self._filename + * + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "ctabix.pyx":219 + * + * if self.iterator == NULL: + * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "ctabix.pyx":266 + * + * if self.iterator == NULL: + * raise ValueError("can't open header.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "ctabix.pyx":461 + * + * if self.iterator == NULL: + * raise ValueError("malformatted query or wrong sequence name.\n") # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "ctabix.pyx":512 + * fp = bgzf_open( filename_out, "w") + * if fp == NULL: + * raise IOError( "could not open '%s' for writing" ) # <<<<<<<<<<<<<< + * + * fd_src = open(filename_in, O_RDONLY) + */ + __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_21)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + + /* "ctabix.pyx":516 + * fd_src = open(filename_in, O_RDONLY) + * if fd_src == 0: + * raise IOError( "could not open '%s' for reading" ) # <<<<<<<<<<<<<< + * + * buffer = malloc(WINDOW_SIZE) + */ + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "ctabix.pyx":525 + * if r < 0: + * free( buffer ) + * raise OSError("writing failed") # <<<<<<<<<<<<<< + * + * free( buffer ) + */ + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "ctabix.pyx":529 + * free( buffer ) + * r = bgzf_close(fp) + * if r < 0: raise OSError("writing failed") # <<<<<<<<<<<<<< + * + * def tabix_index( filename, + */ + __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_s_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + + /* "ctabix.pyx":575 + * if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) + * + * if not filename.endswith(".gz"): # <<<<<<<<<<<<<< + * + * tabix_compress( filename, filename + ".gz", force = force ) + */ + __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_32)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + + /* "ctabix.pyx":582 + * + * if not force and os.path.exists(filename + ".tbi" ): + * raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) # <<<<<<<<<<<<<< + * + * # columns (1-based) + */ + __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_34)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + + /* "ctabix.pyx":588 + * # 0 is a missing column + * preset2conf = { + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + */ + __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + + /* "ctabix.pyx":589 + * preset2conf = { + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + */ + __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + + /* "ctabix.pyx":590 + * 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + */ + __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); + + /* "ctabix.pyx":591 + * 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), + */ + __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + + /* "ctabix.pyx":592 + * 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), + * } + */ + __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + + /* "ctabix.pyx":593 + * 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + * 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + * 'pileup': (3, 1, 2, 0, ord('#'), 0 ), # <<<<<<<<<<<<<< + * } + * + */ + __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initctabix(void); /*proto*/ +PyMODINIT_FUNC initctabix(void) +#else +PyMODINIT_FUNC PyInit_ctabix(void); /*proto*/ +PyMODINIT_FUNC PyInit_ctabix(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ctabix(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ctabix"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_ctabix) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Tabixfile", (PyObject *)&__pyx_type_6ctabix_Tabixfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_Tabixfile = &__pyx_type_6ctabix_Tabixfile; + if (PyType_Ready(&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Parser", (PyObject *)&__pyx_type_6ctabix_Parser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_Parser = &__pyx_type_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_6ctabix_13TabixIterator_2__next__.doc = __pyx_doc_6ctabix_13TabixIterator_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_13TabixIterator_2__next__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "TabixIterator", (PyObject *)&__pyx_type_6ctabix_TabixIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_TabixIterator = &__pyx_type_6ctabix_TabixIterator; + if (PyType_Ready(&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__.doc = __pyx_doc_6ctabix_19TabixHeaderIterator_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixHeaderIterator_2__next__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "TabixHeaderIterator", (PyObject *)&__pyx_type_6ctabix_TabixHeaderIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_TabixHeaderIterator = &__pyx_type_6ctabix_TabixHeaderIterator; + __pyx_type_6ctabix_asTuple.tp_base = __pyx_ptype_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "asTuple", (PyObject *)&__pyx_type_6ctabix_asTuple) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_asTuple = &__pyx_type_6ctabix_asTuple; + __pyx_type_6ctabix_asGTF.tp_base = __pyx_ptype_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "asGTF", (PyObject *)&__pyx_type_6ctabix_asGTF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_asGTF = &__pyx_type_6ctabix_asGTF; + __pyx_type_6ctabix_asBed.tp_base = __pyx_ptype_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "asBed", (PyObject *)&__pyx_type_6ctabix_asBed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_asBed = &__pyx_type_6ctabix_asBed; + __pyx_type_6ctabix_asVCF.tp_base = __pyx_ptype_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "asVCF", (PyObject *)&__pyx_type_6ctabix_asVCF) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_asVCF = &__pyx_type_6ctabix_asVCF; + if (PyType_Ready(&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + { + PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed, "__next__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__.doc = __pyx_doc_6ctabix_19TabixIteratorParsed_2__next__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6ctabix_19TabixIteratorParsed_2__next__; + } + } + if (__Pyx_SetAttrString(__pyx_m, "TabixIteratorParsed", (PyObject *)&__pyx_type_6ctabix_TabixIteratorParsed) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6ctabix_TabixIteratorParsed = &__pyx_type_6ctabix_TabixIteratorParsed; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "ctabix.pyx":4 + * # adds doc-strings for sphinx + * + * import tempfile, os, sys, types, itertools, struct, ctypes, gzip # <<<<<<<<<<<<<< + * from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING + * cimport TabProxies + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__tempfile), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tempfile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__types), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__types, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__ctypes), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ctypes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":488 + * def tabix_compress( filename_in, + * filename_out, + * force = False ): # <<<<<<<<<<<<<< + * + * ''' + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_19 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":486 + * ti_iter_destroy(self.iterator) + * + * def tabix_compress( filename_in, # <<<<<<<<<<<<<< + * filename_out, + * force = False ): + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_tabix_compress, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_compress, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":532 + * + * def tabix_index( filename, + * force = False, # <<<<<<<<<<<<<< + * seq_col = None, + * start_col = None, + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_28 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":538 + * preset = None, + * meta_char = "#", + * zerobased = False, # <<<<<<<<<<<<<< + * ): + * ''' + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_30 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "ctabix.pyx":531 + * if r < 0: raise OSError("writing failed") + * + * def tabix_index( filename, # <<<<<<<<<<<<<< + * force = False, + * seq_col = None, + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6ctabix_1tabix_index, NULL, __pyx_n_s__ctabix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tabix_index, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "ctabix.pyx":621 + * return filename + * + * __all__ = ["tabix_index", # <<<<<<<<<<<<<< + * "tabix_compress", + * "Tabixfile", + */ + __pyx_t_1 = PyList_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_index)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__tabix_index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tabix_compress)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__tabix_compress)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tabix_compress)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Tabixfile)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__Tabixfile)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Tabixfile)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__asTuple)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__asTuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asTuple)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__asGTF)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__asGTF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asGTF)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__asVCF)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__asVCF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asVCF)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__asBed)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__asBed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asBed)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "ctabix.pyx":1 + * # cython: embedsignature=True # <<<<<<<<<<<<<< + * # adds doc-strings for sphinx + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cpython/type.pxd":2 + * + * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * # The C structure of the objects used to describe built-in types. + * + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init ctabix"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init ctabix"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) + #endif + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(&local_type, &local_value, &local_tb); + if (unlikely(tstate->curexc_type)) + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + *type = local_type; + *value = local_value; + *tb = local_tb; + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) { + const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(int32_t) == sizeof(char)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (int32_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(int32_t) == sizeof(short)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (int32_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(int32_t) == sizeof(int)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (int32_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(int32_t) == sizeof(long)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (int32_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (int32_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (int32_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + int32_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (int32_t)-1; + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pxd b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pxd new file mode 100755 index 0000000..7e15c43 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pxd @@ -0,0 +1,179 @@ + +cdef extern from "string.h": + ctypedef int size_t + void *memcpy(void *dst,void *src,size_t len) + void *memmove(void *dst,void *src,size_t len) + void *memset(void *b,int c,size_t len) + char *strtok_r(char *str, char *delim, char **saveptr) + char *strncpy(char *dest, char *src, size_t n) + void *memchr(void *s, int c, size_t n) + +cdef extern from "stdlib.h": + void free(void *) + void *malloc(size_t) + void *calloc(size_t,size_t) + void *realloc(void *,size_t) + void qsort(void *base, size_t nmemb, size_t size, + int (*compar)(void *,void *)) + int c_abs "abs" (int) + int atoi( char *nptr) + long atol( char *nptr) + double atof( char *nptr) + +cdef extern from "stdio.h": + ctypedef struct FILE: + pass + FILE *fopen(char *,char *) + FILE *freopen(char *path, char *mode, FILE *stream) + int fileno(FILE *stream) + int dup2(int oldfd, int newfd) + int fflush(FILE *stream) + + FILE * stderr + FILE * stdout + int fclose(FILE *) + int sscanf(char *str,char *fmt,...) + int printf(char *str,char *fmt,...) + int sprintf(char *str,char *fmt,...) + int fprintf(FILE *ifile,char *fmt,...) + char *fgets(char *str,int size,FILE *ifile) + +cdef extern from "ctype.h": + int toupper(int c) + int tolower(int c) + +cdef extern from "sys/types.h": + pass + +cdef extern from "sys/stat.h": + pass + +cdef extern from "fcntl.h": + int open(char *pathname, int flags) + +cdef extern from "unistd.h": + ctypedef int ssize_t + char *ttyname(int fd) + int isatty(int fd) + ssize_t read(int fd, void *buf, size_t count) + +cdef extern from "string.h": + int strcmp(char *s1, char *s2) + int strncmp(char *s1,char *s2,size_t len) + char *strcpy(char *dest,char *src) + char *strncpy(char *dest,char *src, size_t len) + char *strdup(char *) + char *strcat(char *,char *) + size_t strlen(char *s) + int memcmp( void * s1, void *s2, size_t len ) + +cdef extern from "stdint.h": + ctypedef int int64_t + ctypedef int int32_t + ctypedef int uint32_t + ctypedef int uint8_t + ctypedef int uint64_t + +cdef extern from "Python.h": + ctypedef struct FILE + FILE* PyFile_AsFile(object) + char *fgets(char *str, int size, FILE *ifile) + int feof(FILE *stream) + size_t strlen(char *s) + size_t getline(char **lineptr, size_t *n, FILE *stream) + char *strstr(char *, char *) + char *strchr(char *string, int c) + int fileno(FILE *stream) + +cdef extern from "bgzf.h": + + ctypedef struct BGZF: + pass + + int64_t bgzf_seek(BGZF* fp, int64_t pos, int where) + + BGZF * bgzf_open(char * path, char * mode) + + int bgzf_write(BGZF * fp, void* data, int length) + + int bgzf_close(BGZF* fp) + +# tabix support +cdef extern from "tabix.h": + + ctypedef struct ti_conf_t: + int32_t preset + int32_t sc, bc, ec + int32_t meta_char, line_skip + + ctypedef struct ti_index_t: + pass + + ctypedef struct tabix_t: + BGZF *fp + ti_index_t *idx + char *fn + char *fnidx + + ctypedef struct ti_iter_t: + pass + + tabix_t *ti_open(char *fn, char *fnidx) + + int ti_lazy_index_load(tabix_t *t) + + void ti_close(tabix_t *t) + + ti_iter_t ti_query(tabix_t *t, char *name, int beg, int end) + ti_iter_t ti_queryi(tabix_t *t, int tid, int beg, int end) + ti_iter_t ti_querys(tabix_t *t, char *reg) + char * ti_read(tabix_t *t, ti_iter_t iter, int *len) + + # Get the list of sequence names. Each "char*" pointer points to a + # internal member of the index, so DO NOT modify the returned + # pointer; otherwise the index will be corrupted. The returned + # pointer should be freed by a single free() call by the routine + # calling this function. The number of sequences is returned at *n + char **ti_seqname(ti_index_t *idx, int *n) + + # Destroy the iterator + void ti_iter_destroy(ti_iter_t iter) + + # Build the index for file . File .tbi will be generated + # and overwrite the file of the same name. Return -1 on failure. */ + int ti_index_build(char *fn, ti_conf_t *conf) + + #/* Load the index from file .tbi. If is a URL and the index + # * file is not in the working directory, .tbi will be + # * downloaded. Return NULL on failure. */ + ti_index_t *ti_index_load( char *fn) + + ti_index_t *ti_index_load_local(char *fnidx) + + #/* Destroy the index */ + void ti_index_destroy(ti_index_t *idx) + + #/* Parse a region like: chr2, chr2:100, chr2:100-200. Return -1 on failure. */ + int ti_parse_region( ti_index_t *idx, char *str, int *tid, int *begin, int *end) + + int ti_get_tid( ti_index_t *idx, char *name) + + # /* Get the iterator pointing to the first record at the current file + # * position. If the file is just openned, the iterator points to the + # * first record in the file. */ + ti_iter_t ti_iter_first() + + # /* Get the iterator pointing to the first record in region tid:beg-end */ + ti_iter_t ti_iter_query( ti_index_t *idx, int tid, int beg, int end) + + # /* Get the data line pointed by the iterator and iterate to the next record. */ + # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len) + +cdef class Tabixfile: + cdef char * _filename + + # pointer to tabixfile + cdef tabix_t * tabixfile + +cdef class Parser: + pass diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pyx b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pyx new file mode 100755 index 0000000..a31f3f2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/ctabix.pyx @@ -0,0 +1,628 @@ +# cython: embedsignature=True +# adds doc-strings for sphinx + +import tempfile, os, sys, types, itertools, struct, ctypes, gzip +from cpython cimport PyString_FromStringAndSize, PyString_AS_STRING +cimport TabProxies + +cdef class Tabixfile: + '''*(filename, mode='r')* + + opens a :term:`tabix file` for reading. A missing + index (*filename* + ".tbi") will raise an exception. + ''' + + def __cinit__(self, *args, **kwargs ): + self.tabixfile = NULL + self._open( *args, **kwargs ) + + def _isOpen( self ): + '''return true if samfile has been opened.''' + return self.tabixfile != NULL + + def _open( self, + char * filename, + mode ='r', + ): + '''open a :term:`tabix file` for reading. + ''' + + assert mode in ( "r",), "invalid file opening mode `%s`" % mode + + # close a previously opened file + if self.tabixfile != NULL: self.close() + self.tabixfile = NULL + + if self._filename != NULL: free(self._filename ) + self._filename = strdup( filename ) + + filename_index = filename + ".tbi" + + if mode[0] == 'w': + # open file for writing + pass + + elif mode[0] == "r": + # open file for reading + if not os.path.exists( self._filename ): + raise IOError( "file `%s` not found" % self._filename) + + if not os.path.exists( filename_index ): + raise IOError( "index `%s` not found" % filename_index) + + # open file and load index + self.tabixfile = ti_open( self._filename, filename_index ) + + if self.tabixfile == NULL: + raise IOError("could not open file `%s`" % filename ) + + def _parseRegion( self, + reference = None, + start = None, + end = None, + region = None ): + '''parse region information. + + raise ValueError for for invalid regions. + + returns a tuple of region, tid, start and end. Region + is a valid samtools :term:`region` or None if the region + extends over the whole file. + + Note that regions are 1-based, while start,end are python coordinates. + ''' + ti_lazy_index_load( self.tabixfile ) + + cdef int rtid + cdef int rstart + cdef int rend + cdef int max_pos + max_pos = 2 << 29 + + rtid = rstart = rend = 0 + + # translate to a region + if reference: + if start != None and end != None: + region = "%s:%i-%i" % (reference, start+1, end) + elif start == None and end != None: + region = "%s:%i-%i" % (reference, 1, end) + elif end == None and start != None: + region = "%s:%i-%i" % (reference, start+1, max_pos-1) + else: + region = reference + + if region: + ti_parse_region( self.tabixfile.idx, region, &rtid, &rstart, &rend) + if rtid < 0: raise ValueError( "invalid region `%s`" % region ) + if rstart > rend: raise ValueError( 'invalid region: start (%i) > end (%i)' % (rstart, rend) ) + if not 0 <= rstart < max_pos: raise ValueError( 'start out of range (%i)' % rstart ) + if not 0 <= rend < max_pos: raise ValueError( 'end out of range (%i)' % rend ) + + return region, rtid, rstart, rend + + def fetch( self, + reference = None, + start = None, + end = None, + region = None, + parser = None ): + ''' + + fetch one or more rows in a :term:`region` using 0-based indexing. The region is specified by + :term:`reference`, *start* and *end*. Alternatively, a samtools :term:`region` string can be supplied. + + Without *reference* or *region* all entries will be fetched. + + If only *reference* is set, all reads matching on *reference* will be fetched. + + If *parser* is None, the results are returned as an unparsed string. + Otherwise, *parser* is assumed to be a functor that will return parsed + data (see for example :meth:`asTuple` and :meth:`asGTF`). + ''' + ti_lazy_index_load( self.tabixfile ) + + if not self._isOpen(): + raise ValueError( "I/O operation on closed file" ) + + region, rtid, rstart, rend = self._parseRegion( reference, start, end, region ) + + if parser == None: + if region: + return TabixIterator( self, rtid, rstart, rend ) + else: + return TabixIterator( self, -1, 0, 0 ) + else: + if region: + return TabixIteratorParsed( self, rtid, rstart, rend, parser ) + else: + return TabixIteratorParsed( self, -1, 0, 0, parser ) + + ############################################################### + ############################################################### + ############################################################### + ## properties + ############################################################### + property filename: + '''filename associated with this object.''' + def __get__(self): + if not self._isOpen(): raise ValueError( "I/O operation on closed file" ) + return self._filename + + property header: + '''the file header. + + .. note:: + The header is returned as an iterator over lines without the + newline character. + ''' + + def __get__( self ): + return TabixHeaderIterator( self ) + + property contigs: + '''chromosome names''' + def __get__(self): + cdef char ** sequences + cdef int nsequences + + ti_lazy_index_load( self.tabixfile ) + sequences = ti_seqname( self.tabixfile.idx, &nsequences ) + cdef int x + result = [] + for x from 0 <= x < nsequences: + result.append( sequences[x] ) + return result + + def close( self ): + ''' + closes the :class:`pysam.Tabixfile`.''' + if self.tabixfile != NULL: + ti_close( self.tabixfile ) + self.tabixfile = NULL + + def __dealloc__( self ): + # remember: dealloc cannot call other python methods + # note: no doc string + # note: __del__ is not called. + if self.tabixfile != NULL: + ti_close( self.tabixfile ) + self.tabixfile = NULL + if self._filename != NULL: free( self._filename ) + +cdef class TabixIterator: + """iterates over rows in *tabixfile* in region + given by *tid*, *start* and *end*. + """ + + cdef ti_iter_t iterator + cdef tabix_t * tabixfile + + def __cinit__(self, Tabixfile tabixfile, + int tid, int start, int end ): + + assert tabixfile._isOpen() + + # makes sure that samfile stays alive as long as the + # iterator is alive. + self.tabixfile = tabixfile.tabixfile + + if tid < 0: + # seek to start of file to ensure iteration is over + # all entries. + bgzf_seek( self.tabixfile.fp, 0, 0) + self.iterator = ti_iter_first() + else: + self.iterator = ti_queryi(self.tabixfile, tid, start, end) + + if self.iterator == NULL: + raise ValueError("malformatted query or wrong sequence name.\n") + + def __iter__(self): + return self + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + + cdef char * s + cdef int len + # metachar filtering does not work within tabix + # though it should. Getting the metachar is a pain + # as ti_index_t is incomplete type. + + # simply use '#' for now. + while 1: + s = ti_read(self.tabixfile, self.iterator, &len) + if s == NULL: raise StopIteration + if s[0] != '#': break + + return s + + def __dealloc__(self): + if self.iterator != NULL: + ti_iter_destroy(self.iterator) + +cdef class TabixHeaderIterator: + """return header lines. + """ + + cdef ti_iter_t iterator + cdef tabix_t * tabixfile + + def __cinit__(self, Tabixfile tabixfile ): + + assert tabixfile._isOpen() + + # makes sure that samfile stays alive as long as the + # iterator is alive. + self.tabixfile = tabixfile.tabixfile + + self.iterator = ti_query(self.tabixfile, NULL, 0, 0) + + if self.iterator == NULL: + raise ValueError("can't open header.\n") + + def __iter__(self): + return self + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + + cdef char * s + cdef int len + + # Getting the metachar is a pain as ti_index_t is incomplete type. + # simply use '#' for now. + s = ti_read(self.tabixfile, self.iterator, &len) + if s == NULL: raise StopIteration + # stop at first non-header line + if s[0] != '#': raise StopIteration + + return s + + def __dealloc__(self): + if self.iterator != NULL: + ti_iter_destroy(self.iterator) + +######################################################### +######################################################### +######################################################### +cdef class Parser: + pass + +cdef class asTuple(Parser): + '''converts a :term:`tabix row` into a python tuple. + + Access is by numeric index. + ''' + def __call__(self, char * buffer, int len): + cdef TabProxies.TupleProxy r + r = TabProxies.TupleProxy() + # need to copy - there were some + # persistence issues with "present" + r.copy( buffer, len ) + return r + +cdef class asGTF(Parser): + '''converts a :term:`tabix row` into a GTF record with the following + fields: + + contig + contig + feature + feature + source + source + start + genomic start coordinate (0-based) + end + genomic end coordinate plus one (0-based) + score + feature score + strand + strand + frame + frame + attributes + attribute string. + + GTF formatted entries also defined the attributes: + + gene_id + the gene identifier + transcript_ind + the transcript identifier + + ''' + def __call__(self, char * buffer, int len): + cdef TabProxies.GTFProxy r + r = TabProxies.GTFProxy() + r.copy( buffer, len ) + return r + +cdef class asBed( Parser ): + '''converts a :term:`tabix row` into a bed record + with the following fields: + + contig + contig + start + genomic start coordinate (zero-based) + end + genomic end coordinate plus one (zero-based) + name + name of feature. + score + score of feature + strand + strand of feature + thickStart + thickStart + thickEnd + thickEnd + itemRGB + itemRGB + blockCount + number of bocks + blockSizes + ',' separated string of block sizes + blockStarts + ',' separated string of block genomic start positions + + Only the first three fields are required. Additional + fields are optional, but if one is defined, all the preceeding + need to be defined as well. + + ''' + def __call__(self, char * buffer, int len): + cdef TabProxies.BedProxy r + r = TabProxies.BedProxy() + r.copy( buffer, len ) + return r + +cdef class asVCF( Parser ): + '''converts a :term:`tabix row` into a VCF record with + the following fields: + + contig + contig + pos + chromosomal position, zero-based + id + id + ref + reference + alt + alt + qual + qual + filter + filter + info + info + format + format specifier. + + Access to genotypes is via index:: + + contig = vcf.contig + first_sample_genotype = vcf[0] + second_sample_genotype = vcf[1] + + ''' + def __call__(self, char * buffer, int len ): + cdef TabProxies.VCFProxy r + r = TabProxies.VCFProxy() + r.copy( buffer, len ) + return r + +######################################################### +######################################################### +######################################################### +cdef class TabixIteratorParsed: + """iterates over mapped reads in a region. + + Returns parsed data. + """ + + cdef ti_iter_t iterator + cdef tabix_t * tabixfile + cdef Parser parser + + def __cinit__(self, + Tabixfile tabixfile, + int tid, + int start, + int end, + Parser parser ): + + assert tabixfile._isOpen() + self.parser = parser + + # makes sure that samfile stays alive as long as the + # iterator is alive. + self.tabixfile = tabixfile.tabixfile + + if tid < 0: + # seek to start of file to ensure iteration is over + # all entries. + bgzf_seek( self.tabixfile.fp, 0, 0) + self.iterator = ti_iter_first() + else: + self.iterator = ti_queryi(self.tabixfile, tid, start, end) + + if self.iterator == NULL: + raise ValueError("malformatted query or wrong sequence name.\n") + + def __iter__(self): + return self + + def __next__(self): + """python version of next(). + + pyrex uses this non-standard name instead of next() + """ + + cdef char * s + cdef int len + while 1: + s = ti_read(self.tabixfile, self.iterator, &len) + if s == NULL: raise StopIteration + # todo: read metachar from configuration + if s[0] != '#': break + + return self.parser(s, len) + + def __dealloc__(self): + if self.iterator != NULL: + ti_iter_destroy(self.iterator) + +def tabix_compress( filename_in, + filename_out, + force = False ): + + ''' + compress *filename_in* writing the output to *filename_out*. + + Raise an IOError if *filename_out* already exists, unless *force* is set. + ''' + + if not force and os.path.exists(filename_out ): + raise IOError( "Filename '%s' already exists, use *force* to overwrite" % filename_out) + + cdef int WINDOW_SIZE + cdef int c, r + cdef void * buffer + cdef BGZF * fp + cdef int fd_src + + cdef int O_RDONLY + O_RDONLY = os.O_RDONLY + + WINDOW_SIZE = 64 * 1024 + + fp = bgzf_open( filename_out, "w") + if fp == NULL: + raise IOError( "could not open '%s' for writing" ) + + fd_src = open(filename_in, O_RDONLY) + if fd_src == 0: + raise IOError( "could not open '%s' for reading" ) + + buffer = malloc(WINDOW_SIZE) + + while c > 0: + c = read(fd_src, buffer, WINDOW_SIZE) + r = bgzf_write(fp, buffer, c) + if r < 0: + free( buffer ) + raise OSError("writing failed") + + free( buffer ) + r = bgzf_close(fp) + if r < 0: raise OSError("writing failed") + +def tabix_index( filename, + force = False, + seq_col = None, + start_col = None, + end_col = None, + preset = None, + meta_char = "#", + zerobased = False, + ): + ''' + index tab-separated *filename* using tabix. + + An existing index will not be overwritten unless + *force* is set. + + The index will be built from coordinates + in columns *seq_col*, *start_col* and *end_col*. + + The contents of *filename* have to be sorted by + contig and position - the method does not check + if the file is sorted. + + Column indices are 0-based. Coordinates in the file + are assumed to be 1-based. + + If *preset* is provided, the column coordinates + are taken from a preset. Valid values for preset + are "gff", "bed", "sam", "vcf", psltbl", "pileup". + + Lines beginning with *meta_char* and the first + *line_skip* lines will be skipped. + + If *filename* does not end in ".gz", it will be automatically + compressed. The original file will be removed and only the + compressed file will be retained. + + If *filename* ends in *gz*, the file is assumed to be already + compressed with bgzf. + + returns the filename of the compressed data + ''' + + if not os.path.exists(filename): raise IOError("No such file '%s'" % filename) + + if not filename.endswith(".gz"): + + tabix_compress( filename, filename + ".gz", force = force ) + os.unlink( filename ) + filename += ".gz" + + if not force and os.path.exists(filename + ".tbi" ): + raise IOError( "Filename '%s.tbi' already exists, use *force* to overwrite" ) + + # columns (1-based) + # preset-code, contig, start, end, metachar for commends, lines to ignore at beginning + # 0 is a missing column + preset2conf = { + 'gff' : ( 0, 1, 4, 5, ord('#'), 0 ), + 'bed' : ( 0x10000, 1, 2, 3, ord('#'), 0 ), + 'psltbl' : ( 0x10000, 15, 17, 18, ord('#'), 0 ), + 'sam' : ( 1, 3, 4, 0, ord('#'), 0 ), + 'vcf' : ( 2, 1, 2, 0, ord('#'), 0 ), + 'pileup': (3, 1, 2, 0, ord('#'), 0 ), + } + + if preset: + try: + conf_data = preset2conf[preset] + except KeyError: + raise KeyError( "unknown preset '%s', valid presets are '%s'" % (preset, ",".join(preset2conf.keys() ))) + else: + if end_col == None: end_col = -1 + preset = 0 + + # note that tabix internally works with 0-based coordinates and open/closed intervals. + # When using a preset, conversion is automatically taken care of. + # Otherwise, the coordinates are assumed to be 1-based closed intervals and + # -1 is subtracted from the start coordinate. To avoid doing this, set + # the TI_FLAG_UCSC=0x10000 flag: + if zerobased: preset = preset | 0x10000 + + conf_data = (preset, seq_col+1, start_col+1, end_col+1, ord(meta_char), 0) + + cdef ti_conf_t conf + conf.preset, conf.sc, conf.bc, conf.ec, conf.meta_char, conf.line_skip = conf_data + + ti_index_build( filename, &conf) + + return filename + +__all__ = ["tabix_index", + "tabix_compress", + "Tabixfile", + "asTuple", + "asGTF", + "asVCF", + "asBed", + ] diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.c b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.c new file mode 100755 index 0000000..d194519 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.c @@ -0,0 +1,26575 @@ +/* Generated by Cython 0.14.1 on Sat Oct 15 05:27:48 2011 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__cvcf +#include "stdlib.h" +#include "string.h" +#include "stdint.h" +#include "stdio.h" +#include "ctype.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "fcntl.h" +#include "unistd.h" +#include "bgzf.h" +#include "tabix.h" + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ +/* Test for GCC > 2.95 */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else /* __GNUC__ > 2 ... */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ +#define likely(x) (x) +#define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "cvcf.pyx", + "ctabix.pxd", + "TabProxies.pxd", +}; + +/* Type declarations */ + +/* "TabProxies.pxd":42 + * ctypedef int uint64_t + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_TupleProxy { + PyObject_HEAD + struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtab; + char *data; + char **fields; + int nfields; + int index; + int nbytes; + int offset; + int is_modified; +}; + +/* "TabProxies.pxd":77 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_obj_10TabProxies_NamedTupleProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; +}; + +/* "TabProxies.pxd":80 + * pass + * + * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_BedProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t start; + uint32_t end; + int bedfields; +}; + +/* "cvcf.pyx":94 + * ########################################################################################################### + * + * cdef class VCFRecord( TabProxies.TupleProxy): # <<<<<<<<<<<<<< + * '''vcf record. + * + */ + +struct __pyx_obj_4cvcf_VCFRecord { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; + PyObject *vcf; + char *contig; + uint32_t pos; +}; + +/* "TabProxies.pxd":91 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_VCFProxy { + struct __pyx_obj_10TabProxies_NamedTupleProxy __pyx_base; + char *contig; + uint32_t pos; +}; + +/* "ctabix.pxd":178 + * cdef tabix_t * tabixfile + * + * cdef class Parser: # <<<<<<<<<<<<<< + * pass + */ + +struct __pyx_obj_6ctabix_Parser { + PyObject_HEAD +}; + +/* "TabProxies.pxd":60 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_obj_10TabProxies_GTFProxy { + struct __pyx_obj_10TabProxies_TupleProxy __pyx_base; + char *contig; + char *source; + char *feature; + uint32_t start; + uint32_t end; + char *score; + char *strand; + char *frame; + char *attributes; + int hasOwnAttributes; +}; + +/* "cvcf.pyx":221 + * + * + * cdef class asVCFRecord( ctabix.Parser ): # <<<<<<<<<<<<<< + * '''converts a :term:`tabix row` into a VCF record.''' + * cdef vcffile + */ + +struct __pyx_obj_4cvcf_asVCFRecord { + struct __pyx_obj_6ctabix_Parser __pyx_base; + PyObject *vcffile; +}; + +/* "ctabix.pxd":172 + * # char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len) + * + * cdef class Tabixfile: # <<<<<<<<<<<<<< + * cdef char * filename + * + */ + +struct __pyx_obj_6ctabix_Tabixfile { + PyObject_HEAD + char *filename; + tabix_t *tabixfile; +}; + + +/* "TabProxies.pxd":42 + * ctypedef int uint64_t + * + * cdef class TupleProxy: # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_TupleProxy { + int (*getMaxFields)(struct __pyx_obj_10TabProxies_TupleProxy *, size_t); + PyObject *(*take)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*present)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*copy)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); + PyObject *(*update)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t); +}; +static struct __pyx_vtabstruct_10TabProxies_TupleProxy *__pyx_vtabptr_10TabProxies_TupleProxy; + + +/* "TabProxies.pxd":77 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class NamedTupleProxy( TupleProxy) : # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy *__pyx_vtabptr_10TabProxies_NamedTupleProxy; + + +/* "TabProxies.pxd":91 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class VCFProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_VCFProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_VCFProxy *__pyx_vtabptr_10TabProxies_VCFProxy; + + +/* "TabProxies.pxd":60 + * cdef update( self, char * buffer, size_t nbytes ) + * + * cdef class GTFProxy( TupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_GTFProxy { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_GTFProxy *__pyx_vtabptr_10TabProxies_GTFProxy; + + +/* "cvcf.pyx":94 + * ########################################################################################################### + * + * cdef class VCFRecord( TabProxies.TupleProxy): # <<<<<<<<<<<<<< + * '''vcf record. + * + */ + +struct __pyx_vtabstruct_4cvcf_VCFRecord { + struct __pyx_vtabstruct_10TabProxies_TupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_4cvcf_VCFRecord *__pyx_vtabptr_4cvcf_VCFRecord; + + +/* "TabProxies.pxd":80 + * pass + * + * cdef class BedProxy( NamedTupleProxy) : # <<<<<<<<<<<<<< + * + * cdef: + */ + +struct __pyx_vtabstruct_10TabProxies_BedProxy { + struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy __pyx_base; +}; +static struct __pyx_vtabstruct_10TabProxies_BedProxy *__pyx_vtabptr_10TabProxies_BedProxy; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ + +#define __Pyx_PyObject_AsDouble(obj) \ + ((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + if (unlikely(d == Py_None)) { + __Pyx_RaiseNoneIndexingError(); + return NULL; + } + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) + PyErr_SetObject(PyExc_KeyError, key); + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +#if PY_VERSION_HEX < 0x02050000 +#ifndef PyAnySet_CheckExact + +#define PyAnySet_CheckExact(ob) \ + ((ob)->ob_type == &PySet_Type || \ + (ob)->ob_type == &PyFrozenSet_Type) + +#define PySet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) + +#define Pyx_PyFrozenSet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) + +#define PySet_Size(anyset) \ + PyObject_Size((anyset)) + +#define PySet_Contains(anyset, key) \ + PySequence_Contains((anyset), (key)) + +#define PySet_Pop(set) \ + PyObject_CallMethod(set, (char *)"pop", NULL) + +static CYTHON_INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} + +#endif /* PyAnySet_CheckExact (<= Py2.4) */ + +#if PY_VERSION_HEX < 0x02040000 +#ifndef Py_SETOBJECT_H +#define Py_SETOBJECT_H + +static PyTypeObject *__Pyx_PySet_Type = NULL; +static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; + +#define PySet_Type (*__Pyx_PySet_Type) +#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) + +#define PyAnySet_Check(ob) \ + (PyAnySet_CheckExact(ob) || \ + PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ + PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) + +#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) + +static int __Pyx_Py23SetsImport(void) { + PyObject *sets=0, *Set=0, *ImmutableSet=0; + + sets = PyImport_ImportModule((char *)"sets"); + if (!sets) goto bad; + Set = PyObject_GetAttrString(sets, (char *)"Set"); + if (!Set) goto bad; + ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); + if (!ImmutableSet) goto bad; + Py_DECREF(sets); + + __Pyx_PySet_Type = (PyTypeObject*) Set; + __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; + + return 0; + + bad: + Py_XDECREF(sets); + Py_XDECREF(Set); + Py_XDECREF(ImmutableSet); + return -1; +} + +#else +static int __Pyx_Py23SetsImport(void) { return 0; } +#endif /* !Py_SETOBJECT_H */ +#endif /* < Py2.4 */ +#endif /* < Py2.5 */ + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *modname); /*proto*/ + +#define __pyx_binding_PyCFunctionType_USED 1 + +typedef struct { + PyCFunctionObject func; +} __pyx_binding_PyCFunctionType_object; + +static PyTypeObject __pyx_binding_PyCFunctionType_type; +static PyTypeObject *__pyx_binding_PyCFunctionType = NULL; + +static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */ +#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL) + +static int __pyx_binding_PyCFunctionType_init(void); /* proto */ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from ctabix */ + +static PyTypeObject *__pyx_ptype_6ctabix_Tabixfile = 0; +static PyTypeObject *__pyx_ptype_6ctabix_Parser = 0; +/* Module declarations from TabProxies */ + +static PyTypeObject *__pyx_ptype_10TabProxies_TupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_GTFProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_NamedTupleProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_BedProxy = 0; +static PyTypeObject *__pyx_ptype_10TabProxies_VCFProxy = 0; +/* Module declarations from cvcf */ + +static PyTypeObject *__pyx_ptype_4cvcf_VCFRecord = 0; +static PyTypeObject *__pyx_ptype_4cvcf_asVCFRecord = 0; +#define __Pyx_MODULE_NAME "cvcf" +static int __pyx_module_is_main_cvcf = 0; + +/* Implementation of cvcf */ +static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_map; +static PyObject *__pyx_builtin_min; +static PyObject *__pyx_builtin_len; +static PyObject *__pyx_builtin_zip; +static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_KeyError; +static PyObject *__pyx_builtin_NotImplementedError; +static char __pyx_k_1[] = ""; +static char __pyx_k_2[] = ","; +static char __pyx_k_4[] = ":"; +static char __pyx_k_6[] = "-"; +static char __pyx_k_8[] = "Don't understand region string '%s'"; +static char __pyx_k_9[] = "."; +static char __pyx_k_11[] = ";"; +static char __pyx_k_14[] = "="; +static char __pyx_k_18[] = "BAD_NUMBER_OF_VALUES"; +static char __pyx_k_19[] = "(found %s values in element %s; expected %s)"; +static char __pyx_k_20[] = "BAD_NUMBER_OF_PARAMETERS"; +static char __pyx_k_21[] = "id=%s, expected %s parameters, got %s"; +static char __pyx_k_25[] = "Line %s: '%s'\n%s %s: %s\n"; +static char __pyx_k_27[] = "<"; +static char __pyx_k_29[] = "V40_MISSING_ANGLE_BRACKETS"; +static char __pyx_k_30[] = ">"; +static char __pyx_k_34[] = "\""; +static char __pyx_k_38[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS"; +static char __pyx_k_39[] = "BADLY_FORMATTED_FORMAT_STRING"; +static char __pyx_k_40[] = "ID="; +static char __pyx_k_41[] = "Number="; +static char __pyx_k_42[] = "Type="; +static char __pyx_k_43[] = "Description="; +static char __pyx_k_52[] = "FORMAT_MISSING_QUOTES"; +static char __pyx_k_55[] = ""; +static char __pyx_k_56[] = "#alleles"; +static char __pyx_k_57[] = "#nonref_alleles"; +static char __pyx_k_58[] = "#genotypes"; +static char __pyx_k_59[] = "#phased_genotypes"; +static char __pyx_k_61[] = "Unknown number type encountered: %s"; +static char __pyx_k_62[] = "%s=%s"; +static char __pyx_k_63[] = "(Undefined tag)"; +static char __pyx_k_66[] = "(output)"; +static char __pyx_k_69[] = "Genotype Quality"; +static char __pyx_k_70[] = "Read depth at this position for this sample"; +static char __pyx_k_71[] = "Haplotype Quality"; +static char __pyx_k_72[] = "Sample Genotype Filter"; +static char __pyx_k_73[] = "##"; +static char __pyx_k_76[] = "VCFv3.3"; +static char __pyx_k_77[] = "VCFv4.0"; +static char __pyx_k_78[] = "VCFv4.1"; +static char __pyx_k_79[] = "UNKNOWN_FORMAT_STRING"; +static char __pyx_k_80[] = "##fileformat=VCFv%s.%s\n"; +static char __pyx_k_81[] = "##%s=%s\n"; +static char __pyx_k_82[] = "#"; +static char __pyx_k_85[] = "\t"; +static char __pyx_k_87[] = "HEADING_NOT_SEPARATED_BY_TABS"; +static char __pyx_k_88[] = "(%sth entry not found)"; +static char __pyx_k_89[] = "(found %s, expected %s)"; +static char __pyx_k_90[] = "BADLY_FORMATTED_HEADING"; +static char __pyx_k_91[] = "\n"; +static char __pyx_k_92[] = "|"; +static char __pyx_k_93[] = "ERROR_FLAG_HAS_VALUE"; +static char __pyx_k_97[] = "ERROR_FORMAT_NOT_NUMERICAL"; +static char __pyx_k_98[] = "ERROR_FORMAT_NOT_CHAR"; +static char __pyx_k__0[] = "0"; +static char __pyx_k__D[] = "D"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__N[] = "N"; +static char __pyx_k_101[] = "BAD_NUMBER_OF_COLUMNS"; +static char __pyx_k_102[] = "expected %s for %s samples (%s), got %s"; +static char __pyx_k_103[] = "(reference is %s, VCF says %s)"; +static char __pyx_k_111[] = "V33_UNMATCHED_DELETION"; +static char __pyx_k_112[] = "(deletion is %s, reference is %s)"; +static char __pyx_k_113[] = "MISSING_INDEL_ALLELE_REF_BASE"; +static char __pyx_k_115[] = "Required key %s not found in data"; +static char __pyx_k_118[] = "enter_default_format"; +static char __pyx_k_119[] = "Can only handle v3.3 and v4.0 VCF files"; +static char __pyx_k_121[] = "Invalid error string: %s"; +static char __pyx_k_122[] = "needs to be checked"; +static char __pyx_k_126[] = "[|/\\\\]"; +static char __pyx_k_128[] = "^[ACGTN]+$"; +static char __pyx_k_130[] = "id numbertype number type description missingvalue"; +static char __pyx_k_132[] = "UNKNOWN_FORMAT_STRING:Unknown file format identifier"; +static char __pyx_k_133[] = "BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string"; +static char __pyx_k_134[] = "BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s"; +static char __pyx_k_135[] = "BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)"; +static char __pyx_k_136[] = "POS_NOT_NUMERICAL:Position column is not numerical"; +static char __pyx_k_137[] = "UNKNOWN_CHAR_IN_REF:Unknown character in reference field"; +static char __pyx_k_138[] = "V33_BAD_REF:Reference should be single-character in v3.3 VCF"; +static char __pyx_k_139[] = "V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF"; +static char __pyx_k_140[] = "POS_NOT_POSITIVE:Position field must be >0"; +static char __pyx_k_141[] = "QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'"; +static char __pyx_k_142[] = "ERROR_INFO_STRING:Error while parsing info field"; +static char __pyx_k_143[] = "ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)"; +static char __pyx_k_144[] = "ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s"; +static char __pyx_k_145[] = "ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string"; +static char __pyx_k_146[] = "FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header"; +static char __pyx_k_147[] = "FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header"; +static char __pyx_k_148[] = "BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)"; +static char __pyx_k_149[] = "BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)"; +static char __pyx_k_150[] = "BAD_GENOTYPE:Cannot parse genotype (%s)"; +static char __pyx_k_151[] = "V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)"; +static char __pyx_k_152[] = "MISSING_REF:Reference allele missing"; +static char __pyx_k_153[] = "V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)"; +static char __pyx_k_154[] = "V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets"; +static char __pyx_k_155[] = "FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes"; +static char __pyx_k_156[] = "V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields"; +static char __pyx_k_157[] = "HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs"; +static char __pyx_k_158[] = "WRONG_REF:Wrong reference %s"; +static char __pyx_k_159[] = "ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data"; +static char __pyx_k_160[] = "BAD_CHR_TAG:Error calculating chr tag for %s"; +static char __pyx_k_161[] = "ZERO_LENGTH_ALLELE:Found zero-length allele"; +static char __pyx_k_162[] = "MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base"; +static char __pyx_k__DP[] = "DP"; +static char __pyx_k__FT[] = "FT"; +static char __pyx_k__GQ[] = "GQ"; +static char __pyx_k__GT[] = "GT"; +static char __pyx_k__HQ[] = "HQ"; +static char __pyx_k__ID[] = "ID"; +static char __pyx_k__fa[] = "fa"; +static char __pyx_k__id[] = "id"; +static char __pyx_k__re[] = "re"; +static char __pyx_k__ALT[] = "ALT"; +static char __pyx_k__POS[] = "POS"; +static char __pyx_k__REF[] = "REF"; +static char __pyx_k__VCF[] = "VCF"; +static char __pyx_k__add[] = "add"; +static char __pyx_k__alt[] = "alt"; +static char __pyx_k__end[] = "end"; +static char __pyx_k__fmt[] = "fmt"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__key[] = "key"; +static char __pyx_k__len[] = "len"; +static char __pyx_k__map[] = "map"; +static char __pyx_k__min[] = "min"; +static char __pyx_k__opt[] = "opt"; +static char __pyx_k__pos[] = "pos"; +static char __pyx_k__ref[] = "ref"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__vcf[] = "vcf"; +static char __pyx_k__zip[] = "zip"; +static char __pyx_k__Flag[] = "Flag"; +static char __pyx_k__INFO[] = "INFO"; +static char __pyx_k__PASS[] = "PASS"; +static char __pyx_k__QUAL[] = "QUAL"; +static char __pyx_k__Type[] = "Type"; +static char __pyx_k__alt1[] = "alt1"; +static char __pyx_k__alt2[] = "alt2"; +static char __pyx_k__copy[] = "copy"; +static char __pyx_k__cvcf[] = "cvcf"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__find[] = "find"; +static char __pyx_k__info[] = "info"; +static char __pyx_k__join[] = "join"; +static char __pyx_k__keys[] = "keys"; +static char __pyx_k__line[] = "line"; +static char __pyx_k__pos1[] = "pos1"; +static char __pyx_k__pos2[] = "pos2"; +static char __pyx_k__qual[] = "qual"; +static char __pyx_k__ref1[] = "ref1"; +static char __pyx_k__ref2[] = "ref2"; +static char __pyx_k__self[] = "self"; +static char __pyx_k__type[] = "type"; +static char __pyx_k__ACGTN[] = "ACGTN"; +static char __pyx_k__CHROM[] = "CHROM"; +static char __pyx_k__Error[] = "Error"; +static char __pyx_k__Float[] = "Float"; +static char __pyx_k___copy[] = "_copy"; +static char __pyx_k___info[] = "_info"; +static char __pyx_k___line[] = "_line"; +static char __pyx_k__chrom[] = "chrom"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__error[] = "error"; +static char __pyx_k__fetch[] = "fetch"; +static char __pyx_k__lines[] = "lines"; +static char __pyx_k__match[] = "match"; +static char __pyx_k__parse[] = "parse"; +static char __pyx_k__pysam[] = "pysam"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__start[] = "start"; +static char __pyx_k__strip[] = "strip"; +static char __pyx_k__upper[] = "upper"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__write[] = "write"; +static char __pyx_k__FILTER[] = "FILTER"; +static char __pyx_k__FORMAT[] = "FORMAT"; +static char __pyx_k__GTdata[] = "GTdata"; +static char __pyx_k__Number[] = "Number"; +static char __pyx_k__String[] = "String"; +static char __pyx_k___lines[] = "_lines"; +static char __pyx_k___parse[] = "_parse"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__bisect[] = "bisect"; +static char __pyx_k__buffer[] = "buffer"; +static char __pyx_k__contig[] = "contig"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__filter[] = "filter"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__header[] = "header"; +static char __pyx_k__number[] = "number"; +static char __pyx_k__object[] = "object"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__parser[] = "parser"; +static char __pyx_k__record[] = "record"; +static char __pyx_k__region[] = "region"; +static char __pyx_k__stderr[] = "stderr"; +static char __pyx_k__stream[] = "stream"; +static char __pyx_k__Integer[] = "Integer"; +static char __pyx_k__Warning[] = "Warning"; +static char __pyx_k____all__[] = "__all__"; +static char __pyx_k___errors[] = "_errors"; +static char __pyx_k___filter[] = "_filter"; +static char __pyx_k___format[] = "_format"; +static char __pyx_k___header[] = "_header"; +static char __pyx_k___lineno[] = "_lineno"; +static char __pyx_k__compile[] = "compile"; +static char __pyx_k__connect[] = "connect"; +static char __pyx_k__getinfo[] = "getinfo"; +static char __pyx_k__missing[] = "missing"; +static char __pyx_k__nfields[] = "nfields"; +static char __pyx_k__regions[] = "regions"; +static char __pyx_k__replace[] = "replace"; +static char __pyx_k__samples[] = "samples"; +static char __pyx_k__setinfo[] = "setinfo"; +static char __pyx_k__vcffile[] = "vcffile"; +static char __pyx_k__version[] = "version"; +static char __pyx_k__GTstring[] = "GTstring"; +static char __pyx_k__Genotype[] = "Genotype"; +static char __pyx_k__KeyError[] = "KeyError"; +static char __pyx_k____dict__[] = "__dict__"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k___regions[] = "_regions"; +static char __pyx_k___samples[] = "_samples"; +static char __pyx_k___version[] = "_version"; +static char __pyx_k__deepcopy[] = "deepcopy"; +static char __pyx_k__endswith[] = "endswith"; +static char __pyx_k__filename[] = "filename"; +static char __pyx_k__gtsRegEx[] = "gtsRegEx"; +static char __pyx_k__inregion[] = "inregion"; +static char __pyx_k__operator[] = "operator"; +static char __pyx_k__validate[] = "validate"; +static char __pyx_k__Character[] = "Character"; +static char __pyx_k__NT_NUMBER[] = "NT_NUMBER"; +static char __pyx_k__Tabixfile[] = "Tabixfile"; +static char __pyx_k__VCFRecord[] = "VCFRecord"; +static char __pyx_k__WRONG_REF[] = "WRONG_REF"; +static char __pyx_k___required[] = "_required"; +static char __pyx_k__convertGT[] = "convertGT"; +static char __pyx_k__enumerate[] = "enumerate"; +static char __pyx_k__getfilter[] = "getfilter"; +static char __pyx_k__getformat[] = "getformat"; +static char __pyx_k__getheader[] = "getheader"; +static char __pyx_k__leftalign[] = "leftalign"; +static char __pyx_k__lineparse[] = "lineparse"; +static char __pyx_k__reference[] = "reference"; +static char __pyx_k__separator[] = "separator"; +static char __pyx_k__setfilter[] = "setfilter"; +static char __pyx_k__setformat[] = "setformat"; +static char __pyx_k__setheader[] = "setheader"; +static char __pyx_k__tabixfile[] = "tabixfile"; +static char __pyx_k__warnerror[] = "warnerror"; +static char __pyx_k__NT_ALLELES[] = "NT_ALLELES"; +static char __pyx_k__NT_UNKNOWN[] = "NT_UNKNOWN"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k___leftalign[] = "_leftalign"; +static char __pyx_k___reference[] = "_reference"; +static char __pyx_k__fileformat[] = "fileformat"; +static char __pyx_k__formatdict[] = "formatdict"; +static char __pyx_k__getsamples[] = "getsamples"; +static char __pyx_k__itemgetter[] = "itemgetter"; +static char __pyx_k__itervalues[] = "itervalues"; +static char __pyx_k__namedtuple[] = "namedtuple"; +static char __pyx_k__numbertype[] = "numbertype"; +static char __pyx_k__parse_data[] = "parse_data"; +static char __pyx_k__setregions[] = "setregions"; +static char __pyx_k__setsamples[] = "setsamples"; +static char __pyx_k__setversion[] = "setversion"; +static char __pyx_k__startswith[] = "startswith"; +static char __pyx_k__write_data[] = "write_data"; +static char __pyx_k__Description[] = "Description"; +static char __pyx_k__MISSING_REF[] = "MISSING_REF"; +static char __pyx_k__V33_BAD_REF[] = "V33_BAD_REF"; +static char __pyx_k__alleleRegEx[] = "alleleRegEx"; +static char __pyx_k__collections[] = "collections"; +static char __pyx_k__defaultdict[] = "defaultdict"; +static char __pyx_k__description[] = "description"; +static char __pyx_k__errorstring[] = "errorstring"; +static char __pyx_k__ignoreerror[] = "ignoreerror"; +static char __pyx_k__writeheader[] = "writeheader"; +static char __pyx_k__BAD_GENOTYPE[] = "BAD_GENOTYPE"; +static char __pyx_k__NT_GENOTYPES[] = "NT_GENOTYPES"; +static char __pyx_k___warn_errors[] = "_warn_errors"; +static char __pyx_k__get_expected[] = "get_expected"; +static char __pyx_k__get_sequence[] = "get_sequence"; +static char __pyx_k__missingvalue[] = "missingvalue"; +static char __pyx_k__parse_format[] = "parse_format"; +static char __pyx_k__parse_header[] = "parse_header"; +static char __pyx_k__setreference[] = "setreference"; +static char __pyx_k__write_header[] = "write_header"; +static char __pyx_k__NT_NR_ALLELES[] = "NT_NR_ALLELES"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static char __pyx_k___parse_header[] = "_parse_header"; +static char __pyx_k__compare_calls[] = "compare_calls"; +static char __pyx_k__convertGTback[] = "convertGTback"; +static char __pyx_k__datagenerator[] = "datagenerator"; +static char __pyx_k__format_format[] = "format_format"; +static char __pyx_k__parse_heading[] = "parse_heading"; +static char __pyx_k__parse_regions[] = "parse_regions"; +static char __pyx_k__write_heading[] = "write_heading"; +static char __pyx_k__V33_BAD_ALLELE[] = "V33_BAD_ALLELE"; +static char __pyx_k__V40_BAD_ALLELE[] = "V40_BAD_ALLELE"; +static char __pyx_k___sample2column[] = "_sample2column"; +static char __pyx_k___add_definition[] = "_add_definition"; +static char __pyx_k___ignored_errors[] = "_ignored_errors"; +static char __pyx_k__POS_NOT_POSITIVE[] = "POS_NOT_POSITIVE"; +static char __pyx_k__parse_formatdata[] = "parse_formatdata"; +static char __pyx_k__ERROR_INFO_STRING[] = "ERROR_INFO_STRING"; +static char __pyx_k__ERROR_UNKNOWN_KEY[] = "ERROR_UNKNOWN_KEY"; +static char __pyx_k__POS_NOT_NUMERICAL[] = "POS_NOT_NUMERICAL"; +static char __pyx_k__format_formatdata[] = "format_formatdata"; +static char __pyx_k__FILTER_NOT_DEFINED[] = "FILTER_NOT_DEFINED"; +static char __pyx_k__FORMAT_NOT_DEFINED[] = "FORMAT_NOT_DEFINED"; +static char __pyx_k__QUAL_NOT_NUMERICAL[] = "QUAL_NOT_NUMERICAL"; +static char __pyx_k__ZERO_LENGTH_ALLELE[] = "ZERO_LENGTH_ALLELE"; +static char __pyx_k__ERROR_TRAILING_DATA[] = "ERROR_TRAILING_DATA"; +static char __pyx_k__NT_PHASED_GENOTYPES[] = "NT_PHASED_GENOTYPES"; +static char __pyx_k__NotImplementedError[] = "NotImplementedError"; +static char __pyx_k__UNKNOWN_CHAR_IN_REF[] = "UNKNOWN_CHAR_IN_REF"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_101; +static PyObject *__pyx_kp_s_102; +static PyObject *__pyx_kp_s_103; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_n_s_111; +static PyObject *__pyx_kp_s_112; +static PyObject *__pyx_n_s_113; +static PyObject *__pyx_kp_s_115; +static PyObject *__pyx_n_s_118; +static PyObject *__pyx_kp_s_119; +static PyObject *__pyx_kp_s_121; +static PyObject *__pyx_kp_s_122; +static PyObject *__pyx_kp_s_126; +static PyObject *__pyx_kp_s_128; +static PyObject *__pyx_kp_s_130; +static PyObject *__pyx_kp_s_132; +static PyObject *__pyx_kp_s_133; +static PyObject *__pyx_kp_s_134; +static PyObject *__pyx_kp_s_135; +static PyObject *__pyx_kp_s_136; +static PyObject *__pyx_kp_s_137; +static PyObject *__pyx_kp_s_138; +static PyObject *__pyx_kp_s_139; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_140; +static PyObject *__pyx_kp_s_141; +static PyObject *__pyx_kp_s_142; +static PyObject *__pyx_kp_s_143; +static PyObject *__pyx_kp_s_144; +static PyObject *__pyx_kp_s_145; +static PyObject *__pyx_kp_s_146; +static PyObject *__pyx_kp_s_147; +static PyObject *__pyx_kp_s_148; +static PyObject *__pyx_kp_s_149; +static PyObject *__pyx_kp_s_150; +static PyObject *__pyx_kp_s_151; +static PyObject *__pyx_kp_s_152; +static PyObject *__pyx_kp_s_153; +static PyObject *__pyx_kp_s_154; +static PyObject *__pyx_kp_s_155; +static PyObject *__pyx_kp_s_156; +static PyObject *__pyx_kp_s_157; +static PyObject *__pyx_kp_s_158; +static PyObject *__pyx_kp_s_159; +static PyObject *__pyx_kp_s_160; +static PyObject *__pyx_kp_s_161; +static PyObject *__pyx_kp_s_162; +static PyObject *__pyx_n_s_18; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_20; +static PyObject *__pyx_kp_s_21; +static PyObject *__pyx_kp_s_25; +static PyObject *__pyx_kp_s_27; +static PyObject *__pyx_n_s_29; +static PyObject *__pyx_kp_s_30; +static PyObject *__pyx_kp_s_34; +static PyObject *__pyx_n_s_38; +static PyObject *__pyx_n_s_39; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_40; +static PyObject *__pyx_kp_s_41; +static PyObject *__pyx_kp_s_42; +static PyObject *__pyx_kp_s_43; +static PyObject *__pyx_n_s_52; +static PyObject *__pyx_kp_s_55; +static PyObject *__pyx_kp_s_56; +static PyObject *__pyx_kp_s_57; +static PyObject *__pyx_kp_s_58; +static PyObject *__pyx_kp_s_59; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_61; +static PyObject *__pyx_kp_s_62; +static PyObject *__pyx_kp_s_63; +static PyObject *__pyx_kp_s_66; +static PyObject *__pyx_kp_s_69; +static PyObject *__pyx_kp_s_70; +static PyObject *__pyx_kp_s_71; +static PyObject *__pyx_kp_s_72; +static PyObject *__pyx_kp_s_73; +static PyObject *__pyx_kp_s_76; +static PyObject *__pyx_kp_s_77; +static PyObject *__pyx_kp_s_78; +static PyObject *__pyx_n_s_79; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_80; +static PyObject *__pyx_kp_s_81; +static PyObject *__pyx_kp_s_82; +static PyObject *__pyx_kp_s_85; +static PyObject *__pyx_n_s_87; +static PyObject *__pyx_kp_s_88; +static PyObject *__pyx_kp_s_89; +static PyObject *__pyx_kp_b_9; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s_90; +static PyObject *__pyx_kp_s_91; +static PyObject *__pyx_kp_s_92; +static PyObject *__pyx_n_s_93; +static PyObject *__pyx_n_s_97; +static PyObject *__pyx_n_s_98; +static PyObject *__pyx_kp_b__0; +static PyObject *__pyx_kp_s__0; +static PyObject *__pyx_n_s__ACGTN; +static PyObject *__pyx_n_s__ALT; +static PyObject *__pyx_n_s__BAD_GENOTYPE; +static PyObject *__pyx_n_s__CHROM; +static PyObject *__pyx_n_s__Character; +static PyObject *__pyx_n_s__D; +static PyObject *__pyx_n_s__DP; +static PyObject *__pyx_n_s__Description; +static PyObject *__pyx_n_s__ERROR_INFO_STRING; +static PyObject *__pyx_n_s__ERROR_TRAILING_DATA; +static PyObject *__pyx_n_s__ERROR_UNKNOWN_KEY; +static PyObject *__pyx_n_s__Error; +static PyObject *__pyx_n_s__FILTER; +static PyObject *__pyx_n_s__FILTER_NOT_DEFINED; +static PyObject *__pyx_n_s__FORMAT; +static PyObject *__pyx_n_s__FORMAT_NOT_DEFINED; +static PyObject *__pyx_n_s__FT; +static PyObject *__pyx_n_s__Flag; +static PyObject *__pyx_n_s__Float; +static PyObject *__pyx_n_s__GQ; +static PyObject *__pyx_n_s__GT; +static PyObject *__pyx_n_s__GTdata; +static PyObject *__pyx_n_s__GTstring; +static PyObject *__pyx_n_s__Genotype; +static PyObject *__pyx_n_s__HQ; +static PyObject *__pyx_n_s__I; +static PyObject *__pyx_n_s__ID; +static PyObject *__pyx_n_s__INFO; +static PyObject *__pyx_n_s__Integer; +static PyObject *__pyx_n_s__KeyError; +static PyObject *__pyx_n_s__MISSING_REF; +static PyObject *__pyx_n_s__N; +static PyObject *__pyx_n_s__NT_ALLELES; +static PyObject *__pyx_n_s__NT_GENOTYPES; +static PyObject *__pyx_n_s__NT_NR_ALLELES; +static PyObject *__pyx_n_s__NT_NUMBER; +static PyObject *__pyx_n_s__NT_PHASED_GENOTYPES; +static PyObject *__pyx_n_s__NT_UNKNOWN; +static PyObject *__pyx_n_s__NotImplementedError; +static PyObject *__pyx_n_s__Number; +static PyObject *__pyx_n_b__PASS; +static PyObject *__pyx_n_s__PASS; +static PyObject *__pyx_n_s__POS; +static PyObject *__pyx_n_s__POS_NOT_NUMERICAL; +static PyObject *__pyx_n_s__POS_NOT_POSITIVE; +static PyObject *__pyx_n_s__QUAL; +static PyObject *__pyx_n_s__QUAL_NOT_NUMERICAL; +static PyObject *__pyx_n_s__REF; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__String; +static PyObject *__pyx_n_s__Tabixfile; +static PyObject *__pyx_n_s__Type; +static PyObject *__pyx_n_s__UNKNOWN_CHAR_IN_REF; +static PyObject *__pyx_n_s__V33_BAD_ALLELE; +static PyObject *__pyx_n_s__V33_BAD_REF; +static PyObject *__pyx_n_s__V40_BAD_ALLELE; +static PyObject *__pyx_n_s__VCF; +static PyObject *__pyx_n_s__VCFRecord; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__WRONG_REF; +static PyObject *__pyx_n_s__Warning; +static PyObject *__pyx_n_s__ZERO_LENGTH_ALLELE; +static PyObject *__pyx_n_s____all__; +static PyObject *__pyx_n_s____dict__; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___add_definition; +static PyObject *__pyx_n_s___copy; +static PyObject *__pyx_n_s___errors; +static PyObject *__pyx_n_s___filter; +static PyObject *__pyx_n_s___format; +static PyObject *__pyx_n_s___header; +static PyObject *__pyx_n_s___ignored_errors; +static PyObject *__pyx_n_s___info; +static PyObject *__pyx_n_s___leftalign; +static PyObject *__pyx_n_s___line; +static PyObject *__pyx_n_s___lineno; +static PyObject *__pyx_n_s___lines; +static PyObject *__pyx_n_s___parse; +static PyObject *__pyx_n_s___parse_header; +static PyObject *__pyx_n_s___reference; +static PyObject *__pyx_n_s___regions; +static PyObject *__pyx_n_s___required; +static PyObject *__pyx_n_s___sample2column; +static PyObject *__pyx_n_s___samples; +static PyObject *__pyx_n_s___version; +static PyObject *__pyx_n_s___warn_errors; +static PyObject *__pyx_n_s__add; +static PyObject *__pyx_n_s__alleleRegEx; +static PyObject *__pyx_n_s__alt; +static PyObject *__pyx_n_s__alt1; +static PyObject *__pyx_n_s__alt2; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__bisect; +static PyObject *__pyx_n_s__buffer; +static PyObject *__pyx_n_s__chrom; +static PyObject *__pyx_n_s__collections; +static PyObject *__pyx_n_s__compare_calls; +static PyObject *__pyx_n_s__compile; +static PyObject *__pyx_n_s__connect; +static PyObject *__pyx_n_s__contig; +static PyObject *__pyx_n_s__convertGT; +static PyObject *__pyx_n_s__convertGTback; +static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__cvcf; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__datagenerator; +static PyObject *__pyx_n_s__deepcopy; +static PyObject *__pyx_n_s__defaultdict; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__description; +static PyObject *__pyx_n_s__end; +static PyObject *__pyx_n_s__endswith; +static PyObject *__pyx_n_s__enumerate; +static PyObject *__pyx_n_s__error; +static PyObject *__pyx_n_s__errorstring; +static PyObject *__pyx_n_s__fa; +static PyObject *__pyx_n_s__fetch; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__fileformat; +static PyObject *__pyx_n_s__filename; +static PyObject *__pyx_n_s__filter; +static PyObject *__pyx_n_s__find; +static PyObject *__pyx_n_s__fmt; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__format_format; +static PyObject *__pyx_n_s__format_formatdata; +static PyObject *__pyx_n_s__formatdict; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__get_expected; +static PyObject *__pyx_n_s__get_sequence; +static PyObject *__pyx_n_s__getfilter; +static PyObject *__pyx_n_s__getformat; +static PyObject *__pyx_n_s__getheader; +static PyObject *__pyx_n_s__getinfo; +static PyObject *__pyx_n_s__getsamples; +static PyObject *__pyx_n_s__gtsRegEx; +static PyObject *__pyx_n_s__header; +static PyObject *__pyx_n_s__id; +static PyObject *__pyx_n_s__ignoreerror; +static PyObject *__pyx_n_s__info; +static PyObject *__pyx_n_s__inregion; +static PyObject *__pyx_n_s__itemgetter; +static PyObject *__pyx_n_s__itervalues; +static PyObject *__pyx_n_s__join; +static PyObject *__pyx_n_s__key; +static PyObject *__pyx_n_s__keys; +static PyObject *__pyx_n_s__leftalign; +static PyObject *__pyx_n_s__len; +static PyObject *__pyx_n_s__line; +static PyObject *__pyx_n_s__lineparse; +static PyObject *__pyx_n_s__lines; +static PyObject *__pyx_n_s__map; +static PyObject *__pyx_n_s__match; +static PyObject *__pyx_n_s__min; +static PyObject *__pyx_n_s__missing; +static PyObject *__pyx_n_s__missingvalue; +static PyObject *__pyx_n_s__namedtuple; +static PyObject *__pyx_n_s__nfields; +static PyObject *__pyx_n_s__number; +static PyObject *__pyx_n_s__numbertype; +static PyObject *__pyx_n_s__object; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__operator; +static PyObject *__pyx_n_s__opt; +static PyObject *__pyx_n_s__parse; +static PyObject *__pyx_n_s__parse_data; +static PyObject *__pyx_n_s__parse_format; +static PyObject *__pyx_n_s__parse_formatdata; +static PyObject *__pyx_n_s__parse_header; +static PyObject *__pyx_n_s__parse_heading; +static PyObject *__pyx_n_s__parse_regions; +static PyObject *__pyx_n_s__parser; +static PyObject *__pyx_n_s__pos; +static PyObject *__pyx_n_s__pos1; +static PyObject *__pyx_n_s__pos2; +static PyObject *__pyx_n_s__pysam; +static PyObject *__pyx_n_s__qual; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__re; +static PyObject *__pyx_n_s__record; +static PyObject *__pyx_n_s__ref; +static PyObject *__pyx_n_s__ref1; +static PyObject *__pyx_n_s__ref2; +static PyObject *__pyx_n_s__reference; +static PyObject *__pyx_n_s__region; +static PyObject *__pyx_n_s__regions; +static PyObject *__pyx_n_s__replace; +static PyObject *__pyx_n_s__samples; +static PyObject *__pyx_n_s__self; +static PyObject *__pyx_n_s__separator; +static PyObject *__pyx_n_s__setfilter; +static PyObject *__pyx_n_s__setformat; +static PyObject *__pyx_n_s__setheader; +static PyObject *__pyx_n_s__setinfo; +static PyObject *__pyx_n_s__setreference; +static PyObject *__pyx_n_s__setregions; +static PyObject *__pyx_n_s__setsamples; +static PyObject *__pyx_n_s__setversion; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__start; +static PyObject *__pyx_n_s__startswith; +static PyObject *__pyx_n_s__stderr; +static PyObject *__pyx_n_s__stream; +static PyObject *__pyx_n_s__strip; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__tabixfile; +static PyObject *__pyx_n_s__type; +static PyObject *__pyx_n_s__upper; +static PyObject *__pyx_n_s__validate; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__vcf; +static PyObject *__pyx_n_s__vcffile; +static PyObject *__pyx_n_s__version; +static PyObject *__pyx_n_s__warnerror; +static PyObject *__pyx_n_s__write; +static PyObject *__pyx_n_s__write_data; +static PyObject *__pyx_n_s__write_header; +static PyObject *__pyx_n_s__write_heading; +static PyObject *__pyx_n_s__writeheader; +static PyObject *__pyx_n_s__zip; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_6; +static PyObject *__pyx_int_7; +static PyObject *__pyx_int_8; +static PyObject *__pyx_int_9; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_10; +static PyObject *__pyx_int_11; +static PyObject *__pyx_int_12; +static PyObject *__pyx_int_13; +static PyObject *__pyx_int_14; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_16; +static PyObject *__pyx_int_17; +static PyObject *__pyx_int_18; +static PyObject *__pyx_int_19; +static PyObject *__pyx_int_20; +static PyObject *__pyx_int_21; +static PyObject *__pyx_int_22; +static PyObject *__pyx_int_23; +static PyObject *__pyx_int_24; +static PyObject *__pyx_int_25; +static PyObject *__pyx_int_26; +static PyObject *__pyx_int_27; +static PyObject *__pyx_int_28; +static PyObject *__pyx_int_29; +static PyObject *__pyx_int_30; +static PyObject *__pyx_int_33; +static PyObject *__pyx_int_40; +static PyObject *__pyx_int_100; +static PyObject *__pyx_int_3000000000; +static PyObject *__pyx_k_22; +static PyObject *__pyx_k_26; +static PyObject *__pyx_k_60; +static PyObject *__pyx_k_64; +static PyObject *__pyx_k_65; +static PyObject *__pyx_k_99; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_16; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_32; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_36; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_tuple_44; +static PyObject *__pyx_k_tuple_45; +static PyObject *__pyx_k_tuple_46; +static PyObject *__pyx_k_tuple_47; +static PyObject *__pyx_k_tuple_48; +static PyObject *__pyx_k_tuple_49; +static PyObject *__pyx_k_tuple_50; +static PyObject *__pyx_k_tuple_51; +static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_54; +static PyObject *__pyx_k_tuple_67; +static PyObject *__pyx_k_tuple_68; +static PyObject *__pyx_k_tuple_74; +static PyObject *__pyx_k_tuple_75; +static PyObject *__pyx_k_tuple_83; +static PyObject *__pyx_k_tuple_84; +static PyObject *__pyx_k_tuple_86; +static PyObject *__pyx_k_tuple_94; +static PyObject *__pyx_k_tuple_95; +static PyObject *__pyx_k_tuple_96; +static PyObject *__pyx_k_tuple_100; +static PyObject *__pyx_k_tuple_104; +static PyObject *__pyx_k_tuple_105; +static PyObject *__pyx_k_tuple_106; +static PyObject *__pyx_k_tuple_107; +static PyObject *__pyx_k_tuple_108; +static PyObject *__pyx_k_tuple_109; +static PyObject *__pyx_k_tuple_110; +static PyObject *__pyx_k_tuple_114; +static PyObject *__pyx_k_tuple_116; +static PyObject *__pyx_k_tuple_117; +static PyObject *__pyx_k_tuple_120; +static PyObject *__pyx_k_tuple_123; +static PyObject *__pyx_k_tuple_124; +static PyObject *__pyx_k_tuple_125; +static PyObject *__pyx_k_tuple_127; +static PyObject *__pyx_k_tuple_129; +static PyObject *__pyx_k_tuple_131; + +/* "cvcf.pyx":58 + * + * # Utility function. Uses 0-based coordinates + * def get_sequence(chrom, start, end, fa): # <<<<<<<<<<<<<< + * # obtain sequence from .fa file, without truncation + * if end<=start: return "" + */ + +static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_get_sequence = {__Pyx_NAMESTR("get_sequence"), (PyCFunction)__pyx_pf_4cvcf_get_sequence, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_get_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_chrom = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_fa = 0; + PyObject *__pyx_v_sequence; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__fa,0}; + __Pyx_RefNannySetupContext("get_sequence"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fa); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_sequence") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_chrom = values[0]; + __pyx_v_start = values[1]; + __pyx_v_end = values[2]; + __pyx_v_fa = values[3]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_chrom = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_fa = PyTuple_GET_ITEM(__pyx_args, 3); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_sequence", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.get_sequence"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_sequence = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":60 + * def get_sequence(chrom, start, end, fa): + * # obtain sequence from .fa file, without truncation + * if end<=start: return "" # <<<<<<<<<<<<<< + * if not fa: return "N"*(end-start) + * if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_end, __pyx_v_start, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __pyx_r = ((PyObject *)__pyx_kp_s_1); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":61 + * # obtain sequence from .fa file, without truncation + * if end<=start: return "" + * if not fa: return "N"*(end-start) # <<<<<<<<<<<<<< + * if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() + * sequence = fa.fetch(chrom, start, end).upper() + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_fa); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":62 + * if end<=start: return "" + * if not fa: return "N"*(end-start) + * if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() # <<<<<<<<<<<<<< + * sequence = fa.fetch(chrom, start, end).upper() + * if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence)) + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_start, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = PyNumber_Negative(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_fa); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_fa); + __Pyx_GIVEREF(__pyx_v_fa); + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__upper); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_1), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":63 + * if not fa: return "N"*(end-start) + * if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() + * sequence = fa.fetch(chrom, start, end).upper() # <<<<<<<<<<<<<< + * if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence)) + * return sequence + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_fa, __pyx_n_s__fetch); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__upper); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_sequence); + __pyx_v_sequence = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":64 + * if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() + * sequence = fa.fetch(chrom, start, end).upper() + * if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence)) # <<<<<<<<<<<<<< + * return sequence + * + */ + __pyx_t_7 = PyObject_Length(__pyx_v_sequence); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + __pyx_t_5 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Length(__pyx_v_sequence); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_sequence, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_sequence); + __pyx_v_sequence = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":65 + * sequence = fa.fetch(chrom, start, end).upper() + * if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence)) + * return sequence # <<<<<<<<<<<<<< + * + * # Utility function. Parses a region string + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_sequence); + __pyx_r = __pyx_v_sequence; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.get_sequence"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_sequence); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":68 + * + * # Utility function. Parses a region string + * def parse_regions( string ): # <<<<<<<<<<<<<< + * result = [] + * for r in string.split(','): + */ + +static PyObject *__pyx_pf_4cvcf_1parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_1parse_regions = {__Pyx_NAMESTR("parse_regions"), (PyCFunction)__pyx_pf_4cvcf_1parse_regions, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_1parse_regions(PyObject *__pyx_self, PyObject *__pyx_v_string) { + PyObject *__pyx_v_result; + PyObject *__pyx_v_r; + PyObject *__pyx_v_elts; + PyObject *__pyx_v_chrom; + PyObject *__pyx_v_start; + PyObject *__pyx_v_end; + PyObject *__pyx_v_ielts; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_RefNannySetupContext("parse_regions"); + __pyx_self = __pyx_self; + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_chrom = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_start = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_end = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ielts = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":69 + * # Utility function. Parses a region string + * def parse_regions( string ): + * result = [] # <<<<<<<<<<<<<< + * for r in string.split(','): + * elts = r.split(':') + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":70 + * def parse_regions( string ): + * result = [] + * for r in string.split(','): # <<<<<<<<<<<<<< + * elts = r.split(':') + * chrom, start, end = elts[0], 0, 3000000000 + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_string, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_r); + __pyx_v_r = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":71 + * result = [] + * for r in string.split(','): + * elts = r.split(':') # <<<<<<<<<<<<<< + * chrom, start, end = elts[0], 0, 3000000000 + * if len(elts)==1: pass + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":72 + * for r in string.split(','): + * elts = r.split(':') + * chrom, start, end = elts[0], 0, 3000000000 # <<<<<<<<<<<<<< + * if len(elts)==1: pass + * elif len(elts)==2: + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_int_0; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = __pyx_int_3000000000; + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_chrom); + __pyx_v_chrom = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":73 + * elts = r.split(':') + * chrom, start, end = elts[0], 0, 3000000000 + * if len(elts)==1: pass # <<<<<<<<<<<<<< + * elif len(elts)==2: + * if len(elts[1])>0: + */ + __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_6 == 1); + if (__pyx_t_7) { + goto __pyx_L7; + } + + /* "cvcf.pyx":74 + * chrom, start, end = elts[0], 0, 3000000000 + * if len(elts)==1: pass + * elif len(elts)==2: # <<<<<<<<<<<<<< + * if len(elts[1])>0: + * ielts = elts[1].split('-') + */ + __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_6 == 2); + if (__pyx_t_7) { + + /* "cvcf.pyx":75 + * if len(elts)==1: pass + * elif len(elts)==2: + * if len(elts[1])>0: # <<<<<<<<<<<<<< + * ielts = elts[1].split('-') + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + */ + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = (__pyx_t_6 > 0); + if (__pyx_t_7) { + + /* "cvcf.pyx":76 + * elif len(elts)==2: + * if len(elts[1])>0: + * ielts = elts[1].split('-') # <<<<<<<<<<<<<< + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + * try: start, end = int(ielts[0])-1, int(ielts[1]) + */ + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ielts); + __pyx_v_ielts = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":77 + * if len(elts[1])>0: + * ielts = elts[1].split('-') + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) # <<<<<<<<<<<<<< + * try: start, end = int(ielts[0])-1, int(ielts[1]) + * except: raise ValueError("Don't understand region string '%s'" % r) + */ + __pyx_t_6 = PyObject_Length(__pyx_v_ielts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_6 != 2); + if (__pyx_t_7) { + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":78 + * ielts = elts[1].split('-') + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + * try: start, end = int(ielts[0])-1, int(ielts[1]) # <<<<<<<<<<<<<< + * except: raise ValueError("Don't understand region string '%s'" % r) + * else: + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ielts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ielts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L10_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_start); + __pyx_v_start = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_end); + __pyx_v_end = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L17_try_end; + __pyx_L10_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":79 + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + * try: start, end = int(ielts[0])-1, int(ielts[1]) + * except: raise ValueError("Don't understand region string '%s'" % r) # <<<<<<<<<<<<<< + * else: + * raise ValueError("Don't understand region string '%s'" % r) + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.parse_regions"); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L12_except_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L11_exception_handled; + } + __pyx_L12_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L11_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L17_try_end:; + } + goto __pyx_L8; + } + __pyx_L8:; + goto __pyx_L7; + } + /*else*/ { + + /* "cvcf.pyx":81 + * except: raise ValueError("Don't understand region string '%s'" % r) + * else: + * raise ValueError("Don't understand region string '%s'" % r) # <<<<<<<<<<<<<< + * result.append( (chrom,start,end) ) + * return result + */ + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_v_r); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "cvcf.pyx":82 + * else: + * raise ValueError("Don't understand region string '%s'" % r) + * result.append( (chrom,start,end) ) # <<<<<<<<<<<<<< + * return result + * + */ + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __pyx_t_10 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":83 + * raise ValueError("Don't understand region string '%s'" % r) + * result.append( (chrom,start,end) ) + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("cvcf.parse_regions"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_r); + __Pyx_DECREF(__pyx_v_elts); + __Pyx_DECREF(__pyx_v_chrom); + __Pyx_DECREF(__pyx_v_start); + __Pyx_DECREF(__pyx_v_end); + __Pyx_DECREF(__pyx_v_ielts); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":104 + * cdef uint32_t pos + * + * def __init__(self, vcf): # <<<<<<<<<<<<<< + * self.vcf = vcf + * # if len(data) != len(self.vcf._samples): + */ + +static int __pyx_pf_4cvcf_9VCFRecord___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4cvcf_9VCFRecord___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_vcf = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0}; + __Pyx_RefNannySetupContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_vcf = values[0]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_vcf = PyTuple_GET_ITEM(__pyx_args, 0); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCFRecord.__init__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":105 + * + * def __init__(self, vcf): + * self.vcf = vcf # <<<<<<<<<<<<<< + * # if len(data) != len(self.vcf._samples): + * # self.error(str(data), + */ + __Pyx_INCREF(__pyx_v_vcf); + __Pyx_GIVEREF(__pyx_v_vcf); + __Pyx_GOTREF(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf); + __Pyx_DECREF(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf); + ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf = __pyx_v_vcf; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":115 + * # len(data))) + * + * def __cinit__(self, vcf ): # <<<<<<<<<<<<<< + * # start indexed access at genotypes + * self.offset = 9 + */ + +static int __pyx_pf_4cvcf_9VCFRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4cvcf_9VCFRecord_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_vcf = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcf,0}; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcf); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_vcf = values[0]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_vcf = PyTuple_GET_ITEM(__pyx_args, 0); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCFRecord.__cinit__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":117 + * def __cinit__(self, vcf ): + * # start indexed access at genotypes + * self.offset = 9 # <<<<<<<<<<<<<< + * + * self.vcf = vcf + */ + ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.offset = 9; + + /* "cvcf.pyx":119 + * self.offset = 9 + * + * self.vcf = vcf # <<<<<<<<<<<<<< + * + * cdef update( self, char * buffer, size_t nbytes ): + */ + __Pyx_INCREF(__pyx_v_vcf); + __Pyx_GIVEREF(__pyx_v_vcf); + __Pyx_GOTREF(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf); + __Pyx_DECREF(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf); + ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf = __pyx_v_vcf; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":121 + * self.vcf = vcf + * + * cdef update( self, char * buffer, size_t nbytes ): # <<<<<<<<<<<<<< + * '''update internal data. + * + */ + +static PyObject *__pyx_f_4cvcf_9VCFRecord_update(struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_self, char *__pyx_v_buffer, size_t __pyx_v_nbytes) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("update"); + + /* "cvcf.pyx":126 + * nbytes does not include the terminal '\0'. + * ''' + * TabProxies.TupleProxy.update( self, buffer, nbytes ) # <<<<<<<<<<<<<< + * + * self.contig = self.fields[0] + */ + __pyx_t_1 = __pyx_vtabptr_10TabProxies_TupleProxy->update(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_self), __pyx_v_buffer, __pyx_v_nbytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":128 + * TabProxies.TupleProxy.update( self, buffer, nbytes ) + * + * self.contig = self.fields[0] # <<<<<<<<<<<<<< + * # vcf counts from 1 - correct here + * self.pos = atoi( self.fields[1] ) - 1 + */ + __pyx_v_self->contig = (__pyx_v_self->__pyx_base.fields[0]); + + /* "cvcf.pyx":130 + * self.contig = self.fields[0] + * # vcf counts from 1 - correct here + * self.pos = atoi( self.fields[1] ) - 1 # <<<<<<<<<<<<<< + * + * def __len__(self): + */ + __pyx_v_self->pos = (atoi((__pyx_v_self->__pyx_base.fields[1])) - 1); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.update"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":132 + * self.pos = atoi( self.fields[1] ) - 1 + * + * def __len__(self): # <<<<<<<<<<<<<< + * return max(0, self.nfields - 9) + * + */ + +static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_2__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pf_4cvcf_9VCFRecord_2__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + __Pyx_RefNannySetupContext("__len__"); + + /* "cvcf.pyx":133 + * + * def __len__(self): + * return max(0, self.nfields - 9) # <<<<<<<<<<<<<< + * + * property contig: + */ + __pyx_t_1 = (((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.nfields - 9); + __pyx_t_2 = 0; + if ((__pyx_t_1 > __pyx_t_2)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; + } + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":136 + * + * property contig: + * def __get__(self): return self.contig # <<<<<<<<<<<<<< + * + * property pos: + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6contig___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->contig); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.contig.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":139 + * + * property pos: + * def __get__(self): return self.pos # <<<<<<<<<<<<<< + * + * property id: + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3pos___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_uint32_t(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.pos.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":142 + * + * property id: + * def __get__(self): return self.fields[2] # <<<<<<<<<<<<<< + * + * property ref: + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_2id___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[2])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.id.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":145 + * + * property ref: + * def __get__(self): return self.fields[3] # <<<<<<<<<<<<<< + * + * property alt: + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3ref___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[3])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.ref.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":148 + * + * property alt: + * def __get__(self): # <<<<<<<<<<<<<< + * # convert v3.3 to v4.0 alleles below + * alt = self.fields[4] + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3alt___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_alt; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":150 + * def __get__(self): + * # convert v3.3 to v4.0 alleles below + * alt = self.fields[4] # <<<<<<<<<<<<<< + * if alt == ".": alt = [] + * else: alt = alt.upper().split(',') + */ + __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[4])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "cvcf.pyx":151 + * # convert v3.3 to v4.0 alleles below + * alt = self.fields[4] + * if alt == ".": alt = [] # <<<<<<<<<<<<<< + * else: alt = alt.upper().split(',') + * return alt + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "cvcf.pyx":152 + * alt = self.fields[4] + * if alt == ".": alt = [] + * else: alt = alt.upper().split(',') # <<<<<<<<<<<<<< + * return alt + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_alt, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L5:; + + /* "cvcf.pyx":153 + * if alt == ".": alt = [] + * else: alt = alt.upper().split(',') + * return alt # <<<<<<<<<<<<<< + * + * property qual: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_alt); + __pyx_r = __pyx_v_alt; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCFRecord.alt.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_alt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":156 + * + * property qual: + * def __get__(self): # <<<<<<<<<<<<<< + * qual = self.fields[5] + * if qual == b".": qual = -1 + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_4qual___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_v_qual; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + double __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":157 + * property qual: + * def __get__(self): + * qual = self.fields[5] # <<<<<<<<<<<<<< + * if qual == b".": qual = -1 + * else: + */ + __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[5])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "cvcf.pyx":158 + * def __get__(self): + * qual = self.fields[5] + * if qual == b".": qual = -1 # <<<<<<<<<<<<<< + * else: + * try: qual = float(qual) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_qual, ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = __pyx_int_neg_1; + goto __pyx_L5; + } + /*else*/ { + + /* "cvcf.pyx":160 + * if qual == b".": qual = -1 + * else: + * try: qual = float(qual) # <<<<<<<<<<<<<< + * except: self.vcf.error(str(self),self.QUAL_NOT_NUMERICAL) + * + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_v_qual); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = __pyx_t_1; + __pyx_t_1 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L13_try_end; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":161 + * else: + * try: qual = float(qual) + * except: self.vcf.error(str(self),self.QUAL_NOT_NUMERICAL) # <<<<<<<<<<<<<< + * + * property filter: + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.VCFRecord.qual.__get__"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__error); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__QUAL_NOT_NUMERICAL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L7_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L13_try_end:; + } + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("cvcf.VCFRecord.qual.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_qual); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":164 + * + * property filter: + * def __get__(self): # <<<<<<<<<<<<<< + * f = self.fields[6] + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6filter___get__(PyObject *__pyx_v_self) { + char *__pyx_v_f; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__get__"); + + /* "cvcf.pyx":165 + * property filter: + * def __get__(self): + * f = self.fields[6] # <<<<<<<<<<<<<< + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if f == b"." or f == b"PASS" or f == b"0": return [] + */ + __pyx_v_f = (((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[6]); + + /* "cvcf.pyx":167 + * f = self.fields[6] + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if f == b"." or f == b"PASS" or f == b"0": return [] # <<<<<<<<<<<<<< + * else: return f.split(';') + * + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_3) { + __pyx_t_2 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_b__PASS), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_4) { + __pyx_t_1 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b__0), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_6; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + /*else*/ { + + /* "cvcf.pyx":168 + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if f == b"." or f == b"PASS" or f == b"0": return [] + * else: return f.split(';') # <<<<<<<<<<<<<< + * + * property info: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyBytes_FromString(__pyx_v_f); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } + __pyx_L5:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cvcf.VCFRecord.filter.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":171 + * + * property info: + * def __get__(self): # <<<<<<<<<<<<<< + * col = self.fields[7] + * # dictionary of keys, and list of values + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_4info___get__(PyObject *__pyx_v_self) { + char *__pyx_v_col; + PyObject *__pyx_v_info; + PyObject *__pyx_v_blurp; + PyObject *__pyx_v_elts; + PyObject *__pyx_v_v; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("__get__"); + __pyx_v_info = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_blurp = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":172 + * property info: + * def __get__(self): + * col = self.fields[7] # <<<<<<<<<<<<<< + * # dictionary of keys, and list of values + * info = {} + */ + __pyx_v_col = (((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[7]); + + /* "cvcf.pyx":174 + * col = self.fields[7] + * # dictionary of keys, and list of values + * info = {} # <<<<<<<<<<<<<< + * if col != b".": + * for blurp in col.split(';'): + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_info)); + __pyx_v_info = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":175 + * # dictionary of keys, and list of values + * info = {} + * if col != b".": # <<<<<<<<<<<<<< + * for blurp in col.split(';'): + * elts = blurp.split('=') + */ + __pyx_t_1 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_kp_b_9), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":176 + * info = {} + * if col != b".": + * for blurp in col.split(';'): # <<<<<<<<<<<<<< + * elts = blurp.split('=') + * if len(elts) == 1: v = None + */ + __pyx_t_2 = PyBytes_FromString(__pyx_v_col); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_blurp); + __pyx_v_blurp = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":177 + * if col != b".": + * for blurp in col.split(';'): + * elts = blurp.split('=') # <<<<<<<<<<<<<< + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":178 + * for blurp in col.split(';'): + * elts = blurp.split('=') + * if len(elts) == 1: v = None # <<<<<<<<<<<<<< + * elif len(elts) == 2: v = elts[1] + * else: self.vcf.error(str(self),self.ERROR_INFO_STRING) + */ + __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_6 == 1); + if (__pyx_t_3) { + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = Py_None; + goto __pyx_L8; + } + + /* "cvcf.pyx":179 + * elts = blurp.split('=') + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] # <<<<<<<<<<<<<< + * else: self.vcf.error(str(self),self.ERROR_INFO_STRING) + * info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self)) + */ + __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_6 == 2); + if (__pyx_t_3) { + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "cvcf.pyx":180 + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + * else: self.vcf.error(str(self),self.ERROR_INFO_STRING) # <<<<<<<<<<<<<< + * info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self)) + * return info + */ + __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_7 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L8:; + + /* "cvcf.pyx":181 + * elif len(elts) == 2: v = elts[1] + * else: self.vcf.error(str(self),self.ERROR_INFO_STRING) + * info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self)) # <<<<<<<<<<<<<< + * return info + * + */ + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_8 = 0; + __pyx_t_5 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_7, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "cvcf.pyx":182 + * else: self.vcf.error(str(self),self.ERROR_INFO_STRING) + * info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self)) + * return info # <<<<<<<<<<<<<< + * + * property format: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_info)); + __pyx_r = ((PyObject *)__pyx_v_info); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("cvcf.VCFRecord.info.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_info); + __Pyx_DECREF(__pyx_v_blurp); + __Pyx_DECREF(__pyx_v_elts); + __Pyx_DECREF(__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":185 + * + * property format: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.fields[8].split(':') + * + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_6format___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__get__"); + + /* "cvcf.pyx":186 + * property format: + * def __get__(self): + * return self.fields[8].split(':') # <<<<<<<<<<<<<< + * + * property samples: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[8])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_t_1), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cvcf.VCFRecord.format.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":189 + * + * property samples: + * def __get__(self): # <<<<<<<<<<<<<< + * return self.vcf._samples + * + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_7samples___get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__"); + + /* "cvcf.pyx":190 + * property samples: + * def __get__(self): + * return self.vcf._samples # <<<<<<<<<<<<<< + * + * def __getitem__(self, key): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCFRecord.samples.__get__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":192 + * return self.vcf._samples + * + * def __getitem__(self, key): # <<<<<<<<<<<<<< + * + * # parse sample columns + */ + +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ +static PyObject *__pyx_pf_4cvcf_9VCFRecord_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { + PyObject *__pyx_v_values; + PyObject *__pyx_v_alt; + PyObject *__pyx_v_format; + PyObject *__pyx_v_result; + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_expected; + PyObject *__pyx_v_value; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + __Pyx_RefNannySetupContext("__getitem__"); + __pyx_v_values = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_format = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_expected = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":195 + * + * # parse sample columns + * values = self.fields[self.vcf._sample2column[key]].split(':') # <<<<<<<<<<<<<< + * alt = self.alt + * format = self.format + */ + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___sample2column); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyBytes_FromString((((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.fields[__pyx_t_3])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_values); + __pyx_v_values = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":196 + * # parse sample columns + * values = self.fields[self.vcf._sample2column[key]].split(':') + * alt = self.alt # <<<<<<<<<<<<<< + * format = self.format + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":197 + * values = self.fields[self.vcf._sample2column[key]].split(':') + * alt = self.alt + * format = self.format # <<<<<<<<<<<<<< + * + * if len(values) > len(format): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":199 + * format = self.format + * + * if len(values) > len(format): # <<<<<<<<<<<<<< + * self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\ + * (len(values),key,len(format))) + */ + __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_3 > __pyx_t_4); + if (__pyx_t_5) { + + /* "cvcf.pyx":200 + * + * if len(values) > len(format): + * self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\ # <<<<<<<<<<<<<< + * (len(values),key,len(format))) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "cvcf.pyx":201 + * if len(values) > len(format): + * self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\ + * (len(values),key,len(format))) # <<<<<<<<<<<<<< + * + * result = {} + */ + __pyx_t_4 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "cvcf.pyx":203 + * (len(values),key,len(format))) + * + * result = {} # <<<<<<<<<<<<<< + * for idx in range(len(format)): + * expected = self.vcf.get_expected(format[idx], self.vcf._format, alt) + */ + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = __pyx_t_8; + __pyx_t_8 = 0; + + /* "cvcf.pyx":204 + * + * result = {} + * for idx in range(len(format)): # <<<<<<<<<<<<<< + * expected = self.vcf.get_expected(format[idx], self.vcf._format, alt) + * if idx < len(values): value = values[idx] + */ + __pyx_t_4 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3+=1) { + __pyx_v_idx = __pyx_t_3; + + /* "cvcf.pyx":205 + * result = {} + * for idx in range(len(format)): + * expected = self.vcf.get_expected(format[idx], self.vcf._format, alt) # <<<<<<<<<<<<<< + * if idx < len(values): value = values[idx] + * else: + */ + __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_alt); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_alt); + __Pyx_GIVEREF(__pyx_v_alt); + __pyx_t_9 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_expected); + __pyx_v_expected = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":206 + * for idx in range(len(format)): + * expected = self.vcf.get_expected(format[idx], self.vcf._format, alt) + * if idx < len(values): value = values[idx] # <<<<<<<<<<<<<< + * else: + * if expected == -1: value = "." + */ + __pyx_t_10 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_v_idx < __pyx_t_10); + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "cvcf.pyx":208 + * if idx < len(values): value = values[idx] + * else: + * if expected == -1: value = "." # <<<<<<<<<<<<<< + * else: value = ",".join(["."]*expected) + * + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L9; + } + /*else*/ { + + /* "cvcf.pyx":209 + * else: + * if expected == -1: value = "." + * else: value = ",".join(["."]*expected) # <<<<<<<<<<<<<< + * + * result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data)) + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_8 = PyNumber_Multiply(((PyObject *)__pyx_t_6), __pyx_v_expected); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_8; + __pyx_t_8 = 0; + } + __pyx_L9:; + } + __pyx_L8:; + + /* "cvcf.pyx":211 + * else: value = ",".join(["."]*expected) + * + * result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data)) # <<<<<<<<<<<<<< + * if expected != -1 and len(result[format[idx]]) != expected: + * self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, + */ + __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->vcf, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.data); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_6 = 0; + __pyx_t_2 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_1, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "cvcf.pyx":212 + * + * result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data)) + * if expected != -1 and len(result[format[idx]]) != expected: # <<<<<<<<<<<<<< + * self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) + */ + __pyx_t_9 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_5) { + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_12 = __pyx_t_11; + } else { + __pyx_t_12 = __pyx_t_5; + } + if (__pyx_t_12) { + + /* "cvcf.pyx":213 + * result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data)) + * if expected != -1 and len(result[format[idx]]) != expected: + * self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, # <<<<<<<<<<<<<< + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) + * if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]])) + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_v_self)->__pyx_base.data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "cvcf.pyx":214 + * if expected != -1 and len(result[format[idx]]) != expected: + * self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) # <<<<<<<<<<<<<< + * if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]])) + * result[format[idx]] = result[format[idx]][:expected] + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_6); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_expected); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_expected); + __Pyx_GIVEREF(__pyx_v_expected); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_2 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_t_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "cvcf.pyx":215 + * self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) + * if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]])) # <<<<<<<<<<<<<< + * result[format[idx]] = result[format[idx]][:expected] + * + */ + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_12) { + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_9); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_t_8), __pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_7, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "cvcf.pyx":216 + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) + * if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]])) + * result[format[idx]] = result[format[idx]][:expected] # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_t_7); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_expected); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_t_9, 0, __pyx_t_10); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_9, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L10; + } + __pyx_L10:; + } + + /* "cvcf.pyx":218 + * result[format[idx]] = result[format[idx]][:expected] + * + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("cvcf.VCFRecord.__getitem__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_values); + __Pyx_DECREF(__pyx_v_alt); + __Pyx_DECREF(__pyx_v_format); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_expected); + __Pyx_DECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":224 + * '''converts a :term:`tabix row` into a VCF record.''' + * cdef vcffile + * def __init__(self, vcffile ): # <<<<<<<<<<<<<< + * self.vcffile = vcffile + * def __call__(self, char * buffer, int len ): + */ + +static int __pyx_pf_4cvcf_11asVCFRecord___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_4cvcf_11asVCFRecord___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_vcffile = 0; + int __pyx_r; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vcffile,0}; + __Pyx_RefNannySetupContext("__init__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[1] = {0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcffile); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_vcffile = values[0]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_vcffile = PyTuple_GET_ITEM(__pyx_args, 0); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.asVCFRecord.__init__"); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":225 + * cdef vcffile + * def __init__(self, vcffile ): + * self.vcffile = vcffile # <<<<<<<<<<<<<< + * def __call__(self, char * buffer, int len ): + * cdef VCFRecord r + */ + __Pyx_INCREF(__pyx_v_vcffile); + __Pyx_GIVEREF(__pyx_v_vcffile); + __Pyx_GOTREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile); + __Pyx_DECREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile); + ((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile = __pyx_v_vcffile; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":226 + * def __init__(self, vcffile ): + * self.vcffile = vcffile + * def __call__(self, char * buffer, int len ): # <<<<<<<<<<<<<< + * cdef VCFRecord r + * r = VCFRecord( self.vcffile ) + */ + +static PyObject *__pyx_pf_4cvcf_11asVCFRecord_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pf_4cvcf_11asVCFRecord_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + char *__pyx_v_buffer; + int __pyx_v_len; + struct __pyx_obj_4cvcf_VCFRecord *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__len,0}; + __Pyx_RefNannySetupContext("__call__"); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_buffer = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_buffer = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_buffer) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_len = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_len == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.asVCFRecord.__call__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = ((struct __pyx_obj_4cvcf_VCFRecord *)Py_None); __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":228 + * def __call__(self, char * buffer, int len ): + * cdef VCFRecord r + * r = VCFRecord( self.vcffile ) # <<<<<<<<<<<<<< + * r.copy( buffer, len ) + * return r + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile); + __Pyx_GIVEREF(((struct __pyx_obj_4cvcf_asVCFRecord *)__pyx_v_self)->vcffile); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_VCFRecord)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_r)); + __pyx_v_r = ((struct __pyx_obj_4cvcf_VCFRecord *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "cvcf.pyx":229 + * cdef VCFRecord r + * r = VCFRecord( self.vcffile ) + * r.copy( buffer, len ) # <<<<<<<<<<<<<< + * return r + * + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_4cvcf_VCFRecord *)__pyx_v_r->__pyx_base.__pyx_vtab)->__pyx_base.copy(((struct __pyx_obj_10TabProxies_TupleProxy *)__pyx_v_r), __pyx_v_buffer, __pyx_v_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":230 + * r = VCFRecord( self.vcffile ) + * r.copy( buffer, len ) + * return r # <<<<<<<<<<<<<< + * + * class VCF(object): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_r)); + __pyx_r = ((PyObject *)__pyx_v_r); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cvcf.asVCFRecord.__call__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":306 + * _lines = None + * + * def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): # <<<<<<<<<<<<<< + * # make error identifiers accessible by name + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id + */ + +static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_4cvcf_3VCF___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v__copy = 0; + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_regions = 0; + PyObject *__pyx_v_lines = 0; + PyObject *__pyx_v_leftalign = 0; + PyObject *__pyx_v_id; + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s___copy,&__pyx_n_s__reference,&__pyx_n_s__regions,&__pyx_n_s__lines,&__pyx_n_s__leftalign,0}; + __Pyx_RefNannySetupContext("__init__"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + values[5] = __pyx_k_22; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s___copy); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lines); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__leftalign); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v__copy = values[1]; + __pyx_v_reference = values[2]; + __pyx_v_regions = values[3]; + __pyx_v_lines = values[4]; + __pyx_v_leftalign = values[5]; + } else { + __pyx_v__copy = ((PyObject *)Py_None); + __pyx_v_reference = ((PyObject *)Py_None); + __pyx_v_regions = ((PyObject *)Py_None); + __pyx_v_lines = ((PyObject *)Py_None); + __pyx_v_leftalign = __pyx_k_22; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: __pyx_v_leftalign = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: __pyx_v_lines = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_regions = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v__copy = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.__init__"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_id = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":308 + * def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): + * # make error identifiers accessible by name + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id # <<<<<<<<<<<<<< + * if _copy != None: + * self._leftalign = _copy._leftalign + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__keys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_id); + __pyx_v_id = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_v_id); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyObject_SetItem(__pyx_t_2, __pyx_t_4, __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":309 + * # make error identifiers accessible by name + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id + * if _copy != None: # <<<<<<<<<<<<<< + * self._leftalign = _copy._leftalign + * self._header = _copy._header[:] + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v__copy, Py_None, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + + /* "cvcf.pyx":310 + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id + * if _copy != None: + * self._leftalign = _copy._leftalign # <<<<<<<<<<<<<< + * self._header = _copy._header[:] + * self._version = _copy._version + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___leftalign, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":311 + * if _copy != None: + * self._leftalign = _copy._leftalign + * self._header = _copy._header[:] # <<<<<<<<<<<<<< + * self._version = _copy._version + * self._info = copy.deepcopy(_copy._info) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_3, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___header, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":312 + * self._leftalign = _copy._leftalign + * self._header = _copy._header[:] + * self._version = _copy._version # <<<<<<<<<<<<<< + * self._info = copy.deepcopy(_copy._info) + * self._filter = copy.deepcopy(_copy._filter) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":313 + * self._header = _copy._header[:] + * self._version = _copy._version + * self._info = copy.deepcopy(_copy._info) # <<<<<<<<<<<<<< + * self._filter = copy.deepcopy(_copy._filter) + * self._format = copy.deepcopy(_copy._format) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___info, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":314 + * self._version = _copy._version + * self._info = copy.deepcopy(_copy._info) + * self._filter = copy.deepcopy(_copy._filter) # <<<<<<<<<<<<<< + * self._format = copy.deepcopy(_copy._format) + * self._samples = _copy._samples[:] + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___filter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___filter, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":315 + * self._info = copy.deepcopy(_copy._info) + * self._filter = copy.deepcopy(_copy._filter) + * self._format = copy.deepcopy(_copy._format) # <<<<<<<<<<<<<< + * self._samples = _copy._samples[:] + * self._sample2column = copy.deepcopy(_copy._sample2column) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___format, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":316 + * self._filter = copy.deepcopy(_copy._filter) + * self._format = copy.deepcopy(_copy._format) + * self._samples = _copy._samples[:] # <<<<<<<<<<<<<< + * self._sample2column = copy.deepcopy(_copy._sample2column) + * self._ignored_errors = copy.deepcopy(_copy._ignored_errors) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___samples); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":317 + * self._format = copy.deepcopy(_copy._format) + * self._samples = _copy._samples[:] + * self._sample2column = copy.deepcopy(_copy._sample2column) # <<<<<<<<<<<<<< + * self._ignored_errors = copy.deepcopy(_copy._ignored_errors) + * self._warn_errors = copy.deepcopy(_copy._warn_errors) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___sample2column); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":318 + * self._samples = _copy._samples[:] + * self._sample2column = copy.deepcopy(_copy._sample2column) + * self._ignored_errors = copy.deepcopy(_copy._ignored_errors) # <<<<<<<<<<<<<< + * self._warn_errors = copy.deepcopy(_copy._warn_errors) + * self._reference = _copy._reference + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___ignored_errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":319 + * self._sample2column = copy.deepcopy(_copy._sample2column) + * self._ignored_errors = copy.deepcopy(_copy._ignored_errors) + * self._warn_errors = copy.deepcopy(_copy._warn_errors) # <<<<<<<<<<<<<< + * self._reference = _copy._reference + * self._regions = _copy._regions + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__deepcopy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___warn_errors, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":320 + * self._ignored_errors = copy.deepcopy(_copy._ignored_errors) + * self._warn_errors = copy.deepcopy(_copy._warn_errors) + * self._reference = _copy._reference # <<<<<<<<<<<<<< + * self._regions = _copy._regions + * if reference: self._reference = reference + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":321 + * self._warn_errors = copy.deepcopy(_copy._warn_errors) + * self._reference = _copy._reference + * self._regions = _copy._regions # <<<<<<<<<<<<<< + * if reference: self._reference = reference + * if regions: self._regions = regions + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v__copy, __pyx_n_s___regions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___regions, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":322 + * self._reference = _copy._reference + * self._regions = _copy._regions + * if reference: self._reference = reference # <<<<<<<<<<<<<< + * if regions: self._regions = regions + * if leftalign: self._leftalign = leftalign + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_reference); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_v_reference) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":323 + * self._regions = _copy._regions + * if reference: self._reference = reference + * if regions: self._regions = regions # <<<<<<<<<<<<<< + * if leftalign: self._leftalign = leftalign + * self._lines = lines + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_regions); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___regions, __pyx_v_regions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "cvcf.pyx":324 + * if reference: self._reference = reference + * if regions: self._regions = regions + * if leftalign: self._leftalign = leftalign # <<<<<<<<<<<<<< + * self._lines = lines + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_leftalign); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_6) { + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___leftalign, __pyx_v_leftalign) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + __pyx_L11:; + + /* "cvcf.pyx":325 + * if regions: self._regions = regions + * if leftalign: self._leftalign = leftalign + * self._lines = lines # <<<<<<<<<<<<<< + * + * def error(self,line,error,opt=None): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lines, __pyx_v_lines) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.__init__"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_id); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":327 + * self._lines = lines + * + * def error(self,line,error,opt=None): # <<<<<<<<<<<<<< + * if error in self._ignored_errors: return + * errorlabel, errorstring = self._errors[error].split(':') + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_1error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_1error = {__Pyx_NAMESTR("error"), (PyCFunction)__pyx_pf_4cvcf_3VCF_1error, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_1error(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_error = 0; + PyObject *__pyx_v_opt = 0; + PyObject *__pyx_v_errorlabel; + PyObject *__pyx_v_errorstring; + PyObject *__pyx_v_errwarn; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__error,&__pyx_n_s__opt,0}; + __Pyx_RefNannySetupContext("error"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[3] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opt); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "error") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + __pyx_v_error = values[2]; + __pyx_v_opt = values[3]; + } else { + __pyx_v_opt = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: + __pyx_v_opt = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: + __pyx_v_error = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("error", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.error"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_errorlabel = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_errorstring = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_errwarn = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":328 + * + * def error(self,line,error,opt=None): + * if error in self._ignored_errors: return # <<<<<<<<<<<<<< + * errorlabel, errorstring = self._errors[error].split(':') + * if opt: errorstring = errorstring % opt + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = ((PySequence_Contains(__pyx_t_1, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":329 + * def error(self,line,error,opt=None): + * if error in self._ignored_errors: return + * errorlabel, errorstring = self._errors[error].split(':') # <<<<<<<<<<<<<< + * if opt: errorstring = errorstring % opt + * errwarn = ["Error","Warning"][error in self._warn_errors] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_error); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { + PyObject* tuple = __pyx_t_3; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_errorlabel); + __pyx_v_errorlabel = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_errorstring); + __pyx_v_errorstring = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_EndUnpack(__pyx_t_5, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_errorlabel); + __pyx_v_errorlabel = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_errorstring); + __pyx_v_errorstring = __pyx_t_4; + __pyx_t_4 = 0; + } + + /* "cvcf.pyx":330 + * if error in self._ignored_errors: return + * errorlabel, errorstring = self._errors[error].split(':') + * if opt: errorstring = errorstring % opt # <<<<<<<<<<<<<< + * errwarn = ["Error","Warning"][error in self._warn_errors] + * sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_opt); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + __pyx_t_3 = PyNumber_Remainder(__pyx_v_errorstring, __pyx_v_opt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_errorstring); + __pyx_v_errorstring = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":331 + * errorlabel, errorstring = self._errors[error].split(':') + * if opt: errorstring = errorstring % opt + * errwarn = ["Error","Warning"][error in self._warn_errors] # <<<<<<<<<<<<<< + * sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) + * if error in self._warn_errors: return + */ + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Error)); + PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__Error)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Error)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Warning)); + PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__Warning)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Warning)); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = ((PySequence_Contains(__pyx_t_4, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_3), __pyx_t_2, sizeof(int), __Pyx_PyBool_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_errwarn); + __pyx_v_errwarn = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":332 + * if opt: errorstring = errorstring % opt + * errwarn = ["Error","Warning"][error in self._warn_errors] + * sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) # <<<<<<<<<<<<<< + * if error in self._warn_errors: return + * raise ValueError(errorstring) + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__stderr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_errwarn); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_errwarn); + __Pyx_GIVEREF(__pyx_v_errwarn); + __Pyx_INCREF(__pyx_v_errorlabel); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_errorlabel); + __Pyx_GIVEREF(__pyx_v_errorlabel); + __Pyx_INCREF(__pyx_v_errorstring); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_errorstring); + __Pyx_GIVEREF(__pyx_v_errorstring); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":333 + * errwarn = ["Error","Warning"][error in self._warn_errors] + * sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) + * if error in self._warn_errors: return # <<<<<<<<<<<<<< + * raise ValueError(errorstring) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = ((PySequence_Contains(__pyx_t_3, __pyx_v_error))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":334 + * sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) + * if error in self._warn_errors: return + * raise ValueError(errorstring) # <<<<<<<<<<<<<< + * + * def parse_format(self,line,format,filter=False): + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_errorstring); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_errorstring); + __Pyx_GIVEREF(__pyx_v_errorstring); + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.error"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_errorlabel); + __Pyx_DECREF(__pyx_v_errorstring); + __Pyx_DECREF(__pyx_v_errwarn); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":336 + * raise ValueError(errorstring) + * + * def parse_format(self,line,format,filter=False): # <<<<<<<<<<<<<< + * if self._version == 40: + * if not format.startswith('<'): + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_2parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_2parse_format = {__Pyx_NAMESTR("parse_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_2parse_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_2parse_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_filter = 0; + PyObject *__pyx_v_data; + PyObject *__pyx_v_idx; + PyObject *__pyx_v_elts; + PyObject *__pyx_v_first; + PyObject *__pyx_v_rest; + PyObject *__pyx_v_n; + PyObject *__pyx_v_t; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__format,&__pyx_n_s__filter,0}; + __Pyx_RefNannySetupContext("parse_format"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + values[3] = __pyx_k_26; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_format") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + __pyx_v_format = values[2]; + __pyx_v_filter = values[3]; + } else { + __pyx_v_filter = __pyx_k_26; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: + __pyx_v_filter = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: + __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse_format", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse_format"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_format); + __pyx_v_data = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_first = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_rest = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_n = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":337 + * + * def parse_format(self,line,format,filter=False): + * if self._version == 40: # <<<<<<<<<<<<<< + * if not format.startswith('<'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":338 + * def parse_format(self,line,format,filter=False): + * if self._version == 40: + * if not format.startswith('<'): # <<<<<<<<<<<<<< + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format = "<"+format + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { + + /* "cvcf.pyx":339 + * if self._version == 40: + * if not format.startswith('<'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) # <<<<<<<<<<<<<< + * format = "<"+format + * if not format.endswith('>'): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":340 + * if not format.startswith('<'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format = "<"+format # <<<<<<<<<<<<<< + * if not format.endswith('>'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + */ + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_27), __pyx_v_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":341 + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format = "<"+format + * if not format.endswith('>'): # <<<<<<<<<<<<<< + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format += ">" + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__endswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = (!__pyx_t_4); + if (__pyx_t_3) { + + /* "cvcf.pyx":342 + * format = "<"+format + * if not format.endswith('>'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) # <<<<<<<<<<<<<< + * format += ">" + * format = format[1:-1] + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":343 + * if not format.endswith('>'): + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format += ">" # <<<<<<<<<<<<<< + * format = format[1:-1] + * data = {'id':None,'number':None,'type':None,'descr':None} + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_format, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":344 + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format += ">" + * format = format[1:-1] # <<<<<<<<<<<<<< + * data = {'id':None,'number':None,'type':None,'descr':None} + * idx = 0 + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_format, 1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":345 + * format += ">" + * format = format[1:-1] + * data = {'id':None,'number':None,'type':None,'descr':None} # <<<<<<<<<<<<<< + * idx = 0 + * while len(format.strip())>0: + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__id), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__number), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__type), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__descr), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_data)); + __pyx_v_data = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":346 + * format = format[1:-1] + * data = {'id':None,'number':None,'type':None,'descr':None} + * idx = 0 # <<<<<<<<<<<<<< + * while len(format.strip())>0: + * elts = format.strip().split(',') + */ + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_int_0; + + /* "cvcf.pyx":347 + * data = {'id':None,'number':None,'type':None,'descr':None} + * idx = 0 + * while len(format.strip())>0: # <<<<<<<<<<<<<< + * elts = format.strip().split(',') + * first, rest = elts[0], ','.join(elts[1:]) + */ + while (1) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__strip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_6 > 0); + if (!__pyx_t_3) break; + + /* "cvcf.pyx":348 + * idx = 0 + * while len(format.strip())>0: + * elts = format.strip().split(',') # <<<<<<<<<<<<<< + * first, rest = elts[0], ','.join(elts[1:]) + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":349 + * while len(format.strip())>0: + * elts = format.strip().split(',') + * first, rest = elts[0], ','.join(elts[1:]) # <<<<<<<<<<<<<< + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_rest); + __pyx_v_rest = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":350 + * elts = format.strip().split(',') + * first, rest = elts[0], ','.join(elts[1:]) + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): # <<<<<<<<<<<<<< + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!__pyx_t_3) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_4) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__find); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_9; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + + /* "cvcf.pyx":351 + * first, rest = elts[0], ','.join(elts[1:]) + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) # <<<<<<<<<<<<<< + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * first = ["ID=","Number=","Type=","Description="][idx] + first + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_40, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_38); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L12; + } + __pyx_L12:; + + /* "cvcf.pyx":352 + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * first = ["ID=","Number=","Type=","Description="][idx] + first + * if first.startswith('ID='): data['id'] = first.split('=')[1] + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_4) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "cvcf.pyx":353 + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * first = ["ID=","Number=","Type=","Description="][idx] + first # <<<<<<<<<<<<<< + * if first.startswith('ID='): data['id'] = first.split('=')[1] + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + */ + __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_41)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_s_41)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_42)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_s_42)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_kp_s_43)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43)); + __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_t_2), __pyx_v_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_7, __pyx_v_first); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_first); + __pyx_v_first = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "cvcf.pyx":354 + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * first = ["ID=","Number=","Type=","Description="][idx] + first + * if first.startswith('ID='): data['id'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14; + } + + /* "cvcf.pyx":355 + * first = ["ID=","Number=","Type=","Description="][idx] + first + * if first.startswith('ID='): data['id'] = first.split('=')[1] + * elif first.startswith('Number='): data['number'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L14; + } + + /* "cvcf.pyx":356 + * if first.startswith('ID='): data['id'] = first.split('=')[1] + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Description='): + * elts = format.split('"') + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L14; + } + + /* "cvcf.pyx":357 + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): # <<<<<<<<<<<<<< + * elts = format.split('"') + * if len(elts)<3: + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__startswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":358 + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): + * elts = format.split('"') # <<<<<<<<<<<<<< + * if len(elts)<3: + * self.error(line,self.FORMAT_MISSING_QUOTES) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_format, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_7; + __pyx_t_7 = 0; + + /* "cvcf.pyx":359 + * elif first.startswith('Description='): + * elts = format.split('"') + * if len(elts)<3: # <<<<<<<<<<<<<< + * self.error(line,self.FORMAT_MISSING_QUOTES) + * elts = first.split('=') + [rest] + */ + __pyx_t_6 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_6 < 3); + if (__pyx_t_4) { + + /* "cvcf.pyx":360 + * elts = format.split('"') + * if len(elts)<3: + * self.error(line,self.FORMAT_MISSING_QUOTES) # <<<<<<<<<<<<<< + * elts = first.split('=') + [rest] + * data['descr'] = elts[1] + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_52); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":361 + * if len(elts)<3: + * self.error(line,self.FORMAT_MISSING_QUOTES) + * elts = first.split('=') + [rest] # <<<<<<<<<<<<<< + * data['descr'] = elts[1] + * rest = '"'.join(elts[2:]) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_first, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_rest); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_rest); + __Pyx_GIVEREF(__pyx_v_rest); + __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "cvcf.pyx":362 + * self.error(line,self.FORMAT_MISSING_QUOTES) + * elts = first.split('=') + [rest] + * data['descr'] = elts[1] # <<<<<<<<<<<<<< + * rest = '"'.join(elts[2:]) + * if rest.startswith(','): rest = rest[1:] + */ + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "cvcf.pyx":363 + * elts = first.split('=') + [rest] + * data['descr'] = elts[1] + * rest = '"'.join(elts[2:]) # <<<<<<<<<<<<<< + * if rest.startswith(','): rest = rest[1:] + * else: + */ + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_34), __pyx_n_s__join); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_rest); + __pyx_v_rest = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":364 + * data['descr'] = elts[1] + * rest = '"'.join(elts[2:]) + * if rest.startswith(','): rest = rest[1:] # <<<<<<<<<<<<<< + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_rest, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_4) { + __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_rest, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_rest); + __pyx_v_rest = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L16; + } + __pyx_L16:; + goto __pyx_L14; + } + /*else*/ { + + /* "cvcf.pyx":366 + * if rest.startswith(','): rest = rest[1:] + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * format = rest + * idx += 1 + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L14:; + + /* "cvcf.pyx":367 + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * format = rest # <<<<<<<<<<<<<< + * idx += 1 + * if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings + */ + __Pyx_INCREF(__pyx_v_rest); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_v_rest; + + /* "cvcf.pyx":368 + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * format = rest + * idx += 1 # <<<<<<<<<<<<<< + * if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings + * if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":369 + * format = rest + * idx += 1 + * if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings # <<<<<<<<<<<<<< + * if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * if not data['descr']: + */ + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_2 = PyObject_RichCompare(__pyx_v_idx, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __pyx_t_3; + } else { + __pyx_t_9 = __pyx_t_4; + } + if (__pyx_t_9) { + __Pyx_INCREF(__pyx_int_3); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_int_3; + goto __pyx_L17; + } + __pyx_L17:; + } + + /* "cvcf.pyx":370 + * idx += 1 + * if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings + * if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * if not data['descr']: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_9); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "cvcf.pyx":371 + * if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings + * if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * if not data['descr']: # <<<<<<<<<<<<<< + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * data['descr'] = '' + */ + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = (!__pyx_t_4); + if (__pyx_t_9) { + + /* "cvcf.pyx":372 + * if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * if not data['descr']: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * data['descr'] = '' + * if not data['type'] and not data['number']: + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":373 + * if not data['descr']: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * data['descr'] = '' # <<<<<<<<<<<<<< + * if not data['type'] and not data['number']: + * # fine, ##filter format + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr), ((PyObject *)__pyx_kp_s_55)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L19; + } + __pyx_L19:; + + /* "cvcf.pyx":374 + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * data['descr'] = '' + * if not data['type'] and not data['number']: # <<<<<<<<<<<<<< + * # fine, ##filter format + * return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.') + */ + __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = (!__pyx_t_9); + if (__pyx_t_4) { + __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = (!__pyx_t_9); + __pyx_t_9 = __pyx_t_3; + } else { + __pyx_t_9 = __pyx_t_4; + } + if (__pyx_t_9) { + + /* "cvcf.pyx":376 + * if not data['type'] and not data['number']: + * # fine, ##filter format + * return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.') # <<<<<<<<<<<<<< + * if not data['type'] in ["Integer","Float","Character","String","Flag"]: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Flag)); + PyTuple_SET_ITEM(__pyx_t_10, 3, ((PyObject *)__pyx_n_s__Flag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Flag)); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_10, 5, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_2 = 0; + __pyx_t_7 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L20; + } + __pyx_L20:; + + /* "cvcf.pyx":377 + * # fine, ##filter format + * return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.') + * if not data['type'] in ["Integer","Float","Character","String","Flag"]: # <<<<<<<<<<<<<< + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * # I would like a missing-value field, but it isn't there + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_4 = __pyx_t_9; + if (!__pyx_t_4) { + __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_t_9; + __pyx_t_9 = __pyx_t_3; + } else { + __pyx_t_9 = __pyx_t_4; + } + if (!__pyx_t_9) { + __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_9; + } + if (!__pyx_t_4) { + __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_t_9; + __pyx_t_9 = __pyx_t_3; + } else { + __pyx_t_9 = __pyx_t_4; + } + if (!__pyx_t_9) { + __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_9; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = (!__pyx_t_4); + if (__pyx_t_9) { + + /* "cvcf.pyx":378 + * return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.') + * if not data['type'] in ["Integer","Float","Character","String","Flag"]: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * # I would like a missing-value field, but it isn't there + * if data['type'] in ['Integer','Float']: data['missing'] = None # Do NOT use arbitrary int/float as missing value + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L21; + } + __pyx_L21:; + + /* "cvcf.pyx":380 + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * # I would like a missing-value field, but it isn't there + * if data['type'] in ['Integer','Float']: data['missing'] = None # Do NOT use arbitrary int/float as missing value # <<<<<<<<<<<<<< + * else: data['missing'] = '.' + * if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __pyx_t_9; + if (!__pyx_t_4) { + __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __pyx_t_9; + __pyx_t_9 = __pyx_t_3; + } else { + __pyx_t_9 = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_4 = __pyx_t_9; + if (__pyx_t_4) { + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing), Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L22; + } + /*else*/ { + + /* "cvcf.pyx":381 + * # I would like a missing-value field, but it isn't there + * if data['type'] in ['Integer','Float']: data['missing'] = None # Do NOT use arbitrary int/float as missing value + * else: data['missing'] = '.' # <<<<<<<<<<<<<< + * if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * try: + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing), ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L22:; + + /* "cvcf.pyx":382 + * if data['type'] in ['Integer','Float']: data['missing'] = None # Do NOT use arbitrary int/float as missing value + * else: data['missing'] = '.' + * if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * try: + * n = int(data['number']) + */ + __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = (!__pyx_t_4); + if (__pyx_t_9) { + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L23; + } + __pyx_L23:; + + /* "cvcf.pyx":383 + * else: data['missing'] = '.' + * if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * try: # <<<<<<<<<<<<<< + * n = int(data['number']) + * t = self.NT_NUMBER + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "cvcf.pyx":384 + * if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * try: + * n = int(data['number']) # <<<<<<<<<<<<<< + * t = self.NT_NUMBER + * except ValueError: + */ + __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L24_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":385 + * try: + * n = int(data['number']) + * t = self.NT_NUMBER # <<<<<<<<<<<<<< + * except ValueError: + * n = -1 + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L24_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L31_try_end; + __pyx_L24_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":386 + * n = int(data['number']) + * t = self.NT_NUMBER + * except ValueError: # <<<<<<<<<<<<<< + * n = -1 + * if data['number'] == '.': t = self.NT_UNKNOWN + */ + __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_11) { + __Pyx_AddTraceback("cvcf.VCF.parse_format"); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_10); + + /* "cvcf.pyx":387 + * t = self.NT_NUMBER + * except ValueError: + * n = -1 # <<<<<<<<<<<<<< + * if data['number'] == '.': t = self.NT_UNKNOWN + * elif data['number'] == '#alleles': t = self.NT_ALLELES + */ + __Pyx_INCREF(__pyx_int_neg_1); + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_int_neg_1; + + /* "cvcf.pyx":388 + * except ValueError: + * n = -1 + * if data['number'] == '.': t = self.NT_UNKNOWN # <<<<<<<<<<<<<< + * elif data['number'] == '#alleles': t = self.NT_ALLELES + * elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES + */ + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_9) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L34; + } + + /* "cvcf.pyx":389 + * n = -1 + * if data['number'] == '.': t = self.NT_UNKNOWN + * elif data['number'] == '#alleles': t = self.NT_ALLELES # <<<<<<<<<<<<<< + * elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES + * elif data['number'] == '#genotypes': t = self.NT_GENOTYPES + */ + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_56), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L34; + } + + /* "cvcf.pyx":390 + * if data['number'] == '.': t = self.NT_UNKNOWN + * elif data['number'] == '#alleles': t = self.NT_ALLELES + * elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES # <<<<<<<<<<<<<< + * elif data['number'] == '#genotypes': t = self.NT_GENOTYPES + * elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES + */ + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_57), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_9) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L34; + } + + /* "cvcf.pyx":391 + * elif data['number'] == '#alleles': t = self.NT_ALLELES + * elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES + * elif data['number'] == '#genotypes': t = self.NT_GENOTYPES # <<<<<<<<<<<<<< + * elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES + * else: + */ + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_58), Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_9) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L34; + } + + /* "cvcf.pyx":392 + * elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES + * elif data['number'] == '#genotypes': t = self.NT_GENOTYPES + * elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES # <<<<<<<<<<<<<< + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__number)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_kp_s_59), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_9) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L34; + } + /*else*/ { + + /* "cvcf.pyx":394 + * elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) # <<<<<<<<<<<<<< + * return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing']) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_39); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L26_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L34:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L25_exception_handled; + } + __pyx_L26_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L25_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L31_try_end:; + } + + /* "cvcf.pyx":395 + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing']) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__type)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__descr)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_data), ((PyObject *)__pyx_n_s__missing)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_t); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_t); + __Pyx_GIVEREF(__pyx_v_t); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_7 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("cvcf.VCF.parse_format"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_data); + __Pyx_DECREF(__pyx_v_idx); + __Pyx_DECREF(__pyx_v_elts); + __Pyx_DECREF(__pyx_v_first); + __Pyx_DECREF(__pyx_v_rest); + __Pyx_DECREF(__pyx_v_n); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF(__pyx_v_format); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":398 + * + * + * def format_format( self, fmt, filter=False ): # <<<<<<<<<<<<<< + * values = [('ID',fmt.id)] + * if fmt.number != None and not filter: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_3format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_3format_format = {__Pyx_NAMESTR("format_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_3format_format, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_3format_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_fmt = 0; + PyObject *__pyx_v_filter = 0; + PyObject *__pyx_v_values; + PyObject *__pyx_v_nmb; + PyObject *__pyx_v_format; + PyObject *__pyx_v_k; + PyObject *__pyx_v_v; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__fmt,&__pyx_n_s__filter,0}; + __Pyx_RefNannySetupContext("format_format"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = __pyx_k_60; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fmt); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("format_format", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "format_format") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_fmt = values[1]; + __pyx_v_filter = values[2]; + } else { + __pyx_v_filter = __pyx_k_60; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: + __pyx_v_filter = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: + __pyx_v_fmt = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("format_format", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.format_format"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_values = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_nmb = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_format = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":399 + * + * def format_format( self, fmt, filter=False ): + * values = [('ID',fmt.id)] # <<<<<<<<<<<<<< + * if fmt.number != None and not filter: + * if fmt.numbertype == self.NT_UNKNOWN: nmb = "." + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ID)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_values)); + __pyx_v_values = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":400 + * def format_format( self, fmt, filter=False ): + * values = [('ID',fmt.id)] + * if fmt.number != None and not filter: # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_UNKNOWN: nmb = "." + * elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_filter); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_4); + __pyx_t_4 = __pyx_t_5; + } else { + __pyx_t_4 = __pyx_t_3; + } + if (__pyx_t_4) { + + /* "cvcf.pyx":401 + * values = [('ID',fmt.id)] + * if fmt.number != None and not filter: + * if fmt.numbertype == self.NT_UNKNOWN: nmb = "." # <<<<<<<<<<<<<< + * elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) + * elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_4) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L7; + } + + /* "cvcf.pyx":402 + * if fmt.number != None and not filter: + * if fmt.numbertype == self.NT_UNKNOWN: nmb = "." + * elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) # <<<<<<<<<<<<<< + * elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" + * elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L7; + } + + /* "cvcf.pyx":403 + * if fmt.numbertype == self.NT_UNKNOWN: nmb = "." + * elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) + * elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" # <<<<<<<<<<<<<< + * elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" + * elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes" + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_4) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_56)); + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = ((PyObject *)__pyx_kp_s_56); + goto __pyx_L7; + } + + /* "cvcf.pyx":404 + * elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) + * elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" + * elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" # <<<<<<<<<<<<<< + * elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes" + * elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes" + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_57)); + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = ((PyObject *)__pyx_kp_s_57); + goto __pyx_L7; + } + + /* "cvcf.pyx":405 + * elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" + * elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" + * elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes" # <<<<<<<<<<<<<< + * elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes" + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_4) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_58)); + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = ((PyObject *)__pyx_kp_s_58); + goto __pyx_L7; + } + + /* "cvcf.pyx":406 + * elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" + * elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes" + * elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes" # <<<<<<<<<<<<<< + * else: + * raise ValueError("Unknown number type encountered: %s" % fmt.numbertype) + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_59)); + __Pyx_DECREF(__pyx_v_nmb); + __pyx_v_nmb = ((PyObject *)__pyx_kp_s_59); + goto __pyx_L7; + } + /*else*/ { + + /* "cvcf.pyx":408 + * elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes" + * else: + * raise ValueError("Unknown number type encountered: %s" % fmt.numbertype) # <<<<<<<<<<<<<< + * values.append( ('Number',nmb) ) + * values.append( ('Type', fmt.type) ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L7:; + + /* "cvcf.pyx":409 + * else: + * raise ValueError("Unknown number type encountered: %s" % fmt.numbertype) + * values.append( ('Number',nmb) ) # <<<<<<<<<<<<<< + * values.append( ('Type', fmt.type) ) + * values.append( ('Description', '"' + fmt.description + '"') ) + */ + if (unlikely(__pyx_v_values == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Number)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Number)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Number)); + __Pyx_INCREF(__pyx_v_nmb); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nmb); + __Pyx_GIVEREF(__pyx_v_nmb); + __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":410 + * raise ValueError("Unknown number type encountered: %s" % fmt.numbertype) + * values.append( ('Number',nmb) ) + * values.append( ('Type', fmt.type) ) # <<<<<<<<<<<<<< + * values.append( ('Description', '"' + fmt.description + '"') ) + * if self._version == 33: + */ + if (unlikely(__pyx_v_values == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Type)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__Type)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Type)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":411 + * values.append( ('Number',nmb) ) + * values.append( ('Type', fmt.type) ) + * values.append( ('Description', '"' + fmt.description + '"') ) # <<<<<<<<<<<<<< + * if self._version == 33: + * format = ",".join([v for k,v in values]) + */ + if (unlikely(__pyx_v_values == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__description); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_34), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_34)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Description)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Description)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Description)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_7 = PyList_Append(__pyx_v_values, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":412 + * values.append( ('Type', fmt.type) ) + * values.append( ('Description', '"' + fmt.description + '"') ) + * if self._version == 33: # <<<<<<<<<<<<<< + * format = ",".join([v for k,v in values]) + * else: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":413 + * values.append( ('Description', '"' + fmt.description + '"') ) + * if self._version == 33: + * format = ",".join([v for k,v in values]) # <<<<<<<<<<<<<< + * else: + * format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">" + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (unlikely(__pyx_v_values == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = 0; __pyx_t_6 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_6); + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; + if (PyTuple_CheckExact(__pyx_t_9) && likely(PyTuple_GET_SIZE(__pyx_t_9) == 2)) { + PyObject* tuple = __pyx_t_9; + __pyx_t_10 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_10); + __pyx_t_11 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_11; + __pyx_t_11 = 0; + } else { + __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + if (__Pyx_EndUnpack(__pyx_t_12, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_11; + __pyx_t_11 = 0; + } + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_v))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "cvcf.pyx":415 + * format = ",".join([v for k,v in values]) + * else: + * format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">" # <<<<<<<<<<<<<< + * return format + * + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + if (unlikely(__pyx_v_values == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_values); __Pyx_INCREF(__pyx_t_2); + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; + if (PyTuple_CheckExact(__pyx_t_9) && likely(PyTuple_GET_SIZE(__pyx_t_9) == 2)) { + PyObject* tuple = __pyx_t_9; + __pyx_t_11 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_11); + __pyx_t_10 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_10; + __pyx_t_10 = 0; + } else { + __pyx_t_12 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_12, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_EndUnpack(__pyx_t_12, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_10; + __pyx_t_10 = 0; + } + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_62), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (unlikely(PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_27), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_30)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_6; + __pyx_t_6 = 0; + } + __pyx_L8:; + + /* "cvcf.pyx":416 + * else: + * format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">" + * return format # <<<<<<<<<<<<<< + * + * def get_expected(self, format, formatdict, alt): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_format); + __pyx_r = __pyx_v_format; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("cvcf.VCF.format_format"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_values); + __Pyx_DECREF(__pyx_v_nmb); + __Pyx_DECREF(__pyx_v_format); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":418 + * return format + * + * def get_expected(self, format, formatdict, alt): # <<<<<<<<<<<<<< + * fmt = formatdict[format] + * if fmt.numbertype == self.NT_UNKNOWN: return -1 + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_4get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_4get_expected = {__Pyx_NAMESTR("get_expected"), (PyCFunction)__pyx_pf_4cvcf_3VCF_4get_expected, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_4get_expected(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_formatdict = 0; + PyObject *__pyx_v_alt = 0; + PyObject *__pyx_v_fmt; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_6; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,&__pyx_n_s__formatdict,&__pyx_n_s__alt,0}; + __Pyx_RefNannySetupContext("get_expected"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[4] = {0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_expected") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_format = values[1]; + __pyx_v_formatdict = values[2]; + __pyx_v_alt = values[3]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_formatdict = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_alt = PyTuple_GET_ITEM(__pyx_args, 3); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_expected", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.get_expected"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_fmt = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":419 + * + * def get_expected(self, format, formatdict, alt): + * fmt = formatdict[format] # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_UNKNOWN: return -1 + * if fmt.numbertype == self.NT_NUMBER: return fmt.number + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_formatdict, __pyx_v_format); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_fmt); + __pyx_v_fmt = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":420 + * def get_expected(self, format, formatdict, alt): + * fmt = formatdict[format] + * if fmt.numbertype == self.NT_UNKNOWN: return -1 # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_NUMBER: return fmt.number + * if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":421 + * fmt = formatdict[format] + * if fmt.numbertype == self.NT_UNKNOWN: return -1 + * if fmt.numbertype == self.NT_NUMBER: return fmt.number # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 + * if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":422 + * if fmt.numbertype == self.NT_UNKNOWN: return -1 + * if fmt.numbertype == self.NT_NUMBER: return fmt.number + * if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) + * if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_5 + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":423 + * if fmt.numbertype == self.NT_NUMBER: return fmt.number + * if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 + * if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 + * if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NR_ALLELES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":424 + * if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 + * if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) + * if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 # <<<<<<<<<<<<<< + * if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1) + * return 0 + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__Pyx_div_Py_ssize_t(((__pyx_t_5 + 1) * (__pyx_t_6 + 2)), 2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "cvcf.pyx":425 + * if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) + * if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 + * if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1) # <<<<<<<<<<<<<< + * return 0 + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_fmt, __pyx_n_s__numbertype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_PHASED_GENOTYPES); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_6 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Length(__pyx_v_alt); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(((__pyx_t_6 + 1) * (__pyx_t_5 + 1))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L11; + } + __pyx_L11:; + + /* "cvcf.pyx":426 + * if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 + * if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1) + * return 0 # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_0); + __pyx_r = __pyx_int_0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCF.get_expected"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_fmt); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":429 + * + * + * def _add_definition(self, formatdict, key, data, line ): # <<<<<<<<<<<<<< + * if key in formatdict: return + * self.error(line,self.ERROR_UNKNOWN_KEY,key) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_5_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_5_add_definition = {__Pyx_NAMESTR("_add_definition"), (PyCFunction)__pyx_pf_4cvcf_3VCF_5_add_definition, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_5_add_definition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_formatdict = 0; + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__formatdict,&__pyx_n_s__key,&__pyx_n_s__data,&__pyx_n_s__line,0}; + __Pyx_RefNannySetupContext("_add_definition"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_add_definition") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_formatdict = values[1]; + __pyx_v_key = values[2]; + __pyx_v_data = values[3]; + __pyx_v_line = values[4]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_formatdict = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 4); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_add_definition", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF._add_definition"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_data); + + /* "cvcf.pyx":430 + * + * def _add_definition(self, formatdict, key, data, line ): + * if key in formatdict: return # <<<<<<<<<<<<<< + * self.error(line,self.ERROR_UNKNOWN_KEY,key) + * if data == None: + */ + __pyx_t_1 = ((PySequence_Contains(__pyx_v_formatdict, __pyx_v_key))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":431 + * def _add_definition(self, formatdict, key, data, line ): + * if key in formatdict: return + * self.error(line,self.ERROR_UNKNOWN_KEY,key) # <<<<<<<<<<<<<< + * if data == None: + * formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_UNKNOWN_KEY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":432 + * if key in formatdict: return + * self.error(line,self.ERROR_UNKNOWN_KEY,key) + * if data == None: # <<<<<<<<<<<<<< + * formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") + * return + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_data, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "cvcf.pyx":433 + * self.error(line,self.ERROR_UNKNOWN_KEY,key) + * if data == None: + * formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") # <<<<<<<<<<<<<< + * return + * if data == []: data = [""] # unsure what type -- say string + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Flag)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__Flag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Flag)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_63)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":434 + * if data == None: + * formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") + * return # <<<<<<<<<<<<<< + * if data == []: data = [""] # unsure what type -- say string + * if type(data[0]) == type(0.0): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":435 + * formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") + * return + * if data == []: data = [""] # unsure what type -- say string # <<<<<<<<<<<<<< + * if type(data[0]) == type(0.0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_data, ((PyObject *)__pyx_t_4), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":436 + * return + * if data == []: data = [""] # unsure what type -- say string + * if type(data[0]) == type(0.0): # <<<<<<<<<<<<<< + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) + * return + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_data, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)Py_TYPE(__pyx_t_4)), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "cvcf.pyx":437 + * if data == []: data = [""] # unsure what type -- say string + * if type(data[0]) == type(0.0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) # <<<<<<<<<<<<<< + * return + * if type(data[0]) == type(0): + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Float)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__Float)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Float)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_63)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 5, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":438 + * if type(data[0]) == type(0.0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) + * return # <<<<<<<<<<<<<< + * if type(data[0]) == type(0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":439 + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) + * return + * if type(data[0]) == type(0): # <<<<<<<<<<<<<< + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) + * return + */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_data, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_4)), ((PyObject *)Py_TYPE(__pyx_int_0)), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "cvcf.pyx":440 + * return + * if type(data[0]) == type(0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) # <<<<<<<<<<<<<< + * return + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".") + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer)); + PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__Integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_63)); + PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_kp_s_63)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63)); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_3, 5, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":441 + * if type(data[0]) == type(0): + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) + * return # <<<<<<<<<<<<<< + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".") + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "cvcf.pyx":442 + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) + * return + * formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".") # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__String)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__String)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__String)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_63)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_kp_s_63)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_63)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyObject_SetItem(__pyx_v_formatdict, __pyx_v_key, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("cvcf.VCF._add_definition"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":446 + * + * # todo: trim trailing missing values + * def format_formatdata( self, data, format, key=True, value=True, separator=":" ): # <<<<<<<<<<<<<< + * output, sdata = [], [] + * if type(data) == type([]): # for FORMAT field, make data with dummy values + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_6format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_6format_formatdata = {__Pyx_NAMESTR("format_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_6format_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_6format_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_separator = 0; + PyObject *__pyx_v_output; + PyObject *__pyx_v_sdata; + PyObject *__pyx_v_d; + PyObject *__pyx_v_k; + PyObject *__pyx_v_idx; + PyObject *__pyx_v_v; + PyObject *__pyx_v_last; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + int __pyx_t_11; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__data,&__pyx_n_s__format,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__separator,0}; + __Pyx_RefNannySetupContext("format_formatdata"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[6] = {0,0,0,0,0,0}; + values[3] = __pyx_k_64; + values[4] = __pyx_k_65; + values[5] = ((PyObject *)__pyx_kp_s_4); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__separator); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "format_formatdata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_data = values[1]; + __pyx_v_format = values[2]; + __pyx_v_key = values[3]; + __pyx_v_value = values[4]; + __pyx_v_separator = values[5]; + } else { + __pyx_v_key = __pyx_k_64; + __pyx_v_value = __pyx_k_65; + __pyx_v_separator = ((PyObject *)__pyx_kp_s_4); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: + __pyx_v_separator = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: + __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: + __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: + __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("format_formatdata", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.format_formatdata"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_data); + __pyx_v_output = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_sdata = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_last = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":447 + * # todo: trim trailing missing values + * def format_formatdata( self, data, format, key=True, value=True, separator=":" ): + * output, sdata = [], [] # <<<<<<<<<<<<<< + * if type(data) == type([]): # for FORMAT field, make data with dummy values + * d = {} + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_v_output)); + __pyx_v_output = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sdata)); + __pyx_v_sdata = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":448 + * def format_formatdata( self, data, format, key=True, value=True, separator=":" ): + * output, sdata = [], [] + * if type(data) == type([]): # for FORMAT field, make data with dummy values # <<<<<<<<<<<<<< + * d = {} + * for k in data: d[k] = [] + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_data)), ((PyObject *)Py_TYPE(((PyObject *)__pyx_t_2))), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":449 + * output, sdata = [], [] + * if type(data) == type([]): # for FORMAT field, make data with dummy values + * d = {} # <<<<<<<<<<<<<< + * for k in data: d[k] = [] + * data = d + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_d)); + __pyx_v_d = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":450 + * if type(data) == type([]): # for FORMAT field, make data with dummy values + * d = {} + * for k in data: d[k] = [] # <<<<<<<<<<<<<< + * data = d + * # convert missing values; and silently add definitions if required + */ + if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_v_data; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(((PyObject *)__pyx_v_d), __pyx_v_k, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":451 + * d = {} + * for k in data: d[k] = [] + * data = d # <<<<<<<<<<<<<< + * # convert missing values; and silently add definitions if required + * for k in data: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_d)); + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = ((PyObject *)__pyx_v_d); + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":453 + * data = d + * # convert missing values; and silently add definitions if required + * for k in data: # <<<<<<<<<<<<<< + * self._add_definition( format, k, data[k], "(output)" ) + * for idx,v in enumerate(data[k]): + */ + if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_v_data; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":454 + * # convert missing values; and silently add definitions if required + * for k in data: + * self._add_definition( format, k, data[k], "(output)" ) # <<<<<<<<<<<<<< + * for idx,v in enumerate(data[k]): + * if v == format[k].missingvalue: data[k][idx] = "." + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___add_definition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_format); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_format); + __Pyx_GIVEREF(__pyx_v_format); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_66)); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_kp_s_66)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":455 + * for k in data: + * self._add_definition( format, k, data[k], "(output)" ) + * for idx,v in enumerate(data[k]): # <<<<<<<<<<<<<< + * if v == format[k].missingvalue: data[k][idx] = "." + * # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_5 = __pyx_int_0; + __pyx_t_6 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_7 = 0; __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; + } else { + __pyx_t_6 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_6) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_6; + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_t_5; + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "cvcf.pyx":456 + * self._add_definition( format, k, data[k], "(output)" ) + * for idx,v in enumerate(data[k]): + * if v == format[k].missingvalue: data[k][idx] = "." # <<<<<<<<<<<<<< + * # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string + * for k in data: + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_format, __pyx_v_k); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_RichCompare(__pyx_v_v, __pyx_t_8, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + __pyx_t_6 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyObject_SetItem(__pyx_t_6, __pyx_v_idx, ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L13; + } + __pyx_L13:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":458 + * if v == format[k].missingvalue: data[k][idx] = "." + * # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string + * for k in data: # <<<<<<<<<<<<<< + * if k != 'GT': sdata.append( (k,data[k]) ) + * sdata.sort() + */ + if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_v_data; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":459 + * # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string + * for k in data: + * if k != 'GT': sdata.append( (k,data[k]) ) # <<<<<<<<<<<<<< + * sdata.sort() + * if 'GT' in data: + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, ((PyObject *)__pyx_n_s__GT), Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + if (unlikely(__pyx_v_sdata == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyObject_GetItem(__pyx_v_data, __pyx_v_k); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_sdata, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + goto __pyx_L16; + } + __pyx_L16:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":460 + * for k in data: + * if k != 'GT': sdata.append( (k,data[k]) ) + * sdata.sort() # <<<<<<<<<<<<<< + * if 'GT' in data: + * sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata + */ + if (unlikely(__pyx_v_sdata == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'sort'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = PyList_Sort(((PyObject *)__pyx_v_sdata)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":461 + * if k != 'GT': sdata.append( (k,data[k]) ) + * sdata.sort() + * if 'GT' in data: # <<<<<<<<<<<<<< + * sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata + * for k,v in sdata: + */ + __pyx_t_3 = ((PySequence_Contains(__pyx_v_data, ((PyObject *)__pyx_n_s__GT)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + + /* "cvcf.pyx":462 + * sdata.sort() + * if 'GT' in data: + * sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata # <<<<<<<<<<<<<< + * for k,v in sdata: + * if v == []: v = None + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGTback); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__GT)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__GT)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__GT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GT)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_v_sdata)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_sdata)); + __pyx_v_sdata = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "cvcf.pyx":463 + * if 'GT' in data: + * sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata + * for k,v in sdata: # <<<<<<<<<<<<<< + * if v == []: v = None + * if key and value: + */ + if (unlikely(__pyx_v_sdata == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_sdata); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_6; + __pyx_t_6 = 0; + } else { + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "cvcf.pyx":464 + * sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata + * for k,v in sdata: + * if v == []: v = None # <<<<<<<<<<<<<< + * if key and value: + * if v != None: output.append( k+"="+','.join(map(str,v)) ) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_6 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = Py_None; + goto __pyx_L20; + } + __pyx_L20:; + + /* "cvcf.pyx":465 + * for k,v in sdata: + * if v == []: v = None + * if key and value: # <<<<<<<<<<<<<< + * if v != None: output.append( k+"="+','.join(map(str,v)) ) + * else: output.append( k ) + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_key); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_t_10; + } else { + __pyx_t_11 = __pyx_t_3; + } + if (__pyx_t_11) { + + /* "cvcf.pyx":466 + * if v == []: v = None + * if key and value: + * if v != None: output.append( k+"="+','.join(map(str,v)) ) # <<<<<<<<<<<<<< + * else: output.append( k ) + * elif key: output.append(k) + */ + __pyx_t_6 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_11) { + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = PyNumber_Add(__pyx_v_k, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_8 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L22; + } + /*else*/ { + + /* "cvcf.pyx":467 + * if key and value: + * if v != None: output.append( k+"="+','.join(map(str,v)) ) + * else: output.append( k ) # <<<<<<<<<<<<<< + * elif key: output.append(k) + * elif value: + */ + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L22:; + goto __pyx_L21; + } + + /* "cvcf.pyx":468 + * if v != None: output.append( k+"="+','.join(map(str,v)) ) + * else: output.append( k ) + * elif key: output.append(k) # <<<<<<<<<<<<<< + * elif value: + * if v != None: output.append( ','.join(map(str,v)) ) + */ + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_key); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_11) { + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_v_k); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L21; + } + + /* "cvcf.pyx":469 + * else: output.append( k ) + * elif key: output.append(k) + * elif value: # <<<<<<<<<<<<<< + * if v != None: output.append( ','.join(map(str,v)) ) + * else: output.append( "." ) # should not happen + */ + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_11) { + + /* "cvcf.pyx":470 + * elif key: output.append(k) + * elif value: + * if v != None: output.append( ','.join(map(str,v)) ) # <<<<<<<<<<<<<< + * else: output.append( "." ) # should not happen + * # snip off trailing missing data + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_11) { + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_6 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_9 = PyList_Append(__pyx_v_output, __pyx_t_6); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L23; + } + /*else*/ { + + /* "cvcf.pyx":471 + * elif value: + * if v != None: output.append( ','.join(map(str,v)) ) + * else: output.append( "." ) # should not happen # <<<<<<<<<<<<<< + * # snip off trailing missing data + * while len(output) > 1: + */ + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_9 = PyList_Append(__pyx_v_output, ((PyObject *)__pyx_kp_s_9)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L23:; + goto __pyx_L21; + } + __pyx_L21:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":473 + * else: output.append( "." ) # should not happen + * # snip off trailing missing data + * while len(output) > 1: # <<<<<<<<<<<<<< + * last = output[-1].replace(',','').replace('.','') + * if len(last)>0: break + */ + while (1) { + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_output)); + __pyx_t_11 = (__pyx_t_4 > 1); + if (!__pyx_t_11) break; + + /* "cvcf.pyx":474 + * # snip off trailing missing data + * while len(output) > 1: + * last = output[-1].replace(',','').replace('.','') # <<<<<<<<<<<<<< + * if len(last)>0: break + * output = output[:-1] + */ + __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_output), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__replace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__replace); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_last); + __pyx_v_last = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":475 + * while len(output) > 1: + * last = output[-1].replace(',','').replace('.','') + * if len(last)>0: break # <<<<<<<<<<<<<< + * output = output[:-1] + * return separator.join(output) + */ + __pyx_t_4 = PyObject_Length(__pyx_v_last); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__pyx_t_4 > 0); + if (__pyx_t_11) { + goto __pyx_L25_break; + goto __pyx_L26; + } + __pyx_L26:; + + /* "cvcf.pyx":476 + * last = output[-1].replace(',','').replace('.','') + * if len(last)>0: break + * output = output[:-1] # <<<<<<<<<<<<<< + * return separator.join(output) + * + */ + __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_output), 0, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_v_output)); + __pyx_v_output = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_L25_break:; + + /* "cvcf.pyx":477 + * if len(last)>0: break + * output = output[:-1] + * return separator.join(output) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_separator, __pyx_n_s__join); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_output)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); + __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cvcf.VCF.format_formatdata"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_output); + __Pyx_DECREF(__pyx_v_sdata); + __Pyx_DECREF(__pyx_v_d); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_idx); + __Pyx_DECREF(__pyx_v_v); + __Pyx_DECREF(__pyx_v_last); + __Pyx_DECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":480 + * + * + * def enter_default_format(self): # <<<<<<<<<<<<<< + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_7enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_7enter_default_format = {__Pyx_NAMESTR("enter_default_format"), (PyCFunction)__pyx_pf_4cvcf_3VCF_7enter_default_format, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_7enter_default_format(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_f; + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + __Pyx_RefNannySetupContext("enter_default_format"); + __pyx_self = __pyx_self; + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":481 + * + * def enter_default_format(self): + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), # <<<<<<<<<<<<<< + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__GT)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__GT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GT)); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__String)); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_n_s__String)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__String)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Genotype)); + PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_n_s__Genotype)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Genotype)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + + /* "cvcf.pyx":482 + * def enter_default_format(self): + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), # <<<<<<<<<<<<<< + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + * FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid + */ + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__GQ)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__GQ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__GQ)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer)); + PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_n_s__Integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_69)); + PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_kp_s_69)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_69)); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "cvcf.pyx":483 + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), # <<<<<<<<<<<<<< + * FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid + * FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__DP)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s__DP)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DP)); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer)); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_n_s__Integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_70)); + PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_kp_s_70)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_70)); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + + /* "cvcf.pyx":484 + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + * FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid # <<<<<<<<<<<<<< + * FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: + * if f.id not in self._format: + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_UNKNOWN); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__HQ)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__HQ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HQ)); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Integer)); + PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s__Integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Integer)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_71)); + PyTuple_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_kp_s_71)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_71)); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + + /* "cvcf.pyx":485 + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + * FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid + * FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: # <<<<<<<<<<<<<< + * if f.id not in self._format: + * self._format[f.id] = f + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__FORMAT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__NT_NUMBER); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyTuple_New(6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FT)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_n_s__FT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FT)); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__String)); + PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_n_s__String)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__String)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_72)); + PyTuple_SET_ITEM(__pyx_t_8, 4, ((PyObject *)__pyx_kp_s_72)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_72)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_8, 5, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyList_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyList_SET_ITEM(__pyx_t_8, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyList_SET_ITEM(__pyx_t_8, 4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = 0; __pyx_t_6 = ((PyObject *)__pyx_t_8); __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + for (;;) { + + /* "cvcf.pyx":481 + * + * def enter_default_format(self): + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), # <<<<<<<<<<<<<< + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + * FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + */ + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_8); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_8; + __pyx_t_8 = 0; + + /* "cvcf.pyx":486 + * FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid + * FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: + * if f.id not in self._format: # <<<<<<<<<<<<<< + * self._format[f.id] = f + * + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_5, __pyx_t_8))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_9) { + + /* "cvcf.pyx":487 + * FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: + * if f.id not in self._format: + * self._format[f.id] = f # <<<<<<<<<<<<<< + * + * def parse_header( self, line ): + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyObject_SetItem(__pyx_t_5, __pyx_t_8, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7; + } + __pyx_L7:; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("cvcf.VCF.enter_default_format"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":489 + * self._format[f.id] = f + * + * def parse_header( self, line ): # <<<<<<<<<<<<<< + * assert line.startswith('##') + * elts = line[2:].split('=') + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_8parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_8parse_header = {__Pyx_NAMESTR("parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_8parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_8parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_elts; + PyObject *__pyx_v_key; + PyObject *__pyx_v_value; + PyObject *__pyx_v_f; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0}; + __Pyx_RefNannySetupContext("parse_header"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_header") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse_header"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":490 + * + * def parse_header( self, line ): + * assert line.startswith('##') # <<<<<<<<<<<<<< + * elts = line[2:].split('=') + * key = elts[0].strip() + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "cvcf.pyx":491 + * def parse_header( self, line ): + * assert line.startswith('##') + * elts = line[2:].split('=') # <<<<<<<<<<<<<< + * key = elts[0].strip() + * value = '='.join(elts[1:]).strip() + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":492 + * assert line.startswith('##') + * elts = line[2:].split('=') + * key = elts[0].strip() # <<<<<<<<<<<<<< + * value = '='.join(elts[1:]).strip() + * if key == "fileformat": + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":493 + * elts = line[2:].split('=') + * key = elts[0].strip() + * value = '='.join(elts[1:]).strip() # <<<<<<<<<<<<<< + * if key == "fileformat": + * if value == "VCFv3.3": + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_elts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":494 + * key = elts[0].strip() + * value = '='.join(elts[1:]).strip() + * if key == "fileformat": # <<<<<<<<<<<<<< + * if value == "VCFv3.3": + * self._version = 33 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__fileformat), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":495 + * value = '='.join(elts[1:]).strip() + * if key == "fileformat": + * if value == "VCFv3.3": # <<<<<<<<<<<<<< + * self._version = 33 + * elif value == "VCFv4.0": + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_76), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":496 + * if key == "fileformat": + * if value == "VCFv3.3": + * self._version = 33 # <<<<<<<<<<<<<< + * elif value == "VCFv4.0": + * self._version = 40 + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_int_33) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + + /* "cvcf.pyx":497 + * if value == "VCFv3.3": + * self._version = 33 + * elif value == "VCFv4.0": # <<<<<<<<<<<<<< + * self._version = 40 + * elif value == "VCFv4.1": + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_77), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":498 + * self._version = 33 + * elif value == "VCFv4.0": + * self._version = 40 # <<<<<<<<<<<<<< + * elif value == "VCFv4.1": + * # AH - for testing + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + + /* "cvcf.pyx":499 + * elif value == "VCFv4.0": + * self._version = 40 + * elif value == "VCFv4.1": # <<<<<<<<<<<<<< + * # AH - for testing + * self._version = 40 + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, ((PyObject *)__pyx_kp_s_78), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":501 + * elif value == "VCFv4.1": + * # AH - for testing + * self._version = 40 # <<<<<<<<<<<<<< + * else: + * self.error(line,self.UNKNOWN_FORMAT_STRING) + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + /*else*/ { + + /* "cvcf.pyx":503 + * self._version = 40 + * else: + * self.error(line,self.UNKNOWN_FORMAT_STRING) # <<<<<<<<<<<<<< + * elif key == "INFO": + * f = self.parse_format(line, value) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_79); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L7:; + goto __pyx_L6; + } + + /* "cvcf.pyx":504 + * else: + * self.error(line,self.UNKNOWN_FORMAT_STRING) + * elif key == "INFO": # <<<<<<<<<<<<<< + * f = self.parse_format(line, value) + * self._info[ f.id ] = f + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__INFO), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":505 + * self.error(line,self.UNKNOWN_FORMAT_STRING) + * elif key == "INFO": + * f = self.parse_format(line, value) # <<<<<<<<<<<<<< + * self._info[ f.id ] = f + * elif key == "FILTER": + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":506 + * elif key == "INFO": + * f = self.parse_format(line, value) + * self._info[ f.id ] = f # <<<<<<<<<<<<<< + * elif key == "FILTER": + * f = self.parse_format(line, value, filter=True) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_t_1, __pyx_t_2, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L6; + } + + /* "cvcf.pyx":507 + * f = self.parse_format(line, value) + * self._info[ f.id ] = f + * elif key == "FILTER": # <<<<<<<<<<<<<< + * f = self.parse_format(line, value, filter=True) + * self._filter[ f.id ] = f + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":508 + * self._info[ f.id ] = f + * elif key == "FILTER": + * f = self.parse_format(line, value, filter=True) # <<<<<<<<<<<<<< + * self._filter[ f.id ] = f + * elif key == "FORMAT": + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__filter), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":509 + * elif key == "FILTER": + * f = self.parse_format(line, value, filter=True) + * self._filter[ f.id ] = f # <<<<<<<<<<<<<< + * elif key == "FORMAT": + * f = self.parse_format(line, value) + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyObject_SetItem(__pyx_t_5, __pyx_t_4, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L6; + } + + /* "cvcf.pyx":510 + * f = self.parse_format(line, value, filter=True) + * self._filter[ f.id ] = f + * elif key == "FORMAT": # <<<<<<<<<<<<<< + * f = self.parse_format(line, value) + * self._format[ f.id ] = f + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_key, ((PyObject *)__pyx_n_s__FORMAT), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":511 + * self._filter[ f.id ] = f + * elif key == "FORMAT": + * f = self.parse_format(line, value) # <<<<<<<<<<<<<< + * self._format[ f.id ] = f + * else: + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":512 + * elif key == "FORMAT": + * f = self.parse_format(line, value) + * self._format[ f.id ] = f # <<<<<<<<<<<<<< + * else: + * # keep other keys in the header field + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (PyObject_SetItem(__pyx_t_1, __pyx_t_5, __pyx_v_f) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6; + } + /*else*/ { + + /* "cvcf.pyx":515 + * else: + * # keep other keys in the header field + * self._header.append( (key,value) ) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_4 = __Pyx_PyObject_Append(__pyx_t_5, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_L6:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.parse_header"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_elts); + __Pyx_DECREF(__pyx_v_key); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":518 + * + * + * def write_header( self, stream ): # <<<<<<<<<<<<<< + * stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_9write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_9write_header = {__Pyx_NAMESTR("write_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_9write_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_9write_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_key; + PyObject *__pyx_v_value; + PyObject *__pyx_v_var; + PyObject *__pyx_v_label; + PyObject *__pyx_v_f; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("write_header"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_header") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.write_header"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_var = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_label = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":519 + * + * def write_header( self, stream ): + * stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) # <<<<<<<<<<<<<< + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + * for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_FloorDivide(__pyx_t_2, __pyx_int_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Remainder(__pyx_t_2, __pyx_int_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_80), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":520 + * def write_header( self, stream ): + * stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) # <<<<<<<<<<<<<< + * for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]: + * for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER")))) + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + if (PyTuple_CheckExact(__pyx_t_4) && likely(PyTuple_GET_SIZE(__pyx_t_4) == 2)) { + PyObject* tuple = __pyx_t_4; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_t_4 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":521 + * stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + * for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]: # <<<<<<<<<<<<<< + * for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER")))) + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__INFO)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__INFO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INFO)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FILTER)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__FILTER)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FILTER)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__FORMAT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT)); + __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; __pyx_t_4 = ((PyObject *)__pyx_t_2); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_var); + __pyx_v_var = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_label); + __pyx_v_label = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_var); + __pyx_v_var = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_label); + __pyx_v_label = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "cvcf.pyx":522 + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + * for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]: + * for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER")))) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_var, __pyx_n_s__itervalues); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_7 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_9 = PyObject_RichCompare(__pyx_v_label, ((PyObject *)__pyx_n_s__FILTER), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__filter), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_label); + __Pyx_GIVEREF(__pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_81), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("cvcf.VCF.write_header"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_key); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_var); + __Pyx_DECREF(__pyx_v_label); + __Pyx_DECREF(__pyx_v_f); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":525 + * + * + * def parse_heading( self, line ): # <<<<<<<<<<<<<< + * assert line.startswith('#') + * assert not line.startswith('##') + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_10parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_10parse_heading = {__Pyx_NAMESTR("parse_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_10parse_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_10parse_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_headings; + PyObject *__pyx_v_i; + PyObject *__pyx_v_s; + PyObject *__pyx_v_err; + PyObject *__pyx_v_x; + PyObject *__pyx_v_y; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,0}; + __Pyx_RefNannySetupContext("parse_heading"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_heading") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse_heading", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse_heading"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_headings = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_err = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_x = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_y = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":526 + * + * def parse_heading( self, line ): + * assert line.startswith('#') # <<<<<<<<<<<<<< + * assert not line.startswith('##') + * headings = line[1:].split('\t') + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "cvcf.pyx":527 + * def parse_heading( self, line ): + * assert line.startswith('#') + * assert not line.startswith('##') # <<<<<<<<<<<<<< + * headings = line[1:].split('\t') + * if len(headings)==1 and len(line[1:].split()) >= 9: + */ + #ifndef CYTHON_WITHOUT_ASSERTIONS + __pyx_t_2 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!(!__pyx_t_3))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #endif + + /* "cvcf.pyx":528 + * assert line.startswith('#') + * assert not line.startswith('##') + * headings = line[1:].split('\t') # <<<<<<<<<<<<<< + * if len(headings)==1 and len(line[1:].split()) >= 9: + * self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) + */ + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_headings); + __pyx_v_headings = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":529 + * assert not line.startswith('##') + * headings = line[1:].split('\t') + * if len(headings)==1 and len(line[1:].split()) >= 9: # <<<<<<<<<<<<<< + * self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) + * headings = line[1:].split() + */ + __pyx_t_4 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_4 == 1); + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = (__pyx_t_4 >= 9); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { + + /* "cvcf.pyx":530 + * headings = line[1:].split('\t') + * if len(headings)==1 and len(line[1:].split()) >= 9: + * self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) # <<<<<<<<<<<<<< + * headings = line[1:].split() + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_87); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":531 + * if len(headings)==1 and len(line[1:].split()) >= 9: + * self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) + * headings = line[1:].split() # <<<<<<<<<<<<<< + * + * for i,s in enumerate(self._required): + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_headings); + __pyx_v_headings = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":533 + * headings = line[1:].split() + * + * for i,s in enumerate(self._required): # <<<<<<<<<<<<<< + * + * if len(headings)<=i or headings[i] != s: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___required); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_7; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else { + __pyx_t_7 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_7) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "cvcf.pyx":535 + * for i,s in enumerate(self._required): + * + * if len(headings)<=i or headings[i] != s: # <<<<<<<<<<<<<< + * + * if len(headings) <= i: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (!__pyx_t_6) { + __pyx_t_9 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_9, __pyx_v_s, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_6; + } + if (__pyx_t_5) { + + /* "cvcf.pyx":537 + * if len(headings)<=i or headings[i] != s: + * + * if len(headings) <= i: # <<<<<<<<<<<<<< + * err = "(%sth entry not found)" % (i+1) + * else: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_v_i, Py_LE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":538 + * + * if len(headings) <= i: + * err = "(%sth entry not found)" % (i+1) # <<<<<<<<<<<<<< + * else: + * err = "(found %s, expected %s)" % (headings[i],s) + */ + __pyx_t_9 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_88), __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_err); + __pyx_v_err = ((PyObject *)__pyx_t_7); + __pyx_t_7 = 0; + goto __pyx_L10; + } + /*else*/ { + + /* "cvcf.pyx":540 + * err = "(%sth entry not found)" % (i+1) + * else: + * err = "(found %s, expected %s)" % (headings[i],s) # <<<<<<<<<<<<<< + * + * #self.error(line,self.BADLY_FORMATTED_HEADING,err) + */ + __pyx_t_7 = PyObject_GetItem(__pyx_v_headings, __pyx_v_i); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_s); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_s); + __Pyx_GIVEREF(__pyx_v_s); + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_89), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_err); + __pyx_v_err = ((PyObject *)__pyx_t_7); + __pyx_t_7 = 0; + } + __pyx_L10:; + + /* "cvcf.pyx":545 + * + * # allow FORMAT column to be absent + * if len(headings) == 8: # <<<<<<<<<<<<<< + * headings.append("FORMAT") + * else: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_headings); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_8 == 8); + if (__pyx_t_5) { + + /* "cvcf.pyx":546 + * # allow FORMAT column to be absent + * if len(headings) == 8: + * headings.append("FORMAT") # <<<<<<<<<<<<<< + * else: + * self.error(line,self.BADLY_FORMATTED_HEADING,err) + */ + __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_headings, ((PyObject *)__pyx_n_s__FORMAT)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L11; + } + /*else*/ { + + /* "cvcf.pyx":548 + * headings.append("FORMAT") + * else: + * self.error(line,self.BADLY_FORMATTED_HEADING,err) # <<<<<<<<<<<<<< + * + * self._samples = headings[9:] + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_90); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_err); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_err); + __Pyx_GIVEREF(__pyx_v_err); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_L11:; + goto __pyx_L9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":550 + * self.error(line,self.BADLY_FORMATTED_HEADING,err) + * + * self._samples = headings[9:] # <<<<<<<<<<<<<< + * self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] ) + * + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_headings, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":551 + * + * self._samples = headings[9:] + * self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] ) # <<<<<<<<<<<<<< + * + * def write_heading( self, stream ): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_4 = 0; __pyx_t_10 = __pyx_t_9; __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; + } else { + __pyx_t_9 = PyIter_Next(__pyx_t_10); + if (!__pyx_t_9) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_v_y); + __pyx_v_y = __pyx_t_9; + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_1; + __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_9; + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_v_x, __pyx_int_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_y); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_y); + __Pyx_GIVEREF(__pyx_v_y); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___sample2column, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("cvcf.VCF.parse_heading"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_headings); + __Pyx_DECREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_s); + __Pyx_DECREF(__pyx_v_err); + __Pyx_DECREF(__pyx_v_x); + __Pyx_DECREF(__pyx_v_y); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":553 + * self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] ) + * + * def write_heading( self, stream ): # <<<<<<<<<<<<<< + * stream.write("#" + "\t".join(self._required + self._samples) + "\n") + * + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_11write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_11write_heading = {__Pyx_NAMESTR("write_heading"), (PyCFunction)__pyx_pf_4cvcf_3VCF_11write_heading, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_11write_heading(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("write_heading"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_heading", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_heading") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_heading", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.write_heading"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":554 + * + * def write_heading( self, stream ): + * stream.write("#" + "\t".join(self._required + self._samples) + "\n") # <<<<<<<<<<<<<< + * + * def convertGT(self, GTstring): + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_85), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___required); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_82), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_91)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.write_heading"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":556 + * stream.write("#" + "\t".join(self._required + self._samples) + "\n") + * + * def convertGT(self, GTstring): # <<<<<<<<<<<<<< + * if GTstring == ".": return ["."] + * try: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_12convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_12convertGT = {__Pyx_NAMESTR("convertGT"), (PyCFunction)__pyx_pf_4cvcf_3VCF_12convertGT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_12convertGT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_GTstring = 0; + PyObject *__pyx_v_gts; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTstring,0}; + __Pyx_RefNannySetupContext("convertGT"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTstring); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("convertGT", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "convertGT") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_GTstring = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_GTstring = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("convertGT", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.convertGT"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_gts = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":557 + * + * def convertGT(self, GTstring): + * if GTstring == ".": return ["."] # <<<<<<<<<<<<<< + * try: + * gts = gtsRegEx.split(GTstring) + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_GTstring, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":558 + * def convertGT(self, GTstring): + * if GTstring == ".": return ["."] + * try: # <<<<<<<<<<<<<< + * gts = gtsRegEx.split(GTstring) + * if len(gts) == 1: return [int(gts[0])] + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "cvcf.pyx":559 + * if GTstring == ".": return ["."] + * try: + * gts = gtsRegEx.split(GTstring) # <<<<<<<<<<<<<< + * if len(gts) == 1: return [int(gts[0])] + * if len(gts) != 2: raise ValueError() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gtsRegEx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_GTstring); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_GTstring); + __Pyx_GIVEREF(__pyx_v_GTstring); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_gts); + __pyx_v_gts = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":560 + * try: + * gts = gtsRegEx.split(GTstring) + * if len(gts) == 1: return [int(gts[0])] # <<<<<<<<<<<<<< + * if len(gts) != 2: raise ValueError() + * if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] + */ + __pyx_t_5 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = (__pyx_t_5 == 1); + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L11_try_return; + goto __pyx_L15; + } + __pyx_L15:; + + /* "cvcf.pyx":561 + * gts = gtsRegEx.split(GTstring) + * if len(gts) == 1: return [int(gts[0])] + * if len(gts) != 2: raise ValueError() # <<<<<<<<<<<<<< + * if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] + * return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] + */ + __pyx_t_5 = PyObject_Length(__pyx_v_gts); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __pyx_t_2 = (__pyx_t_5 != 2); + if (__pyx_t_2) { + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + goto __pyx_L16; + } + __pyx_L16:; + + /* "cvcf.pyx":562 + * if len(gts) == 1: return [int(gts[0])] + * if len(gts) != 2: raise ValueError() + * if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] # <<<<<<<<<<<<<< + * return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] + * except ValueError: + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_2; + } + if (__pyx_t_7) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_5, (-__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_9); + __pyx_t_9 = 0; + goto __pyx_L11_try_return; + goto __pyx_L17; + } + __pyx_L17:; + + /* "cvcf.pyx":563 + * if len(gts) != 2: raise ValueError() + * if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] + * return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] # <<<<<<<<<<<<<< + * except ValueError: + * self.error(self._line,self.BAD_GENOTYPE,GTstring) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_GTstring, __pyx_t_8, (-__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L7_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_9 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L11_try_return; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L14_try_end; + __pyx_L11_try_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":564 + * if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] + * return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] + * except ValueError: # <<<<<<<<<<<<<< + * self.error(self._line,self.BAD_GENOTYPE,GTstring) + * return [".","|","."] + */ + __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_10) { + __Pyx_AddTraceback("cvcf.VCF.convertGT"); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + + /* "cvcf.pyx":565 + * return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] + * except ValueError: + * self.error(self._line,self.BAD_GENOTYPE,GTstring) # <<<<<<<<<<<<<< + * return [".","|","."] + * + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___line); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__BAD_GENOTYPE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_GTstring); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_GTstring); + __Pyx_GIVEREF(__pyx_v_GTstring); + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":566 + * except ValueError: + * self.error(self._line,self.BAD_GENOTYPE,GTstring) + * return [".","|","."] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyList_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_92)); + PyList_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_kp_s_92)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyList_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_r = ((PyObject *)__pyx_t_12); + __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L10_except_return; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L10_except_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L8_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L14_try_end:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("cvcf.VCF.convertGT"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_gts); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":569 + * + * + * def convertGTback(self, GTdata): # <<<<<<<<<<<<<< + * return ''.join(map(str,GTdata)) + * + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_13convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_13convertGTback = {__Pyx_NAMESTR("convertGTback"), (PyCFunction)__pyx_pf_4cvcf_3VCF_13convertGTback, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_13convertGTback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_GTdata = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__GTdata,0}; + __Pyx_RefNannySetupContext("convertGTback"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__GTdata); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("convertGTback", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "convertGTback") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_GTdata = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_GTdata = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("convertGTback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.convertGTback"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":570 + * + * def convertGTback(self, GTdata): + * return ''.join(map(str,GTdata)) # <<<<<<<<<<<<<< + * + * def parse_formatdata( self, key, value, formatdict, line ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type)))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type)))); + __Pyx_INCREF(__pyx_v_GTdata); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_GTdata); + __Pyx_GIVEREF(__pyx_v_GTdata); + __pyx_t_3 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCF.convertGTback"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":572 + * return ''.join(map(str,GTdata)) + * + * def parse_formatdata( self, key, value, formatdict, line ): # <<<<<<<<<<<<<< + * # To do: check that the right number of values is present + * f = formatdict.get(key,None) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_14parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_14parse_formatdata = {__Pyx_NAMESTR("parse_formatdata"), (PyCFunction)__pyx_pf_4cvcf_3VCF_14parse_formatdata, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_14parse_formatdata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_key = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_formatdict = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_f; + PyObject *__pyx_v_values; + PyObject *__pyx_v_idx; + PyObject *__pyx_v_v; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + Py_ssize_t __pyx_t_14; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__key,&__pyx_n_s__value,&__pyx_n_s__formatdict,&__pyx_n_s__line,0}; + __Pyx_RefNannySetupContext("parse_formatdata"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__formatdict); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_formatdata") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_key = values[1]; + __pyx_v_value = values[2]; + __pyx_v_formatdict = values[3]; + __pyx_v_line = values[4]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_value = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_formatdict = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 4); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse_formatdata", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse_formatdata"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_values = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_idx = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":574 + * def parse_formatdata( self, key, value, formatdict, line ): + * # To do: check that the right number of values is present + * f = formatdict.get(key,None) # <<<<<<<<<<<<<< + * if f == None: + * self._add_definition(formatdict, key, value, line ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_formatdict, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __Pyx_INCREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); + __Pyx_GIVEREF(Py_None); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":575 + * # To do: check that the right number of values is present + * f = formatdict.get(key,None) + * if f == None: # <<<<<<<<<<<<<< + * self._add_definition(formatdict, key, value, line ) + * f = formatdict[key] + */ + __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":576 + * f = formatdict.get(key,None) + * if f == None: + * self._add_definition(formatdict, key, value, line ) # <<<<<<<<<<<<<< + * f = formatdict[key] + * if f.type == "Flag": + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___add_definition); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_formatdict); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_formatdict); + __Pyx_GIVEREF(__pyx_v_formatdict); + __Pyx_INCREF(__pyx_v_key); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_key); + __Pyx_GIVEREF(__pyx_v_key); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":577 + * if f == None: + * self._add_definition(formatdict, key, value, line ) + * f = formatdict[key] # <<<<<<<<<<<<<< + * if f.type == "Flag": + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_formatdict, __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":578 + * self._add_definition(formatdict, key, value, line ) + * f = formatdict[key] + * if f.type == "Flag": # <<<<<<<<<<<<<< + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + * return [] + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__Flag), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":579 + * f = formatdict[key] + * if f.type == "Flag": + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) # <<<<<<<<<<<<<< + * return [] + * values = value.split(',') + */ + __pyx_t_4 = (__pyx_v_value != Py_None); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_93); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "cvcf.pyx":580 + * if f.type == "Flag": + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + * return [] # <<<<<<<<<<<<<< + * values = value.split(',') + * # deal with trailing data in some early VCF files + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "cvcf.pyx":581 + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + * return [] + * values = value.split(',') # <<<<<<<<<<<<<< + * # deal with trailing data in some early VCF files + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_94), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_values); + __pyx_v_values = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":583 + * values = value.split(',') + * # deal with trailing data in some early VCF files + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: # <<<<<<<<<<<<<< + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + * values[-1] = values[-1].split(';')[0] + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __pyx_t_4; + if (!__pyx_t_5) { + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_4; + __pyx_t_4 = __pyx_t_6; + } else { + __pyx_t_4 = __pyx_t_5; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __pyx_t_4; + if (__pyx_t_5) { + __pyx_t_7 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_7 > 0); + if (__pyx_t_4) { + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__find); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_neg_1, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __pyx_t_6; + } else { + __pyx_t_8 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_8; + } else { + __pyx_t_4 = __pyx_t_5; + } + if (__pyx_t_4) { + + /* "cvcf.pyx":584 + * # deal with trailing data in some early VCF files + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) # <<<<<<<<<<<<<< + * values[-1] = values[-1].split(';')[0] + * if f.type == "Integer": + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_TRAILING_DATA); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":585 + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + * values[-1] = values[-1].split(';')[0] # <<<<<<<<<<<<<< + * if f.type == "Integer": + * for idx,v in enumerate(values): + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemInt(__pyx_v_values, -1, __pyx_t_9, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":586 + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + * values[-1] = values[-1].split(';')[0] + * if f.type == "Integer": # <<<<<<<<<<<<<< + * for idx,v in enumerate(values): + * try: + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Integer), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":587 + * values[-1] = values[-1].split(';')[0] + * if f.type == "Integer": + * for idx,v in enumerate(values): # <<<<<<<<<<<<<< + * try: + * if v == ".": values[idx] = f.missingvalue + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) { + __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_t_2; + __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":588 + * if f.type == "Integer": + * for idx,v in enumerate(values): + * try: # <<<<<<<<<<<<<< + * if v == ".": values[idx] = f.missingvalue + * else: values[idx] = int(v) + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "cvcf.pyx":589 + * for idx,v in enumerate(values): + * try: + * if v == ".": values[idx] = f.missingvalue # <<<<<<<<<<<<<< + * else: values[idx] = int(v) + * except: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L21; + } + /*else*/ { + + /* "cvcf.pyx":590 + * try: + * if v == ".": values[idx] = f.missingvalue + * else: values[idx] = int(v) # <<<<<<<<<<<<<< + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L21:; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L20_try_end; + __pyx_L13_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":591 + * if v == ".": values[idx] = f.missingvalue + * else: values[idx] = int(v) + * except: # <<<<<<<<<<<<<< + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + * return [0] * len(values) + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.VCF.parse_formatdata"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_10); + + /* "cvcf.pyx":592 + * else: values[idx] = int(v) + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) # <<<<<<<<<<<<<< + * return [0] * len(values) + * return values + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_97); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_values); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_values); + __Pyx_GIVEREF(__pyx_v_values); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":593 + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + * return [0] * len(values) # <<<<<<<<<<<<<< + * return values + * elif f.type == "String": + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_14 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_11 = PyNumber_Multiply(((PyObject *)__pyx_t_12), __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_r = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L16_except_return; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L14_exception_handled; + } + __pyx_L15_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L16_except_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L14_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L20_try_end:; + } + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":594 + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + * return [0] * len(values) + * return values # <<<<<<<<<<<<<< + * elif f.type == "String": + * self._line = line + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_values); + __pyx_r = __pyx_v_values; + goto __pyx_L0; + goto __pyx_L10; + } + + /* "cvcf.pyx":595 + * return [0] * len(values) + * return values + * elif f.type == "String": # <<<<<<<<<<<<<< + * self._line = line + * if f.id == "GT": values = map( self.convertGT, values ) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__String), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":596 + * return values + * elif f.type == "String": + * self._line = line # <<<<<<<<<<<<<< + * if f.id == "GT": values = map( self.convertGT, values ) + * return values + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___line, __pyx_v_line) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":597 + * elif f.type == "String": + * self._line = line + * if f.id == "GT": values = map( self.convertGT, values ) # <<<<<<<<<<<<<< + * return values + * elif f.type == "Character": + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__id); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__GT), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__convertGT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_values); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_values); + __Pyx_GIVEREF(__pyx_v_values); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_values); + __pyx_v_values = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L24; + } + __pyx_L24:; + + /* "cvcf.pyx":598 + * self._line = line + * if f.id == "GT": values = map( self.convertGT, values ) + * return values # <<<<<<<<<<<<<< + * elif f.type == "Character": + * for v in values: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_values); + __pyx_r = __pyx_v_values; + goto __pyx_L0; + goto __pyx_L10; + } + + /* "cvcf.pyx":599 + * if f.id == "GT": values = map( self.convertGT, values ) + * return values + * elif f.type == "Character": # <<<<<<<<<<<<<< + * for v in values: + * if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__Character), Py_EQ); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":600 + * return values + * elif f.type == "Character": + * for v in values: # <<<<<<<<<<<<<< + * if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) + * return values + */ + if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) { + __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":601 + * elif f.type == "Character": + * for v in values: + * if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) # <<<<<<<<<<<<<< + * return values + * elif f.type == "Float": + */ + __pyx_t_14 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_14 != 1); + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_98); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L27; + } + __pyx_L27:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "cvcf.pyx":602 + * for v in values: + * if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) + * return values # <<<<<<<<<<<<<< + * elif f.type == "Float": + * for idx,v in enumerate(values): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_values); + __pyx_r = __pyx_v_values; + goto __pyx_L0; + goto __pyx_L10; + } + + /* "cvcf.pyx":603 + * if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) + * return values + * elif f.type == "Float": # <<<<<<<<<<<<<< + * for idx,v in enumerate(values): + * if v == ".": values[idx] = f.missingvalue + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, ((PyObject *)__pyx_n_s__Float), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_4) { + + /* "cvcf.pyx":604 + * return values + * elif f.type == "Float": + * for idx,v in enumerate(values): # <<<<<<<<<<<<<< + * if v == ".": values[idx] = f.missingvalue + * try: return map(float,values) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_10 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_values) || PyTuple_CheckExact(__pyx_v_values)) { + __pyx_t_7 = 0; __pyx_t_9 = __pyx_v_values; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_7 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_10); + __Pyx_DECREF(__pyx_v_idx); + __pyx_v_idx = __pyx_t_10; + __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); + __pyx_t_10 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":605 + * elif f.type == "Float": + * for idx,v in enumerate(values): + * if v == ".": values[idx] = f.missingvalue # <<<<<<<<<<<<<< + * try: return map(float,values) + * except: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_v, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__missingvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_v_values, __pyx_v_idx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L30; + } + __pyx_L30:; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "cvcf.pyx":606 + * for idx,v in enumerate(values): + * if v == ".": values[idx] = f.missingvalue + * try: return map(float,values) # <<<<<<<<<<<<<< + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L31_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type)))); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)((PyObject*)(&PyFloat_Type)))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type)))); + __Pyx_INCREF(__pyx_v_values); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_values); + __Pyx_GIVEREF(__pyx_v_values); + __pyx_t_9 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L31_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L35_try_return; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L38_try_end; + __pyx_L35_try_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L31_error:; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "cvcf.pyx":607 + * if v == ".": values[idx] = f.missingvalue + * try: return map(float,values) + * except: # <<<<<<<<<<<<<< + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + * return [0.0] * len(values) + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.VCF.parse_formatdata"); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_1); + + /* "cvcf.pyx":608 + * try: return map(float,values) + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) # <<<<<<<<<<<<<< + * return [0.0] * len(values) + * else: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_97); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_values); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_values); + __Pyx_GIVEREF(__pyx_v_values); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":609 + * except: + * self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + * return [0.0] * len(values) # <<<<<<<<<<<<<< + * else: + * # can't happen + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = PyList_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_7 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_t_11), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L34_except_return; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L32_exception_handled; + } + __pyx_L33_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L34_except_return:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L0; + __pyx_L32_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L38_try_end:; + } + goto __pyx_L10; + } + /*else*/ { + + /* "cvcf.pyx":612 + * else: + * # can't happen + * self.error(line,self.ERROR_INFO_STRING) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __pyx_L10:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("cvcf.VCF.parse_formatdata"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_values); + __Pyx_DECREF(__pyx_v_idx); + __Pyx_DECREF(__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":615 + * + * + * def inregion(self, chrom, pos): # <<<<<<<<<<<<<< + * if not self._regions: return True + * for r in self._regions: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_15inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_15inregion = {__Pyx_NAMESTR("inregion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_15inregion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_15inregion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_chrom = 0; + PyObject *__pyx_v_pos = 0; + PyObject *__pyx_v_r; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__chrom,&__pyx_n_s__pos,0}; + __Pyx_RefNannySetupContext("inregion"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "inregion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_chrom = values[1]; + __pyx_v_pos = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_chrom = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_pos = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("inregion", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.inregion"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_r = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":616 + * + * def inregion(self, chrom, pos): + * if not self._regions: return True # <<<<<<<<<<<<<< + * for r in self._regions: + * if r[0] == chrom and r[1] <= pos < r[2]: return True + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___regions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":617 + * def inregion(self, chrom, pos): + * if not self._regions: return True + * for r in self._regions: # <<<<<<<<<<<<<< + * if r[0] == chrom and r[1] <= pos < r[2]: return True + * return False + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___regions); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_4 = 0; __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_r); + __pyx_v_r = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":618 + * if not self._regions: return True + * for r in self._regions: + * if r[0] == chrom and r[1] <= pos < r[2]: return True # <<<<<<<<<<<<<< + * return False + * + */ + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_r, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_v_chrom, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_3) { + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_r, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_v_pos, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_IsTrue(__pyx_t_1)) { + __Pyx_DECREF(__pyx_t_1); + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_r, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos, __pyx_t_7, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __pyx_t_2; + } else { + __pyx_t_8 = __pyx_t_3; + } + if (__pyx_t_8) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L0; + goto __pyx_L9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":619 + * for r in self._regions: + * if r[0] == chrom and r[1] <= pos < r[2]: return True + * return False # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("cvcf.VCF.inregion"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_r); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":622 + * + * + * def parse_data( self, line, lineparse=False ): # <<<<<<<<<<<<<< + * cols = line.split('\t') + * if len(cols) != len(self._samples)+9: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_16parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_16parse_data = {__Pyx_NAMESTR("parse_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_16parse_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_16parse_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_lineparse = 0; + PyObject *__pyx_v_cols; + PyObject *__pyx_v_chrom; + PyObject *__pyx_v_pos; + PyObject *__pyx_v_id; + PyObject *__pyx_v_ref; + PyObject *__pyx_v_c; + PyObject *__pyx_v_left; + PyObject *__pyx_v_faref_leftflank; + PyObject *__pyx_v_faref; + PyObject *__pyx_v_alt; + double __pyx_v_qual; + PyObject *__pyx_v_filter; + PyObject *__pyx_v_info; + PyObject *__pyx_v_blurp; + PyObject *__pyx_v_elts; + PyObject *__pyx_v_v; + PyObject *__pyx_v_format; + PyObject *__pyx_v_f; + PyObject *__pyx_v_newalts; + int __pyx_v_have_deletions; + PyObject *__pyx_v_a; + PyObject *__pyx_v_l; + PyObject *__pyx_v_addns; + PyObject *__pyx_v_i; + PyObject *__pyx_v_na; + PyObject *__pyx_v_s; + PyObject *__pyx_v_addn; + PyObject *__pyx_v_allele; + int __pyx_v_movable; + PyObject *__pyx_v_longest; + PyObject *__pyx_v_shortest; + PyObject *__pyx_v_samples; + PyObject *__pyx_v_sample; + PyObject *__pyx_v_dict; + PyObject *__pyx_v_values; + Py_ssize_t __pyx_v_idx; + PyObject *__pyx_v_expected; + PyObject *__pyx_v_value; + PyObject *__pyx_v_d; + PyObject *__pyx_v_key; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + long __pyx_t_13; + double __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + Py_ssize_t __pyx_t_21; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__lineparse,0}; + __Pyx_RefNannySetupContext("parse_data"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + values[2] = __pyx_k_99; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse_data", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lineparse); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + __pyx_v_lineparse = values[2]; + } else { + __pyx_v_lineparse = __pyx_k_99; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: + __pyx_v_lineparse = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse_data", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse_data"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_cols = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_chrom = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pos = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_id = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ref = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_left = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_faref_leftflank = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_faref = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_filter = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_info = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_blurp = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_elts = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_format = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_newalts = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_a = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_addns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_na = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_addn = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_allele = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_longest = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_shortest = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_samples = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_sample = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_dict = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_values = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_expected = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_value = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_d = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":623 + * + * def parse_data( self, line, lineparse=False ): + * cols = line.split('\t') # <<<<<<<<<<<<<< + * if len(cols) != len(self._samples)+9: + * # gracefully deal with absent FORMAT column + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_cols); + __pyx_v_cols = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":624 + * def parse_data( self, line, lineparse=False ): + * cols = line.split('\t') + * if len(cols) != len(self._samples)+9: # <<<<<<<<<<<<<< + * # gracefully deal with absent FORMAT column + * if len(cols) == 8 and len(self._samples)==0: + */ + __pyx_t_3 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = (__pyx_t_3 != (__pyx_t_4 + 9)); + if (__pyx_t_5) { + + /* "cvcf.pyx":626 + * if len(cols) != len(self._samples)+9: + * # gracefully deal with absent FORMAT column + * if len(cols) == 8 and len(self._samples)==0: # <<<<<<<<<<<<<< + * cols.append("") + * else: + */ + __pyx_t_4 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 == 8); + if (__pyx_t_5) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = (__pyx_t_4 == 0); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "cvcf.pyx":627 + * # gracefully deal with absent FORMAT column + * if len(cols) == 8 and len(self._samples)==0: + * cols.append("") # <<<<<<<<<<<<<< + * else: + * self.error(line, + */ + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_cols, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "cvcf.pyx":629 + * cols.append("") + * else: + * self.error(line, # <<<<<<<<<<<<<< + * self.BAD_NUMBER_OF_COLUMNS, + * "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols))) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "cvcf.pyx":630 + * else: + * self.error(line, + * self.BAD_NUMBER_OF_COLUMNS, # <<<<<<<<<<<<<< + * "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols))) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_101); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "cvcf.pyx":631 + * self.error(line, + * self.BAD_NUMBER_OF_COLUMNS, + * "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols))) # <<<<<<<<<<<<<< + * + * chrom = cols[0] + */ + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyInt_FromSsize_t((__pyx_t_4 + 9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_4 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = PyObject_Length(__pyx_v_cols); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_102), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_t_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); + __pyx_t_1 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":633 + * "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols))) + * + * chrom = cols[0] # <<<<<<<<<<<<<< + * + * # get 0-based position + */ + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_v_chrom); + __pyx_v_chrom = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":636 + * + * # get 0-based position + * try: pos = int(cols[1])-1 # <<<<<<<<<<<<<< + * except: self.error(line,self.POS_NOT_NUMERICAL) + * if pos < 0: self.error(line,self.POS_NOT_POSITIVE) + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Subtract(__pyx_t_11, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L8_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_12; + __pyx_t_12 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L15_try_end; + __pyx_L8_error:; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":637 + * # get 0-based position + * try: pos = int(cols[1])-1 + * except: self.error(line,self.POS_NOT_NUMERICAL) # <<<<<<<<<<<<<< + * if pos < 0: self.error(line,self.POS_NOT_POSITIVE) + * + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.VCF.parse_data"); + if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__POS_NOT_NUMERICAL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9_exception_handled; + } + __pyx_L10_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L9_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L15_try_end:; + } + + /* "cvcf.pyx":638 + * try: pos = int(cols[1])-1 + * except: self.error(line,self.POS_NOT_NUMERICAL) + * if pos < 0: self.error(line,self.POS_NOT_POSITIVE) # <<<<<<<<<<<<<< + * + * # implement filtering + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__POS_NOT_POSITIVE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L18; + } + __pyx_L18:; + + /* "cvcf.pyx":641 + * + * # implement filtering + * if not self.inregion(chrom,pos): return None # <<<<<<<<<<<<<< + * + * # end of first-pass parse for sortedVCF + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__inregion); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = (!__pyx_t_7); + if (__pyx_t_5) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L19; + } + __pyx_L19:; + + /* "cvcf.pyx":644 + * + * # end of first-pass parse for sortedVCF + * if lineparse: return chrom, pos, line # <<<<<<<<<<<<<< + * + * id = cols[2] + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_lineparse); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L20; + } + __pyx_L20:; + + /* "cvcf.pyx":646 + * if lineparse: return chrom, pos, line + * + * id = cols[2] # <<<<<<<<<<<<<< + * + * ref = cols[3].upper() + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cols, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_id); + __pyx_v_id = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":648 + * id = cols[2] + * + * ref = cols[3].upper() # <<<<<<<<<<<<<< + * if ref == ".": + * self.error(line,self.MISSING_REF) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_cols, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":649 + * + * ref = cols[3].upper() + * if ref == ".": # <<<<<<<<<<<<<< + * self.error(line,self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":650 + * ref = cols[3].upper() + * if ref == ".": + * self.error(line,self.MISSING_REF) # <<<<<<<<<<<<<< + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + * else: ref = "" + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__MISSING_REF); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":651 + * if ref == ".": + * self.error(line,self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) # <<<<<<<<<<<<<< + * else: ref = "" + * else: + */ + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_5) { + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_12 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L22; + } + /*else*/ { + + /* "cvcf.pyx":652 + * self.error(line,self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + * else: ref = "" # <<<<<<<<<<<<<< + * else: + * for c in ref: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = ((PyObject *)__pyx_kp_s_1); + } + __pyx_L22:; + goto __pyx_L21; + } + /*else*/ { + + /* "cvcf.pyx":654 + * else: ref = "" + * else: + * for c in ref: # <<<<<<<<<<<<<< + * if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF) + * if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference) + */ + if (PyList_CheckExact(__pyx_v_ref) || PyTuple_CheckExact(__pyx_v_ref)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else { + __pyx_t_10 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_10) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_v_c); + __pyx_v_c = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":655 + * else: + * for c in ref: + * if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF) # <<<<<<<<<<<<<< + * if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference) + * + */ + __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__UNKNOWN_CHAR_IN_REF); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L25; + } + __pyx_L25:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":656 + * for c in ref: + * if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF) + * if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference) # <<<<<<<<<<<<<< + * + * # make sure reference is sane + */ + __pyx_t_5 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L26; + } + __pyx_L26:; + } + __pyx_L21:; + + /* "cvcf.pyx":659 + * + * # make sure reference is sane + * if self._reference: # <<<<<<<<<<<<<< + * left = max(0,pos-100) + * faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":660 + * # make sure reference is sane + * if self._reference: + * left = max(0,pos-100) # <<<<<<<<<<<<<< + * faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] + */ + __pyx_t_11 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_100); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_13 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(__pyx_t_11); + __pyx_t_10 = __pyx_t_11; + } else { + __pyx_t_12 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = __pyx_t_12; + __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_INCREF(__pyx_t_10); + __Pyx_DECREF(__pyx_v_left); + __pyx_v_left = __pyx_t_10; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "cvcf.pyx":661 + * if self._reference: + * left = max(0,pos-100) + * faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) # <<<<<<<<<<<<<< + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + */ + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_left); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_left); + __Pyx_GIVEREF(__pyx_v_left); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_faref_leftflank); + __pyx_v_faref_leftflank = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":662 + * left = max(0,pos-100) + * faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] # <<<<<<<<<<<<<< + * if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + * ref = faref + */ + __pyx_t_11 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_4, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_v_faref); + __pyx_v_faref = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":663 + * faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) # <<<<<<<<<<<<<< + * ref = faref + * + */ + __pyx_t_11 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_5) { + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_faref); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_faref); + __Pyx_GIVEREF(__pyx_v_faref); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_t_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_12)); + __pyx_t_2 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L28; + } + __pyx_L28:; + + /* "cvcf.pyx":664 + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + * ref = faref # <<<<<<<<<<<<<< + * + * # convert v3.3 to v4.0 alleles below + */ + __Pyx_INCREF(__pyx_v_faref); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_v_faref; + goto __pyx_L27; + } + __pyx_L27:; + + /* "cvcf.pyx":667 + * + * # convert v3.3 to v4.0 alleles below + * if cols[4] == ".": alt = [] # <<<<<<<<<<<<<< + * else: alt = cols[4].upper().split(',') + * + */ + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_5) { + __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_10); + __pyx_t_10 = 0; + goto __pyx_L29; + } + /*else*/ { + + /* "cvcf.pyx":668 + * # convert v3.3 to v4.0 alleles below + * if cols[4] == ".": alt = [] + * else: alt = cols[4].upper().split(',') # <<<<<<<<<<<<<< + * + * if cols[5] == ".": qual = -1 + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_104), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_10; + __pyx_t_10 = 0; + } + __pyx_L29:; + + /* "cvcf.pyx":670 + * else: alt = cols[4].upper().split(',') + * + * if cols[5] == ".": qual = -1 # <<<<<<<<<<<<<< + * else: + * try: qual = float(cols[5]) + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_5) { + __pyx_v_qual = -1.0; + goto __pyx_L30; + } + /*else*/ { + + /* "cvcf.pyx":672 + * if cols[5] == ".": qual = -1 + * else: + * try: qual = float(cols[5]) # <<<<<<<<<<<<<< + * except: self.error(line,self.QUAL_NOT_NUMERICAL) + * + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyObject_AsDouble(__pyx_t_12); if (unlikely(__pyx_t_14 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L31_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_v_qual = __pyx_t_14; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L38_try_end; + __pyx_L31_error:; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":673 + * else: + * try: qual = float(cols[5]) + * except: self.error(line,self.QUAL_NOT_NUMERICAL) # <<<<<<<<<<<<<< + * + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + */ + /*except:*/ { + __Pyx_AddTraceback("cvcf.VCF.parse_data"); + if (__Pyx_GetException(&__pyx_t_12, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__QUAL_NOT_NUMERICAL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L33_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L32_exception_handled; + } + __pyx_L33_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L32_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L38_try_end:; + } + } + __pyx_L30:; + + /* "cvcf.pyx":676 + * + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = [] # <<<<<<<<<<<<<< + * else: filter = cols[6].split(';') + * + */ + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (!__pyx_t_5) { + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_n_s__PASS), Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (!__pyx_t_7) { + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s__0), Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_15 = __pyx_t_6; + } else { + __pyx_t_15 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_15; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = ((PyObject *)__pyx_t_10); + __pyx_t_10 = 0; + goto __pyx_L41; + } + /*else*/ { + + /* "cvcf.pyx":677 + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = [] + * else: filter = cols[6].split(';') # <<<<<<<<<<<<<< + * + * # dictionary of keys, and list of values + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = __pyx_t_10; + __pyx_t_10 = 0; + } + __pyx_L41:; + + /* "cvcf.pyx":680 + * + * # dictionary of keys, and list of values + * info = {} # <<<<<<<<<<<<<< + * if cols[7] != ".": + * for blurp in cols[7].split(';'): + */ + __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(((PyObject *)__pyx_v_info)); + __pyx_v_info = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":681 + * # dictionary of keys, and list of values + * info = {} + * if cols[7] != ".": # <<<<<<<<<<<<<< + * for blurp in cols[7].split(';'): + * elts = blurp.split('=') + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_9), Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_7) { + + /* "cvcf.pyx":682 + * info = {} + * if cols[7] != ".": + * for blurp in cols[7].split(';'): # <<<<<<<<<<<<<< + * elts = blurp.split('=') + * if len(elts) == 1: v = None + */ + __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_cols, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyList_CheckExact(__pyx_t_11) || PyTuple_CheckExact(__pyx_t_11)) { + __pyx_t_4 = 0; __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_11); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_11); __pyx_t_4++; + } else { + __pyx_t_11 = PyIter_Next(__pyx_t_10); + if (!__pyx_t_11) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_11); + } + __Pyx_DECREF(__pyx_v_blurp); + __pyx_v_blurp = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":683 + * if cols[7] != ".": + * for blurp in cols[7].split(';'): + * elts = blurp.split('=') # <<<<<<<<<<<<<< + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_blurp, __pyx_n_s__split); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_elts); + __pyx_v_elts = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":684 + * for blurp in cols[7].split(';'): + * elts = blurp.split('=') + * if len(elts) == 1: v = None # <<<<<<<<<<<<<< + * elif len(elts) == 2: v = elts[1] + * else: self.error(line,self.ERROR_INFO_STRING) + */ + __pyx_t_3 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_3 == 1); + if (__pyx_t_7) { + __Pyx_INCREF(Py_None); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = Py_None; + goto __pyx_L45; + } + + /* "cvcf.pyx":685 + * elts = blurp.split('=') + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] # <<<<<<<<<<<<<< + * else: self.error(line,self.ERROR_INFO_STRING) + * info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line) + */ + __pyx_t_3 = PyObject_Length(__pyx_v_elts); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_3 == 2); + if (__pyx_t_7) { + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_elts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_12; + __pyx_t_12 = 0; + goto __pyx_L45; + } + /*else*/ { + + /* "cvcf.pyx":686 + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + * else: self.error(line,self.ERROR_INFO_STRING) # <<<<<<<<<<<<<< + * info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line) + * + */ + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ERROR_INFO_STRING); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __pyx_L45:; + + /* "cvcf.pyx":687 + * elif len(elts) == 2: v = elts[1] + * else: self.error(line,self.ERROR_INFO_STRING) + * info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line) # <<<<<<<<<<<<<< + * + * # Gracefully deal with absent FORMAT column + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v); + __Pyx_GIVEREF(__pyx_v_v); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_9 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_elts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(((PyObject *)__pyx_v_info), __pyx_t_1, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L42; + } + __pyx_L42:; + + /* "cvcf.pyx":690 + * + * # Gracefully deal with absent FORMAT column + * if cols[8] == "": format = [] # <<<<<<<<<<<<<< + * else: format = cols[8].split(':') + * + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, ((PyObject *)__pyx_kp_s_1), Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_7) { + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = ((PyObject *)__pyx_t_12); + __pyx_t_12 = 0; + goto __pyx_L46; + } + /*else*/ { + + /* "cvcf.pyx":691 + * # Gracefully deal with absent FORMAT column + * if cols[8] == "": format = [] + * else: format = cols[8].split(':') # <<<<<<<<<<<<<< + * + * # check: all filters are defined + */ + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_cols, 8, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_108), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_format); + __pyx_v_format = __pyx_t_12; + __pyx_t_12 = 0; + } + __pyx_L46:; + + /* "cvcf.pyx":694 + * + * # check: all filters are defined + * for f in filter: # <<<<<<<<<<<<<< + * if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f) + * + */ + if (PyList_CheckExact(__pyx_v_filter) || PyTuple_CheckExact(__pyx_v_filter)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else { + __pyx_t_10 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_10) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":695 + * # check: all filters are defined + * for f in filter: + * if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f) # <<<<<<<<<<<<<< + * + * # check: format fields are defined + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, __pyx_v_f))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_7) { + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L49; + } + __pyx_L49:; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":698 + * + * # check: format fields are defined + * for f in format: # <<<<<<<<<<<<<< + * if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f) + * + */ + if (PyList_CheckExact(__pyx_v_format) || PyTuple_CheckExact(__pyx_v_format)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_format; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_format); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":699 + * # check: format fields are defined + * for f in format: + * if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f) # <<<<<<<<<<<<<< + * + * # convert v3.3 alleles + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_7) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L52; + } + __pyx_L52:; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":702 + * + * # convert v3.3 alleles + * if self._version == 33: # <<<<<<<<<<<<<< + * if len(ref) != 1: self.error(line,self.V33_BAD_REF) + * newalts = [] + */ + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyObject_RichCompare(__pyx_t_12, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_7) { + + /* "cvcf.pyx":703 + * # convert v3.3 alleles + * if self._version == 33: + * if len(ref) != 1: self.error(line,self.V33_BAD_REF) # <<<<<<<<<<<<<< + * newalts = [] + * have_deletions = False + */ + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_4 != 1); + if (__pyx_t_7) { + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L54; + } + __pyx_L54:; + + /* "cvcf.pyx":704 + * if self._version == 33: + * if len(ref) != 1: self.error(line,self.V33_BAD_REF) + * newalts = [] # <<<<<<<<<<<<<< + * have_deletions = False + * for a in alt: + */ + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(((PyObject *)__pyx_v_newalts)); + __pyx_v_newalts = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":705 + * if len(ref) != 1: self.error(line,self.V33_BAD_REF) + * newalts = [] + * have_deletions = False # <<<<<<<<<<<<<< + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + */ + __pyx_v_have_deletions = 0; + + /* "cvcf.pyx":706 + * newalts = [] + * have_deletions = False + * for a in alt: # <<<<<<<<<<<<<< + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + */ + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else { + __pyx_t_10 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_10) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":707 + * have_deletions = False + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D + */ + __pyx_t_3 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_3 == 1); + if (__pyx_t_7) { + __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyNumber_Add(__pyx_v_a, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_11; + __pyx_t_11 = 0; + goto __pyx_L57; + } + + /* "cvcf.pyx":708 + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('D'): # allow D and D + * have_deletions = True + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_7) { + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L57; + } + + /* "cvcf.pyx":709 + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D # <<<<<<<<<<<<<< + * have_deletions = True + * try: + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_7) { + + /* "cvcf.pyx":710 + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D + * have_deletions = True # <<<<<<<<<<<<<< + * try: + * l = int(a[1:]) # throws ValueError if sequence + */ + __pyx_v_have_deletions = 1; + + /* "cvcf.pyx":711 + * elif a.startswith('D'): # allow D and D + * have_deletions = True + * try: # <<<<<<<<<<<<<< + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "cvcf.pyx":712 + * have_deletions = True + * try: + * l = int(a[1:]) # throws ValueError if sequence # <<<<<<<<<<<<<< + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + */ + __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":713 + * try: + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary # <<<<<<<<<<<<<< + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns + */ + __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_11, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_7) { + + /* "cvcf.pyx":714 + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) # <<<<<<<<<<<<<< + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + */ + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_1 = 0; + __pyx_t_11 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_addns); + __pyx_v_addns = __pyx_t_9; + __pyx_t_9 = 0; + + /* "cvcf.pyx":715 + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns # <<<<<<<<<<<<<< + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l + */ + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_9; + __pyx_t_9 = 0; + + /* "cvcf.pyx":716 + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns # <<<<<<<<<<<<<< + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_9 = __pyx_int_0; + __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_2); + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_10); __pyx_t_3++; + __Pyx_DECREF(__pyx_v_na); + __pyx_v_na = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_9; + __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); + __pyx_t_9 = __pyx_t_10; + __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L66; + } + __pyx_L66:; + + /* "cvcf.pyx":717 + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l # <<<<<<<<<<<<<< + * except ValueError: + * s = a[1:] + */ + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_v_l); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_3, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L58_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_9; + __pyx_t_9 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L65_try_end; + __pyx_L58_error:; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "cvcf.pyx":718 + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: # <<<<<<<<<<<<<< + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary + */ + __pyx_t_16 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_16) { + __Pyx_AddTraceback("cvcf.VCF.parse_data"); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_10); + + /* "cvcf.pyx":719 + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: + * s = a[1:] # <<<<<<<<<<<<<< + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + */ + __pyx_t_11 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_11; + __pyx_t_11 = 0; + + /* "cvcf.pyx":720 + * except ValueError: + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary # <<<<<<<<<<<<<< + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): + */ + __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_7 = (__pyx_t_3 < __pyx_t_17); + if (__pyx_t_7) { + + /* "cvcf.pyx":721 + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) # <<<<<<<<<<<<<< + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(line,self.V33_UNMATCHED_DELETION, + */ + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_17 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_18 = PyNumber_Add(__pyx_v_pos, __pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_8 = 0; + __pyx_t_18 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_v_addns); + __pyx_v_addns = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":722 + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): # <<<<<<<<<<<<<< + * self.error(line,self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__endswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_INCREF(__pyx_v_addns); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_addns); + __Pyx_GIVEREF(__pyx_v_addns); + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_5 = (!__pyx_t_7); + if (__pyx_t_5) { + __pyx_t_17 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_11); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_19), Py_NE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_15 = __pyx_t_7; + } else { + __pyx_t_15 = __pyx_t_5; + } + if (__pyx_t_15) { + + /* "cvcf.pyx":723 + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(line,self.V33_UNMATCHED_DELETION, # <<<<<<<<<<<<<< + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns + */ + __pyx_t_11 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_111); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_19); + + /* "cvcf.pyx":724 + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(line,self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) # <<<<<<<<<<<<<< + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_8 = PyNumber_Add(__pyx_v_pos, __pyx_t_18); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_20 = PyTuple_New(4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_t_8 = 0; + __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_18 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_112), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_20, 2, ((PyObject *)__pyx_t_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __pyx_t_19 = 0; + __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L72; + } + __pyx_L72:; + + /* "cvcf.pyx":725 + * self.error(line,self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns # <<<<<<<<<<<<<< + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[len(s):] # new deletion, deleting from pos + */ + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":726 + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns # <<<<<<<<<<<<<< + * a = ref[len(s):] # new deletion, deleting from pos + * else: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_18 = __pyx_int_0; + __pyx_t_17 = 0; __pyx_t_20 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_20); + for (;;) { + if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_20)) break; + __pyx_t_11 = PyList_GET_ITEM(__pyx_t_20, __pyx_t_17); __Pyx_INCREF(__pyx_t_11); __pyx_t_17++; + __Pyx_DECREF(__pyx_v_na); + __pyx_v_na = __pyx_t_11; + __pyx_t_11 = 0; + __Pyx_INCREF(__pyx_t_18); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_18; + __pyx_t_11 = PyNumber_Add(__pyx_t_18, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_18); + __pyx_t_18 = __pyx_t_11; + __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_11); + if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L71; + } + __pyx_L71:; + + /* "cvcf.pyx":727 + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[len(s):] # new deletion, deleting from pos # <<<<<<<<<<<<<< + * else: + * self.error(line,self.V33_BAD_ALLELE) + */ + __pyx_t_17 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_17, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L60_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_18; + __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L59_exception_handled; + } + __pyx_L60_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L59_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L65_try_end:; + } + goto __pyx_L57; + } + /*else*/ { + + /* "cvcf.pyx":729 + * a = ref[len(s):] # new deletion, deleting from pos + * else: + * self.error(line,self.V33_BAD_ALLELE) # <<<<<<<<<<<<<< + * newalts.append(a) + * alt = newalts + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L57:; + + /* "cvcf.pyx":730 + * else: + * self.error(line,self.V33_BAD_ALLELE) + * newalts.append(a) # <<<<<<<<<<<<<< + * alt = newalts + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + */ + if (unlikely(__pyx_v_newalts == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":731 + * self.error(line,self.V33_BAD_ALLELE) + * newalts.append(a) + * alt = newalts # <<<<<<<<<<<<<< + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_newalts)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_v_newalts); + + /* "cvcf.pyx":733 + * alt = newalts + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: # <<<<<<<<<<<<<< + * if pos == 0: + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + */ + if (__pyx_v_have_deletions) { + + /* "cvcf.pyx":734 + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: + * if pos == 0: # <<<<<<<<<<<<<< + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + */ + __pyx_t_12 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_15) { + + /* "cvcf.pyx":736 + * if pos == 0: + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) # <<<<<<<<<<<<<< + * ref += addn + * alt = [allele+addn for allele in alt] + */ + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_10, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyTuple_New(4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_9 = 0; + __pyx_t_2 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_v_addn); + __pyx_v_addn = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":737 + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + * ref += addn # <<<<<<<<<<<<<< + * alt = [allele+addn for allele in alt] + * else: + */ + __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":738 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + * ref += addn + * alt = [allele+addn for allele in alt] # <<<<<<<<<<<<<< + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) + */ + __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18); + } else { + __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else { + __pyx_t_12 = PyIter_Next(__pyx_t_18); + if (!__pyx_t_12) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_12; + __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (unlikely(PyList_Append(__pyx_t_10, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_10)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + goto __pyx_L76; + } + /*else*/ { + + /* "cvcf.pyx":740 + * alt = [allele+addn for allele in alt] + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) # <<<<<<<<<<<<<< + * ref = addn + ref + * alt = [addn + allele for allele in alt] + */ + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_18 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_addn); + __pyx_v_addn = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":741 + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) + * ref = addn + ref # <<<<<<<<<<<<<< + * alt = [addn + allele for allele in alt] + * pos -= 1 + */ + __pyx_t_12 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":742 + * addn = get_sequence(chrom,pos-1,pos,self._reference) + * ref = addn + ref + * alt = [addn + allele for allele in alt] # <<<<<<<<<<<<<< + * pos -= 1 + * else: + */ + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; + } else { + __pyx_t_10 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_10) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_10; + __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(PyList_Append(__pyx_t_12, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + + /* "cvcf.pyx":743 + * ref = addn + ref + * alt = [addn + allele for allele in alt] + * pos -= 1 # <<<<<<<<<<<<<< + * else: + * # format v4.0 -- just check for nucleotides + */ + __pyx_t_12 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_12; + __pyx_t_12 = 0; + } + __pyx_L76:; + goto __pyx_L75; + } + __pyx_L75:; + goto __pyx_L53; + } + /*else*/ { + + /* "cvcf.pyx":746 + * else: + * # format v4.0 -- just check for nucleotides + * for allele in alt: # <<<<<<<<<<<<<< + * if not alleleRegEx.match(allele): + * self.error(line,self.V40_BAD_ALLELE,allele) + */ + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":747 + * # format v4.0 -- just check for nucleotides + * for allele in alt: + * if not alleleRegEx.match(allele): # <<<<<<<<<<<<<< + * self.error(line,self.V40_BAD_ALLELE,allele) + * + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__match); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_allele); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_allele); + __Pyx_GIVEREF(__pyx_v_allele); + __pyx_t_18 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_5 = (!__pyx_t_15); + if (__pyx_t_5) { + + /* "cvcf.pyx":748 + * for allele in alt: + * if not alleleRegEx.match(allele): + * self.error(line,self.V40_BAD_ALLELE,allele) # <<<<<<<<<<<<<< + * + * # check for leading nucleotide in indel calls + */ + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_allele); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_allele); + __Pyx_GIVEREF(__pyx_v_allele); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L83; + } + __pyx_L83:; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __pyx_L53:; + + /* "cvcf.pyx":751 + * + * # check for leading nucleotide in indel calls + * for allele in alt: # <<<<<<<<<<<<<< + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) + */ + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":752 + * # check for leading nucleotide in indel calls + * for allele in alt: + * if len(allele) != len(ref): # <<<<<<<<<<<<<< + * if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + */ + __pyx_t_17 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_17 != __pyx_t_3); + if (__pyx_t_5) { + + /* "cvcf.pyx":753 + * for allele in alt: + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) # <<<<<<<<<<<<<< + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + * self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE) + */ + __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_3 == 0); + if (__pyx_t_5) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L87; + } + __pyx_L87:; + + /* "cvcf.pyx":754 + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): # <<<<<<<<<<<<<< + * self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE) + * + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_18, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_10, __pyx_t_18, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_t_18); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_15 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_10, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __pyx_t_15; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "cvcf.pyx":755 + * if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + * self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE) # <<<<<<<<<<<<<< + * + * # trim trailing bases in alleles + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_113); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L88; + } + __pyx_L88:; + goto __pyx_L86; + } + __pyx_L86:; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":758 + * + * # trim trailing bases in alleles + * for i in range(1,min(len(ref),min(map(len,alt)))): # <<<<<<<<<<<<<< + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break + */ + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(__pyx_builtin_len); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_builtin_len); + __Pyx_GIVEREF(__pyx_builtin_len); + __Pyx_INCREF(__pyx_v_alt); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_alt); + __Pyx_GIVEREF(__pyx_v_alt); + __pyx_t_18 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_3 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_18, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_18); + __pyx_t_12 = __pyx_t_18; + } else { + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_12 = __pyx_t_10; + __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) { + __pyx_t_4 = 0; __pyx_t_18 = __pyx_t_12; __Pyx_INCREF(__pyx_t_18); + } else { + __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else { + __pyx_t_12 = PyIter_Next(__pyx_t_18); + if (!__pyx_t_12) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":759 + * # trim trailing bases in alleles + * for i in range(1,min(len(ref),min(map(len,alt)))): + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): # <<<<<<<<<<<<<< + * break + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] + */ + { /* enter inner scope */ + PyObject *__pyx_7genexpr__pyx_v_allele; + __pyx_7genexpr__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None); + __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_3 = 0; __pyx_t_10 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_3 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_GOTREF(__pyx_t_10); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; + } else if (likely(PyTuple_CheckExact(__pyx_t_10))) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_10); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele); + __pyx_7genexpr__pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(PySet_Add(__pyx_t_12, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L94_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele); + goto __pyx_L97_exit_scope; + __pyx_L94_error:; + __Pyx_DECREF(__pyx_7genexpr__pyx_v_allele); + goto __pyx_L1_error; + __pyx_L97_exit_scope:; + } /* exit inner scope */ + __pyx_t_3 = PySet_Size(((PyObject *)__pyx_t_12)); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_7 = (__pyx_t_3 > 1); + if (!__pyx_t_7) { + __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_alt, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_15 = __pyx_t_5; + } else { + __pyx_t_15 = __pyx_t_7; + } + if (__pyx_t_15) { + + /* "cvcf.pyx":760 + * for i in range(1,min(len(ref),min(map(len,alt)))): + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break # <<<<<<<<<<<<<< + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] + * + */ + goto __pyx_L90_break; + goto __pyx_L91; + } + __pyx_L91:; + + /* "cvcf.pyx":761 + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] # <<<<<<<<<<<<<< + * + * # left-align alleles, if a reference is available + */ + __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_3 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_3 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++; + } else { + __pyx_t_9 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_9) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_9; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_12; + __pyx_t_12 = 0; + } + __pyx_L90_break:; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "cvcf.pyx":764 + * + * # left-align alleles, if a reference is available + * if self._leftalign and self._reference: # <<<<<<<<<<<<<< + * while left < pos: + * movable = True + */ + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (__pyx_t_15) { + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_5 = __pyx_t_7; + } else { + __pyx_t_5 = __pyx_t_15; + } + if (__pyx_t_5) { + + /* "cvcf.pyx":765 + * # left-align alleles, if a reference is available + * if self._leftalign and self._reference: + * while left < pos: # <<<<<<<<<<<<<< + * movable = True + * for allele in alt: + */ + while (1) { + __pyx_t_18 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (!__pyx_t_5) break; + + /* "cvcf.pyx":766 + * if self._leftalign and self._reference: + * while left < pos: + * movable = True # <<<<<<<<<<<<<< + * for allele in alt: + * if len(allele) > len(ref): + */ + __pyx_v_movable = 1; + + /* "cvcf.pyx":767 + * while left < pos: + * movable = True + * for allele in alt: # <<<<<<<<<<<<<< + * if len(allele) > len(ref): + * longest, shortest = allele, ref + */ + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_18 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_18); + } else { + __pyx_t_4 = -1; __pyx_t_18 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_18))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_18)) break; + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_18, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else { + __pyx_t_12 = PyIter_Next(__pyx_t_18); + if (!__pyx_t_12) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":768 + * movable = True + * for allele in alt: + * if len(allele) > len(ref): # <<<<<<<<<<<<<< + * longest, shortest = allele, ref + * else: + */ + __pyx_t_3 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_3 > __pyx_t_17); + if (__pyx_t_5) { + + /* "cvcf.pyx":769 + * for allele in alt: + * if len(allele) > len(ref): + * longest, shortest = allele, ref # <<<<<<<<<<<<<< + * else: + * longest, shortest = ref, allele + */ + __pyx_t_12 = __pyx_v_allele; + __Pyx_INCREF(__pyx_t_12); + __pyx_t_10 = __pyx_v_ref; + __Pyx_INCREF(__pyx_t_10); + __Pyx_DECREF(__pyx_v_longest); + __pyx_v_longest = __pyx_t_12; + __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_shortest); + __pyx_v_shortest = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L105; + } + /*else*/ { + + /* "cvcf.pyx":771 + * longest, shortest = allele, ref + * else: + * longest, shortest = ref, allele # <<<<<<<<<<<<<< + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False + */ + __pyx_t_10 = __pyx_v_ref; + __Pyx_INCREF(__pyx_t_10); + __pyx_t_12 = __pyx_v_allele; + __Pyx_INCREF(__pyx_t_12); + __Pyx_DECREF(__pyx_v_longest); + __pyx_v_longest = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_shortest); + __pyx_v_shortest = __pyx_t_12; + __pyx_t_12 = 0; + } + __pyx_L105:; + + /* "cvcf.pyx":772 + * else: + * longest, shortest = ref, allele + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): # <<<<<<<<<<<<<< + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + */ + __pyx_t_17 = PyObject_Length(__pyx_v_longest); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_17 == __pyx_t_3); + if (!__pyx_t_5) { + __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_RichCompare(__pyx_t_12, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_7 = __pyx_t_15; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "cvcf.pyx":773 + * longest, shortest = ref, allele + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False # <<<<<<<<<<<<<< + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False + */ + __pyx_v_movable = 0; + goto __pyx_L106; + } + __pyx_L106:; + + /* "cvcf.pyx":774 + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): # <<<<<<<<<<<<<< + * movable = False + * if not movable: + */ + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = (__pyx_t_3 - 1); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_17, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__upper); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_RichCompare(__pyx_t_10, __pyx_t_2, Py_NE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_7) { + + /* "cvcf.pyx":775 + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False # <<<<<<<<<<<<<< + * if not movable: + * break + */ + __pyx_v_movable = 0; + goto __pyx_L107; + } + __pyx_L107:; + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "cvcf.pyx":776 + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False + * if not movable: # <<<<<<<<<<<<<< + * break + * ref = ref[:-1] + */ + __pyx_t_7 = (!__pyx_v_movable); + if (__pyx_t_7) { + + /* "cvcf.pyx":777 + * movable = False + * if not movable: + * break # <<<<<<<<<<<<<< + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] + */ + goto __pyx_L102_break; + goto __pyx_L108; + } + __pyx_L108:; + + /* "cvcf.pyx":778 + * if not movable: + * break + * ref = ref[:-1] # <<<<<<<<<<<<<< + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + */ + __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":779 + * break + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] # <<<<<<<<<<<<<< + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref + */ + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + + /* "cvcf.pyx":780 + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: # <<<<<<<<<<<<<< + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + */ + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_17 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_17); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_INCREF(((PyObject *)__pyx_t_18)); + PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __pyx_t_18 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_RichCompare(__pyx_t_18, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (!__pyx_t_7) { + __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 == 0); + __pyx_t_15 = __pyx_t_5; + } else { + __pyx_t_15 = __pyx_t_7; + } + if (__pyx_t_15) { + + /* "cvcf.pyx":781 + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref # <<<<<<<<<<<<<< + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + * pos -= 1 + */ + __pyx_t_12 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = PyNumber_Subtract(__pyx_t_12, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_18); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyNumber_Add(__pyx_t_12, __pyx_v_ref); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":782 + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] # <<<<<<<<<<<<<< + * pos -= 1 + * + */ + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + if (PyList_CheckExact(__pyx_v_alt) || PyTuple_CheckExact(__pyx_v_alt)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_v_alt; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_alt); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_10); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Add(__pyx_t_2, __pyx_v_allele); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyList_Append(__pyx_t_18, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_t_18); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + + /* "cvcf.pyx":783 + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + * pos -= 1 # <<<<<<<<<<<<<< + * + * # parse sample columns + */ + __pyx_t_18 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_18; + __pyx_t_18 = 0; + goto __pyx_L111; + } + __pyx_L111:; + } + __pyx_L102_break:; + goto __pyx_L100; + } + __pyx_L100:; + + /* "cvcf.pyx":786 + * + * # parse sample columns + * samples = [] # <<<<<<<<<<<<<< + * for sample in cols[9:]: + * dict = {} + */ + __pyx_t_18 = PyList_New(0); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(((PyObject *)__pyx_v_samples)); + __pyx_v_samples = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":787 + * # parse sample columns + * samples = [] + * for sample in cols[9:]: # <<<<<<<<<<<<<< + * dict = {} + * values = sample.split(':') + */ + __pyx_t_18 = __Pyx_PySequence_GetSlice(__pyx_v_cols, 9, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + if (PyList_CheckExact(__pyx_t_18) || PyTuple_CheckExact(__pyx_t_18)) { + __pyx_t_4 = 0; __pyx_t_12 = __pyx_t_18; __Pyx_INCREF(__pyx_t_12); + } else { + __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; + __pyx_t_18 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_18); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_12))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; + __pyx_t_18 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_18); __pyx_t_4++; + } else { + __pyx_t_18 = PyIter_Next(__pyx_t_12); + if (!__pyx_t_18) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_18); + } + __Pyx_DECREF(__pyx_v_sample); + __pyx_v_sample = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":788 + * samples = [] + * for sample in cols[9:]: + * dict = {} # <<<<<<<<<<<<<< + * values = sample.split(':') + * if len(values) > len(format): + */ + __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_DECREF(((PyObject *)__pyx_v_dict)); + __pyx_v_dict = __pyx_t_18; + __pyx_t_18 = 0; + + /* "cvcf.pyx":789 + * for sample in cols[9:]: + * dict = {} + * values = sample.split(':') # <<<<<<<<<<<<<< + * if len(values) > len(format): + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + */ + __pyx_t_18 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__split); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_k_tuple_114), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_v_values); + __pyx_v_values = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":790 + * dict = {} + * values = sample.split(':') + * if len(values) > len(format): # <<<<<<<<<<<<<< + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + * for idx in range(len(format)): + */ + __pyx_t_17 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = (__pyx_t_17 > __pyx_t_3); + if (__pyx_t_15) { + + /* "cvcf.pyx":791 + * values = sample.split(':') + * if len(values) > len(format): + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) # <<<<<<<<<<<<<< + * for idx in range(len(format)): + * expected = self.get_expected(format[idx], self._format, alt) + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_18); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_sample); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_sample); + __Pyx_GIVEREF(__pyx_v_sample); + PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_2 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_20, 2, ((PyObject *)__pyx_t_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); + __pyx_t_18 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L118; + } + __pyx_L118:; + + /* "cvcf.pyx":792 + * if len(values) > len(format): + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + * for idx in range(len(format)): # <<<<<<<<<<<<<< + * expected = self.get_expected(format[idx], self._format, alt) + * if idx < len(values): value = values[idx] + */ + __pyx_t_3 = PyObject_Length(__pyx_v_format); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_3; __pyx_t_17+=1) { + __pyx_v_idx = __pyx_t_17; + + /* "cvcf.pyx":793 + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + * for idx in range(len(format)): + * expected = self.get_expected(format[idx], self._format, alt) # <<<<<<<<<<<<<< + * if idx < len(values): value = values[idx] + * else: + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__get_expected); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_alt); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_alt); + __Pyx_GIVEREF(__pyx_v_alt); + __pyx_t_20 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_v_expected); + __pyx_v_expected = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":794 + * for idx in range(len(format)): + * expected = self.get_expected(format[idx], self._format, alt) + * if idx < len(values): value = values[idx] # <<<<<<<<<<<<<< + * else: + * if expected == -1: value = "." + */ + __pyx_t_21 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = (__pyx_v_idx < __pyx_t_21); + if (__pyx_t_15) { + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L121; + } + /*else*/ { + + /* "cvcf.pyx":796 + * if idx < len(values): value = values[idx] + * else: + * if expected == -1: value = "." # <<<<<<<<<<<<<< + * else: value = ",".join(["."]*expected) + * dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) + */ + __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_15) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L122; + } + /*else*/ { + + /* "cvcf.pyx":797 + * else: + * if expected == -1: value = "." + * else: value = ",".join(["."]*expected) # <<<<<<<<<<<<<< + * dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) + * if expected != -1 and len(dict[format[idx]]) != expected: + */ + __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_18 = PyList_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyList_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_9 = PyNumber_Multiply(((PyObject *)__pyx_t_18), __pyx_v_expected); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_9; + __pyx_t_9 = 0; + } + __pyx_L122:; + } + __pyx_L121:; + + /* "cvcf.pyx":798 + * if expected == -1: value = "." + * else: value = ",".join(["."]*expected) + * dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) # <<<<<<<<<<<<<< + * if expected != -1 and len(dict[format[idx]]) != expected: + * self.error(line,self.BAD_NUMBER_OF_PARAMETERS, + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_formatdata); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_20 = PyTuple_New(4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + __Pyx_INCREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + __pyx_t_18 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_20, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "cvcf.pyx":799 + * else: value = ",".join(["."]*expected) + * dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) + * if expected != -1 and len(dict[format[idx]]) != expected: # <<<<<<<<<<<<<< + * self.error(line,self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) + */ + __pyx_t_10 = PyObject_RichCompare(__pyx_v_expected, __pyx_int_neg_1, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_15) { + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_21 = PyObject_Length(__pyx_t_20); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_10 = PyObject_RichCompare(__pyx_t_20, __pyx_v_expected, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = __pyx_t_7; + } else { + __pyx_t_5 = __pyx_t_15; + } + if (__pyx_t_5) { + + /* "cvcf.pyx":800 + * dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) + * if expected != -1 and len(dict[format[idx]]) != expected: + * self.error(line,self.BAD_NUMBER_OF_PARAMETERS, # <<<<<<<<<<<<<< + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) + * if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_20 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_20); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + + /* "cvcf.pyx":801 + * if expected != -1 and len(dict[format[idx]]) != expected: + * self.error(line,self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) # <<<<<<<<<<<<<< + * if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) + * dict[format[idx]] = dict[format[idx]][:expected] + */ + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_18); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(__pyx_v_expected); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_expected); + __Pyx_GIVEREF(__pyx_v_expected); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_9 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_18)); + __Pyx_INCREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_line); + __Pyx_GIVEREF(__pyx_v_line); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_18, 2, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_20 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":802 + * self.error(line,self.BAD_NUMBER_OF_PARAMETERS, + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) + * if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) # <<<<<<<<<<<<<< + * dict[format[idx]] = dict[format[idx]][:expected] + * samples.append( dict ) + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_21 = PyObject_Length(__pyx_t_18); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_18, __pyx_v_expected, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_20 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_20) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_20, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyList_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + PyList_SET_ITEM(__pyx_t_20, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_10); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_21 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_21); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyNumber_Subtract(__pyx_v_expected, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Multiply(((PyObject *)__pyx_t_20), __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_InPlaceAdd(__pyx_t_18, __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_2, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L124; + } + __pyx_L124:; + + /* "cvcf.pyx":803 + * "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) + * if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) + * dict[format[idx]] = dict[format[idx]][:expected] # <<<<<<<<<<<<<< + * samples.append( dict ) + * + */ + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_dict), __pyx_t_2); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_expected); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_t_10, 0, __pyx_t_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_format, __pyx_v_idx, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(((PyObject *)__pyx_v_dict), __pyx_t_10, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L123; + } + __pyx_L123:; + } + + /* "cvcf.pyx":804 + * if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) + * dict[format[idx]] = dict[format[idx]][:expected] + * samples.append( dict ) # <<<<<<<<<<<<<< + * + * # done + */ + if (unlikely(__pyx_v_samples == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_16 = PyList_Append(__pyx_v_samples, ((PyObject *)__pyx_v_dict)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + + /* "cvcf.pyx":807 + * + * # done + * d = {'chrom':chrom, # <<<<<<<<<<<<<< + * 'pos':pos, # return 0-based position + * 'id':id, + */ + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__chrom), __pyx_v_chrom) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":808 + * # done + * d = {'chrom':chrom, + * 'pos':pos, # return 0-based position # <<<<<<<<<<<<<< + * 'id':id, + * 'ref':ref, + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__pos), __pyx_v_pos) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":809 + * d = {'chrom':chrom, + * 'pos':pos, # return 0-based position + * 'id':id, # <<<<<<<<<<<<<< + * 'ref':ref, + * 'alt':alt, + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":810 + * 'pos':pos, # return 0-based position + * 'id':id, + * 'ref':ref, # <<<<<<<<<<<<<< + * 'alt':alt, + * 'qual':qual, + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__ref), __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":811 + * 'id':id, + * 'ref':ref, + * 'alt':alt, # <<<<<<<<<<<<<< + * 'qual':qual, + * 'filter':filter, + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__alt), __pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":812 + * 'ref':ref, + * 'alt':alt, + * 'qual':qual, # <<<<<<<<<<<<<< + * 'filter':filter, + * 'info':info, + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__qual), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":813 + * 'alt':alt, + * 'qual':qual, + * 'filter':filter, # <<<<<<<<<<<<<< + * 'info':info, + * 'format':format} + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__filter), __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":814 + * 'qual':qual, + * 'filter':filter, + * 'info':info, # <<<<<<<<<<<<<< + * 'format':format} + * for key,value in zip(self._samples,samples): + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_info)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":815 + * 'filter':filter, + * 'info':info, + * 'format':format} # <<<<<<<<<<<<<< + * for key,value in zip(self._samples,samples): + * d[key] = value + */ + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__format), __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_d)); + __pyx_v_d = __pyx_t_12; + __pyx_t_12 = 0; + + /* "cvcf.pyx":816 + * 'info':info, + * 'format':format} + * for key,value in zip(self._samples,samples): # <<<<<<<<<<<<<< + * d[key] = value + * + */ + __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_INCREF(((PyObject *)__pyx_v_samples)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_samples)); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_12) || PyTuple_CheckExact(__pyx_t_12)) { + __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_12; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; + } else { + __pyx_t_12 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_12) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + if (PyTuple_CheckExact(__pyx_t_12) && likely(PyTuple_GET_SIZE(__pyx_t_12) == 2)) { + PyObject* tuple = __pyx_t_12; + __pyx_t_10 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_10); + __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_9; + __pyx_t_9 = 0; + } else { + __pyx_t_18 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_18, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_18, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_EndUnpack(__pyx_t_18, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_v_key); + __pyx_v_key = __pyx_t_10; + __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_9; + __pyx_t_9 = 0; + } + + /* "cvcf.pyx":817 + * 'format':format} + * for key,value in zip(self._samples,samples): + * d[key] = value # <<<<<<<<<<<<<< + * + * return d + */ + if (PyDict_SetItem(((PyObject *)__pyx_v_d), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":819 + * d[key] = value + * + * return d # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_d)); + __pyx_r = ((PyObject *)__pyx_v_d); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_AddTraceback("cvcf.VCF.parse_data"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_cols); + __Pyx_DECREF(__pyx_v_chrom); + __Pyx_DECREF(__pyx_v_pos); + __Pyx_DECREF(__pyx_v_id); + __Pyx_DECREF(__pyx_v_ref); + __Pyx_DECREF(__pyx_v_c); + __Pyx_DECREF(__pyx_v_left); + __Pyx_DECREF(__pyx_v_faref_leftflank); + __Pyx_DECREF(__pyx_v_faref); + __Pyx_DECREF(__pyx_v_alt); + __Pyx_DECREF(__pyx_v_filter); + __Pyx_DECREF(__pyx_v_info); + __Pyx_DECREF(__pyx_v_blurp); + __Pyx_DECREF(__pyx_v_elts); + __Pyx_DECREF(__pyx_v_v); + __Pyx_DECREF(__pyx_v_format); + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_newalts); + __Pyx_DECREF(__pyx_v_a); + __Pyx_DECREF(__pyx_v_l); + __Pyx_DECREF(__pyx_v_addns); + __Pyx_DECREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_na); + __Pyx_DECREF(__pyx_v_s); + __Pyx_DECREF(__pyx_v_addn); + __Pyx_DECREF(__pyx_v_allele); + __Pyx_DECREF(__pyx_v_longest); + __Pyx_DECREF(__pyx_v_shortest); + __Pyx_DECREF(__pyx_v_samples); + __Pyx_DECREF(__pyx_v_sample); + __Pyx_DECREF(__pyx_v_dict); + __Pyx_DECREF(__pyx_v_values); + __Pyx_DECREF(__pyx_v_expected); + __Pyx_DECREF(__pyx_v_value); + __Pyx_DECREF(__pyx_v_d); + __Pyx_DECREF(__pyx_v_key); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":822 + * + * + * def write_data(self, stream, data): # <<<<<<<<<<<<<< + * required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples + * for k in required: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_17write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_17write_data = {__Pyx_NAMESTR("write_data"), (PyCFunction)__pyx_pf_4cvcf_3VCF_17write_data, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_17write_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_data = 0; + PyObject *__pyx_v_required; + PyObject *__pyx_v_k; + PyObject *__pyx_v_alt; + PyObject *__pyx_v_filter; + PyObject *__pyx_v_qual; + PyObject *__pyx_v_output; + PyObject *__pyx_v_s; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__data,0}; + __Pyx_RefNannySetupContext("write_data"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + __pyx_v_data = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write_data", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.write_data"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_required = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_alt = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_filter = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_qual = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_output = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":823 + * + * def write_data(self, stream, data): + * required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples # <<<<<<<<<<<<<< + * for k in required: + * if k not in data: raise ValueError("Required key %s not found in data" % str(k)) + */ + __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__chrom)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__chrom)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chrom)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pos)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__id)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ref)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__ref)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ref)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alt)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__alt)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alt)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__qual)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__qual)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qual)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__filter)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__filter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__filter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__info)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__info)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__info)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__format)); + PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__format)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format)); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_required); + __pyx_v_required = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":824 + * def write_data(self, stream, data): + * required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples + * for k in required: # <<<<<<<<<<<<<< + * if k not in data: raise ValueError("Required key %s not found in data" % str(k)) + * if data['alt'] == []: alt = "." + */ + if (PyList_CheckExact(__pyx_v_required) || PyTuple_CheckExact(__pyx_v_required)) { + __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_required; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_required); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":825 + * required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples + * for k in required: + * if k not in data: raise ValueError("Required key %s not found in data" % str(k)) # <<<<<<<<<<<<<< + * if data['alt'] == []: alt = "." + * else: alt = ",".join(data['alt']) + */ + __pyx_t_5 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_v_data, __pyx_v_k))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_115), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":826 + * for k in required: + * if k not in data: raise ValueError("Required key %s not found in data" % str(k)) + * if data['alt'] == []: alt = "." # <<<<<<<<<<<<<< + * else: alt = ",".join(data['alt']) + * if data['filter'] == None: filter = "." + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__alt)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L9; + } + /*else*/ { + + /* "cvcf.pyx":827 + * if k not in data: raise ValueError("Required key %s not found in data" % str(k)) + * if data['alt'] == []: alt = "." + * else: alt = ",".join(data['alt']) # <<<<<<<<<<<<<< + * if data['filter'] == None: filter = "." + * elif data['filter'] == []: + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__alt)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_alt); + __pyx_v_alt = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L9:; + + /* "cvcf.pyx":828 + * if data['alt'] == []: alt = "." + * else: alt = ",".join(data['alt']) + * if data['filter'] == None: filter = "." # <<<<<<<<<<<<<< + * elif data['filter'] == []: + * if self._version == 33: filter = "0" + */ + __pyx_t_2 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, Py_None, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L10; + } + + /* "cvcf.pyx":829 + * else: alt = ",".join(data['alt']) + * if data['filter'] == None: filter = "." + * elif data['filter'] == []: # <<<<<<<<<<<<<< + * if self._version == 33: filter = "0" + * else: filter = "PASS" + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_2), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":830 + * if data['filter'] == None: filter = "." + * elif data['filter'] == []: + * if self._version == 33: filter = "0" # <<<<<<<<<<<<<< + * else: filter = "PASS" + * else: filter = ';'.join(data['filter']) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s__0)); + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = ((PyObject *)__pyx_kp_s__0); + goto __pyx_L11; + } + /*else*/ { + + /* "cvcf.pyx":831 + * elif data['filter'] == []: + * if self._version == 33: filter = "0" + * else: filter = "PASS" # <<<<<<<<<<<<<< + * else: filter = ';'.join(data['filter']) + * if data['qual'] == -1: qual = "." + */ + __Pyx_INCREF(((PyObject *)__pyx_n_s__PASS)); + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = ((PyObject *)__pyx_n_s__PASS); + } + __pyx_L11:; + goto __pyx_L10; + } + /*else*/ { + + /* "cvcf.pyx":832 + * if self._version == 33: filter = "0" + * else: filter = "PASS" + * else: filter = ';'.join(data['filter']) # <<<<<<<<<<<<<< + * if data['qual'] == -1: qual = "." + * else: qual = str(data['qual']) + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_11), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__filter)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_filter); + __pyx_v_filter = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L10:; + + /* "cvcf.pyx":833 + * else: filter = "PASS" + * else: filter = ';'.join(data['filter']) + * if data['qual'] == -1: qual = "." # <<<<<<<<<<<<<< + * else: qual = str(data['qual']) + * + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__qual)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_neg_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = ((PyObject *)__pyx_kp_s_9); + goto __pyx_L12; + } + /*else*/ { + + /* "cvcf.pyx":834 + * else: filter = ';'.join(data['filter']) + * if data['qual'] == -1: qual = "." + * else: qual = str(data['qual']) # <<<<<<<<<<<<<< + * + * output = [data['chrom'], + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__qual)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_qual); + __pyx_v_qual = __pyx_t_3; + __pyx_t_3 = 0; + } + __pyx_L12:; + + /* "cvcf.pyx":836 + * else: qual = str(data['qual']) + * + * output = [data['chrom'], # <<<<<<<<<<<<<< + * str(data['pos']+1), # change to 1-based position + * data['id'], + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__chrom)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "cvcf.pyx":837 + * + * output = [data['chrom'], + * str(data['pos']+1), # change to 1-based position # <<<<<<<<<<<<<< + * data['id'], + * data['ref'], + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__pos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":838 + * output = [data['chrom'], + * str(data['pos']+1), # change to 1-based position + * data['id'], # <<<<<<<<<<<<<< + * data['ref'], + * alt, + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__id)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "cvcf.pyx":839 + * str(data['pos']+1), # change to 1-based position + * data['id'], + * data['ref'], # <<<<<<<<<<<<<< + * alt, + * qual, + */ + __pyx_t_6 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__ref)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + + /* "cvcf.pyx":843 + * qual, + * filter, + * self.format_formatdata( data['info'], self._info, separator=";" ), # <<<<<<<<<<<<<< + * self.format_formatdata( data['format'], self._format, value=False ) ] + * + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format_formatdata); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__info)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__separator), ((PyObject *)__pyx_kp_s_11)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + + /* "cvcf.pyx":844 + * filter, + * self.format_formatdata( data['info'], self._info, separator=";" ), + * self.format_formatdata( data['format'], self._format, value=False ) ] # <<<<<<<<<<<<<< + * + * for s in self._samples: + */ + __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format_formatdata); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetItem(__pyx_v_data, ((PyObject *)__pyx_n_s__format)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_10 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__value), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyList_New(9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_alt); + PyList_SET_ITEM(__pyx_t_7, 4, __pyx_v_alt); + __Pyx_GIVEREF(__pyx_v_alt); + __Pyx_INCREF(__pyx_v_qual); + PyList_SET_ITEM(__pyx_t_7, 5, __pyx_v_qual); + __Pyx_GIVEREF(__pyx_v_qual); + __Pyx_INCREF(__pyx_v_filter); + PyList_SET_ITEM(__pyx_t_7, 6, __pyx_v_filter); + __Pyx_GIVEREF(__pyx_v_filter); + PyList_SET_ITEM(__pyx_t_7, 7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyList_SET_ITEM(__pyx_t_7, 8, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_output)); + __pyx_v_output = __pyx_t_7; + __pyx_t_7 = 0; + + /* "cvcf.pyx":846 + * self.format_formatdata( data['format'], self._format, value=False ) ] + * + * for s in self._samples: # <<<<<<<<<<<<<< + * output.append( self.format_formatdata( data[s], self._format, key=False ) ) + * + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_4 = 0; __pyx_t_10 = __pyx_t_7; __Pyx_INCREF(__pyx_t_10); + } else { + __pyx_t_4 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_10))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_10)) break; + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; + } else { + __pyx_t_7 = PyIter_Next(__pyx_t_10); + if (!__pyx_t_7) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_7; + __pyx_t_7 = 0; + + /* "cvcf.pyx":847 + * + * for s in self._samples: + * output.append( self.format_formatdata( data[s], self._format, key=False ) ) # <<<<<<<<<<<<<< + * + * stream.write( "\t".join(output) + "\n" ) + */ + if (unlikely(__pyx_v_output == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__format_formatdata); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetItem(__pyx_v_data, __pyx_v_s); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_8 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__key), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_12 = PyList_Append(__pyx_v_output, __pyx_t_8); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "cvcf.pyx":849 + * output.append( self.format_formatdata( data[s], self._format, key=False ) ) + * + * stream.write( "\t".join(output) + "\n" ) # <<<<<<<<<<<<<< + * + * def _parse_header(self, stream): + */ + __pyx_t_10 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_85), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_output)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_output)); + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_91)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("cvcf.VCF.write_data"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_required); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_alt); + __Pyx_DECREF(__pyx_v_filter); + __Pyx_DECREF(__pyx_v_qual); + __Pyx_DECREF(__pyx_v_output); + __Pyx_DECREF(__pyx_v_s); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":851 + * stream.write( "\t".join(output) + "\n" ) + * + * def _parse_header(self, stream): # <<<<<<<<<<<<<< + * self._lineno = 0 + * for line in stream: + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_18_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_18_parse_header = {__Pyx_NAMESTR("_parse_header"), (PyCFunction)__pyx_pf_4cvcf_3VCF_18_parse_header, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_18_parse_header(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_line; + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("_parse_header"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_parse_header", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parse_header") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_parse_header", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF._parse_header"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_line = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":852 + * + * def _parse_header(self, stream): + * self._lineno = 0 # <<<<<<<<<<<<<< + * for line in stream: + * self._lineno += 1 + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":853 + * def _parse_header(self, stream): + * self._lineno = 0 + * for line in stream: # <<<<<<<<<<<<<< + * self._lineno += 1 + * if line.startswith('##'): + */ + if (PyList_CheckExact(__pyx_v_stream) || PyTuple_CheckExact(__pyx_v_stream)) { + __pyx_t_1 = 0; __pyx_t_2 = __pyx_v_stream; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + } else { + __pyx_t_3 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_3) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":854 + * self._lineno = 0 + * for line in stream: + * self._lineno += 1 # <<<<<<<<<<<<<< + * if line.startswith('##'): + * self.parse_header( line.strip() ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":855 + * for line in stream: + * self._lineno += 1 + * if line.startswith('##'): # <<<<<<<<<<<<<< + * self.parse_header( line.strip() ) + * elif line.startswith('#'): + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_116), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":856 + * self._lineno += 1 + * if line.startswith('##'): + * self.parse_header( line.strip() ) # <<<<<<<<<<<<<< + * elif line.startswith('#'): + * self.parse_heading( line.strip() ) + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L8; + } + + /* "cvcf.pyx":857 + * if line.startswith('##'): + * self.parse_header( line.strip() ) + * elif line.startswith('#'): # <<<<<<<<<<<<<< + * self.parse_heading( line.strip() ) + * self.enter_default_format() + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__startswith); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "cvcf.pyx":858 + * self.parse_header( line.strip() ) + * elif line.startswith('#'): + * self.parse_heading( line.strip() ) # <<<<<<<<<<<<<< + * self.enter_default_format() + * else: + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_heading); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":859 + * elif line.startswith('#'): + * self.parse_heading( line.strip() ) + * self.enter_default_format() # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_118); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "cvcf.pyx":861 + * self.enter_default_format() + * else: + * break # <<<<<<<<<<<<<< + * return line + * + */ + goto __pyx_L7_break; + } + __pyx_L8:; + } + __pyx_L7_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":862 + * else: + * break + * return line # <<<<<<<<<<<<<< + * + * def _parse(self, line, stream): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_line); + __pyx_r = __pyx_v_line; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.VCF._parse_header"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_line); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":864 + * return line + * + * def _parse(self, line, stream): # <<<<<<<<<<<<<< + * if len(line.strip()) > 0: + * d = self.parse_data( line.strip() ) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_19_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_19_parse = {__Pyx_NAMESTR("_parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF_19_parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_19_parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_line = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_d; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__line,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("_parse"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__line); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_line = values[1]; + __pyx_v_stream = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_line = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_parse", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF._parse"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_line); + __pyx_v_d = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":865 + * + * def _parse(self, line, stream): + * if len(line.strip()) > 0: # <<<<<<<<<<<<<< + * d = self.parse_data( line.strip() ) + * #if d: yield d + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (__pyx_t_3 > 0); + if (__pyx_t_4) { + + /* "cvcf.pyx":866 + * def _parse(self, line, stream): + * if len(line.strip()) > 0: + * d = self.parse_data( line.strip() ) # <<<<<<<<<<<<<< + * #if d: yield d + * for line in stream: + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_d); + __pyx_v_d = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":868 + * d = self.parse_data( line.strip() ) + * #if d: yield d + * for line in stream: # <<<<<<<<<<<<<< + * self._lineno += 1 + * if self._lines and self._lineno > self._lines: raise StopIteration + */ + if (PyList_CheckExact(__pyx_v_stream) || PyTuple_CheckExact(__pyx_v_stream)) { + __pyx_t_3 = 0; __pyx_t_5 = __pyx_v_stream; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_stream); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_line); + __pyx_v_line = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":869 + * #if d: yield d + * for line in stream: + * self._lineno += 1 # <<<<<<<<<<<<<< + * if self._lines and self._lineno > self._lines: raise StopIteration + * d = self.parse_data( line.strip() ) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___lineno, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":870 + * for line in stream: + * self._lineno += 1 + * if self._lines and self._lineno > self._lines: raise StopIteration # <<<<<<<<<<<<<< + * d = self.parse_data( line.strip() ) + * #if d: yield d + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lineno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___lines); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_4; + } + if (__pyx_t_8) { + __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; + } + __pyx_L9:; + + /* "cvcf.pyx":871 + * self._lineno += 1 + * if self._lines and self._lineno > self._lines: raise StopIteration + * d = self.parse_data( line.strip() ) # <<<<<<<<<<<<<< + * #if d: yield d + * + */ + __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__parse_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__strip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_d); + __pyx_v_d = __pyx_t_2; + __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.VCF._parse"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_d); + __Pyx_DECREF(__pyx_v_line); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":880 + * ###################################################################################################### + * + * def getsamples(self): # <<<<<<<<<<<<<< + * """ List of samples in VCF file """ + * return self._samples + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_20getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_20getsamples[] = " List of samples in VCF file "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_20getsamples = {__Pyx_NAMESTR("getsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_20getsamples, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_20getsamples)}; +static PyObject *__pyx_pf_4cvcf_3VCF_20getsamples(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getsamples"); + __pyx_self = __pyx_self; + + /* "cvcf.pyx":882 + * def getsamples(self): + * """ List of samples in VCF file """ + * return self._samples # <<<<<<<<<<<<<< + * + * def setsamples(self,samples): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.getsamples"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":884 + * return self._samples + * + * def setsamples(self,samples): # <<<<<<<<<<<<<< + * """ List of samples in VCF file """ + * self._samples = samples + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_21setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_21setsamples[] = " List of samples in VCF file "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_21setsamples = {__Pyx_NAMESTR("setsamples"), (PyCFunction)__pyx_pf_4cvcf_3VCF_21setsamples, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_21setsamples)}; +static PyObject *__pyx_pf_4cvcf_3VCF_21setsamples(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_samples = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__samples,0}; + __Pyx_RefNannySetupContext("setsamples"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setsamples", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setsamples") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_samples = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_samples = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setsamples", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setsamples"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":886 + * def setsamples(self,samples): + * """ List of samples in VCF file """ + * self._samples = samples # <<<<<<<<<<<<<< + * + * def getheader(self): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___samples, __pyx_v_samples) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setsamples"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":888 + * self._samples = samples + * + * def getheader(self): # <<<<<<<<<<<<<< + * """ List of header key-value pairs (strings) """ + * return self._header + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_22getheader(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_22getheader[] = " List of header key-value pairs (strings) "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_22getheader = {__Pyx_NAMESTR("getheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_22getheader, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_22getheader)}; +static PyObject *__pyx_pf_4cvcf_3VCF_22getheader(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getheader"); + __pyx_self = __pyx_self; + + /* "cvcf.pyx":890 + * def getheader(self): + * """ List of header key-value pairs (strings) """ + * return self._header # <<<<<<<<<<<<<< + * + * def setheader(self,header): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.getheader"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":892 + * return self._header + * + * def setheader(self,header): # <<<<<<<<<<<<<< + * """ List of header key-value pairs (strings) """ + * self._header = header + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_23setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_23setheader[] = " List of header key-value pairs (strings) "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_23setheader = {__Pyx_NAMESTR("setheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_23setheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_23setheader)}; +static PyObject *__pyx_pf_4cvcf_3VCF_23setheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_header = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__header,0}; + __Pyx_RefNannySetupContext("setheader"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setheader") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_header = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_header = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setheader", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setheader"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":894 + * def setheader(self,header): + * """ List of header key-value pairs (strings) """ + * self._header = header # <<<<<<<<<<<<<< + * + * def getinfo(self): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___header, __pyx_v_header) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setheader"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":896 + * self._header = header + * + * def getinfo(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * return self._info + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_24getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_24getinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_24getinfo = {__Pyx_NAMESTR("getinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_24getinfo, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_24getinfo)}; +static PyObject *__pyx_pf_4cvcf_3VCF_24getinfo(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getinfo"); + __pyx_self = __pyx_self; + + /* "cvcf.pyx":898 + * def getinfo(self): + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * return self._info # <<<<<<<<<<<<<< + * + * def setinfo(self,info): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.getinfo"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":900 + * return self._info + * + * def setinfo(self,info): # <<<<<<<<<<<<<< + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * self._info = info + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_25setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_25setinfo[] = " Dictionary of ##INFO tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_25setinfo = {__Pyx_NAMESTR("setinfo"), (PyCFunction)__pyx_pf_4cvcf_3VCF_25setinfo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_25setinfo)}; +static PyObject *__pyx_pf_4cvcf_3VCF_25setinfo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_info = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__info,0}; + __Pyx_RefNannySetupContext("setinfo"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__info); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setinfo", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setinfo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_info = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_info = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setinfo", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setinfo"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":902 + * def setinfo(self,info): + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * self._info = info # <<<<<<<<<<<<<< + * + * def getformat(self): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___info, __pyx_v_info) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setinfo"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":904 + * self._info = info + * + * def getformat(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * return self._format + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_26getformat(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_26getformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_26getformat = {__Pyx_NAMESTR("getformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_26getformat, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_26getformat)}; +static PyObject *__pyx_pf_4cvcf_3VCF_26getformat(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getformat"); + __pyx_self = __pyx_self; + + /* "cvcf.pyx":906 + * def getformat(self): + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * return self._format # <<<<<<<<<<<<<< + * + * def setformat(self,format): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.getformat"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":908 + * return self._format + * + * def setformat(self,format): # <<<<<<<<<<<<<< + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * self._format = format + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_27setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_27setformat[] = " Dictionary of ##FORMAT tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_27setformat = {__Pyx_NAMESTR("setformat"), (PyCFunction)__pyx_pf_4cvcf_3VCF_27setformat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_27setformat)}; +static PyObject *__pyx_pf_4cvcf_3VCF_27setformat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_format = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__format,0}; + __Pyx_RefNannySetupContext("setformat"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setformat", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setformat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_format = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_format = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setformat", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setformat"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":910 + * def setformat(self,format): + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * self._format = format # <<<<<<<<<<<<<< + * + * def getfilter(self): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___format, __pyx_v_format) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setformat"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":912 + * self._format = format + * + * def getfilter(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * return self._filter + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_28getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_28getfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_28getfilter = {__Pyx_NAMESTR("getfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_28getfilter, METH_O, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_28getfilter)}; +static PyObject *__pyx_pf_4cvcf_3VCF_28getfilter(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getfilter"); + __pyx_self = __pyx_self; + + /* "cvcf.pyx":914 + * def getfilter(self): + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * return self._filter # <<<<<<<<<<<<<< + * + * def setfilter(self,filter): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.getfilter"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":916 + * return self._filter + * + * def setfilter(self,filter): # <<<<<<<<<<<<<< + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * self._filter = filter + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_29setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_29setfilter[] = " Dictionary of ##FILTER tags, as VCF.FORMAT values "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_29setfilter = {__Pyx_NAMESTR("setfilter"), (PyCFunction)__pyx_pf_4cvcf_3VCF_29setfilter, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_29setfilter)}; +static PyObject *__pyx_pf_4cvcf_3VCF_29setfilter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filter = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filter,0}; + __Pyx_RefNannySetupContext("setfilter"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filter); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setfilter", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setfilter") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_filter = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_filter = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setfilter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setfilter"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":918 + * def setfilter(self,filter): + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * self._filter = filter # <<<<<<<<<<<<<< + * + * def setversion(self, version): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___filter, __pyx_v_filter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setfilter"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":920 + * self._filter = filter + * + * def setversion(self, version): # <<<<<<<<<<<<<< + * if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") + * self._version = version + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_30setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_30setversion = {__Pyx_NAMESTR("setversion"), (PyCFunction)__pyx_pf_4cvcf_3VCF_30setversion, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_30setversion(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_version = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__version,0}; + __Pyx_RefNannySetupContext("setversion"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__version); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setversion", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setversion") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_version = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_version = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setversion", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setversion"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":921 + * + * def setversion(self, version): + * if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") # <<<<<<<<<<<<<< + * self._version = version + * + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_33, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_version, __pyx_int_40, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_120), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":922 + * def setversion(self, version): + * if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") + * self._version = version # <<<<<<<<<<<<<< + * + * def setregions(self, regions): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___version, __pyx_v_version) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cvcf.VCF.setversion"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":924 + * self._version = version + * + * def setregions(self, regions): # <<<<<<<<<<<<<< + * self._regions = regions + * + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_31setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_31setregions = {__Pyx_NAMESTR("setregions"), (PyCFunction)__pyx_pf_4cvcf_3VCF_31setregions, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_31setregions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_regions = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__regions,0}; + __Pyx_RefNannySetupContext("setregions"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setregions", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setregions") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_regions = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_regions = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setregions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setregions"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":925 + * + * def setregions(self, regions): + * self._regions = regions # <<<<<<<<<<<<<< + * + * def setreference(self, ref): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___regions, __pyx_v_regions) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setregions"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":927 + * self._regions = regions + * + * def setreference(self, ref): # <<<<<<<<<<<<<< + * """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """ + * self._reference = ref + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_32setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_32setreference[] = " Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_32setreference = {__Pyx_NAMESTR("setreference"), (PyCFunction)__pyx_pf_4cvcf_3VCF_32setreference, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_32setreference)}; +static PyObject *__pyx_pf_4cvcf_3VCF_32setreference(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_ref = 0; + PyObject *__pyx_r = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__ref,0}; + __Pyx_RefNannySetupContext("setreference"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("setreference", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setreference") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_ref = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_ref = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("setreference", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.setreference"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":929 + * def setreference(self, ref): + * """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """ + * self._reference = ref # <<<<<<<<<<<<<< + * + * def ignoreerror(self, errorstring): + */ + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___reference, __pyx_v_ref) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("cvcf.VCF.setreference"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":931 + * self._reference = ref + * + * def ignoreerror(self, errorstring): # <<<<<<<<<<<<<< + * try: self._ignored_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_33ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_33ignoreerror = {__Pyx_NAMESTR("ignoreerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_33ignoreerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_33ignoreerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_errorstring = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0}; + __Pyx_RefNannySetupContext("ignoreerror"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("ignoreerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ignoreerror") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_errorstring = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_errorstring = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("ignoreerror", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.ignoreerror"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":932 + * + * def ignoreerror(self, errorstring): + * try: self._ignored_errors.add(self.__dict__[errorstring]) # <<<<<<<<<<<<<< + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___ignored_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_errorstring); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L13_try_end; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":933 + * def ignoreerror(self, errorstring): + * try: self._ignored_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) # <<<<<<<<<<<<<< + * + * def warnerror(self, errorstring): + */ + __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_4) { + __Pyx_AddTraceback("cvcf.VCF.ignoreerror"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L7_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L13_try_end:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.VCF.ignoreerror"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":935 + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + * def warnerror(self, errorstring): # <<<<<<<<<<<<<< + * try: self._warn_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_34warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4cvcf_3VCF_34warnerror = {__Pyx_NAMESTR("warnerror"), (PyCFunction)__pyx_pf_4cvcf_3VCF_34warnerror, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4cvcf_3VCF_34warnerror(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_errorstring = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__errorstring,0}; + __Pyx_RefNannySetupContext("warnerror"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorstring); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("warnerror", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "warnerror") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_errorstring = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_errorstring = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("warnerror", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.warnerror"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":936 + * + * def warnerror(self, errorstring): + * try: self._warn_errors.add(self.__dict__[errorstring]) # <<<<<<<<<<<<<< + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___warn_errors); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____dict__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_errorstring); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L13_try_end; + __pyx_L6_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":937 + * def warnerror(self, errorstring): + * try: self._warn_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) # <<<<<<<<<<<<<< + * + * def parse(self, stream): + */ + __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_4) { + __Pyx_AddTraceback("cvcf.VCF.warnerror"); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_121), __pyx_v_errorstring); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L7_exception_handled; + } + __pyx_L8_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L7_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L13_try_end:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.VCF.warnerror"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":939 + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + * def parse(self, stream): # <<<<<<<<<<<<<< + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * last_line = self._parse_header(stream) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_35parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_35parse[] = " Parse a stream of VCF-formatted lines. Initializes class instance and return generator "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_35parse = {__Pyx_NAMESTR("parse"), (PyCFunction)__pyx_pf_4cvcf_3VCF_35parse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_35parse)}; +static PyObject *__pyx_pf_4cvcf_3VCF_35parse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_last_line; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("parse"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("parse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.parse"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_last_line = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":941 + * def parse(self, stream): + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * last_line = self._parse_header(stream) # <<<<<<<<<<<<<< + * # now return a generator that does the actual work. In this way the pre-processing is done + * # before the first piece of data is yielded + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parse_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_last_line); + __pyx_v_last_line = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cvcf.pyx":944 + * # now return a generator that does the actual work. In this way the pre-processing is done + * # before the first piece of data is yielded + * return self._parse(last_line, stream) # <<<<<<<<<<<<<< + * + * def write(self, stream, datagenerator): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_last_line); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_last_line); + __Pyx_GIVEREF(__pyx_v_last_line); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCF.parse"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_last_line); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":946 + * return self._parse(last_line, stream) + * + * def write(self, stream, datagenerator): # <<<<<<<<<<<<<< + * """ Writes a VCF file to a stream, using a data generator (or list) """ + * self.write_header(stream) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_36write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_36write[] = " Writes a VCF file to a stream, using a data generator (or list) "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_36write = {__Pyx_NAMESTR("write"), (PyCFunction)__pyx_pf_4cvcf_3VCF_36write, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_36write)}; +static PyObject *__pyx_pf_4cvcf_3VCF_36write(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_datagenerator = 0; + PyObject *__pyx_v_data; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,&__pyx_n_s__datagenerator,0}; + __Pyx_RefNannySetupContext("write"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[3] = {0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__datagenerator); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + __pyx_v_datagenerator = values[2]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_datagenerator = PyTuple_GET_ITEM(__pyx_args, 2); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("write", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.write"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":948 + * def write(self, stream, datagenerator): + * """ Writes a VCF file to a stream, using a data generator (or list) """ + * self.write_header(stream) # <<<<<<<<<<<<<< + * self.write_heading(stream) + * for data in datagenerator: self.write_data(stream,data) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":949 + * """ Writes a VCF file to a stream, using a data generator (or list) """ + * self.write_header(stream) + * self.write_heading(stream) # <<<<<<<<<<<<<< + * for data in datagenerator: self.write_data(stream,data) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_heading); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":950 + * self.write_header(stream) + * self.write_heading(stream) + * for data in datagenerator: self.write_data(stream,data) # <<<<<<<<<<<<<< + * + * def writeheader(self, stream): + */ + if (PyList_CheckExact(__pyx_v_datagenerator) || PyTuple_CheckExact(__pyx_v_datagenerator)) { + __pyx_t_4 = 0; __pyx_t_1 = __pyx_v_datagenerator; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_datagenerator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.write"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":952 + * for data in datagenerator: self.write_data(stream,data) + * + * def writeheader(self, stream): # <<<<<<<<<<<<<< + * """ Writes a VCF header """ + * self.write_header(stream) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_37writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_37writeheader[] = " Writes a VCF header "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_37writeheader = {__Pyx_NAMESTR("writeheader"), (PyCFunction)__pyx_pf_4cvcf_3VCF_37writeheader, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_37writeheader)}; +static PyObject *__pyx_pf_4cvcf_3VCF_37writeheader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__stream,0}; + __Pyx_RefNannySetupContext("writeheader"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("writeheader", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "writeheader") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_stream = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_stream = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("writeheader", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.writeheader"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":954 + * def writeheader(self, stream): + * """ Writes a VCF header """ + * self.write_header(stream) # <<<<<<<<<<<<<< + * self.write_heading(stream) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":955 + * """ Writes a VCF header """ + * self.write_header(stream) + * self.write_heading(stream) # <<<<<<<<<<<<<< + * + * def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2): + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_heading); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_stream); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_stream); + __Pyx_GIVEREF(__pyx_v_stream); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCF.writeheader"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":957 + * self.write_heading(stream) + * + * def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2): # <<<<<<<<<<<<<< + * """ Utility function: compares two calls for equality """ + * # a variant should always be assigned to a unique position, one base before + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_38compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_38compare_calls[] = " Utility function: compares two calls for equality "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_38compare_calls = {__Pyx_NAMESTR("compare_calls"), (PyCFunction)__pyx_pf_4cvcf_3VCF_38compare_calls, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_38compare_calls)}; +static PyObject *__pyx_pf_4cvcf_3VCF_38compare_calls(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_pos1 = 0; + PyObject *__pyx_v_ref1 = 0; + PyObject *__pyx_v_alt1 = 0; + PyObject *__pyx_v_pos2 = 0; + PyObject *__pyx_v_ref2 = 0; + PyObject *__pyx_v_alt2 = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__pos1,&__pyx_n_s__ref1,&__pyx_n_s__alt1,&__pyx_n_s__pos2,&__pyx_n_s__ref2,&__pyx_n_s__alt2,0}; + __Pyx_RefNannySetupContext("compare_calls"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[7] = {0,0,0,0,0,0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos1); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref1); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt1); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos2); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref2); + if (likely(values[5])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alt2); + if (likely(values[6])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "compare_calls") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_pos1 = values[1]; + __pyx_v_ref1 = values[2]; + __pyx_v_alt1 = values[3]; + __pyx_v_pos2 = values[4]; + __pyx_v_ref2 = values[5]; + __pyx_v_alt2 = values[6]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_pos1 = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_ref1 = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_alt1 = PyTuple_GET_ITEM(__pyx_args, 3); + __pyx_v_pos2 = PyTuple_GET_ITEM(__pyx_args, 4); + __pyx_v_ref2 = PyTuple_GET_ITEM(__pyx_args, 5); + __pyx_v_alt2 = PyTuple_GET_ITEM(__pyx_args, 6); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("compare_calls", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.compare_calls"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_ref1); + __Pyx_INCREF(__pyx_v_alt1); + __Pyx_INCREF(__pyx_v_ref2); + __Pyx_INCREF(__pyx_v_alt2); + + /* "cvcf.pyx":962 + * # the leftmost position of the alignment gap. If this rule is implemented + * # correctly, the two positions must be equal for the calls to be identical. + * if pos1 != pos2: return False # <<<<<<<<<<<<<< + * # from both calls, trim rightmost bases when identical. Do this safely, i.e. + * # only when the reference bases are not Ns + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_pos1, __pyx_v_pos2, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "cvcf.pyx":965 + * # from both calls, trim rightmost bases when identical. Do this safely, i.e. + * # only when the reference bases are not Ns + * while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]: # <<<<<<<<<<<<<< + * ref1 = ref1[:-1] + * alt1 = alt1[:-1] + */ + while (1) { + __pyx_t_3 = PyObject_Length(__pyx_v_ref1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_3 > 0); + if (__pyx_t_2) { + __pyx_t_3 = PyObject_Length(__pyx_v_alt1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 > 0); + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ref1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __pyx_t_7; + } else { + __pyx_t_8 = __pyx_t_4; + } + __pyx_t_4 = __pyx_t_8; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (!__pyx_t_4) break; + + /* "cvcf.pyx":966 + * # only when the reference bases are not Ns + * while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]: + * ref1 = ref1[:-1] # <<<<<<<<<<<<<< + * alt1 = alt1[:-1] + * while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: + */ + __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_ref1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_ref1); + __pyx_v_ref1 = __pyx_t_6; + __pyx_t_6 = 0; + + /* "cvcf.pyx":967 + * while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]: + * ref1 = ref1[:-1] + * alt1 = alt1[:-1] # <<<<<<<<<<<<<< + * while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: + * ref2 = ref2[:-1] + */ + __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_v_alt1, 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_v_alt1); + __pyx_v_alt1 = __pyx_t_6; + __pyx_t_6 = 0; + } + + /* "cvcf.pyx":968 + * ref1 = ref1[:-1] + * alt1 = alt1[:-1] + * while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: # <<<<<<<<<<<<<< + * ref2 = ref2[:-1] + * alt2 = alt2[:-1] + */ + while (1) { + __pyx_t_3 = PyObject_Length(__pyx_v_ref2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_3 > 0); + if (__pyx_t_4) { + __pyx_t_3 = PyObject_Length(__pyx_v_alt2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_t_3 > 0); + if (__pyx_t_2) { + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_ref2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_alt2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_t_8; + } else { + __pyx_t_7 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_7; + } else { + __pyx_t_2 = __pyx_t_4; + } + if (!__pyx_t_2) break; + + /* "cvcf.pyx":969 + * alt1 = alt1[:-1] + * while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: + * ref2 = ref2[:-1] # <<<<<<<<<<<<<< + * alt2 = alt2[:-1] + * # now, the alternative alleles must be identical + */ + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_ref2); + __pyx_v_ref2 = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":970 + * while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: + * ref2 = ref2[:-1] + * alt2 = alt2[:-1] # <<<<<<<<<<<<<< + * # now, the alternative alleles must be identical + * return alt1 == alt2 + */ + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_alt2, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_alt2); + __pyx_v_alt2 = __pyx_t_1; + __pyx_t_1 = 0; + } + + /* "cvcf.pyx":972 + * alt2 = alt2[:-1] + * # now, the alternative alleles must be identical + * return alt1 == alt2 # <<<<<<<<<<<<<< + * + * ########################################################################################################### + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_alt1, __pyx_v_alt2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("cvcf.VCF.compare_calls"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_ref1); + __Pyx_DECREF(__pyx_v_alt1); + __Pyx_DECREF(__pyx_v_ref2); + __Pyx_DECREF(__pyx_v_alt2); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":979 + * ########################################################################################################### + * + * def connect( self, filename ): # <<<<<<<<<<<<<< + * '''connect to tabix file.''' + * self.tabixfile = pysam.Tabixfile( filename ) + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_39connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_39connect[] = "connect to tabix file."; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_39connect = {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_4cvcf_3VCF_39connect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_39connect)}; +static PyObject *__pyx_pf_4cvcf_3VCF_39connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_filename = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__filename,0}; + __Pyx_RefNannySetupContext("connect"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("connect", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "connect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_filename = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("connect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.connect"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":981 + * def connect( self, filename ): + * '''connect to tabix file.''' + * self.tabixfile = pysam.Tabixfile( filename ) # <<<<<<<<<<<<<< + * self._parse_header(self.tabixfile.header) + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pysam); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Tabixfile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_filename); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_filename); + __Pyx_GIVEREF(__pyx_v_filename); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tabixfile, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "cvcf.pyx":982 + * '''connect to tabix file.''' + * self.tabixfile = pysam.Tabixfile( filename ) + * self._parse_header(self.tabixfile.header) # <<<<<<<<<<<<<< + * + * def fetch(self, + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___parse_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tabixfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__header); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cvcf.VCF.connect"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":984 + * self._parse_header(self.tabixfile.header) + * + * def fetch(self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_40fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_40fetch[] = " Parse a stream of VCF-formatted lines. Initializes class instance and return generator "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_40fetch = {__Pyx_NAMESTR("fetch"), (PyCFunction)__pyx_pf_4cvcf_3VCF_40fetch, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_40fetch)}; +static PyObject *__pyx_pf_4cvcf_3VCF_40fetch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_reference = 0; + PyObject *__pyx_v_start = 0; + PyObject *__pyx_v_end = 0; + PyObject *__pyx_v_region = 0; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__reference,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__region,0}; + __Pyx_RefNannySetupContext("fetch"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[5] = {0,0,0,0,0}; + + /* "cvcf.pyx":985 + * + * def fetch(self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + values[1] = ((PyObject *)Py_None); + + /* "cvcf.pyx":986 + * def fetch(self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + values[2] = ((PyObject *)Py_None); + + /* "cvcf.pyx":987 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + */ + values[3] = ((PyObject *)Py_None); + + /* "cvcf.pyx":988 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * + */ + values[4] = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reference); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__region); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "fetch") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_reference = values[1]; + __pyx_v_start = values[2]; + __pyx_v_end = values[3]; + __pyx_v_region = values[4]; + } else { + + /* "cvcf.pyx":985 + * + * def fetch(self, + * reference = None, # <<<<<<<<<<<<<< + * start = None, + * end = None, + */ + __pyx_v_reference = ((PyObject *)Py_None); + + /* "cvcf.pyx":986 + * def fetch(self, + * reference = None, + * start = None, # <<<<<<<<<<<<<< + * end = None, + * region = None ): + */ + __pyx_v_start = ((PyObject *)Py_None); + + /* "cvcf.pyx":987 + * reference = None, + * start = None, + * end = None, # <<<<<<<<<<<<<< + * region = None ): + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + */ + __pyx_v_end = ((PyObject *)Py_None); + + /* "cvcf.pyx":988 + * start = None, + * end = None, + * region = None ): # <<<<<<<<<<<<<< + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * + */ + __pyx_v_region = ((PyObject *)Py_None); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: __pyx_v_region = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: __pyx_v_end = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: __pyx_v_start = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: __pyx_v_reference = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fetch", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.fetch"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "cvcf.pyx":991 + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * + * return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) ) # <<<<<<<<<<<<<< + * + * def validate( self, record ): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tabixfile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fetch); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_reference); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_reference); + __Pyx_GIVEREF(__pyx_v_reference); + __Pyx_INCREF(__pyx_v_start); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start); + __Pyx_GIVEREF(__pyx_v_start); + __Pyx_INCREF(__pyx_v_end); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_end); + __Pyx_GIVEREF(__pyx_v_end); + __Pyx_INCREF(__pyx_v_region); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_region); + __Pyx_GIVEREF(__pyx_v_region); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_4cvcf_asVCFRecord)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__parser), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("cvcf.VCF.fetch"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cvcf.pyx":993 + * return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) ) + * + * def validate( self, record ): # <<<<<<<<<<<<<< + * '''validate vcf record. + * + */ + +static PyObject *__pyx_pf_4cvcf_3VCF_41validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4cvcf_3VCF_41validate[] = "validate vcf record.\n\n returns a validated record.\n "; +static PyMethodDef __pyx_mdef_4cvcf_3VCF_41validate = {__Pyx_NAMESTR("validate"), (PyCFunction)__pyx_pf_4cvcf_3VCF_41validate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4cvcf_3VCF_41validate)}; +static PyObject *__pyx_pf_4cvcf_3VCF_41validate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_record = 0; + PyObject *__pyx_v_chrom; + PyObject *__pyx_v_pos; + PyObject *__pyx_v_ref; + PyObject *__pyx_v_c; + PyObject *__pyx_v_left; + PyObject *__pyx_v_faref_leftflank; + PyObject *__pyx_v_faref; + PyObject *__pyx_v_f; + PyObject *__pyx_v_newalts; + int __pyx_v_have_deletions; + PyObject *__pyx_v_a; + PyObject *__pyx_v_l; + PyObject *__pyx_v_addns; + PyObject *__pyx_v_i; + PyObject *__pyx_v_na; + PyObject *__pyx_v_s; + PyObject *__pyx_v_alt; + PyObject *__pyx_v_addn; + PyObject *__pyx_v_allele; + int __pyx_v_movable; + PyObject *__pyx_v_longest; + PyObject *__pyx_v_shortest; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + long __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__record,0}; + __Pyx_RefNannySetupContext("validate"); + __pyx_self = __pyx_self; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject* values[2] = {0,0}; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__record); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("validate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "validate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __pyx_v_self = values[0]; + __pyx_v_record = values[1]; + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_record = PyTuple_GET_ITEM(__pyx_args, 1); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("validate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("cvcf.VCF.validate"); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_v_chrom = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_pos = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ref = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_left = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_faref_leftflank = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_faref = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_f = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_newalts = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_a = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_l = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_addns = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_na = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_s = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_alt = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_addn = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_allele = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_longest = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_shortest = Py_None; __Pyx_INCREF(Py_None); + + /* "cvcf.pyx":999 + * ''' + * + * raise NotImplementedError( "needs to be checked" ) # <<<<<<<<<<<<<< + * + * chrom, pos = record.chrom, record.pos + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":1001 + * raise NotImplementedError( "needs to be checked" ) + * + * chrom, pos = record.chrom, record.pos # <<<<<<<<<<<<<< + * + * # check reference + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_chrom); + __pyx_v_chrom = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":1004 + * + * # check reference + * ref = record.ref # <<<<<<<<<<<<<< + * if ref == ".": + * self.error(str(record),self.MISSING_REF) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":1005 + * # check reference + * ref = record.ref + * if ref == ".": # <<<<<<<<<<<<<< + * self.error(str(record),self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_ref, ((PyObject *)__pyx_kp_s_9), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1006 + * ref = record.ref + * if ref == ".": + * self.error(str(record),self.MISSING_REF) # <<<<<<<<<<<<<< + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + * else: ref = "" + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__MISSING_REF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":1007 + * if ref == ".": + * self.error(str(record),self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) # <<<<<<<<<<<<<< + * else: ref = "" + * else: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "cvcf.pyx":1008 + * self.error(str(record),self.MISSING_REF) + * if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + * else: ref = "" # <<<<<<<<<<<<<< + * else: + * for c in ref: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = ((PyObject *)__pyx_kp_s_1); + } + __pyx_L7:; + goto __pyx_L6; + } + /*else*/ { + + /* "cvcf.pyx":1010 + * else: ref = "" + * else: + * for c in ref: # <<<<<<<<<<<<<< + * if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF) + * if "N" in ref: ref = get_sequence(chrom, + */ + if (PyList_CheckExact(__pyx_v_ref) || PyTuple_CheckExact(__pyx_v_ref)) { + __pyx_t_6 = 0; __pyx_t_2 = __pyx_v_ref; __Pyx_INCREF(__pyx_t_2); + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_ref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_c); + __pyx_v_c = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":1011 + * else: + * for c in ref: + * if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF) # <<<<<<<<<<<<<< + * if "N" in ref: ref = get_sequence(chrom, + * pos, + */ + __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(((PyObject *)__pyx_n_s__ACGTN), __pyx_v_c))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__UNKNOWN_CHAR_IN_REF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L10; + } + __pyx_L10:; + + /* "cvcf.pyx":1012 + * for c in ref: + * if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF) + * if "N" in ref: ref = get_sequence(chrom, # <<<<<<<<<<<<<< + * pos, + * pos+len(ref), + */ + __pyx_t_3 = ((PySequence_Contains(__pyx_v_ref, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + + /* "cvcf.pyx":1014 + * if "N" in ref: ref = get_sequence(chrom, + * pos, + * pos+len(ref), # <<<<<<<<<<<<<< + * self._reference) + * + */ + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyNumber_Add(__pyx_v_pos, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "cvcf.pyx":1015 + * pos, + * pos+len(ref), + * self._reference) # <<<<<<<<<<<<<< + * + * # make sure reference is sane + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L11; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L6:; + + /* "cvcf.pyx":1018 + * + * # make sure reference is sane + * if self._reference: # <<<<<<<<<<<<<< + * left = max(0,self.pos-100) + * faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1019 + * # make sure reference is sane + * if self._reference: + * left = max(0,self.pos-100) # <<<<<<<<<<<<<< + * faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_t_7); + __pyx_t_2 = __pyx_t_7; + } else { + __pyx_t_5 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_left); + __pyx_v_left = __pyx_t_2; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":1020 + * if self._reference: + * left = max(0,self.pos-100) + * faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) # <<<<<<<<<<<<<< + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_left); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_left); + __Pyx_GIVEREF(__pyx_v_left); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_faref_leftflank); + __pyx_v_faref_leftflank = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1021 + * left = max(0,self.pos-100) + * faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] # <<<<<<<<<<<<<< + * if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + * ref = faref + */ + __pyx_t_5 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_faref_leftflank, __pyx_t_6, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_faref); + __pyx_v_faref = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1022 + * faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) # <<<<<<<<<<<<<< + * ref = faref + * + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_faref, __pyx_v_ref, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__WRONG_REF); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_faref); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_faref); + __Pyx_GIVEREF(__pyx_v_faref); + __Pyx_INCREF(__pyx_v_ref); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ref); + __Pyx_GIVEREF(__pyx_v_ref); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_103), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = 0; + __pyx_t_7 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "cvcf.pyx":1023 + * faref = faref_leftflank[pos-left:] + * if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + * ref = faref # <<<<<<<<<<<<<< + * + * # check: format fields are defined + */ + __Pyx_INCREF(__pyx_v_faref); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_v_faref; + goto __pyx_L12; + } + __pyx_L12:; + + /* "cvcf.pyx":1026 + * + * # check: format fields are defined + * for f in record.format: # <<<<<<<<<<<<<< + * if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f) + * + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":1027 + * # check: format fields are defined + * for f in record.format: + * if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f) # <<<<<<<<<<<<<< + * + * # check: all filters are defined + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_4, __pyx_v_f))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_3) { + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FORMAT_NOT_DEFINED); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L16; + } + __pyx_L16:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":1030 + * + * # check: all filters are defined + * for f in record.filter: # <<<<<<<<<<<<<< + * if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f) + * + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_record, __pyx_n_s__filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_5); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_v_f); + __pyx_v_f = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1031 + * # check: all filters are defined + * for f in record.filter: + * if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f) # <<<<<<<<<<<<<< + * + * # convert v3.3 alleles + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___filter); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_1, __pyx_v_f))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__FILTER_NOT_DEFINED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_f); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_f); + __Pyx_GIVEREF(__pyx_v_f); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L19; + } + __pyx_L19:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":1034 + * + * # convert v3.3 alleles + * if self._version == 33: # <<<<<<<<<<<<<< + * if len(ref) != 1: self.error(str(record),self.V33_BAD_REF) + * newalts = [] + */ + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___version); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_int_33, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1035 + * # convert v3.3 alleles + * if self._version == 33: + * if len(ref) != 1: self.error(str(record),self.V33_BAD_REF) # <<<<<<<<<<<<<< + * newalts = [] + * have_deletions = False + */ + __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_6 != 1); + if (__pyx_t_3) { + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_REF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L21; + } + __pyx_L21:; + + /* "cvcf.pyx":1036 + * if self._version == 33: + * if len(ref) != 1: self.error(str(record),self.V33_BAD_REF) + * newalts = [] # <<<<<<<<<<<<<< + * have_deletions = False + * for a in alt: + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_v_newalts)); + __pyx_v_newalts = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1037 + * if len(ref) != 1: self.error(str(record),self.V33_BAD_REF) + * newalts = [] + * have_deletions = False # <<<<<<<<<<<<<< + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + */ + __pyx_v_have_deletions = 0; + + /* "cvcf.pyx":1038 + * newalts = [] + * have_deletions = False + * for a in alt: # <<<<<<<<<<<<<< + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + */ + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1039 + * have_deletions = False + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D + */ + __pyx_t_8 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_8 == 1); + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_a, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L24; + } + + /* "cvcf.pyx":1040 + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('D'): # allow D and D + * have_deletions = True + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_124), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L24; + } + + /* "cvcf.pyx":1041 + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D # <<<<<<<<<<<<<< + * have_deletions = True + * try: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__startswith); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1042 + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D + * have_deletions = True # <<<<<<<<<<<<<< + * try: + * l = int(a[1:]) # throws ValueError if sequence + */ + __pyx_v_have_deletions = 1; + + /* "cvcf.pyx":1043 + * elif a.startswith('D'): # allow D and D + * have_deletions = True + * try: # <<<<<<<<<<<<<< + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary + */ + { + PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; + __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); + __Pyx_XGOTREF(__pyx_save_exc_type); + __Pyx_XGOTREF(__pyx_save_exc_value); + __Pyx_XGOTREF(__pyx_save_exc_tb); + /*try:*/ { + + /* "cvcf.pyx":1044 + * have_deletions = True + * try: + * l = int(a[1:]) # throws ValueError if sequence # <<<<<<<<<<<<<< + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_l); + __pyx_v_l = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":1045 + * try: + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary # <<<<<<<<<<<<<< + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns + */ + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_v_l, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1046 + * l = int(a[1:]) # throws ValueError if sequence + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) # <<<<<<<<<<<<<< + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyNumber_Add(__pyx_v_pos, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_pos, __pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_7 = 0; + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_addns); + __pyx_v_addns = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":1047 + * if len(ref) < l: # add to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns # <<<<<<<<<<<<<< + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l + */ + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_4; + __pyx_t_4 = 0; + + /* "cvcf.pyx":1048 + * addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns # <<<<<<<<<<<<<< + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_4 = __pyx_int_0; + __pyx_t_8 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_10); + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; + __Pyx_DECREF(__pyx_v_na); + __pyx_v_na = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_4; + __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); + __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L33; + } + __pyx_L33:; + + /* "cvcf.pyx":1049 + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l # <<<<<<<<<<<<<< + * except ValueError: + * s = a[1:] + */ + __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_l); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_8, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L25_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_4; + __pyx_t_4 = 0; + } + __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; + __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; + __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + goto __pyx_L32_try_end; + __pyx_L25_error:; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "cvcf.pyx":1050 + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: # <<<<<<<<<<<<<< + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary + */ + __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_ValueError); + if (__pyx_t_11) { + __Pyx_AddTraceback("cvcf.VCF.validate"); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_1); + + /* "cvcf.pyx":1051 + * a = ref[l:] # new deletion, deleting pos...pos+l + * except ValueError: + * s = a[1:] # <<<<<<<<<<<<<< + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + */ + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_a, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_s); + __pyx_v_s = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cvcf.pyx":1052 + * except ValueError: + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary # <<<<<<<<<<<<<< + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): + */ + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_12 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_3 = (__pyx_t_8 < __pyx_t_12); + if (__pyx_t_3) { + + /* "cvcf.pyx":1053 + * s = a[1:] + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) # <<<<<<<<<<<<<< + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(str(record),self.V33_UNMATCHED_DELETION, + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = PyNumber_Add(__pyx_v_pos, __pyx_t_7); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_12 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = PyNumber_Add(__pyx_v_pos, __pyx_t_7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_v_addns); + __pyx_v_addns = __pyx_t_7; + __pyx_t_7 = 0; + + /* "cvcf.pyx":1054 + * if len(ref) < len(s): # add Ns to reference if necessary + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): # <<<<<<<<<<<<<< + * self.error(str(record),self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + */ + __pyx_t_7 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__endswith); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_INCREF(__pyx_v_addns); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_addns); + __Pyx_GIVEREF(__pyx_v_addns); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_16 = (!__pyx_t_3); + if (__pyx_t_16) { + __pyx_t_12 = PyObject_Length(__pyx_v_addns); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyNumber_Multiply(((PyObject *)__pyx_n_s__N), __pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_addns, ((PyObject *)__pyx_t_15), Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_17 = __pyx_t_3; + } else { + __pyx_t_17 = __pyx_t_16; + } + if (__pyx_t_17) { + + /* "cvcf.pyx":1055 + * addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(str(record),self.V33_UNMATCHED_DELETION, # <<<<<<<<<<<<<< + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_111); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_15); + + /* "cvcf.pyx":1056 + * if not s.endswith(addns) and addns != 'N'*len(addns): + * self.error(str(record),self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) # <<<<<<<<<<<<<< + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + */ + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_12 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_18 = PyNumber_Add(__pyx_v_pos, __pyx_t_13); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_18 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_INCREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_112), ((PyObject *)__pyx_t_19)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_19, 2, ((PyObject *)__pyx_t_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); + __pyx_t_7 = 0; + __pyx_t_15 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L39; + } + __pyx_L39:; + + /* "cvcf.pyx":1057 + * self.error(str(record),self.V33_UNMATCHED_DELETION, + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns # <<<<<<<<<<<<<< + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[len(s):] # new deletion, deleting from pos + */ + __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addns); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_13; + __pyx_t_13 = 0; + + /* "cvcf.pyx":1058 + * "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns # <<<<<<<<<<<<<< + * a = ref[len(s):] # new deletion, deleting from pos + * else: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_13 = __pyx_int_0; + __pyx_t_12 = 0; __pyx_t_19 = ((PyObject *)__pyx_v_newalts); __Pyx_INCREF(__pyx_t_19); + for (;;) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_19)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_19, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; + __Pyx_DECREF(__pyx_v_na); + __pyx_v_na = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_t_13); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_13; + __pyx_t_2 = PyNumber_Add(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_13); + __pyx_t_13 = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_na, __pyx_v_addns); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(((PyObject *)__pyx_v_newalts), __pyx_v_i, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L38; + } + __pyx_L38:; + + /* "cvcf.pyx":1059 + * ref += addns + * for i,na in enumerate(newalts): newalts[i] = na+addns + * a = ref[len(s):] # new deletion, deleting from pos # <<<<<<<<<<<<<< + * else: + * self.error(str(record),self.V33_BAD_ALLELE) + */ + __pyx_t_12 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __pyx_t_13 = __Pyx_PySequence_GetSlice(__pyx_v_ref, __pyx_t_12, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L27_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_v_a); + __pyx_v_a = __pyx_t_13; + __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L26_exception_handled; + } + __pyx_L27_except_error:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + goto __pyx_L1_error; + __pyx_L26_exception_handled:; + __Pyx_XGIVEREF(__pyx_save_exc_type); + __Pyx_XGIVEREF(__pyx_save_exc_value); + __Pyx_XGIVEREF(__pyx_save_exc_tb); + __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __pyx_L32_try_end:; + } + goto __pyx_L24; + } + /*else*/ { + + /* "cvcf.pyx":1061 + * a = ref[len(s):] # new deletion, deleting from pos + * else: + * self.error(str(record),self.V33_BAD_ALLELE) # <<<<<<<<<<<<<< + * newalts.append(a) + * alt = newalts + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V33_BAD_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_4 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __pyx_L24:; + + /* "cvcf.pyx":1062 + * else: + * self.error(str(record),self.V33_BAD_ALLELE) + * newalts.append(a) # <<<<<<<<<<<<<< + * alt = newalts + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + */ + if (unlikely(__pyx_v_newalts == Py_None)) { + PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = PyList_Append(__pyx_v_newalts, __pyx_v_a); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":1063 + * self.error(str(record),self.V33_BAD_ALLELE) + * newalts.append(a) + * alt = newalts # <<<<<<<<<<<<<< + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_newalts)); + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = __pyx_v_newalts; + + /* "cvcf.pyx":1065 + * alt = newalts + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: # <<<<<<<<<<<<<< + * if pos == 0: + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + */ + if (__pyx_v_have_deletions) { + + /* "cvcf.pyx":1066 + * # deletion alleles exist, add dummy 1st reference allele, and account for leading base + * if have_deletions: + * if pos == 0: # <<<<<<<<<<<<<< + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + */ + __pyx_t_5 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_17) { + + /* "cvcf.pyx":1068 + * if pos == 0: + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) # <<<<<<<<<<<<<< + * ref += addn + * alt = [allele+addn for allele in alt] + */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyNumber_Add(__pyx_v_pos, __pyx_t_10); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyNumber_Add(__pyx_v_pos, __pyx_t_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_13 = 0; + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_addn); + __pyx_v_addn = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1069 + * # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + * ref += addn # <<<<<<<<<<<<<< + * alt = [allele+addn for allele in alt] + * else: + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_ref, __pyx_v_addn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1070 + * addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + * ref += addn + * alt = [allele+addn for allele in alt] # <<<<<<<<<<<<<< + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_4); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_v_allele, __pyx_v_addn); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = __pyx_t_1; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L43; + } + /*else*/ { + + /* "cvcf.pyx":1072 + * alt = [allele+addn for allele in alt] + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) # <<<<<<<<<<<<<< + * ref = addn + ref + * alt = [addn + allele for allele in alt] + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__get_sequence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Subtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom); + __Pyx_GIVEREF(__pyx_v_chrom); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_v_pos); + __Pyx_GIVEREF(__pyx_v_pos); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_addn); + __pyx_v_addn = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1073 + * else: + * addn = get_sequence(chrom,pos-1,pos,self._reference) + * ref = addn + ref # <<<<<<<<<<<<<< + * alt = [addn + allele for allele in alt] + * pos -= 1 + */ + __pyx_t_5 = PyNumber_Add(__pyx_v_addn, __pyx_v_ref); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1074 + * addn = get_sequence(chrom,pos-1,pos,self._reference) + * ref = addn + ref + * alt = [addn + allele for allele in alt] # <<<<<<<<<<<<<< + * pos -= 1 + * else: + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_10 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_10); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_10)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_1; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_v_addn, __pyx_v_allele); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = __pyx_t_5; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + + /* "cvcf.pyx":1075 + * ref = addn + ref + * alt = [addn + allele for allele in alt] + * pos -= 1 # <<<<<<<<<<<<<< + * else: + * # format v4.0 -- just check for nucleotides + */ + __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_L43:; + goto __pyx_L42; + } + __pyx_L42:; + goto __pyx_L20; + } + /*else*/ { + + /* "cvcf.pyx":1078 + * else: + * # format v4.0 -- just check for nucleotides + * for allele in alt: # <<<<<<<<<<<<<< + * if not alleleRegEx.match(allele): + * self.error(str(record),self.V40_BAD_ALLELE,allele) + */ + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":1079 + * # format v4.0 -- just check for nucleotides + * for allele in alt: + * if not alleleRegEx.match(allele): # <<<<<<<<<<<<<< + * self.error(str(record),self.V40_BAD_ALLELE,allele) + * + */ + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__alleleRegEx); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__match); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_allele); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_allele); + __Pyx_GIVEREF(__pyx_v_allele); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_16 = (!__pyx_t_17); + if (__pyx_t_16) { + + /* "cvcf.pyx":1080 + * for allele in alt: + * if not alleleRegEx.match(allele): + * self.error(str(record),self.V40_BAD_ALLELE,allele) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__V40_BAD_ALLELE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_allele); + PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_allele); + __Pyx_GIVEREF(__pyx_v_allele); + __pyx_t_1 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L50; + } + __pyx_L50:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L20:; + + /* "cvcf.pyx":1084 + * + * # check for leading nucleotide in indel calls + * for allele in alt: # <<<<<<<<<<<<<< + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) + */ + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_10); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_10; + __pyx_t_10 = 0; + + /* "cvcf.pyx":1085 + * # check for leading nucleotide in indel calls + * for allele in alt: + * if len(allele) != len(ref): # <<<<<<<<<<<<<< + * if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + */ + __pyx_t_12 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = (__pyx_t_12 != __pyx_t_8); + if (__pyx_t_16) { + + /* "cvcf.pyx":1086 + * for allele in alt: + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) # <<<<<<<<<<<<<< + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + * self.error(str(record),self.MISSING_INDEL_ALLELE_REF_BASE) + */ + __pyx_t_8 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = (__pyx_t_8 == 0); + if (__pyx_t_16) { + __pyx_t_10 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__ZERO_LENGTH_ALLELE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_4 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L54; + } + __pyx_L54:; + + /* "cvcf.pyx":1087 + * if len(allele) != len(ref): + * if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): # <<<<<<<<<<<<<< + * self.error(str(record),self.MISSING_INDEL_ALLELE_REF_BASE) + * + */ + __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_RichCompare(__pyx_t_13, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_16) { + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_ref, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_allele, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = PyNumber_Add(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_13, ((PyObject *)__pyx_n_s__N)))); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_3 = __pyx_t_17; + } else { + __pyx_t_3 = __pyx_t_16; + } + if (__pyx_t_3) { + + /* "cvcf.pyx":1088 + * if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) + * if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + * self.error(str(record),self.MISSING_INDEL_ALLELE_REF_BASE) # <<<<<<<<<<<<<< + * + * # trim trailing bases in alleles + */ + __pyx_t_13 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__error); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_record); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_record); + __Pyx_GIVEREF(__pyx_v_record); + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s_113); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L55; + } + __pyx_L55:; + goto __pyx_L53; + } + __pyx_L53:; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "cvcf.pyx":1091 + * + * # trim trailing bases in alleles + * for i in range(1,min(len(ref),min(map(len,alt)))): # <<<<<<<<<<<<<< + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break + */ + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(__pyx_builtin_len); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_builtin_len); + __Pyx_GIVEREF(__pyx_builtin_len); + __Pyx_INCREF(((PyObject *)__pyx_v_alt)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_alt)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_alt)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __pyx_t_1; + } else { + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_5 = __pyx_t_13; + __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + } else { + __pyx_t_5 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1092 + * # trim trailing bases in alleles + * for i in range(1,min(len(ref),min(map(len,alt)))): + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): # <<<<<<<<<<<<<< + * break + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] + */ + { /* enter inner scope */ + PyObject *__pyx_8genexpr1__pyx_v_allele; + __pyx_8genexpr1__pyx_v_allele = Py_None; __Pyx_INCREF(Py_None); + __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + } + __pyx_t_8 = 0; __pyx_t_13 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_13); + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_13)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; + __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele); + __pyx_8genexpr1__pyx_v_allele = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetItemInt(__pyx_8genexpr1__pyx_v_allele, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__upper); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(PySet_Add(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L61_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele); + goto __pyx_L64_exit_scope; + __pyx_L61_error:; + __Pyx_DECREF(__pyx_8genexpr1__pyx_v_allele); + goto __pyx_L1_error; + __pyx_L64_exit_scope:; + } /* exit inner scope */ + __pyx_t_8 = PySet_Size(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_3 = (__pyx_t_8 > 1); + if (!__pyx_t_3) { + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_alt), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_13, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_17 = __pyx_t_16; + } else { + __pyx_t_17 = __pyx_t_3; + } + if (__pyx_t_17) { + + /* "cvcf.pyx":1093 + * for i in range(1,min(len(ref),min(map(len,alt)))): + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break # <<<<<<<<<<<<<< + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] + * + */ + goto __pyx_L57_break; + goto __pyx_L58; + } + __pyx_L58:; + + /* "cvcf.pyx":1094 + * if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + * break + * ref, alt = ref[:-1], [allele[:-1] for allele in alt] # <<<<<<<<<<<<<< + * + * # left-align alleles, if a reference is available + */ + __pyx_t_13 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_10; + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(PyList_Append(__pyx_t_4, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = ((PyObject *)__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_13; + __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + } + __pyx_L57_break:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":1097 + * + * # left-align alleles, if a reference is available + * if self._leftalign and self._reference: # <<<<<<<<<<<<<< + * while left < pos: + * movable = True + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___leftalign); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_17) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___reference); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_16 = __pyx_t_3; + } else { + __pyx_t_16 = __pyx_t_17; + } + if (__pyx_t_16) { + + /* "cvcf.pyx":1098 + * # left-align alleles, if a reference is available + * if self._leftalign and self._reference: + * while left < pos: # <<<<<<<<<<<<<< + * movable = True + * for allele in alt: + */ + while (1) { + __pyx_t_1 = PyObject_RichCompare(__pyx_v_left, __pyx_v_pos, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!__pyx_t_16) break; + + /* "cvcf.pyx":1099 + * if self._leftalign and self._reference: + * while left < pos: + * movable = True # <<<<<<<<<<<<<< + * for allele in alt: + * if len(allele) > len(ref): + */ + __pyx_v_movable = 1; + + /* "cvcf.pyx":1100 + * while left < pos: + * movable = True + * for allele in alt: # <<<<<<<<<<<<<< + * if len(allele) > len(ref): + * longest, shortest = allele, ref + */ + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_1); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_5; + __pyx_t_5 = 0; + + /* "cvcf.pyx":1101 + * movable = True + * for allele in alt: + * if len(allele) > len(ref): # <<<<<<<<<<<<<< + * longest, shortest = allele, ref + * else: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = (__pyx_t_8 > __pyx_t_12); + if (__pyx_t_16) { + + /* "cvcf.pyx":1102 + * for allele in alt: + * if len(allele) > len(ref): + * longest, shortest = allele, ref # <<<<<<<<<<<<<< + * else: + * longest, shortest = ref, allele + */ + __pyx_t_5 = __pyx_v_allele; + __Pyx_INCREF(__pyx_t_5); + __pyx_t_13 = __pyx_v_ref; + __Pyx_INCREF(__pyx_t_13); + __Pyx_DECREF(__pyx_v_longest); + __pyx_v_longest = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_shortest); + __pyx_v_shortest = __pyx_t_13; + __pyx_t_13 = 0; + goto __pyx_L72; + } + /*else*/ { + + /* "cvcf.pyx":1104 + * longest, shortest = allele, ref + * else: + * longest, shortest = ref, allele # <<<<<<<<<<<<<< + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False + */ + __pyx_t_13 = __pyx_v_ref; + __Pyx_INCREF(__pyx_t_13); + __pyx_t_5 = __pyx_v_allele; + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_longest); + __pyx_v_longest = __pyx_t_13; + __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_v_shortest); + __pyx_v_shortest = __pyx_t_5; + __pyx_t_5 = 0; + } + __pyx_L72:; + + /* "cvcf.pyx":1105 + * else: + * longest, shortest = ref, allele + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): # <<<<<<<<<<<<<< + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + */ + __pyx_t_12 = PyObject_Length(__pyx_v_longest); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = (__pyx_t_12 == __pyx_t_8); + if (!__pyx_t_16) { + __pyx_t_8 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PySequence_GetSlice(__pyx_v_longest, 0, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetAttr(__pyx_v_shortest, __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_3 = __pyx_t_17; + } else { + __pyx_t_3 = __pyx_t_16; + } + if (__pyx_t_3) { + + /* "cvcf.pyx":1106 + * longest, shortest = ref, allele + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False # <<<<<<<<<<<<<< + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False + */ + __pyx_v_movable = 0; + goto __pyx_L73; + } + __pyx_L73:; + + /* "cvcf.pyx":1107 + * if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): # <<<<<<<<<<<<<< + * movable = False + * if not movable: + */ + __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_longest, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__upper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = PyObject_Length(__pyx_v_shortest); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = (__pyx_t_8 - 1); + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_longest, __pyx_t_12, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__upper); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_13, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { + + /* "cvcf.pyx":1108 + * movable = False + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False # <<<<<<<<<<<<<< + * if not movable: + * break + */ + __pyx_v_movable = 0; + goto __pyx_L74; + } + __pyx_L74:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":1109 + * if longest[-1].upper() != longest[len(shortest)-1].upper(): + * movable = False + * if not movable: # <<<<<<<<<<<<<< + * break + * ref = ref[:-1] + */ + __pyx_t_3 = (!__pyx_v_movable); + if (__pyx_t_3) { + + /* "cvcf.pyx":1110 + * movable = False + * if not movable: + * break # <<<<<<<<<<<<<< + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] + */ + goto __pyx_L69_break; + goto __pyx_L75; + } + __pyx_L75:; + + /* "cvcf.pyx":1111 + * if not movable: + * break + * ref = ref[:-1] # <<<<<<<<<<<<<< + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + */ + __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_v_ref, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1112 + * break + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] # <<<<<<<<<<<<<< + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_allele, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = __pyx_t_1; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":1113 + * ref = ref[:-1] + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: # <<<<<<<<<<<<<< + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_12 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!__pyx_t_3) { + __pyx_t_6 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = (__pyx_t_6 == 0); + __pyx_t_17 = __pyx_t_16; + } else { + __pyx_t_17 = __pyx_t_3; + } + if (__pyx_t_17) { + + /* "cvcf.pyx":1114 + * alt = [allele[:-1] for allele in alt] + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref # <<<<<<<<<<<<<< + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + * pos -= 1 + */ + __pyx_t_5 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_ref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_ref); + __pyx_v_ref = __pyx_t_1; + __pyx_t_1 = 0; + + /* "cvcf.pyx":1115 + * if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] # <<<<<<<<<<<<<< + * pos -= 1 + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (unlikely(__pyx_v_alt == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = 0; __pyx_t_5 = ((PyObject *)__pyx_v_alt); __Pyx_INCREF(__pyx_t_5); + for (;;) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; + __Pyx_DECREF(__pyx_v_allele); + __pyx_v_allele = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_v_pos, __pyx_v_left); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetItem(__pyx_v_faref_leftflank, __pyx_t_13); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Add(__pyx_t_4, __pyx_v_allele); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_13))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_v_alt)); + __pyx_v_alt = __pyx_t_1; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":1116 + * ref = faref_leftflank[pos-left-1] + ref + * alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + * pos -= 1 # <<<<<<<<<<<<<< + * + * __all__ = [ + */ + __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_pos, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_pos); + __pyx_v_pos = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L78; + } + __pyx_L78:; + } + __pyx_L69_break:; + goto __pyx_L67; + } + __pyx_L67:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_AddTraceback("cvcf.VCF.validate"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_chrom); + __Pyx_DECREF(__pyx_v_pos); + __Pyx_DECREF(__pyx_v_ref); + __Pyx_DECREF(__pyx_v_c); + __Pyx_DECREF(__pyx_v_left); + __Pyx_DECREF(__pyx_v_faref_leftflank); + __Pyx_DECREF(__pyx_v_faref); + __Pyx_DECREF(__pyx_v_f); + __Pyx_DECREF(__pyx_v_newalts); + __Pyx_DECREF(__pyx_v_a); + __Pyx_DECREF(__pyx_v_l); + __Pyx_DECREF(__pyx_v_addns); + __Pyx_DECREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_na); + __Pyx_DECREF(__pyx_v_s); + __Pyx_DECREF(__pyx_v_alt); + __Pyx_DECREF(__pyx_v_addn); + __Pyx_DECREF(__pyx_v_allele); + __Pyx_DECREF(__pyx_v_longest); + __Pyx_DECREF(__pyx_v_shortest); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_4cvcf_VCFRecord __pyx_vtable_4cvcf_VCFRecord; + +static PyObject *__pyx_tp_new_4cvcf_VCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cvcf_VCFRecord *p; + PyObject *o = __pyx_ptype_10TabProxies_TupleProxy->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_4cvcf_VCFRecord *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__pyx_vtabptr_4cvcf_VCFRecord; + p->vcf = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_4cvcf_9VCFRecord_1__cinit__(o, a, k) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_4cvcf_VCFRecord(PyObject *o) { + struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o; + Py_XDECREF(p->vcf); + __pyx_ptype_10TabProxies_TupleProxy->tp_dealloc(o); +} + +static int __pyx_tp_traverse_4cvcf_VCFRecord(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o; + if (__pyx_ptype_10TabProxies_TupleProxy->tp_traverse) { + e = __pyx_ptype_10TabProxies_TupleProxy->tp_traverse(o, v, a); if (e) return e; + } + if (p->vcf) { + e = (*v)(p->vcf, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cvcf_VCFRecord(PyObject *o) { + struct __pyx_obj_4cvcf_VCFRecord *p = (struct __pyx_obj_4cvcf_VCFRecord *)o; + PyObject* tmp; + if (__pyx_ptype_10TabProxies_TupleProxy->tp_clear) { + __pyx_ptype_10TabProxies_TupleProxy->tp_clear(o); + } + tmp = ((PyObject*)p->vcf); + p->vcf = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_4cvcf_VCFRecord(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_contig(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_6contig___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_pos(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_3pos___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_id(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_2id___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_ref(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_3ref___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_alt(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_3alt___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_qual(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_4qual___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_filter(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_6filter___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_info(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_4info___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_format(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_6format___get__(o); +} + +static PyObject *__pyx_getprop_4cvcf_9VCFRecord_samples(PyObject *o, void *x) { + return __pyx_pf_4cvcf_9VCFRecord_7samples___get__(o); +} + +static PyMethodDef __pyx_methods_4cvcf_VCFRecord[] = { + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_4cvcf_VCFRecord[] = { + {(char *)"contig", __pyx_getprop_4cvcf_9VCFRecord_contig, 0, 0, 0}, + {(char *)"pos", __pyx_getprop_4cvcf_9VCFRecord_pos, 0, 0, 0}, + {(char *)"id", __pyx_getprop_4cvcf_9VCFRecord_id, 0, 0, 0}, + {(char *)"ref", __pyx_getprop_4cvcf_9VCFRecord_ref, 0, 0, 0}, + {(char *)"alt", __pyx_getprop_4cvcf_9VCFRecord_alt, 0, 0, 0}, + {(char *)"qual", __pyx_getprop_4cvcf_9VCFRecord_qual, 0, 0, 0}, + {(char *)"filter", __pyx_getprop_4cvcf_9VCFRecord_filter, 0, 0, 0}, + {(char *)"info", __pyx_getprop_4cvcf_9VCFRecord_info, 0, 0, 0}, + {(char *)"format", __pyx_getprop_4cvcf_9VCFRecord_format, 0, 0, 0}, + {(char *)"samples", __pyx_getprop_4cvcf_9VCFRecord_samples, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_VCFRecord = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_VCFRecord = { + __pyx_pf_4cvcf_9VCFRecord_2__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_4cvcf_VCFRecord, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_VCFRecord = { + __pyx_pf_4cvcf_9VCFRecord_2__len__, /*mp_length*/ + __pyx_pf_4cvcf_9VCFRecord_3__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_VCFRecord = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_4cvcf_VCFRecord = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cvcf.VCFRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_4cvcf_VCFRecord), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cvcf_VCFRecord, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_VCFRecord, /*tp_as_number*/ + &__pyx_tp_as_sequence_VCFRecord, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_VCFRecord, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_VCFRecord, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("vcf record.\n\n initialized from data and vcf meta \n "), /*tp_doc*/ + __pyx_tp_traverse_4cvcf_VCFRecord, /*tp_traverse*/ + __pyx_tp_clear_4cvcf_VCFRecord, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cvcf_VCFRecord, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_4cvcf_VCFRecord, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_4cvcf_9VCFRecord___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cvcf_VCFRecord, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyObject *__pyx_tp_new_4cvcf_asVCFRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_4cvcf_asVCFRecord *p; + PyObject *o = __pyx_ptype_6ctabix_Parser->tp_new(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_4cvcf_asVCFRecord *)o); + p->vcffile = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_4cvcf_asVCFRecord(PyObject *o) { + struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o; + Py_XDECREF(p->vcffile); + __pyx_ptype_6ctabix_Parser->tp_dealloc(o); +} + +static int __pyx_tp_traverse_4cvcf_asVCFRecord(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o; + if (__pyx_ptype_6ctabix_Parser->tp_traverse) { + e = __pyx_ptype_6ctabix_Parser->tp_traverse(o, v, a); if (e) return e; + } + if (p->vcffile) { + e = (*v)(p->vcffile, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_4cvcf_asVCFRecord(PyObject *o) { + struct __pyx_obj_4cvcf_asVCFRecord *p = (struct __pyx_obj_4cvcf_asVCFRecord *)o; + PyObject* tmp; + if (__pyx_ptype_6ctabix_Parser->tp_clear) { + __pyx_ptype_6ctabix_Parser->tp_clear(o); + } + tmp = ((PyObject*)p->vcffile); + p->vcffile = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_4cvcf_asVCFRecord[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_asVCFRecord = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_asVCFRecord = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_asVCFRecord = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_asVCFRecord = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_4cvcf_asVCFRecord = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("cvcf.asVCFRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_4cvcf_asVCFRecord), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_4cvcf_asVCFRecord, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_asVCFRecord, /*tp_as_number*/ + &__pyx_tp_as_sequence_asVCFRecord, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_asVCFRecord, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pf_4cvcf_11asVCFRecord_1__call__, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_asVCFRecord, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("converts a :term:`tabix row` into a VCF record."), /*tp_doc*/ + __pyx_tp_traverse_4cvcf_asVCFRecord, /*tp_traverse*/ + __pyx_tp_clear_4cvcf_asVCFRecord, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_4cvcf_asVCFRecord, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_4cvcf_11asVCFRecord___init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_4cvcf_asVCFRecord, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("cvcf"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 1}, + {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0}, + {&__pyx_kp_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_n_s_111, __pyx_k_111, sizeof(__pyx_k_111), 0, 0, 1, 1}, + {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0}, + {&__pyx_n_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 1}, + {&__pyx_kp_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 0}, + {&__pyx_n_s_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 0, 1, 1}, + {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0}, + {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0}, + {&__pyx_kp_s_122, __pyx_k_122, sizeof(__pyx_k_122), 0, 0, 1, 0}, + {&__pyx_kp_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 0}, + {&__pyx_kp_s_128, __pyx_k_128, sizeof(__pyx_k_128), 0, 0, 1, 0}, + {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0}, + {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0}, + {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0}, + {&__pyx_kp_s_134, __pyx_k_134, sizeof(__pyx_k_134), 0, 0, 1, 0}, + {&__pyx_kp_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 0}, + {&__pyx_kp_s_136, __pyx_k_136, sizeof(__pyx_k_136), 0, 0, 1, 0}, + {&__pyx_kp_s_137, __pyx_k_137, sizeof(__pyx_k_137), 0, 0, 1, 0}, + {&__pyx_kp_s_138, __pyx_k_138, sizeof(__pyx_k_138), 0, 0, 1, 0}, + {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 0, 1, 0}, + {&__pyx_kp_s_141, __pyx_k_141, sizeof(__pyx_k_141), 0, 0, 1, 0}, + {&__pyx_kp_s_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 0, 1, 0}, + {&__pyx_kp_s_143, __pyx_k_143, sizeof(__pyx_k_143), 0, 0, 1, 0}, + {&__pyx_kp_s_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 0, 1, 0}, + {&__pyx_kp_s_145, __pyx_k_145, sizeof(__pyx_k_145), 0, 0, 1, 0}, + {&__pyx_kp_s_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 0, 1, 0}, + {&__pyx_kp_s_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 0, 1, 0}, + {&__pyx_kp_s_148, __pyx_k_148, sizeof(__pyx_k_148), 0, 0, 1, 0}, + {&__pyx_kp_s_149, __pyx_k_149, sizeof(__pyx_k_149), 0, 0, 1, 0}, + {&__pyx_kp_s_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 0, 1, 0}, + {&__pyx_kp_s_151, __pyx_k_151, sizeof(__pyx_k_151), 0, 0, 1, 0}, + {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0}, + {&__pyx_kp_s_153, __pyx_k_153, sizeof(__pyx_k_153), 0, 0, 1, 0}, + {&__pyx_kp_s_154, __pyx_k_154, sizeof(__pyx_k_154), 0, 0, 1, 0}, + {&__pyx_kp_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 0}, + {&__pyx_kp_s_156, __pyx_k_156, sizeof(__pyx_k_156), 0, 0, 1, 0}, + {&__pyx_kp_s_157, __pyx_k_157, sizeof(__pyx_k_157), 0, 0, 1, 0}, + {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0}, + {&__pyx_kp_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 0}, + {&__pyx_kp_s_160, __pyx_k_160, sizeof(__pyx_k_160), 0, 0, 1, 0}, + {&__pyx_kp_s_161, __pyx_k_161, sizeof(__pyx_k_161), 0, 0, 1, 0}, + {&__pyx_kp_s_162, __pyx_k_162, sizeof(__pyx_k_162), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, + {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, + {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0}, + {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, + {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1}, + {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0}, + {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0}, + {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, + {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, + {&__pyx_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1}, + {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0}, + {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0}, + {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, + {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0}, + {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, + {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0}, + {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0}, + {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0}, + {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0}, + {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0}, + {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0}, + {&__pyx_kp_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 0}, + {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0}, + {&__pyx_kp_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 0}, + {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0}, + {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0}, + {&__pyx_n_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 1}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0}, + {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0}, + {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0}, + {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0}, + {&__pyx_n_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 1}, + {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0}, + {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0}, + {&__pyx_kp_b_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 0, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 1}, + {&__pyx_kp_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 0}, + {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0}, + {&__pyx_n_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 1}, + {&__pyx_n_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 1}, + {&__pyx_n_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 1}, + {&__pyx_kp_b__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 0, 0}, + {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0}, + {&__pyx_n_s__ACGTN, __pyx_k__ACGTN, sizeof(__pyx_k__ACGTN), 0, 0, 1, 1}, + {&__pyx_n_s__ALT, __pyx_k__ALT, sizeof(__pyx_k__ALT), 0, 0, 1, 1}, + {&__pyx_n_s__BAD_GENOTYPE, __pyx_k__BAD_GENOTYPE, sizeof(__pyx_k__BAD_GENOTYPE), 0, 0, 1, 1}, + {&__pyx_n_s__CHROM, __pyx_k__CHROM, sizeof(__pyx_k__CHROM), 0, 0, 1, 1}, + {&__pyx_n_s__Character, __pyx_k__Character, sizeof(__pyx_k__Character), 0, 0, 1, 1}, + {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1}, + {&__pyx_n_s__DP, __pyx_k__DP, sizeof(__pyx_k__DP), 0, 0, 1, 1}, + {&__pyx_n_s__Description, __pyx_k__Description, sizeof(__pyx_k__Description), 0, 0, 1, 1}, + {&__pyx_n_s__ERROR_INFO_STRING, __pyx_k__ERROR_INFO_STRING, sizeof(__pyx_k__ERROR_INFO_STRING), 0, 0, 1, 1}, + {&__pyx_n_s__ERROR_TRAILING_DATA, __pyx_k__ERROR_TRAILING_DATA, sizeof(__pyx_k__ERROR_TRAILING_DATA), 0, 0, 1, 1}, + {&__pyx_n_s__ERROR_UNKNOWN_KEY, __pyx_k__ERROR_UNKNOWN_KEY, sizeof(__pyx_k__ERROR_UNKNOWN_KEY), 0, 0, 1, 1}, + {&__pyx_n_s__Error, __pyx_k__Error, sizeof(__pyx_k__Error), 0, 0, 1, 1}, + {&__pyx_n_s__FILTER, __pyx_k__FILTER, sizeof(__pyx_k__FILTER), 0, 0, 1, 1}, + {&__pyx_n_s__FILTER_NOT_DEFINED, __pyx_k__FILTER_NOT_DEFINED, sizeof(__pyx_k__FILTER_NOT_DEFINED), 0, 0, 1, 1}, + {&__pyx_n_s__FORMAT, __pyx_k__FORMAT, sizeof(__pyx_k__FORMAT), 0, 0, 1, 1}, + {&__pyx_n_s__FORMAT_NOT_DEFINED, __pyx_k__FORMAT_NOT_DEFINED, sizeof(__pyx_k__FORMAT_NOT_DEFINED), 0, 0, 1, 1}, + {&__pyx_n_s__FT, __pyx_k__FT, sizeof(__pyx_k__FT), 0, 0, 1, 1}, + {&__pyx_n_s__Flag, __pyx_k__Flag, sizeof(__pyx_k__Flag), 0, 0, 1, 1}, + {&__pyx_n_s__Float, __pyx_k__Float, sizeof(__pyx_k__Float), 0, 0, 1, 1}, + {&__pyx_n_s__GQ, __pyx_k__GQ, sizeof(__pyx_k__GQ), 0, 0, 1, 1}, + {&__pyx_n_s__GT, __pyx_k__GT, sizeof(__pyx_k__GT), 0, 0, 1, 1}, + {&__pyx_n_s__GTdata, __pyx_k__GTdata, sizeof(__pyx_k__GTdata), 0, 0, 1, 1}, + {&__pyx_n_s__GTstring, __pyx_k__GTstring, sizeof(__pyx_k__GTstring), 0, 0, 1, 1}, + {&__pyx_n_s__Genotype, __pyx_k__Genotype, sizeof(__pyx_k__Genotype), 0, 0, 1, 1}, + {&__pyx_n_s__HQ, __pyx_k__HQ, sizeof(__pyx_k__HQ), 0, 0, 1, 1}, + {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1}, + {&__pyx_n_s__ID, __pyx_k__ID, sizeof(__pyx_k__ID), 0, 0, 1, 1}, + {&__pyx_n_s__INFO, __pyx_k__INFO, sizeof(__pyx_k__INFO), 0, 0, 1, 1}, + {&__pyx_n_s__Integer, __pyx_k__Integer, sizeof(__pyx_k__Integer), 0, 0, 1, 1}, + {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1}, + {&__pyx_n_s__MISSING_REF, __pyx_k__MISSING_REF, sizeof(__pyx_k__MISSING_REF), 0, 0, 1, 1}, + {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1}, + {&__pyx_n_s__NT_ALLELES, __pyx_k__NT_ALLELES, sizeof(__pyx_k__NT_ALLELES), 0, 0, 1, 1}, + {&__pyx_n_s__NT_GENOTYPES, __pyx_k__NT_GENOTYPES, sizeof(__pyx_k__NT_GENOTYPES), 0, 0, 1, 1}, + {&__pyx_n_s__NT_NR_ALLELES, __pyx_k__NT_NR_ALLELES, sizeof(__pyx_k__NT_NR_ALLELES), 0, 0, 1, 1}, + {&__pyx_n_s__NT_NUMBER, __pyx_k__NT_NUMBER, sizeof(__pyx_k__NT_NUMBER), 0, 0, 1, 1}, + {&__pyx_n_s__NT_PHASED_GENOTYPES, __pyx_k__NT_PHASED_GENOTYPES, sizeof(__pyx_k__NT_PHASED_GENOTYPES), 0, 0, 1, 1}, + {&__pyx_n_s__NT_UNKNOWN, __pyx_k__NT_UNKNOWN, sizeof(__pyx_k__NT_UNKNOWN), 0, 0, 1, 1}, + {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, + {&__pyx_n_s__Number, __pyx_k__Number, sizeof(__pyx_k__Number), 0, 0, 1, 1}, + {&__pyx_n_b__PASS, __pyx_k__PASS, sizeof(__pyx_k__PASS), 0, 0, 0, 1}, + {&__pyx_n_s__PASS, __pyx_k__PASS, sizeof(__pyx_k__PASS), 0, 0, 1, 1}, + {&__pyx_n_s__POS, __pyx_k__POS, sizeof(__pyx_k__POS), 0, 0, 1, 1}, + {&__pyx_n_s__POS_NOT_NUMERICAL, __pyx_k__POS_NOT_NUMERICAL, sizeof(__pyx_k__POS_NOT_NUMERICAL), 0, 0, 1, 1}, + {&__pyx_n_s__POS_NOT_POSITIVE, __pyx_k__POS_NOT_POSITIVE, sizeof(__pyx_k__POS_NOT_POSITIVE), 0, 0, 1, 1}, + {&__pyx_n_s__QUAL, __pyx_k__QUAL, sizeof(__pyx_k__QUAL), 0, 0, 1, 1}, + {&__pyx_n_s__QUAL_NOT_NUMERICAL, __pyx_k__QUAL_NOT_NUMERICAL, sizeof(__pyx_k__QUAL_NOT_NUMERICAL), 0, 0, 1, 1}, + {&__pyx_n_s__REF, __pyx_k__REF, sizeof(__pyx_k__REF), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1}, + {&__pyx_n_s__String, __pyx_k__String, sizeof(__pyx_k__String), 0, 0, 1, 1}, + {&__pyx_n_s__Tabixfile, __pyx_k__Tabixfile, sizeof(__pyx_k__Tabixfile), 0, 0, 1, 1}, + {&__pyx_n_s__Type, __pyx_k__Type, sizeof(__pyx_k__Type), 0, 0, 1, 1}, + {&__pyx_n_s__UNKNOWN_CHAR_IN_REF, __pyx_k__UNKNOWN_CHAR_IN_REF, sizeof(__pyx_k__UNKNOWN_CHAR_IN_REF), 0, 0, 1, 1}, + {&__pyx_n_s__V33_BAD_ALLELE, __pyx_k__V33_BAD_ALLELE, sizeof(__pyx_k__V33_BAD_ALLELE), 0, 0, 1, 1}, + {&__pyx_n_s__V33_BAD_REF, __pyx_k__V33_BAD_REF, sizeof(__pyx_k__V33_BAD_REF), 0, 0, 1, 1}, + {&__pyx_n_s__V40_BAD_ALLELE, __pyx_k__V40_BAD_ALLELE, sizeof(__pyx_k__V40_BAD_ALLELE), 0, 0, 1, 1}, + {&__pyx_n_s__VCF, __pyx_k__VCF, sizeof(__pyx_k__VCF), 0, 0, 1, 1}, + {&__pyx_n_s__VCFRecord, __pyx_k__VCFRecord, sizeof(__pyx_k__VCFRecord), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__WRONG_REF, __pyx_k__WRONG_REF, sizeof(__pyx_k__WRONG_REF), 0, 0, 1, 1}, + {&__pyx_n_s__Warning, __pyx_k__Warning, sizeof(__pyx_k__Warning), 0, 0, 1, 1}, + {&__pyx_n_s__ZERO_LENGTH_ALLELE, __pyx_k__ZERO_LENGTH_ALLELE, sizeof(__pyx_k__ZERO_LENGTH_ALLELE), 0, 0, 1, 1}, + {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1}, + {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___add_definition, __pyx_k___add_definition, sizeof(__pyx_k___add_definition), 0, 0, 1, 1}, + {&__pyx_n_s___copy, __pyx_k___copy, sizeof(__pyx_k___copy), 0, 0, 1, 1}, + {&__pyx_n_s___errors, __pyx_k___errors, sizeof(__pyx_k___errors), 0, 0, 1, 1}, + {&__pyx_n_s___filter, __pyx_k___filter, sizeof(__pyx_k___filter), 0, 0, 1, 1}, + {&__pyx_n_s___format, __pyx_k___format, sizeof(__pyx_k___format), 0, 0, 1, 1}, + {&__pyx_n_s___header, __pyx_k___header, sizeof(__pyx_k___header), 0, 0, 1, 1}, + {&__pyx_n_s___ignored_errors, __pyx_k___ignored_errors, sizeof(__pyx_k___ignored_errors), 0, 0, 1, 1}, + {&__pyx_n_s___info, __pyx_k___info, sizeof(__pyx_k___info), 0, 0, 1, 1}, + {&__pyx_n_s___leftalign, __pyx_k___leftalign, sizeof(__pyx_k___leftalign), 0, 0, 1, 1}, + {&__pyx_n_s___line, __pyx_k___line, sizeof(__pyx_k___line), 0, 0, 1, 1}, + {&__pyx_n_s___lineno, __pyx_k___lineno, sizeof(__pyx_k___lineno), 0, 0, 1, 1}, + {&__pyx_n_s___lines, __pyx_k___lines, sizeof(__pyx_k___lines), 0, 0, 1, 1}, + {&__pyx_n_s___parse, __pyx_k___parse, sizeof(__pyx_k___parse), 0, 0, 1, 1}, + {&__pyx_n_s___parse_header, __pyx_k___parse_header, sizeof(__pyx_k___parse_header), 0, 0, 1, 1}, + {&__pyx_n_s___reference, __pyx_k___reference, sizeof(__pyx_k___reference), 0, 0, 1, 1}, + {&__pyx_n_s___regions, __pyx_k___regions, sizeof(__pyx_k___regions), 0, 0, 1, 1}, + {&__pyx_n_s___required, __pyx_k___required, sizeof(__pyx_k___required), 0, 0, 1, 1}, + {&__pyx_n_s___sample2column, __pyx_k___sample2column, sizeof(__pyx_k___sample2column), 0, 0, 1, 1}, + {&__pyx_n_s___samples, __pyx_k___samples, sizeof(__pyx_k___samples), 0, 0, 1, 1}, + {&__pyx_n_s___version, __pyx_k___version, sizeof(__pyx_k___version), 0, 0, 1, 1}, + {&__pyx_n_s___warn_errors, __pyx_k___warn_errors, sizeof(__pyx_k___warn_errors), 0, 0, 1, 1}, + {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1}, + {&__pyx_n_s__alleleRegEx, __pyx_k__alleleRegEx, sizeof(__pyx_k__alleleRegEx), 0, 0, 1, 1}, + {&__pyx_n_s__alt, __pyx_k__alt, sizeof(__pyx_k__alt), 0, 0, 1, 1}, + {&__pyx_n_s__alt1, __pyx_k__alt1, sizeof(__pyx_k__alt1), 0, 0, 1, 1}, + {&__pyx_n_s__alt2, __pyx_k__alt2, sizeof(__pyx_k__alt2), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__bisect, __pyx_k__bisect, sizeof(__pyx_k__bisect), 0, 0, 1, 1}, + {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, + {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1}, + {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1}, + {&__pyx_n_s__compare_calls, __pyx_k__compare_calls, sizeof(__pyx_k__compare_calls), 0, 0, 1, 1}, + {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1}, + {&__pyx_n_s__connect, __pyx_k__connect, sizeof(__pyx_k__connect), 0, 0, 1, 1}, + {&__pyx_n_s__contig, __pyx_k__contig, sizeof(__pyx_k__contig), 0, 0, 1, 1}, + {&__pyx_n_s__convertGT, __pyx_k__convertGT, sizeof(__pyx_k__convertGT), 0, 0, 1, 1}, + {&__pyx_n_s__convertGTback, __pyx_k__convertGTback, sizeof(__pyx_k__convertGTback), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__cvcf, __pyx_k__cvcf, sizeof(__pyx_k__cvcf), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__datagenerator, __pyx_k__datagenerator, sizeof(__pyx_k__datagenerator), 0, 0, 1, 1}, + {&__pyx_n_s__deepcopy, __pyx_k__deepcopy, sizeof(__pyx_k__deepcopy), 0, 0, 1, 1}, + {&__pyx_n_s__defaultdict, __pyx_k__defaultdict, sizeof(__pyx_k__defaultdict), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__description, __pyx_k__description, sizeof(__pyx_k__description), 0, 0, 1, 1}, + {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1}, + {&__pyx_n_s__endswith, __pyx_k__endswith, sizeof(__pyx_k__endswith), 0, 0, 1, 1}, + {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, + {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1}, + {&__pyx_n_s__errorstring, __pyx_k__errorstring, sizeof(__pyx_k__errorstring), 0, 0, 1, 1}, + {&__pyx_n_s__fa, __pyx_k__fa, sizeof(__pyx_k__fa), 0, 0, 1, 1}, + {&__pyx_n_s__fetch, __pyx_k__fetch, sizeof(__pyx_k__fetch), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__fileformat, __pyx_k__fileformat, sizeof(__pyx_k__fileformat), 0, 0, 1, 1}, + {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, + {&__pyx_n_s__filter, __pyx_k__filter, sizeof(__pyx_k__filter), 0, 0, 1, 1}, + {&__pyx_n_s__find, __pyx_k__find, sizeof(__pyx_k__find), 0, 0, 1, 1}, + {&__pyx_n_s__fmt, __pyx_k__fmt, sizeof(__pyx_k__fmt), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__format_format, __pyx_k__format_format, sizeof(__pyx_k__format_format), 0, 0, 1, 1}, + {&__pyx_n_s__format_formatdata, __pyx_k__format_formatdata, sizeof(__pyx_k__format_formatdata), 0, 0, 1, 1}, + {&__pyx_n_s__formatdict, __pyx_k__formatdict, sizeof(__pyx_k__formatdict), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__get_expected, __pyx_k__get_expected, sizeof(__pyx_k__get_expected), 0, 0, 1, 1}, + {&__pyx_n_s__get_sequence, __pyx_k__get_sequence, sizeof(__pyx_k__get_sequence), 0, 0, 1, 1}, + {&__pyx_n_s__getfilter, __pyx_k__getfilter, sizeof(__pyx_k__getfilter), 0, 0, 1, 1}, + {&__pyx_n_s__getformat, __pyx_k__getformat, sizeof(__pyx_k__getformat), 0, 0, 1, 1}, + {&__pyx_n_s__getheader, __pyx_k__getheader, sizeof(__pyx_k__getheader), 0, 0, 1, 1}, + {&__pyx_n_s__getinfo, __pyx_k__getinfo, sizeof(__pyx_k__getinfo), 0, 0, 1, 1}, + {&__pyx_n_s__getsamples, __pyx_k__getsamples, sizeof(__pyx_k__getsamples), 0, 0, 1, 1}, + {&__pyx_n_s__gtsRegEx, __pyx_k__gtsRegEx, sizeof(__pyx_k__gtsRegEx), 0, 0, 1, 1}, + {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, + {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, + {&__pyx_n_s__ignoreerror, __pyx_k__ignoreerror, sizeof(__pyx_k__ignoreerror), 0, 0, 1, 1}, + {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1}, + {&__pyx_n_s__inregion, __pyx_k__inregion, sizeof(__pyx_k__inregion), 0, 0, 1, 1}, + {&__pyx_n_s__itemgetter, __pyx_k__itemgetter, sizeof(__pyx_k__itemgetter), 0, 0, 1, 1}, + {&__pyx_n_s__itervalues, __pyx_k__itervalues, sizeof(__pyx_k__itervalues), 0, 0, 1, 1}, + {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1}, + {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1}, + {&__pyx_n_s__keys, __pyx_k__keys, sizeof(__pyx_k__keys), 0, 0, 1, 1}, + {&__pyx_n_s__leftalign, __pyx_k__leftalign, sizeof(__pyx_k__leftalign), 0, 0, 1, 1}, + {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 0, 0, 1, 1}, + {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1}, + {&__pyx_n_s__lineparse, __pyx_k__lineparse, sizeof(__pyx_k__lineparse), 0, 0, 1, 1}, + {&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1}, + {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1}, + {&__pyx_n_s__match, __pyx_k__match, sizeof(__pyx_k__match), 0, 0, 1, 1}, + {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1}, + {&__pyx_n_s__missing, __pyx_k__missing, sizeof(__pyx_k__missing), 0, 0, 1, 1}, + {&__pyx_n_s__missingvalue, __pyx_k__missingvalue, sizeof(__pyx_k__missingvalue), 0, 0, 1, 1}, + {&__pyx_n_s__namedtuple, __pyx_k__namedtuple, sizeof(__pyx_k__namedtuple), 0, 0, 1, 1}, + {&__pyx_n_s__nfields, __pyx_k__nfields, sizeof(__pyx_k__nfields), 0, 0, 1, 1}, + {&__pyx_n_s__number, __pyx_k__number, sizeof(__pyx_k__number), 0, 0, 1, 1}, + {&__pyx_n_s__numbertype, __pyx_k__numbertype, sizeof(__pyx_k__numbertype), 0, 0, 1, 1}, + {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1}, + {&__pyx_n_s__opt, __pyx_k__opt, sizeof(__pyx_k__opt), 0, 0, 1, 1}, + {&__pyx_n_s__parse, __pyx_k__parse, sizeof(__pyx_k__parse), 0, 0, 1, 1}, + {&__pyx_n_s__parse_data, __pyx_k__parse_data, sizeof(__pyx_k__parse_data), 0, 0, 1, 1}, + {&__pyx_n_s__parse_format, __pyx_k__parse_format, sizeof(__pyx_k__parse_format), 0, 0, 1, 1}, + {&__pyx_n_s__parse_formatdata, __pyx_k__parse_formatdata, sizeof(__pyx_k__parse_formatdata), 0, 0, 1, 1}, + {&__pyx_n_s__parse_header, __pyx_k__parse_header, sizeof(__pyx_k__parse_header), 0, 0, 1, 1}, + {&__pyx_n_s__parse_heading, __pyx_k__parse_heading, sizeof(__pyx_k__parse_heading), 0, 0, 1, 1}, + {&__pyx_n_s__parse_regions, __pyx_k__parse_regions, sizeof(__pyx_k__parse_regions), 0, 0, 1, 1}, + {&__pyx_n_s__parser, __pyx_k__parser, sizeof(__pyx_k__parser), 0, 0, 1, 1}, + {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1}, + {&__pyx_n_s__pos1, __pyx_k__pos1, sizeof(__pyx_k__pos1), 0, 0, 1, 1}, + {&__pyx_n_s__pos2, __pyx_k__pos2, sizeof(__pyx_k__pos2), 0, 0, 1, 1}, + {&__pyx_n_s__pysam, __pyx_k__pysam, sizeof(__pyx_k__pysam), 0, 0, 1, 1}, + {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1}, + {&__pyx_n_s__record, __pyx_k__record, sizeof(__pyx_k__record), 0, 0, 1, 1}, + {&__pyx_n_s__ref, __pyx_k__ref, sizeof(__pyx_k__ref), 0, 0, 1, 1}, + {&__pyx_n_s__ref1, __pyx_k__ref1, sizeof(__pyx_k__ref1), 0, 0, 1, 1}, + {&__pyx_n_s__ref2, __pyx_k__ref2, sizeof(__pyx_k__ref2), 0, 0, 1, 1}, + {&__pyx_n_s__reference, __pyx_k__reference, sizeof(__pyx_k__reference), 0, 0, 1, 1}, + {&__pyx_n_s__region, __pyx_k__region, sizeof(__pyx_k__region), 0, 0, 1, 1}, + {&__pyx_n_s__regions, __pyx_k__regions, sizeof(__pyx_k__regions), 0, 0, 1, 1}, + {&__pyx_n_s__replace, __pyx_k__replace, sizeof(__pyx_k__replace), 0, 0, 1, 1}, + {&__pyx_n_s__samples, __pyx_k__samples, sizeof(__pyx_k__samples), 0, 0, 1, 1}, + {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1}, + {&__pyx_n_s__separator, __pyx_k__separator, sizeof(__pyx_k__separator), 0, 0, 1, 1}, + {&__pyx_n_s__setfilter, __pyx_k__setfilter, sizeof(__pyx_k__setfilter), 0, 0, 1, 1}, + {&__pyx_n_s__setformat, __pyx_k__setformat, sizeof(__pyx_k__setformat), 0, 0, 1, 1}, + {&__pyx_n_s__setheader, __pyx_k__setheader, sizeof(__pyx_k__setheader), 0, 0, 1, 1}, + {&__pyx_n_s__setinfo, __pyx_k__setinfo, sizeof(__pyx_k__setinfo), 0, 0, 1, 1}, + {&__pyx_n_s__setreference, __pyx_k__setreference, sizeof(__pyx_k__setreference), 0, 0, 1, 1}, + {&__pyx_n_s__setregions, __pyx_k__setregions, sizeof(__pyx_k__setregions), 0, 0, 1, 1}, + {&__pyx_n_s__setsamples, __pyx_k__setsamples, sizeof(__pyx_k__setsamples), 0, 0, 1, 1}, + {&__pyx_n_s__setversion, __pyx_k__setversion, sizeof(__pyx_k__setversion), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, + {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, + {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1}, + {&__pyx_n_s__stream, __pyx_k__stream, sizeof(__pyx_k__stream), 0, 0, 1, 1}, + {&__pyx_n_s__strip, __pyx_k__strip, sizeof(__pyx_k__strip), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__tabixfile, __pyx_k__tabixfile, sizeof(__pyx_k__tabixfile), 0, 0, 1, 1}, + {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1}, + {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1}, + {&__pyx_n_s__validate, __pyx_k__validate, sizeof(__pyx_k__validate), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__vcf, __pyx_k__vcf, sizeof(__pyx_k__vcf), 0, 0, 1, 1}, + {&__pyx_n_s__vcffile, __pyx_k__vcffile, sizeof(__pyx_k__vcffile), 0, 0, 1, 1}, + {&__pyx_n_s__version, __pyx_k__version, sizeof(__pyx_k__version), 0, 0, 1, 1}, + {&__pyx_n_s__warnerror, __pyx_k__warnerror, sizeof(__pyx_k__warnerror), 0, 0, 1, 1}, + {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, + {&__pyx_n_s__write_data, __pyx_k__write_data, sizeof(__pyx_k__write_data), 0, 0, 1, 1}, + {&__pyx_n_s__write_header, __pyx_k__write_header, sizeof(__pyx_k__write_header), 0, 0, 1, 1}, + {&__pyx_n_s__write_heading, __pyx_k__write_heading, sizeof(__pyx_k__write_heading), 0, 0, 1, 1}, + {&__pyx_n_s__writeheader, __pyx_k__writeheader, sizeof(__pyx_k__writeheader), 0, 0, 1, 1}, + {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_map = __Pyx_GetName(__pyx_b, __pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_min = __Pyx_GetName(__pyx_b, __pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_len = __Pyx_GetName(__pyx_b, __pyx_n_s__len); if (!__pyx_builtin_len) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "cvcf.pyx":70 + * def parse_regions( string ): + * result = [] + * for r in string.split(','): # <<<<<<<<<<<<<< + * elts = r.split(':') + * chrom, start, end = elts[0], 0, 3000000000 + */ + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + + /* "cvcf.pyx":71 + * result = [] + * for r in string.split(','): + * elts = r.split(':') # <<<<<<<<<<<<<< + * chrom, start, end = elts[0], 0, 3000000000 + * if len(elts)==1: pass + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "cvcf.pyx":76 + * elif len(elts)==2: + * if len(elts[1])>0: + * ielts = elts[1].split('-') # <<<<<<<<<<<<<< + * if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + * try: start, end = int(ielts[0])-1, int(ielts[1]) + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "cvcf.pyx":152 + * alt = self.fields[4] + * if alt == ".": alt = [] + * else: alt = alt.upper().split(',') # <<<<<<<<<<<<<< + * return alt + * + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "cvcf.pyx":168 + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if f == b"." or f == b"PASS" or f == b"0": return [] + * else: return f.split(';') # <<<<<<<<<<<<<< + * + * property info: + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "cvcf.pyx":176 + * info = {} + * if col != b".": + * for blurp in col.split(';'): # <<<<<<<<<<<<<< + * elts = blurp.split('=') + * if len(elts) == 1: v = None + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "cvcf.pyx":177 + * if col != b".": + * for blurp in col.split(';'): + * elts = blurp.split('=') # <<<<<<<<<<<<<< + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "cvcf.pyx":186 + * property format: + * def __get__(self): + * return self.fields[8].split(':') # <<<<<<<<<<<<<< + * + * property samples: + */ + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + + /* "cvcf.pyx":195 + * + * # parse sample columns + * values = self.fields[self.vcf._sample2column[key]].split(':') # <<<<<<<<<<<<<< + * alt = self.alt + * format = self.format + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "cvcf.pyx":308 + * def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): + * # make error identifiers accessible by name + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id # <<<<<<<<<<<<<< + * if _copy != None: + * self._leftalign = _copy._leftalign + */ + __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + + /* "cvcf.pyx":329 + * def error(self,line,error,opt=None): + * if error in self._ignored_errors: return + * errorlabel, errorstring = self._errors[error].split(':') # <<<<<<<<<<<<<< + * if opt: errorstring = errorstring % opt + * errwarn = ["Error","Warning"][error in self._warn_errors] + */ + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "cvcf.pyx":338 + * def parse_format(self,line,format,filter=False): + * if self._version == 40: + * if not format.startswith('<'): # <<<<<<<<<<<<<< + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format = "<"+format + */ + __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + + /* "cvcf.pyx":341 + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format = "<"+format + * if not format.endswith('>'): # <<<<<<<<<<<<<< + * self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + * format += ">" + */ + __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_30)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + + /* "cvcf.pyx":348 + * idx = 0 + * while len(format.strip())>0: + * elts = format.strip().split(',') # <<<<<<<<<<<<<< + * first, rest = elts[0], ','.join(elts[1:]) + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + */ + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + + /* "cvcf.pyx":350 + * elts = format.strip().split(',') + * first, rest = elts[0], ','.join(elts[1:]) + * if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): # <<<<<<<<<<<<<< + * if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_34)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_34)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + + /* "cvcf.pyx":354 + * if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + * first = ["ID=","Number=","Type=","Description="][idx] + first + * if first.startswith('ID='): data['id'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + */ + __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); + PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44)); + __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); + + /* "cvcf.pyx":355 + * first = ["ID=","Number=","Type=","Description="][idx] + first + * if first.startswith('ID='): data['id'] = first.split('=')[1] + * elif first.startswith('Number='): data['number'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): + */ + __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_41)); + PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_41)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46)); + __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); + + /* "cvcf.pyx":356 + * if first.startswith('ID='): data['id'] = first.split('=')[1] + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] # <<<<<<<<<<<<<< + * elif first.startswith('Description='): + * elts = format.split('"') + */ + __pyx_k_tuple_48 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_42)); + PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_kp_s_42)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); + __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + + /* "cvcf.pyx":357 + * elif first.startswith('Number='): data['number'] = first.split('=')[1] + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): # <<<<<<<<<<<<<< + * elts = format.split('"') + * if len(elts)<3: + */ + __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_43)); + PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_43)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); + + /* "cvcf.pyx":358 + * elif first.startswith('Type='): data['type'] = first.split('=')[1] + * elif first.startswith('Description='): + * elts = format.split('"') # <<<<<<<<<<<<<< + * if len(elts)<3: + * self.error(line,self.FORMAT_MISSING_QUOTES) + */ + __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_34)); + PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + + /* "cvcf.pyx":361 + * if len(elts)<3: + * self.error(line,self.FORMAT_MISSING_QUOTES) + * elts = first.split('=') + [rest] # <<<<<<<<<<<<<< + * data['descr'] = elts[1] + * rest = '"'.join(elts[2:]) + */ + __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + + /* "cvcf.pyx":364 + * data['descr'] = elts[1] + * rest = '"'.join(elts[2:]) + * if rest.startswith(','): rest = rest[1:] # <<<<<<<<<<<<<< + * else: + * self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + */ + __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); + + /* "cvcf.pyx":474 + * # snip off trailing missing data + * while len(output) > 1: + * last = output[-1].replace(',','').replace('.','') # <<<<<<<<<<<<<< + * if len(last)>0: break + * output = output[:-1] + */ + __pyx_k_tuple_67 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); + __pyx_k_tuple_68 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_68, 1, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); + + /* "cvcf.pyx":490 + * + * def parse_header( self, line ): + * assert line.startswith('##') # <<<<<<<<<<<<<< + * elts = line[2:].split('=') + * key = elts[0].strip() + */ + __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_74)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_73)); + PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74)); + + /* "cvcf.pyx":491 + * def parse_header( self, line ): + * assert line.startswith('##') + * elts = line[2:].split('=') # <<<<<<<<<<<<<< + * key = elts[0].strip() + * value = '='.join(elts[1:]).strip() + */ + __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_75)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); + + /* "cvcf.pyx":526 + * + * def parse_heading( self, line ): + * assert line.startswith('#') # <<<<<<<<<<<<<< + * assert not line.startswith('##') + * headings = line[1:].split('\t') + */ + __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_83)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_82)); + PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_82)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83)); + + /* "cvcf.pyx":527 + * def parse_heading( self, line ): + * assert line.startswith('#') + * assert not line.startswith('##') # <<<<<<<<<<<<<< + * headings = line[1:].split('\t') + * if len(headings)==1 and len(line[1:].split()) >= 9: + */ + __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_73)); + PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); + + /* "cvcf.pyx":528 + * assert line.startswith('#') + * assert not line.startswith('##') + * headings = line[1:].split('\t') # <<<<<<<<<<<<<< + * if len(headings)==1 and len(line[1:].split()) >= 9: + * self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) + */ + __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_86)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_85)); + PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_85)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86)); + + /* "cvcf.pyx":581 + * if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + * return [] + * values = value.split(',') # <<<<<<<<<<<<<< + * # deal with trailing data in some early VCF files + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + */ + __pyx_k_tuple_94 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_94)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94)); + + /* "cvcf.pyx":583 + * values = value.split(',') + * # deal with trailing data in some early VCF files + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: # <<<<<<<<<<<<<< + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + * values[-1] = values[-1].split(';')[0] + */ + __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95)); + + /* "cvcf.pyx":585 + * if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + * self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + * values[-1] = values[-1].split(';')[0] # <<<<<<<<<<<<<< + * if f.type == "Integer": + * for idx,v in enumerate(values): + */ + __pyx_k_tuple_96 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_96)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96)); + + /* "cvcf.pyx":623 + * + * def parse_data( self, line, lineparse=False ): + * cols = line.split('\t') # <<<<<<<<<<<<<< + * if len(cols) != len(self._samples)+9: + * # gracefully deal with absent FORMAT column + */ + __pyx_k_tuple_100 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_100)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_85)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_kp_s_85)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_85)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); + + /* "cvcf.pyx":668 + * # convert v3.3 to v4.0 alleles below + * if cols[4] == ".": alt = [] + * else: alt = cols[4].upper().split(',') # <<<<<<<<<<<<<< + * + * if cols[5] == ".": qual = -1 + */ + __pyx_k_tuple_104 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_104)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + + /* "cvcf.pyx":677 + * # postpone checking that filters exist. Encode missing filter or no filtering as empty list + * if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = [] + * else: filter = cols[6].split(';') # <<<<<<<<<<<<<< + * + * # dictionary of keys, and list of values + */ + __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_105)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105)); + + /* "cvcf.pyx":682 + * info = {} + * if cols[7] != ".": + * for blurp in cols[7].split(';'): # <<<<<<<<<<<<<< + * elts = blurp.split('=') + * if len(elts) == 1: v = None + */ + __pyx_k_tuple_106 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); + + /* "cvcf.pyx":683 + * if cols[7] != ".": + * for blurp in cols[7].split(';'): + * elts = blurp.split('=') # <<<<<<<<<<<<<< + * if len(elts) == 1: v = None + * elif len(elts) == 2: v = elts[1] + */ + __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_107)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); + PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107)); + + /* "cvcf.pyx":691 + * # Gracefully deal with absent FORMAT column + * if cols[8] == "": format = [] + * else: format = cols[8].split(':') # <<<<<<<<<<<<<< + * + * # check: all filters are defined + */ + __pyx_k_tuple_108 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_108)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_108, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_108)); + + /* "cvcf.pyx":708 + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('D'): # allow D and D + * have_deletions = True + */ + __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__I)); + PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_n_s__I)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109)); + + /* "cvcf.pyx":709 + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D # <<<<<<<<<<<<<< + * have_deletions = True + * try: + */ + __pyx_k_tuple_110 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110)); + + /* "cvcf.pyx":789 + * for sample in cols[9:]: + * dict = {} + * values = sample.split(':') # <<<<<<<<<<<<<< + * if len(values) > len(format): + * self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + */ + __pyx_k_tuple_114 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_114)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_114, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_114)); + + /* "cvcf.pyx":855 + * for line in stream: + * self._lineno += 1 + * if line.startswith('##'): # <<<<<<<<<<<<<< + * self.parse_header( line.strip() ) + * elif line.startswith('#'): + */ + __pyx_k_tuple_116 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_116)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_73)); + PyTuple_SET_ITEM(__pyx_k_tuple_116, 0, ((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_73)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_116)); + + /* "cvcf.pyx":857 + * if line.startswith('##'): + * self.parse_header( line.strip() ) + * elif line.startswith('#'): # <<<<<<<<<<<<<< + * self.parse_heading( line.strip() ) + * self.enter_default_format() + */ + __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_82)); + PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_82)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_82)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117)); + + /* "cvcf.pyx":921 + * + * def setversion(self, version): + * if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") # <<<<<<<<<<<<<< + * self._version = version + * + */ + __pyx_k_tuple_120 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_120)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_119)); + PyTuple_SET_ITEM(__pyx_k_tuple_120, 0, ((PyObject *)__pyx_kp_s_119)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_119)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_120)); + + /* "cvcf.pyx":999 + * ''' + * + * raise NotImplementedError( "needs to be checked" ) # <<<<<<<<<<<<<< + * + * chrom, pos = record.chrom, record.pos + */ + __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_122)); + PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_122)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_122)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123)); + + /* "cvcf.pyx":1040 + * for a in alt: + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference # <<<<<<<<<<<<<< + * elif a.startswith('D'): # allow D and D + * have_deletions = True + */ + __pyx_k_tuple_124 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_124)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__I)); + PyTuple_SET_ITEM(__pyx_k_tuple_124, 0, ((PyObject *)__pyx_n_s__I)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_124)); + + /* "cvcf.pyx":1041 + * if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + * elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + * elif a.startswith('D'): # allow D and D # <<<<<<<<<<<<<< + * have_deletions = True + * try: + */ + __pyx_k_tuple_125 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_125)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_125, 0, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125)); + + /* "cvcf.pyx":54 + * import pysam + * + * gtsRegEx = re.compile("[|/\\\\]") # <<<<<<<<<<<<<< + * alleleRegEx = re.compile('^[ACGTN]+$') + * + */ + __pyx_k_tuple_127 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_127)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_126)); + PyTuple_SET_ITEM(__pyx_k_tuple_127, 0, ((PyObject *)__pyx_kp_s_126)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_126)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127)); + + /* "cvcf.pyx":55 + * + * gtsRegEx = re.compile("[|/\\\\]") + * alleleRegEx = re.compile('^[ACGTN]+$') # <<<<<<<<<<<<<< + * + * # Utility function. Uses 0-based coordinates + */ + __pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_129)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_128)); + PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_128)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_128)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129)); + + /* "cvcf.pyx":86 + * + * + * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue') # <<<<<<<<<<<<<< + * + * ########################################################################################################### + */ + __pyx_k_tuple_131 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_131)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT)); + PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_n_s__FORMAT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_130)); + PyTuple_SET_ITEM(__pyx_k_tuple_131, 1, ((PyObject *)__pyx_kp_s_130)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_130)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + #if PY_VERSION_HEX < 0x02040000 + if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_9 = PyInt_FromLong(9); if (unlikely(!__pyx_int_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_11 = PyInt_FromLong(11); if (unlikely(!__pyx_int_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_13 = PyInt_FromLong(13); if (unlikely(!__pyx_int_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_18 = PyInt_FromLong(18); if (unlikely(!__pyx_int_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_21 = PyInt_FromLong(21); if (unlikely(!__pyx_int_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_22 = PyInt_FromLong(22); if (unlikely(!__pyx_int_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_23 = PyInt_FromLong(23); if (unlikely(!__pyx_int_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_25 = PyInt_FromLong(25); if (unlikely(!__pyx_int_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_26 = PyInt_FromLong(26); if (unlikely(!__pyx_int_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_27 = PyInt_FromLong(27); if (unlikely(!__pyx_int_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_28 = PyInt_FromLong(28); if (unlikely(!__pyx_int_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_29 = PyInt_FromLong(29); if (unlikely(!__pyx_int_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_30 = PyInt_FromLong(30); if (unlikely(!__pyx_int_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3000000000 = PyInt_FromString((char *)"3000000000", 0, 0); if (unlikely(!__pyx_int_3000000000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initcvcf(void); /*proto*/ +PyMODINIT_FUNC initcvcf(void) +#else +PyMODINIT_FUNC PyInit_cvcf(void); /*proto*/ +PyMODINIT_FUNC PyInit_cvcf(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_cvcf(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cvcf"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_cvcf) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_ptype_10TabProxies_TupleProxy = __Pyx_ImportType("TabProxies", "TupleProxy", sizeof(struct __pyx_obj_10TabProxies_TupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_TupleProxy = (struct __pyx_vtabstruct_10TabProxies_TupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_TupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_TupleProxy)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_4cvcf_VCFRecord = &__pyx_vtable_4cvcf_VCFRecord; + __pyx_vtable_4cvcf_VCFRecord.__pyx_base = *__pyx_vtabptr_10TabProxies_TupleProxy; + __pyx_vtable_4cvcf_VCFRecord.__pyx_base.update = (PyObject *(*)(struct __pyx_obj_10TabProxies_TupleProxy *, char *, size_t))__pyx_f_4cvcf_9VCFRecord_update; + __pyx_type_4cvcf_VCFRecord.tp_base = __pyx_ptype_10TabProxies_TupleProxy; + if (PyType_Ready(&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_4cvcf_VCFRecord.tp_dict, __pyx_vtabptr_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "VCFRecord", (PyObject *)&__pyx_type_4cvcf_VCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cvcf_VCFRecord = &__pyx_type_4cvcf_VCFRecord; + __pyx_ptype_6ctabix_Parser = __Pyx_ImportType("ctabix", "Parser", sizeof(struct __pyx_obj_6ctabix_Parser), 1); if (unlikely(!__pyx_ptype_6ctabix_Parser)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_4cvcf_asVCFRecord.tp_base = __pyx_ptype_6ctabix_Parser; + if (PyType_Ready(&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "asVCFRecord", (PyObject *)&__pyx_type_4cvcf_asVCFRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_4cvcf_asVCFRecord = &__pyx_type_4cvcf_asVCFRecord; + /*--- Type import code ---*/ + __pyx_ptype_6ctabix_Tabixfile = __Pyx_ImportType("ctabix", "Tabixfile", sizeof(struct __pyx_obj_6ctabix_Tabixfile), 1); if (unlikely(!__pyx_ptype_6ctabix_Tabixfile)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_GTFProxy = __Pyx_ImportType("TabProxies", "GTFProxy", sizeof(struct __pyx_obj_10TabProxies_GTFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_GTFProxy = (struct __pyx_vtabstruct_10TabProxies_GTFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_GTFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_GTFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_NamedTupleProxy = __Pyx_ImportType("TabProxies", "NamedTupleProxy", sizeof(struct __pyx_obj_10TabProxies_NamedTupleProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_NamedTupleProxy = (struct __pyx_vtabstruct_10TabProxies_NamedTupleProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_NamedTupleProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_NamedTupleProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_BedProxy = __Pyx_ImportType("TabProxies", "BedProxy", sizeof(struct __pyx_obj_10TabProxies_BedProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_BedProxy = (struct __pyx_vtabstruct_10TabProxies_BedProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_BedProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_BedProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_10TabProxies_VCFProxy = __Pyx_ImportType("TabProxies", "VCFProxy", sizeof(struct __pyx_obj_10TabProxies_VCFProxy), 1); if (unlikely(!__pyx_ptype_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_10TabProxies_VCFProxy = (struct __pyx_vtabstruct_10TabProxies_VCFProxy*)__Pyx_GetVtable(__pyx_ptype_10TabProxies_VCFProxy->tp_dict); if (unlikely(!__pyx_vtabptr_10TabProxies_VCFProxy)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "cvcf.pyx":46 + * # + * + * from collections import namedtuple, defaultdict # <<<<<<<<<<<<<< + * from operator import itemgetter + * import sys, re, copy, bisect + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__namedtuple)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__namedtuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__namedtuple)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__defaultdict)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__defaultdict)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defaultdict)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__namedtuple, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__defaultdict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":47 + * + * from collections import namedtuple, defaultdict + * from operator import itemgetter # <<<<<<<<<<<<<< + * import sys, re, copy, bisect + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__itemgetter)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__itemgetter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itemgetter)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__itemgetter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itemgetter, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":48 + * from collections import namedtuple, defaultdict + * from operator import itemgetter + * import sys, re, copy, bisect # <<<<<<<<<<<<<< + * + * cimport ctabix + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__bisect), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bisect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":52 + * cimport ctabix + * cimport TabProxies + * import pysam # <<<<<<<<<<<<<< + * + * gtsRegEx = re.compile("[|/\\\\]") + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__pysam), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pysam, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":54 + * import pysam + * + * gtsRegEx = re.compile("[|/\\\\]") # <<<<<<<<<<<<<< + * alleleRegEx = re.compile('^[ACGTN]+$') + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_127), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gtsRegEx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":55 + * + * gtsRegEx = re.compile("[|/\\\\]") + * alleleRegEx = re.compile('^[ACGTN]+$') # <<<<<<<<<<<<<< + * + * # Utility function. Uses 0-based coordinates + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__compile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__alleleRegEx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":58 + * + * # Utility function. Uses 0-based coordinates + * def get_sequence(chrom, start, end, fa): # <<<<<<<<<<<<<< + * # obtain sequence from .fa file, without truncation + * if end<=start: return "" + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cvcf_get_sequence, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_sequence, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":68 + * + * # Utility function. Parses a region string + * def parse_regions( string ): # <<<<<<<<<<<<<< + * result = [] + * for r in string.split(','): + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4cvcf_1parse_regions, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__parse_regions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":86 + * + * + * FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue') # <<<<<<<<<<<<<< + * + * ########################################################################################################### + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__namedtuple); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FORMAT, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "cvcf.pyx":232 + * return r + * + * class VCF(object): # <<<<<<<<<<<<<< + * + * # types + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "cvcf.pyx":235 + * + * # types + * NT_UNKNOWN = 0 # <<<<<<<<<<<<<< + * NT_NUMBER = 1 + * NT_ALLELES = 2 + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_UNKNOWN, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":236 + * # types + * NT_UNKNOWN = 0 + * NT_NUMBER = 1 # <<<<<<<<<<<<<< + * NT_ALLELES = 2 + * NT_NR_ALLELES = 3 + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NUMBER, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":237 + * NT_UNKNOWN = 0 + * NT_NUMBER = 1 + * NT_ALLELES = 2 # <<<<<<<<<<<<<< + * NT_NR_ALLELES = 3 + * NT_GENOTYPES = 4 + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_ALLELES, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":238 + * NT_NUMBER = 1 + * NT_ALLELES = 2 + * NT_NR_ALLELES = 3 # <<<<<<<<<<<<<< + * NT_GENOTYPES = 4 + * NT_PHASED_GENOTYPES = 5 + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_NR_ALLELES, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":239 + * NT_ALLELES = 2 + * NT_NR_ALLELES = 3 + * NT_GENOTYPES = 4 # <<<<<<<<<<<<<< + * NT_PHASED_GENOTYPES = 5 + * + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_GENOTYPES, __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":240 + * NT_NR_ALLELES = 3 + * NT_GENOTYPES = 4 + * NT_PHASED_GENOTYPES = 5 # <<<<<<<<<<<<<< + * + * _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier", + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__NT_PHASED_GENOTYPES, __pyx_int_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":242 + * NT_PHASED_GENOTYPES = 5 + * + * _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier", # <<<<<<<<<<<<<< + * 1:"BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string", + * 2:"BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s", + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, ((PyObject *)__pyx_kp_s_132)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, ((PyObject *)__pyx_kp_s_133)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, ((PyObject *)__pyx_kp_s_134)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, ((PyObject *)__pyx_kp_s_135)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, ((PyObject *)__pyx_kp_s_136)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, ((PyObject *)__pyx_kp_s_137)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, ((PyObject *)__pyx_kp_s_138)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, ((PyObject *)__pyx_kp_s_139)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, ((PyObject *)__pyx_kp_s_140)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, ((PyObject *)__pyx_kp_s_141)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, ((PyObject *)__pyx_kp_s_142)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, ((PyObject *)__pyx_kp_s_143)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, ((PyObject *)__pyx_kp_s_144)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, ((PyObject *)__pyx_kp_s_145)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, ((PyObject *)__pyx_kp_s_146)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, ((PyObject *)__pyx_kp_s_147)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, ((PyObject *)__pyx_kp_s_148)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, ((PyObject *)__pyx_kp_s_149)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, ((PyObject *)__pyx_kp_s_150)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, ((PyObject *)__pyx_kp_s_151)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, ((PyObject *)__pyx_kp_s_152)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, ((PyObject *)__pyx_kp_s_153)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, ((PyObject *)__pyx_kp_s_154)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, ((PyObject *)__pyx_kp_s_155)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, ((PyObject *)__pyx_kp_s_156)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, ((PyObject *)__pyx_kp_s_157)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, ((PyObject *)__pyx_kp_s_158)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, ((PyObject *)__pyx_kp_s_159)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, ((PyObject *)__pyx_kp_s_160)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, ((PyObject *)__pyx_kp_s_161)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, ((PyObject *)__pyx_kp_s_162)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___errors, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":276 + * + * # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields + * _header = [] # <<<<<<<<<<<<<< + * + * # version number; 33=v3.3; 40=v4.0 + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___header, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":279 + * + * # version number; 33=v3.3; 40=v4.0 + * _version = 40 # <<<<<<<<<<<<<< + * + * # info, filter and format data + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___version, __pyx_int_40) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":282 + * + * # info, filter and format data + * _info = {} # <<<<<<<<<<<<<< + * _filter = {} + * _format = {} + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___info, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":283 + * # info, filter and format data + * _info = {} + * _filter = {} # <<<<<<<<<<<<<< + * _format = {} + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___filter, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":284 + * _info = {} + * _filter = {} + * _format = {} # <<<<<<<<<<<<<< + * + * # header; and required columns + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___format, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":287 + * + * # header; and required columns + * _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"] # <<<<<<<<<<<<<< + * _samples = [] + * + */ + __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__CHROM)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__CHROM)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__CHROM)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__POS)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__POS)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__POS)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ID)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__ID)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ID)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__REF)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__REF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REF)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ALT)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__ALT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ALT)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__QUAL)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__QUAL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__QUAL)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FILTER)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__FILTER)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FILTER)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__INFO)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__INFO)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__INFO)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__FORMAT)); + PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__FORMAT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORMAT)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___required, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":288 + * # header; and required columns + * _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"] + * _samples = [] # <<<<<<<<<<<<<< + * + * # control behaviour + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___samples, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "cvcf.pyx":291 + * + * # control behaviour + * _ignored_errors = set([11]) # ERROR_UNKNOWN_KEY # <<<<<<<<<<<<<< + * _warn_errors = set([]) + * _leftalign = False + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_int_11); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_11); + __Pyx_GIVEREF(__pyx_int_11); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___ignored_errors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":292 + * # control behaviour + * _ignored_errors = set([11]) # ERROR_UNKNOWN_KEY + * _warn_errors = set([]) # <<<<<<<<<<<<<< + * _leftalign = False + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___warn_errors, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":293 + * _ignored_errors = set([11]) # ERROR_UNKNOWN_KEY + * _warn_errors = set([]) + * _leftalign = False # <<<<<<<<<<<<<< + * + * # reference sequence + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___leftalign, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":296 + * + * # reference sequence + * _reference = None # <<<<<<<<<<<<<< + * + * # regions to include; None includes everything + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___reference, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":299 + * + * # regions to include; None includes everything + * _regions = None # <<<<<<<<<<<<<< + * + * # statefull stuff + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___regions, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":302 + * + * # statefull stuff + * _lineno = -1 # <<<<<<<<<<<<<< + * _line = None + * _lines = None + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lineno, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":303 + * # statefull stuff + * _lineno = -1 + * _line = None # <<<<<<<<<<<<<< + * _lines = None + * + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___line, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":304 + * _lineno = -1 + * _line = None + * _lines = None # <<<<<<<<<<<<<< + * + * def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): + */ + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___lines, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "cvcf.pyx":306 + * _lines = None + * + * def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): # <<<<<<<<<<<<<< + * # make error identifiers accessible by name + * for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_22 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF___init__, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":327 + * self._lines = lines + * + * def error(self,line,error,opt=None): # <<<<<<<<<<<<<< + * if error in self._ignored_errors: return + * errorlabel, errorstring = self._errors[error].split(':') + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_1error, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__error, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":336 + * raise ValueError(errorstring) + * + * def parse_format(self,line,format,filter=False): # <<<<<<<<<<<<<< + * if self._version == 40: + * if not format.startswith('<'): + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_26 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_2parse_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":398 + * + * + * def format_format( self, fmt, filter=False ): # <<<<<<<<<<<<<< + * values = [('ID',fmt.id)] + * if fmt.number != None and not filter: + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_60 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_3format_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_format, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":418 + * return format + * + * def get_expected(self, format, formatdict, alt): # <<<<<<<<<<<<<< + * fmt = formatdict[format] + * if fmt.numbertype == self.NT_UNKNOWN: return -1 + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_4get_expected, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__get_expected, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":429 + * + * + * def _add_definition(self, formatdict, key, data, line ): # <<<<<<<<<<<<<< + * if key in formatdict: return + * self.error(line,self.ERROR_UNKNOWN_KEY,key) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_5_add_definition, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___add_definition, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":446 + * + * # todo: trim trailing missing values + * def format_formatdata( self, data, format, key=True, value=True, separator=":" ): # <<<<<<<<<<<<<< + * output, sdata = [], [] + * if type(data) == type([]): # for FORMAT field, make data with dummy values + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_64 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_65 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_6format_formatdata, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__format_formatdata, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":480 + * + * + * def enter_default_format(self): # <<<<<<<<<<<<<< + * for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), + * FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_7enter_default_format, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_118, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":489 + * self._format[f.id] = f + * + * def parse_header( self, line ): # <<<<<<<<<<<<<< + * assert line.startswith('##') + * elts = line[2:].split('=') + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_8parse_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":518 + * + * + * def write_header( self, stream ): # <<<<<<<<<<<<<< + * stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) + * for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_9write_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":525 + * + * + * def parse_heading( self, line ): # <<<<<<<<<<<<<< + * assert line.startswith('#') + * assert not line.startswith('##') + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_10parse_heading, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_heading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":553 + * self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] ) + * + * def write_heading( self, stream ): # <<<<<<<<<<<<<< + * stream.write("#" + "\t".join(self._required + self._samples) + "\n") + * + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_11write_heading, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_heading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":556 + * stream.write("#" + "\t".join(self._required + self._samples) + "\n") + * + * def convertGT(self, GTstring): # <<<<<<<<<<<<<< + * if GTstring == ".": return ["."] + * try: + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_12convertGT, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__convertGT, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":569 + * + * + * def convertGTback(self, GTdata): # <<<<<<<<<<<<<< + * return ''.join(map(str,GTdata)) + * + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_13convertGTback, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__convertGTback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":572 + * return ''.join(map(str,GTdata)) + * + * def parse_formatdata( self, key, value, formatdict, line ): # <<<<<<<<<<<<<< + * # To do: check that the right number of values is present + * f = formatdict.get(key,None) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_14parse_formatdata, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_formatdata, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":615 + * + * + * def inregion(self, chrom, pos): # <<<<<<<<<<<<<< + * if not self._regions: return True + * for r in self._regions: + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_15inregion, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__inregion, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":622 + * + * + * def parse_data( self, line, lineparse=False ): # <<<<<<<<<<<<<< + * cols = line.split('\t') + * if len(cols) != len(self._samples)+9: + */ + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_k_99 = __pyx_t_1; + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_16parse_data, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":822 + * + * + * def write_data(self, stream, data): # <<<<<<<<<<<<<< + * required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples + * for k in required: + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_17write_data, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":851 + * stream.write( "\t".join(output) + "\n" ) + * + * def _parse_header(self, stream): # <<<<<<<<<<<<<< + * self._lineno = 0 + * for line in stream: + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_18_parse_header, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___parse_header, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":864 + * return line + * + * def _parse(self, line, stream): # <<<<<<<<<<<<<< + * if len(line.strip()) > 0: + * d = self.parse_data( line.strip() ) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_19_parse, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s___parse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":880 + * ###################################################################################################### + * + * def getsamples(self): # <<<<<<<<<<<<<< + * """ List of samples in VCF file """ + * return self._samples + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_20getsamples, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getsamples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":884 + * return self._samples + * + * def setsamples(self,samples): # <<<<<<<<<<<<<< + * """ List of samples in VCF file """ + * self._samples = samples + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_21setsamples, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setsamples, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":888 + * self._samples = samples + * + * def getheader(self): # <<<<<<<<<<<<<< + * """ List of header key-value pairs (strings) """ + * return self._header + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_22getheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":892 + * return self._header + * + * def setheader(self,header): # <<<<<<<<<<<<<< + * """ List of header key-value pairs (strings) """ + * self._header = header + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_23setheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":896 + * self._header = header + * + * def getinfo(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * return self._info + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_24getinfo, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getinfo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":900 + * return self._info + * + * def setinfo(self,info): # <<<<<<<<<<<<<< + * """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + * self._info = info + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_25setinfo, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setinfo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":904 + * self._info = info + * + * def getformat(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * return self._format + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_26getformat, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":908 + * return self._format + * + * def setformat(self,format): # <<<<<<<<<<<<<< + * """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + * self._format = format + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_27setformat, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setformat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":912 + * self._format = format + * + * def getfilter(self): # <<<<<<<<<<<<<< + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * return self._filter + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_28getfilter, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__getfilter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":916 + * return self._filter + * + * def setfilter(self,filter): # <<<<<<<<<<<<<< + * """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + * self._filter = filter + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_29setfilter, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setfilter, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":920 + * self._filter = filter + * + * def setversion(self, version): # <<<<<<<<<<<<<< + * if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") + * self._version = version + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_30setversion, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setversion, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":924 + * self._version = version + * + * def setregions(self, regions): # <<<<<<<<<<<<<< + * self._regions = regions + * + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_31setregions, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setregions, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":927 + * self._regions = regions + * + * def setreference(self, ref): # <<<<<<<<<<<<<< + * """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """ + * self._reference = ref + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_32setreference, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__setreference, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":931 + * self._reference = ref + * + * def ignoreerror(self, errorstring): # <<<<<<<<<<<<<< + * try: self._ignored_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_33ignoreerror, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__ignoreerror, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":935 + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + * def warnerror(self, errorstring): # <<<<<<<<<<<<<< + * try: self._warn_errors.add(self.__dict__[errorstring]) + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_34warnerror, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__warnerror, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":939 + * except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + * + * def parse(self, stream): # <<<<<<<<<<<<<< + * """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + * last_line = self._parse_header(stream) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_35parse, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__parse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":946 + * return self._parse(last_line, stream) + * + * def write(self, stream, datagenerator): # <<<<<<<<<<<<<< + * """ Writes a VCF file to a stream, using a data generator (or list) """ + * self.write_header(stream) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_36write, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__write, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":952 + * for data in datagenerator: self.write_data(stream,data) + * + * def writeheader(self, stream): # <<<<<<<<<<<<<< + * """ Writes a VCF header """ + * self.write_header(stream) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_37writeheader, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__writeheader, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":957 + * self.write_heading(stream) + * + * def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2): # <<<<<<<<<<<<<< + * """ Utility function: compares two calls for equality """ + * # a variant should always be assigned to a unique position, one base before + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_38compare_calls, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__compare_calls, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":979 + * ########################################################################################################### + * + * def connect( self, filename ): # <<<<<<<<<<<<<< + * '''connect to tabix file.''' + * self.tabixfile = pysam.Tabixfile( filename ) + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_39connect, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__connect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":984 + * self._parse_header(self.tabixfile.header) + * + * def fetch(self, # <<<<<<<<<<<<<< + * reference = None, + * start = None, + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_40fetch, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__fetch, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":993 + * return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) ) + * + * def validate( self, record ): # <<<<<<<<<<<<<< + * '''validate vcf record. + * + */ + __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_4cvcf_3VCF_41validate, NULL, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__validate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "cvcf.pyx":232 + * return r + * + * class VCF(object): # <<<<<<<<<<<<<< + * + * # types + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_builtin_object); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object); + __Pyx_GIVEREF(__pyx_builtin_object); + __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__VCF, __pyx_n_s__cvcf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__VCF, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "cvcf.pyx":1118 + * pos -= 1 + * + * __all__ = [ # <<<<<<<<<<<<<< + * "VCF", "VCFRecord", ] + * + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VCF)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__VCF)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCF)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VCFRecord)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__VCFRecord)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VCFRecord)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "cvcf.pyx":1 + * # # <<<<<<<<<<<<<< + * # Code to read, write and edit VCF files + * # + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "ctabix.pxd":2 + * + * cdef extern from "string.h": # <<<<<<<<<<<<<< + * ctypedef int size_t + * void *memcpy(void *dst,void *src,size_t len) + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init cvcf"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init cvcf"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *number, *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + number = (num_expected == 1) ? "" : "s"; + PyErr_Format(PyExc_TypeError, + #if PY_VERSION_HEX < 0x02050000 + "%s() takes %s %d positional argument%s (%d given)", + #else + "%s() takes %s %zd positional argument%s (%zd given)", + #endif + func_name, more_or_less, num_expected, number, num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + PyErr_NormalizeException(&local_type, &local_value, &local_tb); + if (unlikely(tstate->curexc_type)) + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + #endif + *type = local_type; + *value = local_value; + *tb = local_tb; + Py_INCREF(local_type); + Py_INCREF(local_value); + Py_INCREF(local_tb); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + /* Make sure tstate is in a consistent state when we XDECREF + these objects (XDECREF may run arbitrary code). */ + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static double __Pyx__PyObject_AsDouble(PyObject* obj) { + PyObject* float_value; + if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { + return PyFloat_AsDouble(obj); + } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + } else { + PyObject* args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + PyTuple_SET_ITEM(args, 0, obj); + float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0); + PyTuple_SET_ITEM(args, 0, 0); + Py_DECREF(args); + } + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } +bad: + return (double)-1; +} + +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} + +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { + PyObject *metaclass; + /* Default metaclass */ +#if PY_MAJOR_VERSION < 3 + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = PyObject_GetAttrString(base, "__class__"); + if (!metaclass) { + PyErr_Clear(); + metaclass = (PyObject*) Py_TYPE(base); + } + } else { + metaclass = (PyObject *) &PyClass_Type; + } +#else + if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { + PyObject *base = PyTuple_GET_ITEM(bases, 0); + metaclass = (PyObject*) Py_TYPE(base); + } else { + metaclass = (PyObject *) &PyType_Type; + } +#endif + Py_INCREF(metaclass); + return metaclass; +} + +static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, + PyObject *modname) { + PyObject *result; + PyObject *metaclass; + + if (PyDict_SetItemString(dict, "__module__", modname) < 0) + return NULL; + + /* Python2 __metaclass__ */ + metaclass = PyDict_GetItemString(dict, "__metaclass__"); + if (metaclass) { + Py_INCREF(metaclass); + } else { + metaclass = __Pyx_FindPy2Metaclass(bases); + } + result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL); + Py_DECREF(metaclass); + return result; +} + + +static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) { + __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType); + if (op == NULL) + return NULL; + op->func.m_ml = ml; + Py_XINCREF(self); + op->func.m_self = self; + Py_XINCREF(module); + op->func.m_module = module; + PyObject_GC_Track(op); + return (PyObject *)op; +} + +static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) { + PyObject_GC_UnTrack(m); + Py_XDECREF(m->func.m_self); + Py_XDECREF(m->func.m_module); + PyObject_GC_Del(m); +} + +static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) { + if (obj == Py_None) + obj = NULL; + return PyMethod_New(func, obj, type); +} + +static int __pyx_binding_PyCFunctionType_init(void) { + __pyx_binding_PyCFunctionType_type = PyCFunction_Type; + __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method"); + __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc; + __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get; + if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) { + return -1; + } + __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type; + return 0; + +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint32_t) == sizeof(char)) || + (sizeof(uint32_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint32_t) == sizeof(int)) || + (sizeof(uint32_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); + } +} + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pxd b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pxd new file mode 100755 index 0000000..477e0fa --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pxd @@ -0,0 +1,41 @@ +cdef extern from "stdlib.h": + void free(void *) + void *malloc(size_t) + void *calloc(size_t,size_t) + void *realloc(void *,size_t) + int c_abs "abs" (int) + int c_abs "abs" (int) + int atoi( char *nptr) + long atol( char *nptr) + double atof( char *nptr) + +cdef extern from "Python.h": + ctypedef struct FILE + FILE* PyFile_AsFile(object) + char *fgets(char *str, int size, FILE *ifile) + int feof(FILE *stream) + size_t strlen(char *s) + size_t getline(char **lineptr, size_t *n, FILE *stream) + char *strstr(char *, char *) + char *strchr(char *string, int c) + int fileno(FILE *stream) + +cdef extern from "string.h": + int strcmp(char *s1, char *s2) + int strncmp(char *s1,char *s2,size_t len) + char *strcpy(char *dest,char *src) + char *strncpy(char *dest,char *src, size_t len) + char *strdup(char *) + char *strcat(char *,char *) + size_t strlen(char *s) + int memcmp( void * s1, void *s2, size_t len ) + void *memcpy(void *dest, void *src, size_t n) + void *memchr(void *s, int c, size_t n) + +cdef extern from "stdint.h": + ctypedef int int64_t + ctypedef int int32_t + ctypedef int uint32_t + ctypedef int uint8_t + ctypedef int uint64_t + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pyx b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pyx new file mode 100755 index 0000000..d3f92d3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/cvcf.pyx @@ -0,0 +1,1121 @@ +# +# Code to read, write and edit VCF files +# +# VCF lines are encoded as a dictionary with these keys (note: all lowercase): +# 'chrom': string +# 'pos': integer +# 'id': string +# 'ref': string +# 'alt': list of strings +# 'qual': integer +# 'filter': None (missing value), or list of keys (strings); empty list parsed as ["PASS"] +# 'info': dictionary of values (see below) +# 'format': list of keys (strings) +# sample keys: dictionary of values (see below) +# +# The sample keys are accessible through vcf.getsamples() +# +# A dictionary of values contains value keys (defined in ##INFO or ##FORMAT lines) which map +# to a list, containign integers, floats, strings, or characters. Missing values are replaced +# by a particular value, often -1 or . +# +# Genotypes are not stored as a string, but as a list of 1 or 3 elements (for haploid and diploid samples), +# the first (and last) the integer representing an allele, and the second the separation character. +# Note that there is just one genotype per sample, but for consistency the single element is stored in a list. +# +# Header lines other than ##INFO, ##FORMAT and ##FILTER are stored as (key, value) pairs and are accessible +# through getheader() +# +# The VCF class can be instantiated with a 'regions' variable consisting of tuples (chrom,start,end) encoding +# 0-based half-open segments. Only variants with a position inside the segment will be parsed. A regions +# parser is available under parse_regions. +# +# When instantiated, a reference can be passed to the VCF class. This may be any class that supports a +# fetch(chrom, start, end) method. +# +# +# +# NOTE: the position that is returned to Python is 0-based, NOT 1-based as in the VCF file. +# +# +# +# TODO: +# only v4.0 writing is complete; alleles are not converted to v3.3 format +# + +from collections import namedtuple, defaultdict +from operator import itemgetter +import sys, re, copy, bisect + +cimport ctabix +cimport TabProxies +import pysam + +gtsRegEx = re.compile("[|/\\\\]") +alleleRegEx = re.compile('^[ACGTN]+$') + +# Utility function. Uses 0-based coordinates +def get_sequence(chrom, start, end, fa): + # obtain sequence from .fa file, without truncation + if end<=start: return "" + if not fa: return "N"*(end-start) + if start<0: return "N"*(-start) + get_sequence(chrom, 0, end, fa).upper() + sequence = fa.fetch(chrom, start, end).upper() + if len(sequence) < end-start: sequence += "N"*(end-start-len(sequence)) + return sequence + +# Utility function. Parses a region string +def parse_regions( string ): + result = [] + for r in string.split(','): + elts = r.split(':') + chrom, start, end = elts[0], 0, 3000000000 + if len(elts)==1: pass + elif len(elts)==2: + if len(elts[1])>0: + ielts = elts[1].split('-') + if len(ielts) != 2: ValueError("Don't understand region string '%s'" % r) + try: start, end = int(ielts[0])-1, int(ielts[1]) + except: raise ValueError("Don't understand region string '%s'" % r) + else: + raise ValueError("Don't understand region string '%s'" % r) + result.append( (chrom,start,end) ) + return result + + +FORMAT = namedtuple('FORMAT','id numbertype number type description missingvalue') + +########################################################################################################### +# +# New class +# +########################################################################################################### + +cdef class VCFRecord( TabProxies.TupleProxy): + '''vcf record. + + initialized from data and vcf meta + ''' + + cdef vcf + cdef char * contig + cdef uint32_t pos + + def __init__(self, vcf): + self.vcf = vcf + # if len(data) != len(self.vcf._samples): + # self.error(str(data), + # self.BAD_NUMBER_OF_COLUMNS, + # "expected %s for %s samples (%s), got %s" % \ + # (len(self.vcf._samples), + # len(self.vcf._samples), + # self.vcf._samples, + # len(data))) + + def __cinit__(self, vcf ): + # start indexed access at genotypes + self.offset = 9 + + self.vcf = vcf + + cdef update( self, char * buffer, size_t nbytes ): + '''update internal data. + + nbytes does not include the terminal '\0'. + ''' + TabProxies.TupleProxy.update( self, buffer, nbytes ) + + self.contig = self.fields[0] + # vcf counts from 1 - correct here + self.pos = atoi( self.fields[1] ) - 1 + + def __len__(self): + return max(0, self.nfields - 9) + + property contig: + def __get__(self): return self.contig + + property pos: + def __get__(self): return self.pos + + property id: + def __get__(self): return self.fields[2] + + property ref: + def __get__(self): return self.fields[3] + + property alt: + def __get__(self): + # convert v3.3 to v4.0 alleles below + alt = self.fields[4] + if alt == ".": alt = [] + else: alt = alt.upper().split(',') + return alt + + property qual: + def __get__(self): + qual = self.fields[5] + if qual == b".": qual = -1 + else: + try: qual = float(qual) + except: self.vcf.error(str(self),self.QUAL_NOT_NUMERICAL) + + property filter: + def __get__(self): + f = self.fields[6] + # postpone checking that filters exist. Encode missing filter or no filtering as empty list + if f == b"." or f == b"PASS" or f == b"0": return [] + else: return f.split(';') + + property info: + def __get__(self): + col = self.fields[7] + # dictionary of keys, and list of values + info = {} + if col != b".": + for blurp in col.split(';'): + elts = blurp.split('=') + if len(elts) == 1: v = None + elif len(elts) == 2: v = elts[1] + else: self.vcf.error(str(self),self.ERROR_INFO_STRING) + info[elts[0]] = self.vcf.parse_formatdata(elts[0], v, self.vcf._info, str(self)) + return info + + property format: + def __get__(self): + return self.fields[8].split(':') + + property samples: + def __get__(self): + return self.vcf._samples + + def __getitem__(self, key): + + # parse sample columns + values = self.fields[self.vcf._sample2column[key]].split(':') + alt = self.alt + format = self.format + + if len(values) > len(format): + self.error(str(self.line),self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" %\ + (len(values),key,len(format))) + + result = {} + for idx in range(len(format)): + expected = self.vcf.get_expected(format[idx], self.vcf._format, alt) + if idx < len(values): value = values[idx] + else: + if expected == -1: value = "." + else: value = ",".join(["."]*expected) + + result[format[idx]] = self.vcf.parse_formatdata(format[idx], value, self.vcf._format, str(self.data)) + if expected != -1 and len(result[format[idx]]) != expected: + self.error(str(self.data),self.BAD_NUMBER_OF_PARAMETERS, + "id=%s, expected %s parameters, got %s" % (format[idx],expected,result[format[idx]])) + if len(result[format[idx]] ) < expected: result[format[idx]] += [result[format[idx]][-1]]*(expected-len(result[format[idx]])) + result[format[idx]] = result[format[idx]][:expected] + + return result + + +cdef class asVCFRecord( ctabix.Parser ): + '''converts a :term:`tabix row` into a VCF record.''' + cdef vcffile + def __init__(self, vcffile ): + self.vcffile = vcffile + def __call__(self, char * buffer, int len ): + cdef VCFRecord r + r = VCFRecord( self.vcffile ) + r.copy( buffer, len ) + return r + +class VCF(object): + + # types + NT_UNKNOWN = 0 + NT_NUMBER = 1 + NT_ALLELES = 2 + NT_NR_ALLELES = 3 + NT_GENOTYPES = 4 + NT_PHASED_GENOTYPES = 5 + + _errors = { 0:"UNKNOWN_FORMAT_STRING:Unknown file format identifier", + 1:"BADLY_FORMATTED_FORMAT_STRING:Formatting error in the format string", + 2:"BADLY_FORMATTED_HEADING:Did not find 9 required headings (CHROM, POS, ..., FORMAT) %s", + 3:"BAD_NUMBER_OF_COLUMNS:Wrong number of columns found (%s)", + 4:"POS_NOT_NUMERICAL:Position column is not numerical", + 5:"UNKNOWN_CHAR_IN_REF:Unknown character in reference field", + 6:"V33_BAD_REF:Reference should be single-character in v3.3 VCF", + 7:"V33_BAD_ALLELE:Cannot interpret allele for v3.3 VCF", + 8:"POS_NOT_POSITIVE:Position field must be >0", + 9:"QUAL_NOT_NUMERICAL:Quality field must be numerical, or '.'", + 10:"ERROR_INFO_STRING:Error while parsing info field", + 11:"ERROR_UNKNOWN_KEY:Unknown key (%s) found in formatted field (info; format; or filter)", + 12:"ERROR_FORMAT_NOT_NUMERICAL:Expected integer or float in formatted field; got %s", + 13:"ERROR_FORMAT_NOT_CHAR:Eexpected character in formatted field; got string", + 14:"FILTER_NOT_DEFINED:Identifier (%s) in filter found which was not defined in header", + 15:"FORMAT_NOT_DEFINED:Identifier (%s) in format found which was not defined in header", + 16:"BAD_NUMBER_OF_VALUES:Found too many of values in sample column (%s)", + 17:"BAD_NUMBER_OF_PARAMETERS:Found unexpected number of parameters (%s)", + 18:"BAD_GENOTYPE:Cannot parse genotype (%s)", + 19:"V40_BAD_ALLELE:Bad allele found for v4.0 VCF (%s)", + 20:"MISSING_REF:Reference allele missing", + 21:"V33_UNMATCHED_DELETION:Deleted sequence does not match reference (%s)", + 22:"V40_MISSING_ANGLE_BRACKETS:Format definition is not deliminted by angular brackets", + 23:"FORMAT_MISSING_QUOTES:Description field in format definition is not surrounded by quotes", + 24:"V40_FORMAT_MUST_HAVE_NAMED_FIELDS:Fields in v4.0 VCF format definition must have named fields", + 25:"HEADING_NOT_SEPARATED_BY_TABS:Heading line appears separated by spaces, not tabs", + 26:"WRONG_REF:Wrong reference %s", + 27:"ERROR_TRAILING_DATA:Numerical field ('%s') has semicolon-separated trailing data", + 28:"BAD_CHR_TAG:Error calculating chr tag for %s", + 29:"ZERO_LENGTH_ALLELE:Found zero-length allele", + 30:"MISSING_INDEL_ALLELE_REF_BASE:Indel alleles must begin with single reference base" + } + + # tag-value pairs; tags are not unique; does not include fileformat, INFO, FILTER or FORMAT fields + _header = [] + + # version number; 33=v3.3; 40=v4.0 + _version = 40 + + # info, filter and format data + _info = {} + _filter = {} + _format = {} + + # header; and required columns + _required = ["CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO","FORMAT"] + _samples = [] + + # control behaviour + _ignored_errors = set([11]) # ERROR_UNKNOWN_KEY + _warn_errors = set([]) + _leftalign = False + + # reference sequence + _reference = None + + # regions to include; None includes everything + _regions = None + + # statefull stuff + _lineno = -1 + _line = None + _lines = None + + def __init__(self, _copy=None, reference=None, regions=None, lines=None, leftalign=False): + # make error identifiers accessible by name + for id in self._errors.keys(): self.__dict__[self._errors[id].split(':')[0]] = id + if _copy != None: + self._leftalign = _copy._leftalign + self._header = _copy._header[:] + self._version = _copy._version + self._info = copy.deepcopy(_copy._info) + self._filter = copy.deepcopy(_copy._filter) + self._format = copy.deepcopy(_copy._format) + self._samples = _copy._samples[:] + self._sample2column = copy.deepcopy(_copy._sample2column) + self._ignored_errors = copy.deepcopy(_copy._ignored_errors) + self._warn_errors = copy.deepcopy(_copy._warn_errors) + self._reference = _copy._reference + self._regions = _copy._regions + if reference: self._reference = reference + if regions: self._regions = regions + if leftalign: self._leftalign = leftalign + self._lines = lines + + def error(self,line,error,opt=None): + if error in self._ignored_errors: return + errorlabel, errorstring = self._errors[error].split(':') + if opt: errorstring = errorstring % opt + errwarn = ["Error","Warning"][error in self._warn_errors] + sys.stderr.write("Line %s: '%s'\n%s %s: %s\n" % (self._lineno,line,errwarn,errorlabel,errorstring)) + if error in self._warn_errors: return + raise ValueError(errorstring) + + def parse_format(self,line,format,filter=False): + if self._version == 40: + if not format.startswith('<'): + self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + format = "<"+format + if not format.endswith('>'): + self.error(line,self.V40_MISSING_ANGLE_BRACKETS) + format += ">" + format = format[1:-1] + data = {'id':None,'number':None,'type':None,'descr':None} + idx = 0 + while len(format.strip())>0: + elts = format.strip().split(',') + first, rest = elts[0], ','.join(elts[1:]) + if first.find('=') == -1 or (first.find('"')>=0 and first.find('=') > first.find('"')): + if self._version == 40: self.error(line,self.V40_FORMAT_MUST_HAVE_NAMED_FIELDS) + if idx == 4: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + first = ["ID=","Number=","Type=","Description="][idx] + first + if first.startswith('ID='): data['id'] = first.split('=')[1] + elif first.startswith('Number='): data['number'] = first.split('=')[1] + elif first.startswith('Type='): data['type'] = first.split('=')[1] + elif first.startswith('Description='): + elts = format.split('"') + if len(elts)<3: + self.error(line,self.FORMAT_MISSING_QUOTES) + elts = first.split('=') + [rest] + data['descr'] = elts[1] + rest = '"'.join(elts[2:]) + if rest.startswith(','): rest = rest[1:] + else: + self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + format = rest + idx += 1 + if filter and idx==1: idx=3 # skip number and type fields for FILTER format strings + if not data['id']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + if not data['descr']: + self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + data['descr'] = '' + if not data['type'] and not data['number']: + # fine, ##filter format + return FORMAT(data['id'],self.NT_NUMBER,0,"Flag",data['descr'],'.') + if not data['type'] in ["Integer","Float","Character","String","Flag"]: + self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + # I would like a missing-value field, but it isn't there + if data['type'] in ['Integer','Float']: data['missing'] = None # Do NOT use arbitrary int/float as missing value + else: data['missing'] = '.' + if not data['number']: self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + try: + n = int(data['number']) + t = self.NT_NUMBER + except ValueError: + n = -1 + if data['number'] == '.': t = self.NT_UNKNOWN + elif data['number'] == '#alleles': t = self.NT_ALLELES + elif data['number'] == '#nonref_alleles': t = self.NT_NR_ALLELES + elif data['number'] == '#genotypes': t = self.NT_GENOTYPES + elif data['number'] == '#phased_genotypes': t = self.NT_PHASED_GENOTYPES + else: + self.error(line,self.BADLY_FORMATTED_FORMAT_STRING) + return FORMAT(data['id'],t,n,data['type'],data['descr'],data['missing']) + + + def format_format( self, fmt, filter=False ): + values = [('ID',fmt.id)] + if fmt.number != None and not filter: + if fmt.numbertype == self.NT_UNKNOWN: nmb = "." + elif fmt.numbertype == self.NT_NUMBER: nmb = str(fmt.number) + elif fmt.numbertype == self.NT_ALLELES: nmb = "#alleles" + elif fmt.numbertype == self.NT_NR_ALLELES: nmb = "#nonref_alleles" + elif fmt.numbertype == self.NT_GENOTYPES: nmb = "#genotypes" + elif fmt.numbertype == self.NT_PHASED_GENOTYPES: nmb = "#phased_genotypes" + else: + raise ValueError("Unknown number type encountered: %s" % fmt.numbertype) + values.append( ('Number',nmb) ) + values.append( ('Type', fmt.type) ) + values.append( ('Description', '"' + fmt.description + '"') ) + if self._version == 33: + format = ",".join([v for k,v in values]) + else: + format = "<" + (",".join( ["%s=%s" % (k,v) for (k,v) in values] )) + ">" + return format + + def get_expected(self, format, formatdict, alt): + fmt = formatdict[format] + if fmt.numbertype == self.NT_UNKNOWN: return -1 + if fmt.numbertype == self.NT_NUMBER: return fmt.number + if fmt.numbertype == self.NT_ALLELES: return len(alt)+1 + if fmt.numbertype == self.NT_NR_ALLELES: return len(alt) + if fmt.numbertype == self.NT_GENOTYPES: return ((len(alt)+1)*(len(alt)+2)) // 2 + if fmt.numbertype == self.NT_PHASED_GENOTYPES: return (len(alt)+1)*(len(alt)+1) + return 0 + + + def _add_definition(self, formatdict, key, data, line ): + if key in formatdict: return + self.error(line,self.ERROR_UNKNOWN_KEY,key) + if data == None: + formatdict[key] = FORMAT(key,self.NT_NUMBER,0,"Flag","(Undefined tag)",".") + return + if data == []: data = [""] # unsure what type -- say string + if type(data[0]) == type(0.0): + formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Float","(Undefined tag)",None) + return + if type(data[0]) == type(0): + formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"Integer","(Undefined tag)",None) + return + formatdict[key] = FORMAT(key,self.NT_UNKNOWN,-1,"String","(Undefined tag)",".") + + + # todo: trim trailing missing values + def format_formatdata( self, data, format, key=True, value=True, separator=":" ): + output, sdata = [], [] + if type(data) == type([]): # for FORMAT field, make data with dummy values + d = {} + for k in data: d[k] = [] + data = d + # convert missing values; and silently add definitions if required + for k in data: + self._add_definition( format, k, data[k], "(output)" ) + for idx,v in enumerate(data[k]): + if v == format[k].missingvalue: data[k][idx] = "." + # make sure GT comes first; and ensure fixed ordering; also convert GT data back to string + for k in data: + if k != 'GT': sdata.append( (k,data[k]) ) + sdata.sort() + if 'GT' in data: + sdata = [('GT',map(self.convertGTback,data['GT']))] + sdata + for k,v in sdata: + if v == []: v = None + if key and value: + if v != None: output.append( k+"="+','.join(map(str,v)) ) + else: output.append( k ) + elif key: output.append(k) + elif value: + if v != None: output.append( ','.join(map(str,v)) ) + else: output.append( "." ) # should not happen + # snip off trailing missing data + while len(output) > 1: + last = output[-1].replace(',','').replace('.','') + if len(last)>0: break + output = output[:-1] + return separator.join(output) + + + def enter_default_format(self): + for f in [FORMAT('GT',self.NT_NUMBER,1,'String','Genotype','.'), + FORMAT('GQ',self.NT_NUMBER,1,'Integer','Genotype Quality',-1), + FORMAT('DP',self.NT_NUMBER,1,'Integer','Read depth at this position for this sample',-1), + FORMAT('HQ',self.NT_UNKNOWN,-1,'Integer','Haplotype Quality',-1), # unknown number, since may be haploid + FORMAT('FT',self.NT_NUMBER,1,'String','Sample Genotype Filter','.')]: + if f.id not in self._format: + self._format[f.id] = f + + def parse_header( self, line ): + assert line.startswith('##') + elts = line[2:].split('=') + key = elts[0].strip() + value = '='.join(elts[1:]).strip() + if key == "fileformat": + if value == "VCFv3.3": + self._version = 33 + elif value == "VCFv4.0": + self._version = 40 + elif value == "VCFv4.1": + # AH - for testing + self._version = 40 + else: + self.error(line,self.UNKNOWN_FORMAT_STRING) + elif key == "INFO": + f = self.parse_format(line, value) + self._info[ f.id ] = f + elif key == "FILTER": + f = self.parse_format(line, value, filter=True) + self._filter[ f.id ] = f + elif key == "FORMAT": + f = self.parse_format(line, value) + self._format[ f.id ] = f + else: + # keep other keys in the header field + self._header.append( (key,value) ) + + + def write_header( self, stream ): + stream.write("##fileformat=VCFv%s.%s\n" % (self._version // 10, self._version % 10)) + for key,value in self._header: stream.write("##%s=%s\n" % (key,value)) + for var,label in [(self._info,"INFO"),(self._filter,"FILTER"),(self._format,"FORMAT")]: + for f in var.itervalues(): stream.write("##%s=%s\n" % (label,self.format_format(f,filter=(label=="FILTER")))) + + + def parse_heading( self, line ): + assert line.startswith('#') + assert not line.startswith('##') + headings = line[1:].split('\t') + if len(headings)==1 and len(line[1:].split()) >= 9: + self.error(line,self.HEADING_NOT_SEPARATED_BY_TABS) + headings = line[1:].split() + + for i,s in enumerate(self._required): + + if len(headings)<=i or headings[i] != s: + + if len(headings) <= i: + err = "(%sth entry not found)" % (i+1) + else: + err = "(found %s, expected %s)" % (headings[i],s) + + #self.error(line,self.BADLY_FORMATTED_HEADING,err) + + # allow FORMAT column to be absent + if len(headings) == 8: + headings.append("FORMAT") + else: + self.error(line,self.BADLY_FORMATTED_HEADING,err) + + self._samples = headings[9:] + self._sample2column = dict( [(y,x+9) for x,y in enumerate( self._samples ) ] ) + + def write_heading( self, stream ): + stream.write("#" + "\t".join(self._required + self._samples) + "\n") + + def convertGT(self, GTstring): + if GTstring == ".": return ["."] + try: + gts = gtsRegEx.split(GTstring) + if len(gts) == 1: return [int(gts[0])] + if len(gts) != 2: raise ValueError() + if gts[0] == "." and gts[1] == ".": return [gts[0],GTstring[len(gts[0]):-len(gts[1])],gts[1]] + return [int(gts[0]),GTstring[len(gts[0]):-len(gts[1])],int(gts[1])] + except ValueError: + self.error(self._line,self.BAD_GENOTYPE,GTstring) + return [".","|","."] + + + def convertGTback(self, GTdata): + return ''.join(map(str,GTdata)) + + def parse_formatdata( self, key, value, formatdict, line ): + # To do: check that the right number of values is present + f = formatdict.get(key,None) + if f == None: + self._add_definition(formatdict, key, value, line ) + f = formatdict[key] + if f.type == "Flag": + if value is not None: self.error(line,self.ERROR_FLAG_HAS_VALUE) + return [] + values = value.split(',') + # deal with trailing data in some early VCF files + if f.type in ["Float","Integer"] and len(values)>0 and values[-1].find(';') > -1: + self.error(line,self.ERROR_TRAILING_DATA,values[-1]) + values[-1] = values[-1].split(';')[0] + if f.type == "Integer": + for idx,v in enumerate(values): + try: + if v == ".": values[idx] = f.missingvalue + else: values[idx] = int(v) + except: + self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + return [0] * len(values) + return values + elif f.type == "String": + self._line = line + if f.id == "GT": values = map( self.convertGT, values ) + return values + elif f.type == "Character": + for v in values: + if len(v) != 1: self.error(line,self.ERROR_FORMAT_NOT_CHAR) + return values + elif f.type == "Float": + for idx,v in enumerate(values): + if v == ".": values[idx] = f.missingvalue + try: return map(float,values) + except: + self.error(line,self.ERROR_FORMAT_NOT_NUMERICAL,values) + return [0.0] * len(values) + else: + # can't happen + self.error(line,self.ERROR_INFO_STRING) + + + def inregion(self, chrom, pos): + if not self._regions: return True + for r in self._regions: + if r[0] == chrom and r[1] <= pos < r[2]: return True + return False + + + def parse_data( self, line, lineparse=False ): + cols = line.split('\t') + if len(cols) != len(self._samples)+9: + # gracefully deal with absent FORMAT column + if len(cols) == 8 and len(self._samples)==0: + cols.append("") + else: + self.error(line, + self.BAD_NUMBER_OF_COLUMNS, + "expected %s for %s samples (%s), got %s" % (len(self._samples)+9, len(self._samples), self._samples, len(cols))) + + chrom = cols[0] + + # get 0-based position + try: pos = int(cols[1])-1 + except: self.error(line,self.POS_NOT_NUMERICAL) + if pos < 0: self.error(line,self.POS_NOT_POSITIVE) + + # implement filtering + if not self.inregion(chrom,pos): return None + + # end of first-pass parse for sortedVCF + if lineparse: return chrom, pos, line + + id = cols[2] + + ref = cols[3].upper() + if ref == ".": + self.error(line,self.MISSING_REF) + if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + else: ref = "" + else: + for c in ref: + if c not in "ACGTN": self.error(line,self.UNKNOWN_CHAR_IN_REF) + if "N" in ref: ref = get_sequence(chrom,pos,pos+len(ref),self._reference) + + # make sure reference is sane + if self._reference: + left = max(0,pos-100) + faref_leftflank = get_sequence(chrom,left,pos+len(ref),self._reference) + faref = faref_leftflank[pos-left:] + if faref != ref: self.error(line,self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + ref = faref + + # convert v3.3 to v4.0 alleles below + if cols[4] == ".": alt = [] + else: alt = cols[4].upper().split(',') + + if cols[5] == ".": qual = -1 + else: + try: qual = float(cols[5]) + except: self.error(line,self.QUAL_NOT_NUMERICAL) + + # postpone checking that filters exist. Encode missing filter or no filtering as empty list + if cols[6] == "." or cols[6] == "PASS" or cols[6] == "0": filter = [] + else: filter = cols[6].split(';') + + # dictionary of keys, and list of values + info = {} + if cols[7] != ".": + for blurp in cols[7].split(';'): + elts = blurp.split('=') + if len(elts) == 1: v = None + elif len(elts) == 2: v = elts[1] + else: self.error(line,self.ERROR_INFO_STRING) + info[elts[0]] = self.parse_formatdata(elts[0], v, self._info, line) + + # Gracefully deal with absent FORMAT column + if cols[8] == "": format = [] + else: format = cols[8].split(':') + + # check: all filters are defined + for f in filter: + if f not in self._filter: self.error(line,self.FILTER_NOT_DEFINED, f) + + # check: format fields are defined + for f in format: + if f not in self._format: self.error(line,self.FORMAT_NOT_DEFINED, f) + + # convert v3.3 alleles + if self._version == 33: + if len(ref) != 1: self.error(line,self.V33_BAD_REF) + newalts = [] + have_deletions = False + for a in alt: + if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + elif a.startswith('D'): # allow D and D + have_deletions = True + try: + l = int(a[1:]) # throws ValueError if sequence + if len(ref) < l: # add to reference if necessary + addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + ref += addns + for i,na in enumerate(newalts): newalts[i] = na+addns + a = ref[l:] # new deletion, deleting pos...pos+l + except ValueError: + s = a[1:] + if len(ref) < len(s): # add Ns to reference if necessary + addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + if not s.endswith(addns) and addns != 'N'*len(addns): + self.error(line,self.V33_UNMATCHED_DELETION, + "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + ref += addns + for i,na in enumerate(newalts): newalts[i] = na+addns + a = ref[len(s):] # new deletion, deleting from pos + else: + self.error(line,self.V33_BAD_ALLELE) + newalts.append(a) + alt = newalts + # deletion alleles exist, add dummy 1st reference allele, and account for leading base + if have_deletions: + if pos == 0: + # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + ref += addn + alt = [allele+addn for allele in alt] + else: + addn = get_sequence(chrom,pos-1,pos,self._reference) + ref = addn + ref + alt = [addn + allele for allele in alt] + pos -= 1 + else: + # format v4.0 -- just check for nucleotides + for allele in alt: + if not alleleRegEx.match(allele): + self.error(line,self.V40_BAD_ALLELE,allele) + + # check for leading nucleotide in indel calls + for allele in alt: + if len(allele) != len(ref): + if len(allele) == 0: self.error(line,self.ZERO_LENGTH_ALLELE) + if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + self.error(line,self.MISSING_INDEL_ALLELE_REF_BASE) + + # trim trailing bases in alleles + for i in range(1,min(len(ref),min(map(len,alt)))): + if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + break + ref, alt = ref[:-1], [allele[:-1] for allele in alt] + + # left-align alleles, if a reference is available + if self._leftalign and self._reference: + while left < pos: + movable = True + for allele in alt: + if len(allele) > len(ref): + longest, shortest = allele, ref + else: + longest, shortest = ref, allele + if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + movable = False + if longest[-1].upper() != longest[len(shortest)-1].upper(): + movable = False + if not movable: + break + ref = ref[:-1] + alt = [allele[:-1] for allele in alt] + if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + ref = faref_leftflank[pos-left-1] + ref + alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + pos -= 1 + + # parse sample columns + samples = [] + for sample in cols[9:]: + dict = {} + values = sample.split(':') + if len(values) > len(format): + self.error(line,self.BAD_NUMBER_OF_VALUES,"(found %s values in element %s; expected %s)" % (len(values),sample,len(format))) + for idx in range(len(format)): + expected = self.get_expected(format[idx], self._format, alt) + if idx < len(values): value = values[idx] + else: + if expected == -1: value = "." + else: value = ",".join(["."]*expected) + dict[format[idx]] = self.parse_formatdata(format[idx], value, self._format, line) + if expected != -1 and len(dict[format[idx]]) != expected: + self.error(line,self.BAD_NUMBER_OF_PARAMETERS, + "id=%s, expected %s parameters, got %s" % (format[idx],expected,dict[format[idx]])) + if len(dict[format[idx]] ) < expected: dict[format[idx]] += [dict[format[idx]][-1]]*(expected-len(dict[format[idx]])) + dict[format[idx]] = dict[format[idx]][:expected] + samples.append( dict ) + + # done + d = {'chrom':chrom, + 'pos':pos, # return 0-based position + 'id':id, + 'ref':ref, + 'alt':alt, + 'qual':qual, + 'filter':filter, + 'info':info, + 'format':format} + for key,value in zip(self._samples,samples): + d[key] = value + + return d + + + def write_data(self, stream, data): + required = ['chrom','pos','id','ref','alt','qual','filter','info','format'] + self._samples + for k in required: + if k not in data: raise ValueError("Required key %s not found in data" % str(k)) + if data['alt'] == []: alt = "." + else: alt = ",".join(data['alt']) + if data['filter'] == None: filter = "." + elif data['filter'] == []: + if self._version == 33: filter = "0" + else: filter = "PASS" + else: filter = ';'.join(data['filter']) + if data['qual'] == -1: qual = "." + else: qual = str(data['qual']) + + output = [data['chrom'], + str(data['pos']+1), # change to 1-based position + data['id'], + data['ref'], + alt, + qual, + filter, + self.format_formatdata( data['info'], self._info, separator=";" ), + self.format_formatdata( data['format'], self._format, value=False ) ] + + for s in self._samples: + output.append( self.format_formatdata( data[s], self._format, key=False ) ) + + stream.write( "\t".join(output) + "\n" ) + + def _parse_header(self, stream): + self._lineno = 0 + for line in stream: + self._lineno += 1 + if line.startswith('##'): + self.parse_header( line.strip() ) + elif line.startswith('#'): + self.parse_heading( line.strip() ) + self.enter_default_format() + else: + break + return line + + def _parse(self, line, stream): + if len(line.strip()) > 0: + d = self.parse_data( line.strip() ) + #if d: yield d + for line in stream: + self._lineno += 1 + if self._lines and self._lineno > self._lines: raise StopIteration + d = self.parse_data( line.strip() ) + #if d: yield d + + ###################################################################################################### + # + # API follows + # + ###################################################################################################### + + def getsamples(self): + """ List of samples in VCF file """ + return self._samples + + def setsamples(self,samples): + """ List of samples in VCF file """ + self._samples = samples + + def getheader(self): + """ List of header key-value pairs (strings) """ + return self._header + + def setheader(self,header): + """ List of header key-value pairs (strings) """ + self._header = header + + def getinfo(self): + """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + return self._info + + def setinfo(self,info): + """ Dictionary of ##INFO tags, as VCF.FORMAT values """ + self._info = info + + def getformat(self): + """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + return self._format + + def setformat(self,format): + """ Dictionary of ##FORMAT tags, as VCF.FORMAT values """ + self._format = format + + def getfilter(self): + """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + return self._filter + + def setfilter(self,filter): + """ Dictionary of ##FILTER tags, as VCF.FORMAT values """ + self._filter = filter + + def setversion(self, version): + if version != 33 and version != 40: raise ValueError("Can only handle v3.3 and v4.0 VCF files") + self._version = version + + def setregions(self, regions): + self._regions = regions + + def setreference(self, ref): + """ Provide a reference sequence; a Python class supporting a fetch(chromosome, start, end) method, e.g. PySam.FastaFile """ + self._reference = ref + + def ignoreerror(self, errorstring): + try: self._ignored_errors.add(self.__dict__[errorstring]) + except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + + def warnerror(self, errorstring): + try: self._warn_errors.add(self.__dict__[errorstring]) + except KeyError: raise ValueError("Invalid error string: %s" % errorstring) + + def parse(self, stream): + """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + last_line = self._parse_header(stream) + # now return a generator that does the actual work. In this way the pre-processing is done + # before the first piece of data is yielded + return self._parse(last_line, stream) + + def write(self, stream, datagenerator): + """ Writes a VCF file to a stream, using a data generator (or list) """ + self.write_header(stream) + self.write_heading(stream) + for data in datagenerator: self.write_data(stream,data) + + def writeheader(self, stream): + """ Writes a VCF header """ + self.write_header(stream) + self.write_heading(stream) + + def compare_calls(self, pos1, ref1, alt1, pos2, ref2, alt2): + """ Utility function: compares two calls for equality """ + # a variant should always be assigned to a unique position, one base before + # the leftmost position of the alignment gap. If this rule is implemented + # correctly, the two positions must be equal for the calls to be identical. + if pos1 != pos2: return False + # from both calls, trim rightmost bases when identical. Do this safely, i.e. + # only when the reference bases are not Ns + while len(ref1)>0 and len(alt1)>0 and ref1[-1] == alt1[-1]: + ref1 = ref1[:-1] + alt1 = alt1[:-1] + while len(ref2)>0 and len(alt2)>0 and ref2[-1] == alt2[-1]: + ref2 = ref2[:-1] + alt2 = alt2[:-1] + # now, the alternative alleles must be identical + return alt1 == alt2 + +########################################################################################################### +########################################################################################################### +## API functions added by Andreas +########################################################################################################### + + def connect( self, filename ): + '''connect to tabix file.''' + self.tabixfile = pysam.Tabixfile( filename ) + self._parse_header(self.tabixfile.header) + + def fetch(self, + reference = None, + start = None, + end = None, + region = None ): + """ Parse a stream of VCF-formatted lines. Initializes class instance and return generator """ + + return self.tabixfile.fetch( reference, start, end, region, parser = asVCFRecord( self ) ) + + def validate( self, record ): + '''validate vcf record. + + returns a validated record. + ''' + + raise NotImplementedError( "needs to be checked" ) + + chrom, pos = record.chrom, record.pos + + # check reference + ref = record.ref + if ref == ".": + self.error(str(record),self.MISSING_REF) + if self._version == 33: ref = get_sequence(chrom,pos,pos+1,self._reference) + else: ref = "" + else: + for c in ref: + if c not in "ACGTN": self.error(str(record),self.UNKNOWN_CHAR_IN_REF) + if "N" in ref: ref = get_sequence(chrom, + pos, + pos+len(ref), + self._reference) + + # make sure reference is sane + if self._reference: + left = max(0,self.pos-100) + faref_leftflank = get_sequence(chrom,left,self.pos+len(ref),self._reference) + faref = faref_leftflank[pos-left:] + if faref != ref: self.error(str(record),self.WRONG_REF,"(reference is %s, VCF says %s)" % (faref,ref)) + ref = faref + + # check: format fields are defined + for f in record.format: + if f not in self._format: self.error(str(record),self.FORMAT_NOT_DEFINED, f) + + # check: all filters are defined + for f in record.filter: + if f not in self._filter: self.error(str(record),self.FILTER_NOT_DEFINED, f) + + # convert v3.3 alleles + if self._version == 33: + if len(ref) != 1: self.error(str(record),self.V33_BAD_REF) + newalts = [] + have_deletions = False + for a in alt: + if len(a) == 1: a = a + ref[1:] # SNP; add trailing reference + elif a.startswith('I'): a = ref[0] + a[1:] + ref[1:] # insertion just beyond pos; add first and trailing reference + elif a.startswith('D'): # allow D and D + have_deletions = True + try: + l = int(a[1:]) # throws ValueError if sequence + if len(ref) < l: # add to reference if necessary + addns = get_sequence(chrom,pos+len(ref),pos+l,self._reference) + ref += addns + for i,na in enumerate(newalts): newalts[i] = na+addns + a = ref[l:] # new deletion, deleting pos...pos+l + except ValueError: + s = a[1:] + if len(ref) < len(s): # add Ns to reference if necessary + addns = get_sequence(chrom,pos+len(ref),pos+len(s),self._reference) + if not s.endswith(addns) and addns != 'N'*len(addns): + self.error(str(record),self.V33_UNMATCHED_DELETION, + "(deletion is %s, reference is %s)" % (a,get_sequence(chrom,pos,pos+len(s),self._reference))) + ref += addns + for i,na in enumerate(newalts): newalts[i] = na+addns + a = ref[len(s):] # new deletion, deleting from pos + else: + self.error(str(record),self.V33_BAD_ALLELE) + newalts.append(a) + alt = newalts + # deletion alleles exist, add dummy 1st reference allele, and account for leading base + if have_deletions: + if pos == 0: + # Petr Danacek's: we can't have a leading nucleotide at (1-based) position 1 + addn = get_sequence(chrom,pos+len(ref),pos+len(ref)+1,self._reference) + ref += addn + alt = [allele+addn for allele in alt] + else: + addn = get_sequence(chrom,pos-1,pos,self._reference) + ref = addn + ref + alt = [addn + allele for allele in alt] + pos -= 1 + else: + # format v4.0 -- just check for nucleotides + for allele in alt: + if not alleleRegEx.match(allele): + self.error(str(record),self.V40_BAD_ALLELE,allele) + + + # check for leading nucleotide in indel calls + for allele in alt: + if len(allele) != len(ref): + if len(allele) == 0: self.error(str(record),self.ZERO_LENGTH_ALLELE) + if ref[0].upper() != allele[0].upper() and "N" not in (ref[0]+allele[0]).upper(): + self.error(str(record),self.MISSING_INDEL_ALLELE_REF_BASE) + + # trim trailing bases in alleles + for i in range(1,min(len(ref),min(map(len,alt)))): + if len(set(allele[-1].upper() for allele in alt)) > 1 or ref[-1].upper() != alt[0][-1].upper(): + break + ref, alt = ref[:-1], [allele[:-1] for allele in alt] + + # left-align alleles, if a reference is available + if self._leftalign and self._reference: + while left < pos: + movable = True + for allele in alt: + if len(allele) > len(ref): + longest, shortest = allele, ref + else: + longest, shortest = ref, allele + if len(longest) == len(shortest) or longest[:len(shortest)].upper() != shortest.upper(): + movable = False + if longest[-1].upper() != longest[len(shortest)-1].upper(): + movable = False + if not movable: + break + ref = ref[:-1] + alt = [allele[:-1] for allele in alt] + if min([len(allele) for allele in alt]) == 0 or len(ref) == 0: + ref = faref_leftflank[pos-left-1] + ref + alt = [faref_leftflank[pos-left-1] + allele for allele in alt] + pos -= 1 + +__all__ = [ + "VCF", "VCFRecord", ] + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/namedtuple.py b/code/utilities/CPAT-1.2.2/lib/pysam/namedtuple.py new file mode 100755 index 0000000..a60fb1a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/namedtuple.py @@ -0,0 +1,117 @@ +from operator import itemgetter as _itemgetter +from keyword import iskeyword as _iskeyword +import sys as _sys + +def namedtuple(typename, field_names, verbose=False, rename=False): + """Returns a new subclass of tuple with named fields. + + >>> Point = namedtuple('Point', 'x y') + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with positional args or keywords + >>> p[0] + p[1] # indexable like a plain tuple + 33 + >>> x, y = p # unpack like a regular tuple + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessable by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + + """ + + # Parse and validate the field names. Validation serves two purposes, + # generating informative error messages and preventing template injection attacks. + if isinstance(field_names, basestring): + field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas + field_names = tuple(map(str, field_names)) + if rename: + names = list(field_names) + seen = set() + for i, name in enumerate(names): + if (not min(c.isalnum() or c=='_' for c in name) or _iskeyword(name) + or not name or name[0].isdigit() or name.startswith('_') + or name in seen): + names[i] = '_%d' % i + seen.add(name) + field_names = tuple(names) + for name in (typename,) + field_names: + if not min(c.isalnum() or c=='_' for c in name): + raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with a number: %r' % name) + seen_names = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: %r' % name) + if name in seen_names: + raise ValueError('Encountered duplicate field name: %r' % name) + seen_names.add(name) + + # Create and fill-in the class template + numfields = len(field_names) + argtxt = repr(field_names).replace("'", "")[1:-1] # tuple repr without parens or quotes + reprtxt = ', '.join('%s=%%r' % name for name in field_names) + template = '''class %(typename)s(tuple): + '%(typename)s(%(argtxt)s)' \n + __slots__ = () \n + _fields = %(field_names)r \n + def __new__(_cls, %(argtxt)s): + return _tuple.__new__(_cls, (%(argtxt)s)) \n + @classmethod + def _make(cls, iterable, new=tuple.__new__, len=len): + 'Make a new %(typename)s object from a sequence or iterable' + result = new(cls, iterable) + if len(result) != %(numfields)d: + raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result)) + return result \n + def __repr__(self): + return '%(typename)s(%(reprtxt)s)' %% self \n + def _asdict(self): + 'Return a new dict which maps field names to their values' + return dict(zip(self._fields, self)) \n + def _replace(_self, **kwds): + 'Return a new %(typename)s object replacing specified fields with new values' + result = _self._make(map(kwds.pop, %(field_names)r, _self)) + if kwds: + raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) + return result \n + def __getnewargs__(self): + return tuple(self) \n\n''' % locals() + for i, name in enumerate(field_names): + template += ' %s = _property(_itemgetter(%d))\n' % (name, i) + if verbose: + print template + + # Execute the template string in a temporary namespace + namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename, + _property=property, _tuple=tuple) + try: + exec template in namespace + except SyntaxError, e: + raise SyntaxError(e.message + ':\n' + template) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to the frame + # where the named tuple is created. Bypass this step in enviroments where + # sys._getframe is not defined (Jython for example) or sys._getframe is not + # defined for arguments greater than 0 (IronPython). + try: + result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + + return result + + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.c b/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.c new file mode 100755 index 0000000..e045690 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.c @@ -0,0 +1,444 @@ +#include +#include +#include "bam.h" +#include "khash.h" +#include "ksort.h" +#include "bam_endian.h" +#include "knetfile.h" +#include "pysam_util.h" +#include "errmod.h" // for pysam_dump + +#ifndef inline +#define inline __inline +#endif + +// Definition of pysamerr +#include "stdio.h" +FILE * pysamerr = NULL; + +FILE * pysam_set_stderr( FILE * f ) +{ + pysamerr = f; + return f; +} + +// ####################################################### +// utility routines to avoid using callbacks in bam_fetch +// taken from bam_index.c +// The order of the following declarations is important. +// ####################################################### +#define BAM_MAX_BIN 37450 // =(8^6-1)/7+1 + +// initialize hashes +typedef struct +{ + uint64_t u, v; +} pair64_t; + +#define pair64_lt(a,b) ((a).u < (b).u) + +KSORT_INIT(myoff, pair64_t, pair64_lt); + +typedef struct { + uint32_t m, n; + pair64_t *list; +} bam_binlist_t; + +typedef struct { + int32_t n, m; + uint64_t *offset; +} bam_lidx_t; + + +// initialize hashes ('i' and 's' are idenditifiers) +KHASH_MAP_INIT_INT(i, bam_binlist_t); +KHASH_MAP_INIT_STR(s, int) + +struct __bam_index_t +{ + int32_t n; + uint64_t n_no_coor; // unmapped reads without coordinate + khash_t(i) **index; + bam_lidx_t *index2; +}; + +typedef struct __linkbuf_t { + bam1_t b; + uint32_t beg, end; + struct __linkbuf_t *next; +} lbnode_t; + +typedef struct { + int cnt, n, max; + lbnode_t **buf; +} mempool_t; + +struct __bam_plbuf_t { + mempool_t *mp; + lbnode_t *head, *tail, *dummy; + bam_pileup_f func; + void *func_data; + int32_t tid, pos, max_tid, max_pos; + int max_pu, is_eof; + bam_pileup1_t *pu; + int flag_mask; +}; + +static mempool_t *mp_init() +{ + mempool_t *mp; + mp = (mempool_t*)calloc(1, sizeof(mempool_t)); + return mp; +} +static void mp_destroy(mempool_t *mp) +{ + int k; + for (k = 0; k < mp->n; ++k) { + free(mp->buf[k]->b.data); + free(mp->buf[k]); + } + free(mp->buf); + free(mp); +} +static inline lbnode_t *mp_alloc(mempool_t *mp) +{ + ++mp->cnt; + if (mp->n == 0) return (lbnode_t*)calloc(1, sizeof(lbnode_t)); + else return mp->buf[--mp->n]; +} +static inline void mp_free(mempool_t *mp, lbnode_t *p) +{ + --mp->cnt; p->next = 0; // clear lbnode_t::next here + if (mp->n == mp->max) { + mp->max = mp->max? mp->max<<1 : 256; + mp->buf = (lbnode_t**)realloc(mp->buf, sizeof(lbnode_t*) * mp->max); + } + mp->buf[mp->n++] = p; +} + +static inline int resolve_cigar(bam_pileup1_t *p, uint32_t pos) +{ + unsigned k; + bam1_t *b = p->b; + bam1_core_t *c = &b->core; + uint32_t x = c->pos, y = 0; + int ret = 1, is_restart = 1; + + if (c->flag&BAM_FUNMAP) return 0; // unmapped read + assert(x <= pos); // otherwise a bug + p->qpos = -1; p->indel = 0; p->is_del = p->is_head = p->is_tail = 0; + for (k = 0; k < c->n_cigar; ++k) { + int op = bam1_cigar(b)[k] & BAM_CIGAR_MASK; // operation + int l = bam1_cigar(b)[k] >> BAM_CIGAR_SHIFT; // length + if (op == BAM_CMATCH) { // NOTE: this assumes the first and the last operation MUST BE a match or a clip + if (x + l > pos) { // overlap with pos + p->indel = p->is_del = 0; + p->qpos = y + (pos - x); + if (x == pos && is_restart) p->is_head = 1; + if (x + l - 1 == pos) { // come to the end of a match + if (k < c->n_cigar - 1) { // there are additional operation(s) + uint32_t cigar = bam1_cigar(b)[k+1]; // next CIGAR + int op_next = cigar&BAM_CIGAR_MASK; // next CIGAR operation + if (op_next == BAM_CDEL) p->indel = -(int32_t)(cigar>>BAM_CIGAR_SHIFT); // del + else if (op_next == BAM_CINS) p->indel = cigar>>BAM_CIGAR_SHIFT; // ins + if (op_next == BAM_CSOFT_CLIP || op_next == BAM_CREF_SKIP || op_next == BAM_CHARD_CLIP) + p->is_tail = 1; // tail + } else p->is_tail = 1; // this is the last operation; set tail + } + } + x += l; y += l; + } else if (op == BAM_CDEL) { // then set ->is_del + if (x + l > pos) { + p->indel = 0; p->is_del = 1; + p->qpos = y + (pos - x); + } + x += l; + } else if (op == BAM_CREF_SKIP) x += l; + else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l; + is_restart = (op == BAM_CREF_SKIP || op == BAM_CSOFT_CLIP || op == BAM_CHARD_CLIP); + if (x > pos) { + if (op == BAM_CREF_SKIP) ret = 0; // then do not put it into pileup at all + break; + } + } + assert(x > pos); // otherwise a bug + return ret; + +} +// the following code has been taken from bam_plbuf_push +// and modified such that instead of a function call +// the function returns and will continue (if cont is true). +// from where it left off. + +// returns +// 1: if buf is full and can be emitted +// 0: if b has been added +// -1: if there was an error +int pysam_pileup_next(const bam1_t *b, + bam_plbuf_t *buf, + bam_pileup1_t ** plp, + int * tid, + int * pos, + int * n_plp ) +{ + *plp = bam_plp_next(buf->iter, tid, pos, n_plp); + if (plp == NULL) return 0; + return 1; +} + +typedef struct __bmc_aux_t { + int max; + uint32_t *info; + uint16_t *info16; + errmod_t *em; +} bmc_aux_t; + +// Return number of mapped reads on tid. +// If tid < 0, return mapped reads without a coordinate (0) +uint32_t pysam_get_mapped( const bam_index_t *idx, const int tid ) +{ + + if (tid >= 0) + { + khint_t k; + khash_t(i) *h = idx->index[tid]; + k = kh_get(i, h, BAM_MAX_BIN); + + if (k != kh_end(h)) + return kh_val(h, k).list[1].u; + else + return 0; + } + + return 0; +} + +uint32_t pysam_get_unmapped( const bam_index_t *idx, const int tid ) +{ + + if (tid >= 0) + { + khint_t k; + khash_t(i) *h = idx->index[tid]; + k = kh_get(i, h, BAM_MAX_BIN); + + if (k != kh_end(h)) + return kh_val(h, k).list[1].v; + else + return 0; + } + + return idx->n_no_coor; +} + +/* uint32_t pysam_glf_depth( glf1_t * g ) */ +/* { */ +/* return g->depth; */ +/* } */ + + +/* void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c ) */ +/* { */ +/* int x = 0; */ +/* fprintf(stderr, */ +/* "glf: ref_base=%i, max_mapQ=%i, min_lk=%i, depth=%i", */ +/* g->ref_base, */ +/* g->max_mapQ, */ +/* g->min_lk, */ +/* g->depth ); */ + +/* for (x = 0; x < 10; ++x) */ +/* fprintf(stderr, ", lk%x=%i, ", x, g->lk[x]); */ + +/* fprintf(stderr, */ +/* "maqcns: het_rate=%f, theta=%f, n_hap=%i, cap_mapQ=%i, errmod=%i, min_baseQ=%i, eta=%f, q_r=%f, aux_max=%i", */ +/* c->het_rate, */ +/* c->theta, */ +/* c->n_hap, */ +/* c->cap_mapQ, */ +/* c->errmod, */ +/* c->min_baseQ, */ +/* c->eta, */ +/* c->q_r, */ +/* c->aux->max); */ + +/* for (x = 0; x < c->aux->max; ++x) */ +/* { */ +/* fprintf(stderr, ", info-%i=%i ", x, c->aux->info[x]); */ +/* if (c->aux->info[x] == 0) break; */ +/* } */ + +/* for (x = 0; x < c->aux->max; ++x) */ +/* { */ +/* fprintf(stderr, ", info16-%i=%i ", x, c->aux->info16[x]); */ +/* if (c->aux->info16[x] == 0) break; */ +/* } */ +/* } */ + + + + +// pysam dispatch function to emulate the samtools +// command line within python. +// taken from the main function in bamtk.c +// added code to reset getopt +int bam_taf2baf(int argc, char *argv[]); +int bam_mpileup(int argc, char *argv[]); +int bam_merge(int argc, char *argv[]); +int bam_index(int argc, char *argv[]); +int bam_sort(int argc, char *argv[]); +int bam_tview_main(int argc, char *argv[]); +int bam_mating(int argc, char *argv[]); +int bam_rmdup(int argc, char *argv[]); +int bam_flagstat(int argc, char *argv[]); +int bam_fillmd(int argc, char *argv[]); +int bam_idxstats(int argc, char *argv[]); +int main_samview(int argc, char *argv[]); +int main_import(int argc, char *argv[]); +int main_reheader(int argc, char *argv[]); +int main_cut_target(int argc, char *argv[]); +int main_phase(int argc, char *argv[]); +int main_cat(int argc, char *argv[]); +int main_depth(int argc, char *argv[]); +int main_bam2fq(int argc, char *argv[]); +int faidx_main(int argc, char *argv[]); + +int pysam_dispatch(int argc, char *argv[] ) +{ + extern int optind; +#ifdef _WIN32 + setmode(fileno(stdout), O_BINARY); + setmode(fileno(stdin), O_BINARY); +#ifdef _USE_KNETFILE + knet_win32_init(); +#endif +#endif + + // reset getopt + optind = 1; + + if (argc < 2) return 1; + + if (strcmp(argv[1], "view") == 0) return main_samview(argc-1, argv+1); + else if (strcmp(argv[1], "import") == 0) return main_import(argc-1, argv+1); + else if (strcmp(argv[1], "mpileup") == 0) return bam_mpileup(argc-1, argv+1); + else if (strcmp(argv[1], "merge") == 0) return bam_merge(argc-1, argv+1); + else if (strcmp(argv[1], "sort") == 0) return bam_sort(argc-1, argv+1); + else if (strcmp(argv[1], "index") == 0) return bam_index(argc-1, argv+1); + else if (strcmp(argv[1], "faidx") == 0) return faidx_main(argc-1, argv+1); + else if (strcmp(argv[1], "idxstats") == 0) return bam_idxstats(argc-1, argv+1); + else if (strcmp(argv[1], "fixmate") == 0) return bam_mating(argc-1, argv+1); + else if (strcmp(argv[1], "rmdup") == 0) return bam_rmdup(argc-1, argv+1); + else if (strcmp(argv[1], "flagstat") == 0) return bam_flagstat(argc-1, argv+1); + else if (strcmp(argv[1], "calmd") == 0) return bam_fillmd(argc-1, argv+1); + else if (strcmp(argv[1], "fillmd") == 0) return bam_fillmd(argc-1, argv+1); + else if (strcmp(argv[1], "reheader") == 0) return main_reheader(argc-1, argv+1); + else if (strcmp(argv[1], "cat") == 0) return main_cat(argc-1, argv+1); + else if (strcmp(argv[1], "targetcut") == 0) return main_cut_target(argc-1, argv+1); + else if (strcmp(argv[1], "phase") == 0) return main_phase(argc-1, argv+1); + else if (strcmp(argv[1], "depth") == 0) return main_depth(argc-1, argv+1); + else if (strcmp(argv[1], "bam2fq") == 0) return main_bam2fq(argc-1, argv+1); + +#if _CURSES_LIB != 0 + else if (strcmp(argv[1], "tview") == 0) return bam_tview_main(argc-1, argv+1); +#endif + else + { + fprintf(stderr, "[main] unrecognized command '%s'\n", argv[1]); + return 1; + } + return 0; +} + +// taken from samtools/bam_import.c +static inline uint8_t *alloc_data(bam1_t *b, size_t size) +{ + if (b->m_data < size) + { + b->m_data = size; + kroundup32(b->m_data); + b->data = (uint8_t*)realloc(b->data, b->m_data); + } + return b->data; +} + +// update the variable length data within a bam1_t entry. +// Adds *nbytes_new* - *nbytes_old* into the variable length data of *src* at *pos*. +// Data within the bam1_t entry is moved so that it is +// consistent with the data field lengths. +bam1_t * pysam_bam_update( bam1_t * b, + const size_t nbytes_old, + const size_t nbytes_new, + uint8_t * pos ) +{ + int d = nbytes_new-nbytes_old; + int new_size; + size_t offset; + + // no change + if (d == 0) return b; + + new_size = d + b->data_len; + offset = pos - b->data; + + //printf("d=%i, old=%i, new=%i, old_size=%i, new_size=%i\n", + // d, nbytes_old, nbytes_new, b->data_len, new_size); + + // increase memory if required + if (d > 0) + { + alloc_data( b, new_size ); + pos = b->data + offset; + } + + if (b->data_len != 0) + { + if (offset < 0 || offset > b->data_len) + fprintf(stderr, "[pysam_bam_insert] illegal offset: '%i'\n", (int)offset); + } + + // printf("dest=%p, src=%p, n=%i\n", pos+nbytes_new, pos + nbytes_old, b->data_len - (offset+nbytes_old)); + memmove( pos + nbytes_new, + pos + nbytes_old, + b->data_len - (offset + nbytes_old)); + + b->data_len = new_size; + + return b; +} + +// translate a nucleotide character to binary code +unsigned char pysam_translate_sequence( const unsigned char s ) +{ + return bam_nt16_table[s]; +} + + +void bam_init_header_hash(bam_header_t *header); + +// translate a reference string *s* to a tid +// code taken from bam_parse_region +int pysam_reference2tid( bam_header_t *header, const char * s ) +{ + + khiter_t iter; + khash_t(s) *h; + + bam_init_header_hash(header); + h = (khash_t(s)*)header->hash; + + iter = kh_get(s, h, s); /* get the ref_id */ + if (iter == kh_end(h)) { // name not found + return -1; + } + + return kh_value(h, iter); +} + + + + + + + + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.h b/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.h new file mode 100755 index 0000000..c6184eb --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/pysam_util.h @@ -0,0 +1,65 @@ +#ifndef PYSAM_UTIL_H +#define PYSAM_UTIL_H + +////////////////////////////////////////////////////////////////// +// set pysam standard error to point to stream +FILE * pysam_set_stderr( FILE * f ); + +////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////// +// various helper functions +// +// fill pileup buffer for next position. + +int pysam_pileup_next(const bam1_t *b, + bam_plbuf_t *buf, + bam_pileup1_t ** plp, + int * tid, + int * pos, + int * n_plp); + +int pysam_dispatch(int argc, char *argv[] ); + +/*! + @abstract Update the variable length data within a bam1_t entry + + Old data is deleted and the data within b are re-arranged to + make place for new data. + + @discussion Returns b + + @param b bam1_t data + @param nbytes_old size of old data + @param nbytes_new size of new data + @param pos position of data +*/ +bam1_t * pysam_bam_update( bam1_t * b, + const size_t nbytes_old, + const size_t nbytes_new, + uint8_t * pos ); + +// translate a nucleotide character to binary code +unsigned char pysam_translate_sequence( const unsigned char s ); + +// defined in bam_import.c +extern unsigned char bam_nt16_table[256]; + +// translate a reference string *s* to a tid +int pysam_reference2tid( bam_header_t *header, const char * s ); + +// return number of mapped reads for tid +uint32_t pysam_get_mapped( const bam_index_t *idx, const int tid ); + +// return number of unmapped reads for tid +uint32_t pysam_get_unmapped( const bam_index_t *idx, const int tid ); + +// debugging functions +/* #include "glf.h" */ +/* uint32_t pysam_glf_depth( glf1_t * g); */ + +/* #include "bam_maqcns.h" */ +/* void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c ); */ + + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/tabix_util.c b/code/utilities/CPAT-1.2.2/lib/pysam/tabix_util.c new file mode 100755 index 0000000..b06a614 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/tabix_util.c @@ -0,0 +1,4 @@ +// Definition of pysamerr +#include "stdio.h" +FILE * pysamerr = NULL; + diff --git a/code/utilities/CPAT-1.2.2/lib/pysam/version.py b/code/utilities/CPAT-1.2.2/lib/pysam/version.py new file mode 100755 index 0000000..c0ce4ad --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/pysam/version.py @@ -0,0 +1,7 @@ +# pysam versioning information + +__version__ = "0.6" + +__samtools_version__ = "0.1.18" + +__tabix_version__ = "0.2.5" diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam.c.pysam.c new file mode 100755 index 0000000..ad26339 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam.c.pysam.c @@ -0,0 +1,364 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include "bam.h" +#include "bam_endian.h" +#include "kstring.h" +#include "sam_header.h" + +int bam_is_be = 0, bam_verbose = 2; +char *bam_flag2char_table = "pPuUrR12sfd\0\0\0\0\0"; + +/************************** + * CIGAR related routines * + **************************/ + +uint32_t bam_calend(const bam1_core_t *c, const uint32_t *cigar) +{ + uint32_t k, end; + end = c->pos; + for (k = 0; k < c->n_cigar; ++k) { + int op = cigar[k] & BAM_CIGAR_MASK; + if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP) + end += cigar[k] >> BAM_CIGAR_SHIFT; + } + return end; +} + +int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar) +{ + uint32_t k; + int32_t l = 0; + for (k = 0; k < c->n_cigar; ++k) { + int op = cigar[k] & BAM_CIGAR_MASK; + if (op == BAM_CMATCH || op == BAM_CINS || op == BAM_CSOFT_CLIP || op == BAM_CEQUAL || op == BAM_CDIFF) + l += cigar[k] >> BAM_CIGAR_SHIFT; + } + return l; +} + +/******************** + * BAM I/O routines * + ********************/ + +bam_header_t *bam_header_init() +{ + bam_is_be = bam_is_big_endian(); + return (bam_header_t*)calloc(1, sizeof(bam_header_t)); +} + +void bam_header_destroy(bam_header_t *header) +{ + int32_t i; + extern void bam_destroy_header_hash(bam_header_t *header); + if (header == 0) return; + if (header->target_name) { + for (i = 0; i < header->n_targets; ++i) + free(header->target_name[i]); + free(header->target_name); + free(header->target_len); + } + free(header->text); + if (header->dict) sam_header_free(header->dict); + if (header->rg2lib) sam_tbl_destroy(header->rg2lib); + bam_destroy_header_hash(header); + free(header); +} + +bam_header_t *bam_header_read(bamFile fp) +{ + bam_header_t *header; + char buf[4]; + int magic_len; + int32_t i = 1, name_len; + // check EOF + i = bgzf_check_EOF(fp); + if (i < 0) { + // If the file is a pipe, checking the EOF marker will *always* fail + // with ESPIPE. Suppress the error message in this case. + if (errno != ESPIPE) perror("[bam_header_read] bgzf_check_EOF"); + } + else if (i == 0) fprintf(pysamerr, "[bam_header_read] EOF marker is absent. The input is probably truncated.\n"); + // read "BAM1" + magic_len = bam_read(fp, buf, 4); + if (magic_len != 4 || strncmp(buf, "BAM\001", 4) != 0) { + fprintf(pysamerr, "[bam_header_read] invalid BAM binary header (this is not a BAM file).\n"); + return 0; + } + header = bam_header_init(); + // read plain text and the number of reference sequences + bam_read(fp, &header->l_text, 4); + if (bam_is_be) bam_swap_endian_4p(&header->l_text); + header->text = (char*)calloc(header->l_text + 1, 1); + bam_read(fp, header->text, header->l_text); + bam_read(fp, &header->n_targets, 4); + if (bam_is_be) bam_swap_endian_4p(&header->n_targets); + // read reference sequence names and lengths + header->target_name = (char**)calloc(header->n_targets, sizeof(char*)); + header->target_len = (uint32_t*)calloc(header->n_targets, 4); + for (i = 0; i != header->n_targets; ++i) { + bam_read(fp, &name_len, 4); + if (bam_is_be) bam_swap_endian_4p(&name_len); + header->target_name[i] = (char*)calloc(name_len, 1); + bam_read(fp, header->target_name[i], name_len); + bam_read(fp, &header->target_len[i], 4); + if (bam_is_be) bam_swap_endian_4p(&header->target_len[i]); + } + return header; +} + +int bam_header_write(bamFile fp, const bam_header_t *header) +{ + char buf[4]; + int32_t i, name_len, x; + // write "BAM1" + strncpy(buf, "BAM\001", 4); + bam_write(fp, buf, 4); + // write plain text and the number of reference sequences + if (bam_is_be) { + x = bam_swap_endian_4(header->l_text); + bam_write(fp, &x, 4); + if (header->l_text) bam_write(fp, header->text, header->l_text); + x = bam_swap_endian_4(header->n_targets); + bam_write(fp, &x, 4); + } else { + bam_write(fp, &header->l_text, 4); + if (header->l_text) bam_write(fp, header->text, header->l_text); + bam_write(fp, &header->n_targets, 4); + } + // write sequence names and lengths + for (i = 0; i != header->n_targets; ++i) { + char *p = header->target_name[i]; + name_len = strlen(p) + 1; + if (bam_is_be) { + x = bam_swap_endian_4(name_len); + bam_write(fp, &x, 4); + } else bam_write(fp, &name_len, 4); + bam_write(fp, p, name_len); + if (bam_is_be) { + x = bam_swap_endian_4(header->target_len[i]); + bam_write(fp, &x, 4); + } else bam_write(fp, &header->target_len[i], 4); + } + bgzf_flush(fp); + return 0; +} + +static void swap_endian_data(const bam1_core_t *c, int data_len, uint8_t *data) +{ + uint8_t *s; + uint32_t i, *cigar = (uint32_t*)(data + c->l_qname); + s = data + c->n_cigar*4 + c->l_qname + c->l_qseq + (c->l_qseq + 1)/2; + for (i = 0; i < c->n_cigar; ++i) bam_swap_endian_4p(&cigar[i]); + while (s < data + data_len) { + uint8_t type; + s += 2; // skip key + type = toupper(*s); ++s; // skip type + if (type == 'C' || type == 'A') ++s; + else if (type == 'S') { bam_swap_endian_2p(s); s += 2; } + else if (type == 'I' || type == 'F') { bam_swap_endian_4p(s); s += 4; } + else if (type == 'D') { bam_swap_endian_8p(s); s += 8; } + else if (type == 'Z' || type == 'H') { while (*s) ++s; ++s; } + else if (type == 'B') { + int32_t n, Bsize = bam_aux_type2size(*s); + memcpy(&n, s + 1, 4); + if (1 == Bsize) { + } else if (2 == Bsize) { + for (i = 0; i < n; i += 2) + bam_swap_endian_2p(s + 5 + i); + } else if (4 == Bsize) { + for (i = 0; i < n; i += 4) + bam_swap_endian_4p(s + 5 + i); + } + bam_swap_endian_4p(s+1); + } + } +} + +int bam_read1(bamFile fp, bam1_t *b) +{ + bam1_core_t *c = &b->core; + int32_t block_len, ret, i; + uint32_t x[8]; + + assert(BAM_CORE_SIZE == 32); + if ((ret = bam_read(fp, &block_len, 4)) != 4) { + if (ret == 0) return -1; // normal end-of-file + else return -2; // truncated + } + if (bam_read(fp, x, BAM_CORE_SIZE) != BAM_CORE_SIZE) return -3; + if (bam_is_be) { + bam_swap_endian_4p(&block_len); + for (i = 0; i < 8; ++i) bam_swap_endian_4p(x + i); + } + c->tid = x[0]; c->pos = x[1]; + c->bin = x[2]>>16; c->qual = x[2]>>8&0xff; c->l_qname = x[2]&0xff; + c->flag = x[3]>>16; c->n_cigar = x[3]&0xffff; + c->l_qseq = x[4]; + c->mtid = x[5]; c->mpos = x[6]; c->isize = x[7]; + b->data_len = block_len - BAM_CORE_SIZE; + if (b->m_data < b->data_len) { + b->m_data = b->data_len; + kroundup32(b->m_data); + b->data = (uint8_t*)realloc(b->data, b->m_data); + } + if (bam_read(fp, b->data, b->data_len) != b->data_len) return -4; + b->l_aux = b->data_len - c->n_cigar * 4 - c->l_qname - c->l_qseq - (c->l_qseq+1)/2; + if (bam_is_be) swap_endian_data(c, b->data_len, b->data); + return 4 + block_len; +} + +inline int bam_write1_core(bamFile fp, const bam1_core_t *c, int data_len, uint8_t *data) +{ + uint32_t x[8], block_len = data_len + BAM_CORE_SIZE, y; + int i; + assert(BAM_CORE_SIZE == 32); + x[0] = c->tid; + x[1] = c->pos; + x[2] = (uint32_t)c->bin<<16 | c->qual<<8 | c->l_qname; + x[3] = (uint32_t)c->flag<<16 | c->n_cigar; + x[4] = c->l_qseq; + x[5] = c->mtid; + x[6] = c->mpos; + x[7] = c->isize; + bgzf_flush_try(fp, 4 + block_len); + if (bam_is_be) { + for (i = 0; i < 8; ++i) bam_swap_endian_4p(x + i); + y = block_len; + bam_write(fp, bam_swap_endian_4p(&y), 4); + swap_endian_data(c, data_len, data); + } else bam_write(fp, &block_len, 4); + bam_write(fp, x, BAM_CORE_SIZE); + bam_write(fp, data, data_len); + if (bam_is_be) swap_endian_data(c, data_len, data); + return 4 + block_len; +} + +int bam_write1(bamFile fp, const bam1_t *b) +{ + return bam_write1_core(fp, &b->core, b->data_len, b->data); +} + +char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of) +{ + uint8_t *s = bam1_seq(b), *t = bam1_qual(b); + int i; + const bam1_core_t *c = &b->core; + kstring_t str; + str.l = str.m = 0; str.s = 0; + + kputsn(bam1_qname(b), c->l_qname-1, &str); kputc('\t', &str); + if (of == BAM_OFDEC) { kputw(c->flag, &str); kputc('\t', &str); } + else if (of == BAM_OFHEX) ksprintf(&str, "0x%x\t", c->flag); + else { // BAM_OFSTR + for (i = 0; i < 16; ++i) + if ((c->flag & 1<tid < 0) kputsn("*\t", 2, &str); + else { + if (header) kputs(header->target_name[c->tid] , &str); + else kputw(c->tid, &str); + kputc('\t', &str); + } + kputw(c->pos + 1, &str); kputc('\t', &str); kputw(c->qual, &str); kputc('\t', &str); + if (c->n_cigar == 0) kputc('*', &str); + else { + for (i = 0; i < c->n_cigar; ++i) { + kputw(bam1_cigar(b)[i]>>BAM_CIGAR_SHIFT, &str); + kputc("MIDNSHP=X"[bam1_cigar(b)[i]&BAM_CIGAR_MASK], &str); + } + } + kputc('\t', &str); + if (c->mtid < 0) kputsn("*\t", 2, &str); + else if (c->mtid == c->tid) kputsn("=\t", 2, &str); + else { + if (header) kputs(header->target_name[c->mtid], &str); + else kputw(c->mtid, &str); + kputc('\t', &str); + } + kputw(c->mpos + 1, &str); kputc('\t', &str); kputw(c->isize, &str); kputc('\t', &str); + if (c->l_qseq) { + for (i = 0; i < c->l_qseq; ++i) kputc(bam_nt16_rev_table[bam1_seqi(s, i)], &str); + kputc('\t', &str); + if (t[0] == 0xff) kputc('*', &str); + else for (i = 0; i < c->l_qseq; ++i) kputc(t[i] + 33, &str); + } else kputsn("*\t*", 3, &str); + s = bam1_aux(b); + while (s < b->data + b->data_len) { + uint8_t type, key[2]; + key[0] = s[0]; key[1] = s[1]; + s += 2; type = *s; ++s; + kputc('\t', &str); kputsn((char*)key, 2, &str); kputc(':', &str); + if (type == 'A') { kputsn("A:", 2, &str); kputc(*s, &str); ++s; } + else if (type == 'C') { kputsn("i:", 2, &str); kputw(*s, &str); ++s; } + else if (type == 'c') { kputsn("i:", 2, &str); kputw(*(int8_t*)s, &str); ++s; } + else if (type == 'S') { kputsn("i:", 2, &str); kputw(*(uint16_t*)s, &str); s += 2; } + else if (type == 's') { kputsn("i:", 2, &str); kputw(*(int16_t*)s, &str); s += 2; } + else if (type == 'I') { kputsn("i:", 2, &str); kputuw(*(uint32_t*)s, &str); s += 4; } + else if (type == 'i') { kputsn("i:", 2, &str); kputw(*(int32_t*)s, &str); s += 4; } + else if (type == 'f') { ksprintf(&str, "f:%g", *(float*)s); s += 4; } + else if (type == 'd') { ksprintf(&str, "d:%lg", *(double*)s); s += 8; } + else if (type == 'Z' || type == 'H') { kputc(type, &str); kputc(':', &str); while (*s) kputc(*s++, &str); ++s; } + else if (type == 'B') { + uint8_t sub_type = *(s++); + int32_t n; + memcpy(&n, s, 4); + s += 4; // no point to the start of the array + kputc(type, &str); kputc(':', &str); kputc(sub_type, &str); // write the typing + for (i = 0; i < n; ++i) { + kputc(',', &str); + if ('c' == sub_type || 'c' == sub_type) { kputw(*(int8_t*)s, &str); ++s; } + else if ('C' == sub_type) { kputw(*(uint8_t*)s, &str); ++s; } + else if ('s' == sub_type) { kputw(*(int16_t*)s, &str); s += 2; } + else if ('S' == sub_type) { kputw(*(uint16_t*)s, &str); s += 2; } + else if ('i' == sub_type) { kputw(*(int32_t*)s, &str); s += 4; } + else if ('I' == sub_type) { kputuw(*(uint32_t*)s, &str); s += 4; } + else if ('f' == sub_type) { ksprintf(&str, "%g", *(float*)s); s += 4; } + } + } + } + return str.s; +} + +char *bam_format1(const bam_header_t *header, const bam1_t *b) +{ + return bam_format1_core(header, b, BAM_OFDEC); +} + +void bam_view1(const bam_header_t *header, const bam1_t *b) +{ + char *s = bam_format1(header, b); + puts(s); + free(s); +} + +int bam_validate1(const bam_header_t *header, const bam1_t *b) +{ + char *s; + + if (b->core.tid < -1 || b->core.mtid < -1) return 0; + if (header && (b->core.tid >= header->n_targets || b->core.mtid >= header->n_targets)) return 0; + + if (b->data_len < b->core.l_qname) return 0; + s = memchr(bam1_qname(b), '\0', b->core.l_qname); + if (s != &bam1_qname(b)[b->core.l_qname-1]) return 0; + + // FIXME: Other fields could also be checked, especially the auxiliary data + + return 1; +} + +// FIXME: we should also check the LB tag associated with each alignment +const char *bam_get_library(bam_header_t *h, const bam1_t *b) +{ + const uint8_t *rg; + if (h->dict == 0) h->dict = sam_header_parse2(h->text); + if (h->rg2lib == 0) h->rg2lib = sam_header2tbl(h->dict, "RG", "ID", "LB"); + rg = bam_aux_get(b, "RG"); + return (rg == 0)? 0 : sam_tbl_get(h->rg2lib, (const char*)(rg + 1)); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam.h b/code/utilities/CPAT-1.2.2/lib/samtools/bam.h new file mode 100755 index 0000000..346c750 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam.h @@ -0,0 +1,763 @@ +/* The MIT License + + Copyright (c) 2008-2010 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +#ifndef BAM_BAM_H +#define BAM_BAM_H + +/*! + @header + + BAM library provides I/O and various operations on manipulating files + in the BAM (Binary Alignment/Mapping) or SAM (Sequence Alignment/Map) + format. It now supports importing from or exporting to SAM, sorting, + merging, generating pileup, and quickly retrieval of reads overlapped + with a specified region. + + @copyright Genome Research Ltd. + */ + +#define BAM_VERSION "0.1.18 (r982:295)" + +#include +#include +#include +#include + +#ifndef BAM_LITE +#define BAM_VIRTUAL_OFFSET16 +#include "bgzf.h" +/*! @abstract BAM file handler */ +typedef BGZF *bamFile; +#define bam_open(fn, mode) bgzf_open(fn, mode) +#define bam_dopen(fd, mode) bgzf_fdopen(fd, mode) +#define bam_close(fp) bgzf_close(fp) +#define bam_read(fp, buf, size) bgzf_read(fp, buf, size) +#define bam_write(fp, buf, size) bgzf_write(fp, buf, size) +#define bam_tell(fp) bgzf_tell(fp) +#define bam_seek(fp, pos, dir) bgzf_seek(fp, pos, dir) +#else +#define BAM_TRUE_OFFSET +#include +typedef gzFile bamFile; +#define bam_open(fn, mode) gzopen(fn, mode) +#define bam_dopen(fd, mode) gzdopen(fd, mode) +#define bam_close(fp) gzclose(fp) +#define bam_read(fp, buf, size) gzread(fp, buf, size) +/* no bam_write/bam_tell/bam_seek() here */ +#endif + +/*! @typedef + @abstract Structure for the alignment header. + @field n_targets number of reference sequences + @field target_name names of the reference sequences + @field target_len lengths of the referene sequences + @field dict header dictionary + @field hash hash table for fast name lookup + @field rg2lib hash table for @RG-ID -> LB lookup + @field l_text length of the plain text in the header + @field text plain text + + @discussion Field hash points to null by default. It is a private + member. + */ +typedef struct { + int32_t n_targets; + char **target_name; + uint32_t *target_len; + void *dict, *hash, *rg2lib; + size_t l_text, n_text; + char *text; +} bam_header_t; + +/*! @abstract the read is paired in sequencing, no matter whether it is mapped in a pair */ +#define BAM_FPAIRED 1 +/*! @abstract the read is mapped in a proper pair */ +#define BAM_FPROPER_PAIR 2 +/*! @abstract the read itself is unmapped; conflictive with BAM_FPROPER_PAIR */ +#define BAM_FUNMAP 4 +/*! @abstract the mate is unmapped */ +#define BAM_FMUNMAP 8 +/*! @abstract the read is mapped to the reverse strand */ +#define BAM_FREVERSE 16 +/*! @abstract the mate is mapped to the reverse strand */ +#define BAM_FMREVERSE 32 +/*! @abstract this is read1 */ +#define BAM_FREAD1 64 +/*! @abstract this is read2 */ +#define BAM_FREAD2 128 +/*! @abstract not primary alignment */ +#define BAM_FSECONDARY 256 +/*! @abstract QC failure */ +#define BAM_FQCFAIL 512 +/*! @abstract optical or PCR duplicate */ +#define BAM_FDUP 1024 + +#define BAM_OFDEC 0 +#define BAM_OFHEX 1 +#define BAM_OFSTR 2 + +/*! @abstract defautl mask for pileup */ +#define BAM_DEF_MASK (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) + +#define BAM_CORE_SIZE sizeof(bam1_core_t) + +/** + * Describing how CIGAR operation/length is packed in a 32-bit integer. + */ +#define BAM_CIGAR_SHIFT 4 +#define BAM_CIGAR_MASK ((1 << BAM_CIGAR_SHIFT) - 1) + +/* + CIGAR operations. + */ +/*! @abstract CIGAR: M = match or mismatch*/ +#define BAM_CMATCH 0 +/*! @abstract CIGAR: I = insertion to the reference */ +#define BAM_CINS 1 +/*! @abstract CIGAR: D = deletion from the reference */ +#define BAM_CDEL 2 +/*! @abstract CIGAR: N = skip on the reference (e.g. spliced alignment) */ +#define BAM_CREF_SKIP 3 +/*! @abstract CIGAR: S = clip on the read with clipped sequence + present in qseq */ +#define BAM_CSOFT_CLIP 4 +/*! @abstract CIGAR: H = clip on the read with clipped sequence trimmed off */ +#define BAM_CHARD_CLIP 5 +/*! @abstract CIGAR: P = padding */ +#define BAM_CPAD 6 +/*! @abstract CIGAR: equals = match */ +#define BAM_CEQUAL 7 +/*! @abstract CIGAR: X = mismatch */ +#define BAM_CDIFF 8 + +/*! @typedef + @abstract Structure for core alignment information. + @field tid chromosome ID, defined by bam_header_t + @field pos 0-based leftmost coordinate + @field strand strand; 0 for forward and 1 otherwise + @field bin bin calculated by bam_reg2bin() + @field qual mapping quality + @field l_qname length of the query name + @field flag bitwise flag + @field n_cigar number of CIGAR operations + @field l_qseq length of the query sequence (read) + */ +typedef struct { + int32_t tid; + int32_t pos; + uint32_t bin:16, qual:8, l_qname:8; + uint32_t flag:16, n_cigar:16; + int32_t l_qseq; + int32_t mtid; + int32_t mpos; + int32_t isize; +} bam1_core_t; + +/*! @typedef + @abstract Structure for one alignment. + @field core core information about the alignment + @field l_aux length of auxiliary data + @field data_len current length of bam1_t::data + @field m_data maximum length of bam1_t::data + @field data all variable-length data, concatenated; structure: cigar-qname-seq-qual-aux + + @discussion Notes: + + 1. qname is zero tailing and core.l_qname includes the tailing '\0'. + 2. l_qseq is calculated from the total length of an alignment block + on reading or from CIGAR. + */ +typedef struct { + bam1_core_t core; + int l_aux, data_len, m_data; + uint8_t *data; +} bam1_t; + +typedef struct __bam_iter_t *bam_iter_t; + +#define bam1_strand(b) (((b)->core.flag&BAM_FREVERSE) != 0) +#define bam1_mstrand(b) (((b)->core.flag&BAM_FMREVERSE) != 0) + +/*! @function + @abstract Get the CIGAR array + @param b pointer to an alignment + @return pointer to the CIGAR array + + @discussion In the CIGAR array, each element is a 32-bit integer. The + lower 4 bits gives a CIGAR operation and the higher 28 bits keep the + length of a CIGAR. + */ +#define bam1_cigar(b) ((uint32_t*)((b)->data + (b)->core.l_qname)) + +/*! @function + @abstract Get the name of the query + @param b pointer to an alignment + @return pointer to the name string, null terminated + */ +#define bam1_qname(b) ((char*)((b)->data)) + +/*! @function + @abstract Get query sequence + @param b pointer to an alignment + @return pointer to sequence + + @discussion Each base is encoded in 4 bits: 1 for A, 2 for C, 4 for G, + 8 for T and 15 for N. Two bases are packed in one byte with the base + at the higher 4 bits having smaller coordinate on the read. It is + recommended to use bam1_seqi() macro to get the base. + */ +#define bam1_seq(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname) + +/*! @function + @abstract Get query quality + @param b pointer to an alignment + @return pointer to quality string + */ +#define bam1_qual(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1)) + +/*! @function + @abstract Get a base on read + @param s Query sequence returned by bam1_seq() + @param i The i-th position, 0-based + @return 4-bit integer representing the base. + */ +#define bam1_seqi(s, i) ((s)[(i)/2] >> 4*(1-(i)%2) & 0xf) + +/*! @function + @abstract Get query sequence and quality + @param b pointer to an alignment + @return pointer to the concatenated auxiliary data + */ +#define bam1_aux(b) ((b)->data + (b)->core.n_cigar*4 + (b)->core.l_qname + (b)->core.l_qseq + ((b)->core.l_qseq + 1)/2) + +#ifndef kroundup32 +/*! @function + @abstract Round an integer to the next closest power-2 integer. + @param x integer to be rounded (in place) + @discussion x will be modified. + */ +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +/*! + @abstract Whether the machine is big-endian; modified only in + bam_header_init(). + */ +extern int bam_is_be; + +/*! + @abstract Verbose level between 0 and 3; 0 is supposed to disable all + debugging information, though this may not have been implemented. + */ +extern int bam_verbose; + +/*! @abstract Table for converting a nucleotide character to the 4-bit encoding. */ +extern unsigned char bam_nt16_table[256]; + +/*! @abstract Table for converting a 4-bit encoded nucleotide to a letter. */ +extern char *bam_nt16_rev_table; + +extern char bam_nt16_nt4_table[]; + +#ifdef __cplusplus +extern "C" { +#endif + + /********************* + * Low-level SAM I/O * + *********************/ + + /*! @abstract TAM file handler */ + typedef struct __tamFile_t *tamFile; + + /*! + @abstract Open a SAM file for reading, either uncompressed or compressed by gzip/zlib. + @param fn SAM file name + @return SAM file handler + */ + tamFile sam_open(const char *fn); + + /*! + @abstract Close a SAM file handler + @param fp SAM file handler + */ + void sam_close(tamFile fp); + + /*! + @abstract Read one alignment from a SAM file handler + @param fp SAM file handler + @param header header information (ordered names of chromosomes) + @param b read alignment; all members in b will be updated + @return 0 if successful; otherwise negative + */ + int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b); + + /*! + @abstract Read header information from a TAB-delimited list file. + @param fn_list file name for the list + @return a pointer to the header structure + + @discussion Each line in this file consists of chromosome name and + the length of chromosome. + */ + bam_header_t *sam_header_read2(const char *fn_list); + + /*! + @abstract Read header from a SAM file (if present) + @param fp SAM file handler + @return pointer to header struct; 0 if no @SQ lines available + */ + bam_header_t *sam_header_read(tamFile fp); + + /*! + @abstract Parse @SQ lines a update a header struct + @param h pointer to the header struct to be updated + @return number of target sequences + + @discussion bam_header_t::{n_targets,target_len,target_name} will + be destroyed in the first place. + */ + int sam_header_parse(bam_header_t *h); + int32_t bam_get_tid(const bam_header_t *header, const char *seq_name); + + /*! + @abstract Parse @RG lines a update a header struct + @param h pointer to the header struct to be updated + @return number of @RG lines + + @discussion bam_header_t::rg2lib will be destroyed in the first + place. + */ + int sam_header_parse_rg(bam_header_t *h); + +#define sam_write1(header, b) bam_view1(header, b) + + + /******************************** + * APIs for string dictionaries * + ********************************/ + + int bam_strmap_put(void *strmap, const char *rg, const char *lib); + const char *bam_strmap_get(const void *strmap, const char *rg); + void *bam_strmap_dup(const void*); + void *bam_strmap_init(); + void bam_strmap_destroy(void *strmap); + + + /********************* + * Low-level BAM I/O * + *********************/ + + /*! + @abstract Initialize a header structure. + @return the pointer to the header structure + + @discussion This function also modifies the global variable + bam_is_be. + */ + bam_header_t *bam_header_init(); + + /*! + @abstract Destroy a header structure. + @param header pointer to the header + */ + void bam_header_destroy(bam_header_t *header); + + /*! + @abstract Read a header structure from BAM. + @param fp BAM file handler, opened by bam_open() + @return pointer to the header structure + + @discussion The file position indicator must be placed at the + beginning of the file. Upon success, the position indicator will + be set at the start of the first alignment. + */ + bam_header_t *bam_header_read(bamFile fp); + + /*! + @abstract Write a header structure to BAM. + @param fp BAM file handler + @param header pointer to the header structure + @return always 0 currently + */ + int bam_header_write(bamFile fp, const bam_header_t *header); + + /*! + @abstract Read an alignment from BAM. + @param fp BAM file handler + @param b read alignment; all members are updated. + @return number of bytes read from the file + + @discussion The file position indicator must be + placed right before an alignment. Upon success, this function + will set the position indicator to the start of the next + alignment. This function is not affected by the machine + endianness. + */ + int bam_read1(bamFile fp, bam1_t *b); + + /*! + @abstract Write an alignment to BAM. + @param fp BAM file handler + @param c pointer to the bam1_core_t structure + @param data_len total length of variable size data related to + the alignment + @param data pointer to the concatenated data + @return number of bytes written to the file + + @discussion This function is not affected by the machine + endianness. + */ + int bam_write1_core(bamFile fp, const bam1_core_t *c, int data_len, uint8_t *data); + + /*! + @abstract Write an alignment to BAM. + @param fp BAM file handler + @param b alignment to write + @return number of bytes written to the file + + @abstract It is equivalent to: + bam_write1_core(fp, &b->core, b->data_len, b->data) + */ + int bam_write1(bamFile fp, const bam1_t *b); + + /*! @function + @abstract Initiate a pointer to bam1_t struct + */ +#define bam_init1() ((bam1_t*)calloc(1, sizeof(bam1_t))) + + /*! @function + @abstract Free the memory allocated for an alignment. + @param b pointer to an alignment + */ +#define bam_destroy1(b) do { \ + if (b) { free((b)->data); free(b); } \ + } while (0) + + /*! + @abstract Format a BAM record in the SAM format + @param header pointer to the header structure + @param b alignment to print + @return a pointer to the SAM string + */ + char *bam_format1(const bam_header_t *header, const bam1_t *b); + + char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of); + + /*! + @abstract Check whether a BAM record is plausibly valid + @param header associated header structure, or NULL if unavailable + @param b alignment to validate + @return 0 if the alignment is invalid; non-zero otherwise + + @discussion Simple consistency check of some of the fields of the + alignment record. If the header is provided, several additional checks + are made. Not all fields are checked, so a non-zero result is not a + guarantee that the record is valid. However it is usually good enough + to detect when bam_seek() has been called with a virtual file offset + that is not the offset of an alignment record. + */ + int bam_validate1(const bam_header_t *header, const bam1_t *b); + + const char *bam_get_library(bam_header_t *header, const bam1_t *b); + + + /*************** + * pileup APIs * + ***************/ + + /*! @typedef + @abstract Structure for one alignment covering the pileup position. + @field b pointer to the alignment + @field qpos position of the read base at the pileup site, 0-based + @field indel indel length; 0 for no indel, positive for ins and negative for del + @field is_del 1 iff the base on the padded read is a deletion + @field level the level of the read in the "viewer" mode + + @discussion See also bam_plbuf_push() and bam_lplbuf_push(). The + difference between the two functions is that the former does not + set bam_pileup1_t::level, while the later does. Level helps the + implementation of alignment viewers, but calculating this has some + overhead. + */ + typedef struct { + bam1_t *b; + int32_t qpos; + int indel, level; + uint32_t is_del:1, is_head:1, is_tail:1, is_refskip:1, aux:28; + } bam_pileup1_t; + + typedef int (*bam_plp_auto_f)(void *data, bam1_t *b); + + struct __bam_plp_t; + typedef struct __bam_plp_t *bam_plp_t; + + bam_plp_t bam_plp_init(bam_plp_auto_f func, void *data); + int bam_plp_push(bam_plp_t iter, const bam1_t *b); + const bam_pileup1_t *bam_plp_next(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp); + const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp); + void bam_plp_set_mask(bam_plp_t iter, int mask); + void bam_plp_set_maxcnt(bam_plp_t iter, int maxcnt); + void bam_plp_reset(bam_plp_t iter); + void bam_plp_destroy(bam_plp_t iter); + + struct __bam_mplp_t; + typedef struct __bam_mplp_t *bam_mplp_t; + + bam_mplp_t bam_mplp_init(int n, bam_plp_auto_f func, void **data); + void bam_mplp_destroy(bam_mplp_t iter); + void bam_mplp_set_maxcnt(bam_mplp_t iter, int maxcnt); + int bam_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp); + + /*! @typedef + @abstract Type of function to be called by bam_plbuf_push(). + @param tid chromosome ID as is defined in the header + @param pos start coordinate of the alignment, 0-based + @param n number of elements in pl array + @param pl array of alignments + @param data user provided data + @discussion See also bam_plbuf_push(), bam_plbuf_init() and bam_pileup1_t. + */ + typedef int (*bam_pileup_f)(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data); + + typedef struct { + bam_plp_t iter; + bam_pileup_f func; + void *data; + } bam_plbuf_t; + + void bam_plbuf_set_mask(bam_plbuf_t *buf, int mask); + void bam_plbuf_reset(bam_plbuf_t *buf); + bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data); + void bam_plbuf_destroy(bam_plbuf_t *buf); + int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf); + + int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data); + + struct __bam_lplbuf_t; + typedef struct __bam_lplbuf_t bam_lplbuf_t; + + void bam_lplbuf_reset(bam_lplbuf_t *buf); + + /*! @abstract bam_plbuf_init() equivalent with level calculated. */ + bam_lplbuf_t *bam_lplbuf_init(bam_pileup_f func, void *data); + + /*! @abstract bam_plbuf_destroy() equivalent with level calculated. */ + void bam_lplbuf_destroy(bam_lplbuf_t *tv); + + /*! @abstract bam_plbuf_push() equivalent with level calculated. */ + int bam_lplbuf_push(const bam1_t *b, bam_lplbuf_t *buf); + + + /********************* + * BAM indexing APIs * + *********************/ + + struct __bam_index_t; + typedef struct __bam_index_t bam_index_t; + + /*! + @abstract Build index for a BAM file. + @discussion Index file "fn.bai" will be created. + @param fn name of the BAM file + @return always 0 currently + */ + int bam_index_build(const char *fn); + + /*! + @abstract Load index from file "fn.bai". + @param fn name of the BAM file (NOT the index file) + @return pointer to the index structure + */ + bam_index_t *bam_index_load(const char *fn); + + /*! + @abstract Destroy an index structure. + @param idx pointer to the index structure + */ + void bam_index_destroy(bam_index_t *idx); + + /*! @typedef + @abstract Type of function to be called by bam_fetch(). + @param b the alignment + @param data user provided data + */ + typedef int (*bam_fetch_f)(const bam1_t *b, void *data); + + /*! + @abstract Retrieve the alignments that are overlapped with the + specified region. + + @discussion A user defined function will be called for each + retrieved alignment ordered by its start position. + + @param fp BAM file handler + @param idx pointer to the alignment index + @param tid chromosome ID as is defined in the header + @param beg start coordinate, 0-based + @param end end coordinate, 0-based + @param data user provided data (will be transferred to func) + @param func user defined function + */ + int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func); + + bam_iter_t bam_iter_query(const bam_index_t *idx, int tid, int beg, int end); + int bam_iter_read(bamFile fp, bam_iter_t iter, bam1_t *b); + void bam_iter_destroy(bam_iter_t iter); + + /*! + @abstract Parse a region in the format: "chr2:100,000-200,000". + @discussion bam_header_t::hash will be initialized if empty. + @param header pointer to the header structure + @param str string to be parsed + @param ref_id the returned chromosome ID + @param begin the returned start coordinate + @param end the returned end coordinate + @return 0 on success; -1 on failure + */ + int bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *begin, int *end); + + + /************************** + * APIs for optional tags * + **************************/ + + /*! + @abstract Retrieve data of a tag + @param b pointer to an alignment struct + @param tag two-character tag to be retrieved + + @return pointer to the type and data. The first character is the + type that can be 'iIsScCdfAZH'. + + @discussion Use bam_aux2?() series to convert the returned data to + the corresponding type. + */ + uint8_t *bam_aux_get(const bam1_t *b, const char tag[2]); + + int32_t bam_aux2i(const uint8_t *s); + float bam_aux2f(const uint8_t *s); + double bam_aux2d(const uint8_t *s); + char bam_aux2A(const uint8_t *s); + char *bam_aux2Z(const uint8_t *s); + + int bam_aux_del(bam1_t *b, uint8_t *s); + void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data); + uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]); // an alias of bam_aux_get() + + + /***************** + * Miscellaneous * + *****************/ + + /*! + @abstract Calculate the rightmost coordinate of an alignment on the + reference genome. + + @param c pointer to the bam1_core_t structure + @param cigar the corresponding CIGAR array (from bam1_t::cigar) + @return the rightmost coordinate, 0-based + */ + uint32_t bam_calend(const bam1_core_t *c, const uint32_t *cigar); + + /*! + @abstract Calculate the length of the query sequence from CIGAR. + @param c pointer to the bam1_core_t structure + @param cigar the corresponding CIGAR array (from bam1_t::cigar) + @return length of the query sequence + */ + int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar); + +#ifdef __cplusplus +} +#endif + +/*! + @abstract Calculate the minimum bin that contains a region [beg,end). + @param beg start of the region, 0-based + @param end end of the region, 0-based + @return bin + */ +static inline int bam_reg2bin(uint32_t beg, uint32_t end) +{ + --end; + if (beg>>14 == end>>14) return 4681 + (beg>>14); + if (beg>>17 == end>>17) return 585 + (beg>>17); + if (beg>>20 == end>>20) return 73 + (beg>>20); + if (beg>>23 == end>>23) return 9 + (beg>>23); + if (beg>>26 == end>>26) return 1 + (beg>>26); + return 0; +} + +/*! + @abstract Copy an alignment + @param bdst destination alignment struct + @param bsrc source alignment struct + @return pointer to the destination alignment struct + */ +static inline bam1_t *bam_copy1(bam1_t *bdst, const bam1_t *bsrc) +{ + uint8_t *data = bdst->data; + int m_data = bdst->m_data; // backup data and m_data + if (m_data < bsrc->data_len) { // double the capacity + m_data = bsrc->data_len; kroundup32(m_data); + data = (uint8_t*)realloc(data, m_data); + } + memcpy(data, bsrc->data, bsrc->data_len); // copy var-len data + *bdst = *bsrc; // copy the rest + // restore the backup + bdst->m_data = m_data; + bdst->data = data; + return bdst; +} + +/*! + @abstract Duplicate an alignment + @param src source alignment struct + @return pointer to the destination alignment struct + */ +static inline bam1_t *bam_dup1(const bam1_t *src) +{ + bam1_t *b; + b = bam_init1(); + *b = *src; + b->m_data = b->data_len; + b->data = (uint8_t*)calloc(b->data_len, 1); + memcpy(b->data, src->data, b->data_len); + return b; +} + +static inline int bam_aux_type2size(int x) +{ + if (x == 'C' || x == 'c' || x == 'A') return 1; + else if (x == 'S' || x == 's') return 2; + else if (x == 'I' || x == 'i' || x == 'f') return 4; + else return 0; +} + + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.c.pysam.c new file mode 100755 index 0000000..ece837a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.c.pysam.c @@ -0,0 +1,353 @@ +#include "pysam.h" + +#include +#include +#include "bam.h" +#include "kstring.h" +#include "bam2bcf.h" +#include "errmod.h" +#include "bcftools/bcf.h" + +extern void ks_introsort_uint32_t(size_t n, uint32_t a[]); + +#define CALL_ETA 0.03f +#define CALL_MAX 256 +#define CALL_DEFTHETA 0.83f +#define DEF_MAPQ 20 + +#define CAP_DIST 25 + +bcf_callaux_t *bcf_call_init(double theta, int min_baseQ) +{ + bcf_callaux_t *bca; + if (theta <= 0.) theta = CALL_DEFTHETA; + bca = calloc(1, sizeof(bcf_callaux_t)); + bca->capQ = 60; + bca->openQ = 40; bca->extQ = 20; bca->tandemQ = 100; + bca->min_baseQ = min_baseQ; + bca->e = errmod_init(1. - theta); + bca->min_frac = 0.002; + bca->min_support = 1; + return bca; +} + +void bcf_call_destroy(bcf_callaux_t *bca) +{ + if (bca == 0) return; + errmod_destroy(bca->e); + free(bca->bases); free(bca->inscns); free(bca); +} +/* ref_base is the 4-bit representation of the reference base. It is + * negative if we are looking at an indel. */ +int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r) +{ + static int *var_pos = NULL, nvar_pos = 0; + int i, n, ref4, is_indel, ori_depth = 0; + memset(r, 0, sizeof(bcf_callret1_t)); + if (ref_base >= 0) { + ref4 = bam_nt16_nt4_table[ref_base]; + is_indel = 0; + } else ref4 = 4, is_indel = 1; + if (_n == 0) return -1; + // enlarge the bases array if necessary + if (bca->max_bases < _n) { + bca->max_bases = _n; + kroundup32(bca->max_bases); + bca->bases = (uint16_t*)realloc(bca->bases, 2 * bca->max_bases); + } + // fill the bases array + memset(r, 0, sizeof(bcf_callret1_t)); + for (i = n = 0; i < _n; ++i) { + const bam_pileup1_t *p = pl + i; + int q, b, mapQ, baseQ, is_diff, min_dist, seqQ; + // set base + if (p->is_del || p->is_refskip || (p->b->core.flag&BAM_FUNMAP)) continue; + ++ori_depth; + baseQ = q = is_indel? p->aux&0xff : (int)bam1_qual(p->b)[p->qpos]; // base/indel quality + seqQ = is_indel? (p->aux>>8&0xff) : 99; + if (q < bca->min_baseQ) continue; + if (q > seqQ) q = seqQ; + mapQ = p->b->core.qual < 255? p->b->core.qual : DEF_MAPQ; // special case for mapQ==255 + mapQ = mapQ < bca->capQ? mapQ : bca->capQ; + if (q > mapQ) q = mapQ; + if (q > 63) q = 63; + if (q < 4) q = 4; + if (!is_indel) { + b = bam1_seqi(bam1_seq(p->b), p->qpos); // base + b = bam_nt16_nt4_table[b? b : ref_base]; // b is the 2-bit base + is_diff = (ref4 < 4 && b == ref4)? 0 : 1; + } else { + b = p->aux>>16&0x3f; + is_diff = (b != 0); + } + bca->bases[n++] = q<<5 | (int)bam1_strand(p->b)<<4 | b; + // collect annotations + if (b < 4) r->qsum[b] += q; + ++r->anno[0<<2|is_diff<<1|bam1_strand(p->b)]; + min_dist = p->b->core.l_qseq - 1 - p->qpos; + if (min_dist > p->qpos) min_dist = p->qpos; + if (min_dist > CAP_DIST) min_dist = CAP_DIST; + r->anno[1<<2|is_diff<<1|0] += baseQ; + r->anno[1<<2|is_diff<<1|1] += baseQ * baseQ; + r->anno[2<<2|is_diff<<1|0] += mapQ; + r->anno[2<<2|is_diff<<1|1] += mapQ * mapQ; + r->anno[3<<2|is_diff<<1|0] += min_dist; + r->anno[3<<2|is_diff<<1|1] += min_dist * min_dist; + } + r->depth = n; r->ori_depth = ori_depth; + // glfgen + errmod_cal(bca->e, n, 5, bca->bases, r->p); + + // Calculate the Variant Distance Bias (make it optional?) + if ( nvar_pos < _n ) { + nvar_pos = _n; + var_pos = realloc(var_pos,sizeof(int)*nvar_pos); + } + int alt_dp=0, read_len=0; + for (i=0; i<_n; i++) { + const bam_pileup1_t *p = pl + i; + if ( bam1_seqi(bam1_seq(p->b),p->qpos) == ref_base ) + continue; + + var_pos[alt_dp] = p->qpos; + if ( (bam1_cigar(p->b)[0]&BAM_CIGAR_MASK)==4 ) + var_pos[alt_dp] -= bam1_cigar(p->b)[0]>>BAM_CIGAR_SHIFT; + + alt_dp++; + read_len += p->b->core.l_qseq; + } + float mvd=0; + int j; + n=0; + for (i=0; imvd[0] = n ? mvd/n : 0; + r->mvd[1] = alt_dp; + r->mvd[2] = alt_dp ? read_len/alt_dp : 0; + + return r->depth; +} + + +void calc_vdb(int n, const bcf_callret1_t *calls, bcf_call_t *call) +{ + // Variant distance bias. Samples merged by means of DP-weighted average. + + float weight=0, tot_prob=0; + + int i; + for (i=0; i2*mu ? 0 : sin(mvd*3.14/2/mu) / (4*mu/3.14); + } + else + { + // Scaled gaussian curve, crude approximation, but behaves well. Using fixed depth for bigger depths. + if ( dp>5 ) + dp = 5; + float sigma2 = (read_len/1.9/(dp+1)) * (read_len/1.9/(dp+1)); + float norm = 1.125*sqrt(2*3.14*sigma2); + float mu = read_len/2.9; + if ( mvd < mu ) + prob = exp(-(mvd-mu)*(mvd-mu)/2/sigma2)/norm; + else + prob = exp(-(mvd-mu)*(mvd-mu)/3.125/sigma2)/norm; + } + + //fprintf(pysamerr,"dp=%d mvd=%d read_len=%d -> prob=%f\n", dp,mvd,read_len,prob); + tot_prob += prob*dp; + weight += dp; + } + tot_prob = weight ? tot_prob/weight : 1; + //fprintf(pysamerr,"prob=%f\n", tot_prob); + call->vdb = tot_prob; +} + +int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/, bcf_call_t *call) +{ + int ref4, i, j, qsum[4]; + int64_t tmp; + if (ref_base >= 0) { + call->ori_ref = ref4 = bam_nt16_nt4_table[ref_base]; + if (ref4 > 4) ref4 = 4; + } else call->ori_ref = -1, ref4 = 0; + // calculate qsum + memset(qsum, 0, 4 * sizeof(int)); + for (i = 0; i < n; ++i) + for (j = 0; j < 4; ++j) + qsum[j] += calls[i].qsum[j]; + for (j = 0; j < 4; ++j) qsum[j] = qsum[j] << 2 | j; + // find the top 2 alleles + for (i = 1; i < 4; ++i) // insertion sort + for (j = i; j > 0 && qsum[j] < qsum[j-1]; --j) + tmp = qsum[j], qsum[j] = qsum[j-1], qsum[j-1] = tmp; + // set the reference allele and alternative allele(s) + for (i = 0; i < 5; ++i) call->a[i] = -1; + call->unseen = -1; + call->a[0] = ref4; + for (i = 3, j = 1; i >= 0; --i) { + if ((qsum[i]&3) != ref4) { + if (qsum[i]>>2 != 0) call->a[j++] = qsum[i]&3; + else break; + } + } + if (ref_base >= 0) { // for SNPs, find the "unseen" base + if (((ref4 < 4 && j < 4) || (ref4 == 4 && j < 5)) && i >= 0) + call->unseen = j, call->a[j++] = qsum[i]&3; + call->n_alleles = j; + } else { + call->n_alleles = j; + if (call->n_alleles == 1) return -1; // no reliable supporting read. stop doing anything + } + // set the PL array + if (call->n < n) { + call->n = n; + call->PL = realloc(call->PL, 15 * n); + } + { + int x, g[15], z; + double sum_min = 0.; + x = call->n_alleles * (call->n_alleles + 1) / 2; + // get the possible genotypes + for (i = z = 0; i < call->n_alleles; ++i) + for (j = 0; j <= i; ++j) + g[z++] = call->a[j] * 5 + call->a[i]; + for (i = 0; i < n; ++i) { + uint8_t *PL = call->PL + x * i; + const bcf_callret1_t *r = calls + i; + float min = 1e37; + for (j = 0; j < x; ++j) + if (min > r->p[g[j]]) min = r->p[g[j]]; + sum_min += min; + for (j = 0; j < x; ++j) { + int y; + y = (int)(r->p[g[j]] - min + .499); + if (y > 255) y = 255; + PL[j] = y; + } + } +// if (ref_base < 0) fprintf(pysamerr, "%d,%d,%f,%d\n", call->n_alleles, x, sum_min, call->unseen); + call->shift = (int)(sum_min + .499); + } + // combine annotations + memset(call->anno, 0, 16 * sizeof(int)); + for (i = call->depth = call->ori_depth = 0, tmp = 0; i < n; ++i) { + call->depth += calls[i].depth; + call->ori_depth += calls[i].ori_depth; + for (j = 0; j < 16; ++j) call->anno[j] += calls[i].anno[j]; + } + + calc_vdb(n, calls, call); + + return 0; +} + +int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int is_SP, + const bcf_callaux_t *bca, const char *ref) +{ + extern double kt_fisher_exact(int n11, int n12, int n21, int n22, double *_left, double *_right, double *two); + kstring_t s; + int i, j; + b->n_smpl = bc->n; + b->tid = tid; b->pos = pos; b->qual = 0; + s.s = b->str; s.m = b->m_str; s.l = 0; + kputc('\0', &s); + if (bc->ori_ref < 0) { // an indel + // write REF + kputc(ref[pos], &s); + for (j = 0; j < bca->indelreg; ++j) kputc(ref[pos+1+j], &s); + kputc('\0', &s); + // write ALT + kputc(ref[pos], &s); + for (i = 1; i < 4; ++i) { + if (bc->a[i] < 0) break; + if (i > 1) { + kputc(',', &s); kputc(ref[pos], &s); + } + if (bca->indel_types[bc->a[i]] < 0) { // deletion + for (j = -bca->indel_types[bc->a[i]]; j < bca->indelreg; ++j) + kputc(ref[pos+1+j], &s); + } else { // insertion; cannot be a reference unless a bug + char *inscns = &bca->inscns[bc->a[i] * bca->maxins]; + for (j = 0; j < bca->indel_types[bc->a[i]]; ++j) + kputc("ACGTN"[(int)inscns[j]], &s); + for (j = 0; j < bca->indelreg; ++j) kputc(ref[pos+1+j], &s); + } + } + kputc('\0', &s); + } else { // a SNP + kputc("ACGTN"[bc->ori_ref], &s); kputc('\0', &s); + for (i = 1; i < 5; ++i) { + if (bc->a[i] < 0) break; + if (i > 1) kputc(',', &s); + kputc(bc->unseen == i? 'X' : "ACGT"[bc->a[i]], &s); + } + kputc('\0', &s); + } + kputc('\0', &s); + // INFO + if (bc->ori_ref < 0) kputs("INDEL;", &s); + kputs("DP=", &s); kputw(bc->ori_depth, &s); kputs(";I16=", &s); + for (i = 0; i < 16; ++i) { + if (i) kputc(',', &s); + kputw(bc->anno[i], &s); + } + if ( bc->vdb!=1 ) + { + ksprintf(&s, ";VDB=%.4f", bc->vdb); + } + kputc('\0', &s); + // FMT + kputs("PL", &s); + if (bcr) { + kputs(":DP", &s); + if (is_SP) kputs(":SP", &s); + } + kputc('\0', &s); + b->m_str = s.m; b->str = s.s; b->l_str = s.l; + bcf_sync(b); + memcpy(b->gi[0].data, bc->PL, b->gi[0].len * bc->n); + if (bcr) { + uint16_t *dp = (uint16_t*)b->gi[1].data; + int32_t *sp = is_SP? b->gi[2].data : 0; + for (i = 0; i < bc->n; ++i) { + bcf_callret1_t *p = bcr + i; + dp[i] = p->depth < 0xffff? p->depth : 0xffff; + if (is_SP) { + if (p->anno[0] + p->anno[1] < 2 || p->anno[2] + p->anno[3] < 2 + || p->anno[0] + p->anno[2] < 2 || p->anno[1] + p->anno[3] < 2) + { + sp[i] = 0; + } else { + double left, right, two; + int x; + kt_fisher_exact(p->anno[0], p->anno[1], p->anno[2], p->anno[3], &left, &right, &two); + x = (int)(-4.343 * log(two) + .499); + if (x > 255) x = 255; + sp[i] = x; + } + } + } + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.h b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.h new file mode 100755 index 0000000..4af080c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf.h @@ -0,0 +1,57 @@ +#ifndef BAM2BCF_H +#define BAM2BCF_H + +#include +#include "errmod.h" +#include "bcftools/bcf.h" + +#define B2B_INDEL_NULL 10000 + +typedef struct __bcf_callaux_t { + int capQ, min_baseQ; + int openQ, extQ, tandemQ; // for indels + int min_support; // for collecting indel candidates + double min_frac; // for collecting indel candidates + // for internal uses + int max_bases; + int indel_types[4]; + int maxins, indelreg; + char *inscns; + uint16_t *bases; + errmod_t *e; + void *rghash; +} bcf_callaux_t; + +typedef struct { + int depth, ori_depth, qsum[4]; + int anno[16]; + float p[25]; + int mvd[3]; // mean variant distance, number of variant reads, average read length +} bcf_callret1_t; + +typedef struct { + int a[5]; // alleles: ref, alt, alt2, alt3 + int n, n_alleles, shift, ori_ref, unseen; + int anno[16], depth, ori_depth; + uint8_t *PL; + float vdb; // variant distance bias +} bcf_call_t; + +#ifdef __cplusplus +extern "C" { +#endif + + bcf_callaux_t *bcf_call_init(double theta, int min_baseQ); + void bcf_call_destroy(bcf_callaux_t *bca); + int bcf_call_glfgen(int _n, const bam_pileup1_t *pl, int ref_base, bcf_callaux_t *bca, bcf_callret1_t *r); + int bcf_call_combine(int n, const bcf_callret1_t *calls, int ref_base /*4-bit*/, bcf_call_t *call); + int bcf_call2bcf(int tid, int pos, bcf_call_t *bc, bcf1_t *b, bcf_callret1_t *bcr, int is_SP, + const bcf_callaux_t *bca, const char *ref); + int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref, + const void *rghash); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf_indel.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf_indel.c.pysam.c new file mode 100755 index 0000000..cf86ca3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam2bcf_indel.c.pysam.c @@ -0,0 +1,477 @@ +#include "pysam.h" + +#include +#include +#include +#include "bam.h" +#include "bam2bcf.h" +#include "kaln.h" +#include "kprobaln.h" +#include "khash.h" +KHASH_SET_INIT_STR(rg) + +#include "ksort.h" +KSORT_INIT_GENERIC(uint32_t) + +#define MINUS_CONST 0x10000000 +#define INDEL_WINDOW_SIZE 50 + +void *bcf_call_add_rg(void *_hash, const char *hdtext, const char *list) +{ + const char *s, *p, *q, *r, *t; + khash_t(rg) *hash; + if (list == 0 || hdtext == 0) return _hash; + if (_hash == 0) _hash = kh_init(rg); + hash = (khash_t(rg)*)_hash; + if ((s = strstr(hdtext, "@RG\t")) == 0) return hash; + do { + t = strstr(s + 4, "@RG\t"); // the next @RG + if ((p = strstr(s, "\tID:")) != 0) p += 4; + if ((q = strstr(s, "\tPL:")) != 0) q += 4; + if (p && q && (t == 0 || (p < t && q < t))) { // ID and PL are both present + int lp, lq; + char *x; + for (r = p; *r && *r != '\t' && *r != '\n'; ++r); lp = r - p; + for (r = q; *r && *r != '\t' && *r != '\n'; ++r); lq = r - q; + x = calloc((lp > lq? lp : lq) + 1, 1); + for (r = q; *r && *r != '\t' && *r != '\n'; ++r) x[r-q] = *r; + if (strstr(list, x)) { // insert ID to the hash table + khint_t k; + int ret; + for (r = p; *r && *r != '\t' && *r != '\n'; ++r) x[r-p] = *r; + x[r-p] = 0; + k = kh_get(rg, hash, x); + if (k == kh_end(hash)) k = kh_put(rg, hash, x, &ret); + else free(x); + } else free(x); + } + s = t; + } while (s); + return hash; +} + +void bcf_call_del_rghash(void *_hash) +{ + khint_t k; + khash_t(rg) *hash = (khash_t(rg)*)_hash; + if (hash == 0) return; + for (k = kh_begin(hash); k < kh_end(hash); ++k) + if (kh_exist(hash, k)) + free((char*)kh_key(hash, k)); + kh_destroy(rg, hash); +} + +static int tpos2qpos(const bam1_core_t *c, const uint32_t *cigar, int32_t tpos, int is_left, int32_t *_tpos) +{ + int k, x = c->pos, y = 0, last_y = 0; + *_tpos = c->pos; + for (k = 0; k < c->n_cigar; ++k) { + int op = cigar[k] & BAM_CIGAR_MASK; + int l = cigar[k] >> BAM_CIGAR_SHIFT; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + if (c->pos > tpos) return y; + if (x + l > tpos) { + *_tpos = tpos; + return y + (tpos - x); + } + x += l; y += l; + last_y = y; + } else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l; + else if (op == BAM_CDEL || op == BAM_CREF_SKIP) { + if (x + l > tpos) { + *_tpos = is_left? x : x + l; + return y; + } + x += l; + } + } + *_tpos = x; + return last_y; +} +// FIXME: check if the inserted sequence is consistent with the homopolymer run +// l is the relative gap length and l_run is the length of the homopolymer on the reference +static inline int est_seqQ(const bcf_callaux_t *bca, int l, int l_run) +{ + int q, qh; + q = bca->openQ + bca->extQ * (abs(l) - 1); + qh = l_run >= 3? (int)(bca->tandemQ * (double)abs(l) / l_run + .499) : 1000; + return q < qh? q : qh; +} + +static inline int est_indelreg(int pos, const char *ref, int l, char *ins4) +{ + int i, j, max = 0, max_i = pos, score = 0; + l = abs(l); + for (i = pos + 1, j = 0; ref[i]; ++i, ++j) { + if (ins4) score += (toupper(ref[i]) != "ACGTN"[(int)ins4[j%l]])? -10 : 1; + else score += (toupper(ref[i]) != toupper(ref[pos+1+j%l]))? -10 : 1; + if (score < 0) break; + if (max < score) max = score, max_i = i; + } + return max_i - pos; +} + +int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos, bcf_callaux_t *bca, const char *ref, + const void *rghash) +{ + int i, s, j, k, t, n_types, *types, max_rd_len, left, right, max_ins, *score1, *score2, max_ref2; + int N, K, l_run, ref_type, n_alt; + char *inscns = 0, *ref2, *query, **ref_sample; + khash_t(rg) *hash = (khash_t(rg)*)rghash; + if (ref == 0 || bca == 0) return -1; + // mark filtered reads + if (rghash) { + N = 0; + for (s = N = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i) { + bam_pileup1_t *p = plp[s] + i; + const uint8_t *rg = bam_aux_get(p->b, "RG"); + p->aux = 1; // filtered by default + if (rg) { + khint_t k = kh_get(rg, hash, (const char*)(rg + 1)); + if (k != kh_end(hash)) p->aux = 0, ++N; // not filtered + } + } + } + if (N == 0) return -1; // no reads left + } + // determine if there is a gap + for (s = N = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i) + if (plp[s][i].indel != 0) break; + if (i < n_plp[s]) break; + } + if (s == n) return -1; // there is no indel at this position. + for (s = N = 0; s < n; ++s) N += n_plp[s]; // N is the total number of reads + { // find out how many types of indels are present + int m, n_alt = 0, n_tot = 0; + uint32_t *aux; + aux = calloc(N + 1, 4); + m = max_rd_len = 0; + aux[m++] = MINUS_CONST; // zero indel is always a type + for (s = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i) { + const bam_pileup1_t *p = plp[s] + i; + if (rghash == 0 || p->aux == 0) { + ++n_tot; + if (p->indel != 0) { + ++n_alt; + aux[m++] = MINUS_CONST + p->indel; + } + } + j = bam_cigar2qlen(&p->b->core, bam1_cigar(p->b)); + if (j > max_rd_len) max_rd_len = j; + } + } + ks_introsort(uint32_t, m, aux); + // squeeze out identical types + for (i = 1, n_types = 1; i < m; ++i) + if (aux[i] != aux[i-1]) ++n_types; + if (n_types == 1 || (double)n_alt / n_tot < bca->min_frac || n_alt < bca->min_support) { // then skip + free(aux); return -1; + } + if (n_types >= 64) { + free(aux); + if (bam_verbose >= 2) + fprintf(pysamerr, "[%s] excessive INDEL alleles at position %d. Skip the position.\n", __func__, pos + 1); + return -1; + } + types = (int*)calloc(n_types, sizeof(int)); + t = 0; + types[t++] = aux[0] - MINUS_CONST; + for (i = 1; i < m; ++i) + if (aux[i] != aux[i-1]) + types[t++] = aux[i] - MINUS_CONST; + free(aux); + for (t = 0; t < n_types; ++t) + if (types[t] == 0) break; + ref_type = t; // the index of the reference type (0) + } + { // calculate left and right boundary + left = pos > INDEL_WINDOW_SIZE? pos - INDEL_WINDOW_SIZE : 0; + right = pos + INDEL_WINDOW_SIZE; + if (types[0] < 0) right -= types[0]; + // in case the alignments stand out the reference + for (i = pos; i < right; ++i) + if (ref[i] == 0) break; + right = i; + } + /* The following block fixes a long-existing flaw in the INDEL + * calling model: the interference of nearby SNPs. However, it also + * reduces the power because sometimes, substitutions caused by + * indels are not distinguishable from true mutations. Multiple + * sequence realignment helps to increase the power. + */ + { // construct per-sample consensus + int L = right - left + 1, max_i, max2_i; + uint32_t *cns, max, max2; + char *ref0, *r; + ref_sample = calloc(n, sizeof(void*)); + cns = calloc(L, 4); + ref0 = calloc(L, 1); + for (i = 0; i < right - left; ++i) + ref0[i] = bam_nt16_table[(int)ref[i+left]]; + for (s = 0; s < n; ++s) { + r = ref_sample[s] = calloc(L, 1); + memset(cns, 0, sizeof(int) * L); + // collect ref and non-ref counts + for (i = 0; i < n_plp[s]; ++i) { + bam_pileup1_t *p = plp[s] + i; + bam1_t *b = p->b; + uint32_t *cigar = bam1_cigar(b); + uint8_t *seq = bam1_seq(b); + int x = b->core.pos, y = 0; + for (k = 0; k < b->core.n_cigar; ++k) { + int op = cigar[k]&0xf; + int j, l = cigar[k]>>4; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (j = 0; j < l; ++j) + if (x + j >= left && x + j < right) + cns[x+j-left] += (bam1_seqi(seq, y+j) == ref0[x+j-left])? 1 : 0x10000; + x += l; y += l; + } else if (op == BAM_CDEL || op == BAM_CREF_SKIP) x += l; + else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l; + } + } + // determine the consensus + for (i = 0; i < right - left; ++i) r[i] = ref0[i]; + max = max2 = 0; max_i = max2_i = -1; + for (i = 0; i < right - left; ++i) { + if (cns[i]>>16 >= max>>16) max2 = max, max2_i = max_i, max = cns[i], max_i = i; + else if (cns[i]>>16 >= max2>>16) max2 = cns[i], max2_i = i; + } + if ((double)(max&0xffff) / ((max&0xffff) + (max>>16)) >= 0.7) max_i = -1; + if ((double)(max2&0xffff) / ((max2&0xffff) + (max2>>16)) >= 0.7) max2_i = -1; + if (max_i >= 0) r[max_i] = 15; + if (max2_i >= 0) r[max2_i] = 15; +// for (i = 0; i < right - left; ++i) fputc("=ACMGRSVTWYHKDBN"[(int)r[i]], pysamerr); fputc('\n', pysamerr); + } + free(ref0); free(cns); + } + { // the length of the homopolymer run around the current position + int c = bam_nt16_table[(int)ref[pos + 1]]; + if (c == 15) l_run = 1; + else { + for (i = pos + 2; ref[i]; ++i) + if (bam_nt16_table[(int)ref[i]] != c) break; + l_run = i; + for (i = pos; i >= 0; --i) + if (bam_nt16_table[(int)ref[i]] != c) break; + l_run -= i + 1; + } + } + // construct the consensus sequence + max_ins = types[n_types - 1]; // max_ins is at least 0 + if (max_ins > 0) { + int *inscns_aux = calloc(4 * n_types * max_ins, sizeof(int)); + // count the number of occurrences of each base at each position for each type of insertion + for (t = 0; t < n_types; ++t) { + if (types[t] > 0) { + for (s = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i) { + bam_pileup1_t *p = plp[s] + i; + if (p->indel == types[t]) { + uint8_t *seq = bam1_seq(p->b); + for (k = 1; k <= p->indel; ++k) { + int c = bam_nt16_nt4_table[bam1_seqi(seq, p->qpos + k)]; + if (c < 4) ++inscns_aux[(t*max_ins+(k-1))*4 + c]; + } + } + } + } + } + } + // use the majority rule to construct the consensus + inscns = calloc(n_types * max_ins, 1); + for (t = 0; t < n_types; ++t) { + for (j = 0; j < types[t]; ++j) { + int max = 0, max_k = -1, *ia = &inscns_aux[(t*max_ins+j)*4]; + for (k = 0; k < 4; ++k) + if (ia[k] > max) + max = ia[k], max_k = k; + inscns[t*max_ins + j] = max? max_k : 4; + } + } + free(inscns_aux); + } + // compute the likelihood given each type of indel for each read + max_ref2 = right - left + 2 + 2 * (max_ins > -types[0]? max_ins : -types[0]); + ref2 = calloc(max_ref2, 1); + query = calloc(right - left + max_rd_len + max_ins + 2, 1); + score1 = calloc(N * n_types, sizeof(int)); + score2 = calloc(N * n_types, sizeof(int)); + bca->indelreg = 0; + for (t = 0; t < n_types; ++t) { + int l, ir; + kpa_par_t apf1 = { 1e-4, 1e-2, 10 }, apf2 = { 1e-6, 1e-3, 10 }; + apf1.bw = apf2.bw = abs(types[t]) + 3; + // compute indelreg + if (types[t] == 0) ir = 0; + else if (types[t] > 0) ir = est_indelreg(pos, ref, types[t], &inscns[t*max_ins]); + else ir = est_indelreg(pos, ref, -types[t], 0); + if (ir > bca->indelreg) bca->indelreg = ir; +// fprintf(pysamerr, "%d, %d, %d\n", pos, types[t], ir); + // realignment + for (s = K = 0; s < n; ++s) { + // write ref2 + for (k = 0, j = left; j <= pos; ++j) + ref2[k++] = bam_nt16_nt4_table[(int)ref_sample[s][j-left]]; + if (types[t] <= 0) j += -types[t]; + else for (l = 0; l < types[t]; ++l) + ref2[k++] = inscns[t*max_ins + l]; + for (; j < right && ref[j]; ++j) + ref2[k++] = bam_nt16_nt4_table[(int)ref_sample[s][j-left]]; + for (; k < max_ref2; ++k) ref2[k] = 4; + if (j < right) right = j; + // align each read to ref2 + for (i = 0; i < n_plp[s]; ++i, ++K) { + bam_pileup1_t *p = plp[s] + i; + int qbeg, qend, tbeg, tend, sc, kk; + uint8_t *seq = bam1_seq(p->b); + uint32_t *cigar = bam1_cigar(p->b); + if (p->b->core.flag&4) continue; // unmapped reads + // FIXME: the following loop should be better moved outside; nonetheless, realignment should be much slower anyway. + for (kk = 0; kk < p->b->core.n_cigar; ++kk) + if ((cigar[kk]&BAM_CIGAR_MASK) == BAM_CREF_SKIP) break; + if (kk < p->b->core.n_cigar) continue; + // FIXME: the following skips soft clips, but using them may be more sensitive. + // determine the start and end of sequences for alignment + qbeg = tpos2qpos(&p->b->core, bam1_cigar(p->b), left, 0, &tbeg); + qend = tpos2qpos(&p->b->core, bam1_cigar(p->b), right, 1, &tend); + if (types[t] < 0) { + int l = -types[t]; + tbeg = tbeg - l > left? tbeg - l : left; + } + // write the query sequence + for (l = qbeg; l < qend; ++l) + query[l - qbeg] = bam_nt16_nt4_table[bam1_seqi(seq, l)]; + { // do realignment; this is the bottleneck + const uint8_t *qual = bam1_qual(p->b), *bq; + uint8_t *qq; + qq = calloc(qend - qbeg, 1); + bq = (uint8_t*)bam_aux_get(p->b, "ZQ"); + if (bq) ++bq; // skip type + for (l = qbeg; l < qend; ++l) { + qq[l - qbeg] = bq? qual[l] + (bq[l] - 64) : qual[l]; + if (qq[l - qbeg] > 30) qq[l - qbeg] = 30; + if (qq[l - qbeg] < 7) qq[l - qbeg] = 7; + } + sc = kpa_glocal((uint8_t*)ref2 + tbeg - left, tend - tbeg + abs(types[t]), + (uint8_t*)query, qend - qbeg, qq, &apf1, 0, 0); + l = (int)(100. * sc / (qend - qbeg) + .499); // used for adjusting indelQ below + if (l > 255) l = 255; + score1[K*n_types + t] = score2[K*n_types + t] = sc<<8 | l; + if (sc > 5) { + sc = kpa_glocal((uint8_t*)ref2 + tbeg - left, tend - tbeg + abs(types[t]), + (uint8_t*)query, qend - qbeg, qq, &apf2, 0, 0); + l = (int)(100. * sc / (qend - qbeg) + .499); + if (l > 255) l = 255; + score2[K*n_types + t] = sc<<8 | l; + } + free(qq); + } +/* + for (l = 0; l < tend - tbeg + abs(types[t]); ++l) + fputc("ACGTN"[(int)ref2[tbeg-left+l]], pysamerr); + fputc('\n', pysamerr); + for (l = 0; l < qend - qbeg; ++l) fputc("ACGTN"[(int)query[l]], pysamerr); + fputc('\n', pysamerr); + fprintf(pysamerr, "pos=%d type=%d read=%d:%d name=%s qbeg=%d tbeg=%d score=%d\n", pos, types[t], s, i, bam1_qname(p->b), qbeg, tbeg, sc); +*/ + } + } + } + free(ref2); free(query); + { // compute indelQ + int *sc, tmp, *sumq; + sc = alloca(n_types * sizeof(int)); + sumq = alloca(n_types * sizeof(int)); + memset(sumq, 0, sizeof(int) * n_types); + for (s = K = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i, ++K) { + bam_pileup1_t *p = plp[s] + i; + int *sct = &score1[K*n_types], indelQ1, indelQ2, seqQ, indelQ; + for (t = 0; t < n_types; ++t) sc[t] = sct[t]<<6 | t; + for (t = 1; t < n_types; ++t) // insertion sort + for (j = t; j > 0 && sc[j] < sc[j-1]; --j) + tmp = sc[j], sc[j] = sc[j-1], sc[j-1] = tmp; + /* errmod_cal() assumes that if the call is wrong, the + * likelihoods of other events are equal. This is about + * right for substitutions, but is not desired for + * indels. To reuse errmod_cal(), I have to make + * compromise for multi-allelic indels. + */ + if ((sc[0]&0x3f) == ref_type) { + indelQ1 = (sc[1]>>14) - (sc[0]>>14); + seqQ = est_seqQ(bca, types[sc[1]&0x3f], l_run); + } else { + for (t = 0; t < n_types; ++t) // look for the reference type + if ((sc[t]&0x3f) == ref_type) break; + indelQ1 = (sc[t]>>14) - (sc[0]>>14); + seqQ = est_seqQ(bca, types[sc[0]&0x3f], l_run); + } + tmp = sc[0]>>6 & 0xff; + indelQ1 = tmp > 111? 0 : (int)((1. - tmp/111.) * indelQ1 + .499); // reduce indelQ + sct = &score2[K*n_types]; + for (t = 0; t < n_types; ++t) sc[t] = sct[t]<<6 | t; + for (t = 1; t < n_types; ++t) // insertion sort + for (j = t; j > 0 && sc[j] < sc[j-1]; --j) + tmp = sc[j], sc[j] = sc[j-1], sc[j-1] = tmp; + if ((sc[0]&0x3f) == ref_type) { + indelQ2 = (sc[1]>>14) - (sc[0]>>14); + } else { + for (t = 0; t < n_types; ++t) // look for the reference type + if ((sc[t]&0x3f) == ref_type) break; + indelQ2 = (sc[t]>>14) - (sc[0]>>14); + } + tmp = sc[0]>>6 & 0xff; + indelQ2 = tmp > 111? 0 : (int)((1. - tmp/111.) * indelQ2 + .499); + // pick the smaller between indelQ1 and indelQ2 + indelQ = indelQ1 < indelQ2? indelQ1 : indelQ2; + if (indelQ > 255) indelQ = 255; + if (seqQ > 255) seqQ = 255; + p->aux = (sc[0]&0x3f)<<16 | seqQ<<8 | indelQ; // use 22 bits in total + sumq[sc[0]&0x3f] += indelQ < seqQ? indelQ : seqQ; +// fprintf(pysamerr, "pos=%d read=%d:%d name=%s call=%d indelQ=%d seqQ=%d\n", pos, s, i, bam1_qname(p->b), types[sc[0]&0x3f], indelQ, seqQ); + } + } + // determine bca->indel_types[] and bca->inscns + bca->maxins = max_ins; + bca->inscns = realloc(bca->inscns, bca->maxins * 4); + for (t = 0; t < n_types; ++t) + sumq[t] = sumq[t]<<6 | t; + for (t = 1; t < n_types; ++t) // insertion sort + for (j = t; j > 0 && sumq[j] > sumq[j-1]; --j) + tmp = sumq[j], sumq[j] = sumq[j-1], sumq[j-1] = tmp; + for (t = 0; t < n_types; ++t) // look for the reference type + if ((sumq[t]&0x3f) == ref_type) break; + if (t) { // then move the reference type to the first + tmp = sumq[t]; + for (; t > 0; --t) sumq[t] = sumq[t-1]; + sumq[0] = tmp; + } + for (t = 0; t < 4; ++t) bca->indel_types[t] = B2B_INDEL_NULL; + for (t = 0; t < 4 && t < n_types; ++t) { + bca->indel_types[t] = types[sumq[t]&0x3f]; + memcpy(&bca->inscns[t * bca->maxins], &inscns[(sumq[t]&0x3f) * max_ins], bca->maxins); + } + // update p->aux + for (s = n_alt = 0; s < n; ++s) { + for (i = 0; i < n_plp[s]; ++i) { + bam_pileup1_t *p = plp[s] + i; + int x = types[p->aux>>16&0x3f]; + for (j = 0; j < 4; ++j) + if (x == bca->indel_types[j]) break; + p->aux = j<<16 | (j == 4? 0 : (p->aux&0xffff)); + if ((p->aux>>16&0x3f) > 0) ++n_alt; +// fprintf(pysamerr, "X pos=%d read=%d:%d name=%s call=%d type=%d q=%d seqQ=%d\n", pos, s, i, bam1_qname(p->b), p->aux>>16&63, bca->indel_types[p->aux>>16&63], p->aux&0xff, p->aux>>8&0xff); + } + } + } + free(score1); free(score2); + // free + for (i = 0; i < n; ++i) free(ref_sample[i]); + free(ref_sample); + free(types); free(inscns); + return n_alt > 0? 0 : -1; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam2depth.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam2depth.c.pysam.c new file mode 100755 index 0000000..d22837e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam2depth.c.pysam.c @@ -0,0 +1,114 @@ +#include "pysam.h" + +/* This program demonstrates how to generate pileup from multiple BAMs + * simutaneously, to achieve random access and to use the BED interface. + * To compile this program separately, you may: + * + * gcc -g -O2 -Wall -o bam2depth -D_MAIN_BAM2DEPTH bam2depth.c -L. -lbam -lz + */ +#include +#include +#include +#include +#include "bam.h" + +typedef struct { // auxiliary data structure + bamFile fp; // the file handler + bam_iter_t iter; // NULL if a region not specified + int min_mapQ; // mapQ filter +} aux_t; + +void *bed_read(const char *fn); // read a BED or position list file +void bed_destroy(void *_h); // destroy the BED data structure +int bed_overlap(const void *_h, const char *chr, int beg, int end); // test if chr:beg-end overlaps + +// This function reads a BAM alignment from one BAM file. +static int read_bam(void *data, bam1_t *b) // read level filters better go here to avoid pileup +{ + aux_t *aux = (aux_t*)data; // data in fact is a pointer to an auxiliary structure + int ret = aux->iter? bam_iter_read(aux->fp, aux->iter, b) : bam_read1(aux->fp, b); + if ((int)b->core.qual < aux->min_mapQ) b->core.flag |= BAM_FUNMAP; + return ret; +} + +#ifdef _MAIN_BAM2DEPTH +int main(int argc, char *argv[]) +#else +int main_depth(int argc, char *argv[]) +#endif +{ + int i, n, tid, beg, end, pos, *n_plp, baseQ = 0, mapQ = 0; + const bam_pileup1_t **plp; + char *reg = 0; // specified region + void *bed = 0; // BED data structure + bam_header_t *h = 0; // BAM header of the 1st input + aux_t **data; + bam_mplp_t mplp; + + // parse the command line + while ((n = getopt(argc, argv, "r:b:q:Q:")) >= 0) { + switch (n) { + case 'r': reg = strdup(optarg); break; // parsing a region requires a BAM header + case 'b': bed = bed_read(optarg); break; // BED or position list file can be parsed now + case 'q': baseQ = atoi(optarg); break; // base quality threshold + case 'Q': mapQ = atoi(optarg); break; // mapping quality threshold + } + } + if (optind == argc) { + fprintf(pysamerr, "Usage: bam2depth [-r reg] [-q baseQthres] [-Q mapQthres] [-b in.bed] [...]\n"); + return 1; + } + + // initialize the auxiliary data structures + n = argc - optind; // the number of BAMs on the command line + data = calloc(n, sizeof(void*)); // data[i] for the i-th input + beg = 0; end = 1<<30; tid = -1; // set the default region + for (i = 0; i < n; ++i) { + bam_header_t *htmp; + data[i] = calloc(1, sizeof(aux_t)); + data[i]->fp = bam_open(argv[optind+i], "r"); // open BAM + data[i]->min_mapQ = mapQ; // set the mapQ filter + htmp = bam_header_read(data[i]->fp); // read the BAM header + if (i == 0) { + h = htmp; // keep the header of the 1st BAM + if (reg) bam_parse_region(h, reg, &tid, &beg, &end); // also parse the region + } else bam_header_destroy(htmp); // if not the 1st BAM, trash the header + if (tid >= 0) { // if a region is specified and parsed successfully + bam_index_t *idx = bam_index_load(argv[optind+i]); // load the index + data[i]->iter = bam_iter_query(idx, tid, beg, end); // set the iterator + bam_index_destroy(idx); // the index is not needed any more; phase out of the memory + } + } + + // the core multi-pileup loop + mplp = bam_mplp_init(n, read_bam, (void**)data); // initialization + n_plp = calloc(n, sizeof(int)); // n_plp[i] is the number of covering reads from the i-th BAM + plp = calloc(n, sizeof(void*)); // plp[i] points to the array of covering reads (internal in mplp) + while (bam_mplp_auto(mplp, &tid, &pos, n_plp, plp) > 0) { // come to the next covered position + if (pos < beg || pos >= end) continue; // out of range; skip + if (bed && bed_overlap(bed, h->target_name[tid], pos, pos + 1) == 0) continue; // not in BED; skip + fputs(h->target_name[tid], stdout); printf("\t%d", pos+1); // a customized printf() would be faster + for (i = 0; i < n; ++i) { // base level filters have to go here + int j, m = 0; + for (j = 0; j < n_plp[i]; ++j) { + const bam_pileup1_t *p = plp[i] + j; // DON'T modfity plp[][] unless you really know + if (p->is_del || p->is_refskip) ++m; // having dels or refskips at tid:pos + else if (bam1_qual(p->b)[p->qpos] < baseQ) ++m; // low base quality + } + printf("\t%d", n_plp[i] - m); // this the depth to output + } + putchar('\n'); + } + free(n_plp); free(plp); + bam_mplp_destroy(mplp); + + bam_header_destroy(h); + for (i = 0; i < n; ++i) { + bam_close(data[i]->fp); + if (data[i]->iter) bam_iter_destroy(data[i]->iter); + free(data[i]); + } + free(data); free(reg); + if (bed) bed_destroy(bed); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_aux.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_aux.c.pysam.c new file mode 100755 index 0000000..14209cd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_aux.c.pysam.c @@ -0,0 +1,215 @@ +#include "pysam.h" + +#include +#include "bam.h" +#include "khash.h" +typedef char *str_p; +KHASH_MAP_INIT_STR(s, int) +KHASH_MAP_INIT_STR(r2l, str_p) + +void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data) +{ + int ori_len = b->data_len; + b->data_len += 3 + len; + b->l_aux += 3 + len; + if (b->m_data < b->data_len) { + b->m_data = b->data_len; + kroundup32(b->m_data); + b->data = (uint8_t*)realloc(b->data, b->m_data); + } + b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1]; + b->data[ori_len + 2] = type; + memcpy(b->data + ori_len + 3, data, len); +} + +uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]) +{ + return bam_aux_get(b, tag); +} + +#define __skip_tag(s) do { \ + int type = toupper(*(s)); \ + ++(s); \ + if (type == 'Z' || type == 'H') { while (*(s)) ++(s); ++(s); } \ + else if (type == 'B') (s) += 5 + bam_aux_type2size(*(s)) * (*(int32_t*)((s)+1)); \ + else (s) += bam_aux_type2size(type); \ + } while(0) + +uint8_t *bam_aux_get(const bam1_t *b, const char tag[2]) +{ + uint8_t *s; + int y = tag[0]<<8 | tag[1]; + s = bam1_aux(b); + while (s < b->data + b->data_len) { + int x = (int)s[0]<<8 | s[1]; + s += 2; + if (x == y) return s; + __skip_tag(s); + } + return 0; +} +// s MUST BE returned by bam_aux_get() +int bam_aux_del(bam1_t *b, uint8_t *s) +{ + uint8_t *p, *aux; + aux = bam1_aux(b); + p = s - 2; + __skip_tag(s); + memmove(p, s, b->l_aux - (s - aux)); + b->data_len -= s - p; + b->l_aux -= s - p; + return 0; +} + +int bam_aux_drop_other(bam1_t *b, uint8_t *s) +{ + if (s) { + uint8_t *p, *aux; + aux = bam1_aux(b); + p = s - 2; + __skip_tag(s); + memmove(aux, p, s - p); + b->data_len -= b->l_aux - (s - p); + b->l_aux = s - p; + } else { + b->data_len -= b->l_aux; + b->l_aux = 0; + } + return 0; +} + +void bam_init_header_hash(bam_header_t *header) +{ + if (header->hash == 0) { + int ret, i; + khiter_t iter; + khash_t(s) *h; + header->hash = h = kh_init(s); + for (i = 0; i < header->n_targets; ++i) { + iter = kh_put(s, h, header->target_name[i], &ret); + kh_value(h, iter) = i; + } + } +} + +void bam_destroy_header_hash(bam_header_t *header) +{ + if (header->hash) + kh_destroy(s, (khash_t(s)*)header->hash); +} + +int32_t bam_get_tid(const bam_header_t *header, const char *seq_name) +{ + khint_t k; + khash_t(s) *h = (khash_t(s)*)header->hash; + k = kh_get(s, h, seq_name); + return k == kh_end(h)? -1 : kh_value(h, k); +} + +int bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *beg, int *end) +{ + char *s; + int i, l, k, name_end; + khiter_t iter; + khash_t(s) *h; + + bam_init_header_hash(header); + h = (khash_t(s)*)header->hash; + + *ref_id = *beg = *end = -1; + name_end = l = strlen(str); + s = (char*)malloc(l+1); + // remove space + for (i = k = 0; i < l; ++i) + if (!isspace(str[i])) s[k++] = str[i]; + s[k] = 0; l = k; + // determine the sequence name + for (i = l - 1; i >= 0; --i) if (s[i] == ':') break; // look for colon from the end + if (i >= 0) name_end = i; + if (name_end < l) { // check if this is really the end + int n_hyphen = 0; + for (i = name_end + 1; i < l; ++i) { + if (s[i] == '-') ++n_hyphen; + else if (!isdigit(s[i]) && s[i] != ',') break; + } + if (i < l || n_hyphen > 1) name_end = l; // malformated region string; then take str as the name + s[name_end] = 0; + iter = kh_get(s, h, s); + if (iter == kh_end(h)) { // cannot find the sequence name + iter = kh_get(s, h, str); // try str as the name + if (iter == kh_end(h)) { + if (bam_verbose >= 2) fprintf(pysamerr, "[%s] fail to determine the sequence name.\n", __func__); + free(s); return -1; + } else s[name_end] = ':', name_end = l; + } + } else iter = kh_get(s, h, str); + *ref_id = kh_val(h, iter); + // parse the interval + if (name_end < l) { + for (i = k = name_end + 1; i < l; ++i) + if (s[i] != ',') s[k++] = s[i]; + s[k] = 0; + *beg = atoi(s + name_end + 1); + for (i = name_end + 1; i != k; ++i) if (s[i] == '-') break; + *end = i < k? atoi(s + i + 1) : 1<<29; + if (*beg > 0) --*beg; + } else *beg = 0, *end = 1<<29; + free(s); + return *beg <= *end? 0 : -1; +} + +int32_t bam_aux2i(const uint8_t *s) +{ + int type; + if (s == 0) return 0; + type = *s++; + if (type == 'c') return (int32_t)*(int8_t*)s; + else if (type == 'C') return (int32_t)*(uint8_t*)s; + else if (type == 's') return (int32_t)*(int16_t*)s; + else if (type == 'S') return (int32_t)*(uint16_t*)s; + else if (type == 'i' || type == 'I') return *(int32_t*)s; + else return 0; +} + +float bam_aux2f(const uint8_t *s) +{ + int type; + type = *s++; + if (s == 0) return 0.0; + if (type == 'f') return *(float*)s; + else return 0.0; +} + +double bam_aux2d(const uint8_t *s) +{ + int type; + type = *s++; + if (s == 0) return 0.0; + if (type == 'd') return *(double*)s; + else return 0.0; +} + +char bam_aux2A(const uint8_t *s) +{ + int type; + type = *s++; + if (s == 0) return 0; + if (type == 'A') return *(char*)s; + else return 0; +} + +char *bam_aux2Z(const uint8_t *s) +{ + int type; + type = *s++; + if (s == 0) return 0; + if (type == 'Z' || type == 'H') return (char*)s; + else return 0; +} + +#ifdef _WIN32 +double drand48() +{ + return (double)rand() / RAND_MAX; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_cat.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_cat.c.pysam.c new file mode 100755 index 0000000..0cc1167 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_cat.c.pysam.c @@ -0,0 +1,186 @@ +#include "pysam.h" + +/* + +bam_cat -- efficiently concatenates bam files + +bam_cat can be used to concatenate BAM files. Under special +circumstances, it can be used as an alternative to 'samtools merge' to +concatenate multiple sorted files into a single sorted file. For this +to work each file must be sorted, and the sorted files must be given +as command line arguments in order such that the final read in file i +is less than or equal to the first read in file i+1. + +This code is derived from the bam_reheader function in samtools 0.1.8 +and modified to perform concatenation by Chris Saunders on behalf of +Illumina. + + +########## License: + +The MIT License + +Original SAMtools work copyright (c) 2008-2009 Genome Research Ltd. +Modified SAMtools work copyright (c) 2010 Illumina, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + + +/* +makefile: +""" +CC=gcc +CFLAGS+=-g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -I$(SAMTOOLS_DIR) +LDFLAGS+=-L$(SAMTOOLS_DIR) +LDLIBS+=-lbam -lz + +all:bam_cat +""" +*/ + + +#include +#include +#include + +#include "bgzf.h" +#include "bam.h" + +#define BUF_SIZE 0x10000 + +#define GZIPID1 31 +#define GZIPID2 139 + +#define BGZF_EMPTY_BLOCK_SIZE 28 + + +int bam_cat(int nfn, char * const *fn, const bam_header_t *h, const char* outbam) +{ + BGZF *fp; + FILE* fp_file; + uint8_t *buf; + uint8_t ebuf[BGZF_EMPTY_BLOCK_SIZE]; + const int es=BGZF_EMPTY_BLOCK_SIZE; + int i; + + fp = strcmp(outbam, "-")? bgzf_open(outbam, "w") : bgzf_fdopen(fileno(stdout), "w"); + if (fp == 0) { + fprintf(pysamerr, "[%s] ERROR: fail to open output file '%s'.\n", __func__, outbam); + return 1; + } + if (h) bam_header_write(fp, h); + + buf = (uint8_t*) malloc(BUF_SIZE); + for(i = 0; i < nfn; ++i){ + BGZF *in; + bam_header_t *old; + int len,j; + + in = strcmp(fn[i], "-")? bam_open(fn[i], "r") : bam_dopen(fileno(stdin), "r"); + if (in == 0) { + fprintf(pysamerr, "[%s] ERROR: fail to open file '%s'.\n", __func__, fn[i]); + return -1; + } + if (in->open_mode != 'r') return -1; + + old = bam_header_read(in); + if (h == 0 && i == 0) bam_header_write(fp, old); + + if (in->block_offset < in->block_length) { + bgzf_write(fp, in->uncompressed_block + in->block_offset, in->block_length - in->block_offset); + bgzf_flush(fp); + } + + j=0; +#ifdef _USE_KNETFILE + fp_file=fp->x.fpw; + while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0) { +#else + fp_file=fp->file; + while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0) { +#endif + if(len= 0) { + switch (c) { + case 'h': { + tamFile fph = sam_open(optarg); + if (fph == 0) { + fprintf(pysamerr, "[%s] ERROR: fail to read the header from '%s'.\n", __func__, argv[1]); + return 1; + } + h = sam_header_read(fph); + sam_close(fph); + break; + } + case 'o': outfn = strdup(optarg); break; + } + } + if (argc - optind < 2) { + fprintf(pysamerr, "Usage: samtools cat [-h header.sam] [-o out.bam] [...]\n"); + return 1; + } + ret = bam_cat(argc - optind, argv + optind, h, outfn? outfn : "-"); + free(outfn); + return ret; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_color.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_color.c.pysam.c new file mode 100755 index 0000000..f71c65f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_color.c.pysam.c @@ -0,0 +1,129 @@ +#include "pysam.h" + +#include +#include "bam.h" + +/*! + @abstract Get the color encoding the previous and current base + @param b pointer to an alignment + @param i The i-th position, 0-based + @return color + + @discussion Returns 0 no color information is found. + */ +char bam_aux_getCSi(bam1_t *b, int i) +{ + uint8_t *c = bam_aux_get(b, "CS"); + char *cs = NULL; + + // return the base if the tag was not found + if(0 == c) return 0; + + cs = bam_aux2Z(c); + // adjust for strandedness and leading adaptor + if(bam1_strand(b)) i = strlen(cs) - 1 - i; + else i++; + return cs[i]; +} + +/*! + @abstract Get the color quality of the color encoding the previous and current base + @param b pointer to an alignment + @param i The i-th position, 0-based + @return color quality + + @discussion Returns 0 no color information is found. + */ +char bam_aux_getCQi(bam1_t *b, int i) +{ + uint8_t *c = bam_aux_get(b, "CQ"); + char *cq = NULL; + + // return the base if the tag was not found + if(0 == c) return 0; + + cq = bam_aux2Z(c); + // adjust for strandedness + if(bam1_strand(b)) i = strlen(cq) - 1 - i; + return cq[i]; +} + +char bam_aux_nt2int(char a) +{ + switch(toupper(a)) { + case 'A': + return 0; + break; + case 'C': + return 1; + break; + case 'G': + return 2; + break; + case 'T': + return 3; + break; + default: + return 4; + break; + } +} + +char bam_aux_ntnt2cs(char a, char b) +{ + a = bam_aux_nt2int(a); + b = bam_aux_nt2int(b); + if(4 == a || 4 == b) return '4'; + return "0123"[(int)(a ^ b)]; +} + +/*! + @abstract Get the color error profile at the give position + @param b pointer to an alignment + @return the original color if the color was an error, '-' (dash) otherwise + + @discussion Returns 0 no color information is found. + */ +char bam_aux_getCEi(bam1_t *b, int i) +{ + int cs_i; + uint8_t *c = bam_aux_get(b, "CS"); + char *cs = NULL; + char prev_b, cur_b; + char cur_color, cor_color; + + // return the base if the tag was not found + if(0 == c) return 0; + + cs = bam_aux2Z(c); + + // adjust for strandedness and leading adaptor + if(bam1_strand(b)) { //reverse strand + cs_i = strlen(cs) - 1 - i; + // get current color + cur_color = cs[cs_i]; + // get previous base. Note: must rc adaptor + prev_b = (cs_i == 1) ? "TGCAN"[(int)bam_aux_nt2int(cs[0])] : bam_nt16_rev_table[bam1_seqi(bam1_seq(b), i+1)]; + // get current base + cur_b = bam_nt16_rev_table[bam1_seqi(bam1_seq(b), i)]; + } + else { + cs_i=i+1; + // get current color + cur_color = cs[cs_i]; + // get previous base + prev_b = (0 == i) ? cs[0] : bam_nt16_rev_table[bam1_seqi(bam1_seq(b), i-1)]; + // get current base + cur_b = bam_nt16_rev_table[bam1_seqi(bam1_seq(b), i)]; + } + + // corrected color + cor_color = bam_aux_ntnt2cs(prev_b, cur_b); + + if(cur_color == cor_color) { + return '-'; + } + else { + return cur_color; + } +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_endian.h b/code/utilities/CPAT-1.2.2/lib/samtools/bam_endian.h new file mode 100755 index 0000000..0fc74a8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_endian.h @@ -0,0 +1,42 @@ +#ifndef BAM_ENDIAN_H +#define BAM_ENDIAN_H + +#include + +static inline int bam_is_big_endian() +{ + long one= 1; + return !(*((char *)(&one))); +} +static inline uint16_t bam_swap_endian_2(uint16_t v) +{ + return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8)); +} +static inline void *bam_swap_endian_2p(void *x) +{ + *(uint16_t*)x = bam_swap_endian_2(*(uint16_t*)x); + return x; +} +static inline uint32_t bam_swap_endian_4(uint32_t v) +{ + v = ((v & 0x0000FFFFU) << 16) | (v >> 16); + return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8); +} +static inline void *bam_swap_endian_4p(void *x) +{ + *(uint32_t*)x = bam_swap_endian_4(*(uint32_t*)x); + return x; +} +static inline uint64_t bam_swap_endian_8(uint64_t v) +{ + v = ((v & 0x00000000FFFFFFFFLLU) << 32) | (v >> 32); + v = ((v & 0x0000FFFF0000FFFFLLU) << 16) | ((v & 0xFFFF0000FFFF0000LLU) >> 16); + return ((v & 0x00FF00FF00FF00FFLLU) << 8) | ((v & 0xFF00FF00FF00FF00LLU) >> 8); +} +static inline void *bam_swap_endian_8p(void *x) +{ + *(uint64_t*)x = bam_swap_endian_8(*(uint64_t*)x); + return x; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_import.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_import.c.pysam.c new file mode 100755 index 0000000..36a8024 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_import.c.pysam.c @@ -0,0 +1,487 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include "kstring.h" +#include "bam.h" +#include "sam_header.h" +#include "kseq.h" +#include "khash.h" + +KSTREAM_INIT(gzFile, gzread, 16384) +KHASH_MAP_INIT_STR(ref, uint64_t) + +void bam_init_header_hash(bam_header_t *header); +void bam_destroy_header_hash(bam_header_t *header); +int32_t bam_get_tid(const bam_header_t *header, const char *seq_name); + +unsigned char bam_nt16_table[256] = { + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 1, 2, 4, 8, 15,15,15,15, 15,15,15,15, 15, 0 /*=*/,15,15, + 15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15, + 15,15, 5, 6, 8,15, 7, 9, 15,10,15,15, 15,15,15,15, + 15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15, + 15,15, 5, 6, 8,15, 7, 9, 15,10,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15 +}; + +unsigned short bam_char2flag_table[256] = { + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,BAM_FREAD1,BAM_FREAD2,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + BAM_FPROPER_PAIR,0,BAM_FMREVERSE,0, 0,BAM_FMUNMAP,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, BAM_FDUP,0,BAM_FQCFAIL,0, 0,0,0,0, 0,0,0,0, + BAM_FPAIRED,0,BAM_FREVERSE,BAM_FSECONDARY, 0,BAM_FUNMAP,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 +}; + +char *bam_nt16_rev_table = "=ACMGRSVTWYHKDBN"; + +struct __tamFile_t { + gzFile fp; + kstream_t *ks; + kstring_t *str; + uint64_t n_lines; + int is_first; +}; + +char **__bam_get_lines(const char *fn, int *_n) // for bam_plcmd.c only +{ + char **list = 0, *s; + int n = 0, dret, m = 0; + gzFile fp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(fn, "r"); + kstream_t *ks; + kstring_t *str; + str = (kstring_t*)calloc(1, sizeof(kstring_t)); + ks = ks_init(fp); + while (ks_getuntil(ks, '\n', str, &dret) > 0) { + if (n == m) { + m = m? m << 1 : 16; + list = (char**)realloc(list, m * sizeof(char*)); + } + if (str->s[str->l-1] == '\r') + str->s[--str->l] = '\0'; + s = list[n++] = (char*)calloc(str->l + 1, 1); + strcpy(s, str->s); + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + *_n = n; + return list; +} + +static bam_header_t *hash2header(const kh_ref_t *hash) +{ + bam_header_t *header; + khiter_t k; + header = bam_header_init(); + header->n_targets = kh_size(hash); + header->target_name = (char**)calloc(kh_size(hash), sizeof(char*)); + header->target_len = (uint32_t*)calloc(kh_size(hash), 4); + for (k = kh_begin(hash); k != kh_end(hash); ++k) { + if (kh_exist(hash, k)) { + int i = (int)kh_value(hash, k); + header->target_name[i] = (char*)kh_key(hash, k); + header->target_len[i] = kh_value(hash, k)>>32; + } + } + bam_init_header_hash(header); + return header; +} +bam_header_t *sam_header_read2(const char *fn) +{ + bam_header_t *header; + int c, dret, ret, error = 0; + gzFile fp; + kstream_t *ks; + kstring_t *str; + kh_ref_t *hash; + khiter_t k; + if (fn == 0) return 0; + fp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(fn, "r"); + if (fp == 0) return 0; + hash = kh_init(ref); + ks = ks_init(fp); + str = (kstring_t*)calloc(1, sizeof(kstring_t)); + while (ks_getuntil(ks, 0, str, &dret) > 0) { + char *s = strdup(str->s); + int len, i; + i = kh_size(hash); + ks_getuntil(ks, 0, str, &dret); + len = atoi(str->s); + k = kh_put(ref, hash, s, &ret); + if (ret == 0) { + fprintf(pysamerr, "[sam_header_read2] duplicated sequence name: %s\n", s); + error = 1; + } + kh_value(hash, k) = (uint64_t)len<<32 | i; + if (dret != '\n') + while ((c = ks_getc(ks)) != '\n' && c != -1); + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + fprintf(pysamerr, "[sam_header_read2] %d sequences loaded.\n", kh_size(hash)); + if (error) return 0; + header = hash2header(hash); + kh_destroy(ref, hash); + return header; +} +static inline uint8_t *alloc_data(bam1_t *b, int size) +{ + if (b->m_data < size) { + b->m_data = size; + kroundup32(b->m_data); + b->data = (uint8_t*)realloc(b->data, b->m_data); + } + return b->data; +} +static inline void parse_error(int64_t n_lines, const char * __restrict msg) +{ + fprintf(pysamerr, "Parse error at line %lld: %s\n", (long long)n_lines, msg); + abort(); +} +static inline void append_text(bam_header_t *header, kstring_t *str) +{ + size_t x = header->l_text, y = header->l_text + str->l + 2; // 2 = 1 byte dret + 1 byte null + kroundup32(x); kroundup32(y); + if (x < y) + { + header->n_text = y; + header->text = (char*)realloc(header->text, y); + if ( !header->text ) + { + fprintf(pysamerr,"realloc failed to alloc %ld bytes\n", y); + abort(); + } + } + // Sanity check + if ( header->l_text+str->l+1 >= header->n_text ) + { + fprintf(pysamerr,"append_text FIXME: %ld>=%ld, x=%ld,y=%ld\n", header->l_text+str->l+1,header->n_text,x,y); + abort(); + } + strncpy(header->text + header->l_text, str->s, str->l+1); // we cannot use strcpy() here. + header->l_text += str->l + 1; + header->text[header->l_text] = 0; +} + +int sam_header_parse(bam_header_t *h) +{ + char **tmp; + int i; + free(h->target_len); free(h->target_name); + h->n_targets = 0; h->target_len = 0; h->target_name = 0; + if (h->l_text < 3) return 0; + if (h->dict == 0) h->dict = sam_header_parse2(h->text); + tmp = sam_header2list(h->dict, "SQ", "SN", &h->n_targets); + if (h->n_targets == 0) return 0; + h->target_name = calloc(h->n_targets, sizeof(void*)); + for (i = 0; i < h->n_targets; ++i) + h->target_name[i] = strdup(tmp[i]); + free(tmp); + tmp = sam_header2list(h->dict, "SQ", "LN", &h->n_targets); + h->target_len = calloc(h->n_targets, 4); + for (i = 0; i < h->n_targets; ++i) + h->target_len[i] = atoi(tmp[i]); + free(tmp); + return h->n_targets; +} + +bam_header_t *sam_header_read(tamFile fp) +{ + int ret, dret; + bam_header_t *header = bam_header_init(); + kstring_t *str = fp->str; + while ((ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret)) >= 0 && str->s[0] == '@') { // skip header + str->s[str->l] = dret; // note that str->s is NOT null terminated!! + append_text(header, str); + if (dret != '\n') { + ret = ks_getuntil(fp->ks, '\n', str, &dret); + str->s[str->l] = '\n'; // NOT null terminated!! + append_text(header, str); + } + ++fp->n_lines; + } + sam_header_parse(header); + bam_init_header_hash(header); + fp->is_first = 1; + return header; +} + +int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b) +{ + int ret, doff, doff0, dret, z = 0; + bam1_core_t *c = &b->core; + kstring_t *str = fp->str; + kstream_t *ks = fp->ks; + + if (fp->is_first) { + fp->is_first = 0; + ret = str->l; + } else { + do { // special consideration for empty lines + ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret); + if (ret >= 0) z += str->l + 1; + } while (ret == 0); + } + if (ret < 0) return -1; + ++fp->n_lines; + doff = 0; + + { // name + c->l_qname = strlen(str->s) + 1; + memcpy(alloc_data(b, doff + c->l_qname) + doff, str->s, c->l_qname); + doff += c->l_qname; + } + { // flag + long flag; + char *s; + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; + flag = strtol((char*)str->s, &s, 0); + if (*s) { // not the end of the string + flag = 0; + for (s = str->s; *s; ++s) + flag |= bam_char2flag_table[(int)*s]; + } + c->flag = flag; + } + { // tid, pos, qual + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->tid = bam_get_tid(header, str->s); + if (c->tid < 0 && strcmp(str->s, "*")) { + if (header->n_targets == 0) { + fprintf(pysamerr, "[sam_read1] missing header? Abort!\n"); + exit(1); + } else fprintf(pysamerr, "[sam_read1] reference '%s' is recognized as '*'.\n", str->s); + } + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->pos = isdigit(str->s[0])? atoi(str->s) - 1 : -1; + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->qual = isdigit(str->s[0])? atoi(str->s) : 0; + if (ret < 0) return -2; + } + { // cigar + char *s, *t; + int i, op; + long x; + c->n_cigar = 0; + if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -3; + z += str->l + 1; + if (str->s[0] != '*') { + for (s = str->s; *s; ++s) { + if ((isalpha(*s)) || (*s=='=')) ++c->n_cigar; + else if (!isdigit(*s)) parse_error(fp->n_lines, "invalid CIGAR character"); + } + b->data = alloc_data(b, doff + c->n_cigar * 4); + for (i = 0, s = str->s; i != c->n_cigar; ++i) { + x = strtol(s, &t, 10); + op = toupper(*t); + if (op == 'M') op = BAM_CMATCH; + else if (op == 'I') op = BAM_CINS; + else if (op == 'D') op = BAM_CDEL; + else if (op == 'N') op = BAM_CREF_SKIP; + else if (op == 'S') op = BAM_CSOFT_CLIP; + else if (op == 'H') op = BAM_CHARD_CLIP; + else if (op == 'P') op = BAM_CPAD; + else if (op == '=') op = BAM_CEQUAL; + else if (op == 'X') op = BAM_CDIFF; + else parse_error(fp->n_lines, "invalid CIGAR operation"); + s = t + 1; + bam1_cigar(b)[i] = x << BAM_CIGAR_SHIFT | op; + } + if (*s) parse_error(fp->n_lines, "unmatched CIGAR operation"); + c->bin = bam_reg2bin(c->pos, bam_calend(c, bam1_cigar(b))); + doff += c->n_cigar * 4; + } else { + if (!(c->flag&BAM_FUNMAP)) { + fprintf(pysamerr, "Parse warning at line %lld: mapped sequence without CIGAR\n", (long long)fp->n_lines); + c->flag |= BAM_FUNMAP; + } + c->bin = bam_reg2bin(c->pos, c->pos + 1); + } + } + { // mtid, mpos, isize + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; + c->mtid = strcmp(str->s, "=")? bam_get_tid(header, str->s) : c->tid; + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; + c->mpos = isdigit(str->s[0])? atoi(str->s) - 1 : -1; + ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; + c->isize = (str->s[0] == '-' || isdigit(str->s[0]))? atoi(str->s) : 0; + if (ret < 0) return -4; + } + { // seq and qual + int i; + uint8_t *p = 0; + if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -5; // seq + z += str->l + 1; + if (strcmp(str->s, "*")) { + c->l_qseq = strlen(str->s); + if (c->n_cigar && c->l_qseq != (int32_t)bam_cigar2qlen(c, bam1_cigar(b))) { + fprintf(pysamerr, "Line %ld, sequence length %i vs %i from CIGAR\n", + (long)fp->n_lines, c->l_qseq, (int32_t)bam_cigar2qlen(c, bam1_cigar(b))); + parse_error(fp->n_lines, "CIGAR and sequence length are inconsistent"); + } + p = (uint8_t*)alloc_data(b, doff + c->l_qseq + (c->l_qseq+1)/2) + doff; + memset(p, 0, (c->l_qseq+1)/2); + for (i = 0; i < c->l_qseq; ++i) + p[i/2] |= bam_nt16_table[(int)str->s[i]] << 4*(1-i%2); + } else c->l_qseq = 0; + if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -6; // qual + z += str->l + 1; + if (strcmp(str->s, "*") && c->l_qseq != strlen(str->s)) + parse_error(fp->n_lines, "sequence and quality are inconsistent"); + p += (c->l_qseq+1)/2; + if (strcmp(str->s, "*") == 0) for (i = 0; i < c->l_qseq; ++i) p[i] = 0xff; + else for (i = 0; i < c->l_qseq; ++i) p[i] = str->s[i] - 33; + doff += c->l_qseq + (c->l_qseq+1)/2; + } + doff0 = doff; + if (dret != '\n' && dret != '\r') { // aux + while (ks_getuntil(ks, KS_SEP_TAB, str, &dret) >= 0) { + uint8_t *s, type, key[2]; + z += str->l + 1; + if (str->l < 6 || str->s[2] != ':' || str->s[4] != ':') + parse_error(fp->n_lines, "missing colon in auxiliary data"); + key[0] = str->s[0]; key[1] = str->s[1]; + type = str->s[3]; + s = alloc_data(b, doff + 3) + doff; + s[0] = key[0]; s[1] = key[1]; s += 2; doff += 2; + if (type == 'A' || type == 'a' || type == 'c' || type == 'C') { // c and C for backward compatibility + s = alloc_data(b, doff + 2) + doff; + *s++ = 'A'; *s = str->s[5]; + doff += 2; + } else if (type == 'I' || type == 'i') { + long long x; + s = alloc_data(b, doff + 5) + doff; + x = (long long)atoll(str->s + 5); + if (x < 0) { + if (x >= -127) { + *s++ = 'c'; *(int8_t*)s = (int8_t)x; + s += 1; doff += 2; + } else if (x >= -32767) { + *s++ = 's'; *(int16_t*)s = (int16_t)x; + s += 2; doff += 3; + } else { + *s++ = 'i'; *(int32_t*)s = (int32_t)x; + s += 4; doff += 5; + if (x < -2147483648ll) + fprintf(pysamerr, "Parse warning at line %lld: integer %lld is out of range.", + (long long)fp->n_lines, x); + } + } else { + if (x <= 255) { + *s++ = 'C'; *s++ = (uint8_t)x; + doff += 2; + } else if (x <= 65535) { + *s++ = 'S'; *(uint16_t*)s = (uint16_t)x; + s += 2; doff += 3; + } else { + *s++ = 'I'; *(uint32_t*)s = (uint32_t)x; + s += 4; doff += 5; + if (x > 4294967295ll) + fprintf(pysamerr, "Parse warning at line %lld: integer %lld is out of range.", + (long long)fp->n_lines, x); + } + } + } else if (type == 'f') { + s = alloc_data(b, doff + 5) + doff; + *s++ = 'f'; + *(float*)s = (float)atof(str->s + 5); + s += 4; doff += 5; + } else if (type == 'd') { + s = alloc_data(b, doff + 9) + doff; + *s++ = 'd'; + *(float*)s = (float)atof(str->s + 9); + s += 8; doff += 9; + } else if (type == 'Z' || type == 'H') { + int size = 1 + (str->l - 5) + 1; + if (type == 'H') { // check whether the hex string is valid + int i; + if ((str->l - 5) % 2 == 1) parse_error(fp->n_lines, "length of the hex string not even"); + for (i = 0; i < str->l - 5; ++i) { + int c = toupper(str->s[5 + i]); + if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'))) + parse_error(fp->n_lines, "invalid hex character"); + } + } + s = alloc_data(b, doff + size) + doff; + *s++ = type; + memcpy(s, str->s + 5, str->l - 5); + s[str->l - 5] = 0; + doff += size; + } else if (type == 'B') { + int32_t n = 0, Bsize, k = 0, size; + char *p; + if (str->l < 8) parse_error(fp->n_lines, "too few values in aux type B"); + Bsize = bam_aux_type2size(str->s[5]); // the size of each element + for (p = (char*)str->s + 6; *p; ++p) // count the number of elements in the array + if (*p == ',') ++n; + p = str->s + 7; // now p points to the first number in the array + size = 6 + Bsize * n; // total number of bytes allocated to this tag + s = alloc_data(b, doff + 6 * Bsize * n) + doff; // allocate memory + *s++ = 'B'; *s++ = str->s[5]; + memcpy(s, &n, 4); s += 4; // write the number of elements + if (str->s[5] == 'c') while (p < str->s + str->l) ((int8_t*)s)[k++] = (int8_t)strtol(p, &p, 0), ++p; + else if (str->s[5] == 'C') while (p < str->s + str->l) ((uint8_t*)s)[k++] = (uint8_t)strtol(p, &p, 0), ++p; + else if (str->s[5] == 's') while (p < str->s + str->l) ((int16_t*)s)[k++] = (int16_t)strtol(p, &p, 0), ++p; // FIXME: avoid unaligned memory + else if (str->s[5] == 'S') while (p < str->s + str->l) ((uint16_t*)s)[k++] = (uint16_t)strtol(p, &p, 0), ++p; + else if (str->s[5] == 'i') while (p < str->s + str->l) ((int32_t*)s)[k++] = (int32_t)strtol(p, &p, 0), ++p; + else if (str->s[5] == 'I') while (p < str->s + str->l) ((uint32_t*)s)[k++] = (uint32_t)strtol(p, &p, 0), ++p; + else if (str->s[5] == 'f') while (p < str->s + str->l) ((float*)s)[k++] = (float)strtod(p, &p), ++p; + else parse_error(fp->n_lines, "unrecognized array type"); + s += Bsize * n; doff += size; + } else parse_error(fp->n_lines, "unrecognized type"); + if (dret == '\n' || dret == '\r') break; + } + } + b->l_aux = doff - doff0; + b->data_len = doff; + return z; +} + +tamFile sam_open(const char *fn) +{ + tamFile fp; + gzFile gzfp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "rb") : gzopen(fn, "rb"); + if (gzfp == 0) return 0; + fp = (tamFile)calloc(1, sizeof(struct __tamFile_t)); + fp->str = (kstring_t*)calloc(1, sizeof(kstring_t)); + fp->fp = gzfp; + fp->ks = ks_init(fp->fp); + return fp; +} + +void sam_close(tamFile fp) +{ + if (fp) { + ks_destroy(fp->ks); + gzclose(fp->fp); + free(fp->str->s); free(fp->str); + free(fp); + } +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_index.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_index.c.pysam.c new file mode 100755 index 0000000..6ae2ac3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_index.c.pysam.c @@ -0,0 +1,721 @@ +#include "pysam.h" + +#include +#include +#include "bam.h" +#include "khash.h" +#include "ksort.h" +#include "bam_endian.h" +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +/*! + @header + + Alignment indexing. Before indexing, BAM must be sorted based on the + leftmost coordinate of alignments. In indexing, BAM uses two indices: + a UCSC binning index and a simple linear index. The binning index is + efficient for alignments spanning long distance, while the auxiliary + linear index helps to reduce unnecessary seek calls especially for + short alignments. + + The UCSC binning scheme was suggested by Richard Durbin and Lincoln + Stein and is explained by Kent et al. (2002). In this scheme, each bin + represents a contiguous genomic region which can be fully contained in + another bin; each alignment is associated with a bin which represents + the smallest region containing the entire alignment. The binning + scheme is essentially another representation of R-tree. A distinct bin + uniquely corresponds to a distinct internal node in a R-tree. Bin A is + a child of Bin B if region A is contained in B. + + In BAM, each bin may span 2^29, 2^26, 2^23, 2^20, 2^17 or 2^14 bp. Bin + 0 spans a 512Mbp region, bins 1-8 span 64Mbp, 9-72 8Mbp, 73-584 1Mbp, + 585-4680 128Kbp and bins 4681-37449 span 16Kbp regions. If we want to + find the alignments overlapped with a region [rbeg,rend), we need to + calculate the list of bins that may be overlapped the region and test + the alignments in the bins to confirm the overlaps. If the specified + region is short, typically only a few alignments in six bins need to + be retrieved. The overlapping alignments can be quickly fetched. + + */ + +#define BAM_MIN_CHUNK_GAP 32768 +// 1<<14 is the size of minimum bin. +#define BAM_LIDX_SHIFT 14 + +#define BAM_MAX_BIN 37450 // =(8^6-1)/7+1 + +typedef struct { + uint64_t u, v; +} pair64_t; + +#define pair64_lt(a,b) ((a).u < (b).u) +KSORT_INIT(off, pair64_t, pair64_lt) + +typedef struct { + uint32_t m, n; + pair64_t *list; +} bam_binlist_t; + +typedef struct { + int32_t n, m; + uint64_t *offset; +} bam_lidx_t; + +KHASH_MAP_INIT_INT(i, bam_binlist_t) + +struct __bam_index_t { + int32_t n; + uint64_t n_no_coor; // unmapped reads without coordinate + khash_t(i) **index; + bam_lidx_t *index2; +}; + +// requirement: len <= LEN_MASK +static inline void insert_offset(khash_t(i) *h, int bin, uint64_t beg, uint64_t end) +{ + khint_t k; + bam_binlist_t *l; + int ret; + k = kh_put(i, h, bin, &ret); + l = &kh_value(h, k); + if (ret) { // not present + l->m = 1; l->n = 0; + l->list = (pair64_t*)calloc(l->m, 16); + } + if (l->n == l->m) { + l->m <<= 1; + l->list = (pair64_t*)realloc(l->list, l->m * 16); + } + l->list[l->n].u = beg; l->list[l->n++].v = end; +} + +static inline void insert_offset2(bam_lidx_t *index2, bam1_t *b, uint64_t offset) +{ + int i, beg, end; + beg = b->core.pos >> BAM_LIDX_SHIFT; + end = (bam_calend(&b->core, bam1_cigar(b)) - 1) >> BAM_LIDX_SHIFT; + if (index2->m < end + 1) { + int old_m = index2->m; + index2->m = end + 1; + kroundup32(index2->m); + index2->offset = (uint64_t*)realloc(index2->offset, index2->m * 8); + memset(index2->offset + old_m, 0, 8 * (index2->m - old_m)); + } + if (beg == end) { + if (index2->offset[beg] == 0) index2->offset[beg] = offset; + } else { + for (i = beg; i <= end; ++i) + if (index2->offset[i] == 0) index2->offset[i] = offset; + } + index2->n = end + 1; +} + +static void merge_chunks(bam_index_t *idx) +{ +#if defined(BAM_TRUE_OFFSET) || defined(BAM_VIRTUAL_OFFSET16) + khash_t(i) *index; + int i, l, m; + khint_t k; + for (i = 0; i < idx->n; ++i) { + index = idx->index[i]; + for (k = kh_begin(index); k != kh_end(index); ++k) { + bam_binlist_t *p; + if (!kh_exist(index, k) || kh_key(index, k) == BAM_MAX_BIN) continue; + p = &kh_value(index, k); + m = 0; + for (l = 1; l < p->n; ++l) { +#ifdef BAM_TRUE_OFFSET + if (p->list[m].v + BAM_MIN_CHUNK_GAP > p->list[l].u) p->list[m].v = p->list[l].v; +#else + if (p->list[m].v>>16 == p->list[l].u>>16) p->list[m].v = p->list[l].v; +#endif + else p->list[++m] = p->list[l]; + } // ~for(l) + p->n = m + 1; + } // ~for(k) + } // ~for(i) +#endif // defined(BAM_TRUE_OFFSET) || defined(BAM_BGZF) +} + +static void fill_missing(bam_index_t *idx) +{ + int i, j; + for (i = 0; i < idx->n; ++i) { + bam_lidx_t *idx2 = &idx->index2[i]; + for (j = 1; j < idx2->n; ++j) + if (idx2->offset[j] == 0) + idx2->offset[j] = idx2->offset[j-1]; + } +} + +bam_index_t *bam_index_core(bamFile fp) +{ + bam1_t *b; + bam_header_t *h; + int i, ret; + bam_index_t *idx; + uint32_t last_bin, save_bin; + int32_t last_coor, last_tid, save_tid; + bam1_core_t *c; + uint64_t save_off, last_off, n_mapped, n_unmapped, off_beg, off_end, n_no_coor; + + idx = (bam_index_t*)calloc(1, sizeof(bam_index_t)); + b = (bam1_t*)calloc(1, sizeof(bam1_t)); + h = bam_header_read(fp); + c = &b->core; + + idx->n = h->n_targets; + bam_header_destroy(h); + idx->index = (khash_t(i)**)calloc(idx->n, sizeof(void*)); + for (i = 0; i < idx->n; ++i) idx->index[i] = kh_init(i); + idx->index2 = (bam_lidx_t*)calloc(idx->n, sizeof(bam_lidx_t)); + + save_bin = save_tid = last_tid = last_bin = 0xffffffffu; + save_off = last_off = bam_tell(fp); last_coor = 0xffffffffu; + n_mapped = n_unmapped = n_no_coor = off_end = 0; + off_beg = off_end = bam_tell(fp); + while ((ret = bam_read1(fp, b)) >= 0) { + if (c->tid < 0) ++n_no_coor; + if (last_tid < c->tid || (last_tid >= 0 && c->tid < 0)) { // change of chromosomes + last_tid = c->tid; + last_bin = 0xffffffffu; + } else if ((uint32_t)last_tid > (uint32_t)c->tid) { + fprintf(pysamerr, "[bam_index_core] the alignment is not sorted (%s): %d-th chr > %d-th chr\n", + bam1_qname(b), last_tid+1, c->tid+1); + return NULL; + } else if ((int32_t)c->tid >= 0 && last_coor > c->pos) { + fprintf(pysamerr, "[bam_index_core] the alignment is not sorted (%s): %u > %u in %d-th chr\n", + bam1_qname(b), last_coor, c->pos, c->tid+1); + return NULL; + } + if (c->tid >= 0 && !(c->flag & BAM_FUNMAP)) insert_offset2(&idx->index2[b->core.tid], b, last_off); + if (c->bin != last_bin) { // then possibly write the binning index + if (save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record + insert_offset(idx->index[save_tid], save_bin, save_off, last_off); + if (last_bin == 0xffffffffu && save_tid != 0xffffffffu) { // write the meta element + off_end = last_off; + insert_offset(idx->index[save_tid], BAM_MAX_BIN, off_beg, off_end); + insert_offset(idx->index[save_tid], BAM_MAX_BIN, n_mapped, n_unmapped); + n_mapped = n_unmapped = 0; + off_beg = off_end; + } + save_off = last_off; + save_bin = last_bin = c->bin; + save_tid = c->tid; + if (save_tid < 0) break; + } + if (bam_tell(fp) <= last_off) { + fprintf(pysamerr, "[bam_index_core] bug in BGZF/RAZF: %llx < %llx\n", + (unsigned long long)bam_tell(fp), (unsigned long long)last_off); + return NULL; + } + if (c->flag & BAM_FUNMAP) ++n_unmapped; + else ++n_mapped; + last_off = bam_tell(fp); + last_coor = b->core.pos; + } + if (save_tid >= 0) { + insert_offset(idx->index[save_tid], save_bin, save_off, bam_tell(fp)); + insert_offset(idx->index[save_tid], BAM_MAX_BIN, off_beg, bam_tell(fp)); + insert_offset(idx->index[save_tid], BAM_MAX_BIN, n_mapped, n_unmapped); + } + merge_chunks(idx); + fill_missing(idx); + if (ret >= 0) { + while ((ret = bam_read1(fp, b)) >= 0) { + ++n_no_coor; + if (c->tid >= 0 && n_no_coor) { + fprintf(pysamerr, "[bam_index_core] the alignment is not sorted: reads without coordinates prior to reads with coordinates.\n"); + return NULL; + } + } + } + if (ret < -1) fprintf(pysamerr, "[bam_index_core] truncated file? Continue anyway. (%d)\n", ret); + free(b->data); free(b); + idx->n_no_coor = n_no_coor; + return idx; +} + +void bam_index_destroy(bam_index_t *idx) +{ + khint_t k; + int i; + if (idx == 0) return; + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index = idx->index[i]; + bam_lidx_t *index2 = idx->index2 + i; + for (k = kh_begin(index); k != kh_end(index); ++k) { + if (kh_exist(index, k)) + free(kh_value(index, k).list); + } + kh_destroy(i, index); + free(index2->offset); + } + free(idx->index); free(idx->index2); + free(idx); +} + +void bam_index_save(const bam_index_t *idx, FILE *fp) +{ + int32_t i, size; + khint_t k; + fwrite("BAI\1", 1, 4, fp); + if (bam_is_be) { + uint32_t x = idx->n; + fwrite(bam_swap_endian_4p(&x), 4, 1, fp); + } else fwrite(&idx->n, 4, 1, fp); + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index = idx->index[i]; + bam_lidx_t *index2 = idx->index2 + i; + // write binning index + size = kh_size(index); + if (bam_is_be) { // big endian + uint32_t x = size; + fwrite(bam_swap_endian_4p(&x), 4, 1, fp); + } else fwrite(&size, 4, 1, fp); + for (k = kh_begin(index); k != kh_end(index); ++k) { + if (kh_exist(index, k)) { + bam_binlist_t *p = &kh_value(index, k); + if (bam_is_be) { // big endian + uint32_t x; + x = kh_key(index, k); fwrite(bam_swap_endian_4p(&x), 4, 1, fp); + x = p->n; fwrite(bam_swap_endian_4p(&x), 4, 1, fp); + for (x = 0; (int)x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + fwrite(p->list, 16, p->n, fp); + for (x = 0; (int)x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + } else { + fwrite(&kh_key(index, k), 4, 1, fp); + fwrite(&p->n, 4, 1, fp); + fwrite(p->list, 16, p->n, fp); + } + } + } + // write linear index (index2) + if (bam_is_be) { + int x = index2->n; + fwrite(bam_swap_endian_4p(&x), 4, 1, fp); + } else fwrite(&index2->n, 4, 1, fp); + if (bam_is_be) { // big endian + int x; + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + fwrite(index2->offset, 8, index2->n, fp); + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + } else fwrite(index2->offset, 8, index2->n, fp); + } + { // write the number of reads coor-less records. + uint64_t x = idx->n_no_coor; + if (bam_is_be) bam_swap_endian_8p(&x); + fwrite(&x, 8, 1, fp); + } + fflush(fp); +} + +static bam_index_t *bam_index_load_core(FILE *fp) +{ + int i; + char magic[4]; + bam_index_t *idx; + if (fp == 0) { + fprintf(pysamerr, "[bam_index_load_core] fail to load index.\n"); + return 0; + } + fread(magic, 1, 4, fp); + if (strncmp(magic, "BAI\1", 4)) { + fprintf(pysamerr, "[bam_index_load] wrong magic number.\n"); + fclose(fp); + return 0; + } + idx = (bam_index_t*)calloc(1, sizeof(bam_index_t)); + fread(&idx->n, 4, 1, fp); + if (bam_is_be) bam_swap_endian_4p(&idx->n); + idx->index = (khash_t(i)**)calloc(idx->n, sizeof(void*)); + idx->index2 = (bam_lidx_t*)calloc(idx->n, sizeof(bam_lidx_t)); + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index; + bam_lidx_t *index2 = idx->index2 + i; + uint32_t key, size; + khint_t k; + int j, ret; + bam_binlist_t *p; + index = idx->index[i] = kh_init(i); + // load binning index + fread(&size, 4, 1, fp); + if (bam_is_be) bam_swap_endian_4p(&size); + for (j = 0; j < (int)size; ++j) { + fread(&key, 4, 1, fp); + if (bam_is_be) bam_swap_endian_4p(&key); + k = kh_put(i, index, key, &ret); + p = &kh_value(index, k); + fread(&p->n, 4, 1, fp); + if (bam_is_be) bam_swap_endian_4p(&p->n); + p->m = p->n; + p->list = (pair64_t*)malloc(p->m * 16); + fread(p->list, 16, p->n, fp); + if (bam_is_be) { + int x; + for (x = 0; x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + } + } + // load linear index + fread(&index2->n, 4, 1, fp); + if (bam_is_be) bam_swap_endian_4p(&index2->n); + index2->m = index2->n; + index2->offset = (uint64_t*)calloc(index2->m, 8); + fread(index2->offset, index2->n, 8, fp); + if (bam_is_be) + for (j = 0; j < index2->n; ++j) bam_swap_endian_8p(&index2->offset[j]); + } + if (fread(&idx->n_no_coor, 8, 1, fp) == 0) idx->n_no_coor = 0; + if (bam_is_be) bam_swap_endian_8p(&idx->n_no_coor); + return idx; +} + +bam_index_t *bam_index_load_local(const char *_fn) +{ + FILE *fp; + char *fnidx, *fn; + + if (strstr(_fn, "ftp://") == _fn || strstr(_fn, "http://") == _fn) { + const char *p; + int l = strlen(_fn); + for (p = _fn + l - 1; p >= _fn; --p) + if (*p == '/') break; + fn = strdup(p + 1); + } else fn = strdup(_fn); + fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcpy(fnidx, fn); strcat(fnidx, ".bai"); + fp = fopen(fnidx, "rb"); + if (fp == 0) { // try "{base}.bai" + char *s = strstr(fn, "bam"); + if (s == fn + strlen(fn) - 3) { + strcpy(fnidx, fn); + fnidx[strlen(fn)-1] = 'i'; + fp = fopen(fnidx, "rb"); + } + } + free(fnidx); free(fn); + if (fp) { + bam_index_t *idx = bam_index_load_core(fp); + fclose(fp); + return idx; + } else return 0; +} + +#ifdef _USE_KNETFILE +static void download_from_remote(const char *url) +{ + const int buf_size = 1 * 1024 * 1024; + char *fn; + FILE *fp; + uint8_t *buf; + knetFile *fp_remote; + int l; + if (strstr(url, "ftp://") != url && strstr(url, "http://") != url) return; + l = strlen(url); + for (fn = (char*)url + l - 1; fn >= url; --fn) + if (*fn == '/') break; + ++fn; // fn now points to the file name + fp_remote = knet_open(url, "r"); + if (fp_remote == 0) { + fprintf(pysamerr, "[download_from_remote] fail to open remote file.\n"); + return; + } + if ((fp = fopen(fn, "wb")) == 0) { + fprintf(pysamerr, "[download_from_remote] fail to create file in the working directory.\n"); + knet_close(fp_remote); + return; + } + buf = (uint8_t*)calloc(buf_size, 1); + while ((l = knet_read(fp_remote, buf, buf_size)) != 0) + fwrite(buf, 1, l, fp); + free(buf); + fclose(fp); + knet_close(fp_remote); +} +#else +static void download_from_remote(const char *url) +{ + return; +} +#endif + +bam_index_t *bam_index_load(const char *fn) +{ + bam_index_t *idx; + idx = bam_index_load_local(fn); + if (idx == 0 && (strstr(fn, "ftp://") == fn || strstr(fn, "http://") == fn)) { + char *fnidx = calloc(strlen(fn) + 5, 1); + strcat(strcpy(fnidx, fn), ".bai"); + fprintf(pysamerr, "[bam_index_load] attempting to download the remote index file.\n"); + download_from_remote(fnidx); + idx = bam_index_load_local(fn); + } + if (idx == 0) fprintf(pysamerr, "[bam_index_load] fail to load BAM index.\n"); + return idx; +} + +int bam_index_build2(const char *fn, const char *_fnidx) +{ + char *fnidx; + FILE *fpidx; + bamFile fp; + bam_index_t *idx; + if ((fp = bam_open(fn, "r")) == 0) { + fprintf(pysamerr, "[bam_index_build2] fail to open the BAM file.\n"); + return -1; + } + idx = bam_index_core(fp); + bam_close(fp); + if(idx == 0) { + fprintf(pysamerr, "[bam_index_build2] fail to index the BAM file.\n"); + return -1; + } + if (_fnidx == 0) { + fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcpy(fnidx, fn); strcat(fnidx, ".bai"); + } else fnidx = strdup(_fnidx); + fpidx = fopen(fnidx, "wb"); + if (fpidx == 0) { + fprintf(pysamerr, "[bam_index_build2] fail to create the index file.\n"); + free(fnidx); + return -1; + } + bam_index_save(idx, fpidx); + bam_index_destroy(idx); + fclose(fpidx); + free(fnidx); + return 0; +} + +int bam_index_build(const char *fn) +{ + return bam_index_build2(fn, 0); +} + +int bam_index(int argc, char *argv[]) +{ + if (argc < 2) { + fprintf(pysamerr, "Usage: samtools index [out.index]\n"); + return 1; + } + if (argc >= 3) bam_index_build2(argv[1], argv[2]); + else bam_index_build(argv[1]); + return 0; +} + +int bam_idxstats(int argc, char *argv[]) +{ + bam_index_t *idx; + bam_header_t *header; + bamFile fp; + int i; + if (argc < 2) { + fprintf(pysamerr, "Usage: samtools idxstats \n"); + return 1; + } + fp = bam_open(argv[1], "r"); + if (fp == 0) { fprintf(pysamerr, "[%s] fail to open BAM.\n", __func__); return 1; } + header = bam_header_read(fp); + bam_close(fp); + idx = bam_index_load(argv[1]); + if (idx == 0) { fprintf(pysamerr, "[%s] fail to load the index.\n", __func__); return 1; } + for (i = 0; i < idx->n; ++i) { + khint_t k; + khash_t(i) *h = idx->index[i]; + printf("%s\t%d", header->target_name[i], header->target_len[i]); + k = kh_get(i, h, BAM_MAX_BIN); + if (k != kh_end(h)) + printf("\t%llu\t%llu", (long long)kh_val(h, k).list[1].u, (long long)kh_val(h, k).list[1].v); + else printf("\t0\t0"); + putchar('\n'); + } + printf("*\t0\t0\t%llu\n", (long long)idx->n_no_coor); + bam_header_destroy(header); + bam_index_destroy(idx); + return 0; +} + +static inline int reg2bins(uint32_t beg, uint32_t end, uint16_t list[BAM_MAX_BIN]) +{ + int i = 0, k; + if (beg >= end) return 0; + if (end >= 1u<<29) end = 1u<<29; + --end; + list[i++] = 0; + for (k = 1 + (beg>>26); k <= 1 + (end>>26); ++k) list[i++] = k; + for (k = 9 + (beg>>23); k <= 9 + (end>>23); ++k) list[i++] = k; + for (k = 73 + (beg>>20); k <= 73 + (end>>20); ++k) list[i++] = k; + for (k = 585 + (beg>>17); k <= 585 + (end>>17); ++k) list[i++] = k; + for (k = 4681 + (beg>>14); k <= 4681 + (end>>14); ++k) list[i++] = k; + return i; +} + +static inline int is_overlap(uint32_t beg, uint32_t end, const bam1_t *b) +{ + uint32_t rbeg = b->core.pos; + uint32_t rend = b->core.n_cigar? bam_calend(&b->core, bam1_cigar(b)) : b->core.pos + 1; + return (rend > beg && rbeg < end); +} + +struct __bam_iter_t { + int from_first; // read from the first record; no random access + int tid, beg, end, n_off, i, finished; + uint64_t curr_off; + pair64_t *off; +}; + +// bam_fetch helper function retrieves +bam_iter_t bam_iter_query(const bam_index_t *idx, int tid, int beg, int end) +{ + uint16_t *bins; + int i, n_bins, n_off; + pair64_t *off; + khint_t k; + khash_t(i) *index; + uint64_t min_off; + bam_iter_t iter = 0; + + if (beg < 0) beg = 0; + if (end < beg) return 0; + // initialize iter + iter = calloc(1, sizeof(struct __bam_iter_t)); + iter->tid = tid, iter->beg = beg, iter->end = end; iter->i = -1; + // + bins = (uint16_t*)calloc(BAM_MAX_BIN, 2); + n_bins = reg2bins(beg, end, bins); + index = idx->index[tid]; + if (idx->index2[tid].n > 0) { + min_off = (beg>>BAM_LIDX_SHIFT >= idx->index2[tid].n)? idx->index2[tid].offset[idx->index2[tid].n-1] + : idx->index2[tid].offset[beg>>BAM_LIDX_SHIFT]; + if (min_off == 0) { // improvement for index files built by tabix prior to 0.1.4 + int n = beg>>BAM_LIDX_SHIFT; + if (n > idx->index2[tid].n) n = idx->index2[tid].n; + for (i = n - 1; i >= 0; --i) + if (idx->index2[tid].offset[i] != 0) break; + if (i >= 0) min_off = idx->index2[tid].offset[i]; + } + } else min_off = 0; // tabix 0.1.2 may produce such index files + for (i = n_off = 0; i < n_bins; ++i) { + if ((k = kh_get(i, index, bins[i])) != kh_end(index)) + n_off += kh_value(index, k).n; + } + if (n_off == 0) { + free(bins); return iter; + } + off = (pair64_t*)calloc(n_off, 16); + for (i = n_off = 0; i < n_bins; ++i) { + if ((k = kh_get(i, index, bins[i])) != kh_end(index)) { + int j; + bam_binlist_t *p = &kh_value(index, k); + for (j = 0; j < p->n; ++j) + if (p->list[j].v > min_off) off[n_off++] = p->list[j]; + } + } + free(bins); + if (n_off == 0) { + free(off); return iter; + } + { + bam1_t *b = (bam1_t*)calloc(1, sizeof(bam1_t)); + int l; + ks_introsort(off, n_off, off); + // resolve completely contained adjacent blocks + for (i = 1, l = 0; i < n_off; ++i) + if (off[l].v < off[i].v) + off[++l] = off[i]; + n_off = l + 1; + // resolve overlaps between adjacent blocks; this may happen due to the merge in indexing + for (i = 1; i < n_off; ++i) + if (off[i-1].v >= off[i].u) off[i-1].v = off[i].u; + { // merge adjacent blocks +#if defined(BAM_TRUE_OFFSET) || defined(BAM_VIRTUAL_OFFSET16) + for (i = 1, l = 0; i < n_off; ++i) { +#ifdef BAM_TRUE_OFFSET + if (off[l].v + BAM_MIN_CHUNK_GAP > off[i].u) off[l].v = off[i].v; +#else + if (off[l].v>>16 == off[i].u>>16) off[l].v = off[i].v; +#endif + else off[++l] = off[i]; + } + n_off = l + 1; +#endif + } + bam_destroy1(b); + } + iter->n_off = n_off; iter->off = off; + return iter; +} + +pair64_t *get_chunk_coordinates(const bam_index_t *idx, int tid, int beg, int end, int *cnt_off) +{ // for pysam compatibility + bam_iter_t iter; + pair64_t *off; + iter = bam_iter_query(idx, tid, beg, end); + off = iter->off; *cnt_off = iter->n_off; + free(iter); + return off; +} + +void bam_iter_destroy(bam_iter_t iter) +{ + if (iter) { free(iter->off); free(iter); } +} + +int bam_iter_read(bamFile fp, bam_iter_t iter, bam1_t *b) +{ + int ret; + if (iter && iter->finished) return -1; + if (iter == 0 || iter->from_first) { + ret = bam_read1(fp, b); + if (ret < 0 && iter) iter->finished = 1; + return ret; + } + if (iter->off == 0) return -1; + for (;;) { + if (iter->curr_off == 0 || iter->curr_off >= iter->off[iter->i].v) { // then jump to the next chunk + if (iter->i == iter->n_off - 1) { ret = -1; break; } // no more chunks + if (iter->i >= 0) assert(iter->curr_off == iter->off[iter->i].v); // otherwise bug + if (iter->i < 0 || iter->off[iter->i].v != iter->off[iter->i+1].u) { // not adjacent chunks; then seek + bam_seek(fp, iter->off[iter->i+1].u, SEEK_SET); + iter->curr_off = bam_tell(fp); + } + ++iter->i; + } + if ((ret = bam_read1(fp, b)) >= 0) { + iter->curr_off = bam_tell(fp); + if (b->core.tid != iter->tid || b->core.pos >= iter->end) { // no need to proceed + ret = bam_validate1(NULL, b)? -1 : -5; // determine whether end of region or error + break; + } + else if (is_overlap(iter->beg, iter->end, b)) return ret; + } else break; // end of file or error + } + iter->finished = 1; + return ret; +} + +int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func) +{ + int ret; + bam_iter_t iter; + bam1_t *b; + b = bam_init1(); + iter = bam_iter_query(idx, tid, beg, end); + while ((ret = bam_iter_read(fp, iter, b)) >= 0) func(b, data); + bam_iter_destroy(iter); + bam_destroy1(b); + return (ret == -1)? 0 : ret; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_lpileup.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_lpileup.c.pysam.c new file mode 100755 index 0000000..a5c5b04 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_lpileup.c.pysam.c @@ -0,0 +1,200 @@ +#include "pysam.h" + +#include +#include +#include +#include "bam.h" +#include "ksort.h" + +#define TV_GAP 2 + +typedef struct __freenode_t { + uint32_t level:28, cnt:4; + struct __freenode_t *next; +} freenode_t, *freenode_p; + +#define freenode_lt(a,b) ((a)->cnt < (b)->cnt || ((a)->cnt == (b)->cnt && (a)->level < (b)->level)) +KSORT_INIT(node, freenode_p, freenode_lt) + +/* Memory pool, similar to the one in bam_pileup.c */ +typedef struct { + int cnt, n, max; + freenode_t **buf; +} mempool_t; + +static mempool_t *mp_init() +{ + return (mempool_t*)calloc(1, sizeof(mempool_t)); +} +static void mp_destroy(mempool_t *mp) +{ + int k; + for (k = 0; k < mp->n; ++k) free(mp->buf[k]); + free(mp->buf); free(mp); +} +static inline freenode_t *mp_alloc(mempool_t *mp) +{ + ++mp->cnt; + if (mp->n == 0) return (freenode_t*)calloc(1, sizeof(freenode_t)); + else return mp->buf[--mp->n]; +} +static inline void mp_free(mempool_t *mp, freenode_t *p) +{ + --mp->cnt; p->next = 0; p->cnt = TV_GAP; + if (mp->n == mp->max) { + mp->max = mp->max? mp->max<<1 : 256; + mp->buf = (freenode_t**)realloc(mp->buf, sizeof(freenode_t*) * mp->max); + } + mp->buf[mp->n++] = p; +} + +/* core part */ +struct __bam_lplbuf_t { + int max, n_cur, n_pre; + int max_level, *cur_level, *pre_level; + mempool_t *mp; + freenode_t **aux, *head, *tail; + int n_nodes, m_aux; + bam_pileup_f func; + void *user_data; + bam_plbuf_t *plbuf; +}; + +void bam_lplbuf_reset(bam_lplbuf_t *buf) +{ + freenode_t *p, *q; + bam_plbuf_reset(buf->plbuf); + for (p = buf->head; p->next;) { + q = p->next; + mp_free(buf->mp, p); + p = q; + } + buf->head = buf->tail; + buf->max_level = 0; + buf->n_cur = buf->n_pre = 0; + buf->n_nodes = 0; +} + +static int tview_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data) +{ + bam_lplbuf_t *tv = (bam_lplbuf_t*)data; + freenode_t *p; + int i, l, max_level; + // allocate memory if necessary + if (tv->max < n) { // enlarge + tv->max = n; + kroundup32(tv->max); + tv->cur_level = (int*)realloc(tv->cur_level, sizeof(int) * tv->max); + tv->pre_level = (int*)realloc(tv->pre_level, sizeof(int) * tv->max); + } + tv->n_cur = n; + // update cnt + for (p = tv->head; p->next; p = p->next) + if (p->cnt > 0) --p->cnt; + // calculate cur_level[] + max_level = 0; + for (i = l = 0; i < n; ++i) { + const bam_pileup1_t *p = pl + i; + if (p->is_head) { + if (tv->head->next && tv->head->cnt == 0) { // then take a free slot + freenode_t *p = tv->head->next; + tv->cur_level[i] = tv->head->level; + mp_free(tv->mp, tv->head); + tv->head = p; + --tv->n_nodes; + } else tv->cur_level[i] = ++tv->max_level; + } else { + tv->cur_level[i] = tv->pre_level[l++]; + if (p->is_tail) { // then return a free slot + tv->tail->level = tv->cur_level[i]; + tv->tail->next = mp_alloc(tv->mp); + tv->tail = tv->tail->next; + ++tv->n_nodes; + } + } + if (tv->cur_level[i] > max_level) max_level = tv->cur_level[i]; + ((bam_pileup1_t*)p)->level = tv->cur_level[i]; + } + assert(l == tv->n_pre); + tv->func(tid, pos, n, pl, tv->user_data); + // sort the linked list + if (tv->n_nodes) { + freenode_t *q; + if (tv->n_nodes + 1 > tv->m_aux) { // enlarge + tv->m_aux = tv->n_nodes + 1; + kroundup32(tv->m_aux); + tv->aux = (freenode_t**)realloc(tv->aux, sizeof(void*) * tv->m_aux); + } + for (p = tv->head, i = l = 0; p->next;) { + if (p->level > max_level) { // then discard this entry + q = p->next; + mp_free(tv->mp, p); + p = q; + } else { + tv->aux[i++] = p; + p = p->next; + } + } + tv->aux[i] = tv->tail; // add a proper tail for the loop below + tv->n_nodes = i; + if (tv->n_nodes) { + ks_introsort(node, tv->n_nodes, tv->aux); + for (i = 0; i < tv->n_nodes; ++i) tv->aux[i]->next = tv->aux[i+1]; + tv->head = tv->aux[0]; + } else tv->head = tv->tail; + } + // clean up + tv->max_level = max_level; + memcpy(tv->pre_level, tv->cur_level, tv->n_cur * 4); + // squeeze out terminated levels + for (i = l = 0; i < n; ++i) { + const bam_pileup1_t *p = pl + i; + if (!p->is_tail) + tv->pre_level[l++] = tv->pre_level[i]; + } + tv->n_pre = l; +/* + fprintf(pysamerr, "%d\t", pos+1); + for (i = 0; i < n; ++i) { + const bam_pileup1_t *p = pl + i; + if (p->is_head) fprintf(pysamerr, "^"); + if (p->is_tail) fprintf(pysamerr, "$"); + fprintf(pysamerr, "%d,", p->level); + } + fprintf(pysamerr, "\n"); +*/ + return 0; +} + +bam_lplbuf_t *bam_lplbuf_init(bam_pileup_f func, void *data) +{ + bam_lplbuf_t *tv; + tv = (bam_lplbuf_t*)calloc(1, sizeof(bam_lplbuf_t)); + tv->mp = mp_init(); + tv->head = tv->tail = mp_alloc(tv->mp); + tv->func = func; + tv->user_data = data; + tv->plbuf = bam_plbuf_init(tview_func, tv); + return (bam_lplbuf_t*)tv; +} + +void bam_lplbuf_destroy(bam_lplbuf_t *tv) +{ + freenode_t *p, *q; + free(tv->cur_level); free(tv->pre_level); + bam_plbuf_destroy(tv->plbuf); + free(tv->aux); + for (p = tv->head; p->next;) { + q = p->next; + mp_free(tv->mp, p); p = q; + } + mp_free(tv->mp, p); + assert(tv->mp->cnt == 0); + mp_destroy(tv->mp); + free(tv); +} + +int bam_lplbuf_push(const bam1_t *b, bam_lplbuf_t *tv) +{ + return bam_plbuf_push(b, tv->plbuf); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_mate.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_mate.c.pysam.c new file mode 100755 index 0000000..ebb797b --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_mate.c.pysam.c @@ -0,0 +1,72 @@ +#include "pysam.h" + +#include +#include +#include "bam.h" + +// currently, this function ONLY works if each read has one hit +void bam_mating_core(bamFile in, bamFile out) +{ + bam_header_t *header; + bam1_t *b[2]; + int curr, has_prev; + + header = bam_header_read(in); + bam_header_write(out, header); + + b[0] = bam_init1(); + b[1] = bam_init1(); + curr = 0; has_prev = 0; + while (bam_read1(in, b[curr]) >= 0) { + bam1_t *cur = b[curr], *pre = b[1-curr]; + if (has_prev) { + if (strcmp(bam1_qname(cur), bam1_qname(pre)) == 0) { // identical pair name + cur->core.mtid = pre->core.tid; cur->core.mpos = pre->core.pos; + pre->core.mtid = cur->core.tid; pre->core.mpos = cur->core.pos; + if (pre->core.tid == cur->core.tid && !(cur->core.flag&(BAM_FUNMAP|BAM_FMUNMAP)) + && !(pre->core.flag&(BAM_FUNMAP|BAM_FMUNMAP))) + { + uint32_t cur5, pre5; + cur5 = (cur->core.flag&BAM_FREVERSE)? bam_calend(&cur->core, bam1_cigar(cur)) : cur->core.pos; + pre5 = (pre->core.flag&BAM_FREVERSE)? bam_calend(&pre->core, bam1_cigar(pre)) : pre->core.pos; + cur->core.isize = pre5 - cur5; pre->core.isize = cur5 - pre5; + } else cur->core.isize = pre->core.isize = 0; + if (pre->core.flag&BAM_FREVERSE) cur->core.flag |= BAM_FMREVERSE; + else cur->core.flag &= ~BAM_FMREVERSE; + if (cur->core.flag&BAM_FREVERSE) pre->core.flag |= BAM_FMREVERSE; + else pre->core.flag &= ~BAM_FMREVERSE; + if (cur->core.flag & BAM_FUNMAP) { pre->core.flag |= BAM_FMUNMAP; pre->core.flag &= ~BAM_FPROPER_PAIR; } + if (pre->core.flag & BAM_FUNMAP) { cur->core.flag |= BAM_FMUNMAP; cur->core.flag &= ~BAM_FPROPER_PAIR; } + bam_write1(out, pre); + bam_write1(out, cur); + has_prev = 0; + } else { // unpaired or singleton + pre->core.mtid = -1; pre->core.mpos = -1; pre->core.isize = 0; + if (pre->core.flag & BAM_FPAIRED) { + pre->core.flag |= BAM_FMUNMAP; + pre->core.flag &= ~BAM_FMREVERSE & ~BAM_FPROPER_PAIR; + } + bam_write1(out, pre); + } + } else has_prev = 1; + curr = 1 - curr; + } + if (has_prev) bam_write1(out, b[1-curr]); + bam_header_destroy(header); + bam_destroy1(b[0]); + bam_destroy1(b[1]); +} + +int bam_mating(int argc, char *argv[]) +{ + bamFile in, out; + if (argc < 3) { + fprintf(pysamerr, "samtools fixmate \n"); + return 1; + } + in = (strcmp(argv[1], "-") == 0)? bam_dopen(fileno(stdin), "r") : bam_open(argv[1], "r"); + out = (strcmp(argv[2], "-") == 0)? bam_dopen(fileno(stdout), "w") : bam_open(argv[2], "w"); + bam_mating_core(in, out); + bam_close(in); bam_close(out); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_md.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_md.c.pysam.c new file mode 100755 index 0000000..50ecaf1 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_md.c.pysam.c @@ -0,0 +1,386 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "faidx.h" +#include "sam.h" +#include "kstring.h" +#include "kaln.h" +#include "kprobaln.h" + +#define USE_EQUAL 1 +#define DROP_TAG 2 +#define BIN_QUAL 4 +#define UPDATE_NM 8 +#define UPDATE_MD 16 +#define HASH_QNM 32 + +char bam_nt16_nt4_table[] = { 4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4 }; + +int bam_aux_drop_other(bam1_t *b, uint8_t *s); + +void bam_fillmd1_core(bam1_t *b, char *ref, int flag, int max_nm) +{ + uint8_t *seq = bam1_seq(b); + uint32_t *cigar = bam1_cigar(b); + bam1_core_t *c = &b->core; + int i, x, y, u = 0; + kstring_t *str; + int32_t old_nm_i = -1, nm = 0; + + str = (kstring_t*)calloc(1, sizeof(kstring_t)); + for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) { + int j, l = cigar[i]>>4, op = cigar[i]&0xf; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (j = 0; j < l; ++j) { + int z = y + j; + int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]]; + if (ref[x+j] == 0) break; // out of boundary + if ((c1 == c2 && c1 != 15 && c2 != 15) || c1 == 0) { // a match + if (flag&USE_EQUAL) seq[z/2] &= (z&1)? 0xf0 : 0x0f; + ++u; + } else { + kputw(u, str); kputc(ref[x+j], str); + u = 0; ++nm; + } + } + if (j < l) break; + x += l; y += l; + } else if (op == BAM_CDEL) { + kputw(u, str); kputc('^', str); + for (j = 0; j < l; ++j) { + if (ref[x+j] == 0) break; + kputc(ref[x+j], str); + } + u = 0; + if (j < l) break; + x += l; nm += l; + } else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) { + y += l; + if (op == BAM_CINS) nm += l; + } else if (op == BAM_CREF_SKIP) { + x += l; + } + } + kputw(u, str); + // apply max_nm + if (max_nm > 0 && nm >= max_nm) { + for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) { + int j, l = cigar[i]>>4, op = cigar[i]&0xf; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (j = 0; j < l; ++j) { + int z = y + j; + int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]]; + if (ref[x+j] == 0) break; // out of boundary + if ((c1 == c2 && c1 != 15 && c2 != 15) || c1 == 0) { // a match + seq[z/2] |= (z&1)? 0x0f : 0xf0; + bam1_qual(b)[z] = 0; + } + } + if (j < l) break; + x += l; y += l; + } else if (op == BAM_CDEL || op == BAM_CREF_SKIP) x += l; + else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l; + } + } + // update NM + if (flag & UPDATE_NM) { + uint8_t *old_nm = bam_aux_get(b, "NM"); + if (c->flag & BAM_FUNMAP) return; + if (old_nm) old_nm_i = bam_aux2i(old_nm); + if (!old_nm) bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm); + else if (nm != old_nm_i) { + fprintf(pysamerr, "[bam_fillmd1] different NM for read '%s': %d -> %d\n", bam1_qname(b), old_nm_i, nm); + bam_aux_del(b, old_nm); + bam_aux_append(b, "NM", 'i', 4, (uint8_t*)&nm); + } + } + // update MD + if (flag & UPDATE_MD) { + uint8_t *old_md = bam_aux_get(b, "MD"); + if (c->flag & BAM_FUNMAP) return; + if (!old_md) bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s); + else { + int is_diff = 0; + if (strlen((char*)old_md+1) == str->l) { + for (i = 0; i < str->l; ++i) + if (toupper(old_md[i+1]) != toupper(str->s[i])) + break; + if (i < str->l) is_diff = 1; + } else is_diff = 1; + if (is_diff) { + fprintf(pysamerr, "[bam_fillmd1] different MD for read '%s': '%s' -> '%s'\n", bam1_qname(b), old_md+1, str->s); + bam_aux_del(b, old_md); + bam_aux_append(b, "MD", 'Z', str->l + 1, (uint8_t*)str->s); + } + } + } + // drop all tags but RG + if (flag&DROP_TAG) { + uint8_t *q = bam_aux_get(b, "RG"); + bam_aux_drop_other(b, q); + } + // reduce the resolution of base quality + if (flag&BIN_QUAL) { + uint8_t *qual = bam1_qual(b); + for (i = 0; i < b->core.l_qseq; ++i) + if (qual[i] >= 3) qual[i] = qual[i]/10*10 + 7; + } + free(str->s); free(str); +} + +void bam_fillmd1(bam1_t *b, char *ref, int flag) +{ + bam_fillmd1_core(b, ref, flag, 0); +} + +int bam_cap_mapQ(bam1_t *b, char *ref, int thres) +{ + uint8_t *seq = bam1_seq(b), *qual = bam1_qual(b); + uint32_t *cigar = bam1_cigar(b); + bam1_core_t *c = &b->core; + int i, x, y, mm, q, len, clip_l, clip_q; + double t; + if (thres < 0) thres = 40; // set the default + mm = q = len = clip_l = clip_q = 0; + for (i = y = 0, x = c->pos; i < c->n_cigar; ++i) { + int j, l = cigar[i]>>4, op = cigar[i]&0xf; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (j = 0; j < l; ++j) { + int z = y + j; + int c1 = bam1_seqi(seq, z), c2 = bam_nt16_table[(int)ref[x+j]]; + if (ref[x+j] == 0) break; // out of boundary + if (c2 != 15 && c1 != 15 && qual[z] >= 13) { // not ambiguous + ++len; + if (c1 && c1 != c2 && qual[z] >= 13) { // mismatch + ++mm; + q += qual[z] > 33? 33 : qual[z]; + } + } + } + if (j < l) break; + x += l; y += l; len += l; + } else if (op == BAM_CDEL) { + for (j = 0; j < l; ++j) + if (ref[x+j] == 0) break; + if (j < l) break; + x += l; + } else if (op == BAM_CSOFT_CLIP) { + for (j = 0; j < l; ++j) clip_q += qual[y+j]; + clip_l += l; + y += l; + } else if (op == BAM_CHARD_CLIP) { + clip_q += 13 * l; + clip_l += l; + } else if (op == BAM_CINS) y += l; + else if (op == BAM_CREF_SKIP) x += l; + } + for (i = 0, t = 1; i < mm; ++i) + t *= (double)len / (i+1); + t = q - 4.343 * log(t) + clip_q / 5.; + if (t > thres) return -1; + if (t < 0) t = 0; + t = sqrt((thres - t) / thres) * thres; +// fprintf(pysamerr, "%s %lf %d\n", bam1_qname(b), t, q); + return (int)(t + .499); +} + +int bam_prob_realn_core(bam1_t *b, const char *ref, int flag) +{ + int k, i, bw, x, y, yb, ye, xb, xe, apply_baq = flag&1, extend_baq = flag>>1&1; + uint32_t *cigar = bam1_cigar(b); + bam1_core_t *c = &b->core; + kpa_par_t conf = kpa_par_def; + uint8_t *bq = 0, *zq = 0, *qual = bam1_qual(b); + if ((c->flag & BAM_FUNMAP) || b->core.l_qseq == 0) return -1; // do nothing + // test if BQ or ZQ is present + if ((bq = bam_aux_get(b, "BQ")) != 0) ++bq; + if ((zq = bam_aux_get(b, "ZQ")) != 0 && *zq == 'Z') ++zq; + if (bq && zq) { // remove the ZQ tag + bam_aux_del(b, zq-1); + zq = 0; + } + if (bq || zq) { + if ((apply_baq && zq) || (!apply_baq && bq)) return -3; // in both cases, do nothing + if (bq && apply_baq) { // then convert BQ to ZQ + for (i = 0; i < c->l_qseq; ++i) + qual[i] = qual[i] + 64 < bq[i]? 0 : qual[i] - ((int)bq[i] - 64); + *(bq - 3) = 'Z'; + } else if (zq && !apply_baq) { // then convert ZQ to BQ + for (i = 0; i < c->l_qseq; ++i) + qual[i] += (int)zq[i] - 64; + *(zq - 3) = 'B'; + } + return 0; + } + // find the start and end of the alignment + x = c->pos, y = 0, yb = ye = xb = xe = -1; + for (k = 0; k < c->n_cigar; ++k) { + int op, l; + op = cigar[k]&0xf; l = cigar[k]>>4; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + if (yb < 0) yb = y; + if (xb < 0) xb = x; + ye = y + l; xe = x + l; + x += l; y += l; + } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) y += l; + else if (op == BAM_CDEL) x += l; + else if (op == BAM_CREF_SKIP) return -1; // do nothing if there is a reference skip + } + // set bandwidth and the start and the end + bw = 7; + if (abs((xe - xb) - (ye - yb)) > bw) + bw = abs((xe - xb) - (ye - yb)) + 3; + conf.bw = bw; + xb -= yb + bw/2; if (xb < 0) xb = 0; + xe += c->l_qseq - ye + bw/2; + if (xe - xb - c->l_qseq > bw) + xb += (xe - xb - c->l_qseq - bw) / 2, xe -= (xe - xb - c->l_qseq - bw) / 2; + { // glocal + uint8_t *s, *r, *q, *seq = bam1_seq(b), *bq; + int *state; + bq = calloc(c->l_qseq + 1, 1); + memcpy(bq, qual, c->l_qseq); + s = calloc(c->l_qseq, 1); + for (i = 0; i < c->l_qseq; ++i) s[i] = bam_nt16_nt4_table[bam1_seqi(seq, i)]; + r = calloc(xe - xb, 1); + for (i = xb; i < xe; ++i) { + if (ref[i] == 0) { xe = i; break; } + r[i-xb] = bam_nt16_nt4_table[bam_nt16_table[(int)ref[i]]]; + } + state = calloc(c->l_qseq, sizeof(int)); + q = calloc(c->l_qseq, 1); + kpa_glocal(r, xe-xb, s, c->l_qseq, qual, &conf, state, q); + if (!extend_baq) { // in this block, bq[] is capped by base quality qual[] + for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) { + int op = cigar[k]&0xf, l = cigar[k]>>4; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (i = y; i < y + l; ++i) { + if ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y)) bq[i] = 0; + else bq[i] = bq[i] < q[i]? bq[i] : q[i]; + } + x += l; y += l; + } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) y += l; + else if (op == BAM_CDEL) x += l; + } + for (i = 0; i < c->l_qseq; ++i) bq[i] = qual[i] - bq[i] + 64; // finalize BQ + } else { // in this block, bq[] is BAQ that can be larger than qual[] (different from the above!) + uint8_t *left, *rght; + left = calloc(c->l_qseq, 1); rght = calloc(c->l_qseq, 1); + for (k = 0, x = c->pos, y = 0; k < c->n_cigar; ++k) { + int op = cigar[k]&0xf, l = cigar[k]>>4; + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + for (i = y; i < y + l; ++i) + bq[i] = ((state[i]&3) != 0 || state[i]>>2 != x - xb + (i - y))? 0 : q[i]; + for (left[y] = bq[y], i = y + 1; i < y + l; ++i) + left[i] = bq[i] > left[i-1]? bq[i] : left[i-1]; + for (rght[y+l-1] = bq[y+l-1], i = y + l - 2; i >= y; --i) + rght[i] = bq[i] > rght[i+1]? bq[i] : rght[i+1]; + for (i = y; i < y + l; ++i) + bq[i] = left[i] < rght[i]? left[i] : rght[i]; + x += l; y += l; + } else if (op == BAM_CSOFT_CLIP || op == BAM_CINS) y += l; + else if (op == BAM_CDEL) x += l; + } + for (i = 0; i < c->l_qseq; ++i) bq[i] = 64 + (qual[i] <= bq[i]? 0 : qual[i] - bq[i]); // finalize BQ + free(left); free(rght); + } + if (apply_baq) { + for (i = 0; i < c->l_qseq; ++i) qual[i] -= bq[i] - 64; // modify qual + bam_aux_append(b, "ZQ", 'Z', c->l_qseq + 1, bq); + } else bam_aux_append(b, "BQ", 'Z', c->l_qseq + 1, bq); + free(bq); free(s); free(r); free(q); free(state); + } + return 0; +} + +int bam_prob_realn(bam1_t *b, const char *ref) +{ + return bam_prob_realn_core(b, ref, 1); +} + +int bam_fillmd(int argc, char *argv[]) +{ + int c, flt_flag, tid = -2, ret, len, is_bam_out, is_sam_in, is_uncompressed, max_nm, is_realn, capQ, baq_flag; + samfile_t *fp, *fpout = 0; + faidx_t *fai; + char *ref = 0, mode_w[8], mode_r[8]; + bam1_t *b; + + flt_flag = UPDATE_NM | UPDATE_MD; + is_bam_out = is_sam_in = is_uncompressed = is_realn = max_nm = capQ = baq_flag = 0; + mode_w[0] = mode_r[0] = 0; + strcpy(mode_r, "r"); strcpy(mode_w, "w"); + while ((c = getopt(argc, argv, "EqreuNhbSC:n:Ad")) >= 0) { + switch (c) { + case 'r': is_realn = 1; break; + case 'e': flt_flag |= USE_EQUAL; break; + case 'd': flt_flag |= DROP_TAG; break; + case 'q': flt_flag |= BIN_QUAL; break; + case 'h': flt_flag |= HASH_QNM; break; + case 'N': flt_flag &= ~(UPDATE_MD|UPDATE_NM); break; + case 'b': is_bam_out = 1; break; + case 'u': is_uncompressed = is_bam_out = 1; break; + case 'S': is_sam_in = 1; break; + case 'n': max_nm = atoi(optarg); break; + case 'C': capQ = atoi(optarg); break; + case 'A': baq_flag |= 1; break; + case 'E': baq_flag |= 2; break; + default: fprintf(pysamerr, "[bam_fillmd] unrecognized option '-%c'\n", c); return 1; + } + } + if (!is_sam_in) strcat(mode_r, "b"); + if (is_bam_out) strcat(mode_w, "b"); + else strcat(mode_w, "h"); + if (is_uncompressed) strcat(mode_w, "u"); + if (optind + 1 >= argc) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools fillmd [-eubrS] \n\n"); + fprintf(pysamerr, "Options: -e change identical bases to '='\n"); + fprintf(pysamerr, " -u uncompressed BAM output (for piping)\n"); + fprintf(pysamerr, " -b compressed BAM output\n"); + fprintf(pysamerr, " -S the input is SAM with header\n"); + fprintf(pysamerr, " -A modify the quality string\n"); + fprintf(pysamerr, " -r compute the BQ tag (without -A) or cap baseQ by BAQ (with -A)\n"); + fprintf(pysamerr, " -E extended BAQ for better sensitivity but lower specificity\n\n"); + return 1; + } + fp = samopen(argv[optind], mode_r, 0); + if (fp == 0) return 1; + if (is_sam_in && (fp->header == 0 || fp->header->n_targets == 0)) { + fprintf(pysamerr, "[bam_fillmd] input SAM does not have header. Abort!\n"); + return 1; + } + fpout = samopen("-", mode_w, fp->header); + fai = fai_load(argv[optind+1]); + + b = bam_init1(); + while ((ret = samread(fp, b)) >= 0) { + if (b->core.tid >= 0) { + if (tid != b->core.tid) { + free(ref); + ref = fai_fetch(fai, fp->header->target_name[b->core.tid], &len); + tid = b->core.tid; + if (ref == 0) + fprintf(pysamerr, "[bam_fillmd] fail to find sequence '%s' in the reference.\n", + fp->header->target_name[tid]); + } + if (is_realn) bam_prob_realn_core(b, ref, baq_flag); + if (capQ > 10) { + int q = bam_cap_mapQ(b, ref, capQ); + if (b->core.qual > q) b->core.qual = q; + } + if (ref) bam_fillmd1_core(b, ref, flt_flag, max_nm); + } + samwrite(fpout, b); + } + bam_destroy1(b); + + free(ref); + fai_destroy(fai); + samclose(fp); samclose(fpout); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_pileup.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_pileup.c.pysam.c new file mode 100755 index 0000000..cca29d2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_pileup.c.pysam.c @@ -0,0 +1,439 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include "sam.h" + +typedef struct { + int k, x, y, end; +} cstate_t; + +static cstate_t g_cstate_null = { -1, 0, 0, 0 }; + +typedef struct __linkbuf_t { + bam1_t b; + uint32_t beg, end; + cstate_t s; + struct __linkbuf_t *next; +} lbnode_t; + +/* --- BEGIN: Memory pool */ + +typedef struct { + int cnt, n, max; + lbnode_t **buf; +} mempool_t; + +static mempool_t *mp_init() +{ + mempool_t *mp; + mp = (mempool_t*)calloc(1, sizeof(mempool_t)); + return mp; +} +static void mp_destroy(mempool_t *mp) +{ + int k; + for (k = 0; k < mp->n; ++k) { + free(mp->buf[k]->b.data); + free(mp->buf[k]); + } + free(mp->buf); + free(mp); +} +static inline lbnode_t *mp_alloc(mempool_t *mp) +{ + ++mp->cnt; + if (mp->n == 0) return (lbnode_t*)calloc(1, sizeof(lbnode_t)); + else return mp->buf[--mp->n]; +} +static inline void mp_free(mempool_t *mp, lbnode_t *p) +{ + --mp->cnt; p->next = 0; // clear lbnode_t::next here + if (mp->n == mp->max) { + mp->max = mp->max? mp->max<<1 : 256; + mp->buf = (lbnode_t**)realloc(mp->buf, sizeof(lbnode_t*) * mp->max); + } + mp->buf[mp->n++] = p; +} + +/* --- END: Memory pool */ + +/* --- BEGIN: Auxiliary functions */ + +/* s->k: the index of the CIGAR operator that has just been processed. + s->x: the reference coordinate of the start of s->k + s->y: the query coordiante of the start of s->k + */ +static inline int resolve_cigar2(bam_pileup1_t *p, uint32_t pos, cstate_t *s) +{ +#define _cop(c) ((c)&BAM_CIGAR_MASK) +#define _cln(c) ((c)>>BAM_CIGAR_SHIFT) + + bam1_t *b = p->b; + bam1_core_t *c = &b->core; + uint32_t *cigar = bam1_cigar(b); + int k, is_head = 0; + // determine the current CIGAR operation +// fprintf(pysamerr, "%s\tpos=%d\tend=%d\t(%d,%d,%d)\n", bam1_qname(b), pos, s->end, s->k, s->x, s->y); + if (s->k == -1) { // never processed + is_head = 1; + if (c->n_cigar == 1) { // just one operation, save a loop + if (_cop(cigar[0]) == BAM_CMATCH || _cop(cigar[0]) == BAM_CEQUAL || _cop(cigar[0]) == BAM_CDIFF) s->k = 0, s->x = c->pos, s->y = 0; + } else { // find the first match or deletion + for (k = 0, s->x = c->pos, s->y = 0; k < c->n_cigar; ++k) { + int op = _cop(cigar[k]); + int l = _cln(cigar[k]); + if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CEQUAL || op == BAM_CDIFF) break; + else if (op == BAM_CREF_SKIP) s->x += l; + else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) s->y += l; + } + assert(k < c->n_cigar); + s->k = k; + } + } else { // the read has been processed before + int op, l = _cln(cigar[s->k]); + if (pos - s->x >= l) { // jump to the next operation + assert(s->k < c->n_cigar); // otherwise a bug: this function should not be called in this case + op = _cop(cigar[s->k+1]); + if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP || op == BAM_CEQUAL || op == BAM_CDIFF) { // jump to the next without a loop + if (_cop(cigar[s->k]) == BAM_CMATCH|| _cop(cigar[s->k]) == BAM_CEQUAL || _cop(cigar[s->k]) == BAM_CDIFF) s->y += l; + s->x += l; + ++s->k; + } else { // find the next M/D/N/=/X + if (_cop(cigar[s->k]) == BAM_CMATCH|| _cop(cigar[s->k]) == BAM_CEQUAL || _cop(cigar[s->k]) == BAM_CDIFF) s->y += l; + s->x += l; + for (k = s->k + 1; k < c->n_cigar; ++k) { + op = _cop(cigar[k]), l = _cln(cigar[k]); + if (op == BAM_CMATCH || op == BAM_CDEL || op == BAM_CREF_SKIP || op == BAM_CEQUAL || op == BAM_CDIFF) break; + else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) s->y += l; + } + s->k = k; + } + assert(s->k < c->n_cigar); // otherwise a bug + } // else, do nothing + } + { // collect pileup information + int op, l; + op = _cop(cigar[s->k]); l = _cln(cigar[s->k]); + p->is_del = p->indel = p->is_refskip = 0; + if (s->x + l - 1 == pos && s->k + 1 < c->n_cigar) { // peek the next operation + int op2 = _cop(cigar[s->k+1]); + int l2 = _cln(cigar[s->k+1]); + if (op2 == BAM_CDEL) p->indel = -(int)l2; + else if (op2 == BAM_CINS) p->indel = l2; + else if (op2 == BAM_CPAD && s->k + 2 < c->n_cigar) { // no working for adjacent padding + int l3 = 0; + for (k = s->k + 2; k < c->n_cigar; ++k) { + op2 = _cop(cigar[k]); l2 = _cln(cigar[k]); + if (op2 == BAM_CINS) l3 += l2; + else if (op2 == BAM_CDEL || op2 == BAM_CMATCH || op2 == BAM_CREF_SKIP || op2 == BAM_CEQUAL || op2 == BAM_CDIFF) break; + } + if (l3 > 0) p->indel = l3; + } + } + if (op == BAM_CMATCH || op == BAM_CEQUAL || op == BAM_CDIFF) { + p->qpos = s->y + (pos - s->x); + } else if (op == BAM_CDEL || op == BAM_CREF_SKIP) { + p->is_del = 1; p->qpos = s->y; // FIXME: distinguish D and N!!!!! + p->is_refskip = (op == BAM_CREF_SKIP); + } // cannot be other operations; otherwise a bug + p->is_head = (pos == c->pos); p->is_tail = (pos == s->end); + } + return 1; +} + +/* --- END: Auxiliary functions */ + +/******************* + * pileup iterator * + *******************/ + +struct __bam_plp_t { + mempool_t *mp; + lbnode_t *head, *tail, *dummy; + int32_t tid, pos, max_tid, max_pos; + int is_eof, flag_mask, max_plp, error, maxcnt; + bam_pileup1_t *plp; + // for the "auto" interface only + bam1_t *b; + bam_plp_auto_f func; + void *data; +}; + +bam_plp_t bam_plp_init(bam_plp_auto_f func, void *data) +{ + bam_plp_t iter; + iter = calloc(1, sizeof(struct __bam_plp_t)); + iter->mp = mp_init(); + iter->head = iter->tail = mp_alloc(iter->mp); + iter->dummy = mp_alloc(iter->mp); + iter->max_tid = iter->max_pos = -1; + iter->flag_mask = BAM_DEF_MASK; + iter->maxcnt = 8000; + if (func) { + iter->func = func; + iter->data = data; + iter->b = bam_init1(); + } + return iter; +} + +void bam_plp_destroy(bam_plp_t iter) +{ + mp_free(iter->mp, iter->dummy); + mp_free(iter->mp, iter->head); + if (iter->mp->cnt != 0) + fprintf(pysamerr, "[bam_plp_destroy] memory leak: %d. Continue anyway.\n", iter->mp->cnt); + mp_destroy(iter->mp); + if (iter->b) bam_destroy1(iter->b); + free(iter->plp); + free(iter); +} + +const bam_pileup1_t *bam_plp_next(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) +{ + if (iter->error) { *_n_plp = -1; return 0; } + *_n_plp = 0; + if (iter->is_eof && iter->head->next == 0) return 0; + while (iter->is_eof || iter->max_tid > iter->tid || (iter->max_tid == iter->tid && iter->max_pos > iter->pos)) { + int n_plp = 0; + lbnode_t *p, *q; + // write iter->plp at iter->pos + iter->dummy->next = iter->head; + for (p = iter->head, q = iter->dummy; p->next; q = p, p = p->next) { + if (p->b.core.tid < iter->tid || (p->b.core.tid == iter->tid && p->end <= iter->pos)) { // then remove + q->next = p->next; mp_free(iter->mp, p); p = q; + } else if (p->b.core.tid == iter->tid && p->beg <= iter->pos) { // here: p->end > pos; then add to pileup + if (n_plp == iter->max_plp) { // then double the capacity + iter->max_plp = iter->max_plp? iter->max_plp<<1 : 256; + iter->plp = (bam_pileup1_t*)realloc(iter->plp, sizeof(bam_pileup1_t) * iter->max_plp); + } + iter->plp[n_plp].b = &p->b; + if (resolve_cigar2(iter->plp + n_plp, iter->pos, &p->s)) ++n_plp; // actually always true... + } + } + iter->head = iter->dummy->next; // dummy->next may be changed + *_n_plp = n_plp; *_tid = iter->tid; *_pos = iter->pos; + // update iter->tid and iter->pos + if (iter->head->next) { + if (iter->tid > iter->head->b.core.tid) { + fprintf(pysamerr, "[%s] unsorted input. Pileup aborts.\n", __func__); + iter->error = 1; + *_n_plp = -1; + return 0; + } + } + if (iter->tid < iter->head->b.core.tid) { // come to a new reference sequence + iter->tid = iter->head->b.core.tid; iter->pos = iter->head->beg; // jump to the next reference + } else if (iter->pos < iter->head->beg) { // here: tid == head->b.core.tid + iter->pos = iter->head->beg; // jump to the next position + } else ++iter->pos; // scan contiguously + // return + if (n_plp) return iter->plp; + if (iter->is_eof && iter->head->next == 0) break; + } + return 0; +} + +int bam_plp_push(bam_plp_t iter, const bam1_t *b) +{ + if (iter->error) return -1; + if (b) { + if (b->core.tid < 0) return 0; + if (b->core.flag & iter->flag_mask) return 0; + if (iter->tid == b->core.tid && iter->pos == b->core.pos && iter->mp->cnt > iter->maxcnt) return 0; + bam_copy1(&iter->tail->b, b); + iter->tail->beg = b->core.pos; iter->tail->end = bam_calend(&b->core, bam1_cigar(b)); + iter->tail->s = g_cstate_null; iter->tail->s.end = iter->tail->end - 1; // initialize cstate_t + if (b->core.tid < iter->max_tid) { + fprintf(pysamerr, "[bam_pileup_core] the input is not sorted (chromosomes out of order)\n"); + iter->error = 1; + return -1; + } + if ((b->core.tid == iter->max_tid) && (iter->tail->beg < iter->max_pos)) { + fprintf(pysamerr, "[bam_pileup_core] the input is not sorted (reads out of order)\n"); + iter->error = 1; + return -1; + } + iter->max_tid = b->core.tid; iter->max_pos = iter->tail->beg; + if (iter->tail->end > iter->pos || iter->tail->b.core.tid > iter->tid) { + iter->tail->next = mp_alloc(iter->mp); + iter->tail = iter->tail->next; + } + } else iter->is_eof = 1; + return 0; +} + +const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp) +{ + const bam_pileup1_t *plp; + if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; } + if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; + else { // no pileup line can be obtained; read alignments + *_n_plp = 0; + if (iter->is_eof) return 0; + while (iter->func(iter->data, iter->b) >= 0) { + if (bam_plp_push(iter, iter->b) < 0) { + *_n_plp = -1; + return 0; + } + if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; + // otherwise no pileup line can be returned; read the next alignment. + } + bam_plp_push(iter, 0); + if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp; + return 0; + } +} + +void bam_plp_reset(bam_plp_t iter) +{ + lbnode_t *p, *q; + iter->max_tid = iter->max_pos = -1; + iter->tid = iter->pos = 0; + iter->is_eof = 0; + for (p = iter->head; p->next;) { + q = p->next; + mp_free(iter->mp, p); + p = q; + } + iter->head = iter->tail; +} + +void bam_plp_set_mask(bam_plp_t iter, int mask) +{ + iter->flag_mask = mask < 0? BAM_DEF_MASK : (BAM_FUNMAP | mask); +} + +void bam_plp_set_maxcnt(bam_plp_t iter, int maxcnt) +{ + iter->maxcnt = maxcnt; +} + +/***************** + * callback APIs * + *****************/ + +int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data) +{ + bam_plbuf_t *buf; + int ret; + bam1_t *b; + b = bam_init1(); + buf = bam_plbuf_init(func, func_data); + bam_plbuf_set_mask(buf, mask); + while ((ret = bam_read1(fp, b)) >= 0) + bam_plbuf_push(b, buf); + bam_plbuf_push(0, buf); + bam_plbuf_destroy(buf); + bam_destroy1(b); + return 0; +} + +void bam_plbuf_set_mask(bam_plbuf_t *buf, int mask) +{ + bam_plp_set_mask(buf->iter, mask); +} + +void bam_plbuf_reset(bam_plbuf_t *buf) +{ + bam_plp_reset(buf->iter); +} + +bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data) +{ + bam_plbuf_t *buf; + buf = calloc(1, sizeof(bam_plbuf_t)); + buf->iter = bam_plp_init(0, 0); + buf->func = func; + buf->data = data; + return buf; +} + +void bam_plbuf_destroy(bam_plbuf_t *buf) +{ + bam_plp_destroy(buf->iter); + free(buf); +} + +int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf) +{ + int ret, n_plp, tid, pos; + const bam_pileup1_t *plp; + ret = bam_plp_push(buf->iter, b); + if (ret < 0) return ret; + while ((plp = bam_plp_next(buf->iter, &tid, &pos, &n_plp)) != 0) + buf->func(tid, pos, n_plp, plp, buf->data); + return 0; +} + +/*********** + * mpileup * + ***********/ + +struct __bam_mplp_t { + int n; + uint64_t min, *pos; + bam_plp_t *iter; + int *n_plp; + const bam_pileup1_t **plp; +}; + +bam_mplp_t bam_mplp_init(int n, bam_plp_auto_f func, void **data) +{ + int i; + bam_mplp_t iter; + iter = calloc(1, sizeof(struct __bam_mplp_t)); + iter->pos = calloc(n, 8); + iter->n_plp = calloc(n, sizeof(int)); + iter->plp = calloc(n, sizeof(void*)); + iter->iter = calloc(n, sizeof(void*)); + iter->n = n; + iter->min = (uint64_t)-1; + for (i = 0; i < n; ++i) { + iter->iter[i] = bam_plp_init(func, data[i]); + iter->pos[i] = iter->min; + } + return iter; +} + +void bam_mplp_set_maxcnt(bam_mplp_t iter, int maxcnt) +{ + int i; + for (i = 0; i < iter->n; ++i) + iter->iter[i]->maxcnt = maxcnt; +} + +void bam_mplp_destroy(bam_mplp_t iter) +{ + int i; + for (i = 0; i < iter->n; ++i) bam_plp_destroy(iter->iter[i]); + free(iter->iter); free(iter->pos); free(iter->n_plp); free(iter->plp); + free(iter); +} + +int bam_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp) +{ + int i, ret = 0; + uint64_t new_min = (uint64_t)-1; + for (i = 0; i < iter->n; ++i) { + if (iter->pos[i] == iter->min) { + int tid, pos; + iter->plp[i] = bam_plp_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]); + iter->pos[i] = (uint64_t)tid<<32 | pos; + } + if (iter->plp[i] && iter->pos[i] < new_min) new_min = iter->pos[i]; + } + iter->min = new_min; + if (new_min == (uint64_t)-1) return 0; + *_tid = new_min>>32; *_pos = (uint32_t)new_min; + for (i = 0; i < iter->n; ++i) { + if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line" + n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i]; + ++ret; + } else n_plp[i] = 0, plp[i] = 0; + } + return ret; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_plcmd.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_plcmd.c.pysam.c new file mode 100755 index 0000000..473d409 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_plcmd.c.pysam.c @@ -0,0 +1,548 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include "sam.h" +#include "faidx.h" +#include "kstring.h" + +static inline int printw(int c, FILE *fp) +{ + char buf[16]; + int l, x; + if (c == 0) return fputc('0', fp); + for (l = 0, x = c < 0? -c : c; x > 0; x /= 10) buf[l++] = x%10 + '0'; + if (c < 0) buf[l++] = '-'; + buf[l] = 0; + for (x = 0; x < l/2; ++x) { + int y = buf[x]; buf[x] = buf[l-1-x]; buf[l-1-x] = y; + } + fputs(buf, fp); + return 0; +} + +static inline void pileup_seq(const bam_pileup1_t *p, int pos, int ref_len, const char *ref) +{ + int j; + if (p->is_head) { + putchar('^'); + putchar(p->b->core.qual > 93? 126 : p->b->core.qual + 33); + } + if (!p->is_del) { + int c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; + if (ref) { + int rb = pos < ref_len? ref[pos] : 'N'; + if (c == '=' || bam_nt16_table[c] == bam_nt16_table[rb]) c = bam1_strand(p->b)? ',' : '.'; + else c = bam1_strand(p->b)? tolower(c) : toupper(c); + } else { + if (c == '=') c = bam1_strand(p->b)? ',' : '.'; + else c = bam1_strand(p->b)? tolower(c) : toupper(c); + } + putchar(c); + } else putchar(p->is_refskip? (bam1_strand(p->b)? '<' : '>') : '*'); + if (p->indel > 0) { + putchar('+'); printw(p->indel, stdout); + for (j = 1; j <= p->indel; ++j) { + int c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos + j)]; + putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); + } + } else if (p->indel < 0) { + printw(p->indel, stdout); + for (j = 1; j <= -p->indel; ++j) { + int c = (ref && (int)pos+j < ref_len)? ref[pos+j] : 'N'; + putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); + } + } + if (p->is_tail) putchar('$'); +} + +#include +#include "bam2bcf.h" +#include "sample.h" + +#define MPLP_GLF 0x10 +#define MPLP_NO_COMP 0x20 +#define MPLP_NO_ORPHAN 0x40 +#define MPLP_REALN 0x80 +#define MPLP_FMT_DP 0x100 +#define MPLP_FMT_SP 0x200 +#define MPLP_NO_INDEL 0x400 +#define MPLP_EXT_BAQ 0x800 +#define MPLP_ILLUMINA13 0x1000 +#define MPLP_IGNORE_RG 0x2000 +#define MPLP_PRINT_POS 0x4000 +#define MPLP_PRINT_MAPQ 0x8000 + +void *bed_read(const char *fn); +void bed_destroy(void *_h); +int bed_overlap(const void *_h, const char *chr, int beg, int end); + +typedef struct { + int max_mq, min_mq, flag, min_baseQ, capQ_thres, max_depth, max_indel_depth; + int openQ, extQ, tandemQ, min_support; // for indels + double min_frac; // for indels + char *reg, *pl_list; + faidx_t *fai; + void *bed, *rghash; +} mplp_conf_t; + +typedef struct { + bamFile fp; + bam_iter_t iter; + bam_header_t *h; + int ref_id; + char *ref; + const mplp_conf_t *conf; +} mplp_aux_t; + +typedef struct { + int n; + int *n_plp, *m_plp; + bam_pileup1_t **plp; +} mplp_pileup_t; + +static int mplp_func(void *data, bam1_t *b) +{ + extern int bam_realn(bam1_t *b, const char *ref); + extern int bam_prob_realn_core(bam1_t *b, const char *ref, int); + extern int bam_cap_mapQ(bam1_t *b, char *ref, int thres); + mplp_aux_t *ma = (mplp_aux_t*)data; + int ret, skip = 0; + do { + int has_ref; + ret = ma->iter? bam_iter_read(ma->fp, ma->iter, b) : bam_read1(ma->fp, b); + if (ret < 0) break; + if (b->core.tid < 0 || (b->core.flag&BAM_FUNMAP)) { // exclude unmapped reads + skip = 1; + continue; + } + if (ma->conf->bed) { // test overlap + skip = !bed_overlap(ma->conf->bed, ma->h->target_name[b->core.tid], b->core.pos, bam_calend(&b->core, bam1_cigar(b))); + if (skip) continue; + } + if (ma->conf->rghash) { // exclude read groups + uint8_t *rg = bam_aux_get(b, "RG"); + skip = (rg && bcf_str2id(ma->conf->rghash, (const char*)(rg+1)) >= 0); + if (skip) continue; + } + if (ma->conf->flag & MPLP_ILLUMINA13) { + int i; + uint8_t *qual = bam1_qual(b); + for (i = 0; i < b->core.l_qseq; ++i) + qual[i] = qual[i] > 31? qual[i] - 31 : 0; + } + has_ref = (ma->ref && ma->ref_id == b->core.tid)? 1 : 0; + skip = 0; + if (has_ref && (ma->conf->flag&MPLP_REALN)) bam_prob_realn_core(b, ma->ref, (ma->conf->flag & MPLP_EXT_BAQ)? 3 : 1); + if (has_ref && ma->conf->capQ_thres > 10) { + int q = bam_cap_mapQ(b, ma->ref, ma->conf->capQ_thres); + if (q < 0) skip = 1; + else if (b->core.qual > q) b->core.qual = q; + } + else if (b->core.qual < ma->conf->min_mq) skip = 1; + else if ((ma->conf->flag&MPLP_NO_ORPHAN) && (b->core.flag&1) && !(b->core.flag&2)) skip = 1; + } while (skip); + return ret; +} + +static void group_smpl(mplp_pileup_t *m, bam_sample_t *sm, kstring_t *buf, + int n, char *const*fn, int *n_plp, const bam_pileup1_t **plp, int ignore_rg) +{ + int i, j; + memset(m->n_plp, 0, m->n * sizeof(int)); + for (i = 0; i < n; ++i) { + for (j = 0; j < n_plp[i]; ++j) { + const bam_pileup1_t *p = plp[i] + j; + uint8_t *q; + int id = -1; + q = ignore_rg? 0 : bam_aux_get(p->b, "RG"); + if (q) id = bam_smpl_rg2smid(sm, fn[i], (char*)q+1, buf); + if (id < 0) id = bam_smpl_rg2smid(sm, fn[i], 0, buf); + if (id < 0 || id >= m->n) { + assert(q); // otherwise a bug + fprintf(pysamerr, "[%s] Read group %s used in file %s but absent from the header or an alignment missing read group.\n", __func__, (char*)q+1, fn[i]); + exit(1); + } + if (m->n_plp[id] == m->m_plp[id]) { + m->m_plp[id] = m->m_plp[id]? m->m_plp[id]<<1 : 8; + m->plp[id] = realloc(m->plp[id], sizeof(bam_pileup1_t) * m->m_plp[id]); + } + m->plp[id][m->n_plp[id]++] = *p; + } + } +} + +static int mpileup(mplp_conf_t *conf, int n, char **fn) +{ + extern void *bcf_call_add_rg(void *rghash, const char *hdtext, const char *list); + extern void bcf_call_del_rghash(void *rghash); + mplp_aux_t **data; + int i, tid, pos, *n_plp, tid0 = -1, beg0 = 0, end0 = 1u<<29, ref_len, ref_tid = -1, max_depth, max_indel_depth; + const bam_pileup1_t **plp; + bam_mplp_t iter; + bam_header_t *h = 0; + char *ref; + void *rghash = 0; + + bcf_callaux_t *bca = 0; + bcf_callret1_t *bcr = 0; + bcf_call_t bc; + bcf_t *bp = 0; + bcf_hdr_t *bh = 0; + + bam_sample_t *sm = 0; + kstring_t buf; + mplp_pileup_t gplp; + + memset(&gplp, 0, sizeof(mplp_pileup_t)); + memset(&buf, 0, sizeof(kstring_t)); + memset(&bc, 0, sizeof(bcf_call_t)); + data = calloc(n, sizeof(void*)); + plp = calloc(n, sizeof(void*)); + n_plp = calloc(n, sizeof(int*)); + sm = bam_smpl_init(); + + // read the header and initialize data + for (i = 0; i < n; ++i) { + bam_header_t *h_tmp; + data[i] = calloc(1, sizeof(mplp_aux_t)); + data[i]->fp = strcmp(fn[i], "-") == 0? bam_dopen(fileno(stdin), "r") : bam_open(fn[i], "r"); + data[i]->conf = conf; + h_tmp = bam_header_read(data[i]->fp); + data[i]->h = i? h : h_tmp; // for i==0, "h" has not been set yet + bam_smpl_add(sm, fn[i], (conf->flag&MPLP_IGNORE_RG)? 0 : h_tmp->text); + rghash = bcf_call_add_rg(rghash, h_tmp->text, conf->pl_list); + if (conf->reg) { + int beg, end; + bam_index_t *idx; + idx = bam_index_load(fn[i]); + if (idx == 0) { + fprintf(pysamerr, "[%s] fail to load index for %d-th input.\n", __func__, i+1); + exit(1); + } + if (bam_parse_region(h_tmp, conf->reg, &tid, &beg, &end) < 0) { + fprintf(pysamerr, "[%s] malformatted region or wrong seqname for %d-th input.\n", __func__, i+1); + exit(1); + } + if (i == 0) tid0 = tid, beg0 = beg, end0 = end; + data[i]->iter = bam_iter_query(idx, tid, beg, end); + bam_index_destroy(idx); + } + if (i == 0) h = h_tmp; + else { + // FIXME: to check consistency + bam_header_destroy(h_tmp); + } + } + gplp.n = sm->n; + gplp.n_plp = calloc(sm->n, sizeof(int)); + gplp.m_plp = calloc(sm->n, sizeof(int)); + gplp.plp = calloc(sm->n, sizeof(void*)); + + fprintf(pysamerr, "[%s] %d samples in %d input files\n", __func__, sm->n, n); + // write the VCF header + if (conf->flag & MPLP_GLF) { + kstring_t s; + bh = calloc(1, sizeof(bcf_hdr_t)); + s.l = s.m = 0; s.s = 0; + bp = bcf_open("-", (conf->flag&MPLP_NO_COMP)? "wu" : "w"); + for (i = 0; i < h->n_targets; ++i) { + kputs(h->target_name[i], &s); + kputc('\0', &s); + } + bh->l_nm = s.l; + bh->name = malloc(s.l); + memcpy(bh->name, s.s, s.l); + s.l = 0; + for (i = 0; i < sm->n; ++i) { + kputs(sm->smpl[i], &s); kputc('\0', &s); + } + bh->l_smpl = s.l; + bh->sname = malloc(s.l); + memcpy(bh->sname, s.s, s.l); + bh->txt = malloc(strlen(BAM_VERSION) + 64); + bh->l_txt = 1 + sprintf(bh->txt, "##samtoolsVersion=%s\n", BAM_VERSION); + free(s.s); + bcf_hdr_sync(bh); + bcf_hdr_write(bp, bh); + bca = bcf_call_init(-1., conf->min_baseQ); + bcr = calloc(sm->n, sizeof(bcf_callret1_t)); + bca->rghash = rghash; + bca->openQ = conf->openQ, bca->extQ = conf->extQ, bca->tandemQ = conf->tandemQ; + bca->min_frac = conf->min_frac; + bca->min_support = conf->min_support; + } + if (tid0 >= 0 && conf->fai) { // region is set + ref = faidx_fetch_seq(conf->fai, h->target_name[tid0], 0, 0x7fffffff, &ref_len); + ref_tid = tid0; + for (i = 0; i < n; ++i) data[i]->ref = ref, data[i]->ref_id = tid0; + } else ref_tid = -1, ref = 0; + iter = bam_mplp_init(n, mplp_func, (void**)data); + max_depth = conf->max_depth; + if (max_depth * sm->n > 1<<20) + fprintf(pysamerr, "(%s) Max depth is above 1M. Potential memory hog!\n", __func__); + if (max_depth * sm->n < 8000) { + max_depth = 8000 / sm->n; + fprintf(pysamerr, "<%s> Set max per-file depth to %d\n", __func__, max_depth); + } + max_indel_depth = conf->max_indel_depth * sm->n; + bam_mplp_set_maxcnt(iter, max_depth); + while (bam_mplp_auto(iter, &tid, &pos, n_plp, plp) > 0) { + if (conf->reg && (pos < beg0 || pos >= end0)) continue; // out of the region requested + if (conf->bed && tid >= 0 && !bed_overlap(conf->bed, h->target_name[tid], pos, pos+1)) continue; + if (tid != ref_tid) { + free(ref); ref = 0; + if (conf->fai) ref = faidx_fetch_seq(conf->fai, h->target_name[tid], 0, 0x7fffffff, &ref_len); + for (i = 0; i < n; ++i) data[i]->ref = ref, data[i]->ref_id = tid; + ref_tid = tid; + } + if (conf->flag & MPLP_GLF) { + int total_depth, _ref0, ref16; + bcf1_t *b = calloc(1, sizeof(bcf1_t)); + for (i = total_depth = 0; i < n; ++i) total_depth += n_plp[i]; + group_smpl(&gplp, sm, &buf, n, fn, n_plp, plp, conf->flag & MPLP_IGNORE_RG); + _ref0 = (ref && pos < ref_len)? ref[pos] : 'N'; + ref16 = bam_nt16_table[_ref0]; + for (i = 0; i < gplp.n; ++i) + bcf_call_glfgen(gplp.n_plp[i], gplp.plp[i], ref16, bca, bcr + i); + bcf_call_combine(gplp.n, bcr, ref16, &bc); + bcf_call2bcf(tid, pos, &bc, b, (conf->flag&(MPLP_FMT_DP|MPLP_FMT_SP))? bcr : 0, + (conf->flag&MPLP_FMT_SP), 0, 0); + bcf_write(bp, bh, b); + bcf_destroy(b); + // call indels + if (!(conf->flag&MPLP_NO_INDEL) && total_depth < max_indel_depth && bcf_call_gap_prep(gplp.n, gplp.n_plp, gplp.plp, pos, bca, ref, rghash) >= 0) { + for (i = 0; i < gplp.n; ++i) + bcf_call_glfgen(gplp.n_plp[i], gplp.plp[i], -1, bca, bcr + i); + if (bcf_call_combine(gplp.n, bcr, -1, &bc) >= 0) { + b = calloc(1, sizeof(bcf1_t)); + bcf_call2bcf(tid, pos, &bc, b, (conf->flag&(MPLP_FMT_DP|MPLP_FMT_SP))? bcr : 0, + (conf->flag&MPLP_FMT_SP), bca, ref); + bcf_write(bp, bh, b); + bcf_destroy(b); + } + } + } else { + printf("%s\t%d\t%c", h->target_name[tid], pos + 1, (ref && pos < ref_len)? ref[pos] : 'N'); + for (i = 0; i < n; ++i) { + int j; + printf("\t%d\t", n_plp[i]); + if (n_plp[i] == 0) { + printf("*\t*"); // FIXME: printf() is very slow... + if (conf->flag & MPLP_PRINT_POS) printf("\t*"); + } else { + for (j = 0; j < n_plp[i]; ++j) + pileup_seq(plp[i] + j, pos, ref_len, ref); + putchar('\t'); + for (j = 0; j < n_plp[i]; ++j) { + const bam_pileup1_t *p = plp[i] + j; + int c = bam1_qual(p->b)[p->qpos] + 33; + if (c > 126) c = 126; + putchar(c); + } + if (conf->flag & MPLP_PRINT_MAPQ) { + putchar('\t'); + for (j = 0; j < n_plp[i]; ++j) { + int c = plp[i][j].b->core.qual + 33; + if (c > 126) c = 126; + putchar(c); + } + } + if (conf->flag & MPLP_PRINT_POS) { + putchar('\t'); + for (j = 0; j < n_plp[i]; ++j) { + if (j > 0) putchar(','); + printf("%d", plp[i][j].qpos + 1); // FIXME: printf() is very slow... + } + } + } + } + putchar('\n'); + } + } + + bcf_close(bp); + bam_smpl_destroy(sm); free(buf.s); + for (i = 0; i < gplp.n; ++i) free(gplp.plp[i]); + free(gplp.plp); free(gplp.n_plp); free(gplp.m_plp); + bcf_call_del_rghash(rghash); + bcf_hdr_destroy(bh); bcf_call_destroy(bca); free(bc.PL); free(bcr); + bam_mplp_destroy(iter); + bam_header_destroy(h); + for (i = 0; i < n; ++i) { + bam_close(data[i]->fp); + if (data[i]->iter) bam_iter_destroy(data[i]->iter); + free(data[i]); + } + free(data); free(plp); free(ref); free(n_plp); + return 0; +} + +#define MAX_PATH_LEN 1024 +static int read_file_list(const char *file_list,int *n,char **argv[]) +{ + char buf[MAX_PATH_LEN]; + int len, nfiles; + char **files; + + FILE *fh = fopen(file_list,"r"); + if ( !fh ) + { + fprintf(pysamerr,"%s: %s\n", file_list,strerror(errno)); + return 1; + } + + // Speed is not an issue here, determine the number of files by reading the file twice + nfiles = 0; + while ( fgets(buf,MAX_PATH_LEN,fh) ) nfiles++; + + if ( fseek(fh, 0L, SEEK_SET) ) + { + fprintf(pysamerr,"%s: %s\n", file_list,strerror(errno)); + return 1; + } + + files = calloc(nfiles,sizeof(char*)); + nfiles = 0; + while ( fgets(buf,MAX_PATH_LEN,fh) ) + { + len = strlen(buf); + while ( len>0 && isspace(buf[len-1]) ) len--; + if ( !len ) continue; + + files[nfiles] = malloc(sizeof(char)*(len+1)); + strncpy(files[nfiles],buf,len); + files[nfiles][len] = 0; + nfiles++; + } + fclose(fh); + if ( !nfiles ) + { + fprintf(pysamerr,"No files read from %s\n", file_list); + return 1; + } + *argv = files; + *n = nfiles; + return 0; +} +#undef MAX_PATH_LEN + +int bam_mpileup(int argc, char *argv[]) +{ + int c; + const char *file_list = NULL; + char **fn = NULL; + int nfiles = 0, use_orphan = 0; + mplp_conf_t mplp; + memset(&mplp, 0, sizeof(mplp_conf_t)); + #define MPLP_PRINT_POS 0x4000 + mplp.max_mq = 60; + mplp.min_baseQ = 13; + mplp.capQ_thres = 0; + mplp.max_depth = 250; mplp.max_indel_depth = 250; + mplp.openQ = 40; mplp.extQ = 20; mplp.tandemQ = 100; + mplp.min_frac = 0.002; mplp.min_support = 1; + mplp.flag = MPLP_NO_ORPHAN | MPLP_REALN; + while ((c = getopt(argc, argv, "Agf:r:l:M:q:Q:uaRC:BDSd:L:b:P:o:e:h:Im:F:EG:6Os")) >= 0) { + switch (c) { + case 'f': + mplp.fai = fai_load(optarg); + if (mplp.fai == 0) return 1; + break; + case 'd': mplp.max_depth = atoi(optarg); break; + case 'r': mplp.reg = strdup(optarg); break; + case 'l': mplp.bed = bed_read(optarg); break; + case 'P': mplp.pl_list = strdup(optarg); break; + case 'g': mplp.flag |= MPLP_GLF; break; + case 'u': mplp.flag |= MPLP_NO_COMP | MPLP_GLF; break; + case 'a': mplp.flag |= MPLP_NO_ORPHAN | MPLP_REALN; break; + case 'B': mplp.flag &= ~MPLP_REALN; break; + case 'D': mplp.flag |= MPLP_FMT_DP; break; + case 'S': mplp.flag |= MPLP_FMT_SP; break; + case 'I': mplp.flag |= MPLP_NO_INDEL; break; + case 'E': mplp.flag |= MPLP_EXT_BAQ; break; + case '6': mplp.flag |= MPLP_ILLUMINA13; break; + case 'R': mplp.flag |= MPLP_IGNORE_RG; break; + case 's': mplp.flag |= MPLP_PRINT_MAPQ; break; + case 'O': mplp.flag |= MPLP_PRINT_POS; break; + case 'C': mplp.capQ_thres = atoi(optarg); break; + case 'M': mplp.max_mq = atoi(optarg); break; + case 'q': mplp.min_mq = atoi(optarg); break; + case 'Q': mplp.min_baseQ = atoi(optarg); break; + case 'b': file_list = optarg; break; + case 'o': mplp.openQ = atoi(optarg); break; + case 'e': mplp.extQ = atoi(optarg); break; + case 'h': mplp.tandemQ = atoi(optarg); break; + case 'A': use_orphan = 1; break; + case 'F': mplp.min_frac = atof(optarg); break; + case 'm': mplp.min_support = atoi(optarg); break; + case 'L': mplp.max_indel_depth = atoi(optarg); break; + case 'G': { + FILE *fp_rg; + char buf[1024]; + mplp.rghash = bcf_str2id_init(); + if ((fp_rg = fopen(optarg, "r")) == 0) + fprintf(pysamerr, "(%s) Fail to open file %s. Continue anyway.\n", __func__, optarg); + while (!feof(fp_rg) && fscanf(fp_rg, "%s", buf) > 0) // this is not a good style, but forgive me... + bcf_str2id_add(mplp.rghash, strdup(buf)); + fclose(fp_rg); + } + break; + } + } + if (use_orphan) mplp.flag &= ~MPLP_NO_ORPHAN; + if (argc == 1) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools mpileup [options] in1.bam [in2.bam [...]]\n\n"); + fprintf(pysamerr, "Input options:\n\n"); + fprintf(pysamerr, " -6 assume the quality is in the Illumina-1.3+ encoding\n"); + fprintf(pysamerr, " -A count anomalous read pairs\n"); + fprintf(pysamerr, " -B disable BAQ computation\n"); + fprintf(pysamerr, " -b FILE list of input BAM files [null]\n"); + fprintf(pysamerr, " -C INT parameter for adjusting mapQ; 0 to disable [0]\n"); + fprintf(pysamerr, " -d INT max per-BAM depth to avoid excessive memory usage [%d]\n", mplp.max_depth); + fprintf(pysamerr, " -E extended BAQ for higher sensitivity but lower specificity\n"); + fprintf(pysamerr, " -f FILE faidx indexed reference sequence file [null]\n"); + fprintf(pysamerr, " -G FILE exclude read groups listed in FILE [null]\n"); + fprintf(pysamerr, " -l FILE list of positions (chr pos) or regions (BED) [null]\n"); + fprintf(pysamerr, " -M INT cap mapping quality at INT [%d]\n", mplp.max_mq); + fprintf(pysamerr, " -r STR region in which pileup is generated [null]\n"); + fprintf(pysamerr, " -R ignore RG tags\n"); + fprintf(pysamerr, " -q INT skip alignments with mapQ smaller than INT [%d]\n", mplp.min_mq); + fprintf(pysamerr, " -Q INT skip bases with baseQ/BAQ smaller than INT [%d]\n", mplp.min_baseQ); + fprintf(pysamerr, "\nOutput options:\n\n"); + fprintf(pysamerr, " -D output per-sample DP in BCF (require -g/-u)\n"); + fprintf(pysamerr, " -g generate BCF output (genotype likelihoods)\n"); + fprintf(pysamerr, " -O output base positions on reads (disabled by -g/-u)\n"); + fprintf(pysamerr, " -s output mapping quality (disabled by -g/-u)\n"); + fprintf(pysamerr, " -S output per-sample strand bias P-value in BCF (require -g/-u)\n"); + fprintf(pysamerr, " -u generate uncompress BCF output\n"); + fprintf(pysamerr, "\nSNP/INDEL genotype likelihoods options (effective with `-g' or `-u'):\n\n"); + fprintf(pysamerr, " -e INT Phred-scaled gap extension seq error probability [%d]\n", mplp.extQ); + fprintf(pysamerr, " -F FLOAT minimum fraction of gapped reads for candidates [%g]\n", mplp.min_frac); + fprintf(pysamerr, " -h INT coefficient for homopolymer errors [%d]\n", mplp.tandemQ); + fprintf(pysamerr, " -I do not perform indel calling\n"); + fprintf(pysamerr, " -L INT max per-sample depth for INDEL calling [%d]\n", mplp.max_indel_depth); + fprintf(pysamerr, " -m INT minimum gapped reads for indel candidates [%d]\n", mplp.min_support); + fprintf(pysamerr, " -o INT Phred-scaled gap open sequencing error probability [%d]\n", mplp.openQ); + fprintf(pysamerr, " -P STR comma separated list of platforms for indels [all]\n"); + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Notes: Assuming diploid individuals.\n\n"); + return 1; + } + if (file_list) { + if ( read_file_list(file_list,&nfiles,&fn) ) return 1; + mpileup(&mplp,nfiles,fn); + for (c=0; c +#include +#include "bgzf.h" +#include "bam.h" + +#define BUF_SIZE 0x10000 + +int bam_reheader(BGZF *in, const bam_header_t *h, int fd) +{ + BGZF *fp; + bam_header_t *old; + int len; + uint8_t *buf; + if (in->open_mode != 'r') return -1; + buf = malloc(BUF_SIZE); + old = bam_header_read(in); + fp = bgzf_fdopen(fd, "w"); + bam_header_write(fp, h); + if (in->block_offset < in->block_length) { + bgzf_write(fp, in->uncompressed_block + in->block_offset, in->block_length - in->block_offset); + bgzf_flush(fp); + } +#ifdef _USE_KNETFILE + while ((len = knet_read(in->x.fpr, buf, BUF_SIZE)) > 0) + fwrite(buf, 1, len, fp->x.fpw); +#else + while (!feof(in->file) && (len = fread(buf, 1, BUF_SIZE, in->file)) > 0) + fwrite(buf, 1, len, fp->file); +#endif + free(buf); + fp->block_offset = in->block_offset = 0; + bgzf_close(fp); + return 0; +} + +int main_reheader(int argc, char *argv[]) +{ + bam_header_t *h; + BGZF *in; + if (argc != 3) { + fprintf(pysamerr, "Usage: samtools reheader \n"); + return 1; + } + { // read the header + tamFile fph = sam_open(argv[1]); + if (fph == 0) { + fprintf(pysamerr, "[%s] fail to read the header from %s.\n", __func__, argv[1]); + return 1; + } + h = sam_header_read(fph); + sam_close(fph); + } + in = strcmp(argv[2], "-")? bam_open(argv[2], "r") : bam_dopen(fileno(stdin), "r"); + if (in == 0) { + fprintf(pysamerr, "[%s] fail to open file %s.\n", __func__, argv[2]); + return 1; + } + bam_reheader(in, h, fileno(stdout)); + bgzf_close(in); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdup.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdup.c.pysam.c new file mode 100755 index 0000000..2d5a718 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdup.c.pysam.c @@ -0,0 +1,208 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "sam.h" + +typedef bam1_t *bam1_p; + +#include "khash.h" +KHASH_SET_INIT_STR(name) +KHASH_MAP_INIT_INT64(pos, bam1_p) + +#define BUFFER_SIZE 0x40000 + +typedef struct { + uint64_t n_checked, n_removed; + khash_t(pos) *best_hash; +} lib_aux_t; +KHASH_MAP_INIT_STR(lib, lib_aux_t) + +typedef struct { + int n, max; + bam1_t **a; +} tmp_stack_t; + +static inline void stack_insert(tmp_stack_t *stack, bam1_t *b) +{ + if (stack->n == stack->max) { + stack->max = stack->max? stack->max<<1 : 0x10000; + stack->a = (bam1_t**)realloc(stack->a, sizeof(bam1_t*) * stack->max); + } + stack->a[stack->n++] = b; +} + +static inline void dump_best(tmp_stack_t *stack, samfile_t *out) +{ + int i; + for (i = 0; i != stack->n; ++i) { + samwrite(out, stack->a[i]); + bam_destroy1(stack->a[i]); + } + stack->n = 0; +} + +static void clear_del_set(khash_t(name) *del_set) +{ + khint_t k; + for (k = kh_begin(del_set); k < kh_end(del_set); ++k) + if (kh_exist(del_set, k)) + free((char*)kh_key(del_set, k)); + kh_clear(name, del_set); +} + +static lib_aux_t *get_aux(khash_t(lib) *aux, const char *lib) +{ + khint_t k = kh_get(lib, aux, lib); + if (k == kh_end(aux)) { + int ret; + char *p = strdup(lib); + lib_aux_t *q; + k = kh_put(lib, aux, p, &ret); + q = &kh_val(aux, k); + q->n_checked = q->n_removed = 0; + q->best_hash = kh_init(pos); + return q; + } else return &kh_val(aux, k); +} + +static void clear_best(khash_t(lib) *aux, int max) +{ + khint_t k; + for (k = kh_begin(aux); k != kh_end(aux); ++k) { + if (kh_exist(aux, k)) { + lib_aux_t *q = &kh_val(aux, k); + if (kh_size(q->best_hash) >= max) + kh_clear(pos, q->best_hash); + } + } +} + +static inline int sum_qual(const bam1_t *b) +{ + int i, q; + uint8_t *qual = bam1_qual(b); + for (i = q = 0; i < b->core.l_qseq; ++i) q += qual[i]; + return q; +} + +void bam_rmdup_core(samfile_t *in, samfile_t *out) +{ + bam1_t *b; + int last_tid = -1, last_pos = -1; + tmp_stack_t stack; + khint_t k; + khash_t(lib) *aux; + khash_t(name) *del_set; + + aux = kh_init(lib); + del_set = kh_init(name); + b = bam_init1(); + memset(&stack, 0, sizeof(tmp_stack_t)); + + kh_resize(name, del_set, 4 * BUFFER_SIZE); + while (samread(in, b) >= 0) { + bam1_core_t *c = &b->core; + if (c->tid != last_tid || last_pos != c->pos) { + dump_best(&stack, out); // write the result + clear_best(aux, BUFFER_SIZE); + if (c->tid != last_tid) { + clear_best(aux, 0); + if (kh_size(del_set)) { // check + fprintf(pysamerr, "[bam_rmdup_core] %llu unmatched pairs\n", (long long)kh_size(del_set)); + clear_del_set(del_set); + } + if ((int)c->tid == -1) { // append unmapped reads + samwrite(out, b); + while (samread(in, b) >= 0) samwrite(out, b); + break; + } + last_tid = c->tid; + fprintf(pysamerr, "[bam_rmdup_core] processing reference %s...\n", in->header->target_name[c->tid]); + } + } + if (!(c->flag&BAM_FPAIRED) || (c->flag&(BAM_FUNMAP|BAM_FMUNMAP)) || (c->mtid >= 0 && c->tid != c->mtid)) { + samwrite(out, b); + } else if (c->isize > 0) { // paired, head + uint64_t key = (uint64_t)c->pos<<32 | c->isize; + const char *lib; + lib_aux_t *q; + int ret; + lib = bam_get_library(in->header, b); + q = lib? get_aux(aux, lib) : get_aux(aux, "\t"); + ++q->n_checked; + k = kh_put(pos, q->best_hash, key, &ret); + if (ret == 0) { // found in best_hash + bam1_t *p = kh_val(q->best_hash, k); + ++q->n_removed; + if (sum_qual(p) < sum_qual(b)) { // the current alignment is better; this can be accelerated in principle + kh_put(name, del_set, strdup(bam1_qname(p)), &ret); // p will be removed + bam_copy1(p, b); // replaced as b + } else kh_put(name, del_set, strdup(bam1_qname(b)), &ret); // b will be removed + if (ret == 0) + fprintf(pysamerr, "[bam_rmdup_core] inconsistent BAM file for pair '%s'. Continue anyway.\n", bam1_qname(b)); + } else { // not found in best_hash + kh_val(q->best_hash, k) = bam_dup1(b); + stack_insert(&stack, kh_val(q->best_hash, k)); + } + } else { // paired, tail + k = kh_get(name, del_set, bam1_qname(b)); + if (k != kh_end(del_set)) { + free((char*)kh_key(del_set, k)); + kh_del(name, del_set, k); + } else samwrite(out, b); + } + last_pos = c->pos; + } + + for (k = kh_begin(aux); k != kh_end(aux); ++k) { + if (kh_exist(aux, k)) { + lib_aux_t *q = &kh_val(aux, k); + dump_best(&stack, out); + fprintf(pysamerr, "[bam_rmdup_core] %lld / %lld = %.4lf in library '%s'\n", (long long)q->n_removed, + (long long)q->n_checked, (double)q->n_removed/q->n_checked, kh_key(aux, k)); + kh_destroy(pos, q->best_hash); + free((char*)kh_key(aux, k)); + } + } + kh_destroy(lib, aux); + + clear_del_set(del_set); + kh_destroy(name, del_set); + free(stack.a); + bam_destroy1(b); +} + +void bam_rmdupse_core(samfile_t *in, samfile_t *out, int force_se); + +int bam_rmdup(int argc, char *argv[]) +{ + int c, is_se = 0, force_se = 0; + samfile_t *in, *out; + while ((c = getopt(argc, argv, "sS")) >= 0) { + switch (c) { + case 's': is_se = 1; break; + case 'S': force_se = is_se = 1; break; + } + } + if (optind + 2 > argc) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools rmdup [-sS] \n\n"); + fprintf(pysamerr, "Option: -s rmdup for SE reads\n"); + fprintf(pysamerr, " -S treat PE reads as SE in rmdup (force -s)\n\n"); + return 1; + } + in = samopen(argv[optind], "rb", 0); + out = samopen(argv[optind+1], "wb", in->header); + if (in == 0 || out == 0) { + fprintf(pysamerr, "[bam_rmdup] fail to read/write input files\n"); + return 1; + } + if (is_se) bam_rmdupse_core(in, out, force_se); + else bam_rmdup_core(in, out); + samclose(in); samclose(out); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdupse.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdupse.c.pysam.c new file mode 100755 index 0000000..f2cd8b7 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_rmdupse.c.pysam.c @@ -0,0 +1,161 @@ +#include "pysam.h" + +#include +#include "sam.h" +#include "khash.h" +#include "klist.h" + +#define QUEUE_CLEAR_SIZE 0x100000 +#define MAX_POS 0x7fffffff + +typedef struct { + int endpos; + uint32_t score:31, discarded:1; + bam1_t *b; +} elem_t, *elem_p; +#define __free_elem(p) bam_destroy1((p)->data.b) +KLIST_INIT(q, elem_t, __free_elem) +typedef klist_t(q) queue_t; + +KHASH_MAP_INIT_INT(best, elem_p) +typedef khash_t(best) besthash_t; + +typedef struct { + uint64_t n_checked, n_removed; + besthash_t *left, *rght; +} lib_aux_t; +KHASH_MAP_INIT_STR(lib, lib_aux_t) + +static lib_aux_t *get_aux(khash_t(lib) *aux, const char *lib) +{ + khint_t k = kh_get(lib, aux, lib); + if (k == kh_end(aux)) { + int ret; + char *p = strdup(lib); + lib_aux_t *q; + k = kh_put(lib, aux, p, &ret); + q = &kh_val(aux, k); + q->left = kh_init(best); + q->rght = kh_init(best); + q->n_checked = q->n_removed = 0; + return q; + } else return &kh_val(aux, k); +} + +static inline int sum_qual(const bam1_t *b) +{ + int i, q; + uint8_t *qual = bam1_qual(b); + for (i = q = 0; i < b->core.l_qseq; ++i) q += qual[i]; + return q; +} + +static inline elem_t *push_queue(queue_t *queue, const bam1_t *b, int endpos, int score) +{ + elem_t *p = kl_pushp(q, queue); + p->discarded = 0; + p->endpos = endpos; p->score = score; + if (p->b == 0) p->b = bam_init1(); + bam_copy1(p->b, b); + return p; +} + +static void clear_besthash(besthash_t *h, int32_t pos) +{ + khint_t k; + for (k = kh_begin(h); k != kh_end(h); ++k) + if (kh_exist(h, k) && kh_val(h, k)->endpos <= pos) + kh_del(best, h, k); +} + +static void dump_alignment(samfile_t *out, queue_t *queue, int32_t pos, khash_t(lib) *h) +{ + if (queue->size > QUEUE_CLEAR_SIZE || pos == MAX_POS) { + khint_t k; + while (1) { + elem_t *q; + if (queue->head == queue->tail) break; + q = &kl_val(queue->head); + if (q->discarded) { + q->b->data_len = 0; + kl_shift(q, queue, 0); + continue; + } + if ((q->b->core.flag&BAM_FREVERSE) && q->endpos > pos) break; + samwrite(out, q->b); + q->b->data_len = 0; + kl_shift(q, queue, 0); + } + for (k = kh_begin(h); k != kh_end(h); ++k) { + if (kh_exist(h, k)) { + clear_besthash(kh_val(h, k).left, pos); + clear_besthash(kh_val(h, k).rght, pos); + } + } + } +} + +void bam_rmdupse_core(samfile_t *in, samfile_t *out, int force_se) +{ + bam1_t *b; + queue_t *queue; + khint_t k; + int last_tid = -2; + khash_t(lib) *aux; + + aux = kh_init(lib); + b = bam_init1(); + queue = kl_init(q); + while (samread(in, b) >= 0) { + bam1_core_t *c = &b->core; + int endpos = bam_calend(c, bam1_cigar(b)); + int score = sum_qual(b); + + if (last_tid != c->tid) { + if (last_tid >= 0) dump_alignment(out, queue, MAX_POS, aux); + last_tid = c->tid; + } else dump_alignment(out, queue, c->pos, aux); + if ((c->flag&BAM_FUNMAP) || ((c->flag&BAM_FPAIRED) && !force_se)) { + push_queue(queue, b, endpos, score); + } else { + const char *lib; + lib_aux_t *q; + besthash_t *h; + uint32_t key; + int ret; + lib = bam_get_library(in->header, b); + q = lib? get_aux(aux, lib) : get_aux(aux, "\t"); + ++q->n_checked; + h = (c->flag&BAM_FREVERSE)? q->rght : q->left; + key = (c->flag&BAM_FREVERSE)? endpos : c->pos; + k = kh_put(best, h, key, &ret); + if (ret == 0) { // in the hash table + elem_t *p = kh_val(h, k); + ++q->n_removed; + if (p->score < score) { + if (c->flag&BAM_FREVERSE) { // mark "discarded" and push the queue + p->discarded = 1; + kh_val(h, k) = push_queue(queue, b, endpos, score); + } else { // replace + p->score = score; p->endpos = endpos; + bam_copy1(p->b, b); + } + } // otherwise, discard the alignment + } else kh_val(h, k) = push_queue(queue, b, endpos, score); + } + } + dump_alignment(out, queue, MAX_POS, aux); + + for (k = kh_begin(aux); k != kh_end(aux); ++k) { + if (kh_exist(aux, k)) { + lib_aux_t *q = &kh_val(aux, k); + fprintf(pysamerr, "[bam_rmdupse_core] %lld / %lld = %.4lf in library '%s'\n", (long long)q->n_removed, + (long long)q->n_checked, (double)q->n_removed/q->n_checked, kh_key(aux, k)); + kh_destroy(best, q->left); kh_destroy(best, q->rght); + free((char*)kh_key(aux, k)); + } + } + kh_destroy(lib, aux); + bam_destroy1(b); + kl_destroy(q, queue); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_sort.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_sort.c.pysam.c new file mode 100755 index 0000000..8737edc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_sort.c.pysam.c @@ -0,0 +1,440 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include +#include "bam.h" +#include "ksort.h" + +static int g_is_by_qname = 0; + +static inline int strnum_cmp(const char *a, const char *b) +{ + char *pa, *pb; + pa = (char*)a; pb = (char*)b; + while (*pa && *pb) { + if (isdigit(*pa) && isdigit(*pb)) { + long ai, bi; + ai = strtol(pa, &pa, 10); + bi = strtol(pb, &pb, 10); + if (ai != bi) return aibi? 1 : 0; + } else { + if (*pa != *pb) break; + ++pa; ++pb; + } + } + if (*pa == *pb) + return (pa-a) < (pb-b)? -1 : (pa-a) > (pb-b)? 1 : 0; + return *pa<*pb? -1 : *pa>*pb? 1 : 0; +} + +#define HEAP_EMPTY 0xffffffffffffffffull + +typedef struct { + int i; + uint64_t pos, idx; + bam1_t *b; +} heap1_t; + +#define __pos_cmp(a, b) ((a).pos > (b).pos || ((a).pos == (b).pos && ((a).i > (b).i || ((a).i == (b).i && (a).idx > (b).idx)))) + +static inline int heap_lt(const heap1_t a, const heap1_t b) +{ + if (g_is_by_qname) { + int t; + if (a.b == 0 || b.b == 0) return a.b == 0? 1 : 0; + t = strnum_cmp(bam1_qname(a.b), bam1_qname(b.b)); + return (t > 0 || (t == 0 && __pos_cmp(a, b))); + } else return __pos_cmp(a, b); +} + +KSORT_INIT(heap, heap1_t, heap_lt) + +static void swap_header_targets(bam_header_t *h1, bam_header_t *h2) +{ + bam_header_t t; + t.n_targets = h1->n_targets, h1->n_targets = h2->n_targets, h2->n_targets = t.n_targets; + t.target_name = h1->target_name, h1->target_name = h2->target_name, h2->target_name = t.target_name; + t.target_len = h1->target_len, h1->target_len = h2->target_len, h2->target_len = t.target_len; +} + +static void swap_header_text(bam_header_t *h1, bam_header_t *h2) +{ + int tempi; + char *temps; + tempi = h1->l_text, h1->l_text = h2->l_text, h2->l_text = tempi; + temps = h1->text, h1->text = h2->text, h2->text = temps; +} + +#define MERGE_RG 1 +#define MERGE_UNCOMP 2 +#define MERGE_LEVEL1 4 +#define MERGE_FORCE 8 + +/*! + @abstract Merge multiple sorted BAM. + @param is_by_qname whether to sort by query name + @param out output BAM file name + @param headers name of SAM file from which to copy '@' header lines, + or NULL to copy them from the first file to be merged + @param n number of files to be merged + @param fn names of files to be merged + + @discussion Padding information may NOT correctly maintained. This + function is NOT thread safe. + */ +int bam_merge_core(int by_qname, const char *out, const char *headers, int n, char * const *fn, + int flag, const char *reg) +{ + bamFile fpout, *fp; + heap1_t *heap; + bam_header_t *hout = 0; + bam_header_t *hheaders = NULL; + int i, j, *RG_len = 0; + uint64_t idx = 0; + char **RG = 0; + bam_iter_t *iter = 0; + + if (headers) { + tamFile fpheaders = sam_open(headers); + if (fpheaders == 0) { + const char *message = strerror(errno); + fprintf(pysamerr, "[bam_merge_core] cannot open '%s': %s\n", headers, message); + return -1; + } + hheaders = sam_header_read(fpheaders); + sam_close(fpheaders); + } + + g_is_by_qname = by_qname; + fp = (bamFile*)calloc(n, sizeof(bamFile)); + heap = (heap1_t*)calloc(n, sizeof(heap1_t)); + iter = (bam_iter_t*)calloc(n, sizeof(bam_iter_t)); + // prepare RG tag + if (flag & MERGE_RG) { + RG = (char**)calloc(n, sizeof(void*)); + RG_len = (int*)calloc(n, sizeof(int)); + for (i = 0; i != n; ++i) { + int l = strlen(fn[i]); + const char *s = fn[i]; + if (l > 4 && strcmp(s + l - 4, ".bam") == 0) l -= 4; + for (j = l - 1; j >= 0; --j) if (s[j] == '/') break; + ++j; l -= j; + RG[i] = calloc(l + 1, 1); + RG_len[i] = l; + strncpy(RG[i], s + j, l); + } + } + // read the first + for (i = 0; i != n; ++i) { + bam_header_t *hin; + fp[i] = bam_open(fn[i], "r"); + if (fp[i] == 0) { + int j; + fprintf(pysamerr, "[bam_merge_core] fail to open file %s\n", fn[i]); + for (j = 0; j < i; ++j) bam_close(fp[j]); + free(fp); free(heap); + // FIXME: possible memory leak + return -1; + } + hin = bam_header_read(fp[i]); + if (i == 0) { // the first BAM + hout = hin; + } else { // validate multiple baf + int min_n_targets = hout->n_targets; + if (hin->n_targets < min_n_targets) min_n_targets = hin->n_targets; + + for (j = 0; j < min_n_targets; ++j) + if (strcmp(hout->target_name[j], hin->target_name[j]) != 0) { + fprintf(pysamerr, "[bam_merge_core] different target sequence name: '%s' != '%s' in file '%s'\n", + hout->target_name[j], hin->target_name[j], fn[i]); + return -1; + } + + // If this input file has additional target reference sequences, + // add them to the headers to be output + if (hin->n_targets > hout->n_targets) { + swap_header_targets(hout, hin); + // FIXME Possibly we should also create @SQ text headers + // for the newly added reference sequences + } + + bam_header_destroy(hin); + } + } + + if (hheaders) { + // If the text headers to be swapped in include any @SQ headers, + // check that they are consistent with the existing binary list + // of reference information. + if (hheaders->n_targets > 0) { + if (hout->n_targets != hheaders->n_targets) { + fprintf(pysamerr, "[bam_merge_core] number of @SQ headers in '%s' differs from number of target sequences\n", headers); + if (!reg) return -1; + } + for (j = 0; j < hout->n_targets; ++j) + if (strcmp(hout->target_name[j], hheaders->target_name[j]) != 0) { + fprintf(pysamerr, "[bam_merge_core] @SQ header '%s' in '%s' differs from target sequence\n", hheaders->target_name[j], headers); + if (!reg) return -1; + } + } + + swap_header_text(hout, hheaders); + bam_header_destroy(hheaders); + } + + if (reg) { + int tid, beg, end; + if (bam_parse_region(hout, reg, &tid, &beg, &end) < 0) { + fprintf(pysamerr, "[%s] Malformated region string or undefined reference name\n", __func__); + return -1; + } + for (i = 0; i < n; ++i) { + bam_index_t *idx; + idx = bam_index_load(fn[i]); + iter[i] = bam_iter_query(idx, tid, beg, end); + bam_index_destroy(idx); + } + } + + for (i = 0; i < n; ++i) { + heap1_t *h = heap + i; + h->i = i; + h->b = (bam1_t*)calloc(1, sizeof(bam1_t)); + if (bam_iter_read(fp[i], iter[i], h->b) >= 0) { + h->pos = ((uint64_t)h->b->core.tid<<32) | (uint32_t)((int32_t)h->b->core.pos+1)<<1 | bam1_strand(h->b); + h->idx = idx++; + } + else h->pos = HEAP_EMPTY; + } + if (flag & MERGE_UNCOMP) fpout = strcmp(out, "-")? bam_open(out, "wu") : bam_dopen(fileno(stdout), "wu"); + else if (flag & MERGE_LEVEL1) fpout = strcmp(out, "-")? bam_open(out, "w1") : bam_dopen(fileno(stdout), "w1"); + else fpout = strcmp(out, "-")? bam_open(out, "w") : bam_dopen(fileno(stdout), "w"); + if (fpout == 0) { + fprintf(pysamerr, "[%s] fail to create the output file.\n", __func__); + return -1; + } + bam_header_write(fpout, hout); + bam_header_destroy(hout); + + ks_heapmake(heap, n, heap); + while (heap->pos != HEAP_EMPTY) { + bam1_t *b = heap->b; + if (flag & MERGE_RG) { + uint8_t *rg = bam_aux_get(b, "RG"); + if (rg) bam_aux_del(b, rg); + bam_aux_append(b, "RG", 'Z', RG_len[heap->i] + 1, (uint8_t*)RG[heap->i]); + } + bam_write1_core(fpout, &b->core, b->data_len, b->data); + if ((j = bam_iter_read(fp[heap->i], iter[heap->i], b)) >= 0) { + heap->pos = ((uint64_t)b->core.tid<<32) | (uint32_t)((int)b->core.pos+1)<<1 | bam1_strand(b); + heap->idx = idx++; + } else if (j == -1) { + heap->pos = HEAP_EMPTY; + free(heap->b->data); free(heap->b); + heap->b = 0; + } else fprintf(pysamerr, "[bam_merge_core] '%s' is truncated. Continue anyway.\n", fn[heap->i]); + ks_heapadjust(heap, 0, n, heap); + } + + if (flag & MERGE_RG) { + for (i = 0; i != n; ++i) free(RG[i]); + free(RG); free(RG_len); + } + for (i = 0; i != n; ++i) { + bam_iter_destroy(iter[i]); + bam_close(fp[i]); + } + bam_close(fpout); + free(fp); free(heap); free(iter); + return 0; +} + +int bam_merge(int argc, char *argv[]) +{ + int c, is_by_qname = 0, flag = 0, ret = 0; + char *fn_headers = NULL, *reg = 0; + + while ((c = getopt(argc, argv, "h:nru1R:f")) >= 0) { + switch (c) { + case 'r': flag |= MERGE_RG; break; + case 'f': flag |= MERGE_FORCE; break; + case 'h': fn_headers = strdup(optarg); break; + case 'n': is_by_qname = 1; break; + case '1': flag |= MERGE_LEVEL1; break; + case 'u': flag |= MERGE_UNCOMP; break; + case 'R': reg = strdup(optarg); break; + } + } + if (optind + 2 >= argc) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools merge [-nr] [-h inh.sam] [...]\n\n"); + fprintf(pysamerr, "Options: -n sort by read names\n"); + fprintf(pysamerr, " -r attach RG tag (inferred from file names)\n"); + fprintf(pysamerr, " -u uncompressed BAM output\n"); + fprintf(pysamerr, " -f overwrite the output BAM if exist\n"); + fprintf(pysamerr, " -1 compress level 1\n"); + fprintf(pysamerr, " -R STR merge file in the specified region STR [all]\n"); + fprintf(pysamerr, " -h FILE copy the header in FILE to [in1.bam]\n\n"); + fprintf(pysamerr, "Note: Samtools' merge does not reconstruct the @RG dictionary in the header. Users\n"); + fprintf(pysamerr, " must provide the correct header with -h, or uses Picard which properly maintains\n"); + fprintf(pysamerr, " the header dictionary in merging.\n\n"); + return 1; + } + if (!(flag & MERGE_FORCE) && strcmp(argv[optind], "-")) { + FILE *fp = fopen(argv[optind], "rb"); + if (fp != NULL) { + fclose(fp); + fprintf(pysamerr, "[%s] File '%s' exists. Please apply '-f' to overwrite. Abort.\n", __func__, argv[optind]); + return 1; + } + } + if (bam_merge_core(is_by_qname, argv[optind], fn_headers, argc - optind - 1, argv + optind + 1, flag, reg) < 0) ret = 1; + free(reg); + free(fn_headers); + return ret; +} + +typedef bam1_t *bam1_p; + +static inline int bam1_lt(const bam1_p a, const bam1_p b) +{ + if (g_is_by_qname) { + int t = strnum_cmp(bam1_qname(a), bam1_qname(b)); + return (t < 0 || (t == 0 && (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1))))); + } else return (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1))); +} +KSORT_INIT(sort, bam1_p, bam1_lt) + +static void sort_blocks(int n, int k, bam1_p *buf, const char *prefix, const bam_header_t *h, int is_stdout) +{ + char *name, mode[3]; + int i; + bamFile fp; + ks_mergesort(sort, k, buf, 0); + name = (char*)calloc(strlen(prefix) + 20, 1); + if (n >= 0) { + sprintf(name, "%s.%.4d.bam", prefix, n); + strcpy(mode, "w1"); + } else { + sprintf(name, "%s.bam", prefix); + strcpy(mode, "w"); + } + fp = is_stdout? bam_dopen(fileno(stdout), mode) : bam_open(name, mode); + if (fp == 0) { + fprintf(pysamerr, "[sort_blocks] fail to create file %s.\n", name); + free(name); + // FIXME: possible memory leak + return; + } + free(name); + bam_header_write(fp, h); + for (i = 0; i < k; ++i) + bam_write1_core(fp, &buf[i]->core, buf[i]->data_len, buf[i]->data); + bam_close(fp); +} + +/*! + @abstract Sort an unsorted BAM file based on the chromosome order + and the leftmost position of an alignment + + @param is_by_qname whether to sort by query name + @param fn name of the file to be sorted + @param prefix prefix of the output and the temporary files; upon + sucessess, prefix.bam will be written. + @param max_mem approxiate maximum memory (very inaccurate) + + @discussion It may create multiple temporary subalignment files + and then merge them by calling bam_merge_core(). This function is + NOT thread safe. + */ +void bam_sort_core_ext(int is_by_qname, const char *fn, const char *prefix, size_t max_mem, int is_stdout) +{ + int n, ret, k, i; + size_t mem; + bam_header_t *header; + bamFile fp; + bam1_t *b, **buf; + + g_is_by_qname = is_by_qname; + n = k = 0; mem = 0; + fp = strcmp(fn, "-")? bam_open(fn, "r") : bam_dopen(fileno(stdin), "r"); + if (fp == 0) { + fprintf(pysamerr, "[bam_sort_core] fail to open file %s\n", fn); + return; + } + header = bam_header_read(fp); + buf = (bam1_t**)calloc(max_mem / BAM_CORE_SIZE, sizeof(bam1_t*)); + // write sub files + for (;;) { + if (buf[k] == 0) buf[k] = (bam1_t*)calloc(1, sizeof(bam1_t)); + b = buf[k]; + if ((ret = bam_read1(fp, b)) < 0) break; + mem += ret; + ++k; + if (mem >= max_mem) { + sort_blocks(n++, k, buf, prefix, header, 0); + mem = 0; k = 0; + } + } + if (ret != -1) + fprintf(pysamerr, "[bam_sort_core] truncated file. Continue anyway.\n"); + if (n == 0) sort_blocks(-1, k, buf, prefix, header, is_stdout); + else { // then merge + char **fns, *fnout; + fprintf(pysamerr, "[bam_sort_core] merging from %d files...\n", n+1); + sort_blocks(n++, k, buf, prefix, header, 0); + fnout = (char*)calloc(strlen(prefix) + 20, 1); + if (is_stdout) sprintf(fnout, "-"); + else sprintf(fnout, "%s.bam", prefix); + fns = (char**)calloc(n, sizeof(char*)); + for (i = 0; i < n; ++i) { + fns[i] = (char*)calloc(strlen(prefix) + 20, 1); + sprintf(fns[i], "%s.%.4d.bam", prefix, i); + } + bam_merge_core(is_by_qname, fnout, 0, n, fns, 0, 0); + free(fnout); + for (i = 0; i < n; ++i) { + unlink(fns[i]); + free(fns[i]); + } + free(fns); + } + for (k = 0; k < max_mem / BAM_CORE_SIZE; ++k) { + if (buf[k]) { + free(buf[k]->data); + free(buf[k]); + } + } + free(buf); + bam_header_destroy(header); + bam_close(fp); +} + +void bam_sort_core(int is_by_qname, const char *fn, const char *prefix, size_t max_mem) +{ + bam_sort_core_ext(is_by_qname, fn, prefix, max_mem, 0); +} + +int bam_sort(int argc, char *argv[]) +{ + size_t max_mem = 500000000; + int c, is_by_qname = 0, is_stdout = 0; + while ((c = getopt(argc, argv, "nom:")) >= 0) { + switch (c) { + case 'o': is_stdout = 1; break; + case 'n': is_by_qname = 1; break; + case 'm': max_mem = atol(optarg); break; + } + } + if (optind + 2 > argc) { + fprintf(pysamerr, "Usage: samtools sort [-on] [-m ] \n"); + return 1; + } + bam_sort_core_ext(is_by_qname, argv[optind], argv[optind+1], max_mem, is_stdout); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_stat.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_stat.c.pysam.c new file mode 100755 index 0000000..4751782 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_stat.c.pysam.c @@ -0,0 +1,79 @@ +#include "pysam.h" + +#include +#include +#include "bam.h" + +typedef struct { + long long n_reads[2], n_mapped[2], n_pair_all[2], n_pair_map[2], n_pair_good[2]; + long long n_sgltn[2], n_read1[2], n_read2[2]; + long long n_dup[2]; + long long n_diffchr[2], n_diffhigh[2]; +} bam_flagstat_t; + +#define flagstat_loop(s, c) do { \ + int w = ((c)->flag & BAM_FQCFAIL)? 1 : 0; \ + ++(s)->n_reads[w]; \ + if ((c)->flag & BAM_FPAIRED) { \ + ++(s)->n_pair_all[w]; \ + if ((c)->flag & BAM_FPROPER_PAIR) ++(s)->n_pair_good[w]; \ + if ((c)->flag & BAM_FREAD1) ++(s)->n_read1[w]; \ + if ((c)->flag & BAM_FREAD2) ++(s)->n_read2[w]; \ + if (((c)->flag & BAM_FMUNMAP) && !((c)->flag & BAM_FUNMAP)) ++(s)->n_sgltn[w]; \ + if (!((c)->flag & BAM_FUNMAP) && !((c)->flag & BAM_FMUNMAP)) { \ + ++(s)->n_pair_map[w]; \ + if ((c)->mtid != (c)->tid) { \ + ++(s)->n_diffchr[w]; \ + if ((c)->qual >= 5) ++(s)->n_diffhigh[w]; \ + } \ + } \ + } \ + if (!((c)->flag & BAM_FUNMAP)) ++(s)->n_mapped[w]; \ + if ((c)->flag & BAM_FDUP) ++(s)->n_dup[w]; \ + } while (0) + +bam_flagstat_t *bam_flagstat_core(bamFile fp) +{ + bam_flagstat_t *s; + bam1_t *b; + bam1_core_t *c; + int ret; + s = (bam_flagstat_t*)calloc(1, sizeof(bam_flagstat_t)); + b = bam_init1(); + c = &b->core; + while ((ret = bam_read1(fp, b)) >= 0) + flagstat_loop(s, c); + bam_destroy1(b); + if (ret != -1) + fprintf(pysamerr, "[bam_flagstat_core] Truncated file? Continue anyway.\n"); + return s; +} +int bam_flagstat(int argc, char *argv[]) +{ + bamFile fp; + bam_header_t *header; + bam_flagstat_t *s; + if (argc == optind) { + fprintf(pysamerr, "Usage: samtools flagstat \n"); + return 1; + } + fp = strcmp(argv[optind], "-")? bam_open(argv[optind], "r") : bam_dopen(fileno(stdin), "r"); + assert(fp); + header = bam_header_read(fp); + s = bam_flagstat_core(fp); + printf("%lld + %lld in total (QC-passed reads + QC-failed reads)\n", s->n_reads[0], s->n_reads[1]); + printf("%lld + %lld duplicates\n", s->n_dup[0], s->n_dup[1]); + printf("%lld + %lld mapped (%.2f%%:%.2f%%)\n", s->n_mapped[0], s->n_mapped[1], (float)s->n_mapped[0] / s->n_reads[0] * 100.0, (float)s->n_mapped[1] / s->n_reads[1] * 100.0); + printf("%lld + %lld paired in sequencing\n", s->n_pair_all[0], s->n_pair_all[1]); + printf("%lld + %lld read1\n", s->n_read1[0], s->n_read1[1]); + printf("%lld + %lld read2\n", s->n_read2[0], s->n_read2[1]); + printf("%lld + %lld properly paired (%.2f%%:%.2f%%)\n", s->n_pair_good[0], s->n_pair_good[1], (float)s->n_pair_good[0] / s->n_pair_all[0] * 100.0, (float)s->n_pair_good[1] / s->n_pair_all[1] * 100.0); + printf("%lld + %lld with itself and mate mapped\n", s->n_pair_map[0], s->n_pair_map[1]); + printf("%lld + %lld singletons (%.2f%%:%.2f%%)\n", s->n_sgltn[0], s->n_sgltn[1], (float)s->n_sgltn[0] / s->n_pair_all[0] * 100.0, (float)s->n_sgltn[1] / s->n_pair_all[1] * 100.0); + printf("%lld + %lld with mate mapped to a different chr\n", s->n_diffchr[0], s->n_diffchr[1]); + printf("%lld + %lld with mate mapped to a different chr (mapQ>=5)\n", s->n_diffhigh[0], s->n_diffhigh[1]); + free(s); + bam_header_destroy(header); + bam_close(fp); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bam_tview.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bam_tview.c.pysam.c new file mode 100755 index 0000000..3709702 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bam_tview.c.pysam.c @@ -0,0 +1,442 @@ +#include "pysam.h" + +#undef _HAVE_CURSES + +#if _CURSES_LIB == 0 +#elif _CURSES_LIB == 1 +#include +#ifndef NCURSES_VERSION +#warning "_CURSES_LIB=1 but NCURSES_VERSION not defined; tview is NOT compiled" +#else +#define _HAVE_CURSES +#endif +#elif _CURSES_LIB == 2 +#include +#define _HAVE_CURSES +#else +#warning "_CURSES_LIB is not 0, 1 or 2; tview is NOT compiled" +#endif + +#ifdef _HAVE_CURSES +#include +#include +#include +#include +#include "bam.h" +#include "faidx.h" +#include "bam2bcf.h" + +char bam_aux_getCEi(bam1_t *b, int i); +char bam_aux_getCSi(bam1_t *b, int i); +char bam_aux_getCQi(bam1_t *b, int i); + +#define TV_MIN_ALNROW 2 +#define TV_MAX_GOTO 40 +#define TV_LOW_MAPQ 10 + +#define TV_COLOR_MAPQ 0 +#define TV_COLOR_BASEQ 1 +#define TV_COLOR_NUCL 2 +#define TV_COLOR_COL 3 +#define TV_COLOR_COLQ 4 + +#define TV_BASE_NUCL 0 +#define TV_BASE_COLOR_SPACE 1 + +typedef struct { + int mrow, mcol; + WINDOW *wgoto, *whelp; + + bam_index_t *idx; + bam_lplbuf_t *lplbuf; + bam_header_t *header; + bamFile fp; + int curr_tid, left_pos; + faidx_t *fai; + bcf_callaux_t *bca; + + int ccol, last_pos, row_shift, base_for, color_for, is_dot, l_ref, ins, no_skip, show_name; + char *ref; +} tview_t; + +int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void *data) +{ + extern unsigned char bam_nt16_table[256]; + tview_t *tv = (tview_t*)data; + int i, j, c, rb, attr, max_ins = 0; + uint32_t call = 0; + if (pos < tv->left_pos || tv->ccol > tv->mcol) return 0; // out of screen + // print referece + rb = (tv->ref && pos - tv->left_pos < tv->l_ref)? tv->ref[pos - tv->left_pos] : 'N'; + for (i = tv->last_pos + 1; i < pos; ++i) { + if (i%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", i+1); + c = tv->ref? tv->ref[i - tv->left_pos] : 'N'; + mvaddch(1, tv->ccol++, c); + } + if (pos%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", pos+1); + { // call consensus + bcf_callret1_t bcr; + int qsum[4], a1, a2, tmp; + double p[3], prior = 30; + bcf_call_glfgen(n, pl, bam_nt16_table[rb], tv->bca, &bcr); + for (i = 0; i < 4; ++i) qsum[i] = bcr.qsum[i]<<2 | i; + for (i = 1; i < 4; ++i) // insertion sort + for (j = i; j > 0 && qsum[j] > qsum[j-1]; --j) + tmp = qsum[j], qsum[j] = qsum[j-1], qsum[j-1] = tmp; + a1 = qsum[0]&3; a2 = qsum[1]&3; + p[0] = bcr.p[a1*5+a1]; p[1] = bcr.p[a1*5+a2] + prior; p[2] = bcr.p[a2*5+a2]; + if ("ACGT"[a1] != toupper(rb)) p[0] += prior + 3; + if ("ACGT"[a2] != toupper(rb)) p[2] += prior + 3; + if (p[0] < p[1] && p[0] < p[2]) call = (1<>16&0xf]; + i = (call&0xffff)/10+1; + if (i > 4) i = 4; + attr |= COLOR_PAIR(i); + if (c == toupper(rb)) c = '.'; + attron(attr); + mvaddch(2, tv->ccol, c); + attroff(attr); + if(tv->ins) { + // calculate maximum insert + for (i = 0; i < n; ++i) { + const bam_pileup1_t *p = pl + i; + if (p->indel > 0 && max_ins < p->indel) max_ins = p->indel; + } + } + // core loop + for (j = 0; j <= max_ins; ++j) { + for (i = 0; i < n; ++i) { + const bam_pileup1_t *p = pl + i; + int row = TV_MIN_ALNROW + p->level - tv->row_shift; + if (j == 0) { + if (!p->is_del) { + if (tv->base_for == TV_BASE_COLOR_SPACE && + (c = bam_aux_getCSi(p->b, p->qpos))) { + c = bam_aux_getCSi(p->b, p->qpos); + // assume that if we found one color, we will be able to get the color error + if (tv->is_dot && '-' == bam_aux_getCEi(p->b, p->qpos)) c = bam1_strand(p->b)? ',' : '.'; + } else { + if (tv->show_name) { + char *name = bam1_qname(p->b); + c = (p->qpos + 1 >= p->b->core.l_qname)? ' ' : name[p->qpos]; + } else { + c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; + if (tv->is_dot && toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.'; + } + } + } else c = p->is_refskip? (bam1_strand(p->b)? '<' : '>') : '*'; + } else { // padding + if (j > p->indel) c = '*'; + else { // insertion + if (tv->base_for == TV_BASE_NUCL) { + if (tv->show_name) { + char *name = bam1_qname(p->b); + c = (p->qpos + j + 1 >= p->b->core.l_qname)? ' ' : name[p->qpos + j]; + } else { + c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos + j)]; + if (j == 0 && tv->is_dot && toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.'; + } + } else { + c = bam_aux_getCSi(p->b, p->qpos + j); + if (tv->is_dot && '-' == bam_aux_getCEi(p->b, p->qpos + j)) c = bam1_strand(p->b)? ',' : '.'; + } + } + } + if (row > TV_MIN_ALNROW && row < tv->mrow) { + int x; + attr = 0; + if (((p->b->core.flag&BAM_FPAIRED) && !(p->b->core.flag&BAM_FPROPER_PAIR)) + || (p->b->core.flag & BAM_FSECONDARY)) attr |= A_UNDERLINE; + if (tv->color_for == TV_COLOR_BASEQ) { + x = bam1_qual(p->b)[p->qpos]/10 + 1; + if (x > 4) x = 4; + attr |= COLOR_PAIR(x); + } else if (tv->color_for == TV_COLOR_MAPQ) { + x = p->b->core.qual/10 + 1; + if (x > 4) x = 4; + attr |= COLOR_PAIR(x); + } else if (tv->color_for == TV_COLOR_NUCL) { + x = bam_nt16_nt4_table[bam1_seqi(bam1_seq(p->b), p->qpos)] + 5; + attr |= COLOR_PAIR(x); + } else if(tv->color_for == TV_COLOR_COL) { + x = 0; + switch(bam_aux_getCSi(p->b, p->qpos)) { + case '0': x = 0; break; + case '1': x = 1; break; + case '2': x = 2; break; + case '3': x = 3; break; + case '4': x = 4; break; + default: x = bam_nt16_nt4_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; break; + } + x+=5; + attr |= COLOR_PAIR(x); + } else if(tv->color_for == TV_COLOR_COLQ) { + x = bam_aux_getCQi(p->b, p->qpos); + if(0 == x) x = bam1_qual(p->b)[p->qpos]; + x = x/10 + 1; + if (x > 4) x = 4; + attr |= COLOR_PAIR(x); + } + attron(attr); + mvaddch(row, tv->ccol, bam1_strand(p->b)? tolower(c) : toupper(c)); + attroff(attr); + } + } + c = j? '*' : rb; + if (c == '*') { + attr = COLOR_PAIR(8); + attron(attr); + mvaddch(1, tv->ccol++, c); + attroff(attr); + } else mvaddch(1, tv->ccol++, c); + } + tv->last_pos = pos; + return 0; +} + +tview_t *tv_init(const char *fn, const char *fn_fa) +{ + tview_t *tv = (tview_t*)calloc(1, sizeof(tview_t)); + tv->is_dot = 1; + tv->fp = bam_open(fn, "r"); + bgzf_set_cache_size(tv->fp, 8 * 1024 *1024); + assert(tv->fp); + tv->header = bam_header_read(tv->fp); + tv->idx = bam_index_load(fn); + if (tv->idx == 0) exit(1); + tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv); + if (fn_fa) tv->fai = fai_load(fn_fa); + tv->bca = bcf_call_init(0.83, 13); + tv->ins = 1; + + initscr(); + keypad(stdscr, TRUE); + clear(); + noecho(); + cbreak(); + tv->mrow = 24; tv->mcol = 80; + getmaxyx(stdscr, tv->mrow, tv->mcol); + tv->wgoto = newwin(3, TV_MAX_GOTO + 10, 10, 5); + tv->whelp = newwin(29, 40, 5, 5); + tv->color_for = TV_COLOR_MAPQ; + start_color(); + init_pair(1, COLOR_BLUE, COLOR_BLACK); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_YELLOW, COLOR_BLACK); + init_pair(4, COLOR_WHITE, COLOR_BLACK); + init_pair(5, COLOR_GREEN, COLOR_BLACK); + init_pair(6, COLOR_CYAN, COLOR_BLACK); + init_pair(7, COLOR_YELLOW, COLOR_BLACK); + init_pair(8, COLOR_RED, COLOR_BLACK); + init_pair(9, COLOR_BLUE, COLOR_BLACK); + return tv; +} + +void tv_destroy(tview_t *tv) +{ + delwin(tv->wgoto); delwin(tv->whelp); + endwin(); + + bam_lplbuf_destroy(tv->lplbuf); + bcf_call_destroy(tv->bca); + bam_index_destroy(tv->idx); + if (tv->fai) fai_destroy(tv->fai); + free(tv->ref); + bam_header_destroy(tv->header); + bam_close(tv->fp); + free(tv); +} + +int tv_fetch_func(const bam1_t *b, void *data) +{ + tview_t *tv = (tview_t*)data; + if (tv->no_skip) { + uint32_t *cigar = bam1_cigar(b); // this is cheating... + int i; + for (i = 0; i core.n_cigar; ++i) { + if ((cigar[i]&0xf) == BAM_CREF_SKIP) + cigar[i] = cigar[i]>>4<<4 | BAM_CDEL; + } + } + bam_lplbuf_push(b, tv->lplbuf); + return 0; +} + +int tv_draw_aln(tview_t *tv, int tid, int pos) +{ + // reset + clear(); + tv->curr_tid = tid; tv->left_pos = pos; + tv->last_pos = tv->left_pos - 1; + tv->ccol = 0; + // print ref and consensus + if (tv->fai) { + char *str; + if (tv->ref) free(tv->ref); + str = (char*)calloc(strlen(tv->header->target_name[tv->curr_tid]) + 30, 1); + sprintf(str, "%s:%d-%d", tv->header->target_name[tv->curr_tid], tv->left_pos + 1, tv->left_pos + tv->mcol); + tv->ref = fai_fetch(tv->fai, str, &tv->l_ref); + free(str); + } + // draw aln + bam_lplbuf_reset(tv->lplbuf); + bam_fetch(tv->fp, tv->idx, tv->curr_tid, tv->left_pos, tv->left_pos + tv->mcol, tv, tv_fetch_func); + bam_lplbuf_push(0, tv->lplbuf); + + while (tv->ccol < tv->mcol) { + int pos = tv->last_pos + 1; + if (pos%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", pos+1); + mvaddch(1, tv->ccol++, (tv->ref && pos < tv->l_ref)? tv->ref[pos - tv->left_pos] : 'N'); + ++tv->last_pos; + } + return 0; +} + +static void tv_win_goto(tview_t *tv, int *tid, int *pos) +{ + char str[256], *p; + int i, l = 0; + wborder(tv->wgoto, '|', '|', '-', '-', '+', '+', '+', '+'); + mvwprintw(tv->wgoto, 1, 2, "Goto: "); + for (;;) { + int c = wgetch(tv->wgoto); + wrefresh(tv->wgoto); + if (c == KEY_BACKSPACE || c == '\010' || c == '\177') { + --l; + } else if (c == KEY_ENTER || c == '\012' || c == '\015') { + int _tid = -1, _beg, _end; + if (str[0] == '=') { + _beg = strtol(str+1, &p, 10) - 1; + if (_beg > 0) { + *pos = _beg; + return; + } + } else { + bam_parse_region(tv->header, str, &_tid, &_beg, &_end); + if (_tid >= 0) { + *tid = _tid; *pos = _beg; + return; + } + } + } else if (isgraph(c)) { + if (l < TV_MAX_GOTO) str[l++] = c; + } else if (c == '\027') l = 0; + else if (c == '\033') return; + str[l] = '\0'; + for (i = 0; i < TV_MAX_GOTO; ++i) mvwaddch(tv->wgoto, 1, 8 + i, ' '); + mvwprintw(tv->wgoto, 1, 8, "%s", str); + } +} + +static void tv_win_help(tview_t *tv) { + int r = 1; + WINDOW *win = tv->whelp; + wborder(win, '|', '|', '-', '-', '+', '+', '+', '+'); + mvwprintw(win, r++, 2, " -=- Help -=- "); + r++; + mvwprintw(win, r++, 2, "? This window"); + mvwprintw(win, r++, 2, "Arrows Small scroll movement"); + mvwprintw(win, r++, 2, "h,j,k,l Small scroll movement"); + mvwprintw(win, r++, 2, "H,J,K,L Large scroll movement"); + mvwprintw(win, r++, 2, "ctrl-H Scroll 1k left"); + mvwprintw(win, r++, 2, "ctrl-L Scroll 1k right"); + mvwprintw(win, r++, 2, "space Scroll one screen"); + mvwprintw(win, r++, 2, "backspace Scroll back one screen"); + mvwprintw(win, r++, 2, "g Go to specific location"); + mvwprintw(win, r++, 2, "m Color for mapping qual"); + mvwprintw(win, r++, 2, "n Color for nucleotide"); + mvwprintw(win, r++, 2, "b Color for base quality"); + mvwprintw(win, r++, 2, "c Color for cs color"); + mvwprintw(win, r++, 2, "z Color for cs qual"); + mvwprintw(win, r++, 2, ". Toggle on/off dot view"); + mvwprintw(win, r++, 2, "s Toggle on/off ref skip"); + mvwprintw(win, r++, 2, "r Toggle on/off rd name"); + mvwprintw(win, r++, 2, "N Turn on nt view"); + mvwprintw(win, r++, 2, "C Turn on cs view"); + mvwprintw(win, r++, 2, "i Toggle on/off ins"); + mvwprintw(win, r++, 2, "q Exit"); + r++; + mvwprintw(win, r++, 2, "Underline: Secondary or orphan"); + mvwprintw(win, r++, 2, "Blue: 0-9 Green: 10-19"); + mvwprintw(win, r++, 2, "Yellow: 20-29 White: >=30"); + wrefresh(win); + wgetch(win); +} + +void tv_loop(tview_t *tv) +{ + int tid, pos; + tid = tv->curr_tid; pos = tv->left_pos; + while (1) { + int c = getch(); + switch (c) { + case '?': tv_win_help(tv); break; + case '\033': + case 'q': goto end_loop; + case '/': + case 'g': tv_win_goto(tv, &tid, &pos); break; + case 'm': tv->color_for = TV_COLOR_MAPQ; break; + case 'b': tv->color_for = TV_COLOR_BASEQ; break; + case 'n': tv->color_for = TV_COLOR_NUCL; break; + case 'c': tv->color_for = TV_COLOR_COL; break; + case 'z': tv->color_for = TV_COLOR_COLQ; break; + case 's': tv->no_skip = !tv->no_skip; break; + case 'r': tv->show_name = !tv->show_name; break; + case KEY_LEFT: + case 'h': --pos; break; + case KEY_RIGHT: + case 'l': ++pos; break; + case KEY_SLEFT: + case 'H': pos -= 20; break; + case KEY_SRIGHT: + case 'L': pos += 20; break; + case '.': tv->is_dot = !tv->is_dot; break; + case 'N': tv->base_for = TV_BASE_NUCL; break; + case 'C': tv->base_for = TV_BASE_COLOR_SPACE; break; + case 'i': tv->ins = !tv->ins; break; + case '\010': pos -= 1000; break; + case '\014': pos += 1000; break; + case ' ': pos += tv->mcol; break; + case KEY_UP: + case 'j': --tv->row_shift; break; + case KEY_DOWN: + case 'k': ++tv->row_shift; break; + case KEY_BACKSPACE: + case '\177': pos -= tv->mcol; break; + case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break; + default: continue; + } + if (pos < 0) pos = 0; + if (tv->row_shift < 0) tv->row_shift = 0; + tv_draw_aln(tv, tid, pos); + } +end_loop: + return; +} + +int bam_tview_main(int argc, char *argv[]) +{ + tview_t *tv; + if (argc == 1) { + fprintf(pysamerr, "Usage: bamtk tview [ref.fasta]\n"); + return 1; + } + tv = tv_init(argv[1], (argc == 2)? 0 : argv[2]); + tv_draw_aln(tv, 0, 0); + tv_loop(tv); + tv_destroy(tv); + return 0; +} +#else // #ifdef _HAVE_CURSES +#include +#warning "No curses library is available; tview is disabled." +int bam_tview_main(int argc, char *argv[]) +{ + fprintf(pysamerr, "[bam_tview_main] The ncurses library is unavailable; tview is not compiled.\n"); + return 1; +} +#endif // #ifdef _HAVE_CURSES diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.c.pysam.c new file mode 100755 index 0000000..e1c823d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.c.pysam.c @@ -0,0 +1,330 @@ +#include "pysam.h" + +#include +#include +#include +#include "kstring.h" +#include "bcf.h" + +bcf_t *bcf_open(const char *fn, const char *mode) +{ + bcf_t *b; + b = calloc(1, sizeof(bcf_t)); + if (strchr(mode, 'w')) { + b->fp = strcmp(fn, "-")? bgzf_open(fn, mode) : bgzf_fdopen(fileno(stdout), mode); + } else { + b->fp = strcmp(fn, "-")? bgzf_open(fn, mode) : bgzf_fdopen(fileno(stdin), mode); + } +#ifndef BCF_LITE + b->fp->owned_file = 1; +#endif + return b; +} + +int bcf_close(bcf_t *b) +{ + int ret; + if (b == 0) return 0; + ret = bgzf_close(b->fp); + free(b); + return ret; +} + +int bcf_hdr_write(bcf_t *b, const bcf_hdr_t *h) +{ + if (b == 0 || h == 0) return -1; + bgzf_write(b->fp, "BCF\4", 4); + bgzf_write(b->fp, &h->l_nm, 4); + bgzf_write(b->fp, h->name, h->l_nm); + bgzf_write(b->fp, &h->l_smpl, 4); + bgzf_write(b->fp, h->sname, h->l_smpl); + bgzf_write(b->fp, &h->l_txt, 4); + bgzf_write(b->fp, h->txt, h->l_txt); + bgzf_flush(b->fp); + return 16 + h->l_nm + h->l_smpl + h->l_txt; +} + +bcf_hdr_t *bcf_hdr_read(bcf_t *b) +{ + uint8_t magic[4]; + bcf_hdr_t *h; + if (b == 0) return 0; + h = calloc(1, sizeof(bcf_hdr_t)); + bgzf_read(b->fp, magic, 4); + bgzf_read(b->fp, &h->l_nm, 4); + h->name = malloc(h->l_nm); + bgzf_read(b->fp, h->name, h->l_nm); + bgzf_read(b->fp, &h->l_smpl, 4); + h->sname = malloc(h->l_smpl); + bgzf_read(b->fp, h->sname, h->l_smpl); + bgzf_read(b->fp, &h->l_txt, 4); + h->txt = malloc(h->l_txt); + bgzf_read(b->fp, h->txt, h->l_txt); + bcf_hdr_sync(h); + return h; +} + +void bcf_hdr_destroy(bcf_hdr_t *h) +{ + if (h == 0) return; + free(h->name); free(h->sname); free(h->txt); free(h->ns); free(h->sns); + free(h); +} + +static inline char **cnt_null(int l, char *str, int *_n) +{ + int n = 0; + char *p, **list; + *_n = 0; + if (l == 0 || str == 0) return 0; + for (p = str; p != str + l; ++p) + if (*p == 0) ++n; + *_n = n; + list = calloc(n, sizeof(void*)); + list[0] = str; + for (p = str, n = 1; p < str + l - 1; ++p) + if (*p == 0) list[n++] = p + 1; + return list; +} + +int bcf_hdr_sync(bcf_hdr_t *b) +{ + if (b == 0) return -1; + if (b->ns) free(b->ns); + if (b->sns) free(b->sns); + if (b->l_nm) b->ns = cnt_null(b->l_nm, b->name, &b->n_ref); + else b->ns = 0, b->n_ref = 0; + b->sns = cnt_null(b->l_smpl, b->sname, &b->n_smpl); + return 0; +} + +int bcf_sync(bcf1_t *b) +{ + char *p, *tmp[5]; + int i, n, n_smpl = b->n_smpl; + ks_tokaux_t aux; + // set ref, alt, flt, info, fmt + b->ref = b->alt = b->flt = b->info = b->fmt = 0; + for (p = b->str, n = 0; p < b->str + b->l_str; ++p) { + if (*p == 0 && p+1 != b->str + b->l_str) { + if (n == 5) { + ++n; + break; + } else tmp[n++] = p + 1; + } + } + if (n != 5) { + fprintf(pysamerr, "[%s] incorrect number of fields (%d != 5) at %d:%d\n", __func__, n, b->tid, b->pos); + return -1; + } + b->ref = tmp[0]; b->alt = tmp[1]; b->flt = tmp[2]; b->info = tmp[3]; b->fmt = tmp[4]; + // set n_alleles + if (*b->alt == 0) b->n_alleles = 1; + else { + for (p = b->alt, n = 1; *p; ++p) + if (*p == ',') ++n; + b->n_alleles = n + 1; + } + // set n_gi and gi[i].fmt + for (p = b->fmt, n = 1; *p; ++p) + if (*p == ':') ++n; + if (n > b->m_gi) { + int old_m = b->m_gi; + b->m_gi = n; + kroundup32(b->m_gi); + b->gi = realloc(b->gi, b->m_gi * sizeof(bcf_ginfo_t)); + memset(b->gi + old_m, 0, (b->m_gi - old_m) * sizeof(bcf_ginfo_t)); + } + b->n_gi = n; + for (p = kstrtok(b->fmt, ":", &aux), n = 0; p; p = kstrtok(0, 0, &aux)) + b->gi[n++].fmt = bcf_str2int(p, aux.p - p); + // set gi[i].len + for (i = 0; i < b->n_gi; ++i) { + if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + b->gi[i].len = b->n_alleles * (b->n_alleles + 1) / 2; + } else if (b->gi[i].fmt == bcf_str2int("DP", 2) || b->gi[i].fmt == bcf_str2int("HQ", 2)) { + b->gi[i].len = 2; + } else if (b->gi[i].fmt == bcf_str2int("GQ", 2) || b->gi[i].fmt == bcf_str2int("GT", 2)) { + b->gi[i].len = 1; + } else if (b->gi[i].fmt == bcf_str2int("SP", 2)) { + b->gi[i].len = 4; + } else if (b->gi[i].fmt == bcf_str2int("GL", 2)) { + b->gi[i].len = b->n_alleles * (b->n_alleles + 1) / 2 * 4; + } + b->gi[i].data = realloc(b->gi[i].data, n_smpl * b->gi[i].len); + } + return 0; +} + +int bcf_write(bcf_t *bp, const bcf_hdr_t *h, const bcf1_t *b) +{ + int i, l = 0; + if (b == 0) return -1; + bgzf_write(bp->fp, &b->tid, 4); + bgzf_write(bp->fp, &b->pos, 4); + bgzf_write(bp->fp, &b->qual, 4); + bgzf_write(bp->fp, &b->l_str, 4); + bgzf_write(bp->fp, b->str, b->l_str); + l = 12 + b->l_str; + for (i = 0; i < b->n_gi; ++i) { + bgzf_write(bp->fp, b->gi[i].data, b->gi[i].len * h->n_smpl); + l += b->gi[i].len * h->n_smpl; + } + return l; +} + +int bcf_read(bcf_t *bp, const bcf_hdr_t *h, bcf1_t *b) +{ + int i, l = 0; + if (b == 0) return -1; + if (bgzf_read(bp->fp, &b->tid, 4) == 0) return -1; + b->n_smpl = h->n_smpl; + bgzf_read(bp->fp, &b->pos, 4); + bgzf_read(bp->fp, &b->qual, 4); + bgzf_read(bp->fp, &b->l_str, 4); + if (b->l_str > b->m_str) { + b->m_str = b->l_str; + kroundup32(b->m_str); + b->str = realloc(b->str, b->m_str); + } + bgzf_read(bp->fp, b->str, b->l_str); + l = 12 + b->l_str; + if (bcf_sync(b) < 0) return -2; + for (i = 0; i < b->n_gi; ++i) { + bgzf_read(bp->fp, b->gi[i].data, b->gi[i].len * h->n_smpl); + l += b->gi[i].len * h->n_smpl; + } + return l; +} + +int bcf_destroy(bcf1_t *b) +{ + int i; + if (b == 0) return -1; + free(b->str); + for (i = 0; i < b->m_gi; ++i) + free(b->gi[i].data); + free(b->gi); + free(b); + return 0; +} + +static inline void fmt_str(const char *p, kstring_t *s) +{ + if (*p == 0) kputc('.', s); + else kputs(p, s); +} + +void bcf_fmt_core(const bcf_hdr_t *h, bcf1_t *b, kstring_t *s) +{ + int i, j, x; + s->l = 0; + if (h->n_ref) kputs(h->ns[b->tid], s); + else kputw(b->tid, s); + kputc('\t', s); + kputw(b->pos + 1, s); kputc('\t', s); + fmt_str(b->str, s); kputc('\t', s); + fmt_str(b->ref, s); kputc('\t', s); + fmt_str(b->alt, s); kputc('\t', s); + ksprintf(s, "%.3g", b->qual); kputc('\t', s); + fmt_str(b->flt, s); kputc('\t', s); + fmt_str(b->info, s); + if (b->fmt[0]) { + kputc('\t', s); + fmt_str(b->fmt, s); + } + x = b->n_alleles * (b->n_alleles + 1) / 2; + if (b->n_gi == 0) return; + for (j = 0; j < h->n_smpl; ++j) { + kputc('\t', s); + for (i = 0; i < b->n_gi; ++i) { + if (i) kputc(':', s); + if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + uint8_t *d = (uint8_t*)b->gi[i].data + j * x; + int k; + for (k = 0; k < x; ++k) { + if (k > 0) kputc(',', s); + kputw(d[k], s); + } + } else if (b->gi[i].fmt == bcf_str2int("DP", 2)) { + kputw(((uint16_t*)b->gi[i].data)[j], s); + } else if (b->gi[i].fmt == bcf_str2int("GQ", 2)) { + kputw(((uint8_t*)b->gi[i].data)[j], s); + } else if (b->gi[i].fmt == bcf_str2int("SP", 2)) { + kputw(((int32_t*)b->gi[i].data)[j], s); + } else if (b->gi[i].fmt == bcf_str2int("GT", 2)) { + int y = ((uint8_t*)b->gi[i].data)[j]; + if (y>>7&1) { + kputsn("./.", 3, s); + } else { + kputc('0' + (y>>3&7), s); + kputc("/|"[y>>6&1], s); + kputc('0' + (y&7), s); + } + } else if (b->gi[i].fmt == bcf_str2int("GL", 2)) { + float *d = (float*)b->gi[i].data + j * x; + int k; + //printf("- %lx\n", d); + for (k = 0; k < x; ++k) { + if (k > 0) kputc(',', s); + ksprintf(s, "%.2f", d[k]); + } + } else kputc('.', s); // custom fields + } + } +} + +char *bcf_fmt(const bcf_hdr_t *h, bcf1_t *b) +{ + kstring_t s; + s.l = s.m = 0; s.s = 0; + bcf_fmt_core(h, b, &s); + return s.s; +} + +int bcf_append_info(bcf1_t *b, const char *info, int l) +{ + int shift = b->fmt - b->str; + int l_fmt = b->l_str - shift; + char *ori = b->str; + if (b->l_str + l > b->m_str) { // enlarge if necessary + b->m_str = b->l_str + l; + kroundup32(b->m_str); + b->str = realloc(b->str, b->m_str); + } + memmove(b->str + shift + l, b->str + shift, l_fmt); // move the FORMAT field + memcpy(b->str + shift - 1, info, l); // append to the INFO field + b->str[shift + l - 1] = '\0'; + b->fmt = b->str + shift + l; + b->l_str += l; + if (ori != b->str) bcf_sync(b); // synchronize when realloc changes the pointer + return 0; +} + +int bcf_cpy(bcf1_t *r, const bcf1_t *b) +{ + char *t1 = r->str; + bcf_ginfo_t *t2 = r->gi; + int i, t3 = r->m_str, t4 = r->m_gi; + *r = *b; + r->str = t1; r->gi = t2; r->m_str = t3; r->m_gi = t4; + if (r->m_str < b->m_str) { + r->m_str = b->m_str; + r->str = realloc(r->str, r->m_str); + } + memcpy(r->str, b->str, r->m_str); + bcf_sync(r); // calling bcf_sync() is simple but inefficient + for (i = 0; i < r->n_gi; ++i) + memcpy(r->gi[i].data, b->gi[i].data, r->n_smpl * r->gi[i].len); + return 0; +} + +int bcf_is_indel(const bcf1_t *b) +{ + char *p; + if (strlen(b->ref) > 1) return 1; + for (p = b->alt; *p; ++p) + if (*p != ',' && p[1] != ',' && p[1] != '\0') + return 1; + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.h b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.h new file mode 100755 index 0000000..822ae5c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf.h @@ -0,0 +1,190 @@ +/* The MIT License + + Copyright (c) 2010 Broad Institute + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +#ifndef BCF_H +#define BCF_H + +#define BCF_VERSION "0.1.17-dev (r973:277)" + +#include +#include + +#ifndef BCF_LITE +#include "bgzf.h" +typedef BGZF *bcfFile; +#else +typedef gzFile bcfFile; +#define bgzf_open(fn, mode) gzopen(fn, mode) +#define bgzf_fdopen(fd, mode) gzdopen(fd, mode) +#define bgzf_close(fp) gzclose(fp) +#define bgzf_read(fp, buf, len) gzread(fp, buf, len) +#define bgzf_write(fp, buf, len) +#define bgzf_flush(fp) +#endif + +/* + A member in the structs below is said to "primary" if its content + cannot be inferred from other members in any of structs below; a + member is said to be "derived" if its content can be derived from + other members. For example, bcf1_t::str is primary as this comes from + the input data, while bcf1_t::info is derived as it can always be + correctly set if we know bcf1_t::str. Derived members are for quick + access to the content and must be synchronized with the primary data. + */ + +typedef struct { + uint32_t fmt; // format of the block, set by bcf_str2int(). + int len; // length of data for each individual + void *data; // concatenated data + // derived info: fmt, len (<-bcf1_t::fmt) +} bcf_ginfo_t; + +typedef struct { + int32_t tid, pos; // refID and 0-based position + int32_t l_str, m_str; // length and the allocated size of ->str + float qual; // SNP quality + char *str; // concatenated string of variable length strings in VCF (from col.2 to col.7) + char *ref, *alt, *flt, *info, *fmt; // they all point to ->str; no memory allocation + int n_gi, m_gi; // number and the allocated size of geno fields + bcf_ginfo_t *gi; // array of geno fields + int n_alleles, n_smpl; // number of alleles and samples + // derived info: ref, alt, flt, info, fmt (<-str), n_gi (<-fmt), n_alleles (<-alt), n_smpl (<-bcf_hdr_t::n_smpl) +} bcf1_t; + +typedef struct { + int32_t n_ref, n_smpl; // number of reference sequences and samples + int32_t l_nm; // length of concatenated sequence names; 0 padded + int32_t l_smpl; // length of concatenated sample names; 0 padded + int32_t l_txt; // length of header text (lines started with ##) + char *name, *sname, *txt; // concatenated sequence names, sample names and header text + char **ns, **sns; // array of sequence and sample names; point to name and sname, respectively + // derived info: n_ref (<-name), n_smpl (<-sname), ns (<-name), sns (<-sname) +} bcf_hdr_t; + +typedef struct { + int is_vcf; // if the file in operation is a VCF + void *v; // auxillary data structure for VCF + bcfFile fp; // file handler for BCF +} bcf_t; + +struct __bcf_idx_t; +typedef struct __bcf_idx_t bcf_idx_t; + +#ifdef __cplusplus +extern "C" { +#endif + + // open a BCF file; for BCF file only + bcf_t *bcf_open(const char *fn, const char *mode); + // close file + int bcf_close(bcf_t *b); + // read one record from BCF; return -1 on end-of-file, and <-1 for errors + int bcf_read(bcf_t *bp, const bcf_hdr_t *h, bcf1_t *b); + // call this function if b->str is changed + int bcf_sync(bcf1_t *b); + // write a BCF record + int bcf_write(bcf_t *bp, const bcf_hdr_t *h, const bcf1_t *b); + // read the BCF header; BCF only + bcf_hdr_t *bcf_hdr_read(bcf_t *b); + // write the BCF header + int bcf_hdr_write(bcf_t *b, const bcf_hdr_t *h); + // set bcf_hdr_t::ns and bcf_hdr_t::sns + int bcf_hdr_sync(bcf_hdr_t *b); + // destroy the header + void bcf_hdr_destroy(bcf_hdr_t *h); + // destroy a record + int bcf_destroy(bcf1_t *b); + // BCF->VCF conversion + char *bcf_fmt(const bcf_hdr_t *h, bcf1_t *b); + // append more info + int bcf_append_info(bcf1_t *b, const char *info, int l); + // copy + int bcf_cpy(bcf1_t *r, const bcf1_t *b); + + // open a VCF or BCF file if "b" is set in "mode" + bcf_t *vcf_open(const char *fn, const char *mode); + // close a VCF/BCF file + int vcf_close(bcf_t *bp); + // read the VCF/BCF header + bcf_hdr_t *vcf_hdr_read(bcf_t *bp); + // read the sequence dictionary from a separate file; required for VCF->BCF conversion + int vcf_dictread(bcf_t *bp, bcf_hdr_t *h, const char *fn); + // read a VCF/BCF record; return -1 on end-of-file and <-1 for errors + int vcf_read(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b); + // write the VCF header + int vcf_hdr_write(bcf_t *bp, const bcf_hdr_t *h); + // write a VCF record + int vcf_write(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b); + + // keep the first n alleles and discard the rest + int bcf_shrink_alt(bcf1_t *b, int n); + // convert GL to PL + int bcf_gl2pl(bcf1_t *b); + // if the site is an indel + int bcf_is_indel(const bcf1_t *b); + bcf_hdr_t *bcf_hdr_subsam(const bcf_hdr_t *h0, int n, char *const* samples, int *list); + int bcf_subsam(int n_smpl, int *list, bcf1_t *b); + // move GT to the first FORMAT field + int bcf_fix_gt(bcf1_t *b); + // update PL generated by old samtools + int bcf_fix_pl(bcf1_t *b); + // convert PL to GLF-like 10-likelihood GL + int bcf_gl10(const bcf1_t *b, uint8_t *gl); + // convert up to 4 INDEL alleles to GLF-like 10-likelihood GL + int bcf_gl10_indel(const bcf1_t *b, uint8_t *gl); + + // string hash table + void *bcf_build_refhash(bcf_hdr_t *h); + void bcf_str2id_destroy(void *_hash); + void bcf_str2id_thorough_destroy(void *_hash); + int bcf_str2id_add(void *_hash, const char *str); + int bcf_str2id(void *_hash, const char *str); + void *bcf_str2id_init(); + + // indexing related functions + int bcf_idx_build(const char *fn); + uint64_t bcf_idx_query(const bcf_idx_t *idx, int tid, int beg); + int bcf_parse_region(void *str2id, const char *str, int *tid, int *begin, int *end); + bcf_idx_t *bcf_idx_load(const char *fn); + void bcf_idx_destroy(bcf_idx_t *idx); + +#ifdef __cplusplus +} +#endif + +static inline uint32_t bcf_str2int(const char *str, int l) +{ + int i; + uint32_t x = 0; + for (i = 0; i < l && i < 4; ++i) { + if (str[i] == 0) return x; + x = x<<8 | str[i]; + } + return x; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf2qcall.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf2qcall.c.pysam.c new file mode 100755 index 0000000..6dc7e0c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcf2qcall.c.pysam.c @@ -0,0 +1,93 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include "bcf.h" + +static int8_t nt4_table[256] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 /*'-'*/, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, -1, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, -1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +}; + +static int read_I16(bcf1_t *b, int anno[16]) +{ + char *p; + int i; + if ((p = strstr(b->info, "I16=")) == 0) return -1; + p += 4; + for (i = 0; i < 16; ++i) { + anno[i] = strtol(p, &p, 10); + if (anno[i] == 0 && (errno == EINVAL || errno == ERANGE)) return -2; + ++p; + } + return 0; +} + +int bcf_2qcall(bcf_hdr_t *h, bcf1_t *b) +{ + int a[4], k, g[10], l, map[4], k1, j, i, i0, anno[16], dp, mq, d_rest; + char *s; + if (b->ref[1] != 0 || b->n_alleles > 4) return -1; // ref is not a single base + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + if (read_I16(b, anno) != 0) return -1; // no I16; FIXME: can be improved + d_rest = dp = anno[0] + anno[1] + anno[2] + anno[3]; + if (dp == 0) return -1; // depth is zero + mq = (int)(sqrt((double)(anno[9] + anno[11]) / dp) + .499); + i0 = i; + a[0] = nt4_table[(int)b->ref[0]]; + if (a[0] > 3) return -1; // ref is not A/C/G/T + a[1] = a[2] = a[3] = -2; // -1 has a special meaning + if (b->alt[0] == 0) return -1; // no alternate allele + map[0] = map[1] = map[2] = map[3] = -2; + map[a[0]] = 0; + for (k = 0, s = b->alt, k1 = -1; k < 3 && *s; ++k, s += 2) { + if (s[1] != ',' && s[1] != 0) return -1; // ALT is not single base + a[k+1] = nt4_table[(int)*s]; + if (a[k+1] >= 0) map[a[k+1]] = k+1; + else k1 = k+1; + if (s[1] == 0) break; + } + for (k = 0; k < 4; ++k) + if (map[k] < 0) map[k] = k1; + for (i = 0; i < h->n_smpl; ++i) { + int d; + uint8_t *p = b->gi[i0].data + i * b->gi[i0].len; + for (j = 0; j < b->gi[i0].len; ++j) + if (p[j]) break; + d = (int)((double)d_rest / (h->n_smpl - i) + .499); + if (d == 0) d = 1; + if (j == b->gi[i0].len) d = 0; + d_rest -= d; + for (k = j = 0; k < 4; ++k) { + for (l = k; l < 4; ++l) { + int t, x = map[k], y = map[l]; + if (x > y) t = x, x = y, y = t; // swap + g[j++] = p[y * (y+1) / 2 + x]; + } + } + printf("%s\t%d\t%c", h->ns[b->tid], b->pos+1, *b->ref); + printf("\t%d\t%d\t0", d, mq); + for (j = 0; j < 10; ++j) + printf("\t%d", g[j]); + printf("\t%s\n", h->sns[i]); + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcfutils.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcfutils.c.pysam.c new file mode 100755 index 0000000..110d0bb --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/bcfutils.c.pysam.c @@ -0,0 +1,392 @@ +#include "pysam.h" + +#include +#include +#include "bcf.h" +#include "kstring.h" +#include "khash.h" +KHASH_MAP_INIT_STR(str2id, int) + +#ifdef _WIN32 +#define srand48(x) srand(x) +#define drand48() ((double)rand() / RAND_MAX) +#endif + +// FIXME: valgrind report a memory leak in this function. Probably it does not get deallocated... +void *bcf_build_refhash(bcf_hdr_t *h) +{ + khash_t(str2id) *hash; + int i, ret; + hash = kh_init(str2id); + for (i = 0; i < h->n_ref; ++i) { + khint_t k; + k = kh_put(str2id, hash, h->ns[i], &ret); // FIXME: check ret + kh_val(hash, k) = i; + } + return hash; +} + +void *bcf_str2id_init() +{ + return kh_init(str2id); +} + +void bcf_str2id_destroy(void *_hash) +{ + khash_t(str2id) *hash = (khash_t(str2id)*)_hash; + if (hash) kh_destroy(str2id, hash); // Note that strings are not freed. +} + +void bcf_str2id_thorough_destroy(void *_hash) +{ + khash_t(str2id) *hash = (khash_t(str2id)*)_hash; + khint_t k; + if (hash == 0) return; + for (k = 0; k < kh_end(hash); ++k) + if (kh_exist(hash, k)) free((char*)kh_key(hash, k)); + kh_destroy(str2id, hash); +} + +int bcf_str2id(void *_hash, const char *str) +{ + khash_t(str2id) *hash = (khash_t(str2id)*)_hash; + khint_t k; + if (!hash) return -1; + k = kh_get(str2id, hash, str); + return k == kh_end(hash)? -1 : kh_val(hash, k); +} + +int bcf_str2id_add(void *_hash, const char *str) +{ + khint_t k; + int ret; + khash_t(str2id) *hash = (khash_t(str2id)*)_hash; + if (!hash) return -1; + k = kh_put(str2id, hash, str, &ret); + if (ret == 0) return kh_val(hash, k); + kh_val(hash, k) = kh_size(hash) - 1; + return kh_val(hash, k); +} + +int bcf_shrink_alt(bcf1_t *b, int n) +{ + char *p; + int i, j, k, n_smpl = b->n_smpl; + if (b->n_alleles <= n) return -1; + // update ALT + if (n > 1) { + for (p = b->alt, k = 1; *p; ++p) + if (*p == ',' && ++k == n) break; + *p = '\0'; + } else p = b->alt, *p = '\0'; + ++p; + memmove(p, b->flt, b->str + b->l_str - b->flt); + b->l_str -= b->flt - p; + // update PL + for (i = 0; i < b->n_gi; ++i) { + bcf_ginfo_t *g = b->gi + i; + if (g->fmt == bcf_str2int("PL", 2)) { + int l, x = b->n_alleles * (b->n_alleles + 1) / 2; + uint8_t *d = (uint8_t*)g->data; + g->len = n * (n + 1) / 2; + for (l = k = 0; l < n_smpl; ++l) { + uint8_t *dl = d + l * x; + for (j = 0; j < g->len; ++j) d[k++] = dl[j]; + } + } // FIXME: to add GL + } + b->n_alleles = n; + bcf_sync(b); + return 0; +} + +int bcf_gl2pl(bcf1_t *b) +{ + char *p; + int i, n_smpl = b->n_smpl; + bcf_ginfo_t *g; + float *d0; + uint8_t *d1; + if (strstr(b->fmt, "PL")) return -1; + if ((p = strstr(b->fmt, "GL")) == 0) return -1; + *p = 'P'; + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("GL", 2)) + break; + g = b->gi + i; + g->fmt = bcf_str2int("PL", 2); + g->len /= 4; // 4 == sizeof(float) + d0 = (float*)g->data; d1 = (uint8_t*)g->data; + for (i = 0; i < n_smpl * g->len; ++i) { + int x = (int)(-10. * d0[i] + .499); + if (x > 255) x = 255; + if (x < 0) x = 0; + d1[i] = x; + } + return 0; +} +/* FIXME: this function will fail given AB:GTX:GT. BCFtools never + * produces such FMT, but others may do. */ +int bcf_fix_gt(bcf1_t *b) +{ + char *s; + int i; + uint32_t tmp; + bcf_ginfo_t gt; + // check the presence of the GT FMT + if ((s = strstr(b->fmt, ":GT")) == 0) return 0; // no GT or GT is already the first + if (s[3] != '\0' && s[3] != ':') return 0; // :GTX in fact + tmp = bcf_str2int("GT", 2); + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == tmp) break; + if (i == b->n_gi) return 0; // no GT in b->gi; probably a bug... + gt = b->gi[i]; + // move GT to the first + for (; i > 0; --i) b->gi[i] = b->gi[i-1]; + b->gi[0] = gt; + memmove(b->fmt + 3, b->fmt, s + 1 - b->fmt); + b->fmt[0] = 'G'; b->fmt[1] = 'T'; b->fmt[2] = ':'; + return 0; +} + +int bcf_fix_pl(bcf1_t *b) +{ + int i; + uint32_t tmp; + uint8_t *PL, *swap; + bcf_ginfo_t *gi; + // pinpoint PL + tmp = bcf_str2int("PL", 2); + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == tmp) break; + if (i == b->n_gi) return 0; + // prepare + gi = b->gi + i; + PL = (uint8_t*)gi->data; + swap = alloca(gi->len); + // loop through individuals + for (i = 0; i < b->n_smpl; ++i) { + int k, l, x; + uint8_t *PLi = PL + i * gi->len; + memcpy(swap, PLi, gi->len); + for (k = x = 0; k < b->n_alleles; ++k) + for (l = k; l < b->n_alleles; ++l) + PLi[l*(l+1)/2 + k] = swap[x++]; + } + return 0; +} + +int bcf_smpl_covered(const bcf1_t *b) +{ + int i, j, n = 0; + uint32_t tmp; + bcf_ginfo_t *gi; + // pinpoint PL + tmp = bcf_str2int("PL", 2); + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == tmp) break; + if (i == b->n_gi) return 0; + // count how many samples having PL!=[0..0] + gi = b->gi + i; + for (i = 0; i < b->n_smpl; ++i) { + uint8_t *PLi = ((uint8_t*)gi->data) + i * gi->len; + for (j = 0; j < gi->len; ++j) + if (PLi[j]) break; + if (j < gi->len) ++n; + } + return n; +} + +static void *locate_field(const bcf1_t *b, const char *fmt, int l) +{ + int i; + uint32_t tmp; + tmp = bcf_str2int(fmt, l); + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == tmp) break; + return i == b->n_gi? 0 : b->gi[i].data; +} + +int bcf_anno_max(bcf1_t *b) +{ + int k, max_gq, max_sp, n_het; + kstring_t str; + uint8_t *gt, *gq; + int32_t *sp; + max_gq = max_sp = n_het = 0; + gt = locate_field(b, "GT", 2); + if (gt == 0) return -1; + gq = locate_field(b, "GQ", 2); + sp = locate_field(b, "SP", 2); + if (sp) + for (k = 0; k < b->n_smpl; ++k) + if (gt[k]&0x3f) + max_sp = max_sp > (int)sp[k]? max_sp : sp[k]; + if (gq) + for (k = 0; k < b->n_smpl; ++k) + if (gt[k]&0x3f) + max_gq = max_gq > (int)gq[k]? max_gq : gq[k]; + for (k = 0; k < b->n_smpl; ++k) { + int a1, a2; + a1 = gt[k]&7; a2 = gt[k]>>3&7; + if ((!a1 && a2) || (!a2 && a1)) { // a het + if (gq == 0) ++n_het; + else if (gq[k] >= 20) ++n_het; + } + } + if (n_het) max_sp -= (int)(4.343 * log(n_het) + .499); + if (max_sp < 0) max_sp = 0; + memset(&str, 0, sizeof(kstring_t)); + if (*b->info) kputc(';', &str); + ksprintf(&str, "MXSP=%d;MXGQ=%d", max_sp, max_gq); + bcf_append_info(b, str.s, str.l); + free(str.s); + return 0; +} + +// FIXME: only data are shuffled; the header is NOT +int bcf_shuffle(bcf1_t *b, int seed) +{ + int i, j, *a; + if (seed > 0) srand48(seed); + a = malloc(b->n_smpl * sizeof(int)); + for (i = 0; i < b->n_smpl; ++i) a[i] = i; + for (i = b->n_smpl; i > 1; --i) { + int tmp; + j = (int)(drand48() * i); + tmp = a[j]; a[j] = a[i-1]; a[i-1] = tmp; + } + for (j = 0; j < b->n_gi; ++j) { + bcf_ginfo_t *gi = b->gi + j; + uint8_t *swap, *data = (uint8_t*)gi->data; + swap = malloc(gi->len * b->n_smpl); + for (i = 0; i < b->n_smpl; ++i) + memcpy(swap + gi->len * a[i], data + gi->len * i, gi->len); + free(gi->data); + gi->data = swap; + } + free(a); + return 0; +} + +bcf_hdr_t *bcf_hdr_subsam(const bcf_hdr_t *h0, int n, char *const* samples, int *list) +{ + int i, ret, j; + khint_t k; + bcf_hdr_t *h; + khash_t(str2id) *hash; + kstring_t s; + s.l = s.m = 0; s.s = 0; + hash = kh_init(str2id); + for (i = 0; i < h0->n_smpl; ++i) { + k = kh_put(str2id, hash, h0->sns[i], &ret); + kh_val(hash, k) = i; + } + for (i = j = 0; i < n; ++i) { + k = kh_get(str2id, hash, samples[i]); + if (k != kh_end(hash)) { + list[j++] = kh_val(hash, k); + kputs(samples[i], &s); kputc('\0', &s); + } + } + if (j < n) fprintf(pysamerr, "<%s> %d samples in the list but not in BCF.", __func__, n - j); + kh_destroy(str2id, hash); + h = calloc(1, sizeof(bcf_hdr_t)); + *h = *h0; + h->ns = 0; h->sns = 0; + h->name = malloc(h->l_nm); memcpy(h->name, h0->name, h->l_nm); + h->txt = calloc(1, h->l_txt + 1); memcpy(h->txt, h0->txt, h->l_txt); + h->l_smpl = s.l; h->sname = s.s; + bcf_hdr_sync(h); + return h; +} + +int bcf_subsam(int n_smpl, int *list, bcf1_t *b) +{ + int i, j; + for (j = 0; j < b->n_gi; ++j) { + bcf_ginfo_t *gi = b->gi + j; + uint8_t *swap; + swap = malloc(gi->len * b->n_smpl); + for (i = 0; i < n_smpl; ++i) + memcpy(swap + i * gi->len, (uint8_t*)gi->data + list[i] * gi->len, gi->len); + free(gi->data); + gi->data = swap; + } + b->n_smpl = n_smpl; + return 0; +} + +static int8_t nt4_table[128] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 /*'-'*/, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, -1, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, -1, 4, 4, 4, 4, 4, 4, 4 +}; + +int bcf_gl10(const bcf1_t *b, uint8_t *gl) +{ + int a[4], k, l, map[4], k1, j, i; + const bcf_ginfo_t *PL; + char *s; + if (b->ref[1] != 0 || b->n_alleles > 4) return -1; // ref is not a single base or >4 alleles + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + PL = b->gi + i; + a[0] = nt4_table[(int)b->ref[0]]; + if (a[0] > 3 || a[0] < 0) return -1; // ref is not A/C/G/T + a[1] = a[2] = a[3] = -2; // -1 has a special meaning + if (b->alt[0] == 0) return -1; // no alternate allele + map[0] = map[1] = map[2] = map[3] = -2; + map[a[0]] = 0; + for (k = 0, s = b->alt, k1 = -1; k < 3 && *s; ++k, s += 2) { + if (s[1] != ',' && s[1] != 0) return -1; // ALT is not single base + a[k+1] = nt4_table[(int)*s]; + if (a[k+1] >= 0) map[a[k+1]] = k+1; + else k1 = k + 1; + if (s[1] == 0) break; // the end of the ALT string + } + for (k = 0; k < 4; ++k) + if (map[k] < 0) map[k] = k1; + for (i = 0; i < b->n_smpl; ++i) { + const uint8_t *p = PL->data + i * PL->len; // the PL for the i-th individual + uint8_t *g = gl + 10 * i; + for (k = j = 0; k < 4; ++k) { + for (l = k; l < 4; ++l) { + int t, x = map[k], y = map[l]; + if (x > y) t = x, x = y, y = t; // make sure x is the smaller + g[j++] = p[y * (y+1) / 2 + x]; + } + } + } + return 0; +} + +int bcf_gl10_indel(const bcf1_t *b, uint8_t *gl) +{ + int k, l, j, i; + const bcf_ginfo_t *PL; + if (b->alt[0] == 0) return -1; // no alternate allele + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + PL = b->gi + i; + for (i = 0; i < b->n_smpl; ++i) { + const uint8_t *p = PL->data + i * PL->len; // the PL for the i-th individual + uint8_t *g = gl + 10 * i; + for (k = j = 0; k < 4; ++k) { + for (l = k; l < 4; ++l) { + int t, x = k, y = l; + if (x > y) t = x, x = y, y = t; // make sure x is the smaller + x = y * (y+1) / 2 + x; + g[j++] = x < PL->len? p[x] : 255; + } + } + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/call1.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/call1.c.pysam.c new file mode 100755 index 0000000..fcd2456 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/call1.c.pysam.c @@ -0,0 +1,588 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "bcf.h" +#include "prob1.h" +#include "kstring.h" +#include "time.h" + +#ifdef _WIN32 +#define srand48(x) srand(x) +#define lrand48() rand() +#endif + +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 16384) + +#define VC_NO_GENO 2 +#define VC_BCFOUT 4 +#define VC_CALL 8 +#define VC_VARONLY 16 +#define VC_VCFIN 32 +#define VC_UNCOMP 64 +#define VC_KEEPALT 256 +#define VC_ACGT_ONLY 512 +#define VC_QCALL 1024 +#define VC_CALL_GT 2048 +#define VC_ADJLD 4096 +#define VC_NO_INDEL 8192 +#define VC_ANNO_MAX 16384 +#define VC_FIX_PL 32768 +#define VC_EM 0x10000 +#define VC_PAIRCALL 0x20000 +#define VC_QCNT 0x40000 + +typedef struct { + int flag, prior_type, n1, n_sub, *sublist, n_perm; + uint32_t *trio_aux; + char *prior_file, **subsam, *fn_dict; + uint8_t *ploidy; + double theta, pref, indel_frac, min_perm_p, min_smpl_frac, min_lrt; + void *bed; +} viewconf_t; + +void *bed_read(const char *fn); +void bed_destroy(void *_h); +int bed_overlap(const void *_h, const char *chr, int beg, int end); + +typedef struct { + double p[4]; + int mq, depth, is_tested, d[4]; +} anno16_t; + +static double ttest(int n1, int n2, int a[4]) +{ + extern double kf_betai(double a, double b, double x); + double t, v, u1, u2; + if (n1 == 0 || n2 == 0 || n1 + n2 < 3) return 1.0; + u1 = (double)a[0] / n1; u2 = (double)a[2] / n2; + if (u1 <= u2) return 1.; + t = (u1 - u2) / sqrt(((a[1] - n1 * u1 * u1) + (a[3] - n2 * u2 * u2)) / (n1 + n2 - 2) * (1./n1 + 1./n2)); + v = n1 + n2 - 2; +// printf("%d,%d,%d,%d,%lf,%lf,%lf\n", a[0], a[1], a[2], a[3], t, u1, u2); + return t < 0.? 1. : .5 * kf_betai(.5*v, .5, v/(v+t*t)); +} + +static int test16_core(int anno[16], anno16_t *a) +{ + extern double kt_fisher_exact(int n11, int n12, int n21, int n22, double *_left, double *_right, double *two); + double left, right; + int i; + a->p[0] = a->p[1] = a->p[2] = a->p[3] = 1.; + memcpy(a->d, anno, 4 * sizeof(int)); + a->depth = anno[0] + anno[1] + anno[2] + anno[3]; + a->is_tested = (anno[0] + anno[1] > 0 && anno[2] + anno[3] > 0); + if (a->depth == 0) return -1; + a->mq = (int)(sqrt((anno[9] + anno[11]) / a->depth) + .499); + kt_fisher_exact(anno[0], anno[1], anno[2], anno[3], &left, &right, &a->p[0]); + for (i = 1; i < 4; ++i) + a->p[i] = ttest(anno[0] + anno[1], anno[2] + anno[3], anno+4*i); + return 0; +} + +static int test16(bcf1_t *b, anno16_t *a) +{ + char *p; + int i, anno[16]; + a->p[0] = a->p[1] = a->p[2] = a->p[3] = 1.; + a->d[0] = a->d[1] = a->d[2] = a->d[3] = 0.; + a->mq = a->depth = a->is_tested = 0; + if ((p = strstr(b->info, "I16=")) == 0) return -1; + p += 4; + for (i = 0; i < 16; ++i) { + errno = 0; anno[i] = strtol(p, &p, 10); + if (anno[i] == 0 && (errno == EINVAL || errno == ERANGE)) return -2; + ++p; + } + return test16_core(anno, a); +} + +static void rm_info(bcf1_t *b, const char *key) +{ + char *p, *q; + if ((p = strstr(b->info, key)) == 0) return; + for (q = p; *q && *q != ';'; ++q); + if (p > b->info && *(p-1) == ';') --p; + memmove(p, q, b->l_str - (q - b->str)); + b->l_str -= q - p; + bcf_sync(b); +} + +static int update_bcf1(bcf1_t *b, const bcf_p1aux_t *pa, const bcf_p1rst_t *pr, double pref, int flag, double em[10], int cons_llr, int64_t cons_gt) +{ + kstring_t s; + int has_I16, is_var; + double fq, r; + anno16_t a; + + has_I16 = test16(b, &a) >= 0? 1 : 0; + rm_info(b, "I16="); // FIXME: probably this function has a bug. If I move it below, I16 will not be removed! + + memset(&s, 0, sizeof(kstring_t)); + kputc('\0', &s); kputs(b->ref, &s); kputc('\0', &s); + kputs(b->alt, &s); kputc('\0', &s); kputc('\0', &s); + kputs(b->info, &s); + if (b->info[0]) kputc(';', &s); + { // print EM + if (em[0] >= 0) ksprintf(&s, "AF1=%.4g", 1 - em[0]); + if (em[4] >= 0 && em[4] <= 0.05) ksprintf(&s, ";G3=%.4g,%.4g,%.4g;HWE=%.3g", em[3], em[2], em[1], em[4]); + if (em[5] >= 0 && em[6] >= 0) ksprintf(&s, ";AF2=%.4g,%.4g", 1 - em[5], 1 - em[6]); + if (em[7] >= 0) ksprintf(&s, ";LRT=%.3g", em[7]); + if (em[8] >= 0) ksprintf(&s, ";LRT2=%.3g", em[8]); + } + if (cons_llr > 0) { + ksprintf(&s, ";CLR=%d", cons_llr); + if (cons_gt > 0) + ksprintf(&s, ";UGT=%c%c%c;CGT=%c%c%c", cons_gt&0xff, cons_gt>>8&0xff, cons_gt>>16&0xff, + cons_gt>>32&0xff, cons_gt>>40&0xff, cons_gt>>48&0xff); + } + if (pr == 0) { // if pr is unset, return + kputc('\0', &s); kputs(b->fmt, &s); kputc('\0', &s); + free(b->str); + b->m_str = s.m; b->l_str = s.l; b->str = s.s; + bcf_sync(b); + return 1; + } + + is_var = (pr->p_ref < pref); + r = is_var? pr->p_ref : pr->p_var; + +// ksprintf(&s, ";CI95=%.4g,%.4g", pr->cil, pr->cih); // FIXME: when EM is not used, ";" should be omitted! + ksprintf(&s, ";AC1=%d", pr->ac); + if (has_I16) ksprintf(&s, ";DP4=%d,%d,%d,%d;MQ=%d", a.d[0], a.d[1], a.d[2], a.d[3], a.mq); + fq = pr->p_ref_folded < 0.5? -4.343 * log(pr->p_ref_folded) : 4.343 * log(pr->p_var_folded); + if (fq < -999) fq = -999; + if (fq > 999) fq = 999; + ksprintf(&s, ";FQ=%.3g", fq); + if (pr->cmp[0] >= 0.) { // two sample groups + int i, q[3]; + for (i = 1; i < 3; ++i) { + double x = pr->cmp[i] + pr->cmp[0]/2.; + q[i] = x == 0? 255 : (int)(-4.343 * log(x) + .499); + if (q[i] > 255) q[i] = 255; + } + if (pr->perm_rank >= 0) ksprintf(&s, ";PR=%d", pr->perm_rank); + // ksprintf(&s, ";LRT3=%.3g", pr->lrt); + ksprintf(&s, ";PCHI2=%.3g;PC2=%d,%d", q[1], q[2], pr->p_chi2); + } + if (has_I16 && a.is_tested) ksprintf(&s, ";PV4=%.2g,%.2g,%.2g,%.2g", a.p[0], a.p[1], a.p[2], a.p[3]); + kputc('\0', &s); + kputs(b->fmt, &s); kputc('\0', &s); + free(b->str); + b->m_str = s.m; b->l_str = s.l; b->str = s.s; + b->qual = r < 1e-100? 999 : -4.343 * log(r); + if (b->qual > 999) b->qual = 999; + bcf_sync(b); + if (!is_var) bcf_shrink_alt(b, 1); + else if (!(flag&VC_KEEPALT)) + bcf_shrink_alt(b, pr->rank0 < 2? 2 : pr->rank0+1); + if (is_var && (flag&VC_CALL_GT)) { // call individual genotype + int i, x, old_n_gi = b->n_gi; + s.m = b->m_str; s.l = b->l_str - 1; s.s = b->str; + kputs(":GT:GQ", &s); kputc('\0', &s); + b->m_str = s.m; b->l_str = s.l; b->str = s.s; + bcf_sync(b); + for (i = 0; i < b->n_smpl; ++i) { + x = bcf_p1_call_gt(pa, pr->f_exp, i); + ((uint8_t*)b->gi[old_n_gi].data)[i] = (x&3) == 0? 1<<3|1 : (x&3) == 1? 1 : 0; + ((uint8_t*)b->gi[old_n_gi+1].data)[i] = x>>2; + } + } + return is_var; +} + +static char **read_samples(const char *fn, int *_n) +{ + gzFile fp; + kstream_t *ks; + kstring_t s; + int dret, n = 0, max = 0; + char **sam = 0; + *_n = 0; + s.l = s.m = 0; s.s = 0; + fp = gzopen(fn, "r"); + if (fp == 0) return 0; // fail to open file + ks = ks_init(fp); + while (ks_getuntil(ks, 0, &s, &dret) >= 0) { + int l; + if (max == n) { + max = max? max<<1 : 4; + sam = realloc(sam, sizeof(void*)*max); + } + l = s.l; + sam[n] = malloc(s.l + 2); + strcpy(sam[n], s.s); + sam[n][l+1] = 2; // by default, diploid + if (dret != '\n') { + if (ks_getuntil(ks, 0, &s, &dret) >= 0) { // read ploidy, 1 or 2 + int x = (int)s.s[0] - '0'; + if (x == 1 || x == 2) sam[n][l+1] = x; + else fprintf(pysamerr, "(%s) ploidy can only be 1 or 2; assume diploid\n", __func__); + } + if (dret != '\n') ks_getuntil(ks, '\n', &s, &dret); + } + ++n; + } + ks_destroy(ks); + gzclose(fp); + free(s.s); + *_n = n; + return sam; +} + +static void write_header(bcf_hdr_t *h) +{ + kstring_t str; + str.l = h->l_txt? h->l_txt - 1 : 0; + str.m = str.l + 1; str.s = h->txt; + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); +// if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##INFO=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + if (!strstr(str.s, "##FORMAT=\n", &str); + h->l_txt = str.l + 1; h->txt = str.s; +} + +double bcf_pair_freq(const bcf1_t *b0, const bcf1_t *b1, double f[4]); + +int bcfview(int argc, char *argv[]) +{ + extern int bcf_2qcall(bcf_hdr_t *h, bcf1_t *b); + extern void bcf_p1_indel_prior(bcf_p1aux_t *ma, double x); + extern int bcf_fix_gt(bcf1_t *b); + extern int bcf_anno_max(bcf1_t *b); + extern int bcf_shuffle(bcf1_t *b, int seed); + extern uint32_t *bcf_trio_prep(int is_x, int is_son); + extern int bcf_trio_call(uint32_t *prep, const bcf1_t *b, int *llr, int64_t *gt); + extern int bcf_pair_call(const bcf1_t *b); + extern int bcf_min_diff(const bcf1_t *b); + + bcf_t *bp, *bout = 0; + bcf1_t *b, *blast; + int c, *seeds = 0; + uint64_t n_processed = 0, qcnt[256]; + viewconf_t vc; + bcf_p1aux_t *p1 = 0; + bcf_hdr_t *hin, *hout; + int tid, begin, end; + char moder[4], modew[4]; + + tid = begin = end = -1; + memset(&vc, 0, sizeof(viewconf_t)); + vc.prior_type = vc.n1 = -1; vc.theta = 1e-3; vc.pref = 0.5; vc.indel_frac = -1.; vc.n_perm = 0; vc.min_perm_p = 0.01; vc.min_smpl_frac = 0; vc.min_lrt = 1; + memset(qcnt, 0, 8 * 256); + while ((c = getopt(argc, argv, "FN1:l:cC:eHAGvbSuP:t:p:QgLi:IMs:D:U:X:d:T:Y")) >= 0) { + switch (c) { + case '1': vc.n1 = atoi(optarg); break; + case 'l': vc.bed = bed_read(optarg); break; + case 'D': vc.fn_dict = strdup(optarg); break; + case 'F': vc.flag |= VC_FIX_PL; break; + case 'N': vc.flag |= VC_ACGT_ONLY; break; + case 'G': vc.flag |= VC_NO_GENO; break; + case 'A': vc.flag |= VC_KEEPALT; break; + case 'b': vc.flag |= VC_BCFOUT; break; + case 'S': vc.flag |= VC_VCFIN; break; + case 'c': vc.flag |= VC_CALL; break; + case 'e': vc.flag |= VC_EM; break; + case 'v': vc.flag |= VC_VARONLY | VC_CALL; break; + case 'u': vc.flag |= VC_UNCOMP | VC_BCFOUT; break; + case 'g': vc.flag |= VC_CALL_GT | VC_CALL; break; + case 'I': vc.flag |= VC_NO_INDEL; break; + case 'M': vc.flag |= VC_ANNO_MAX; break; + case 'Y': vc.flag |= VC_QCNT; break; + case 't': vc.theta = atof(optarg); break; + case 'p': vc.pref = atof(optarg); break; + case 'i': vc.indel_frac = atof(optarg); break; + case 'Q': vc.flag |= VC_QCALL; break; + case 'L': vc.flag |= VC_ADJLD; break; + case 'U': vc.n_perm = atoi(optarg); break; + case 'C': vc.min_lrt = atof(optarg); break; + case 'X': vc.min_perm_p = atof(optarg); break; + case 'd': vc.min_smpl_frac = atof(optarg); break; + case 's': vc.subsam = read_samples(optarg, &vc.n_sub); + vc.ploidy = calloc(vc.n_sub + 1, 1); + for (tid = 0; tid < vc.n_sub; ++tid) vc.ploidy[tid] = vc.subsam[tid][strlen(vc.subsam[tid]) + 1]; + tid = -1; + break; + case 'T': + if (strcmp(optarg, "trioauto") == 0) vc.trio_aux = bcf_trio_prep(0, 0); + else if (strcmp(optarg, "trioxd") == 0) vc.trio_aux = bcf_trio_prep(1, 0); + else if (strcmp(optarg, "trioxs") == 0) vc.trio_aux = bcf_trio_prep(1, 1); + else if (strcmp(optarg, "pair") == 0) vc.flag |= VC_PAIRCALL; + else { + fprintf(pysamerr, "[%s] Option '-T' can only take value trioauto, trioxd or trioxs.\n", __func__); + return 1; + } + break; + case 'P': + if (strcmp(optarg, "full") == 0) vc.prior_type = MC_PTYPE_FULL; + else if (strcmp(optarg, "cond2") == 0) vc.prior_type = MC_PTYPE_COND2; + else if (strcmp(optarg, "flat") == 0) vc.prior_type = MC_PTYPE_FLAT; + else vc.prior_file = strdup(optarg); + break; + } + } + if (argc == optind) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: bcftools view [options] [reg]\n\n"); + fprintf(pysamerr, "Input/output options:\n\n"); + fprintf(pysamerr, " -A keep all possible alternate alleles at variant sites\n"); + fprintf(pysamerr, " -b output BCF instead of VCF\n"); + fprintf(pysamerr, " -D FILE sequence dictionary for VCF->BCF conversion [null]\n"); + fprintf(pysamerr, " -F PL generated by r921 or before (which generate old ordering)\n"); + fprintf(pysamerr, " -G suppress all individual genotype information\n"); + fprintf(pysamerr, " -l FILE list of sites (chr pos) or regions (BED) to output [all sites]\n"); + fprintf(pysamerr, " -L calculate LD for adjacent sites\n"); + fprintf(pysamerr, " -N skip sites where REF is not A/C/G/T\n"); + fprintf(pysamerr, " -Q output the QCALL likelihood format\n"); + fprintf(pysamerr, " -s FILE list of samples to use [all samples]\n"); + fprintf(pysamerr, " -S input is VCF\n"); + fprintf(pysamerr, " -u uncompressed BCF output (force -b)\n"); + fprintf(pysamerr, "\nConsensus/variant calling options:\n\n"); + fprintf(pysamerr, " -c SNP calling (force -e)\n"); + fprintf(pysamerr, " -d FLOAT skip loci where less than FLOAT fraction of samples covered [0]\n"); + fprintf(pysamerr, " -e likelihood based analyses\n"); + fprintf(pysamerr, " -g call genotypes at variant sites (force -c)\n"); + fprintf(pysamerr, " -i FLOAT indel-to-substitution ratio [%.4g]\n", vc.indel_frac); + fprintf(pysamerr, " -I skip indels\n"); + fprintf(pysamerr, " -p FLOAT variant if P(ref|D)BCF conversion please specify the sequence dictionary with -D\n", __func__); + return 1; + } + if (vc.n1 <= 0) vc.n_perm = 0; // TODO: give a warning here! + if (vc.n_perm > 0) { + seeds = malloc(vc.n_perm * sizeof(int)); + srand48(time(0)); + for (c = 0; c < vc.n_perm; ++c) seeds[c] = lrand48(); + } + b = calloc(1, sizeof(bcf1_t)); + blast = calloc(1, sizeof(bcf1_t)); + strcpy(moder, "r"); + if (!(vc.flag & VC_VCFIN)) strcat(moder, "b"); + strcpy(modew, "w"); + if (vc.flag & VC_BCFOUT) strcat(modew, "b"); + if (vc.flag & VC_UNCOMP) strcat(modew, "u"); + bp = vcf_open(argv[optind], moder); + hin = hout = vcf_hdr_read(bp); + if (vc.fn_dict && (vc.flag & VC_VCFIN)) + vcf_dictread(bp, hin, vc.fn_dict); + bout = vcf_open("-", modew); + if (!(vc.flag & VC_QCALL)) { + if (vc.n_sub) { + vc.sublist = calloc(vc.n_sub, sizeof(int)); + hout = bcf_hdr_subsam(hin, vc.n_sub, vc.subsam, vc.sublist); + } + if (vc.flag & VC_CALL) write_header(hout); + vcf_hdr_write(bout, hout); + } + if (vc.flag & VC_CALL) { + p1 = bcf_p1_init(hout->n_smpl, vc.ploidy); + if (vc.prior_file) { + if (bcf_p1_read_prior(p1, vc.prior_file) < 0) { + fprintf(pysamerr, "[%s] fail to read the prior AFS.\n", __func__); + return 1; + } + } else bcf_p1_init_prior(p1, vc.prior_type, vc.theta); + if (vc.n1 > 0 && vc.min_lrt > 0.) { // set n1 + bcf_p1_set_n1(p1, vc.n1); + bcf_p1_init_subprior(p1, vc.prior_type, vc.theta); + } + if (vc.indel_frac > 0.) bcf_p1_indel_prior(p1, vc.indel_frac); // otherwise use the default indel_frac + } + if (optind + 1 < argc && !(vc.flag&VC_VCFIN)) { + void *str2id = bcf_build_refhash(hout); + if (bcf_parse_region(str2id, argv[optind+1], &tid, &begin, &end) >= 0) { + bcf_idx_t *idx; + idx = bcf_idx_load(argv[optind]); + if (idx) { + uint64_t off; + off = bcf_idx_query(idx, tid, begin); + if (off == 0) { + fprintf(pysamerr, "[%s] no records in the query region.\n", __func__); + return 1; // FIXME: a lot of memory leaks... + } + bgzf_seek(bp->fp, off, SEEK_SET); + bcf_idx_destroy(idx); + } + } + } + while (vcf_read(bp, hin, b) > 0) { + int is_indel, cons_llr = -1; + int64_t cons_gt = -1; + double em[10]; + if ((vc.flag & VC_VARONLY) && strcmp(b->alt, "X") == 0) continue; + if ((vc.flag & VC_VARONLY) && vc.min_smpl_frac > 0.) { + extern int bcf_smpl_covered(const bcf1_t *b); + int n = bcf_smpl_covered(b); + if ((double)n / b->n_smpl < vc.min_smpl_frac) continue; + } + if (vc.n_sub) bcf_subsam(vc.n_sub, vc.sublist, b); + if (vc.flag & VC_FIX_PL) bcf_fix_pl(b); + is_indel = bcf_is_indel(b); + if ((vc.flag & VC_NO_INDEL) && is_indel) continue; + if ((vc.flag & VC_ACGT_ONLY) && !is_indel) { + int x; + if (b->ref[0] == 0 || b->ref[1] != 0) continue; + x = toupper(b->ref[0]); + if (x != 'A' && x != 'C' && x != 'G' && x != 'T') continue; + } + if (vc.bed && !bed_overlap(vc.bed, hin->ns[b->tid], b->pos, b->pos + strlen(b->ref))) continue; + if (tid >= 0) { + int l = strlen(b->ref); + l = b->pos + (l > 0? l : 1); + if (b->tid != tid || b->pos >= end) break; + if (!(l > begin && end > b->pos)) continue; + } + ++n_processed; + if ((vc.flag & VC_QCNT) && !is_indel) { // summarize the difference + int x = bcf_min_diff(b); + if (x > 255) x = 255; + if (x >= 0) ++qcnt[x]; + } + if (vc.flag & VC_QCALL) { // output QCALL format; STOP here + bcf_2qcall(hout, b); + continue; + } + if (vc.trio_aux) // do trio calling + bcf_trio_call(vc.trio_aux, b, &cons_llr, &cons_gt); + else if (vc.flag & VC_PAIRCALL) + cons_llr = bcf_pair_call(b); + if (vc.flag & (VC_CALL|VC_ADJLD|VC_EM)) bcf_gl2pl(b); + if (vc.flag & VC_EM) bcf_em1(b, vc.n1, 0x1ff, em); + else { + int i; + for (i = 0; i < 9; ++i) em[i] = -1.; + } + if (vc.flag & VC_CALL) { // call variants + bcf_p1rst_t pr; + int calret = bcf_p1_cal(b, (em[7] >= 0 && em[7] < vc.min_lrt), p1, &pr); + if (n_processed % 100000 == 0) { + fprintf(pysamerr, "[%s] %ld sites processed.\n", __func__, (long)n_processed); + bcf_p1_dump_afs(p1); + } + if (pr.p_ref >= vc.pref && (vc.flag & VC_VARONLY)) continue; + if (vc.n_perm && vc.n1 > 0 && pr.p_chi2 < vc.min_perm_p) { // permutation test + bcf_p1rst_t r; + int i, n = 0; + for (i = 0; i < vc.n_perm; ++i) { +#ifdef BCF_PERM_LRT // LRT based permutation is much faster but less robust to artifacts + double x[10]; + bcf_shuffle(b, seeds[i]); + bcf_em1(b, vc.n1, 1<<7, x); + if (x[7] < em[7]) ++n; +#else + bcf_shuffle(b, seeds[i]); + bcf_p1_cal(b, 1, p1, &r); + if (pr.p_chi2 >= r.p_chi2) ++n; +#endif + } + pr.perm_rank = n; + } + if (calret >= 0) update_bcf1(b, p1, &pr, vc.pref, vc.flag, em, cons_llr, cons_gt); + } else if (vc.flag & VC_EM) update_bcf1(b, 0, 0, 0, vc.flag, em, cons_llr, cons_gt); + if (vc.flag & VC_ADJLD) { // compute LD + double f[4], r2; + if ((r2 = bcf_pair_freq(blast, b, f)) >= 0) { + kstring_t s; + s.m = s.l = 0; s.s = 0; + if (*b->info) kputc(';', &s); + ksprintf(&s, "NEIR=%.3f;NEIF4=%.3f,%.3f,%.3f,%.3f", r2, f[0], f[1], f[2], f[3]); + bcf_append_info(b, s.s, s.l); + free(s.s); + } + bcf_cpy(blast, b); + } + if (vc.flag & VC_ANNO_MAX) bcf_anno_max(b); + if (vc.flag & VC_NO_GENO) { // do not output GENO fields + b->n_gi = 0; + b->fmt[0] = '\0'; + b->l_str = b->fmt - b->str + 1; + } else bcf_fix_gt(b); + vcf_write(bout, hout, b); + } + if (vc.prior_file) free(vc.prior_file); + if (vc.flag & VC_CALL) bcf_p1_dump_afs(p1); + if (hin != hout) bcf_hdr_destroy(hout); + bcf_hdr_destroy(hin); + bcf_destroy(b); bcf_destroy(blast); + vcf_close(bp); vcf_close(bout); + if (vc.fn_dict) free(vc.fn_dict); + if (vc.ploidy) free(vc.ploidy); + if (vc.trio_aux) free(vc.trio_aux); + if (vc.n_sub) { + int i; + for (i = 0; i < vc.n_sub; ++i) free(vc.subsam[i]); + free(vc.subsam); free(vc.sublist); + } + if (vc.bed) bed_destroy(vc.bed); + if (vc.flag & VC_QCNT) + for (c = 0; c < 256; ++c) + fprintf(pysamerr, "QT\t%d\t%lld\n", c, (long long)qcnt[c]); + if (seeds) free(seeds); + if (p1) bcf_p1_destroy(p1); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/em.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/em.c.pysam.c new file mode 100755 index 0000000..94b6d75 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/em.c.pysam.c @@ -0,0 +1,312 @@ +#include "pysam.h" + +#include +#include +#include +#include "bcf.h" +#include "kmin.h" + +static double g_q2p[256]; + +#define ITER_MAX 50 +#define ITER_TRY 10 +#define EPS 1e-5 + +extern double kf_gammaq(double, double); + +/* + Generic routines + */ +// get the 3 genotype likelihoods +static double *get_pdg3(const bcf1_t *b) +{ + double *pdg; + const uint8_t *PL = 0; + int i, PL_len = 0; + // initialize g_q2p if necessary + if (g_q2p[0] == 0.) + for (i = 0; i < 256; ++i) + g_q2p[i] = pow(10., -i / 10.); + // set PL and PL_len + for (i = 0; i < b->n_gi; ++i) { + if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + PL = (const uint8_t*)b->gi[i].data; + PL_len = b->gi[i].len; + break; + } + } + if (i == b->n_gi) return 0; // no PL + // fill pdg + pdg = malloc(3 * b->n_smpl * sizeof(double)); + for (i = 0; i < b->n_smpl; ++i) { + const uint8_t *pi = PL + i * PL_len; + double *p = pdg + i * 3; + p[0] = g_q2p[pi[2]]; p[1] = g_q2p[pi[1]]; p[2] = g_q2p[pi[0]]; + } + return pdg; +} + +// estimate site allele frequency in a very naive and inaccurate way +static double est_freq(int n, const double *pdg) +{ + int i, gcnt[3], tmp1; + // get a rough estimate of the genotype frequency + gcnt[0] = gcnt[1] = gcnt[2] = 0; + for (i = 0; i < n; ++i) { + const double *p = pdg + i * 3; + if (p[0] != 1. || p[1] != 1. || p[2] != 1.) { + int which = p[0] > p[1]? 0 : 1; + which = p[which] > p[2]? which : 2; + ++gcnt[which]; + } + } + tmp1 = gcnt[0] + gcnt[1] + gcnt[2]; + return (tmp1 == 0)? -1.0 : (.5 * gcnt[1] + gcnt[2]) / tmp1; +} + +/* + Single-locus EM + */ + +typedef struct { + int beg, end; + const double *pdg; +} minaux1_t; + +static double prob1(double f, void *data) +{ + minaux1_t *a = (minaux1_t*)data; + double p = 1., l = 0., f3[3]; + int i; +// printf("brent %lg\n", f); + if (f < 0 || f > 1) return 1e300; + f3[0] = (1.-f)*(1.-f); f3[1] = 2.*f*(1.-f); f3[2] = f*f; + for (i = a->beg; i < a->end; ++i) { + const double *pdg = a->pdg + i * 3; + p *= pdg[0] * f3[0] + pdg[1] * f3[1] + pdg[2] * f3[2]; + if (p < 1e-200) l -= log(p), p = 1.; + } + return l - log(p); +} + +// one EM iteration for allele frequency estimate +static double freq_iter(double *f, const double *_pdg, int beg, int end) +{ + double f0 = *f, f3[3], err; + int i; +// printf("em %lg\n", *f); + f3[0] = (1.-f0)*(1.-f0); f3[1] = 2.*f0*(1.-f0); f3[2] = f0*f0; + for (i = beg, f0 = 0.; i < end; ++i) { + const double *pdg = _pdg + i * 3; + f0 += (pdg[1] * f3[1] + 2. * pdg[2] * f3[2]) + / (pdg[0] * f3[0] + pdg[1] * f3[1] + pdg[2] * f3[2]); + } + f0 /= (end - beg) * 2; + err = fabs(f0 - *f); + *f = f0; + return err; +} + +/* The following function combines EM and Brent's method. When the signal from + * the data is strong, EM is faster but sometimes, EM may converge very slowly. + * When this happens, we switch to Brent's method. The idea is learned from + * Rasmus Nielsen. + */ +static double freqml(double f0, int beg, int end, const double *pdg) +{ + int i; + double f; + for (i = 0, f = f0; i < ITER_TRY; ++i) + if (freq_iter(&f, pdg, beg, end) < EPS) break; + if (i == ITER_TRY) { // haven't converged yet; try Brent's method + minaux1_t a; + a.beg = beg; a.end = end; a.pdg = pdg; + kmin_brent(prob1, f0 == f? .5*f0 : f0, f, (void*)&a, EPS, &f); + } + return f; +} + +// one EM iteration for genotype frequency estimate +static double g3_iter(double g[3], const double *_pdg, int beg, int end) +{ + double err, gg[3]; + int i; + gg[0] = gg[1] = gg[2] = 0.; +// printf("%lg,%lg,%lg\n", g[0], g[1], g[2]); + for (i = beg; i < end; ++i) { + double sum, tmp[3]; + const double *pdg = _pdg + i * 3; + tmp[0] = pdg[0] * g[0]; tmp[1] = pdg[1] * g[1]; tmp[2] = pdg[2] * g[2]; + sum = (tmp[0] + tmp[1] + tmp[2]) * (end - beg); + gg[0] += tmp[0] / sum; gg[1] += tmp[1] / sum; gg[2] += tmp[2] / sum; + } + err = fabs(gg[0] - g[0]) > fabs(gg[1] - g[1])? fabs(gg[0] - g[0]) : fabs(gg[1] - g[1]); + err = err > fabs(gg[2] - g[2])? err : fabs(gg[2] - g[2]); + g[0] = gg[0]; g[1] = gg[1]; g[2] = gg[2]; + return err; +} + +// perform likelihood ratio test +static double lk_ratio_test(int n, int n1, const double *pdg, double f3[3][3]) +{ + double r; + int i; + for (i = 0, r = 1.; i < n1; ++i) { + const double *p = pdg + i * 3; + r *= (p[0] * f3[1][0] + p[1] * f3[1][1] + p[2] * f3[1][2]) + / (p[0] * f3[0][0] + p[1] * f3[0][1] + p[2] * f3[0][2]); + } + for (; i < n; ++i) { + const double *p = pdg + i * 3; + r *= (p[0] * f3[2][0] + p[1] * f3[2][1] + p[2] * f3[2][2]) + / (p[0] * f3[0][0] + p[1] * f3[0][1] + p[2] * f3[0][2]); + } + return r; +} + +// x[0]: ref frequency +// x[1..3]: alt-alt, alt-ref, ref-ref frequenc +// x[4]: HWE P-value +// x[5..6]: group1 freq, group2 freq +// x[7]: 1-degree P-value +// x[8]: 2-degree P-value +int bcf_em1(const bcf1_t *b, int n1, int flag, double x[10]) +{ + double *pdg; + int i, n, n2; + if (b->n_alleles < 2) return -1; // one allele only + // initialization + if (n1 < 0 || n1 > b->n_smpl) n1 = 0; + if (flag & 1<<7) flag |= 7<<5; // compute group freq if LRT is required + if (flag & 0xf<<1) flag |= 0xf<<1; + n = b->n_smpl; n2 = n - n1; + pdg = get_pdg3(b); + if (pdg == 0) return -1; + for (i = 0; i < 10; ++i) x[i] = -1.; // set to negative + { + if ((x[0] = est_freq(n, pdg)) < 0.) { + free(pdg); + return -1; // no data + } + x[0] = freqml(x[0], 0, n, pdg); + } + if (flag & (0xf<<1|3<<8)) { // estimate the genotype frequency and test HWE + double *g = x + 1, f3[3], r; + f3[0] = g[0] = (1 - x[0]) * (1 - x[0]); + f3[1] = g[1] = 2 * x[0] * (1 - x[0]); + f3[2] = g[2] = x[0] * x[0]; + for (i = 0; i < ITER_MAX; ++i) + if (g3_iter(g, pdg, 0, n) < EPS) break; + // Hardy-Weinberg equilibrium (HWE) + for (i = 0, r = 1.; i < n; ++i) { + double *p = pdg + i * 3; + r *= (p[0] * g[0] + p[1] * g[1] + p[2] * g[2]) / (p[0] * f3[0] + p[1] * f3[1] + p[2] * f3[2]); + } + x[4] = kf_gammaq(.5, log(r)); + } + if ((flag & 7<<5) && n1 > 0 && n1 < n) { // group frequency + x[5] = freqml(x[0], 0, n1, pdg); + x[6] = freqml(x[0], n1, n, pdg); + } + if ((flag & 1<<7) && n1 > 0 && n1 < n) { // 1-degree P-value + double f[3], f3[3][3], tmp; + f[0] = x[0]; f[1] = x[5]; f[2] = x[6]; + for (i = 0; i < 3; ++i) + f3[i][0] = (1-f[i])*(1-f[i]), f3[i][1] = 2*f[i]*(1-f[i]), f3[i][2] = f[i]*f[i]; + tmp = log(lk_ratio_test(n, n1, pdg, f3)); + if (tmp < 0) tmp = 0; + x[7] = kf_gammaq(.5, tmp); + } + if ((flag & 3<<8) && n1 > 0 && n1 < n) { // 2-degree P-value + double g[3][3], tmp; + for (i = 0; i < 3; ++i) memcpy(g[i], x + 1, 3 * sizeof(double)); + for (i = 0; i < ITER_MAX; ++i) + if (g3_iter(g[1], pdg, 0, n1) < EPS) break; + for (i = 0; i < ITER_MAX; ++i) + if (g3_iter(g[2], pdg, n1, n) < EPS) break; + tmp = log(lk_ratio_test(n, n1, pdg, g)); + if (tmp < 0) tmp = 0; + x[8] = kf_gammaq(1., tmp); + } + // free + free(pdg); + return 0; +} + +/* + Two-locus EM (LD) + */ + +#define _G1(h, k) ((h>>1&1) + (k>>1&1)) +#define _G2(h, k) ((h&1) + (k&1)) + +// 0: the previous site; 1: the current site +static int pair_freq_iter(int n, double *pdg[2], double f[4]) +{ + double ff[4]; + int i, k, h; +// printf("%lf,%lf,%lf,%lf\n", f[0], f[1], f[2], f[3]); + memset(ff, 0, 4 * sizeof(double)); + for (i = 0; i < n; ++i) { + double *p[2], sum, tmp; + p[0] = pdg[0] + i * 3; p[1] = pdg[1] + i * 3; + for (k = 0, sum = 0.; k < 4; ++k) + for (h = 0; h < 4; ++h) + sum += f[k] * f[h] * p[0][_G1(k,h)] * p[1][_G2(k,h)]; + for (k = 0; k < 4; ++k) { + tmp = f[0] * (p[0][_G1(0,k)] * p[1][_G2(0,k)] + p[0][_G1(k,0)] * p[1][_G2(k,0)]) + + f[1] * (p[0][_G1(1,k)] * p[1][_G2(1,k)] + p[0][_G1(k,1)] * p[1][_G2(k,1)]) + + f[2] * (p[0][_G1(2,k)] * p[1][_G2(2,k)] + p[0][_G1(k,2)] * p[1][_G2(k,2)]) + + f[3] * (p[0][_G1(3,k)] * p[1][_G2(3,k)] + p[0][_G1(k,3)] * p[1][_G2(k,3)]); + ff[k] += f[k] * tmp / sum; + } + } + for (k = 0; k < 4; ++k) f[k] = ff[k] / (2 * n); + return 0; +} + +double bcf_pair_freq(const bcf1_t *b0, const bcf1_t *b1, double f[4]) +{ + const bcf1_t *b[2]; + int i, j, n_smpl; + double *pdg[2], flast[4], r, f0[2]; + // initialize others + if (b0->n_smpl != b1->n_smpl) return -1; // different number of samples + n_smpl = b0->n_smpl; + b[0] = b0; b[1] = b1; + f[0] = f[1] = f[2] = f[3] = -1.; + if (b[0]->n_alleles < 2 || b[1]->n_alleles < 2) return -1; // one allele only + pdg[0] = get_pdg3(b0); pdg[1] = get_pdg3(b1); + if (pdg[0] == 0 || pdg[1] == 0) { + free(pdg[0]); free(pdg[1]); + return -1; + } + // set the initial value + f0[0] = est_freq(n_smpl, pdg[0]); + f0[1] = est_freq(n_smpl, pdg[1]); + f[0] = (1 - f0[0]) * (1 - f0[1]); f[3] = f0[0] * f0[1]; + f[1] = (1 - f0[0]) * f0[1]; f[2] = f0[0] * (1 - f0[1]); + // iteration + for (j = 0; j < ITER_MAX; ++j) { + double eps = 0; + memcpy(flast, f, 4 * sizeof(double)); + pair_freq_iter(n_smpl, pdg, f); + for (i = 0; i < 4; ++i) { + double x = fabs(f[i] - flast[i]); + if (x > eps) eps = x; + } + if (eps < EPS) break; + } + // free + free(pdg[0]); free(pdg[1]); + { // calculate r^2 + double p[2], q[2], D; + p[0] = f[0] + f[1]; q[0] = 1 - p[0]; + p[1] = f[0] + f[2]; q[1] = 1 - p[1]; + D = f[0] * f[3] - f[1] * f[2]; + r = sqrt(D * D / (p[0] * p[1] * q[0] * q[1])); +// printf("R(%lf,%lf,%lf,%lf)=%lf\n", f[0], f[1], f[2], f[3], r); + if (isnan(r)) r = -1.; + } + return r; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/fet.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/fet.c.pysam.c new file mode 100755 index 0000000..cbd3585 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/fet.c.pysam.c @@ -0,0 +1,114 @@ +#include "pysam.h" + +#include +#include + +/* This program is implemented with ideas from this web page: + * + * http://www.langsrud.com/fisher.htm + */ + +// log\binom{n}{k} +static double lbinom(int n, int k) +{ + if (k == 0 || n == k) return 0; + return lgamma(n+1) - lgamma(k+1) - lgamma(n-k+1); +} + +// n11 n12 | n1_ +// n21 n22 | n2_ +//-----------+---- +// n_1 n_2 | n + +// hypergeometric distribution +static double hypergeo(int n11, int n1_, int n_1, int n) +{ + return exp(lbinom(n1_, n11) + lbinom(n-n1_, n_1-n11) - lbinom(n, n_1)); +} + +typedef struct { + int n11, n1_, n_1, n; + double p; +} hgacc_t; + +// incremental version of hypergenometric distribution +static double hypergeo_acc(int n11, int n1_, int n_1, int n, hgacc_t *aux) +{ + if (n1_ || n_1 || n) { + aux->n11 = n11; aux->n1_ = n1_; aux->n_1 = n_1; aux->n = n; + } else { // then only n11 changed; the rest fixed + if (n11%11 && n11 + aux->n - aux->n1_ - aux->n_1) { + if (n11 == aux->n11 + 1) { // incremental + aux->p *= (double)(aux->n1_ - aux->n11) / n11 + * (aux->n_1 - aux->n11) / (n11 + aux->n - aux->n1_ - aux->n_1); + aux->n11 = n11; + return aux->p; + } + if (n11 == aux->n11 - 1) { // incremental + aux->p *= (double)aux->n11 / (aux->n1_ - n11) + * (aux->n11 + aux->n - aux->n1_ - aux->n_1) / (aux->n_1 - n11); + aux->n11 = n11; + return aux->p; + } + } + aux->n11 = n11; + } + aux->p = hypergeo(aux->n11, aux->n1_, aux->n_1, aux->n); + return aux->p; +} + +double kt_fisher_exact(int n11, int n12, int n21, int n22, double *_left, double *_right, double *two) +{ + int i, j, max, min; + double p, q, left, right; + hgacc_t aux; + int n1_, n_1, n; + + n1_ = n11 + n12; n_1 = n11 + n21; n = n11 + n12 + n21 + n22; // calculate n1_, n_1 and n + max = (n_1 < n1_) ? n_1 : n1_; // max n11, for right tail + min = n1_ + n_1 - n; + if (min < 0) min = 0; // min n11, for left tail + *two = *_left = *_right = 1.; + if (min == max) return 1.; // no need to do test + q = hypergeo_acc(n11, n1_, n_1, n, &aux); // the probability of the current table + // left tail + p = hypergeo_acc(min, 0, 0, 0, &aux); + for (left = 0., i = min + 1; p < 0.99999999 * q; ++i) // loop until underflow + left += p, p = hypergeo_acc(i, 0, 0, 0, &aux); + --i; + if (p < 1.00000001 * q) left += p; + else --i; + // right tail + p = hypergeo_acc(max, 0, 0, 0, &aux); + for (right = 0., j = max - 1; p < 0.99999999 * q; --j) // loop until underflow + right += p, p = hypergeo_acc(j, 0, 0, 0, &aux); + ++j; + if (p < 1.00000001 * q) right += p; + else ++j; + // two-tail + *two = left + right; + if (*two > 1.) *two = 1.; + // adjust left and right + if (abs(i - n11) < abs(j - n11)) right = 1. - left + q; + else left = 1.0 - right + q; + *_left = left; *_right = right; + return q; +} + +#ifdef FET_MAIN +#include + +int main(int argc, char *argv[]) +{ + char id[1024]; + int n11, n12, n21, n22; + double left, right, twotail, prob; + + while (scanf("%s%d%d%d%d", id, &n11, &n12, &n21, &n22) == 5) { + prob = kt_fisher_exact(n11, n12, n21, n22, &left, &right, &twotail); + printf("%s\t%d\t%d\t%d\t%d\t%.6g\t%.6g\t%.6g\t%.6g\n", id, n11, n12, n21, n22, + prob, left, right, twotail); + } + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/index.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/index.c.pysam.c new file mode 100755 index 0000000..8258854 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/index.c.pysam.c @@ -0,0 +1,337 @@ +#include "pysam.h" + +#include +#include +#include +#include "bam_endian.h" +#include "kstring.h" +#include "bcf.h" +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +#define TAD_LIDX_SHIFT 13 + +typedef struct { + int32_t n, m; + uint64_t *offset; +} bcf_lidx_t; + +struct __bcf_idx_t { + int32_t n; + bcf_lidx_t *index2; +}; + +/************ + * indexing * + ************/ + +static inline void insert_offset2(bcf_lidx_t *index2, int _beg, int _end, uint64_t offset) +{ + int i, beg, end; + beg = _beg >> TAD_LIDX_SHIFT; + end = (_end - 1) >> TAD_LIDX_SHIFT; + if (index2->m < end + 1) { + int old_m = index2->m; + index2->m = end + 1; + kroundup32(index2->m); + index2->offset = (uint64_t*)realloc(index2->offset, index2->m * 8); + memset(index2->offset + old_m, 0, 8 * (index2->m - old_m)); + } + if (beg == end) { + if (index2->offset[beg] == 0) index2->offset[beg] = offset; + } else { + for (i = beg; i <= end; ++i) + if (index2->offset[i] == 0) index2->offset[i] = offset; + } + if (index2->n < end + 1) index2->n = end + 1; +} + +bcf_idx_t *bcf_idx_core(bcf_t *bp, bcf_hdr_t *h) +{ + bcf_idx_t *idx; + int32_t last_coor, last_tid; + uint64_t last_off; + kstring_t *str; + BGZF *fp = bp->fp; + bcf1_t *b; + int ret; + + b = calloc(1, sizeof(bcf1_t)); + str = calloc(1, sizeof(kstring_t)); + idx = (bcf_idx_t*)calloc(1, sizeof(bcf_idx_t)); + idx->n = h->n_ref; + idx->index2 = calloc(h->n_ref, sizeof(bcf_lidx_t)); + + last_tid = 0xffffffffu; + last_off = bgzf_tell(fp); last_coor = 0xffffffffu; + while ((ret = bcf_read(bp, h, b)) > 0) { + int end, tmp; + if (last_tid != b->tid) { // change of chromosomes + last_tid = b->tid; + } else if (last_coor > b->pos) { + fprintf(pysamerr, "[bcf_idx_core] the input is out of order\n"); + free(str->s); free(str); free(idx); bcf_destroy(b); + return 0; + } + tmp = strlen(b->ref); + end = b->pos + (tmp > 0? tmp : 1); + insert_offset2(&idx->index2[b->tid], b->pos, end, last_off); + last_off = bgzf_tell(fp); + last_coor = b->pos; + } + free(str->s); free(str); bcf_destroy(b); + return idx; +} + +void bcf_idx_destroy(bcf_idx_t *idx) +{ + int i; + if (idx == 0) return; + for (i = 0; i < idx->n; ++i) free(idx->index2[i].offset); + free(idx->index2); + free(idx); +} + +/****************** + * index file I/O * + ******************/ + +void bcf_idx_save(const bcf_idx_t *idx, BGZF *fp) +{ + int32_t i, ti_is_be; + ti_is_be = bam_is_big_endian(); + bgzf_write(fp, "BCI\4", 4); + if (ti_is_be) { + uint32_t x = idx->n; + bgzf_write(fp, bam_swap_endian_4p(&x), 4); + } else bgzf_write(fp, &idx->n, 4); + for (i = 0; i < idx->n; ++i) { + bcf_lidx_t *index2 = idx->index2 + i; + // write linear index (index2) + if (ti_is_be) { + int x = index2->n; + bgzf_write(fp, bam_swap_endian_4p(&x), 4); + } else bgzf_write(fp, &index2->n, 4); + if (ti_is_be) { // big endian + int x; + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + bgzf_write(fp, index2->offset, 8 * index2->n); + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + } else bgzf_write(fp, index2->offset, 8 * index2->n); + } +} + +static bcf_idx_t *bcf_idx_load_core(BGZF *fp) +{ + int i, ti_is_be; + char magic[4]; + bcf_idx_t *idx; + ti_is_be = bam_is_big_endian(); + if (fp == 0) { + fprintf(pysamerr, "[%s] fail to load index.\n", __func__); + return 0; + } + bgzf_read(fp, magic, 4); + if (strncmp(magic, "BCI\4", 4)) { + fprintf(pysamerr, "[%s] wrong magic number.\n", __func__); + return 0; + } + idx = (bcf_idx_t*)calloc(1, sizeof(bcf_idx_t)); + bgzf_read(fp, &idx->n, 4); + if (ti_is_be) bam_swap_endian_4p(&idx->n); + idx->index2 = (bcf_lidx_t*)calloc(idx->n, sizeof(bcf_lidx_t)); + for (i = 0; i < idx->n; ++i) { + bcf_lidx_t *index2 = idx->index2 + i; + int j; + bgzf_read(fp, &index2->n, 4); + if (ti_is_be) bam_swap_endian_4p(&index2->n); + index2->m = index2->n; + index2->offset = (uint64_t*)calloc(index2->m, 8); + bgzf_read(fp, index2->offset, index2->n * 8); + if (ti_is_be) + for (j = 0; j < index2->n; ++j) bam_swap_endian_8p(&index2->offset[j]); + } + return idx; +} + +bcf_idx_t *bcf_idx_load_local(const char *fnidx) +{ + BGZF *fp; + fp = bgzf_open(fnidx, "r"); + if (fp) { + bcf_idx_t *idx = bcf_idx_load_core(fp); + bgzf_close(fp); + return idx; + } else return 0; +} + +#ifdef _USE_KNETFILE +static void download_from_remote(const char *url) +{ + const int buf_size = 1 * 1024 * 1024; + char *fn; + FILE *fp; + uint8_t *buf; + knetFile *fp_remote; + int l; + if (strstr(url, "ftp://") != url && strstr(url, "http://") != url) return; + l = strlen(url); + for (fn = (char*)url + l - 1; fn >= url; --fn) + if (*fn == '/') break; + ++fn; // fn now points to the file name + fp_remote = knet_open(url, "r"); + if (fp_remote == 0) { + fprintf(pysamerr, "[download_from_remote] fail to open remote file.\n"); + return; + } + if ((fp = fopen(fn, "w")) == 0) { + fprintf(pysamerr, "[download_from_remote] fail to create file in the working directory.\n"); + knet_close(fp_remote); + return; + } + buf = (uint8_t*)calloc(buf_size, 1); + while ((l = knet_read(fp_remote, buf, buf_size)) != 0) + fwrite(buf, 1, l, fp); + free(buf); + fclose(fp); + knet_close(fp_remote); +} +#else +static void download_from_remote(const char *url) +{ + return; +} +#endif + +static char *get_local_version(const char *fn) +{ + struct stat sbuf; + char *fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcat(strcpy(fnidx, fn), ".bci"); + if ((strstr(fnidx, "ftp://") == fnidx || strstr(fnidx, "http://") == fnidx)) { + char *p, *url; + int l = strlen(fnidx); + for (p = fnidx + l - 1; p >= fnidx; --p) + if (*p == '/') break; + url = fnidx; fnidx = strdup(p + 1); + if (stat(fnidx, &sbuf) == 0) { + free(url); + return fnidx; + } + fprintf(pysamerr, "[%s] downloading the index file...\n", __func__); + download_from_remote(url); + free(url); + } + if (stat(fnidx, &sbuf) == 0) return fnidx; + free(fnidx); return 0; +} + +bcf_idx_t *bcf_idx_load(const char *fn) +{ + bcf_idx_t *idx; + char *fname = get_local_version(fn); + if (fname == 0) return 0; + idx = bcf_idx_load_local(fname); + free(fname); + return idx; +} + +int bcf_idx_build2(const char *fn, const char *_fnidx) +{ + char *fnidx; + BGZF *fpidx; + bcf_t *bp; + bcf_idx_t *idx; + bcf_hdr_t *h; + if ((bp = bcf_open(fn, "r")) == 0) { + fprintf(pysamerr, "[bcf_idx_build2] fail to open the BAM file.\n"); + return -1; + } + h = bcf_hdr_read(bp); + idx = bcf_idx_core(bp, h); + bcf_close(bp); + if (_fnidx == 0) { + fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcpy(fnidx, fn); strcat(fnidx, ".bci"); + } else fnidx = strdup(_fnidx); + fpidx = bgzf_open(fnidx, "w"); + if (fpidx == 0) { + fprintf(pysamerr, "[bcf_idx_build2] fail to create the index file.\n"); + free(fnidx); + return -1; + } + bcf_idx_save(idx, fpidx); + bcf_idx_destroy(idx); + bgzf_close(fpidx); + free(fnidx); + return 0; +} + +int bcf_idx_build(const char *fn) +{ + return bcf_idx_build2(fn, 0); +} + +/******************************************** + * parse a region in the format chr:beg-end * + ********************************************/ + +int bcf_parse_region(void *str2id, const char *str, int *tid, int *begin, int *end) +{ + char *s, *p; + int i, l, k; + l = strlen(str); + p = s = (char*)malloc(l+1); + /* squeeze out "," */ + for (i = k = 0; i != l; ++i) + if (str[i] != ',' && !isspace(str[i])) s[k++] = str[i]; + s[k] = 0; + for (i = 0; i != k; ++i) if (s[i] == ':') break; + s[i] = 0; + if ((*tid = bcf_str2id(str2id, s)) < 0) { + free(s); + return -1; + } + if (i == k) { /* dump the whole sequence */ + *begin = 0; *end = 1<<29; free(s); + return 0; + } + for (p = s + i + 1; i != k; ++i) if (s[i] == '-') break; + *begin = atoi(p); + if (i < k) { + p = s + i + 1; + *end = atoi(p); + } else *end = 1<<29; + if (*begin > 0) --*begin; + free(s); + if (*begin > *end) return -1; + return 0; +} + +/******************************* + * retrieve a specified region * + *******************************/ + +uint64_t bcf_idx_query(const bcf_idx_t *idx, int tid, int beg) +{ + uint64_t min_off, *offset; + int i; + if (beg < 0) beg = 0; + offset = idx->index2[tid].offset; + for (i = beg>>TAD_LIDX_SHIFT; i < idx->index2[tid].n && offset[i] == 0; ++i); + min_off = (i == idx->index2[tid].n)? offset[idx->index2[tid].n-1] : offset[i]; + return min_off; +} + +int bcf_main_index(int argc, char *argv[]) +{ + if (argc == 1) { + fprintf(pysamerr, "Usage: bcftools index \n"); + return 1; + } + bcf_idx_build(argv[1]); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kfunc.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kfunc.c.pysam.c new file mode 100755 index 0000000..4de836e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kfunc.c.pysam.c @@ -0,0 +1,164 @@ +#include "pysam.h" + +#include + + +/* Log gamma function + * \log{\Gamma(z)} + * AS245, 2nd algorithm, http://lib.stat.cmu.edu/apstat/245 + */ +double kf_lgamma(double z) +{ + double x = 0; + x += 0.1659470187408462e-06 / (z+7); + x += 0.9934937113930748e-05 / (z+6); + x -= 0.1385710331296526 / (z+5); + x += 12.50734324009056 / (z+4); + x -= 176.6150291498386 / (z+3); + x += 771.3234287757674 / (z+2); + x -= 1259.139216722289 / (z+1); + x += 676.5203681218835 / z; + x += 0.9999999999995183; + return log(x) - 5.58106146679532777 - z + (z-0.5) * log(z+6.5); +} + +/* complementary error function + * \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2} dt + * AS66, 2nd algorithm, http://lib.stat.cmu.edu/apstat/66 + */ +double kf_erfc(double x) +{ + const double p0 = 220.2068679123761; + const double p1 = 221.2135961699311; + const double p2 = 112.0792914978709; + const double p3 = 33.912866078383; + const double p4 = 6.37396220353165; + const double p5 = .7003830644436881; + const double p6 = .03526249659989109; + const double q0 = 440.4137358247522; + const double q1 = 793.8265125199484; + const double q2 = 637.3336333788311; + const double q3 = 296.5642487796737; + const double q4 = 86.78073220294608; + const double q5 = 16.06417757920695; + const double q6 = 1.755667163182642; + const double q7 = .08838834764831844; + double expntl, z, p; + z = fabs(x) * M_SQRT2; + if (z > 37.) return x > 0.? 0. : 2.; + expntl = exp(z * z * - .5); + if (z < 10. / M_SQRT2) // for small z + p = expntl * ((((((p6 * z + p5) * z + p4) * z + p3) * z + p2) * z + p1) * z + p0) + / (((((((q7 * z + q6) * z + q5) * z + q4) * z + q3) * z + q2) * z + q1) * z + q0); + else p = expntl / 2.506628274631001 / (z + 1. / (z + 2. / (z + 3. / (z + 4. / (z + .65))))); + return x > 0.? 2. * p : 2. * (1. - p); +} + +/* The following computes regularized incomplete gamma functions. + * Formulas are taken from Wiki, with additional input from Numerical + * Recipes in C (for modified Lentz's algorithm) and AS245 + * (http://lib.stat.cmu.edu/apstat/245). + * + * A good online calculator is available at: + * + * http://www.danielsoper.com/statcalc/calc23.aspx + * + * It calculates upper incomplete gamma function, which equals + * kf_gammaq(s,z)*tgamma(s). + */ + +#define KF_GAMMA_EPS 1e-14 +#define KF_TINY 1e-290 + +// regularized lower incomplete gamma function, by series expansion +static double _kf_gammap(double s, double z) +{ + double sum, x; + int k; + for (k = 1, sum = x = 1.; k < 100; ++k) { + sum += (x *= z / (s + k)); + if (x / sum < KF_GAMMA_EPS) break; + } + return exp(s * log(z) - z - kf_lgamma(s + 1.) + log(sum)); +} +// regularized upper incomplete gamma function, by continued fraction +static double _kf_gammaq(double s, double z) +{ + int j; + double C, D, f; + f = 1. + z - s; C = f; D = 0.; + // Modified Lentz's algorithm for computing continued fraction + // See Numerical Recipes in C, 2nd edition, section 5.2 + for (j = 1; j < 100; ++j) { + double a = j * (s - j), b = (j<<1) + 1 + z - s, d; + D = b + a * D; + if (D < KF_TINY) D = KF_TINY; + C = b + a / C; + if (C < KF_TINY) C = KF_TINY; + D = 1. / D; + d = C * D; + f *= d; + if (fabs(d - 1.) < KF_GAMMA_EPS) break; + } + return exp(s * log(z) - z - kf_lgamma(s) - log(f)); +} + +double kf_gammap(double s, double z) +{ + return z <= 1. || z < s? _kf_gammap(s, z) : 1. - _kf_gammaq(s, z); +} + +double kf_gammaq(double s, double z) +{ + return z <= 1. || z < s? 1. - _kf_gammap(s, z) : _kf_gammaq(s, z); +} + +/* Regularized incomplete beta function. The method is taken from + * Numerical Recipe in C, 2nd edition, section 6.4. The following web + * page calculates the incomplete beta function, which equals + * kf_betai(a,b,x) * gamma(a) * gamma(b) / gamma(a+b): + * + * http://www.danielsoper.com/statcalc/calc36.aspx + */ +static double kf_betai_aux(double a, double b, double x) +{ + double C, D, f; + int j; + if (x == 0.) return 0.; + if (x == 1.) return 1.; + f = 1.; C = f; D = 0.; + // Modified Lentz's algorithm for computing continued fraction + for (j = 1; j < 200; ++j) { + double aa, d; + int m = j>>1; + aa = (j&1)? -(a + m) * (a + b + m) * x / ((a + 2*m) * (a + 2*m + 1)) + : m * (b - m) * x / ((a + 2*m - 1) * (a + 2*m)); + D = 1. + aa * D; + if (D < KF_TINY) D = KF_TINY; + C = 1. + aa / C; + if (C < KF_TINY) C = KF_TINY; + D = 1. / D; + d = C * D; + f *= d; + if (fabs(d - 1.) < KF_GAMMA_EPS) break; + } + return exp(kf_lgamma(a+b) - kf_lgamma(a) - kf_lgamma(b) + a * log(x) + b * log(1.-x)) / a / f; +} +double kf_betai(double a, double b, double x) +{ + return x < (a + 1.) / (a + b + 2.)? kf_betai_aux(a, b, x) : 1. - kf_betai_aux(b, a, 1. - x); +} + +#ifdef KF_MAIN +#include +int main(int argc, char *argv[]) +{ + double x = 5.5, y = 3; + double a, b; + printf("erfc(%lg): %lg, %lg\n", x, erfc(x), kf_erfc(x)); + printf("upper-gamma(%lg,%lg): %lg\n", x, y, kf_gammaq(y, x)*tgamma(y)); + a = 2; b = 2; x = 0.5; + printf("incomplete-beta(%lg,%lg,%lg): %lg\n", a, b, x, kf_betai(a, b, x) / exp(kf_lgamma(a+b) - kf_lgamma(a) - kf_lgamma(b))); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.c.pysam.c new file mode 100755 index 0000000..ee7b512 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.c.pysam.c @@ -0,0 +1,211 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008, 2010 by Attractive Chaos + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Hooke-Jeeves algorithm for nonlinear minimization + + Based on the pseudocodes by Bell and Pike (CACM 9(9):684-685), and + the revision by Tomlin and Smith (CACM 12(11):637-638). Both of the + papers are comments on Kaupe's Algorithm 178 "Direct Search" (ACM + 6(6):313-314). The original algorithm was designed by Hooke and + Jeeves (ACM 8:212-229). This program is further revised according to + Johnson's implementation at Netlib (opt/hooke.c). + + Hooke-Jeeves algorithm is very simple and it works quite well on a + few examples. However, it might fail to converge due to its heuristic + nature. A possible improvement, as is suggested by Johnson, may be to + choose a small r at the beginning to quickly approach to the minimum + and a large r at later step to hit the minimum. + */ + +#include +#include +#include +#include "kmin.h" + +static double __kmin_hj_aux(kmin_f func, int n, double *x1, void *data, double fx1, double *dx, int *n_calls) +{ + int k, j = *n_calls; + double ftmp; + for (k = 0; k != n; ++k) { + x1[k] += dx[k]; + ftmp = func(n, x1, data); ++j; + if (ftmp < fx1) fx1 = ftmp; + else { /* search the opposite direction */ + dx[k] = 0.0 - dx[k]; + x1[k] += dx[k] + dx[k]; + ftmp = func(n, x1, data); ++j; + if (ftmp < fx1) fx1 = ftmp; + else x1[k] -= dx[k]; /* back to the original x[k] */ + } + } + *n_calls = j; + return fx1; /* here: fx1=f(n,x1) */ +} + +double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls) +{ + double fx, fx1, *x1, *dx, radius; + int k, n_calls = 0; + x1 = (double*)calloc(n, sizeof(double)); + dx = (double*)calloc(n, sizeof(double)); + for (k = 0; k != n; ++k) { /* initial directions, based on MGJ */ + dx[k] = fabs(x[k]) * r; + if (dx[k] == 0) dx[k] = r; + } + radius = r; + fx1 = fx = func(n, x, data); ++n_calls; + for (;;) { + memcpy(x1, x, n * sizeof(double)); /* x1 = x */ + fx1 = __kmin_hj_aux(func, n, x1, data, fx, dx, &n_calls); + while (fx1 < fx) { + for (k = 0; k != n; ++k) { + double t = x[k]; + dx[k] = x1[k] > x[k]? fabs(dx[k]) : 0.0 - fabs(dx[k]); + x[k] = x1[k]; + x1[k] = x1[k] + x1[k] - t; + } + fx = fx1; + if (n_calls >= max_calls) break; + fx1 = func(n, x1, data); ++n_calls; + fx1 = __kmin_hj_aux(func, n, x1, data, fx1, dx, &n_calls); + if (fx1 >= fx) break; + for (k = 0; k != n; ++k) + if (fabs(x1[k] - x[k]) > .5 * fabs(dx[k])) break; + if (k == n) break; + } + if (radius >= eps) { + if (n_calls >= max_calls) break; + radius *= r; + for (k = 0; k != n; ++k) dx[k] *= r; + } else break; /* converge */ + } + free(x1); free(dx); + return fx1; +} + +// I copied this function somewhere several years ago with some of my modifications, but I forgot the source. +double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin) +{ + double bound, u, r, q, fu, tmp, fa, fb, fc, c; + const double gold1 = 1.6180339887; + const double gold2 = 0.3819660113; + const double tiny = 1e-20; + const int max_iter = 100; + + double e, d, w, v, mid, tol1, tol2, p, eold, fv, fw; + int iter; + + fa = func(a, data); fb = func(b, data); + if (fb > fa) { // swap, such that f(a) > f(b) + tmp = a; a = b; b = tmp; + tmp = fa; fa = fb; fb = tmp; + } + c = b + gold1 * (b - a), fc = func(c, data); // golden section extrapolation + while (fb > fc) { + bound = b + 100.0 * (c - b); // the farthest point where we want to go + r = (b - a) * (fb - fc); + q = (b - c) * (fb - fa); + if (fabs(q - r) < tiny) { // avoid 0 denominator + tmp = q > r? tiny : 0.0 - tiny; + } else tmp = q - r; + u = b - ((b - c) * q - (b - a) * r) / (2.0 * tmp); // u is the parabolic extrapolation point + if ((b > u && u > c) || (b < u && u < c)) { // u lies between b and c + fu = func(u, data); + if (fu < fc) { // (b,u,c) bracket the minimum + a = b; b = u; fa = fb; fb = fu; + break; + } else if (fu > fb) { // (a,b,u) bracket the minimum + c = u; fc = fu; + break; + } + u = c + gold1 * (c - b); fu = func(u, data); // golden section extrapolation + } else if ((c > u && u > bound) || (c < u && u < bound)) { // u lies between c and bound + fu = func(u, data); + if (fu < fc) { // fb > fc > fu + b = c; c = u; u = c + gold1 * (c - b); + fb = fc; fc = fu; fu = func(u, data); + } else { // (b,c,u) bracket the minimum + a = b; b = c; c = u; + fa = fb; fb = fc; fc = fu; + break; + } + } else if ((u > bound && bound > c) || (u < bound && bound < c)) { // u goes beyond the bound + u = bound; fu = func(u, data); + } else { // u goes the other way around, use golden section extrapolation + u = c + gold1 * (c - b); fu = func(u, data); + } + a = b; b = c; c = u; + fa = fb; fb = fc; fc = fu; + } + if (a > c) u = a, a = c, c = u; // swap + + // now, afb and fb tol1) { + // related to parabolic interpolation + r = (b - w) * (fb - fv); + q = (b - v) * (fb - fw); + p = (b - v) * q - (b - w) * r; + q = 2.0 * (q - r); + if (q > 0.0) p = 0.0 - p; + else q = 0.0 - q; + eold = e; e = d; + if (fabs(p) >= fabs(0.5 * q * eold) || p <= q * (a - b) || p >= q * (c - b)) { + d = gold2 * (e = (b >= mid ? a - b : c - b)); + } else { + d = p / q; u = b + d; // actual parabolic interpolation happens here + if (u - a < tol2 || c - u < tol2) + d = (mid > b)? tol1 : 0.0 - tol1; + } + } else d = gold2 * (e = (b >= mid ? a - b : c - b)); // golden section interpolation + u = fabs(d) >= tol1 ? b + d : b + (d > 0.0? tol1 : -tol1); + fu = func(u, data); + if (fu <= fb) { // u is the minimum point so far + if (u >= b) a = b; + else c = b; + v = w; w = b; b = u; fv = fw; fw = fb; fb = fu; + } else { // adjust (a,c) and (u,v,w) + if (u < b) a = u; + else c = u; + if (fu <= fw || w == b) { + v = w; w = u; + fv = fw; fw = fu; + } else if (fu <= fv || v == b || v == w) { + v = u; fv = fu; + } + } + } + *xmin = b; + return fb; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.h b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.h new file mode 100755 index 0000000..6feba45 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/kmin.h @@ -0,0 +1,46 @@ +/* + Copyright (c) 2008, 2010 by Attractive Chaos + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef KMIN_H +#define KMIN_H + +#define KMIN_RADIUS 0.5 +#define KMIN_EPS 1e-7 +#define KMIN_MAXCALL 50000 + +typedef double (*kmin_f)(int, double*, void*); +typedef double (*kmin1_f)(double, void*); + +#ifdef __cplusplus +extern "C" { +#endif + + double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls); + double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/mut.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/mut.c.pysam.c new file mode 100755 index 0000000..59ffb60 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/mut.c.pysam.c @@ -0,0 +1,129 @@ +#include "pysam.h" + +#include +#include +#include "bcf.h" + +#define MAX_GENO 359 + +int8_t seq_bitcnt[] = { 4, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; +char *seq_nt16rev = "XACMGRSVTWYHKDBN"; + +uint32_t *bcf_trio_prep(int is_x, int is_son) +{ + int i, j, k, n, map[10]; + uint32_t *ret; + ret = calloc(MAX_GENO, 4); + for (i = 0, k = 0; i < 4; ++i) + for (j = i; j < 4; ++j) + map[k++] = 1<n_smpl != 3) return -1; // not a trio + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + gl10 = alloca(10 * b->n_smpl); + if (bcf_gl10(b, gl10) < 0) { + if (bcf_gl10_indel(b, gl10) < 0) return -1; + } + PL = b->gi + i; + for (i = 0, k = 0; i < 4; ++i) + for (j = i; j < 4; ++j) + map[k++] = seq_nt16rev[1<data)[j * PL->len] != 0) break; + if (j < 3) { // we need to go through the complex procedure + uint8_t *g[3]; + int minc = 1<<30, minc_j = -1, minf = 0, gtf = 0, gtc = 0; + g[0] = gl10; + g[1] = gl10 + 10; + g[2] = gl10 + 20; + for (j = 1; j <= (int)prep[0]; ++j) { // compute LK with constraint + int sum = g[0][prep[j]&0xff] + g[1][prep[j]>>8&0xff] + g[2][prep[j]>>16&0xff]; + if (sum < minc) minc = sum, minc_j = j; + } + gtc |= map[prep[minc_j]&0xff]; gtc |= map[prep[minc_j]>>8&0xff]<<8; gtc |= map[prep[minc_j]>>16]<<16; + for (j = 0; j < 3; ++j) { // compute LK without constraint + int min = 1<<30, min_k = -1; + for (k = 0; k < 10; ++k) + if (g[j][k] < min) min = g[j][k], min_k = k; + gtf |= map[min_k]<<(j*8); + minf += min; + } + *llr = minc - minf; *gt = (int64_t)gtc<<32 | gtf; + } else *llr = 0, *gt = -1; + return 0; +} + +int bcf_pair_call(const bcf1_t *b) +{ + int i, j, k; + const bcf_ginfo_t *PL; + if (b->n_smpl != 2) return -1; // not a pair + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + PL = b->gi + i; + for (j = 0; j < 2; ++j) // check if ref hom is the most probable in all members + if (((uint8_t*)PL->data)[j * PL->len] != 0) break; + if (j < 2) { // we need to go through the complex procedure + uint8_t *g[2]; + int minc = 1<<30, minf = 0; + g[0] = PL->data; + g[1] = (uint8_t*)PL->data + PL->len; + for (j = 0; j < PL->len; ++j) // compute LK with constraint + minc = minc < g[0][j] + g[1][j]? minc : g[0][j] + g[1][j]; + for (j = 0; j < 2; ++j) { // compute LK without constraint + int min = 1<<30; + for (k = 0; k < PL->len; ++k) + min = min < g[j][k]? min : g[j][k]; + minf += min; + } + return minc - minf; + } else return 0; +} + +int bcf_min_diff(const bcf1_t *b) +{ + int i, min = 1<<30; + const bcf_ginfo_t *PL; + for (i = 0; i < b->n_gi; ++i) + if (b->gi[i].fmt == bcf_str2int("PL", 2)) break; + if (i == b->n_gi) return -1; // no PL + PL = b->gi + i; + for (i = 0; i < b->n_smpl; ++i) { + int m1, m2, j; + const uint8_t *p = (uint8_t*)PL->data; + m1 = m2 = 1<<30; + for (j = 0; j < PL->len; ++j) { + if ((int)p[j] < m1) m2 = m1, m1 = p[j]; + else if ((int)p[j] < m2) m2 = p[j]; + } + min = min < m2 - m1? min : m2 - m1; + } + return min; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.c.pysam.c new file mode 100755 index 0000000..5bc52a5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.c.pysam.c @@ -0,0 +1,556 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include "prob1.h" + +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 16384) + +#define MC_MAX_EM_ITER 16 +#define MC_EM_EPS 1e-5 +#define MC_DEF_INDEL 0.15 + +unsigned char seq_nt4_table[256] = { + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 /*'-'*/, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +}; + +struct __bcf_p1aux_t { + int n, M, n1, is_indel; + uint8_t *ploidy; // haploid or diploid ONLY + double *q2p, *pdg; // pdg -> P(D|g) + double *phi, *phi_indel; + double *z, *zswap; // aux for afs + double *z1, *z2, *phi1, *phi2; // only calculated when n1 is set + double **hg; // hypergeometric distribution + double *lf; // log factorial + double t, t1, t2; + double *afs, *afs1; // afs: accumulative AFS; afs1: site posterior distribution + const uint8_t *PL; // point to PL + int PL_len; +}; + +void bcf_p1_indel_prior(bcf_p1aux_t *ma, double x) +{ + int i; + for (i = 0; i < ma->M; ++i) + ma->phi_indel[i] = ma->phi[i] * x; + ma->phi_indel[ma->M] = 1. - ma->phi[ma->M] * x; +} + +static void init_prior(int type, double theta, int M, double *phi) +{ + int i; + if (type == MC_PTYPE_COND2) { + for (i = 0; i <= M; ++i) + phi[i] = 2. * (i + 1) / (M + 1) / (M + 2); + } else if (type == MC_PTYPE_FLAT) { + for (i = 0; i <= M; ++i) + phi[i] = 1. / (M + 1); + } else { + double sum; + for (i = 0, sum = 0.; i < M; ++i) + sum += (phi[i] = theta / (M - i)); + phi[M] = 1. - sum; + } +} + +void bcf_p1_init_prior(bcf_p1aux_t *ma, int type, double theta) +{ + init_prior(type, theta, ma->M, ma->phi); + bcf_p1_indel_prior(ma, MC_DEF_INDEL); +} + +void bcf_p1_init_subprior(bcf_p1aux_t *ma, int type, double theta) +{ + if (ma->n1 <= 0 || ma->n1 >= ma->M) return; + init_prior(type, theta, 2*ma->n1, ma->phi1); + init_prior(type, theta, 2*(ma->n - ma->n1), ma->phi2); +} + +int bcf_p1_read_prior(bcf_p1aux_t *ma, const char *fn) +{ + gzFile fp; + kstring_t s; + kstream_t *ks; + long double sum; + int dret, k; + memset(&s, 0, sizeof(kstring_t)); + fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + ks = ks_init(fp); + memset(ma->phi, 0, sizeof(double) * (ma->M + 1)); + while (ks_getuntil(ks, '\n', &s, &dret) >= 0) { + if (strstr(s.s, "[afs] ") == s.s) { + char *p = s.s + 6; + for (k = 0; k <= ma->M; ++k) { + int x; + double y; + x = strtol(p, &p, 10); + if (x != k && (errno == EINVAL || errno == ERANGE)) return -1; + ++p; + y = strtod(p, &p); + if (y == 0. && (errno == EINVAL || errno == ERANGE)) return -1; + ma->phi[ma->M - k] += y; + } + } + } + ks_destroy(ks); + gzclose(fp); + free(s.s); + for (sum = 0., k = 0; k <= ma->M; ++k) sum += ma->phi[k]; + fprintf(pysamerr, "[prior]"); + for (k = 0; k <= ma->M; ++k) ma->phi[k] /= sum; + for (k = 0; k <= ma->M; ++k) fprintf(pysamerr, " %d:%.3lg", k, ma->phi[ma->M - k]); + fputc('\n', pysamerr); + for (sum = 0., k = 1; k < ma->M; ++k) sum += ma->phi[ma->M - k] * (2.* k * (ma->M - k) / ma->M / (ma->M - 1)); + fprintf(pysamerr, "[%s] heterozygosity=%lf, ", __func__, (double)sum); + for (sum = 0., k = 1; k <= ma->M; ++k) sum += k * ma->phi[ma->M - k] / ma->M; + fprintf(pysamerr, "theta=%lf\n", (double)sum); + bcf_p1_indel_prior(ma, MC_DEF_INDEL); + return 0; +} + +bcf_p1aux_t *bcf_p1_init(int n, uint8_t *ploidy) +{ + bcf_p1aux_t *ma; + int i; + ma = calloc(1, sizeof(bcf_p1aux_t)); + ma->n1 = -1; + ma->n = n; ma->M = 2 * n; + if (ploidy) { + ma->ploidy = malloc(n); + memcpy(ma->ploidy, ploidy, n); + for (i = 0, ma->M = 0; i < n; ++i) ma->M += ploidy[i]; + if (ma->M == 2 * n) { + free(ma->ploidy); + ma->ploidy = 0; + } + } + ma->q2p = calloc(256, sizeof(double)); + ma->pdg = calloc(3 * ma->n, sizeof(double)); + ma->phi = calloc(ma->M + 1, sizeof(double)); + ma->phi_indel = calloc(ma->M + 1, sizeof(double)); + ma->phi1 = calloc(ma->M + 1, sizeof(double)); + ma->phi2 = calloc(ma->M + 1, sizeof(double)); + ma->z = calloc(ma->M + 1, sizeof(double)); + ma->zswap = calloc(ma->M + 1, sizeof(double)); + ma->z1 = calloc(ma->M + 1, sizeof(double)); // actually we do not need this large + ma->z2 = calloc(ma->M + 1, sizeof(double)); + ma->afs = calloc(ma->M + 1, sizeof(double)); + ma->afs1 = calloc(ma->M + 1, sizeof(double)); + ma->lf = calloc(ma->M + 1, sizeof(double)); + for (i = 0; i < 256; ++i) + ma->q2p[i] = pow(10., -i / 10.); + for (i = 0; i <= ma->M; ++i) ma->lf[i] = lgamma(i + 1); + bcf_p1_init_prior(ma, MC_PTYPE_FULL, 1e-3); // the simplest prior + return ma; +} + +int bcf_p1_set_n1(bcf_p1aux_t *b, int n1) +{ + if (n1 == 0 || n1 >= b->n) return -1; + if (b->M != b->n * 2) { + fprintf(pysamerr, "[%s] unable to set `n1' when there are haploid samples.\n", __func__); + return -1; + } + b->n1 = n1; + return 0; +} + +void bcf_p1_destroy(bcf_p1aux_t *ma) +{ + if (ma) { + int k; + free(ma->lf); + if (ma->hg && ma->n1 > 0) { + for (k = 0; k <= 2*ma->n1; ++k) free(ma->hg[k]); + free(ma->hg); + } + free(ma->ploidy); free(ma->q2p); free(ma->pdg); + free(ma->phi); free(ma->phi_indel); free(ma->phi1); free(ma->phi2); + free(ma->z); free(ma->zswap); free(ma->z1); free(ma->z2); + free(ma->afs); free(ma->afs1); + free(ma); + } +} + +static int cal_pdg(const bcf1_t *b, bcf_p1aux_t *ma) +{ + int i, j; + long *p, tmp; + p = alloca(b->n_alleles * sizeof(long)); + memset(p, 0, sizeof(long) * b->n_alleles); + for (j = 0; j < ma->n; ++j) { + const uint8_t *pi = ma->PL + j * ma->PL_len; + double *pdg = ma->pdg + j * 3; + pdg[0] = ma->q2p[pi[2]]; pdg[1] = ma->q2p[pi[1]]; pdg[2] = ma->q2p[pi[0]]; + for (i = 0; i < b->n_alleles; ++i) + p[i] += (int)pi[(i+1)*(i+2)/2-1]; + } + for (i = 0; i < b->n_alleles; ++i) p[i] = p[i]<<4 | i; + for (i = 1; i < b->n_alleles; ++i) // insertion sort + for (j = i; j > 0 && p[j] < p[j-1]; --j) + tmp = p[j], p[j] = p[j-1], p[j-1] = tmp; + for (i = b->n_alleles - 1; i >= 0; --i) + if ((p[i]&0xf) == 0) break; + return i; +} + +int bcf_p1_call_gt(const bcf_p1aux_t *ma, double f0, int k) +{ + double sum, g[3]; + double max, f3[3], *pdg = ma->pdg + k * 3; + int q, i, max_i, ploidy; + ploidy = ma->ploidy? ma->ploidy[k] : 2; + if (ploidy == 2) { + f3[0] = (1.-f0)*(1.-f0); f3[1] = 2.*f0*(1.-f0); f3[2] = f0*f0; + } else { + f3[0] = 1. - f0; f3[1] = 0; f3[2] = f0; + } + for (i = 0, sum = 0.; i < 3; ++i) + sum += (g[i] = pdg[i] * f3[i]); + for (i = 0, max = -1., max_i = 0; i < 3; ++i) { + g[i] /= sum; + if (g[i] > max) max = g[i], max_i = i; + } + max = 1. - max; + if (max < 1e-308) max = 1e-308; + q = (int)(-4.343 * log(max) + .499); + if (q > 99) q = 99; + return q<<2|max_i; +} + +#define TINY 1e-20 + +static void mc_cal_y_core(bcf_p1aux_t *ma, int beg) +{ + double *z[2], *tmp, *pdg; + int _j, last_min, last_max; + assert(beg == 0 || ma->M == ma->n*2); + z[0] = ma->z; + z[1] = ma->zswap; + pdg = ma->pdg; + memset(z[0], 0, sizeof(double) * (ma->M + 1)); + memset(z[1], 0, sizeof(double) * (ma->M + 1)); + z[0][0] = 1.; + last_min = last_max = 0; + ma->t = 0.; + if (ma->M == ma->n * 2) { + int M = 0; + for (_j = beg; _j < ma->n; ++_j) { + int k, j = _j - beg, _min = last_min, _max = last_max, M0; + double p[3], sum; + M0 = M; M += 2; + pdg = ma->pdg + _j * 3; + p[0] = pdg[0]; p[1] = 2. * pdg[1]; p[2] = pdg[2]; + for (; _min < _max && z[0][_min] < TINY; ++_min) z[0][_min] = z[1][_min] = 0.; + for (; _max > _min && z[0][_max] < TINY; --_max) z[0][_max] = z[1][_max] = 0.; + _max += 2; + if (_min == 0) k = 0, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k]; + if (_min <= 1) k = 1, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1]; + for (k = _min < 2? 2 : _min; k <= _max; ++k) + z[1][k] = (M0-k+1)*(M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1] + k*(k-1)* p[2] * z[0][k-2]; + for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k]; + ma->t += log(sum / (M * (M - 1.))); + for (k = _min; k <= _max; ++k) z[1][k] /= sum; + if (_min >= 1) z[1][_min-1] = 0.; + if (_min >= 2) z[1][_min-2] = 0.; + if (j < ma->n - 1) z[1][_max+1] = z[1][_max+2] = 0.; + if (_j == ma->n1 - 1) { // set pop1; ma->n1==-1 when unset + ma->t1 = ma->t; + memcpy(ma->z1, z[1], sizeof(double) * (ma->n1 * 2 + 1)); + } + tmp = z[0]; z[0] = z[1]; z[1] = tmp; + last_min = _min; last_max = _max; + } + //for (_j = 0; _j < last_min; ++_j) z[0][_j] = 0.; // TODO: are these necessary? + //for (_j = last_max + 1; _j < ma->M; ++_j) z[0][_j] = 0.; + } else { // this block is very similar to the block above; these two might be merged in future + int j, M = 0; + for (j = 0; j < ma->n; ++j) { + int k, M0, _min = last_min, _max = last_max; + double p[3], sum; + pdg = ma->pdg + j * 3; + for (; _min < _max && z[0][_min] < TINY; ++_min) z[0][_min] = z[1][_min] = 0.; + for (; _max > _min && z[0][_max] < TINY; --_max) z[0][_max] = z[1][_max] = 0.; + M0 = M; + M += ma->ploidy[j]; + if (ma->ploidy[j] == 1) { + p[0] = pdg[0]; p[1] = pdg[2]; + _max++; + if (_min == 0) k = 0, z[1][k] = (M0+1-k) * p[0] * z[0][k]; + for (k = _min < 1? 1 : _min; k <= _max; ++k) + z[1][k] = (M0+1-k) * p[0] * z[0][k] + k * p[1] * z[0][k-1]; + for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k]; + ma->t += log(sum / M); + for (k = _min; k <= _max; ++k) z[1][k] /= sum; + if (_min >= 1) z[1][_min-1] = 0.; + if (j < ma->n - 1) z[1][_max+1] = 0.; + } else if (ma->ploidy[j] == 2) { + p[0] = pdg[0]; p[1] = 2 * pdg[1]; p[2] = pdg[2]; + _max += 2; + if (_min == 0) k = 0, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k]; + if (_min <= 1) k = 1, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1]; + for (k = _min < 2? 2 : _min; k <= _max; ++k) + z[1][k] = (M0-k+1)*(M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1] + k*(k-1)* p[2] * z[0][k-2]; + for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k]; + ma->t += log(sum / (M * (M - 1.))); + for (k = _min; k <= _max; ++k) z[1][k] /= sum; + if (_min >= 1) z[1][_min-1] = 0.; + if (_min >= 2) z[1][_min-2] = 0.; + if (j < ma->n - 1) z[1][_max+1] = z[1][_max+2] = 0.; + } + tmp = z[0]; z[0] = z[1]; z[1] = tmp; + last_min = _min; last_max = _max; + } + } + if (z[0] != ma->z) memcpy(ma->z, z[0], sizeof(double) * (ma->M + 1)); +} + +static void mc_cal_y(bcf_p1aux_t *ma) +{ + if (ma->n1 > 0 && ma->n1 < ma->n && ma->M == ma->n * 2) { // NB: ma->n1 is ineffective when there are haploid samples + int k; + long double x; + memset(ma->z1, 0, sizeof(double) * (2 * ma->n1 + 1)); + memset(ma->z2, 0, sizeof(double) * (2 * (ma->n - ma->n1) + 1)); + ma->t1 = ma->t2 = 0.; + mc_cal_y_core(ma, ma->n1); + ma->t2 = ma->t; + memcpy(ma->z2, ma->z, sizeof(double) * (2 * (ma->n - ma->n1) + 1)); + mc_cal_y_core(ma, 0); + // rescale z + x = expl(ma->t - (ma->t1 + ma->t2)); + for (k = 0; k <= ma->M; ++k) ma->z[k] *= x; + } else mc_cal_y_core(ma, 0); +} + +#define CONTRAST_TINY 1e-30 + +extern double kf_gammaq(double s, double z); // incomplete gamma function for chi^2 test + +static inline double chi2_test(int a, int b, int c, int d) +{ + double x, z; + x = (double)(a+b) * (c+d) * (b+d) * (a+c); + if (x == 0.) return 1; + z = a * d - b * c; + return kf_gammaq(.5, .5 * z * z * (a+b+c+d) / x); +} + +// chi2=(a+b+c+d)(ad-bc)^2/[(a+b)(c+d)(a+c)(b+d)] +static inline double contrast2_aux(const bcf_p1aux_t *p1, double sum, int k1, int k2, double x[3]) +{ + double p = p1->phi[k1+k2] * p1->z1[k1] * p1->z2[k2] / sum * p1->hg[k1][k2]; + int n1 = p1->n1, n2 = p1->n - p1->n1; + if (p < CONTRAST_TINY) return -1; + if (.5*k1/n1 < .5*k2/n2) x[1] += p; + else if (.5*k1/n1 > .5*k2/n2) x[2] += p; + else x[0] += p; + return p * chi2_test(k1, k2, (n1<<1) - k1, (n2<<1) - k2); +} + +static double contrast2(bcf_p1aux_t *p1, double ret[3]) +{ + int k, k1, k2, k10, k20, n1, n2; + double sum; + // get n1 and n2 + n1 = p1->n1; n2 = p1->n - p1->n1; + if (n1 <= 0 || n2 <= 0) return 0.; + if (p1->hg == 0) { // initialize the hypergeometric distribution + /* NB: the hg matrix may take a lot of memory when there are many samples. There is a way + to avoid precomputing this matrix, but it is slower and quite intricate. The following + computation in this block can be accelerated with a similar strategy, but perhaps this + is not a serious concern for now. */ + double tmp = lgamma(2*(n1+n2)+1) - (lgamma(2*n1+1) + lgamma(2*n2+1)); + p1->hg = calloc(2*n1+1, sizeof(void*)); + for (k1 = 0; k1 <= 2*n1; ++k1) { + p1->hg[k1] = calloc(2*n2+1, sizeof(double)); + for (k2 = 0; k2 <= 2*n2; ++k2) + p1->hg[k1][k2] = exp(lgamma(k1+k2+1) + lgamma(p1->M-k1-k2+1) - (lgamma(k1+1) + lgamma(k2+1) + lgamma(2*n1-k1+1) + lgamma(2*n2-k2+1) + tmp)); + } + } + { // compute + long double suml = 0; + for (k = 0; k <= p1->M; ++k) suml += p1->phi[k] * p1->z[k]; + sum = suml; + } + { // get the max k1 and k2 + double max; + int max_k; + for (k = 0, max = 0, max_k = -1; k <= 2*n1; ++k) { + double x = p1->phi1[k] * p1->z1[k]; + if (x > max) max = x, max_k = k; + } + k10 = max_k; + for (k = 0, max = 0, max_k = -1; k <= 2*n2; ++k) { + double x = p1->phi2[k] * p1->z2[k]; + if (x > max) max = x, max_k = k; + } + k20 = max_k; + } + { // We can do the following with one nested loop, but that is an O(N^2) thing. The following code block is much faster for large N. + double x[3], y; + long double z = 0., L[2]; + x[0] = x[1] = x[2] = 0; L[0] = L[1] = 0; + for (k1 = k10; k1 >= 0; --k1) { + for (k2 = k20; k2 >= 0; --k2) { + if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break; + else z += y; + } + for (k2 = k20 + 1; k2 <= 2*n2; ++k2) { + if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break; + else z += y; + } + } + ret[0] = x[0]; ret[1] = x[1]; ret[2] = x[2]; + x[0] = x[1] = x[2] = 0; + for (k1 = k10 + 1; k1 <= 2*n1; ++k1) { + for (k2 = k20; k2 >= 0; --k2) { + if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break; + else z += y; + } + for (k2 = k20 + 1; k2 <= 2*n2; ++k2) { + if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break; + else z += y; + } + } + ret[0] += x[0]; ret[1] += x[1]; ret[2] += x[2]; + if (ret[0] + ret[1] + ret[2] < 0.95) { // in case of bad things happened + ret[0] = ret[1] = ret[2] = 0; L[0] = L[1] = 0; + for (k1 = 0, z = 0.; k1 <= 2*n1; ++k1) + for (k2 = 0; k2 <= 2*n2; ++k2) + if ((y = contrast2_aux(p1, sum, k1, k2, ret)) >= 0) z += y; + if (ret[0] + ret[1] + ret[2] < 0.95) // It seems that this may be caused by floating point errors. I do not really understand why... + z = 1.0, ret[0] = ret[1] = ret[2] = 1./3; + } + return (double)z; + } +} + +static double mc_cal_afs(bcf_p1aux_t *ma, double *p_ref_folded, double *p_var_folded) +{ + int k; + long double sum = 0., sum2; + double *phi = ma->is_indel? ma->phi_indel : ma->phi; + memset(ma->afs1, 0, sizeof(double) * (ma->M + 1)); + mc_cal_y(ma); + // compute AFS + for (k = 0, sum = 0.; k <= ma->M; ++k) + sum += (long double)phi[k] * ma->z[k]; + for (k = 0; k <= ma->M; ++k) { + ma->afs1[k] = phi[k] * ma->z[k] / sum; + if (isnan(ma->afs1[k]) || isinf(ma->afs1[k])) return -1.; + } + // compute folded variant probability + for (k = 0, sum = 0.; k <= ma->M; ++k) + sum += (long double)(phi[k] + phi[ma->M - k]) / 2. * ma->z[k]; + for (k = 1, sum2 = 0.; k < ma->M; ++k) + sum2 += (long double)(phi[k] + phi[ma->M - k]) / 2. * ma->z[k]; + *p_var_folded = sum2 / sum; + *p_ref_folded = (phi[k] + phi[ma->M - k]) / 2. * (ma->z[ma->M] + ma->z[0]) / sum; + // the expected frequency + for (k = 0, sum = 0.; k <= ma->M; ++k) { + ma->afs[k] += ma->afs1[k]; + sum += k * ma->afs1[k]; + } + return sum / ma->M; +} + +int bcf_p1_cal(const bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *rst) +{ + int i, k; + long double sum = 0.; + ma->is_indel = bcf_is_indel(b); + rst->perm_rank = -1; + // set PL and PL_len + for (i = 0; i < b->n_gi; ++i) { + if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + ma->PL = (uint8_t*)b->gi[i].data; + ma->PL_len = b->gi[i].len; + break; + } + } + if (i == b->n_gi) return -1; // no PL + if (b->n_alleles < 2) return -1; // FIXME: find a better solution + // + rst->rank0 = cal_pdg(b, ma); + rst->f_exp = mc_cal_afs(ma, &rst->p_ref_folded, &rst->p_var_folded); + rst->p_ref = ma->afs1[ma->M]; + for (k = 0, sum = 0.; k < ma->M; ++k) + sum += ma->afs1[k]; + rst->p_var = (double)sum; + { // compute the allele count + double max = -1; + rst->ac = -1; + for (k = 0; k <= ma->M; ++k) + if (max < ma->z[k]) max = ma->z[k], rst->ac = k; + rst->ac = ma->M - rst->ac; + } + // calculate f_flat and f_em + for (k = 0, sum = 0.; k <= ma->M; ++k) + sum += (long double)ma->z[k]; + rst->f_flat = 0.; + for (k = 0; k <= ma->M; ++k) { + double p = ma->z[k] / sum; + rst->f_flat += k * p; + } + rst->f_flat /= ma->M; + { // estimate equal-tail credible interval (95% level) + int l, h; + double p; + for (i = 0, p = 0.; i <= ma->M; ++i) + if (p + ma->afs1[i] > 0.025) break; + else p += ma->afs1[i]; + l = i; + for (i = ma->M, p = 0.; i >= 0; --i) + if (p + ma->afs1[i] > 0.025) break; + else p += ma->afs1[i]; + h = i; + rst->cil = (double)(ma->M - h) / ma->M; rst->cih = (double)(ma->M - l) / ma->M; + } + if (ma->n1 > 0) { // compute LRT + double max0, max1, max2; + for (k = 0, max0 = -1; k <= ma->M; ++k) + if (max0 < ma->z[k]) max0 = ma->z[k]; + for (k = 0, max1 = -1; k <= ma->n1 * 2; ++k) + if (max1 < ma->z1[k]) max1 = ma->z1[k]; + for (k = 0, max2 = -1; k <= ma->M - ma->n1 * 2; ++k) + if (max2 < ma->z2[k]) max2 = ma->z2[k]; + rst->lrt = log(max1 * max2 / max0); + rst->lrt = rst->lrt < 0? 1 : kf_gammaq(.5, rst->lrt); + } else rst->lrt = -1.0; + rst->cmp[0] = rst->cmp[1] = rst->cmp[2] = rst->p_chi2 = -1.0; + if (do_contrast && rst->p_var > 0.5) // skip contrast2() if the locus is a strong non-variant + rst->p_chi2 = contrast2(ma, rst->cmp); + return 0; +} + +void bcf_p1_dump_afs(bcf_p1aux_t *ma) +{ + int k; + fprintf(pysamerr, "[afs]"); + for (k = 0; k <= ma->M; ++k) + fprintf(pysamerr, " %d:%.3lf", k, ma->afs[ma->M - k]); + fprintf(pysamerr, "\n"); + memset(ma->afs, 0, sizeof(double) * (ma->M + 1)); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.h b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.h new file mode 100755 index 0000000..0a51a0a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/prob1.h @@ -0,0 +1,42 @@ +#ifndef BCF_PROB1_H +#define BCF_PROB1_H + +#include "bcf.h" + +struct __bcf_p1aux_t; +typedef struct __bcf_p1aux_t bcf_p1aux_t; + +typedef struct { + int rank0, perm_rank; // NB: perm_rank is always set to -1 by bcf_p1_cal() + int ac; // ML alternative allele count + double f_exp, f_flat, p_ref_folded, p_ref, p_var_folded, p_var; + double cil, cih; + double cmp[3], p_chi2, lrt; // used by contrast2() +} bcf_p1rst_t; + +#define MC_PTYPE_FULL 1 +#define MC_PTYPE_COND2 2 +#define MC_PTYPE_FLAT 3 + +#ifdef __cplusplus +extern "C" { +#endif + + bcf_p1aux_t *bcf_p1_init(int n, uint8_t *ploidy); + void bcf_p1_init_prior(bcf_p1aux_t *ma, int type, double theta); + void bcf_p1_init_subprior(bcf_p1aux_t *ma, int type, double theta); + void bcf_p1_destroy(bcf_p1aux_t *ma); + int bcf_p1_cal(const bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *rst); + int bcf_p1_call_gt(const bcf_p1aux_t *ma, double f0, int k); + void bcf_p1_dump_afs(bcf_p1aux_t *ma); + int bcf_p1_read_prior(bcf_p1aux_t *ma, const char *fn); + int bcf_p1_set_n1(bcf_p1aux_t *b, int n1); + void bcf_p1_set_folded(bcf_p1aux_t *p1a); // only effective when set_n1() is not called + + int bcf_em1(const bcf1_t *b, int n1, int flag, double x[10]); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/vcf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/vcf.c.pysam.c new file mode 100755 index 0000000..a30de82 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bcftools/vcf.c.pysam.c @@ -0,0 +1,246 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include "bcf.h" +#include "kstring.h" +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 4096) + +typedef struct { + gzFile fp; + FILE *fpout; + kstream_t *ks; + void *refhash; + kstring_t line; + int max_ref; +} vcf_t; + +bcf_hdr_t *vcf_hdr_read(bcf_t *bp) +{ + kstring_t meta, smpl; + int dret; + vcf_t *v; + bcf_hdr_t *h; + if (!bp->is_vcf) return bcf_hdr_read(bp); + h = calloc(1, sizeof(bcf_hdr_t)); + v = (vcf_t*)bp->v; + v->line.l = 0; + memset(&meta, 0, sizeof(kstring_t)); + memset(&smpl, 0, sizeof(kstring_t)); + while (ks_getuntil(v->ks, '\n', &v->line, &dret) >= 0) { + if (v->line.l < 2) continue; + if (v->line.s[0] != '#') return 0; // no sample line + if (v->line.s[0] == '#' && v->line.s[1] == '#') { + kputsn(v->line.s, v->line.l, &meta); kputc('\n', &meta); + } else if (v->line.s[0] == '#') { + int k; + ks_tokaux_t aux; + char *p; + for (p = kstrtok(v->line.s, "\t\n", &aux), k = 0; p; p = kstrtok(0, 0, &aux), ++k) { + if (k >= 9) { + kputsn(p, aux.p - p, &smpl); + kputc('\0', &smpl); + } + } + break; + } + } + kputc('\0', &meta); + h->name = 0; + h->sname = smpl.s; h->l_smpl = smpl.l; + h->txt = meta.s; h->l_txt = meta.l; + bcf_hdr_sync(h); + return h; +} + +bcf_t *vcf_open(const char *fn, const char *mode) +{ + bcf_t *bp; + vcf_t *v; + if (strchr(mode, 'b')) return bcf_open(fn, mode); + bp = calloc(1, sizeof(bcf_t)); + v = calloc(1, sizeof(vcf_t)); + bp->is_vcf = 1; + bp->v = v; + v->refhash = bcf_str2id_init(); + if (strchr(mode, 'r')) { + v->fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + v->ks = ks_init(v->fp); + } else if (strchr(mode, 'w')) + v->fpout = strcmp(fn, "-")? fopen(fn, "w") : stdout; + return bp; +} + +int vcf_dictread(bcf_t *bp, bcf_hdr_t *h, const char *fn) +{ + vcf_t *v; + gzFile fp; + kstream_t *ks; + kstring_t s, rn; + int dret; + if (bp == 0) return -1; + if (!bp->is_vcf) return 0; + s.l = s.m = 0; s.s = 0; + rn.m = rn.l = h->l_nm; rn.s = h->name; + v = (vcf_t*)bp->v; + fp = gzopen(fn, "r"); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, &s, &dret) >= 0) { + bcf_str2id_add(v->refhash, strdup(s.s)); + kputs(s.s, &rn); kputc('\0', &rn); + if (dret != '\n') ks_getuntil(ks, '\n', &s, &dret); + } + ks_destroy(ks); + gzclose(fp); + h->l_nm = rn.l; h->name = rn.s; + bcf_hdr_sync(h); + free(s.s); + return 0; +} + +int vcf_close(bcf_t *bp) +{ + vcf_t *v; + if (bp == 0) return -1; + if (!bp->is_vcf) return bcf_close(bp); + v = (vcf_t*)bp->v; + if (v->fp) { + ks_destroy(v->ks); + gzclose(v->fp); + } + if (v->fpout) fclose(v->fpout); + free(v->line.s); + bcf_str2id_thorough_destroy(v->refhash); + free(v); + free(bp); + return 0; +} + +int vcf_hdr_write(bcf_t *bp, const bcf_hdr_t *h) +{ + vcf_t *v = (vcf_t*)bp->v; + int i, has_ver = 0; + if (!bp->is_vcf) return bcf_hdr_write(bp, h); + if (h->l_txt > 0) { + if (strstr(h->txt, "##fileformat=")) has_ver = 1; + if (has_ver == 0) fprintf(v->fpout, "##fileformat=VCFv4.1\n"); + fwrite(h->txt, 1, h->l_txt - 1, v->fpout); + } + if (h->l_txt == 0) fprintf(v->fpout, "##fileformat=VCFv4.1\n"); + fprintf(v->fpout, "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT"); + for (i = 0; i < h->n_smpl; ++i) + fprintf(v->fpout, "\t%s", h->sns[i]); + fputc('\n', v->fpout); + return 0; +} + +int vcf_write(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b) +{ + vcf_t *v = (vcf_t*)bp->v; + extern void bcf_fmt_core(const bcf_hdr_t *h, bcf1_t *b, kstring_t *s); + if (!bp->is_vcf) return bcf_write(bp, h, b); + bcf_fmt_core(h, b, &v->line); + fwrite(v->line.s, 1, v->line.l, v->fpout); + fputc('\n', v->fpout); + return v->line.l + 1; +} + +int vcf_read(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b) +{ + int dret, k, i, sync = 0; + vcf_t *v = (vcf_t*)bp->v; + char *p, *q; + kstring_t str, rn; + ks_tokaux_t aux, a2; + if (!bp->is_vcf) return bcf_read(bp, h, b); + v->line.l = 0; + str.l = 0; str.m = b->m_str; str.s = b->str; + rn.l = rn.m = h->l_nm; rn.s = h->name; + if (ks_getuntil(v->ks, '\n', &v->line, &dret) < 0) return -1; + b->n_smpl = h->n_smpl; + for (p = kstrtok(v->line.s, "\t", &aux), k = 0; p; p = kstrtok(0, 0, &aux), ++k) { + *(char*)aux.p = 0; + if (k == 0) { // ref + int tid = bcf_str2id(v->refhash, p); + if (tid < 0) { + tid = bcf_str2id_add(v->refhash, strdup(p)); + kputs(p, &rn); kputc('\0', &rn); + sync = 1; + } + b->tid = tid; + } else if (k == 1) { // pos + b->pos = atoi(p) - 1; + } else if (k == 5) { // qual + b->qual = (p[0] >= '0' && p[0] <= '9')? atof(p) : 0; + } else if (k <= 8) { // variable length strings + kputs(p, &str); kputc('\0', &str); + b->l_str = str.l; b->m_str = str.m; b->str = str.s; + if (k == 8) bcf_sync(b); + } else { // k > 9 + if (strncmp(p, "./.", 3) == 0) { + for (i = 0; i < b->n_gi; ++i) { + if (b->gi[i].fmt == bcf_str2int("GT", 2)) { + ((uint8_t*)b->gi[i].data)[k-9] = 1<<7; + } else if (b->gi[i].fmt == bcf_str2int("GQ", 2)) { + ((uint8_t*)b->gi[i].data)[k-9] = 0; + } else if (b->gi[i].fmt == bcf_str2int("SP", 2)) { + ((int32_t*)b->gi[i].data)[k-9] = 0; + } else if (b->gi[i].fmt == bcf_str2int("DP", 2)) { + ((uint16_t*)b->gi[i].data)[k-9] = 0; + } else if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + int y = b->n_alleles * (b->n_alleles + 1) / 2; + memset((uint8_t*)b->gi[i].data + (k - 9) * y, 0, y); + } else if (b->gi[i].fmt == bcf_str2int("GL", 2)) { + int y = b->n_alleles * (b->n_alleles + 1) / 2; + memset((float*)b->gi[i].data + (k - 9) * y, 0, y * 4); + } + } + goto endblock; + } + for (q = kstrtok(p, ":", &a2), i = 0; q && i < b->n_gi; q = kstrtok(0, 0, &a2), ++i) { + if (b->gi[i].fmt == bcf_str2int("GT", 2)) { + ((uint8_t*)b->gi[i].data)[k-9] = (q[0] - '0')<<3 | (q[2] - '0') | (q[1] == '/'? 0 : 1) << 6; + } else if (b->gi[i].fmt == bcf_str2int("GQ", 2)) { + double _x = strtod(q, &q); + int x = (int)(_x + .499); + if (x > 255) x = 255; + ((uint8_t*)b->gi[i].data)[k-9] = x; + } else if (b->gi[i].fmt == bcf_str2int("SP", 2)) { + int x = strtol(q, &q, 10); + if (x > 0xffff) x = 0xffff; + ((uint32_t*)b->gi[i].data)[k-9] = x; + } else if (b->gi[i].fmt == bcf_str2int("DP", 2)) { + int x = strtol(q, &q, 10); + if (x > 0xffff) x = 0xffff; + ((uint16_t*)b->gi[i].data)[k-9] = x; + } else if (b->gi[i].fmt == bcf_str2int("PL", 2)) { + int x, y, j; + uint8_t *data = (uint8_t*)b->gi[i].data; + y = b->n_alleles * (b->n_alleles + 1) / 2; + for (j = 0; j < y; ++j) { + x = strtol(q, &q, 10); + if (x > 255) x = 255; + data[(k-9) * y + j] = x; + ++q; + } + } else if (b->gi[i].fmt == bcf_str2int("GL", 2)) { + int j, y; + float x, *data = (float*)b->gi[i].data; + y = b->n_alleles * (b->n_alleles + 1) / 2; + for (j = 0; j < y; ++j) { + x = strtod(q, &q); + data[(k-9) * y + j] = x > 0? -x/10. : x; + ++q; + } + } + } + endblock: i = i; + } + } + h->l_nm = rn.l; h->name = rn.s; + if (sync) bcf_hdr_sync(h); + return v->line.l + 1; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bedidx.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bedidx.c.pysam.c new file mode 100755 index 0000000..2bbb05f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bedidx.c.pysam.c @@ -0,0 +1,164 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#define drand48() ((double)rand() / RAND_MAX) +#endif + +#include "ksort.h" +KSORT_INIT_GENERIC(uint64_t) + +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 8192) + +typedef struct { + int n, m; + uint64_t *a; + int *idx; +} bed_reglist_t; + +#include "khash.h" +KHASH_MAP_INIT_STR(reg, bed_reglist_t) + +#define LIDX_SHIFT 13 + +typedef kh_reg_t reghash_t; + +int *bed_index_core(int n, uint64_t *a, int *n_idx) +{ + int i, j, m, *idx; + m = *n_idx = 0; idx = 0; + for (i = 0; i < n; ++i) { + int beg, end; + beg = a[i]>>32 >> LIDX_SHIFT; end = ((uint32_t)a[i]) >> LIDX_SHIFT; + if (m < end + 1) { + int oldm = m; + m = end + 1; + kroundup32(m); + idx = realloc(idx, m * sizeof(int)); + for (j = oldm; j < m; ++j) idx[j] = -1; + } + if (beg == end) { + if (idx[beg] < 0) idx[beg] = i; + } else { + for (j = beg; j <= end; ++j) + if (idx[j] < 0) idx[j] = i; + } + *n_idx = end + 1; + } + return idx; +} + +void bed_index(void *_h) +{ + reghash_t *h = (reghash_t*)_h; + khint_t k; + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + bed_reglist_t *p = &kh_val(h, k); + if (p->idx) free(p->idx); + ks_introsort(uint64_t, p->n, p->a); + p->idx = bed_index_core(p->n, p->a, &p->m); + } + } +} + +int bed_overlap_core(const bed_reglist_t *p, int beg, int end) +{ + int i, min_off; + if (p->n == 0) return 0; + min_off = (beg>>LIDX_SHIFT >= p->n)? p->idx[p->n-1] : p->idx[beg>>LIDX_SHIFT]; + if (min_off < 0) { // TODO: this block can be improved, but speed should not matter too much here + int n = beg>>LIDX_SHIFT; + if (n > p->n) n = p->n; + for (i = n - 1; i >= 0; --i) + if (p->idx[i] >= 0) break; + min_off = i >= 0? p->idx[i] : 0; + } + for (i = min_off; i < p->n; ++i) { + if ((int)(p->a[i]>>32) >= end) break; // out of range; no need to proceed + if ((int32_t)p->a[i] > beg && (int32_t)(p->a[i]>>32) < end) + return 1; // find the overlap; return + } + return 0; +} + +int bed_overlap(const void *_h, const char *chr, int beg, int end) +{ + const reghash_t *h = (const reghash_t*)_h; + khint_t k; + if (!h) return 0; + k = kh_get(reg, h, chr); + if (k == kh_end(h)) return 0; + return bed_overlap_core(&kh_val(h, k), beg, end); +} + +void *bed_read(const char *fn) +{ + reghash_t *h = kh_init(reg); + gzFile fp; + kstream_t *ks; + int dret; + kstring_t *str; + // read the list + fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + if (fp == 0) return 0; + str = calloc(1, sizeof(kstring_t)); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, str, &dret) >= 0) { // read the chr name + int beg = -1, end = -1; + bed_reglist_t *p; + khint_t k = kh_get(reg, h, str->s); + if (k == kh_end(h)) { // absent from the hash table + int ret; + char *s = strdup(str->s); + k = kh_put(reg, h, s, &ret); + memset(&kh_val(h, k), 0, sizeof(bed_reglist_t)); + } + p = &kh_val(h, k); + if (dret != '\n') { // if the lines has other characters + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { + beg = atoi(str->s); // begin + if (dret != '\n') { + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { + end = atoi(str->s); // end + if (end < beg) end = -1; + } + } + } + } + if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); // skip the rest of the line + if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column + if (beg >= 0 && end > beg) { + if (p->n == p->m) { + p->m = p->m? p->m<<1 : 4; + p->a = realloc(p->a, p->m * 8); + } + p->a[p->n++] = (uint64_t)beg<<32 | end; + } + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + bed_index(h); + return h; +} + +void bed_destroy(void *_h) +{ + reghash_t *h = (reghash_t*)_h; + khint_t k; + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + free(kh_val(h, k).a); + free(kh_val(h, k).idx); + free((char*)kh_key(h, k)); + } + } + kh_destroy(reg, h); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.c.pysam.c new file mode 100755 index 0000000..067b89d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.c.pysam.c @@ -0,0 +1,716 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +/* + 2009-06-29 by lh3: cache recent uncompressed blocks. + 2009-06-25 by lh3: optionally use my knetfile library to access file on a FTP. + 2009-06-12 by lh3: support a mode string like "wu" where 'u' for uncompressed output */ + +#include +#include +#include +#include +#include +#include +#include +#include "bgzf.h" + +#include "khash.h" +typedef struct { + int size; + uint8_t *block; + int64_t end_offset; +} cache_t; +KHASH_MAP_INIT_INT64(cache, cache_t) + +#if defined(_WIN32) || defined(_MSC_VER) +#define ftello(fp) ftell(fp) +#define fseeko(fp, offset, whence) fseek(fp, offset, whence) +#else +extern off_t ftello(FILE *stream); +extern int fseeko(FILE *stream, off_t offset, int whence); +#endif + +typedef int8_t bgzf_byte_t; + +static const int DEFAULT_BLOCK_SIZE = 64 * 1024; +static const int MAX_BLOCK_SIZE = 64 * 1024; + +static const int BLOCK_HEADER_LENGTH = 18; +static const int BLOCK_FOOTER_LENGTH = 8; + +static const int GZIP_ID1 = 31; +static const int GZIP_ID2 = 139; +static const int CM_DEFLATE = 8; +static const int FLG_FEXTRA = 4; +static const int OS_UNKNOWN = 255; +static const int BGZF_ID1 = 66; // 'B' +static const int BGZF_ID2 = 67; // 'C' +static const int BGZF_LEN = 2; +static const int BGZF_XLEN = 6; // BGZF_LEN+4 + +static const int GZIP_WINDOW_BITS = -15; // no zlib header +static const int Z_DEFAULT_MEM_LEVEL = 8; + + +inline +void +packInt16(uint8_t* buffer, uint16_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; +} + +inline +int +unpackInt16(const uint8_t* buffer) +{ + return (buffer[0] | (buffer[1] << 8)); +} + +inline +void +packInt32(uint8_t* buffer, uint32_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; + buffer[2] = value >> 16; + buffer[3] = value >> 24; +} + +static inline +int +bgzf_min(int x, int y) +{ + return (x < y) ? x : y; +} + +static +void +report_error(BGZF* fp, const char* message) { + fp->error = message; +} + +int bgzf_check_bgzf(const char *fn) +{ + BGZF *fp; + uint8_t buf[10],magic[10]="\037\213\010\4\0\0\0\0\0\377"; + int n; + + if ((fp = bgzf_open(fn, "r")) == 0) + { + fprintf(pysamerr, "[bgzf_check_bgzf] failed to open the file: %s\n",fn); + return -1; + } + +#ifdef _USE_KNETFILE + n = knet_read(fp->x.fpr, buf, 10); +#else + n = fread(buf, 1, 10, fp->file); +#endif + bgzf_close(fp); + + if ( n!=10 ) + return -1; + + if ( !memcmp(magic, buf, 10) ) return 1; + return 0; +} + +static BGZF *bgzf_read_init() +{ + BGZF *fp; + fp = calloc(1, sizeof(BGZF)); + fp->uncompressed_block_size = MAX_BLOCK_SIZE; + fp->uncompressed_block = malloc(MAX_BLOCK_SIZE); + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->cache_size = 0; + fp->cache = kh_init(cache); + return fp; +} + +static +BGZF* +open_read(int fd) +{ +#ifdef _USE_KNETFILE + knetFile *file = knet_dopen(fd, "r"); +#else + FILE* file = fdopen(fd, "r"); +#endif + BGZF* fp; + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = fd; + fp->open_mode = 'r'; +#ifdef _USE_KNETFILE + fp->x.fpr = file; +#else + fp->file = file; +#endif + return fp; +} + +static +BGZF* +open_write(int fd, int compress_level) // compress_level==-1 for the default level +{ + FILE* file = fdopen(fd, "w"); + BGZF* fp; + if (file == 0) return 0; + fp = malloc(sizeof(BGZF)); + fp->file_descriptor = fd; + fp->open_mode = 'w'; + fp->owned_file = 0; + fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1 + if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION; +#ifdef _USE_KNETFILE + fp->x.fpw = file; +#else + fp->file = file; +#endif + fp->uncompressed_block_size = DEFAULT_BLOCK_SIZE; + fp->uncompressed_block = NULL; + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->block_address = 0; + fp->block_offset = 0; + fp->block_length = 0; + fp->error = NULL; + return fp; +} + +BGZF* +bgzf_open(const char* __restrict path, const char* __restrict mode) +{ + BGZF* fp = NULL; + if (strchr(mode, 'r') || strchr(mode, 'R')) { /* The reading mode is preferred. */ +#ifdef _USE_KNETFILE + knetFile *file = knet_open(path, mode); + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = -1; + fp->open_mode = 'r'; + fp->x.fpr = file; +#else + int fd, oflag = O_RDONLY; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag); + if (fd == -1) return 0; + fp = open_read(fd); +#endif + } else if (strchr(mode, 'w') || strchr(mode, 'W')) { + int fd, compress_level = -1, oflag = O_WRONLY | O_CREAT | O_TRUNC; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag, 0666); + if (fd == -1) return 0; + { // set compress_level + int i; + for (i = 0; mode[i]; ++i) + if (mode[i] >= '0' && mode[i] <= '9') break; + if (mode[i]) compress_level = (int)mode[i] - '0'; + if (strchr(mode, 'u')) compress_level = 0; + } + fp = open_write(fd, compress_level); + } + if (fp != NULL) fp->owned_file = 1; + return fp; +} + +BGZF* +bgzf_fdopen(int fd, const char * __restrict mode) +{ + if (fd == -1) return 0; + if (mode[0] == 'r' || mode[0] == 'R') { + return open_read(fd); + } else if (mode[0] == 'w' || mode[0] == 'W') { + int i, compress_level = -1; + for (i = 0; mode[i]; ++i) + if (mode[i] >= '0' && mode[i] <= '9') break; + if (mode[i]) compress_level = (int)mode[i] - '0'; + if (strchr(mode, 'u')) compress_level = 0; + return open_write(fd, compress_level); + } else { + return NULL; + } +} + +static +int +deflate_block(BGZF* fp, int block_length) +{ + // Deflate the block in fp->uncompressed_block into fp->compressed_block. + // Also adds an extra field that stores the compressed block length. + + bgzf_byte_t* buffer = fp->compressed_block; + int buffer_size = fp->compressed_block_size; + + // Init gzip header + buffer[0] = GZIP_ID1; + buffer[1] = GZIP_ID2; + buffer[2] = CM_DEFLATE; + buffer[3] = FLG_FEXTRA; + buffer[4] = 0; // mtime + buffer[5] = 0; + buffer[6] = 0; + buffer[7] = 0; + buffer[8] = 0; + buffer[9] = OS_UNKNOWN; + buffer[10] = BGZF_XLEN; + buffer[11] = 0; + buffer[12] = BGZF_ID1; + buffer[13] = BGZF_ID2; + buffer[14] = BGZF_LEN; + buffer[15] = 0; + buffer[16] = 0; // placeholder for block length + buffer[17] = 0; + + // loop to retry for blocks that do not compress enough + int input_length = block_length; + int compressed_length = 0; + while (1) { + z_stream zs; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->uncompressed_block; + zs.avail_in = input_length; + zs.next_out = (void*)&buffer[BLOCK_HEADER_LENGTH]; + zs.avail_out = buffer_size - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH; + + int status = deflateInit2(&zs, fp->compress_level, Z_DEFLATED, + GZIP_WINDOW_BITS, Z_DEFAULT_MEM_LEVEL, Z_DEFAULT_STRATEGY); + if (status != Z_OK) { + report_error(fp, "deflate init failed"); + return -1; + } + status = deflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + deflateEnd(&zs); + if (status == Z_OK) { + // Not enough space in buffer. + // Can happen in the rare case the input doesn't compress enough. + // Reduce the amount of input until it fits. + input_length -= 1024; + if (input_length <= 0) { + // should never happen + report_error(fp, "input reduction failed"); + return -1; + } + continue; + } + report_error(fp, "deflate failed"); + return -1; + } + status = deflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "deflate end failed"); + return -1; + } + compressed_length = zs.total_out; + compressed_length += BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH; + if (compressed_length > MAX_BLOCK_SIZE) { + // should never happen + report_error(fp, "deflate overflow"); + return -1; + } + break; + } + + packInt16((uint8_t*)&buffer[16], compressed_length-1); + uint32_t crc = crc32(0L, NULL, 0L); + crc = crc32(crc, fp->uncompressed_block, input_length); + packInt32((uint8_t*)&buffer[compressed_length-8], crc); + packInt32((uint8_t*)&buffer[compressed_length-4], input_length); + + int remaining = block_length - input_length; + if (remaining > 0) { + if (remaining > input_length) { + // should never happen (check so we can use memcpy) + report_error(fp, "remainder too large"); + return -1; + } + memcpy(fp->uncompressed_block, + fp->uncompressed_block + input_length, + remaining); + } + fp->block_offset = remaining; + return compressed_length; +} + +static +int +inflate_block(BGZF* fp, int block_length) +{ + // Inflate the block in fp->compressed_block into fp->uncompressed_block + + z_stream zs; + int status; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->compressed_block + 18; + zs.avail_in = block_length - 16; + zs.next_out = fp->uncompressed_block; + zs.avail_out = fp->uncompressed_block_size; + + status = inflateInit2(&zs, GZIP_WINDOW_BITS); + if (status != Z_OK) { + report_error(fp, "inflate init failed"); + return -1; + } + status = inflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + inflateEnd(&zs); + report_error(fp, "inflate failed"); + return -1; + } + status = inflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "inflate failed"); + return -1; + } + return zs.total_out; +} + +static +int +check_header(const bgzf_byte_t* header) +{ + return (header[0] == GZIP_ID1 && + header[1] == (bgzf_byte_t) GZIP_ID2 && + header[2] == Z_DEFLATED && + (header[3] & FLG_FEXTRA) != 0 && + unpackInt16((uint8_t*)&header[10]) == BGZF_XLEN && + header[12] == BGZF_ID1 && + header[13] == BGZF_ID2 && + unpackInt16((uint8_t*)&header[14]) == BGZF_LEN); +} + +static void free_cache(BGZF *fp) +{ + khint_t k; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (fp->open_mode != 'r') return; + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) free(kh_val(h, k).block); + kh_destroy(cache, h); +} + +static int load_block_from_cache(BGZF *fp, int64_t block_address) +{ + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + k = kh_get(cache, h, block_address); + if (k == kh_end(h)) return 0; + p = &kh_val(h, k); + if (fp->block_length != 0) fp->block_offset = 0; + fp->block_address = block_address; + fp->block_length = p->size; + memcpy(fp->uncompressed_block, p->block, MAX_BLOCK_SIZE); +#ifdef _USE_KNETFILE + knet_seek(fp->x.fpr, p->end_offset, SEEK_SET); +#else + fseeko(fp->file, p->end_offset, SEEK_SET); +#endif + return p->size; +} + +static void cache_block(BGZF *fp, int size) +{ + int ret; + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (MAX_BLOCK_SIZE >= fp->cache_size) return; + if ((kh_size(h) + 1) * MAX_BLOCK_SIZE > fp->cache_size) { + /* A better way would be to remove the oldest block in the + * cache, but here we remove a random one for simplicity. This + * should not have a big impact on performance. */ + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) break; + if (k < kh_end(h)) { + free(kh_val(h, k).block); + kh_del(cache, h, k); + } + } + k = kh_put(cache, h, fp->block_address, &ret); + if (ret == 0) return; // if this happens, a bug! + p = &kh_val(h, k); + p->size = fp->block_length; + p->end_offset = fp->block_address + size; + p->block = malloc(MAX_BLOCK_SIZE); + memcpy(kh_val(h, k).block, fp->uncompressed_block, MAX_BLOCK_SIZE); +} + +int +bgzf_read_block(BGZF* fp) +{ + bgzf_byte_t header[BLOCK_HEADER_LENGTH]; + int count, size = 0, block_length, remaining; +#ifdef _USE_KNETFILE + int64_t block_address = knet_tell(fp->x.fpr); + if (load_block_from_cache(fp, block_address)) return 0; + count = knet_read(fp->x.fpr, header, sizeof(header)); +#else + int64_t block_address = ftello(fp->file); + if (load_block_from_cache(fp, block_address)) return 0; + count = fread(header, 1, sizeof(header), fp->file); +#endif + if (count == 0) { + fp->block_length = 0; + return 0; + } + size = count; + if (count != sizeof(header)) { + report_error(fp, "read failed"); + return -1; + } + if (!check_header(header)) { + report_error(fp, "invalid block header"); + return -1; + } + block_length = unpackInt16((uint8_t*)&header[16]) + 1; + bgzf_byte_t* compressed_block = (bgzf_byte_t*) fp->compressed_block; + memcpy(compressed_block, header, BLOCK_HEADER_LENGTH); + remaining = block_length - BLOCK_HEADER_LENGTH; +#ifdef _USE_KNETFILE + count = knet_read(fp->x.fpr, &compressed_block[BLOCK_HEADER_LENGTH], remaining); +#else + count = fread(&compressed_block[BLOCK_HEADER_LENGTH], 1, remaining, fp->file); +#endif + if (count != remaining) { + report_error(fp, "read failed"); + return -1; + } + size += count; + count = inflate_block(fp, block_length); + if (count < 0) return -1; + if (fp->block_length != 0) { + // Do not reset offset if this read follows a seek. + fp->block_offset = 0; + } + fp->block_address = block_address; + fp->block_length = count; + cache_block(fp, size); + return 0; +} + +int +bgzf_read(BGZF* fp, void* data, int length) +{ + if (length <= 0) { + return 0; + } + if (fp->open_mode != 'r') { + report_error(fp, "file not open for reading"); + return -1; + } + + int bytes_read = 0; + bgzf_byte_t* output = data; + while (bytes_read < length) { + int copy_length, available = fp->block_length - fp->block_offset; + bgzf_byte_t *buffer; + if (available <= 0) { + if (bgzf_read_block(fp) != 0) { + return -1; + } + available = fp->block_length - fp->block_offset; + if (available <= 0) { + break; + } + } + copy_length = bgzf_min(length-bytes_read, available); + buffer = fp->uncompressed_block; + memcpy(output, buffer + fp->block_offset, copy_length); + fp->block_offset += copy_length; + output += copy_length; + bytes_read += copy_length; + } + if (fp->block_offset == fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + return bytes_read; +} + +int bgzf_flush(BGZF* fp) +{ + while (fp->block_offset > 0) { + int count, block_length; + block_length = deflate_block(fp, fp->block_offset); + if (block_length < 0) return -1; +#ifdef _USE_KNETFILE + count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + if (count != block_length) { + report_error(fp, "write failed"); + return -1; + } + fp->block_address += block_length; + } + return 0; +} + +int bgzf_flush_try(BGZF *fp, int size) +{ + if (fp->block_offset + size > fp->uncompressed_block_size) + return bgzf_flush(fp); + return -1; +} + +int bgzf_write(BGZF* fp, const void* data, int length) +{ + const bgzf_byte_t *input = data; + int block_length, bytes_written; + if (fp->open_mode != 'w') { + report_error(fp, "file not open for writing"); + return -1; + } + + if (fp->uncompressed_block == NULL) + fp->uncompressed_block = malloc(fp->uncompressed_block_size); + + input = data; + block_length = fp->uncompressed_block_size; + bytes_written = 0; + while (bytes_written < length) { + int copy_length = bgzf_min(block_length - fp->block_offset, length - bytes_written); + bgzf_byte_t* buffer = fp->uncompressed_block; + memcpy(buffer + fp->block_offset, input, copy_length); + fp->block_offset += copy_length; + input += copy_length; + bytes_written += copy_length; + if (fp->block_offset == block_length) { + if (bgzf_flush(fp) != 0) { + break; + } + } + } + return bytes_written; +} + +int bgzf_close(BGZF* fp) +{ + if (fp->open_mode == 'w') { + if (bgzf_flush(fp) != 0) return -1; + { // add an empty block + int count, block_length = deflate_block(fp, 0); +#ifdef _USE_KNETFILE + count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + } +#ifdef _USE_KNETFILE + if (fflush(fp->x.fpw) != 0) { +#else + if (fflush(fp->file) != 0) { +#endif + report_error(fp, "flush failed"); + return -1; + } + } + if (fp->owned_file) { +#ifdef _USE_KNETFILE + int ret; + if (fp->open_mode == 'w') ret = fclose(fp->x.fpw); + else ret = knet_close(fp->x.fpr); + if (ret != 0) return -1; +#else + if (fclose(fp->file) != 0) return -1; +#endif + } + free(fp->uncompressed_block); + free(fp->compressed_block); + free_cache(fp); + free(fp); + return 0; +} + +void bgzf_set_cache_size(BGZF *fp, int cache_size) +{ + if (fp) fp->cache_size = cache_size; +} + +int bgzf_check_EOF(BGZF *fp) +{ + static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0"; + uint8_t buf[28]; + off_t offset; +#ifdef _USE_KNETFILE + offset = knet_tell(fp->x.fpr); + if (knet_seek(fp->x.fpr, -28, SEEK_END) != 0) return -1; + knet_read(fp->x.fpr, buf, 28); + knet_seek(fp->x.fpr, offset, SEEK_SET); +#else + offset = ftello(fp->file); + if (fseeko(fp->file, -28, SEEK_END) != 0) return -1; + fread(buf, 1, 28, fp->file); + fseeko(fp->file, offset, SEEK_SET); +#endif + return (memcmp(magic, buf, 28) == 0)? 1 : 0; +} + +int64_t bgzf_seek(BGZF* fp, int64_t pos, int where) +{ + int block_offset; + int64_t block_address; + + if (fp->open_mode != 'r') { + report_error(fp, "file not open for read"); + return -1; + } + if (where != SEEK_SET) { + report_error(fp, "unimplemented seek option"); + return -1; + } + block_offset = pos & 0xFFFF; + block_address = (pos >> 16) & 0xFFFFFFFFFFFFLL; +#ifdef _USE_KNETFILE + if (knet_seek(fp->x.fpr, block_address, SEEK_SET) != 0) { +#else + if (fseeko(fp->file, block_address, SEEK_SET) != 0) { +#endif + report_error(fp, "seek failed"); + return -1; + } + fp->block_length = 0; // indicates current block is not loaded + fp->block_address = block_address; + fp->block_offset = block_offset; + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.h b/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.h new file mode 100755 index 0000000..7295f37 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/bgzf.h @@ -0,0 +1,157 @@ +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef __BGZF_H +#define __BGZF_H + +#include +#include +#include +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +//typedef int8_t bool; + +typedef struct { + int file_descriptor; + char open_mode; // 'r' or 'w' + int16_t owned_file, compress_level; +#ifdef _USE_KNETFILE + union { + knetFile *fpr; + FILE *fpw; + } x; +#else + FILE* file; +#endif + int uncompressed_block_size; + int compressed_block_size; + void* uncompressed_block; + void* compressed_block; + int64_t block_address; + int block_length; + int block_offset; + int cache_size; + const char* error; + void *cache; // a pointer to a hash table +} BGZF; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open an existing file descriptor for reading or writing. + * Mode must be either "r" or "w". + * A subsequent bgzf_close will not close the file descriptor. + * Returns null on error. + */ +BGZF* bgzf_fdopen(int fd, const char* __restrict mode); + +/* + * Open the specified file for reading or writing. + * Mode must be either "r" or "w". + * Returns null on error. + */ +BGZF* bgzf_open(const char* path, const char* __restrict mode); + +/* + * Close the BGZ file and free all associated resources. + * Does not close the underlying file descriptor if created with bgzf_fdopen. + * Returns zero on success, -1 on error. + */ +int bgzf_close(BGZF* fp); + +/* + * Read up to length bytes from the file storing into data. + * Returns the number of bytes actually read. + * Returns zero on end of file. + * Returns -1 on error. + */ +int bgzf_read(BGZF* fp, void* data, int length); + +/* + * Write length bytes from data to the file. + * Returns the number of bytes written. + * Returns -1 on error. + */ +int bgzf_write(BGZF* fp, const void* data, int length); + +/* + * Return a virtual file pointer to the current location in the file. + * No interpetation of the value should be made, other than a subsequent + * call to bgzf_seek can be used to position the file at the same point. + * Return value is non-negative on success. + * Returns -1 on error. + */ +#define bgzf_tell(fp) ((fp->block_address << 16) | (fp->block_offset & 0xFFFF)) + +/* + * Set the file to read from the location specified by pos, which must + * be a value previously returned by bgzf_tell for this file (but not + * necessarily one returned by this file handle). + * The where argument must be SEEK_SET. + * Seeking on a file opened for write is not supported. + * Returns zero on success, -1 on error. + */ +int64_t bgzf_seek(BGZF* fp, int64_t pos, int where); + +/* + * Set the cache size. Zero to disable. By default, caching is + * disabled. The recommended cache size for frequent random access is + * about 8M bytes. + */ +void bgzf_set_cache_size(BGZF *fp, int cache_size); + +int bgzf_check_EOF(BGZF *fp); +int bgzf_read_block(BGZF* fp); +int bgzf_flush(BGZF* fp); +int bgzf_flush_try(BGZF *fp, int size); +int bgzf_check_bgzf(const char *fn); + +#ifdef __cplusplus +} +#endif + +static inline int bgzf_getc(BGZF *fp) +{ + int c; + if (fp->block_offset >= fp->block_length) { + if (bgzf_read_block(fp) != 0) return -2; /* error */ + if (fp->block_length == 0) return -1; /* end-of-file */ + } + c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++]; + if (fp->block_offset == fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + return c; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/cut_target.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/cut_target.c.pysam.c new file mode 100755 index 0000000..13cf2d2 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/cut_target.c.pysam.c @@ -0,0 +1,195 @@ +#include "pysam.h" + +#include +#include +#include +#include "bam.h" +#include "errmod.h" +#include "faidx.h" + +#define ERR_DEP 0.83f + +typedef struct { + int e[2][3], p[2][2]; +} score_param_t; + +/* Note that although the two matrics have 10 parameters in total, only 4 + * (probably 3) are free. Changing the scoring matrices in a sort of symmetric + * way will not change the result. */ +static score_param_t g_param = { {{0,0,0},{-4,1,6}}, {{0,-14000}, {0,0}} }; + +typedef struct { + int min_baseQ, tid, max_bases; + uint16_t *bases; + bamFile fp; + bam_header_t *h; + char *ref; + faidx_t *fai; + errmod_t *em; +} ct_t; + +static uint16_t gencns(ct_t *g, int n, const bam_pileup1_t *plp) +{ + int i, j, ret, tmp, k, sum[4], qual; + float q[16]; + if (n > g->max_bases) { // enlarge g->bases + g->max_bases = n; + kroundup32(g->max_bases); + g->bases = realloc(g->bases, g->max_bases * 2); + } + for (i = k = 0; i < n; ++i) { + const bam_pileup1_t *p = plp + i; + uint8_t *seq; + int q, baseQ, b; + if (p->is_refskip || p->is_del) continue; + baseQ = bam1_qual(p->b)[p->qpos]; + if (baseQ < g->min_baseQ) continue; + seq = bam1_seq(p->b); + b = bam_nt16_nt4_table[bam1_seqi(seq, p->qpos)]; + if (b > 3) continue; + q = baseQ < p->b->core.qual? baseQ : p->b->core.qual; + if (q < 4) q = 4; + if (q > 63) q = 63; + g->bases[k++] = q<<5 | bam1_strand(p->b)<<4 | b; + } + if (k == 0) return 0; + errmod_cal(g->em, k, 4, g->bases, q); + for (i = 0; i < 4; ++i) sum[i] = (int)(q[i<<2|i] + .499) << 2 | i; + for (i = 1; i < 4; ++i) // insertion sort + for (j = i; j > 0 && sum[j] < sum[j-1]; --j) + tmp = sum[j], sum[j] = sum[j-1], sum[j-1] = tmp; + qual = (sum[1]>>2) - (sum[0]>>2); + k = k < 256? k : 255; + ret = (qual < 63? qual : 63) << 2 | (sum[0]&3); + return ret<<8|k; +} + +static void process_cns(bam_header_t *h, int tid, int l, uint16_t *cns) +{ + int i, f[2][2], *prev, *curr, *swap_tmp, s; + uint8_t *b; // backtrack array + b = calloc(l, 1); + f[0][0] = f[0][1] = 0; + prev = f[0]; curr = f[1]; + // fill the backtrack matrix + for (i = 0; i < l; ++i) { + int c = (cns[i] == 0)? 0 : (cns[i]>>8 == 0)? 1 : 2; + int tmp0, tmp1; + // compute f[0] + tmp0 = prev[0] + g_param.e[0][c] + g_param.p[0][0]; // (s[i+1],s[i])=(0,0) + tmp1 = prev[1] + g_param.e[0][c] + g_param.p[1][0]; // (0,1) + if (tmp0 > tmp1) curr[0] = tmp0, b[i] = 0; + else curr[0] = tmp1, b[i] = 1; + // compute f[1] + tmp0 = prev[0] + g_param.e[1][c] + g_param.p[0][1]; // (s[i+1],s[i])=(1,0) + tmp1 = prev[1] + g_param.e[1][c] + g_param.p[1][1]; // (1,1) + if (tmp0 > tmp1) curr[1] = tmp0, b[i] |= 0<<1; + else curr[1] = tmp1, b[i] |= 1<<1; + // swap + swap_tmp = prev; prev = curr; curr = swap_tmp; + } + // backtrack + s = prev[0] > prev[1]? 0 : 1; + for (i = l - 1; i > 0; --i) { + b[i] |= s<<2; + s = b[i]>>s&1; + } + // print + for (i = 0, s = -1; i <= l; ++i) { + if (i == l || ((b[i]>>2&3) == 0 && s >= 0)) { + if (s >= 0) { + int j; + printf("%s:%d-%d\t0\t%s\t%d\t60\t%dM\t*\t0\t0\t", h->target_name[tid], s+1, i, h->target_name[tid], s+1, i-s); + for (j = s; j < i; ++j) { + int c = cns[j]>>8; + if (c == 0) putchar('N'); + else putchar("ACGT"[c&3]); + } + putchar('\t'); + for (j = s; j < i; ++j) + putchar(33 + (cns[j]>>8>>2)); + putchar('\n'); + } + //if (s >= 0) printf("%s\t%d\t%d\t%d\n", h->target_name[tid], s, i, i - s); + s = -1; + } else if ((b[i]>>2&3) && s < 0) s = i; + } + free(b); +} + +static int read_aln(void *data, bam1_t *b) +{ + extern int bam_prob_realn_core(bam1_t *b, const char *ref, int flag); + ct_t *g = (ct_t*)data; + int ret, len; + ret = bam_read1(g->fp, b); + if (ret >= 0 && g->fai && b->core.tid >= 0 && (b->core.flag&4) == 0) { + if (b->core.tid != g->tid) { // then load the sequence + free(g->ref); + g->ref = fai_fetch(g->fai, g->h->target_name[b->core.tid], &len); + g->tid = b->core.tid; + } + bam_prob_realn_core(b, g->ref, 1<<1|1); + } + return ret; +} + +int main_cut_target(int argc, char *argv[]) +{ + int c, tid, pos, n, lasttid = -1, lastpos = -1, l, max_l; + const bam_pileup1_t *p; + bam_plp_t plp; + uint16_t *cns; + ct_t g; + + memset(&g, 0, sizeof(ct_t)); + g.min_baseQ = 13; g.tid = -1; + while ((c = getopt(argc, argv, "f:Q:i:o:0:1:2:")) >= 0) { + switch (c) { + case 'Q': g.min_baseQ = atoi(optarg); break; // quality cutoff + case 'i': g_param.p[0][1] = -atoi(optarg); break; // 0->1 transition (in) PENALTY + case '0': g_param.e[1][0] = atoi(optarg); break; // emission SCORE + case '1': g_param.e[1][1] = atoi(optarg); break; + case '2': g_param.e[1][2] = atoi(optarg); break; + case 'f': g.fai = fai_load(optarg); + if (g.fai == 0) fprintf(pysamerr, "[%s] fail to load the fasta index.\n", __func__); + break; + } + } + if (argc == optind) { + fprintf(pysamerr, "Usage: samtools targetcut [-Q minQ] [-i inPen] [-0 em0] [-1 em1] [-2 em2] [-f ref] \n"); + return 1; + } + l = max_l = 0; cns = 0; + g.fp = strcmp(argv[optind], "-")? bam_open(argv[optind], "r") : bam_dopen(fileno(stdin), "r"); + g.h = bam_header_read(g.fp); + g.em = errmod_init(1 - ERR_DEP); + plp = bam_plp_init(read_aln, &g); + while ((p = bam_plp_auto(plp, &tid, &pos, &n)) != 0) { + if (tid < 0) break; + if (tid != lasttid) { // change of chromosome + if (cns) process_cns(g.h, lasttid, l, cns); + if (max_l < g.h->target_len[tid]) { + max_l = g.h->target_len[tid]; + kroundup32(max_l); + cns = realloc(cns, max_l * 2); + } + l = g.h->target_len[tid]; + memset(cns, 0, max_l * 2); + lasttid = tid; + } + cns[pos] = gencns(&g, n, p); + lastpos = pos; + } + process_cns(g.h, lasttid, l, cns); + free(cns); + bam_header_destroy(g.h); + bam_plp_destroy(plp); + bam_close(g.fp); + if (g.fai) { + fai_destroy(g.fai); free(g.ref); + } + errmod_destroy(g.em); + free(g.bases); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/errmod.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/errmod.c.pysam.c new file mode 100755 index 0000000..bf62418 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/errmod.c.pysam.c @@ -0,0 +1,132 @@ +#include "pysam.h" + +#include +#include "errmod.h" +#include "ksort.h" +KSORT_INIT_GENERIC(uint16_t) + +typedef struct __errmod_coef_t { + double *fk, *beta, *lhet; +} errmod_coef_t; + +typedef struct { + double fsum[16], bsum[16]; + uint32_t c[16]; +} call_aux_t; + +static errmod_coef_t *cal_coef(double depcorr, double eta) +{ + int k, n, q; + long double sum, sum1; + double *lC; + errmod_coef_t *ec; + + ec = calloc(1, sizeof(errmod_coef_t)); + // initialize ->fk + ec->fk = (double*)calloc(256, sizeof(double)); + ec->fk[0] = 1.0; + for (n = 1; n != 256; ++n) + ec->fk[n] = pow(1. - depcorr, n) * (1.0 - eta) + eta; + // initialize ->coef + ec->beta = (double*)calloc(256 * 256 * 64, sizeof(double)); + lC = (double*)calloc(256 * 256, sizeof(double)); + for (n = 1; n != 256; ++n) { + double lgn = lgamma(n+1); + for (k = 1; k <= n; ++k) + lC[n<<8|k] = lgn - lgamma(k+1) - lgamma(n-k+1); + } + for (q = 1; q != 64; ++q) { + double e = pow(10.0, -q/10.0); + double le = log(e); + double le1 = log(1.0 - e); + for (n = 1; n <= 255; ++n) { + double *beta = ec->beta + (q<<16|n<<8); + sum1 = sum = 0.0; + for (k = n; k >= 0; --k, sum1 = sum) { + sum = sum1 + expl(lC[n<<8|k] + k*le + (n-k)*le1); + beta[k] = -10. / M_LN10 * logl(sum1 / sum); + } + } + } + // initialize ->lhet + ec->lhet = (double*)calloc(256 * 256, sizeof(double)); + for (n = 0; n < 256; ++n) + for (k = 0; k < 256; ++k) + ec->lhet[n<<8|k] = lC[n<<8|k] - M_LN2 * n; + free(lC); + return ec; +} + +errmod_t *errmod_init(float depcorr) +{ + errmod_t *em; + em = (errmod_t*)calloc(1, sizeof(errmod_t)); + em->depcorr = depcorr; + em->coef = cal_coef(depcorr, 0.03); + return em; +} + +void errmod_destroy(errmod_t *em) +{ + if (em == 0) return; + free(em->coef->lhet); free(em->coef->fk); free(em->coef->beta); + free(em->coef); free(em); +} +// qual:6, strand:1, base:4 +int errmod_cal(const errmod_t *em, int n, int m, uint16_t *bases, float *q) +{ + call_aux_t aux; + int i, j, k, w[32]; + + if (m > m) return -1; + memset(q, 0, m * m * sizeof(float)); + if (n == 0) return 0; + // calculate aux.esum and aux.fsum + if (n > 255) { // then sample 255 bases + ks_shuffle(uint16_t, n, bases); + n = 255; + } + ks_introsort(uint16_t, n, bases); + memset(w, 0, 32 * sizeof(int)); + memset(&aux, 0, sizeof(call_aux_t)); + for (j = n - 1; j >= 0; --j) { // calculate esum and fsum + uint16_t b = bases[j]; + int q = b>>5 < 4? 4 : b>>5; + if (q > 63) q = 63; + k = b&0x1f; + aux.fsum[k&0xf] += em->coef->fk[w[k]]; + aux.bsum[k&0xf] += em->coef->fk[w[k]] * em->coef->beta[q<<16|n<<8|aux.c[k&0xf]]; + ++aux.c[k&0xf]; + ++w[k]; + } + // generate likelihood + for (j = 0; j != m; ++j) { + float tmp1, tmp3; + int tmp2, bar_e; + // homozygous + for (k = 0, tmp1 = tmp3 = 0.0, tmp2 = 0; k != m; ++k) { + if (k == j) continue; + tmp1 += aux.bsum[k]; tmp2 += aux.c[k]; tmp3 += aux.fsum[k]; + } + if (tmp2) { + bar_e = (int)(tmp1 / tmp3 + 0.499); + if (bar_e > 63) bar_e = 63; + q[j*m+j] = tmp1; + } + // heterozygous + for (k = j + 1; k < m; ++k) { + int cjk = aux.c[j] + aux.c[k]; + for (i = 0, tmp2 = 0, tmp1 = tmp3 = 0.0; i < m; ++i) { + if (i == j || i == k) continue; + tmp1 += aux.bsum[i]; tmp2 += aux.c[i]; tmp3 += aux.fsum[i]; + } + if (tmp2) { + bar_e = (int)(tmp1 / tmp3 + 0.499); + if (bar_e > 63) bar_e = 63; + q[j*m+k] = q[k*m+j] = -4.343 * em->coef->lhet[cjk<<8|aux.c[k]] + tmp1; + } else q[j*m+k] = q[k*m+j] = -4.343 * em->coef->lhet[cjk<<8|aux.c[k]]; // all the bases are either j or k + } + for (k = 0; k != m; ++k) if (q[j*m+k] < 0.0) q[j*m+k] = 0.0; + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/errmod.h b/code/utilities/CPAT-1.2.2/lib/samtools/errmod.h new file mode 100755 index 0000000..32c07b6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/errmod.h @@ -0,0 +1,24 @@ +#ifndef ERRMOD_H +#define ERRMOD_H + +#include + +struct __errmod_coef_t; + +typedef struct { + double depcorr; + struct __errmod_coef_t *coef; +} errmod_t; + +errmod_t *errmod_init(float depcorr); +void errmod_destroy(errmod_t *em); + +/* + n: number of bases + m: maximum base + bases[i]: qual:6, strand:1, base:4 + q[i*m+j]: phred-scaled likelihood of (i,j) + */ +int errmod_cal(const errmod_t *em, int n, int m, uint16_t *bases, float *q); + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/faidx.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/faidx.c.pysam.c new file mode 100755 index 0000000..376629e --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/faidx.c.pysam.c @@ -0,0 +1,434 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "faidx.h" +#include "khash.h" + +typedef struct { + int32_t line_len, line_blen; + int64_t len; + uint64_t offset; +} faidx1_t; +KHASH_MAP_INIT_STR(s, faidx1_t) + +#ifndef _NO_RAZF +#include "razf.h" +#else +#ifdef _WIN32 +#define ftello(fp) ftell(fp) +#define fseeko(fp, offset, whence) fseek(fp, offset, whence) +#else +extern off_t ftello(FILE *stream); +extern int fseeko(FILE *stream, off_t offset, int whence); +#endif +#define RAZF FILE +#define razf_read(fp, buf, size) fread(buf, 1, size, fp) +#define razf_open(fn, mode) fopen(fn, mode) +#define razf_close(fp) fclose(fp) +#define razf_seek(fp, offset, whence) fseeko(fp, offset, whence) +#define razf_tell(fp) ftello(fp) +#endif +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +struct __faidx_t { + RAZF *rz; + int n, m; + char **name; + khash_t(s) *hash; +}; + +#ifndef kroundup32 +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +static inline void fai_insert_index(faidx_t *idx, const char *name, int len, int line_len, int line_blen, uint64_t offset) +{ + khint_t k; + int ret; + faidx1_t t; + if (idx->n == idx->m) { + idx->m = idx->m? idx->m<<1 : 16; + idx->name = (char**)realloc(idx->name, sizeof(void*) * idx->m); + } + idx->name[idx->n] = strdup(name); + k = kh_put(s, idx->hash, idx->name[idx->n], &ret); + t.len = len; t.line_len = line_len; t.line_blen = line_blen; t.offset = offset; + kh_value(idx->hash, k) = t; + ++idx->n; +} + +faidx_t *fai_build_core(RAZF *rz) +{ + char c, *name; + int l_name, m_name, ret; + int line_len, line_blen, state; + int l1, l2; + faidx_t *idx; + uint64_t offset; + int64_t len; + + idx = (faidx_t*)calloc(1, sizeof(faidx_t)); + idx->hash = kh_init(s); + name = 0; l_name = m_name = 0; + len = line_len = line_blen = -1; state = 0; l1 = l2 = -1; offset = 0; + while (razf_read(rz, &c, 1)) { + if (c == '\n') { // an empty line + if (state == 1) { + offset = razf_tell(rz); + continue; + } else if ((state == 0 && len < 0) || state == 2) continue; + } + if (c == '>') { // fasta header + if (len >= 0) + fai_insert_index(idx, name, len, line_len, line_blen, offset); + l_name = 0; + while ((ret = razf_read(rz, &c, 1)) != 0 && !isspace(c)) { + if (m_name < l_name + 2) { + m_name = l_name + 2; + kroundup32(m_name); + name = (char*)realloc(name, m_name); + } + name[l_name++] = c; + } + name[l_name] = '\0'; + if (ret == 0) { + fprintf(pysamerr, "[fai_build_core] the last entry has no sequence\n"); + free(name); fai_destroy(idx); + return 0; + } + if (c != '\n') while (razf_read(rz, &c, 1) && c != '\n'); + state = 1; len = 0; + offset = razf_tell(rz); + } else { + if (state == 3) { + fprintf(pysamerr, "[fai_build_core] inlined empty line is not allowed in sequence '%s'.\n", name); + free(name); fai_destroy(idx); + return 0; + } + if (state == 2) state = 3; + l1 = l2 = 0; + do { + ++l1; + if (isgraph(c)) ++l2; + } while ((ret = razf_read(rz, &c, 1)) && c != '\n'); + if (state == 3 && l2) { + fprintf(pysamerr, "[fai_build_core] different line length in sequence '%s'.\n", name); + free(name); fai_destroy(idx); + return 0; + } + ++l1; len += l2; + if (state == 1) line_len = l1, line_blen = l2, state = 0; + else if (state == 0) { + if (l1 != line_len || l2 != line_blen) state = 2; + } + } + } + fai_insert_index(idx, name, len, line_len, line_blen, offset); + free(name); + return idx; +} + +void fai_save(const faidx_t *fai, FILE *fp) +{ + khint_t k; + int i; + for (i = 0; i < fai->n; ++i) { + faidx1_t x; + k = kh_get(s, fai->hash, fai->name[i]); + x = kh_value(fai->hash, k); +#ifdef _WIN32 + fprintf(fp, "%s\t%d\t%ld\t%d\t%d\n", fai->name[i], (int)x.len, (long)x.offset, (int)x.line_blen, (int)x.line_len); +#else + fprintf(fp, "%s\t%d\t%lld\t%d\t%d\n", fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len); +#endif + } +} + +faidx_t *fai_read(FILE *fp) +{ + faidx_t *fai; + char *buf, *p; + int len, line_len, line_blen; +#ifdef _WIN32 + long offset; +#else + long long offset; +#endif + fai = (faidx_t*)calloc(1, sizeof(faidx_t)); + fai->hash = kh_init(s); + buf = (char*)calloc(0x10000, 1); + while (!feof(fp) && fgets(buf, 0x10000, fp)) { + for (p = buf; *p && isgraph(*p); ++p); + *p = 0; ++p; +#ifdef _WIN32 + sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len); +#else + sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len); +#endif + fai_insert_index(fai, buf, len, line_len, line_blen, offset); + } + free(buf); + return fai; +} + +void fai_destroy(faidx_t *fai) +{ + int i; + for (i = 0; i < fai->n; ++i) free(fai->name[i]); + free(fai->name); + kh_destroy(s, fai->hash); + if (fai->rz) razf_close(fai->rz); + free(fai); +} + +int fai_build(const char *fn) +{ + char *str; + RAZF *rz; + FILE *fp; + faidx_t *fai; + str = (char*)calloc(strlen(fn) + 5, 1); + sprintf(str, "%s.fai", fn); + rz = razf_open(fn, "r"); + if (rz == 0) { + fprintf(pysamerr, "[fai_build] fail to open the FASTA file %s\n",fn); + free(str); + return -1; + } + fai = fai_build_core(rz); + razf_close(rz); + fp = fopen(str, "wb"); + if (fp == 0) { + fprintf(pysamerr, "[fai_build] fail to write FASTA index %s\n",str); + fai_destroy(fai); free(str); + return -1; + } + fai_save(fai, fp); + fclose(fp); + free(str); + fai_destroy(fai); + return 0; +} + +#ifdef _USE_KNETFILE +FILE *download_and_open(const char *fn) +{ + const int buf_size = 1 * 1024 * 1024; + uint8_t *buf; + FILE *fp; + knetFile *fp_remote; + const char *url = fn; + const char *p; + int l = strlen(fn); + for (p = fn + l - 1; p >= fn; --p) + if (*p == '/') break; + fn = p + 1; + + // First try to open a local copy + fp = fopen(fn, "r"); + if (fp) + return fp; + + // If failed, download from remote and open + fp_remote = knet_open(url, "rb"); + if (fp_remote == 0) { + fprintf(pysamerr, "[download_from_remote] fail to open remote file %s\n",url); + return NULL; + } + if ((fp = fopen(fn, "wb")) == 0) { + fprintf(pysamerr, "[download_from_remote] fail to create file in the working directory %s\n",fn); + knet_close(fp_remote); + return NULL; + } + buf = (uint8_t*)calloc(buf_size, 1); + while ((l = knet_read(fp_remote, buf, buf_size)) != 0) + fwrite(buf, 1, l, fp); + free(buf); + fclose(fp); + knet_close(fp_remote); + + return fopen(fn, "r"); +} +#endif + +faidx_t *fai_load(const char *fn) +{ + char *str; + FILE *fp; + faidx_t *fai; + str = (char*)calloc(strlen(fn) + 5, 1); + sprintf(str, "%s.fai", fn); + +#ifdef _USE_KNETFILE + if (strstr(fn, "ftp://") == fn || strstr(fn, "http://") == fn) + { + fp = download_and_open(str); + if ( !fp ) + { + fprintf(pysamerr, "[fai_load] failed to open remote FASTA index %s\n", str); + free(str); + return 0; + } + } + else +#endif + fp = fopen(str, "rb"); + if (fp == 0) { + fprintf(pysamerr, "[fai_load] build FASTA index.\n"); + fai_build(fn); + fp = fopen(str, "rb"); + if (fp == 0) { + fprintf(pysamerr, "[fai_load] fail to open FASTA index.\n"); + free(str); + return 0; + } + } + + fai = fai_read(fp); + fclose(fp); + + fai->rz = razf_open(fn, "rb"); + free(str); + if (fai->rz == 0) { + fprintf(pysamerr, "[fai_load] fail to open FASTA file.\n"); + return 0; + } + return fai; +} + +char *fai_fetch(const faidx_t *fai, const char *str, int *len) +{ + char *s, c; + int i, l, k, name_end; + khiter_t iter; + faidx1_t val; + khash_t(s) *h; + int beg, end; + + beg = end = -1; + h = fai->hash; + name_end = l = strlen(str); + s = (char*)malloc(l+1); + // remove space + for (i = k = 0; i < l; ++i) + if (!isspace(str[i])) s[k++] = str[i]; + s[k] = 0; l = k; + // determine the sequence name + for (i = l - 1; i >= 0; --i) if (s[i] == ':') break; // look for colon from the end + if (i >= 0) name_end = i; + if (name_end < l) { // check if this is really the end + int n_hyphen = 0; + for (i = name_end + 1; i < l; ++i) { + if (s[i] == '-') ++n_hyphen; + else if (!isdigit(s[i]) && s[i] != ',') break; + } + if (i < l || n_hyphen > 1) name_end = l; // malformated region string; then take str as the name + s[name_end] = 0; + iter = kh_get(s, h, s); + if (iter == kh_end(h)) { // cannot find the sequence name + iter = kh_get(s, h, str); // try str as the name + if (iter == kh_end(h)) { + *len = 0; + free(s); return 0; + } else s[name_end] = ':', name_end = l; + } + } else iter = kh_get(s, h, str); + val = kh_value(h, iter); + // parse the interval + if (name_end < l) { + for (i = k = name_end + 1; i < l; ++i) + if (s[i] != ',') s[k++] = s[i]; + s[k] = 0; + beg = atoi(s + name_end + 1); + for (i = name_end + 1; i != k; ++i) if (s[i] == '-') break; + end = i < k? atoi(s + i + 1) : val.len; + if (beg > 0) --beg; + } else beg = 0, end = val.len; + if (beg >= val.len) beg = val.len; + if (end >= val.len) end = val.len; + if (beg > end) beg = end; + free(s); + + // now retrieve the sequence + l = 0; + s = (char*)malloc(end - beg + 2); + razf_seek(fai->rz, val.offset + beg / val.line_blen * val.line_len + beg % val.line_blen, SEEK_SET); + while (razf_read(fai->rz, &c, 1) == 1 && l < end - beg && !fai->rz->z_err) + if (isgraph(c)) s[l++] = c; + s[l] = '\0'; + *len = l; + return s; +} + +int faidx_main(int argc, char *argv[]) +{ + if (argc == 1) { + fprintf(pysamerr, "Usage: faidx [ [...]]\n"); + return 1; + } else { + if (argc == 2) fai_build(argv[1]); + else { + int i, j, k, l; + char *s; + faidx_t *fai; + fai = fai_load(argv[1]); + if (fai == 0) return 1; + for (i = 2; i != argc; ++i) { + printf(">%s\n", argv[i]); + s = fai_fetch(fai, argv[i], &l); + for (j = 0; j < l; j += 60) { + for (k = 0; k < 60 && k < l - j; ++k) + putchar(s[j + k]); + putchar('\n'); + } + free(s); + } + fai_destroy(fai); + } + } + return 0; +} + +int faidx_fetch_nseq(const faidx_t *fai) +{ + return fai->n; +} + +char *faidx_fetch_seq(const faidx_t *fai, char *c_name, int p_beg_i, int p_end_i, int *len) +{ + int l; + char c; + khiter_t iter; + faidx1_t val; + char *seq=NULL; + + // Adjust position + iter = kh_get(s, fai->hash, c_name); + if(iter == kh_end(fai->hash)) return 0; + val = kh_value(fai->hash, iter); + if(p_end_i < p_beg_i) p_beg_i = p_end_i; + if(p_beg_i < 0) p_beg_i = 0; + else if(val.len <= p_beg_i) p_beg_i = val.len - 1; + if(p_end_i < 0) p_end_i = 0; + else if(val.len <= p_end_i) p_end_i = val.len - 1; + + // Now retrieve the sequence + l = 0; + seq = (char*)malloc(p_end_i - p_beg_i + 2); + razf_seek(fai->rz, val.offset + p_beg_i / val.line_blen * val.line_len + p_beg_i % val.line_blen, SEEK_SET); + while (razf_read(fai->rz, &c, 1) == 1 && l < p_end_i - p_beg_i + 1) + if (isgraph(c)) seq[l++] = c; + seq[l] = '\0'; + *len = l; + return seq; +} + +#ifdef FAIDX_MAIN +int main(int argc, char *argv[]) { return faidx_main(argc, argv); } +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/faidx.h b/code/utilities/CPAT-1.2.2/lib/samtools/faidx.h new file mode 100755 index 0000000..1fb1b1f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/faidx.h @@ -0,0 +1,103 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +#ifndef FAIDX_H +#define FAIDX_H + +/*! + @header + + Index FASTA files and extract subsequence. + + @copyright The Wellcome Trust Sanger Institute. + */ + +struct __faidx_t; +typedef struct __faidx_t faidx_t; + +#ifdef __cplusplus +extern "C" { +#endif + + /*! + @abstract Build index for a FASTA or razip compressed FASTA file. + @param fn FASTA file name + @return 0 on success; or -1 on failure + @discussion File "fn.fai" will be generated. + */ + int fai_build(const char *fn); + + /*! + @abstract Distroy a faidx_t struct. + @param fai Pointer to the struct to be destroyed + */ + void fai_destroy(faidx_t *fai); + + /*! + @abstract Load index from "fn.fai". + @param fn File name of the FASTA file + */ + faidx_t *fai_load(const char *fn); + + /*! + @abstract Fetch the sequence in a region. + @param fai Pointer to the faidx_t struct + @param reg Region in the format "chr2:20,000-30,000" + @param len Length of the region + @return Pointer to the sequence; null on failure + + @discussion The returned sequence is allocated by malloc family + and should be destroyed by end users by calling free() on it. + */ + char *fai_fetch(const faidx_t *fai, const char *reg, int *len); + + /*! + @abstract Fetch the number of sequences. + @param fai Pointer to the faidx_t struct + @return The number of sequences + */ + int faidx_fetch_nseq(const faidx_t *fai); + + /*! + @abstract Fetch the sequence in a region. + @param fai Pointer to the faidx_t struct + @param c_name Region name + @param p_beg_i Beginning position number (zero-based) + @param p_end_i End position number (zero-based) + @param len Length of the region + @return Pointer to the sequence; null on failure + + @discussion The returned sequence is allocated by malloc family + and should be destroyed by end users by calling free() on it. + */ + char *faidx_fetch_seq(const faidx_t *fai, char *c_name, int p_beg_i, int p_end_i, int *len); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kaln.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/kaln.c.pysam.c new file mode 100755 index 0000000..953a214 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kaln.c.pysam.c @@ -0,0 +1,488 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2003-2006, 2008, 2009, by Heng Li + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#include +#include +#include +#include +#include +#include "kaln.h" + +#define FROM_M 0 +#define FROM_I 1 +#define FROM_D 2 + +typedef struct { + int i, j; + unsigned char ctype; +} path_t; + +int aln_sm_blosum62[] = { +/* A R N D C Q E G H I L K M F P S T W Y V * X */ + 4,-1,-2,-2, 0,-1,-1, 0,-2,-1,-1,-1,-1,-2,-1, 1, 0,-3,-2, 0,-4, 0, + -1, 5, 0,-2,-3, 1, 0,-2, 0,-3,-2, 2,-1,-3,-2,-1,-1,-3,-2,-3,-4,-1, + -2, 0, 6, 1,-3, 0, 0, 0, 1,-3,-3, 0,-2,-3,-2, 1, 0,-4,-2,-3,-4,-1, + -2,-2, 1, 6,-3, 0, 2,-1,-1,-3,-4,-1,-3,-3,-1, 0,-1,-4,-3,-3,-4,-1, + 0,-3,-3,-3, 9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-4,-2, + -1, 1, 0, 0,-3, 5, 2,-2, 0,-3,-2, 1, 0,-3,-1, 0,-1,-2,-1,-2,-4,-1, + -1, 0, 0, 2,-4, 2, 5,-2, 0,-3,-3, 1,-2,-3,-1, 0,-1,-3,-2,-2,-4,-1, + 0,-2, 0,-1,-3,-2,-2, 6,-2,-4,-4,-2,-3,-3,-2, 0,-2,-2,-3,-3,-4,-1, + -2, 0, 1,-1,-3, 0, 0,-2, 8,-3,-3,-1,-2,-1,-2,-1,-2,-2, 2,-3,-4,-1, + -1,-3,-3,-3,-1,-3,-3,-4,-3, 4, 2,-3, 1, 0,-3,-2,-1,-3,-1, 3,-4,-1, + -1,-2,-3,-4,-1,-2,-3,-4,-3, 2, 4,-2, 2, 0,-3,-2,-1,-2,-1, 1,-4,-1, + -1, 2, 0,-1,-3, 1, 1,-2,-1,-3,-2, 5,-1,-3,-1, 0,-1,-3,-2,-2,-4,-1, + -1,-1,-2,-3,-1, 0,-2,-3,-2, 1, 2,-1, 5, 0,-2,-1,-1,-1,-1, 1,-4,-1, + -2,-3,-3,-3,-2,-3,-3,-3,-1, 0, 0,-3, 0, 6,-4,-2,-2, 1, 3,-1,-4,-1, + -1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4, 7,-1,-1,-4,-3,-2,-4,-2, + 1,-1, 1, 0,-1, 0, 0, 0,-1,-2,-2, 0,-1,-2,-1, 4, 1,-3,-2,-2,-4, 0, + 0,-1, 0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1, 1, 5,-2,-2, 0,-4, 0, + -3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1, 1,-4,-3,-2,11, 2,-3,-4,-2, + -2,-2,-2,-3,-2,-1,-2,-3, 2,-1,-1,-2,-1, 3,-3,-2,-2, 2, 7,-1,-4,-1, + 0,-3,-3,-3,-1,-2,-2,-3,-3, 3, 1,-2, 1,-1,-2,-2, 0,-3,-1, 4,-4,-1, + -4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4, 1,-4, + 0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2, 0, 0,-2,-1,-1,-4,-1 +}; + +int aln_sm_blast[] = { + 1, -3, -3, -3, -2, + -3, 1, -3, -3, -2, + -3, -3, 1, -3, -2, + -3, -3, -3, 1, -2, + -2, -2, -2, -2, -2 +}; + +int aln_sm_qual[] = { + 0, -23, -23, -23, 0, + -23, 0, -23, -23, 0, + -23, -23, 0, -23, 0, + -23, -23, -23, 0, 0, + 0, 0, 0, 0, 0 +}; + +ka_param_t ka_param_blast = { 5, 2, 5, 2, aln_sm_blast, 5, 50 }; +ka_param_t ka_param_aa2aa = { 10, 2, 10, 2, aln_sm_blosum62, 22, 50 }; + +ka_param2_t ka_param2_qual = { 37, 11, 37, 11, 37, 11, 0, 0, aln_sm_qual, 5, 50 }; + +static uint32_t *ka_path2cigar32(const path_t *path, int path_len, int *n_cigar) +{ + int i, n; + uint32_t *cigar; + unsigned char last_type; + + if (path_len == 0 || path == 0) { + *n_cigar = 0; + return 0; + } + + last_type = path->ctype; + for (i = n = 1; i < path_len; ++i) { + if (last_type != path[i].ctype) ++n; + last_type = path[i].ctype; + } + *n_cigar = n; + cigar = (uint32_t*)calloc(*n_cigar, 4); + + cigar[0] = 1u << 4 | path[path_len-1].ctype; + last_type = path[path_len-1].ctype; + for (i = path_len - 2, n = 0; i >= 0; --i) { + if (path[i].ctype == last_type) cigar[n] += 1u << 4; + else { + cigar[++n] = 1u << 4 | path[i].ctype; + last_type = path[i].ctype; + } + } + + return cigar; +} + +/***************************/ +/* START OF common_align.c */ +/***************************/ + +#define SET_INF(s) (s).M = (s).I = (s).D = MINOR_INF; + +#define set_M(MM, cur, p, sc) \ +{ \ + if ((p)->M >= (p)->I) { \ + if ((p)->M >= (p)->D) { \ + (MM) = (p)->M + (sc); (cur)->Mt = FROM_M; \ + } else { \ + (MM) = (p)->D + (sc); (cur)->Mt = FROM_D; \ + } \ + } else { \ + if ((p)->I > (p)->D) { \ + (MM) = (p)->I + (sc); (cur)->Mt = FROM_I; \ + } else { \ + (MM) = (p)->D + (sc); (cur)->Mt = FROM_D; \ + } \ + } \ +} +#define set_I(II, cur, p) \ +{ \ + if ((p)->M - gap_open > (p)->I) { \ + (cur)->It = FROM_M; \ + (II) = (p)->M - gap_open - gap_ext; \ + } else { \ + (cur)->It = FROM_I; \ + (II) = (p)->I - gap_ext; \ + } \ +} +#define set_end_I(II, cur, p) \ +{ \ + if (gap_end_ext >= 0) { \ + if ((p)->M - gap_end_open > (p)->I) { \ + (cur)->It = FROM_M; \ + (II) = (p)->M - gap_end_open - gap_end_ext; \ + } else { \ + (cur)->It = FROM_I; \ + (II) = (p)->I - gap_end_ext; \ + } \ + } else set_I(II, cur, p); \ +} +#define set_D(DD, cur, p) \ +{ \ + if ((p)->M - gap_open > (p)->D) { \ + (cur)->Dt = FROM_M; \ + (DD) = (p)->M - gap_open - gap_ext; \ + } else { \ + (cur)->Dt = FROM_D; \ + (DD) = (p)->D - gap_ext; \ + } \ +} +#define set_end_D(DD, cur, p) \ +{ \ + if (gap_end_ext >= 0) { \ + if ((p)->M - gap_end_open > (p)->D) { \ + (cur)->Dt = FROM_M; \ + (DD) = (p)->M - gap_end_open - gap_end_ext; \ + } else { \ + (cur)->Dt = FROM_D; \ + (DD) = (p)->D - gap_end_ext; \ + } \ + } else set_D(DD, cur, p); \ +} + +typedef struct { + uint8_t Mt:3, It:2, Dt:3; +} dpcell_t; + +typedef struct { + int M, I, D; +} dpscore_t; + +/*************************** + * banded global alignment * + ***************************/ +uint32_t *ka_global_core(uint8_t *seq1, int len1, uint8_t *seq2, int len2, const ka_param_t *ap, int *_score, int *n_cigar) +{ + int i, j; + dpcell_t **dpcell, *q; + dpscore_t *curr, *last, *s; + int b1, b2, tmp_end; + int *mat, end, max = 0; + uint8_t type, ctype; + uint32_t *cigar = 0; + + int gap_open, gap_ext, gap_end_open, gap_end_ext, b; + int *score_matrix, N_MATRIX_ROW; + + /* initialize some align-related parameters. just for compatibility */ + gap_open = ap->gap_open; + gap_ext = ap->gap_ext; + gap_end_open = ap->gap_end_open; + gap_end_ext = ap->gap_end_ext; + b = ap->band_width; + score_matrix = ap->matrix; + N_MATRIX_ROW = ap->row; + + if (n_cigar) *n_cigar = 0; + if (len1 == 0 || len2 == 0) return 0; + + /* calculate b1 and b2 */ + if (len1 > len2) { + b1 = len1 - len2 + b; + b2 = b; + } else { + b1 = b; + b2 = len2 - len1 + b; + } + if (b1 > len1) b1 = len1; + if (b2 > len2) b2 = len2; + --seq1; --seq2; + + /* allocate memory */ + end = (b1 + b2 <= len1)? (b1 + b2 + 1) : (len1 + 1); + dpcell = (dpcell_t**)malloc(sizeof(dpcell_t*) * (len2 + 1)); + for (j = 0; j <= len2; ++j) + dpcell[j] = (dpcell_t*)malloc(sizeof(dpcell_t) * end); + for (j = b2 + 1; j <= len2; ++j) + dpcell[j] -= j - b2; + curr = (dpscore_t*)malloc(sizeof(dpscore_t) * (len1 + 1)); + last = (dpscore_t*)malloc(sizeof(dpscore_t) * (len1 + 1)); + + /* set first row */ + SET_INF(*curr); curr->M = 0; + for (i = 1, s = curr + 1; i < b1; ++i, ++s) { + SET_INF(*s); + set_end_D(s->D, dpcell[0] + i, s - 1); + } + s = curr; curr = last; last = s; + + /* core dynamic programming, part 1 */ + tmp_end = (b2 < len2)? b2 : len2 - 1; + for (j = 1; j <= tmp_end; ++j) { + q = dpcell[j]; s = curr; SET_INF(*s); + set_end_I(s->I, q, last); + end = (j + b1 <= len1 + 1)? (j + b1 - 1) : len1; + mat = score_matrix + seq2[j] * N_MATRIX_ROW; + ++s; ++q; + for (i = 1; i != end; ++i, ++s, ++q) { + set_M(s->M, q, last + i - 1, mat[seq1[i]]); /* this will change s->M ! */ + set_I(s->I, q, last + i); + set_D(s->D, q, s - 1); + } + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_D(s->D, q, s - 1); + if (j + b1 - 1 > len1) { /* bug fixed, 040227 */ + set_end_I(s->I, q, last + i); + } else s->I = MINOR_INF; + s = curr; curr = last; last = s; + } + /* last row for part 1, use set_end_D() instead of set_D() */ + if (j == len2 && b2 != len2 - 1) { + q = dpcell[j]; s = curr; SET_INF(*s); + set_end_I(s->I, q, last); + end = (j + b1 <= len1 + 1)? (j + b1 - 1) : len1; + mat = score_matrix + seq2[j] * N_MATRIX_ROW; + ++s; ++q; + for (i = 1; i != end; ++i, ++s, ++q) { + set_M(s->M, q, last + i - 1, mat[seq1[i]]); /* this will change s->M ! */ + set_I(s->I, q, last + i); + set_end_D(s->D, q, s - 1); + } + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_end_D(s->D, q, s - 1); + if (j + b1 - 1 > len1) { /* bug fixed, 040227 */ + set_end_I(s->I, q, last + i); + } else s->I = MINOR_INF; + s = curr; curr = last; last = s; + ++j; + } + + /* core dynamic programming, part 2 */ + for (; j <= len2 - b2 + 1; ++j) { + SET_INF(curr[j - b2]); + mat = score_matrix + seq2[j] * N_MATRIX_ROW; + end = j + b1 - 1; + for (i = j - b2 + 1, q = dpcell[j] + i, s = curr + i; i != end; ++i, ++s, ++q) { + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_I(s->I, q, last + i); + set_D(s->D, q, s - 1); + } + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_D(s->D, q, s - 1); + s->I = MINOR_INF; + s = curr; curr = last; last = s; + } + + /* core dynamic programming, part 3 */ + for (; j < len2; ++j) { + SET_INF(curr[j - b2]); + mat = score_matrix + seq2[j] * N_MATRIX_ROW; + for (i = j - b2 + 1, q = dpcell[j] + i, s = curr + i; i < len1; ++i, ++s, ++q) { + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_I(s->I, q, last + i); + set_D(s->D, q, s - 1); + } + set_M(s->M, q, last + len1 - 1, mat[seq1[i]]); + set_end_I(s->I, q, last + i); + set_D(s->D, q, s - 1); + s = curr; curr = last; last = s; + } + /* last row */ + if (j == len2) { + SET_INF(curr[j - b2]); + mat = score_matrix + seq2[j] * N_MATRIX_ROW; + for (i = j - b2 + 1, q = dpcell[j] + i, s = curr + i; i < len1; ++i, ++s, ++q) { + set_M(s->M, q, last + i - 1, mat[seq1[i]]); + set_I(s->I, q, last + i); + set_end_D(s->D, q, s - 1); + } + set_M(s->M, q, last + len1 - 1, mat[seq1[i]]); + set_end_I(s->I, q, last + i); + set_end_D(s->D, q, s - 1); + s = curr; curr = last; last = s; + } + + *_score = last[len1].M; + if (n_cigar) { /* backtrace */ + path_t *p, *path = (path_t*)malloc(sizeof(path_t) * (len1 + len2 + 2)); + i = len1; j = len2; + q = dpcell[j] + i; + s = last + len1; + max = s->M; type = q->Mt; ctype = FROM_M; + if (s->I > max) { max = s->I; type = q->It; ctype = FROM_I; } + if (s->D > max) { max = s->D; type = q->Dt; ctype = FROM_D; } + + p = path; + p->ctype = ctype; p->i = i; p->j = j; /* bug fixed 040408 */ + ++p; + do { + switch (ctype) { + case FROM_M: --i; --j; break; + case FROM_I: --j; break; + case FROM_D: --i; break; + } + q = dpcell[j] + i; + ctype = type; + switch (type) { + case FROM_M: type = q->Mt; break; + case FROM_I: type = q->It; break; + case FROM_D: type = q->Dt; break; + } + p->ctype = ctype; p->i = i; p->j = j; + ++p; + } while (i || j); + cigar = ka_path2cigar32(path, p - path - 1, n_cigar); + free(path); + } + + /* free memory */ + for (j = b2 + 1; j <= len2; ++j) + dpcell[j] += j - b2; + for (j = 0; j <= len2; ++j) + free(dpcell[j]); + free(dpcell); + free(curr); free(last); + + return cigar; +} + +typedef struct { + int M, I, D; +} score_aux_t; + +#define MINUS_INF -0x40000000 + +// matrix: len2 rows and len1 columns +int ka_global_score(const uint8_t *_seq1, int len1, const uint8_t *_seq2, int len2, const ka_param2_t *ap) +{ + +#define __score_aux(_p, _q0, _sc, _io, _ie, _do, _de) { \ + int t1, t2; \ + score_aux_t *_q; \ + _q = _q0; \ + _p->M = _q->M >= _q->I? _q->M : _q->I; \ + _p->M = _p->M >= _q->D? _p->M : _q->D; \ + _p->M += (_sc); \ + ++_q; t1 = _q->M - _io - _ie; t2 = _q->I - _ie; _p->I = t1 >= t2? t1 : t2; \ + _q = _p-1; t1 = _q->M - _do - _de; t2 = _q->D - _de; _p->D = t1 >= t2? t1 : t2; \ + } + + int i, j, bw, scmat_size = ap->row, *scmat = ap->matrix, ret; + const uint8_t *seq1, *seq2; + score_aux_t *curr, *last, *swap; + bw = abs(len1 - len2) + ap->band_width; + i = len1 > len2? len1 : len2; + if (bw > i + 1) bw = i + 1; + seq1 = _seq1 - 1; seq2 = _seq2 - 1; + curr = calloc(len1 + 2, sizeof(score_aux_t)); + last = calloc(len1 + 2, sizeof(score_aux_t)); + { // the zero-th row + int x, end = len1; + score_aux_t *p; + j = 0; + x = j + bw; end = len1 < x? len1 : x; // band end + p = curr; + p->M = 0; p->I = p->D = MINUS_INF; + for (i = 1, p = &curr[1]; i <= end; ++i, ++p) + p->M = p->I = MINUS_INF, p->D = -(ap->edo + ap->ede * i); + p->M = p->I = p->D = MINUS_INF; + swap = curr; curr = last; last = swap; + } + for (j = 1; j < len2; ++j) { + int x, beg = 0, end = len1, *scrow, col_end; + score_aux_t *p; + x = j - bw; beg = 0 > x? 0 : x; // band start + x = j + bw; end = len1 < x? len1 : x; // band end + if (beg == 0) { // from zero-th column + p = curr; + p->M = p->D = MINUS_INF; p->I = -(ap->eio + ap->eie * j); + ++beg; // then beg = 1 + } + scrow = scmat + seq2[j] * scmat_size; + if (end == len1) col_end = 1, --end; + else col_end = 0; + for (i = beg, p = &curr[beg]; i <= end; ++i, ++p) + __score_aux(p, &last[i-1], scrow[(int)seq1[i]], ap->iio, ap->iie, ap->ido, ap->ide); + if (col_end) { + __score_aux(p, &last[i-1], scrow[(int)seq1[i]], ap->eio, ap->eie, ap->ido, ap->ide); + ++p; + } + p->M = p->I = p->D = MINUS_INF; +// for (i = 0; i <= len1; ++i) printf("(%d,%d,%d) ", curr[i].M, curr[i].I, curr[i].D); putchar('\n'); + swap = curr; curr = last; last = swap; + } + { // the last row + int x, beg = 0, *scrow; + score_aux_t *p; + j = len2; + x = j - bw; beg = 0 > x? 0 : x; // band start + if (beg == 0) { // from zero-th column + p = curr; + p->M = p->D = MINUS_INF; p->I = -(ap->eio + ap->eie * j); + ++beg; // then beg = 1 + } + scrow = scmat + seq2[j] * scmat_size; + for (i = beg, p = &curr[beg]; i < len1; ++i, ++p) + __score_aux(p, &last[i-1], scrow[(int)seq1[i]], ap->iio, ap->iie, ap->edo, ap->ede); + __score_aux(p, &last[i-1], scrow[(int)seq1[i]], ap->eio, ap->eie, ap->edo, ap->ede); +// for (i = 0; i <= len1; ++i) printf("(%d,%d,%d) ", curr[i].M, curr[i].I, curr[i].D); putchar('\n'); + } + ret = curr[len1].M >= curr[len1].I? curr[len1].M : curr[len1].I; + ret = ret >= curr[len1].D? ret : curr[len1].D; + free(curr); free(last); + return ret; +} + +#ifdef _MAIN +int main(int argc, char *argv[]) +{ +// int len1 = 35, len2 = 35; +// uint8_t *seq1 = (uint8_t*)"\0\0\3\3\2\0\0\0\1\0\2\1\2\1\3\2\3\3\3\0\2\3\2\1\1\3\3\3\2\3\3\1\0\0\1"; +// uint8_t *seq2 = (uint8_t*)"\0\0\3\3\2\0\0\0\1\0\2\1\2\1\3\2\3\3\3\0\2\3\2\1\1\3\3\3\2\3\3\1\0\1\0"; + int len1 = 4, len2 = 4; + uint8_t *seq1 = (uint8_t*)"\1\0\0\1"; + uint8_t *seq2 = (uint8_t*)"\1\0\1\0"; + int sc; +// ka_global_core(seq1, 2, seq2, 1, &ka_param_qual, &sc, 0); + sc = ka_global_score(seq1, len1, seq2, len2, &ka_param2_qual); + printf("%d\n", sc); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kaln.h b/code/utilities/CPAT-1.2.2/lib/samtools/kaln.h new file mode 100755 index 0000000..1ece132 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kaln.h @@ -0,0 +1,67 @@ +/* The MIT License + + Copyright (c) 2003-2006, 2008, 2009 by Heng Li + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef LH3_KALN_H_ +#define LH3_KALN_H_ + +#include + +#define MINOR_INF -1073741823 + +typedef struct { + int gap_open; + int gap_ext; + int gap_end_open; + int gap_end_ext; + + int *matrix; + int row; + int band_width; +} ka_param_t; + +typedef struct { + int iio, iie, ido, ide; + int eio, eie, edo, ede; + int *matrix; + int row; + int band_width; +} ka_param2_t; + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t *ka_global_core(uint8_t *seq1, int len1, uint8_t *seq2, int len2, const ka_param_t *ap, + int *_score, int *n_cigar); + int ka_global_score(const uint8_t *_seq1, int len1, const uint8_t *_seq2, int len2, const ka_param2_t *ap); +#ifdef __cplusplus +} +#endif + +extern ka_param_t ka_param_blast; /* = { 5, 2, 5, 2, aln_sm_blast, 5, 50 }; */ +extern ka_param_t ka_param_qual; // only use this for global alignment!!! +extern ka_param2_t ka_param2_qual; // only use this for global alignment!!! + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/khash.h b/code/utilities/CPAT-1.2.2/lib/samtools/khash.h new file mode 100755 index 0000000..a7e8056 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/khash.h @@ -0,0 +1,528 @@ +/* The MIT License + + Copyright (c) 2008, 2009, 2011 by Attractive Chaos + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* + An example: + +#include "khash.h" +KHASH_MAP_INIT_INT(32, char) +int main() { + int ret, is_missing; + khiter_t k; + khash_t(32) *h = kh_init(32); + k = kh_put(32, h, 5, &ret); + if (!ret) kh_del(32, h, k); + kh_value(h, k) = 10; + k = kh_get(32, h, 10); + is_missing = (k == kh_end(h)); + k = kh_get(32, h, 5); + kh_del(32, h, k); + for (k = kh_begin(h); k != kh_end(h); ++k) + if (kh_exist(h, k)) kh_value(h, k) = 1; + kh_destroy(32, h); + return 0; +} +*/ + +/* + 2011-02-14 (0.2.5): + + * Allow to declare global functions. + + 2009-09-26 (0.2.4): + + * Improve portability + + 2008-09-19 (0.2.3): + + * Corrected the example + * Improved interfaces + + 2008-09-11 (0.2.2): + + * Improved speed a little in kh_put() + + 2008-09-10 (0.2.1): + + * Added kh_clear() + * Fixed a compiling error + + 2008-09-02 (0.2.0): + + * Changed to token concatenation which increases flexibility. + + 2008-08-31 (0.1.2): + + * Fixed a bug in kh_get(), which has not been tested previously. + + 2008-08-31 (0.1.1): + + * Added destructor +*/ + + +#ifndef __AC_KHASH_H +#define __AC_KHASH_H + +/*! + @header + + Generic hash table library. + + @copyright Heng Li + */ + +#define AC_VERSION_KHASH_H "0.2.5" + +#include +#include +#include + +/* compipler specific configuration */ + +#if UINT_MAX == 0xffffffffu +typedef unsigned int khint32_t; +#elif ULONG_MAX == 0xffffffffu +typedef unsigned long khint32_t; +#endif + +#if ULONG_MAX == ULLONG_MAX +typedef unsigned long khint64_t; +#else +typedef unsigned long long khint64_t; +#endif + +#ifdef _MSC_VER +#define inline __inline +#endif + +typedef khint32_t khint_t; +typedef khint_t khiter_t; + +#define __ac_HASH_PRIME_SIZE 32 +static const khint32_t __ac_prime_list[__ac_HASH_PRIME_SIZE] = +{ + 0ul, 3ul, 11ul, 23ul, 53ul, + 97ul, 193ul, 389ul, 769ul, 1543ul, + 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, + 98317ul, 196613ul, 393241ul, 786433ul, 1572869ul, + 3145739ul, 6291469ul, 12582917ul, 25165843ul, 50331653ul, + 100663319ul, 201326611ul, 402653189ul, 805306457ul, 1610612741ul, + 3221225473ul, 4294967291ul +}; + +#define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) +#define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) +#define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) +#define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) +#define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) +#define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) +#define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) + +static const double __ac_HASH_UPPER = 0.77; + +#define KHASH_DECLARE(name, khkey_t, khval_t) \ + typedef struct { \ + khint_t n_buckets, size, n_occupied, upper_bound; \ + khint32_t *flags; \ + khkey_t *keys; \ + khval_t *vals; \ + } kh_##name##_t; \ + extern kh_##name##_t *kh_init_##name(); \ + extern void kh_destroy_##name(kh_##name##_t *h); \ + extern void kh_clear_##name(kh_##name##_t *h); \ + extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \ + extern void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \ + extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \ + extern void kh_del_##name(kh_##name##_t *h, khint_t x); + +#define KHASH_INIT2(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ + typedef struct { \ + khint_t n_buckets, size, n_occupied, upper_bound; \ + khint32_t *flags; \ + khkey_t *keys; \ + khval_t *vals; \ + } kh_##name##_t; \ + SCOPE kh_##name##_t *kh_init_##name() { \ + return (kh_##name##_t*)calloc(1, sizeof(kh_##name##_t)); \ + } \ + SCOPE void kh_destroy_##name(kh_##name##_t *h) \ + { \ + if (h) { \ + free(h->keys); free(h->flags); \ + free(h->vals); \ + free(h); \ + } \ + } \ + SCOPE void kh_clear_##name(kh_##name##_t *h) \ + { \ + if (h && h->flags) { \ + memset(h->flags, 0xaa, ((h->n_buckets>>4) + 1) * sizeof(khint32_t)); \ + h->size = h->n_occupied = 0; \ + } \ + } \ + SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \ + { \ + if (h->n_buckets) { \ + khint_t inc, k, i, last; \ + k = __hash_func(key); i = k % h->n_buckets; \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) return h->n_buckets; \ + } \ + return __ac_iseither(h->flags, i)? h->n_buckets : i; \ + } else return 0; \ + } \ + SCOPE void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \ + { \ + khint32_t *new_flags = 0; \ + khint_t j = 1; \ + { \ + khint_t t = __ac_HASH_PRIME_SIZE - 1; \ + while (__ac_prime_list[t] > new_n_buckets) --t; \ + new_n_buckets = __ac_prime_list[t+1]; \ + if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; \ + else { \ + new_flags = (khint32_t*)malloc(((new_n_buckets>>4) + 1) * sizeof(khint32_t)); \ + memset(new_flags, 0xaa, ((new_n_buckets>>4) + 1) * sizeof(khint32_t)); \ + if (h->n_buckets < new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + } \ + } \ + if (j) { \ + for (j = 0; j != h->n_buckets; ++j) { \ + if (__ac_iseither(h->flags, j) == 0) { \ + khkey_t key = h->keys[j]; \ + khval_t val; \ + if (kh_is_map) val = h->vals[j]; \ + __ac_set_isdel_true(h->flags, j); \ + while (1) { \ + khint_t inc, k, i; \ + k = __hash_func(key); \ + i = k % new_n_buckets; \ + inc = 1 + k % (new_n_buckets - 1); \ + while (!__ac_isempty(new_flags, i)) { \ + if (i + inc >= new_n_buckets) i = i + inc - new_n_buckets; \ + else i += inc; \ + } \ + __ac_set_isempty_false(new_flags, i); \ + if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \ + { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ + if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ + __ac_set_isdel_true(h->flags, i); \ + } else { \ + h->keys[i] = key; \ + if (kh_is_map) h->vals[i] = val; \ + break; \ + } \ + } \ + } \ + } \ + if (h->n_buckets > new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + free(h->flags); \ + h->flags = new_flags; \ + h->n_buckets = new_n_buckets; \ + h->n_occupied = h->size; \ + h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ + } \ + } \ + SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \ + { \ + khint_t x; \ + if (h->n_occupied >= h->upper_bound) { \ + if (h->n_buckets > (h->size<<1)) kh_resize_##name(h, h->n_buckets - 1); \ + else kh_resize_##name(h, h->n_buckets + 1); \ + } \ + { \ + khint_t inc, k, i, site, last; \ + x = site = h->n_buckets; k = __hash_func(key); i = k % h->n_buckets; \ + if (__ac_isempty(h->flags, i)) x = i; \ + else { \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (__ac_isdel(h->flags, i)) site = i; \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) { x = site; break; } \ + } \ + if (x == h->n_buckets) { \ + if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ + else x = i; \ + } \ + } \ + } \ + if (__ac_isempty(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; ++h->n_occupied; \ + *ret = 1; \ + } else if (__ac_isdel(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; \ + *ret = 2; \ + } else *ret = 0; \ + return x; \ + } \ + SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \ + { \ + if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ + __ac_set_isdel_true(h->flags, x); \ + --h->size; \ + } \ + } + +#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ + KHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) + +/* --- BEGIN OF HASH FUNCTIONS --- */ + +/*! @function + @abstract Integer hash function + @param key The integer [khint32_t] + @return The hash value [khint_t] + */ +#define kh_int_hash_func(key) (khint32_t)(key) +/*! @function + @abstract Integer comparison function + */ +#define kh_int_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract 64-bit integer hash function + @param key The integer [khint64_t] + @return The hash value [khint_t] + */ +#define kh_int64_hash_func(key) (khint32_t)((key)>>33^(key)^(key)<<11) +/*! @function + @abstract 64-bit integer comparison function + */ +#define kh_int64_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract const char* hash function + @param s Pointer to a null terminated string + @return The hash value + */ +static inline khint_t __ac_X31_hash_string(const char *s) +{ + khint_t h = *s; + if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s; + return h; +} +/*! @function + @abstract Another interface to const char* hash function + @param key Pointer to a null terminated string [const char*] + @return The hash value [khint_t] + */ +#define kh_str_hash_func(key) __ac_X31_hash_string(key) +/*! @function + @abstract Const char* comparison function + */ +#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) + +/* --- END OF HASH FUNCTIONS --- */ + +/* Other necessary macros... */ + +/*! + @abstract Type of the hash table. + @param name Name of the hash table [symbol] + */ +#define khash_t(name) kh_##name##_t + +/*! @function + @abstract Initiate a hash table. + @param name Name of the hash table [symbol] + @return Pointer to the hash table [khash_t(name)*] + */ +#define kh_init(name) kh_init_##name() + +/*! @function + @abstract Destroy a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_destroy(name, h) kh_destroy_##name(h) + +/*! @function + @abstract Reset a hash table without deallocating memory. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_clear(name, h) kh_clear_##name(h) + +/*! @function + @abstract Resize a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param s New size [khint_t] + */ +#define kh_resize(name, h, s) kh_resize_##name(h, s) + +/*! @function + @abstract Insert a key to the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @param r Extra return code: 0 if the key is present in the hash table; + 1 if the bucket is empty (never used); 2 if the element in + the bucket has been deleted [int*] + @return Iterator to the inserted element [khint_t] + */ +#define kh_put(name, h, k, r) kh_put_##name(h, k, r) + +/*! @function + @abstract Retrieve a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @return Iterator to the found element, or kh_end(h) is the element is absent [khint_t] + */ +#define kh_get(name, h, k) kh_get_##name(h, k) + +/*! @function + @abstract Remove a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Iterator to the element to be deleted [khint_t] + */ +#define kh_del(name, h, k) kh_del_##name(h, k) + + +/*! @function + @abstract Test whether a bucket contains data. + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return 1 if containing data; 0 otherwise [int] + */ +#define kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) + +/*! @function + @abstract Get key given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Key [type of keys] + */ +#define kh_key(h, x) ((h)->keys[x]) + +/*! @function + @abstract Get value given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Value [type of values] + @discussion For hash sets, calling this results in segfault. + */ +#define kh_val(h, x) ((h)->vals[x]) + +/*! @function + @abstract Alias of kh_val() + */ +#define kh_value(h, x) ((h)->vals[x]) + +/*! @function + @abstract Get the start iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The start iterator [khint_t] + */ +#define kh_begin(h) (khint_t)(0) + +/*! @function + @abstract Get the end iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The end iterator [khint_t] + */ +#define kh_end(h) ((h)->n_buckets) + +/*! @function + @abstract Get the number of elements in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of elements in the hash table [khint_t] + */ +#define kh_size(h) ((h)->size) + +/*! @function + @abstract Get the number of buckets in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of buckets in the hash table [khint_t] + */ +#define kh_n_buckets(h) ((h)->n_buckets) + +/* More conenient interfaces */ + +/*! @function + @abstract Instantiate a hash set containing integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT(name) \ + KHASH_INIT(name, khint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT(name, khval_t) \ + KHASH_INIT(name, khint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT64(name) \ + KHASH_INIT(name, khint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT64(name, khval_t) \ + KHASH_INIT(name, khint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) + +typedef const char *kh_cstr_t; +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_STR(name) \ + KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_STR(name, khval_t) \ + KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) + +#endif /* __AC_KHASH_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/klist.h b/code/utilities/CPAT-1.2.2/lib/samtools/klist.h new file mode 100755 index 0000000..2f17016 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/klist.h @@ -0,0 +1,96 @@ +#ifndef _LH3_KLIST_H +#define _LH3_KLIST_H + +#include + +#define KMEMPOOL_INIT(name, kmptype_t, kmpfree_f) \ + typedef struct { \ + size_t cnt, n, max; \ + kmptype_t **buf; \ + } kmp_##name##_t; \ + static inline kmp_##name##_t *kmp_init_##name() { \ + return calloc(1, sizeof(kmp_##name##_t)); \ + } \ + static inline void kmp_destroy_##name(kmp_##name##_t *mp) { \ + size_t k; \ + for (k = 0; k < mp->n; ++k) { \ + kmpfree_f(mp->buf[k]); free(mp->buf[k]); \ + } \ + free(mp->buf); free(mp); \ + } \ + static inline kmptype_t *kmp_alloc_##name(kmp_##name##_t *mp) { \ + ++mp->cnt; \ + if (mp->n == 0) return calloc(1, sizeof(kmptype_t)); \ + return mp->buf[--mp->n]; \ + } \ + static inline void kmp_free_##name(kmp_##name##_t *mp, kmptype_t *p) { \ + --mp->cnt; \ + if (mp->n == mp->max) { \ + mp->max = mp->max? mp->max<<1 : 16; \ + mp->buf = realloc(mp->buf, sizeof(void*) * mp->max); \ + } \ + mp->buf[mp->n++] = p; \ + } + +#define kmempool_t(name) kmp_##name##_t +#define kmp_init(name) kmp_init_##name() +#define kmp_destroy(name, mp) kmp_destroy_##name(mp) +#define kmp_alloc(name, mp) kmp_alloc_##name(mp) +#define kmp_free(name, mp, p) kmp_free_##name(mp, p) + +#define KLIST_INIT(name, kltype_t, kmpfree_t) \ + struct __kl1_##name { \ + kltype_t data; \ + struct __kl1_##name *next; \ + }; \ + typedef struct __kl1_##name kl1_##name; \ + KMEMPOOL_INIT(name, kl1_##name, kmpfree_t) \ + typedef struct { \ + kl1_##name *head, *tail; \ + kmp_##name##_t *mp; \ + size_t size; \ + } kl_##name##_t; \ + static inline kl_##name##_t *kl_init_##name() { \ + kl_##name##_t *kl = calloc(1, sizeof(kl_##name##_t)); \ + kl->mp = kmp_init(name); \ + kl->head = kl->tail = kmp_alloc(name, kl->mp); \ + kl->head->next = 0; \ + return kl; \ + } \ + static inline void kl_destroy_##name(kl_##name##_t *kl) { \ + kl1_##name *p; \ + for (p = kl->head; p != kl->tail; p = p->next) \ + kmp_free(name, kl->mp, p); \ + kmp_free(name, kl->mp, p); \ + kmp_destroy(name, kl->mp); \ + free(kl); \ + } \ + static inline kltype_t *kl_pushp_##name(kl_##name##_t *kl) { \ + kl1_##name *q, *p = kmp_alloc(name, kl->mp); \ + q = kl->tail; p->next = 0; kl->tail->next = p; kl->tail = p; \ + ++kl->size; \ + return &q->data; \ + } \ + static inline int kl_shift_##name(kl_##name##_t *kl, kltype_t *d) { \ + kl1_##name *p; \ + if (kl->head->next == 0) return -1; \ + --kl->size; \ + p = kl->head; kl->head = kl->head->next; \ + if (d) *d = p->data; \ + kmp_free(name, kl->mp, p); \ + return 0; \ + } + +#define kliter_t(name) kl1_##name +#define klist_t(name) kl_##name##_t +#define kl_val(iter) ((iter)->data) +#define kl_next(iter) ((iter)->next) +#define kl_begin(kl) ((kl)->head) +#define kl_end(kl) ((kl)->tail) + +#define kl_init(name) kl_init_##name() +#define kl_destroy(name, kl) kl_destroy_##name(kl) +#define kl_pushp(name, kl) kl_pushp_##name(kl) +#define kl_shift(name, kl, d) kl_shift_##name(kl, d) + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.c.pysam.c new file mode 100755 index 0000000..25bbafe --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.c.pysam.c @@ -0,0 +1,634 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008 by Genome Research Ltd (GRL). + 2010 by Attractive Chaos + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Probably I will not do socket programming in the next few years and + therefore I decide to heavily annotate this file, for Linux and + Windows as well. -ac */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 +#include +#include +#include +#endif + +#include "knetfile.h" + +/* In winsock.h, the type of a socket is SOCKET, which is: "typedef + * u_int SOCKET". An invalid SOCKET is: "(SOCKET)(~0)", or signed + * integer -1. In knetfile.c, I use "int" for socket type + * throughout. This should be improved to avoid confusion. + * + * In Linux/Mac, recv() and read() do almost the same thing. You can see + * in the header file that netread() is simply an alias of read(). In + * Windows, however, they are different and using recv() is mandatory. + */ + +/* This function tests if the file handler is ready for reading (or + * writing if is_read==0). */ +static int socket_wait(int fd, int is_read) +{ + fd_set fds, *fdr = 0, *fdw = 0; + struct timeval tv; + int ret; + tv.tv_sec = 5; tv.tv_usec = 0; // 5 seconds time out + FD_ZERO(&fds); + FD_SET(fd, &fds); + if (is_read) fdr = &fds; + else fdw = &fds; + ret = select(fd+1, fdr, fdw, 0, &tv); +#ifndef _WIN32 + if (ret == -1) perror("select"); +#else + if (ret == 0) + fprintf(pysamerr, "select time-out\n"); + else if (ret == SOCKET_ERROR) + fprintf(pysamerr, "select: %d\n", WSAGetLastError()); +#endif + return ret; +} + +#ifndef _WIN32 +/* This function does not work with Windows due to the lack of + * getaddrinfo() in winsock. It is addapted from an example in "Beej's + * Guide to Network Programming" (http://beej.us/guide/bgnet/). */ +static int socket_connect(const char *host, const char *port) +{ +#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0) + + int on = 1, fd; + struct linger lng = { 0, 0 }; + struct addrinfo hints, *res = 0; + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + /* In Unix/Mac, getaddrinfo() is the most convenient way to get + * server information. */ + if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo"); + if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket"); + /* The following two setsockopt() are used by ftplib + * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they + * necessary. */ + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt"); + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt"); + if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect"); + freeaddrinfo(res); + return fd; +} +#else +/* MinGW's printf has problem with "%lld" */ +char *int64tostr(char *buf, int64_t x) +{ + int cnt; + int i = 0; + do { + buf[i++] = '0' + x % 10; + x /= 10; + } while (x); + buf[i] = 0; + for (cnt = i, i = 0; i < cnt/2; ++i) { + int c = buf[i]; buf[i] = buf[cnt-i-1]; buf[cnt-i-1] = c; + } + return buf; +} + +int64_t strtoint64(const char *buf) +{ + int64_t x; + for (x = 0; *buf != '\0'; ++buf) + x = x * 10 + ((int64_t) *buf - 48); + return x; +} +/* In windows, the first thing is to establish the TCP connection. */ +int knet_win32_init() +{ + WSADATA wsaData; + return WSAStartup(MAKEWORD(2, 2), &wsaData); +} +void knet_win32_destroy() +{ + WSACleanup(); +} +/* A slightly modfied version of the following function also works on + * Mac (and presummably Linux). However, this function is not stable on + * my Mac. It sometimes works fine but sometimes does not. Therefore for + * non-Windows OS, I do not use this one. */ +static SOCKET socket_connect(const char *host, const char *port) +{ +#define __err_connect(func) \ + do { \ + fprintf(pysamerr, "%s: %d\n", func, WSAGetLastError()); \ + return -1; \ + } while (0) + + int on = 1; + SOCKET fd; + struct linger lng = { 0, 0 }; + struct sockaddr_in server; + struct hostent *hp = 0; + // open socket + if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) __err_connect("socket"); + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on)) == -1) __err_connect("setsockopt"); + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&lng, sizeof(lng)) == -1) __err_connect("setsockopt"); + // get host info + if (isalpha(host[0])) hp = gethostbyname(host); + else { + struct in_addr addr; + addr.s_addr = inet_addr(host); + hp = gethostbyaddr((char*)&addr, 4, AF_INET); + } + if (hp == 0) __err_connect("gethost"); + // connect + server.sin_addr.s_addr = *((unsigned long*)hp->h_addr); + server.sin_family= AF_INET; + server.sin_port = htons(atoi(port)); + if (connect(fd, (struct sockaddr*)&server, sizeof(server)) != 0) __err_connect("connect"); + // freehostent(hp); // strangely in MSDN, hp is NOT freed (memory leak?!) + return fd; +} +#endif + +static off_t my_netread(int fd, void *buf, off_t len) +{ + off_t rest = len, curr, l = 0; + /* recv() and read() may not read the required length of data with + * one call. They have to be called repeatedly. */ + while (rest) { + if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading + curr = netread(fd, buf + l, rest); + /* According to the glibc manual, section 13.2, a zero returned + * value indicates end-of-file (EOF), which should mean that + * read() will not return zero if EOF has not been met but data + * are not immediately available. */ + if (curr == 0) break; + l += curr; rest -= curr; + } + return l; +} + +/************************* + * FTP specific routines * + *************************/ + +static int kftp_get_response(knetFile *ftp) +{ +#ifndef _WIN32 + unsigned char c; +#else + char c; +#endif + int n = 0; + char *p; + if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0; + while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O + //fputc(c, pysamerr); + if (n >= ftp->max_response) { + ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256; + ftp->response = realloc(ftp->response, ftp->max_response); + } + ftp->response[n++] = c; + if (c == '\n') { + if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2]) + && ftp->response[3] != '-') break; + n = 0; + continue; + } + } + if (n < 2) return -1; + ftp->response[n-2] = 0; + return strtol(ftp->response, &p, 0); +} + +static int kftp_send_cmd(knetFile *ftp, const char *cmd, int is_get) +{ + if (socket_wait(ftp->ctrl_fd, 0) <= 0) return -1; // socket is not ready for writing + netwrite(ftp->ctrl_fd, cmd, strlen(cmd)); + return is_get? kftp_get_response(ftp) : 0; +} + +static int kftp_pasv_prep(knetFile *ftp) +{ + char *p; + int v[6]; + kftp_send_cmd(ftp, "PASV\r\n", 1); + for (p = ftp->response; *p && *p != '('; ++p); + if (*p != '(') return -1; + ++p; + sscanf(p, "%d,%d,%d,%d,%d,%d", &v[0], &v[1], &v[2], &v[3], &v[4], &v[5]); + memcpy(ftp->pasv_ip, v, 4 * sizeof(int)); + ftp->pasv_port = (v[4]<<8&0xff00) + v[5]; + return 0; +} + + +static int kftp_pasv_connect(knetFile *ftp) +{ + char host[80], port[10]; + if (ftp->pasv_port == 0) { + fprintf(pysamerr, "[kftp_pasv_connect] kftp_pasv_prep() is not called before hand.\n"); + return -1; + } + sprintf(host, "%d.%d.%d.%d", ftp->pasv_ip[0], ftp->pasv_ip[1], ftp->pasv_ip[2], ftp->pasv_ip[3]); + sprintf(port, "%d", ftp->pasv_port); + ftp->fd = socket_connect(host, port); + if (ftp->fd == -1) return -1; + return 0; +} + +int kftp_connect(knetFile *ftp) +{ + ftp->ctrl_fd = socket_connect(ftp->host, ftp->port); + if (ftp->ctrl_fd == -1) return -1; + kftp_get_response(ftp); + kftp_send_cmd(ftp, "USER anonymous\r\n", 1); + kftp_send_cmd(ftp, "PASS kftp@\r\n", 1); + kftp_send_cmd(ftp, "TYPE I\r\n", 1); + return 0; +} + +int kftp_reconnect(knetFile *ftp) +{ + if (ftp->ctrl_fd != -1) { + netclose(ftp->ctrl_fd); + ftp->ctrl_fd = -1; + } + netclose(ftp->fd); + ftp->fd = -1; + return kftp_connect(ftp); +} + +// initialize ->type, ->host, ->retr and ->size +knetFile *kftp_parse_url(const char *fn, const char *mode) +{ + knetFile *fp; + char *p; + int l; + if (strstr(fn, "ftp://") != fn) return 0; + for (p = (char*)fn + 6; *p && *p != '/'; ++p); + if (*p != '/') return 0; + l = p - fn - 6; + fp = calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_FTP; + fp->fd = -1; + /* the Linux/Mac version of socket_connect() also recognizes a port + * like "ftp", but the Windows version does not. */ + fp->port = strdup("21"); + fp->host = calloc(l + 1, 1); + if (strchr(mode, 'c')) fp->no_reconnect = 1; + strncpy(fp->host, fn + 6, l); + fp->retr = calloc(strlen(p) + 8, 1); + sprintf(fp->retr, "RETR %s\r\n", p); + fp->size_cmd = calloc(strlen(p) + 8, 1); + sprintf(fp->size_cmd, "SIZE %s\r\n", p); + fp->seek_offset = 0; + return fp; +} +// place ->fd at offset off +int kftp_connect_file(knetFile *fp) +{ + int ret; + long long file_size; + if (fp->fd != -1) { + netclose(fp->fd); + if (fp->no_reconnect) kftp_get_response(fp); + } + kftp_pasv_prep(fp); + kftp_send_cmd(fp, fp->size_cmd, 1); +#ifndef _WIN32 + if ( sscanf(fp->response,"%*d %lld", &file_size) != 1 ) + { + fprintf(pysamerr,"[kftp_connect_file] %s\n", fp->response); + return -1; + } +#else + const char *p = fp->response; + while (*p != ' ') ++p; + while (*p < '0' || *p > '9') ++p; + file_size = strtoint64(p); +#endif + fp->file_size = file_size; + if (fp->offset>=0) { + char tmp[32]; +#ifndef _WIN32 + sprintf(tmp, "REST %lld\r\n", (long long)fp->offset); +#else + strcpy(tmp, "REST "); + int64tostr(tmp + 5, fp->offset); + strcat(tmp, "\r\n"); +#endif + kftp_send_cmd(fp, tmp, 1); + } + kftp_send_cmd(fp, fp->retr, 0); + kftp_pasv_connect(fp); + ret = kftp_get_response(fp); + if (ret != 150) { + fprintf(pysamerr, "[kftp_connect_file] %s\n", fp->response); + netclose(fp->fd); + fp->fd = -1; + return -1; + } + fp->is_ready = 1; + return 0; +} + + +/************************** + * HTTP specific routines * + **************************/ + +knetFile *khttp_parse_url(const char *fn, const char *mode) +{ + knetFile *fp; + char *p, *proxy, *q; + int l; + if (strstr(fn, "http://") != fn) return 0; + // set ->http_host + for (p = (char*)fn + 7; *p && *p != '/'; ++p); + l = p - fn - 7; + fp = calloc(1, sizeof(knetFile)); + fp->http_host = calloc(l + 1, 1); + strncpy(fp->http_host, fn + 7, l); + fp->http_host[l] = 0; + for (q = fp->http_host; *q && *q != ':'; ++q); + if (*q == ':') *q++ = 0; + // get http_proxy + proxy = getenv("http_proxy"); + // set ->host, ->port and ->path + if (proxy == 0) { + fp->host = strdup(fp->http_host); // when there is no proxy, server name is identical to http_host name. + fp->port = strdup(*q? q : "80"); + fp->path = strdup(*p? p : "/"); + } else { + fp->host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy); + for (q = fp->host; *q && *q != ':'; ++q); + if (*q == ':') *q++ = 0; + fp->port = strdup(*q? q : "80"); + fp->path = strdup(fn); + } + fp->type = KNF_TYPE_HTTP; + fp->ctrl_fd = fp->fd = -1; + fp->seek_offset = 0; + return fp; +} + +int khttp_connect_file(knetFile *fp) +{ + int ret, l = 0; + char *buf, *p; + if (fp->fd != -1) netclose(fp->fd); + fp->fd = socket_connect(fp->host, fp->port); + buf = calloc(0x10000, 1); // FIXME: I am lazy... But in principle, 64KB should be large enough. + l += sprintf(buf + l, "GET %s HTTP/1.0\r\nHost: %s\r\n", fp->path, fp->http_host); + l += sprintf(buf + l, "Range: bytes=%lld-\r\n", (long long)fp->offset); + l += sprintf(buf + l, "\r\n"); + netwrite(fp->fd, buf, l); + l = 0; + while (netread(fp->fd, buf + l, 1)) { // read HTTP header; FIXME: bad efficiency + if (buf[l] == '\n' && l >= 3) + if (strncmp(buf + l - 3, "\r\n\r\n", 4) == 0) break; + ++l; + } + buf[l] = 0; + if (l < 14) { // prematured header + netclose(fp->fd); + fp->fd = -1; + return -1; + } + ret = strtol(buf + 8, &p, 0); // HTTP return code + if (ret == 200 && fp->offset>0) { // 200 (complete result); then skip beginning of the file + off_t rest = fp->offset; + while (rest) { + off_t l = rest < 0x10000? rest : 0x10000; + rest -= my_netread(fp->fd, buf, l); + } + } else if (ret != 206 && ret != 200) { + free(buf); + fprintf(pysamerr, "[khttp_connect_file] fail to open file (HTTP code: %d).\n", ret); + netclose(fp->fd); + fp->fd = -1; + return -1; + } + free(buf); + fp->is_ready = 1; + return 0; +} + +/******************** + * Generic routines * + ********************/ + +knetFile *knet_open(const char *fn, const char *mode) +{ + knetFile *fp = 0; + if (mode[0] != 'r') { + fprintf(pysamerr, "[kftp_open] only mode \"r\" is supported.\n"); + return 0; + } + if (strstr(fn, "ftp://") == fn) { + fp = kftp_parse_url(fn, mode); + if (fp == 0) return 0; + if (kftp_connect(fp) == -1) { + knet_close(fp); + return 0; + } + kftp_connect_file(fp); + } else if (strstr(fn, "http://") == fn) { + fp = khttp_parse_url(fn, mode); + if (fp == 0) return 0; + khttp_connect_file(fp); + } else { // local file +#ifdef _WIN32 + /* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may + * be undefined on some systems, although it is defined on my + * Mac and the Linux I have tested on. */ + int fd = open(fn, O_RDONLY | O_BINARY); +#else + int fd = open(fn, O_RDONLY); +#endif + if (fd == -1) { + perror("open"); + return 0; + } + fp = (knetFile*)calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_LOCAL; + fp->fd = fd; + fp->ctrl_fd = -1; + } + if (fp && fp->fd == -1) { + knet_close(fp); + return 0; + } + return fp; +} + +knetFile *knet_dopen(int fd, const char *mode) +{ + knetFile *fp = (knetFile*)calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_LOCAL; + fp->fd = fd; + return fp; +} + +off_t knet_read(knetFile *fp, void *buf, off_t len) +{ + off_t l = 0; + if (fp->fd == -1) return 0; + if (fp->type == KNF_TYPE_FTP) { + if (fp->is_ready == 0) { + if (!fp->no_reconnect) kftp_reconnect(fp); + kftp_connect_file(fp); + } + } else if (fp->type == KNF_TYPE_HTTP) { + if (fp->is_ready == 0) + khttp_connect_file(fp); + } + if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX + off_t rest = len, curr; + while (rest) { + do { + curr = read(fp->fd, buf + l, rest); + } while (curr < 0 && EINTR == errno); + if (curr < 0) return -1; + if (curr == 0) break; + l += curr; rest -= curr; + } + } else l = my_netread(fp->fd, buf, len); + fp->offset += l; + return l; +} + +off_t knet_seek(knetFile *fp, int64_t off, int whence) +{ + if (whence == SEEK_SET && off == fp->offset) return 0; + if (fp->type == KNF_TYPE_LOCAL) { + /* Be aware that lseek() returns the offset after seeking, + * while fseek() returns zero on success. */ + off_t offset = lseek(fp->fd, off, whence); + if (offset == -1) { + // Be silent, it is OK for knet_seek to fail when the file is streamed + // fprintf(pysamerr,"[knet_seek] %s\n", strerror(errno)); + return -1; + } + fp->offset = offset; + return 0; + } + else if (fp->type == KNF_TYPE_FTP) + { + if (whence==SEEK_CUR) + fp->offset += off; + else if (whence==SEEK_SET) + fp->offset = off; + else if ( whence==SEEK_END) + fp->offset = fp->file_size+off; + fp->is_ready = 0; + return 0; + } + else if (fp->type == KNF_TYPE_HTTP) + { + if (whence == SEEK_END) { // FIXME: can we allow SEEK_END in future? + fprintf(pysamerr, "[knet_seek] SEEK_END is not supported for HTTP. Offset is unchanged.\n"); + errno = ESPIPE; + return -1; + } + if (whence==SEEK_CUR) + fp->offset += off; + else if (whence==SEEK_SET) + fp->offset = off; + fp->is_ready = 0; + return 0; + } + errno = EINVAL; + fprintf(pysamerr,"[knet_seek] %s\n", strerror(errno)); + return -1; +} + +int knet_close(knetFile *fp) +{ + if (fp == 0) return 0; + if (fp->ctrl_fd != -1) netclose(fp->ctrl_fd); // FTP specific + if (fp->fd != -1) { + /* On Linux/Mac, netclose() is an alias of close(), but on + * Windows, it is an alias of closesocket(). */ + if (fp->type == KNF_TYPE_LOCAL) close(fp->fd); + else netclose(fp->fd); + } + free(fp->host); free(fp->port); + free(fp->response); free(fp->retr); // FTP specific + free(fp->path); free(fp->http_host); // HTTP specific + free(fp); + return 0; +} + +#ifdef KNETFILE_MAIN +int main(void) +{ + char *buf; + knetFile *fp; + int type = 4, l; +#ifdef _WIN32 + knet_win32_init(); +#endif + buf = calloc(0x100000, 1); + if (type == 0) { + fp = knet_open("knetfile.c", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 1) { // NCBI FTP, large file + fp = knet_open("ftp://ftp.ncbi.nih.gov/1000genomes/ftp/data/NA12878/alignment/NA12878.chrom6.SLX.SRP000032.2009_06.bam", "r"); + knet_seek(fp, 2500000000ll, SEEK_SET); + l = knet_read(fp, buf, 255); + } else if (type == 2) { + fp = knet_open("ftp://ftp.sanger.ac.uk/pub4/treefam/tmp/index.shtml", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 3) { + fp = knet_open("http://www.sanger.ac.uk/Users/lh3/index.shtml", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 4) { + fp = knet_open("http://www.sanger.ac.uk/Users/lh3/ex1.bam", "r"); + knet_read(fp, buf, 10000); + knet_seek(fp, 20000, SEEK_SET); + knet_seek(fp, 10000, SEEK_SET); + l = knet_read(fp, buf+10000, 10000000) + 10000; + } + if (type != 4 && type != 1) { + knet_read(fp, buf, 255); + buf[255] = 0; + printf("%s\n", buf); + } else write(fileno(stdout), buf, l); + knet_close(fp); + free(buf); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.h b/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.h new file mode 100755 index 0000000..0a0e66f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/knetfile.h @@ -0,0 +1,75 @@ +#ifndef KNETFILE_H +#define KNETFILE_H + +#include +#include + +#ifndef _WIN32 +#define netread(fd, ptr, len) read(fd, ptr, len) +#define netwrite(fd, ptr, len) write(fd, ptr, len) +#define netclose(fd) close(fd) +#else +#include +#define netread(fd, ptr, len) recv(fd, ptr, len, 0) +#define netwrite(fd, ptr, len) send(fd, ptr, len, 0) +#define netclose(fd) closesocket(fd) +#endif + +// FIXME: currently I/O is unbuffered + +#define KNF_TYPE_LOCAL 1 +#define KNF_TYPE_FTP 2 +#define KNF_TYPE_HTTP 3 + +typedef struct knetFile_s { + int type, fd; + int64_t offset; + char *host, *port; + + // the following are for FTP only + int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect, is_ready; + char *response, *retr, *size_cmd; + int64_t seek_offset; // for lazy seek + int64_t file_size; + + // the following are for HTTP only + char *path, *http_host; +} knetFile; + +#define knet_tell(fp) ((fp)->offset) +#define knet_fileno(fp) ((fp)->fd) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + int knet_win32_init(); + void knet_win32_destroy(); +#endif + + knetFile *knet_open(const char *fn, const char *mode); + + /* + This only works with local files. + */ + knetFile *knet_dopen(int fd, const char *mode); + + /* + If ->is_ready==0, this routine updates ->fd; otherwise, it simply + reads from ->fd. + */ + off_t knet_read(knetFile *fp, void *buf, off_t len); + + /* + This routine only sets ->offset and ->is_ready=0. It does not + communicate with the FTP server. + */ + off_t knet_seek(knetFile *fp, int64_t off, int whence); + int knet_close(knetFile *fp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.c.pysam.c new file mode 100755 index 0000000..3404936 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.c.pysam.c @@ -0,0 +1,280 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2003-2006, 2008-2010, by Heng Li + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#include +#include +#include +#include +#include +#include "kprobaln.h" + +/***************************************** + * Probabilistic banded glocal alignment * + *****************************************/ + +#define EI .25 +#define EM .33333333333 + +static float g_qual2prob[256]; + +#define set_u(u, b, i, k) { int x=(i)-(b); x=x>0?x:0; (u)=((k)-x+1)*3; } + +kpa_par_t kpa_par_def = { 0.001, 0.1, 10 }; +kpa_par_t kpa_par_alt = { 0.0001, 0.01, 10 }; + +/* + The topology of the profile HMM: + + /\ /\ /\ /\ + I[1] I[k-1] I[k] I[L] + ^ \ \ ^ \ ^ \ \ ^ + | \ \ | \ | \ \ | + M[0] M[1] -> ... -> M[k-1] -> M[k] -> ... -> M[L] M[L+1] + \ \/ \/ \/ / + \ /\ /\ /\ / + -> D[k-1] -> D[k] -> + + M[0] points to every {M,I}[k] and every {M,I}[k] points M[L+1]. + + On input, _ref is the reference sequence and _query is the query + sequence. Both are sequences of 0/1/2/3/4 where 4 stands for an + ambiguous residue. iqual is the base quality. c sets the gap open + probability, gap extension probability and band width. + + On output, state and q are arrays of length l_query. The higher 30 + bits give the reference position the query base is matched to and the + lower two bits can be 0 (an alignment match) or 1 (an + insertion). q[i] gives the phred scaled posterior probability of + state[i] being wrong. + */ +int kpa_glocal(const uint8_t *_ref, int l_ref, const uint8_t *_query, int l_query, const uint8_t *iqual, + const kpa_par_t *c, int *state, uint8_t *q) +{ + double **f, **b = 0, *s, m[9], sI, sM, bI, bM, pb; + float *qual, *_qual; + const uint8_t *ref, *query; + int bw, bw2, i, k, is_diff = 0, is_backward = 1, Pr; + + /*** initialization ***/ + is_backward = state && q? 1 : 0; + ref = _ref - 1; query = _query - 1; // change to 1-based coordinate + bw = l_ref > l_query? l_ref : l_query; + if (bw > c->bw) bw = c->bw; + if (bw < abs(l_ref - l_query)) bw = abs(l_ref - l_query); + bw2 = bw * 2 + 1; + // allocate the forward and backward matrices f[][] and b[][] and the scaling array s[] + f = calloc(l_query+1, sizeof(void*)); + if (is_backward) b = calloc(l_query+1, sizeof(void*)); + for (i = 0; i <= l_query; ++i) { + f[i] = calloc(bw2 * 3 + 6, sizeof(double)); // FIXME: this is over-allocated for very short seqs + if (is_backward) b[i] = calloc(bw2 * 3 + 6, sizeof(double)); + } + s = calloc(l_query+2, sizeof(double)); // s[] is the scaling factor to avoid underflow + // initialize qual + _qual = calloc(l_query, sizeof(float)); + if (g_qual2prob[0] == 0) + for (i = 0; i < 256; ++i) + g_qual2prob[i] = pow(10, -i/10.); + for (i = 0; i < l_query; ++i) _qual[i] = g_qual2prob[iqual? iqual[i] : 30]; + qual = _qual - 1; + // initialize transition probability + sM = sI = 1. / (2 * l_query + 2); // the value here seems not to affect results; FIXME: need proof + m[0*3+0] = (1 - c->d - c->d) * (1 - sM); m[0*3+1] = m[0*3+2] = c->d * (1 - sM); + m[1*3+0] = (1 - c->e) * (1 - sI); m[1*3+1] = c->e * (1 - sI); m[1*3+2] = 0.; + m[2*3+0] = 1 - c->e; m[2*3+1] = 0.; m[2*3+2] = c->e; + bM = (1 - c->d) / l_ref; bI = c->d / l_ref; // (bM+bI)*l_ref==1 + /*** forward ***/ + // f[0] + set_u(k, bw, 0, 0); + f[0][k] = s[0] = 1.; + { // f[1] + double *fi = f[1], sum; + int beg = 1, end = l_ref < bw + 1? l_ref : bw + 1, _beg, _end; + for (k = beg, sum = 0.; k <= end; ++k) { + int u; + double e = (ref[k] > 3 || query[1] > 3)? 1. : ref[k] == query[1]? 1. - qual[1] : qual[1] * EM; + set_u(u, bw, 1, k); + fi[u+0] = e * bM; fi[u+1] = EI * bI; + sum += fi[u] + fi[u+1]; + } + // rescale + s[1] = sum; + set_u(_beg, bw, 1, beg); set_u(_end, bw, 1, end); _end += 2; + for (k = _beg; k <= _end; ++k) fi[k] /= sum; + } + // f[2..l_query] + for (i = 2; i <= l_query; ++i) { + double *fi = f[i], *fi1 = f[i-1], sum, qli = qual[i]; + int beg = 1, end = l_ref, x, _beg, _end; + uint8_t qyi = query[i]; + x = i - bw; beg = beg > x? beg : x; // band start + x = i + bw; end = end < x? end : x; // band end + for (k = beg, sum = 0.; k <= end; ++k) { + int u, v11, v01, v10; + double e; + e = (ref[k] > 3 || qyi > 3)? 1. : ref[k] == qyi? 1. - qli : qli * EM; + set_u(u, bw, i, k); set_u(v11, bw, i-1, k-1); set_u(v10, bw, i-1, k); set_u(v01, bw, i, k-1); + fi[u+0] = e * (m[0] * fi1[v11+0] + m[3] * fi1[v11+1] + m[6] * fi1[v11+2]); + fi[u+1] = EI * (m[1] * fi1[v10+0] + m[4] * fi1[v10+1]); + fi[u+2] = m[2] * fi[v01+0] + m[8] * fi[v01+2]; + sum += fi[u] + fi[u+1] + fi[u+2]; +// fprintf(pysamerr, "F (%d,%d;%d): %lg,%lg,%lg\n", i, k, u, fi[u], fi[u+1], fi[u+2]); // DEBUG + } + // rescale + s[i] = sum; + set_u(_beg, bw, i, beg); set_u(_end, bw, i, end); _end += 2; + for (k = _beg, sum = 1./sum; k <= _end; ++k) fi[k] *= sum; + } + { // f[l_query+1] + double sum; + for (k = 1, sum = 0.; k <= l_ref; ++k) { + int u; + set_u(u, bw, l_query, k); + if (u < 3 || u >= bw2*3+3) continue; + sum += f[l_query][u+0] * sM + f[l_query][u+1] * sI; + } + s[l_query+1] = sum; // the last scaling factor + } + { // compute likelihood + double p = 1., Pr1 = 0.; + for (i = 0; i <= l_query + 1; ++i) { + p *= s[i]; + if (p < 1e-100) Pr1 += -4.343 * log(p), p = 1.; + } + Pr1 += -4.343 * log(p * l_ref * l_query); + Pr = (int)(Pr1 + .499); + if (!is_backward) { // skip backward and MAP + for (i = 0; i <= l_query; ++i) free(f[i]); + free(f); free(s); free(_qual); + return Pr; + } + } + /*** backward ***/ + // b[l_query] (b[l_query+1][0]=1 and thus \tilde{b}[][]=1/s[l_query+1]; this is where s[l_query+1] comes from) + for (k = 1; k <= l_ref; ++k) { + int u; + double *bi = b[l_query]; + set_u(u, bw, l_query, k); + if (u < 3 || u >= bw2*3+3) continue; + bi[u+0] = sM / s[l_query] / s[l_query+1]; bi[u+1] = sI / s[l_query] / s[l_query+1]; + } + // b[l_query-1..1] + for (i = l_query - 1; i >= 1; --i) { + int beg = 1, end = l_ref, x, _beg, _end; + double *bi = b[i], *bi1 = b[i+1], y = (i > 1), qli1 = qual[i+1]; + uint8_t qyi1 = query[i+1]; + x = i - bw; beg = beg > x? beg : x; + x = i + bw; end = end < x? end : x; + for (k = end; k >= beg; --k) { + int u, v11, v01, v10; + double e; + set_u(u, bw, i, k); set_u(v11, bw, i+1, k+1); set_u(v10, bw, i+1, k); set_u(v01, bw, i, k+1); + e = (k >= l_ref? 0 : (ref[k+1] > 3 || qyi1 > 3)? 1. : ref[k+1] == qyi1? 1. - qli1 : qli1 * EM) * bi1[v11]; + bi[u+0] = e * m[0] + EI * m[1] * bi1[v10+1] + m[2] * bi[v01+2]; // bi1[v11] has been foled into e. + bi[u+1] = e * m[3] + EI * m[4] * bi1[v10+1]; + bi[u+2] = (e * m[6] + m[8] * bi[v01+2]) * y; +// fprintf(pysamerr, "B (%d,%d;%d): %lg,%lg,%lg\n", i, k, u, bi[u], bi[u+1], bi[u+2]); // DEBUG + } + // rescale + set_u(_beg, bw, i, beg); set_u(_end, bw, i, end); _end += 2; + for (k = _beg, y = 1./s[i]; k <= _end; ++k) bi[k] *= y; + } + { // b[0] + int beg = 1, end = l_ref < bw + 1? l_ref : bw + 1; + double sum = 0.; + for (k = end; k >= beg; --k) { + int u; + double e = (ref[k] > 3 || query[1] > 3)? 1. : ref[k] == query[1]? 1. - qual[1] : qual[1] * EM; + set_u(u, bw, 1, k); + if (u < 3 || u >= bw2*3+3) continue; + sum += e * b[1][u+0] * bM + EI * b[1][u+1] * bI; + } + set_u(k, bw, 0, 0); + pb = b[0][k] = sum / s[0]; // if everything works as is expected, pb == 1.0 + } + is_diff = fabs(pb - 1.) > 1e-7? 1 : 0; + /*** MAP ***/ + for (i = 1; i <= l_query; ++i) { + double sum = 0., *fi = f[i], *bi = b[i], max = 0.; + int beg = 1, end = l_ref, x, max_k = -1; + x = i - bw; beg = beg > x? beg : x; + x = i + bw; end = end < x? end : x; + for (k = beg; k <= end; ++k) { + int u; + double z; + set_u(u, bw, i, k); + z = fi[u+0] * bi[u+0]; if (z > max) max = z, max_k = (k-1)<<2 | 0; sum += z; + z = fi[u+1] * bi[u+1]; if (z > max) max = z, max_k = (k-1)<<2 | 1; sum += z; + } + max /= sum; sum *= s[i]; // if everything works as is expected, sum == 1.0 + if (state) state[i-1] = max_k; + if (q) k = (int)(-4.343 * log(1. - max) + .499), q[i-1] = k > 100? 99 : k; +#ifdef _MAIN + fprintf(pysamerr, "(%.10lg,%.10lg) (%d,%d:%c,%c:%d) %lg\n", pb, sum, i-1, max_k>>2, + "ACGT"[query[i]], "ACGT"[ref[(max_k>>2)+1]], max_k&3, max); // DEBUG +#endif + } + /*** free ***/ + for (i = 0; i <= l_query; ++i) { + free(f[i]); free(b[i]); + } + free(f); free(b); free(s); free(_qual); + return Pr; +} + +#ifdef _MAIN +#include +int main(int argc, char *argv[]) +{ + uint8_t conv[256], *iqual, *ref, *query; + int c, l_ref, l_query, i, q = 30, b = 10, P; + while ((c = getopt(argc, argv, "b:q:")) >= 0) { + switch (c) { + case 'b': b = atoi(optarg); break; + case 'q': q = atoi(optarg); break; + } + } + if (optind + 2 > argc) { + fprintf(pysamerr, "Usage: %s [-q %d] [-b %d] \n", argv[0], q, b); // example: acttc attc + return 1; + } + memset(conv, 4, 256); + conv['a'] = conv['A'] = 0; conv['c'] = conv['C'] = 1; + conv['g'] = conv['G'] = 2; conv['t'] = conv['T'] = 3; + ref = (uint8_t*)argv[optind]; query = (uint8_t*)argv[optind+1]; + l_ref = strlen((char*)ref); l_query = strlen((char*)query); + for (i = 0; i < l_ref; ++i) ref[i] = conv[ref[i]]; + for (i = 0; i < l_query; ++i) query[i] = conv[query[i]]; + iqual = malloc(l_query); + memset(iqual, q, l_query); + kpa_par_def.bw = b; + P = kpa_glocal(ref, l_ref, query, l_query, iqual, &kpa_par_alt, 0, 0); + fprintf(pysamerr, "%d\n", P); + free(iqual); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.h b/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.h new file mode 100755 index 0000000..0357dcc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kprobaln.h @@ -0,0 +1,49 @@ +/* The MIT License + + Copyright (c) 2003-2006, 2008, 2009 by Heng Li + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef LH3_KPROBALN_H_ +#define LH3_KPROBALN_H_ + +#include + +typedef struct { + float d, e; + int bw; +} kpa_par_t; + +#ifdef __cplusplus +extern "C" { +#endif + + int kpa_glocal(const uint8_t *_ref, int l_ref, const uint8_t *_query, int l_query, const uint8_t *iqual, + const kpa_par_t *c, int *state, uint8_t *q); + +#ifdef __cplusplus +} +#endif + +extern kpa_par_t kpa_par_def, kpa_par_alt; + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kseq.h b/code/utilities/CPAT-1.2.2/lib/samtools/kseq.h new file mode 100755 index 0000000..0bbc7dc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kseq.h @@ -0,0 +1,224 @@ +/* The MIT License + + Copyright (c) 2008, 2009, 2011 Attractive Chaos + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Last Modified: 18AUG2011 */ + +#ifndef AC_KSEQ_H +#define AC_KSEQ_H + +#include +#include +#include + +#define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r +#define KS_SEP_TAB 1 // isspace() && !' ' +#define KS_SEP_MAX 1 + +#define __KS_TYPE(type_t) \ + typedef struct __kstream_t { \ + unsigned char *buf; \ + int begin, end, is_eof; \ + type_t f; \ + } kstream_t; + +#define ks_eof(ks) ((ks)->is_eof && (ks)->begin >= (ks)->end) +#define ks_rewind(ks) ((ks)->is_eof = (ks)->begin = (ks)->end = 0) + +#define __KS_BASIC(type_t, __bufsize) \ + static inline kstream_t *ks_init(type_t f) \ + { \ + kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t)); \ + ks->f = f; \ + ks->buf = malloc(__bufsize); \ + return ks; \ + } \ + static inline void ks_destroy(kstream_t *ks) \ + { \ + if (ks) { \ + free(ks->buf); \ + free(ks); \ + } \ + } + +#define __KS_GETC(__read, __bufsize) \ + static inline int ks_getc(kstream_t *ks) \ + { \ + if (ks->is_eof && ks->begin >= ks->end) return -1; \ + if (ks->begin >= ks->end) { \ + ks->begin = 0; \ + ks->end = __read(ks->f, ks->buf, __bufsize); \ + if (ks->end < __bufsize) ks->is_eof = 1; \ + if (ks->end == 0) return -1; \ + } \ + return (int)ks->buf[ks->begin++]; \ + } + +#ifndef KSTRING_T +#define KSTRING_T kstring_t +typedef struct __kstring_t { + size_t l, m; + char *s; +} kstring_t; +#endif + +#ifndef kroundup32 +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +#define __KS_GETUNTIL(__read, __bufsize) \ + static int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \ + { \ + if (dret) *dret = 0; \ + str->l = append? str->l : 0; \ + if (ks->begin >= ks->end && ks->is_eof) return -1; \ + for (;;) { \ + int i; \ + if (ks->begin >= ks->end) { \ + if (!ks->is_eof) { \ + ks->begin = 0; \ + ks->end = __read(ks->f, ks->buf, __bufsize); \ + if (ks->end < __bufsize) ks->is_eof = 1; \ + if (ks->end == 0) break; \ + } else break; \ + } \ + if (delimiter > KS_SEP_MAX) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (ks->buf[i] == delimiter) break; \ + } else if (delimiter == KS_SEP_SPACE) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (isspace(ks->buf[i])) break; \ + } else if (delimiter == KS_SEP_TAB) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \ + } else i = 0; /* never come to here! */ \ + if (str->m - str->l < i - ks->begin + 1) { \ + str->m = str->l + (i - ks->begin) + 1; \ + kroundup32(str->m); \ + str->s = (char*)realloc(str->s, str->m); \ + } \ + memcpy(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \ + str->l = str->l + (i - ks->begin); \ + ks->begin = i + 1; \ + if (i < ks->end) { \ + if (dret) *dret = ks->buf[i]; \ + break; \ + } \ + } \ + if (str->s == 0) { \ + str->m = 1; \ + str->s = (char*)calloc(1, 1); \ + } \ + str->s[str->l] = '\0'; \ + return str->l; \ + } \ + static inline int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \ + { return ks_getuntil2(ks, delimiter, str, dret, 0); } + +#define KSTREAM_INIT(type_t, __read, __bufsize) \ + __KS_TYPE(type_t) \ + __KS_BASIC(type_t, __bufsize) \ + __KS_GETC(__read, __bufsize) \ + __KS_GETUNTIL(__read, __bufsize) + +#define __KSEQ_BASIC(type_t) \ + static inline kseq_t *kseq_init(type_t fd) \ + { \ + kseq_t *s = (kseq_t*)calloc(1, sizeof(kseq_t)); \ + s->f = ks_init(fd); \ + return s; \ + } \ + static inline void kseq_rewind(kseq_t *ks) \ + { \ + ks->last_char = 0; \ + ks->f->is_eof = ks->f->begin = ks->f->end = 0; \ + } \ + static inline void kseq_destroy(kseq_t *ks) \ + { \ + if (!ks) return; \ + free(ks->name.s); free(ks->comment.s); free(ks->seq.s); free(ks->qual.s); \ + ks_destroy(ks->f); \ + free(ks); \ + } + +/* Return value: + >=0 length of the sequence (normal) + -1 end-of-file + -2 truncated quality string + */ +#define __KSEQ_READ \ + static int kseq_read(kseq_t *seq) \ + { \ + int c; \ + kstream_t *ks = seq->f; \ + if (seq->last_char == 0) { /* then jump to the next header line */ \ + while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \ + if (c == -1) return -1; /* end of file */ \ + seq->last_char = c; \ + } /* else: the first header char has been read in the previous call */ \ + seq->comment.l = seq->seq.l = seq->qual.l = 0; /* reset all members */ \ + if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; /* normal exit: EOF */ \ + if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0); /* read FASTA/Q comment */ \ + if (seq->seq.s == 0) { /* we can do this in the loop below, but that is slower */ \ + seq->seq.m = 256; \ + seq->seq.s = (char*)malloc(seq->seq.m); \ + } \ + while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \ + seq->seq.s[seq->seq.l++] = c; /* this is safe: we always have enough space for 1 char */ \ + ks_getuntil2(ks, '\n', &seq->seq, 0, 1); /* read the rest of the line */ \ + } \ + if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */ \ + if (seq->seq.l + 1 >= seq->seq.m) { /* seq->seq.s[seq->seq.l] below may be out of boundary */ \ + seq->seq.m = seq->seq.l + 2; \ + kroundup32(seq->seq.m); /* rounded to the next closest 2^k */ \ + seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \ + } \ + seq->seq.s[seq->seq.l] = 0; /* null terminated string */ \ + if (c != '+') return seq->seq.l; /* FASTA */ \ + if (seq->qual.m < seq->seq.m) { /* allocate memory for qual in case insufficient */ \ + seq->qual.m = seq->seq.m; \ + seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \ + } \ + while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \ + if (c == -1) return -2; /* error: no quality string */ \ + while (ks_getuntil2(ks, '\n', &seq->qual, 0, 1) >= 0 && seq->qual.l < seq->seq.l); \ + seq->last_char = 0; /* we have not come to the next header line */ \ + if (seq->seq.l != seq->qual.l) return -2; /* error: qual string is of a different length */ \ + return seq->seq.l; \ + } + +#define __KSEQ_TYPE(type_t) \ + typedef struct { \ + kstring_t name, comment, seq, qual; \ + int last_char; \ + kstream_t *f; \ + } kseq_t; + +#define KSEQ_INIT(type_t, __read) \ + KSTREAM_INIT(type_t, __read, 16384) \ + __KSEQ_TYPE(type_t) \ + __KSEQ_BASIC(type_t) \ + __KSEQ_READ + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/ksort.h b/code/utilities/CPAT-1.2.2/lib/samtools/ksort.h new file mode 100755 index 0000000..fa850ab --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/ksort.h @@ -0,0 +1,281 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* + 2008-11-16 (0.1.4): + + * Fixed a bug in introsort() that happens in rare cases. + + 2008-11-05 (0.1.3): + + * Fixed a bug in introsort() for complex comparisons. + + * Fixed a bug in mergesort(). The previous version is not stable. + + 2008-09-15 (0.1.2): + + * Accelerated introsort. On my Mac (not on another Linux machine), + my implementation is as fast as std::sort on random input. + + * Added combsort and in introsort, switch to combsort if the + recursion is too deep. + + 2008-09-13 (0.1.1): + + * Added k-small algorithm + + 2008-09-05 (0.1.0): + + * Initial version + +*/ + +#ifndef AC_KSORT_H +#define AC_KSORT_H + +#include +#include + +typedef struct { + void *left, *right; + int depth; +} ks_isort_stack_t; + +#define KSORT_SWAP(type_t, a, b) { register type_t t=(a); (a)=(b); (b)=t; } + +#define KSORT_INIT(name, type_t, __sort_lt) \ + void ks_mergesort_##name(size_t n, type_t array[], type_t temp[]) \ + { \ + type_t *a2[2], *a, *b; \ + int curr, shift; \ + \ + a2[0] = array; \ + a2[1] = temp? temp : (type_t*)malloc(sizeof(type_t) * n); \ + for (curr = 0, shift = 0; (1ul<> 1) - 1; i != (size_t)(-1); --i) \ + ks_heapadjust_##name(i, lsize, l); \ + } \ + void ks_heapsort_##name(size_t lsize, type_t l[]) \ + { \ + size_t i; \ + for (i = lsize - 1; i > 0; --i) { \ + type_t tmp; \ + tmp = *l; *l = l[i]; l[i] = tmp; ks_heapadjust_##name(0, i, l); \ + } \ + } \ + inline void __ks_insertsort_##name(type_t *s, type_t *t) \ + { \ + type_t *i, *j, swap_tmp; \ + for (i = s + 1; i < t; ++i) \ + for (j = i; j > s && __sort_lt(*j, *(j-1)); --j) { \ + swap_tmp = *j; *j = *(j-1); *(j-1) = swap_tmp; \ + } \ + } \ + void ks_combsort_##name(size_t n, type_t a[]) \ + { \ + const double shrink_factor = 1.2473309501039786540366528676643; \ + int do_swap; \ + size_t gap = n; \ + type_t tmp, *i, *j; \ + do { \ + if (gap > 2) { \ + gap = (size_t)(gap / shrink_factor); \ + if (gap == 9 || gap == 10) gap = 11; \ + } \ + do_swap = 0; \ + for (i = a; i < a + n - gap; ++i) { \ + j = i + gap; \ + if (__sort_lt(*j, *i)) { \ + tmp = *i; *i = *j; *j = tmp; \ + do_swap = 1; \ + } \ + } \ + } while (do_swap || gap > 2); \ + if (gap != 1) __ks_insertsort_##name(a, a + n); \ + } \ + void ks_introsort_##name(size_t n, type_t a[]) \ + { \ + int d; \ + ks_isort_stack_t *top, *stack; \ + type_t rp, swap_tmp; \ + type_t *s, *t, *i, *j, *k; \ + \ + if (n < 1) return; \ + else if (n == 2) { \ + if (__sort_lt(a[1], a[0])) { swap_tmp = a[0]; a[0] = a[1]; a[1] = swap_tmp; } \ + return; \ + } \ + for (d = 2; 1ul<>1) + 1; \ + if (__sort_lt(*k, *i)) { \ + if (__sort_lt(*k, *j)) k = j; \ + } else k = __sort_lt(*j, *i)? i : j; \ + rp = *k; \ + if (k != t) { swap_tmp = *k; *k = *t; *t = swap_tmp; } \ + for (;;) { \ + do ++i; while (__sort_lt(*i, rp)); \ + do --j; while (i <= j && __sort_lt(rp, *j)); \ + if (j <= i) break; \ + swap_tmp = *i; *i = *j; *j = swap_tmp; \ + } \ + swap_tmp = *i; *i = *t; *t = swap_tmp; \ + if (i-s > t-i) { \ + if (i-s > 16) { top->left = s; top->right = i-1; top->depth = d; ++top; } \ + s = t-i > 16? i+1 : t; \ + } else { \ + if (t-i > 16) { top->left = i+1; top->right = t; top->depth = d; ++top; } \ + t = i-s > 16? i-1 : s; \ + } \ + } else { \ + if (top == stack) { \ + free(stack); \ + __ks_insertsort_##name(a, a+n); \ + return; \ + } else { --top; s = (type_t*)top->left; t = (type_t*)top->right; d = top->depth; } \ + } \ + } \ + } \ + /* This function is adapted from: http://ndevilla.free.fr/median/ */ \ + /* 0 <= kk < n */ \ + type_t ks_ksmall_##name(size_t n, type_t arr[], size_t kk) \ + { \ + type_t *low, *high, *k, *ll, *hh, *mid; \ + low = arr; high = arr + n - 1; k = arr + kk; \ + for (;;) { \ + if (high <= low) return *k; \ + if (high == low + 1) { \ + if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \ + return *k; \ + } \ + mid = low + (high - low) / 2; \ + if (__sort_lt(*high, *mid)) KSORT_SWAP(type_t, *mid, *high); \ + if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \ + if (__sort_lt(*low, *mid)) KSORT_SWAP(type_t, *mid, *low); \ + KSORT_SWAP(type_t, *mid, *(low+1)); \ + ll = low + 1; hh = high; \ + for (;;) { \ + do ++ll; while (__sort_lt(*ll, *low)); \ + do --hh; while (__sort_lt(*low, *hh)); \ + if (hh < ll) break; \ + KSORT_SWAP(type_t, *ll, *hh); \ + } \ + KSORT_SWAP(type_t, *low, *hh); \ + if (hh <= k) low = ll; \ + if (hh >= k) high = hh - 1; \ + } \ + } \ + void ks_shuffle_##name(size_t n, type_t a[]) \ + { \ + int i, j; \ + for (i = n; i > 1; --i) { \ + type_t tmp; \ + j = (int)(drand48() * i); \ + tmp = a[j]; a[j] = a[i-1]; a[i-1] = tmp; \ + } \ + } + +#define ks_mergesort(name, n, a, t) ks_mergesort_##name(n, a, t) +#define ks_introsort(name, n, a) ks_introsort_##name(n, a) +#define ks_combsort(name, n, a) ks_combsort_##name(n, a) +#define ks_heapsort(name, n, a) ks_heapsort_##name(n, a) +#define ks_heapmake(name, n, a) ks_heapmake_##name(n, a) +#define ks_heapadjust(name, i, n, a) ks_heapadjust_##name(i, n, a) +#define ks_ksmall(name, n, a, k) ks_ksmall_##name(n, a, k) +#define ks_shuffle(name, n, a) ks_shuffle_##name(n, a) + +#define ks_lt_generic(a, b) ((a) < (b)) +#define ks_lt_str(a, b) (strcmp((a), (b)) < 0) + +typedef const char *ksstr_t; + +#define KSORT_INIT_GENERIC(type_t) KSORT_INIT(type_t, type_t, ks_lt_generic) +#define KSORT_INIT_STR KSORT_INIT(str, ksstr_t, ks_lt_str) + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kstring.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/kstring.c.pysam.c new file mode 100755 index 0000000..c02bce0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kstring.c.pysam.c @@ -0,0 +1,214 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "kstring.h" + +int ksprintf(kstring_t *s, const char *fmt, ...) +{ + va_list ap; + int l; + va_start(ap, fmt); + l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snprintf'. + va_end(ap); + if (l + 1 > s->m - s->l) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + va_start(ap, fmt); + l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); + } + va_end(ap); + s->l += l; + return l; +} + +char *kstrtok(const char *str, const char *sep, ks_tokaux_t *aux) +{ + const char *p, *start; + if (sep) { // set up the table + if (str == 0 && (aux->tab[0]&1)) return 0; // no need to set up if we have finished + aux->finished = 0; + if (sep[1]) { + aux->sep = -1; + aux->tab[0] = aux->tab[1] = aux->tab[2] = aux->tab[3] = 0; + for (p = sep; *p; ++p) aux->tab[*p>>6] |= 1ull<<(*p&0x3f); + } else aux->sep = sep[0]; + } + if (aux->finished) return 0; + else if (str) aux->p = str - 1, aux->finished = 0; + if (aux->sep < 0) { + for (p = start = aux->p + 1; *p; ++p) + if (aux->tab[*p>>6]>>(*p&0x3f)&1) break; + } else { + for (p = start = aux->p + 1; *p; ++p) + if (*p == aux->sep) break; + } + aux->p = p; // end of token + if (*p == 0) aux->finished = 1; // no more tokens + return (char*)start; +} + +// s MUST BE a null terminated string; l = strlen(s) +int ksplit_core(char *s, int delimiter, int *_max, int **_offsets) +{ + int i, n, max, last_char, last_start, *offsets, l; + n = 0; max = *_max; offsets = *_offsets; + l = strlen(s); + +#define __ksplit_aux do { \ + if (_offsets) { \ + s[i] = 0; \ + if (n == max) { \ + max = max? max<<1 : 2; \ + offsets = (int*)realloc(offsets, sizeof(int) * max); \ + } \ + offsets[n++] = last_start; \ + } else ++n; \ + } while (0) + + for (i = 0, last_char = last_start = 0; i <= l; ++i) { + if (delimiter == 0) { + if (isspace(s[i]) || s[i] == 0) { + if (isgraph(last_char)) __ksplit_aux; // the end of a field + } else { + if (isspace(last_char) || last_char == 0) last_start = i; + } + } else { + if (s[i] == delimiter || s[i] == 0) { + if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field + } else { + if (last_char == delimiter || last_char == 0) last_start = i; + } + } + last_char = s[i]; + } + *_max = max; *_offsets = offsets; + return n; +} + +/********************** + * Boyer-Moore search * + **********************/ + +typedef unsigned char ubyte_t; + +// reference: http://www-igm.univ-mlv.fr/~lecroq/string/node14.html +static int *ksBM_prep(const ubyte_t *pat, int m) +{ + int i, *suff, *prep, *bmGs, *bmBc; + prep = calloc(m + 256, sizeof(int)); + bmGs = prep; bmBc = prep + m; + { // preBmBc() + for (i = 0; i < 256; ++i) bmBc[i] = m; + for (i = 0; i < m - 1; ++i) bmBc[pat[i]] = m - i - 1; + } + suff = calloc(m, sizeof(int)); + { // suffixes() + int f = 0, g; + suff[m - 1] = m; + g = m - 1; + for (i = m - 2; i >= 0; --i) { + if (i > g && suff[i + m - 1 - f] < i - g) + suff[i] = suff[i + m - 1 - f]; + else { + if (i < g) g = i; + f = i; + while (g >= 0 && pat[g] == pat[g + m - 1 - f]) --g; + suff[i] = f - g; + } + } + } + { // preBmGs() + int j = 0; + for (i = 0; i < m; ++i) bmGs[i] = m; + for (i = m - 1; i >= 0; --i) + if (suff[i] == i + 1) + for (; j < m - 1 - i; ++j) + if (bmGs[j] == m) + bmGs[j] = m - 1 - i; + for (i = 0; i <= m - 2; ++i) + bmGs[m - 1 - suff[i]] = m - 1 - i; + } + free(suff); + return prep; +} + +void *kmemmem(const void *_str, int n, const void *_pat, int m, int **_prep) +{ + int i, j, *prep = 0, *bmGs, *bmBc; + const ubyte_t *str, *pat; + str = (const ubyte_t*)_str; pat = (const ubyte_t*)_pat; + prep = (_prep == 0 || *_prep == 0)? ksBM_prep(pat, m) : *_prep; + if (_prep && *_prep == 0) *_prep = prep; + bmGs = prep; bmBc = prep + m; + j = 0; + while (j <= n - m) { + for (i = m - 1; i >= 0 && pat[i] == str[i+j]; --i); + if (i >= 0) { + int max = bmBc[str[i+j]] - m + 1 + i; + if (max < bmGs[i]) max = bmGs[i]; + j += max; + } else return (void*)(str + j); + } + if (_prep == 0) free(prep); + return 0; +} + +char *kstrstr(const char *str, const char *pat, int **_prep) +{ + return (char*)kmemmem(str, strlen(str), pat, strlen(pat), _prep); +} + +char *kstrnstr(const char *str, const char *pat, int n, int **_prep) +{ + return (char*)kmemmem(str, n, pat, strlen(pat), _prep); +} + +/*********************** + * The main() function * + ***********************/ + +#ifdef KSTRING_MAIN +#include +int main() +{ + kstring_t *s; + int *fields, n, i; + ks_tokaux_t aux; + char *p; + s = (kstring_t*)calloc(1, sizeof(kstring_t)); + // test ksprintf() + ksprintf(s, " abcdefg: %d ", 100); + printf("'%s'\n", s->s); + // test ksplit() + fields = ksplit(s, 0, &n); + for (i = 0; i < n; ++i) + printf("field[%d] = '%s'\n", i, s->s + fields[i]); + // test kstrtok() + s->l = 0; + for (p = kstrtok("ab:cde:fg/hij::k", ":/", &aux); p; p = kstrtok(0, 0, &aux)) { + kputsn(p, aux.p - p, s); + kputc('\n', s); + } + printf("%s", s->s); + // free + free(s->s); free(s); free(fields); + + { + static char *str = "abcdefgcdgcagtcakcdcd"; + static char *pat = "cd"; + char *ret, *s = str; + int *prep = 0; + while ((ret = kstrstr(s, pat, &prep)) != 0) { + printf("match: %s\n", ret); + s = ret + prep[0]; + } + free(prep); + } + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/kstring.h b/code/utilities/CPAT-1.2.2/lib/samtools/kstring.h new file mode 100755 index 0000000..ec5775b --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/kstring.h @@ -0,0 +1,117 @@ +#ifndef KSTRING_H +#define KSTRING_H + +#include +#include +#include + +#ifndef kroundup32 +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +#ifndef KSTRING_T +#define KSTRING_T kstring_t +typedef struct __kstring_t { + size_t l, m; + char *s; +} kstring_t; +#endif + +typedef struct { + uint64_t tab[4]; + int sep, finished; + const char *p; // end of the current token +} ks_tokaux_t; + +#ifdef __cplusplus +extern "C" { +#endif + + int ksprintf(kstring_t *s, const char *fmt, ...); + int ksplit_core(char *s, int delimiter, int *_max, int **_offsets); + char *kstrstr(const char *str, const char *pat, int **_prep); + char *kstrnstr(const char *str, const char *pat, int n, int **_prep); + void *kmemmem(const void *_str, int n, const void *_pat, int m, int **_prep); + + /* kstrtok() is similar to strtok_r() except that str is not + * modified and both str and sep can be NULL. For efficiency, it is + * actually recommended to set both to NULL in the subsequent calls + * if sep is not changed. */ + char *kstrtok(const char *str, const char *sep, ks_tokaux_t *aux); + +#ifdef __cplusplus +} +#endif + +static inline int kputsn(const char *p, int l, kstring_t *s) +{ + if (s->l + l + 1 >= s->m) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + memcpy(s->s + s->l, p, l); + s->l += l; + s->s[s->l] = 0; + return l; +} + +static inline int kputs(const char *p, kstring_t *s) +{ + return kputsn(p, strlen(p), s); +} + +static inline int kputc(int c, kstring_t *s) +{ + if (s->l + 1 >= s->m) { + s->m = s->l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + s->s[s->l++] = c; + s->s[s->l] = 0; + return c; +} + +static inline int kputw(int c, kstring_t *s) +{ + char buf[16]; + int l, x; + if (c == 0) return kputc('0', s); + for (l = 0, x = c < 0? -c : c; x > 0; x /= 10) buf[l++] = x%10 + '0'; + if (c < 0) buf[l++] = '-'; + if (s->l + l + 1 >= s->m) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + for (x = l - 1; x >= 0; --x) s->s[s->l++] = buf[x]; + s->s[s->l] = 0; + return 0; +} + +static inline int kputuw(unsigned c, kstring_t *s) +{ + char buf[16]; + int l, i; + unsigned x; + if (c == 0) return kputc('0', s); + for (l = 0, x = c; x > 0; x /= 10) buf[l++] = x%10 + '0'; + if (s->l + l + 1 >= s->m) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i]; + s->s[s->l] = 0; + return 0; +} + +static inline int *ksplit(kstring_t *s, int delimiter, int *n) +{ + int max = 0, *offsets = 0; + *n = ksplit_core(s->s, delimiter, &max, &offsets); + return offsets; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.c.pysam.c new file mode 100755 index 0000000..7710844 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.c.pysam.c @@ -0,0 +1,298 @@ +#include "pysam.h" + +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +/* Brutally hacked by John Walker back from ANSI C to K&R (no + prototypes) to maintain the tradition that Netfone will compile + with Sun's original "cc". */ + +#include +#include "md5.h" + +#ifndef HIGHFIRST +#define byteReverse(buf, len) /* Nothing */ +#else +/* + * Note: this code is harmless on little-endian machines. + */ +void byteReverse(buf, longs) + unsigned char *buf; unsigned longs; +{ + uint32_t t; + do { + t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | + ((unsigned) buf[1] << 8 | buf[0]); + *(uint32_t *) buf = t; + buf += 4; + } while (--longs); +} +#endif + +void MD5Transform(uint32_t buf[4], uint32_t in[16]); + + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(ctx) + struct MD5Context *ctx; +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(ctx, buf, len) + struct MD5Context *ctx; unsigned char *buf; unsigned len; +{ + uint32_t t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if (t) { + unsigned char *p = (unsigned char *) ctx->in + t; + + t = 64 - t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Final(digest, ctx) + unsigned char digest[16]; struct MD5Context *ctx; +{ + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); + + /* Append length in bits and transform */ + ((uint32_t *) ctx->in)[14] = ctx->bits[0]; + ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + + MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void MD5Transform(buf, in) + uint32_t buf[4]; uint32_t in[16]; +{ + register uint32_t a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +/* lh3: the following code is added by me */ + +#ifdef MD5SUM_MAIN +#include +#include +#include +#define HEX_STR "0123456789abcdef" + +static void md5_one(const char *fn) +{ + unsigned char buf[4096], digest[16]; + MD5_CTX md5; + int l; + FILE *fp; + + fp = strcmp(fn, "-")? fopen(fn, "r") : stdin; + if (fp == 0) { + fprintf(pysamerr, "md5sum: %s: No such file or directory\n", fn); + exit(1); + } + MD5Init(&md5); + while ((l = fread(buf, 1, 4096, fp)) > 0) + MD5Update(&md5, buf, l); + MD5Final(digest, &md5); + if (fp != stdin) fclose(fp); + for (l = 0; l < 16; ++l) + printf("%c%c", HEX_STR[digest[l]>>4&0xf], HEX_STR[digest[l]&0xf]); + printf(" %s\n", fn); +} +int main(int argc, char *argv[]) +{ + int i; + if (argc == 1) md5_one("-"); + else for (i = 1; i < argc; ++i) md5_one(argv[i]); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.h b/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.h new file mode 100755 index 0000000..44121e4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/misc/md5.h @@ -0,0 +1,57 @@ +/* + This file is adapted from a program in this page: + + http://www.fourmilab.ch/md5/ + + The original source code does not work on 64-bit machines due to the + wrong typedef "uint32". I also added prototypes. + + -lh3 + */ + +#ifndef MD5_H +#define MD5_H + +/* The following tests optimise behaviour on little-endian + machines, where there is no need to reverse the byte order + of 32 bit words in the MD5 computation. By default, + HIGHFIRST is defined, which indicates we're running on a + big-endian (most significant byte first) machine, on which + the byteReverse function in md5.c must be invoked. However, + byteReverse is coded in such a way that it is an identity + function when run on a little-endian machine, so calling it + on such a platform causes no harm apart from wasting time. + If the platform is known to be little-endian, we speed + things up by undefining HIGHFIRST, which defines + byteReverse as a null macro. Doing things in this manner + insures we work on new platforms regardless of their byte + order. */ + +#define HIGHFIRST + +#if __LITTLE_ENDIAN__ != 0 +#undef HIGHFIRST +#endif + +#include + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + unsigned char in[64]; +}; + +void MD5Init(struct MD5Context *ctx); +void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *ctx); + +/* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +typedef struct MD5Context MD5_CTX; + +/* Define CHECK_HARDWARE_PROPERTIES to have main,c verify + byte order and uint32_t settings. */ +#define CHECK_HARDWARE_PROPERTIES + +#endif /* !MD5_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/misc/seqtk.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/misc/seqtk.c.pysam.c new file mode 100755 index 0000000..46b3c56 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/misc/seqtk.c.pysam.c @@ -0,0 +1,785 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kseq.h" +KSEQ_INIT(gzFile, gzread) + +typedef struct { + int n, m; + uint64_t *a; +} reglist_t; + +#include "khash.h" +KHASH_MAP_INIT_STR(reg, reglist_t) + +typedef kh_reg_t reghash_t; + +reghash_t *stk_reg_read(const char *fn) +{ + reghash_t *h = kh_init(reg); + gzFile fp; + kstream_t *ks; + int dret; + kstring_t *str; + // read the list + str = calloc(1, sizeof(kstring_t)); + fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, str, &dret) >= 0) { + int beg = -1, end = -1; + reglist_t *p; + khint_t k = kh_get(reg, h, str->s); + if (k == kh_end(h)) { + int ret; + char *s = strdup(str->s); + k = kh_put(reg, h, s, &ret); + memset(&kh_val(h, k), 0, sizeof(reglist_t)); + } + p = &kh_val(h, k); + if (dret != '\n') { + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { + beg = atoi(str->s); + if (dret != '\n') { + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { + end = atoi(str->s); + if (end < 0) end = -1; + } + } + } + } + // skip the rest of the line + if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); + if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column + if (beg < 0) beg = 0, end = INT_MAX; + if (p->n == p->m) { + p->m = p->m? p->m<<1 : 4; + p->a = realloc(p->a, p->m * 8); + } + p->a[p->n++] = (uint64_t)beg<<32 | end; + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + return h; +} + +void stk_reg_destroy(reghash_t *h) +{ + khint_t k; + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + free(kh_val(h, k).a); + free((char*)kh_key(h, k)); + } + } + kh_destroy(reg, h); +} + +/* constant table */ + +unsigned char seq_nt16_table[256] = { + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15 /*'-'*/,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15, + 15,15, 5, 6, 8,15, 7, 9, 0,10,15,15, 15,15,15,15, + 15, 1,14, 2, 13,15,15, 4, 11,15,15,12, 15, 3,15,15, + 15,15, 5, 6, 8,15, 7, 9, 0,10,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15 +}; + +char *seq_nt16_rev_table = "XACMGRSVTWYHKDBN"; +unsigned char seq_nt16to4_table[] = { 4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4 }; +int bitcnt_table[] = { 4, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; + +/* composition */ +int stk_comp(int argc, char *argv[]) +{ + gzFile fp; + kseq_t *seq; + int l, c, upper_only = 0; + reghash_t *h = 0; + reglist_t dummy; + while ((c = getopt(argc, argv, "ur:")) >= 0) { + switch (c) { + case 'u': upper_only = 1; break; + case 'r': h = stk_reg_read(optarg); break; + } + } + if (argc == optind) { + fprintf(pysamerr, "Usage: seqtk comp [-u] [-r in.bed] \n\n"); + fprintf(pysamerr, "Output format: chr, length, #A, #C, #G, #T, #2, #3, #4, #CpG, #tv, #ts, #CpG-ts\n"); + return 1; + } + fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r"); + seq = kseq_init(fp); + dummy.n= dummy.m = 1; dummy.a = calloc(1, 8); + while ((l = kseq_read(seq)) >= 0) { + int i, k; + reglist_t *p = 0; + if (h) { + khint_t k = kh_get(reg, h, seq->name.s); + if (k != kh_end(h)) p = &kh_val(h, k); + } else { + p = &dummy; + dummy.a[0] = l; + } + for (k = 0; p && k < p->n; ++k) { + int beg = p->a[k]>>32, end = p->a[k]&0xffffffff; + int la, lb, lc, na, nb, nc, cnt[11]; + if (beg > 0) la = seq->seq.s[beg-1], lb = seq_nt16_table[la], lc = bitcnt_table[lb]; + else la = 'a', lb = -1, lc = 0; + na = seq->seq.s[beg]; nb = seq_nt16_table[na]; nc = bitcnt_table[nb]; + memset(cnt, 0, 11 * sizeof(int)); + for (i = beg; i < end; ++i) { + int is_CpG = 0, a, b, c; + a = na; b = nb; c = nc; + na = seq->seq.s[i+1]; nb = seq_nt16_table[na]; nc = bitcnt_table[nb]; + if (b == 2 || b == 10) { // C or Y + if (nb == 4 || nb == 5) is_CpG = 1; + } else if (b == 4 || b == 5) { // G or R + if (lb == 2 || lb == 10) is_CpG = 1; + } + if (upper_only == 0 || isupper(a)) { + if (c > 1) ++cnt[c+2]; + if (c == 1) ++cnt[seq_nt16to4_table[b]]; + if (b == 10 || b == 5) ++cnt[9]; + else if (c == 2) { + ++cnt[8]; + } + if (is_CpG) { + ++cnt[7]; + if (b == 10 || b == 5) ++cnt[10]; + } + } + la = a; lb = b; lc = c; + } + if (h) printf("%s\t%d\t%d", seq->name.s, beg, end); + else printf("%s\t%d", seq->name.s, l); + for (i = 0; i < 11; ++i) printf("\t%d", cnt[i]); + putchar('\n'); + } + fflush(stdout); + } + free(dummy.a); + kseq_destroy(seq); + gzclose(fp); + return 0; +} + +int stk_randbase(int argc, char *argv[]) +{ + gzFile fp; + kseq_t *seq; + int l; + if (argc == 1) { + fprintf(pysamerr, "Usage: seqtk randbase \n"); + return 1; + } + fp = (strcmp(argv[1], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[1], "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + int i; + printf(">%s", seq->name.s); + for (i = 0; i < l; ++i) { + int c, b, a, j, k, m; + b = seq->seq.s[i]; + c = seq_nt16_table[b]; + a = bitcnt_table[c]; + if (a == 2) { + m = (drand48() < 0.5); + for (j = k = 0; j < 4; ++j) { + if ((1<seq.s[i] = islower(b)? "acgt"[j] : "ACGT"[j]; + } + if (i%60 == 0) putchar('\n'); + putchar(seq->seq.s[i]); + } + putchar('\n'); + } + kseq_destroy(seq); + gzclose(fp); + return 0; +} + +int stk_hety(int argc, char *argv[]) +{ + gzFile fp; + kseq_t *seq; + int l, c, win_size = 50000, n_start = 5, win_step, is_lower_mask = 0; + char *buf; + uint32_t cnt[3]; + if (argc == 1) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: seqtk hety [options] \n\n"); + fprintf(pysamerr, "Options: -w INT window size [%d]\n", win_size); + fprintf(pysamerr, " -t INT # start positions in a window [%d]\n", n_start); + fprintf(pysamerr, " -m treat lowercases as masked\n"); + fprintf(pysamerr, "\n"); + return 1; + } + while ((c = getopt(argc, argv, "w:t:m")) >= 0) { + switch (c) { + case 'w': win_size = atoi(optarg); break; + case 't': n_start = atoi(optarg); break; + case 'm': is_lower_mask = 1; break; + } + } + fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r"); + seq = kseq_init(fp); + win_step = win_size / n_start; + buf = calloc(win_size, 1); + while ((l = kseq_read(seq)) >= 0) { + int x, i, y, z, next = 0; + cnt[0] = cnt[1] = cnt[2] = 0; + for (i = 0; i <= l; ++i) { + if ((i >= win_size && i % win_step == 0) || i == l) { + if (i == l && l >= win_size) { + for (y = l - win_size; y < next; ++y) --cnt[(int)buf[y % win_size]]; + } + if (cnt[1] + cnt[2] > 0) + printf("%s\t%d\t%d\t%.2lf\t%d\t%d\n", seq->name.s, next, i, + (double)cnt[2] / (cnt[1] + cnt[2]) * win_size, cnt[1] + cnt[2], cnt[2]); + next = i; + } + if (i < l) { + y = i % win_size; + c = seq->seq.s[i]; + if (is_lower_mask && islower(c)) c = 'N'; + c = seq_nt16_table[c]; + x = bitcnt_table[c]; + if (i >= win_size) --cnt[(int)buf[y]]; + buf[y] = z = x > 2? 0 : x == 2? 2 : 1; + ++cnt[z]; + } + } + } + free(buf); + kseq_destroy(seq); + gzclose(fp); + return 0; +} + +/* fq2fa */ +int stk_fq2fa(int argc, char *argv[]) +{ + gzFile fp; + kseq_t *seq; + char *buf; + int l, i, c, qual_thres = 0, linelen = 60; + while ((c = getopt(argc, argv, "q:l:")) >= 0) { + switch (c) { + case 'q': qual_thres = atoi(optarg); break; + case 'l': linelen = atoi(optarg); break; + } + } + if (argc == optind) { + fprintf(pysamerr, "Usage: seqtk fq2fa [-q qualThres=0] [-l lineLen=60] \n"); + return 1; + } + buf = linelen > 0? malloc(linelen + 1) : 0; + fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + if (seq->qual.l && qual_thres > 0) { + for (i = 0; i < l; ++i) + if (seq->qual.s[i] - 33 < qual_thres) + seq->seq.s[i] = tolower(seq->seq.s[i]); + } + putchar('>'); + if (seq->comment.l) { + fputs(seq->name.s, stdout); + putchar(' '); + puts(seq->comment.s); + } else puts(seq->name.s); + if (buf) { // multi-line + for (i = 0; i < l; i += linelen) { + int x = i + linelen < l? linelen : l - i; + memcpy(buf, seq->seq.s + i, x); + buf[x] = 0; + puts(buf); + } + } else puts(seq->seq.s); + } + free(buf); + kseq_destroy(seq); + gzclose(fp); + return 0; +} + +int stk_maskseq(int argc, char *argv[]) +{ + khash_t(reg) *h = kh_init(reg); + gzFile fp; + kseq_t *seq; + int l, i, j, c, is_complement = 0, is_lower = 0; + khint_t k; + while ((c = getopt(argc, argv, "cl")) >= 0) { + switch (c) { + case 'c': is_complement = 1; break; + case 'l': is_lower = 1; break; + } + } + if (argc - optind < 2) { + fprintf(pysamerr, "Usage: seqtk maskseq [-cl] \n\n"); + fprintf(pysamerr, "Options: -c mask the complement regions\n"); + fprintf(pysamerr, " -l soft mask (to lower cases)\n"); + return 1; + } + h = stk_reg_read(argv[optind+1]); + // maskseq + fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + k = kh_get(reg, h, seq->name.s); + if (k == kh_end(h)) { // not found in the hash table + if (is_complement) { + for (j = 0; j < l; ++j) + seq->seq.s[j] = is_lower? tolower(seq->seq.s[j]) : 'N'; + } + } else { + reglist_t *p = &kh_val(h, k); + if (!is_complement) { + for (i = 0; i < p->n; ++i) { + int beg = p->a[i]>>32, end = p->a[i]; + if (beg >= seq->seq.l) { + fprintf(pysamerr, "[maskseq] start position >= the sequence length.\n"); + continue; + } + if (end >= seq->seq.l) end = seq->seq.l; + if (is_lower) for (j = beg; j < end; ++j) seq->seq.s[j] = tolower(seq->seq.s[j]); + else for (j = beg; j < end; ++j) seq->seq.s[j] = 'N'; + } + } else { + int8_t *mask = calloc(seq->seq.l, 1); + for (i = 0; i < p->n; ++i) { + int beg = p->a[i]>>32, end = p->a[i]; + if (end >= seq->seq.l) end = seq->seq.l; + for (j = beg; j < end; ++j) mask[j] = 1; + } + for (j = 0; j < l; ++j) + if (mask[j] == 0) seq->seq.s[j] = is_lower? tolower(seq->seq.s[j]) : 'N'; + free(mask); + } + } + printf(">%s", seq->name.s); + for (j = 0; j < seq->seq.l; ++j) { + if (j%60 == 0) putchar('\n'); + putchar(seq->seq.s[j]); + } + putchar('\n'); + } + // free + kseq_destroy(seq); + gzclose(fp); + stk_reg_destroy(h); + return 0; +} + +/* subseq */ + +int stk_subseq(int argc, char *argv[]) +{ + khash_t(reg) *h = kh_init(reg); + gzFile fp; + kseq_t *seq; + int l, i, j, c, is_tab = 0; + khint_t k; + while ((c = getopt(argc, argv, "t")) >= 0) { + switch (c) { + case 't': is_tab = 1; break; + } + } + if (optind + 2 > argc) { + fprintf(pysamerr, "Usage: seqtk subseq [-t] \n\n"); + fprintf(pysamerr, "Note: Use 'samtools faidx' if only a few regions are intended.\n"); + return 1; + } + h = stk_reg_read(argv[optind+1]); + // subseq + fp = strcmp(argv[optind], "-")? gzopen(argv[optind], "r") : gzdopen(fileno(stdin), "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + reglist_t *p; + k = kh_get(reg, h, seq->name.s); + if (k == kh_end(h)) continue; + p = &kh_val(h, k); + for (i = 0; i < p->n; ++i) { + int beg = p->a[i]>>32, end = p->a[i]; + if (beg >= seq->seq.l) { + fprintf(pysamerr, "[subseq] %s: %d >= %ld\n", seq->name.s, beg, seq->seq.l); + continue; + } + if (end > seq->seq.l) end = seq->seq.l; + if (is_tab == 0) { + printf("%c%s", seq->qual.l == seq->seq.l? '@' : '>', seq->name.s); + if (end == INT_MAX) { + if (beg) printf(":%d", beg+1); + } else printf(":%d-%d", beg+1, end); + } else printf("%s\t%d\t", seq->name.s, beg + 1); + if (end > seq->seq.l) end = seq->seq.l; + for (j = 0; j < end - beg; ++j) { + if (is_tab == 0 && j % 60 == 0) putchar('\n'); + putchar(seq->seq.s[j + beg]); + } + putchar('\n'); + if (seq->qual.l != seq->seq.l || is_tab) continue; + printf("+"); + for (j = 0; j < end - beg; ++j) { + if (j % 60 == 0) putchar('\n'); + putchar(seq->qual.s[j + beg]); + } + putchar('\n'); + } + } + // free + kseq_destroy(seq); + gzclose(fp); + stk_reg_destroy(h); + return 0; +} + +/* mergefa */ +int stk_mergefa(int argc, char *argv[]) +{ + gzFile fp[2]; + kseq_t *seq[2]; + int i, l, c, is_intersect = 0, is_haploid = 0, qual = 0, is_mask = 0; + while ((c = getopt(argc, argv, "himq:")) >= 0) { + switch (c) { + case 'i': is_intersect = 1; break; + case 'h': is_haploid = 1; break; + case 'm': is_mask = 1; break; + case 'q': qual = atoi(optarg); break; + } + } + if (is_mask && is_intersect) { + fprintf(pysamerr, "[%s] `-i' and `-h' cannot be applied at the same time.\n", __func__); + return 1; + } + if (optind + 2 > argc) { + fprintf(pysamerr, "\nUsage: seqtk mergefa [options] \n\n"); + fprintf(pysamerr, "Options: -q INT quality threshold [0]\n"); + fprintf(pysamerr, " -i take intersection\n"); + fprintf(pysamerr, " -m convert to lowercase when one of the input base is N.\n"); + fprintf(pysamerr, " -h suppress hets in the input\n\n"); + return 1; + } + for (i = 0; i < 2; ++i) { + fp[i] = strcmp(argv[optind+i], "-")? gzopen(argv[optind+i], "r") : gzdopen(fileno(stdin), "r"); + seq[i] = kseq_init(fp[i]); + } + while (kseq_read(seq[0]) >= 0) { + int min_l, c[2], is_upper; + kseq_read(seq[1]); + if (strcmp(seq[0]->name.s, seq[1]->name.s)) + fprintf(pysamerr, "[%s] Different sequence names: %s != %s\n", __func__, seq[0]->name.s, seq[1]->name.s); + if (seq[0]->seq.l != seq[1]->seq.l) + fprintf(pysamerr, "[%s] Unequal sequence length: %ld != %ld\n", __func__, seq[0]->seq.l, seq[1]->seq.l); + min_l = seq[0]->seq.l < seq[1]->seq.l? seq[0]->seq.l : seq[1]->seq.l; + printf(">%s", seq[0]->name.s); + for (l = 0; l < min_l; ++l) { + c[0] = seq[0]->seq.s[l]; c[1] = seq[1]->seq.s[l]; + if (seq[0]->qual.l && seq[0]->qual.s[l] - 33 < qual) c[0] = tolower(c[0]); + if (seq[1]->qual.l && seq[1]->qual.s[l] - 33 < qual) c[1] = tolower(c[1]); + if (is_intersect) is_upper = (isupper(c[0]) || isupper(c[1]))? 1 : 0; + else if (is_mask) is_upper = (isupper(c[0]) || isupper(c[1]))? 1 : 0; + else is_upper = (isupper(c[0]) && isupper(c[1]))? 1 : 0; + c[0] = seq_nt16_table[c[0]]; c[1] = seq_nt16_table[c[1]]; + if (c[0] == 0) c[0] = 15; + if (c[1] == 0) c[1] = 15; + if (is_haploid && (bitcnt_table[c[0]] > 1 || bitcnt_table[c[1]] > 1)) is_upper = 0; + if (is_intersect) { + c[0] = c[0] & c[1]; + if (c[0] == 0) is_upper = 0; + } else if (is_mask) { + if (c[0] == 15 || c[1] == 15) is_upper = 0; + c[0] = c[0] & c[1]; + if (c[0] == 0) is_upper = 0; + } else c[0] = c[0] | c[1]; + c[0] = seq_nt16_rev_table[c[0]]; + if (!is_upper) c[0] = tolower(c[0]); + if (l%60 == 0) putchar('\n'); + putchar(c[0]); + } + putchar('\n'); + } + return 0; +} + +int stk_famask(int argc, char *argv[]) +{ + gzFile fp[2]; + kseq_t *seq[2]; + int i, l; + if (argc < 3) { + fprintf(pysamerr, "Usage: seqtk famask \n"); + return 1; + } + for (i = 0; i < 2; ++i) { + fp[i] = strcmp(argv[optind+i], "-")? gzopen(argv[optind+i], "r") : gzdopen(fileno(stdin), "r"); + seq[i] = kseq_init(fp[i]); + } + while (kseq_read(seq[0]) >= 0) { + int min_l, c[2]; + kseq_read(seq[1]); + if (strcmp(seq[0]->name.s, seq[1]->name.s)) + fprintf(pysamerr, "[%s] Different sequence names: %s != %s\n", __func__, seq[0]->name.s, seq[1]->name.s); + if (seq[0]->seq.l != seq[1]->seq.l) + fprintf(pysamerr, "[%s] Unequal sequence length: %ld != %ld\n", __func__, seq[0]->seq.l, seq[1]->seq.l); + min_l = seq[0]->seq.l < seq[1]->seq.l? seq[0]->seq.l : seq[1]->seq.l; + printf(">%s", seq[0]->name.s); + for (l = 0; l < min_l; ++l) { + c[0] = seq[0]->seq.s[l]; c[1] = seq[1]->seq.s[l]; + if (c[1] == 'x') c[0] = tolower(c[0]); + else if (c[1] != 'X') c[0] = c[1]; + if (l%60 == 0) putchar('\n'); + putchar(c[0]); + } + putchar('\n'); + } + return 0; +} + +int stk_mutfa(int argc, char *argv[]) +{ + khash_t(reg) *h = kh_init(reg); + gzFile fp; + kseq_t *seq; + kstream_t *ks; + int l, i, dret; + kstring_t *str; + khint_t k; + if (argc < 3) { + fprintf(pysamerr, "Usage: seqtk mutfa \n\n"); + fprintf(pysamerr, "Note: contains at least four columns per line which are:\n"); + fprintf(pysamerr, " 'chr 1-based-pos any base-changed-to'.\n"); + return 1; + } + // read the list + str = calloc(1, sizeof(kstring_t)); + fp = strcmp(argv[2], "-")? gzopen(argv[2], "r") : gzdopen(fileno(stdin), "r"); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, str, &dret) >= 0) { + char *s = strdup(str->s); + int beg = 0, ret; + reglist_t *p; + k = kh_get(reg, h, s); + if (k == kh_end(h)) { + k = kh_put(reg, h, s, &ret); + memset(&kh_val(h, k), 0, sizeof(reglist_t)); + } + p = &kh_val(h, k); + if (ks_getuntil(ks, 0, str, &dret) > 0) beg = atol(str->s) - 1; // 2nd col + ks_getuntil(ks, 0, str, &dret); // 3rd col + ks_getuntil(ks, 0, str, &dret); // 4th col + // skip the rest of the line + if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); + if (isalpha(str->s[0]) && str->l == 1) { + if (p->n == p->m) { + p->m = p->m? p->m<<1 : 4; + p->a = realloc(p->a, p->m * 8); + } + p->a[p->n++] = (uint64_t)beg<<32 | str->s[0]; + } + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + // mutfa + fp = strcmp(argv[1], "-")? gzopen(argv[1], "r") : gzdopen(fileno(stdin), "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + reglist_t *p; + k = kh_get(reg, h, seq->name.s); + if (k != kh_end(h)) { + p = &kh_val(h, k); + for (i = 0; i < p->n; ++i) { + int beg = p->a[i]>>32; + if (beg < seq->seq.l) + seq->seq.s[beg] = (int)p->a[i]; + } + } + printf(">%s", seq->name.s); + for (i = 0; i < l; ++i) { + if (i%60 == 0) putchar('\n'); + putchar(seq->seq.s[i]); + } + putchar('\n'); + } + // free + kseq_destroy(seq); + gzclose(fp); + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + free(kh_val(h, k).a); + free((char*)kh_key(h, k)); + } + } + kh_destroy(reg, h); + return 0; +} + +int stk_listhet(int argc, char *argv[]) +{ + gzFile fp; + kseq_t *seq; + int i, l; + if (argc == 1) { + fprintf(pysamerr, "Usage: seqtk listhet \n"); + return 1; + } + fp = (strcmp(argv[1], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[1], "r"); + seq = kseq_init(fp); + while ((l = kseq_read(seq)) >= 0) { + for (i = 0; i < l; ++i) { + int b = seq->seq.s[i]; + if (bitcnt_table[seq_nt16_table[b]] == 2) + printf("%s\t%d\t%c\n", seq->name.s, i+1, b); + } + } + kseq_destroy(seq); + gzclose(fp); + return 0; +} + +/* cutN */ +static int cutN_min_N_tract = 1000; +static int cutN_nonN_penalty = 10; + +static int find_next_cut(const kseq_t *ks, int k, int *begin, int *end) +{ + int i, b, e; + while (k < ks->seq.l) { + if (seq_nt16_table[(int)ks->seq.s[k]] == 15) { + int score, max; + score = 0; e = max = -1; + for (i = k; i < ks->seq.l && score >= 0; ++i) { /* forward */ + if (seq_nt16_table[(int)ks->seq.s[i]] == 15) ++score; + else score -= cutN_nonN_penalty; + if (score > max) max = score, e = i; + } + score = 0; b = max = -1; + for (i = e; i >= 0 && score >= 0; --i) { /* backward */ + if (seq_nt16_table[(int)ks->seq.s[i]] == 15) ++score; + else score -= cutN_nonN_penalty; + if (score > max) max = score, b = i; + } + if (e + 1 - b >= cutN_min_N_tract) { + *begin = b; + *end = e + 1; + return *end; + } + k = e + 1; + } else ++k; + } + return -1; +} +static void print_seq(FILE *fpout, const kseq_t *ks, int begin, int end) +{ + int i; + if (begin >= end) return; // FIXME: why may this happen? Understand it! + fprintf(fpout, ">%s:%d-%d", ks->name.s, begin+1, end); + for (i = begin; i < end && i < ks->seq.l; ++i) { + if ((i - begin)%60 == 0) fputc('\n', fpout); + fputc(ks->seq.s[i], fpout); + } + fputc('\n', fpout); +} +int stk_cutN(int argc, char *argv[]) +{ + int c, l, gap_only = 0; + gzFile fp; + kseq_t *ks; + while ((c = getopt(argc, argv, "n:p:g")) >= 0) { + switch (c) { + case 'n': cutN_min_N_tract = atoi(optarg); break; + case 'p': cutN_nonN_penalty = atoi(optarg); break; + case 'g': gap_only = 1; break; + default: return 1; + } + } + if (argc == optind) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: seqtk cutN [options] \n\n"); + fprintf(pysamerr, "Options: -n INT min size of N tract [%d]\n", cutN_min_N_tract); + fprintf(pysamerr, " -p INT penalty for a non-N [%d]\n", cutN_nonN_penalty); + fprintf(pysamerr, " -g print gaps only, no sequence\n\n"); + return 1; + } + fp = (strcmp(argv[optind], "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(argv[optind], "r"); + ks = kseq_init(fp); + while ((l = kseq_read(ks)) >= 0) { + int k = 0, begin = 0, end = 0; + while (find_next_cut(ks, k, &begin, &end) >= 0) { + if (begin != 0) { + if (gap_only) printf("%s\t%d\t%d\n", ks->name.s, begin, end); + else print_seq(stdout, ks, k, begin); + } + k = end; + } + if (!gap_only) print_seq(stdout, ks, k, l); + } + kseq_destroy(ks); + gzclose(fp); + return 0; +} + +/* main function */ +static int usage() +{ + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: seqtk \n\n"); + fprintf(pysamerr, "Command: comp get the nucleotide composite of FASTA/Q\n"); + fprintf(pysamerr, " hety regional heterozygosity\n"); + fprintf(pysamerr, " fq2fa convert FASTQ to FASTA\n"); + fprintf(pysamerr, " subseq extract subsequences from FASTA/Q\n"); + fprintf(pysamerr, " maskseq mask sequences\n"); + fprintf(pysamerr, " mutfa point mutate FASTA at specified positions\n"); + fprintf(pysamerr, " mergefa merge two FASTA/Q files\n"); + fprintf(pysamerr, " randbase choose a random base from hets\n"); + fprintf(pysamerr, " cutN cut sequence at long N\n"); + fprintf(pysamerr, " listhet extract the position of each het\n"); + fprintf(pysamerr, "\n"); + return 1; +} + +int main(int argc, char *argv[]) +{ + if (argc == 1) return usage(); + if (strcmp(argv[1], "comp") == 0) stk_comp(argc-1, argv+1); + else if (strcmp(argv[1], "hety") == 0) stk_hety(argc-1, argv+1); + else if (strcmp(argv[1], "fq2fa") == 0) stk_fq2fa(argc-1, argv+1); + else if (strcmp(argv[1], "subseq") == 0) stk_subseq(argc-1, argv+1); + else if (strcmp(argv[1], "maskseq") == 0) stk_maskseq(argc-1, argv+1); + else if (strcmp(argv[1], "mutfa") == 0) stk_mutfa(argc-1, argv+1); + else if (strcmp(argv[1], "mergefa") == 0) stk_mergefa(argc-1, argv+1); + else if (strcmp(argv[1], "randbase") == 0) stk_randbase(argc-1, argv+1); + else if (strcmp(argv[1], "cutN") == 0) stk_cutN(argc-1, argv+1); + else if (strcmp(argv[1], "listhet") == 0) stk_listhet(argc-1, argv+1); + else if (strcmp(argv[1], "famask") == 0) stk_famask(argc-1, argv+1); + else { + fprintf(pysamerr, "[main] unrecognized commad '%s'. Abort!\n", argv[1]); + return 1; + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/phase.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/phase.c.pysam.c new file mode 100755 index 0000000..d142538 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/phase.c.pysam.c @@ -0,0 +1,689 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include +#include "bam.h" +#include "errmod.h" + +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 16384) + +#define MAX_VARS 256 +#define FLIP_PENALTY 2 +#define FLIP_THRES 4 +#define MASK_THRES 3 + +#define FLAG_FIX_CHIMERA 0x1 +#define FLAG_LIST_EXCL 0x4 +#define FLAG_DROP_AMBI 0x8 + +typedef struct { + // configurations, initialized in the main function + int flag, k, min_baseQ, min_varLOD, max_depth; + // other global variables + int vpos_shift; + bamFile fp; + char *pre; + bamFile out[3]; + // alignment queue + int n, m; + bam1_t **b; +} phaseg_t; + +typedef struct { + int8_t seq[MAX_VARS]; // TODO: change to dynamic memory allocation! + int vpos, beg, end; + uint32_t vlen:16, single:1, flip:1, phase:1, phased:1, ambig:1; + uint32_t in:16, out:16; // in-phase and out-phase +} frag_t, *frag_p; + +#define rseq_lt(a,b) ((a)->vpos < (b)->vpos) + +#include "khash.h" +KHASH_SET_INIT_INT64(set64) +KHASH_MAP_INIT_INT64(64, frag_t) + +typedef khash_t(64) nseq_t; + +#include "ksort.h" +KSORT_INIT(rseq, frag_p, rseq_lt) + +static char nt16_nt4_table[] = { 4, 0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4 }; + +static inline uint64_t X31_hash_string(const char *s) +{ + uint64_t h = *s; + if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s; + return h; +} + +static void count1(int l, const uint8_t *seq, int *cnt) +{ + int i, j, n_ambi; + uint32_t z, x; + if (seq[l-1] == 0) return; // do nothing is the last base is ambiguous + for (i = n_ambi = 0; i < l; ++i) // collect ambiguous bases + if (seq[i] == 0) ++n_ambi; + if (l - n_ambi <= 1) return; // only one SNP + for (x = 0; x < 1u<>j&1; + ++j; + } + z = z<<1 | c; + } + ++cnt[z]; + } +} + +static int **count_all(int l, int vpos, nseq_t *hash) +{ + khint_t k; + int i, j, **cnt; + uint8_t *seq; + seq = calloc(l, 1); + cnt = calloc(vpos, sizeof(void*)); + for (i = 0; i < vpos; ++i) cnt[i] = calloc(1<vpos >= vpos || f->single) continue; // out of region; or singleton + if (f->vlen == 1) { // such reads should be flagged as deleted previously if everything is right + f->single = 1; + continue; + } + for (j = 1; j < f->vlen; ++j) { + for (i = 0; i < l; ++i) + seq[i] = j < l - 1 - i? 0 : f->seq[j - (l - 1 - i)]; + count1(l, seq, cnt[f->vpos + j]); + } + } + } + free(seq); + return cnt; +} + +// phasing +static int8_t *dynaprog(int l, int vpos, int **w) +{ + int *f[2], *curr, *prev, max, i; + int8_t **b, *h = 0; + uint32_t x, z = 1u<<(l-1), mask = (1u<>1; y1 = xc>>1; + c0 = prev[y0] + wi[x] + wi[xc]; + c1 = prev[y1] + wi[x] + wi[xc]; + if (c0 > c1) bi[x] = 0, curr[x] = c0; + else bi[x] = 1, curr[x] = c1; + } + tmp = prev; prev = curr; curr = tmp; // swap + } + { // backtrack + uint32_t max_x = 0; + int which = 0; + h = calloc(vpos, 1); + for (x = 0, max = 0, max_x = 0; x < z; ++x) + if (prev[x] > max) max = prev[x], max_x = x; + for (i = vpos - 1, x = max_x; i >= 0; --i) { + h[i] = which? (~x&1) : (x&1); + which = b[i][x]? !which : which; + x = b[i][x]? (~x&mask)>>1 : x>>1; + } + } + // free + for (i = 0; i < vpos; ++i) free(b[i]); + free(f[0]); free(f[1]); free(b); + return h; +} + +// phase each fragment +static uint64_t *fragphase(int vpos, const int8_t *path, nseq_t *hash, int flip) +{ + khint_t k; + uint64_t *pcnt; + uint32_t *left, *rght, max; + left = rght = 0; max = 0; + pcnt = calloc(vpos, 8); + for (k = 0; k < kh_end(hash); ++k) { + if (kh_exist(hash, k)) { + int i, c[2]; + frag_t *f = &kh_val(hash, k); + if (f->vpos >= vpos) continue; + // get the phase + c[0] = c[1] = 0; + for (i = 0; i < f->vlen; ++i) { + if (f->seq[i] == 0) continue; + ++c[f->seq[i] == path[f->vpos + i] + 1? 0 : 1]; + } + f->phase = c[0] > c[1]? 0 : 1; + f->in = c[f->phase]; f->out = c[1 - f->phase]; + f->phased = f->in == f->out? 0 : 1; + f->ambig = (f->in && f->out && f->out < 3 && f->in <= f->out + 1)? 1 : 0; + // fix chimera + f->flip = 0; + if (flip && c[0] >= 3 && c[1] >= 3) { + int sum[2], m, mi, md; + if (f->vlen > max) { // enlarge the array + max = f->vlen; + kroundup32(max); + left = realloc(left, max * 4); + rght = realloc(rght, max * 4); + } + for (i = 0, sum[0] = sum[1] = 0; i < f->vlen; ++i) { // get left counts + if (f->seq[i]) { + int c = f->phase? 2 - f->seq[i] : f->seq[i] - 1; + ++sum[c == path[f->vpos + i]? 0 : 1]; + } + left[i] = sum[1]<<16 | sum[0]; + } + for (i = f->vlen - 1, sum[0] = sum[1] = 0; i >= 0; --i) { // get right counts + if (f->seq[i]) { + int c = f->phase? 2 - f->seq[i] : f->seq[i] - 1; + ++sum[c == path[f->vpos + i]? 0 : 1]; + } + rght[i] = sum[1]<<16 | sum[0]; + } + // find the best flip point + for (i = m = 0, mi = -1, md = -1; i < f->vlen - 1; ++i) { + int a[2]; + a[0] = (left[i]&0xffff) + (rght[i+1]>>16&0xffff) - (rght[i+1]&0xffff) * FLIP_PENALTY; + a[1] = (left[i]>>16&0xffff) + (rght[i+1]&0xffff) - (rght[i+1]>>16&0xffff) * FLIP_PENALTY; + if (a[0] > a[1]) { + if (a[0] > m) m = a[0], md = 0, mi = i; + } else { + if (a[1] > m) m = a[1], md = 1, mi = i; + } + } + if (m - c[0] >= FLIP_THRES && m - c[1] >= FLIP_THRES) { // then flip + f->flip = 1; + if (md == 0) { // flip the tail + for (i = mi + 1; i < f->vlen; ++i) + if (f->seq[i] == 1) f->seq[i] = 2; + else if (f->seq[i] == 2) f->seq[i] = 1; + } else { // flip the head + for (i = 0; i <= mi; ++i) + if (f->seq[i] == 1) f->seq[i] = 2; + else if (f->seq[i] == 2) f->seq[i] = 1; + } + } + } + // update pcnt[] + if (!f->single) { + for (i = 0; i < f->vlen; ++i) { + int c; + if (f->seq[i] == 0) continue; + c = f->phase? 2 - f->seq[i] : f->seq[i] - 1; + if (c == path[f->vpos + i]) { + if (f->phase == 0) ++pcnt[f->vpos + i]; + else pcnt[f->vpos + i] += 1ull<<32; + } else { + if (f->phase == 0) pcnt[f->vpos + i] += 1<<16; + else pcnt[f->vpos + i] += 1ull<<48; + } + } + } + } + } + free(left); free(rght); + return pcnt; +} + +static uint64_t *genmask(int vpos, const uint64_t *pcnt, int *_n) +{ + int i, max = 0, max_i = -1, m = 0, n = 0, beg = 0, score = 0; + uint64_t *list = 0; + for (i = 0; i < vpos; ++i) { + uint64_t x = pcnt[i]; + int c[4], pre = score, s; + c[0] = x&0xffff; c[1] = x>>16&0xffff; c[2] = x>>32&0xffff; c[3] = x>>48&0xffff; + s = (c[1] + c[3] == 0)? -(c[0] + c[2]) : (c[1] + c[3] - 1); + if (c[3] > c[2]) s += c[3] - c[2]; + if (c[1] > c[0]) s += c[1] - c[0]; + score += s; + if (score < 0) score = 0; + if (pre == 0 && score > 0) beg = i; // change from zero to non-zero + if ((i == vpos - 1 || score == 0) && max >= MASK_THRES) { + if (n == m) { + m = m? m<<1 : 4; + list = realloc(list, m * 8); + } + list[n++] = (uint64_t)beg<<32 | max_i; + i = max_i; // reset i to max_i + score = 0; + } else if (score > max) max = score, max_i = i; + if (score == 0) max = 0; + } + *_n = n; + return list; +} + +// trim heading and tailing ambiguous bases; mark deleted and remove sequence +static int clean_seqs(int vpos, nseq_t *hash) +{ + khint_t k; + int ret = 0; + for (k = 0; k < kh_end(hash); ++k) { + if (kh_exist(hash, k)) { + frag_t *f = &kh_val(hash, k); + int beg, end, i; + if (f->vpos >= vpos) { + ret = 1; + continue; + } + for (i = 0; i < f->vlen; ++i) + if (f->seq[i] != 0) break; + beg = i; + for (i = f->vlen - 1; i >= 0; --i) + if (f->seq[i] != 0) break; + end = i + 1; + if (end - beg <= 0) kh_del(64, hash, k); + else { + if (beg != 0) memmove(f->seq, f->seq + beg, end - beg); + f->vpos += beg; f->vlen = end - beg; + f->single = f->vlen == 1? 1 : 0; + } + } + } + return ret; +} + +static void dump_aln(phaseg_t *g, int min_pos, const nseq_t *hash) +{ + int i, is_flip, drop_ambi; + drop_ambi = g->flag & FLAG_DROP_AMBI; + is_flip = (drand48() < 0.5); + for (i = 0; i < g->n; ++i) { + int end, which; + uint64_t key; + khint_t k; + bam1_t *b = g->b[i]; + key = X31_hash_string(bam1_qname(b)); + end = bam_calend(&b->core, bam1_cigar(b)); + if (end > min_pos) break; + k = kh_get(64, hash, key); + if (k == kh_end(hash)) which = 3; + else { + frag_t *f = &kh_val(hash, k); + if (f->ambig) which = drop_ambi? 2 : 3; + else if (f->phased && f->flip) which = 2; + else if (f->phased == 0) which = 3; + else { // phased and not flipped + char c = 'Y'; + which = f->phase; + bam_aux_append(b, "ZP", 'A', 1, (uint8_t*)&c); + } + if (which < 2 && is_flip) which = 1 - which; // increase the randomness + } + if (which == 3) which = (drand48() < 0.5); + bam_write1(g->out[which], b); + bam_destroy1(b); + g->b[i] = 0; + } + memmove(g->b, g->b + i, (g->n - i) * sizeof(void*)); + g->n -= i; +} + +static int phase(phaseg_t *g, const char *chr, int vpos, uint64_t *cns, nseq_t *hash) +{ + int i, j, n_seqs = kh_size(hash), n_masked = 0, min_pos; + khint_t k; + frag_t **seqs; + int8_t *path, *sitemask; + uint64_t *pcnt, *regmask; + + if (vpos == 0) return 0; + i = clean_seqs(vpos, hash); // i is true if hash has an element with its vpos >= vpos + min_pos = i? cns[vpos]>>32 : 0x7fffffff; + if (vpos == 1) { + printf("PS\t%s\t%d\t%d\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[0]>>32) + 1); + printf("M0\t%s\t%d\t%d\t%c\t%c\t%d\t0\t0\t0\t0\n//\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[0]>>32) + 1, + "ACGTX"[cns[0]&3], "ACGTX"[cns[0]>>16&3], g->vpos_shift + 1); + for (k = 0; k < kh_end(hash); ++k) { + if (kh_exist(hash, k)) { + frag_t *f = &kh_val(hash, k); + if (f->vpos) continue; + f->flip = 0; + if (f->seq[0] == 0) f->phased = 0; + else f->phased = 1, f->phase = f->seq[0] - 1; + } + } + dump_aln(g, min_pos, hash); + ++g->vpos_shift; + return 1; + } + { // phase + int **cnt; + uint64_t *mask; + printf("PS\t%s\t%d\t%d\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[vpos-1]>>32) + 1); + sitemask = calloc(vpos, 1); + cnt = count_all(g->k, vpos, hash); + path = dynaprog(g->k, vpos, cnt); + for (i = 0; i < vpos; ++i) free(cnt[i]); + free(cnt); + pcnt = fragphase(vpos, path, hash, 0); // do not fix chimeras when masking + mask = genmask(vpos, pcnt, &n_masked); + regmask = calloc(n_masked, 8); + for (i = 0; i < n_masked; ++i) { + regmask[i] = cns[mask[i]>>32]>>32<<32 | cns[(uint32_t)mask[i]]>>32; + for (j = mask[i]>>32; j <= (int32_t)mask[i]; ++j) + sitemask[j] = 1; + } + free(mask); + if (g->flag & FLAG_FIX_CHIMERA) { + free(pcnt); + pcnt = fragphase(vpos, path, hash, 1); + } + } + for (i = 0; i < n_masked; ++i) + printf("FL\t%s\t%d\t%d\n", chr, (int)(regmask[i]>>32) + 1, (int)regmask[i] + 1); + for (i = 0; i < vpos; ++i) { + uint64_t x = pcnt[i]; + int8_t c[2]; + c[0] = (cns[i]&0xffff)>>2 == 0? 4 : (cns[i]&3); + c[1] = (cns[i]>>16&0xffff)>>2 == 0? 4 : (cns[i]>>16&3); + printf("M%d\t%s\t%d\t%d\t%c\t%c\t%d\t%d\t%d\t%d\t%d\n", sitemask[i]+1, chr, (int)(cns[0]>>32) + 1, (int)(cns[i]>>32) + 1, "ACGTX"[c[path[i]]], "ACGTX"[c[1-path[i]]], + i + g->vpos_shift + 1, (int)(x&0xffff), (int)(x>>16&0xffff), (int)(x>>32&0xffff), (int)(x>>48&0xffff)); + } + free(path); free(pcnt); free(regmask); free(sitemask); + seqs = calloc(n_seqs, sizeof(void*)); + for (k = 0, i = 0; k < kh_end(hash); ++k) + if (kh_exist(hash, k) && kh_val(hash, k).vpos < vpos && !kh_val(hash, k).single) + seqs[i++] = &kh_val(hash, k); + n_seqs = i; + ks_introsort_rseq(n_seqs, seqs); + for (i = 0; i < n_seqs; ++i) { + frag_t *f = seqs[i]; + printf("EV\t0\t%s\t%d\t40\t%dM\t*\t0\t0\t", chr, f->vpos + 1 + g->vpos_shift, f->vlen); + for (j = 0; j < f->vlen; ++j) { + uint32_t c = cns[f->vpos + j]; + if (f->seq[j] == 0) putchar('N'); + else putchar("ACGT"[f->seq[j] == 1? (c&3) : (c>>16&3)]); + } + printf("\t*\tYP:i:%d\tYF:i:%d\tYI:i:%d\tYO:i:%d\tYS:i:%d\n", f->phase, f->flip, f->in, f->out, f->beg+1); + } + free(seqs); + printf("//\n"); + fflush(stdout); + g->vpos_shift += vpos; + dump_aln(g, min_pos, hash); + return vpos; +} + +static void update_vpos(int vpos, nseq_t *hash) +{ + khint_t k; + for (k = 0; k < kh_end(hash); ++k) { + if (kh_exist(hash, k)) { + frag_t *f = &kh_val(hash, k); + if (f->vpos < vpos) kh_del(64, hash, k); // TODO: if frag_t::seq is allocated dynamically, free it + else f->vpos -= vpos; + } + } +} + +static nseq_t *shrink_hash(nseq_t *hash) // TODO: to implement +{ + return hash; +} + +static int readaln(void *data, bam1_t *b) +{ + phaseg_t *g = (phaseg_t*)data; + int ret; + ret = bam_read1(g->fp, b); + if (ret < 0) return ret; + if (!(b->core.flag & (BAM_FUNMAP|BAM_FSECONDARY|BAM_FQCFAIL|BAM_FDUP)) && g->pre) { + if (g->n == g->m) { + g->m = g->m? g->m<<1 : 16; + g->b = realloc(g->b, g->m * sizeof(void*)); + } + g->b[g->n++] = bam_dup1(b); + } + return ret; +} + +static khash_t(set64) *loadpos(const char *fn, bam_header_t *h) +{ + gzFile fp; + kstream_t *ks; + int ret, dret; + kstring_t *str; + khash_t(set64) *hash; + + hash = kh_init(set64); + str = calloc(1, sizeof(kstring_t)); + fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, str, &dret) >= 0) { + int tid = bam_get_tid(h, str->s); + if (tid >= 0 && dret != '\n') { + if (ks_getuntil(ks, 0, str, &dret) >= 0) { + uint64_t x = (uint64_t)tid<<32 | (atoi(str->s) - 1); + kh_put(set64, hash, x, &ret); + } else break; + } + if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); + if (dret < 0) break; + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + return hash; +} + +static int gl2cns(float q[16]) +{ + int i, j, min_ij; + float min, min2; + min = min2 = 1e30; min_ij = -1; + for (i = 0; i < 4; ++i) { + for (j = i; j < 4; ++j) { + if (q[i<<2|j] < min) min_ij = i<<2|j, min2 = min, min = q[i<<2|j]; + else if (q[i<<2|j] < min2) min2 = q[i<<2|j]; + } + } + return (min_ij>>2&3) == (min_ij&3)? 0 : 1<<18 | (min_ij>>2&3)<<16 | (min_ij&3) | (int)(min2 - min + .499) << 2; +} + +int main_phase(int argc, char *argv[]) +{ + extern void bam_init_header_hash(bam_header_t *header); + int c, tid, pos, vpos = 0, n, lasttid = -1, max_vpos = 0; + const bam_pileup1_t *plp; + bam_plp_t iter; + bam_header_t *h; + nseq_t *seqs; + uint64_t *cns = 0; + phaseg_t g; + char *fn_list = 0; + khash_t(set64) *set = 0; + errmod_t *em; + uint16_t *bases; + + memset(&g, 0, sizeof(phaseg_t)); + g.flag = FLAG_FIX_CHIMERA; + g.min_varLOD = 37; g.k = 13; g.min_baseQ = 13; g.max_depth = 256; + while ((c = getopt(argc, argv, "Q:eFq:k:b:l:D:A:")) >= 0) { + switch (c) { + case 'D': g.max_depth = atoi(optarg); break; + case 'q': g.min_varLOD = atoi(optarg); break; + case 'Q': g.min_baseQ = atoi(optarg); break; + case 'k': g.k = atoi(optarg); break; + case 'F': g.flag &= ~FLAG_FIX_CHIMERA; break; + case 'e': g.flag |= FLAG_LIST_EXCL; break; + case 'A': g.flag |= FLAG_DROP_AMBI; break; + case 'b': g.pre = strdup(optarg); break; + case 'l': fn_list = strdup(optarg); break; + } + } + if (argc == optind) { + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools phase [options] \n\n"); + fprintf(pysamerr, "Options: -k INT block length [%d]\n", g.k); + fprintf(pysamerr, " -b STR prefix of BAMs to output [null]\n"); + fprintf(pysamerr, " -q INT min het phred-LOD [%d]\n", g.min_varLOD); + fprintf(pysamerr, " -Q INT min base quality in het calling [%d]\n", g.min_baseQ); + fprintf(pysamerr, " -D INT max read depth [%d]\n", g.max_depth); +// fprintf(pysamerr, " -l FILE list of sites to phase [null]\n"); + fprintf(pysamerr, " -F do not attempt to fix chimeras\n"); + fprintf(pysamerr, " -A drop reads with ambiguous phase\n"); +// fprintf(pysamerr, " -e do not discover SNPs (effective with -l)\n"); + fprintf(pysamerr, "\n"); + return 1; + } + g.fp = strcmp(argv[optind], "-")? bam_open(argv[optind], "r") : bam_dopen(fileno(stdin), "r"); + h = bam_header_read(g.fp); + if (fn_list) { // read the list of sites to phase + bam_init_header_hash(h); + set = loadpos(fn_list, h); + free(fn_list); + } else g.flag &= ~FLAG_LIST_EXCL; + if (g.pre) { // open BAMs to write + char *s = malloc(strlen(g.pre) + 20); + strcpy(s, g.pre); strcat(s, ".0.bam"); g.out[0] = bam_open(s, "w"); + strcpy(s, g.pre); strcat(s, ".1.bam"); g.out[1] = bam_open(s, "w"); + strcpy(s, g.pre); strcat(s, ".chimera.bam"); g.out[2] = bam_open(s, "w"); + for (c = 0; c <= 2; ++c) bam_header_write(g.out[c], h); + free(s); + } + + iter = bam_plp_init(readaln, &g); + g.vpos_shift = 0; + seqs = kh_init(64); + em = errmod_init(1. - 0.83); + bases = calloc(g.max_depth, 2); + printf("CC\n"); + printf("CC\tDescriptions:\nCC\n"); + printf("CC\t CC comments\n"); + printf("CC\t PS start of a phase set\n"); + printf("CC\t FL filtered region\n"); + printf("CC\t M[012] markers; 0 for singletons, 1 for phased and 2 for filtered\n"); + printf("CC\t EV supporting reads; SAM format\n"); + printf("CC\t // end of a phase set\nCC\n"); + printf("CC\tFormats of PS, FL and M[012] lines (1-based coordinates):\nCC\n"); + printf("CC\t PS chr phaseSetStart phaseSetEnd\n"); + printf("CC\t FL chr filterStart filterEnd\n"); + printf("CC\t M? chr PS pos allele0 allele1 hetIndex #supports0 #errors0 #supp1 #err1\n"); + printf("CC\nCC\n"); + fflush(stdout); + while ((plp = bam_plp_auto(iter, &tid, &pos, &n)) != 0) { + int i, k, c, tmp, dophase = 1, in_set = 0; + float q[16]; + if (tid < 0) break; + if (tid != lasttid) { // change of chromosome + g.vpos_shift = 0; + if (lasttid >= 0) { + seqs = shrink_hash(seqs); + phase(&g, h->target_name[lasttid], vpos, cns, seqs); + update_vpos(0x7fffffff, seqs); + } + lasttid = tid; + vpos = 0; + } + if (set && kh_get(set64, set, (uint64_t)tid<<32 | pos) != kh_end(set)) in_set = 1; + if (n > g.max_depth) continue; // do not proceed if the depth is too high + // fill the bases array and check if there is a variant + for (i = k = 0; i < n; ++i) { + const bam_pileup1_t *p = plp + i; + uint8_t *seq; + int q, baseQ, b; + if (p->is_del || p->is_refskip) continue; + baseQ = bam1_qual(p->b)[p->qpos]; + if (baseQ < g.min_baseQ) continue; + seq = bam1_seq(p->b); + b = bam_nt16_nt4_table[bam1_seqi(seq, p->qpos)]; + if (b > 3) continue; + q = baseQ < p->b->core.qual? baseQ : p->b->core.qual; + if (q < 4) q = 4; + if (q > 63) q = 63; + bases[k++] = q<<5 | (int)bam1_strand(p->b)<<4 | b; + } + if (k == 0) continue; + errmod_cal(em, k, 4, bases, q); // compute genotype likelihood + c = gl2cns(q); // get the consensus + // tell if to proceed + if (set && (g.flag&FLAG_LIST_EXCL) && !in_set) continue; // not in the list + if (!in_set && (c&0xffff)>>2 < g.min_varLOD) continue; // not a variant + // add the variant + if (vpos == max_vpos) { + max_vpos = max_vpos? max_vpos<<1 : 128; + cns = realloc(cns, max_vpos * 8); + } + cns[vpos] = (uint64_t)pos<<32 | c; + for (i = 0; i < n; ++i) { + const bam_pileup1_t *p = plp + i; + uint64_t key; + khint_t k; + uint8_t *seq = bam1_seq(p->b); + frag_t *f; + if (p->is_del || p->is_refskip) continue; + if (p->b->core.qual == 0) continue; + // get the base code + c = nt16_nt4_table[(int)bam1_seqi(seq, p->qpos)]; + if (c == (cns[vpos]&3)) c = 1; + else if (c == (cns[vpos]>>16&3)) c = 2; + else c = 0; + // write to seqs + key = X31_hash_string(bam1_qname(p->b)); + k = kh_put(64, seqs, key, &tmp); + f = &kh_val(seqs, k); + if (tmp == 0) { // present in the hash table + if (vpos - f->vpos + 1 < MAX_VARS) { + f->vlen = vpos - f->vpos + 1; + f->seq[f->vlen-1] = c; + f->end = bam_calend(&p->b->core, bam1_cigar(p->b)); + } + dophase = 0; + } else { // absent + memset(f->seq, 0, MAX_VARS); + f->beg = p->b->core.pos; + f->end = bam_calend(&p->b->core, bam1_cigar(p->b)); + f->vpos = vpos, f->vlen = 1, f->seq[0] = c, f->single = f->phased = f->flip = f->ambig = 0; + } + } + if (dophase) { + seqs = shrink_hash(seqs); + phase(&g, h->target_name[tid], vpos, cns, seqs); + update_vpos(vpos, seqs); + cns[0] = cns[vpos]; + vpos = 0; + } + ++vpos; + } + if (tid >= 0) phase(&g, h->target_name[tid], vpos, cns, seqs); + bam_header_destroy(h); + bam_plp_destroy(iter); + bam_close(g.fp); + kh_destroy(64, seqs); + kh_destroy(set64, set); + free(cns); + errmod_destroy(em); + free(bases); + if (g.pre) { + for (c = 0; c <= 2; ++c) bam_close(g.out[c]); + free(g.pre); free(g.b); + } + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/pysam.h b/code/utilities/CPAT-1.2.2/lib/samtools/pysam.h new file mode 100755 index 0000000..008cbbd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/pysam.h @@ -0,0 +1,5 @@ +#ifndef PYSAM_H +#define PYSAM_H +#include "stdio.h" +extern FILE * pysamerr; +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/razf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/razf.c.pysam.c new file mode 100755 index 0000000..4021637 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/razf.c.pysam.c @@ -0,0 +1,855 @@ +#include "pysam.h" + +/* + * RAZF : Random Access compressed(Z) File + * Version: 1.0 + * Release Date: 2008-10-27 + * + * Copyright 2008, Jue Ruan , Heng Li + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _NO_RAZF + +#include +#include +#include +#include +#include +#include "razf.h" + + +#if ZLIB_VERNUM < 0x1221 +struct _gz_header_s { + int text; + uLong time; + int xflags; + int os; + Bytef *extra; + uInt extra_len; + uInt extra_max; + Bytef *name; + uInt name_max; + Bytef *comment; + uInt comm_max; + int hcrc; + int done; +}; +#warning "zlib < 1.2.2.1; RAZF writing is disabled." +#endif + +#define DEF_MEM_LEVEL 8 + +static inline uint32_t byte_swap_4(uint32_t v){ + v = ((v & 0x0000FFFFU) << 16) | (v >> 16); + return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8); +} + +static inline uint64_t byte_swap_8(uint64_t v){ + v = ((v & 0x00000000FFFFFFFFLLU) << 32) | (v >> 32); + v = ((v & 0x0000FFFF0000FFFFLLU) << 16) | ((v & 0xFFFF0000FFFF0000LLU) >> 16); + return ((v & 0x00FF00FF00FF00FFLLU) << 8) | ((v & 0xFF00FF00FF00FF00LLU) >> 8); +} + +static inline int is_big_endian(){ + int x = 0x01; + char *c = (char*)&x; + return (c[0] != 0x01); +} + +#ifndef _RZ_READONLY +static void add_zindex(RAZF *rz, int64_t in, int64_t out){ + if(rz->index->size == rz->index->cap){ + rz->index->cap = rz->index->cap * 1.5 + 2; + rz->index->cell_offsets = realloc(rz->index->cell_offsets, sizeof(int) * rz->index->cap); + rz->index->bin_offsets = realloc(rz->index->bin_offsets, sizeof(int64_t) * (rz->index->cap/RZ_BIN_SIZE + 1)); + } + if(rz->index->size % RZ_BIN_SIZE == 0) rz->index->bin_offsets[rz->index->size / RZ_BIN_SIZE] = out; + rz->index->cell_offsets[rz->index->size] = out - rz->index->bin_offsets[rz->index->size / RZ_BIN_SIZE]; + rz->index->size ++; +} + +static void save_zindex(RAZF *rz, int fd){ + int32_t i, v32; + int is_be; + is_be = is_big_endian(); + if(is_be) write(fd, &rz->index->size, sizeof(int)); + else { + v32 = byte_swap_4((uint32_t)rz->index->size); + write(fd, &v32, sizeof(uint32_t)); + } + v32 = rz->index->size / RZ_BIN_SIZE + 1; + if(!is_be){ + for(i=0;iindex->bin_offsets[i] = byte_swap_8((uint64_t)rz->index->bin_offsets[i]); + for(i=0;iindex->size;i++) rz->index->cell_offsets[i] = byte_swap_4((uint32_t)rz->index->cell_offsets[i]); + } + write(fd, rz->index->bin_offsets, sizeof(int64_t) * v32); + write(fd, rz->index->cell_offsets, sizeof(int32_t) * rz->index->size); +} +#endif + +#ifdef _USE_KNETFILE +static void load_zindex(RAZF *rz, knetFile *fp){ +#else +static void load_zindex(RAZF *rz, int fd){ +#endif + int32_t i, v32; + int is_be; + if(!rz->load_index) return; + if(rz->index == NULL) rz->index = malloc(sizeof(ZBlockIndex)); + is_be = is_big_endian(); +#ifdef _USE_KNETFILE + knet_read(fp, &rz->index->size, sizeof(int)); +#else + read(fd, &rz->index->size, sizeof(int)); +#endif + if(!is_be) rz->index->size = byte_swap_4((uint32_t)rz->index->size); + rz->index->cap = rz->index->size; + v32 = rz->index->size / RZ_BIN_SIZE + 1; + rz->index->bin_offsets = malloc(sizeof(int64_t) * v32); +#ifdef _USE_KNETFILE + knet_read(fp, rz->index->bin_offsets, sizeof(int64_t) * v32); +#else + read(fd, rz->index->bin_offsets, sizeof(int64_t) * v32); +#endif + rz->index->cell_offsets = malloc(sizeof(int) * rz->index->size); +#ifdef _USE_KNETFILE + knet_read(fp, rz->index->cell_offsets, sizeof(int) * rz->index->size); +#else + read(fd, rz->index->cell_offsets, sizeof(int) * rz->index->size); +#endif + if(!is_be){ + for(i=0;iindex->bin_offsets[i] = byte_swap_8((uint64_t)rz->index->bin_offsets[i]); + for(i=0;iindex->size;i++) rz->index->cell_offsets[i] = byte_swap_4((uint32_t)rz->index->cell_offsets[i]); + } +} + +#ifdef _RZ_READONLY +static RAZF* razf_open_w(int fd) +{ + fprintf(pysamerr, "[razf_open_w] Writing is not available with zlib ver < 1.2.2.1\n"); + return 0; +} +#else +static RAZF* razf_open_w(int fd){ + RAZF *rz; +#ifdef _WIN32 + setmode(fd, O_BINARY); +#endif + rz = calloc(1, sizeof(RAZF)); + rz->mode = 'w'; +#ifdef _USE_KNETFILE + rz->x.fpw = fd; +#else + rz->filedes = fd; +#endif + rz->stream = calloc(sizeof(z_stream), 1); + rz->inbuf = malloc(RZ_BUFFER_SIZE); + rz->outbuf = malloc(RZ_BUFFER_SIZE); + rz->index = calloc(sizeof(ZBlockIndex), 1); + deflateInit2(rz->stream, RZ_COMPRESS_LEVEL, Z_DEFLATED, WINDOW_BITS + 16, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + rz->header = calloc(sizeof(gz_header), 1); + rz->header->os = 0x03; //Unix + rz->header->text = 0; + rz->header->time = 0; + rz->header->extra = malloc(7); + strncpy((char*)rz->header->extra, "RAZF", 4); + rz->header->extra[4] = 1; // obsolete field + // block size = RZ_BLOCK_SIZE, Big-Endian + rz->header->extra[5] = RZ_BLOCK_SIZE >> 8; + rz->header->extra[6] = RZ_BLOCK_SIZE & 0xFF; + rz->header->extra_len = 7; + rz->header->name = rz->header->comment = 0; + rz->header->hcrc = 0; + deflateSetHeader(rz->stream, rz->header); + rz->block_pos = rz->block_off = 0; + return rz; +} + +static void _razf_write(RAZF* rz, const void *data, int size){ + int tout; + rz->stream->avail_in = size; + rz->stream->next_in = (void*)data; + while(1){ + tout = rz->stream->avail_out; + deflate(rz->stream, Z_NO_FLUSH); + rz->out += tout - rz->stream->avail_out; + if(rz->stream->avail_out) break; +#ifdef _USE_KNETFILE + write(rz->x.fpw, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#else + write(rz->filedes, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#endif + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + if(rz->stream->avail_in == 0) break; + }; + rz->in += size - rz->stream->avail_in; + rz->block_off += size - rz->stream->avail_in; +} + +static void razf_flush(RAZF *rz){ + uint32_t tout; + if(rz->buf_len){ + _razf_write(rz, rz->inbuf, rz->buf_len); + rz->buf_off = rz->buf_len = 0; + } + if(rz->stream->avail_out){ +#ifdef _USE_KNETFILE + write(rz->x.fpw, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#else + write(rz->filedes, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#endif + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + } + while(1){ + tout = rz->stream->avail_out; + deflate(rz->stream, Z_FULL_FLUSH); + rz->out += tout - rz->stream->avail_out; + if(rz->stream->avail_out == 0){ +#ifdef _USE_KNETFILE + write(rz->x.fpw, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#else + write(rz->filedes, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#endif + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + } else break; + } + rz->block_pos = rz->out; + rz->block_off = 0; +} + +static void razf_end_flush(RAZF *rz){ + uint32_t tout; + if(rz->buf_len){ + _razf_write(rz, rz->inbuf, rz->buf_len); + rz->buf_off = rz->buf_len = 0; + } + while(1){ + tout = rz->stream->avail_out; + deflate(rz->stream, Z_FINISH); + rz->out += tout - rz->stream->avail_out; + if(rz->stream->avail_out < RZ_BUFFER_SIZE){ +#ifdef _USE_KNETFILE + write(rz->x.fpw, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#else + write(rz->filedes, rz->outbuf, RZ_BUFFER_SIZE - rz->stream->avail_out); +#endif + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + } else break; + } +} + +static void _razf_buffered_write(RAZF *rz, const void *data, int size){ + int i, n; + while(1){ + if(rz->buf_len == RZ_BUFFER_SIZE){ + _razf_write(rz, rz->inbuf, rz->buf_len); + rz->buf_len = 0; + } + if(size + rz->buf_len < RZ_BUFFER_SIZE){ + for(i=0;iinbuf + rz->buf_len)[i] = ((char*)data)[i]; + rz->buf_len += size; + return; + } else { + n = RZ_BUFFER_SIZE - rz->buf_len; + for(i=0;iinbuf + rz->buf_len)[i] = ((char*)data)[i]; + size -= n; + data += n; + rz->buf_len += n; + } + } +} + +int razf_write(RAZF* rz, const void *data, int size){ + int ori_size, n; + int64_t next_block; + ori_size = size; + next_block = ((rz->in / RZ_BLOCK_SIZE) + 1) * RZ_BLOCK_SIZE; + while(rz->in + rz->buf_len + size >= next_block){ + n = next_block - rz->in - rz->buf_len; + _razf_buffered_write(rz, data, n); + data += n; + size -= n; + razf_flush(rz); + add_zindex(rz, rz->in, rz->out); + next_block = ((rz->in / RZ_BLOCK_SIZE) + 1) * RZ_BLOCK_SIZE; + } + _razf_buffered_write(rz, data, size); + return ori_size; +} +#endif + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +static int _read_gz_header(unsigned char *data, int size, int *extra_off, int *extra_len){ + int method, flags, n, len; + if(size < 2) return 0; + if(data[0] != 0x1f || data[1] != 0x8b) return 0; + if(size < 4) return 0; + method = data[2]; + flags = data[3]; + if(method != Z_DEFLATED || (flags & RESERVED)) return 0; + n = 4 + 6; // Skip 6 bytes + *extra_off = n + 2; + *extra_len = 0; + if(flags & EXTRA_FIELD){ + if(size < n + 2) return 0; + len = ((int)data[n + 1] << 8) | data[n]; + n += 2; + *extra_off = n; + while(len){ + if(n >= size) return 0; + n ++; + len --; + } + *extra_len = n - (*extra_off); + } + if(flags & ORIG_NAME) while(n < size && data[n++]); + if(flags & COMMENT) while(n < size && data[n++]); + if(flags & HEAD_CRC){ + if(n + 2 > size) return 0; + n += 2; + } + return n; +} + +#ifdef _USE_KNETFILE +static RAZF* razf_open_r(knetFile *fp, int _load_index){ +#else +static RAZF* razf_open_r(int fd, int _load_index){ +#endif + RAZF *rz; + int ext_off, ext_len; + int n, is_be, ret; + int64_t end; + unsigned char c[] = "RAZF"; + rz = calloc(1, sizeof(RAZF)); + rz->mode = 'r'; +#ifdef _USE_KNETFILE + rz->x.fpr = fp; +#else +#ifdef _WIN32 + setmode(fd, O_BINARY); +#endif + rz->filedes = fd; +#endif + rz->stream = calloc(sizeof(z_stream), 1); + rz->inbuf = malloc(RZ_BUFFER_SIZE); + rz->outbuf = malloc(RZ_BUFFER_SIZE); + rz->end = rz->src_end = 0x7FFFFFFFFFFFFFFFLL; +#ifdef _USE_KNETFILE + n = knet_read(rz->x.fpr, rz->inbuf, RZ_BUFFER_SIZE); +#else + n = read(rz->filedes, rz->inbuf, RZ_BUFFER_SIZE); +#endif + ret = _read_gz_header(rz->inbuf, n, &ext_off, &ext_len); + if(ret == 0){ + PLAIN_FILE: + rz->in = n; + rz->file_type = FILE_TYPE_PLAIN; + memcpy(rz->outbuf, rz->inbuf, n); + rz->buf_len = n; + free(rz->stream); + rz->stream = NULL; + return rz; + } + rz->header_size = ret; + ret = inflateInit2(rz->stream, -WINDOW_BITS); + if(ret != Z_OK){ inflateEnd(rz->stream); goto PLAIN_FILE;} + rz->stream->avail_in = n - rz->header_size; + rz->stream->next_in = rz->inbuf + rz->header_size; + rz->stream->avail_out = RZ_BUFFER_SIZE; + rz->stream->next_out = rz->outbuf; + rz->file_type = FILE_TYPE_GZ; + rz->in = rz->header_size; + rz->block_pos = rz->header_size; + rz->next_block_pos = rz->header_size; + rz->block_off = 0; + if(ext_len < 7 || memcmp(rz->inbuf + ext_off, c, 4) != 0) return rz; + if(((((unsigned char*)rz->inbuf)[ext_off + 5] << 8) | ((unsigned char*)rz->inbuf)[ext_off + 6]) != RZ_BLOCK_SIZE){ + fprintf(pysamerr, " -- WARNING: RZ_BLOCK_SIZE is not %d, treat source as gz file. in %s -- %s:%d --\n", RZ_BLOCK_SIZE, __FUNCTION__, __FILE__, __LINE__); + return rz; + } + rz->load_index = _load_index; + rz->file_type = FILE_TYPE_RZ; +#ifdef _USE_KNETFILE + if(knet_seek(fp, -16, SEEK_END) == -1){ +#else + if(lseek(fd, -16, SEEK_END) == -1){ +#endif + UNSEEKABLE: + rz->seekable = 0; + rz->index = NULL; + rz->src_end = rz->end = 0x7FFFFFFFFFFFFFFFLL; + } else { + is_be = is_big_endian(); + rz->seekable = 1; +#ifdef _USE_KNETFILE + knet_read(fp, &end, sizeof(int64_t)); +#else + read(fd, &end, sizeof(int64_t)); +#endif + if(!is_be) rz->src_end = (int64_t)byte_swap_8((uint64_t)end); + else rz->src_end = end; + +#ifdef _USE_KNETFILE + knet_read(fp, &end, sizeof(int64_t)); +#else + read(fd, &end, sizeof(int64_t)); +#endif + if(!is_be) rz->end = (int64_t)byte_swap_8((uint64_t)end); + else rz->end = end; + if(n > rz->end){ + rz->stream->avail_in -= n - rz->end; + n = rz->end; + } + if(rz->end > rz->src_end){ +#ifdef _USE_KNETFILE + knet_seek(fp, rz->in, SEEK_SET); +#else + lseek(fd, rz->in, SEEK_SET); +#endif + goto UNSEEKABLE; + } +#ifdef _USE_KNETFILE + knet_seek(fp, rz->end, SEEK_SET); + if(knet_tell(fp) != rz->end){ + knet_seek(fp, rz->in, SEEK_SET); +#else + if(lseek(fd, rz->end, SEEK_SET) != rz->end){ + lseek(fd, rz->in, SEEK_SET); +#endif + goto UNSEEKABLE; + } +#ifdef _USE_KNETFILE + load_zindex(rz, fp); + knet_seek(fp, n, SEEK_SET); +#else + load_zindex(rz, fd); + lseek(fd, n, SEEK_SET); +#endif + } + return rz; +} + +#ifdef _USE_KNETFILE +RAZF* razf_dopen(int fd, const char *mode){ + if (strstr(mode, "r")) fprintf(pysamerr,"[razf_dopen] implement me\n"); + else if(strstr(mode, "w")) return razf_open_w(fd); + return NULL; +} + +RAZF* razf_dopen2(int fd, const char *mode) +{ + fprintf(pysamerr,"[razf_dopen2] implement me\n"); + return NULL; +} +#else +RAZF* razf_dopen(int fd, const char *mode){ + if(strstr(mode, "r")) return razf_open_r(fd, 1); + else if(strstr(mode, "w")) return razf_open_w(fd); + else return NULL; +} + +RAZF* razf_dopen2(int fd, const char *mode) +{ + if(strstr(mode, "r")) return razf_open_r(fd, 0); + else if(strstr(mode, "w")) return razf_open_w(fd); + else return NULL; +} +#endif + +static inline RAZF* _razf_open(const char *filename, const char *mode, int _load_index){ + int fd; + RAZF *rz; + if(strstr(mode, "r")){ +#ifdef _USE_KNETFILE + knetFile *fd = knet_open(filename, "r"); + if (fd == 0) { + fprintf(pysamerr, "[_razf_open] fail to open %s\n", filename); + return NULL; + } +#else +#ifdef _WIN32 + fd = open(filename, O_RDONLY | O_BINARY); +#else + fd = open(filename, O_RDONLY); +#endif +#endif + if(fd < 0) return NULL; + rz = razf_open_r(fd, _load_index); + } else if(strstr(mode, "w")){ +#ifdef _WIN32 + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); +#else + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); +#endif + if(fd < 0) return NULL; + rz = razf_open_w(fd); + } else return NULL; + return rz; +} + +RAZF* razf_open(const char *filename, const char *mode){ + return _razf_open(filename, mode, 1); +} + +RAZF* razf_open2(const char *filename, const char *mode){ + return _razf_open(filename, mode, 0); +} + +int razf_get_data_size(RAZF *rz, int64_t *u_size, int64_t *c_size){ + int64_t n; + if(rz->mode != 'r' && rz->mode != 'R') return 0; + switch(rz->file_type){ + case FILE_TYPE_PLAIN: + if(rz->end == 0x7fffffffffffffffLL){ +#ifdef _USE_KNETFILE + if(knet_seek(rz->x.fpr, 0, SEEK_CUR) == -1) return 0; + n = knet_tell(rz->x.fpr); + knet_seek(rz->x.fpr, 0, SEEK_END); + rz->end = knet_tell(rz->x.fpr); + knet_seek(rz->x.fpr, n, SEEK_SET); +#else + if((n = lseek(rz->filedes, 0, SEEK_CUR)) == -1) return 0; + rz->end = lseek(rz->filedes, 0, SEEK_END); + lseek(rz->filedes, n, SEEK_SET); +#endif + } + *u_size = *c_size = rz->end; + return 1; + case FILE_TYPE_GZ: + return 0; + case FILE_TYPE_RZ: + if(rz->src_end == rz->end) return 0; + *u_size = rz->src_end; + *c_size = rz->end; + return 1; + default: + return 0; + } +} + +static int _razf_read(RAZF* rz, void *data, int size){ + int ret, tin; + if(rz->z_eof || rz->z_err) return 0; + if (rz->file_type == FILE_TYPE_PLAIN) { +#ifdef _USE_KNETFILE + ret = knet_read(rz->x.fpr, data, size); +#else + ret = read(rz->filedes, data, size); +#endif + if (ret == 0) rz->z_eof = 1; + return ret; + } + rz->stream->avail_out = size; + rz->stream->next_out = data; + while(rz->stream->avail_out){ + if(rz->stream->avail_in == 0){ + if(rz->in >= rz->end){ rz->z_eof = 1; break; } + if(rz->end - rz->in < RZ_BUFFER_SIZE){ +#ifdef _USE_KNETFILE + rz->stream->avail_in = knet_read(rz->x.fpr, rz->inbuf, rz->end -rz->in); +#else + rz->stream->avail_in = read(rz->filedes, rz->inbuf, rz->end -rz->in); +#endif + } else { +#ifdef _USE_KNETFILE + rz->stream->avail_in = knet_read(rz->x.fpr, rz->inbuf, RZ_BUFFER_SIZE); +#else + rz->stream->avail_in = read(rz->filedes, rz->inbuf, RZ_BUFFER_SIZE); +#endif + } + if(rz->stream->avail_in == 0){ + rz->z_eof = 1; + break; + } + rz->stream->next_in = rz->inbuf; + } + tin = rz->stream->avail_in; + ret = inflate(rz->stream, Z_BLOCK); + rz->in += tin - rz->stream->avail_in; + if(ret == Z_NEED_DICT || ret == Z_MEM_ERROR || ret == Z_DATA_ERROR){ + fprintf(pysamerr, "[_razf_read] inflate error: %d %s (at %s:%d)\n", ret, rz->stream->msg ? rz->stream->msg : "", __FILE__, __LINE__); + rz->z_err = 1; + break; + } + if(ret == Z_STREAM_END){ + rz->z_eof = 1; + break; + } + if ((rz->stream->data_type&128) && !(rz->stream->data_type&64)){ + rz->buf_flush = 1; + rz->next_block_pos = rz->in; + break; + } + } + return size - rz->stream->avail_out; +} + +int razf_read(RAZF *rz, void *data, int size){ + int ori_size, i; + ori_size = size; + while(size > 0){ + if(rz->buf_len){ + if(size < rz->buf_len){ + for(i=0;ioutbuf + rz->buf_off)[i]; + rz->buf_off += size; + rz->buf_len -= size; + data += size; + rz->block_off += size; + size = 0; + break; + } else { + for(i=0;ibuf_len;i++) ((char*)data)[i] = ((char*)rz->outbuf + rz->buf_off)[i]; + data += rz->buf_len; + size -= rz->buf_len; + rz->block_off += rz->buf_len; + rz->buf_off = 0; + rz->buf_len = 0; + if(rz->buf_flush){ + rz->block_pos = rz->next_block_pos; + rz->block_off = 0; + rz->buf_flush = 0; + } + } + } else if(rz->buf_flush){ + rz->block_pos = rz->next_block_pos; + rz->block_off = 0; + rz->buf_flush = 0; + } + if(rz->buf_flush) continue; + rz->buf_len = _razf_read(rz, rz->outbuf, RZ_BUFFER_SIZE); + if(rz->z_eof && rz->buf_len == 0) break; + } + rz->out += ori_size - size; + return ori_size - size; +} + +int razf_skip(RAZF* rz, int size){ + int ori_size; + ori_size = size; + while(size > 0){ + if(rz->buf_len){ + if(size < rz->buf_len){ + rz->buf_off += size; + rz->buf_len -= size; + rz->block_off += size; + size = 0; + break; + } else { + size -= rz->buf_len; + rz->buf_off = 0; + rz->buf_len = 0; + rz->block_off += rz->buf_len; + if(rz->buf_flush){ + rz->block_pos = rz->next_block_pos; + rz->block_off = 0; + rz->buf_flush = 0; + } + } + } else if(rz->buf_flush){ + rz->block_pos = rz->next_block_pos; + rz->block_off = 0; + rz->buf_flush = 0; + } + if(rz->buf_flush) continue; + rz->buf_len = _razf_read(rz, rz->outbuf, RZ_BUFFER_SIZE); + if(rz->z_eof || rz->z_err) break; + } + rz->out += ori_size - size; + return ori_size - size; +} + +static void _razf_reset_read(RAZF *rz, int64_t in, int64_t out){ +#ifdef _USE_KNETFILE + knet_seek(rz->x.fpr, in, SEEK_SET); +#else + lseek(rz->filedes, in, SEEK_SET); +#endif + rz->in = in; + rz->out = out; + rz->block_pos = in; + rz->next_block_pos = in; + rz->block_off = 0; + rz->buf_flush = 0; + rz->z_eof = rz->z_err = 0; + inflateReset(rz->stream); + rz->stream->avail_in = 0; + rz->buf_off = rz->buf_len = 0; +} + +int64_t razf_jump(RAZF *rz, int64_t block_start, int block_offset){ + int64_t pos; + rz->z_eof = 0; + if(rz->file_type == FILE_TYPE_PLAIN){ + rz->buf_off = rz->buf_len = 0; + pos = block_start + block_offset; +#ifdef _USE_KNETFILE + knet_seek(rz->x.fpr, pos, SEEK_SET); + pos = knet_tell(rz->x.fpr); +#else + pos = lseek(rz->filedes, pos, SEEK_SET); +#endif + rz->out = rz->in = pos; + return pos; + } + if(block_start == rz->block_pos && block_offset >= rz->block_off) { + block_offset -= rz->block_off; + goto SKIP; // Needn't reset inflate + } + if(block_start == 0) block_start = rz->header_size; // Automaticly revist wrong block_start + _razf_reset_read(rz, block_start, 0); + SKIP: + if(block_offset) razf_skip(rz, block_offset); + return rz->block_off; +} + +int64_t razf_seek(RAZF* rz, int64_t pos, int where){ + int64_t idx; + int64_t seek_pos, new_out; + rz->z_eof = 0; + if (where == SEEK_CUR) pos += rz->out; + else if (where == SEEK_END) pos += rz->src_end; + if(rz->file_type == FILE_TYPE_PLAIN){ +#ifdef _USE_KNETFILE + knet_seek(rz->x.fpr, pos, SEEK_SET); + seek_pos = knet_tell(rz->x.fpr); +#else + seek_pos = lseek(rz->filedes, pos, SEEK_SET); +#endif + rz->buf_off = rz->buf_len = 0; + rz->out = rz->in = seek_pos; + return seek_pos; + } else if(rz->file_type == FILE_TYPE_GZ){ + if(pos >= rz->out) goto SKIP; + return rz->out; + } + if(pos == rz->out) return pos; + if(pos > rz->src_end) return rz->out; + if(!rz->seekable || !rz->load_index){ + if(pos >= rz->out) goto SKIP; + } + idx = pos / RZ_BLOCK_SIZE - 1; + seek_pos = (idx < 0)? rz->header_size:(rz->index->cell_offsets[idx] + rz->index->bin_offsets[idx / RZ_BIN_SIZE]); + new_out = (idx + 1) * RZ_BLOCK_SIZE; + if(pos > rz->out && new_out <= rz->out) goto SKIP; + _razf_reset_read(rz, seek_pos, new_out); + SKIP: + razf_skip(rz, (int)(pos - rz->out)); + return rz->out; +} + +uint64_t razf_tell2(RAZF *rz) +{ + /* + if (rz->load_index) { + int64_t idx, seek_pos; + idx = rz->out / RZ_BLOCK_SIZE - 1; + seek_pos = (idx < 0)? rz->header_size:(rz->index->cell_offsets[idx] + rz->index->bin_offsets[idx / RZ_BIN_SIZE]); + if (seek_pos != rz->block_pos || rz->out%RZ_BLOCK_SIZE != rz->block_off) + fprintf(pysamerr, "[razf_tell2] inconsistent block offset: (%lld, %lld) != (%lld, %lld)\n", + (long long)seek_pos, (long long)rz->out%RZ_BLOCK_SIZE, (long long)rz->block_pos, (long long) rz->block_off); + } + */ + return (uint64_t)rz->block_pos<<16 | (rz->block_off&0xffff); +} + +int64_t razf_seek2(RAZF *rz, uint64_t voffset, int where) +{ + if (where != SEEK_SET) return -1; + return razf_jump(rz, voffset>>16, voffset&0xffff); +} + +void razf_close(RAZF *rz){ + if(rz->mode == 'w'){ +#ifndef _RZ_READONLY + razf_end_flush(rz); + deflateEnd(rz->stream); +#ifdef _USE_KNETFILE + save_zindex(rz, rz->x.fpw); + if(is_big_endian()){ + write(rz->x.fpw, &rz->in, sizeof(int64_t)); + write(rz->x.fpw, &rz->out, sizeof(int64_t)); + } else { + uint64_t v64 = byte_swap_8((uint64_t)rz->in); + write(rz->x.fpw, &v64, sizeof(int64_t)); + v64 = byte_swap_8((uint64_t)rz->out); + write(rz->x.fpw, &v64, sizeof(int64_t)); + } +#else + save_zindex(rz, rz->filedes); + if(is_big_endian()){ + write(rz->filedes, &rz->in, sizeof(int64_t)); + write(rz->filedes, &rz->out, sizeof(int64_t)); + } else { + uint64_t v64 = byte_swap_8((uint64_t)rz->in); + write(rz->filedes, &v64, sizeof(int64_t)); + v64 = byte_swap_8((uint64_t)rz->out); + write(rz->filedes, &v64, sizeof(int64_t)); + } +#endif +#endif + } else if(rz->mode == 'r'){ + if(rz->stream) inflateEnd(rz->stream); + } + if(rz->inbuf) free(rz->inbuf); + if(rz->outbuf) free(rz->outbuf); + if(rz->header){ + free(rz->header->extra); + free(rz->header->name); + free(rz->header->comment); + free(rz->header); + } + if(rz->index){ + free(rz->index->bin_offsets); + free(rz->index->cell_offsets); + free(rz->index); + } + free(rz->stream); +#ifdef _USE_KNETFILE + if (rz->mode == 'r') + knet_close(rz->x.fpr); + if (rz->mode == 'w') + close(rz->x.fpw); +#else + close(rz->filedes); +#endif + free(rz); +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/razf.h b/code/utilities/CPAT-1.2.2/lib/samtools/razf.h new file mode 100755 index 0000000..60a0c96 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/razf.h @@ -0,0 +1,134 @@ + /*- + * RAZF : Random Access compressed(Z) File + * Version: 1.0 + * Release Date: 2008-10-27 + * + * Copyright 2008, Jue Ruan , Heng Li + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#ifndef __RAZF_RJ_H +#define __RAZF_RJ_H + +#include +#include +#include "zlib.h" + +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +#if ZLIB_VERNUM < 0x1221 +#define _RZ_READONLY +struct _gz_header_s; +typedef struct _gz_header_s _gz_header; +#define gz_header _gz_header +#endif + +#define WINDOW_BITS 15 + +#ifndef RZ_BLOCK_SIZE +#define RZ_BLOCK_SIZE (1<mode from HEAD to TYPE after call inflateReset */ + int buf_off, buf_len; + int z_err, z_eof; + int seekable; + /* Indice where the source is seekable */ + int load_index; + /* set has_index to 0 in mode 'w', then index will be discarded */ +} RAZF; + +#ifdef __cplusplus +extern "C" { +#endif + + RAZF* razf_dopen(int data_fd, const char *mode); + RAZF *razf_open(const char *fn, const char *mode); + int razf_write(RAZF* rz, const void *data, int size); + int razf_read(RAZF* rz, void *data, int size); + int64_t razf_seek(RAZF* rz, int64_t pos, int where); + void razf_close(RAZF* rz); + +#define razf_tell(rz) ((rz)->out) + + RAZF* razf_open2(const char *filename, const char *mode); + RAZF* razf_dopen2(int fd, const char *mode); + uint64_t razf_tell2(RAZF *rz); + int64_t razf_seek2(RAZF *rz, uint64_t voffset, int where); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sam.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/sam.c.pysam.c new file mode 100755 index 0000000..7f71f7a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sam.c.pysam.c @@ -0,0 +1,181 @@ +#include "pysam.h" + +#include +#include +#include "faidx.h" +#include "sam.h" + +#define TYPE_BAM 1 +#define TYPE_READ 2 + +bam_header_t *bam_header_dup(const bam_header_t *h0) +{ + bam_header_t *h; + int i; + h = bam_header_init(); + *h = *h0; + h->hash = h->dict = h->rg2lib = 0; + h->text = (char*)calloc(h->l_text + 1, 1); + memcpy(h->text, h0->text, h->l_text); + h->target_len = (uint32_t*)calloc(h->n_targets, 4); + h->target_name = (char**)calloc(h->n_targets, sizeof(void*)); + for (i = 0; i < h->n_targets; ++i) { + h->target_len[i] = h0->target_len[i]; + h->target_name[i] = strdup(h0->target_name[i]); + } + return h; +} +static void append_header_text(bam_header_t *header, char* text, int len) +{ + int x = header->l_text + 1; + int y = header->l_text + len + 1; // 1 byte null + if (text == 0) return; + kroundup32(x); + kroundup32(y); + if (x < y) header->text = (char*)realloc(header->text, y); + strncpy(header->text + header->l_text, text, len); // we cannot use strcpy() here. + header->l_text += len; + header->text[header->l_text] = 0; +} + +samfile_t *samopen(const char *fn, const char *mode, const void *aux) +{ + samfile_t *fp; + fp = (samfile_t*)calloc(1, sizeof(samfile_t)); + if (strchr(mode, 'r')) { // read + fp->type |= TYPE_READ; + if (strchr(mode, 'b')) { // binary + fp->type |= TYPE_BAM; + fp->x.bam = strcmp(fn, "-")? bam_open(fn, "r") : bam_dopen(fileno(stdin), "r"); + if (fp->x.bam == 0) goto open_err_ret; + fp->header = bam_header_read(fp->x.bam); + } else { // text + fp->x.tamr = sam_open(fn); + if (fp->x.tamr == 0) goto open_err_ret; + fp->header = sam_header_read(fp->x.tamr); + if (fp->header->n_targets == 0) { // no @SQ fields + if (aux) { // check if aux is present + bam_header_t *textheader = fp->header; + fp->header = sam_header_read2((const char*)aux); + if (fp->header == 0) goto open_err_ret; + append_header_text(fp->header, textheader->text, textheader->l_text); + bam_header_destroy(textheader); + } + if (fp->header->n_targets == 0 && bam_verbose >= 1) + fprintf(pysamerr, "[samopen] no @SQ lines in the header.\n"); + } else if (bam_verbose >= 2) fprintf(pysamerr, "[samopen] SAM header is present: %d sequences.\n", fp->header->n_targets); + } + } else if (strchr(mode, 'w')) { // write + fp->header = bam_header_dup((const bam_header_t*)aux); + if (strchr(mode, 'b')) { // binary + char bmode[3]; + int i, compress_level = -1; + for (i = 0; mode[i]; ++i) if (mode[i] >= '0' && mode[i] <= '9') break; + if (mode[i]) compress_level = mode[i] - '0'; + if (strchr(mode, 'u')) compress_level = 0; + bmode[0] = 'w'; bmode[1] = compress_level < 0? 0 : compress_level + '0'; bmode[2] = 0; + fp->type |= TYPE_BAM; + fp->x.bam = strcmp(fn, "-")? bam_open(fn, bmode) : bam_dopen(fileno(stdout), bmode); + if (fp->x.bam == 0) goto open_err_ret; + bam_header_write(fp->x.bam, fp->header); + } else { // text + // open file + fp->x.tamw = strcmp(fn, "-")? fopen(fn, "w") : stdout; + if (fp->x.tamr == 0) goto open_err_ret; + if (strchr(mode, 'X')) fp->type |= BAM_OFSTR<<2; + else if (strchr(mode, 'x')) fp->type |= BAM_OFHEX<<2; + else fp->type |= BAM_OFDEC<<2; + // write header + if (strchr(mode, 'h')) { + int i; + bam_header_t *alt; + // parse the header text + alt = bam_header_init(); + alt->l_text = fp->header->l_text; alt->text = fp->header->text; + sam_header_parse(alt); + alt->l_text = 0; alt->text = 0; + // check if there are @SQ lines in the header + fwrite(fp->header->text, 1, fp->header->l_text, fp->x.tamw); // FIXME: better to skip the trailing NULL + if (alt->n_targets) { // then write the header text without dumping ->target_{name,len} + if (alt->n_targets != fp->header->n_targets && bam_verbose >= 1) + fprintf(pysamerr, "[samopen] inconsistent number of target sequences. Output the text header.\n"); + } else { // then dump ->target_{name,len} + for (i = 0; i < fp->header->n_targets; ++i) + fprintf(fp->x.tamw, "@SQ\tSN:%s\tLN:%d\n", fp->header->target_name[i], fp->header->target_len[i]); + } + bam_header_destroy(alt); + } + } + } + return fp; + +open_err_ret: + free(fp); + return 0; +} + +void samclose(samfile_t *fp) +{ + if (fp == 0) return; + if (fp->header) bam_header_destroy(fp->header); + if (fp->type & TYPE_BAM) bam_close(fp->x.bam); + else if (fp->type & TYPE_READ) sam_close(fp->x.tamr); + else fclose(fp->x.tamw); + free(fp); +} + +int samread(samfile_t *fp, bam1_t *b) +{ + if (fp == 0 || !(fp->type & TYPE_READ)) return -1; // not open for reading + if (fp->type & TYPE_BAM) return bam_read1(fp->x.bam, b); + else return sam_read1(fp->x.tamr, fp->header, b); +} + +int samwrite(samfile_t *fp, const bam1_t *b) +{ + if (fp == 0 || (fp->type & TYPE_READ)) return -1; // not open for writing + if (fp->type & TYPE_BAM) return bam_write1(fp->x.bam, b); + else { + char *s = bam_format1_core(fp->header, b, fp->type>>2&3); + int l = strlen(s); + fputs(s, fp->x.tamw); fputc('\n', fp->x.tamw); + free(s); + return l + 1; + } +} + +int sampileup(samfile_t *fp, int mask, bam_pileup_f func, void *func_data) +{ + bam_plbuf_t *buf; + int ret; + bam1_t *b; + b = bam_init1(); + buf = bam_plbuf_init(func, func_data); + bam_plbuf_set_mask(buf, mask); + while ((ret = samread(fp, b)) >= 0) + bam_plbuf_push(b, buf); + bam_plbuf_push(0, buf); + bam_plbuf_destroy(buf); + bam_destroy1(b); + return 0; +} + +char *samfaipath(const char *fn_ref) +{ + char *fn_list = 0; + if (fn_ref == 0) return 0; + fn_list = calloc(strlen(fn_ref) + 5, 1); + strcat(strcpy(fn_list, fn_ref), ".fai"); + if (access(fn_list, R_OK) == -1) { // fn_list is unreadable + if (access(fn_ref, R_OK) == -1) { + fprintf(pysamerr, "[samfaipath] fail to read file %s.\n", fn_ref); + } else { + if (bam_verbose >= 3) fprintf(pysamerr, "[samfaipath] build FASTA index...\n"); + if (fai_build(fn_ref) == -1) { + fprintf(pysamerr, "[samfaipath] fail to build FASTA index.\n"); + free(fn_list); fn_list = 0; + } + } + } + return fn_list; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sam.h b/code/utilities/CPAT-1.2.2/lib/samtools/sam.h new file mode 100755 index 0000000..0b87194 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sam.h @@ -0,0 +1,98 @@ +#ifndef BAM_SAM_H +#define BAM_SAM_H + +#include "bam.h" + +/*! + @header + + This file provides higher level of I/O routines and unifies the APIs + for SAM and BAM formats. These APIs are more convenient and + recommended. + + @copyright Genome Research Ltd. + */ + +/*! @typedef + @abstract SAM/BAM file handler + @field type type of the handler; bit 1 for BAM, 2 for reading and bit 3-4 for flag format + @field bam BAM file handler; valid if (type&1) == 1 + @field tamr SAM file handler for reading; valid if type == 2 + @field tamw SAM file handler for writing; valid if type == 0 + @field header header struct + */ +typedef struct { + int type; + union { + tamFile tamr; + bamFile bam; + FILE *tamw; + } x; + bam_header_t *header; +} samfile_t; + +#ifdef __cplusplus +extern "C" { +#endif + + /*! + @abstract Open a SAM/BAM file + + @param fn SAM/BAM file name; "-" is recognized as stdin (for + reading) or stdout (for writing). + + @param mode open mode /[rw](b?)(u?)(h?)([xX]?)/: 'r' for reading, + 'w' for writing, 'b' for BAM I/O, 'u' for uncompressed BAM output, + 'h' for outputing header in SAM, 'x' for HEX flag and 'X' for + string flag. If 'b' present, it must immediately follow 'r' or + 'w'. Valid modes are "r", "w", "wh", "wx", "whx", "wX", "whX", + "rb", "wb" and "wbu" exclusively. + + @param aux auxiliary data; if mode[0]=='w', aux points to + bam_header_t; if strcmp(mode, "rb")!=0 and @SQ header lines in SAM + are absent, aux points the file name of the list of the reference; + aux is not used otherwise. If @SQ header lines are present in SAM, + aux is not used, either. + + @return SAM/BAM file handler + */ + samfile_t *samopen(const char *fn, const char *mode, const void *aux); + + /*! + @abstract Close a SAM/BAM handler + @param fp file handler to be closed + */ + void samclose(samfile_t *fp); + + /*! + @abstract Read one alignment + @param fp file handler + @param b alignment + @return bytes read + */ + int samread(samfile_t *fp, bam1_t *b); + + /*! + @abstract Write one alignment + @param fp file handler + @param b alignment + @return bytes written + */ + int samwrite(samfile_t *fp, const bam1_t *b); + + /*! + @abstract Get the pileup for a whole alignment file + @param fp file handler + @param mask mask transferred to bam_plbuf_set_mask() + @param func user defined function called in the pileup process + #param data user provided data for func() + */ + int sampileup(samfile_t *fp, int mask, bam_pileup_f func, void *data); + + char *samfaipath(const char *fn_ref); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.c.pysam.c new file mode 100755 index 0000000..2178047 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.c.pysam.c @@ -0,0 +1,738 @@ +#include "pysam.h" + +#include "sam_header.h" +#include +#include +#include +#include +#include + +#include "khash.h" +KHASH_MAP_INIT_STR(str, const char *) + +struct _HeaderList +{ + struct _HeaderList *last; // Hack: Used and maintained only by list_append_to_end. Maintained in the root node only. + struct _HeaderList *next; + void *data; +}; +typedef struct _HeaderList list_t; +typedef list_t HeaderDict; + +typedef struct +{ + char key[2]; + char *value; +} +HeaderTag; + +typedef struct +{ + char type[2]; + list_t *tags; +} +HeaderLine; + +const char *o_hd_tags[] = {"SO","GO",NULL}; +const char *r_hd_tags[] = {"VN",NULL}; + +const char *o_sq_tags[] = {"AS","M5","UR","SP",NULL}; +const char *r_sq_tags[] = {"SN","LN",NULL}; +const char *u_sq_tags[] = {"SN",NULL}; + +const char *o_rg_tags[] = {"CN","DS","DT","FO","KS","LB","PG","PI","PL","PU","SM",NULL}; +const char *r_rg_tags[] = {"ID",NULL}; +const char *u_rg_tags[] = {"ID",NULL}; + +const char *o_pg_tags[] = {"VN","CL",NULL}; +const char *r_pg_tags[] = {"ID",NULL}; + +const char *types[] = {"HD","SQ","RG","PG","CO",NULL}; +const char **optional_tags[] = {o_hd_tags,o_sq_tags,o_rg_tags,o_pg_tags,NULL,NULL}; +const char **required_tags[] = {r_hd_tags,r_sq_tags,r_rg_tags,r_pg_tags,NULL,NULL}; +const char **unique_tags[] = {NULL, u_sq_tags,u_rg_tags,NULL,NULL,NULL}; + + +static void debug(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + vfprintf(pysamerr, format, ap); + va_end(ap); +} + +#if 0 +// Replaced by list_append_to_end +static list_t *list_prepend(list_t *root, void *data) +{ + list_t *l = malloc(sizeof(list_t)); + l->next = root; + l->data = data; + return l; +} +#endif + +// Relies on the root->last being correct. Do not use with the other list_* +// routines unless they are fixed to modify root->last as well. +static list_t *list_append_to_end(list_t *root, void *data) +{ + list_t *l = malloc(sizeof(list_t)); + l->last = l; + l->next = NULL; + l->data = data; + + if ( !root ) + return l; + + root->last->next = l; + root->last = l; + return root; +} + +static list_t *list_append(list_t *root, void *data) +{ + list_t *l = root; + while (l && l->next) + l = l->next; + if ( l ) + { + l->next = malloc(sizeof(list_t)); + l = l->next; + } + else + { + l = malloc(sizeof(list_t)); + root = l; + } + l->data = data; + l->next = NULL; + return root; +} + +static void list_free(list_t *root) +{ + list_t *l = root; + while (root) + { + l = root; + root = root->next; + free(l); + } +} + + + +// Look for a tag "XY" in a predefined const char *[] array. +static int tag_exists(const char *tag, const char **tags) +{ + int itag=0; + if ( !tags ) return -1; + while ( tags[itag] ) + { + if ( tags[itag][0]==tag[0] && tags[itag][1]==tag[1] ) return itag; + itag++; + } + return -1; +} + + + +// Mimics the behaviour of getline, except it returns pointer to the next chunk of the text +// or NULL if everything has been read. The lineptr should be freed by the caller. The +// newline character is stripped. +static const char *nextline(char **lineptr, size_t *n, const char *text) +{ + int len; + const char *to = text; + + if ( !*to ) return NULL; + + while ( *to && *to!='\n' && *to!='\r' ) to++; + len = to - text + 1; + + if ( *to ) + { + // Advance the pointer for the next call + if ( *to=='\n' ) to++; + else if ( *to=='\r' && *(to+1)=='\n' ) to+=2; + } + if ( !len ) + return to; + + if ( !*lineptr ) + { + *lineptr = malloc(len); + *n = len; + } + else if ( *nkey[0] = name[0]; + tag->key[1] = name[1]; + tag->value = malloc(len+1); + memcpy(tag->value,value_from,len+1); + tag->value[len] = 0; + return tag; +} + +static HeaderTag *header_line_has_tag(HeaderLine *hline, const char *key) +{ + list_t *tags = hline->tags; + while (tags) + { + HeaderTag *tag = tags->data; + if ( tag->key[0]==key[0] && tag->key[1]==key[1] ) return tag; + tags = tags->next; + } + return NULL; +} + + +// Return codes: +// 0 .. different types or unique tags differ or conflicting tags, cannot be merged +// 1 .. all tags identical -> no need to merge, drop one +// 2 .. the unique tags match and there are some conflicting tags (same tag, different value) -> error, cannot be merged nor duplicated +// 3 .. there are some missing complementary tags and no unique conflict -> can be merged into a single line +static int sam_header_compare_lines(HeaderLine *hline1, HeaderLine *hline2) +{ + HeaderTag *t1, *t2; + + if ( hline1->type[0]!=hline2->type[0] || hline1->type[1]!=hline2->type[1] ) + return 0; + + int itype = tag_exists(hline1->type,types); + if ( itype==-1 ) { + debug("[sam_header_compare_lines] Unknown type [%c%c]\n", hline1->type[0],hline1->type[1]); + return -1; // FIXME (lh3): error; I do not know how this will be handled in Petr's code + } + + if ( unique_tags[itype] ) + { + t1 = header_line_has_tag(hline1,unique_tags[itype][0]); + t2 = header_line_has_tag(hline2,unique_tags[itype][0]); + if ( !t1 || !t2 ) // this should never happen, the unique tags are required + return 2; + + if ( strcmp(t1->value,t2->value) ) + return 0; // the unique tags differ, cannot be merged + } + if ( !required_tags[itype] && !optional_tags[itype] ) + { + t1 = hline1->tags->data; + t2 = hline2->tags->data; + if ( !strcmp(t1->value,t2->value) ) return 1; // identical comments + return 0; + } + + int missing=0, itag=0; + while ( required_tags[itype] && required_tags[itype][itag] ) + { + t1 = header_line_has_tag(hline1,required_tags[itype][itag]); + t2 = header_line_has_tag(hline2,required_tags[itype][itag]); + if ( !t1 && !t2 ) + return 2; // this should never happen + else if ( !t1 || !t2 ) + missing = 1; // there is some tag missing in one of the hlines + else if ( strcmp(t1->value,t2->value) ) + { + if ( unique_tags[itype] ) + return 2; // the lines have a matching unique tag but have a conflicting tag + + return 0; // the lines contain conflicting tags, cannot be merged + } + itag++; + } + itag = 0; + while ( optional_tags[itype] && optional_tags[itype][itag] ) + { + t1 = header_line_has_tag(hline1,optional_tags[itype][itag]); + t2 = header_line_has_tag(hline2,optional_tags[itype][itag]); + if ( !t1 && !t2 ) + { + itag++; + continue; + } + if ( !t1 || !t2 ) + missing = 1; // there is some tag missing in one of the hlines + else if ( strcmp(t1->value,t2->value) ) + { + if ( unique_tags[itype] ) + return 2; // the lines have a matching unique tag but have a conflicting tag + + return 0; // the lines contain conflicting tags, cannot be merged + } + itag++; + } + if ( missing ) return 3; // there are some missing complementary tags with no conflicts, can be merged + return 1; +} + + +static HeaderLine *sam_header_line_clone(const HeaderLine *hline) +{ + list_t *tags; + HeaderLine *out = malloc(sizeof(HeaderLine)); + out->type[0] = hline->type[0]; + out->type[1] = hline->type[1]; + out->tags = NULL; + + tags = hline->tags; + while (tags) + { + HeaderTag *old = tags->data; + + HeaderTag *new = malloc(sizeof(HeaderTag)); + new->key[0] = old->key[0]; + new->key[1] = old->key[1]; + new->value = strdup(old->value); + out->tags = list_append(out->tags, new); + + tags = tags->next; + } + return out; +} + +static int sam_header_line_merge_with(HeaderLine *out_hline, const HeaderLine *tmpl_hline) +{ + list_t *tmpl_tags; + + if ( out_hline->type[0]!=tmpl_hline->type[0] || out_hline->type[1]!=tmpl_hline->type[1] ) + return 0; + + tmpl_tags = tmpl_hline->tags; + while (tmpl_tags) + { + HeaderTag *tmpl_tag = tmpl_tags->data; + HeaderTag *out_tag = header_line_has_tag(out_hline, tmpl_tag->key); + if ( !out_tag ) + { + HeaderTag *tag = malloc(sizeof(HeaderTag)); + tag->key[0] = tmpl_tag->key[0]; + tag->key[1] = tmpl_tag->key[1]; + tag->value = strdup(tmpl_tag->value); + out_hline->tags = list_append(out_hline->tags,tag); + } + tmpl_tags = tmpl_tags->next; + } + return 1; +} + + +static HeaderLine *sam_header_line_parse(const char *headerLine) +{ + HeaderLine *hline; + HeaderTag *tag; + const char *from, *to; + from = headerLine; + + if ( *from != '@' ) { + debug("[sam_header_line_parse] expected '@', got [%s]\n", headerLine); + return 0; + } + to = ++from; + + while (*to && *to!='\t') to++; + if ( to-from != 2 ) { + debug("[sam_header_line_parse] expected '@XY', got [%s]\nHint: The header tags must be tab-separated.\n", headerLine); + return 0; + } + + hline = malloc(sizeof(HeaderLine)); + hline->type[0] = from[0]; + hline->type[1] = from[1]; + hline->tags = NULL; + + int itype = tag_exists(hline->type, types); + + from = to; + while (*to && *to=='\t') to++; + if ( to-from != 1 ) { + debug("[sam_header_line_parse] multiple tabs on line [%s] (%d)\n", headerLine,(int)(to-from)); + return 0; + } + from = to; + while (*from) + { + while (*to && *to!='\t') to++; + + if ( !required_tags[itype] && !optional_tags[itype] ) + { + // CO is a special case, it can contain anything, including tabs + if ( *to ) { to++; continue; } + tag = new_tag(" ",from,to-1); + } + else + tag = new_tag(from,from+3,to-1); + + if ( header_line_has_tag(hline,tag->key) ) + debug("The tag '%c%c' present (at least) twice on line [%s]\n", tag->key[0],tag->key[1], headerLine); + hline->tags = list_append(hline->tags, tag); + + from = to; + while (*to && *to=='\t') to++; + if ( *to && to-from != 1 ) { + debug("[sam_header_line_parse] multiple tabs on line [%s] (%d)\n", headerLine,(int)(to-from)); + return 0; + } + + from = to; + } + return hline; +} + + +// Must be of an existing type, all tags must be recognised and all required tags must be present +static int sam_header_line_validate(HeaderLine *hline) +{ + list_t *tags; + HeaderTag *tag; + int itype, itag; + + // Is the type correct? + itype = tag_exists(hline->type, types); + if ( itype==-1 ) + { + debug("The type [%c%c] not recognised.\n", hline->type[0],hline->type[1]); + return 0; + } + + // Has all required tags? + itag = 0; + while ( required_tags[itype] && required_tags[itype][itag] ) + { + if ( !header_line_has_tag(hline,required_tags[itype][itag]) ) + { + debug("The tag [%c%c] required for [%c%c] not present.\n", required_tags[itype][itag][0],required_tags[itype][itag][1], + hline->type[0],hline->type[1]); + return 0; + } + itag++; + } + + // Are all tags recognised? + tags = hline->tags; + while ( tags ) + { + tag = tags->data; + if ( !tag_exists(tag->key,required_tags[itype]) && !tag_exists(tag->key,optional_tags[itype]) ) + { + debug("Unknown tag [%c%c] for [%c%c].\n", tag->key[0],tag->key[1], hline->type[0],hline->type[1]); + return 0; + } + tags = tags->next; + } + + return 1; +} + + +static void print_header_line(FILE *fp, HeaderLine *hline) +{ + list_t *tags = hline->tags; + HeaderTag *tag; + + fprintf(fp, "@%c%c", hline->type[0],hline->type[1]); + while (tags) + { + tag = tags->data; + + fprintf(fp, "\t"); + if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) + fprintf(fp, "%c%c:", tag->key[0],tag->key[1]); + fprintf(fp, "%s", tag->value); + + tags = tags->next; + } + fprintf(fp,"\n"); +} + + +static void sam_header_line_free(HeaderLine *hline) +{ + list_t *tags = hline->tags; + while (tags) + { + HeaderTag *tag = tags->data; + free(tag->value); + free(tag); + tags = tags->next; + } + list_free(hline->tags); + free(hline); +} + +void sam_header_free(void *_header) +{ + HeaderDict *header = (HeaderDict*)_header; + list_t *hlines = header; + while (hlines) + { + sam_header_line_free(hlines->data); + hlines = hlines->next; + } + list_free(header); +} + +HeaderDict *sam_header_clone(const HeaderDict *dict) +{ + HeaderDict *out = NULL; + while (dict) + { + HeaderLine *hline = dict->data; + out = list_append(out, sam_header_line_clone(hline)); + dict = dict->next; + } + return out; +} + +// Returns a newly allocated string +char *sam_header_write(const void *_header) +{ + const HeaderDict *header = (const HeaderDict*)_header; + char *out = NULL; + int len=0, nout=0; + const list_t *hlines; + + // Calculate the length of the string to allocate + hlines = header; + while (hlines) + { + len += 4; // @XY and \n + + HeaderLine *hline = hlines->data; + list_t *tags = hline->tags; + while (tags) + { + HeaderTag *tag = tags->data; + len += strlen(tag->value) + 1; // \t + if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) + len += strlen(tag->value) + 3; // XY: + tags = tags->next; + } + hlines = hlines->next; + } + + nout = 0; + out = malloc(len+1); + hlines = header; + while (hlines) + { + HeaderLine *hline = hlines->data; + + nout += sprintf(out+nout,"@%c%c",hline->type[0],hline->type[1]); + + list_t *tags = hline->tags; + while (tags) + { + HeaderTag *tag = tags->data; + nout += sprintf(out+nout,"\t"); + if ( tag->key[0]!=' ' || tag->key[1]!=' ' ) + nout += sprintf(out+nout,"%c%c:", tag->key[0],tag->key[1]); + nout += sprintf(out+nout,"%s", tag->value); + tags = tags->next; + } + hlines = hlines->next; + nout += sprintf(out+nout,"\n"); + } + out[len] = 0; + return out; +} + +void *sam_header_parse2(const char *headerText) +{ + list_t *hlines = NULL; + HeaderLine *hline; + const char *text; + char *buf=NULL; + size_t nbuf = 0; + int tovalidate = 0; + + if ( !headerText ) + return 0; + + text = headerText; + while ( (text=nextline(&buf, &nbuf, text)) ) + { + hline = sam_header_line_parse(buf); + if ( hline && (!tovalidate || sam_header_line_validate(hline)) ) + // With too many (~250,000) reference sequences the header parsing was too slow with list_append. + hlines = list_append_to_end(hlines, hline); + else + { + if (hline) sam_header_line_free(hline); + sam_header_free(hlines); + if ( buf ) free(buf); + return NULL; + } + } + if ( buf ) free(buf); + + return hlines; +} + +void *sam_header2tbl(const void *_dict, char type[2], char key_tag[2], char value_tag[2]) +{ + const HeaderDict *dict = (const HeaderDict*)_dict; + const list_t *l = dict; + khash_t(str) *tbl = kh_init(str); + khiter_t k; + int ret; + + if (_dict == 0) return tbl; // return an empty (not null) hash table + while (l) + { + HeaderLine *hline = l->data; + if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) + { + l = l->next; + continue; + } + + HeaderTag *key, *value; + key = header_line_has_tag(hline,key_tag); + value = header_line_has_tag(hline,value_tag); + if ( !key || !value ) + { + l = l->next; + continue; + } + + k = kh_get(str, tbl, key->value); + if ( k != kh_end(tbl) ) + debug("[sam_header_lookup_table] They key %s not unique.\n", key->value); + k = kh_put(str, tbl, key->value, &ret); + kh_value(tbl, k) = value->value; + + l = l->next; + } + return tbl; +} + +char **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n) +{ + const HeaderDict *dict = (const HeaderDict*)_dict; + const list_t *l = dict; + int max, n; + char **ret; + + ret = 0; *_n = max = n = 0; + while (l) + { + HeaderLine *hline = l->data; + if ( hline->type[0]!=type[0] || hline->type[1]!=type[1] ) + { + l = l->next; + continue; + } + + HeaderTag *key; + key = header_line_has_tag(hline,key_tag); + if ( !key ) + { + l = l->next; + continue; + } + + if (n == max) { + max = max? max<<1 : 4; + ret = realloc(ret, max * sizeof(void*)); + } + ret[n++] = key->value; + + l = l->next; + } + *_n = n; + return ret; +} + +const char *sam_tbl_get(void *h, const char *key) +{ + khash_t(str) *tbl = (khash_t(str)*)h; + khint_t k; + k = kh_get(str, tbl, key); + return k == kh_end(tbl)? 0 : kh_val(tbl, k); +} + +int sam_tbl_size(void *h) +{ + khash_t(str) *tbl = (khash_t(str)*)h; + return h? kh_size(tbl) : 0; +} + +void sam_tbl_destroy(void *h) +{ + khash_t(str) *tbl = (khash_t(str)*)h; + kh_destroy(str, tbl); +} + +void *sam_header_merge(int n, const void **_dicts) +{ + const HeaderDict **dicts = (const HeaderDict**)_dicts; + HeaderDict *out_dict; + int idict, status; + + if ( n<2 ) return NULL; + + out_dict = sam_header_clone(dicts[0]); + + for (idict=1; idictdata, out_hlines->data); + if ( status==0 ) + { + out_hlines = out_hlines->next; + continue; + } + + if ( status==2 ) + { + print_header_line(pysamerr,tmpl_hlines->data); + print_header_line(pysamerr,out_hlines->data); + debug("Conflicting lines, cannot merge the headers.\n"); + return 0; + } + if ( status==3 ) + sam_header_line_merge_with(out_hlines->data, tmpl_hlines->data); + + inserted = 1; + break; + } + if ( !inserted ) + out_dict = list_append(out_dict, sam_header_line_clone(tmpl_hlines->data)); + + tmpl_hlines = tmpl_hlines->next; + } + } + + return out_dict; +} + + diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.h b/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.h new file mode 100755 index 0000000..e5c754f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sam_header.h @@ -0,0 +1,24 @@ +#ifndef __SAM_HEADER_H__ +#define __SAM_HEADER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + void *sam_header_parse2(const char *headerText); + void *sam_header_merge(int n, const void **dicts); + void sam_header_free(void *header); + char *sam_header_write(const void *headerDict); // returns a newly allocated string + + char **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); + + void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); + const char *sam_tbl_get(void *h, const char *key); + int sam_tbl_size(void *h); + void sam_tbl_destroy(void *h); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sam_view.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/sam_view.c.pysam.c new file mode 100755 index 0000000..05da8e3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sam_view.c.pysam.c @@ -0,0 +1,408 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "sam_header.h" +#include "sam.h" +#include "faidx.h" +#include "kstring.h" +#include "khash.h" +KHASH_SET_INIT_STR(rg) + +// When counting records instead of printing them, +// data passed to the bam_fetch callback is encapsulated in this struct. +typedef struct { + bam_header_t *header; + int *count; +} count_func_data_t; + +typedef khash_t(rg) *rghash_t; + +// FIXME: we'd better use no global variables... +static rghash_t g_rghash = 0; +static int g_min_mapQ = 0, g_flag_on = 0, g_flag_off = 0; +static float g_subsam = -1; +static char *g_library, *g_rg; +static void *g_bed; + +void *bed_read(const char *fn); +void bed_destroy(void *_h); +int bed_overlap(const void *_h, const char *chr, int beg, int end); + +static inline int __g_skip_aln(const bam_header_t *h, const bam1_t *b) +{ + if (b->core.qual < g_min_mapQ || ((b->core.flag & g_flag_on) != g_flag_on) || (b->core.flag & g_flag_off)) + return 1; + if (g_bed && b->core.tid >= 0 && !bed_overlap(g_bed, h->target_name[b->core.tid], b->core.pos, bam_calend(&b->core, bam1_cigar(b)))) + return 1; + if (g_subsam > 0.) { + int x = (int)(g_subsam + .499); + uint32_t k = __ac_X31_hash_string(bam1_qname(b)) + x; + if (k%1024 / 1024.0 >= g_subsam - x) return 1; + } + if (g_rg || g_rghash) { + uint8_t *s = bam_aux_get(b, "RG"); + if (s) { + if (g_rg) return (strcmp(g_rg, (char*)(s + 1)) == 0)? 0 : 1; + if (g_rghash) { + khint_t k = kh_get(rg, g_rghash, (char*)(s + 1)); + return (k != kh_end(g_rghash))? 0 : 1; + } + } + } + if (g_library) { + const char *p = bam_get_library((bam_header_t*)h, b); + return (p && strcmp(p, g_library) == 0)? 0 : 1; + } + return 0; +} + +static char *drop_rg(char *hdtxt, rghash_t h, int *len) +{ + char *p = hdtxt, *q, *r, *s; + kstring_t str; + memset(&str, 0, sizeof(kstring_t)); + while (1) { + int toprint = 0; + q = strchr(p, '\n'); + if (q == 0) q = p + strlen(p); + if (q - p < 3) break; // the line is too short; then stop + if (strncmp(p, "@RG\t", 4) == 0) { + int c; + khint_t k; + if ((r = strstr(p, "\tID:")) != 0) { + r += 4; + for (s = r; *s != '\0' && *s != '\n' && *s != '\t'; ++s); + c = *s; *s = '\0'; + k = kh_get(rg, h, r); + *s = c; + if (k != kh_end(h)) toprint = 1; + } + } else toprint = 1; + if (toprint) { + kputsn(p, q - p, &str); kputc('\n', &str); + } + p = q + 1; + } + *len = str.l; + return str.s; +} + +// callback function for bam_fetch() that prints nonskipped records +static int view_func(const bam1_t *b, void *data) +{ + if (!__g_skip_aln(((samfile_t*)data)->header, b)) + samwrite((samfile_t*)data, b); + return 0; +} + +// callback function for bam_fetch() that counts nonskipped records +static int count_func(const bam1_t *b, void *data) +{ + if (!__g_skip_aln(((count_func_data_t*)data)->header, b)) { + (*((count_func_data_t*)data)->count)++; + } + return 0; +} + +static int usage(int is_long_help); + +int main_samview(int argc, char *argv[]) +{ + int c, is_header = 0, is_header_only = 0, is_bamin = 1, ret = 0, compress_level = -1, is_bamout = 0, is_count = 0; + int of_type = BAM_OFDEC, is_long_help = 0; + int count = 0; + samfile_t *in = 0, *out = 0; + char in_mode[5], out_mode[5], *fn_out = 0, *fn_list = 0, *fn_ref = 0, *fn_rg = 0; + + /* parse command-line options */ + strcpy(in_mode, "r"); strcpy(out_mode, "w"); + while ((c = getopt(argc, argv, "Sbct:h1Ho:q:f:F:ul:r:xX?T:R:L:s:")) >= 0) { + switch (c) { + case 's': g_subsam = atof(optarg); break; + case 'c': is_count = 1; break; + case 'S': is_bamin = 0; break; + case 'b': is_bamout = 1; break; + case 't': fn_list = strdup(optarg); is_bamin = 0; break; + case 'h': is_header = 1; break; + case 'H': is_header_only = 1; break; + case 'o': fn_out = strdup(optarg); break; + case 'f': g_flag_on = strtol(optarg, 0, 0); break; + case 'F': g_flag_off = strtol(optarg, 0, 0); break; + case 'q': g_min_mapQ = atoi(optarg); break; + case 'u': compress_level = 0; break; + case '1': compress_level = 1; break; + case 'l': g_library = strdup(optarg); break; + case 'L': g_bed = bed_read(optarg); break; + case 'r': g_rg = strdup(optarg); break; + case 'R': fn_rg = strdup(optarg); break; + case 'x': of_type = BAM_OFHEX; break; + case 'X': of_type = BAM_OFSTR; break; + case '?': is_long_help = 1; break; + case 'T': fn_ref = strdup(optarg); is_bamin = 0; break; + default: return usage(is_long_help); + } + } + if (compress_level >= 0) is_bamout = 1; + if (is_header_only) is_header = 1; + if (is_bamout) strcat(out_mode, "b"); + else { + if (of_type == BAM_OFHEX) strcat(out_mode, "x"); + else if (of_type == BAM_OFSTR) strcat(out_mode, "X"); + } + if (is_bamin) strcat(in_mode, "b"); + if (is_header) strcat(out_mode, "h"); + if (compress_level >= 0) { + char tmp[2]; + tmp[0] = compress_level + '0'; tmp[1] = '\0'; + strcat(out_mode, tmp); + } + if (argc == optind) return usage(is_long_help); // potential memory leak... + + // read the list of read groups + if (fn_rg) { + FILE *fp_rg; + char buf[1024]; + int ret; + g_rghash = kh_init(rg); + fp_rg = fopen(fn_rg, "r"); + while (!feof(fp_rg) && fscanf(fp_rg, "%s", buf) > 0) // this is not a good style, but bear me... + kh_put(rg, g_rghash, strdup(buf), &ret); // we'd better check duplicates... + fclose(fp_rg); + } + + // generate the fn_list if necessary + if (fn_list == 0 && fn_ref) fn_list = samfaipath(fn_ref); + // open file handlers + if ((in = samopen(argv[optind], in_mode, fn_list)) == 0) { + fprintf(pysamerr, "[main_samview] fail to open \"%s\" for reading.\n", argv[optind]); + ret = 1; + goto view_end; + } + if (in->header == 0) { + fprintf(pysamerr, "[main_samview] fail to read the header from \"%s\".\n", argv[optind]); + ret = 1; + goto view_end; + } + if (g_rghash) { // FIXME: I do not know what "bam_header_t::n_text" is for... + char *tmp; + int l; + tmp = drop_rg(in->header->text, g_rghash, &l); + free(in->header->text); + in->header->text = tmp; + in->header->l_text = l; + } + if (!is_count && (out = samopen(fn_out? fn_out : "-", out_mode, in->header)) == 0) { + fprintf(pysamerr, "[main_samview] fail to open \"%s\" for writing.\n", fn_out? fn_out : "standard output"); + ret = 1; + goto view_end; + } + if (is_header_only) goto view_end; // no need to print alignments + + if (argc == optind + 1) { // convert/print the entire file + bam1_t *b = bam_init1(); + int r; + while ((r = samread(in, b)) >= 0) { // read one alignment from `in' + if (!__g_skip_aln(in->header, b)) { + if (!is_count) samwrite(out, b); // write the alignment to `out' + count++; + } + } + if (r < -1) { + fprintf(pysamerr, "[main_samview] truncated file.\n"); + ret = 1; + } + bam_destroy1(b); + } else { // retrieve alignments in specified regions + int i; + bam_index_t *idx = 0; + if (is_bamin) idx = bam_index_load(argv[optind]); // load BAM index + if (idx == 0) { // index is unavailable + fprintf(pysamerr, "[main_samview] random alignment retrieval only works for indexed BAM files.\n"); + ret = 1; + goto view_end; + } + for (i = optind + 1; i < argc; ++i) { + int tid, beg, end, result; + bam_parse_region(in->header, argv[i], &tid, &beg, &end); // parse a region in the format like `chr2:100-200' + if (tid < 0) { // reference name is not found + fprintf(pysamerr, "[main_samview] region \"%s\" specifies an unknown reference name. Continue anyway.\n", argv[i]); + continue; + } + // fetch alignments + if (is_count) { + count_func_data_t count_data = { in->header, &count }; + result = bam_fetch(in->x.bam, idx, tid, beg, end, &count_data, count_func); + } else + result = bam_fetch(in->x.bam, idx, tid, beg, end, out, view_func); + if (result < 0) { + fprintf(pysamerr, "[main_samview] retrieval of region \"%s\" failed due to truncated file or corrupt BAM index file\n", argv[i]); + ret = 1; + break; + } + } + bam_index_destroy(idx); // destroy the BAM index + } + +view_end: + if (is_count && ret == 0) { + printf("%d\n", count); + } + // close files, free and return + free(fn_list); free(fn_ref); free(fn_out); free(g_library); free(g_rg); free(fn_rg); + if (g_bed) bed_destroy(g_bed); + if (g_rghash) { + khint_t k; + for (k = 0; k < kh_end(g_rghash); ++k) + if (kh_exist(g_rghash, k)) free((char*)kh_key(g_rghash, k)); + kh_destroy(rg, g_rghash); + } + samclose(in); + if (!is_count) + samclose(out); + return ret; +} + +static int usage(int is_long_help) +{ + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: samtools view [options] | [region1 [...]]\n\n"); + fprintf(pysamerr, "Options: -b output BAM\n"); + fprintf(pysamerr, " -h print header for the SAM output\n"); + fprintf(pysamerr, " -H print header only (no alignments)\n"); + fprintf(pysamerr, " -S input is SAM\n"); + fprintf(pysamerr, " -u uncompressed BAM output (force -b)\n"); + fprintf(pysamerr, " -1 fast compression (force -b)\n"); + fprintf(pysamerr, " -x output FLAG in HEX (samtools-C specific)\n"); + fprintf(pysamerr, " -X output FLAG in string (samtools-C specific)\n"); + fprintf(pysamerr, " -c print only the count of matching records\n"); + fprintf(pysamerr, " -L FILE output alignments overlapping the input BED FILE [null]\n"); + fprintf(pysamerr, " -t FILE list of reference names and lengths (force -S) [null]\n"); + fprintf(pysamerr, " -T FILE reference sequence file (force -S) [null]\n"); + fprintf(pysamerr, " -o FILE output file name [stdout]\n"); + fprintf(pysamerr, " -R FILE list of read groups to be outputted [null]\n"); + fprintf(pysamerr, " -f INT required flag, 0 for unset [0]\n"); + fprintf(pysamerr, " -F INT filtering flag, 0 for unset [0]\n"); + fprintf(pysamerr, " -q INT minimum mapping quality [0]\n"); + fprintf(pysamerr, " -l STR only output reads in library STR [null]\n"); + fprintf(pysamerr, " -r STR only output reads in read group STR [null]\n"); + fprintf(pysamerr, " -s FLOAT fraction of templates to subsample; integer part as seed [-1]\n"); + fprintf(pysamerr, " -? longer help\n"); + fprintf(pysamerr, "\n"); + if (is_long_help) + fprintf(pysamerr, "Notes:\n\ +\n\ + 1. By default, this command assumes the file on the command line is in\n\ + the BAM format and it prints the alignments in SAM. If `-t' is\n\ + applied, the input file is assumed to be in the SAM format. The\n\ + file supplied with `-t' is SPACE/TAB delimited with the first two\n\ + fields of each line consisting of the reference name and the\n\ + corresponding sequence length. The `.fai' file generated by `faidx'\n\ + can be used here. This file may be empty if reads are unaligned.\n\ +\n\ + 2. SAM->BAM conversion: `samtools view -bT ref.fa in.sam.gz'.\n\ +\n\ + 3. BAM->SAM conversion: `samtools view in.bam'.\n\ +\n\ + 4. A region should be presented in one of the following formats:\n\ + `chr1', `chr2:1,000' and `chr3:1000-2,000'. When a region is\n\ + specified, the input alignment file must be an indexed BAM file.\n\ +\n\ + 5. Option `-u' is preferred over `-b' when the output is piped to\n\ + another samtools command.\n\ +\n\ + 6. In a string FLAG, each character represents one bit with\n\ + p=0x1 (paired), P=0x2 (properly paired), u=0x4 (unmapped),\n\ + U=0x8 (mate unmapped), r=0x10 (reverse), R=0x20 (mate reverse)\n\ + 1=0x40 (first), 2=0x80 (second), s=0x100 (not primary), \n\ + f=0x200 (failure) and d=0x400 (duplicate). Note that `-x' and\n\ + `-X' are samtools-C specific. Picard and older samtools do not\n\ + support HEX or string flags.\n\ +\n"); + return 1; +} + +int main_import(int argc, char *argv[]) +{ + int argc2, ret; + char **argv2; + if (argc != 4) { + fprintf(pysamerr, "Usage: bamtk import \n"); + return 1; + } + argc2 = 6; + argv2 = calloc(6, sizeof(char*)); + argv2[0] = "import", argv2[1] = "-o", argv2[2] = argv[3], argv2[3] = "-bt", argv2[4] = argv[1], argv2[5] = argv[2]; + ret = main_samview(argc2, argv2); + free(argv2); + return ret; +} + +int8_t seq_comp_table[16] = { 0, 8, 4, 12, 2, 10, 9, 14, 1, 6, 5, 13, 3, 11, 7, 15 }; + +int main_bam2fq(int argc, char *argv[]) +{ + bamFile fp; + bam_header_t *h; + bam1_t *b; + int8_t *buf; + int max_buf; + if (argc == 1) { + fprintf(pysamerr, "Usage: samtools bam2fq \n"); + return 1; + } + fp = strcmp(argv[1], "-")? bam_open(argv[1], "r") : bam_dopen(fileno(stdin), "r"); + if (fp == 0) return 1; + h = bam_header_read(fp); + b = bam_init1(); + buf = 0; + max_buf = 0; + while (bam_read1(fp, b) >= 0) { + int i, qlen = b->core.l_qseq; + uint8_t *seq; + putchar('@'); fputs(bam1_qname(b), stdout); + if ((b->core.flag & 0x40) && !(b->core.flag & 0x80)) puts("/1"); + else if ((b->core.flag & 0x80) && !(b->core.flag & 0x40)) puts("/2"); + else putchar('\n'); + if (max_buf < qlen + 1) { + max_buf = qlen + 1; + kroundup32(max_buf); + buf = realloc(buf, max_buf); + } + buf[qlen] = 0; + seq = bam1_seq(b); + for (i = 0; i < qlen; ++i) + buf[i] = bam1_seqi(seq, i); + if (b->core.flag & 16) { // reverse complement + for (i = 0; i < qlen>>1; ++i) { + int8_t t = seq_comp_table[buf[qlen - 1 - i]]; + buf[qlen - 1 - i] = seq_comp_table[buf[i]]; + buf[i] = t; + } + if (qlen&1) buf[i] = seq_comp_table[buf[i]]; + } + for (i = 0; i < qlen; ++i) + buf[i] = bam_nt16_rev_table[buf[i]]; + puts((char*)buf); + puts("+"); + seq = bam1_qual(b); + for (i = 0; i < qlen; ++i) + buf[i] = 33 + seq[i]; + if (b->core.flag & 16) { // reverse + for (i = 0; i < qlen>>1; ++i) { + int8_t t = buf[qlen - 1 - i]; + buf[qlen - 1 - i] = buf[i]; + buf[i] = t; + } + } + puts((char*)buf); + } + free(buf); + bam_destroy1(b); + bam_header_destroy(h); + bam_close(fp); + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sample.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/samtools/sample.c.pysam.c new file mode 100755 index 0000000..5f3d655 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sample.c.pysam.c @@ -0,0 +1,109 @@ +#include "pysam.h" + +#include +#include +#include "sample.h" +#include "khash.h" +KHASH_MAP_INIT_STR(sm, int) + +bam_sample_t *bam_smpl_init(void) +{ + bam_sample_t *s; + s = calloc(1, sizeof(bam_sample_t)); + s->rg2smid = kh_init(sm); + s->sm2id = kh_init(sm); + return s; +} + +void bam_smpl_destroy(bam_sample_t *sm) +{ + int i; + khint_t k; + khash_t(sm) *rg2smid = (khash_t(sm)*)sm->rg2smid; + if (sm == 0) return; + for (i = 0; i < sm->n; ++i) free(sm->smpl[i]); + free(sm->smpl); + for (k = kh_begin(rg2smid); k != kh_end(rg2smid); ++k) + if (kh_exist(rg2smid, k)) free((char*)kh_key(rg2smid, k)); + kh_destroy(sm, sm->rg2smid); + kh_destroy(sm, sm->sm2id); + free(sm); +} + +static void add_pair(bam_sample_t *sm, khash_t(sm) *sm2id, const char *key, const char *val) +{ + khint_t k_rg, k_sm; + int ret; + khash_t(sm) *rg2smid = (khash_t(sm)*)sm->rg2smid; + k_rg = kh_get(sm, rg2smid, key); + if (k_rg != kh_end(rg2smid)) return; // duplicated @RG-ID + k_rg = kh_put(sm, rg2smid, strdup(key), &ret); + k_sm = kh_get(sm, sm2id, val); + if (k_sm == kh_end(sm2id)) { // absent + if (sm->n == sm->m) { + sm->m = sm->m? sm->m<<1 : 1; + sm->smpl = realloc(sm->smpl, sizeof(void*) * sm->m); + } + sm->smpl[sm->n] = strdup(val); + k_sm = kh_put(sm, sm2id, sm->smpl[sm->n], &ret); + kh_val(sm2id, k_sm) = sm->n++; + } + kh_val(rg2smid, k_rg) = kh_val(sm2id, k_sm); +} + +int bam_smpl_add(bam_sample_t *sm, const char *fn, const char *txt) +{ + const char *p = txt, *q, *r; + kstring_t buf, first_sm; + int n = 0; + khash_t(sm) *sm2id = (khash_t(sm)*)sm->sm2id; + if (txt == 0) { + add_pair(sm, sm2id, fn, fn); + return 0; + } + memset(&buf, 0, sizeof(kstring_t)); + memset(&first_sm, 0, sizeof(kstring_t)); + while ((q = strstr(p, "@RG")) != 0) { + p = q + 3; + r = q = 0; + if ((q = strstr(p, "\tID:")) != 0) q += 4; + if ((r = strstr(p, "\tSM:")) != 0) r += 4; + if (r && q) { + char *u, *v; + int oq, or; + for (u = (char*)q; *u && *u != '\t' && *u != '\n'; ++u); + for (v = (char*)r; *v && *v != '\t' && *v != '\n'; ++v); + oq = *u; or = *v; *u = *v = '\0'; + buf.l = 0; kputs(fn, &buf); kputc('/', &buf); kputs(q, &buf); + add_pair(sm, sm2id, buf.s, r); + if ( !first_sm.s ) + kputs(r,&first_sm); + *u = oq; *v = or; + } else break; + p = q > r? q : r; + ++n; + } + if (n == 0) add_pair(sm, sm2id, fn, fn); + // If there is only one RG tag present in the header and reads are not annotated, don't refuse to work but + // use the tag instead. + else if ( n==1 && first_sm.s ) + add_pair(sm,sm2id,fn,first_sm.s); + if ( first_sm.s ) + free(first_sm.s); + +// add_pair(sm, sm2id, fn, fn); + free(buf.s); + return 0; +} + +int bam_smpl_rg2smid(const bam_sample_t *sm, const char *fn, const char *rg, kstring_t *str) +{ + khint_t k; + khash_t(sm) *rg2smid = (khash_t(sm)*)sm->rg2smid; + if (rg) { + str->l = 0; + kputs(fn, str); kputc('/', str); kputs(rg, str); + k = kh_get(sm, rg2smid, str->s); + } else k = kh_get(sm, rg2smid, fn); + return k == kh_end(rg2smid)? -1 : kh_val(rg2smid, k); +} diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/sample.h b/code/utilities/CPAT-1.2.2/lib/samtools/sample.h new file mode 100755 index 0000000..85fe499 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/sample.h @@ -0,0 +1,17 @@ +#ifndef BAM_SAMPLE_H +#define BAM_SAMPLE_H + +#include "kstring.h" + +typedef struct { + int n, m; + char **smpl; + void *rg2smid, *sm2id; +} bam_sample_t; + +bam_sample_t *bam_smpl_init(void); +int bam_smpl_add(bam_sample_t *sm, const char *abs, const char *txt); +int bam_smpl_rg2smid(const bam_sample_t *sm, const char *fn, const char *rg, kstring_t *str); +void bam_smpl_destroy(bam_sample_t *sm); + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/win32/xcurses.h b/code/utilities/CPAT-1.2.2/lib/samtools/win32/xcurses.h new file mode 100755 index 0000000..6f3ce19 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/win32/xcurses.h @@ -0,0 +1,1377 @@ +/* Public Domain Curses */ + +/* $Id: curses.h,v 1.295 2008/07/15 17:13:25 wmcbrine Exp $ */ + +/*----------------------------------------------------------------------* + * PDCurses * + *----------------------------------------------------------------------*/ + +#ifndef __PDCURSES__ +#define __PDCURSES__ 1 + +/*man-start************************************************************** + +PDCurses definitions list: (Only define those needed) + + XCURSES True if compiling for X11. + PDC_RGB True if you want to use RGB color definitions + (Red = 1, Green = 2, Blue = 4) instead of BGR. + PDC_WIDE True if building wide-character support. + PDC_DLL_BUILD True if building a Win32 DLL. + NCURSES_MOUSE_VERSION Use the ncurses mouse API instead + of PDCurses' traditional mouse API. + +PDCurses portable platform definitions list: + + PDC_BUILD Defines API build version. + PDCURSES Enables access to PDCurses-only routines. + XOPEN Always true. + SYSVcurses True if you are compiling for SYSV portability. + BSDcurses True if you are compiling for BSD portability. + +**man-end****************************************************************/ + +#define PDC_BUILD 3401 +#define PDCURSES 1 /* PDCurses-only routines */ +#define XOPEN 1 /* X/Open Curses routines */ +#define SYSVcurses 1 /* System V Curses routines */ +#define BSDcurses 1 /* BSD Curses routines */ +#define CHTYPE_LONG 1 /* size of chtype; long */ + +/*----------------------------------------------------------------------*/ + +#include +#include +#include /* Required by X/Open usage below */ + +#ifdef PDC_WIDE +# include +#endif + +#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) +extern "C" +{ +# define bool _bool +#endif + +/*---------------------------------------------------------------------- + * + * PDCurses Manifest Constants + * + */ + +#ifndef FALSE +# define FALSE 0 +#endif +#ifndef TRUE +# define TRUE 1 +#endif +#ifndef NULL +# define NULL (void *)0 +#endif +#ifndef ERR +# define ERR (-1) +#endif +#ifndef OK +# define OK 0 +#endif + +/*---------------------------------------------------------------------- + * + * PDCurses Type Declarations + * + */ + +typedef unsigned char bool; /* PDCurses Boolean type */ + +#ifdef CHTYPE_LONG +# if _LP64 +typedef unsigned int chtype; +# else +typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ +# endif +#else +typedef unsigned short chtype; /* 8-bit attr + 8-bit char */ +#endif + +#ifdef PDC_WIDE +typedef chtype cchar_t; +#endif + +typedef chtype attr_t; + +/*---------------------------------------------------------------------- + * + * PDCurses Mouse Interface -- SYSVR4, with extensions + * + */ + +typedef struct +{ + int x; /* absolute column, 0 based, measured in characters */ + int y; /* absolute row, 0 based, measured in characters */ + short button[3]; /* state of each button */ + int changes; /* flags indicating what has changed with the mouse */ +} MOUSE_STATUS; + +#define BUTTON_RELEASED 0x0000 +#define BUTTON_PRESSED 0x0001 +#define BUTTON_CLICKED 0x0002 +#define BUTTON_DOUBLE_CLICKED 0x0003 +#define BUTTON_TRIPLE_CLICKED 0x0004 +#define BUTTON_MOVED 0x0005 /* PDCurses */ +#define WHEEL_SCROLLED 0x0006 /* PDCurses */ +#define BUTTON_ACTION_MASK 0x0007 /* PDCurses */ + +#define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */ +#define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */ +#define PDC_BUTTON_ALT 0x0020 /* PDCurses */ +#define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */ + +#define MOUSE_X_POS (Mouse_status.x) +#define MOUSE_Y_POS (Mouse_status.y) + +/* + * Bits associated with the .changes field: + * 3 2 1 0 + * 210987654321098765432109876543210 + * 1 <- button 1 has changed + * 10 <- button 2 has changed + * 100 <- button 3 has changed + * 1000 <- mouse has moved + * 10000 <- mouse position report + * 100000 <- mouse wheel up + * 1000000 <- mouse wheel down + */ + +#define PDC_MOUSE_MOVED 0x0008 +#define PDC_MOUSE_POSITION 0x0010 +#define PDC_MOUSE_WHEEL_UP 0x0020 +#define PDC_MOUSE_WHEEL_DOWN 0x0040 + +#define A_BUTTON_CHANGED (Mouse_status.changes & 7) +#define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED) +#define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION) +#define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1))) +#define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1]) +#define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP) +#define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN) + +/* mouse bit-masks */ + +#define BUTTON1_RELEASED 0x00000001L +#define BUTTON1_PRESSED 0x00000002L +#define BUTTON1_CLICKED 0x00000004L +#define BUTTON1_DOUBLE_CLICKED 0x00000008L +#define BUTTON1_TRIPLE_CLICKED 0x00000010L +#define BUTTON1_MOVED 0x00000010L /* PDCurses */ + +#define BUTTON2_RELEASED 0x00000020L +#define BUTTON2_PRESSED 0x00000040L +#define BUTTON2_CLICKED 0x00000080L +#define BUTTON2_DOUBLE_CLICKED 0x00000100L +#define BUTTON2_TRIPLE_CLICKED 0x00000200L +#define BUTTON2_MOVED 0x00000200L /* PDCurses */ + +#define BUTTON3_RELEASED 0x00000400L +#define BUTTON3_PRESSED 0x00000800L +#define BUTTON3_CLICKED 0x00001000L +#define BUTTON3_DOUBLE_CLICKED 0x00002000L +#define BUTTON3_TRIPLE_CLICKED 0x00004000L +#define BUTTON3_MOVED 0x00004000L /* PDCurses */ + +/* For the ncurses-compatible functions only, BUTTON4_PRESSED and + BUTTON5_PRESSED are returned for mouse scroll wheel up and down; + otherwise PDCurses doesn't support buttons 4 and 5 */ + +#define BUTTON4_RELEASED 0x00008000L +#define BUTTON4_PRESSED 0x00010000L +#define BUTTON4_CLICKED 0x00020000L +#define BUTTON4_DOUBLE_CLICKED 0x00040000L +#define BUTTON4_TRIPLE_CLICKED 0x00080000L + +#define BUTTON5_RELEASED 0x00100000L +#define BUTTON5_PRESSED 0x00200000L +#define BUTTON5_CLICKED 0x00400000L +#define BUTTON5_DOUBLE_CLICKED 0x00800000L +#define BUTTON5_TRIPLE_CLICKED 0x01000000L + +#define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */ +#define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */ +#define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */ +#define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */ + +#define ALL_MOUSE_EVENTS 0x1fffffffL +#define REPORT_MOUSE_POSITION 0x20000000L + +/* ncurses mouse interface */ + +typedef unsigned long mmask_t; + +typedef struct +{ + short id; /* unused, always 0 */ + int x, y, z; /* x, y same as MOUSE_STATUS; z unused */ + mmask_t bstate; /* equivalent to changes + button[], but + in the same format as used for mousemask() */ +} MEVENT; + +#ifdef NCURSES_MOUSE_VERSION +# define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT +# define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL +# define BUTTON_CTRL BUTTON_MODIFIER_CONTROL +# define BUTTON_ALT BUTTON_MODIFIER_ALT +#else +# define BUTTON_SHIFT PDC_BUTTON_SHIFT +# define BUTTON_CONTROL PDC_BUTTON_CONTROL +# define BUTTON_ALT PDC_BUTTON_ALT +#endif + +/*---------------------------------------------------------------------- + * + * PDCurses Structure Definitions + * + */ + +typedef struct _win /* definition of a window */ +{ + int _cury; /* current pseudo-cursor */ + int _curx; + int _maxy; /* max window coordinates */ + int _maxx; + int _begy; /* origin on screen */ + int _begx; + int _flags; /* window properties */ + chtype _attrs; /* standard attributes and colors */ + chtype _bkgd; /* background, normally blank */ + bool _clear; /* causes clear at next refresh */ + bool _leaveit; /* leaves cursor where it is */ + bool _scroll; /* allows window scrolling */ + bool _nodelay; /* input character wait flag */ + bool _immed; /* immediate update flag */ + bool _sync; /* synchronise window ancestors */ + bool _use_keypad; /* flags keypad key mode active */ + chtype **_y; /* pointer to line pointer array */ + int *_firstch; /* first changed character in line */ + int *_lastch; /* last changed character in line */ + int _tmarg; /* top of scrolling region */ + int _bmarg; /* bottom of scrolling region */ + int _delayms; /* milliseconds of delay for getch() */ + int _parx, _pary; /* coords relative to parent (0,0) */ + struct _win *_parent; /* subwin's pointer to parent win */ +} WINDOW; + +/* Avoid using the SCREEN struct directly -- use the corresponding + functions if possible. This struct may eventually be made private. */ + +typedef struct +{ + bool alive; /* if initscr() called, and not endwin() */ + bool autocr; /* if cr -> lf */ + bool cbreak; /* if terminal unbuffered */ + bool echo; /* if terminal echo */ + bool raw_inp; /* raw input mode (v. cooked input) */ + bool raw_out; /* raw output mode (7 v. 8 bits) */ + bool audible; /* FALSE if the bell is visual */ + bool mono; /* TRUE if current screen is mono */ + bool resized; /* TRUE if TERM has been resized */ + bool orig_attr; /* TRUE if we have the original colors */ + short orig_fore; /* original screen foreground color */ + short orig_back; /* original screen foreground color */ + int cursrow; /* position of physical cursor */ + int curscol; /* position of physical cursor */ + int visibility; /* visibility of cursor */ + int orig_cursor; /* original cursor size */ + int lines; /* new value for LINES */ + int cols; /* new value for COLS */ + unsigned long _trap_mbe; /* trap these mouse button events */ + unsigned long _map_mbe_to_key; /* map mouse buttons to slk */ + int mouse_wait; /* time to wait (in ms) for a + button release after a press, in + order to count it as a click */ + int slklines; /* lines in use by slk_init() */ + WINDOW *slk_winptr; /* window for slk */ + int linesrippedoff; /* lines ripped off via ripoffline() */ + int linesrippedoffontop; /* lines ripped off on + top via ripoffline() */ + int delaytenths; /* 1/10ths second to wait block + getch() for */ + bool _preserve; /* TRUE if screen background + to be preserved */ + int _restore; /* specifies if screen background + to be restored, and how */ + bool save_key_modifiers; /* TRUE if each key modifiers saved + with each key press */ + bool return_key_modifiers; /* TRUE if modifier keys are + returned as "real" keys */ + bool key_code; /* TRUE if last key is a special key; + used internally by get_wch() */ +#ifdef XCURSES + int XcurscrSize; /* size of Xcurscr shared memory block */ + bool sb_on; + int sb_viewport_y; + int sb_viewport_x; + int sb_total_y; + int sb_total_x; + int sb_cur_y; + int sb_cur_x; +#endif + short line_color; /* color of line attributes - default -1 */ +} SCREEN; + +/*---------------------------------------------------------------------- + * + * PDCurses External Variables + * + */ + +#ifdef PDC_DLL_BUILD +# ifdef CURSES_LIBRARY +# define PDCEX __declspec(dllexport) extern +# else +# define PDCEX __declspec(dllimport) +# endif +#else +# define PDCEX extern +#endif + +PDCEX int LINES; /* terminal height */ +PDCEX int COLS; /* terminal width */ +PDCEX WINDOW *stdscr; /* the default screen window */ +PDCEX WINDOW *curscr; /* the current screen image */ +PDCEX SCREEN *SP; /* curses variables */ +PDCEX MOUSE_STATUS Mouse_status; +PDCEX int COLORS; +PDCEX int COLOR_PAIRS; +PDCEX int TABSIZE; +PDCEX chtype acs_map[]; /* alternate character set map */ +PDCEX char ttytype[]; /* terminal name/description */ + +/*man-start************************************************************** + +PDCurses Text Attributes +======================== + +Originally, PDCurses used a short (16 bits) for its chtype. To include +color, a number of things had to be sacrificed from the strict Unix and +System V support. The main problem was fitting all character attributes +and color into an unsigned char (all 8 bits!). + +Today, PDCurses by default uses a long (32 bits) for its chtype, as in +System V. The short chtype is still available, by undefining CHTYPE_LONG +and rebuilding the library. + +The following is the structure of a win->_attrs chtype: + +short form: + +------------------------------------------------- +|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| +------------------------------------------------- + color number | attrs | character eg 'a' + +The available non-color attributes are bold, reverse and blink. Others +have no effect. The high order char is an index into an array of +physical colors (defined in color.c) -- 32 foreground/background color +pairs (5 bits) plus 3 bits for other attributes. + +long form: + +---------------------------------------------------------------------------- +|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|..| 3| 2| 1| 0| +---------------------------------------------------------------------------- + color number | modifiers | character eg 'a' + +The available non-color attributes are bold, underline, invisible, +right-line, left-line, protect, reverse and blink. 256 color pairs (8 +bits), 8 bits for other attributes, and 16 bits for character data. + +**man-end****************************************************************/ + +/*** Video attribute macros ***/ + +#define A_NORMAL (chtype)0 + +#ifdef CHTYPE_LONG +# define A_ALTCHARSET (chtype)0x00010000 +# define A_RIGHTLINE (chtype)0x00020000 +# define A_LEFTLINE (chtype)0x00040000 +# define A_INVIS (chtype)0x00080000 +# define A_UNDERLINE (chtype)0x00100000 +# define A_REVERSE (chtype)0x00200000 +# define A_BLINK (chtype)0x00400000 +# define A_BOLD (chtype)0x00800000 + +# define A_ATTRIBUTES (chtype)0xffff0000 +# define A_CHARTEXT (chtype)0x0000ffff +# define A_COLOR (chtype)0xff000000 + +# define A_ITALIC A_INVIS +# define A_PROTECT (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) + +# define PDC_ATTR_SHIFT 19 +# define PDC_COLOR_SHIFT 24 +#else +# define A_BOLD (chtype)0x0100 /* X/Open */ +# define A_REVERSE (chtype)0x0200 /* X/Open */ +# define A_BLINK (chtype)0x0400 /* X/Open */ + +# define A_ATTRIBUTES (chtype)0xff00 /* X/Open */ +# define A_CHARTEXT (chtype)0x00ff /* X/Open */ +# define A_COLOR (chtype)0xf800 /* System V */ + +# define A_ALTCHARSET A_NORMAL /* X/Open */ +# define A_PROTECT A_NORMAL /* X/Open */ +# define A_UNDERLINE A_NORMAL /* X/Open */ + +# define A_LEFTLINE A_NORMAL +# define A_RIGHTLINE A_NORMAL +# define A_ITALIC A_NORMAL +# define A_INVIS A_NORMAL + +# define PDC_ATTR_SHIFT 8 +# define PDC_COLOR_SHIFT 11 +#endif + +#define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */ +#define A_DIM A_NORMAL + +#define CHR_MSK A_CHARTEXT /* Obsolete */ +#define ATR_MSK A_ATTRIBUTES /* Obsolete */ +#define ATR_NRM A_NORMAL /* Obsolete */ + +/* For use with attr_t -- X/Open says, "these shall be distinct", so + this is a non-conforming implementation. */ + +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_BLINK A_BLINK +#define WA_BOLD A_BOLD +#define WA_DIM A_DIM +#define WA_INVIS A_INVIS +#define WA_LEFT A_LEFTLINE +#define WA_PROTECT A_PROTECT +#define WA_REVERSE A_REVERSE +#define WA_RIGHT A_RIGHTLINE +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE + +#define WA_HORIZONTAL A_NORMAL +#define WA_LOW A_NORMAL +#define WA_TOP A_NORMAL +#define WA_VERTICAL A_NORMAL + +/*** Alternate character set macros ***/ + +/* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET + 'n' = 16-bit chtype; it gets the fallback set because no bit is + available for A_ALTCHARSET */ + +#ifdef CHTYPE_LONG +# define ACS_PICK(w, n) ((chtype)w | A_ALTCHARSET) +#else +# define ACS_PICK(w, n) ((chtype)n) +#endif + +/* VT100-compatible symbols -- box chars */ + +#define ACS_ULCORNER ACS_PICK('l', '+') +#define ACS_LLCORNER ACS_PICK('m', '+') +#define ACS_URCORNER ACS_PICK('k', '+') +#define ACS_LRCORNER ACS_PICK('j', '+') +#define ACS_RTEE ACS_PICK('u', '+') +#define ACS_LTEE ACS_PICK('t', '+') +#define ACS_BTEE ACS_PICK('v', '+') +#define ACS_TTEE ACS_PICK('w', '+') +#define ACS_HLINE ACS_PICK('q', '-') +#define ACS_VLINE ACS_PICK('x', '|') +#define ACS_PLUS ACS_PICK('n', '+') + +/* VT100-compatible symbols -- other */ + +#define ACS_S1 ACS_PICK('o', '-') +#define ACS_S9 ACS_PICK('s', '_') +#define ACS_DIAMOND ACS_PICK('`', '+') +#define ACS_CKBOARD ACS_PICK('a', ':') +#define ACS_DEGREE ACS_PICK('f', '\'') +#define ACS_PLMINUS ACS_PICK('g', '#') +#define ACS_BULLET ACS_PICK('~', 'o') + +/* Teletype 5410v1 symbols -- these are defined in SysV curses, but + are not well-supported by most terminals. Stick to VT100 characters + for optimum portability. */ + +#define ACS_LARROW ACS_PICK(',', '<') +#define ACS_RARROW ACS_PICK('+', '>') +#define ACS_DARROW ACS_PICK('.', 'v') +#define ACS_UARROW ACS_PICK('-', '^') +#define ACS_BOARD ACS_PICK('h', '#') +#define ACS_LANTERN ACS_PICK('i', '*') +#define ACS_BLOCK ACS_PICK('0', '#') + +/* That goes double for these -- undocumented SysV symbols. Don't use + them. */ + +#define ACS_S3 ACS_PICK('p', '-') +#define ACS_S7 ACS_PICK('r', '-') +#define ACS_LEQUAL ACS_PICK('y', '<') +#define ACS_GEQUAL ACS_PICK('z', '>') +#define ACS_PI ACS_PICK('{', 'n') +#define ACS_NEQUAL ACS_PICK('|', '+') +#define ACS_STERLING ACS_PICK('}', 'L') + +/* Box char aliases */ + +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +/* cchar_t aliases */ + +#ifdef PDC_WIDE +# define WACS_ULCORNER (&(acs_map['l'])) +# define WACS_LLCORNER (&(acs_map['m'])) +# define WACS_URCORNER (&(acs_map['k'])) +# define WACS_LRCORNER (&(acs_map['j'])) +# define WACS_RTEE (&(acs_map['u'])) +# define WACS_LTEE (&(acs_map['t'])) +# define WACS_BTEE (&(acs_map['v'])) +# define WACS_TTEE (&(acs_map['w'])) +# define WACS_HLINE (&(acs_map['q'])) +# define WACS_VLINE (&(acs_map['x'])) +# define WACS_PLUS (&(acs_map['n'])) + +# define WACS_S1 (&(acs_map['o'])) +# define WACS_S9 (&(acs_map['s'])) +# define WACS_DIAMOND (&(acs_map['`'])) +# define WACS_CKBOARD (&(acs_map['a'])) +# define WACS_DEGREE (&(acs_map['f'])) +# define WACS_PLMINUS (&(acs_map['g'])) +# define WACS_BULLET (&(acs_map['~'])) + +# define WACS_LARROW (&(acs_map[','])) +# define WACS_RARROW (&(acs_map['+'])) +# define WACS_DARROW (&(acs_map['.'])) +# define WACS_UARROW (&(acs_map['-'])) +# define WACS_BOARD (&(acs_map['h'])) +# define WACS_LANTERN (&(acs_map['i'])) +# define WACS_BLOCK (&(acs_map['0'])) + +# define WACS_S3 (&(acs_map['p'])) +# define WACS_S7 (&(acs_map['r'])) +# define WACS_LEQUAL (&(acs_map['y'])) +# define WACS_GEQUAL (&(acs_map['z'])) +# define WACS_PI (&(acs_map['{'])) +# define WACS_NEQUAL (&(acs_map['|'])) +# define WACS_STERLING (&(acs_map['}'])) + +# define WACS_BSSB WACS_ULCORNER +# define WACS_SSBB WACS_LLCORNER +# define WACS_BBSS WACS_URCORNER +# define WACS_SBBS WACS_LRCORNER +# define WACS_SBSS WACS_RTEE +# define WACS_SSSB WACS_LTEE +# define WACS_SSBS WACS_BTEE +# define WACS_BSSS WACS_TTEE +# define WACS_BSBS WACS_HLINE +# define WACS_SBSB WACS_VLINE +# define WACS_SSSS WACS_PLUS +#endif + +/*** Color macros ***/ + +#define COLOR_BLACK 0 + +#ifdef PDC_RGB /* RGB */ +# define COLOR_RED 1 +# define COLOR_GREEN 2 +# define COLOR_BLUE 4 +#else /* BGR */ +# define COLOR_BLUE 1 +# define COLOR_GREEN 2 +# define COLOR_RED 4 +#endif + +#define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) +#define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) +#define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) + +#define COLOR_WHITE 7 + +/*---------------------------------------------------------------------- + * + * Function and Keypad Key Definitions. + * Many are just for compatibility. + * + */ + +#define KEY_CODE_YES 0x100 /* If get_wch() gives a key code */ + +#define KEY_BREAK 0x101 /* Not on PC KBD */ +#define KEY_DOWN 0x102 /* Down arrow key */ +#define KEY_UP 0x103 /* Up arrow key */ +#define KEY_LEFT 0x104 /* Left arrow key */ +#define KEY_RIGHT 0x105 /* Right arrow key */ +#define KEY_HOME 0x106 /* home key */ +#define KEY_BACKSPACE 0x107 /* not on pc */ +#define KEY_F0 0x108 /* function keys; 64 reserved */ + +#define KEY_DL 0x148 /* delete line */ +#define KEY_IL 0x149 /* insert line */ +#define KEY_DC 0x14a /* delete character */ +#define KEY_IC 0x14b /* insert char or enter ins mode */ +#define KEY_EIC 0x14c /* exit insert char mode */ +#define KEY_CLEAR 0x14d /* clear screen */ +#define KEY_EOS 0x14e /* clear to end of screen */ +#define KEY_EOL 0x14f /* clear to end of line */ +#define KEY_SF 0x150 /* scroll 1 line forward */ +#define KEY_SR 0x151 /* scroll 1 line back (reverse) */ +#define KEY_NPAGE 0x152 /* next page */ +#define KEY_PPAGE 0x153 /* previous page */ +#define KEY_STAB 0x154 /* set tab */ +#define KEY_CTAB 0x155 /* clear tab */ +#define KEY_CATAB 0x156 /* clear all tabs */ +#define KEY_ENTER 0x157 /* enter or send (unreliable) */ +#define KEY_SRESET 0x158 /* soft/reset (partial/unreliable) */ +#define KEY_RESET 0x159 /* reset/hard reset (unreliable) */ +#define KEY_PRINT 0x15a /* print/copy */ +#define KEY_LL 0x15b /* home down/bottom (lower left) */ +#define KEY_ABORT 0x15c /* abort/terminate key (any) */ +#define KEY_SHELP 0x15d /* short help */ +#define KEY_LHELP 0x15e /* long help */ +#define KEY_BTAB 0x15f /* Back tab key */ +#define KEY_BEG 0x160 /* beg(inning) key */ +#define KEY_CANCEL 0x161 /* cancel key */ +#define KEY_CLOSE 0x162 /* close key */ +#define KEY_COMMAND 0x163 /* cmd (command) key */ +#define KEY_COPY 0x164 /* copy key */ +#define KEY_CREATE 0x165 /* create key */ +#define KEY_END 0x166 /* end key */ +#define KEY_EXIT 0x167 /* exit key */ +#define KEY_FIND 0x168 /* find key */ +#define KEY_HELP 0x169 /* help key */ +#define KEY_MARK 0x16a /* mark key */ +#define KEY_MESSAGE 0x16b /* message key */ +#define KEY_MOVE 0x16c /* move key */ +#define KEY_NEXT 0x16d /* next object key */ +#define KEY_OPEN 0x16e /* open key */ +#define KEY_OPTIONS 0x16f /* options key */ +#define KEY_PREVIOUS 0x170 /* previous object key */ +#define KEY_REDO 0x171 /* redo key */ +#define KEY_REFERENCE 0x172 /* ref(erence) key */ +#define KEY_REFRESH 0x173 /* refresh key */ +#define KEY_REPLACE 0x174 /* replace key */ +#define KEY_RESTART 0x175 /* restart key */ +#define KEY_RESUME 0x176 /* resume key */ +#define KEY_SAVE 0x177 /* save key */ +#define KEY_SBEG 0x178 /* shifted beginning key */ +#define KEY_SCANCEL 0x179 /* shifted cancel key */ +#define KEY_SCOMMAND 0x17a /* shifted command key */ +#define KEY_SCOPY 0x17b /* shifted copy key */ +#define KEY_SCREATE 0x17c /* shifted create key */ +#define KEY_SDC 0x17d /* shifted delete char key */ +#define KEY_SDL 0x17e /* shifted delete line key */ +#define KEY_SELECT 0x17f /* select key */ +#define KEY_SEND 0x180 /* shifted end key */ +#define KEY_SEOL 0x181 /* shifted clear line key */ +#define KEY_SEXIT 0x182 /* shifted exit key */ +#define KEY_SFIND 0x183 /* shifted find key */ +#define KEY_SHOME 0x184 /* shifted home key */ +#define KEY_SIC 0x185 /* shifted input key */ + +#define KEY_SLEFT 0x187 /* shifted left arrow key */ +#define KEY_SMESSAGE 0x188 /* shifted message key */ +#define KEY_SMOVE 0x189 /* shifted move key */ +#define KEY_SNEXT 0x18a /* shifted next key */ +#define KEY_SOPTIONS 0x18b /* shifted options key */ +#define KEY_SPREVIOUS 0x18c /* shifted prev key */ +#define KEY_SPRINT 0x18d /* shifted print key */ +#define KEY_SREDO 0x18e /* shifted redo key */ +#define KEY_SREPLACE 0x18f /* shifted replace key */ +#define KEY_SRIGHT 0x190 /* shifted right arrow */ +#define KEY_SRSUME 0x191 /* shifted resume key */ +#define KEY_SSAVE 0x192 /* shifted save key */ +#define KEY_SSUSPEND 0x193 /* shifted suspend key */ +#define KEY_SUNDO 0x194 /* shifted undo key */ +#define KEY_SUSPEND 0x195 /* suspend key */ +#define KEY_UNDO 0x196 /* undo key */ + +/* PDCurses-specific key definitions -- PC only */ + +#define ALT_0 0x197 +#define ALT_1 0x198 +#define ALT_2 0x199 +#define ALT_3 0x19a +#define ALT_4 0x19b +#define ALT_5 0x19c +#define ALT_6 0x19d +#define ALT_7 0x19e +#define ALT_8 0x19f +#define ALT_9 0x1a0 +#define ALT_A 0x1a1 +#define ALT_B 0x1a2 +#define ALT_C 0x1a3 +#define ALT_D 0x1a4 +#define ALT_E 0x1a5 +#define ALT_F 0x1a6 +#define ALT_G 0x1a7 +#define ALT_H 0x1a8 +#define ALT_I 0x1a9 +#define ALT_J 0x1aa +#define ALT_K 0x1ab +#define ALT_L 0x1ac +#define ALT_M 0x1ad +#define ALT_N 0x1ae +#define ALT_O 0x1af +#define ALT_P 0x1b0 +#define ALT_Q 0x1b1 +#define ALT_R 0x1b2 +#define ALT_S 0x1b3 +#define ALT_T 0x1b4 +#define ALT_U 0x1b5 +#define ALT_V 0x1b6 +#define ALT_W 0x1b7 +#define ALT_X 0x1b8 +#define ALT_Y 0x1b9 +#define ALT_Z 0x1ba + +#define CTL_LEFT 0x1bb /* Control-Left-Arrow */ +#define CTL_RIGHT 0x1bc +#define CTL_PGUP 0x1bd +#define CTL_PGDN 0x1be +#define CTL_HOME 0x1bf +#define CTL_END 0x1c0 + +#define KEY_A1 0x1c1 /* upper left on Virtual keypad */ +#define KEY_A2 0x1c2 /* upper middle on Virt. keypad */ +#define KEY_A3 0x1c3 /* upper right on Vir. keypad */ +#define KEY_B1 0x1c4 /* middle left on Virt. keypad */ +#define KEY_B2 0x1c5 /* center on Virt. keypad */ +#define KEY_B3 0x1c6 /* middle right on Vir. keypad */ +#define KEY_C1 0x1c7 /* lower left on Virt. keypad */ +#define KEY_C2 0x1c8 /* lower middle on Virt. keypad */ +#define KEY_C3 0x1c9 /* lower right on Vir. keypad */ + +#define PADSLASH 0x1ca /* slash on keypad */ +#define PADENTER 0x1cb /* enter on keypad */ +#define CTL_PADENTER 0x1cc /* ctl-enter on keypad */ +#define ALT_PADENTER 0x1cd /* alt-enter on keypad */ +#define PADSTOP 0x1ce /* stop on keypad */ +#define PADSTAR 0x1cf /* star on keypad */ +#define PADMINUS 0x1d0 /* minus on keypad */ +#define PADPLUS 0x1d1 /* plus on keypad */ +#define CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */ +#define CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */ +#define CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */ +#define CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */ +#define CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */ +#define CTL_PADSTAR 0x1d7 /* ctl-star on keypad */ +#define ALT_PADPLUS 0x1d8 /* alt-plus on keypad */ +#define ALT_PADMINUS 0x1d9 /* alt-minus on keypad */ +#define ALT_PADSLASH 0x1da /* alt-slash on keypad */ +#define ALT_PADSTAR 0x1db /* alt-star on keypad */ +#define ALT_PADSTOP 0x1dc /* alt-stop on keypad */ +#define CTL_INS 0x1dd /* ctl-insert */ +#define ALT_DEL 0x1de /* alt-delete */ +#define ALT_INS 0x1df /* alt-insert */ +#define CTL_UP 0x1e0 /* ctl-up arrow */ +#define CTL_DOWN 0x1e1 /* ctl-down arrow */ +#define CTL_TAB 0x1e2 /* ctl-tab */ +#define ALT_TAB 0x1e3 +#define ALT_MINUS 0x1e4 +#define ALT_EQUAL 0x1e5 +#define ALT_HOME 0x1e6 +#define ALT_PGUP 0x1e7 +#define ALT_PGDN 0x1e8 +#define ALT_END 0x1e9 +#define ALT_UP 0x1ea /* alt-up arrow */ +#define ALT_DOWN 0x1eb /* alt-down arrow */ +#define ALT_RIGHT 0x1ec /* alt-right arrow */ +#define ALT_LEFT 0x1ed /* alt-left arrow */ +#define ALT_ENTER 0x1ee /* alt-enter */ +#define ALT_ESC 0x1ef /* alt-escape */ +#define ALT_BQUOTE 0x1f0 /* alt-back quote */ +#define ALT_LBRACKET 0x1f1 /* alt-left bracket */ +#define ALT_RBRACKET 0x1f2 /* alt-right bracket */ +#define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */ +#define ALT_FQUOTE 0x1f4 /* alt-forward quote */ +#define ALT_COMMA 0x1f5 /* alt-comma */ +#define ALT_STOP 0x1f6 /* alt-stop */ +#define ALT_FSLASH 0x1f7 /* alt-forward slash */ +#define ALT_BKSP 0x1f8 /* alt-backspace */ +#define CTL_BKSP 0x1f9 /* ctl-backspace */ +#define PAD0 0x1fa /* keypad 0 */ + +#define CTL_PAD0 0x1fb /* ctl-keypad 0 */ +#define CTL_PAD1 0x1fc +#define CTL_PAD2 0x1fd +#define CTL_PAD3 0x1fe +#define CTL_PAD4 0x1ff +#define CTL_PAD5 0x200 +#define CTL_PAD6 0x201 +#define CTL_PAD7 0x202 +#define CTL_PAD8 0x203 +#define CTL_PAD9 0x204 + +#define ALT_PAD0 0x205 /* alt-keypad 0 */ +#define ALT_PAD1 0x206 +#define ALT_PAD2 0x207 +#define ALT_PAD3 0x208 +#define ALT_PAD4 0x209 +#define ALT_PAD5 0x20a +#define ALT_PAD6 0x20b +#define ALT_PAD7 0x20c +#define ALT_PAD8 0x20d +#define ALT_PAD9 0x20e + +#define CTL_DEL 0x20f /* clt-delete */ +#define ALT_BSLASH 0x210 /* alt-back slash */ +#define CTL_ENTER 0x211 /* ctl-enter */ + +#define SHF_PADENTER 0x212 /* shift-enter on keypad */ +#define SHF_PADSLASH 0x213 /* shift-slash on keypad */ +#define SHF_PADSTAR 0x214 /* shift-star on keypad */ +#define SHF_PADPLUS 0x215 /* shift-plus on keypad */ +#define SHF_PADMINUS 0x216 /* shift-minus on keypad */ +#define SHF_UP 0x217 /* shift-up on keypad */ +#define SHF_DOWN 0x218 /* shift-down on keypad */ +#define SHF_IC 0x219 /* shift-insert on keypad */ +#define SHF_DC 0x21a /* shift-delete on keypad */ + +#define KEY_MOUSE 0x21b /* "mouse" key */ +#define KEY_SHIFT_L 0x21c /* Left-shift */ +#define KEY_SHIFT_R 0x21d /* Right-shift */ +#define KEY_CONTROL_L 0x21e /* Left-control */ +#define KEY_CONTROL_R 0x21f /* Right-control */ +#define KEY_ALT_L 0x220 /* Left-alt */ +#define KEY_ALT_R 0x221 /* Right-alt */ +#define KEY_RESIZE 0x222 /* Window resize */ +#define KEY_SUP 0x223 /* Shifted up arrow */ +#define KEY_SDOWN 0x224 /* Shifted down arrow */ + +#define KEY_MIN KEY_BREAK /* Minimum curses key value */ +#define KEY_MAX KEY_SDOWN /* Maximum curses key */ + +#define KEY_F(n) (KEY_F0 + (n)) + +/*---------------------------------------------------------------------- + * + * PDCurses Function Declarations + * + */ + +/* Standard */ + +int addch(const chtype); +int addchnstr(const chtype *, int); +int addchstr(const chtype *); +int addnstr(const char *, int); +int addstr(const char *); +int attroff(chtype); +int attron(chtype); +int attrset(chtype); +int attr_get(attr_t *, short *, void *); +int attr_off(attr_t, void *); +int attr_on(attr_t, void *); +int attr_set(attr_t, short, void *); +int baudrate(void); +int beep(void); +int bkgd(chtype); +void bkgdset(chtype); +int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype); +int box(WINDOW *, chtype, chtype); +bool can_change_color(void); +int cbreak(void); +int chgat(int, attr_t, short, const void *); +int clearok(WINDOW *, bool); +int clear(void); +int clrtobot(void); +int clrtoeol(void); +int color_content(short, short *, short *, short *); +int color_set(short, void *); +int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int); +int curs_set(int); +int def_prog_mode(void); +int def_shell_mode(void); +int delay_output(int); +int delch(void); +int deleteln(void); +void delscreen(SCREEN *); +int delwin(WINDOW *); +WINDOW *derwin(WINDOW *, int, int, int, int); +int doupdate(void); +WINDOW *dupwin(WINDOW *); +int echochar(const chtype); +int echo(void); +int endwin(void); +char erasechar(void); +int erase(void); +void filter(void); +int flash(void); +int flushinp(void); +chtype getbkgd(WINDOW *); +int getnstr(char *, int); +int getstr(char *); +WINDOW *getwin(FILE *); +int halfdelay(int); +bool has_colors(void); +bool has_ic(void); +bool has_il(void); +int hline(chtype, int); +void idcok(WINDOW *, bool); +int idlok(WINDOW *, bool); +void immedok(WINDOW *, bool); +int inchnstr(chtype *, int); +int inchstr(chtype *); +chtype inch(void); +int init_color(short, short, short, short); +int init_pair(short, short, short); +WINDOW *initscr(void); +int innstr(char *, int); +int insch(chtype); +int insdelln(int); +int insertln(void); +int insnstr(const char *, int); +int insstr(const char *); +int instr(char *); +int intrflush(WINDOW *, bool); +bool isendwin(void); +bool is_linetouched(WINDOW *, int); +bool is_wintouched(WINDOW *); +char *keyname(int); +int keypad(WINDOW *, bool); +char killchar(void); +int leaveok(WINDOW *, bool); +char *longname(void); +int meta(WINDOW *, bool); +int move(int, int); +int mvaddch(int, int, const chtype); +int mvaddchnstr(int, int, const chtype *, int); +int mvaddchstr(int, int, const chtype *); +int mvaddnstr(int, int, const char *, int); +int mvaddstr(int, int, const char *); +int mvchgat(int, int, int, attr_t, short, const void *); +int mvcur(int, int, int, int); +int mvdelch(int, int); +int mvderwin(WINDOW *, int, int); +int mvgetch(int, int); +int mvgetnstr(int, int, char *, int); +int mvgetstr(int, int, char *); +int mvhline(int, int, chtype, int); +chtype mvinch(int, int); +int mvinchnstr(int, int, chtype *, int); +int mvinchstr(int, int, chtype *); +int mvinnstr(int, int, char *, int); +int mvinsch(int, int, chtype); +int mvinsnstr(int, int, const char *, int); +int mvinsstr(int, int, const char *); +int mvinstr(int, int, char *); +int mvprintw(int, int, const char *, ...); +int mvscanw(int, int, const char *, ...); +int mvvline(int, int, chtype, int); +int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); +int mvwaddchstr(WINDOW *, int, int, const chtype *); +int mvwaddch(WINDOW *, int, int, const chtype); +int mvwaddnstr(WINDOW *, int, int, const char *, int); +int mvwaddstr(WINDOW *, int, int, const char *); +int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); +int mvwdelch(WINDOW *, int, int); +int mvwgetch(WINDOW *, int, int); +int mvwgetnstr(WINDOW *, int, int, char *, int); +int mvwgetstr(WINDOW *, int, int, char *); +int mvwhline(WINDOW *, int, int, chtype, int); +int mvwinchnstr(WINDOW *, int, int, chtype *, int); +int mvwinchstr(WINDOW *, int, int, chtype *); +chtype mvwinch(WINDOW *, int, int); +int mvwinnstr(WINDOW *, int, int, char *, int); +int mvwinsch(WINDOW *, int, int, chtype); +int mvwinsnstr(WINDOW *, int, int, const char *, int); +int mvwinsstr(WINDOW *, int, int, const char *); +int mvwinstr(WINDOW *, int, int, char *); +int mvwin(WINDOW *, int, int); +int mvwprintw(WINDOW *, int, int, const char *, ...); +int mvwscanw(WINDOW *, int, int, const char *, ...); +int mvwvline(WINDOW *, int, int, chtype, int); +int napms(int); +WINDOW *newpad(int, int); +SCREEN *newterm(const char *, FILE *, FILE *); +WINDOW *newwin(int, int, int, int); +int nl(void); +int nocbreak(void); +int nodelay(WINDOW *, bool); +int noecho(void); +int nonl(void); +void noqiflush(void); +int noraw(void); +int notimeout(WINDOW *, bool); +int overlay(const WINDOW *, WINDOW *); +int overwrite(const WINDOW *, WINDOW *); +int pair_content(short, short *, short *); +int pechochar(WINDOW *, chtype); +int pnoutrefresh(WINDOW *, int, int, int, int, int, int); +int prefresh(WINDOW *, int, int, int, int, int, int); +int printw(const char *, ...); +int putwin(WINDOW *, FILE *); +void qiflush(void); +int raw(void); +int redrawwin(WINDOW *); +int refresh(void); +int reset_prog_mode(void); +int reset_shell_mode(void); +int resetty(void); +int ripoffline(int, int (*)(WINDOW *, int)); +int savetty(void); +int scanw(const char *, ...); +int scr_dump(const char *); +int scr_init(const char *); +int scr_restore(const char *); +int scr_set(const char *); +int scrl(int); +int scroll(WINDOW *); +int scrollok(WINDOW *, bool); +SCREEN *set_term(SCREEN *); +int setscrreg(int, int); +int slk_attroff(const chtype); +int slk_attr_off(const attr_t, void *); +int slk_attron(const chtype); +int slk_attr_on(const attr_t, void *); +int slk_attrset(const chtype); +int slk_attr_set(const attr_t, short, void *); +int slk_clear(void); +int slk_color(short); +int slk_init(int); +char *slk_label(int); +int slk_noutrefresh(void); +int slk_refresh(void); +int slk_restore(void); +int slk_set(int, const char *, int); +int slk_touch(void); +int standend(void); +int standout(void); +int start_color(void); +WINDOW *subpad(WINDOW *, int, int, int, int); +WINDOW *subwin(WINDOW *, int, int, int, int); +int syncok(WINDOW *, bool); +chtype termattrs(void); +attr_t term_attrs(void); +char *termname(void); +void timeout(int); +int touchline(WINDOW *, int, int); +int touchwin(WINDOW *); +int typeahead(int); +int untouchwin(WINDOW *); +void use_env(bool); +int vidattr(chtype); +int vid_attr(attr_t, short, void *); +int vidputs(chtype, int (*)(int)); +int vid_puts(attr_t, short, void *, int (*)(int)); +int vline(chtype, int); +int vw_printw(WINDOW *, const char *, va_list); +int vwprintw(WINDOW *, const char *, va_list); +int vw_scanw(WINDOW *, const char *, va_list); +int vwscanw(WINDOW *, const char *, va_list); +int waddchnstr(WINDOW *, const chtype *, int); +int waddchstr(WINDOW *, const chtype *); +int waddch(WINDOW *, const chtype); +int waddnstr(WINDOW *, const char *, int); +int waddstr(WINDOW *, const char *); +int wattroff(WINDOW *, chtype); +int wattron(WINDOW *, chtype); +int wattrset(WINDOW *, chtype); +int wattr_get(WINDOW *, attr_t *, short *, void *); +int wattr_off(WINDOW *, attr_t, void *); +int wattr_on(WINDOW *, attr_t, void *); +int wattr_set(WINDOW *, attr_t, short, void *); +void wbkgdset(WINDOW *, chtype); +int wbkgd(WINDOW *, chtype); +int wborder(WINDOW *, chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +int wchgat(WINDOW *, int, attr_t, short, const void *); +int wclear(WINDOW *); +int wclrtobot(WINDOW *); +int wclrtoeol(WINDOW *); +int wcolor_set(WINDOW *, short, void *); +void wcursyncup(WINDOW *); +int wdelch(WINDOW *); +int wdeleteln(WINDOW *); +int wechochar(WINDOW *, const chtype); +int werase(WINDOW *); +int wgetch(WINDOW *); +int wgetnstr(WINDOW *, char *, int); +int wgetstr(WINDOW *, char *); +int whline(WINDOW *, chtype, int); +int winchnstr(WINDOW *, chtype *, int); +int winchstr(WINDOW *, chtype *); +chtype winch(WINDOW *); +int winnstr(WINDOW *, char *, int); +int winsch(WINDOW *, chtype); +int winsdelln(WINDOW *, int); +int winsertln(WINDOW *); +int winsnstr(WINDOW *, const char *, int); +int winsstr(WINDOW *, const char *); +int winstr(WINDOW *, char *); +int wmove(WINDOW *, int, int); +int wnoutrefresh(WINDOW *); +int wprintw(WINDOW *, const char *, ...); +int wredrawln(WINDOW *, int, int); +int wrefresh(WINDOW *); +int wscanw(WINDOW *, const char *, ...); +int wscrl(WINDOW *, int); +int wsetscrreg(WINDOW *, int, int); +int wstandend(WINDOW *); +int wstandout(WINDOW *); +void wsyncdown(WINDOW *); +void wsyncup(WINDOW *); +void wtimeout(WINDOW *, int); +int wtouchln(WINDOW *, int, int, int); +int wvline(WINDOW *, chtype, int); + +/* Wide-character functions */ + +#ifdef PDC_WIDE +int addnwstr(const wchar_t *, int); +int addwstr(const wchar_t *); +int add_wch(const cchar_t *); +int add_wchnstr(const cchar_t *, int); +int add_wchstr(const cchar_t *); +int border_set(const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *); +int box_set(WINDOW *, const cchar_t *, const cchar_t *); +int echo_wchar(const cchar_t *); +int erasewchar(wchar_t *); +int getbkgrnd(cchar_t *); +int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); +int getn_wstr(wint_t *, int); +int get_wch(wint_t *); +int get_wstr(wint_t *); +int hline_set(const cchar_t *, int); +int innwstr(wchar_t *, int); +int ins_nwstr(const wchar_t *, int); +int ins_wch(const cchar_t *); +int ins_wstr(const wchar_t *); +int inwstr(wchar_t *); +int in_wch(cchar_t *); +int in_wchnstr(cchar_t *, int); +int in_wchstr(cchar_t *); +char *key_name(wchar_t); +int killwchar(wchar_t *); +int mvaddnwstr(int, int, const wchar_t *, int); +int mvaddwstr(int, int, const wchar_t *); +int mvadd_wch(int, int, const cchar_t *); +int mvadd_wchnstr(int, int, const cchar_t *, int); +int mvadd_wchstr(int, int, const cchar_t *); +int mvgetn_wstr(int, int, wint_t *, int); +int mvget_wch(int, int, wint_t *); +int mvget_wstr(int, int, wint_t *); +int mvhline_set(int, int, const cchar_t *, int); +int mvinnwstr(int, int, wchar_t *, int); +int mvins_nwstr(int, int, const wchar_t *, int); +int mvins_wch(int, int, const cchar_t *); +int mvins_wstr(int, int, const wchar_t *); +int mvinwstr(int, int, wchar_t *); +int mvin_wch(int, int, cchar_t *); +int mvin_wchnstr(int, int, cchar_t *, int); +int mvin_wchstr(int, int, cchar_t *); +int mvvline_set(int, int, const cchar_t *, int); +int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); +int mvwaddwstr(WINDOW *, int, int, const wchar_t *); +int mvwadd_wch(WINDOW *, int, int, const cchar_t *); +int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); +int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); +int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int); +int mvwget_wch(WINDOW *, int, int, wint_t *); +int mvwget_wstr(WINDOW *, int, int, wint_t *); +int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); +int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); +int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); +int mvwins_wch(WINDOW *, int, int, const cchar_t *); +int mvwins_wstr(WINDOW *, int, int, const wchar_t *); +int mvwin_wch(WINDOW *, int, int, cchar_t *); +int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); +int mvwin_wchstr(WINDOW *, int, int, cchar_t *); +int mvwinwstr(WINDOW *, int, int, wchar_t *); +int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); +int pecho_wchar(WINDOW *, const cchar_t*); +int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*); +int slk_wset(int, const wchar_t *, int); +int unget_wch(const wchar_t); +int vline_set(const cchar_t *, int); +int waddnwstr(WINDOW *, const wchar_t *, int); +int waddwstr(WINDOW *, const wchar_t *); +int wadd_wch(WINDOW *, const cchar_t *); +int wadd_wchnstr(WINDOW *, const cchar_t *, int); +int wadd_wchstr(WINDOW *, const cchar_t *); +int wbkgrnd(WINDOW *, const cchar_t *); +void wbkgrndset(WINDOW *, const cchar_t *); +int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *); +int wecho_wchar(WINDOW *, const cchar_t *); +int wgetbkgrnd(WINDOW *, cchar_t *); +int wgetn_wstr(WINDOW *, wint_t *, int); +int wget_wch(WINDOW *, wint_t *); +int wget_wstr(WINDOW *, wint_t *); +int whline_set(WINDOW *, const cchar_t *, int); +int winnwstr(WINDOW *, wchar_t *, int); +int wins_nwstr(WINDOW *, const wchar_t *, int); +int wins_wch(WINDOW *, const cchar_t *); +int wins_wstr(WINDOW *, const wchar_t *); +int winwstr(WINDOW *, wchar_t *); +int win_wch(WINDOW *, cchar_t *); +int win_wchnstr(WINDOW *, cchar_t *, int); +int win_wchstr(WINDOW *, cchar_t *); +wchar_t *wunctrl(cchar_t *); +int wvline_set(WINDOW *, const cchar_t *, int); +#endif + +/* Quasi-standard */ + +chtype getattrs(WINDOW *); +int getbegx(WINDOW *); +int getbegy(WINDOW *); +int getmaxx(WINDOW *); +int getmaxy(WINDOW *); +int getparx(WINDOW *); +int getpary(WINDOW *); +int getcurx(WINDOW *); +int getcury(WINDOW *); +void traceoff(void); +void traceon(void); +char *unctrl(chtype); + +int crmode(void); +int nocrmode(void); +int draino(int); +int resetterm(void); +int fixterm(void); +int saveterm(void); +int setsyx(int, int); + +int mouse_set(unsigned long); +int mouse_on(unsigned long); +int mouse_off(unsigned long); +int request_mouse_pos(void); +int map_button(unsigned long); +void wmouse_position(WINDOW *, int *, int *); +unsigned long getmouse(void); +unsigned long getbmap(void); + +/* ncurses */ + +int assume_default_colors(int, int); +const char *curses_version(void); +bool has_key(int); +int use_default_colors(void); +int wresize(WINDOW *, int, int); + +int mouseinterval(int); +mmask_t mousemask(mmask_t, mmask_t *); +bool mouse_trafo(int *, int *, bool); +int nc_getmouse(MEVENT *); +int ungetmouse(MEVENT *); +bool wenclose(const WINDOW *, int, int); +bool wmouse_trafo(const WINDOW *, int *, int *, bool); + +/* PDCurses */ + +int addrawch(chtype); +int insrawch(chtype); +bool is_termresized(void); +int mvaddrawch(int, int, chtype); +int mvdeleteln(int, int); +int mvinsertln(int, int); +int mvinsrawch(int, int, chtype); +int mvwaddrawch(WINDOW *, int, int, chtype); +int mvwdeleteln(WINDOW *, int, int); +int mvwinsertln(WINDOW *, int, int); +int mvwinsrawch(WINDOW *, int, int, chtype); +int raw_output(bool); +int resize_term(int, int); +WINDOW *resize_window(WINDOW *, int, int); +int waddrawch(WINDOW *, chtype); +int winsrawch(WINDOW *, chtype); +char wordchar(void); + +#ifdef PDC_WIDE +wchar_t *slk_wlabel(int); +#endif + +void PDC_debug(const char *, ...); +int PDC_ungetch(int); +int PDC_set_blink(bool); +int PDC_set_line_color(short); +void PDC_set_title(const char *); + +int PDC_clearclipboard(void); +int PDC_freeclipboard(char *); +int PDC_getclipboard(char **, long *); +int PDC_setclipboard(const char *, long); + +unsigned long PDC_get_input_fd(void); +unsigned long PDC_get_key_modifiers(void); +int PDC_return_key_modifiers(bool); +int PDC_save_key_modifiers(bool); + +#ifdef XCURSES +WINDOW *Xinitscr(int, char **); +void XCursesExit(void); +int sb_init(void); +int sb_set_horz(int, int, int); +int sb_set_vert(int, int, int); +int sb_get_horz(int *, int *, int *); +int sb_get_vert(int *, int *, int *); +int sb_refresh(void); +#endif + +/*** Functions defined as macros ***/ + +/* getch() and ungetch() conflict with some DOS libraries */ + +#define getch() wgetch(stdscr) +#define ungetch(ch) PDC_ungetch(ch) + +#define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR) +#define PAIR_NUMBER(n) (((n) & A_COLOR) >> PDC_COLOR_SHIFT) + +/* These will _only_ work as macros */ + +#define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w)) +#define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w)) +#define getparyx(w, y, x) (y = getpary(w), x = getparx(w)) +#define getyx(w, y, x) (y = getcury(w), x = getcurx(w)) + +#define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \ + else getyx(curscr,(y),(x)); } + +#ifdef NCURSES_MOUSE_VERSION +# define getmouse(x) nc_getmouse(x) +#endif + +/* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ + +#define PDC_CLIP_SUCCESS 0 +#define PDC_CLIP_ACCESS_ERROR 1 +#define PDC_CLIP_EMPTY 2 +#define PDC_CLIP_MEMORY_ERROR 3 + +/* PDCurses key modifier masks */ + +#define PDC_KEY_MODIFIER_SHIFT 1 +#define PDC_KEY_MODIFIER_CONTROL 2 +#define PDC_KEY_MODIFIER_ALT 4 +#define PDC_KEY_MODIFIER_NUMLOCK 8 + +#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) +# undef bool +} +#endif + +#endif /* __PDCURSES__ */ diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/win32/zconf.h b/code/utilities/CPAT-1.2.2/lib/samtools/win32/zconf.h new file mode 100755 index 0000000..03a9431 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/win32/zconf.h @@ -0,0 +1,332 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/samtools/win32/zlib.h b/code/utilities/CPAT-1.2.2/lib/samtools/win32/zlib.h new file mode 100755 index 0000000..0228179 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/samtools/win32/zlib.h @@ -0,0 +1,1357 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/bam_endian.h b/code/utilities/CPAT-1.2.2/lib/tabix/bam_endian.h new file mode 100755 index 0000000..0fc74a8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/bam_endian.h @@ -0,0 +1,42 @@ +#ifndef BAM_ENDIAN_H +#define BAM_ENDIAN_H + +#include + +static inline int bam_is_big_endian() +{ + long one= 1; + return !(*((char *)(&one))); +} +static inline uint16_t bam_swap_endian_2(uint16_t v) +{ + return (uint16_t)(((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8)); +} +static inline void *bam_swap_endian_2p(void *x) +{ + *(uint16_t*)x = bam_swap_endian_2(*(uint16_t*)x); + return x; +} +static inline uint32_t bam_swap_endian_4(uint32_t v) +{ + v = ((v & 0x0000FFFFU) << 16) | (v >> 16); + return ((v & 0x00FF00FFU) << 8) | ((v & 0xFF00FF00U) >> 8); +} +static inline void *bam_swap_endian_4p(void *x) +{ + *(uint32_t*)x = bam_swap_endian_4(*(uint32_t*)x); + return x; +} +static inline uint64_t bam_swap_endian_8(uint64_t v) +{ + v = ((v & 0x00000000FFFFFFFFLLU) << 32) | (v >> 32); + v = ((v & 0x0000FFFF0000FFFFLLU) << 16) | ((v & 0xFFFF0000FFFF0000LLU) >> 16); + return ((v & 0x00FF00FF00FF00FFLLU) << 8) | ((v & 0xFF00FF00FF00FF00LLU) >> 8); +} +static inline void *bam_swap_endian_8p(void *x) +{ + *(uint64_t*)x = bam_swap_endian_8(*(uint64_t*)x); + return x; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/bedidx.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/bedidx.c.pysam.c new file mode 100755 index 0000000..c3ab06f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/bedidx.c.pysam.c @@ -0,0 +1,158 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include + +#include "ksort.h" +KSORT_INIT_GENERIC(uint64_t) + +#include "kseq.h" +KSTREAM_INIT(gzFile, gzread, 8192) + +typedef struct { + int n, m; + uint64_t *a; + int *idx; +} bed_reglist_t; + +#include "khash.h" +KHASH_MAP_INIT_STR(reg, bed_reglist_t) + +#define LIDX_SHIFT 13 + +typedef kh_reg_t reghash_t; + +int *bed_index_core(int n, uint64_t *a, int *n_idx) +{ + int i, j, m, *idx; + m = *n_idx = 0; idx = 0; + for (i = 0; i < n; ++i) { + int beg, end; + beg = a[i]>>32 >> LIDX_SHIFT; end = ((uint32_t)a[i]) >> LIDX_SHIFT; + if (m < end + 1) { + int oldm = m; + m = end + 1; + kroundup32(m); + idx = realloc(idx, m * sizeof(int)); + for (j = oldm; j < m; ++j) idx[j] = -1; + } + if (beg == end) { + if (idx[beg] < 0) idx[beg] = i; + } else { + for (j = beg; j <= end; ++j) + if (idx[j] < 0) idx[j] = i; + } + *n_idx = end + 1; + } + return idx; +} + +void bed_index(void *_h) +{ + reghash_t *h = (reghash_t*)_h; + khint_t k; + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + bed_reglist_t *p = &kh_val(h, k); + if (p->idx) free(p->idx); + ks_introsort(uint64_t, p->n, p->a); + p->idx = bed_index_core(p->n, p->a, &p->m); + } + } +} + +int bed_overlap_core(const bed_reglist_t *p, int beg, int end) +{ + int i, min_off; + if (p->n == 0) return 0; + min_off = (beg>>LIDX_SHIFT >= p->n)? p->idx[p->n-1] : p->idx[beg>>LIDX_SHIFT]; + if (min_off < 0) { // TODO: this block can be improved, but speed should not matter too much here + int n = beg>>LIDX_SHIFT; + if (n > p->n) n = p->n; + for (i = n - 1; i >= 0; --i) + if (p->idx[i] >= 0) break; + min_off = i >= 0? p->idx[i] : 0; + } + for (i = min_off; i < p->n; ++i) { + if ((int)(p->a[i]>>32) >= end) break; // out of range; no need to proceed + if ((int32_t)p->a[i] > beg && (int32_t)(p->a[i]>>32) < end) + return 1; // find the overlap; return + } + return 0; +} + +int bed_overlap(const void *_h, const char *chr, int beg, int end) +{ + const reghash_t *h = (const reghash_t*)_h; + khint_t k; + if (!h) return 0; + k = kh_get(reg, h, chr); + if (k == kh_end(h)) return 0; + return bed_overlap_core(&kh_val(h, k), beg, end); +} + +void *bed_read(const char *fn) +{ + reghash_t *h = kh_init(reg); + gzFile fp; + kstream_t *ks; + int dret; + kstring_t *str; + // read the list + fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r"); + if (fp == 0) return 0; + str = calloc(1, sizeof(kstring_t)); + ks = ks_init(fp); + while (ks_getuntil(ks, 0, str, &dret) >= 0) { // read the chr name + int beg = -1, end = -1; + bed_reglist_t *p; + khint_t k = kh_get(reg, h, str->s); + if (k == kh_end(h)) { // absent from the hash table + int ret; + char *s = strdup(str->s); + k = kh_put(reg, h, s, &ret); + memset(&kh_val(h, k), 0, sizeof(bed_reglist_t)); + } + p = &kh_val(h, k); + if (dret != '\n') { // if the lines has other characters + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { + beg = atoi(str->s); // begin + if (dret != '\n') { + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) + end = atoi(str->s); // end + } + } + } + if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n'); // skip the rest of the line + if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column + if (beg >= 0 && end > beg) { + if (p->n == p->m) { + p->m = p->m? p->m<<1 : 4; + p->a = realloc(p->a, p->m * 8); + } + p->a[p->n++] = (uint64_t)beg<<32 | end; + } + } + ks_destroy(ks); + gzclose(fp); + free(str->s); free(str); + bed_index(h); + return h; +} + +void bed_destroy(void *_h) +{ + reghash_t *h = (reghash_t*)_h; + khint_t k; + for (k = 0; k < kh_end(h); ++k) { + if (kh_exist(h, k)) { + free(kh_val(h, k).a); + free(kh_val(h, k).idx); + free((char*)kh_key(h, k)); + } + } + kh_destroy(reg, h); +} diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.c.pysam.c new file mode 100755 index 0000000..067b89d --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.c.pysam.c @@ -0,0 +1,716 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +/* + 2009-06-29 by lh3: cache recent uncompressed blocks. + 2009-06-25 by lh3: optionally use my knetfile library to access file on a FTP. + 2009-06-12 by lh3: support a mode string like "wu" where 'u' for uncompressed output */ + +#include +#include +#include +#include +#include +#include +#include +#include "bgzf.h" + +#include "khash.h" +typedef struct { + int size; + uint8_t *block; + int64_t end_offset; +} cache_t; +KHASH_MAP_INIT_INT64(cache, cache_t) + +#if defined(_WIN32) || defined(_MSC_VER) +#define ftello(fp) ftell(fp) +#define fseeko(fp, offset, whence) fseek(fp, offset, whence) +#else +extern off_t ftello(FILE *stream); +extern int fseeko(FILE *stream, off_t offset, int whence); +#endif + +typedef int8_t bgzf_byte_t; + +static const int DEFAULT_BLOCK_SIZE = 64 * 1024; +static const int MAX_BLOCK_SIZE = 64 * 1024; + +static const int BLOCK_HEADER_LENGTH = 18; +static const int BLOCK_FOOTER_LENGTH = 8; + +static const int GZIP_ID1 = 31; +static const int GZIP_ID2 = 139; +static const int CM_DEFLATE = 8; +static const int FLG_FEXTRA = 4; +static const int OS_UNKNOWN = 255; +static const int BGZF_ID1 = 66; // 'B' +static const int BGZF_ID2 = 67; // 'C' +static const int BGZF_LEN = 2; +static const int BGZF_XLEN = 6; // BGZF_LEN+4 + +static const int GZIP_WINDOW_BITS = -15; // no zlib header +static const int Z_DEFAULT_MEM_LEVEL = 8; + + +inline +void +packInt16(uint8_t* buffer, uint16_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; +} + +inline +int +unpackInt16(const uint8_t* buffer) +{ + return (buffer[0] | (buffer[1] << 8)); +} + +inline +void +packInt32(uint8_t* buffer, uint32_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; + buffer[2] = value >> 16; + buffer[3] = value >> 24; +} + +static inline +int +bgzf_min(int x, int y) +{ + return (x < y) ? x : y; +} + +static +void +report_error(BGZF* fp, const char* message) { + fp->error = message; +} + +int bgzf_check_bgzf(const char *fn) +{ + BGZF *fp; + uint8_t buf[10],magic[10]="\037\213\010\4\0\0\0\0\0\377"; + int n; + + if ((fp = bgzf_open(fn, "r")) == 0) + { + fprintf(pysamerr, "[bgzf_check_bgzf] failed to open the file: %s\n",fn); + return -1; + } + +#ifdef _USE_KNETFILE + n = knet_read(fp->x.fpr, buf, 10); +#else + n = fread(buf, 1, 10, fp->file); +#endif + bgzf_close(fp); + + if ( n!=10 ) + return -1; + + if ( !memcmp(magic, buf, 10) ) return 1; + return 0; +} + +static BGZF *bgzf_read_init() +{ + BGZF *fp; + fp = calloc(1, sizeof(BGZF)); + fp->uncompressed_block_size = MAX_BLOCK_SIZE; + fp->uncompressed_block = malloc(MAX_BLOCK_SIZE); + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->cache_size = 0; + fp->cache = kh_init(cache); + return fp; +} + +static +BGZF* +open_read(int fd) +{ +#ifdef _USE_KNETFILE + knetFile *file = knet_dopen(fd, "r"); +#else + FILE* file = fdopen(fd, "r"); +#endif + BGZF* fp; + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = fd; + fp->open_mode = 'r'; +#ifdef _USE_KNETFILE + fp->x.fpr = file; +#else + fp->file = file; +#endif + return fp; +} + +static +BGZF* +open_write(int fd, int compress_level) // compress_level==-1 for the default level +{ + FILE* file = fdopen(fd, "w"); + BGZF* fp; + if (file == 0) return 0; + fp = malloc(sizeof(BGZF)); + fp->file_descriptor = fd; + fp->open_mode = 'w'; + fp->owned_file = 0; + fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1 + if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION; +#ifdef _USE_KNETFILE + fp->x.fpw = file; +#else + fp->file = file; +#endif + fp->uncompressed_block_size = DEFAULT_BLOCK_SIZE; + fp->uncompressed_block = NULL; + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->block_address = 0; + fp->block_offset = 0; + fp->block_length = 0; + fp->error = NULL; + return fp; +} + +BGZF* +bgzf_open(const char* __restrict path, const char* __restrict mode) +{ + BGZF* fp = NULL; + if (strchr(mode, 'r') || strchr(mode, 'R')) { /* The reading mode is preferred. */ +#ifdef _USE_KNETFILE + knetFile *file = knet_open(path, mode); + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = -1; + fp->open_mode = 'r'; + fp->x.fpr = file; +#else + int fd, oflag = O_RDONLY; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag); + if (fd == -1) return 0; + fp = open_read(fd); +#endif + } else if (strchr(mode, 'w') || strchr(mode, 'W')) { + int fd, compress_level = -1, oflag = O_WRONLY | O_CREAT | O_TRUNC; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag, 0666); + if (fd == -1) return 0; + { // set compress_level + int i; + for (i = 0; mode[i]; ++i) + if (mode[i] >= '0' && mode[i] <= '9') break; + if (mode[i]) compress_level = (int)mode[i] - '0'; + if (strchr(mode, 'u')) compress_level = 0; + } + fp = open_write(fd, compress_level); + } + if (fp != NULL) fp->owned_file = 1; + return fp; +} + +BGZF* +bgzf_fdopen(int fd, const char * __restrict mode) +{ + if (fd == -1) return 0; + if (mode[0] == 'r' || mode[0] == 'R') { + return open_read(fd); + } else if (mode[0] == 'w' || mode[0] == 'W') { + int i, compress_level = -1; + for (i = 0; mode[i]; ++i) + if (mode[i] >= '0' && mode[i] <= '9') break; + if (mode[i]) compress_level = (int)mode[i] - '0'; + if (strchr(mode, 'u')) compress_level = 0; + return open_write(fd, compress_level); + } else { + return NULL; + } +} + +static +int +deflate_block(BGZF* fp, int block_length) +{ + // Deflate the block in fp->uncompressed_block into fp->compressed_block. + // Also adds an extra field that stores the compressed block length. + + bgzf_byte_t* buffer = fp->compressed_block; + int buffer_size = fp->compressed_block_size; + + // Init gzip header + buffer[0] = GZIP_ID1; + buffer[1] = GZIP_ID2; + buffer[2] = CM_DEFLATE; + buffer[3] = FLG_FEXTRA; + buffer[4] = 0; // mtime + buffer[5] = 0; + buffer[6] = 0; + buffer[7] = 0; + buffer[8] = 0; + buffer[9] = OS_UNKNOWN; + buffer[10] = BGZF_XLEN; + buffer[11] = 0; + buffer[12] = BGZF_ID1; + buffer[13] = BGZF_ID2; + buffer[14] = BGZF_LEN; + buffer[15] = 0; + buffer[16] = 0; // placeholder for block length + buffer[17] = 0; + + // loop to retry for blocks that do not compress enough + int input_length = block_length; + int compressed_length = 0; + while (1) { + z_stream zs; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->uncompressed_block; + zs.avail_in = input_length; + zs.next_out = (void*)&buffer[BLOCK_HEADER_LENGTH]; + zs.avail_out = buffer_size - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH; + + int status = deflateInit2(&zs, fp->compress_level, Z_DEFLATED, + GZIP_WINDOW_BITS, Z_DEFAULT_MEM_LEVEL, Z_DEFAULT_STRATEGY); + if (status != Z_OK) { + report_error(fp, "deflate init failed"); + return -1; + } + status = deflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + deflateEnd(&zs); + if (status == Z_OK) { + // Not enough space in buffer. + // Can happen in the rare case the input doesn't compress enough. + // Reduce the amount of input until it fits. + input_length -= 1024; + if (input_length <= 0) { + // should never happen + report_error(fp, "input reduction failed"); + return -1; + } + continue; + } + report_error(fp, "deflate failed"); + return -1; + } + status = deflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "deflate end failed"); + return -1; + } + compressed_length = zs.total_out; + compressed_length += BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH; + if (compressed_length > MAX_BLOCK_SIZE) { + // should never happen + report_error(fp, "deflate overflow"); + return -1; + } + break; + } + + packInt16((uint8_t*)&buffer[16], compressed_length-1); + uint32_t crc = crc32(0L, NULL, 0L); + crc = crc32(crc, fp->uncompressed_block, input_length); + packInt32((uint8_t*)&buffer[compressed_length-8], crc); + packInt32((uint8_t*)&buffer[compressed_length-4], input_length); + + int remaining = block_length - input_length; + if (remaining > 0) { + if (remaining > input_length) { + // should never happen (check so we can use memcpy) + report_error(fp, "remainder too large"); + return -1; + } + memcpy(fp->uncompressed_block, + fp->uncompressed_block + input_length, + remaining); + } + fp->block_offset = remaining; + return compressed_length; +} + +static +int +inflate_block(BGZF* fp, int block_length) +{ + // Inflate the block in fp->compressed_block into fp->uncompressed_block + + z_stream zs; + int status; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->compressed_block + 18; + zs.avail_in = block_length - 16; + zs.next_out = fp->uncompressed_block; + zs.avail_out = fp->uncompressed_block_size; + + status = inflateInit2(&zs, GZIP_WINDOW_BITS); + if (status != Z_OK) { + report_error(fp, "inflate init failed"); + return -1; + } + status = inflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + inflateEnd(&zs); + report_error(fp, "inflate failed"); + return -1; + } + status = inflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "inflate failed"); + return -1; + } + return zs.total_out; +} + +static +int +check_header(const bgzf_byte_t* header) +{ + return (header[0] == GZIP_ID1 && + header[1] == (bgzf_byte_t) GZIP_ID2 && + header[2] == Z_DEFLATED && + (header[3] & FLG_FEXTRA) != 0 && + unpackInt16((uint8_t*)&header[10]) == BGZF_XLEN && + header[12] == BGZF_ID1 && + header[13] == BGZF_ID2 && + unpackInt16((uint8_t*)&header[14]) == BGZF_LEN); +} + +static void free_cache(BGZF *fp) +{ + khint_t k; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (fp->open_mode != 'r') return; + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) free(kh_val(h, k).block); + kh_destroy(cache, h); +} + +static int load_block_from_cache(BGZF *fp, int64_t block_address) +{ + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + k = kh_get(cache, h, block_address); + if (k == kh_end(h)) return 0; + p = &kh_val(h, k); + if (fp->block_length != 0) fp->block_offset = 0; + fp->block_address = block_address; + fp->block_length = p->size; + memcpy(fp->uncompressed_block, p->block, MAX_BLOCK_SIZE); +#ifdef _USE_KNETFILE + knet_seek(fp->x.fpr, p->end_offset, SEEK_SET); +#else + fseeko(fp->file, p->end_offset, SEEK_SET); +#endif + return p->size; +} + +static void cache_block(BGZF *fp, int size) +{ + int ret; + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (MAX_BLOCK_SIZE >= fp->cache_size) return; + if ((kh_size(h) + 1) * MAX_BLOCK_SIZE > fp->cache_size) { + /* A better way would be to remove the oldest block in the + * cache, but here we remove a random one for simplicity. This + * should not have a big impact on performance. */ + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) break; + if (k < kh_end(h)) { + free(kh_val(h, k).block); + kh_del(cache, h, k); + } + } + k = kh_put(cache, h, fp->block_address, &ret); + if (ret == 0) return; // if this happens, a bug! + p = &kh_val(h, k); + p->size = fp->block_length; + p->end_offset = fp->block_address + size; + p->block = malloc(MAX_BLOCK_SIZE); + memcpy(kh_val(h, k).block, fp->uncompressed_block, MAX_BLOCK_SIZE); +} + +int +bgzf_read_block(BGZF* fp) +{ + bgzf_byte_t header[BLOCK_HEADER_LENGTH]; + int count, size = 0, block_length, remaining; +#ifdef _USE_KNETFILE + int64_t block_address = knet_tell(fp->x.fpr); + if (load_block_from_cache(fp, block_address)) return 0; + count = knet_read(fp->x.fpr, header, sizeof(header)); +#else + int64_t block_address = ftello(fp->file); + if (load_block_from_cache(fp, block_address)) return 0; + count = fread(header, 1, sizeof(header), fp->file); +#endif + if (count == 0) { + fp->block_length = 0; + return 0; + } + size = count; + if (count != sizeof(header)) { + report_error(fp, "read failed"); + return -1; + } + if (!check_header(header)) { + report_error(fp, "invalid block header"); + return -1; + } + block_length = unpackInt16((uint8_t*)&header[16]) + 1; + bgzf_byte_t* compressed_block = (bgzf_byte_t*) fp->compressed_block; + memcpy(compressed_block, header, BLOCK_HEADER_LENGTH); + remaining = block_length - BLOCK_HEADER_LENGTH; +#ifdef _USE_KNETFILE + count = knet_read(fp->x.fpr, &compressed_block[BLOCK_HEADER_LENGTH], remaining); +#else + count = fread(&compressed_block[BLOCK_HEADER_LENGTH], 1, remaining, fp->file); +#endif + if (count != remaining) { + report_error(fp, "read failed"); + return -1; + } + size += count; + count = inflate_block(fp, block_length); + if (count < 0) return -1; + if (fp->block_length != 0) { + // Do not reset offset if this read follows a seek. + fp->block_offset = 0; + } + fp->block_address = block_address; + fp->block_length = count; + cache_block(fp, size); + return 0; +} + +int +bgzf_read(BGZF* fp, void* data, int length) +{ + if (length <= 0) { + return 0; + } + if (fp->open_mode != 'r') { + report_error(fp, "file not open for reading"); + return -1; + } + + int bytes_read = 0; + bgzf_byte_t* output = data; + while (bytes_read < length) { + int copy_length, available = fp->block_length - fp->block_offset; + bgzf_byte_t *buffer; + if (available <= 0) { + if (bgzf_read_block(fp) != 0) { + return -1; + } + available = fp->block_length - fp->block_offset; + if (available <= 0) { + break; + } + } + copy_length = bgzf_min(length-bytes_read, available); + buffer = fp->uncompressed_block; + memcpy(output, buffer + fp->block_offset, copy_length); + fp->block_offset += copy_length; + output += copy_length; + bytes_read += copy_length; + } + if (fp->block_offset == fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + return bytes_read; +} + +int bgzf_flush(BGZF* fp) +{ + while (fp->block_offset > 0) { + int count, block_length; + block_length = deflate_block(fp, fp->block_offset); + if (block_length < 0) return -1; +#ifdef _USE_KNETFILE + count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + if (count != block_length) { + report_error(fp, "write failed"); + return -1; + } + fp->block_address += block_length; + } + return 0; +} + +int bgzf_flush_try(BGZF *fp, int size) +{ + if (fp->block_offset + size > fp->uncompressed_block_size) + return bgzf_flush(fp); + return -1; +} + +int bgzf_write(BGZF* fp, const void* data, int length) +{ + const bgzf_byte_t *input = data; + int block_length, bytes_written; + if (fp->open_mode != 'w') { + report_error(fp, "file not open for writing"); + return -1; + } + + if (fp->uncompressed_block == NULL) + fp->uncompressed_block = malloc(fp->uncompressed_block_size); + + input = data; + block_length = fp->uncompressed_block_size; + bytes_written = 0; + while (bytes_written < length) { + int copy_length = bgzf_min(block_length - fp->block_offset, length - bytes_written); + bgzf_byte_t* buffer = fp->uncompressed_block; + memcpy(buffer + fp->block_offset, input, copy_length); + fp->block_offset += copy_length; + input += copy_length; + bytes_written += copy_length; + if (fp->block_offset == block_length) { + if (bgzf_flush(fp) != 0) { + break; + } + } + } + return bytes_written; +} + +int bgzf_close(BGZF* fp) +{ + if (fp->open_mode == 'w') { + if (bgzf_flush(fp) != 0) return -1; + { // add an empty block + int count, block_length = deflate_block(fp, 0); +#ifdef _USE_KNETFILE + count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + } +#ifdef _USE_KNETFILE + if (fflush(fp->x.fpw) != 0) { +#else + if (fflush(fp->file) != 0) { +#endif + report_error(fp, "flush failed"); + return -1; + } + } + if (fp->owned_file) { +#ifdef _USE_KNETFILE + int ret; + if (fp->open_mode == 'w') ret = fclose(fp->x.fpw); + else ret = knet_close(fp->x.fpr); + if (ret != 0) return -1; +#else + if (fclose(fp->file) != 0) return -1; +#endif + } + free(fp->uncompressed_block); + free(fp->compressed_block); + free_cache(fp); + free(fp); + return 0; +} + +void bgzf_set_cache_size(BGZF *fp, int cache_size) +{ + if (fp) fp->cache_size = cache_size; +} + +int bgzf_check_EOF(BGZF *fp) +{ + static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0"; + uint8_t buf[28]; + off_t offset; +#ifdef _USE_KNETFILE + offset = knet_tell(fp->x.fpr); + if (knet_seek(fp->x.fpr, -28, SEEK_END) != 0) return -1; + knet_read(fp->x.fpr, buf, 28); + knet_seek(fp->x.fpr, offset, SEEK_SET); +#else + offset = ftello(fp->file); + if (fseeko(fp->file, -28, SEEK_END) != 0) return -1; + fread(buf, 1, 28, fp->file); + fseeko(fp->file, offset, SEEK_SET); +#endif + return (memcmp(magic, buf, 28) == 0)? 1 : 0; +} + +int64_t bgzf_seek(BGZF* fp, int64_t pos, int where) +{ + int block_offset; + int64_t block_address; + + if (fp->open_mode != 'r') { + report_error(fp, "file not open for read"); + return -1; + } + if (where != SEEK_SET) { + report_error(fp, "unimplemented seek option"); + return -1; + } + block_offset = pos & 0xFFFF; + block_address = (pos >> 16) & 0xFFFFFFFFFFFFLL; +#ifdef _USE_KNETFILE + if (knet_seek(fp->x.fpr, block_address, SEEK_SET) != 0) { +#else + if (fseeko(fp->file, block_address, SEEK_SET) != 0) { +#endif + report_error(fp, "seek failed"); + return -1; + } + fp->block_length = 0; // indicates current block is not loaded + fp->block_address = block_address; + fp->block_offset = block_offset; + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.h b/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.h new file mode 100755 index 0000000..7295f37 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/bgzf.h @@ -0,0 +1,157 @@ +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef __BGZF_H +#define __BGZF_H + +#include +#include +#include +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +//typedef int8_t bool; + +typedef struct { + int file_descriptor; + char open_mode; // 'r' or 'w' + int16_t owned_file, compress_level; +#ifdef _USE_KNETFILE + union { + knetFile *fpr; + FILE *fpw; + } x; +#else + FILE* file; +#endif + int uncompressed_block_size; + int compressed_block_size; + void* uncompressed_block; + void* compressed_block; + int64_t block_address; + int block_length; + int block_offset; + int cache_size; + const char* error; + void *cache; // a pointer to a hash table +} BGZF; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open an existing file descriptor for reading or writing. + * Mode must be either "r" or "w". + * A subsequent bgzf_close will not close the file descriptor. + * Returns null on error. + */ +BGZF* bgzf_fdopen(int fd, const char* __restrict mode); + +/* + * Open the specified file for reading or writing. + * Mode must be either "r" or "w". + * Returns null on error. + */ +BGZF* bgzf_open(const char* path, const char* __restrict mode); + +/* + * Close the BGZ file and free all associated resources. + * Does not close the underlying file descriptor if created with bgzf_fdopen. + * Returns zero on success, -1 on error. + */ +int bgzf_close(BGZF* fp); + +/* + * Read up to length bytes from the file storing into data. + * Returns the number of bytes actually read. + * Returns zero on end of file. + * Returns -1 on error. + */ +int bgzf_read(BGZF* fp, void* data, int length); + +/* + * Write length bytes from data to the file. + * Returns the number of bytes written. + * Returns -1 on error. + */ +int bgzf_write(BGZF* fp, const void* data, int length); + +/* + * Return a virtual file pointer to the current location in the file. + * No interpetation of the value should be made, other than a subsequent + * call to bgzf_seek can be used to position the file at the same point. + * Return value is non-negative on success. + * Returns -1 on error. + */ +#define bgzf_tell(fp) ((fp->block_address << 16) | (fp->block_offset & 0xFFFF)) + +/* + * Set the file to read from the location specified by pos, which must + * be a value previously returned by bgzf_tell for this file (but not + * necessarily one returned by this file handle). + * The where argument must be SEEK_SET. + * Seeking on a file opened for write is not supported. + * Returns zero on success, -1 on error. + */ +int64_t bgzf_seek(BGZF* fp, int64_t pos, int where); + +/* + * Set the cache size. Zero to disable. By default, caching is + * disabled. The recommended cache size for frequent random access is + * about 8M bytes. + */ +void bgzf_set_cache_size(BGZF *fp, int cache_size); + +int bgzf_check_EOF(BGZF *fp); +int bgzf_read_block(BGZF* fp); +int bgzf_flush(BGZF* fp); +int bgzf_flush_try(BGZF *fp, int size); +int bgzf_check_bgzf(const char *fn); + +#ifdef __cplusplus +} +#endif + +static inline int bgzf_getc(BGZF *fp) +{ + int c; + if (fp->block_offset >= fp->block_length) { + if (bgzf_read_block(fp) != 0) return -2; /* error */ + if (fp->block_length == 0) return -1; /* end-of-file */ + } + c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++]; + if (fp->block_offset == fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + return c; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/bgzip.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/bgzip.c.pysam.c new file mode 100755 index 0000000..55e7029 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/bgzip.c.pysam.c @@ -0,0 +1,208 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "bgzf.h" + +static const int WINDOW_SIZE = 64 * 1024; + +static int bgzip_main_usage() +{ + fprintf(pysamerr, "\n"); + fprintf(pysamerr, "Usage: bgzip [options] [file] ...\n\n"); + fprintf(pysamerr, "Options: -c write on standard output, keep original files unchanged\n"); + fprintf(pysamerr, " -d decompress\n"); + fprintf(pysamerr, " -f overwrite files without asking\n"); + fprintf(pysamerr, " -b INT decompress at virtual file pointer INT\n"); + fprintf(pysamerr, " -s INT decompress INT bytes in the uncompressed file\n"); + fprintf(pysamerr, " -h give this help\n"); + fprintf(pysamerr, "\n"); + return 1; +} + +static int write_open(const char *fn, int is_forced) +{ + int fd = -1; + char c; + if (!is_forced) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) { + fprintf(pysamerr, "[bgzip] %s already exists; do you wish to overwrite (y or n)? ", fn); + scanf("%c", &c); + if (c != 'Y' && c != 'y') { + fprintf(pysamerr, "[bgzip] not overwritten\n"); + exit(1); + } + } + } + if (fd < 0) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { + fprintf(pysamerr, "[bgzip] %s: Fail to write\n", fn); + exit(1); + } + } + return fd; +} + +static void fail(BGZF* fp) +{ + fprintf(pysamerr, "Error: %s\n", fp->error); + exit(1); +} + +int main(int argc, char **argv) +{ + int c, compress, pstdout, is_forced; + BGZF *fp; + void *buffer; + long start, end, size; + + compress = 1; pstdout = 0; start = 0; size = -1; end = -1; is_forced = 0; + while((c = getopt(argc, argv, "cdhfb:s:")) >= 0){ + switch(c){ + case 'h': return bgzip_main_usage(); + case 'd': compress = 0; break; + case 'c': pstdout = 1; break; + case 'b': start = atol(optarg); break; + case 's': size = atol(optarg); break; + case 'f': is_forced = 1; break; + } + } + if (size >= 0) end = start + size; + if (end >= 0 && end < start) { + fprintf(pysamerr, "[bgzip] Illegal region: [%ld, %ld]\n", start, end); + return 1; + } + if (compress == 1) { + struct stat sbuf; + int f_src = fileno(stdin); + int f_dst = fileno(stdout); + + if ( argc>optind ) + { + if ( stat(argv[optind],&sbuf)<0 ) + { + fprintf(pysamerr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]); + return 1; + } + + if ((f_src = open(argv[optind], O_RDONLY)) < 0) { + fprintf(pysamerr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]); + return 1; + } + + if (pstdout) + f_dst = fileno(stdout); + else + { + char *name = malloc(strlen(argv[optind]) + 5); + strcpy(name, argv[optind]); + strcat(name, ".gz"); + f_dst = write_open(name, is_forced); + if (f_dst < 0) return 1; + free(name); + } + } + else if (!pstdout && isatty(fileno((FILE *)stdout)) ) + return bgzip_main_usage(); + + fp = bgzf_fdopen(f_dst, "w"); + buffer = malloc(WINDOW_SIZE); + while ((c = read(f_src, buffer, WINDOW_SIZE)) > 0) + if (bgzf_write(fp, buffer, c) < 0) fail(fp); + // f_dst will be closed here + if (bgzf_close(fp) < 0) fail(fp); + if (argc > optind && !pstdout) unlink(argv[optind]); + free(buffer); + close(f_src); + return 0; + } else { + struct stat sbuf; + int f_dst; + + if ( argc>optind ) + { + if ( stat(argv[optind],&sbuf)<0 ) + { + fprintf(pysamerr, "[bgzip] %s: %s\n", strerror(errno), argv[optind]); + return 1; + } + char *name; + int len = strlen(argv[optind]); + if ( strcmp(argv[optind]+len-3,".gz") ) + { + fprintf(pysamerr, "[bgzip] %s: unknown suffix -- ignored\n", argv[optind]); + return 1; + } + fp = bgzf_open(argv[optind], "r"); + if (fp == NULL) { + fprintf(pysamerr, "[bgzip] Could not open file: %s\n", argv[optind]); + return 1; + } + + if (pstdout) { + f_dst = fileno(stdout); + } + else { + name = strdup(argv[optind]); + name[strlen(name) - 3] = '\0'; + f_dst = write_open(name, is_forced); + free(name); + } + } + else if (!pstdout && isatty(fileno((FILE *)stdin)) ) + return bgzip_main_usage(); + else + { + f_dst = fileno(stdout); + fp = bgzf_fdopen(fileno(stdin), "r"); + if (fp == NULL) { + fprintf(pysamerr, "[bgzip] Could not read from stdin: %s\n", strerror(errno)); + return 1; + } + } + buffer = malloc(WINDOW_SIZE); + if (bgzf_seek(fp, start, SEEK_SET) < 0) fail(fp); + while (1) { + if (end < 0) c = bgzf_read(fp, buffer, WINDOW_SIZE); + else c = bgzf_read(fp, buffer, (end - start > WINDOW_SIZE)? WINDOW_SIZE:(end - start)); + if (c == 0) break; + if (c < 0) fail(fp); + start += c; + write(f_dst, buffer, c); + if (end >= 0 && start >= end) break; + } + free(buffer); + if (bgzf_close(fp) < 0) fail(fp); + if (!pstdout) unlink(argv[optind]); + return 0; + } +} diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/index.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/index.c.pysam.c new file mode 100755 index 0000000..486e26f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/index.c.pysam.c @@ -0,0 +1,1000 @@ +#include "pysam.h" + +#include +#include +#include +#include "khash.h" +#include "ksort.h" +#include "kstring.h" +#include "bam_endian.h" +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif +#include "tabix.h" + +#define TAD_MIN_CHUNK_GAP 32768 +// 1<<14 is the size of minimum bin. +#define TAD_LIDX_SHIFT 14 + +typedef struct { + uint64_t u, v; +} pair64_t; + +#define pair64_lt(a,b) ((a).u < (b).u) +KSORT_INIT(offt, pair64_t, pair64_lt) + +typedef struct { + uint32_t m, n; + pair64_t *list; +} ti_binlist_t; + +typedef struct { + int32_t n, m; + uint64_t *offset; +} ti_lidx_t; + +KHASH_MAP_INIT_INT(i, ti_binlist_t) +KHASH_MAP_INIT_STR(s, int) + +struct __ti_index_t { + ti_conf_t conf; + int32_t n, max; + khash_t(s) *tname; + khash_t(i) **index; + ti_lidx_t *index2; +}; + +struct __ti_iter_t { + int from_first; // read from the first record; no random access + int tid, beg, end, n_off, i, finished; + uint64_t curr_off; + kstring_t str; + const ti_index_t *idx; + pair64_t *off; +}; + +typedef struct { + int tid, beg, end, bin; +} ti_intv_t; + +ti_conf_t ti_conf_gff = { 0, 1, 4, 5, '#', 0 }; +ti_conf_t ti_conf_bed = { TI_FLAG_UCSC, 1, 2, 3, '#', 0 }; +ti_conf_t ti_conf_psltbl = { TI_FLAG_UCSC, 15, 17, 18, '#', 0 }; +ti_conf_t ti_conf_sam = { TI_PRESET_SAM, 3, 4, 0, '@', 0 }; +ti_conf_t ti_conf_vcf = { TI_PRESET_VCF, 1, 2, 0, '#', 0 }; + +/*************** + * read a line * + ***************/ + +/* +int ti_readline(BGZF *fp, kstring_t *str) +{ + int c, l = 0; + str->l = 0; + while ((c = bgzf_getc(fp)) >= 0 && c != '\n') { + ++l; + if (c != '\r') kputc(c, str); + } + if (c < 0 && l == 0) return -1; // end of file + return str->l; +} +*/ + +/* Below is a faster implementation largely equivalent to the one + * commented out above. */ +int ti_readline(BGZF *fp, kstring_t *str) +{ + int l, state = 0; + unsigned char *buf = (unsigned char*)fp->uncompressed_block; + str->l = 0; + do { + if (fp->block_offset >= fp->block_length) { + if (bgzf_read_block(fp) != 0) { state = -2; break; } + if (fp->block_length == 0) { state = -1; break; } + } + for (l = fp->block_offset; l < fp->block_length && buf[l] != '\n'; ++l); + if (l < fp->block_length) state = 1; + l -= fp->block_offset; + if (str->l + l + 1 >= str->m) { + str->m = str->l + l + 2; + kroundup32(str->m); + str->s = (char*)realloc(str->s, str->m); + } + memcpy(str->s + str->l, buf + fp->block_offset, l); + str->l += l; + fp->block_offset += l + 1; + if (fp->block_offset >= fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + } while (state == 0); + if (str->l == 0 && state < 0) return state; + str->s[str->l] = 0; + return str->l; +} + +/************************************* + * get the interval from a data line * + *************************************/ + +static inline int ti_reg2bin(uint32_t beg, uint32_t end) +{ + --end; + if (beg>>14 == end>>14) return 4681 + (beg>>14); + if (beg>>17 == end>>17) return 585 + (beg>>17); + if (beg>>20 == end>>20) return 73 + (beg>>20); + if (beg>>23 == end>>23) return 9 + (beg>>23); + if (beg>>26 == end>>26) return 1 + (beg>>26); + return 0; +} + +static int get_tid(ti_index_t *idx, const char *ss) +{ + khint_t k; + int tid; + k = kh_get(s, idx->tname, ss); + if (k == kh_end(idx->tname)) { // a new target sequence + int ret, size; + // update idx->n, ->max, ->index and ->index2 + if (idx->n == idx->max) { + idx->max = idx->max? idx->max<<1 : 8; + idx->index = realloc(idx->index, idx->max * sizeof(void*)); + idx->index2 = realloc(idx->index2, idx->max * sizeof(ti_lidx_t)); + } + memset(&idx->index2[idx->n], 0, sizeof(ti_lidx_t)); + idx->index[idx->n++] = kh_init(i); + // update ->tname + tid = size = kh_size(idx->tname); + k = kh_put(s, idx->tname, strdup(ss), &ret); + kh_value(idx->tname, k) = size; + assert(idx->n == kh_size(idx->tname)); + } else tid = kh_value(idx->tname, k); + return tid; +} + +int ti_get_intv(const ti_conf_t *conf, int len, char *line, ti_interval_t *intv) +{ + int i, b = 0, id = 1, ncols = 0; + char *s; + intv->ss = intv->se = 0; intv->beg = intv->end = -1; + for (i = 0; i <= len; ++i) { + if (line[i] == '\t' || line[i] == 0) { + ++ncols; + if (id == conf->sc) { + intv->ss = line + b; intv->se = line + i; + } else if (id == conf->bc) { + // here ->beg is 0-based. + intv->beg = intv->end = strtol(line + b, &s, 0); + if (!(conf->preset&TI_FLAG_UCSC)) --intv->beg; + else ++intv->end; + if (intv->beg < 0) intv->beg = 0; + if (intv->end < 1) intv->end = 1; + } else { + if ((conf->preset&0xffff) == TI_PRESET_GENERIC) { + if (id == conf->ec) intv->end = strtol(line + b, &s, 0); + } else if ((conf->preset&0xffff) == TI_PRESET_SAM) { + if (id == 6) { // CIGAR + int l = 0, op; + char *t; + for (s = line + b; s < line + i;) { + long x = strtol(s, &t, 10); + op = toupper(*t); + if (op == 'M' || op == 'D' || op == 'N') l += x; + s = t + 1; + } + if (l == 0) l = 1; + intv->end = intv->beg + l; + } + } else if ((conf->preset&0xffff) == TI_PRESET_VCF) { + // FIXME: the following is NOT tested and is likely to be buggy + if (id == 4) { + if (b < i) intv->end = intv->beg + (i - b); + } else if (id == 8) { // look for "END=" + int c = line[i]; + line[i] = 0; + s = strstr(line + b, "END="); + if (s == line + b) s += 4; + else if (s) { + s = strstr(line + b, ";END="); + if (s) s += 5; + } + if (s) intv->end = strtol(s, &s, 0); + line[i] = c; + } + } + } + b = i + 1; + ++id; + } + } +/* + if (ncols < conf->sc || ncols < conf->bc || ncols < conf->ec) { + if (ncols == 1) fprintf(pysamerr,"[get_intv] Is the file tab-delimited? The line has %d field only: %s\n", ncols, line); + else fprintf(pysamerr,"[get_intv] The line has %d field(s) only: %s\n", ncols, line); + exit(1); + } +*/ + if (intv->ss == 0 || intv->se == 0 || intv->beg < 0 || intv->end < 0) return -1; + return 0; +} + +static int get_intv(ti_index_t *idx, kstring_t *str, ti_intv_t *intv) +{ + ti_interval_t x; + intv->tid = intv->beg = intv->end = intv->bin = -1; + if (ti_get_intv(&idx->conf, str->l, str->s, &x) == 0) { + int c = *x.se; + *x.se = '\0'; intv->tid = get_tid(idx, x.ss); *x.se = c; + intv->beg = x.beg; intv->end = x.end; + intv->bin = ti_reg2bin(intv->beg, intv->end); + return (intv->tid >= 0 && intv->beg >= 0 && intv->end >= 0)? 0 : -1; + } else { + fprintf(pysamerr, "[%s] the following line cannot be parsed and skipped: %s\n", __func__, str->s); + return -1; + } +} + +/************ + * indexing * + ************/ + +// requirement: len <= LEN_MASK +static inline void insert_offset(khash_t(i) *h, int bin, uint64_t beg, uint64_t end) +{ + khint_t k; + ti_binlist_t *l; + int ret; + k = kh_put(i, h, bin, &ret); + l = &kh_value(h, k); + if (ret) { // not present + l->m = 1; l->n = 0; + l->list = (pair64_t*)calloc(l->m, 16); + } + if (l->n == l->m) { + l->m <<= 1; + l->list = (pair64_t*)realloc(l->list, l->m * 16); + } + l->list[l->n].u = beg; l->list[l->n++].v = end; +} + +static inline uint64_t insert_offset2(ti_lidx_t *index2, int _beg, int _end, uint64_t offset) +{ + int i, beg, end; + beg = _beg >> TAD_LIDX_SHIFT; + end = (_end - 1) >> TAD_LIDX_SHIFT; + if (index2->m < end + 1) { + int old_m = index2->m; + index2->m = end + 1; + kroundup32(index2->m); + index2->offset = (uint64_t*)realloc(index2->offset, index2->m * 8); + memset(index2->offset + old_m, 0, 8 * (index2->m - old_m)); + } + if (beg == end) { + if (index2->offset[beg] == 0) index2->offset[beg] = offset; + } else { + for (i = beg; i <= end; ++i) + if (index2->offset[i] == 0) index2->offset[i] = offset; + } + if (index2->n < end + 1) index2->n = end + 1; + return (uint64_t)beg<<32 | end; +} + +static void merge_chunks(ti_index_t *idx) +{ + khash_t(i) *index; + int i, l, m; + khint_t k; + for (i = 0; i < idx->n; ++i) { + index = idx->index[i]; + for (k = kh_begin(index); k != kh_end(index); ++k) { + ti_binlist_t *p; + if (!kh_exist(index, k)) continue; + p = &kh_value(index, k); + m = 0; + for (l = 1; l < p->n; ++l) { + if (p->list[m].v>>16 == p->list[l].u>>16) p->list[m].v = p->list[l].v; + else p->list[++m] = p->list[l]; + } // ~for(l) + p->n = m + 1; + } // ~for(k) + } // ~for(i) +} + +static void fill_missing(ti_index_t *idx) +{ + int i, j; + for (i = 0; i < idx->n; ++i) { + ti_lidx_t *idx2 = &idx->index2[i]; + for (j = 1; j < idx2->n; ++j) + if (idx2->offset[j] == 0) + idx2->offset[j] = idx2->offset[j-1]; + } +} + +ti_index_t *ti_index_core(BGZF *fp, const ti_conf_t *conf) +{ + int ret; + ti_index_t *idx; + uint32_t last_bin, save_bin; + int32_t last_coor, last_tid, save_tid; + uint64_t save_off, last_off, lineno = 0, offset0 = (uint64_t)-1, tmp; + kstring_t *str; + + str = calloc(1, sizeof(kstring_t)); + + idx = (ti_index_t*)calloc(1, sizeof(ti_index_t)); + idx->conf = *conf; + idx->n = idx->max = 0; + idx->tname = kh_init(s); + idx->index = 0; + idx->index2 = 0; + + save_bin = save_tid = last_tid = last_bin = 0xffffffffu; + save_off = last_off = bgzf_tell(fp); last_coor = 0xffffffffu; + while ((ret = ti_readline(fp, str)) >= 0) { + ti_intv_t intv; + ++lineno; + if (lineno <= idx->conf.line_skip || str->s[0] == idx->conf.meta_char) { + last_off = bgzf_tell(fp); + continue; + } + get_intv(idx, str, &intv); + if ( intv.beg<0 || intv.end<0 ) + { + fprintf(pysamerr,"[ti_index_core] the indexes overlap or are out of bounds\n"); + exit(1); + } + if (last_tid != intv.tid) { // change of chromosomes + if (last_tid>intv.tid ) + { + fprintf(pysamerr,"[ti_index_core] the chromosome blocks not continuous at line %llu, is the file sorted? [pos %d]\n",(unsigned long long)lineno,intv.beg+1); + exit(1); + } + last_tid = intv.tid; + last_bin = 0xffffffffu; + } else if (last_coor > intv.beg) { + fprintf(pysamerr, "[ti_index_core] the file out of order at line %llu\n", (unsigned long long)lineno); + exit(1); + } + tmp = insert_offset2(&idx->index2[intv.tid], intv.beg, intv.end, last_off); + if (last_off == 0) offset0 = tmp; + if (intv.bin != last_bin) { // then possibly write the binning index + if (save_bin != 0xffffffffu) // save_bin==0xffffffffu only happens to the first record + insert_offset(idx->index[save_tid], save_bin, save_off, last_off); + save_off = last_off; + save_bin = last_bin = intv.bin; + save_tid = intv.tid; + if (save_tid < 0) break; + } + if (bgzf_tell(fp) <= last_off) { + fprintf(pysamerr, "[ti_index_core] bug in BGZF: %llx < %llx\n", + (unsigned long long)bgzf_tell(fp), (unsigned long long)last_off); + exit(1); + } + last_off = bgzf_tell(fp); + last_coor = intv.beg; + } + if (save_tid >= 0) insert_offset(idx->index[save_tid], save_bin, save_off, bgzf_tell(fp)); + merge_chunks(idx); + fill_missing(idx); + if (offset0 != (uint64_t)-1 && idx->n && idx->index2[0].offset) { + int i, beg = offset0>>32, end = offset0&0xffffffffu; + for (i = beg; i <= end; ++i) idx->index2[0].offset[i] = 0; + } + + free(str->s); free(str); + return idx; +} + +void ti_index_destroy(ti_index_t *idx) +{ + khint_t k; + int i; + if (idx == 0) return; + // destroy the name hash table + for (k = kh_begin(idx->tname); k != kh_end(idx->tname); ++k) { + if (kh_exist(idx->tname, k)) + free((char*)kh_key(idx->tname, k)); + } + kh_destroy(s, idx->tname); + // destroy the binning index + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index = idx->index[i]; + ti_lidx_t *index2 = idx->index2 + i; + for (k = kh_begin(index); k != kh_end(index); ++k) { + if (kh_exist(index, k)) + free(kh_value(index, k).list); + } + kh_destroy(i, index); + free(index2->offset); + } + free(idx->index); + // destroy the linear index + free(idx->index2); + free(idx); +} + +/****************** + * index file I/O * + ******************/ + +void ti_index_save(const ti_index_t *idx, BGZF *fp) +{ + int32_t i, size, ti_is_be; + khint_t k; + ti_is_be = bam_is_big_endian(); + bgzf_write(fp, "TBI\1", 4); + if (ti_is_be) { + uint32_t x = idx->n; + bgzf_write(fp, bam_swap_endian_4p(&x), 4); + } else bgzf_write(fp, &idx->n, 4); + assert(sizeof(ti_conf_t) == 24); + if (ti_is_be) { // write ti_conf_t; + uint32_t x[6]; + memcpy(x, &idx->conf, 24); + for (i = 0; i < 6; ++i) bgzf_write(fp, bam_swap_endian_4p(&x[i]), 4); + } else bgzf_write(fp, &idx->conf, sizeof(ti_conf_t)); + { // write target names + char **name; + int32_t l = 0; + name = calloc(kh_size(idx->tname), sizeof(void*)); + for (k = kh_begin(idx->tname); k != kh_end(idx->tname); ++k) + if (kh_exist(idx->tname, k)) + name[kh_value(idx->tname, k)] = (char*)kh_key(idx->tname, k); + for (i = 0; i < kh_size(idx->tname); ++i) + l += strlen(name[i]) + 1; + if (ti_is_be) bgzf_write(fp, bam_swap_endian_4p(&l), 4); + else bgzf_write(fp, &l, 4); + for (i = 0; i < kh_size(idx->tname); ++i) + bgzf_write(fp, name[i], strlen(name[i]) + 1); + free(name); + } + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index = idx->index[i]; + ti_lidx_t *index2 = idx->index2 + i; + // write binning index + size = kh_size(index); + if (ti_is_be) { // big endian + uint32_t x = size; + bgzf_write(fp, bam_swap_endian_4p(&x), 4); + } else bgzf_write(fp, &size, 4); + for (k = kh_begin(index); k != kh_end(index); ++k) { + if (kh_exist(index, k)) { + ti_binlist_t *p = &kh_value(index, k); + if (ti_is_be) { // big endian + uint32_t x; + x = kh_key(index, k); bgzf_write(fp, bam_swap_endian_4p(&x), 4); + x = p->n; bgzf_write(fp, bam_swap_endian_4p(&x), 4); + for (x = 0; (int)x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + bgzf_write(fp, p->list, 16 * p->n); + for (x = 0; (int)x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + } else { + bgzf_write(fp, &kh_key(index, k), 4); + bgzf_write(fp, &p->n, 4); + bgzf_write(fp, p->list, 16 * p->n); + } + } + } + // write linear index (index2) + if (ti_is_be) { + int x = index2->n; + bgzf_write(fp, bam_swap_endian_4p(&x), 4); + } else bgzf_write(fp, &index2->n, 4); + if (ti_is_be) { // big endian + int x; + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + bgzf_write(fp, index2->offset, 8 * index2->n); + for (x = 0; (int)x < index2->n; ++x) + bam_swap_endian_8p(&index2->offset[x]); + } else bgzf_write(fp, index2->offset, 8 * index2->n); + } +} + +static ti_index_t *ti_index_load_core(BGZF *fp) +{ + int i, ti_is_be; + char magic[4]; + ti_index_t *idx; + ti_is_be = bam_is_big_endian(); + if (fp == 0) { + fprintf(pysamerr, "[ti_index_load_core] fail to load index.\n"); + return 0; + } + bgzf_read(fp, magic, 4); + if (strncmp(magic, "TBI\1", 4)) { + fprintf(pysamerr, "[ti_index_load] wrong magic number.\n"); + return 0; + } + idx = (ti_index_t*)calloc(1, sizeof(ti_index_t)); + bgzf_read(fp, &idx->n, 4); + if (ti_is_be) bam_swap_endian_4p(&idx->n); + idx->tname = kh_init(s); + idx->index = (khash_t(i)**)calloc(idx->n, sizeof(void*)); + idx->index2 = (ti_lidx_t*)calloc(idx->n, sizeof(ti_lidx_t)); + // read idx->conf + bgzf_read(fp, &idx->conf, sizeof(ti_conf_t)); + if (ti_is_be) { + bam_swap_endian_4p(&idx->conf.preset); + bam_swap_endian_4p(&idx->conf.sc); + bam_swap_endian_4p(&idx->conf.bc); + bam_swap_endian_4p(&idx->conf.ec); + bam_swap_endian_4p(&idx->conf.meta_char); + bam_swap_endian_4p(&idx->conf.line_skip); + } + { // read target names + int j, ret; + kstring_t *str; + int32_t l; + uint8_t *buf; + bgzf_read(fp, &l, 4); + if (ti_is_be) bam_swap_endian_4p(&l); + buf = calloc(l, 1); + bgzf_read(fp, buf, l); + str = calloc(1, sizeof(kstring_t)); + for (i = j = 0; i < l; ++i) { + if (buf[i] == 0) { + khint_t k = kh_put(s, idx->tname, strdup(str->s), &ret); + kh_value(idx->tname, k) = j++; + str->l = 0; + } else kputc(buf[i], str); + } + free(str->s); free(str); free(buf); + } + for (i = 0; i < idx->n; ++i) { + khash_t(i) *index; + ti_lidx_t *index2 = idx->index2 + i; + uint32_t key, size; + khint_t k; + int j, ret; + ti_binlist_t *p; + index = idx->index[i] = kh_init(i); + // load binning index + bgzf_read(fp, &size, 4); + if (ti_is_be) bam_swap_endian_4p(&size); + for (j = 0; j < (int)size; ++j) { + bgzf_read(fp, &key, 4); + if (ti_is_be) bam_swap_endian_4p(&key); + k = kh_put(i, index, key, &ret); + p = &kh_value(index, k); + bgzf_read(fp, &p->n, 4); + if (ti_is_be) bam_swap_endian_4p(&p->n); + p->m = p->n; + p->list = (pair64_t*)malloc(p->m * 16); + bgzf_read(fp, p->list, 16 * p->n); + if (ti_is_be) { + int x; + for (x = 0; x < p->n; ++x) { + bam_swap_endian_8p(&p->list[x].u); + bam_swap_endian_8p(&p->list[x].v); + } + } + } + // load linear index + bgzf_read(fp, &index2->n, 4); + if (ti_is_be) bam_swap_endian_4p(&index2->n); + index2->m = index2->n; + index2->offset = (uint64_t*)calloc(index2->m, 8); + bgzf_read(fp, index2->offset, index2->n * 8); + if (ti_is_be) + for (j = 0; j < index2->n; ++j) bam_swap_endian_8p(&index2->offset[j]); + } + return idx; +} + +ti_index_t *ti_index_load_local(const char *fnidx) +{ + BGZF *fp; + fp = bgzf_open(fnidx, "r"); + if (fp) { + ti_index_t *idx = ti_index_load_core(fp); + bgzf_close(fp); + return idx; + } else return 0; +} + +#ifdef _USE_KNETFILE +static void download_from_remote(const char *url) +{ + const int buf_size = 1 * 1024 * 1024; + char *fn; + FILE *fp; + uint8_t *buf; + knetFile *fp_remote; + int l; + if (strstr(url, "ftp://") != url && strstr(url, "http://") != url) return; + l = strlen(url); + for (fn = (char*)url + l - 1; fn >= url; --fn) + if (*fn == '/') break; + ++fn; // fn now points to the file name + fp_remote = knet_open(url, "r"); + if (fp_remote == 0) { + fprintf(pysamerr, "[download_from_remote] fail to open remote file.\n"); + return; + } + if ((fp = fopen(fn, "w")) == 0) { + fprintf(pysamerr, "[download_from_remote] fail to create file in the working directory.\n"); + knet_close(fp_remote); + return; + } + buf = (uint8_t*)calloc(buf_size, 1); + while ((l = knet_read(fp_remote, buf, buf_size)) != 0) + fwrite(buf, 1, l, fp); + free(buf); + fclose(fp); + knet_close(fp_remote); +} +#else +static void download_from_remote(const char *url) +{ + return; +} +#endif + +static char *get_local_version(const char *fn) +{ + struct stat sbuf; + char *fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcat(strcpy(fnidx, fn), ".tbi"); + if ((strstr(fnidx, "ftp://") == fnidx || strstr(fnidx, "http://") == fnidx)) { + char *p, *url; + int l = strlen(fnidx); + for (p = fnidx + l - 1; p >= fnidx; --p) + if (*p == '/') break; + url = fnidx; fnidx = strdup(p + 1); + if (stat(fnidx, &sbuf) == 0) { + free(url); + return fnidx; + } + fprintf(pysamerr, "[%s] downloading the index file...\n", __func__); + download_from_remote(url); + free(url); + } + if (stat(fnidx, &sbuf) == 0) return fnidx; + free(fnidx); return 0; +} + +const char **ti_seqname(const ti_index_t *idx, int *n) +{ + const char **names; + khint_t k; + *n = idx->n; + names = calloc(idx->n, sizeof(void*)); + for (k = kh_begin(idx->tname); k < kh_end(idx->tname); ++k) + if (kh_exist(idx->tname, k)) + names[kh_val(idx->tname, k)] = kh_key(idx->tname, k); + return names; +} + +ti_index_t *ti_index_load(const char *fn) +{ + ti_index_t *idx; + char *fname = get_local_version(fn); + if (fname == 0) return 0; + idx = ti_index_load_local(fname); + if (idx == 0) fprintf(pysamerr, "[ti_index_load] fail to load the index: %s\n", fname); + free(fname); + return idx; +} + +int ti_index_build2(const char *fn, const ti_conf_t *conf, const char *_fnidx) +{ + char *fnidx; + BGZF *fp, *fpidx; + ti_index_t *idx; + if ((fp = bgzf_open(fn, "r")) == 0) { + fprintf(pysamerr, "[ti_index_build2] fail to open the file: %s\n", fn); + return -1; + } + idx = ti_index_core(fp, conf); + bgzf_close(fp); + if (_fnidx == 0) { + fnidx = (char*)calloc(strlen(fn) + 5, 1); + strcpy(fnidx, fn); strcat(fnidx, ".tbi"); + } else fnidx = strdup(_fnidx); + fpidx = bgzf_open(fnidx, "w"); + if (fpidx == 0) { + fprintf(pysamerr, "[ti_index_build2] fail to create the index file.\n"); + free(fnidx); + return -1; + } + ti_index_save(idx, fpidx); + ti_index_destroy(idx); + bgzf_close(fpidx); + free(fnidx); + return 0; +} + +int ti_index_build(const char *fn, const ti_conf_t *conf) +{ + return ti_index_build2(fn, conf, 0); +} + +/******************************************** + * parse a region in the format chr:beg-end * + ********************************************/ + +int ti_get_tid(const ti_index_t *idx, const char *name) +{ + khiter_t iter; + const khash_t(s) *h = idx->tname; + iter = kh_get(s, h, name); /* get the tid */ + if (iter == kh_end(h)) return -1; + return kh_value(h, iter); +} + +int ti_parse_region(const ti_index_t *idx, const char *str, int *tid, int *begin, int *end) +{ + char *s, *p; + int i, l, k; + l = strlen(str); + p = s = (char*)malloc(l+1); + /* squeeze out "," */ + for (i = k = 0; i != l; ++i) + if (str[i] != ',' && !isspace(str[i])) s[k++] = str[i]; + s[k] = 0; + for (i = 0; i != k; ++i) if (s[i] == ':') break; + s[i] = 0; + if ((*tid = ti_get_tid(idx, s)) < 0) { + free(s); + return -1; + } + if (i == k) { /* dump the whole sequence */ + *begin = 0; *end = 1<<29; free(s); + return 0; + } + for (p = s + i + 1; i != k; ++i) if (s[i] == '-') break; + *begin = atoi(p); + if (i < k) { + p = s + i + 1; + *end = atoi(p); + } else *end = 1<<29; + if (*begin > 0) --*begin; + free(s); + if (*begin > *end) return -1; + return 0; +} + +/******************************* + * retrieve a specified region * + *******************************/ + +#define MAX_BIN 37450 // =(8^6-1)/7+1 + +static inline int reg2bins(uint32_t beg, uint32_t end, uint16_t list[MAX_BIN]) +{ + int i = 0, k; + if (beg >= end) return 0; + if (end >= 1u<<29) end = 1u<<29; + --end; + list[i++] = 0; + for (k = 1 + (beg>>26); k <= 1 + (end>>26); ++k) list[i++] = k; + for (k = 9 + (beg>>23); k <= 9 + (end>>23); ++k) list[i++] = k; + for (k = 73 + (beg>>20); k <= 73 + (end>>20); ++k) list[i++] = k; + for (k = 585 + (beg>>17); k <= 585 + (end>>17); ++k) list[i++] = k; + for (k = 4681 + (beg>>14); k <= 4681 + (end>>14); ++k) list[i++] = k; + return i; +} + +ti_iter_t ti_iter_first() +{ + ti_iter_t iter; + iter = calloc(1, sizeof(struct __ti_iter_t)); + iter->from_first = 1; + return iter; +} + +ti_iter_t ti_iter_query(const ti_index_t *idx, int tid, int beg, int end) +{ + uint16_t *bins; + int i, n_bins, n_off; + pair64_t *off; + khint_t k; + khash_t(i) *index; + uint64_t min_off; + ti_iter_t iter = 0; + + if (beg < 0) beg = 0; + if (end < beg) return 0; + // initialize the iterator + iter = calloc(1, sizeof(struct __ti_iter_t)); + iter->idx = idx; iter->tid = tid; iter->beg = beg; iter->end = end; iter->i = -1; + // random access + bins = (uint16_t*)calloc(MAX_BIN, 2); + n_bins = reg2bins(beg, end, bins); + index = idx->index[tid]; + if (idx->index2[tid].n > 0) { + min_off = (beg>>TAD_LIDX_SHIFT >= idx->index2[tid].n)? idx->index2[tid].offset[idx->index2[tid].n-1] + : idx->index2[tid].offset[beg>>TAD_LIDX_SHIFT]; + if (min_off == 0) { // improvement for index files built by tabix prior to 0.1.4 + int n = beg>>TAD_LIDX_SHIFT; + if (n > idx->index2[tid].n) n = idx->index2[tid].n; + for (i = n - 1; i >= 0; --i) + if (idx->index2[tid].offset[i] != 0) break; + if (i >= 0) min_off = idx->index2[tid].offset[i]; + } + } else min_off = 0; // tabix 0.1.2 may produce such index files + for (i = n_off = 0; i < n_bins; ++i) { + if ((k = kh_get(i, index, bins[i])) != kh_end(index)) + n_off += kh_value(index, k).n; + } + if (n_off == 0) { + free(bins); return iter; + } + off = (pair64_t*)calloc(n_off, 16); + for (i = n_off = 0; i < n_bins; ++i) { + if ((k = kh_get(i, index, bins[i])) != kh_end(index)) { + int j; + ti_binlist_t *p = &kh_value(index, k); + for (j = 0; j < p->n; ++j) + if (p->list[j].v > min_off) off[n_off++] = p->list[j]; + } + } + if (n_off == 0) { + free(bins); free(off); return iter; + } + free(bins); + { + int l; + ks_introsort(offt, n_off, off); + // resolve completely contained adjacent blocks + for (i = 1, l = 0; i < n_off; ++i) + if (off[l].v < off[i].v) + off[++l] = off[i]; + n_off = l + 1; + // resolve overlaps between adjacent blocks; this may happen due to the merge in indexing + for (i = 1; i < n_off; ++i) + if (off[i-1].v >= off[i].u) off[i-1].v = off[i].u; + { // merge adjacent blocks + for (i = 1, l = 0; i < n_off; ++i) { + if (off[l].v>>16 == off[i].u>>16) off[l].v = off[i].v; + else off[++l] = off[i]; + } + n_off = l + 1; + } + } + iter->n_off = n_off; iter->off = off; + return iter; +} + +const char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len) +{ + if (iter->finished) return 0; + if (iter->from_first) { + int ret; + if ((ret = ti_readline(fp, &iter->str)) < 0) { + iter->finished = 1; + return 0; + } else { + if (len) *len = iter->str.l; + return iter->str.s; + } + } + if (iter->n_off == 0) return 0; + while (1) { + int ret; + if (iter->curr_off == 0 || iter->curr_off >= iter->off[iter->i].v) { // then jump to the next chunk + if (iter->i == iter->n_off - 1) break; // no more chunks + if (iter->i >= 0) assert(iter->curr_off == iter->off[iter->i].v); // otherwise bug + if (iter->i < 0 || iter->off[iter->i].v != iter->off[iter->i+1].u) { // not adjacent chunks; then seek + bgzf_seek(fp, iter->off[iter->i+1].u, SEEK_SET); + iter->curr_off = bgzf_tell(fp); + } + ++iter->i; + } + if ((ret = ti_readline(fp, &iter->str)) >= 0) { + ti_intv_t intv; + iter->curr_off = bgzf_tell(fp); + if (iter->str.s[0] == iter->idx->conf.meta_char) continue; + get_intv((ti_index_t*)iter->idx, &iter->str, &intv); + if (intv.tid != iter->tid || intv.beg >= iter->end) break; // no need to proceed + else if (intv.end > iter->beg && iter->end > intv.beg) { + if (len) *len = iter->str.l; + return iter->str.s; + } + } else break; // end of file + } + iter->finished = 1; + return 0; +} + +void ti_iter_destroy(ti_iter_t iter) +{ + if (iter) { + free(iter->str.s); free(iter->off); + free(iter); + } +} + +int ti_fetch(BGZF *fp, const ti_index_t *idx, int tid, int beg, int end, void *data, ti_fetch_f func) +{ + ti_iter_t iter; + const char *s; + int len; + iter = ti_iter_query(idx, tid, beg, end); + while ((s = ti_iter_read(fp, iter, &len)) != 0) + func(len, s, data); + ti_iter_destroy(iter); + return 0; +} + +const ti_conf_t *ti_get_conf(ti_index_t *idx) { return idx? &idx->conf : 0; } + +/******************* + * High-level APIs * + *******************/ + +tabix_t *ti_open(const char *fn, const char *fnidx) +{ + tabix_t *t; + BGZF *fp; + if ((fp = bgzf_open(fn, "r")) == 0) return 0; + t = calloc(1, sizeof(tabix_t)); + t->fn = strdup(fn); + if (fnidx) t->fnidx = strdup(fnidx); + t->fp = fp; + return t; +} + +void ti_close(tabix_t *t) +{ + if (t) { + bgzf_close(t->fp); + if (t->idx) ti_index_destroy(t->idx); + free(t->fn); free(t->fnidx); + free(t); + } +} + +int ti_lazy_index_load(tabix_t *t) +{ + if (t->idx == 0) { // load index + if (t->fnidx) t->idx = ti_index_load_local(t->fnidx); + else t->idx = ti_index_load(t->fn); + if (t->idx == 0) return -1; // fail to load index + } + return 0; +} + +ti_iter_t ti_queryi(tabix_t *t, int tid, int beg, int end) +{ + if (tid < 0) return ti_iter_first(); + if (ti_lazy_index_load(t) != 0) return 0; + return ti_iter_query(t->idx, tid, beg, end); +} + +ti_iter_t ti_querys(tabix_t *t, const char *reg) +{ + int tid, beg, end; + if (reg == 0) return ti_iter_first(); + if (ti_lazy_index_load(t) != 0) return 0; + if (ti_parse_region(t->idx, reg, &tid, &beg, &end) < 0) return 0; + return ti_iter_query(t->idx, tid, beg, end); +} + +ti_iter_t ti_query(tabix_t *t, const char *name, int beg, int end) +{ + int tid; + if (name == 0) return ti_iter_first(); + // then need to load the index + if (ti_lazy_index_load(t) != 0) return 0; + if ((tid = ti_get_tid(t->idx, name)) < 0) return 0; + return ti_iter_query(t->idx, tid, beg, end); +} + +const char *ti_read(tabix_t *t, ti_iter_t iter, int *len) +{ + return ti_iter_read(t->fp, iter, len); +} diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/khash.h b/code/utilities/CPAT-1.2.2/lib/tabix/khash.h new file mode 100755 index 0000000..1d583ef --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/khash.h @@ -0,0 +1,486 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* + An example: + +#include "khash.h" +KHASH_MAP_INIT_INT(32, char) +int main() { + int ret, is_missing; + khiter_t k; + khash_t(32) *h = kh_init(32); + k = kh_put(32, h, 5, &ret); + if (!ret) kh_del(32, h, k); + kh_value(h, k) = 10; + k = kh_get(32, h, 10); + is_missing = (k == kh_end(h)); + k = kh_get(32, h, 5); + kh_del(32, h, k); + for (k = kh_begin(h); k != kh_end(h); ++k) + if (kh_exist(h, k)) kh_value(h, k) = 1; + kh_destroy(32, h); + return 0; +} +*/ + +/* + 2008-09-19 (0.2.3): + + * Corrected the example + * Improved interfaces + + 2008-09-11 (0.2.2): + + * Improved speed a little in kh_put() + + 2008-09-10 (0.2.1): + + * Added kh_clear() + * Fixed a compiling error + + 2008-09-02 (0.2.0): + + * Changed to token concatenation which increases flexibility. + + 2008-08-31 (0.1.2): + + * Fixed a bug in kh_get(), which has not been tested previously. + + 2008-08-31 (0.1.1): + + * Added destructor +*/ + + +#ifndef __AC_KHASH_H +#define __AC_KHASH_H + +/*! + @header + + Generic hash table library. + + @copyright Heng Li + */ + +#define AC_VERSION_KHASH_H "0.2.2" + +#include +#include +#include + +typedef uint32_t khint_t; +typedef khint_t khiter_t; + +#define __ac_HASH_PRIME_SIZE 32 +static const uint32_t __ac_prime_list[__ac_HASH_PRIME_SIZE] = +{ + 0ul, 3ul, 11ul, 23ul, 53ul, + 97ul, 193ul, 389ul, 769ul, 1543ul, + 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, + 98317ul, 196613ul, 393241ul, 786433ul, 1572869ul, + 3145739ul, 6291469ul, 12582917ul, 25165843ul, 50331653ul, + 100663319ul, 201326611ul, 402653189ul, 805306457ul, 1610612741ul, + 3221225473ul, 4294967291ul +}; + +#define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) +#define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) +#define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) +#define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) +#define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) +#define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) +#define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) + +static const double __ac_HASH_UPPER = 0.77; + +#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ + typedef struct { \ + khint_t n_buckets, size, n_occupied, upper_bound; \ + uint32_t *flags; \ + khkey_t *keys; \ + khval_t *vals; \ + } kh_##name##_t; \ + static inline kh_##name##_t *kh_init_##name() { \ + return (kh_##name##_t*)calloc(1, sizeof(kh_##name##_t)); \ + } \ + static inline void kh_destroy_##name(kh_##name##_t *h) \ + { \ + if (h) { \ + free(h->keys); free(h->flags); \ + free(h->vals); \ + free(h); \ + } \ + } \ + static inline void kh_clear_##name(kh_##name##_t *h) \ + { \ + if (h && h->flags) { \ + memset(h->flags, 0xaa, ((h->n_buckets>>4) + 1) * sizeof(uint32_t)); \ + h->size = h->n_occupied = 0; \ + } \ + } \ + static inline khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \ + { \ + if (h->n_buckets) { \ + khint_t inc, k, i, last; \ + k = __hash_func(key); i = k % h->n_buckets; \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) return h->n_buckets; \ + } \ + return __ac_iseither(h->flags, i)? h->n_buckets : i; \ + } else return 0; \ + } \ + static inline void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \ + { \ + uint32_t *new_flags = 0; \ + khint_t j = 1; \ + { \ + khint_t t = __ac_HASH_PRIME_SIZE - 1; \ + while (__ac_prime_list[t] > new_n_buckets) --t; \ + new_n_buckets = __ac_prime_list[t+1]; \ + if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; \ + else { \ + new_flags = (uint32_t*)malloc(((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \ + memset(new_flags, 0xaa, ((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \ + if (h->n_buckets < new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + } \ + } \ + if (j) { \ + for (j = 0; j != h->n_buckets; ++j) { \ + if (__ac_iseither(h->flags, j) == 0) { \ + khkey_t key = h->keys[j]; \ + khval_t val; \ + if (kh_is_map) val = h->vals[j]; \ + __ac_set_isdel_true(h->flags, j); \ + while (1) { \ + khint_t inc, k, i; \ + k = __hash_func(key); \ + i = k % new_n_buckets; \ + inc = 1 + k % (new_n_buckets - 1); \ + while (!__ac_isempty(new_flags, i)) { \ + if (i + inc >= new_n_buckets) i = i + inc - new_n_buckets; \ + else i += inc; \ + } \ + __ac_set_isempty_false(new_flags, i); \ + if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \ + { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ + if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ + __ac_set_isdel_true(h->flags, i); \ + } else { \ + h->keys[i] = key; \ + if (kh_is_map) h->vals[i] = val; \ + break; \ + } \ + } \ + } \ + } \ + if (h->n_buckets > new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + free(h->flags); \ + h->flags = new_flags; \ + h->n_buckets = new_n_buckets; \ + h->n_occupied = h->size; \ + h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ + } \ + } \ + static inline khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \ + { \ + khint_t x; \ + if (h->n_occupied >= h->upper_bound) { \ + if (h->n_buckets > (h->size<<1)) kh_resize_##name(h, h->n_buckets - 1); \ + else kh_resize_##name(h, h->n_buckets + 1); \ + } \ + { \ + khint_t inc, k, i, site, last; \ + x = site = h->n_buckets; k = __hash_func(key); i = k % h->n_buckets; \ + if (__ac_isempty(h->flags, i)) x = i; \ + else { \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (__ac_isdel(h->flags, i)) site = i; \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) { x = site; break; } \ + } \ + if (x == h->n_buckets) { \ + if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ + else x = i; \ + } \ + } \ + } \ + if (__ac_isempty(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; ++h->n_occupied; \ + *ret = 1; \ + } else if (__ac_isdel(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; \ + *ret = 2; \ + } else *ret = 0; \ + return x; \ + } \ + static inline void kh_del_##name(kh_##name##_t *h, khint_t x) \ + { \ + if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ + __ac_set_isdel_true(h->flags, x); \ + --h->size; \ + } \ + } + +/* --- BEGIN OF HASH FUNCTIONS --- */ + +/*! @function + @abstract Integer hash function + @param key The integer [uint32_t] + @return The hash value [khint_t] + */ +#define kh_int_hash_func(key) (uint32_t)(key) +/*! @function + @abstract Integer comparison function + */ +#define kh_int_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract 64-bit integer hash function + @param key The integer [uint64_t] + @return The hash value [khint_t] + */ +#define kh_int64_hash_func(key) (uint32_t)((key)>>33^(key)^(key)<<11) +/*! @function + @abstract 64-bit integer comparison function + */ +#define kh_int64_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract const char* hash function + @param s Pointer to a null terminated string + @return The hash value + */ +static inline khint_t __ac_X31_hash_string(const char *s) +{ + khint_t h = *s; + if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s; + return h; +} +/*! @function + @abstract Another interface to const char* hash function + @param key Pointer to a null terminated string [const char*] + @return The hash value [khint_t] + */ +#define kh_str_hash_func(key) __ac_X31_hash_string(key) +/*! @function + @abstract Const char* comparison function + */ +#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) + +/* --- END OF HASH FUNCTIONS --- */ + +/* Other necessary macros... */ + +/*! + @abstract Type of the hash table. + @param name Name of the hash table [symbol] + */ +#define khash_t(name) kh_##name##_t + +/*! @function + @abstract Initiate a hash table. + @param name Name of the hash table [symbol] + @return Pointer to the hash table [khash_t(name)*] + */ +#define kh_init(name) kh_init_##name() + +/*! @function + @abstract Destroy a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_destroy(name, h) kh_destroy_##name(h) + +/*! @function + @abstract Reset a hash table without deallocating memory. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_clear(name, h) kh_clear_##name(h) + +/*! @function + @abstract Resize a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param s New size [khint_t] + */ +#define kh_resize(name, h, s) kh_resize_##name(h, s) + +/*! @function + @abstract Insert a key to the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @param r Extra return code: 0 if the key is present in the hash table; + 1 if the bucket is empty (never used); 2 if the element in + the bucket has been deleted [int*] + @return Iterator to the inserted element [khint_t] + */ +#define kh_put(name, h, k, r) kh_put_##name(h, k, r) + +/*! @function + @abstract Retrieve a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @return Iterator to the found element, or kh_end(h) is the element is absent [khint_t] + */ +#define kh_get(name, h, k) kh_get_##name(h, k) + +/*! @function + @abstract Remove a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Iterator to the element to be deleted [khint_t] + */ +#define kh_del(name, h, k) kh_del_##name(h, k) + + +/*! @function + @abstract Test whether a bucket contains data. + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return 1 if containing data; 0 otherwise [int] + */ +#define kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) + +/*! @function + @abstract Get key given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Key [type of keys] + */ +#define kh_key(h, x) ((h)->keys[x]) + +/*! @function + @abstract Get value given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Value [type of values] + @discussion For hash sets, calling this results in segfault. + */ +#define kh_val(h, x) ((h)->vals[x]) + +/*! @function + @abstract Alias of kh_val() + */ +#define kh_value(h, x) ((h)->vals[x]) + +/*! @function + @abstract Get the start iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The start iterator [khint_t] + */ +#define kh_begin(h) (khint_t)(0) + +/*! @function + @abstract Get the end iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The end iterator [khint_t] + */ +#define kh_end(h) ((h)->n_buckets) + +/*! @function + @abstract Get the number of elements in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of elements in the hash table [khint_t] + */ +#define kh_size(h) ((h)->size) + +/*! @function + @abstract Get the number of buckets in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of buckets in the hash table [khint_t] + */ +#define kh_n_buckets(h) ((h)->n_buckets) + +/* More conenient interfaces */ + +/*! @function + @abstract Instantiate a hash set containing integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT(name) \ + KHASH_INIT(name, uint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT(name, khval_t) \ + KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT64(name) \ + KHASH_INIT(name, uint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT64(name, khval_t) \ + KHASH_INIT(name, uint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) + +typedef const char *kh_cstr_t; +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_STR(name) \ + KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_STR(name, khval_t) \ + KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) + +#endif /* __AC_KHASH_H */ diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.c.pysam.c new file mode 100755 index 0000000..88d92f5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.c.pysam.c @@ -0,0 +1,634 @@ +#include "pysam.h" + +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* Probably I will not do socket programming in the next few years and + therefore I decide to heavily annotate this file, for Linux and + Windows as well. -lh3 */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#else +#include +#include +#include +#endif + +#include "knetfile.h" + +/* In winsock.h, the type of a socket is SOCKET, which is: "typedef + * u_int SOCKET". An invalid SOCKET is: "(SOCKET)(~0)", or signed + * integer -1. In knetfile.c, I use "int" for socket type + * throughout. This should be improved to avoid confusion. + * + * In Linux/Mac, recv() and read() do almost the same thing. You can see + * in the header file that netread() is simply an alias of read(). In + * Windows, however, they are different and using recv() is mandatory. + */ + +/* This function tests if the file handler is ready for reading (or + * writing if is_read==0). */ +static int socket_wait(int fd, int is_read) +{ + fd_set fds, *fdr = 0, *fdw = 0; + struct timeval tv; + int ret; + tv.tv_sec = 5; tv.tv_usec = 0; // 5 seconds time out + FD_ZERO(&fds); + FD_SET(fd, &fds); + if (is_read) fdr = &fds; + else fdw = &fds; + ret = select(fd+1, fdr, fdw, 0, &tv); +#ifndef _WIN32 + if (ret == -1) perror("select"); +#else + if (ret == 0) + fprintf(pysamerr, "select time-out\n"); + else if (ret == SOCKET_ERROR) + fprintf(pysamerr, "select: %d\n", WSAGetLastError()); +#endif + return ret; +} + +#ifndef _WIN32 +/* This function does not work with Windows due to the lack of + * getaddrinfo() in winsock. It is addapted from an example in "Beej's + * Guide to Network Programming" (http://beej.us/guide/bgnet/). */ +static int socket_connect(const char *host, const char *port) +{ +#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0) + + int on = 1, fd; + struct linger lng = { 0, 0 }; + struct addrinfo hints, *res; + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + /* In Unix/Mac, getaddrinfo() is the most convenient way to get + * server information. */ + if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo"); + if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket"); + /* The following two setsockopt() are used by ftplib + * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they + * necessary. */ + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt"); + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt"); + if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect"); + freeaddrinfo(res); + return fd; +} +#else +/* MinGW's printf has problem with "%lld" */ +char *int64tostr(char *buf, int64_t x) +{ + int cnt; + int i = 0; + do { + buf[i++] = '0' + x % 10; + x /= 10; + } while (x); + buf[i] = 0; + for (cnt = i, i = 0; i < cnt/2; ++i) { + int c = buf[i]; buf[i] = buf[cnt-i-1]; buf[cnt-i-1] = c; + } + return buf; +} + +int64_t strtoint64(const char *buf) +{ + int64_t x; + for (x = 0; *buf != '\0'; ++buf) + x = x * 10 + ((int64_t) *buf - 48); + return x; +} +/* In windows, the first thing is to establish the TCP connection. */ +int knet_win32_init() +{ + WSADATA wsaData; + return WSAStartup(MAKEWORD(2, 2), &wsaData); +} +void knet_win32_destroy() +{ + WSACleanup(); +} +/* A slightly modfied version of the following function also works on + * Mac (and presummably Linux). However, this function is not stable on + * my Mac. It sometimes works fine but sometimes does not. Therefore for + * non-Windows OS, I do not use this one. */ +static SOCKET socket_connect(const char *host, const char *port) +{ +#define __err_connect(func) \ + do { \ + fprintf(pysamerr, "%s: %d\n", func, WSAGetLastError()); \ + return -1; \ + } while (0) + + int on = 1; + SOCKET fd; + struct linger lng = { 0, 0 }; + struct sockaddr_in server; + struct hostent *hp = 0; + // open socket + if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) __err_connect("socket"); + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on)) == -1) __err_connect("setsockopt"); + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&lng, sizeof(lng)) == -1) __err_connect("setsockopt"); + // get host info + if (isalpha(host[0])) hp = gethostbyname(host); + else { + struct in_addr addr; + addr.s_addr = inet_addr(host); + hp = gethostbyaddr((char*)&addr, 4, AF_INET); + } + if (hp == 0) __err_connect("gethost"); + // connect + server.sin_addr.s_addr = *((unsigned long*)hp->h_addr); + server.sin_family= AF_INET; + server.sin_port = htons(atoi(port)); + if (connect(fd, (struct sockaddr*)&server, sizeof(server)) != 0) __err_connect("connect"); + // freehostent(hp); // strangely in MSDN, hp is NOT freed (memory leak?!) + return fd; +} +#endif + +static off_t my_netread(int fd, void *buf, off_t len) +{ + off_t rest = len, curr, l = 0; + /* recv() and read() may not read the required length of data with + * one call. They have to be called repeatedly. */ + while (rest) { + if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading + curr = netread(fd, buf + l, rest); + /* According to the glibc manual, section 13.2, a zero returned + * value indicates end-of-file (EOF), which should mean that + * read() will not return zero if EOF has not been met but data + * are not immediately available. */ + if (curr == 0) break; + l += curr; rest -= curr; + } + return l; +} + +/************************* + * FTP specific routines * + *************************/ + +static int kftp_get_response(knetFile *ftp) +{ +#ifndef _WIN32 + unsigned char c; +#else + char c; +#endif + int n = 0; + char *p; + if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0; + while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O + //fputc(c, pysamerr); + if (n >= ftp->max_response) { + ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256; + ftp->response = realloc(ftp->response, ftp->max_response); + } + ftp->response[n++] = c; + if (c == '\n') { + if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2]) + && ftp->response[3] != '-') break; + n = 0; + continue; + } + } + if (n < 2) return -1; + ftp->response[n-2] = 0; + return strtol(ftp->response, &p, 0); +} + +static int kftp_send_cmd(knetFile *ftp, const char *cmd, int is_get) +{ + if (socket_wait(ftp->ctrl_fd, 0) <= 0) return -1; // socket is not ready for writing + netwrite(ftp->ctrl_fd, cmd, strlen(cmd)); + return is_get? kftp_get_response(ftp) : 0; +} + +static int kftp_pasv_prep(knetFile *ftp) +{ + char *p; + int v[6]; + kftp_send_cmd(ftp, "PASV\r\n", 1); + for (p = ftp->response; *p && *p != '('; ++p); + if (*p != '(') return -1; + ++p; + sscanf(p, "%d,%d,%d,%d,%d,%d", &v[0], &v[1], &v[2], &v[3], &v[4], &v[5]); + memcpy(ftp->pasv_ip, v, 4 * sizeof(int)); + ftp->pasv_port = (v[4]<<8&0xff00) + v[5]; + return 0; +} + + +static int kftp_pasv_connect(knetFile *ftp) +{ + char host[80], port[10]; + if (ftp->pasv_port == 0) { + fprintf(pysamerr, "[kftp_pasv_connect] kftp_pasv_prep() is not called before hand.\n"); + return -1; + } + sprintf(host, "%d.%d.%d.%d", ftp->pasv_ip[0], ftp->pasv_ip[1], ftp->pasv_ip[2], ftp->pasv_ip[3]); + sprintf(port, "%d", ftp->pasv_port); + ftp->fd = socket_connect(host, port); + if (ftp->fd == -1) return -1; + return 0; +} + +int kftp_connect(knetFile *ftp) +{ + ftp->ctrl_fd = socket_connect(ftp->host, ftp->port); + if (ftp->ctrl_fd == -1) return -1; + kftp_get_response(ftp); + kftp_send_cmd(ftp, "USER anonymous\r\n", 1); + kftp_send_cmd(ftp, "PASS kftp@\r\n", 1); + kftp_send_cmd(ftp, "TYPE I\r\n", 1); + return 0; +} + +int kftp_reconnect(knetFile *ftp) +{ + if (ftp->ctrl_fd != -1) { + netclose(ftp->ctrl_fd); + ftp->ctrl_fd = -1; + } + netclose(ftp->fd); + ftp->fd = -1; + return kftp_connect(ftp); +} + +// initialize ->type, ->host, ->retr and ->size +knetFile *kftp_parse_url(const char *fn, const char *mode) +{ + knetFile *fp; + char *p; + int l; + if (strstr(fn, "ftp://") != fn) return 0; + for (p = (char*)fn + 6; *p && *p != '/'; ++p); + if (*p != '/') return 0; + l = p - fn - 6; + fp = calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_FTP; + fp->fd = -1; + /* the Linux/Mac version of socket_connect() also recognizes a port + * like "ftp", but the Windows version does not. */ + fp->port = strdup("21"); + fp->host = calloc(l + 1, 1); + if (strchr(mode, 'c')) fp->no_reconnect = 1; + strncpy(fp->host, fn + 6, l); + fp->retr = calloc(strlen(p) + 8, 1); + sprintf(fp->retr, "RETR %s\r\n", p); + fp->size_cmd = calloc(strlen(p) + 8, 1); + sprintf(fp->size_cmd, "SIZE %s\r\n", p); + fp->seek_offset = 0; + return fp; +} +// place ->fd at offset off +int kftp_connect_file(knetFile *fp) +{ + int ret; + long long file_size; + if (fp->fd != -1) { + netclose(fp->fd); + if (fp->no_reconnect) kftp_get_response(fp); + } + kftp_pasv_prep(fp); + kftp_send_cmd(fp, fp->size_cmd, 1); +#ifndef _WIN32 + if ( sscanf(fp->response,"%*d %lld", &file_size) != 1 ) + { + fprintf(pysamerr,"[kftp_connect_file] %s\n", fp->response); + return -1; + } +#else + const char *p = fp->response; + while (*p != ' ') ++p; + while (*p < '0' || *p > '9') ++p; + file_size = strtoint64(p); +#endif + fp->file_size = file_size; + if (fp->offset>=0) { + char tmp[32]; +#ifndef _WIN32 + sprintf(tmp, "REST %lld\r\n", (long long)fp->offset); +#else + strcpy(tmp, "REST "); + int64tostr(tmp + 5, fp->offset); + strcat(tmp, "\r\n"); +#endif + kftp_send_cmd(fp, tmp, 1); + } + kftp_send_cmd(fp, fp->retr, 0); + kftp_pasv_connect(fp); + ret = kftp_get_response(fp); + if (ret != 150) { + fprintf(pysamerr, "[kftp_connect_file] %s\n", fp->response); + netclose(fp->fd); + fp->fd = -1; + return -1; + } + fp->is_ready = 1; + return 0; +} + + +/************************** + * HTTP specific routines * + **************************/ + +knetFile *khttp_parse_url(const char *fn, const char *mode) +{ + knetFile *fp; + char *p, *proxy, *q; + int l; + if (strstr(fn, "http://") != fn) return 0; + // set ->http_host + for (p = (char*)fn + 7; *p && *p != '/'; ++p); + l = p - fn - 7; + fp = calloc(1, sizeof(knetFile)); + fp->http_host = calloc(l + 1, 1); + strncpy(fp->http_host, fn + 7, l); + fp->http_host[l] = 0; + for (q = fp->http_host; *q && *q != ':'; ++q); + if (*q == ':') *q++ = 0; + // get http_proxy + proxy = getenv("http_proxy"); + // set ->host, ->port and ->path + if (proxy == 0) { + fp->host = strdup(fp->http_host); // when there is no proxy, server name is identical to http_host name. + fp->port = strdup(*q? q : "80"); + fp->path = strdup(*p? p : "/"); + } else { + fp->host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy); + for (q = fp->host; *q && *q != ':'; ++q); + if (*q == ':') *q++ = 0; + fp->port = strdup(*q? q : "80"); + fp->path = strdup(fn); + } + fp->type = KNF_TYPE_HTTP; + fp->ctrl_fd = fp->fd = -1; + fp->seek_offset = 0; + return fp; +} + +int khttp_connect_file(knetFile *fp) +{ + int ret, l = 0; + char *buf, *p; + if (fp->fd != -1) netclose(fp->fd); + fp->fd = socket_connect(fp->host, fp->port); + buf = calloc(0x10000, 1); // FIXME: I am lazy... But in principle, 64KB should be large enough. + l += sprintf(buf + l, "GET %s HTTP/1.0\r\nHost: %s\r\n", fp->path, fp->http_host); + l += sprintf(buf + l, "Range: bytes=%lld-\r\n", (long long)fp->offset); + l += sprintf(buf + l, "\r\n"); + netwrite(fp->fd, buf, l); + l = 0; + while (netread(fp->fd, buf + l, 1)) { // read HTTP header; FIXME: bad efficiency + if (buf[l] == '\n' && l >= 3) + if (strncmp(buf + l - 3, "\r\n\r\n", 4) == 0) break; + ++l; + } + buf[l] = 0; + if (l < 14) { // prematured header + netclose(fp->fd); + fp->fd = -1; + return -1; + } + ret = strtol(buf + 8, &p, 0); // HTTP return code + if (ret == 200 && fp->offset>0) { // 200 (complete result); then skip beginning of the file + off_t rest = fp->offset; + while (rest) { + off_t l = rest < 0x10000? rest : 0x10000; + rest -= my_netread(fp->fd, buf, l); + } + } else if (ret != 206 && ret != 200) { + free(buf); + fprintf(pysamerr, "[khttp_connect_file] fail to open file (HTTP code: %d).\n", ret); + netclose(fp->fd); + fp->fd = -1; + return -1; + } + free(buf); + fp->is_ready = 1; + return 0; +} + +/******************** + * Generic routines * + ********************/ + +knetFile *knet_open(const char *fn, const char *mode) +{ + knetFile *fp = 0; + if (mode[0] != 'r') { + fprintf(pysamerr, "[kftp_open] only mode \"r\" is supported.\n"); + return 0; + } + if (strstr(fn, "ftp://") == fn) { + fp = kftp_parse_url(fn, mode); + if (fp == 0) return 0; + if (kftp_connect(fp) == -1) { + knet_close(fp); + return 0; + } + kftp_connect_file(fp); + } else if (strstr(fn, "http://") == fn) { + fp = khttp_parse_url(fn, mode); + if (fp == 0) return 0; + khttp_connect_file(fp); + } else { // local file +#ifdef _WIN32 + /* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may + * be undefined on some systems, although it is defined on my + * Mac and the Linux I have tested on. */ + int fd = open(fn, O_RDONLY | O_BINARY); +#else + int fd = open(fn, O_RDONLY); +#endif + if (fd == -1) { + perror("open"); + return 0; + } + fp = (knetFile*)calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_LOCAL; + fp->fd = fd; + fp->ctrl_fd = -1; + } + if (fp && fp->fd == -1) { + knet_close(fp); + return 0; + } + return fp; +} + +knetFile *knet_dopen(int fd, const char *mode) +{ + knetFile *fp = (knetFile*)calloc(1, sizeof(knetFile)); + fp->type = KNF_TYPE_LOCAL; + fp->fd = fd; + return fp; +} + +off_t knet_read(knetFile *fp, void *buf, off_t len) +{ + off_t l = 0; + if (fp->fd == -1) return 0; + if (fp->type == KNF_TYPE_FTP) { + if (fp->is_ready == 0) { + if (!fp->no_reconnect) kftp_reconnect(fp); + kftp_connect_file(fp); + } + } else if (fp->type == KNF_TYPE_HTTP) { + if (fp->is_ready == 0) + khttp_connect_file(fp); + } + if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX + off_t rest = len, curr; + while (rest) { + curr = read(fp->fd, buf + l, rest); + if (curr == 0) break; + l += curr; rest -= curr; + } + } else l = my_netread(fp->fd, buf, len); + fp->offset += l; + return l; +} + +off_t knet_seek(knetFile *fp, int64_t off, int whence) +{ + if (whence == SEEK_SET && off == fp->offset) return 0; + if (fp->type == KNF_TYPE_LOCAL) { + /* Be aware that lseek() returns the offset after seeking, + * while fseek() returns zero on success. */ + off_t offset = lseek(fp->fd, off, whence); + if (offset == -1) { + // Be silent, it is OK for knet_seek to fail when the file is streamed + // fprintf(pysamerr,"[knet_seek] %s\n", strerror(errno)); + return -1; + } + fp->offset = offset; + return 0; + } + else if (fp->type == KNF_TYPE_FTP) + { + if (whence==SEEK_CUR) + fp->offset += off; + else if (whence==SEEK_SET) + fp->offset = off; + else if ( whence==SEEK_END) + fp->offset = fp->file_size+off; + fp->is_ready = 0; + return 0; + } + else if (fp->type == KNF_TYPE_HTTP) + { + if (whence == SEEK_END) { // FIXME: can we allow SEEK_END in future? + fprintf(pysamerr, "[knet_seek] SEEK_END is not supported for HTTP. Offset is unchanged.\n"); + errno = ESPIPE; + return -1; + } + if (whence==SEEK_CUR) + fp->offset += off; + else if (whence==SEEK_SET) + fp->offset = off; + fp->is_ready = 0; + return fp->offset; + } + errno = EINVAL; + fprintf(pysamerr,"[knet_seek] %s\n", strerror(errno)); + return -1; +} + +int knet_close(knetFile *fp) +{ + if (fp == 0) return 0; + if (fp->ctrl_fd != -1) netclose(fp->ctrl_fd); // FTP specific + if (fp->fd != -1) { + /* On Linux/Mac, netclose() is an alias of close(), but on + * Windows, it is an alias of closesocket(). */ + if (fp->type == KNF_TYPE_LOCAL) close(fp->fd); + else netclose(fp->fd); + } + free(fp->host); free(fp->port); + free(fp->response); free(fp->retr); free(fp->size_cmd); // FTP specific + free(fp->path); free(fp->http_host); // HTTP specific + free(fp); + return 0; +} + +#ifdef KNETFILE_MAIN +int main(void) +{ + char *buf; + knetFile *fp; + int type = 4, l; +#ifdef _WIN32 + knet_win32_init(); +#endif + buf = calloc(0x100000, 1); + if (type == 0) { + fp = knet_open("knetfile.c", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 1) { // NCBI FTP, large file + fp = knet_open("ftp://ftp.ncbi.nih.gov/1000genomes/ftp/data/NA12878/alignment/NA12878.chrom6.SLX.SRP000032.2009_06.bam", "r"); + knet_seek(fp, 2500000000ll, SEEK_SET); + l = knet_read(fp, buf, 255); + } else if (type == 2) { + fp = knet_open("ftp://ftp.sanger.ac.uk/pub4/treefam/tmp/index.shtml", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 3) { + fp = knet_open("http://www.sanger.ac.uk/Users/lh3/index.shtml", "r"); + knet_seek(fp, 1000, SEEK_SET); + } else if (type == 4) { + fp = knet_open("http://www.sanger.ac.uk/Users/lh3/ex1.bam", "r"); + knet_read(fp, buf, 10000); + knet_seek(fp, 20000, SEEK_SET); + knet_seek(fp, 10000, SEEK_SET); + l = knet_read(fp, buf+10000, 10000000) + 10000; + } + if (type != 4 && type != 1) { + knet_read(fp, buf, 255); + buf[255] = 0; + printf("%s\n", buf); + } else write(fileno(stdout), buf, l); + knet_close(fp); + free(buf); + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.h b/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.h new file mode 100755 index 0000000..0a0e66f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/knetfile.h @@ -0,0 +1,75 @@ +#ifndef KNETFILE_H +#define KNETFILE_H + +#include +#include + +#ifndef _WIN32 +#define netread(fd, ptr, len) read(fd, ptr, len) +#define netwrite(fd, ptr, len) write(fd, ptr, len) +#define netclose(fd) close(fd) +#else +#include +#define netread(fd, ptr, len) recv(fd, ptr, len, 0) +#define netwrite(fd, ptr, len) send(fd, ptr, len, 0) +#define netclose(fd) closesocket(fd) +#endif + +// FIXME: currently I/O is unbuffered + +#define KNF_TYPE_LOCAL 1 +#define KNF_TYPE_FTP 2 +#define KNF_TYPE_HTTP 3 + +typedef struct knetFile_s { + int type, fd; + int64_t offset; + char *host, *port; + + // the following are for FTP only + int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect, is_ready; + char *response, *retr, *size_cmd; + int64_t seek_offset; // for lazy seek + int64_t file_size; + + // the following are for HTTP only + char *path, *http_host; +} knetFile; + +#define knet_tell(fp) ((fp)->offset) +#define knet_fileno(fp) ((fp)->fd) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + int knet_win32_init(); + void knet_win32_destroy(); +#endif + + knetFile *knet_open(const char *fn, const char *mode); + + /* + This only works with local files. + */ + knetFile *knet_dopen(int fd, const char *mode); + + /* + If ->is_ready==0, this routine updates ->fd; otherwise, it simply + reads from ->fd. + */ + off_t knet_read(knetFile *fp, void *buf, off_t len); + + /* + This routine only sets ->offset and ->is_ready=0. It does not + communicate with the FTP server. + */ + off_t knet_seek(knetFile *fp, int64_t off, int whence); + int knet_close(knetFile *fp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/kseq.h b/code/utilities/CPAT-1.2.2/lib/tabix/kseq.h new file mode 100755 index 0000000..82face0 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/kseq.h @@ -0,0 +1,227 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* + 2009-07-16 (lh3): in kstream_t, change "char*" to "unsigned char*" + */ + +/* Last Modified: 12APR2009 */ + +#ifndef AC_KSEQ_H +#define AC_KSEQ_H + +#include +#include +#include + +#define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r +#define KS_SEP_TAB 1 // isspace() && !' ' +#define KS_SEP_MAX 1 + +#define __KS_TYPE(type_t) \ + typedef struct __kstream_t { \ + unsigned char *buf; \ + int begin, end, is_eof; \ + type_t f; \ + } kstream_t; + +#define ks_eof(ks) ((ks)->is_eof && (ks)->begin >= (ks)->end) +#define ks_rewind(ks) ((ks)->is_eof = (ks)->begin = (ks)->end = 0) + +#define __KS_BASIC(type_t, __bufsize) \ + static inline kstream_t *ks_init(type_t f) \ + { \ + kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t)); \ + ks->f = f; \ + ks->buf = malloc(__bufsize); \ + return ks; \ + } \ + static inline void ks_destroy(kstream_t *ks) \ + { \ + if (ks) { \ + free(ks->buf); \ + free(ks); \ + } \ + } + +#define __KS_GETC(__read, __bufsize) \ + static inline int ks_getc(kstream_t *ks) \ + { \ + if (ks->is_eof && ks->begin >= ks->end) return -1; \ + if (ks->begin >= ks->end) { \ + ks->begin = 0; \ + ks->end = __read(ks->f, ks->buf, __bufsize); \ + if (ks->end < __bufsize) ks->is_eof = 1; \ + if (ks->end == 0) return -1; \ + } \ + return (int)ks->buf[ks->begin++]; \ + } + +#ifndef KSTRING_T +#define KSTRING_T kstring_t +typedef struct __kstring_t { + size_t l, m; + char *s; +} kstring_t; +#endif + +#ifndef kroundup32 +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +#define __KS_GETUNTIL(__read, __bufsize) \ + static int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \ + { \ + if (dret) *dret = 0; \ + str->l = 0; \ + if (ks->begin >= ks->end && ks->is_eof) return -1; \ + for (;;) { \ + int i; \ + if (ks->begin >= ks->end) { \ + if (!ks->is_eof) { \ + ks->begin = 0; \ + ks->end = __read(ks->f, ks->buf, __bufsize); \ + if (ks->end < __bufsize) ks->is_eof = 1; \ + if (ks->end == 0) break; \ + } else break; \ + } \ + if (delimiter > KS_SEP_MAX) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (ks->buf[i] == delimiter) break; \ + } else if (delimiter == KS_SEP_SPACE) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (isspace(ks->buf[i])) break; \ + } else if (delimiter == KS_SEP_TAB) { \ + for (i = ks->begin; i < ks->end; ++i) \ + if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \ + } else i = 0; /* never come to here! */ \ + if (str->m - str->l < i - ks->begin + 1) { \ + str->m = str->l + (i - ks->begin) + 1; \ + kroundup32(str->m); \ + str->s = (char*)realloc(str->s, str->m); \ + } \ + memcpy(str->s + str->l, ks->buf + ks->begin, i - ks->begin); \ + str->l = str->l + (i - ks->begin); \ + ks->begin = i + 1; \ + if (i < ks->end) { \ + if (dret) *dret = ks->buf[i]; \ + break; \ + } \ + } \ + if (str->l == 0) { \ + str->m = 1; \ + str->s = (char*)calloc(1, 1); \ + } \ + str->s[str->l] = '\0'; \ + return str->l; \ + } + +#define KSTREAM_INIT(type_t, __read, __bufsize) \ + __KS_TYPE(type_t) \ + __KS_BASIC(type_t, __bufsize) \ + __KS_GETC(__read, __bufsize) \ + __KS_GETUNTIL(__read, __bufsize) + +#define __KSEQ_BASIC(type_t) \ + static inline kseq_t *kseq_init(type_t fd) \ + { \ + kseq_t *s = (kseq_t*)calloc(1, sizeof(kseq_t)); \ + s->f = ks_init(fd); \ + return s; \ + } \ + static inline void kseq_rewind(kseq_t *ks) \ + { \ + ks->last_char = 0; \ + ks->f->is_eof = ks->f->begin = ks->f->end = 0; \ + } \ + static inline void kseq_destroy(kseq_t *ks) \ + { \ + if (!ks) return; \ + free(ks->name.s); free(ks->comment.s); free(ks->seq.s); free(ks->qual.s); \ + ks_destroy(ks->f); \ + free(ks); \ + } + +/* Return value: + >=0 length of the sequence (normal) + -1 end-of-file + -2 truncated quality string + */ +#define __KSEQ_READ \ + static int kseq_read(kseq_t *seq) \ + { \ + int c; \ + kstream_t *ks = seq->f; \ + if (seq->last_char == 0) { /* then jump to the next header line */ \ + while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \ + if (c == -1) return -1; /* end of file */ \ + seq->last_char = c; \ + } /* the first header char has been read */ \ + seq->comment.l = seq->seq.l = seq->qual.l = 0; \ + if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; \ + if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0); \ + while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \ + if (isgraph(c)) { /* printable non-space character */ \ + if (seq->seq.l + 1 >= seq->seq.m) { /* double the memory */ \ + seq->seq.m = seq->seq.l + 2; \ + kroundup32(seq->seq.m); /* rounded to next closest 2^k */ \ + seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \ + } \ + seq->seq.s[seq->seq.l++] = (char)c; \ + } \ + } \ + if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */ \ + seq->seq.s[seq->seq.l] = 0; /* null terminated string */ \ + if (c != '+') return seq->seq.l; /* FASTA */ \ + if (seq->qual.m < seq->seq.m) { /* allocate enough memory */ \ + seq->qual.m = seq->seq.m; \ + seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \ + } \ + while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \ + if (c == -1) return -2; /* we should not stop here */ \ + while ((c = ks_getc(ks)) != -1 && seq->qual.l < seq->seq.l) \ + if (c >= 33 && c <= 127) seq->qual.s[seq->qual.l++] = (unsigned char)c; \ + seq->qual.s[seq->qual.l] = 0; /* null terminated string */ \ + seq->last_char = 0; /* we have not come to the next header line */ \ + if (seq->seq.l != seq->qual.l) return -2; /* qual string is shorter than seq string */ \ + return seq->seq.l; \ + } + +#define __KSEQ_TYPE(type_t) \ + typedef struct { \ + kstring_t name, comment, seq, qual; \ + int last_char; \ + kstream_t *f; \ + } kseq_t; + +#define KSEQ_INIT(type_t, __read) \ + KSTREAM_INIT(type_t, __read, 4096) \ + __KSEQ_TYPE(type_t) \ + __KSEQ_BASIC(type_t) \ + __KSEQ_READ + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/ksort.h b/code/utilities/CPAT-1.2.2/lib/tabix/ksort.h new file mode 100755 index 0000000..16a03fd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/ksort.h @@ -0,0 +1,271 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* + 2008-11-16 (0.1.4): + + * Fixed a bug in introsort() that happens in rare cases. + + 2008-11-05 (0.1.3): + + * Fixed a bug in introsort() for complex comparisons. + + * Fixed a bug in mergesort(). The previous version is not stable. + + 2008-09-15 (0.1.2): + + * Accelerated introsort. On my Mac (not on another Linux machine), + my implementation is as fast as std::sort on random input. + + * Added combsort and in introsort, switch to combsort if the + recursion is too deep. + + 2008-09-13 (0.1.1): + + * Added k-small algorithm + + 2008-09-05 (0.1.0): + + * Initial version + +*/ + +#ifndef AC_KSORT_H +#define AC_KSORT_H + +#include +#include + +typedef struct { + void *left, *right; + int depth; +} ks_isort_stack_t; + +#define KSORT_SWAP(type_t, a, b) { register type_t t=(a); (a)=(b); (b)=t; } + +#define KSORT_INIT(name, type_t, __sort_lt) \ + void ks_mergesort_##name(size_t n, type_t array[], type_t temp[]) \ + { \ + type_t *a2[2], *a, *b; \ + int curr, shift; \ + \ + a2[0] = array; \ + a2[1] = temp? temp : (type_t*)malloc(sizeof(type_t) * n); \ + for (curr = 0, shift = 0; (1ul<> 1) - 1; i != (size_t)(-1); --i) \ + ks_heapadjust_##name(i, lsize, l); \ + } \ + void ks_heapsort_##name(size_t lsize, type_t l[]) \ + { \ + size_t i; \ + for (i = lsize - 1; i > 0; --i) { \ + type_t tmp; \ + tmp = *l; *l = l[i]; l[i] = tmp; ks_heapadjust_##name(0, i, l); \ + } \ + } \ + inline void __ks_insertsort_##name(type_t *s, type_t *t) \ + { \ + type_t *i, *j, swap_tmp; \ + for (i = s + 1; i < t; ++i) \ + for (j = i; j > s && __sort_lt(*j, *(j-1)); --j) { \ + swap_tmp = *j; *j = *(j-1); *(j-1) = swap_tmp; \ + } \ + } \ + void ks_combsort_##name(size_t n, type_t a[]) \ + { \ + const double shrink_factor = 1.2473309501039786540366528676643; \ + int do_swap; \ + size_t gap = n; \ + type_t tmp, *i, *j; \ + do { \ + if (gap > 2) { \ + gap = (size_t)(gap / shrink_factor); \ + if (gap == 9 || gap == 10) gap = 11; \ + } \ + do_swap = 0; \ + for (i = a; i < a + n - gap; ++i) { \ + j = i + gap; \ + if (__sort_lt(*j, *i)) { \ + tmp = *i; *i = *j; *j = tmp; \ + do_swap = 1; \ + } \ + } \ + } while (do_swap || gap > 2); \ + if (gap != 1) __ks_insertsort_##name(a, a + n); \ + } \ + void ks_introsort_##name(size_t n, type_t a[]) \ + { \ + int d; \ + ks_isort_stack_t *top, *stack; \ + type_t rp, swap_tmp; \ + type_t *s, *t, *i, *j, *k; \ + \ + if (n < 1) return; \ + else if (n == 2) { \ + if (__sort_lt(a[1], a[0])) { swap_tmp = a[0]; a[0] = a[1]; a[1] = swap_tmp; } \ + return; \ + } \ + for (d = 2; 1ul<>1) + 1; \ + if (__sort_lt(*k, *i)) { \ + if (__sort_lt(*k, *j)) k = j; \ + } else k = __sort_lt(*j, *i)? i : j; \ + rp = *k; \ + if (k != t) { swap_tmp = *k; *k = *t; *t = swap_tmp; } \ + for (;;) { \ + do ++i; while (__sort_lt(*i, rp)); \ + do --j; while (i <= j && __sort_lt(rp, *j)); \ + if (j <= i) break; \ + swap_tmp = *i; *i = *j; *j = swap_tmp; \ + } \ + swap_tmp = *i; *i = *t; *t = swap_tmp; \ + if (i-s > t-i) { \ + if (i-s > 16) { top->left = s; top->right = i-1; top->depth = d; ++top; } \ + s = t-i > 16? i+1 : t; \ + } else { \ + if (t-i > 16) { top->left = i+1; top->right = t; top->depth = d; ++top; } \ + t = i-s > 16? i-1 : s; \ + } \ + } else { \ + if (top == stack) { \ + free(stack); \ + __ks_insertsort_##name(a, a+n); \ + return; \ + } else { --top; s = (type_t*)top->left; t = (type_t*)top->right; d = top->depth; } \ + } \ + } \ + } \ + /* This function is adapted from: http://ndevilla.free.fr/median/ */ \ + /* 0 <= kk < n */ \ + type_t ks_ksmall_##name(size_t n, type_t arr[], size_t kk) \ + { \ + type_t *low, *high, *k, *ll, *hh, *mid; \ + low = arr; high = arr + n - 1; k = arr + kk; \ + for (;;) { \ + if (high <= low) return *k; \ + if (high == low + 1) { \ + if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \ + return *k; \ + } \ + mid = low + (high - low) / 2; \ + if (__sort_lt(*high, *mid)) KSORT_SWAP(type_t, *mid, *high); \ + if (__sort_lt(*high, *low)) KSORT_SWAP(type_t, *low, *high); \ + if (__sort_lt(*low, *mid)) KSORT_SWAP(type_t, *mid, *low); \ + KSORT_SWAP(type_t, *mid, *(low+1)); \ + ll = low + 1; hh = high; \ + for (;;) { \ + do ++ll; while (__sort_lt(*ll, *low)); \ + do --hh; while (__sort_lt(*low, *hh)); \ + if (hh < ll) break; \ + KSORT_SWAP(type_t, *ll, *hh); \ + } \ + KSORT_SWAP(type_t, *low, *hh); \ + if (hh <= k) low = ll; \ + if (hh >= k) high = hh - 1; \ + } \ + } + +#define ks_mergesort(name, n, a, t) ks_mergesort_##name(n, a, t) +#define ks_introsort(name, n, a) ks_introsort_##name(n, a) +#define ks_combsort(name, n, a) ks_combsort_##name(n, a) +#define ks_heapsort(name, n, a) ks_heapsort_##name(n, a) +#define ks_heapmake(name, n, a) ks_heapmake_##name(n, a) +#define ks_heapadjust(name, i, n, a) ks_heapadjust_##name(i, n, a) +#define ks_ksmall(name, n, a, k) ks_ksmall_##name(n, a, k) + +#define ks_lt_generic(a, b) ((a) < (b)) +#define ks_lt_str(a, b) (strcmp((a), (b)) < 0) + +typedef const char *ksstr_t; + +#define KSORT_INIT_GENERIC(type_t) KSORT_INIT(type_t, type_t, ks_lt_generic) +#define KSORT_INIT_STR KSORT_INIT(str, ksstr_t, ks_lt_str) + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/kstring.c.pysam.c b/code/utilities/CPAT-1.2.2/lib/tabix/kstring.c.pysam.c new file mode 100755 index 0000000..3114a23 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/kstring.c.pysam.c @@ -0,0 +1,167 @@ +#include "pysam.h" + +#include +#include +#include +#include +#include +#include "kstring.h" + +int ksprintf(kstring_t *s, const char *fmt, ...) +{ + va_list ap; + int l; + va_start(ap, fmt); + l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snprintf'. + va_end(ap); + if (l + 1 > s->m - s->l) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + va_start(ap, fmt); + l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); + } + va_end(ap); + s->l += l; + return l; +} + +// s MUST BE a null terminated string; l = strlen(s) +int ksplit_core(char *s, int delimiter, int *_max, int **_offsets) +{ + int i, n, max, last_char, last_start, *offsets, l; + n = 0; max = *_max; offsets = *_offsets; + l = strlen(s); + +#define __ksplit_aux do { \ + if (_offsets) { \ + s[i] = 0; \ + if (n == max) { \ + max = max? max<<1 : 2; \ + offsets = (int*)realloc(offsets, sizeof(int) * max); \ + } \ + offsets[n++] = last_start; \ + } else ++n; \ + } while (0) + + for (i = 0, last_char = last_start = 0; i <= l; ++i) { + if (delimiter == 0) { + if (isspace(s[i]) || s[i] == 0) { + if (isgraph(last_char)) __ksplit_aux; // the end of a field + } else { + if (isspace(last_char) || last_char == 0) last_start = i; + } + } else { + if (s[i] == delimiter || s[i] == 0) { + if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field + } else { + if (last_char == delimiter || last_char == 0) last_start = i; + } + } + last_char = s[i]; + } + *_max = max; *_offsets = offsets; + return n; +} + +/********************** + * Boyer-Moore search * + **********************/ + +// reference: http://www-igm.univ-mlv.fr/~lecroq/string/node14.html +int *ksBM_prep(const uint8_t *pat, int m) +{ + int i, *suff, *prep, *bmGs, *bmBc; + prep = calloc(m + 256, 1); + bmGs = prep; bmBc = prep + m; + { // preBmBc() + for (i = 0; i < 256; ++i) bmBc[i] = m; + for (i = 0; i < m - 1; ++i) bmBc[pat[i]] = m - i - 1; + } + suff = calloc(m, sizeof(int)); + { // suffixes() + int f = 0, g; + suff[m - 1] = m; + g = m - 1; + for (i = m - 2; i >= 0; --i) { + if (i > g && suff[i + m - 1 - f] < i - g) + suff[i] = suff[i + m - 1 - f]; + else { + if (i < g) g = i; + f = i; + while (g >= 0 && pat[g] == pat[g + m - 1 - f]) --g; + suff[i] = f - g; + } + } + } + { // preBmGs() + int j = 0; + for (i = 0; i < m; ++i) bmGs[i] = m; + for (i = m - 1; i >= 0; --i) + if (suff[i] == i + 1) + for (; j < m - 1 - i; ++j) + if (bmGs[j] == m) + bmGs[j] = m - 1 - i; + for (i = 0; i <= m - 2; ++i) + bmGs[m - 1 - suff[i]] = m - 1 - i; + } + free(suff); + return prep; +} + +int *ksBM_search(const uint8_t *str, int n, const uint8_t *pat, int m, int *_prep, int *n_matches) +{ + int i, j, *prep, *bmGs, *bmBc; + int *matches = 0, mm = 0, nm = 0; + prep = _prep? _prep : ksBM_prep(pat, m); + bmGs = prep; bmBc = prep + m; + j = 0; + while (j <= n - m) { + for (i = m - 1; i >= 0 && pat[i] == str[i+j]; --i); + if (i < 0) { + if (nm == mm) { + mm = mm? mm<<1 : 1; + matches = realloc(matches, mm * sizeof(int)); + } + matches[nm++] = j; + j += bmGs[0]; + } else { + int max = bmBc[str[i+j]] - m + 1 + i; + if (max < bmGs[i]) max = bmGs[i]; + j += max; + } + } + *n_matches = nm; + if (_prep == 0) free(prep); + return matches; +} + +#ifdef KSTRING_MAIN +#include +int main() +{ + kstring_t *s; + int *fields, n, i; + s = (kstring_t*)calloc(1, sizeof(kstring_t)); + // test ksprintf() + ksprintf(s, " abcdefg: %d ", 100); + printf("'%s'\n", s->s); + // test ksplit() + fields = ksplit(s, 0, &n); + for (i = 0; i < n; ++i) + printf("field[%d] = '%s'\n", i, s->s + fields[i]); + free(s); + + { + static char *str = "abcdefgcdg"; + static char *pat = "cd"; + int n, *matches; + matches = ksBM_search(str, strlen(str), pat, strlen(pat), 0, &n); + printf("%d: \n", n); + for (i = 0; i < n; ++i) + printf("- %d\n", matches[i]); + free(matches); + } + return 0; +} +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/kstring.h b/code/utilities/CPAT-1.2.2/lib/tabix/kstring.h new file mode 100755 index 0000000..f4e5a99 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/kstring.h @@ -0,0 +1,68 @@ +#ifndef KSTRING_H +#define KSTRING_H + +#include +#include +#include + +#ifndef kroundup32 +#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) +#endif + +#ifndef KSTRING_T +#define KSTRING_T kstring_t +typedef struct __kstring_t { + size_t l, m; + char *s; +} kstring_t; +#endif + +int ksprintf(kstring_t *s, const char *fmt, ...); +int ksplit_core(char *s, int delimiter, int *_max, int **_offsets); + +// calculate the auxiliary array, allocated by calloc() +int *ksBM_prep(const uint8_t *pat, int m); + +/* Search pat in str and returned the list of matches. The size of the + * list is returned as n_matches. _prep is the array returned by + * ksBM_prep(). If it is a NULL pointer, ksBM_prep() will be called. */ +int *ksBM_search(const uint8_t *str, int n, const uint8_t *pat, int m, int *_prep, int *n_matches); + +static inline int kputsn(const char *p, int l, kstring_t *s) +{ + if (s->l + l + 1 >= s->m) { + s->m = s->l + l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + strncpy(s->s + s->l, p, l); + s->l += l; + s->s[s->l] = 0; + return l; +} + +static inline int kputs(const char *p, kstring_t *s) +{ + return kputsn(p, strlen(p), s); +} + +static inline int kputc(int c, kstring_t *s) +{ + if (s->l + 1 >= s->m) { + s->m = s->l + 2; + kroundup32(s->m); + s->s = (char*)realloc(s->s, s->m); + } + s->s[s->l++] = c; + s->s[s->l] = 0; + return c; +} + +static inline int *ksplit(kstring_t *s, int delimiter, int *n) +{ + int max = 0, *offsets = 0; + *n = ksplit_core(s->s, delimiter, &max, &offsets); + return offsets; +} + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/pysam.h b/code/utilities/CPAT-1.2.2/lib/tabix/pysam.h new file mode 100755 index 0000000..008cbbd --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/pysam.h @@ -0,0 +1,5 @@ +#ifndef PYSAM_H +#define PYSAM_H +#include "stdio.h" +extern FILE * pysamerr; +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tabix/tabix.h b/code/utilities/CPAT-1.2.2/lib/tabix/tabix.h new file mode 100755 index 0000000..7b4497a --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tabix/tabix.h @@ -0,0 +1,145 @@ +/* The MIT License + + Copyright (c) 2009 Genome Research Ltd (GRL), 2010 Broad Institute + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +#ifndef __TABIDX_H +#define __TABIDX_H + +#include +#include "kstring.h" +#include "bgzf.h" + +#define TI_PRESET_GENERIC 0 +#define TI_PRESET_SAM 1 +#define TI_PRESET_VCF 2 + +#define TI_FLAG_UCSC 0x10000 + +typedef int (*ti_fetch_f)(int l, const char *s, void *data); + +struct __ti_index_t; +typedef struct __ti_index_t ti_index_t; + +struct __ti_iter_t; +typedef struct __ti_iter_t *ti_iter_t; + +typedef struct { + BGZF *fp; + ti_index_t *idx; + char *fn, *fnidx; +} tabix_t; + +typedef struct { + int32_t preset; + int32_t sc, bc, ec; // seq col., beg col. and end col. + int32_t meta_char, line_skip; +} ti_conf_t; + +typedef struct { + int beg, end; + char *ss, *se; +} ti_interval_t; + +extern ti_conf_t ti_conf_gff, ti_conf_bed, ti_conf_psltbl, ti_conf_vcf, ti_conf_sam; // preset + +#ifdef __cplusplus +extern "C" { +#endif + + /******************* + * High-level APIs * + *******************/ + + tabix_t *ti_open(const char *fn, const char *fnidx); + int ti_lazy_index_load(tabix_t *t); + void ti_close(tabix_t *t); + ti_iter_t ti_query(tabix_t *t, const char *name, int beg, int end); + ti_iter_t ti_queryi(tabix_t *t, int tid, int beg, int end); + ti_iter_t ti_querys(tabix_t *t, const char *reg); + const char *ti_read(tabix_t *t, ti_iter_t iter, int *len); + + /* Destroy the iterator */ + void ti_iter_destroy(ti_iter_t iter); + + /* Get the list of sequence names. Each "char*" pointer points to a + * internal member of the index, so DO NOT modify the returned + * pointer; otherwise the index will be corrupted. The returned + * pointer should be freed by a single free() call by the routine + * calling this function. The number of sequences is returned at *n. */ + const char **ti_seqname(const ti_index_t *idx, int *n); + + /****************** + * Low-level APIs * + ******************/ + + /* Build the index for file . File .tbi will be generated + * and overwrite the file of the same name. Return -1 on failure. */ + int ti_index_build(const char *fn, const ti_conf_t *conf); + + /* Load the index from file .tbi. If is a URL and the index + * file is not in the working directory, .tbi will be + * downloaded. Return NULL on failure. */ + ti_index_t *ti_index_load(const char *fn); + + ti_index_t *ti_index_load_local(const char *fnidx); + + /* Destroy the index */ + void ti_index_destroy(ti_index_t *idx); + + /* Parse a region like: chr2, chr2:100, chr2:100-200. Return -1 on failure. */ + int ti_parse_region(const ti_index_t *idx, const char *str, int *tid, int *begin, int *end); + + int ti_get_tid(const ti_index_t *idx, const char *name); + + /* Get the iterator pointing to the first record at the current file + * position. If the file is just openned, the iterator points to the + * first record in the file. */ + ti_iter_t ti_iter_first(void); + + /* Get the iterator pointing to the first record in region tid:beg-end */ + ti_iter_t ti_iter_query(const ti_index_t *idx, int tid, int beg, int end); + + /* Get the data line pointed by the iterator and iterate to the next record. */ + const char *ti_iter_read(BGZF *fp, ti_iter_t iter, int *len); + + const ti_conf_t *ti_get_conf(ti_index_t *idx); + int ti_get_intv(const ti_conf_t *conf, int len, char *line, ti_interval_t *intv); + + /******************* + * Deprecated APIs * + *******************/ + + /* The callback version for random access */ + int ti_fetch(BGZF *fp, const ti_index_t *idx, int tid, int beg, int end, void *data, ti_fetch_f func); + + /* Read one line. */ + int ti_readline(BGZF *fp, kstring_t *str); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/lib/tests/00README.txt b/code/utilities/CPAT-1.2.2/lib/tests/00README.txt new file mode 100755 index 0000000..67b8689 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/00README.txt @@ -0,0 +1,32 @@ +File ex1.fa contains two sequences cut from the human genome +build36. They were exatracted with command: + + samtools faidx human_b36.fa 2:2043966-2045540 20:67967-69550 + +Sequence names were changed manually for simplicity. File ex1.sam.gz +contains MAQ alignments exatracted with: + + (samtools view NA18507_maq.bam 2:2044001-2045500; + samtools view NA18507_maq.bam 20:68001-69500) + +and processed with `samtools fixmate' to make it self-consistent as a +standalone alignment. + +To try samtools, you may run the following commands: + + samtools faidx ex1.fa # index the reference FASTA + samtools import ex1.fa.fai ex1.sam.gz ex1.bam # SAM->BAM + samtools index ex1.bam # index BAM + samtools tview ex1.bam ex1.fa # view alignment + samtools pileup -cf ex1.fa ex1.bam # pileup and consensus + samtools pileup -cf ex1.fa -t ex1.fa.fai ex1.sam.gz + +In order for the script pysam_test.py to work, you will need pysam +in your PYTHONPATH. + +In order for the script example.py to work, you will need pysam +in your PYTHONPATH and run + + make all + +beforehand. diff --git a/code/utilities/CPAT-1.2.2/lib/tests/Makefile b/code/utilities/CPAT-1.2.2/lib/tests/Makefile new file mode 100755 index 0000000..3482829 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/Makefile @@ -0,0 +1,34 @@ +all: ex1.pileup.gz ex1.bam.bai \ + ex2.sam.gz ex2.sam ex1.sam \ + ex2.bam \ + ex3.bam ex3.bam.bai \ + ex4.bam ex4.bam.bai \ + ex5.bam ex5.bam.bai \ + ex6.bam \ + ex8.bam ex8.bam.bai \ + ex9_nofail.bam.bai \ + ex9_fail.bam.bai \ + ex10.bam ex10.bam.bai + +ex2.sam.gz: ex1.bam ex1.bam.bai + samtools view -h ex1.bam | gzip > ex2.sam.gz + +%.bam: %.sam ex1.fa.fai + samtools import ex1.fa.fai $< $@ + +%.sam: %.sam.gz + gunzip < $< > $@ + +ex1.fa.fai:ex1.fa + samtools faidx ex1.fa +ex1.bam:ex1.sam.gz ex1.fa.fai + samtools import ex1.fa.fai ex1.sam.gz ex1.bam +%.bam.bai:%.bam + samtools index $< +ex1.pileup.gz:ex1.bam ex1.fa + samtools pileup -cf ex1.fa ex1.bam | gzip > ex1.pileup.gz + +clean: + rm -fr *.bam *.bai *.fai *.pileup* \ + *~ calDepth *.dSYM pysam_*.sam \ + ex2.sam ex2.sam.gz ex1.sam diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex1.fa b/code/utilities/CPAT-1.2.2/lib/tests/ex1.fa new file mode 100755 index 0000000..b4ed0cf --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex1.fa @@ -0,0 +1,56 @@ +>chr1 +CACTAGTGGCTCATTGTAAATGTGTGGTTTAACTCGTCCATGGCCCAGCATTAGGGAGCT +GTGGACCCTGCAGCCTGGCTGTGGGGGCCGCAGTGGCTGAGGGGTGCAGAGCCGAGTCAC +GGGGTTGCCAGCACAGGGGCTTAACCTCTGGTGACTGCCAGAGCTGCTGGCAAGCTAGAG +TCCCATTTGGAGCCCCTCTAAGCCGTTCTATTTGTAATGAAAACTATATTTATGCTATTC +AGTTCTAAATATAGAAATTGAAACAGCTGTGTTTAGTGCCTTTGTTCAACCCCCTTGCAA +CAACCTTGAGAACCCCAGGGAATTTGTCAATGTCAGGGAAGGAGCATTTTGTCAGTTACC +AAATGTGTTTATTACCAGAGGGATGGAGGGAAGAGGGACGCTGAAGAACTTTGATGCCCT +CTTCTTCCAAAGATGAAACGCGTAACTGCGCTCTCATTCACTCCAGCTCCCTGTCACCCA +ATGGACCTGTGATATCTGGATTCTGGGAAATTCTTCATCCTGGACCCTGAGAGATTCTGC +AGCCCAGCTCCAGATTGCTTGTGGTCTGACAGGCTGCAACTGTGAGCCATCACAATGAAC +AACAGGAAGAAAAGGTCTTTCAAAAGGTGATGTGTGTTCTCATCAACCTCATACACACAC +ATGGTTTAGGGGTATAATACCTCTACATGGCTGATTATGAAAACAATGTTCCCCAGATAC +CATCCCTGTCTTACTTCCAGCTCCCCAGAGGGAAAGCTTTCAACGCTTCTAGCCATTTCT +TTTGGCATTTGCCTTCAGACCCTACACGAATGCGTCTCTACCACAGGGGGCTGCGCGGTT +TCCCATCATGAAGCACTGAACTTCCACGTCTCATCTAGGGGAACAGGGAGGTGCACTAAT +GCGCTCCACGCCCAAGCCCTTCTCACAGTTTCTGCCCCCAGCATGGTTGTACTGGGCAAT +ACATGAGATTATTAGGAAATGCTTTACTGTCATAACTATGAAGAGACTATTGCCAGATGA +ACCACACATTAATACTATGTTTCTTATCTGCACATTACTACCCTGCAATTAATATAATTG +TGTCCATGTACACACGCTGTCCTATGTACTTATCATGACTCTATCCCAAATTCCCAATTA +CGTCCTATCTTCTTCTTAGGGAAGAACAGCTTAGGTATCAATTTGGTGTTCTGTGTAAAG +TCTCAGGGAGCCGTCCGTGTCCTCCCATCTGGCCTCGTCCACACTGGTTCTCTTGAAAGC +TTGGGCTGTAATGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTC +TCTCCTTTTTGCTGCATCCCTGTCTTCCTCTGTCTTGATTTACTTGTTGTTGGTTTTCTG +TTTCTTTGTTTGATTTGGTGGAAGACATAATCCCACGCTTCCTATGGAAAGGTTGTTGGG +AGATTTTTAATGATTCCTCAATGTTAAAATGTCTATTTTTGTCTTGACACCCAACTAATA +TTTGTCTGAGCAAAACAGTCTAGATGAGAGAGAACTTCCCTGGAGGTCTGATGGCGTTTC +TCCCTCGTCTTCTTA +>chr2 +TTCAAATGAACTTCTGTAATTGAAAAATTCATTTAAGAAATTACAAAATATAGTTGAAAG +CTCTAACAATAGACTAAACCAAGCAGAAGAAAGAGGTTCAGAACTTGAAGACAAGTCTCT +TATGAATTAACCCAGTCAGACAAAAATAAAGAAAAAAATTTTAAAAATGAACAGAGCTTT +CAAGAAGTATGAGATTATGTAAAGTAACTGAACCTATGAGTCACAGGTATTCCTGAGGAA +AAAGAAAAAGTGAGAAGTTTGGAAAAACTATTTGAGGAAGTAATTGGGGAAAACCTCTTT +AGTCTTGCTAGAGATTTAGACATCTAAATGAAAGAGGCTCAAAGAATGCCAGGAAGATAC +ATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAG +GAAAAAAATTCTAAAATCAGCAAGAGAAAAGCATACAGTCATCTATAAAGGAAATCCCAT +CAGAATAACAATGGGCTTCTCAGCAGAAACCTTACAAGCCAGAAGAGATTGGATCTAATT +TTTGGACTTCTTAAAGAAAAAAAAACCTGTCAAACACGAATGTTATGCCCTGCTAAACTA +AGCATCATAAATGAAGGGGAAATAAAGTCAAGTCTTTCCTGACAAGCAAATGCTAAGATA +ATTCATCATCACTAAACCAGTCCTATAAGAAATGCTCAAAAGAATTGTAAAAGTCAAAAT +TAAAGTTCAATACTCACCATCATAAATACACACAAAAGTACAAAACTCACAGGTTTTATA +AAACAATTGAGACTACAGAGCAACTAGGTAAAAAATTAACATTACAACAGGAACAAAACC +TCATATATCAATATTAACTTTGAATAAAAAGGGATTAAATTCCCCCACTTAAGAGATATA +GATTGGCAGAACAGATTTAAAAACATGAACTAACTATATGCTGTTTACAAGAAACTCATT +AATAAAGACATGAGTTCAGGTAAAGGGGTGGAAAAAGATGTTCTACGCAAACAGAAACCA +AATGAGAGAAGGAGTAGCTATACTTATATCAGATAAAGCACACTTTAAATCAACAACAGT +AAAATAAAACAAAGGAGGTCATCATACAATGATAAAAAGATCAATTCAGCAAGAAGATAT +AACCATCCTACTAAATACATATGCACCTAACACAAGACTACCCAGATTCATAAAACAAAT +ACTACTAGACCTAAGAGGGATGAGAAATTACCTAATTGGTACAATGTACAATATTCTGAT +GATGGTTACACTAAAAGCCCATACTTTACTGCTACTCAATATATCCATGTAACAAATCTG +CGCTTGTACTTCTAAATCTATAAAAAAATTAAAATTTAACAAAAGTAAATAAAACACATA +GCTAAAACTAAAAAAGCAAAAACAAAAACTATGCTAAGTATTGGTAAAGATGTGGGGAAA +AAAGTAAACTCTCAAATATTGCTAGTGGGAGTATAAATTGTTTTCCACTTTGGAAAACAA +TTTGGTAATTTCGTTTTTTTTTTTTTCTTTTCTCTTTTTTTTTTTTTTTTTTTTGCATGC +CAGAAAAAAATATTTACAGTAACT diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex1.sam.gz b/code/utilities/CPAT-1.2.2/lib/tests/ex1.sam.gz new file mode 100755 index 0000000..8dd2bc4 Binary files /dev/null and b/code/utilities/CPAT-1.2.2/lib/tests/ex1.sam.gz differ diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex10.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex10.sam new file mode 100755 index 0000000..45f08c5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex10.sam @@ -0,0 +1,19 @@ +@HD VN:1.0 +@SQ SN:1 LN:249250621 +read1 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:65536 ZL:i:25 +read2 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:214748 ZL:i:25 +read3 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:2147484 ZL:i:25 +read4 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:2147483647 ZL:i:25 +read5 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:-65536 ZL:i:25 +read6 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:-214748 ZL:i:25 +read7 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:-2147484 ZL:i:25 +read8 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:i:-2147483647 ZL:i:25 +read1 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:65536 ZL:i:25 +read2 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:214748 ZL:i:25 +read3 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:2147484 ZL:i:25 +read5 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:-65536 ZL:i:25 +read6 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:-214748 ZL:i:25 +read7 115 1 142618765 255 25M = 142618765 25 CGACCCACTCCGCCATTTTCATCCG IIGIIIHIGIIFIIIIIIIGIGIII NM:i:0 ZP:f:-2147484 ZL:i:25 + + + diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex3.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex3.sam new file mode 100755 index 0000000..495d4fe --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex3.sam @@ -0,0 +1,13 @@ +@HD VN:1.0 +@SQ SN:chr1 LN:1575 +@SQ SN:chr2 LN:1584 +@RG ID:L1 PU:SC_1_10 LB:SC_1 SM:NA12891 CN:name:with:colon +@RG ID:L2 PU:SC_2_12 LB:SC_2 SM:NA12891 CN:name:with:colon +@PG ID:P1 VN:1.0 +@PG ID:P2 VN:1.1 +@CO this is a comment +@CO this is another comment +read_28833_29006_6945 99 chr1 33 20 10M1D25M = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 PG:Z:P1 XT:A:U +read_28701_28881_323b 147 chr2 88 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< MF:i:18 RG:Z:L2 PG:Z:P2 XT:A:R +read_28701_28881_323c 147 chr2 88 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< +test_clipped1 99 chr2 997 20 4S6M1D20M5S = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 PG:Z:P1 XT:A:U diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex4.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex4.sam new file mode 100755 index 0000000..b2282b8 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex4.sam @@ -0,0 +1,9 @@ +@HD VN:1.0 +@SQ SN:chr1 LN:100 +@SQ SN:chr2 LN:100 +@RG ID:L1 PU:SC_1_10 LB:SC_1 SM:NA12891 +@RG ID:L2 PU:SC_2_12 LB:SC_2 SM:NA12891 +@CO this is a comment +@CO this is another comment +read_28833_29006_6945 99 chr1 21 20 10M1D25M = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 +read_28701_28881_323b 147 chr2 21 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< MF:i:18 RG:Z:L2 diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex5.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex5.sam new file mode 100755 index 0000000..f1f8aad --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex5.sam @@ -0,0 +1,5 @@ +@HD VN:1.0 +@SQ SN:chr1 LN:100 +@SQ SN:chr2 LN:100 +read_28833_29006_6945 0 * * * * * 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< +read_28701_28881_323b 0 * * * * * 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex6.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex6.sam new file mode 100755 index 0000000..7ae90f3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex6.sam @@ -0,0 +1,5 @@ +@HD VN:1.0 +@SQ SN:chr1 LN:1575 +@SQ SN:chr2 LN:1584 +read_28833_29006_6945 99 chr1 33 20 10M1D25M = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 +read_28701_28881_323b 147 chr2 88 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< MF:i:18 RG:Z:L2 diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex7.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex7.sam new file mode 100755 index 0000000..12befae --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex7.sam @@ -0,0 +1,2 @@ +read_28833_29006_6945 99 chr1 33 20 10M1D25M = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 PG:Z:P1 XT:A:U +read_28701_28881_323b 147 chr2 88 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< MF:i:18 RG:Z:L2 PG:Z:P2 XT:A:R diff --git a/code/utilities/CPAT-1.2.2/lib/tests/ex8.sam b/code/utilities/CPAT-1.2.2/lib/tests/ex8.sam new file mode 100755 index 0000000..5a16b4f --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/ex8.sam @@ -0,0 +1,3 @@ +@HD VN:1.0 +@SQ SN:2 LN:48297693 +GJP00TM04CAQ5W 0 2 38297693 60 45H51M1D13M1D12M1D9M2D5M1D7M4D2M1I6M1D28M1D5M1D2M1D18M55H * 0 0 CATGAAGAACCGCTGGGTATGGAGCACACCTCACCTGATGGACAGTTGATTATGCTCACCTTAACGCTAATTGAGAGCAGCACAAGAGGACTGGAAACTAGAATTTACTCCTCATCTCCGAAGATGTGAATATTCTAAATTCAGCTTGCCTCTTGCTTC IID7757111/=;?///:D>777;EEGAAAEEIHHIIIIIIIIIIIIIIBBBIIIIH==<<<<>>D?1112544556::03---//25.22=;DD?;;;>BDDDEEEGGGA<888>sys.stderr, "Child was terminated by signal", -retcode + except OSError, e: + print >>sys.stderr, "Execution failed:", e + +def getSamtoolsVersion(): + '''return samtools version''' + + pipe = subprocess.Popen(SAMTOOLS, shell=True, stderr=subprocess.PIPE).stderr + lines = "".join(pipe.readlines()) + return re.search( "Version:\s+(\S+)", lines).groups()[0] + +class BinaryTest(unittest.TestCase): + '''test samtools command line commands and compare + against pysam commands. + + Tests fail, if the output is not binary identical. + ''' + + first_time = True + + # a list of commands to test + commands = \ + { + "view" : + ( + ("ex1.view", "view ex1.bam > ex1.view"), + ("pysam_ex1.view", (pysam.view, "ex1.bam" ) ), + ), + "view2" : + ( + ("ex1.view", "view -bT ex1.fa -o ex1.view2 ex1.sam"), + # note that -o ex1.view2 throws exception. + ("pysam_ex1.view", (pysam.view, "-bT ex1.fa -oex1.view2 ex1.sam" ) ), + ), + "sort" : + ( + ( "ex1.sort.bam", "sort ex1.bam ex1.sort" ), + ( "pysam_ex1.sort.bam", (pysam.sort, "ex1.bam pysam_ex1.sort" ) ), + ), + "mpileup" : + ( + ("ex1.pileup", "mpileup ex1.bam > ex1.pileup" ), + ("pysam_ex1.mpileup", (pysam.mpileup, "ex1.bam" ) ), + ), + "depth" : + ( + ("ex1.depth", "depth ex1.bam > ex1.depth" ), + ("pysam_ex1.depth", (pysam.depth, "ex1.bam" ) ), + ), + "faidx" : + ( + ("ex1.fa.fai", "faidx ex1.fa"), + ("pysam_ex1.fa.fai", (pysam.faidx, "ex1.fa") ), + ), + "index": + ( + ("ex1.bam.bai", "index ex1.bam" ), + ("pysam_ex1.bam.bai", (pysam.index, "pysam_ex1.bam" ) ), + ), + "idxstats" : + ( + ("ex1.idxstats", "idxstats ex1.bam > ex1.idxstats" ), + ("pysam_ex1.idxstats", (pysam.idxstats, "pysam_ex1.bam" ) ), + ), + "fixmate" : + ( + ("ex1.fixmate", "fixmate ex1.bam ex1.fixmate" ), + ("pysam_ex1.fixmate", (pysam.fixmate, "pysam_ex1.bam pysam_ex1.fixmate") ), + ), + "flagstat" : + ( + ("ex1.flagstat", "flagstat ex1.bam > ex1.flagstat" ), + ("pysam_ex1.flagstat", (pysam.flagstat, "pysam_ex1.bam") ), + ), + "calmd" : + ( + ("ex1.calmd", "calmd ex1.bam ex1.fa > ex1.calmd" ), + ("pysam_ex1.calmd", (pysam.calmd, "pysam_ex1.bam ex1.fa") ), + ), + "merge" : + ( + ("ex1.merge", "merge -f ex1.merge ex1.bam ex1.bam" ), + # -f option does not work - following command will cause the subsequent + # command to fail + ("pysam_ex1.merge", (pysam.merge, "pysam_ex1.merge pysam_ex1.bam pysam_ex1.bam") ), + ), + "rmdup" : + ( + ("ex1.rmdup", "rmdup ex1.bam ex1.rmdup" ), + ("pysam_ex1.rmdup", (pysam.rmdup, "pysam_ex1.bam pysam_ex1.rmdup" )), + ), + "reheader" : + ( + ( "ex1.reheader", "reheader ex1.bam ex1.bam > ex1.reheader"), + ( "pysam_ex1.reheader", (pysam.reheader, "ex1.bam ex1.bam" ) ), + ), + "cat": + ( + ( "ex1.cat", "cat ex1.bam ex1.bam > ex1.cat"), + ( "pysam_ex1.cat", (pysam.cat, "ex1.bam ex1.bam" ) ), + ), + "targetcut": + ( + ("ex1.targetcut", "targetcut ex1.bam > ex1.targetcut" ), + ("pysam_ex1.targetcut", (pysam.targetcut, "pysam_ex1.bam") ), + ), + "phase": + ( + ("ex1.phase", "phase ex1.bam > ex1.phase" ), + ("pysam_ex1.phase", (pysam.phase, "pysam_ex1.bam") ), + ), + "import" : + ( + ("ex1.bam", "import ex1.fa.fai ex1.sam.gz ex1.bam" ), + ("pysam_ex1.bam", (pysam.samimport, "ex1.fa.fai ex1.sam.gz pysam_ex1.bam") ), + ), + "bam2fq": + ( + ("ex1.bam2fq", "bam2fq ex1.bam > ex1.bam2fq" ), + ("pysam_ex1.bam2fq", (pysam.bam2fq, "pysam_ex1.bam") ), + ), + } + + # some tests depend on others. The order specifies in which order + # the samtools commands are executed. + # The first three (faidx, import, index) need to be in that order, + # the rest is arbitrary. + order = ('faidx', 'import', 'index', + # 'pileup1', 'pileup2', deprecated + # 'glfview', deprecated + 'view', 'view2', + 'sort', + 'mpileup', + 'depth', + 'idxstats', + 'fixmate', + 'flagstat', + # 'calmd', + 'merge', + 'rmdup', + 'reheader', + 'cat', + 'targetcut', + 'phase', + 'bam2fq', + ) + + def setUp( self ): + '''setup tests. + + For setup, all commands will be run before the first test is + executed. Individual tests will then just compare the output + files. + ''' + if BinaryTest.first_time: + + # remove previous files + if os.path.exists( WORKDIR ): + shutil.rmtree( WORKDIR ) + + # copy the source files to WORKDIR + os.makedirs( WORKDIR ) + + shutil.copy( "ex1.fa", os.path.join( WORKDIR, "pysam_ex1.fa" ) ) + shutil.copy( "ex1.fa", os.path.join( WORKDIR, "ex1.fa" ) ) + shutil.copy( "ex1.sam.gz", os.path.join( WORKDIR, "ex1.sam.gz" ) ) + shutil.copy( "ex1.sam", os.path.join( WORKDIR, "ex1.sam" ) ) + + # cd to workdir + savedir = os.getcwd() + os.chdir( WORKDIR ) + + for label in self.order: + command = self.commands[label] + samtools_target, samtools_command = command[0] + try: + pysam_target, pysam_command = command[1] + except ValueError, msg: + raise ValueError( "error while setting up %s=%s: %s" %\ + (label, command, msg) ) + runSamtools( " ".join( (SAMTOOLS, samtools_command ))) + pysam_method, pysam_options = pysam_command + try: + output = pysam_method( *pysam_options.split(" "), raw=True) + except pysam.SamtoolsError, msg: + raise pysam.SamtoolsError( "error while executing %s: options=%s: msg=%s" %\ + (label, pysam_options, msg) ) + if ">" in samtools_command: + outfile = open( pysam_target, "wb" ) + for line in output: outfile.write( line ) + outfile.close() + + os.chdir( savedir ) + BinaryTest.first_time = False + + + + samtools_version = getSamtoolsVersion() + + + def _r( s ): + # patch - remove any of the alpha/beta suffixes, i.e., 0.1.12a -> 0.1.12 + if s.count('-') > 0: s = s[0:s.find('-')] + return re.sub( "[^0-9.]", "", s ) + + if _r(samtools_version) != _r( pysam.__samtools_version__): + raise ValueError("versions of pysam/samtools and samtools differ: %s != %s" % \ + (pysam.__samtools_version__, + samtools_version )) + + def checkCommand( self, command ): + if command: + samtools_target, pysam_target = self.commands[command][0][0], self.commands[command][1][0] + samtools_target = os.path.join( WORKDIR, samtools_target ) + pysam_target = os.path.join( WORKDIR, pysam_target ) + self.assertTrue( checkBinaryEqual( samtools_target, pysam_target ), + "%s failed: files %s and %s are not the same" % (command, samtools_target, pysam_target) ) + + def testImport( self ): + self.checkCommand( "import" ) + + def testIndex( self ): + self.checkCommand( "index" ) + + def testSort( self ): + self.checkCommand( "sort" ) + + def testMpileup( self ): + self.checkCommand( "mpileup" ) + + def testDepth( self ): + self.checkCommand( "depth" ) + + def testIdxstats( self ): + self.checkCommand( "idxstats" ) + + def testFixmate( self ): + self.checkCommand( "fixmate" ) + + def testFlagstat( self ): + self.checkCommand( "flagstat" ) + + def testMerge( self ): + self.checkCommand( "merge" ) + + def testRmdup( self ): + self.checkCommand( "rmdup" ) + + def testReheader( self ): + self.checkCommand( "reheader" ) + + def testCat( self ): + self.checkCommand( "cat" ) + + def testTargetcut( self ): + self.checkCommand( "targetcut" ) + + def testPhase( self ): + self.checkCommand( "phase" ) + + def testBam2fq( self ): + self.checkCommand( "bam2fq" ) + + # def testPileup1( self ): + # self.checkCommand( "pileup1" ) + + # def testPileup2( self ): + # self.checkCommand( "pileup2" ) + + # deprecated + # def testGLFView( self ): + # self.checkCommand( "glfview" ) + + def testView( self ): + self.checkCommand( "view" ) + + def testEmptyIndex( self ): + self.assertRaises( IOError, pysam.index, "exdoesntexist.bam" ) + + def __del__(self): + if os.path.exists( WORKDIR ): + shutil.rmtree( WORKDIR ) + +class IOTest(unittest.TestCase): + '''check if reading samfile and writing a samfile are consistent.''' + + def checkEcho( self, input_filename, reference_filename, + output_filename, + input_mode, output_mode, use_template = True ): + '''iterate through *input_filename* writing to *output_filename* and + comparing the output to *reference_filename*. + + The files are opened according to the *input_mode* and *output_mode*. + + If *use_template* is set, the header is copied from infile using the + template mechanism, otherwise target names and lengths are passed + explicitely. + + ''' + + infile = pysam.Samfile( input_filename, input_mode ) + if use_template: + outfile = pysam.Samfile( output_filename, output_mode, template = infile ) + else: + outfile = pysam.Samfile( output_filename, output_mode, + referencenames = infile.references, + referencelengths = infile.lengths, + add_sq_text = False ) + + iter = infile.fetch() + for x in iter: outfile.write( x ) + infile.close() + outfile.close() + + self.assertTrue( checkBinaryEqual( reference_filename, output_filename), + "files %s and %s are not the same" % (reference_filename, output_filename) ) + + def testReadWriteBam( self ): + + input_filename = "ex1.bam" + output_filename = "pysam_ex1.bam" + reference_filename = "ex1.bam" + + self.checkEcho( input_filename, reference_filename, output_filename, + "rb", "wb" ) + + def testReadWriteBamWithTargetNames( self ): + + input_filename = "ex1.bam" + output_filename = "pysam_ex1.bam" + reference_filename = "ex1.bam" + + self.checkEcho( input_filename, reference_filename, output_filename, + "rb", "wb", use_template = False ) + + def testReadWriteSamWithHeader( self ): + + input_filename = "ex2.sam" + output_filename = "pysam_ex2.sam" + reference_filename = "ex2.sam" + + self.checkEcho( input_filename, reference_filename, output_filename, + "r", "wh" ) + + def testReadWriteSamWithoutHeader( self ): + + input_filename = "ex2.sam" + output_filename = "pysam_ex2.sam" + reference_filename = "ex1.sam" + + self.checkEcho( input_filename, reference_filename, output_filename, + "r", "w" ) + + def testReadSamWithoutHeaderWriteSamWithoutHeader( self ): + + input_filename = "ex1.sam" + output_filename = "pysam_ex1.sam" + reference_filename = "ex1.sam" + + # disabled - reading from a samfile without header + # is not implemented. + + # self.checkEcho( input_filename, reference_filename, output_filename, + # "r", "w" ) + + def testFetchFromClosedFile( self ): + + samfile = pysam.Samfile( "ex1.bam", "rb" ) + samfile.close() + self.assertRaises( ValueError, samfile.fetch, 'chr1', 100, 120) + + def testClosedFile( self ): + '''test that access to a closed samfile raises ValueError.''' + + samfile = pysam.Samfile( "ex1.bam", "rb" ) + samfile.close() + self.assertRaises( ValueError, samfile.fetch, 'chr1', 100, 120) + self.assertRaises( ValueError, samfile.pileup, 'chr1', 100, 120) + self.assertRaises( ValueError, samfile.getrname, 0 ) + self.assertRaises( ValueError, samfile.tell ) + self.assertRaises( ValueError, samfile.seek, 0 ) + self.assertRaises( ValueError, getattr, samfile, "nreferences" ) + self.assertRaises( ValueError, getattr, samfile, "references" ) + self.assertRaises( ValueError, getattr, samfile, "lengths" ) + self.assertRaises( ValueError, getattr, samfile, "text" ) + self.assertRaises( ValueError, getattr, samfile, "header" ) + + # write on closed file + self.assertEqual( 0, samfile.write(None) ) + + def testAutoDetection( self ): + '''test if autodetection works.''' + + samfile = pysam.Samfile( "ex3.sam" ) + self.assertRaises( ValueError, samfile.fetch, 'chr1' ) + samfile.close() + + samfile = pysam.Samfile( "ex3.bam" ) + samfile.fetch('chr1') + samfile.close() + + def testReadingFromSamFileWithoutHeader( self ): + '''read from samfile without header. + ''' + samfile = pysam.Samfile( "ex7.sam" ) + self.assertRaises( NotImplementedError, samfile.__iter__ ) + + def testReadingFromFileWithoutIndex( self ): + '''read from bam file without index.''' + + assert not os.path.exists( "ex2.bam.bai" ) + samfile = pysam.Samfile( "ex2.bam", "rb" ) + self.assertRaises( ValueError, samfile.fetch ) + self.assertEqual( len(list( samfile.fetch(until_eof = True) )), 3270 ) + + def testReadingUniversalFileMode( self ): + '''read from samfile without header. + ''' + + input_filename = "ex2.sam" + output_filename = "pysam_ex2.sam" + reference_filename = "ex1.sam" + + self.checkEcho( input_filename, reference_filename, output_filename, + "rU", "w" ) + +class TestFloatTagBug( unittest.TestCase ): + '''see issue 71''' + + def testFloatTagBug( self ): + '''a float tag before another exposed a parsing bug in bam_aux_get - expected to fail + + This test is expected to fail until samtools is fixed. + ''' + samfile = pysam.Samfile("tag_bug.bam") + read = samfile.fetch(until_eof=True).next() + self.assertTrue( ('XC',1) in read.tags ) + self.assertEqual(read.opt('XC'), 1) + +class TestTagParsing( unittest.TestCase ): + '''tests checking the accuracy of tag setting and retrieval.''' + + def makeRead( self ): + a = pysam.AlignedRead() + a.qname = "read_12345" + a.tid = 0 + a.seq="ACGT" * 3 + a.flag = 0 + a.rname = 0 + a.pos = 1 + a.mapq = 20 + a.cigar = ( (0,10), (2,1), (0,25) ) + a.mrnm = 0 + a.mpos=200 + a.isize = 0 + a.qual ="1234" * 3 + # todo: create tags + return a + + def testNegativeIntegers( self ): + x = -2 + aligned_read = self.makeRead() + aligned_read.tags = [("XD", int(x) ) ] + print aligned_read.tags + + def testNegativeIntegers2( self ): + x = -2 + r = self.makeRead() + r.tags = [("XD", int(x) ) ] + outfile = pysam.Samfile( "test.bam", + "wb", + referencenames = ("chr1",), + referencelengths = (1000,) ) + outfile.write (r ) + outfile.close() + +class TestIteratorRow(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex1.bam","rb" ) + + def checkRange( self, rnge ): + '''compare results from iterator with those from samtools.''' + ps = list(self.samfile.fetch(region=rnge)) + sa = list(pysam.view( "ex1.bam", rnge, raw = True) ) + self.assertEqual( len(ps), len(sa), "unequal number of results for range %s: %i != %i" % (rnge, len(ps), len(sa) )) + # check if the same reads are returned and in the same order + for line, pair in enumerate( zip( ps, sa ) ): + a,b = pair + d = b.split("\t") + self.assertEqual( a.qname, d[0], "line %i: read id mismatch: %s != %s" % (line, a.rname, d[0]) ) + self.assertEqual( a.pos, int(d[3])-1, "line %i: read position mismatch: %s != %s, \n%s\n%s\n" % \ + (line, a.pos, int(d[3])-1, + str(a), str(d) ) ) + self.assertEqual( a.qual, d[10], "line %i: quality mismatch: %s != %s, \n%s\n%s\n" % \ + (line, a.qual, d[10], + str(a), str(d) ) ) + + def testIteratePerContig(self): + '''check random access per contig''' + for contig in self.samfile.references: + self.checkRange( contig ) + + def testIterateRanges(self): + '''check random access per range''' + for contig, length in zip(self.samfile.references, self.samfile.lengths): + for start in range( 1, length, 90): + self.checkRange( "%s:%i-%i" % (contig, start, start + 90) ) # this includes empty ranges + + def tearDown(self): + self.samfile.close() + +class TestIteratorRowAll(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex1.bam","rb" ) + + def testIterate(self): + '''compare results from iterator with those from samtools.''' + ps = list(self.samfile.fetch()) + sa = list(pysam.view( "ex1.bam", raw = True) ) + self.assertEqual( len(ps), len(sa), "unequal number of results: %i != %i" % (len(ps), len(sa) )) + # check if the same reads are returned + for line, pair in enumerate( zip( ps, sa ) ): + data = pair[1].split("\t") + self.assertEqual( pair[0].qname, data[0], "read id mismatch in line %i: %s != %s" % (line, pair[0].rname, data[0]) ) + + def tearDown(self): + self.samfile.close() + +class TestIteratorColumn(unittest.TestCase): + '''test iterator column against contents of ex3.bam.''' + + # note that samfile contains 1-based coordinates + # 1D means deletion with respect to reference sequence + # + mCoverages = { 'chr1' : [ 0 ] * 20 + [1] * 36 + [0] * (100 - 20 -35 ), + 'chr2' : [ 0 ] * 20 + [1] * 35 + [0] * (100 - 20 -35 ), + } + + def setUp(self): + self.samfile=pysam.Samfile( "ex4.bam","rb" ) + + def checkRange( self, rnge ): + '''compare results from iterator with those from samtools.''' + # check if the same reads are returned and in the same order + for column in self.samfile.pileup(region=rnge): + thiscov = len(column.pileups) + refcov = self.mCoverages[self.samfile.getrname(column.tid)][column.pos] + self.assertEqual( thiscov, refcov, "wrong coverage at pos %s:%i %i should be %i" % (self.samfile.getrname(column.tid), column.pos, thiscov, refcov)) + + def testIterateAll(self): + '''check random access per contig''' + self.checkRange( None ) + + def testIteratePerContig(self): + '''check random access per contig''' + for contig in self.samfile.references: + self.checkRange( contig ) + + def testIterateRanges(self): + '''check random access per range''' + for contig, length in zip(self.samfile.references, self.samfile.lengths): + for start in range( 1, length, 90): + self.checkRange( "%s:%i-%i" % (contig, start, start + 90) ) # this includes empty ranges + + def testInverse( self ): + '''test the inverse, is point-wise pileup accurate.''' + for contig, refseq in self.mCoverages.items(): + refcolumns = sum(refseq) + for pos, refcov in enumerate( refseq ): + columns = list(self.samfile.pileup( contig, pos, pos+1) ) + if refcov == 0: + # if no read, no coverage + self.assertEqual( len(columns), refcov, "wrong number of pileup columns returned for position %s:%i, %i should be %i" %(contig,pos,len(columns), refcov) ) + elif refcov == 1: + # one read, all columns of the read are returned + self.assertEqual( len(columns), refcolumns, "pileup incomplete at position %i: got %i, expected %i " %\ + (pos, len(columns), refcolumns)) + + + + def tearDown(self): + self.samfile.close() + +class TestAlignedReadFromBam(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex3.bam","rb" ) + self.reads=list(self.samfile.fetch()) + + def testARqname(self): + self.assertEqual( self.reads[0].qname, "read_28833_29006_6945", "read name mismatch in read 1: %s != %s" % (self.reads[0].qname, "read_28833_29006_6945") ) + self.assertEqual( self.reads[1].qname, "read_28701_28881_323b", "read name mismatch in read 2: %s != %s" % (self.reads[1].qname, "read_28701_28881_323b") ) + + def testARflag(self): + self.assertEqual( self.reads[0].flag, 99, "flag mismatch in read 1: %s != %s" % (self.reads[0].flag, 99) ) + self.assertEqual( self.reads[1].flag, 147, "flag mismatch in read 2: %s != %s" % (self.reads[1].flag, 147) ) + + def testARrname(self): + self.assertEqual( self.reads[0].rname, 0, "chromosome/target id mismatch in read 1: %s != %s" % (self.reads[0].rname, 0) ) + self.assertEqual( self.reads[1].rname, 1, "chromosome/target id mismatch in read 2: %s != %s" % (self.reads[1].rname, 1) ) + + def testARpos(self): + self.assertEqual( self.reads[0].pos, 33-1, "mapping position mismatch in read 1: %s != %s" % (self.reads[0].pos, 33-1) ) + self.assertEqual( self.reads[1].pos, 88-1, "mapping position mismatch in read 2: %s != %s" % (self.reads[1].pos, 88-1) ) + + def testARmapq(self): + self.assertEqual( self.reads[0].mapq, 20, "mapping quality mismatch in read 1: %s != %s" % (self.reads[0].mapq, 20) ) + self.assertEqual( self.reads[1].mapq, 30, "mapping quality mismatch in read 2: %s != %s" % (self.reads[1].mapq, 30) ) + + def testARcigar(self): + self.assertEqual( self.reads[0].cigar, [(0, 10), (2, 1), (0, 25)], "read name length mismatch in read 1: %s != %s" % (self.reads[0].cigar, [(0, 10), (2, 1), (0, 25)]) ) + self.assertEqual( self.reads[1].cigar, [(0, 35)], "read name length mismatch in read 2: %s != %s" % (self.reads[1].cigar, [(0, 35)]) ) + + def testARmrnm(self): + self.assertEqual( self.reads[0].mrnm, 0, "mate reference sequence name mismatch in read 1: %s != %s" % (self.reads[0].mrnm, 0) ) + self.assertEqual( self.reads[1].mrnm, 1, "mate reference sequence name mismatch in read 2: %s != %s" % (self.reads[1].mrnm, 1) ) + self.assertEqual( self.reads[0].rnext, 0, "mate reference sequence name mismatch in read 1: %s != %s" % (self.reads[0].rnext, 0) ) + self.assertEqual( self.reads[1].rnext, 1, "mate reference sequence name mismatch in read 2: %s != %s" % (self.reads[1].rnext, 1) ) + + def testARmpos(self): + self.assertEqual( self.reads[0].mpos, 200-1, "mate mapping position mismatch in read 1: %s != %s" % (self.reads[0].mpos, 200-1) ) + self.assertEqual( self.reads[1].mpos, 500-1, "mate mapping position mismatch in read 2: %s != %s" % (self.reads[1].mpos, 500-1) ) + self.assertEqual( self.reads[0].pnext, 200-1, "mate mapping position mismatch in read 1: %s != %s" % (self.reads[0].pnext, 200-1) ) + self.assertEqual( self.reads[1].pnext, 500-1, "mate mapping position mismatch in read 2: %s != %s" % (self.reads[1].pnext, 500-1) ) + + def testARisize(self): + self.assertEqual( self.reads[0].isize, 167, "insert size mismatch in read 1: %s != %s" % (self.reads[0].isize, 167) ) + self.assertEqual( self.reads[1].isize, 412, "insert size mismatch in read 2: %s != %s" % (self.reads[1].isize, 412) ) + self.assertEqual( self.reads[0].tlen, 167, "insert size mismatch in read 1: %s != %s" % (self.reads[0].tlen, 167) ) + self.assertEqual( self.reads[1].tlen, 412, "insert size mismatch in read 2: %s != %s" % (self.reads[1].tlen, 412) ) + + def testARseq(self): + self.assertEqual( self.reads[0].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG", "sequence mismatch in read 1: %s != %s" % (self.reads[0].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG") ) + self.assertEqual( self.reads[1].seq, "ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA", "sequence size mismatch in read 2: %s != %s" % (self.reads[1].seq, "ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA") ) + self.assertEqual( self.reads[3].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG", "sequence mismatch in read 4: %s != %s" % (self.reads[3].seq, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG") ) + + def testARqual(self): + self.assertEqual( self.reads[0].qual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<", "quality string mismatch in read 1: %s != %s" % (self.reads[0].qual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<") ) + self.assertEqual( self.reads[1].qual, "<<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<<", "quality string mismatch in read 2: %s != %s" % (self.reads[1].qual, "<<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<<") ) + self.assertEqual( self.reads[3].qual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<", "quality string mismatch in read 3: %s != %s" % (self.reads[3].qual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<") ) + + def testARquery(self): + self.assertEqual( self.reads[0].query, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG", "query mismatch in read 1: %s != %s" % (self.reads[0].query, "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG") ) + self.assertEqual( self.reads[1].query, "ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA", "query size mismatch in read 2: %s != %s" % (self.reads[1].query, "ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA") ) + self.assertEqual( self.reads[3].query, "TAGCTAGCTACCTATATCTTGGTCTT", "query mismatch in read 4: %s != %s" % (self.reads[3].query, "TAGCTAGCTACCTATATCTTGGTCTT") ) + + def testARqqual(self): + self.assertEqual( self.reads[0].qqual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<", "qquality string mismatch in read 1: %s != %s" % (self.reads[0].qqual, "<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<") ) + self.assertEqual( self.reads[1].qqual, "<<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<<", "qquality string mismatch in read 2: %s != %s" % (self.reads[1].qqual, "<<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<<") ) + self.assertEqual( self.reads[3].qqual, "<<<<<<<<<<<<<<<<<:<9/,&,22", "qquality string mismatch in read 3: %s != %s" % (self.reads[3].qqual, "<<<<<<<<<<<<<<<<<:<9/,&,22") ) + + def testPresentOptionalFields(self): + self.assertEqual( self.reads[0].opt('NM'), 1, "optional field mismatch in read 1, NM: %s != %s" % (self.reads[0].opt('NM'), 1) ) + self.assertEqual( self.reads[0].opt('RG'), 'L1', "optional field mismatch in read 1, RG: %s != %s" % (self.reads[0].opt('RG'), 'L1') ) + self.assertEqual( self.reads[1].opt('RG'), 'L2', "optional field mismatch in read 2, RG: %s != %s" % (self.reads[1].opt('RG'), 'L2') ) + self.assertEqual( self.reads[1].opt('MF'), 18, "optional field mismatch in read 2, MF: %s != %s" % (self.reads[1].opt('MF'), 18) ) + + def testPairedBools(self): + self.assertEqual( self.reads[0].is_paired, True, "is paired mismatch in read 1: %s != %s" % (self.reads[0].is_paired, True) ) + self.assertEqual( self.reads[1].is_paired, True, "is paired mismatch in read 2: %s != %s" % (self.reads[1].is_paired, True) ) + self.assertEqual( self.reads[0].is_proper_pair, True, "is proper pair mismatch in read 1: %s != %s" % (self.reads[0].is_proper_pair, True) ) + self.assertEqual( self.reads[1].is_proper_pair, True, "is proper pair mismatch in read 2: %s != %s" % (self.reads[1].is_proper_pair, True) ) + + def testTags( self ): + self.assertEqual( self.reads[0].tags, + [('NM', 1), ('RG', 'L1'), + ('PG', 'P1'), ('XT', 'U')] ) + self.assertEqual( self.reads[1].tags, + [('MF', 18), ('RG', 'L2'), + ('PG', 'P2'),('XT', 'R') ] ) + + def testOpt( self ): + self.assertEqual( self.reads[0].opt("XT"), "U" ) + self.assertEqual( self.reads[1].opt("XT"), "R" ) + + def testMissingOpt( self ): + self.assertRaises( KeyError, self.reads[0].opt, "XP" ) + + def testEmptyOpt( self ): + self.assertRaises( KeyError, self.reads[2].opt, "XT" ) + + def tearDown(self): + self.samfile.close() + +class TestAlignedReadFromSam(TestAlignedReadFromBam): + + def setUp(self): + self.samfile=pysam.Samfile( "ex3.sam","r" ) + self.reads=list(self.samfile.fetch()) + +# needs to be implemented +# class TestAlignedReadFromSamWithoutHeader(TestAlignedReadFromBam): +# +# def setUp(self): +# self.samfile=pysam.Samfile( "ex7.sam","r" ) +# self.reads=list(self.samfile.fetch()) + +class TestHeaderSam(unittest.TestCase): + + header = {'SQ': [{'LN': 1575, 'SN': 'chr1'}, + {'LN': 1584, 'SN': 'chr2'}], + 'RG': [{'LB': 'SC_1', 'ID': 'L1', 'SM': 'NA12891', 'PU': 'SC_1_10', "CN":"name:with:colon"}, + {'LB': 'SC_2', 'ID': 'L2', 'SM': 'NA12891', 'PU': 'SC_2_12', "CN":"name:with:colon"}], + 'PG': [{'ID': 'P1', 'VN': '1.0'}, {'ID': 'P2', 'VN': '1.1'}], + 'HD': {'VN': '1.0'}, + 'CO' : [ 'this is a comment', 'this is another comment'], + } + + def compareHeaders( self, a, b ): + '''compare two headers a and b.''' + for ak,av in a.iteritems(): + self.assertTrue( ak in b, "key '%s' not in '%s' " % (ak,b) ) + self.assertEqual( av, b[ak] ) + + def setUp(self): + self.samfile=pysam.Samfile( "ex3.sam","r" ) + + def testHeaders(self): + self.compareHeaders( self.header, self.samfile.header ) + self.compareHeaders( self.samfile.header, self.header ) + + def testNameMapping( self ): + for x, y in enumerate( ("chr1", "chr2")): + tid = self.samfile.gettid( y ) + ref = self.samfile.getrname( x ) + self.assertEqual( tid, x ) + self.assertEqual( ref, y ) + + self.assertEqual( self.samfile.gettid("chr?"), -1 ) + self.assertRaises( ValueError, self.samfile.getrname, 2 ) + + def tearDown(self): + self.samfile.close() + +class TestHeaderBam(TestHeaderSam): + + def setUp(self): + self.samfile=pysam.Samfile( "ex3.bam","rb" ) + +class TestUnmappedReads(unittest.TestCase): + + def testSAM(self): + samfile=pysam.Samfile( "ex5.sam","r" ) + self.assertEqual( len(list(samfile.fetch( until_eof = True))), 2 ) + samfile.close() + + def testBAM(self): + samfile=pysam.Samfile( "ex5.bam","rb" ) + self.assertEqual( len(list(samfile.fetch( until_eof = True))), 2 ) + samfile.close() + +class TestPileupObjects(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex1.bam","rb" ) + + def testPileupColumn(self): + for pcolumn1 in self.samfile.pileup( region="chr1:105" ): + if pcolumn1.pos == 104: + self.assertEqual( pcolumn1.tid, 0, "chromosome/target id mismatch in position 1: %s != %s" % (pcolumn1.tid, 0) ) + self.assertEqual( pcolumn1.pos, 105-1, "position mismatch in position 1: %s != %s" % (pcolumn1.pos, 105-1) ) + self.assertEqual( pcolumn1.n, 2, "# reads mismatch in position 1: %s != %s" % (pcolumn1.n, 2) ) + for pcolumn2 in self.samfile.pileup( region="chr2:1480" ): + if pcolumn2.pos == 1479: + self.assertEqual( pcolumn2.tid, 1, "chromosome/target id mismatch in position 1: %s != %s" % (pcolumn2.tid, 1) ) + self.assertEqual( pcolumn2.pos, 1480-1, "position mismatch in position 1: %s != %s" % (pcolumn2.pos, 1480-1) ) + self.assertEqual( pcolumn2.n, 12, "# reads mismatch in position 1: %s != %s" % (pcolumn2.n, 12) ) + + def testPileupRead(self): + for pcolumn1 in self.samfile.pileup( region="chr1:105" ): + if pcolumn1.pos == 104: + self.assertEqual( len(pcolumn1.pileups), 2, "# reads aligned to column mismatch in position 1: %s != %s" % (len(pcolumn1.pileups), 2) ) +# self.assertEqual( pcolumn1.pileups[0] # need to test additional properties here + + def tearDown(self): + self.samfile.close() + +class TestContextManager(unittest.TestCase): + + def testManager( self ): + with pysam.Samfile('ex1.bam', 'rb') as samfile: + samfile.fetch() + self.assertEqual( samfile._isOpen(), False ) + +class TestExceptions(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex1.bam","rb" ) + + def testMissingFile(self): + + self.assertRaises( IOError, pysam.Samfile, "exdoesntexist.bam", "rb" ) + self.assertRaises( IOError, pysam.Samfile, "exdoesntexist.sam", "r" ) + self.assertRaises( IOError, pysam.Samfile, "exdoesntexist.bam", "r" ) + self.assertRaises( IOError, pysam.Samfile, "exdoesntexist.sam", "rb" ) + + def testBadContig(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr88" ) + + def testMeaninglessCrap(self): + self.assertRaises( ValueError, self.samfile.fetch, "skljf" ) + + def testBackwardsOrderNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, 'chr1', 100, 10 ) + + def testBackwardsOrderOldFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, region="chr1:100-10") + + def testOutOfRangeNegativeNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 5, -10 ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 5, 0 ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1", -5, -10 ) + + self.assertRaises( ValueError, self.samfile.count, "chr1", 5, -10 ) + self.assertRaises( ValueError, self.samfile.count, "chr1", 5, 0 ) + self.assertRaises( ValueError, self.samfile.count, "chr1", -5, -10 ) + + def testOutOfRangeNegativeOldFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, region="chr1:-5-10" ) + self.assertRaises( ValueError, self.samfile.fetch, region="chr1:-5-0" ) + self.assertRaises( ValueError, self.samfile.fetch, region="chr1:-5--10" ) + + self.assertRaises( ValueError, self.samfile.count, region="chr1:-5-10" ) + self.assertRaises( ValueError, self.samfile.count, region="chr1:-5-0" ) + self.assertRaises( ValueError, self.samfile.count, region="chr1:-5--10" ) + + def testOutOfRangNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 9999999999, 99999999999 ) + self.assertRaises( ValueError, self.samfile.count, "chr1", 9999999999, 99999999999 ) + + def testOutOfRangeLargeNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 9999999999999999999999999999999, 9999999999999999999999999999999999999999 ) + self.assertRaises( ValueError, self.samfile.count, "chr1", 9999999999999999999999999999999, 9999999999999999999999999999999999999999 ) + + def testOutOfRangeLargeOldFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1:99999999999999999-999999999999999999" ) + self.assertRaises( ValueError, self.samfile.count, "chr1:99999999999999999-999999999999999999" ) + + def testZeroToZero(self): + '''see issue 44''' + self.assertEqual( len(list(self.samfile.fetch('chr1', 0, 0))), 0) + + def tearDown(self): + self.samfile.close() + +class TestWrongFormat(unittest.TestCase): + '''test cases for opening files not in bam/sam format.''' + + def testOpenSamAsBam( self ): + self.assertRaises( ValueError, pysam.Samfile, 'ex1.sam', 'rb' ) + + def testOpenBamAsSam( self ): + # test fails, needs to be implemented. + # sam.fetch() fails on reading, not on opening + # self.assertRaises( ValueError, pysam.Samfile, 'ex1.bam', 'r' ) + pass + + def testOpenFastaAsSam( self ): + # test fails, needs to be implemented. + # sam.fetch() fails on reading, not on opening + # self.assertRaises( ValueError, pysam.Samfile, 'ex1.fa', 'r' ) + pass + + def testOpenFastaAsBam( self ): + self.assertRaises( ValueError, pysam.Samfile, 'ex1.fa', 'rb' ) + +class TestFastaFile(unittest.TestCase): + + mSequences = { 'chr1' : + "CACTAGTGGCTCATTGTAAATGTGTGGTTTAACTCGTCCATGGCCCAGCATTAGGGAGCTGTGGACCCTGCAGCCTGGCTGTGGGGGCCGCAGTGGCTGAGGGGTGCAGAGCCGAGTCACGGGGTTGCCAGCACAGGGGCTTAACCTCTGGTGACTGCCAGAGCTGCTGGCAAGCTAGAGTCCCATTTGGAGCCCCTCTAAGCCGTTCTATTTGTAATGAAAACTATATTTATGCTATTCAGTTCTAAATATAGAAATTGAAACAGCTGTGTTTAGTGCCTTTGTTCAACCCCCTTGCAACAACCTTGAGAACCCCAGGGAATTTGTCAATGTCAGGGAAGGAGCATTTTGTCAGTTACCAAATGTGTTTATTACCAGAGGGATGGAGGGAAGAGGGACGCTGAAGAACTTTGATGCCCTCTTCTTCCAAAGATGAAACGCGTAACTGCGCTCTCATTCACTCCAGCTCCCTGTCACCCAATGGACCTGTGATATCTGGATTCTGGGAAATTCTTCATCCTGGACCCTGAGAGATTCTGCAGCCCAGCTCCAGATTGCTTGTGGTCTGACAGGCTGCAACTGTGAGCCATCACAATGAACAACAGGAAGAAAAGGTCTTTCAAAAGGTGATGTGTGTTCTCATCAACCTCATACACACACATGGTTTAGGGGTATAATACCTCTACATGGCTGATTATGAAAACAATGTTCCCCAGATACCATCCCTGTCTTACTTCCAGCTCCCCAGAGGGAAAGCTTTCAACGCTTCTAGCCATTTCTTTTGGCATTTGCCTTCAGACCCTACACGAATGCGTCTCTACCACAGGGGGCTGCGCGGTTTCCCATCATGAAGCACTGAACTTCCACGTCTCATCTAGGGGAACAGGGAGGTGCACTAATGCGCTCCACGCCCAAGCCCTTCTCACAGTTTCTGCCCCCAGCATGGTTGTACTGGGCAATACATGAGATTATTAGGAAATGCTTTACTGTCATAACTATGAAGAGACTATTGCCAGATGAACCACACATTAATACTATGTTTCTTATCTGCACATTACTACCCTGCAATTAATATAATTGTGTCCATGTACACACGCTGTCCTATGTACTTATCATGACTCTATCCCAAATTCCCAATTACGTCCTATCTTCTTCTTAGGGAAGAACAGCTTAGGTATCAATTTGGTGTTCTGTGTAAAGTCTCAGGGAGCCGTCCGTGTCCTCCCATCTGGCCTCGTCCACACTGGTTCTCTTGAAAGCTTGGGCTGTAATGATGCCCCTTGGCCATCACCCAGTCCCTGCCCCATCTCTTGTAATCTCTCTCCTTTTTGCTGCATCCCTGTCTTCCTCTGTCTTGATTTACTTGTTGTTGGTTTTCTGTTTCTTTGTTTGATTTGGTGGAAGACATAATCCCACGCTTCCTATGGAAAGGTTGTTGGGAGATTTTTAATGATTCCTCAATGTTAAAATGTCTATTTTTGTCTTGACACCCAACTAATATTTGTCTGAGCAAAACAGTCTAGATGAGAGAGAACTTCCCTGGAGGTCTGATGGCGTTTCTCCCTCGTCTTCTTA", + 'chr2' : + "TTCAAATGAACTTCTGTAATTGAAAAATTCATTTAAGAAATTACAAAATATAGTTGAAAGCTCTAACAATAGACTAAACCAAGCAGAAGAAAGAGGTTCAGAACTTGAAGACAAGTCTCTTATGAATTAACCCAGTCAGACAAAAATAAAGAAAAAAATTTTAAAAATGAACAGAGCTTTCAAGAAGTATGAGATTATGTAAAGTAACTGAACCTATGAGTCACAGGTATTCCTGAGGAAAAAGAAAAAGTGAGAAGTTTGGAAAAACTATTTGAGGAAGTAATTGGGGAAAACCTCTTTAGTCTTGCTAGAGATTTAGACATCTAAATGAAAGAGGCTCAAAGAATGCCAGGAAGATACATTGCAAGACAGACTTCATCAAGATATGTAGTCATCAGACTATCTAAAGTCAACATGAAGGAAAAAAATTCTAAAATCAGCAAGAGAAAAGCATACAGTCATCTATAAAGGAAATCCCATCAGAATAACAATGGGCTTCTCAGCAGAAACCTTACAAGCCAGAAGAGATTGGATCTAATTTTTGGACTTCTTAAAGAAAAAAAAACCTGTCAAACACGAATGTTATGCCCTGCTAAACTAAGCATCATAAATGAAGGGGAAATAAAGTCAAGTCTTTCCTGACAAGCAAATGCTAAGATAATTCATCATCACTAAACCAGTCCTATAAGAAATGCTCAAAAGAATTGTAAAAGTCAAAATTAAAGTTCAATACTCACCATCATAAATACACACAAAAGTACAAAACTCACAGGTTTTATAAAACAATTGAGACTACAGAGCAACTAGGTAAAAAATTAACATTACAACAGGAACAAAACCTCATATATCAATATTAACTTTGAATAAAAAGGGATTAAATTCCCCCACTTAAGAGATATAGATTGGCAGAACAGATTTAAAAACATGAACTAACTATATGCTGTTTACAAGAAACTCATTAATAAAGACATGAGTTCAGGTAAAGGGGTGGAAAAAGATGTTCTACGCAAACAGAAACCAAATGAGAGAAGGAGTAGCTATACTTATATCAGATAAAGCACACTTTAAATCAACAACAGTAAAATAAAACAAAGGAGGTCATCATACAATGATAAAAAGATCAATTCAGCAAGAAGATATAACCATCCTACTAAATACATATGCACCTAACACAAGACTACCCAGATTCATAAAACAAATACTACTAGACCTAAGAGGGATGAGAAATTACCTAATTGGTACAATGTACAATATTCTGATGATGGTTACACTAAAAGCCCATACTTTACTGCTACTCAATATATCCATGTAACAAATCTGCGCTTGTACTTCTAAATCTATAAAAAAATTAAAATTTAACAAAAGTAAATAAAACACATAGCTAAAACTAAAAAAGCAAAAACAAAAACTATGCTAAGTATTGGTAAAGATGTGGGGAAAAAAGTAAACTCTCAAATATTGCTAGTGGGAGTATAAATTGTTTTCCACTTTGGAAAACAATTTGGTAATTTCGTTTTTTTTTTTTTCTTTTCTCTTTTTTTTTTTTTTTTTTTTGCATGCCAGAAAAAAATATTTACAGTAACT", + } + + def setUp(self): + self.file=pysam.Fastafile( "ex1.fa" ) + + def testFetch(self): + for id, seq in self.mSequences.items(): + self.assertEqual( seq, self.file.fetch( id ) ) + for x in range( 0, len(seq), 10): + self.assertEqual( seq[x:x+10], self.file.fetch( id, x, x+10) ) + # test x:end + self.assertEqual( seq[x:], self.file.fetch( id, x) ) + # test 0:x + self.assertEqual( seq[:x], self.file.fetch( id, None, x) ) + + + # unknown sequence returns "" + self.assertEqual( "", self.file.fetch("chr12") ) + + def testOutOfRangeAccess( self ): + '''test out of range access.''' + # out of range access returns an empty string + for contig, s in self.mSequences.iteritems(): + self.assertEqual( self.file.fetch( contig, len(s), len(s)+1), "" ) + + self.assertEqual( self.file.fetch( "chr3", 0 , 100), "" ) + + def testFetchErrors( self ): + self.assertRaises( ValueError, self.file.fetch ) + self.assertRaises( ValueError, self.file.fetch, "chr1", -1, 10 ) + self.assertRaises( ValueError, self.file.fetch, "chr1", 20, 10 ) + + def testLength( self ): + self.assertEqual( len(self.file), 2 ) + + def tearDown(self): + self.file.close() + +class TestAlignedRead(unittest.TestCase): + '''tests to check if aligned read can be constructed + and manipulated. + ''' + + def checkFieldEqual( self, read1, read2, exclude = []): + '''check if two reads are equal by comparing each field.''' + + for x in ("qname", "seq", "flag", + "rname", "pos", "mapq", "cigar", + "mrnm", "mpos", "isize", "qual", + "is_paired", "is_proper_pair", + "is_unmapped", "mate_is_unmapped", + "is_reverse", "mate_is_reverse", + "is_read1", "is_read2", + "is_secondary", "is_qcfail", + "is_duplicate", "bin"): + if x in exclude: continue + self.assertEqual( getattr(read1, x), getattr(read2,x), "attribute mismatch for %s: %s != %s" % + (x, getattr(read1, x), getattr(read2,x))) + + def testEmpty( self ): + a = pysam.AlignedRead() + self.assertEqual( a.qname, None ) + self.assertEqual( a.seq, None ) + self.assertEqual( a.qual, None ) + self.assertEqual( a.flag, 0 ) + self.assertEqual( a.rname, 0 ) + self.assertEqual( a.mapq, 0 ) + self.assertEqual( a.cigar, None ) + self.assertEqual( a.tags, [] ) + self.assertEqual( a.mrnm, 0 ) + self.assertEqual( a.mpos, 0 ) + self.assertEqual( a.isize, 0 ) + + def buildRead( self ): + '''build an example read.''' + + a = pysam.AlignedRead() + a.qname = "read_12345" + a.seq="ACGT" * 3 + a.flag = 0 + a.rname = 0 + a.pos = 33 + a.mapq = 20 + a.cigar = ( (0,10), (2,1), (0,25) ) + a.mrnm = 0 + a.mpos=200 + a.isize=167 + a.qual="1234" * 3 + # todo: create tags + return a + + def testUpdate( self ): + '''check if updating fields affects other variable length data + ''' + a = self.buildRead() + b = self.buildRead() + + # check qname + b.qname = "read_123" + self.checkFieldEqual( a, b, "qname" ) + b.qname = "read_12345678" + self.checkFieldEqual( a, b, "qname" ) + b.qname = "read_12345" + self.checkFieldEqual( a, b) + + # check cigar + b.cigar = ( (0,10), ) + self.checkFieldEqual( a, b, "cigar" ) + b.cigar = ( (0,10), (2,1), (0,25), (2,1), (0,25) ) + self.checkFieldEqual( a, b, "cigar" ) + b.cigar = ( (0,10), (2,1), (0,25) ) + self.checkFieldEqual( a, b) + + # check seq + b.seq = "ACGT" + self.checkFieldEqual( a, b, ("seq", "qual") ) + b.seq = "ACGT" * 10 + self.checkFieldEqual( a, b, ("seq", "qual") ) + b.seq = "ACGT" * 3 + self.checkFieldEqual( a, b, ("qual",)) + + # reset qual + b = self.buildRead() + + # check flags: + for x in ( + "is_paired", "is_proper_pair", + "is_unmapped", "mate_is_unmapped", + "is_reverse", "mate_is_reverse", + "is_read1", "is_read2", + "is_secondary", "is_qcfail", + "is_duplicate"): + setattr( b, x, True ) + self.assertEqual( getattr(b, x), True ) + self.checkFieldEqual( a, b, ("flag", x,) ) + setattr( b, x, False ) + self.assertEqual( getattr(b, x), False ) + self.checkFieldEqual( a, b ) + + def testLargeRead( self ): + '''build an example read.''' + + a = pysam.AlignedRead() + a.qname = "read_12345" + a.seq="ACGT" * 200 + a.flag = 0 + a.rname = 0 + a.pos = 33 + a.mapq = 20 + a.cigar = ( (0,10), (2,1), (0,25) ) + a.mrnm = 0 + a.mpos=200 + a.isize=167 + a.qual="1234" * 200 + + return a + + def testTagParsing( self ): + '''test for tag parsing + + see http://groups.google.com/group/pysam-user-group/browse_thread/thread/67ca204059ea465a + ''' + samfile=pysam.Samfile( "ex8.bam","rb" ) + + for entry in samfile: + before = entry.tags + entry.tags = entry.tags + after = entry.tags + self.assertEqual( after, before ) + +class TestDeNovoConstruction(unittest.TestCase): + '''check BAM/SAM file construction using ex3.sam + + (note these are +1 coordinates): + + read_28833_29006_6945 99 chr1 33 20 10M1D25M = 200 167 AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG <<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<< NM:i:1 RG:Z:L1 + read_28701_28881_323b 147 chr2 88 30 35M = 500 412 ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA <<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<< MF:i:18 RG:Z:L2 + ''' + + header = { 'HD': {'VN': '1.0'}, + 'SQ': [{'LN': 1575, 'SN': 'chr1'}, + {'LN': 1584, 'SN': 'chr2'}], } + + bamfile = "ex6.bam" + samfile = "ex6.sam" + + def checkFieldEqual( self, read1, read2, exclude = []): + '''check if two reads are equal by comparing each field.''' + + for x in ("qname", "seq", "flag", + "rname", "pos", "mapq", "cigar", + "mrnm", "mpos", "isize", "qual", + "bin", + "is_paired", "is_proper_pair", + "is_unmapped", "mate_is_unmapped", + "is_reverse", "mate_is_reverse", + "is_read1", "is_read2", + "is_secondary", "is_qcfail", + "is_duplicate"): + if x in exclude: continue + self.assertEqual( getattr(read1, x), getattr(read2,x), "attribute mismatch for %s: %s != %s" % + (x, getattr(read1, x), getattr(read2,x))) + + def setUp( self ): + + + a = pysam.AlignedRead() + a.qname = "read_28833_29006_6945" + a.seq="AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG" + a.flag = 99 + a.rname = 0 + a.pos = 32 + a.mapq = 20 + a.cigar = ( (0,10), (2,1), (0,25) ) + a.mrnm = 0 + a.mpos=199 + a.isize=167 + a.qual="<<<<<<<<<<<<<<<<<<<<<:<9/,&,22;;<<<" + a.tags = ( ("NM", 1), + ("RG", "L1") ) + + b = pysam.AlignedRead() + b.qname = "read_28701_28881_323b" + b.seq="ACCTATATCTTGGCCTTGGCCGATGCGGCCTTGCA" + b.flag = 147 + b.rname = 1 + b.pos = 87 + b.mapq = 30 + b.cigar = ( (0,35), ) + b.mrnm = 1 + b.mpos=499 + b.isize=412 + b.qual="<<<<<;<<<<7;:<<<6;<<<<<<<<<<<<7<<<<" + b.tags = ( ("MF", 18), + ("RG", "L2") ) + + self.reads = (a,b) + + def testSAMWholeFile( self ): + + tmpfilename = "tmp_%i.sam" % id(self) + + outfile = pysam.Samfile( tmpfilename, "wh", header = self.header ) + + for x in self.reads: outfile.write( x ) + outfile.close() + + self.assertTrue( checkBinaryEqual( tmpfilename, self.samfile ), + "mismatch when construction SAM file, see %s %s" % (tmpfilename, self.samfile)) + + os.unlink( tmpfilename ) + + def testBAMPerRead( self ): + '''check if individual reads are binary equal.''' + infile = pysam.Samfile( self.bamfile, "rb") + + others = list(infile) + for denovo, other in zip( others, self.reads): + self.checkFieldEqual( other, denovo ) + self.assertEqual( other.compare( denovo ), 0 ) + + def testSAMPerRead( self ): + '''check if individual reads are binary equal.''' + infile = pysam.Samfile( self.samfile, "r") + + others = list(infile) + for denovo, other in zip( others, self.reads): + self.checkFieldEqual( other, denovo ) + self.assertEqual( other.compare( denovo), 0 ) + + def testBAMWholeFile( self ): + + tmpfilename = "tmp_%i.bam" % id(self) + + outfile = pysam.Samfile( tmpfilename, "wb", header = self.header ) + + for x in self.reads: outfile.write( x ) + outfile.close() + + self.assertTrue( checkBinaryEqual( tmpfilename, self.bamfile ), + "mismatch when construction BAM file, see %s %s" % (tmpfilename, self.bamfile)) + + os.unlink( tmpfilename ) + + +class TestDoubleFetch(unittest.TestCase): + '''check if two iterators on the same bamfile are independent.''' + + def testDoubleFetch( self ): + + samfile1 = pysam.Samfile('ex1.bam', 'rb') + + for a,b in zip(samfile1.fetch(), samfile1.fetch()): + self.assertEqual( a.compare( b ), 0 ) + + def testDoubleFetchWithRegion( self ): + + samfile1 = pysam.Samfile('ex1.bam', 'rb') + chr, start, stop = 'chr1', 200, 3000000 + self.assertTrue(len(list(samfile1.fetch ( chr, start, stop))) > 0) #just making sure the test has something to catch + + for a,b in zip(samfile1.fetch( chr, start, stop), samfile1.fetch( chr, start, stop)): + self.assertEqual( a.compare( b ), 0 ) + + def testDoubleFetchUntilEOF( self ): + + samfile1 = pysam.Samfile('ex1.bam', 'rb') + + for a,b in zip(samfile1.fetch( until_eof = True), + samfile1.fetch( until_eof = True )): + self.assertEqual( a.compare( b), 0 ) + +class TestRemoteFileFTP(unittest.TestCase): + '''test remote access. + + ''' + + # Need to find an ftp server without password on standard + # port. + + url = "ftp://ftp.sanger.ac.uk/pub/rd/humanSequences/CV.bam" + region = "1:1-1000" + + def testFTPView( self ): + return + result = pysam.view( self.url, self.region ) + self.assertEqual( len(result), 36 ) + + def testFTPFetch( self ): + return + samfile = pysam.Samfile(self.url, "rb") + result = list(samfile.fetch( region = self.region )) + self.assertEqual( len(result), 36 ) + +class TestRemoteFileHTTP( unittest.TestCase): + + url = "http://genserv.anat.ox.ac.uk/downloads/pysam/test/ex1.bam" + region = "chr1:1-1000" + local = "ex1.bam" + + def testView( self ): + samfile_local = pysam.Samfile(self.local, "rb") + ref = list(samfile_local.fetch( region = self.region )) + + result = pysam.view( self.url, self.region ) + self.assertEqual( len(result), len(ref) ) + + def testFetch( self ): + samfile = pysam.Samfile(self.url, "rb") + result = list(samfile.fetch( region = self.region )) + samfile_local = pysam.Samfile(self.local, "rb") + ref = list(samfile_local.fetch( region = self.region )) + + self.assertEqual( len(ref), len(result) ) + for x, y in zip(result, ref): + self.assertEqual( x.compare( y ), 0 ) + + def testFetchAll( self ): + samfile = pysam.Samfile(self.url, "rb") + result = list(samfile.fetch()) + samfile_local = pysam.Samfile(self.local, "rb") + ref = list(samfile_local.fetch() ) + + self.assertEqual( len(ref), len(result) ) + for x, y in zip(result, ref): + self.assertEqual( x.compare( y ), 0 ) + +class TestLargeOptValues( unittest.TestCase ): + + ints = ( 65536, 214748, 2147484, 2147483647 ) + floats = ( 65536.0, 214748.0, 2147484.0 ) + + def check( self, samfile ): + + i = samfile.fetch() + for exp in self.ints: + rr = i.next() + obs = rr.opt("ZP") + self.assertEqual( exp, obs, "expected %s, got %s\n%s" % (str(exp), str(obs), str(rr))) + + for exp in [ -x for x in self.ints ]: + rr = i.next() + obs = rr.opt("ZP") + self.assertEqual( exp, obs, "expected %s, got %s\n%s" % (str(exp), str(obs), str(rr))) + + for exp in self.floats: + rr = i.next() + obs = rr.opt("ZP") + self.assertEqual( exp, obs, "expected %s, got %s\n%s" % (str(exp), str(obs), str(rr))) + + for exp in [ -x for x in self.floats ]: + rr = i.next() + obs = rr.opt("ZP") + self.assertEqual( exp, obs, "expected %s, got %s\n%s" % (str(exp), str(obs), str(rr))) + + def testSAM( self ): + samfile = pysam.Samfile("ex10.sam", "r") + self.check( samfile ) + + def testBAM( self ): + samfile = pysam.Samfile("ex10.bam", "rb") + self.check( samfile ) + +# class TestSNPCalls( unittest.TestCase ): +# '''test pysam SNP calling ability.''' + +# def checkEqual( self, a, b ): +# for x in ("reference_base", +# "pos", +# "genotype", +# "consensus_quality", +# "snp_quality", +# "mapping_quality", +# "coverage" ): +# self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % +# (x, getattr(a, x), getattr(b,x), str(a), str(b))) + +# def testAllPositionsViaIterator( self ): +# samfile = pysam.Samfile( "ex1.bam", "rb") +# fastafile = pysam.Fastafile( "ex1.fa" ) +# try: +# refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base != "*"] +# except pysam.SamtoolsError: +# pass + +# i = samfile.pileup( stepper = "samtools", fastafile = fastafile ) +# calls = list(pysam.IteratorSNPCalls(i)) +# for x,y in zip( refs, calls ): +# self.checkEqual( x, y ) + +# def testPerPositionViaIterator( self ): +# # test pileup for each position. This is a slow operation +# # so this test is disabled +# return +# samfile = pysam.Samfile( "ex1.bam", "rb") +# fastafile = pysam.Fastafile( "ex1.fa" ) +# for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ): +# if x.reference_base == "*": continue +# i = samfile.pileup( x.chromosome, x.pos, x.pos+1, +# fastafile = fastafile, +# stepper = "samtools" ) +# z = [ zz for zz in pysam.IteratorSamtools(i) if zz.pos == x.pos ] +# self.assertEqual( len(z), 1 ) +# self.checkEqual( x, z[0] ) + +# def testPerPositionViaCaller( self ): +# # test pileup for each position. This is a fast operation +# samfile = pysam.Samfile( "ex1.bam", "rb") +# fastafile = pysam.Fastafile( "ex1.fa" ) +# i = samfile.pileup( stepper = "samtools", fastafile = fastafile ) +# caller = pysam.SNPCaller( i ) + +# for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ): +# if x.reference_base == "*": continue +# call = caller.call( x.chromosome, x.pos ) +# self.checkEqual( x, call ) + +# class TestIndelCalls( unittest.TestCase ): +# '''test pysam indel calling.''' + +# def checkEqual( self, a, b ): + +# for x in ("pos", +# "genotype", +# "consensus_quality", +# "snp_quality", +# "mapping_quality", +# "coverage", +# "first_allele", +# "second_allele", +# "reads_first", +# "reads_second", +# "reads_diff"): +# if b.genotype == "*/*" and x == "second_allele": +# # ignore test for second allele (positions chr2:439 and chr2:1512) +# continue +# self.assertEqual( getattr(a, x), getattr(b,x), "%s mismatch: %s != %s\n%s\n%s" % +# (x, getattr(a, x), getattr(b,x), str(a), str(b))) + +# def testAllPositionsViaIterator( self ): + +# samfile = pysam.Samfile( "ex1.bam", "rb") +# fastafile = pysam.Fastafile( "ex1.fa" ) +# try: +# refs = [ x for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ) if x.reference_base == "*"] +# except pysam.SamtoolsError: +# pass + +# i = samfile.pileup( stepper = "samtools", fastafile = fastafile ) +# calls = [ x for x in list(pysam.IteratorIndelCalls(i)) if x != None ] +# for x,y in zip( refs, calls ): +# self.checkEqual( x, y ) + +# def testPerPositionViaCaller( self ): +# # test pileup for each position. This is a fast operation +# samfile = pysam.Samfile( "ex1.bam", "rb") +# fastafile = pysam.Fastafile( "ex1.fa" ) +# i = samfile.pileup( stepper = "samtools", fastafile = fastafile ) +# caller = pysam.IndelCaller( i ) + +# for x in pysam.pileup( "-c", "-f", "ex1.fa", "ex1.bam" ): +# if x.reference_base != "*": continue +# call = caller.call( x.chromosome, x.pos ) +# self.checkEqual( x, call ) + +class TestLogging( unittest.TestCase ): + '''test around bug issue 42, + + failed in versions < 0.4 + ''' + + def check( self, bamfile, log ): + + if log: + logger = logging.getLogger('franklin') + logger.setLevel(logging.INFO) + formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + log_hand = logging.FileHandler('log.txt') + log_hand.setFormatter(formatter) + logger.addHandler(log_hand) + + bam = pysam.Samfile(bamfile, 'rb') + cols = bam.pileup() + self.assert_( True ) + + def testFail1( self ): + self.check( "ex9_fail.bam", False ) + self.check( "ex9_fail.bam", True ) + + def testNoFail1( self ): + self.check( "ex9_nofail.bam", False ) + self.check( "ex9_nofail.bam", True ) + + def testNoFail2( self ): + self.check( "ex9_nofail.bam", True ) + self.check( "ex9_nofail.bam", True ) + +# TODOS +# 1. finish testing all properties within pileup objects +# 2. check exceptions and bad input problems (missing files, optional fields that aren't present, etc...) +# 3. check: presence of sequence + +class TestSamfileUtilityFunctions( unittest.TestCase ): + + def testCount( self ): + + samfile = pysam.Samfile( "ex1.bam", "rb" ) + + for contig in ("chr1", "chr2" ): + for start in xrange( 0, 2000, 100 ): + end = start + 1 + self.assertEqual( len( list( samfile.fetch( contig, start, end ) ) ), + samfile.count( contig, start, end ) ) + + # test empty intervals + self.assertEqual( len( list( samfile.fetch( contig, start, start ) ) ), + samfile.count( contig, start, start ) ) + + # test half empty intervals + self.assertEqual( len( list( samfile.fetch( contig, start ) ) ), + samfile.count( contig, start ) ) + + def testMate( self ): + '''test mate access.''' + + readnames = [ x.split("\t")[0] for x in open( "ex1.sam", "rb" ).readlines() ] + counts = collections.defaultdict( int ) + for x in readnames: counts[x] += 1 + + samfile = pysam.Samfile( "ex1.bam", "rb" ) + for read in samfile.fetch(): + if not read.is_paired: + self.assertRaises( ValueError, samfile.mate, read ) + elif read.mate_is_unmapped: + self.assertRaises( ValueError, samfile.mate, read ) + else: + if counts[read.qname] == 1: + self.assertRaises( ValueError, samfile.mate, read ) + else: + mate = samfile.mate( read ) + self.assertEqual( read.qname, mate.qname ) + self.assertEqual( read.is_read1, mate.is_read2 ) + self.assertEqual( read.is_read2, mate.is_read1 ) + self.assertEqual( read.pos, mate.mpos ) + self.assertEqual( read.mpos, mate.pos ) + + def testIndexStats( self ): + '''test if total number of mapped/unmapped reads is correct.''' + + samfile = pysam.Samfile( "ex1.bam", "rb" ) + self.assertEqual( samfile.mapped, 3235 ) + self.assertEqual( samfile.unmapped, 35 ) + +class TestSamtoolsProxy( unittest.TestCase ): + '''tests for sanity checking access to samtools functions.''' + + def testIndex( self ): + self.assertRaises( IOError, pysam.index, "missing_file" ) + + def testView( self ): + # note that view still echos "open: No such file or directory" + self.assertRaises( pysam.SamtoolsError, pysam.view, "missing_file" ) + + def testSort( self ): + self.assertRaises( pysam.SamtoolsError, pysam.sort, "missing_file" ) + +class TestSamfileIndex( unittest.TestCase): + + def testIndex( self ): + samfile = pysam.Samfile( "ex1.bam", "rb" ) + index = pysam.IndexedReads( samfile ) + index.build() + + reads = collections.defaultdict( int ) + + for read in samfile: reads[read.qname] += 1 + + for qname, counts in reads.iteritems(): + found = list(index.find( qname )) + self.assertEqual( len(found), counts ) + for x in found: self.assertEqual( x.qname, qname ) + + +if __name__ == "__main__": + # build data files + print "building data files" + subprocess.call( "make", shell=True) + print "starting tests" + unittest.main() diff --git a/code/utilities/CPAT-1.2.2/lib/tests/segfault_tests.py b/code/utilities/CPAT-1.2.2/lib/tests/segfault_tests.py new file mode 100755 index 0000000..ff32fec --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/segfault_tests.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +'''unit testing code for pysam.''' + +import pysam +import unittest +import os +import itertools +import subprocess +import shutil + +class TestExceptions(unittest.TestCase): + + def setUp(self): + self.samfile=pysam.Samfile( "ex1.bam","rb" ) + + def testOutOfRangeNegativeNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 5, -10 ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 5, 0 ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1", -5, -10 ) + + def testOutOfRangeNegativeOldFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1:-5-10" ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1:-5-0" ) + self.assertRaises( ValueError, self.samfile.fetch, "chr1:-5--10" ) + + def testOutOfRangeLargeNewFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1", 99999999999999999, 999999999999999999 ) + + def testOutOfRangeLargeOldFormat(self): + self.assertRaises( ValueError, self.samfile.fetch, "chr1:99999999999999999-999999999999999999" ) + + def tearDown(self): + self.samfile.close() + +if __name__ == "__main__": + unittest.main() + diff --git a/code/utilities/CPAT-1.2.2/lib/tests/tabix_test.py b/code/utilities/CPAT-1.2.2/lib/tests/tabix_test.py new file mode 100755 index 0000000..2caa628 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/lib/tests/tabix_test.py @@ -0,0 +1,403 @@ +#!/usr/bin/env python +'''unit testing code for pysam. + +Execute in the :file:`tests` directory as it requires the Makefile +and data files located there. +''' + +import sys, os, shutil, gzip +import pysam +import unittest +import itertools +import subprocess + +def checkBinaryEqual( filename1, filename2 ): + '''return true if the two files are binary equal.''' + if os.path.getsize( filename1 ) != os.path.getsize( filename2 ): + return False + + infile1 = open(filename1, "rb") + infile2 = open(filename2, "rb") + + def chariter( infile ): + while 1: + c = infile.read(1) + if c == "": break + yield c + + found = False + for c1,c2 in itertools.izip( chariter( infile1), chariter( infile2) ): + if c1 != c2: break + else: + found = True + + infile1.close() + infile2.close() + return found + +class TestIndexing(unittest.TestCase): + filename = "example.gtf.gz" + filename_idx = "example.gtf.gz.tbi" + + def setUp( self ): + + self.tmpfilename = "tmp_%i.gtf.gz" % id(self) + shutil.copyfile( self.filename, self.tmpfilename ) + + def testIndexPreset( self ): + '''test indexing via preset.''' + + pysam.tabix_index( self.tmpfilename, preset = "gff" ) + checkBinaryEqual( self.tmpfilename + ".tbi", self.filename_idx ) + + def tearDown( self ): + os.unlink( self.tmpfilename ) + os.unlink( self.tmpfilename + ".tbi" ) + +class TestCompression(unittest.TestCase): + filename = "example.gtf.gz" + filename_idx = "example.gtf.gz.tbi" + + def setUp( self ): + + self.tmpfilename = "tmp_%i.gtf" % id(self) + infile = gzip.open( self.filename, "r") + outfile = open( self.tmpfilename, "w" ) + outfile.write( "".join(infile.readlines()) ) + outfile.close() + infile.close() + + def testIndexPreset( self ): + '''test indexing via preset.''' + + pysam.tabix_index( self.tmpfilename, preset = "gff" ) + checkBinaryEqual( self.tmpfilename + ".gz", self.filename ) + checkBinaryEqual( self.tmpfilename + ".gz.tbi", self.filename_idx ) + + def tearDown( self ): + os.unlink( self.tmpfilename + ".gz" ) + os.unlink( self.tmpfilename + ".gz.tbi" ) + +class TestIteration( unittest.TestCase ): + + filename = "example.gtf.gz" + + def setUp( self ): + + self.tabix = pysam.Tabixfile( self.filename ) + lines = [ x for x in gzip.open(self.filename).readlines() if not x.startswith("#") ] + # creates index of contig, start, end, adds content without newline. + self.compare = [ + (x[0][0], int(x[0][3]), int(x[0][4]), x[1]) + for x in [ (y.split("\t"), y[:-1]) for y in lines ] ] + + def getSubset( self, contig = None, start = None, end = None): + + if contig == None: + # all lines + subset = [ x[3] for x in self.compare ] + else: + if start != None and end == None: + # until end of contig + subset = [ x[3] for x in self.compare if x[0] == contig and x[2] > start ] + elif start == None and end != None: + # from start of contig + subset = [ x[3] for x in self.compare if x[0] == contig and x[1] <= end ] + elif start == None and end == None: + subset = [ x[3] for x in self.compare if x[0] == contig ] + else: + # all within interval + subset = [ x[3] for x in self.compare if x[0] == contig and \ + min( x[2], end) - max(x[1], start) > 0 ] + + return subset + + def checkPairwise( self, result, ref ): + + result.sort() + ref.sort() + + a = set(result) + b = set(ref) + + self.assertEqual( len(result), len(ref), + "unexpected number of results: %i, expected %i, differences are %s: %s" \ + % (len(result), len(ref), + a.difference(b), + b.difference(a) )) + + for x, d in enumerate( zip( result, ref )): + self.assertEqual( d[0], d[1], + "unexpected results in pair %i: '%s', expected '%s'" % \ + (x, + d[0], + d[1]) ) + + + def testAll( self ): + result = list(self.tabix.fetch()) + ref = self.getSubset( ) + self.checkPairwise( result, ref ) + + def testPerContig( self ): + for contig in ("chr1", "chr2", "chr1", "chr2" ): + result = list(self.tabix.fetch( contig )) + ref = self.getSubset( contig ) + self.checkPairwise( result, ref ) + + def testPerContigToEnd( self ): + + end = None + for contig in ("chr1", "chr2", "chr1", "chr2" ): + for start in range( 0, 200000, 1000): + result = list(self.tabix.fetch( contig, start, end )) + ref = self.getSubset( contig, start, end ) + self.checkPairwise( result, ref ) + + def testPerContigFromStart( self ): + + start = None + for contig in ("chr1", "chr2", "chr1", "chr2" ): + for end in range( 0, 200000, 1000): + result = list(self.tabix.fetch( contig, start, end )) + ref = self.getSubset( contig, start, end ) + self.checkPairwise( result, ref ) + + def testPerContig( self ): + + start, end = None, None + for contig in ("chr1", "chr2", "chr1", "chr2" ): + result = list(self.tabix.fetch( contig, start, end )) + ref = self.getSubset( contig, start, end ) + self.checkPairwise( result, ref ) + + def testPerInterval( self ): + + start, end = None, None + for contig in ("chr1", "chr2", "chr1", "chr2" ): + for start in range( 0, 200000, 2000): + for end in range( start, start + 2000, 500): + result = list(self.tabix.fetch( contig, start, end )) + ref = self.getSubset( contig, start, end ) + self.checkPairwise( result, ref ) + + + def testInvalidIntervals( self ): + + self.assertRaises( ValueError, self.tabix.fetch, "chr1", 0, -10) + self.assertRaises( ValueError, self.tabix.fetch, "chr1", -10, 200) + self.assertRaises( ValueError, self.tabix.fetch, "chr1", 200, 0) + self.assertRaises( ValueError, self.tabix.fetch, "chr1", -10, -20) + self.assertRaises( ValueError, self.tabix.fetch, "chrUn" ) + + def testGetContigs( self ): + self.assertEqual( sorted(self.tabix.contigs), ["chr1", "chr2"] ) + # check that contigs is read-only + self.assertRaises( AttributeError, setattr, self.tabix, "contigs", ["chr1", "chr2"] ) + + def testHeader( self ): + ref = [] + for x in gzip.open( self.filename ): + if not x.startswith("#"): break + ref.append( x[:-1] ) + header = list( self.tabix.header ) + self.assertEqual( ref, header ) + + def testReopening( self ): + '''test repeated opening of the same file.''' + def func1(): + # opens any tabix file + inf = pysam.Tabixfile(self.filename) + return + + for i in range(10000): + func1() + + +class TestParser( unittest.TestCase ): + + filename = "example.gtf.gz" + + def setUp( self ): + + self.tabix = pysam.Tabixfile( self.filename ) + self.compare = [ x[:-1].split("\t") for x in gzip.open( self.filename, "r") if not x.startswith("#") ] + + def testRead( self ): + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asTuple() )): + self.assertEqual( self.compare[x], list(r) ) + self.assertEqual( len(self.compare[x]), len(r) ) + + # test indexing + for c in range(0,len(r)): + self.assertEqual( self.compare[x][c], r[c] ) + + # test slicing access + for c in range(0, len(r)-1): + for cc in range(c+1, len(r)): + self.assertEqual( self.compare[x][c:cc], + r[c:cc] ) + + def testWrite( self ): + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asTuple() )): + self.assertEqual( self.compare[x], list(r) ) + c = list(r) + for y in range(len(r)): + r[y] = "test_%05i" % y + c[y] = "test_%05i" % y + self.assertEqual( c, list(r) ) + self.assertEqual( "\t".join( c ), str(r) ) + # check second assignment + for y in range(len(r)): + r[y] = "test_%05i" % y + self.assertEqual( c, list(r) ) + self.assertEqual( "\t".join( c ), str(r) ) + + def testUnset( self ): + for x, r in enumerate(self.tabix.fetch( parser = pysam.asTuple() )): + self.assertEqual( self.compare[x], list(r) ) + c = list(r) + e = list(r) + for y in range(len(r)): + r[y] = c[y] = None + e[y] = "" + self.assertEqual( c, list(r) ) + self.assertEqual( "\t".join(e), str(r) ) + +class TestGTF( TestParser ): + + def testRead( self ): + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asGTF() )): + c = self.compare[x] + + self.assertEqual( len(c), len(r) ) + self.assertEqual( "\t".join(c), str(r) ) + self.assertTrue( r.gene_id.startswith("ENSG") ) + if r.feature != "gene": + self.assertTrue( r.transcript_id.startswith("ENST") ) + self.assertEqual( c[0], r.contig ) + +class TestBed( unittest.TestCase ): + filename = "example.bed.gz" + + def setUp( self ): + + self.tabix = pysam.Tabixfile( self.filename ) + self.compare = [ x[:-1].split("\t") for x in gzip.open( self.filename, "r") if not x.startswith("#") ] + + def testRead( self ): + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asBed() )): + c = self.compare[x] + self.assertEqual( "\t".join( c ), str(r) ) + self.assertEqual( list(c), list(r) ) + self.assertEqual( c[0], r.contig) + self.assertEqual( int(c[1]), r.start) + self.assertEqual( int(c[2]), r.end) + + def testWrite( self ): + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asBed() )): + c = self.compare[x] + self.assertEqual( "\t".join( c ), str(r) ) + self.assertEqual( list(c), list(r) ) + + r.contig = "test" + self.assertEqual( "test", r.contig) + self.assertEqual( "test", r[0]) + + r.start += 1 + self.assertEqual( int(c[1]) + 1, r.start ) + self.assertEqual( str(int(c[1]) + 1), r[1] ) + + r.end += 1 + self.assertEqual( int(c[2]) + 1, r.end ) + self.assertEqual( str(int(c[2]) + 1), r[2] ) + +class TestVCF( TestParser ): + + filename = "example.vcf40.gz" + columns = ("contig", "pos", "id", + "ref", "alt", "qual", + "filter", "info", "format" ) + + def testRead( self ): + + ncolumns = len(self.columns) + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asVCF() )): + c = self.compare[x] + for y, field in enumerate( self.columns ): + if field == "pos": + self.assertEqual( int(c[y]) - 1, getattr( r, field ) ) + self.assertEqual( int(c[y]) - 1, r.pos ) + else: + self.assertEqual( c[y], getattr( r, field ), + "mismatch in field %s: %s != %s" %\ + ( field,c[y], getattr( r, field ) ) ) + self.assertEqual( len(c), len( r ) + ncolumns ) + + for y in range(len(c) - ncolumns): + self.assertEqual( c[ncolumns+y], r[y] ) + + def testWrite( self ): + + ncolumns = len(self.columns) + + for x, r in enumerate(self.tabix.fetch( parser = pysam.asVCF() )): + + c = self.compare[x] + + # check unmodified string + ref_string = "\t".join( c ) + cmp_string = str(r) + self.assertEqual( ref_string, cmp_string ) + + # set fields and compare field-wise + for y, field in enumerate( self.columns ): + if field == "pos": + rpos = getattr( r, field ) + self.assertEqual( int(c[y]) - 1, rpos ) + self.assertEqual( int(c[y]) - 1, r.pos ) + # increment pos by 1 + setattr( r, field, rpos + 1 ) + self.assertEqual( getattr( r, field ), rpos + 1 ) + c[y] = str(int(c[y]) + 1 ) + else: + setattr( r, field, "test_%i" % y) + c[y] = "test_%i" % y + self.assertEqual( c[y], getattr( r, field ), + "mismatch in field %s: %s != %s" %\ + ( field,c[y], getattr( r, field ) ) ) + + self.assertEqual( len(c), len( r ) + ncolumns ) + + for y in range(len(c) - ncolumns): + c[ncolumns+y] = "test_%i" % y + r[y] = "test_%i" % y + self.assertEqual( c[ncolumns+y], r[y] ) + +class TestVCF( TestParser ): + + filename = "example.vcf40.gz" + + def testOpening( self ): + while 1: + infile = pysam.Tabixfile( self.filename ) + infile.close() + + + # check strings + ref_string = "\t".join( c ) + cmp_string = str(r) + + self.assertEqual( ref_string, cmp_string ) + +if __name__ == "__main__": + + unittest.main() + + diff --git a/code/utilities/CPAT-1.2.2/setup.cfg b/code/utilities/CPAT-1.2.2/setup.cfg new file mode 100755 index 0000000..861a9f5 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/setup.cfg @@ -0,0 +1,5 @@ +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + diff --git a/code/utilities/CPAT-1.2.2/setup.py b/code/utilities/CPAT-1.2.2/setup.py new file mode 100755 index 0000000..3ba2ba4 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/setup.py @@ -0,0 +1,272 @@ +import sys, platform +import os, shutil, hashlib, re, fnmatch + +"""Description + +Setup script for CPAT -- Coding Potential Assessment Tool + +Copyright (c) 2012 Liguo Wang + +This code is free software; you can redistribute it and/or modify it +under the terms of the Artistic License (see the file COPYING included +with the distribution). +""" + +if sys.version_info[0] != 2 or sys.version_info[1] < 7: + print >> sys.stderr, "ERROR: CPAT only works on Python2.x and requires Python 2.7 or greater" + sys.exit() + +# Automatically download setuptools if not available +from distribute_setup import use_setuptools +use_setuptools() + +from setuptools import * +from glob import glob + +try: + import numpy + have_numpy = True +except: + have_numpy = False + +def main(): + setup( name = "CPAT", + version = "1.2.2", + py_modules = [ 'psyco_full' ], + packages = find_packages( 'lib' ), + package_dir = { '': 'lib' }, + package_data = { '': ['*.ps'] }, + scripts = glob( "bin/*.py"), + ext_modules = get_extension_modules(), + test_suite = 'nose.collector', + setup_requires = ['nose>=0.10.4','cython>=0.12'], + author = "Liguo Wang", + author_email ="wangliguo78@gmail.com", + platforms = ['Linux','MacOS'], + description = "Coding Potential Assessment Tool", + url = "http://rna-cpat.sourceforge.net/", + zip_safe = False, + dependency_links = ['http://bitbucket.org/james_taylor/bx-python/wiki/Home','http://wwwfgu.anat.ox.ac.uk/~andreas/documentation/samtools/contents.html'], + cmdclass=command_classes ) + +# ---- Commands ------------------------------------------------------------- + +from distutils.core import Command + +# Use build_ext from Cython +command_classes = {} + +# Use build_ext from Cython if found +try: + import Cython.Distutils + command_classes['build_ext'] = Cython.Distutils.build_ext +except: + pass + +# Use epydoc if found +try: + import pkg_resources + pkg_resources.require( "epydoc" ) + import epydoc.cli, sys, os, os.path + # Create command class to build API documentation + class BuildAPIDocs( Command ): + user_options = [] + def initialize_options( self ): + pass + def finalize_options( self ): + pass + def run( self ): + # Save working directory and args + old_argv = sys.argv + old_cwd = os.getcwd() + # Build command line for Epydoc + sys.argv = """epydoc.py bx --verbose --html --simple-term + --exclude=._ + --exclude=_tests + --docformat=reStructuredText + --output=../doc/docbuild/html/apidoc""".split() + # Make output directory + if not os.path.exists( "./doc/docbuild/html/apidoc" ): + os.mkdir( "./doc/docbuild/html/apidoc" ) + # Move to lib directory (so bx package is in current directory) + os.chdir( "./lib" ) + # Invoke epydoc + epydoc.cli.cli() + # Restore args and working directory + sys.argv = old_argv + os.chdir( old_cwd ) + # Add to extra_commands + command_classes['build_apidocs'] = BuildAPIDocs +except: + pass + +# ---- Extension Modules ---------------------------------------------------- + +def get_extension_modules(): + extensions = [] + # Bitsets + extensions.append( Extension( "bx.bitset", + [ "lib/bx/bitset.pyx", + "src/binBits.c", + "src/kent/bits.c", + "src/kent/common.c" ], + include_dirs=[ "src/kent", "src"] ) ) + # Interval intersection + extensions.append( Extension( "bx.intervals.intersection", [ "lib/bx/intervals/intersection.pyx" ] ) ) + # Alignment object speedups + extensions.append( Extension( "bx.align._core", [ "lib/bx/align/_core.pyx" ] ) ) + # NIB reading speedups + extensions.append( Extension( "bx.seq._nib", [ "lib/bx/seq/_nib.pyx" ] ) ) + # 2bit reading speedups + extensions.append( Extension( "bx.seq._twobit", [ "lib/bx/seq/_twobit.pyx" ] ) ) + # Translation if character / integer strings + extensions.append( Extension( "bx._seqmapping", [ "lib/bx/_seqmapping.pyx" ] ) ) + # BGZF + extensions.append( Extension( "bx.misc.bgzf", + [ "lib/bx/misc/bgzf.pyx", "src/samtools/bgzf.c" ], + include_dirs=[ "src/samtools"], + libraries=['z'] ) ) + + + # The following extensions won't (currently) compile on windows + if platform.system() not in ( 'Microsoft', 'Windows' ): + + # Interval clustering + extensions.append( Extension( "bx.intervals.cluster", + [ "lib/bx/intervals/cluster.pyx", + "src/cluster.c"], + include_dirs=["src"] ) ) + # Position weight matrices + extensions.append( Extension( "bx.pwm._position_weight_matrix", + [ "lib/bx/pwm/_position_weight_matrix.pyx", "src/pwm_utils.c" ], + include_dirs=["src"] ) ) + + if have_numpy: + extensions.append( Extension( "bx.motif._pwm", [ "lib/bx/motif/_pwm.pyx" ], + include_dirs=[numpy.get_include()] ) ) + + # Sparse arrays with summaries organized as trees on disk + extensions.append( Extension( "bx.arrays.array_tree", [ "lib/bx/arrays/array_tree.pyx" ], include_dirs=[numpy.get_include()] ) ) + + # Reading UCSC "big binary index" files + extensions.append( Extension( "bx.bbi.bpt_file", [ "lib/bx/bbi/bpt_file.pyx" ] ) ) + extensions.append( Extension( "bx.bbi.cirtree_file", [ "lib/bx/bbi/cirtree_file.pyx" ] ) ) + extensions.append( Extension( "bx.bbi.bbi_file", [ "lib/bx/bbi/bbi_file.pyx" ], include_dirs=[numpy.get_include()] ) ) + extensions.append( Extension( "bx.bbi.bigwig_file", [ "lib/bx/bbi/bigwig_file.pyx" ], include_dirs=[numpy.get_include()] ) ) + extensions.append( Extension( "bx.bbi.bigbed_file", [ "lib/bx/bbi/bigbed_file.pyx" ], include_dirs=[numpy.get_include()] ) ) + + # Reading UCSC bed and wiggle formats + extensions.append( Extension( "bx.arrays.bed", [ "lib/bx/arrays/bed.pyx" ] ) ) + extensions.append( Extension( "bx.arrays.wiggle", [ "lib/bx/arrays/wiggle.pyx" ] ) ) + + + # CpG masking + extensions.append( Extension( "bx.align.sitemask._cpg", \ + [ "lib/bx/align/sitemask/_cpg.pyx", + "lib/bx/align/sitemask/find_cpg.c" ] ) ) + + # Counting n-grams in integer strings + extensions.append( Extension( "bx.intseq.ngramcount", [ "lib/bx/intseq/ngramcount.pyx" ] ) ) + + # Seekable access to bzip2 files + extensions.append( Extension( "bx.misc._seekbzip2", + [ "lib/bx/misc/_seekbzip2.pyx", + "src/bunzip/micro-bunzip.c" ], + include_dirs=[ "src/bunzip" ] ) ) + #samtools + if platform.system()=='Windows': + include_os = ['win32'] + os_c_files = ['win32/getopt.c'] + else: + include_os = [] + os_c_files = [] + extensions.append(Extension("csamtools", # name of extension + [ "lib/pysam/csamtools.pyx" ] +\ + [ "lib/pysam/%s" % x for x in ( + "pysam_util.c", )] +\ + glob( os.path.join( "lib/samtools", "*.pysam.c" )) +\ + os_c_files + \ + glob( os.path.join( "lib/samtools", "*", "*.pysam.c" ) ), + library_dirs=[], + include_dirs=[ "lib/samtools", "lib/pysam" ] + include_os, + libraries=[ "z", ], + language="c", + define_macros = [('_FILE_OFFSET_BITS','64'), + ('_USE_KNETFILE','')], + )) + + extensions.append(Extension("ctabix", # name of extension + [ "lib/pysam/ctabix.pyx", ] +\ + [ "lib/pysam/%s" % x for x in ( "tabix_util.c", )] +\ + os_c_files + \ + glob( os.path.join( "lib/tabix", "*.pysam.c" ) ), + library_dirs=[], + include_dirs=[ "lib/tabix", "lib/pysam" ] + include_os, + libraries=[ "z", ], + language="c", + )) + extensions.append(Extension("TabProxies", # name of extension + [ "lib/pysam/TabProxies.pyx", ] + os_c_files, + library_dirs=[], + include_dirs= include_os, + libraries=[ "z", ], + language="c", + )) + + extensions.append(Extension("cvcf", # name of extension + [ "lib/pysam/cvcf.pyx", ] + os_c_files, + library_dirs=[], + include_dirs= ["lib/tabix",] + include_os, + libraries=[ "z", ], + language="c", + )) + + + return extensions + +# ---- Monkey patches ------------------------------------------------------- + +def monkey_patch_doctest(): + # + # Doctest and coverage don't get along, so we need to create + # a monkeypatch that will replace the part of doctest that + # interferes with coverage reports. + # + # The monkeypatch is based on this zope patch: + # http://svn.zope.org/Zope3/trunk/src/zope/testing/doctest.py?rev=28679&r1=28703&r2=28705 + # + try: + import doctest + _orp = doctest._OutputRedirectingPdb + class NoseOutputRedirectingPdb(_orp): + def __init__(self, out): + self.__debugger_used = False + _orp.__init__(self, out) + + def set_trace(self): + self.__debugger_used = True + _orp.set_trace(self) + + def set_continue(self): + # Calling set_continue unconditionally would break unit test coverage + # reporting, as Bdb.set_continue calls sys.settrace(None). + if self.__debugger_used: + _orp.set_continue(self) + doctest._OutputRedirectingPdb = NoseOutputRedirectingPdb + except: + pass + +def monkey_patch_numpy(): + # Numpy pushes its tests into every importers namespace, yeccch. + try: + import numpy + numpy.test = None + except: + pass + + +if __name__ == "__main__": + monkey_patch_doctest() + if have_numpy: + monkey_patch_numpy() + main() diff --git a/code/utilities/CPAT-1.2.2/src/binBits.c b/code/utilities/CPAT-1.2.2/src/binBits.c new file mode 100755 index 0000000..a23cbcc --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/binBits.c @@ -0,0 +1,316 @@ +#include "common.h" +#include "bits.h" +#include "binBits.h" + +static Bits * ALL_ZERO = NULL; +static Bits * ALL_ONE = ( Bits * ) &"ONE"; + +struct BinBits* binBitsAlloc( int size, int granularity ) +{ + struct BinBits * bb; + AllocVar(bb); + bb->size = size; + bb->bin_size = (int) ceil( size / (float) granularity ); + bb->nbins = (int) ceil( size / (float) bb->bin_size ); + AllocArray( bb->bins, bb->nbins ); + return bb; +} + +void binBitsFree( struct BinBits *bb ) +{ + int i; + for ( i = 0; i < bb->nbins; i++ ) + { + if ( ( bb->bins[i] != ALL_ZERO ) && ( bb->bins[i] != ALL_ONE ) ) + { + bitFree( &(bb->bins[i]) ); + } + } + freeMem( bb ); +} + +#ifdef _MSC_VER + #define INLINE static __inline +#else + #define INLINE static inline +#endif + +INLINE int binBitsGetBin( struct BinBits * bb, int pos ) +{ + return pos / bb->bin_size; +} + +INLINE int binBitsGetOffset( struct BinBits * bb, int pos ) +{ + return pos % bb->bin_size; +} + +boolean binBitsReadOne( struct BinBits * bb, int pos ) +{ + int bin = binBitsGetBin( bb, pos ); + + if ( bb->bins[bin] == ALL_ZERO ) + { + return 0; + } + else if ( bb->bins[bin] == ALL_ONE ) + { + return 1; + } + else + { + return bitReadOne( bb->bins[bin], binBitsGetOffset( bb, pos ) ); + } +} + +void binBitsSetOne( struct BinBits * bb, int pos ) +{ + int bin = binBitsGetBin( bb, pos ); + int offset = binBitsGetOffset( bb, pos ); + if ( bb->bins[bin] == ALL_ONE ) + { + return; + } + if ( bb->bins[bin] == ALL_ZERO ) + { + bb->bins[bin] = bitAlloc( bb->bin_size ); + } + bitSetOne( bb->bins[bin], offset ); +} + +void binBitsClearOne( struct BinBits * bb, int pos ) +{ + int bin = binBitsGetBin( bb, pos ); + int offset = binBitsGetOffset( bb, pos ); + if ( bb->bins[bin] == ALL_ZERO ) + { + return; + } + if ( bb->bins[bin] == ALL_ONE ) + { + bb->bins[bin] = bitAlloc( bb->bin_size ); + bitSetRange( bb->bins[bin], 0, bb->bin_size ); + } + bitClearOne( bb->bins[bin], offset ); +} + +void binBitsSetRange( struct BinBits *bb, int start, int size ) +{ + int bin, offset, delta; + while ( size > 0 ) + { + bin = binBitsGetBin( bb, start ); + offset = binBitsGetOffset( bb, start ); + delta = bb->bin_size - offset; + if ( bb->bins[bin] == ALL_ZERO ) + { + bb->bins[bin] = bitAlloc( bb->bin_size ); + } + if ( delta < size ) + { + if ( bb->bins[bin] != ALL_ONE ) + { + bitSetRange( bb->bins[bin], offset, delta ); + } + size -= delta; + start += delta; + } + else + { + if ( bb->bins[bin] != ALL_ONE ) + { + bitSetRange( bb->bins[bin], offset, size ); + } + size = 0; + } + } +} + +int binBitsCountRange( struct BinBits *bb, int start, int size ) +{ + int delta; + int count = 0; + while ( size > 0 ) + { + int bin = binBitsGetBin( bb, start ); + int offset = binBitsGetOffset( bb, start ); + delta = bb->bin_size - offset; + if ( bb->bins[bin] == ALL_ZERO ) + { + if ( delta < size ) + { + size -= delta; + start += delta; + } + else + { + size = 0; + } + } + else if ( bb->bins[bin] == ALL_ONE ) + { + if ( delta < size ) + { + count += ( delta - offset ); + size -= delta; + start += delta; + } + else + { + count += ( size - offset ); + size = 0; + } + } + else if ( delta < size ) + { + count += bitCountRange( bb->bins[bin], offset, delta ); + size -= delta; + start += delta; + } + else + { + count += bitCountRange( bb->bins[bin], offset, size ); + size = 0; + } + } + return count; +} + +int binBitsFindSet( struct BinBits *bb, int start ) +{ + int ns; + int bin = binBitsGetBin( bb, start ); + int offset = binBitsGetOffset( bb, start ); + while ( bin < bb->nbins ) + { + if ( bb->bins[bin] == ALL_ONE ) + { + return bin * bb->bin_size + offset; + } + else if ( bb->bins[bin] != ALL_ZERO ) + { + ns = bitFindSet( bb->bins[bin], offset, bb->bin_size ); + if ( ns < bb->bin_size ) + { + return bin * bb->bin_size + ns; + } + } + bin += 1; + offset = 0; + } + return bb->size; +} + +int binBitsFindClear( struct BinBits *bb, int start ) +{ + int ns; + int bin = binBitsGetBin( bb, start ); + int offset = binBitsGetOffset( bb, start ); + while ( bin < bb->nbins ) + { + if ( bb->bins[bin] == ALL_ZERO ) + { + return bin*bb->bin_size + offset; + } + else if ( bb->bins[bin] != ALL_ONE ) + { + ns = bitFindClear( bb->bins[bin], offset, bb->bin_size ); + if ( ns < bb->bin_size ) + { + return bin*bb->bin_size + ns; + } + } + bin += 1; + offset = 0; + } + return bb->size; +} + +void binBitsAnd( struct BinBits *bb1, struct BinBits *bb2 ) +{ + int i; + assert( bb1->bin_size == bb2->bin_size && bb1->nbins == bb2->nbins && bb1->size == bb2->size ); + + for ( i = 0; i < bb1->nbins; i++ ) + { + if ( bb1->bins[i] == ALL_ZERO ) + { + // Do nothing + } + else if ( bb2->bins[i] == ALL_ZERO ) + { + if ( bb1->bins[i] != ALL_ONE ) + { + bitFree( &bb1->bins[i] ); + } + bb1->bins[i] = ALL_ZERO; + } + else if ( bb2->bins[i] == ALL_ONE ) + { + // Do nothing + } + else if ( bb1->bins[i] == ALL_ONE ) + { + bb1->bins[i] = bitClone( bb2->bins[i], bb1->bin_size ); + } + else + { + bitAnd( bb1->bins[i], bb2->bins[i], bb1->bin_size ); + } + } +} + +void binBitsOr( struct BinBits *bb1, struct BinBits *bb2 ) +{ + int i; + assert( bb1->bin_size == bb2->bin_size && bb1->nbins == bb2->nbins && bb1->size == bb2->size ); + + for ( i = 0; i < bb1->nbins; i++ ) + { + if ( bb1->bins[i] == ALL_ONE ) + { + // Do nothing + } + else if ( bb2->bins[i] == ALL_ONE ) + { + if ( bb1->bins[i] != ALL_ZERO ) + { + bitFree( &bb1->bins[i] ); + } + bb1->bins[i] = ALL_ONE; + } + else if ( bb2->bins[i] == ALL_ZERO ) + { + // Do nothing + } + else if ( bb1->bins[i] == ALL_ZERO ) + { + bb1->bins[i] = bitClone( bb2->bins[i], bb1->bin_size ); + } + else + { + bitOr( bb1->bins[i], bb2->bins[i], bb1->bin_size ); + } + } +} + +void binBitsNot( struct BinBits *bb ) +{ + int i; + + for ( i = 0; i < bb->nbins; i++ ) + { + if ( bb->bins[i] == ALL_ONE ) + { + bb->bins[i] = ALL_ZERO; + } + else if ( bb->bins[i] == ALL_ZERO ) + { + bb->bins[i] = ALL_ONE; + } + else + { + bitNot( bb->bins[i], bb->bin_size ); + } + } +} diff --git a/code/utilities/CPAT-1.2.2/src/binBits.h b/code/utilities/CPAT-1.2.2/src/binBits.h new file mode 100755 index 0000000..4db89f3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/binBits.h @@ -0,0 +1,28 @@ +#ifndef BINBITS_H +#define BINBITS_H + +#include "common.h" +#include "bits.h" + +struct BinBits +{ + int size; + int bin_size; + int nbins; + Bits ** bins; +}; + +struct BinBits* binBitsAlloc( int size, int granularity ); +void binBitsFree( struct BinBits *bb ); +boolean binBitsReadOne( struct BinBits * bb, int pos ); +void binBitsSetOne( struct BinBits * bb, int pos ); +void binBitsClearOne( struct BinBits * bb, int pos ); +void binBitsSetRange( struct BinBits *bb, int start, int size ); +int binBitsCountRange( struct BinBits *bb, int start, int size ); +int binBitsFindSet( struct BinBits *bb, int start ); +int binBitsFindClear( struct BinBits *bb, int start ); +void binBitsAnd( struct BinBits *bb1, struct BinBits *bb2 ); +void binBitsOr( struct BinBits *bb1, struct BinBits *bb2 ); +void binBitsNot( struct BinBits *bb ); + +#endif diff --git a/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.c b/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.c new file mode 100755 index 0000000..d3ceaca --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.c @@ -0,0 +1,705 @@ +/* vi: set sw=4 ts=4: */ +/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net). + + Based on bzip2 decompression code by Julian R Seward (jseward@acm.org), + which also acknowledges contributions by Mike Burrows, David Wheeler, + Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten, + Robert Sedgewick, and Jon L. Bentley. + + This code is licensed under the LGPLv2: + LGPL (http://www.gnu.org/copyleft/lgpl.html +*/ + +/* + Size and speed optimizations by Manuel Novoa III (mjn3@codepoet.org). + + More efficient reading of huffman codes, a streamlined read_bunzip() + function, and various other tweaks. In (limited) tests, approximately + 20% faster than bzcat on x86 and about 10% faster on arm. + + Note that about 2/3 of the time is spent in read_unzip() reversing + the Burrows-Wheeler transformation. Much of that time is delay + resulting from cache misses. + + I would ask that anyone benefiting from this work, especially those + using it in commercial products, consider making a donation to my local + non-profit hospice organization (see www.hospiceacadiana.com) in the + name of the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003. + + Manuel + */ + +#include +#include +#include +#include +#include +#include + +/* Constants for huffman coding */ +#define MAX_GROUPS 6 +#define GROUP_SIZE 50 /* 64 would have been more efficient */ +#define MAX_HUFCODE_BITS 20 /* Longest huffman code allowed */ +#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ +#define SYMBOL_RUNA 0 +#define SYMBOL_RUNB 1 + +/* Status return values */ +#define RETVAL_OK 0 +#define RETVAL_LAST_BLOCK (-1) +#define RETVAL_NOT_BZIP_DATA (-2) +#define RETVAL_UNEXPECTED_INPUT_EOF (-3) +#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4) +#define RETVAL_DATA_ERROR (-5) +#define RETVAL_OUT_OF_MEMORY (-6) +#define RETVAL_OBSOLETE_INPUT (-7) + +#define RETVAL_END_OF_BLOCK (-8) +#define RETVAL_STOPCHAR (-9) +#define RETVAL_BUFFER_FULL (-10) + +/* Other housekeeping constants */ +#define IOBUF_SIZE 4096 + +/* This is what we know about each huffman coding group */ +struct group_data { + /* We have an extra slot at the end of limit[] for a sentinal value. */ + int limit[MAX_HUFCODE_BITS+1],base[MAX_HUFCODE_BITS],permute[MAX_SYMBOLS]; + int minLen, maxLen; +}; + +/* Structure holding all the housekeeping data, including IO buffers and + memory that persists between calls to bunzip */ +typedef struct { + /* State for interrupting output loop */ + int writeCopies,writePos,writeRunCountdown,writeCount,writeCurrent; + /* I/O tracking data (file handles, buffers, positions, etc.) */ + int in_fd,out_fd,inbufCount,inbufPos /*,outbufPos*/; + unsigned char *inbuf /*,*outbuf*/; + unsigned int inbufBitCount, inbufBits; + /* The CRC values stored in the block header and calculated from the data */ + unsigned int crc32Table[256],headerCRC, totalCRC, writeCRC; + /* Intermediate buffer and its size (in bytes) */ + unsigned int *dbuf, dbufSize; + /* These things are a bit too big to go on the stack */ + unsigned char selectors[32768]; /* nSelectors=15 bits */ + struct group_data groups[MAX_GROUPS]; /* huffman coding tables */ + /* For I/O error handling */ + jmp_buf jmpbuf; +} bunzip_data; + +/* Return the next nnn bits of input. All reads from the compressed input + are done through this function. All reads are big endian */ +unsigned int get_bits(bunzip_data *bd, char bits_wanted) +{ + unsigned int bits=0; + + /* If we need to get more data from the byte buffer, do so. (Loop getting + one byte at a time to enforce endianness and avoid unaligned access.) */ + while (bd->inbufBitCountinbufPos==bd->inbufCount) { + if((bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)) <= 0) + longjmp(bd->jmpbuf,RETVAL_UNEXPECTED_INPUT_EOF); + bd->inbufPos=0; + } + /* Avoid 32-bit overflow (dump bit buffer to top of output) */ + if(bd->inbufBitCount>=24) { + bits=bd->inbufBits&((1<inbufBitCount)-1); + bits_wanted-=bd->inbufBitCount; + bits<<=bits_wanted; + bd->inbufBitCount=0; + } + /* Grab next 8 bits of input from buffer. */ + bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++]; + bd->inbufBitCount+=8; + } + /* Calculate result */ + bd->inbufBitCount-=bits_wanted; + bits|=(bd->inbufBits>>bd->inbufBitCount)&((1<dbuf; + dbufSize=bd->dbufSize; + selectors=bd->selectors; + /* Reset longjmp I/O error handling */ + i=setjmp(bd->jmpbuf); + if(i) return i; + /* Read in header signature and CRC, then validate signature. + (last block signature means CRC is for whole file, return now) */ + i = get_bits(bd,24); + j = get_bits(bd,24); + bd->headerCRC=get_bits(bd,32); + if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK; + if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA; + /* We can add support for blockRandomised if anybody complains. There was + some code for this in busybox 1.0.0-pre3, but nobody ever noticed that + it didn't actually work. */ + if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT; + if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR; + /* mapping table: if some byte values are never used (encoding things + like ascii text), the compression code removes the gaps to have fewer + symbols to deal with, and writes a sparse bitfield indicating which + values were present. We make a translation table to convert the symbols + back to the corresponding bytes. */ + t=get_bits(bd, 16); + symTotal=0; + for (i=0;i<16;i++) { + if(t&(1<<(15-i))) { + k=get_bits(bd,16); + for(j=0;j<16;j++) + if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j; + } + } + /* How many different huffman coding groups does this block use? */ + groupCount=get_bits(bd,3); + if (groupCount<2 || groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR; + /* nSelectors: Every GROUP_SIZE many symbols we select a new huffman coding + group. Read in the group selector list, which is stored as MTF encoded + bit runs. (MTF=Move To Front, as each value is used it's moved to the + start of the list.) */ + if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR; + for(i=0; i=groupCount) return RETVAL_DATA_ERROR; + /* Decode MTF to get the next selector */ + uc = mtfSymbol[j]; + for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1]; + mtfSymbol[0]=selectors[i]=uc; + } + /* Read the huffman coding tables for each group, which code for symTotal + literal symbols, plus two run symbols (RUNA, RUNB) */ + symCount=symTotal+2; + for (j=0; j (MAX_HUFCODE_BITS-1)) + return RETVAL_DATA_ERROR; + /* If first bit is 0, stop. Else second bit indicates whether + to increment or decrement the value. Optimization: grab 2 + bits and unget the second if the first was 0. */ + k = get_bits(bd,2); + if (k < 2) { + bd->inbufBitCount++; + break; + } + /* Add one if second bit 1, else subtract 1. Avoids if/else */ + t+=(((k+1)&2)-1); + } + /* Correct for the initial -1, to get the final symbol length */ + length[i]=t+1; + } + /* Find largest and smallest lengths in this group */ + minLen=maxLen=length[0]; + for(i = 1; i < symCount; i++) { + if(length[i] > maxLen) maxLen = length[i]; + else if(length[i] < minLen) minLen = length[i]; + } + /* Calculate permute[], base[], and limit[] tables from length[]. + * + * permute[] is the lookup table for converting huffman coded symbols + * into decoded symbols. base[] is the amount to subtract from the + * value of a huffman symbol of a given length when using permute[]. + * + * limit[] indicates the largest numerical value a symbol with a given + * number of bits can have. This is how the huffman codes can vary in + * length: each code with a value>limit[length] needs another bit. + */ + hufGroup=bd->groups+j; + hufGroup->minLen = minLen; + hufGroup->maxLen = maxLen; + /* Note that minLen can't be smaller than 1, so we adjust the base + and limit array pointers so we're not always wasting the first + entry. We do this again when using them (during symbol decoding).*/ + base=hufGroup->base-1; + limit=hufGroup->limit-1; + /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */ + pp=0; + for(i=minLen;i<=maxLen;i++) { + temp[i]=limit[i]=0; + for(t=0;tpermute[pp++] = t; + } + /* Count symbols coded for at each bit length */ + for (i=0;ilimit[length] comparison. */ + limit[i]= (pp << (maxLen - i)) - 1; + pp<<=1; + base[i+1]=pp-(t+=temp[i]); + } + limit[maxLen+1] = INT_MAX; /* Sentinal value for reading next sym. */ + limit[maxLen]=pp+temp[maxLen]-1; + base[minLen]=0; + } + /* We've finished reading and digesting the block header. Now read this + block's huffman coded symbols from the file and undo the huffman coding + and run length encoding, saving the result into dbuf[dbufCount++]=uc */ + + /* Initialize symbol occurrence counters and symbol Move To Front table */ + for(i=0;i<256;i++) { + byteCount[i] = 0; + mtfSymbol[i]=(unsigned char)i; + } + /* Loop through compressed symbols. */ + runPos=dbufCount=symCount=selector=0; + for(;;) { + /* Determine which huffman coding group to use. */ + if(!(symCount--)) { + symCount=GROUP_SIZE-1; + if(selector>=nSelectors) return RETVAL_DATA_ERROR; + hufGroup=bd->groups+selectors[selector++]; + base=hufGroup->base-1; + limit=hufGroup->limit-1; + } + /* Read next huffman-coded symbol. */ + /* Note: It is far cheaper to read maxLen bits and back up than it is + to read minLen bits and then an additional bit at a time, testing + as we go. Because there is a trailing last block (with file CRC), + there is no danger of the overread causing an unexpected EOF for a + valid compressed file. As a further optimization, we do the read + inline (falling back to a call to get_bits if the buffer runs + dry). The following (up to got_huff_bits:) is equivalent to + j=get_bits(bd,hufGroup->maxLen); + */ + while (bd->inbufBitCountmaxLen) { + if(bd->inbufPos==bd->inbufCount) { + j = get_bits(bd,hufGroup->maxLen); + goto got_huff_bits; + } + bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++]; + bd->inbufBitCount+=8; + }; + bd->inbufBitCount-=hufGroup->maxLen; + j = (bd->inbufBits>>bd->inbufBitCount)&((1<maxLen)-1); +got_huff_bits: + /* Figure how how many bits are in next symbol and unget extras */ + i=hufGroup->minLen; + while(j>limit[i]) ++i; + bd->inbufBitCount += (hufGroup->maxLen - i); + /* Huffman decode value to get nextSym (with bounds checking) */ + if ((i > hufGroup->maxLen) + || (((unsigned)(j=(j>>(hufGroup->maxLen-i))-base[i])) + >= MAX_SYMBOLS)) + return RETVAL_DATA_ERROR; + nextSym = hufGroup->permute[j]; + /* We have now decoded the symbol, which indicates either a new literal + byte, or a repeated run of the most recent literal byte. First, + check if nextSym indicates a repeated run, and if so loop collecting + how many times to repeat the last literal. */ + if (((unsigned)nextSym) <= SYMBOL_RUNB) { /* RUNA or RUNB */ + /* If this is the start of a new run, zero out counter */ + if(!runPos) { + runPos = 1; + t = 0; + } + /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at + each bit position, add 1 or 2 instead. For example, + 1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2. + You can make any bit pattern that way using 1 less symbol than + the basic or 0/1 method (except all bits 0, which would use no + symbols, but a run of length 0 doesn't mean anything in this + context). Thus space is saved. */ + t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */ + runPos <<= 1; + continue; + } + /* When we hit the first non-run symbol after a run, we now know + how many times to repeat the last literal, so append that many + copies to our buffer of decoded symbols (dbuf) now. (The last + literal used is the one at the head of the mtfSymbol array.) */ + if(runPos) { + runPos=0; + if(dbufCount+t>=dbufSize) return RETVAL_DATA_ERROR; + + uc = symToByte[mtfSymbol[0]]; + byteCount[uc] += t; + while(t--) dbuf[dbufCount++]=uc; + } + /* Is this the terminating symbol? */ + if(nextSym>symTotal) break; + /* At this point, nextSym indicates a new literal character. Subtract + one to get the position in the MTF array at which this literal is + currently to be found. (Note that the result can't be -1 or 0, + because 0 and 1 are RUNA and RUNB. But another instance of the + first symbol in the mtf array, position 0, would have been handled + as part of a run above. Therefore 1 unused mtf position minus + 2 non-literal nextSym values equals -1.) */ + if(dbufCount>=dbufSize) return RETVAL_DATA_ERROR; + i = nextSym - 1; + uc = mtfSymbol[i]; + /* Adjust the MTF array. Since we typically expect to move only a + * small number of symbols, and are bound by 256 in any case, using + * memmove here would typically be bigger and slower due to function + * call overhead and other assorted setup costs. */ + do { + mtfSymbol[i] = mtfSymbol[i-1]; + } while (--i); + mtfSymbol[0] = uc; + uc=symToByte[uc]; + /* We have our literal byte. Save it into dbuf. */ + byteCount[uc]++; + dbuf[dbufCount++] = (unsigned int)uc; + } + /* At this point, we've read all the huffman-coded symbols (and repeated + runs) for this block from the input stream, and decoded them into the + intermediate buffer. There are dbufCount many decoded bytes in dbuf[]. + Now undo the Burrows-Wheeler transform on dbuf. + See http://dogma.net/markn/articles/bwt/bwt.htm + */ + /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ + j=0; + for(i=0;i<256;i++) { + k=j+byteCount[i]; + byteCount[i] = j; + j=k; + } + /* Figure out what order dbuf would be in if we sorted it. */ + for (i=0;i=dbufCount) return RETVAL_DATA_ERROR; + bd->writePos=dbuf[origPtr]; + bd->writeCurrent=(unsigned char)(bd->writePos&0xff); + bd->writePos>>=8; + bd->writeRunCountdown=5; + } + bd->writeCount=dbufCount; + + return RETVAL_OK; +} + +/* Undo burrows-wheeler transform on intermediate buffer to produce output. + If start_bunzip was initialized with out_fd=-1, then up to len bytes of + data are written to outbuf. Return value is number of bytes written or + error (all errors are negative numbers). If out_fd!=-1, outbuf and len + are ignored, data is written to out_fd and return is RETVAL_OK or error. +*/ + +int read_bunzip(bunzip_data *bd, char *outbuf, int len) +{ + const unsigned int *dbuf; + int pos,current,previous,gotcount; + + /* If last read was short due to end of file, return last block now */ + /* if(bd->writeCount<0) return bd->writeCount; */ + + /* james@bx.psu.edu: writeCount goes to -1 when the buffer is fully + decoded, which results in this returning RETVAL_LAST_BLOCK, also + equal to -1... Confusing, I'm returning 0 here to indicate no + bytes written into the buffer */ + if(bd->writeCount<0) return 0; + + gotcount = 0; + dbuf=bd->dbuf; + pos=bd->writePos; + current=bd->writeCurrent; + + /* We will always have pending decoded data to write into the output + buffer unless this is the very first call (in which case we haven't + huffman-decoded a block into the intermediate buffer yet). */ + + if (bd->writeCopies) { + /* Inside the loop, writeCopies means extra copies (beyond 1) */ + --bd->writeCopies; + /* Loop outputting bytes */ + for(;;) { + /* Write next byte into output buffer, updating CRC */ + /* If the output buffer is full, snapshot state and return */ + if(gotcount >= len) { + bd->writePos=pos; + bd->writeCurrent=current; + bd->writeCopies++; + return len; + } + outbuf[gotcount++] = current; + bd->writeCRC=(((bd->writeCRC)<<8) + ^bd->crc32Table[((bd->writeCRC)>>24)^current]); + /* Loop now if we're outputting multiple copies of this byte */ + if (bd->writeCopies) { + --bd->writeCopies; + continue; + } +decode_next_byte: + if (!bd->writeCount--) break; + /* Follow sequence vector to undo Burrows-Wheeler transform */ + previous=current; + pos=dbuf[pos]; + current=pos&0xff; + pos>>=8; + /* After 3 consecutive copies of the same byte, the 4th is a repeat + count. We count down from 4 instead + * of counting up because testing for non-zero is faster */ + if(--bd->writeRunCountdown) { + if(current!=previous) bd->writeRunCountdown=4; + } else { + /* We have a repeated run, this byte indicates the count */ + bd->writeCopies=current; + current=previous; + bd->writeRunCountdown=5; + /* Sometimes there are just 3 bytes (run length 0) */ + if(!bd->writeCopies) goto decode_next_byte; + /* Subtract the 1 copy we'd output anyway to get extras */ + --bd->writeCopies; + } + } + /* Decompression of this block completed successfully */ + bd->writeCRC=~bd->writeCRC; + bd->totalCRC=((bd->totalCRC<<1) | (bd->totalCRC>>31)) ^ bd->writeCRC; + /* If this block had a CRC error, force file level CRC error. */ + if(bd->writeCRC!=bd->headerCRC) { + // fprintf( stderr, "CRC ERROR\n" ); fflush( stderr ); + bd->totalCRC=bd->headerCRC+1; + return RETVAL_LAST_BLOCK; + } + /* james@bx.psu.edu -- rather than falling through we return here */ + return gotcount; + } + + goto decode_next_byte; +} + +/** + * Same as read_bunzip, but will stop if it encounters `stop_char`. + */ +int read_bunzip_to_char(bunzip_data *bd, char *outbuf, int len, int* gotcount_out, char stopchar ) +{ + const unsigned int *dbuf; + int pos,current,previous,gotcount; + + /* If last read was short due to end of file, return last block now */ + /* if(bd->writeCount<0) return bd->writeCount; */ + + /* james@bx.psu.edu: writeCount goes to -1 when the buffer is fully + decoded, which results in this returning RETVAL_LAST_BLOCK, also + equal to -1... Confusing, I'm returning 0 here to indicate no + bytes written into the buffer */ + if(bd->writeCount<0) return RETVAL_END_OF_BLOCK; + + gotcount = 0; + dbuf=bd->dbuf; + pos=bd->writePos; + current=bd->writeCurrent; + + /* We will always have pending decoded data to write into the output + buffer unless this is the very first call (in which case we haven't + huffman-decoded a block into the intermediate buffer yet). */ + + if (bd->writeCopies) { + /* Inside the loop, writeCopies means extra copies (beyond 1) */ + --bd->writeCopies; + /* Loop outputting bytes */ + for(;;) { + /* Write next byte into output buffer, updating CRC */ + /* If the output buffer is full, snapshot state and return */ + if(gotcount >= len) { + bd->writePos=pos; + bd->writeCurrent=current; + bd->writeCopies++; + *gotcount_out = gotcount; + return RETVAL_BUFFER_FULL; + } + /* Also stop if we hit stop char (this could be faster) */ + if( gotcount && outbuf[gotcount-1] == stopchar ) { + bd->writePos=pos; + bd->writeCurrent=current; + bd->writeCopies++; + *gotcount_out = gotcount; + return RETVAL_STOPCHAR; + } + outbuf[gotcount++] = current; + bd->writeCRC=(((bd->writeCRC)<<8) + ^bd->crc32Table[((bd->writeCRC)>>24)^current]); + /* Loop now if we're outputting multiple copies of this byte */ + if (bd->writeCopies) { + --bd->writeCopies; + continue; + } +decode_next_byte: + if (!bd->writeCount--) break; + /* Follow sequence vector to undo Burrows-Wheeler transform */ + previous=current; + pos=dbuf[pos]; + current=pos&0xff; + pos>>=8; + /* After 3 consecutive copies of the same byte, the 4th is a repeat + count. We count down from 4 instead + * of counting up because testing for non-zero is faster */ + if(--bd->writeRunCountdown) { + if(current!=previous) bd->writeRunCountdown=4; + } else { + /* We have a repeated run, this byte indicates the count */ + bd->writeCopies=current; + current=previous; + bd->writeRunCountdown=5; + /* Sometimes there are just 3 bytes (run length 0) */ + if(!bd->writeCopies) goto decode_next_byte; + /* Subtract the 1 copy we'd output anyway to get extras */ + --bd->writeCopies; + } + } + /* Decompression of this block completed successfully */ + bd->writeCRC=~bd->writeCRC; + bd->totalCRC=((bd->totalCRC<<1) | (bd->totalCRC>>31)) ^ bd->writeCRC; + /* If this block had a CRC error, force file level CRC error. */ + if(bd->writeCRC!=bd->headerCRC) { + // fprintf( stderr, "CRC ERROR\n" ); fflush( stderr ); + bd->totalCRC=bd->headerCRC+1; + return RETVAL_LAST_BLOCK; + } + /* james@bx.psu.edu -- rather than falling through we return here */ + *gotcount_out = gotcount; + return RETVAL_END_OF_BLOCK; + } + + goto decode_next_byte; +} + +int init_block( bunzip_data *bd ) +{ + int status; + /* Refill the intermediate buffer by huffman-decoding next block of input */ + /* (previous is just a convenient unused temp variable here) */ + status=get_next_block(bd); + if(status) { + bd->writeCount=status; + return status; + } + bd->writeCRC=0xffffffffUL; + return RETVAL_OK; +} + +/* Allocate the structure, read file header. If in_fd==-1, inbuf must contain + a complete bunzip file (len bytes long). If in_fd!=-1, inbuf and len are + ignored, and data is read from file handle into temporary buffer. */ +int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len) +{ + bunzip_data *bd; + unsigned int i,j,c; + const unsigned int BZh0=(((unsigned int)'B')<<24)+(((unsigned int)'Z')<<16) + +(((unsigned int)'h')<<8)+(unsigned int)'0'; + + /* Figure out how much data to allocate */ + i=sizeof(bunzip_data); + if(in_fd!=-1) i+=IOBUF_SIZE; + /* Allocate bunzip_data. Most fields initialize to zero. */ + if(!(bd=*bdp=malloc(i))) return RETVAL_OUT_OF_MEMORY; + memset(bd,0,sizeof(bunzip_data)); + /* Setup input buffer */ + if(-1==(bd->in_fd=in_fd)) { + bd->inbuf=inbuf; + bd->inbufCount=len; + } else bd->inbuf=(unsigned char *)(bd+1); + /* Init the CRC32 table (big endian) */ + for(i=0;i<256;i++) { + c=i<<24; + for(j=8;j;j--) + c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1); + bd->crc32Table[i]=c; + } + /* Setup for I/O error handling via longjmp */ + i=setjmp(bd->jmpbuf); + if(i) return i; + + /* Ensure that file starts with "BZh['1'-'9']." */ + i = get_bits(bd,32); + if (((unsigned int)(i-BZh0-1)) >= 9) return RETVAL_NOT_BZIP_DATA; + + /* Fourth byte (ascii '1'-'9'), indicates block size in units of 100k of + uncompressed data. Allocate intermediate buffer for block. */ + bd->dbufSize=100000*(i-BZh0); + + if(!(bd->dbuf=malloc(bd->dbufSize * sizeof(int)))) + return RETVAL_OUT_OF_MEMORY; + return RETVAL_OK; +} + +/* Example usage: decompress src_fd to dst_fd. (Stops at end of bzip data, + not end of file.) */ +extern int uncompressStream(int src_fd, int dst_fd) +{ + char *outbuf; + bunzip_data *bd; + int i; + + if(!(outbuf=malloc(IOBUF_SIZE))) return RETVAL_OUT_OF_MEMORY; + if(!(i=start_bunzip(&bd,src_fd,0,0))) { + for(;;) { + if (((i=init_block(bd)) < 0)) break; + // fprintf( stderr, "init: %d\n", i ); + for(;;) + { + if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break; + // fprintf( stderr, "read: %d\n", i ); + if(i!=write(dst_fd,outbuf,i)) { + i=RETVAL_UNEXPECTED_OUTPUT_EOF; + break; + } + } + } + } + /* Check CRC and release memory */ + if(i==RETVAL_LAST_BLOCK && bd->headerCRC==bd->totalCRC) i=RETVAL_OK; + if(bd->dbuf) free(bd->dbuf); + free(bd); + free(outbuf); + return i; +} + +#ifdef MICRO_BUNZIP_MAIN + +static char * const bunzip_errors[]={NULL,"Bad file checksum","Not bzip data", + "Unexpected input EOF","Unexpected output EOF","Data error", + "Out of memory","Obsolete (pre 0.9.5) bzip format not supported."}; + +/* Dumb little test thing, decompress stdin to stdout */ +int main(int argc, char *argv[]) +{ + int i=uncompressStream(0,1); + char c; + + if(i) fprintf(stderr,"%d: %s\n", i, bunzip_errors[-i]); + else if(read(0,&c,1)) fprintf(stderr,"Trailing garbage ignored\n"); + return -i; +} + +#endif \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.h b/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.h new file mode 100755 index 0000000..317992c --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/bunzip/micro-bunzip.h @@ -0,0 +1,77 @@ +#ifndef __MICRO_BUNZIP_H__ +#define __MICRO_BUNZIP_H__ + +/* ---- Duplicated from micro-bzip.c -------------------------------------- */ + +#include +#include +#include +#include +#include +#include + +/* Constants for huffman coding */ +#define MAX_GROUPS 6 +#define GROUP_SIZE 50 /* 64 would have been more efficient */ +#define MAX_HUFCODE_BITS 20 /* Longest huffman code allowed */ +#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ +#define SYMBOL_RUNA 0 +#define SYMBOL_RUNB 1 + +/* Status return values */ +#define RETVAL_OK 0 +#define RETVAL_LAST_BLOCK (-1) +#define RETVAL_NOT_BZIP_DATA (-2) +#define RETVAL_UNEXPECTED_INPUT_EOF (-3) +#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4) +#define RETVAL_DATA_ERROR (-5) +#define RETVAL_OUT_OF_MEMORY (-6) +#define RETVAL_OBSOLETE_INPUT (-7) + +#define RETVAL_END_OF_BLOCK (-8) +#define RETVAL_STOPCHAR (-9) +#define RETVAL_BUFFER_FULL (-10) + +/* Other housekeeping constants */ +#define IOBUF_SIZE 4096 + +/* This is what we know about each huffman coding group */ +struct group_data { + /* We have an extra slot at the end of limit[] for a sentinal value. */ + int limit[MAX_HUFCODE_BITS+1],base[MAX_HUFCODE_BITS],permute[MAX_SYMBOLS]; + int minLen, maxLen; +}; + +/* Structure holding all the housekeeping data, including IO buffers and + memory that persists between calls to bunzip */ +typedef struct { + /* State for interrupting output loop */ + int writeCopies,writePos,writeRunCountdown,writeCount,writeCurrent; + /* I/O tracking data (file handles, buffers, positions, etc.) */ + int in_fd,out_fd,inbufCount,inbufPos /*,outbufPos*/; + unsigned char *inbuf /*,*outbuf*/; + unsigned int inbufBitCount, inbufBits; + /* The CRC values stored in the block header and calculated from the data */ + unsigned int crc32Table[256],headerCRC, totalCRC, writeCRC; + /* Intermediate buffer and its size (in bytes) */ + unsigned int *dbuf, dbufSize; + /* These things are a bit too big to go on the stack */ + unsigned char selectors[32768]; /* nSelectors=15 bits */ + struct group_data groups[MAX_GROUPS]; /* huffman coding tables */ + /* For I/O error handling */ + jmp_buf jmpbuf; +} bunzip_data; + +static char * const bunzip_errors[]={NULL,"Bad file checksum","Not bzip data", + "Unexpected input EOF","Unexpected output EOF","Data error", + "Out of memory","Obsolete (pre 0.9.5) bzip format not supported."}; + +/* ---- Forward declarations for micro-bzip.c ---------------------------- */ + +unsigned int get_bits(bunzip_data *bd, char bits_wanted); +int get_next_block( bunzip_data *bd ); +int read_bunzip(bunzip_data *bd, char *outbuf, int len); +int start_bunzip(bunzip_data **bdp, int in_fd, char *inbuf, int len); +int read_bunzip_to_char(bunzip_data *bd, char *outbuf, int len, int* gotcount_out, char stopchar ); + +#endif \ No newline at end of file diff --git a/code/utilities/CPAT-1.2.2/src/cluster.c b/code/utilities/CPAT-1.2.2/src/cluster.c new file mode 100755 index 0000000..0887d85 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/cluster.c @@ -0,0 +1,267 @@ +/* + Kanwei Li, 2009 + Inspired by previous ClusterTree + + This clustering algorithm uses a binary tree structure. Nodes correspond to + non-overlapping intervals, where overlapping means that the distance between + two intervals is less or equal to max_dist, which is the max separation. + + The tree self-balances using rotations based on the binomial sequence. Merges + among nodes are performed whenever a node is changed/added that will cause other + nodes to form a new cluster. +*/ +#include +#include +#include +#include "cluster.h" + +#define ALLOC(pt) (malloc(sizeof(pt))) + +static int min(int a, int b) { + if( a < b ) + return a; + else + return b; +} + +static int max(int a, int b) { + if( a > b ) + return a; + else + return b; +} + +/* Create new tree with given max_dist (max distance between intervals to be + considered a cluster), and min_intervals, the minimum number of intervals + needed for a cluster to be considered significant */ +clustertree* create_clustertree(int max_dist, int min_intervals) { + clustertree *tree = ALLOC(clustertree); + tree->max_dist = max_dist; + tree->min_intervals = min_intervals; + tree->root = NULL; + return tree; +} + +static interval* create_interval(int start, int end, int id) { + interval *ival = ALLOC(interval); + + ival->start = start; + ival->end = end; + ival->id = id; + ival->next = NULL; + return ival; +} + +static clusternode* create_node(int start, int end, int id) { + clusternode *new_node = ALLOC(clusternode); + + new_node->start = start; + new_node->end = end; + new_node->interval_head = create_interval(start, end, id); + new_node->interval_tail = new_node->interval_head; + new_node->num_ivals = 1; + new_node->left = NULL; + new_node->right = NULL; + + double uniform = ((double)rand()) / (RAND_MAX); + if (uniform == 1.0) + uniform = 0; + new_node->priority = (int)ceil( (-1.0 / log(.5)) * log( -1.0 / (uniform - 1))); + + return new_node; +} + +static void recursively_free_intervals(interval *ival) { + interval *next; + if(ival) { + next = ival->next; + free(ival); + recursively_free_intervals(next); + } +} + +static void recursively_free_nodes(clusternode *node) { + if(node) { + recursively_free_nodes(node->left); + recursively_free_nodes(node->right); + recursively_free_intervals(node->interval_head); + free(node); + } +} + +void free_tree(clustertree *tree) { + recursively_free_nodes(tree->root); + free(tree); +} + +void cluster_rotateright(clusternode **node) { + clusternode* root = (*node)->left; + (*node)->left = (*node)->left->right; + root->right = (*node); + *node = root; +} + +void cluster_rotateleft(clusternode **node) { + clusternode* root = (*node)->right; + (*node)->right = (*node)->right->left; + root->left = (*node); + *node = root; +} + +/* Go down the tree and merge nodes if necessary */ +void cluster_fixup(clustertree *tree, clusternode **ln, clusternode **rn) { + clusternode* local = *ln; + clusternode* root = *rn; + int maxstart = max(root->start, local->start); + int maxend = max(local->end, root->end); + int minstart = min(root->start, local->start); + int minend = min(root->end, local->end); + + if( maxstart - minend <= tree->max_dist ) { + /* Have to merge this node and children */ + root->start = minstart; + root->end = maxend; + root->interval_tail->next = local->interval_head; + root->interval_tail = local->interval_tail; + root->num_ivals += local->num_ivals; + if( local->right) cluster_fixup(tree, &(local->right), rn); + if( local->left) cluster_fixup(tree, &(local->left), rn); + if((local->right == NULL) && (local->left == NULL)) { + free(local); + *ln = NULL; + } else if(local->right) { + *ln = local->right; + free(local); + } else if (local->left) { + *ln = local->left; + free(local); + } + return; + } + // Even if we miss, we still have to check children + if(local->left) { + cluster_fixup(tree, &(local->left), rn); + } + if(local->right) { + cluster_fixup(tree, &(local->right), rn); + } +} + +/* Pyrex "getregions" implements this. Only used for C debugging */ +void clustereach(clustertree *tree, clusternode *node) { + interval* ival; + if (node == NULL) { + exit(1); /* Shouldn't happen */ + } + if (node->left != NULL) { + clustereach(tree, node->left); + } + printf("Node: %d\t%d\n", node->start, node->end); + ival = node->interval_head; + while(ival) { + printf("\tInterval %d: %d\t%d\n", ival->id, ival->start, ival->end); + ival = ival->next; + } + + if (node->right != NULL) { + clustereach(tree, node->right); + } +} + +void clusteritr_recursive(clustertree *tree, clusternode *node, treeitr* *itr) { + treeitr *newitr; + + if (node == NULL) { + return; + } + if (node->right != NULL) { + clusteritr_recursive(tree, node->right, itr); + } + if (node->num_ivals >= tree->min_intervals) { + newitr = ALLOC(treeitr); + newitr->next = *itr; + newitr->node = node; + *itr = newitr; + } + if (node->left != NULL) { + clusteritr_recursive(tree, node->left, itr); + } +} + +/* Create an infix iterator */ +treeitr* clusteritr(clustertree *tree) { + treeitr *itr = NULL; + + clusteritr_recursive(tree, tree->root, &itr); + if (itr != NULL) { + return itr; + } + return NULL; +} + +/* Free iterator (tail recursive) */ +void freeclusteritr(treeitr *itr) { + treeitr *next; + if (itr == NULL) { + return; + } + + next = itr->next; + free(itr); + freeclusteritr(next); +} + +/* Insert based on the start position of intervals */ +clusternode* clusternode_insert(clustertree *tree, clusternode *node, int start, int end, int id) { + int oldstart; + int oldend; + interval* ival; + + // printf("Inserting %d %d %d\n", start, end, id); + if (node == NULL) { + node = create_node(start, end, id); + + } else if ( (start - tree->max_dist) > node->end ) { /* We're to the right of this cluster */ + node->right = clusternode_insert(tree, node->right, start, end, id); + if (node->priority < node->right->priority) cluster_rotateleft(&node); + + } else if ( (end + tree->max_dist) < node->start) { /* We're to the left of this cluster */ + node->left = clusternode_insert(tree, node->left, start, end, id); + if (node->priority < node->left->priority) cluster_rotateright(&node); + + } else { /* We're in the range of this cluster */ + /* Update the start and end to match to new values */ + oldstart = node->start; + oldend = node->end; + node->start = min(start, node->start); + node->end = max(end, node->end); + ival = create_interval(start, end, id); + ival->next = node->interval_head; /* Add this interval as the head of the interval list */ + node->interval_head = ival; + node->num_ivals += 1; + + if ( oldstart > node->start && node->left != NULL ) { /* New interval added to the start, and there's a left child */ + cluster_fixup(tree, &(node->left), &node); + } + if ( oldend < node->end && node->right != NULL ) { /* New interval added to the end, and there's a right child */ + cluster_fixup(tree, &(node->right), &node); + } + } + return node; +} + +int main() { + + // Simple test + clustertree* tree = create_clustertree(0, 1); + + tree->root = clusternode_insert(tree, tree->root, 3, 4, 0); + tree->root = clusternode_insert(tree, tree->root, 6, 7, 1); + tree->root = clusternode_insert(tree, tree->root, 9, 10, 2); + tree->root = clusternode_insert(tree, tree->root, 1, 2, 3); + tree->root = clusternode_insert(tree, tree->root, 3, 8, 4); + + clustereach(tree, tree->root); + return 0; + +} diff --git a/code/utilities/CPAT-1.2.2/src/cluster.h b/code/utilities/CPAT-1.2.2/src/cluster.h new file mode 100755 index 0000000..a509ecb --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/cluster.h @@ -0,0 +1,39 @@ +typedef struct struct_interval { + int start; + int end; + int id; + + struct struct_interval *next; +} interval; + +typedef struct struct_clusternode { + int start; + int end; + int priority; + + struct struct_interval *interval_head; + struct struct_interval *interval_tail; + int num_ivals; + + struct struct_clusternode *left; + struct struct_clusternode *right; +} clusternode; + +typedef struct { + int max_dist; + int min_intervals; + + clusternode *root; +} clustertree; + +typedef struct struct_treeitr { + struct struct_treeitr *next; + struct struct_clusternode *node; +} treeitr; + + +clusternode* clusternode_insert(clustertree *tree, clusternode *node, int start, int end, int id); +clustertree* create_clustertree(int max_dist, int min_intervals); +treeitr* clusteritr(clustertree *tree); +void freeclusteritr(treeitr *itr); +void free_tree(clustertree *tree); diff --git a/code/utilities/CPAT-1.2.2/src/kent/bits.c b/code/utilities/CPAT-1.2.2/src/kent/bits.c new file mode 100755 index 0000000..0c058cf --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/kent/bits.c @@ -0,0 +1,279 @@ +/* bits - handle operations on arrays of bits. + * + * This file is copyright 2002 Jim Kent, but license is hereby + * granted for all use - public, private or commercial. */ + +#include "common.h" +#include "bits.h" + +static char const rcsid[] = "$Id: bits.c,v 1.20 2008/03/25 16:32:31 angie Exp $"; + + +static Bits oneBit[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1}; +static Bits leftMask[8] = {0xFF, 0x7F, 0x3F, 0x1F, 0xF, 0x7, 0x3, 0x1,}; +static Bits rightMask[8] = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF,}; +int bitsInByte[256]; + +static boolean inittedBitsInByte = FALSE; + +void bitsInByteInit(void) +/* Initialize bitsInByte array. */ +{ + int i; + + if (!inittedBitsInByte) + { + inittedBitsInByte = TRUE; + for (i=0; i<256; ++i) + { + int count = 0; + if (i&1) + count = 1; + if (i&2) + ++count; + if (i&4) + ++count; + if (i&8) + ++count; + if (i&0x10) + ++count; + if (i&0x20) + ++count; + if (i&0x40) + ++count; + if (i&0x80) + ++count; + bitsInByte[i] = count; + } + } +} + +Bits *bitAlloc(int bitCount) +/* Allocate bits. */ +{ + int byteCount = ((bitCount+7)>>3); + return needLargeZeroedMem(byteCount); +} + +Bits *bitClone(Bits* orig, int bitCount) +/* Clone bits. */ +{ + int byteCount = ((bitCount+7)>>3); + Bits* bits = needLargeZeroedMem(byteCount); + if(orig!=NULL) + memcpy(bits, orig, byteCount); + return bits; +} + +void bitFree(Bits **pB) +/* Free bits. */ +{ + freez(pB); +} + +void bitSetOne(Bits *b, int bitIx) +/* Set a single bit. */ +{ + b[bitIx>>3] |= oneBit[bitIx&7]; +} + +void bitClearOne(Bits *b, int bitIx) +/* Clear a single bit. */ +{ + b[bitIx>>3] &= ~oneBit[bitIx&7]; +} + +void bitSetRange(Bits *b, int startIx, int bitCount) +/* Set a range of bits. */ +{ + + int endIx = (startIx + bitCount - 1); + int startByte = (startIx>>3); + int endByte = (endIx>>3); + int startBits = (startIx&7); + int endBits = (endIx&7); + int i; + + if (bitCount <= 0) + return; + + if (startByte == endByte) + { + b[startByte] |= (leftMask[startBits] & rightMask[endBits]); + return; + } + b[startByte] |= leftMask[startBits]; + for (i = startByte+1; i>3] & oneBit[bitIx&7]) != 0; +} + +int bitCountRange(Bits *b, int startIx, int bitCount) +/* Count number of bits set in range. */ +{ + int endIx = (startIx + bitCount - 1); + int startByte = (startIx>>3); + int endByte = (endIx>>3); + int startBits = (startIx&7); + int endBits = (endIx&7); + int i; + int count = 0; + + if (bitCount <= 0) + return 0; + + if (!inittedBitsInByte) + bitsInByteInit(); + if (startByte == endByte) + return bitsInByte[b[startByte] & leftMask[startBits] & rightMask[endBits]]; + count = bitsInByte[b[startByte] & leftMask[startBits]]; + for (i = startByte+1; i>3); + int iByte; + +/* scan initial byte */ + while (((iBit & 7) != 0) && (iBit < bitCount)) + { + if (bitReadOne(b, iBit) == val) + return iBit; + iBit++; + } + +/* scan byte at a time, if not already in last byte */ + iByte = (iBit >> 3); + if (iByte < endByte) + { + while ((iByte < endByte) && (b[iByte] == notByteVal)) + iByte++; + iBit = iByte << 3; + } + +/* scan last byte */ + while (iBit < bitCount) + { + if (bitReadOne(b, iBit) == val) + return iBit; + iBit++; + } + return bitCount; /* not found */ +} + +int bitFindSet(Bits *b, int startIx, int bitCount) +/* Find the index of the the next set bit. */ +{ + return bitFind(b, startIx, TRUE, bitCount); +} + +int bitFindClear(Bits *b, int startIx, int bitCount) +/* Find the index of the the next clear bit. */ +{ + return bitFind(b, startIx, FALSE, bitCount); +} + +void bitClear(Bits *b, int bitCount) +/* Clear many bits (possibly up to 7 beyond bitCount). */ +{ + int byteCount = ((bitCount+7)>>3); + zeroBytes(b, byteCount); +} + +void bitClearRange(Bits *b, int startIx, int bitCount) +/* Clear a range of bits. */ +{ + + int endIx = (startIx + bitCount - 1); + int startByte = (startIx>>3); + int endByte = (endIx>>3); + int startBits = (startIx&7); + int endBits = (endIx&7); + int i; + + if (bitCount <= 0) + return; + + if (startByte == endByte) + { + b[startByte] &= ~(leftMask[startBits] & rightMask[endBits]); + return; + } + b[startByte] &= ~leftMask[startBits]; + for (i = startByte+1; i>3); + while (--byteCount >= 0) + { + *a = (*a & *b++); + a++; + } +} + +void bitOr(Bits *a, Bits *b, int bitCount) +/* Or two bitmaps. Put result in a. */ +{ + int byteCount = ((bitCount+7)>>3); + while (--byteCount >= 0) + { + *a = (*a | *b++); + a++; + } +} + +void bitXor(Bits *a, Bits *b, int bitCount) +{ + int byteCount = ((bitCount+7)>>3); + while (--byteCount >= 0) + { + *a = (*a ^ *b++); + a++; + } +} + +void bitNot(Bits *a, int bitCount) +/* Flip all bits in a. */ +{ + int byteCount = ((bitCount+7)>>3); + while (--byteCount >= 0) + { + *a = ~*a; + a++; + } +} + +void bitPrint(Bits *a, int startIx, int bitCount, FILE* out) +/* Print part or all of bit map as a string of 0s and 1s. Mostly useful for +* debugging */ +{ + int i; + for (i = startIx; i < bitCount; i++) + { + if (bitReadOne(a, i)) + fputc('1', out); + else + fputc('0', out); + } + fputc('\n', out); +} + diff --git a/code/utilities/CPAT-1.2.2/src/kent/bits.h b/code/utilities/CPAT-1.2.2/src/kent/bits.h new file mode 100755 index 0000000..7377b28 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/kent/bits.h @@ -0,0 +1,72 @@ +/* bits - handle operations on arrays of bits. + * + * This file is copyright 2002 Jim Kent, but license is hereby + * granted for all use - public, private or commercial. */ + +#ifndef BITS_H +#define BITS_H + +#include "common.h" + +typedef unsigned char Bits; + +Bits *bitAlloc(int bitCount); +/* Allocate bits. */ + +Bits *bitClone(Bits* orig, int bitCount); +/* Clone bits. */ + +void bitFree(Bits **pB); +/* Free bits. */ + +void bitSetOne(Bits *b, int bitIx); +/* Set a single bit. */ + +void bitClearOne(Bits *b, int bitIx); +/* Clear a single bit. */ + +void bitSetRange(Bits *b, int startIx, int bitCount); +/* Set a range of bits. */ + +boolean bitReadOne(Bits *b, int bitIx); +/* Read a single bit. */ + +int bitCountRange(Bits *b, int startIx, int bitCount); +/* Count number of bits set in range. */ + +int bitFindSet(Bits *b, int startIx, int bitCount); +/* Find the index of the the next set bit. */ + +int bitFindClear(Bits *b, int startIx, int bitCount); +/* Find the index of the the next clear bit. */ + +void bitClear(Bits *b, int bitCount); +/* Clear many bits (possibly up to 7 beyond bitCount). */ + +void bitClearRange(Bits *b, int startIx, int bitCount); +/* Clear a range of bits. */ + +void bitAnd(Bits *a, Bits *b, int bitCount); +/* And two bitmaps. Put result in a. */ + +void bitOr(Bits *a, Bits *b, int bitCount); +/* Or two bitmaps. Put result in a. */ + +void bitXor(Bits *a, Bits *b, int bitCount); +/* Xor two bitmaps. Put result in a. */ + +void bitNot(Bits *a, int bitCount); +/* Flip all bits in a. */ + +void bitPrint(Bits *a, int startIx, int bitCount, FILE* out); +/* Print part or all of bit map as a string of 0s and 1s. Mostly useful for + * debugging */ + +extern int bitsInByte[256]; +/* Lookup table for how many bits are set in a byte. */ + +void bitsInByteInit(void); +/* Initialize bitsInByte array. */ + +#endif /* BITS_H */ + diff --git a/code/utilities/CPAT-1.2.2/src/kent/common.c b/code/utilities/CPAT-1.2.2/src/kent/common.c new file mode 100755 index 0000000..55528f6 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/kent/common.c @@ -0,0 +1,62 @@ +#include "common.h" + +void *needMem(size_t size) + /* Need mem calls abort if the memory allocation fails. The memory + * * is initialized to zero. */ +{ + void *pt; + if ((pt = malloc(size)) == NULL) + { + fprintf( stderr, "Out of memory needMem - request size %llu bytes\n", + (unsigned long long)size); + exit(1); + } + memset(pt, 0, size); + return pt; +} + +void freeMem(void *pt) + /* Free memory will check for null before freeing. */ +{ + if (pt != NULL) + free(pt); +} + + +void *needLargeZeroedMem(size_t size) + /* Request a large block of memory and zero it. */ +{ + void *v; + /*v = needLargeMem(size);*/ + v = malloc(size); + /* + * If you do memset(NULL,0,size), there will be a segfault. + * So check v for NULL + */ + if( v != NULL ) + memset(v, 0, size); + return v; +} + +void freez(void *vpt) + /* Pass address of pointer. Will free pointer and set it + * * to NULL. */ +{ + void **ppt = (void **)vpt; + void *pt = *ppt; + *ppt = NULL; + freeMem(pt); +} + +/* fill a specified area of memory with zeroes + * If you do zeroBytes(NULL,count), there will be a segfault. + * So check pt for NULL + */ +void zeroBytes(void *vpt, int count) +{ + char *pt = (char*)vpt; + if(pt != NULL ){ + while (--count>=0) + *pt++=0; + } +} diff --git a/code/utilities/CPAT-1.2.2/src/kent/common.h b/code/utilities/CPAT-1.2.2/src/kent/common.h new file mode 100755 index 0000000..13d1b68 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/kent/common.h @@ -0,0 +1,32 @@ +#ifndef __COMMON_H__ +#define __COMMON_H__ + +#include +#include +#include +#include +#include + +/* Let's pretend C has a boolean type. */ +#define TRUE 1 +#define FALSE 0 +#define boolean int +#define bool char + +#define AllocVar(pt) (pt = needMem(sizeof(*pt))) +/* Shortcut to allocating a single variable on the heap and + * * assigning pointer to it. */ + +#define AllocArray(pt, size) (pt = needLargeZeroedMem(sizeof(*pt) * (size))) + +void *needMem(size_t size); + +void freeMem(void *pt); + +void *needLargeZeroedMem(size_t size); + +void freez(void *vpt); + +void zeroBytes(void *vpt, int count); + +#endif diff --git a/code/utilities/CPAT-1.2.2/src/pwm_utils.c b/code/utilities/CPAT-1.2.2/src/pwm_utils.c new file mode 100755 index 0000000..3303b10 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/pwm_utils.c @@ -0,0 +1,63 @@ + +#include +#include +#include + +int symbol_match( char, char); +int pattern_match( char*, char*, int); + +int main(int argc, char** argv) { + if (argc == 3) { + int string_size = strlen(argv[1]); + if (strlen(argv[2]) != string_size) { + fprintf(stdout, "%s != %s\n", argv[1], argv[2]); + return 1; + } + if ( pattern_match( argv[1], argv[2], string_size) ) + fprintf(stdout, "%s == %s\n", argv[1], argv[2]); + else + fprintf(stdout, "%s != %s\n", argv[1], argv[2]); + } + return 0; +} + +int pattern_match( char* string, char* pattern, int n){ + int i = 0; + while (i +#include +#include +#include +#include +#include +#include +#include "bgzf.h" + +#include "khash.h" +typedef struct { + int size; + uint8_t *block; + int64_t end_offset; +} cache_t; +KHASH_MAP_INIT_INT64(cache, cache_t) + +#if defined(_WIN32) || defined(_MSC_VER) +#define ftello(fp) ftell(fp) +#define fseeko(fp, offset, whence) fseek(fp, offset, whence) +#else +extern off_t ftello(FILE *stream); +extern int fseeko(FILE *stream, off_t offset, int whence); +#endif + +typedef int8_t bgzf_byte_t; + +static const int DEFAULT_BLOCK_SIZE = 64 * 1024; +static const int MAX_BLOCK_SIZE = 64 * 1024; + +static const int BLOCK_HEADER_LENGTH = 18; +static const int BLOCK_FOOTER_LENGTH = 8; + +static const int GZIP_ID1 = 31; +static const int GZIP_ID2 = 139; +static const int CM_DEFLATE = 8; +static const int FLG_FEXTRA = 4; +static const int OS_UNKNOWN = 255; +static const int BGZF_ID1 = 66; // 'B' +static const int BGZF_ID2 = 67; // 'C' +static const int BGZF_LEN = 2; +static const int BGZF_XLEN = 6; // BGZF_LEN+4 + +static const int GZIP_WINDOW_BITS = -15; // no zlib header +static const int Z_DEFAULT_MEM_LEVEL = 8; + + +inline +void +packInt16(uint8_t* buffer, uint16_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; +} + +inline +int +unpackInt16(const uint8_t* buffer) +{ + return (buffer[0] | (buffer[1] << 8)); +} + +inline +void +packInt32(uint8_t* buffer, uint32_t value) +{ + buffer[0] = value; + buffer[1] = value >> 8; + buffer[2] = value >> 16; + buffer[3] = value >> 24; +} + +static inline +int +bgzf_min(int x, int y) +{ + return (x < y) ? x : y; +} + +static +void +report_error(BGZF* fp, const char* message) { + fp->error = message; +} + +static BGZF *bgzf_read_init() +{ + BGZF *fp; + fp = calloc(1, sizeof(BGZF)); + fp->uncompressed_block_size = MAX_BLOCK_SIZE; + fp->uncompressed_block = malloc(MAX_BLOCK_SIZE); + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->cache_size = 0; + fp->cache = kh_init(cache); + return fp; +} + +static +BGZF* +open_read(int fd) +{ +#ifdef _USE_KNETFILE + knetFile *file = knet_dopen(fd, "r"); +#else + FILE* file = fdopen(fd, "r"); +#endif + BGZF* fp; + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = fd; + fp->open_mode = 'r'; +#ifdef _USE_KNETFILE + fp->x.fpr = file; +#else + fp->file = file; +#endif + return fp; +} + +static +BGZF* +open_write(int fd, bool is_uncompressed) +{ + FILE* file = fdopen(fd, "w"); + BGZF* fp; + if (file == 0) return 0; + fp = malloc(sizeof(BGZF)); + fp->file_descriptor = fd; + fp->open_mode = 'w'; + fp->owned_file = 0; fp->is_uncompressed = is_uncompressed; +#ifdef _USE_KNETFILE + fp->x.fpw = file; +#else + fp->file = file; +#endif + fp->uncompressed_block_size = DEFAULT_BLOCK_SIZE; + fp->uncompressed_block = NULL; + fp->compressed_block_size = MAX_BLOCK_SIZE; + fp->compressed_block = malloc(MAX_BLOCK_SIZE); + fp->block_address = 0; + fp->block_offset = 0; + fp->block_length = 0; + fp->error = NULL; + return fp; +} + +#ifdef __SUNPRO_C +BGZF* +bgzf_open(const char* path, const char* mode) +#else +BGZF* +bgzf_open(const char* __restrict path, const char* __restrict mode) +#endif +{ + BGZF* fp = NULL; + if (mode[0] == 'r' || mode[0] == 'R') { /* The reading mode is preferred. */ +#ifdef _USE_KNETFILE + knetFile *file = knet_open(path, mode); + if (file == 0) return 0; + fp = bgzf_read_init(); + fp->file_descriptor = -1; + fp->open_mode = 'r'; + fp->x.fpr = file; +#else + int fd, oflag = O_RDONLY; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag); + if (fd == -1) return 0; + fp = open_read(fd); +#endif + } else if (mode[0] == 'w' || mode[0] == 'W') { + int fd, oflag = O_WRONLY | O_CREAT | O_TRUNC; +#ifdef _WIN32 + oflag |= O_BINARY; +#endif + fd = open(path, oflag, 0666); + if (fd == -1) return 0; + fp = open_write(fd, strstr(mode, "u")? 1 : 0); + } + if (fp != NULL) { + fp->owned_file = 1; + } + return fp; +} + +#ifdef __SUNPRO_C +BGZF* +bgzf_fdopen(int fd, const char * mode) +#else +BGZF* +bgzf_fdopen(int fd, const char * __restrict mode) +#endif +{ + if (fd == -1) return 0; + if (mode[0] == 'r' || mode[0] == 'R') { + return open_read(fd); + } else if (mode[0] == 'w' || mode[0] == 'W') { + return open_write(fd, strstr(mode, "u")? 1 : 0); + } else { + return NULL; + } +} + +static +int +deflate_block(BGZF* fp, int block_length) +{ + // Deflate the block in fp->uncompressed_block into fp->compressed_block. + // Also adds an extra field that stores the compressed block length. + + bgzf_byte_t* buffer = fp->compressed_block; + int buffer_size = fp->compressed_block_size; + + // Init gzip header + buffer[0] = GZIP_ID1; + buffer[1] = GZIP_ID2; + buffer[2] = CM_DEFLATE; + buffer[3] = FLG_FEXTRA; + buffer[4] = 0; // mtime + buffer[5] = 0; + buffer[6] = 0; + buffer[7] = 0; + buffer[8] = 0; + buffer[9] = OS_UNKNOWN; + buffer[10] = BGZF_XLEN; + buffer[11] = 0; + buffer[12] = BGZF_ID1; + buffer[13] = BGZF_ID2; + buffer[14] = BGZF_LEN; + buffer[15] = 0; + buffer[16] = 0; // placeholder for block length + buffer[17] = 0; + + // loop to retry for blocks that do not compress enough + int input_length = block_length; + int compressed_length = 0; + while (1) { + int compress_level = fp->is_uncompressed? 0 : Z_DEFAULT_COMPRESSION; + z_stream zs; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->uncompressed_block; + zs.avail_in = input_length; + zs.next_out = (void*)&buffer[BLOCK_HEADER_LENGTH]; + zs.avail_out = buffer_size - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH; + + int status = deflateInit2(&zs, compress_level, Z_DEFLATED, + GZIP_WINDOW_BITS, Z_DEFAULT_MEM_LEVEL, Z_DEFAULT_STRATEGY); + if (status != Z_OK) { + report_error(fp, "deflate init failed"); + return -1; + } + status = deflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + deflateEnd(&zs); + if (status == Z_OK) { + // Not enough space in buffer. + // Can happen in the rare case the input doesn't compress enough. + // Reduce the amount of input until it fits. + input_length -= 1024; + if (input_length <= 0) { + // should never happen + report_error(fp, "input reduction failed"); + return -1; + } + continue; + } + report_error(fp, "deflate failed"); + return -1; + } + status = deflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "deflate end failed"); + return -1; + } + compressed_length = zs.total_out; + compressed_length += BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH; + if (compressed_length > MAX_BLOCK_SIZE) { + // should never happen + report_error(fp, "deflate overflow"); + return -1; + } + break; + } + + packInt16((uint8_t*)&buffer[16], compressed_length-1); + uint32_t crc = crc32(0L, NULL, 0L); + crc = crc32(crc, fp->uncompressed_block, input_length); + packInt32((uint8_t*)&buffer[compressed_length-8], crc); + packInt32((uint8_t*)&buffer[compressed_length-4], input_length); + + int remaining = block_length - input_length; + if (remaining > 0) { + if (remaining > input_length) { + // should never happen (check so we can use memcpy) + report_error(fp, "remainder too large"); + return -1; + } + memcpy(fp->uncompressed_block, + fp->uncompressed_block + input_length, + remaining); + } + fp->block_offset = remaining; + return compressed_length; +} + +static +int +inflate_block(BGZF* fp, int block_length) +{ + // Inflate the block in fp->compressed_block into fp->uncompressed_block + + z_stream zs; + zs.zalloc = NULL; + zs.zfree = NULL; + zs.next_in = fp->compressed_block + 18; + zs.avail_in = block_length - 16; + zs.next_out = fp->uncompressed_block; + zs.avail_out = fp->uncompressed_block_size; + + int status = inflateInit2(&zs, GZIP_WINDOW_BITS); + if (status != Z_OK) { + report_error(fp, "inflate init failed"); + return -1; + } + status = inflate(&zs, Z_FINISH); + if (status != Z_STREAM_END) { + inflateEnd(&zs); + report_error(fp, "inflate failed"); + return -1; + } + status = inflateEnd(&zs); + if (status != Z_OK) { + report_error(fp, "inflate failed"); + return -1; + } + return zs.total_out; +} + +static +int +check_header(const bgzf_byte_t* header) +{ + return (header[0] == GZIP_ID1 && + header[1] == (bgzf_byte_t) GZIP_ID2 && + header[2] == Z_DEFLATED && + (header[3] & FLG_FEXTRA) != 0 && + unpackInt16((uint8_t*)&header[10]) == BGZF_XLEN && + header[12] == BGZF_ID1 && + header[13] == BGZF_ID2 && + unpackInt16((uint8_t*)&header[14]) == BGZF_LEN); +} + +static void free_cache(BGZF *fp) +{ + khint_t k; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (fp->open_mode != 'r') return; + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) free(kh_val(h, k).block); + kh_destroy(cache, h); +} + +static int load_block_from_cache(BGZF *fp, int64_t block_address) +{ + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + k = kh_get(cache, h, block_address); + if (k == kh_end(h)) return 0; + p = &kh_val(h, k); + if (fp->block_length != 0) fp->block_offset = 0; + fp->block_address = block_address; + fp->block_length = p->size; + memcpy(fp->uncompressed_block, p->block, MAX_BLOCK_SIZE); +#ifdef _USE_KNETFILE + knet_seek(fp->x.fpr, p->end_offset, SEEK_SET); +#else + fseeko(fp->file, p->end_offset, SEEK_SET); +#endif + return p->size; +} + +static void cache_block(BGZF *fp, int size) +{ + int ret; + khint_t k; + cache_t *p; + khash_t(cache) *h = (khash_t(cache)*)fp->cache; + if (MAX_BLOCK_SIZE >= fp->cache_size) return; + if ((kh_size(h) + 1) * MAX_BLOCK_SIZE > fp->cache_size) { + /* A better way would be to remove the oldest block in the + * cache, but here we remove a random one for simplicity. This + * should not have a big impact on performance. */ + for (k = kh_begin(h); k < kh_end(h); ++k) + if (kh_exist(h, k)) break; + if (k < kh_end(h)) { + free(kh_val(h, k).block); + kh_del(cache, h, k); + } + } + k = kh_put(cache, h, fp->block_address, &ret); + if (ret == 0) return; // if this happens, a bug! + p = &kh_val(h, k); + p->size = fp->block_length; + p->end_offset = fp->block_address + size; + p->block = malloc(MAX_BLOCK_SIZE); + memcpy(kh_val(h, k).block, fp->uncompressed_block, MAX_BLOCK_SIZE); +} + +static +int +read_block(BGZF* fp) +{ + bgzf_byte_t header[BLOCK_HEADER_LENGTH]; + int size = 0; +#ifdef _USE_KNETFILE + int64_t block_address = knet_tell(fp->x.fpr); + if (load_block_from_cache(fp, block_address)) return 0; + int count = knet_read(fp->x.fpr, header, sizeof(header)); +#else + int64_t block_address = ftello(fp->file); + if (load_block_from_cache(fp, block_address)) return 0; + int count = fread(header, 1, sizeof(header), fp->file); +#endif + if (count == 0) { + fp->block_length = 0; + return 0; + } + size = count; + if (count != sizeof(header)) { + report_error(fp, "read failed"); + return -1; + } + if (!check_header(header)) { + report_error(fp, "invalid block header"); + return -1; + } + int block_length = unpackInt16((uint8_t*)&header[16]) + 1; + bgzf_byte_t* compressed_block = (bgzf_byte_t*) fp->compressed_block; + memcpy(compressed_block, header, BLOCK_HEADER_LENGTH); + int remaining = block_length - BLOCK_HEADER_LENGTH; +#ifdef _USE_KNETFILE + count = knet_read(fp->x.fpr, &compressed_block[BLOCK_HEADER_LENGTH], remaining); +#else + count = fread(&compressed_block[BLOCK_HEADER_LENGTH], 1, remaining, fp->file); +#endif + if (count != remaining) { + report_error(fp, "read failed"); + return -1; + } + size += count; + count = inflate_block(fp, block_length); + if (count < 0) { + return -1; + } + if (fp->block_length != 0) { + // Do not reset offset if this read follows a seek. + fp->block_offset = 0; + } + fp->block_address = block_address; + fp->block_length = count; + cache_block(fp, size); + return 0; +} + +int +bgzf_read(BGZF* fp, void* data, int length) +{ + if (length <= 0) { + return 0; + } + if (fp->open_mode != 'r') { + report_error(fp, "file not open for reading"); + return -1; + } + + int bytes_read = 0; + bgzf_byte_t* output = data; + while (bytes_read < length) { + int available = fp->block_length - fp->block_offset; + if (available <= 0) { + if (read_block(fp) != 0) { + return -1; + } + available = fp->block_length - fp->block_offset; + if (available <= 0) { + break; + } + } + int copy_length = bgzf_min(length-bytes_read, available); + bgzf_byte_t* buffer = fp->uncompressed_block; + memcpy(output, buffer + fp->block_offset, copy_length); + fp->block_offset += copy_length; + output += copy_length; + bytes_read += copy_length; + } + if (fp->block_offset == fp->block_length) { +#ifdef _USE_KNETFILE + fp->block_address = knet_tell(fp->x.fpr); +#else + fp->block_address = ftello(fp->file); +#endif + fp->block_offset = 0; + fp->block_length = 0; + } + return bytes_read; +} + +static +int +flush_block(BGZF* fp) +{ + while (fp->block_offset > 0) { + int block_length = deflate_block(fp, fp->block_offset); + if (block_length < 0) { + return -1; + } +#ifdef _USE_KNETFILE + int count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + int count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + if (count != block_length) { + report_error(fp, "write failed"); + return -1; + } + fp->block_address += block_length; + } + return 0; +} + +int +bgzf_write(BGZF* fp, const void* data, int length) +{ + if (fp->open_mode != 'w') { + report_error(fp, "file not open for writing"); + return -1; + } + + if (fp->uncompressed_block == NULL) { + fp->uncompressed_block = malloc(fp->uncompressed_block_size); + } + + const bgzf_byte_t* input = data; + int block_length = fp->uncompressed_block_size; + int bytes_written = 0; + while (bytes_written < length) { + int copy_length = bgzf_min(block_length - fp->block_offset, length - bytes_written); + bgzf_byte_t* buffer = fp->uncompressed_block; + memcpy(buffer + fp->block_offset, input, copy_length); + fp->block_offset += copy_length; + input += copy_length; + bytes_written += copy_length; + if (fp->block_offset == block_length) { + if (flush_block(fp) != 0) { + break; + } + } + } + return bytes_written; +} + +int +bgzf_close(BGZF* fp) +{ + if (fp->open_mode == 'w') { + if (flush_block(fp) != 0) { + return -1; + } + { // add an empty block + int count, block_length = deflate_block(fp, 0); +#ifdef _USE_KNETFILE + count = fwrite(fp->compressed_block, 1, block_length, fp->x.fpw); +#else + count = fwrite(fp->compressed_block, 1, block_length, fp->file); +#endif + } +#ifdef _USE_KNETFILE + if (fflush(fp->x.fpw) != 0) { +#else + if (fflush(fp->file) != 0) { +#endif + report_error(fp, "flush failed"); + return -1; + } + } + if (fp->owned_file) { +#ifdef _USE_KNETFILE + int ret; + if (fp->open_mode == 'w') ret = fclose(fp->x.fpw); + else ret = knet_close(fp->x.fpr); + if (ret != 0) return -1; +#else + if (fclose(fp->file) != 0) { + return -1; + } +#endif + } + free(fp->uncompressed_block); + free(fp->compressed_block); + free_cache(fp); + free(fp); + return 0; +} + +int64_t +bgzf_tell(BGZF* fp) +{ + return ((fp->block_address << 16) | (fp->block_offset & 0xFFFF)); +} + +void bgzf_set_cache_size(BGZF *fp, int cache_size) +{ + if (fp) fp->cache_size = cache_size; +} + +int bgzf_check_EOF(BGZF *fp) +{ + static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0"; + uint8_t buf[28]; + off_t offset; +#ifdef _USE_KNETFILE + offset = knet_tell(fp->x.fpr); + if (knet_seek(fp->x.fpr, -28, SEEK_END) != 0) return -1; + knet_read(fp->x.fpr, buf, 28); + knet_seek(fp->x.fpr, offset, SEEK_SET); +#else + offset = ftello(fp->file); + if (fseeko(fp->file, -28, SEEK_END) != 0) return -1; + fread(buf, 1, 28, fp->file); + fseeko(fp->file, offset, SEEK_SET); +#endif + return (memcmp(magic, buf, 28) == 0)? 1 : 0; +} + +int64_t +bgzf_seek(BGZF* fp, int64_t pos, int where) +{ + if (fp->open_mode != 'r') { + report_error(fp, "file not open for read"); + return -1; + } + if (where != SEEK_SET) { + report_error(fp, "unimplemented seek option"); + return -1; + } + int block_offset = pos & 0xFFFF; + int64_t block_address = (pos >> 16) & 0xFFFFFFFFFFFFLL; +#ifdef _USE_KNETFILE + if (knet_seek(fp->x.fpr, block_address, SEEK_SET) != 0) { +#else + if (fseeko(fp->file, block_address, SEEK_SET) != 0) { +#endif + report_error(fp, "seek failed"); + return -1; + } + fp->block_length = 0; // indicates current block is not loaded + fp->block_address = block_address; + fp->block_offset = block_offset; + return 0; +} diff --git a/code/utilities/CPAT-1.2.2/src/samtools/bgzf.h b/code/utilities/CPAT-1.2.2/src/samtools/bgzf.h new file mode 100755 index 0000000..45f3af3 --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/samtools/bgzf.h @@ -0,0 +1,142 @@ +/* The MIT License + + Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#ifndef __BGZF_H +#define __BGZF_H + +#include +#include +#include +#include +#ifdef _USE_KNETFILE +#include "knetfile.h" +#endif + +//typedef int8_t bool; + +typedef struct { + int file_descriptor; + char open_mode; // 'r' or 'w' + bool owned_file, is_uncompressed; +#ifdef _USE_KNETFILE + union { + knetFile *fpr; + FILE *fpw; + } x; +#else + FILE* file; +#endif + int uncompressed_block_size; + int compressed_block_size; + void* uncompressed_block; + void* compressed_block; + int64_t block_address; + int block_length; + int block_offset; + int cache_size; + const char* error; + void *cache; // a pointer to a hash table +} BGZF; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Open an existing file descriptor for reading or writing. + * Mode must be either "r" or "w". + * A subsequent bgzf_close will not close the file descriptor. + * Returns null on error. + */ +#ifdef __SUNPRO_C +BGZF* bgzf_fdopen(int fd, const char* mode); +#else +BGZF* bgzf_fdopen(int fd, const char* __restrict mode); +#endif + +/* + * Open the specified file for reading or writing. + * Mode must be either "r" or "w". + * Returns null on error. + */ +#ifdef __SUNPRO_C +BGZF* bgzf_open(const char* path, const char* mode); +#else +BGZF* bgzf_open(const char* path, const char* __restrict mode); +#endif + +/* + * Close the BGZ file and free all associated resources. + * Does not close the underlying file descriptor if created with bgzf_fdopen. + * Returns zero on success, -1 on error. + */ +int bgzf_close(BGZF* fp); + +/* + * Read up to length bytes from the file storing into data. + * Returns the number of bytes actually read. + * Returns zero on end of file. + * Returns -1 on error. + */ +int bgzf_read(BGZF* fp, void* data, int length); + +/* + * Write length bytes from data to the file. + * Returns the number of bytes written. + * Returns -1 on error. + */ +int bgzf_write(BGZF* fp, const void* data, int length); + +/* + * Return a virtual file pointer to the current location in the file. + * No interpetation of the value should be made, other than a subsequent + * call to bgzf_seek can be used to position the file at the same point. + * Return value is non-negative on success. + * Returns -1 on error. + */ +int64_t bgzf_tell(BGZF* fp); + +/* + * Set the file to read from the location specified by pos, which must + * be a value previously returned by bgzf_tell for this file (but not + * necessarily one returned by this file handle). + * The where argument must be SEEK_SET. + * Seeking on a file opened for write is not supported. + * Returns zero on success, -1 on error. + */ +int64_t bgzf_seek(BGZF* fp, int64_t pos, int where); + +/* + * Set the cache size. Zero to disable. By default, caching is + * disabled. The recommended cache size for frequent random access is + * about 8M bytes. + */ +void bgzf_set_cache_size(BGZF *fp, int cache_size); + +int bgzf_check_EOF(BGZF *fp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/utilities/CPAT-1.2.2/src/samtools/khash.h b/code/utilities/CPAT-1.2.2/src/samtools/khash.h new file mode 100755 index 0000000..1d583ef --- /dev/null +++ b/code/utilities/CPAT-1.2.2/src/samtools/khash.h @@ -0,0 +1,486 @@ +/* The MIT License + + Copyright (c) 2008 Genome Research Ltd (GRL). + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +/* Contact: Heng Li */ + +/* + An example: + +#include "khash.h" +KHASH_MAP_INIT_INT(32, char) +int main() { + int ret, is_missing; + khiter_t k; + khash_t(32) *h = kh_init(32); + k = kh_put(32, h, 5, &ret); + if (!ret) kh_del(32, h, k); + kh_value(h, k) = 10; + k = kh_get(32, h, 10); + is_missing = (k == kh_end(h)); + k = kh_get(32, h, 5); + kh_del(32, h, k); + for (k = kh_begin(h); k != kh_end(h); ++k) + if (kh_exist(h, k)) kh_value(h, k) = 1; + kh_destroy(32, h); + return 0; +} +*/ + +/* + 2008-09-19 (0.2.3): + + * Corrected the example + * Improved interfaces + + 2008-09-11 (0.2.2): + + * Improved speed a little in kh_put() + + 2008-09-10 (0.2.1): + + * Added kh_clear() + * Fixed a compiling error + + 2008-09-02 (0.2.0): + + * Changed to token concatenation which increases flexibility. + + 2008-08-31 (0.1.2): + + * Fixed a bug in kh_get(), which has not been tested previously. + + 2008-08-31 (0.1.1): + + * Added destructor +*/ + + +#ifndef __AC_KHASH_H +#define __AC_KHASH_H + +/*! + @header + + Generic hash table library. + + @copyright Heng Li + */ + +#define AC_VERSION_KHASH_H "0.2.2" + +#include +#include +#include + +typedef uint32_t khint_t; +typedef khint_t khiter_t; + +#define __ac_HASH_PRIME_SIZE 32 +static const uint32_t __ac_prime_list[__ac_HASH_PRIME_SIZE] = +{ + 0ul, 3ul, 11ul, 23ul, 53ul, + 97ul, 193ul, 389ul, 769ul, 1543ul, + 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, + 98317ul, 196613ul, 393241ul, 786433ul, 1572869ul, + 3145739ul, 6291469ul, 12582917ul, 25165843ul, 50331653ul, + 100663319ul, 201326611ul, 402653189ul, 805306457ul, 1610612741ul, + 3221225473ul, 4294967291ul +}; + +#define __ac_isempty(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&2) +#define __ac_isdel(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&1) +#define __ac_iseither(flag, i) ((flag[i>>4]>>((i&0xfU)<<1))&3) +#define __ac_set_isdel_false(flag, i) (flag[i>>4]&=~(1ul<<((i&0xfU)<<1))) +#define __ac_set_isempty_false(flag, i) (flag[i>>4]&=~(2ul<<((i&0xfU)<<1))) +#define __ac_set_isboth_false(flag, i) (flag[i>>4]&=~(3ul<<((i&0xfU)<<1))) +#define __ac_set_isdel_true(flag, i) (flag[i>>4]|=1ul<<((i&0xfU)<<1)) + +static const double __ac_HASH_UPPER = 0.77; + +#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \ + typedef struct { \ + khint_t n_buckets, size, n_occupied, upper_bound; \ + uint32_t *flags; \ + khkey_t *keys; \ + khval_t *vals; \ + } kh_##name##_t; \ + static inline kh_##name##_t *kh_init_##name() { \ + return (kh_##name##_t*)calloc(1, sizeof(kh_##name##_t)); \ + } \ + static inline void kh_destroy_##name(kh_##name##_t *h) \ + { \ + if (h) { \ + free(h->keys); free(h->flags); \ + free(h->vals); \ + free(h); \ + } \ + } \ + static inline void kh_clear_##name(kh_##name##_t *h) \ + { \ + if (h && h->flags) { \ + memset(h->flags, 0xaa, ((h->n_buckets>>4) + 1) * sizeof(uint32_t)); \ + h->size = h->n_occupied = 0; \ + } \ + } \ + static inline khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \ + { \ + if (h->n_buckets) { \ + khint_t inc, k, i, last; \ + k = __hash_func(key); i = k % h->n_buckets; \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) return h->n_buckets; \ + } \ + return __ac_iseither(h->flags, i)? h->n_buckets : i; \ + } else return 0; \ + } \ + static inline void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \ + { \ + uint32_t *new_flags = 0; \ + khint_t j = 1; \ + { \ + khint_t t = __ac_HASH_PRIME_SIZE - 1; \ + while (__ac_prime_list[t] > new_n_buckets) --t; \ + new_n_buckets = __ac_prime_list[t+1]; \ + if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; \ + else { \ + new_flags = (uint32_t*)malloc(((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \ + memset(new_flags, 0xaa, ((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \ + if (h->n_buckets < new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + } \ + } \ + if (j) { \ + for (j = 0; j != h->n_buckets; ++j) { \ + if (__ac_iseither(h->flags, j) == 0) { \ + khkey_t key = h->keys[j]; \ + khval_t val; \ + if (kh_is_map) val = h->vals[j]; \ + __ac_set_isdel_true(h->flags, j); \ + while (1) { \ + khint_t inc, k, i; \ + k = __hash_func(key); \ + i = k % new_n_buckets; \ + inc = 1 + k % (new_n_buckets - 1); \ + while (!__ac_isempty(new_flags, i)) { \ + if (i + inc >= new_n_buckets) i = i + inc - new_n_buckets; \ + else i += inc; \ + } \ + __ac_set_isempty_false(new_flags, i); \ + if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \ + { khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \ + if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \ + __ac_set_isdel_true(h->flags, i); \ + } else { \ + h->keys[i] = key; \ + if (kh_is_map) h->vals[i] = val; \ + break; \ + } \ + } \ + } \ + } \ + if (h->n_buckets > new_n_buckets) { \ + h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) \ + h->vals = (khval_t*)realloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + } \ + free(h->flags); \ + h->flags = new_flags; \ + h->n_buckets = new_n_buckets; \ + h->n_occupied = h->size; \ + h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \ + } \ + } \ + static inline khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \ + { \ + khint_t x; \ + if (h->n_occupied >= h->upper_bound) { \ + if (h->n_buckets > (h->size<<1)) kh_resize_##name(h, h->n_buckets - 1); \ + else kh_resize_##name(h, h->n_buckets + 1); \ + } \ + { \ + khint_t inc, k, i, site, last; \ + x = site = h->n_buckets; k = __hash_func(key); i = k % h->n_buckets; \ + if (__ac_isempty(h->flags, i)) x = i; \ + else { \ + inc = 1 + k % (h->n_buckets - 1); last = i; \ + while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \ + if (__ac_isdel(h->flags, i)) site = i; \ + if (i + inc >= h->n_buckets) i = i + inc - h->n_buckets; \ + else i += inc; \ + if (i == last) { x = site; break; } \ + } \ + if (x == h->n_buckets) { \ + if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \ + else x = i; \ + } \ + } \ + } \ + if (__ac_isempty(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; ++h->n_occupied; \ + *ret = 1; \ + } else if (__ac_isdel(h->flags, x)) { \ + h->keys[x] = key; \ + __ac_set_isboth_false(h->flags, x); \ + ++h->size; \ + *ret = 2; \ + } else *ret = 0; \ + return x; \ + } \ + static inline void kh_del_##name(kh_##name##_t *h, khint_t x) \ + { \ + if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \ + __ac_set_isdel_true(h->flags, x); \ + --h->size; \ + } \ + } + +/* --- BEGIN OF HASH FUNCTIONS --- */ + +/*! @function + @abstract Integer hash function + @param key The integer [uint32_t] + @return The hash value [khint_t] + */ +#define kh_int_hash_func(key) (uint32_t)(key) +/*! @function + @abstract Integer comparison function + */ +#define kh_int_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract 64-bit integer hash function + @param key The integer [uint64_t] + @return The hash value [khint_t] + */ +#define kh_int64_hash_func(key) (uint32_t)((key)>>33^(key)^(key)<<11) +/*! @function + @abstract 64-bit integer comparison function + */ +#define kh_int64_hash_equal(a, b) ((a) == (b)) +/*! @function + @abstract const char* hash function + @param s Pointer to a null terminated string + @return The hash value + */ +static inline khint_t __ac_X31_hash_string(const char *s) +{ + khint_t h = *s; + if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s; + return h; +} +/*! @function + @abstract Another interface to const char* hash function + @param key Pointer to a null terminated string [const char*] + @return The hash value [khint_t] + */ +#define kh_str_hash_func(key) __ac_X31_hash_string(key) +/*! @function + @abstract Const char* comparison function + */ +#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0) + +/* --- END OF HASH FUNCTIONS --- */ + +/* Other necessary macros... */ + +/*! + @abstract Type of the hash table. + @param name Name of the hash table [symbol] + */ +#define khash_t(name) kh_##name##_t + +/*! @function + @abstract Initiate a hash table. + @param name Name of the hash table [symbol] + @return Pointer to the hash table [khash_t(name)*] + */ +#define kh_init(name) kh_init_##name() + +/*! @function + @abstract Destroy a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_destroy(name, h) kh_destroy_##name(h) + +/*! @function + @abstract Reset a hash table without deallocating memory. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + */ +#define kh_clear(name, h) kh_clear_##name(h) + +/*! @function + @abstract Resize a hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param s New size [khint_t] + */ +#define kh_resize(name, h, s) kh_resize_##name(h, s) + +/*! @function + @abstract Insert a key to the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @param r Extra return code: 0 if the key is present in the hash table; + 1 if the bucket is empty (never used); 2 if the element in + the bucket has been deleted [int*] + @return Iterator to the inserted element [khint_t] + */ +#define kh_put(name, h, k, r) kh_put_##name(h, k, r) + +/*! @function + @abstract Retrieve a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Key [type of keys] + @return Iterator to the found element, or kh_end(h) is the element is absent [khint_t] + */ +#define kh_get(name, h, k) kh_get_##name(h, k) + +/*! @function + @abstract Remove a key from the hash table. + @param name Name of the hash table [symbol] + @param h Pointer to the hash table [khash_t(name)*] + @param k Iterator to the element to be deleted [khint_t] + */ +#define kh_del(name, h, k) kh_del_##name(h, k) + + +/*! @function + @abstract Test whether a bucket contains data. + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return 1 if containing data; 0 otherwise [int] + */ +#define kh_exist(h, x) (!__ac_iseither((h)->flags, (x))) + +/*! @function + @abstract Get key given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Key [type of keys] + */ +#define kh_key(h, x) ((h)->keys[x]) + +/*! @function + @abstract Get value given an iterator + @param h Pointer to the hash table [khash_t(name)*] + @param x Iterator to the bucket [khint_t] + @return Value [type of values] + @discussion For hash sets, calling this results in segfault. + */ +#define kh_val(h, x) ((h)->vals[x]) + +/*! @function + @abstract Alias of kh_val() + */ +#define kh_value(h, x) ((h)->vals[x]) + +/*! @function + @abstract Get the start iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The start iterator [khint_t] + */ +#define kh_begin(h) (khint_t)(0) + +/*! @function + @abstract Get the end iterator + @param h Pointer to the hash table [khash_t(name)*] + @return The end iterator [khint_t] + */ +#define kh_end(h) ((h)->n_buckets) + +/*! @function + @abstract Get the number of elements in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of elements in the hash table [khint_t] + */ +#define kh_size(h) ((h)->size) + +/*! @function + @abstract Get the number of buckets in the hash table + @param h Pointer to the hash table [khash_t(name)*] + @return Number of buckets in the hash table [khint_t] + */ +#define kh_n_buckets(h) ((h)->n_buckets) + +/* More conenient interfaces */ + +/*! @function + @abstract Instantiate a hash set containing integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT(name) \ + KHASH_INIT(name, uint32_t, char, 0, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT(name, khval_t) \ + KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_INT64(name) \ + KHASH_INIT(name, uint64_t, char, 0, kh_int64_hash_func, kh_int64_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing 64-bit integer keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_INT64(name, khval_t) \ + KHASH_INIT(name, uint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal) + +typedef const char *kh_cstr_t; +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + */ +#define KHASH_SET_INIT_STR(name) \ + KHASH_INIT(name, kh_cstr_t, char, 0, kh_str_hash_func, kh_str_hash_equal) + +/*! @function + @abstract Instantiate a hash map containing const char* keys + @param name Name of the hash table [symbol] + @param khval_t Type of values [type] + */ +#define KHASH_MAP_INIT_STR(name, khval_t) \ + KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal) + +#endif /* __AC_KHASH_H */ diff --git a/code/utilities/STAR b/code/utilities/STAR new file mode 120000 index 0000000..988799e --- /dev/null +++ b/code/utilities/STAR @@ -0,0 +1 @@ +STAR-STAR_2.4.2a/bin/Linux_x86_64_static \ No newline at end of file diff --git a/code/utilities/STAR-STAR_2.4.2a/.gitignore b/code/utilities/STAR-STAR_2.4.2a/.gitignore new file mode 100755 index 0000000..d8b9b6c --- /dev/null +++ b/code/utilities/STAR-STAR_2.4.2a/.gitignore @@ -0,0 +1,4 @@ +*.o +Depend.list +parametersDefault.xxd + diff --git a/code/utilities/STAR-STAR_2.4.2a/.gitmodules b/code/utilities/STAR-STAR_2.4.2a/.gitmodules new file mode 100755 index 0000000..9f60d88 --- /dev/null +++ b/code/utilities/STAR-STAR_2.4.2a/.gitmodules @@ -0,0 +1,3 @@ +[submodule "STAR-Fusion"] + path = STAR-Fusion + url = https://github.com/STAR-Fusion/STAR-Fusion diff --git a/code/utilities/STAR-STAR_2.4.2a/bin/Linux_x86_64_static/STAR b/code/utilities/STAR-STAR_2.4.2a/bin/Linux_x86_64_static/STAR new file mode 100755 index 0000000..ece9b6a Binary files /dev/null and b/code/utilities/STAR-STAR_2.4.2a/bin/Linux_x86_64_static/STAR differ diff --git a/code/utilities/bedGraphToBigWig b/code/utilities/bedGraphToBigWig new file mode 100755 index 0000000..fa91275 Binary files /dev/null and b/code/utilities/bedGraphToBigWig differ diff --git a/code/utilities/bedToGenePred b/code/utilities/bedToGenePred new file mode 100755 index 0000000..f04e1e8 Binary files /dev/null and b/code/utilities/bedToGenePred differ diff --git a/code/utilities/bigWigMerge b/code/utilities/bigWigMerge new file mode 100755 index 0000000..febdd0f Binary files /dev/null and b/code/utilities/bigWigMerge differ diff --git a/code/utilities/bigWigToBedGraph b/code/utilities/bigWigToBedGraph new file mode 100755 index 0000000..adea2b9 Binary files /dev/null and b/code/utilities/bigWigToBedGraph differ diff --git a/code/utilities/bigWigToWig b/code/utilities/bigWigToWig new file mode 100755 index 0000000..bc556d9 Binary files /dev/null and b/code/utilities/bigWigToWig differ diff --git a/code/utilities/cpat.py b/code/utilities/cpat.py new file mode 120000 index 0000000..d687638 --- /dev/null +++ b/code/utilities/cpat.py @@ -0,0 +1 @@ +CPAT/bin/cpat.py \ No newline at end of file diff --git a/code/utilities/cufflinks b/code/utilities/cufflinks new file mode 120000 index 0000000..b90e2cc --- /dev/null +++ b/code/utilities/cufflinks @@ -0,0 +1 @@ +cufflinks-2.2.1.Linux_x86_64 \ No newline at end of file diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffcompare b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffcompare new file mode 100755 index 0000000..5deefa0 Binary files /dev/null and b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffcompare differ diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffdiff b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffdiff new file mode 100755 index 0000000..91c682f Binary files /dev/null and b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffdiff differ diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/cufflinks b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cufflinks new file mode 100755 index 0000000..d73ebcf Binary files /dev/null and b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cufflinks differ diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffmerge b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffmerge new file mode 100755 index 0000000..e12f232 --- /dev/null +++ b/code/utilities/cufflinks-2.2.1.Linux_x86_64/cuffmerge @@ -0,0 +1,580 @@ +#!/usr/bin/env python +# encoding: utf-8 +""" +cuffmerge.py + +Created by Cole Trapnell on 2011-03-17. +Copyright (c) 2011 Cole Trapnell. All rights reserved. +""" + +import sys +import getopt +from datetime import datetime, date, time +import shutil +import subprocess +import errno +import os +import tempfile +import warnings +import types + +help_message = ''' +cuffmerge takes two or more Cufflinks GTF files and merges them into a +single unified transcript catalog. Optionally, you can provide the script +with a reference GTF, and the script will use it to attach gene names and other +metadata to the merged catalog. + +Usage: + cuffmerge [Options] + +Options: + -h/--help Prints the help message and exits + -o Directory where merged assembly will be written [ default: ./merged_asm ] + -g/--ref-gtf An optional "reference" annotation GTF. + -s/--ref-sequence / Genomic DNA sequences for the reference. + --min-isoform-fraction <0-1.0> Discard isoforms with abundance below this [ default: 0.05 ] + -p/--num-threads Use this many threads to merge assemblies. [ default: 1 ] + --keep-tmp Keep all intermediate files during merge +''' + +output_dir = "./merged_asm/" +logging_dir = output_dir + "logs/" +run_log = None +run_cmd = None +tmp_dir = output_dir + "/tmp/" +bin_dir = sys.path[0] + "/" +run_meta_assembly = True +fail_str = "\t[FAILED]\n" +params = None + +class Usage(Exception): + def __init__(self, msg): + self.msg = msg + +class TestParams: + + class SystemParams: + def __init__(self, + threads, + keep_tmp): + self.threads = threads + self.keep_tmp = keep_tmp + + def parse_options(self, opts): + for option, value in opts: + if option in ("-p", "--num-threads"): + self.threads = int(value) + if option in ("--keep-tmp"): + self.keep_tmp = True + + def check(self): + pass + + def __init__(self): + self.system_params = self.SystemParams(1, # threads + False) # keep_tmp + self.ref_gtf = None + self.fasta = None + self.min_isoform_frac = 0.05 + + def check(self): + self.system_params.check() + + def parse_options(self, argv): + try: + opts, args = getopt.getopt(argv[1:], + "hvp:o:g:M:s:q:F:", + ["version", + "help", + "ref-sequence=", + "ref-gtf=", + "output-dir=", + "num-threads=", + "keep-tmp", + "min-isoform-fraction="]) + except getopt.error, msg: + raise Usage(msg) + + self.system_params.parse_options(opts) + + global output_dir + global logging_dir + global tmp_dir + + # option processing + for option, value in opts: + if option in ("-v", "--version"): + print "merge_cuff_asms v%s" % (get_version()) + exit(0) + if option in ("-h", "--help"): + raise Usage(help_message) + if option in ("-g", "--ref-gtf"): + self.ref_gtf = value + if option in ("-s", "--ref-sequence"): + self.fasta = value + if option in ("-F", "--min-isoform-fraction"): + self.min_isoform_frac = float(value) + if option in ("-o", "--output-dir"): + output_dir = value + "/" + logging_dir = output_dir + "logs/" + tmp_dir = output_dir + "tmp/" + + return args + + +def right_now(): + curr_time = datetime.now() + return curr_time.strftime("%c") + +def prepare_output_dir(): + + print >> sys.stderr, "[%s] Preparing output location %s" % (right_now(), output_dir) + if os.path.exists(output_dir): + pass + else: + os.makedirs(output_dir) + + #print >> sys.stderr, "Checking for %s", logging_dir + if os.path.exists(logging_dir): + pass + else: + #print >> sys.stderr, "Creating %s", logging_dir + os.makedirs(logging_dir) + + if os.path.exists(tmp_dir): + pass + else: + os.makedirs(tmp_dir) + +def formatTD(td): + hours = td.seconds // 3600 + minutes = (td.seconds % 3600) // 60 + seconds = td.seconds % 60 + return '%02d:%02d:%02d' % (hours, minutes, seconds) + +def tmp_name(prefix): + tmp_root = output_dir + "tmp/" + if os.path.exists(tmp_root): + pass + else: + os.mkdir(tmp_root) + return tmp_root + prefix + os.tmpnam().split('/')[-1] + +def cufflinks(out_dir, + sam_file, + min_isoform_frac, + gtf_file=None, + extra_opts=["-q", "--overhang-tolerance", "200", "--library-type=transfrags", "-A","0.0", "--min-frags-per-transfrag", "0", "--no-5-extend"], + lsf=False, + curr_queue=None): + if gtf_file != None: + print >> sys.stderr, "[%s] Quantitating transcripts" % (right_now()) + else: + print >> sys.stderr, "[%s] Assembling transcripts" % (right_now()) + + cmd = ["cufflinks"] + + if out_dir != None and out_dir != "": + cmd.extend(["-o", out_dir]) + + cmd.extend(["-F", str(min_isoform_frac)]) + + if gtf_file != None: + cmd.extend(["-g", gtf_file]) + + if extra_opts != None: + cmd.extend(extra_opts) + global params + # Run Cufflinks with more than one thread? + cmd.extend(["-p", str(params.system_params.threads)]) + + cmd.append(sam_file) + + try: + print >> run_log, " ".join(cmd) + ret = subprocess.call(cmd) + if ret != 0: + print >> sys.stderr, fail_str, "Error: could not execute cufflinks" + exit(1) + # cufflinks not found + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: cufflinks not found on this system. Did you forget to include it in your PATH?" + exit(1) + +def cuffcompare(prefix, ref_gtf, fasta, cuff_gtf): + + print >> sys.stderr, "[%s] Comparing reference %s to assembly %s" % (right_now(), ref_gtf, cuff_gtf) + cmd = ["cuffcompare"] + + if prefix != None: + cmd.extend(["-o", prefix]) + if ref_gtf != None: + cmd.extend(["-r", ref_gtf]) + if fasta != None: + cmd.extend(["-s", fasta]) + if type(cuff_gtf) == types.ListType: + for g in cuff_gtf: + cmd.extend([g]) + else: + cmd.extend([cuff_gtf]) + + try: + print >> run_log, " ".join(cmd) + ret = subprocess.call(cmd) + if ret != 0: + print >> sys.stderr, fail_str, "Error: could not execute cuffcompare" + exit(1) + # cuffcompare not found + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: cuffcompare not found on this system. Did you forget to include it in your PATH?" + exit(1) + +def gtf_to_sam(gtf_filename): + + sam_out = tmp_name("gtf2sam_") + + cmd = ["gtf_to_sam"] + cmd.append("-F") + cmd.append(gtf_filename) + cmd.append(sam_out) + try: + print >> run_log, " ".join(cmd) + ret = subprocess.call(cmd) + if ret != 0: + print >> sys.stderr, fail_str, "Error: could not execute gtf_to_sam" + exit(1) + # gtf_to_sam not found + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: gtf_to_sam not found on this system. Did you forget to include it in your PATH?" + exit(1) + return sam_out + +def test_input_files(filename_list): + """This function takes a file that contains a list of GTF files, + tests accessibility of each, and returns the list of filenames""" + + OK = True + input_files = [] + for line in filename_list: + line = line.strip() + + # Skip comment line + if len(line) == 0 or line[0] == "#": + continue + try: + g = open(line,"r") + input_files.append(line) + + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: could not open %s" % line + OK = False + if not OK: + sys.exit(1) + return input_files + +def convert_gtf_to_sam(gtf_filename_list): + """This function takes a list of GTF files, converts them all to + temporary SAM files, and returns the list of temporary file names.""" + print >> sys.stderr, "[%s] Converting GTF files to SAM" % (right_now()) + OK = True + sam_input_filenames = [] + for line in gtf_filename_list: + try: + sam_out = gtf_to_sam(line) + sam_input_filenames.append(sam_out) + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: could not open %s" % line + OK = False + if not OK: + sys.exit(1) + return sam_input_filenames + +def merge_sam_inputs(sam_input_list, header): + sorted_map_name = tmp_name( "mergeSam_") + + sorted_map = open(sorted_map_name, "w") + + #print header + + # The header was built from a dict keyed by chrom, so + # the records will be lexicographically ordered and + # should match the BAM after the sort below. + print >> sorted_map, header, + + sorted_map.close() + sort_cmd =["sort", + "-k", + "3,3", + "-k", + "4,4n", + "--temporary-directory="+tmp_dir] + sort_cmd.extend(sam_input_list) + + print >> run_log, " ".join(sort_cmd), ">", sorted_map_name + subprocess.call(sort_cmd, + stdout=open(sorted_map_name, "a")) + return sorted_map_name + +def compare_to_reference(meta_asm_gtf, ref_gtf, fasta): + print >> sys.stderr, "[%s] Comparing against reference file %s" % (right_now(), ref_gtf) + ref_str = "" + if ref_gtf != None: + ref_str = " -r %s " % ref_gtf + + if fasta != None: + comp_cmd = '''cuffcompare -o tmp_meta_asm -C -G %s -s %s %s''' % (ref_str, fasta, meta_asm_gtf) + else: + comp_cmd = '''cuffcompare -o tmp_meta_asm -C -G %s %s''' % (ref_str, meta_asm_gtf) + + #cmd = bsub_cmd(comp_cmd, "/gencode_cmp", True, job_mem=8) + cmd = comp_cmd + + try: + print >> run_log, cmd + ret = subprocess.call(cmd,shell=True) + if ret != 0: + print >> sys.stderr, fail_str, "Error: could not execute cuffcompare" + exit(1) + #tmap_out = meta_asm_gtf.split("/")[-1] + ".tmap" + tfpath, tfname = os.path.split(meta_asm_gtf) + if tfpath: tfpath+='/' + tmap_out = tfpath+'tmp_meta_asm.'+tfname+".tmap" + return tmap_out + # cuffcompare not found + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: cuffcompare not found on this system. Did you forget to include it in your PATH?" + exit(1) + +def select_gtf(gtf_in_filename, ids, gtf_out_filename): + f_gtf = open(gtf_in_filename) + #print >> sys.stderr, "Select GTF: Ids are: " + #print >> sys.stderr, ids + #print >> sys.stderr, "reference gtf file name:" + #print >> sys.stderr, gtf_in_filename + out_gtf = open(gtf_out_filename, "w") + for line in f_gtf: + line = line.strip() + cols = line.split('\t') + if len(cols) < 9: + continue + attrs = cols[8] + attr_cols = attrs.split(';') + for col in attr_cols: + if col.find("transcript_id") != -1: + first_quote = col.find('"') + last_quote = col.find('"', first_quote + 1) + transcript = col[first_quote + 1:last_quote] + #print >> sys.stderr, transcript + if transcript in ids: + print >> out_gtf, line + + +def merge_gtfs(gtf_filenames, merged_gtf, ref_gtf=None): + print >> sys.stderr, "[%s] Merging linc gtf files with cuffcompare" % (right_now()) + cmd = ["cuffcompare"] + + cmd.extend(["-o", merged_gtf]) + if ref_gtf != None: + cmd.extend(["-r", ref_gtf]) + + cmd.extend(gtf_filenames) + cmd = " ".join(cmd) + #cmd = bsub_cmd(cmd, "/merge_gtf", True, job_mem=8) + + try: + print >> run_log, cmd + ret = subprocess.call(cmd, shell=True) + if ret != 0: + print >> sys.stderr, fail_str, "Error: could not execute cuffcompare" + exit(1) + return merged_gtf + ".combined.gtf" + # cuffcompare not found + except OSError, o: + if o.errno == errno.ENOTDIR or o.errno == errno.ENOENT: + print >> sys.stderr, fail_str, "Error: cuffcompare not found on this system. Did you forget to include it in your PATH?" + exit(1) + +def compare_meta_asm_against_ref(ref_gtf, fasta_file, gtf_input_file, class_codes=["c", "i", "r", "p", "e"]): + #print >> sys.stderr, "Cuffcmpare all assemblies GTFs" + + tmap = compare_to_reference(gtf_input_file, ref_gtf, fasta_file) + + #print >> sys.stderr, "Cuffcmpare all assemblies GTFs : filter %s" % ",".join(class_codes) + selected_ids= set([]) + f_tmap = open(tmap) + #out = open("tmp_meta_asm_selectedIds.txt", "w") + for line in f_tmap: + line = line.strip() + cols = line.split('\t') + if len(cols) < 5: + continue + class_code = cols[2] + name = cols[4] + if class_code not in class_codes: + selected_ids.add(name) + + global output_dir + asm_dir = output_dir + + if os.path.exists(asm_dir): + pass + else: + os.mkdir(asm_dir) + current_asm_gtf = output_dir +"transcripts.gtf" + select_gtf(current_asm_gtf, selected_ids, output_dir + "/merged.gtf") + mtmap = compare_to_reference(output_dir + "/merged.gtf", ref_gtf, fasta_file) + if os.path.exists(mtmap): + os.remove(mtmap) + if os.path.exists(mtmap.split(".tmap")[0]+".refmap"): + os.remove(mtmap.split(".tmap")[0]+".refmap") + + shutil.move("tmp_meta_asm.combined.gtf", output_dir + "/merged.gtf") + +# os.remove("tmp_meta_asm.combined.gtf") + if os.path.exists("tmp_meta_asm.loci"): + os.remove("tmp_meta_asm.loci") + if os.path.exists("tmp_meta_asm.tracking"): + os.remove("tmp_meta_asm.tracking") + if os.path.exists("tmp_meta_asm.stats"): + os.remove("tmp_meta_asm.stats") + if os.path.exists(tmap): + os.remove(tmap) + if os.path.exists(tmap.split(".tmap")[0]+".refmap"): + os.remove(tmap.split(".tmap")[0]+".refmap") + #tmp_dir = asm_dir + #tmp_files = os.listdir(tmp_dir) + #for t in tmp_files: + # os.remove(tmp_dir+t) + #os.rmdir(tmp_dir) + +#os.remove("tmp_meta_asm.tmap") + +def get_version(): + return "1.0.0" + +def get_gtf_chrom_info(gtf_filename, known_chrom_info=None): + gtf_file = open(gtf_filename) + if known_chrom_info == None: + chroms = {} + else: + chroms = known_chrom_info + for line in gtf_file: + line = line.strip() + + if len(line) == 0 or line[0] == "#": + continue + cols = line.split('\t') + if len(cols) < 8: + continue + chrom = cols[0] + left = int(cols[3]) + right = int(cols[4]) + bounds = chroms.setdefault(chrom, [9999999999,-1]) + if bounds[0] > left: + bounds[0] = left + if bounds[1] < right: + bounds[1] = right + return chroms + +def header_for_chrom_info(chrom_info): + header_strs = ["""@HD\tVN:1.0\tSO:coordinate"""] + chrom_list = [(chrom, limits) for chrom, limits in chrom_info.iteritems()] + chrom_list.sort(lambda x,y: cmp(x[0],y[0])) + #print chrom_list + for chrom, limits in chrom_list: + line = "@SQ\tSN:%s\tLN:\t%d" % (chrom, limits[1]) + header_strs.append(line) + header_strs.append("@PG\tID:cuffmerge\tVN:1.0.0\n") + header = "\n".join(header_strs) + return header + +def main(argv=None): + + # Set this so sort is consistent across platforms and python versions + # (and always character-lexicographic) + os.environ['LC_ALL']='C' + warnings.filterwarnings("ignore", "tmpnam is a potential security risk") + global params + params = TestParams() + + try: + if argv is None: + argv = sys.argv + args = params.parse_options(argv) + params.check() + + if len(args) < 1: + raise(Usage(help_message)) + + global run_log + global run_cmd + + print >> sys.stderr + print >> sys.stderr, "[%s] Beginning transcriptome assembly merge" % (right_now()) + print >> sys.stderr, "-------------------------------------------" + print >> sys.stderr + + start_time = datetime.now() + prepare_output_dir() + + run_log = open(logging_dir + "run.log", "w", 0) + run_cmd = " ".join(argv) + print >> run_log, run_cmd + + transfrag_list_file = open(args[0], "r") + + if params.ref_gtf != None: + test_input_files([params.ref_gtf]) + else: + print >> sys.stderr, "Warning: no reference GTF provided!" + + # Check that all the primary assemblies are accessible before starting the time consuming stuff + gtf_input_files = test_input_files(transfrag_list_file) + + all_gtfs = [] + all_gtfs.extend(gtf_input_files) + if params.ref_gtf != None: + all_gtfs.append(params.ref_gtf) + chrom_info = {} + for gtf in all_gtfs: + chrom_info = get_gtf_chrom_info(gtf, chrom_info) + + header = header_for_chrom_info(chrom_info) + + #Meta assembly option: + global run_meta_assembly + if run_meta_assembly: + # Convert the primary assemblies to SAM format + sam_input_files = convert_gtf_to_sam(gtf_input_files) + # Merge the primary assembly SAMs into a single input SAM file + merged_sam_filename = merge_sam_inputs(sam_input_files, header) + # Run cufflinks on the primary assembly transfrags to generate a meta-assembly + cufflinks(output_dir, merged_sam_filename, params.min_isoform_frac, params.ref_gtf) + compare_meta_asm_against_ref(params.ref_gtf, params.fasta, output_dir+"/transcripts.gtf") + #Meta Cuffcompare option: + else: + cuffcompare_all_assemblies(gtf_input_files) #FIXME: where is this function ? + + + if not params.system_params.keep_tmp: + tmp_files = os.listdir(tmp_dir) + for t in tmp_files: + os.remove(tmp_dir+t) + os.rmdir(tmp_dir) + os.remove(output_dir + "/transcripts.gtf") + os.remove(output_dir + "/skipped.gtf") + os.remove(output_dir + "/genes.fpkm_tracking") + os.remove(output_dir + "/isoforms.fpkm_tracking") + except Usage, err: + print >> sys.stderr, sys.argv[0].split("/")[-1] + ": " + str(err.msg) + return 2 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/gffread b/code/utilities/cufflinks-2.2.1.Linux_x86_64/gffread new file mode 100755 index 0000000..2e442a5 Binary files /dev/null and b/code/utilities/cufflinks-2.2.1.Linux_x86_64/gffread differ diff --git a/code/utilities/cufflinks-2.2.1.Linux_x86_64/gtf_to_sam b/code/utilities/cufflinks-2.2.1.Linux_x86_64/gtf_to_sam new file mode 100755 index 0000000..fcffaed Binary files /dev/null and b/code/utilities/cufflinks-2.2.1.Linux_x86_64/gtf_to_sam differ diff --git a/code/utilities/fastqc b/code/utilities/fastqc new file mode 120000 index 0000000..a28acd0 --- /dev/null +++ b/code/utilities/fastqc @@ -0,0 +1 @@ +fastqc_v0.11.3/ \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Configuration/adapter_list.txt b/code/utilities/fastqc_v0.11.3/Configuration/adapter_list.txt new file mode 100755 index 0000000..76ac43b --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Configuration/adapter_list.txt @@ -0,0 +1,25 @@ +# This file contains a set of sequence fragments which will be explicitly +# searched against your library. The reporting will be similar to the +# Kmer plot, except that every sequence in this list will be shown so +# you can use this to judge the level of adapter read-through even if those +# adapter sequences aren't picked out by the Kmer module. +# +# Since every sequence here will be analysed and the results plotted it +# doesn't make any sense to include duplicate sequences, or to add too +# many sequences since your plot will end up a mess. +# +# You can add more sequences to the file by putting one line per entry +# and specifying a name[tab]sequence. If the contaminant you add is +# likely to be of use to others please consider sending it to the FastQ +# authors, either via a bug report at www.bioinformatics.babraham.ac.uk/bugzilla/ +# or by directly emailing simon.andrews@babraham.ac.uk so other users of +# the program can benefit. +# +# For the time being it's going to be easier to interpret this plot if all +# of the sequences provided are the same length, so we've gone with 12bp +# fragments for now. + +Illumina Universal Adapter AGATCGGAAGAG +Illumina Small RNA Adapter ATGGAATTCTCG +Nextera Transposase Sequence CTGTCTCTTATA +SOLID Small RNA Adapter CGCCTTGGCCGT \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Configuration/contaminant_list.txt b/code/utilities/fastqc_v0.11.3/Configuration/contaminant_list.txt new file mode 100755 index 0000000..b8eaf8b --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Configuration/contaminant_list.txt @@ -0,0 +1,182 @@ +# This file contains a list of potential contaminants which are +# frequently found in high throughput sequencing reactions. These +# are mostly sequences of adapters / primers used in the various +# sequencing chemistries. +# +# Please DO NOT rely on these sequences to design your own oligos, some +# of them are truncated at ambiguous positions, and none of them are +# definitive sequences from the manufacturers so don't blame us if you +# try to use them and they don't work. +# +# You can add more sequences to the file by putting one line per entry +# and specifying a name[tab]sequence. If the contaminant you add is +# likely to be of use to others please consider sending it to the FastQ +# authors, either via a bug report at www.bioinformatics.babraham.ac.uk/bugzilla/ +# or by directly emailing simon.andrews@babraham.ac.uk so other users of +# the program can benefit. + +Illumina Single End Adapter 1 GATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG +Illumina Single End Adapter 2 CAAGCAGAAGACGGCATACGAGCTCTTCCGATCT +Illumina Single End PCR Primer 1 AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Single End PCR Primer 2 CAAGCAGAAGACGGCATACGAGCTCTTCCGATCT +Illumina Single End Sequencing Primer ACACTCTTTCCCTACACGACGCTCTTCCGATCT + +Illumina Paired End Adapter 1 ACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Paired End Adapter 2 GATCGGAAGAGCGGTTCAGCAGGAATGCCGAG +Illumina Paried End PCR Primer 1 AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Paired End PCR Primer 2 CAAGCAGAAGACGGCATACGAGATCGGTCTCGGCATTCCTGCTGAACCGCTCTTCCGATCT +Illumina Paried End Sequencing Primer 1 ACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Paired End Sequencing Primer 2 CGGTCTCGGCATTCCTGCTGAACCGCTCTTCCGATCT + +Illumina DpnII expression Adapter 1 ACAGGTTCAGAGTTCTACAGTCCGAC +Illumina DpnII expression Adapter 2 CAAGCAGAAGACGGCATACGA +Illumina DpnII expression PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina DpnII expression PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina DpnII expression Sequencing Primer CGACAGGTTCAGAGTTCTACAGTCCGACGATC + +Illumina NlaIII expression Adapter 1 ACAGGTTCAGAGTTCTACAGTCCGACATG +Illumina NlaIII expression Adapter 2 CAAGCAGAAGACGGCATACGA +Illumina NlaIII expression PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina NlaIII expression PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina NlaIII expression Sequencing Primer CCGACAGGTTCAGAGTTCTACAGTCCGACATG + +Illumina Small RNA Adapter 1 GTTCAGAGTTCTACAGTCCGACGATC +Illumina Small RNA Adapter 2 TGGAATTCTCGGGTGCCAAGG +Illumina Small RNA RT Primer CAAGCAGAAGACGGCATACGA +Illumina Small RNA PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina Small RNA PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina Small RNA Sequencing Primer CGACAGGTTCAGAGTTCTACAGTCCGACGATC + +Illumina Multiplexing Adapter 1 GATCGGAAGAGCACACGTCT +Illumina Multiplexing Adapter 2 ACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Multiplexing PCR Primer 1.01 AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Multiplexing PCR Primer 2.01 GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT +Illumina Multiplexing Read1 Sequencing Primer ACACTCTTTCCCTACACGACGCTCTTCCGATCT +Illumina Multiplexing Index Sequencing Primer GATCGGAAGAGCACACGTCTGAACTCCAGTCAC +Illumina Multiplexing Read2 Sequencing Primer GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT + +Illumina PCR Primer Index 1 CAAGCAGAAGACGGCATACGAGATCGTGATGTGACTGGAGTTC +Illumina PCR Primer Index 2 CAAGCAGAAGACGGCATACGAGATACATCGGTGACTGGAGTTC +Illumina PCR Primer Index 3 CAAGCAGAAGACGGCATACGAGATGCCTAAGTGACTGGAGTTC +Illumina PCR Primer Index 4 CAAGCAGAAGACGGCATACGAGATTGGTCAGTGACTGGAGTTC +Illumina PCR Primer Index 5 CAAGCAGAAGACGGCATACGAGATCACTGTGTGACTGGAGTTC +Illumina PCR Primer Index 6 CAAGCAGAAGACGGCATACGAGATATTGGCGTGACTGGAGTTC +Illumina PCR Primer Index 7 CAAGCAGAAGACGGCATACGAGATGATCTGGTGACTGGAGTTC +Illumina PCR Primer Index 8 CAAGCAGAAGACGGCATACGAGATTCAAGTGTGACTGGAGTTC +Illumina PCR Primer Index 9 CAAGCAGAAGACGGCATACGAGATCTGATCGTGACTGGAGTTC +Illumina PCR Primer Index 10 CAAGCAGAAGACGGCATACGAGATAAGCTAGTGACTGGAGTTC +Illumina PCR Primer Index 11 CAAGCAGAAGACGGCATACGAGATGTAGCCGTGACTGGAGTTC +Illumina PCR Primer Index 12 CAAGCAGAAGACGGCATACGAGATTACAAGGTGACTGGAGTTC + +Illumina DpnII Gex Adapter 1 GATCGTCGGACTGTAGAACTCTGAAC +Illumina DpnII Gex Adapter 1.01 ACAGGTTCAGAGTTCTACAGTCCGAC +Illumina DpnII Gex Adapter 2 CAAGCAGAAGACGGCATACGA +Illumina DpnII Gex Adapter 2.01 TCGTATGCCGTCTTCTGCTTG +Illumina DpnII Gex PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina DpnII Gex PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina DpnII Gex Sequencing Primer CGACAGGTTCAGAGTTCTACAGTCCGACGATC + +Illumina NlaIII Gex Adapter 1.01 TCGGACTGTAGAACTCTGAAC +Illumina NlaIII Gex Adapter 1.02 ACAGGTTCAGAGTTCTACAGTCCGACATG +Illumina NlaIII Gex Adapter 2.01 CAAGCAGAAGACGGCATACGA +Illumina NlaIII Gex Adapter 2.02 TCGTATGCCGTCTTCTGCTTG +Illumina NlaIII Gex PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina NlaIII Gex PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina NlaIII Gex Sequencing Primer CCGACAGGTTCAGAGTTCTACAGTCCGACATG + +Illumina Small RNA RT Primer CAAGCAGAAGACGGCATACGA +Illumina 5p RNA Adapter GTTCAGAGTTCTACAGTCCGACGATC +Illumina RNA Adapter1 TGGAATTCTCGGGTGCCAAGG + +Illumina Small RNA 3p Adapter 1 ATCTCGTATGCCGTCTTCTGCTTG +Illumina Small RNA PCR Primer 1 CAAGCAGAAGACGGCATACGA +Illumina Small RNA PCR Primer 2 AATGATACGGCGACCACCGACAGGTTCAGAGTTCTACAGTCCGA +Illumina Small RNA Sequencing Primer CGACAGGTTCAGAGTTCTACAGTCCGACGATC + +TruSeq Universal Adapter AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT +TruSeq Adapter, Index 1 GATCGGAAGAGCACACGTCTGAACTCCAGTCACATCACGATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 2 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCGATGTATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 3 GATCGGAAGAGCACACGTCTGAACTCCAGTCACTTAGGCATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 4 GATCGGAAGAGCACACGTCTGAACTCCAGTCACTGACCAATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 5 GATCGGAAGAGCACACGTCTGAACTCCAGTCACACAGTGATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 6 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGCCAATATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 7 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCAGATCATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 8 GATCGGAAGAGCACACGTCTGAACTCCAGTCACACTTGAATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 9 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGATCAGATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 10 GATCGGAAGAGCACACGTCTGAACTCCAGTCACTAGCTTATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 11 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGGCTACATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 12 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCTTGTAATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 13 GATCGGAAGAGCACACGTCTGAACTCCAGTCACAGTCAACTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 14 GATCGGAAGAGCACACGTCTGAACTCCAGTCACAGTTCCGTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 15 GATCGGAAGAGCACACGTCTGAACTCCAGTCACATGTCAGTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 16 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCCGTCCCTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 18 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGTCCGCATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 19 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGTGAAACTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 20 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGTGGCCTTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 21 GATCGGAAGAGCACACGTCTGAACTCCAGTCACGTTTCGGTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 22 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCGTACGTTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 23 GATCGGAAGAGCACACGTCTGAACTCCAGTCACCGTACGTTCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 25 GATCGGAAGAGCACACGTCTGAACTCCAGTCACACTGATATCTCGTATGCCGTCTTCTGCTTG +TruSeq Adapter, Index 27 GATCGGAAGAGCACACGTCTGAACTCCAGTCACATTCCTTTCTCGTATGCCGTCTTCTGCTTG + +Illumina RNA RT Primer GCCTTGGCACCCGAGAATTCCA +Illumina RNA PCR Primer AATGATACGGCGACCACCGAGATCTACACGTTCAGAGTTCTACAGTCCGA + +RNA PCR Primer, Index 1 CAAGCAGAAGACGGCATACGAGATCGTGATGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 2 CAAGCAGAAGACGGCATACGAGATACATCGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 3 CAAGCAGAAGACGGCATACGAGATGCCTAAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 4 CAAGCAGAAGACGGCATACGAGATTGGTCAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 5 CAAGCAGAAGACGGCATACGAGATCACTGTGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 6 CAAGCAGAAGACGGCATACGAGATATTGGCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 7 CAAGCAGAAGACGGCATACGAGATGATCTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 8 CAAGCAGAAGACGGCATACGAGATTCAAGTGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 9 CAAGCAGAAGACGGCATACGAGATCTGATCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 10 CAAGCAGAAGACGGCATACGAGATAAGCTAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 11 CAAGCAGAAGACGGCATACGAGATGTAGCCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 12 CAAGCAGAAGACGGCATACGAGATTACAAGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 13 CAAGCAGAAGACGGCATACGAGATTTGACTGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 14 CAAGCAGAAGACGGCATACGAGATGGAACTGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 15 CAAGCAGAAGACGGCATACGAGATTGACATGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 16 CAAGCAGAAGACGGCATACGAGATGGACGGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 17 CAAGCAGAAGACGGCATACGAGATCTCTACGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 18 CAAGCAGAAGACGGCATACGAGATGCGGACGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 19 CAAGCAGAAGACGGCATACGAGATTTTCACGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 20 CAAGCAGAAGACGGCATACGAGATGGCCACGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 21 CAAGCAGAAGACGGCATACGAGATCGAAACGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 22 CAAGCAGAAGACGGCATACGAGATCGTACGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 23 CAAGCAGAAGACGGCATACGAGATCCACTCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 24 CAAGCAGAAGACGGCATACGAGATGCTACCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 25 CAAGCAGAAGACGGCATACGAGATATCAGTGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 26 CAAGCAGAAGACGGCATACGAGATGCTCATGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 27 CAAGCAGAAGACGGCATACGAGATAGGAATGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 28 CAAGCAGAAGACGGCATACGAGATCTTTTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 29 CAAGCAGAAGACGGCATACGAGATTAGTTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 30 CAAGCAGAAGACGGCATACGAGATCCGGTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 31 CAAGCAGAAGACGGCATACGAGATATCGTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 32 CAAGCAGAAGACGGCATACGAGATTGAGTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 33 CAAGCAGAAGACGGCATACGAGATCGCCTGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 34 CAAGCAGAAGACGGCATACGAGATGCCATGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 35 CAAGCAGAAGACGGCATACGAGATAAAATGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 36 CAAGCAGAAGACGGCATACGAGATTGTTGGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 37 CAAGCAGAAGACGGCATACGAGATATTCCGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 38 CAAGCAGAAGACGGCATACGAGATAGCTAGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 39 CAAGCAGAAGACGGCATACGAGATGTATAGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 40 CAAGCAGAAGACGGCATACGAGATTCTGAGGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 41 CAAGCAGAAGACGGCATACGAGATGTCGTCGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 42 CAAGCAGAAGACGGCATACGAGATCGATTAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 43 CAAGCAGAAGACGGCATACGAGATGCTGTAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 44 CAAGCAGAAGACGGCATACGAGATATTATAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 45 CAAGCAGAAGACGGCATACGAGATGAATGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 46 CAAGCAGAAGACGGCATACGAGATTCGGGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 47 CAAGCAGAAGACGGCATACGAGATCTTCGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA +RNA PCR Primer, Index 48 CAAGCAGAAGACGGCATACGAGATTGCCGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA + +ABI Dynabead EcoP Oligo CTGATCTAGAGGTACCGGATCCCAGCAGT +ABI Solid3 Adapter A CTGCCCCGGGTTCCTCATTCTCTCAGCAGCATG +ABI Solid3 Adapter B CCACTACGCCTCCGCTTTCCTCTCTATGGGCAGTCGGTGAT +ABI Solid3 5' AMP Primer CCACTACGCCTCCGCTTTCCTCTCTATG +ABI Solid3 3' AMP Primer CTGCCCCGGGTTCCTCATTCT +ABI Solid3 EF1 alpha Sense Primer CATGTGTGTTGAGAGCTTC +ABI Solid3 EF1 alpha Antisense Primer GAAAACCAAAGTGGTCCAC +ABI Solid3 GAPDH Forward Primer TTAGCACCCCTGGCCAAGG +ABI Solid3 GAPDH Reverse Primer CTTACTCCTTGGAGGCCATG diff --git a/code/utilities/fastqc_v0.11.3/Configuration/limits.txt b/code/utilities/fastqc_v0.11.3/Configuration/limits.txt new file mode 100755 index 0000000..1b8415a --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Configuration/limits.txt @@ -0,0 +1,84 @@ +# For each of the modules you can choose to not run that +# module at all by setting the value below to 1 for the +# modules you want to remove. +duplication ignore 0 +kmer ignore 0 +n_content ignore 0 +overrepresented ignore 0 +quality_base ignore 0 +sequence ignore 0 +gc_sequence ignore 0 +quality_sequence ignore 0 +tile ignore 0 +sequence_length ignore 0 +adapter ignore 0 + +# For the duplication module the value is the percentage +# remaining after deduplication. Measured levels below +# these limits trigger the warning / error. +duplication warn 70 +duplication error 50 + +# For the kmer module the filter is on the -log10 binomial +# pvalue for the most significant Kmer, so 5 would be +# 10^-5 = p<0.00001 +kmer warn 2 +kmer error 5 + +# For the N module the filter is on the percentage of Ns +# at any position in the library +n_content warn 5 +n_content error 20 + +# For the overrepresented seqs the warn value sets the +# threshold for the overrepresented sequences to be reported +# at all as the proportion of the library which must be seen +# as a single sequence +overrepresented warn 0.1 +overrepresented error 1 + +# The per base quality filter uses two values, one for the value +# of the lower quartile, and the other for the value of the +# median quality. Failing either of these will trigger the alert +quality_base_lower warn 10 +quality_base_lower error 5 +quality_base_median warn 25 +quality_base_median error 20 + +# The per base sequence content module tests the maximum deviation +# between A and T or C and G +sequence warn 10 +sequence error 20 + +# The per sequence GC content tests the maximum deviation between +# the theoretical distribution and the real distribution +gc_sequence warn 15 +gc_sequence error 30 + +# The per sequence quality module tests the phred score which is +# most frequently observed +quality_sequence warn 27 +quality_sequence error 20 + +# The per tile module tests the maximum phred score loss between +# and individual tile and the average for that base across all tiles +tile warn 5 +tile error 10 + +# The sequence length module tests are binary, so the values here +# simply turn them on or off. The actual tests warn if you have +# sequences of different length, and error if you have sequences +# of zero length. + +sequence_length warn 1 +sequence_length error 1 + +# The adapter module's warnings and errors are based on the +# percentage of reads in the library which have been observed +# to contain an adapter associated Kmer at any point + +adapter warn 5 +adapter error 10 + + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Help/1 Introduction/1.1 What is FastQC.html b/code/utilities/fastqc_v0.11.3/Help/1 Introduction/1.1 What is FastQC.html new file mode 100755 index 0000000..a124ff3 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/1 Introduction/1.1 What is FastQC.html @@ -0,0 +1,36 @@ + + + +What is FastQC? + + + +

What is FastQC

+

+Modern high throughput sequencers can generate hundreds of millions of sequences +in a single run. Before analysing this sequence to draw biological conclusions +you should always perform some simple quality control checks to ensure that +the raw data looks good and there are no problems or biases in your data which +may affect how you can usefully use it. +

+

+Most sequencers will generate a QC report as part of their analysis pipeline, +but this is usually only focused on identifying problems which were generated +by the sequencer itself. FastQC aims to provide a QC report which can spot +problems which originate either in the sequencer or in the starting library +material. +

+

+FastQC can be run in one of two modes. It can either run as a stand alone +interactive application for the immediate analysis of small numbers of FastQ +files, or it can be run in a non-interactive mode where it would be suitable +for integrating into a larger analysis pipeline for the systematic processing + of large numbers of files. +

+ + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.1 Opening a sequence file.html b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.1 Opening a sequence file.html new file mode 100755 index 0000000..993e802 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.1 Opening a sequence file.html @@ -0,0 +1,63 @@ + + + +Opening a FastQ file + + + +

Opening a Sequence file

+

+To open one or more Sequence files interactively simply run the +program and select File > Open. You can then select the files +you want to analyse. +

+

+ Newly opened files will immediately appear in the set of tabs + at the top of the screen. Because of the size of these files + it can take a couple of minutes to open them. FastQC operates + a queueing system where only one file is opened at a time, and + new files will wait until existing files have been processed. +

+

+ FastQC supports files in the following formats +

+
    +
  • FastQ (all quality encoding variants)
  • +
  • Casava FastQ files*
  • +
  • Colorspace FastQ
  • +
  • GZip compressed FastQ
  • +
  • SAM
  • +
  • BAM
  • +
  • SAM/BAM Mapped only (normally used for colorspace data)
  • +
+ +

+ * Casava fastq format is the same as regular fastq except that + the data is usually split across multiple files for a single sample. + In this mode the program will merge the files in a sample group and + present a single report for each sample. Also Casava fastq files + contain poor quality sequences which have been flagged to be remove. + In Casava mode the program will exclude these flagged sequences from + the report. +

+ +

+ By default FastQC will try to guess the file format from the name + of the input file. Anything ending in .sam or .bam will be + opened as a SAM/BAM file (using all sequences, mapped and unmapped) + , and everything else will be treated as FastQ format. If you want + to override this detection and specify the file format manually + then you can use the drop down file filter in the file chooser to + select the type of file you're going to load. You need to use the + drop down selector to make the program use the Mapped BAM or Casava + file modes as these won't be selected automatically. +

+ + + + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.2 Evaluating Results.html b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.2 Evaluating Results.html new file mode 100755 index 0000000..c9ff2d9 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.2 Evaluating Results.html @@ -0,0 +1,37 @@ + + + +Evaluating Results + + + +

Evaluating Results

+

+The analysis in FastQC is performed by a series of analysis +modules. The left hand side of the main interactive display +or the top of the HTML report show a summary of the modules +which were run, and a quick evaluation of whether the results +of the module seem entirely normal (green tick), slightly +abnormal (orange triangle) or very unusual (red cross). +

+

+It is important to stress that although the analysis results +appear to give a pass/fail result, these evaluations must be +taken in the context of what you expect from your library. A +'normal' sample as far as FastQC is concerned is random and +diverse. Some experiments may be expected to produce libraries +which are biased in particular ways. You should treat the +summary evaluations therefore as pointers to where you should +concentrate your attention and understand why your library +may not look random and diverse. +

+

+Specific guidance on how to interpret the output of each +module can be found in the modules section of the help. +

+ + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.3 Saving a Report.html b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.3 Saving a Report.html new file mode 100755 index 0000000..4d01778 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/2 Basic Operations/2.3 Saving a Report.html @@ -0,0 +1,39 @@ + + + +Saving a Report + + + +

Saving a Report

+

+In addition to providing an interactive report FastQC also +has the option to create an HTML version of this report +for a more permanent record. This HTML report can also +be generated directly by running FastQC in non-interactive +mode. +

+

+To create a report simply select File > Save Report from +the main menu. By default a report will be created using +the name of the fastq file with _fastqc.html appended to the +end. The report will be created for whichever file tab +was active when the menu option was selected. +

+

+The HTML file which is saved is a self-contained document with +all of the graphs embedded into it, so you can distribute this +single file. Alongside the HTML file is a zip file (with the +same name as the HTML file, but with .zip added to the end). +This file contains the graphs from the report as separate files +but also contains data files which are designed to be easily +parsed to allow for a more detailed and automated evauation of +the raw data on which the QC report is built. +

+ + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/1 Basic Statistics.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/1 Basic Statistics.html new file mode 100755 index 0000000..76766aa --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/1 Basic Statistics.html @@ -0,0 +1,58 @@ + + + +Basic Statistics + + + +

Basic Statistics

+

Summary

+

+The Basic Statistics module generates some simple composition +statistics for the file analysed. +

+ +
    +
  • Filename: The original filename of the file which was analysed
  • +
  • File type: Says whether the file appeared to contain actual base calls or +colorspace data which had to be converted to base calls
  • +
  • Encoding: Says which ASCII encoding of quality values was found in this +file. +
  • Total Sequences: A count of the total number of sequences processed. +There are two values reported, actual and estimated. At the moment these +will always be the same. In the future it may be possible to analyse just +a subset of sequences and estimate the total number, to speed up the analysis, +but since we have found that problematic sequences are not evenly distributed +through a file we have disabled this for now.
  • +
  • Filtered Sequences: If running in Casava mode sequences flagged to be +filtered will be removed from all analyses. The number of such sequences +removed will be reported here. The total sequences count above will not include +these filtered sequences and will the number of sequences actually used for the +rest of the analysis.
  • +
  • Sequence Length: Provides the length of the shortest and longest sequence +in the set. If all sequences are the same length only one value is reported. +
  • +
  • %GC: The overall %GC of all bases in all sequences
  • +
+ +

Warning

+

+Basic Statistics never raises a warning. +

+ +

Failure

+

+Basic Statistics never raises an error. +

+ +

Common reasons for warnings

+

+This module never raises warnings or errors +

+ + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/10 Adapter Content.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/10 Adapter Content.html new file mode 100755 index 0000000..6ebfe47 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/10 Adapter Content.html @@ -0,0 +1,69 @@ + + + +Adapter Content + + + +

Adapter Content

+

Summary

+

+The Kmer Content module will do a generic analysis of all of the Kmers +in your library to find those which do not have even coverage through +the length of your reads. This can find a number of different sources +of bias in the library which can include the presence of read-through +adapter sequences building up on the end of your sequences. +

+

+You can however find that the presence of any overrepresented sequences +in your library (such as adapter dimers) will cause the Kmer plot to +be dominated by the Kmers these sequences contain, and that it's not +always easy to see if there are other biases present in which you might +be interested. +

+

+One obvious class of sequences which you might want to analyse are +adapter sequences. It is useful to know if your library contains a +significant amount of adapter in order to be able to assess whether +you need to adapter trim or not. Although the Kmer analysis can +theoretically spot this kind of contamination it isn't always clear. +This module therefore does a specific search for a set of separately +defined Kmers and will give you a view of the total proportion of your +library which contain these Kmers. A results trace will always be +generated for all of the sequences present in the adapter config file +so you can see the adapter content of your library, even if it's low. +

+

+The plot itself shows a cumulative percentage count of the proportion +of your library which has seen each of the adapter sequences at each +position. Once a sequence has been seen in a read it is counted as +being present right through to the end of the read so the percentages +you see will only increase as the read length goes on. +

+ +

Warning

+

+This module will issue a warning if any sequence is present in more +than 5% of all reads. +

+ +

Failure

+

+This module will issue a warning if any sequence is present in more +than 10% of all reads. +

+ +

Common reasons for warnings

+

+Any library where a reasonable proportion of the insert sizes are shorter +than the read length will trigger this module. This doesn't indicate a +problem as such - just that the sequences will need to be adapter trimmed +before proceeding with any downstream analysis. +

+ + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/11 Kmer Content.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/11 Kmer Content.html new file mode 100755 index 0000000..b2b2a82 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/11 Kmer Content.html @@ -0,0 +1,77 @@ + + + +Kmer Content + + + +

Kmer Content

+

Summary

+

+The analysis of overrepresented sequences will spot an increase in +any exactly duplicated sequences, but there are a different subset +of problems where it will not work. +

+
    +
  • If you have very long sequences with poor sequence quality then +random sequencing errors will dramatically reduce the counts for +exactly duplicated sequences. +
  • +
  • If you have a partial sequence which is appearing at a variety +of places within your sequence then this won't be seen either by the +per base content plot or the duplicate sequence analysis. +
  • +
+ +

+The Kmer module starts from the assumption that any small fragment +of sequence should not have a positional bias in its apearance within +a diverse library. There may be biological reasons why certain Kmers +are enriched or depleted overall, but these biases should affect all +positions within a sequence equally. This module therefore measures the +number of each 7-mer at each position in your library and then uses +a binomial test to look for significant deviations from an even +coverage at all positions. Any Kmers with positionally biased enrichment +are reported. The top 6 most biased Kmer are additionally plotted to +show their distribution. +

+

Kmer profiles

+

+To allow this module to run in a reasonable time only 2% of the whole +library is analysed and the results are extrapolated to the rest of +the library. Sequences longer than 500bp are truncated to 500bp for +this analysis. +

+ +

Warning

+

+This module will issue a warning if any k-mer is imbalanced with a binomial +p-value <0.01. +

+ +

Failure

+

+This module will issue a warning if any k-mer is imbalanced with a binomial +p-value < 10^-5. +

+ +

Common reasons for warnings

+

+Any individually overrepresented sequences, even if not present at a high enough +threshold to trigger the overrepresented sequences module will cause the Kmers from +those sequences to be highly enriched in this module. These will normally appear +as sharp spikes of enrichemnt at a single point in the sequence, rather than a +progressive or broad enrichment. +

+

+Libraries which derive from random priming will nearly always show Kmer bias at +the start of the library due to an incomplete sampling of the possible random +primers. +

+ + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/12 Per Tile Sequence Quality.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/12 Per Tile Sequence Quality.html new file mode 100755 index 0000000..7e1521a --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/12 Per Tile Sequence Quality.html @@ -0,0 +1,66 @@ + + + +Per Tile Sequence Quality + + + +

Per Tile Sequence Quality

+

Summary

+

+This graph will only appear in your analysis results if you're using +an Illumina library which retains its original sequence identifiers. +Encoded in these is the flowcell tile from which each read came. The +graph allows you to look at the quality scores from each tile across +all of your bases to see if there was a loss in quality associated +with only one part of the flowcell. +

+

+The plot shows the deviation from the average quality for each tile. +The colours are on a cold to hot scale, with cold colours being +positions where the quality was at or below the average for that +base in the run, and hotter colours indicate that a tile had worse +qualities than other tiles for that base. In the example below you +can see that certain tiles show consistently poor quality. A good +plot should be blue all over. +

+

Kmer profiles

+

+Reasons for seeing warnings or errors on this plot could be transient +problems such as bubbles going through the flowcell, or they could +be more permanent problems such as smudges on the flowcell or debris +inside the flowcell lane. +

+ +

Warning

+

+This module will issue a warning if any tile shows a mean Phred +score more than 2 less than the mean for that base across all +tiles. +

+ +

Failure

+

+This module will issue a warning if any tile shows a mean Phred +score more than 5 less than the mean for that base across all +tiles. +

+ +

Common reasons for warnings

+

+Whilst warnings in this module can be triggered by individual specific +events we have also observed that greater variation in the phred +scores attributed to tiles can also appear when a flowcell is generally +overloaded. In this case events appear all over the flowcell rather +than being confined to a specific area or range of cycles. We would +generally ignore errors which mildly affected a small number of tiles for +only 1 or 2 cycles, but would pursue larger effects which showed high +deviation in scores, or which persisted for several cycles. +

+ + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/2 Per Base Sequence Quality.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/2 Per Base Sequence Quality.html new file mode 100755 index 0000000..45771e2 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/2 Per Base Sequence Quality.html @@ -0,0 +1,95 @@ + + + +Per Base Sequence Quality + + + +

Per Base Sequence Quality

+

Summary

+

+This view shows an overview of the range of quality values across all bases +at each position in the FastQ file. +

+

+

+For each position a BoxWhisker type plot is drawn. The elements of the +plot are as follows: +

+
    +
  • The central red line is the median value
  • +
  • The yellow box represents the inter-quartile range (25-75%)
  • +
  • The upper and lower whiskers represent the 10% and 90% points
  • +
  • The blue line represents the mean quality
  • +
+

+The y-axis on the graph shows the quality scores. The higher the score +the better the base call. The background of the graph divides the +y axis into very good quality calls (green), calls of reasonable quality +(orange), and calls of poor quality (red). The quality of calls on most +platforms will degrade as the run progresses, so it is common to see +base calls falling into the orange area towards the end of a read. +

+

+It should be mentioned that there are number of different ways to encode +a quality score in a FastQ file. FastQC attempts to automatically determine +which encoding method was used, but in some very limited datasets it is +possible that it will guess this incorrectly (ironically only when your +data is universally very good!). The title of the graph will describe the +encoding FastQC thinks your file used. +

+

+Results from this module will not be displayed if your input is a BAM/SAM +file in which quality scores have not been recorded. +

+ + +

Warning

+

+A warning will be issued if the lower quartile for any base is less +than 10, or if the median for any base is less than 25. +

+ +

Failure

+

+This module will raise a failure if the lower quartile for any base is +less than 5 or if the median for any base is less than 20. +

+ +

Common reasons for warnings

+

+The most common reason for warnings and failures in this module is a general +degradation of quality over the duration of long runs. In general sequencing +chemistry degrades with increasing read length and for long runs you may find +that the general quality of the run falls to a level where a warning or error +is triggered. +

+

+If the quality of the library falls to a low level then the most common remedy +is to perform quality trimming where reads are truncated based on their average +quality. For most libraries where this type of degradation has occurred you +will often be simultaneously running into the issue of adapter read-through so +a combined adapter and quality trimming step is often employed. +

+

+Another possibility is that a warn / error is triggered because of a short loss +of quality earlier in the run, which then recovers to produce later good +quality sequence. This can happen if there is a transient problem with the run +(bubbles passing through a flowcell for example). You can normally see this +type of error by looking at the per-tile quality plot (if available for your +platform). In these cases trimming is not advisable as it will remove later +good sequence, but you might want to consider masking bases during subsequent +mapping or assembly. +

+

+If your library has reads of varying length then you can find a warning or error +is triggered from this module because of very low coverage for a given base range. +Before committing to any action, check how many sequences were responsible for +triggering an error by looking at the sequence length distribution module results. +

+ + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/3 Per Sequence Quality Scores.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/3 Per Sequence Quality Scores.html new file mode 100755 index 0000000..7dc9ac7 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/3 Per Sequence Quality Scores.html @@ -0,0 +1,58 @@ + + + +Per Sequence Quality Scores + + + +

Per Sequence Quality Scores

+

Summary

+

+The per sequence quality score report allows you to see if a subset +of your sequences have universally low quality values. It is often +the case that a subset of sequences will have universally poor quality, +often because they are poorly imaged (on the edge of the field of view +etc), however these should represent only a small percentage of the total +sequences. +

+

+

+If a significant proportion of the sequences in a run have overall low +quality then this could indicate some kind of systematic problem - possibly +with just part of the run (for example one end of a flowcell). +

+ +

+Results from this module will not be displayed if your input is a BAM/SAM +file in which quality scores have not been recorded. +

+ + +

Warning

+

+A warning is raised if the most frequently observed mean quality is below 27 - +this equates to a 0.2% error rate. +

+ +

Failure

+

+An error is raised if the most frequently observed mean quality is below 20 - +this equates to a 1% error rate. +

+ +

Common reasons for warnings

+

+This module is generally fairly robust and errors here usually indicate a general +loss of quality within a run. For long runs this may be alleviated through quality +trimming. If a bi-modal, or complex distribution is seen then the results should +be evaluated in concert with the per-tile qualities (if available) since this might +indicate the reason for the loss in quality of a subset of sequences. +

+ + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/4 Per Base Sequence Content.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/4 Per Base Sequence Content.html new file mode 100755 index 0000000..bae1142 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/4 Per Base Sequence Content.html @@ -0,0 +1,85 @@ + + + +Per Base Sequence Content + + + +

Per Base Sequence Content

+

Summary

+

+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. +

+

+

+In a random library you would expect that there would be little +to no difference between the different bases of a sequence run, so +the lines in this plot should run parallel with each other. The +relative amount of each base should reflect the overall amount of +these bases in your genome, but in any case they should not be +hugely imbalanced from each other. +

+

+It's worth noting that some types of library will always produce biased +sequence composition, normally at the start of the read. Libraries +produced by priming using random hexamers (including nearly all RNA-Seq libraries) +and those which were fragmented using transposases inherit an intrinsic +bias in the positions at which reads start. This bias does not concern +an absolute sequence, but instead provides enrichement of a number of +different K-mers at the 5' end of the reads. Whilst this is a true +technical bias, it isn't something which can be corrected by trimming +and in most cases doesn't seem to adversely affect the downstream analysis. +It will however produce a warning or error in this module. +

+ +

Warning

+

+This module issues a warning if the difference between A and T, or G +and C is greater than 10% in any position. +

+ +

Failure

+

+This module will fail if the difference between A and T, or G and C +is greater than 20% in any position. +

+ +

Common reasons for warnings

+

+There are a number of common scenarios which would ellicit a warning +or error from this module. +

+ +
    +
  1. Overrepresented sequences: If there is any evidence of overrepresented +sequences such as adapter dimers or rRNA in a sample then these sequences +may bias the overall composition and their sequence will emerge from this plot. +
  2. Biased fragmentation: Any library which is generated based on the ligation +of random hexamers or through tagmentation should theoretically have good +diversity through the sequence, but experience has shown that these libraries +always have a selection bias in around the first 12bp of each run. This is +due to a biased selection of random primers, but doesn't represent any individually +biased sequences. Nearly all RNA-Seq libraries will fail this module because of +this bias, but this is not a problem which can be fixed by processing, and it +doesn't seem to adversely affect the ablity to measure expression. +
  3. Biased composition libraries: Some libraries are inherently biased in their +sequence composition. The most obvious example would be a library which has been +treated with sodium bisulphite which will then have converted most of the cytosines +to thymines, meaning that the base composition will be almost devoid of cytosines +and will thus trigger an error, despite this being entirely normal for that type of +library
  4. +
  5. If you are analysing a library which has been aggressivley adapter trimmed +then you will naturally introduce a composition bias at the end of the reads as +sequences which happen to match short stretches of adapter are removed, leaving +only sequences which do not match. Sudden deviations in composition at the end +of libraries which have undergone aggressive trimming are therefore likely to be +spurious.
  6. + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/5 Per Sequence GC Content.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/5 Per Sequence GC Content.html new file mode 100755 index 0000000..db6f594 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/5 Per Sequence GC Content.html @@ -0,0 +1,63 @@ + + + +Per Sequence GC Content + + + +

    Per Sequence GC Content

    +

    Summary

    +

    +This module measures the GC content across the whole length +of each sequence in a file and compares it to a modelled +normal distribution of GC content. +

    + +

    + +

    +In a normal random library you would expect to see a roughly +normal distribution of GC content where the central peak +corresponds to the overall GC content of the underlying genome. +Since we don't know the the GC content of the genome the modal +GC content is calculated from the observed data and used to +build a reference distribution. +

    + +

    +An unusually shaped distribution could indicate a contaminated +library or some other kinds of biased subset. A normal distribution +which is shifted indicates some systematic bias which is independent +of base position. If there is a systematic bias which creates a +shifted normal distribution then this won't be flagged as an error +by the module since it doesn't know what your genome's GC content +should be. +

    + +

    Warning

    +

    +A warning is raised if the sum of the deviations from the normal +distribution represents more than 15% of the reads. +

    + +

    Failure

    +

    +This module will indicate a failure if the sum of the deviations from +the normal distribution represents more than 30% of the reads. +

    + +

    Common reasons for warnings

    +

    +Warnings in this module usually indicate a problem with the library. Sharp +peaks on an otherwise smooth distribution are normally the result of a specific +contaminant (adapter dimers for example), which may well be picked up by the +overrepresented sequences module. Broader peaks may represent contamination +with a different species. +

    + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/6 Per Base N Content.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/6 Per Base N Content.html new file mode 100755 index 0000000..443a119 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/6 Per Base N Content.html @@ -0,0 +1,60 @@ + + + +Per Base N Content + + + +

    Per Base N Content

    +

    Summary

    +

    +If a sequencer is unable to make a base call with sufficient confidence +then it will normally substitute an N rather than a conventional base] +call +

    +

    +This module plots out the percentage of base calls at each position for +which an N was called. +

    +

    + +

    +It's not unusual to see a very low proportion of Ns appearing in a sequence, +especially nearer the end of a sequence. However, if this proportion rises +above a few percent it suggests that the analysis pipeline was unable to +interpret the data well enough to make valid base calls. +

    + +

    Warning

    +

    +This module raises a warning if any position shows an N content of >5%. +

    + +

    Failure

    +

    +This module will raise an error if any position shows an N content of >20%. +

    + +

    Common reasons for warnings

    +

    +The most common reason for the inclusion of significant proportions of Ns +is a general loss of quality, so the results of this module should be evaluated +in concert with those of the various quality modules. You should check the +coverage of a specific bin, since it's possible that the last bin in this analysis +could contain very few sequences, and an error could be prematurely triggered in +this case. +

    +

    +Another common scenario is the incidence of a high proportions of N at a small +number of positions early in the library, against a background of generally +good quality. Such deviations can occur when you have very biased sequence +composition in the library to the point that base callers can become confused +and make poor calls. This type of problem will be apparent when looking at the +per-base sequence content results. +

    + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/7 Sequence Length Distribution.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/7 Sequence Length Distribution.html new file mode 100755 index 0000000..27bbbb9 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/7 Sequence Length Distribution.html @@ -0,0 +1,49 @@ + + + +Sequence Length Distribution + + + +

    Sequence Length Distribution

    +

    Summary

    +

    +Some high throughput sequencers generate sequence fragments +of uniform length, but others can contain reads of wildly +varying lengths. Even within uniform length libraries some +pipelines will trim sequences to remove poor quality base calls +from the end. +

    +

    +This module generates a graph showing the distribution of fragment +sizes in the file which was analysed. +

    +

    +

    +In many cases this will produce a simple graph showing a peak only +at one size, but for variable length FastQ files this will show the +relative amounts of each different size of sequence fragment. +

    + +

    Warning

    +

    +This module will raise a warning if all sequences are not the same length. +

    + +

    Failure

    +

    +This module will raise an error if any of the sequences have zero length. +

    + +

    Common reasons for warnings

    +

    +For some sequencing platforms it is entirely normal to have different read +lengths so warnings here can be ignored. +

    + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/8 Duplicate Sequences.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/8 Duplicate Sequences.html new file mode 100755 index 0000000..72e630c --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/8 Duplicate Sequences.html @@ -0,0 +1,126 @@ + + + +Duplicate Sequences + + + +

    Duplicate Sequences

    +

    Summary

    +

    +In a diverse library most sequences will occur only once in the final +set. A low level of duplication may indicate a very high level of +coverage of the target sequence, but a high level of duplication is +more likely to indicate some kind of enrichment bias (eg PCR over +amplification). +

    +

    +This module counts the degree of duplication for every sequence in +a library and creates a plot showing the relative number of sequences +with different degrees of duplication. +

    +

    +

    +To cut down on the memory requirements for this module only sequences +which first appear in the first 100,000 sequences in each file are analysed, +but this should be enough to get a good impression for the duplication +levels in the whole file. Each sequence is tracked to the end of the +file to give a representative count of the overall duplication level. +To cut down on the amount of information in the final plot any sequences +with more than 10 duplicates are placed into grouped bins to give a clear +impression of the overall duplication level without having to show each +individual duplication value. +

    + +

    +Because the duplication detection requires an exact sequence match over +the whole length of the sequence, any reads over 75bp in length are truncated +to 50bp for the purposes of this analysis. Even so, longer reads are more +likely to contain sequencing errors which will artificially increase the +observed diversity and will tend to underrepresent highly duplicated sequences. +

    + +

    +The plot shows the proportion of the library which is made up of sequences in +each of the different duplication level bins. There are two lines on the plot. The +blue line takes the full sequence set and shows how its duplication levels are +distributed. In the red plot the sequences are de-duplicated and the proportions +shown are the proportions of the deduplicated set which come from different duplication +levels in the original data. +

    + +

    +In a properly diverse library most sequences should fall into the far left of the +plot in both the red and blue lines. A general level of enrichment, indicating broad +oversequencing in the library will tend to flatten the lines, lowering the low end and +generally raising other categories. More specific enrichments of subsets, or the +presence of low complexity contaminants will tend to produce spikes towards the right +of the plot. These high duplication peaks will most often appear in the red trace as +they make up a high proportion of the original library, but usually disappear in the +blue trace as they make up an insignificant proportion of the deduplicated set. If peaks +persist in the blue trace then this suggests that there are a large number of different +highly duplicated sequences which might indicate either a contaminant set or a very +severe technical duplication. +

    + +

    +The module also calculates an expected overall loss of sequence were the library to be +deduplicated. This headline figure is shown at the top of the plot and gives a reasonable +impression of the potential overall level of loss. +

    + +

    Warning

    +

    +This module will issue a warning if non-unique sequences make up more than +20% of the total. +

    + +

    Failure

    +

    +This module will issue a error if non-unique sequences make up more than +50% of the total. +

    + +

    Common reasons for warnings

    +

    +The underlying assumption of this module is of a diverse unenriched library. Any deviation +from this assumption will naturally generate duplicates and can lead to warnings or errors +from this module. +

    +

    +In general there are two potential types of duplicate in a library, technical duplicates +arising from PCR artefacts, or biological duplicates which are natural collisions where different +copies of exactly the same sequence are randomly selected. From a sequence level there is no +way to distinguish between these two types and both will be reported as duplicates here. +

    +

    +A warning or error in this module is simply a statement that you have exhausted the diversity +in at least part of your library and are re-sequencing the same sequences. In a supposedly diverse +library this would suggest that the diversity has been partially or completely exhausted and that +you are therefore wasting sequencing capacity. However in some library types you will naturally +tend to over-sequence parts of the library and therefore generate duplication and will therefore +expect to see warnings or error from this module. +

    +

    +In RNA-Seq libraries sequences from different transcripts will be present at wildly different levels +in the starting population. In order to be able to observe lowly expressed transcripts it is therefore +common to greatly over-sequence high expressed transcripts, and this will potentially create large +set of duplicates. This will result in high overall duplication in this test, and will often produce +peaks in the higher duplication bins. This duplication will come from physically connected regions, and +an examination of the distribution of duplicates in a specific genomic region will allow the +distinction between over-sequencing and general technical duplication, but these distinctions are not +possible from raw fastq files. A similar situation can arise in highly enriched ChIP-Seq libraries +although the duplication there is less pronounced. Finally, if you have a library where the sequence +start points are constrained (a library constructed around restriction sites for example, or an +unfragmented small RNA library) then the constrained start sites will generate huge dupliction levels +which should not be treated as a problem, nor removed by deduplication. In these types of library +you should consider using a system such as random barcoding to allow the distinction of technical +and biological duplicates. +

    + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/9 Overrepresented Sequences.html b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/9 Overrepresented Sequences.html new file mode 100755 index 0000000..68b0d23 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/9 Overrepresented Sequences.html @@ -0,0 +1,70 @@ + + + +Overrepresented Sequences + + + +

    Overrepresented Sequences

    +

    Summary

    +

    +A normal high-throughput library will contain a diverse set +of sequences, with no individual sequence making up a tiny +fraction of the whole. Finding that a single sequence is very +overrepresented in the set either means that it is highly +biologically significant, or indicates that the library is +contaminated, or not as diverse as you expected. +

    +

    +This module lists all of the sequence which make up more than +0.1% of the total. To conserve memory only sequences which +appear in the first 100,000 sequences are tracked +to the end of the file. It is therefore possible that a sequence +which is overrepresented but doesn't appear at the start of the file +for some reason could be missed by this module. +

    +

    +For each overrepresented sequence the program will look for matches +in a database of common contaminants and will report the best hit +it finds. Hits must be at least 20bp in length and have no more +than 1 mismatch. Finding a hit doesn't necessarily mean that this +is the source of the contamination, but may point you in the right +direction. It's also worth pointing out that many adapter sequences +are very similar to each other so you may get a hit reported which +isn't technically correct, but which has very similar sequence to +the actual match. +

    +

    +Because the duplication detection requires an exact sequence match over +the whole length of the sequence any reads over 75bp in length are truncated +to 50bp for the purposes of this analysis. Even so, longer reads are more +likely to contain sequencing errors which will artificially increase the +observed diversity and will tend to underrepresent highly duplicated sequences. +

    + + +

    Warning

    +

    +This module will issue a warning if any sequence is found to represent +more than 0.1% of the total. +

    + +

    Failure

    +

    +This module will issue an error if any sequence is found to represent +more than 1% of the total. +

    + +

    Common reasons for warnings

    +

    +This module will often be triggered when used to analyse small RNA libraries +where sequences are not subjected to random fragmentation, and the same +sequence may natrually be present in a significant proportion of the library. +

    + + + diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/duplication_levels.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/duplication_levels.png new file mode 100755 index 0000000..74be880 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/duplication_levels.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/kmer_profiles.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/kmer_profiles.png new file mode 100755 index 0000000..ba7850c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/kmer_profiles.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_gc_content.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_gc_content.png new file mode 100755 index 0000000..9d9e5cb Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_gc_content.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_n_content.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_n_content.png new file mode 100755 index 0000000..05c79bc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_n_content.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_quality.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_quality.png new file mode 100755 index 0000000..897d92a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_quality.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_sequence_content.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_sequence_content.png new file mode 100755 index 0000000..2863269 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_base_sequence_content.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_gc_content.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_gc_content.png new file mode 100755 index 0000000..bacda7a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_gc_content.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_quality.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_quality.png new file mode 100755 index 0000000..308e821 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_sequence_quality.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_tile_quality.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_tile_quality.png new file mode 100755 index 0000000..dc3897e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/per_tile_quality.png differ diff --git a/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/sequence_length_distribution.png b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/sequence_length_distribution.png new file mode 100755 index 0000000..0aa066e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Help/3 Analysis Modules/sequence_length_distribution.png differ diff --git a/code/utilities/fastqc_v0.11.3/INSTALL.txt b/code/utilities/fastqc_v0.11.3/INSTALL.txt new file mode 100755 index 0000000..3f84451 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/INSTALL.txt @@ -0,0 +1,127 @@ +Installing FastQC +------------------- +FastQC is a java application. In order to run it needs your system to have a suitable +Java Runtime Environment (JRE) installed. Before you try to run FastQC you should therefore +ensure that you have a suitable JRE. There are a number of different JREs available +however the one we have tested is the v1.6 JRE from Oracle. This is available +for a number of different platforms from www.java.com (click the download now button at the +top). + +If you're not sure whether you have java installed then you can test this from a command +prompt. To get a command prompt try: + +Windows: Select Start > Run, and type 'cmd' (no quotes) in the box which appears, press OK + +MaxOSX: Run Applications > Utilities > Terminal + +Linux: From your applications menu look for an application called 'Terminal' or 'Konsole'. +Either of these will give you a usable shell. + +At the command prompt type 'java -version' and press enter. You should see something like: + +java version "1.6.0_17" +Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025) +Java HotSpot(TM) Client VM (build 14.3-b01-101, mixed mode) + +If you get an error then you don't have java installed. If the version listed on the first +line is less than 1.5 then you might have problems running FastQC. + +Actually installing FastQC is as simple as unzipping the zip file it comes in into a +suitable location. That's it. Once unzipped it's ready to go. + +Running FastQC +-------------- + +You can run FastQC in one of two modes, either as an interactive graphical application +in which you can dynamically load FastQ files and view their results. + +Alternatively you can run FastQC in a non-interactive mode where you specify the files +you want to process on the command line and FastQC will generate an HTML report for +each file without launching a user interface. This would allow FastQC to be run as +part of an analysis pipeline. + + +Running FastQC Interactively +---------------------------- +Windows: Simply double click on the run_fastqc bat file. If you want to make a pretty +shortcut then we've included an icon file in the top level directory so you don't have +to use the generic bat file icon. + +MacOSX: There is an application bundle for MacOSX which you can use to install and run +FastQC. Just drag the application from the disk image to your Applications folder (or +wherever you want to install the program). + +Linux: We have included a wrapper script, called 'fastqc' which is the easiest way to +start the program. The wrapper is in the top level of the FastQC installation. You +may need to make this file executable: + +chmod 755 fastqc + +..but once you have done that you can run it directly + +./fastqc + +..or place a link in /usr/local/bin to be able to run the program from any location: + +sudo ln -s /path/to/FastQC/fastqc /usr/local/bin/fastqc + + +Running FastQC as part of a pipeline +------------------------------------ +To run FastQC non-interactively you should use the fastqc wrapper script to launch +the program. You will probably want to use the zipped install file on every platform +(even OSX). + +To run non-interactively you simply have to specify a list of files to process +on the commandline + +fastqc somefile.txt someotherfile.txt + +You can specify as many files to process in a single run as you like. If you don't +specify any files to process the program will try to open the interactive application +which may result in an error if you're running in a non-graphical environment. + +There are a few extra options you can specify when running non-interactively. Full +details of these can be found by running + +fastqc --help + +By default, in non-interactive mode FastQC will create an HTML report with embedded +graphs, but also a zip file containing individual graph files and additional data files +containing the raw data from which plots were drawn. The zip file will not be extracted +by default but you can enable this by adding: + +--extract + +To the launch command. + +If you want to save your reports in a folder other than the folder which contained +your original FastQ files then you can specify an alternative location by setting a +--outdir value: + +--outdir=/some/other/dir/ + +If you want to run fastqc on a stream of data to be read from standard input then you +can do this by specifing 'stdin' as the name of the file to be processed and then +streaming uncompressed fastq format data to the program. For example: + +zcat *fastq.gz | fastqc stdin + +Customising the report output +----------------------------- + +If you want to run FastQC as part of a sequencing pipeline you may wish to change the +formatting of the report to add in your own branding or to include extra information. + +In the Templates directory you will find a file called 'header_template.html' which +you can edit to change the look of the report. This file contains all of the header for +the report file, including the CSS section and you can alter this however you see fit. + +Whilst you can make whatever changes you like you should probably leave in place the +
    structure of the html template since later code will expect to close the main div +which is left open at the end of the header. There is no facility to change the code in +the main body of the report or the footer (although you can of course change the styling). + +The text tags @@FILENAME@@ and @@DATE@@ are placeholders which are filled in when the +report it created. You can use these placeholders in other parts of the header if you +wish. diff --git a/code/utilities/fastqc_v0.11.3/LICENSE.txt b/code/utilities/fastqc_v0.11.3/LICENSE.txt new file mode 100755 index 0000000..818433e --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/code/utilities/fastqc_v0.11.3/LICENSE_JHDF5.txt b/code/utilities/fastqc_v0.11.3/LICENSE_JHDF5.txt new file mode 100755 index 0000000..f820d4b --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/LICENSE_JHDF5.txt @@ -0,0 +1,203 @@ +/* + * Apache License + * Version 2.0, January 2004 + * http://www.apache.org/licenses/ + * + * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + * + * 1. Definitions. + * + * "License" shall mean the terms and conditions for use, reproduction, + * and distribution as defined by Sections 1 through 9 of this document. + * + * "Licensor" shall mean the copyright owner or entity authorized by + * the copyright owner that is granting the License. + * + * "Legal Entity" shall mean the union of the acting entity and all + * other entities that control, are controlled by, or are under common + * control with that entity. For the purposes of this definition, + * "control" means (i) the power, direct or indirect, to cause the + * direction or management of such entity, whether by contract or + * otherwise, or (ii) ownership of fifty percent (50%) or more of the + * outstanding shares, or (iii) beneficial ownership of such entity. + * + * "You" (or "Your") shall mean an individual or Legal Entity + * exercising permissions granted by this License. + * + * "Source" form shall mean the preferred form for making modifications, + * including but not limited to software source code, documentation + * source, and configuration files. + * + * "Object" form shall mean any form resulting from mechanical + * transformation or translation of a Source form, including but + * not limited to compiled object code, generated documentation, + * and conversions to other media types. + * + * "Work" shall mean the work of authorship, whether in Source or + * Object form, made available under the License, as indicated by a + * copyright notice that is included in or attached to the work + * (an example is provided in the Appendix below). + * + * "Derivative Works" shall mean any work, whether in Source or Object + * form, that is based on (or derived from) the Work and for which the + * editorial revisions, annotations, elaborations, or other modifications + * represent, as a whole, an original work of authorship. For the purposes + * of this License, Derivative Works shall not include works that remain + * separable from, or merely link (or bind by name) to the interfaces of, + * the Work and Derivative Works thereof. + * + * "Contribution" shall mean any work of authorship, including + * the original version of the Work and any modifications or additions + * to that Work or Derivative Works thereof, that is intentionally + * submitted to Licensor for inclusion in the Work by the copyright owner + * or by an individual or Legal Entity authorized to submit on behalf of + * the copyright owner. For the purposes of this definition, "submitted" + * means any form of electronic, verbal, or written communication sent + * to the Licensor or its representatives, including but not limited to + * communication on electronic mailing lists, source code control systems, + * and issue tracking systems that are managed by, or on behalf of, the + * Licensor for the purpose of discussing and improving the Work, but + * excluding communication that is conspicuously marked or otherwise + * designated in writing by the copyright owner as "Not a Contribution." + * + * "Contributor" shall mean Licensor and any individual or Legal Entity + * on behalf of whom a Contribution has been received by Licensor and + * subsequently incorporated within the Work. + * + * 2. Grant of Copyright License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * copyright license to reproduce, prepare Derivative Works of, + * publicly display, publicly perform, sublicense, and distribute the + * Work and such Derivative Works in Source or Object form. + * + * 3. Grant of Patent License. Subject to the terms and conditions of + * this License, each Contributor hereby grants to You a perpetual, + * worldwide, non-exclusive, no-charge, royalty-free, irrevocable + * (except as stated in this section) patent license to make, have made, + * use, offer to sell, sell, import, and otherwise transfer the Work, + * where such license applies only to those patent claims licensable + * by such Contributor that are necessarily infringed by their + * Contribution(s) alone or by combination of their Contribution(s) + * with the Work to which such Contribution(s) was submitted. If You + * institute patent litigation against any entity (including a + * cross-claim or counterclaim in a lawsuit) alleging that the Work + * or a Contribution incorporated within the Work constitutes direct + * or contributory patent infringement, then any patent licenses + * granted to You under this License for that Work shall terminate + * as of the date such litigation is filed. + * + * 4. Redistribution. You may reproduce and distribute copies of the + * Work or Derivative Works thereof in any medium, with or without + * modifications, and in Source or Object form, provided that You + * meet the following conditions: + * + * (a) You must give any other recipients of the Work or + * Derivative Works a copy of this License; and + * + * (b) You must cause any modified files to carry prominent notices + * stating that You changed the files; and + * + * (c) You must retain, in the Source form of any Derivative Works + * that You distribute, all copyright, patent, trademark, and + * attribution notices from the Source form of the Work, + * excluding those notices that do not pertain to any part of + * the Derivative Works; and + * + * (d) If the Work includes a "NOTICE" text file as part of its + * distribution, then any Derivative Works that You distribute must + * include a readable copy of the attribution notices contained + * within such NOTICE file, excluding those notices that do not + * pertain to any part of the Derivative Works, in at least one + * of the following places: within a NOTICE text file distributed + * as part of the Derivative Works; within the Source form or + * documentation, if provided along with the Derivative Works; or, + * within a display generated by the Derivative Works, if and + * wherever such third-party notices normally appear. The contents + * of the NOTICE file are for informational purposes only and + * do not modify the License. You may add Your own attribution + * notices within Derivative Works that You distribute, alongside + * or as an addendum to the NOTICE text from the Work, provided + * that such additional attribution notices cannot be construed + * as modifying the License. + * + * You may add Your own copyright statement to Your modifications and + * may provide additional or different license terms and conditions + * for use, reproduction, or distribution of Your modifications, or + * for any such Derivative Works as a whole, provided Your use, + * reproduction, and distribution of the Work otherwise complies with + * the conditions stated in this License. + * + * 5. Submission of Contributions. Unless You explicitly state otherwise, + * any Contribution intentionally submitted for inclusion in the Work + * by You to the Licensor shall be under the terms and conditions of + * this License, without any additional terms or conditions. + * Notwithstanding the above, nothing herein shall supersede or modify + * the terms of any separate license agreement you may have executed + * with Licensor regarding such Contributions. + * + * 6. Trademarks. This License does not grant permission to use the trade + * names, trademarks, service marks, or product names of the Licensor, + * except as required for reasonable and customary use in describing the + * origin of the Work and reproducing the content of the NOTICE file. + * + * 7. Disclaimer of Warranty. Unless required by applicable law or + * agreed to in writing, Licensor provides the Work (and each + * Contributor provides its Contributions) on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied, including, without limitation, any warranties or conditions + * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + * PARTICULAR PURPOSE. You are solely responsible for determining the + * appropriateness of using or redistributing the Work and assume any + * risks associated with Your exercise of permissions under this License. + * + * 8. Limitation of Liability. In no event and under no legal theory, + * whether in tort (including negligence), contract, or otherwise, + * unless required by applicable law (such as deliberate and grossly + * negligent acts) or agreed to in writing, shall any Contributor be + * liable to You for damages, including any direct, indirect, special, + * incidental, or consequential damages of any character arising as a + * result of this License or out of the use or inability to use the + * Work (including but not limited to damages for loss of goodwill, + * work stoppage, computer failure or malfunction, or any and all + * other commercial damages or losses), even if such Contributor + * has been advised of the possibility of such damages. + * + * 9. Accepting Warranty or Additional Liability. While redistributing + * the Work or Derivative Works thereof, You may choose to offer, + * and charge a fee for, acceptance of support, warranty, indemnity, + * or other liability obligations and/or rights consistent with this + * License. However, in accepting such obligations, You may act only + * on Your own behalf and on Your sole responsibility, not on behalf + * of any other Contributor, and only if You agree to indemnify, + * defend, and hold each Contributor harmless for any liability + * incurred by, or claims asserted against, such Contributor by reason + * of your accepting any such warranty or additional liability. + * + * END OF TERMS AND CONDITIONS + * + * APPENDIX: How to apply the Apache License to your work. + * + * To apply the Apache License to your work, attach the following + * boilerplate notice, with the fields enclosed by brackets "[]" + * replaced with your own identifying information. (Don't include + * the brackets!) The text should be enclosed in the appropriate + * comment syntax for the file format. We also recommend that a + * file or class name and description of purpose be included on the + * same "printed page" as the copyright notice for easier + * identification within third-party archives. + * + * Copyright [yyyy] [name of copyright owner] + * + * 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. + */ diff --git a/code/utilities/fastqc_v0.11.3/README.txt b/code/utilities/fastqc_v0.11.3/README.txt new file mode 100755 index 0000000..2f7df91 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/README.txt @@ -0,0 +1,42 @@ +FastQC - A Quality Control application for FastQ files +------------------------------------------------------ + +Most high throughput sequencers generate output in FastQ format. This +format combines the base calls for the sequence which was generated with +an encoded quality value for each base which says how confident the +sequencer was that the base call generated was correct. + +Before proceeding with the analysis of a sequence data set it is +a good idea to do some basic quality control checks on the raw data +to ensure that there are no hidden problems which might be more +difficult to detect at a later stage. + +FastQC is an application which takes a FastQ file and runs a series +of tests on it to generate a comprehensive QC report. This will +tell you if there is anything unusual about your sequence. Each +test is flagged as a pass, warning or fail depending on how far it +departs from what you'd expect from a normal large dataset with no +significant biases. It's important to stress that warnings or even +failures do not necessarily mean that there is a problem with your +data, only that it is unusual. It is possible that the biological +nature of your sample means that you would expect this particular +bias in your results. + +FastQC can be run either as an interactive graphical application +which allows you to view results for multiple files in a single +application. Alternatively you can run the program in a non +interactive way (say as part of a pipeline) which will generate +an HTML report for each file you process. + +FastQC is a cross-platform application, written in java. In theory it +should run on any platform which has a suitable java runtime environment. +Having said that we've only tested in on Windows, MacOSX 10.6 and Linux +running the Sun v1.5 and 1.6 JREs. Please let us know what happened if +you try running it on other platforms / JREs. + +If you have any comments about FastQC we would like to hear them. You +can either enter them in our bug tracking system at: + +http://www.bioinformatics.bbsrc.ac.uk/bugzilla/ + +..or send them directly to simon.andrews@bbsrc.ac.uk. diff --git a/code/utilities/fastqc_v0.11.3/RELEASE_NOTES.txt b/code/utilities/fastqc_v0.11.3/RELEASE_NOTES.txt new file mode 100755 index 0000000..4003475 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/RELEASE_NOTES.txt @@ -0,0 +1,802 @@ +RELEASE NOTES FOR FastQC v0.11.3 +-------------------------------- + +This is a minor bug-fix release which addresses some issues +reported with the v0.11.2 release. + +1) Fixed a bug when using the limits.txt file to disable the per + tile analysis module. + +2) Fixed a documentation error in the duplicated sequences plot. + +3) Fixed a thread safety bug when processing multiple files in a + single session which caused the program not to exit when all + processing had in fact completed. + +4) Fixed a bug which meant that forced formats in the interactive + application weren't being honoured. + +5) Fixed a bug in the way soft clipping was applied when we were + analysing only mapped data. + +6) Fix a memory issue when trying to parse tile names in cases where + we mistakenly think we're identify tile numbers, but we aren't + +7) Fix a bug in the text reporting of per-tile quality scores + +8) Add the SOLID smallRNA adapter to the default adapter search set + +9) Fix a bug in casava mode when using uncompressed fastq files + +10) Increase the number of sampled sequences in the duplicate and + overrepresented module to 100,000. + +11) Add a clean up of data structures for the Kmer module so that + the interactive mode can process more files without dying. + + +RELEASE NOTES FOR FastQC v0.11.2 +-------------------------------- + +This is a minor bug-fix release which addresses some issues +reported with the v0.11.1 release. + +1) Added a proper implementation of a --limits command line +option to allow users to specify a custom limits file for an +individual run. This also fixed a bug seen if the user used the +--adapter option. + +2) Fixed an error in the naming of the folder inside the zip file +such that it couldn't be extracted into the same folder as the +main HTML file. + +3) Fixed an overly large data structure which was causing some +runs to terminate due to a lack of memory. + +4) Fixed a poor implementation in the Kmer module which was +causing unusually high memory usage. + +5) Fixed incorrect defaults for the warn/fail values in the per +sequence quality module. + +RELEASE NOTES FOR FastQC V0.11.1 +-------------------------------- + +FastQC v0.11.1 is the first release for a long time and is a +major update to the package. This release adds some significant +new features to the program which will hopefully make it more +useful. + +The major new features in this release are: + +1) Configurable thresholds for modules. For all modules you can +now alter a configuration file to set the thresholds used by the +program for warnings and errors so that you can flag up only the +types of problem which you are concerned by. + +2) Optional modules. The same configuration file used to set +the warn / error thresholds can also be used to selectively +disable modules you don't want to see at all. + +3) New per-tile quality analysis. If you are running Illumina +libraries through FastQC it will now analyse the quality calls +on a per-tile basis and will flag up points in the run where the +quality in individual tiles fell below the average quality for +that cycle. This can help to spot technical problems during the +run. + +4) New adapter content module. A new module has been added to +specifically search for the presence of adapters in your library. +This operates in a similar way to the existing Kmer analysis but +allows you to specify individual adapter sequences to screen and +will always show the results for each adapter so you can easily +see what you might gain if you chose to adapter trim your library. + +5) Improved duplication plot. The duplication plot has been given +an overhaul so that it now reports values which are real read +numbers rather than always giving relative values. This is thanks +to work done by Brian Howard of sciome.com who worked out the right +way to extrapolate from the data we sample to the full library. It +also shows how the level of duplication would affect the library +both before and after deduplication, and the headline figure is now +much more useful as it shows the percentage of the library which +would remain if you chose to deduplicate. + +6) Improved Kmer module. The Kmer module has been changed so that +instead of trying to search for individual Kmers which are present +at higher than expected frequency (which actually happens all the +time in real libraries), it now looks for Kmers which are present +in significantly different amounts at different starting positions +within the library. This has allowed the use of longer Kmer +sequences to give a more useful result. + +7) Since file reports. The default output format for the program +is now a single HTML file with all of the various graphs embedded +into it. The .zip file output with the individual graphs is still +produced as are the associated data files, but you can just +distribute the one HTML file alone - the other data is no longer +required. + +8) Ability to read from stdin. If you want to pipe a stream of +data into fastqc rather than using a real file then you can just +use 'stdin' as the filename to process and then stream uncompressed +fastq data on stdin. + +9) Changed base groupings. For long reads we used to use an +exponential series to group bases together to summarise the sequence +content and qualities. We've now switched the default to be that +for grouped plots the first 9 individual bases will always be shown +(since this often roots out problems in the libraries), after that +there will be a series of evenly sized windows so that the same number +of bases fall into each window. You can bring back the old behaviour +with the new --expgroup option, and you can remove grouping all together +with the --nogroup option (although this will do bad things to your +plots if you have really long reads). + +10) Dropped support for the Solaxa64 (but NOT Phred64) encoding. We +have removed the ability of the program to reliably detect the original +Solexa64 encoding which was used in the GA pipeline prior to v1.3. +This was a 64 offset encoding but which allowed scores which ranged +down to -5. Supporting this encoding meant that we would incorrectly +guess the encoding on Phred33 files which had no bases with quality +scores below 26, which could happen if you aggressively trimmed your +data. Supporting just Phred33 and Phred64 now means that we wouldn't +mis-detect unless there were no bases with qualities below 31, which +is much less likely, even in trimmed data. Since no Solexa64 data +will have been produced since early 2009 it is unlikely that removing +support for this format will adversely affect users of the program. + + +RELEASE NOTES FOR FastQC V0.10.1 +-------------------------------- + +FastQC v0.10.1 is a bugfix release which works around two problems +people have encountered with previous releases: + +1) A work-round has been put into place for a limitation in the +java gzip decompressor, where it would read only the first +compressed block in a file created by concatenating multiple +gzipped files directly, rather than decompressing and recompressing +them. + +2) Users who had installed the program in directories containing +characters required to be encoded in URLs (= & ? etc) were finding +that the report generation generated an error. This encoding has +now been fixed and the program should now have no limits in the +name of the directory in which it can be installed. + +One additional feature is that in the fastqc wrapper you can now +specify the location of the java interpreter on the command line +using the --java parameter, rather than having to have it included +in the path. + +One other change in this release is that the package names for all +of the java classes have been changed to reflect a change in the +official project URL. This means that the launchers for the +program have had to be updated to use these new names. If you have +created your own launcher, or had copied any of the old ones you'll +need to update this to use the launchers included in this version +of the program. + +The new URL for the project is: + +www.bioinformatics.babraham.ac.uk/projects/fastqc/ + +..and if you want to report bugs the bugzilla URL is now: + +www.bioinformatics.babraham.ac.uk/bugzilla/ + + +RELEASE NOTES FOR FastQC V0.10.0 +-------------------------------- + +The major feature of FastQC v0.10.0 is the addition of support +for fastq files generated directly by the latest version of the +illumina pipeline (Casava v1.8). In this version the pipeline +generates gzipped fastq files by default rather than using qseq +files which can then be converted to fastq. However the fastq +files generated by casava are unusual in two ways: + +1) A single sample produces a set of fastq files with a common + name, but an incrementing number at the end. + +2) Casava FastQ files contain sequences from clusters which have + failed the internal QC, and been flagged to be filtered. + +FastQC v0.10.0 introduces a Casava mode which will merge together +fastq files from the same sample group and produce a single report. +It will also exclude any flagged entries from the analysis. You +would therefore run FastQC as normal but selecting all of the +fastq files from Casava and using casava mode for your analysis. + +Casava mode is activated from the command line by adding the +--casava option to the launch command. From the interactive +application you need to select 'Casava FastQ Files' from the drop +down file selector filter options. + +If you want to analyse casava fastq files without these extra +options then you can use treat them as normal fastq files with +no problems. + +In addition to this change there have also been changes to allow +the wrapper script to work properly under windows, and a bug was +fixed which missed of the last possible Kmer from every sequence +in a library. + + +RELEASE NOTES FOR FastQC V0.9.6 +------------------------------- + +FastQC v0.9.6 fixes a couple of bugs which aren't likely to have +affected the majority of fastqc users: + +- Fixed a crash in the Kmer module when analysing a sequence where + every sequence in a library contained a poly-N stretch at its + 3' end. + +- Fixed the wrapper script so that OSX users launching fastqc + through the script rather than the Mac application bundle get + their classpath set correctly, and can therefore analyse bam/sam + files. + + +RELEASE NOTES FOR FastQC V0.9.5 +------------------------------- + +FastQC v0.9.5 fixes some bugs in the programs text output and +improves a few things in the graphical interface. Main changes +are: + +- Progress calculations are now exact and not approximate + +- The UI now has a welcome screen so you're not just presented + with a blank screen when the program starts + +- The wrapper script now sets the classpath correctly in windows + as well as linux. + +- The text report for per-base sequence content now reports + correct values for grouped bases + +- The HTML report uses a custom stylesheet for print output so + graphs aren't cut off when reports are printed. + +- Fixed a bug in testing for a warning in the per-base sequence + content module. + +- Alt text in HTML reports now matches the graphic it describes + + +RELEASE NOTES FOR FastQC V0.9.4 +------------------------------- + +FastQC v0.9.4 is a minor bugfix release which changes the offline +version of the program so that if a file fails to be processed a +full backtrace of the error is produced, rather than just a +simple generic error message. + +RELEASE NOTES FOR FastQC V0.9.3 +------------------------------- + +FastQC v0.9.3 adds support for fastq files compressed with +bzip2 in addition to its existing support for gzip compressed +files. It's worth noting that although bzip2 offers a reduction +in the file size of the compressed files (about a 5-fold size +reduction compared to raw fastq. Gzip is a 4-fold decrease), +there is a significant penalty in terms of the speed of +decompression of these files. In our tests gzipped files were +actually processed slightly faster than raw FastQ files, presumably +due to the lower amount of data transfer from disk required, +however bzip2 compressed files took around 6X as long to +process as gzipped files. + +The other big change in this release is an update to the default +CSS layout such that viewing the HTML reports doesn't require +lots of scrolling up and down the page. As before the CSS can +be edited and customised by editing the templates shipped with +the program. Many thanks to Phil Ewels who did much of the +work on the new layout. + + + +RELEASE NOTES FOR FastQC V0.9.2 +------------------------------- + +FastQC v0.9.2 fixes two bugs which were identified in the +previous release. + +1) In the text output for the per-base quality module the +correct base numbers weren't being included for files which +used grouped base ranges. + +2) The Kmer analysis module could crash when analysing very +small files, such that no position in the file had more than +1000 instances of an enriched Kmer. + +Both of these issues should now be resolved. + + +RELEASE NOTES FOR FastQC V0.9.1 +------------------------------- + +FastQC v0.9.1 adds some new command line options and fixes a +couple of usability issues. + +The new command line options are: + +--quiet Will suppress all progress messages and ensure that only +warnings or errors are written to stderr. This might be useful +for people running fastqc as part of a pipeline. + +--nogroup Will turn off the dynamic grouping of bases in the +various per-base plots. This would allow you to see a result +for each base of a 100bp run for example. This option should +not be used for really long reads (454, PacBio etc) since it +has the potential to crash the program or generate very wide +output plots + +In addition to these the following changes have been made: + +The basic stats module now includes a line to say which type +of quality encoding was found so this information isn't just +present in the header of the per-base quality plot, and will +appear in the text based output. + +We now distinguish between Illumina <1.3, 1.3 and 1.5 encodings +rather than just <1.3 and >=1.3. The Sanger encoding is now +labelled as Sanger / Illumina 1.9+ to allow for the change in +encoding in the latest illumina pipeline. + +A bug was fixed which caused the program to crash when encountering +a zero length colorspace file (which shouldn't happen anyway, but +crashing wasn't the correct response). + +The interactive over-represented sequence table now allows you +to copy out each cell individually which makes it easy to copy +any unknown sequences into other programs. + + +RELEASE NOTES FOR FastQC V0.9.0 +------------------------------- + +FastQC v0.9.0 makes a number of changes primarily targetted at +datasets containing longer reads. It allows all of the analyses +within FastQC to be completed sensibly and without excessive +resource usage on runs containing reads up to tens of kilobases +in length. + +For long reads the program now converts many of its plots to +variably sized bins so that, for example you see every base for +the first 10 bases, then every 5 bases for the next 40 bases, +then every 50, then 100 then 1kb per bin, until the end of the +sequence is reached. For sequences below 75bp the reports will +look exactly the same as before. For groups running slightly +longer Illumina or ABI runs you'll see some compression at the +end of your reads, and people using 454 or PacBio will get +sensible results for all analyses for the first time. + +One additional change which will impact anyone using reads over +75bp is that the duplicate sequence and overrepresented sequence +plots now only use the first 50bp of each read if the total read +length is over 75bp. This is because these plots work on the +basis of an exact sequence match, and longer reads tend to show +more errors at the end which makes them look like different +sequences when they're actually the same. 50bp should be enough +that you won't see exact matches by chance. + + + +RELEASE NOTES FOR FastQC V0.8.0 +------------------------------- + +FastQC v0.8.0 adds some new options for parsing BAM/SAM files and +makes the graphs in the report easier to interpret. + +All graphs in v0.8.0 now have marker lines going across them to make +it easier to relate the data in the graph to the y-axis. The per +base quality boxplots have shading behind the graph to indicate ranges +of good, medium and bad quality sequence. + +For BAM/SAM files you can now specify that you wish to analyse only +the mapped sequences in the file. This is particularly of use to +people working on colorspace data where the mapped data should +produce reliable sequence, whereas the current raw conversion to +base space may overrepresent any errors which are present. The +option to use only mapped data is set by using the + +-f bam_mapped or -f sam_mapped + +option on the command line, or by specifying Mapped BAM/SAM files +from the drop down file filter in the file chooser in the interactive +version of the program. + +For FastQ files the parser has been updated to not treat blank lines +between entries or at the end of the file as a format violation since +many sequences in the public repositories can have this problem. + +From the command line we now offer the option to process multiple +files in parallel by setting the -t/--threads option. Please note that +using more than 1 thread will increase the amount of allocated memory +(250MB per thread), so you need to be sure you have enough memory (and +disk bandwidth) to be able to process more than one file. The +interactive application still defaults to a single processing thread +but you could theoretically change this by passing the correct java +properties in the startup command. + + +RELEASE NOTES FOR FastQC V0.7.2 +------------------------------- + +FastQC v0.7.2 fixes a bug in libraries where no unique sequences +were observed. It also improves the collection of duplicate +statistics on libraries with very low diversity. + +A new command line option has been added to allow the user to +manually specify a contaminant's file rather than using the sitewide +default. This would be useful if you have different sets of +contaminants to screen against for different libraries, or if you +wanted to make a custom set of contaminants, but didn't have +sufficient privileges to modify the sitewide contaminants file. + + +RELEASE NOTES FOR FastQC V0.7.1 +------------------------------- + +FastQC v0.7.1 makes some significant enhancements to the fastqc +wrapper script which make it easier to use as part of a pipeline. + +You can now use normal unix options to create your fastqc +command rather than having to pass java system properties. The +old options will continue to work though, so the updated +wrapper is still compatible with any previous commands you may +have in place. Full details of the new options can be found +by running + +fastqc --help + +One new option is the --format option which allows you to manually +specify the input format of a file, rather than having FastQC +guess the format from the file name. This would allow you to have +a BAM file called test.dat and process it using: + +fastqc --format bam test.dat + + + + +RELEASE NOTES FOR FastQC V0.7.0 +------------------------------- + +FastQC v0.7.0 introduces a new analysis module which looks at the +enrichment of short sequences within the library. It is possible +to get enrichment of unaligned subsequences to quite a high degree +without this being apparent in any of the existing modules. This +new module should find problems such as read through into the +adapters at the other end of libraries, which other analyses would +miss. + +Other changes in this release include: + +* Altering the fastqc wrapper script so it can identify when it's + being used on the source distribution of the software so it can + issue an appropriate warning. + +* Tidied up all of the y-axes on the graphs so that scaling should + now always be perfect in all graphs. + + +RELEASE NOTES FOR FastQC V0.6.1 +------------------------------- + +FastQC v0.6.1 is a bugfix release which fixes a problem with sequences +from BAM/SAM files which map to the reverse strand of the reference. + +In these cases the sequence contained in the BAM/SAM file is reverse +complemented and the qualities are reversed relative to the original +sequence which came off the sequencer. In the previous release this +meant that the plots were incorrectly showing a mix of forward and +reversed sequences. + +In v0.6.1 any sequences mapping to the reverse strand of the reference +are converted back to their original state before being analysed which +should give a clearer view of the overall qualities and sequence biases +within the run. + + +RELEASE NOTES FOR FastQC V0.6.0 +------------------------------- + +FastQC v0.6 adds support for reading SAM/BAM files as well as still +supporting fastq files. File type detection is based on the filename +so SAM/BAM files need to be named .sam or .bam. Any other form of +filename is assumed to be a fastq file. + +SAM/BAM reading was added through the use of the picard libraries, which +means that the launcher for FastQC has had to be modified to include +the picard libraries into the classpath. If you use the bat file launcher, +the wrapper script or the Mac application bundle then you won't need to +do anything to get the new version to work, but if you've created your +own launcher then you will need to modify your classpath statement to +include the sam-1.32.jar file into the classpath. + +The only other change in this release is that the line graphs have been +improved to use smoother lines for the graphs. + + + +RELEASE NOTES FOR FastQC V0.5.1 +------------------------------- + +Release 0.5.1 fixes a couple of bugs and makes some improvements to +existing functions. + +* A bug was fixed which caused the headers of the overrepresented + sequences results to not be separated in the text output. + +* A bug was fixed which caused spikes to appear in the %GC profile + when using read lengths >100bp + +* The fitting of the theoretical distribution to the %GC profile + was improved + +* Some new entries were added to the contaminants file to cover + Illumina oligos for multiplexing, tag expression and small RNA + protocols (thanks to Aaron Statham for providing these) + + +RELEASE NOTES FOR FastQC V0.5.0 +------------------------------- + +FastQC v0.4.4 makes a number of changes to the previous +release which hopefully improve the relevance of the output. + +* The fitting of the normal curve to the %GC distribution has + been improved for shorter sequences + +* Each section of the HTML report output now has a pass/warn/fail + icon next to it, rather than just having them at the top + +* The duplicate level analysis now estimates the total percentage + of sequences which are not unique, reports this on the graph and + uses this as the basis for the pass/warn/fail filtering + +* The structure of the HTML output folder has been changed so that + icons and images are put into subfolders so the only files at + the top level are ones which the user is intended to open directly. + + +RELEASE NOTES FOR FastQC V0.4.3 +------------------------------- + +FastQC v0.4.3 is a bugfix release which fixes a bug and adds +an extra check to the interactive program. + +In versions of the program since v0.2 the total sequence count +in the Basic Stats module may have been incorrect by a few percent +(either high or low). This is because instead of using the real +sequence count the module was using an estimated count which should +only be used for updating the progress indicators. The module +has now been fixed to report the actual sequence count. + +In the interactive application there was no warning given if you +chose to save a report and opted to overwrite an existing report. You +will now be warned in this case an offered the chance to use a +different filename. This change won't affect the non-interactive +mode of the program where report files will be overwritten if the +program is run more than once on the same set of data. + +RELEASE NOTES FOR FastQC V0.4.2 +------------------------------- + +FastQC v0.4.2 is a minor release which fixes some bugs and improves +the warnings on some of the analysis modules. + +Bugs which were fixed were: + +* The per-base quality plot showed an incorrect scale on the + y-axis. This was usually off by about 2, but could be more + depending on the data. The relative relationships shown + were correct, it was just the scale bar which was wrong. + +* The sequence parser incorrectly identified some base called + files as colorspace files where they contained dots in place + of N base calls. This has now been improved but will still + fail for the base where a base called file starts with an + entry which is a single called base followed by all dots + since this is indistinguishable from a colorspace fastq file. + +* Some JREs (notably OpenJDK) can't cope with a headless environment + being set from within the program. I've therefore added code + to the fastqc wrapper script to externally set the headless + environment up to bypass this problem. + +Other improvements which have been made are: + +* When writing out graphs for the HTML report we now scale some + graphs by the length of the sequences analysed so we don't get + really squashed graphs. The interactive application will still + scale the graphs to the size of the window + +* More checks have been added to the parsing of FastQ files to + ensure we're looking at the correct file format. A better reporting + mechanism has been added to allow the program to cope better with + problems during parsing. + +* The per-sequence GC plot has been modified to add in a modelled + normal distribtion over the observed distribution so you can see + how well the two fit. + +* All modules (apart from the general stats) now have valid checks + in place, and all can now produce warnings and failures. Some of + the checks in the existing modules have been changed to better cope + with libraries with very low or high GC content. + + +RELEASE NOTES FOR FastQC V0.4.1 +------------------------------- + +FastQC v0.4.1 is a bugfix release which changes the operation +of the duplicate sequence and overrepresented sequence modules. + +Both of these modules now only track sequences which appear in +the first 200,000 sequences of a file. This change was made +because people using longer read lengths found that tracking +the first million sequences led to the program exhausting its +allocated memory. + +The other change is that the duplicate sequence module now +tracks sequence counts to the end of the file rather than +stopping after a million sequences. This means the final +duplication counts seen are much more realistic and should +match with what you would see in a genome browser. Because +of this change the cutoffs to flag a file with a warning or +an error have been increased. You now get a warning when +the sum of duplicated sequences is more than 20% of the +unique sequences. You get an error when there are more +duplicated sequences than unique sequences. + + +RELEASE NOTES FOR FastQC V0.4 +----------------------------- + +FastQC v0.4 introduces a new analysis module, and easier way +to launch the program from the command line and a new output +file, as well as fixing a few minor bugs. + +The new analysis module is the sequence duplication level +module. This is a complement to the existing overrepresented +sequences module in that it looks at sequences which occur +more than once in your data. The new module takes a more +global view and says what proportion of all of your sequences +occur once, twice, three times etc. In a diverse library most +sequences should occur only once. A highly enriched library +may have some duplication, but higher levels of duplication +may indicate a problem, such as a PCR overamplification. + +In response to several requests we've also now introduced a +new output file into the report. This is a text based, tab +delimited file which includes all of the data show in the +graphs in the graphical report. This would allow people +running pipelines to store the data generated by fastQC and +analyse it systematically rather than just taking the +pass/fail/warn summary, or reviewing the reports manually. + +Finally, if you're running fastqc from the command line we've +now included a 'fastqc' wrapper script which you can launch +directly rather than having to construct a java launch +command. You can still pass -Dxxx options through to the +program, but for simple analyses you can now simply run: + +fastqc [some files] + +..once you have included the FastQC install directory into your +path. More details are in the install document. + +Other minor changes: + +- The over-represented sequences module now scans the first +million sequences to decide which sequences to track to the +end of the file. + +- The labeling on the per-base N content graph is now correct + + + +RELEASE NOTES FOR FastQC V0.3.1 +------------------------------- + +V0.3.1 is a bugfix release which fixes a few minor problems. + +1) The template system now correctly checks that it only imports +graphics files from the templates directory into the report +files and doesn't break when it encounters unexpected files. + +2) The offline mode now correctly reports the progress of all +processed files rather than just the first one. + +3) The documentation has been updated to include information on +the blue mean line in the per base quality plot. + + +RELEASE NOTES FOR FastQC V0.3 +----------------------------- + +Major new additions to v0.3 are listed below: + +1) Support for gzip compressed fastq files. You can now +load gzip compressed fastq files into FastQC in the same +way as uncompressed files. The files will be decompressed +interactively and can be viewed in the same way as for +uncompressed files. + +2) Contaminant identification. If your library is found to +have overrepresented sequences in it these are now scanned +against a database of common contaminants (primers, adapters etc) +to see if the source of the contamination can be identified. +The database is stored in a new Contaminants folder in the +main installation directory, and can be updated with your +own protocol specific sequences. + +3) When in non-interactive mode you can now pass a +preference -Dfastqc.output_dir to provide an alternative location +to save reports to, rather than having them in the same +directory as the source fastq files. + +Some improvements have also been made to the colorspace support +so this version should support a wider range of colorspace +fastq files. + + +RELEASE NOTES FOR FastQC V0.2 +----------------------------- + +There are a few new additions in v0.2 of FastQC + +1) Colorspace support: We now have rudimentary support for the +analysis of fastq files in colorspace. The analysis is done by +converting the colorspace calls to basecalls, which isn't ideal +but is hopefully more useful than nothing. + +2) Option to unzip reports. The default action in non-interactive +mode is now to both create a zip file containing the FastQC report +and to unzip this into a folder of the same name. If you just want +to generate the zip files you can add -Dfastqc.unzip=false to the +command line to suppress this new behaviour + +3) It is now possible to customise the HTML report for your site. +There is an HTML template which can be edited to add your own +branding to the reports you generate. + +4) In addition to the human readable HTML report we now also +generate a tab delimited summary file which should make it +easier to integrate FastQC into an automated reporting system +which spots any potential problems with the data. + + +RELEASE NOTES FOR FastQC V0.1.1 +------------------------------- + +This point release fixes a problem when running FastQC in a +non-interactive mode on a system without a graphical display. +The program should now operate correctly on headless systems +as long as the filename(s) to process are specified on the +command line. + + +RELEASE NOTES FOR FastQC V0.1 +------------------------------- + +FastQC v0.1 is a beta release it should work in its present state but +we are keen to get feedback on the program. In particular we are +interested to hear if anyone has: + +1) Suggestions for other checks we could be performing. + +2) Comments about the criteria we set for issuing warnings or errors and +suggestions for how these could be improved. + +You can report feedback either though our bug reporting tool at: + +www.bioinformatics.bbsrc.ac.uk/bugzilla/ + +...or directly to simon.andrews@bbsrc.ac.uk diff --git a/code/utilities/fastqc_v0.11.3/Templates/Icons/error.png b/code/utilities/fastqc_v0.11.3/Templates/Icons/error.png new file mode 100755 index 0000000..edb1fd8 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Templates/Icons/error.png differ diff --git a/code/utilities/fastqc_v0.11.3/Templates/Icons/fastqc_icon.png b/code/utilities/fastqc_v0.11.3/Templates/Icons/fastqc_icon.png new file mode 100755 index 0000000..348c93b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Templates/Icons/fastqc_icon.png differ diff --git a/code/utilities/fastqc_v0.11.3/Templates/Icons/tick.png b/code/utilities/fastqc_v0.11.3/Templates/Icons/tick.png new file mode 100755 index 0000000..9c6a456 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Templates/Icons/tick.png differ diff --git a/code/utilities/fastqc_v0.11.3/Templates/Icons/warning.png b/code/utilities/fastqc_v0.11.3/Templates/Icons/warning.png new file mode 100755 index 0000000..34db221 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/Templates/Icons/warning.png differ diff --git a/code/utilities/fastqc_v0.11.3/Templates/fastqc2fo.xsl b/code/utilities/fastqc_v0.11.3/Templates/fastqc2fo.xsl new file mode 100755 index 0000000..83f6817 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Templates/fastqc2fo.xsl @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FASTQC-Report + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/Templates/header_template.html b/code/utilities/fastqc_v0.11.3/Templates/header_template.html new file mode 100755 index 0000000..8344dd0 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/Templates/header_template.html @@ -0,0 +1,186 @@ + + @media screen { + div.summary { + width: 18em; + position:fixed; + top: 3em; + margin:1em 0 0 1em; + } + + div.main { + display:block; + position:absolute; + overflow:auto; + height:auto; + width:auto; + top:4.5em; + bottom:2.3em; + left:18em; + right:0; + border-left: 1px solid #CCC; + padding:0 0 0 1em; + background-color: white; + z-index:1; + } + + div.header { + background-color: #EEE; + border:0; + margin:0; + padding: 0.5em; + font-size: 200%; + font-weight: bold; + position:fixed; + width:100%; + top:0; + left:0; + z-index:2; + } + + div.footer { + background-color: #EEE; + border:0; + margin:0; + padding:0.5em; + height: 1.3em; + overflow:hidden; + font-size: 100%; + font-weight: bold; + position:fixed; + bottom:0; + width:100%; + z-index:2; + } + + img.indented { + margin-left: 3em; + } + } + + @media print { + img { + max-width:100% !important; + page-break-inside: avoid; + } + h2, h3 { + page-break-after: avoid; + } + div.header { + background-color: #FFF; + } + + } + + body { + font-family: sans-serif; + color: #000; + background-color: #FFF; + border: 0; + margin: 0; + padding: 0; + } + + div.header { + border:0; + margin:0; + padding: 0.5em; + font-size: 200%; + font-weight: bold; + width:100%; + } + + #header_title { + display:inline-block; + float:left; + clear:left; + } + #header_filename { + display:inline-block; + float:right; + clear:right; + font-size: 50%; + margin-right:2em; + text-align: right; + } + + div.header h3 { + font-size: 50%; + margin-bottom: 0; + } + + div.summary ul { + padding-left:0; + list-style-type:none; + } + + div.summary ul li img { + margin-bottom:-0.5em; + margin-top:0.5em; + } + + div.main { + background-color: white; + } + + div.module { + padding-bottom:1.5em; + padding-top:1.5em; + } + + div.footer { + background-color: #EEE; + border:0; + margin:0; + padding: 0.5em; + font-size: 100%; + font-weight: bold; + width:100%; + } + + + a { + color: #000080; + } + + a:hover { + color: #800000; + } + + h2 { + color: #800000; + padding-bottom: 0; + margin-bottom: 0; + clear:left; + } + + table { + margin-left: 3em; + text-align: center; + } + + th { + text-align: center; + background-color: #000080; + color: #FFF; + padding: 0.4em; + } + + td { + font-family: monospace; + text-align: left; + background-color: #EEE; + color: #000; + padding: 0.4em; + } + + img { + padding-top: 0; + margin-top: 0; + border-top: 0; + } + + + p { + padding-top: 0; + margin-top: 0; + } diff --git a/code/utilities/fastqc_v0.11.3/cisd-jhdf5.jar b/code/utilities/fastqc_v0.11.3/cisd-jhdf5.jar new file mode 100755 index 0000000..2c05d6a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/cisd-jhdf5.jar differ diff --git a/code/utilities/fastqc_v0.11.3/fastqc b/code/utilities/fastqc_v0.11.3/fastqc new file mode 100755 index 0000000..a737484 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/fastqc @@ -0,0 +1,384 @@ +#!/usr/bin/perl +use warnings; +use strict; +use FindBin qw($RealBin); +use Getopt::Long; + +##################################################################################### +# Copyright Copyright 2010-15 Simon Andrews # +# # +# This file is part of FastQC. # +# # +# FastQC is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 3 of the License, or # +# (at your option) any later version. # +# # +# FastQC is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with FastQC; if not, write to the Free Software # +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # +##################################################################################### + + +# Check to see if they've mistakenly downloaded the source distribution +# since several people have made this mistake + +if (-e "$RealBin/uk/ac/babraham/FastQC/FastQCApplication.java") { + die "This is the source distribution of FastQC. You need to get the compiled version if you want to run the program\n"; +} + +my $delimiter = ':'; + +if ($^O =~ /Win/) { + $delimiter = ';'; +} + +if ($ENV{CLASSPATH}) { + $ENV{CLASSPATH} .= "$delimiter$RealBin$delimiter$RealBin/sam-1.103.jar$delimiter$RealBin/jbzip2-0.9.jar$delimiter$RealBin/cisd-jhdf5.jar"; +} +else { + $ENV{CLASSPATH} = "$RealBin$delimiter$RealBin/sam-1.103.jar$delimiter$RealBin/jbzip2-0.9.jar$delimiter$RealBin/cisd-jhdf5.jar"; +} + +my @java_args; +my @files; + +# We now need to scan the command line for switches which we're going +# to pass on to the main java program. + +my $version; +my $help; +my $outdir; +my $unzip; +my $format; +my $contaminant; +my $adapter; +my $limits; +my $threads; +my $quiet; +my $nogroup; +my $expgroup; +my $casava; +my $nano; +my $nofilter; +my $kmer_size; +my $temp_directory; +my $java_bin = 'java'; + +my $result = GetOptions('version' => \$version, + 'help' => \$help, + 'quiet' => \$quiet, + 'nogroup' => \$nogroup, + 'expgroup' => \$expgroup, + 'outdir=s' => \$outdir, + 'extract!' => \$unzip, + 'format=s' => \$format, + 'threads=i' => \$threads, + 'kmers=i' => \$kmer_size, + 'casava' => \$casava, + 'nano' => \$nano, + 'nofilter' => \$nofilter, + 'contaminants=s' => \$contaminant, + 'adapters=s' => \$adapter, + 'limits=s' => \$limits, + 'dir=s' => \$temp_directory, + 'java=s' => \$java_bin, + ); + +# Check the simple stuff first + +if ($help) { + # Just print the help and exit + print while(); + exit; +} + +if ($version) { + push @java_args ,"-Dfastqc.show_version=true"; +} + +# Now parse any additional options +if ($outdir) { + unless(-e $outdir and -d $outdir) { + die "Specified output directory '$outdir' does not exist\n"; + } + + push @java_args ,"-Dfastqc.output_dir=$outdir"; +} + +if ($contaminant) { + unless (-e $contaminant and -r $contaminant) { + die "Contaminant file '$contaminant' did not exist, or could not be read\n"; + } + push @java_args ,"-Dfastqc.contaminant_file=$contaminant"; +} + +if ($adapter) { + unless (-e $adapter and -r $adapter) { + die "Adapters file '$adapter' did not exist, or could not be read\n"; + } + push @java_args ,"-Dfastqc.adapter_file=$adapter"; +} + +if ($limits) { + unless (-e $limits and -r $limits) { + die "Limits file '$limits' did not exist, or could not be read\n"; + } + push @java_args ,"-Dfastqc.limits_file=$limits"; +} + +if ($temp_directory) { + unless (-e $temp_directory and -d $temp_directory and -w $temp_directory) { + die "Temp directory '$temp_directory' doesn't exist, or can't be written to\n"; + } + push @java_args, "-Djava.io.tmpdir=$temp_directory"; + +} + +if ($threads) { + if ($threads < 1) { + die "Number of threads must be a positive integer"; + } + + push @java_args ,"-Dfastqc.threads=$threads"; + my $memory = 250 * $threads; + unshift @java_args,"-Xmx${memory}m"; +} +else { + unshift @java_args,'-Xmx250m'; +} + +if ($kmer_size) { + unless ($kmer_size =~ /^\d+$/) { + die "Kmer size '$kmer_size' was not a number"; + } + + if ($kmer_size < 2 or $kmer_size > 10) { + die "Kmer size must be in the range 2-10"; + } + + push @java_args,"-Dfastqc.kmer_size=$kmer_size"; +} + +if ($quiet) { + push @java_args ,"-Dfastqc.quiet=true"; +} + +if ($casava) { + push @java_args ,"-Dfastqc.casava=true"; +} + +if ($nano) { + push @java_args ,"-Dfastqc.nano=true"; +} + + +if ($nofilter) { + push @java_args ,"-Dfastqc.nofilter=true"; +} + + +if ($nogroup) { + push @java_args ,"-Dfastqc.nogroup=true"; +} + +if ($expgroup) { + if ($nogroup) { + die "You can't specify both --expgroup and --nogroup in the same run\n"; + } + push @java_args ,"-Dfastqc.expgroup=true"; +} + +if (defined $unzip) { + + if ($unzip) { + $unzip = 'true'; + } + else { + $unzip = 'false'; + } + + push @java_args,"-Dfastqc.unzip=$unzip"; +} + +if ($format) { + + unless ($format eq 'bam' || $format eq 'sam' || $format eq 'fastq' || $format eq 'sam_mapped' || $format eq 'bam_mapped') { + die "Unrecognised sequence format '$format', acceptable formats are bam,sam,bam_mapped,sam_mapped and fastq\n"; + } + + push @java_args,"-Dfastqc.sequence_format=$format"; + +} + +if ($java_bin ne 'java') { +# $java_bin =~ s/\\/\//g; + + unless (-e $java_bin) { + die "Couldn't find java interpreter at '$java_bin'"; + } + +# if ($java_bin =~ / /) { +# $java_bin = "\"$java_bin\""; +# } +} + + +# We've found that on systems with large numbers of CPUs, and especially on systems +# where IO contention can occur, that the program can consume large amounts of CPU +# during parallel garbage collection. Since interactive performance isn't really +# important when running non-interactively we'll limit the GC to using only a single +# thread if running with a list of filenames + +if (@ARGV) { + push @java_args,"-XX:ParallelGCThreads=1"; +} + + +foreach (@ARGV) { + if (/^\-D/) { + push @java_args,$_; + } + else { + push @files,$_; + } +} + +# This is set internally as well, but on some JREs it doesn't +# pick up the internally set value properly, so we'll set it +# outside as well which should work. +if (@files or $version or $help) { + push @java_args, "-Djava.awt.headless=true"; +} + +#warn "Running 'exec $java_bin,@java_args, \"uk.ac.babraham.FastQC.FastQCApplication\", @files, CLASSPATH is $ENV{CLASSPATH}"; + + +if ($java_bin ne 'java') { + system $java_bin,@java_args, "uk.ac.babraham.FastQC.FastQCApplication", @files; +} +else { + exec $java_bin,@java_args, "uk.ac.babraham.FastQC.FastQCApplication", @files; +} + +__DATA__ + + FastQC - A high throughput sequence QC analysis tool + +SYNOPSIS + + fastqc seqfile1 seqfile2 .. seqfileN + + fastqc [-o output dir] [--(no)extract] [-f fastq|bam|sam] + [-c contaminant file] seqfile1 .. seqfileN + +DESCRIPTION + + FastQC reads a set of sequence files and produces from each one a quality + control report consisting of a number of different modules, each one of + which will help to identify a different potential type of problem in your + data. + + If no files to process are specified on the command line then the program + will start as an interactive graphical application. If files are provided + on the command line then the program will run with no user interaction + required. In this mode it is suitable for inclusion into a standardised + analysis pipeline. + + The options for the program as as follows: + + -h --help Print this help file and exit + + -v --version Print the version of the program and exit + + -o --outdir 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. + + --casava Files come from raw casava output. Files in the same sample + group (differing only by the group number) will be analysed + as a set rather than individually. Sequences with the filter + flag set in the header will be excluded from the analysis. + Files must have the same names given to them by casava + (including being gzipped and ending with .gz) otherwise they + won't be grouped together correctly. + + --nano Files come from naopore sequences and are in fast5 format. In + this mode you can pass in directories to process and the program + will take in all fast5 files within those directories and produce + a single output file from the sequences found in all files. + + --nofilter If running with --casava then don't remove read flagged by + casava as poor quality when performing the QC analysis. + + --extract If set then the zipped output file will be uncompressed in + the same directory after it has been created. By default + this option will be set if fastqc is run in non-interactive + mode. + + -j --java Provides the full path to the java binary you want to use to + launch fastqc. If not supplied then java is assumed to be in + your path. + + --noextract Do not uncompress the output file after creating it. You + should set this option if you do not wish to uncompress + the output when running in non-interactive mode. + + --nogroup Disable grouping of bases for reads >50bp. All reports will + show data for every base in the read. WARNING: Using this + option will cause fastqc to crash and burn if you use it on + really long reads, and your plots may end up a ridiculous size. + You have been warned! + + -f --format Bypasses the normal sequence file format detection and + forces the program to use the specified format. Valid + formats are bam,sam,bam_mapped,sam_mapped and fastq + + -t --threads Specifies the number of files which can be processed + simultaneously. Each thread will be allocated 250MB of + memory so you shouldn't run more threads than your + available memory will cope with, and not more than + 6 threads on a 32 bit machine + + -c Specifies a non-default file which contains the list of + --contaminants contaminants to screen overrepresented sequences against. + The file must contain sets of named contaminants in the + form name[tab]sequence. Lines prefixed with a hash will + be ignored. + + -a Specifies a non-default file which contains the list of + --adapters adapter sequences which will be explicity searched against + the library. The file must contain sets of named adapters + in the form name[tab]sequence. Lines prefixed with a hash + will be ignored. + + -l Specifies a non-default file which contains a set of criteria + --limits which will be used to determine the warn/error limits for the + various modules. This file can also be used to selectively + remove some modules from the output all together. The format + needs to mirror the default limits.txt file found in the + Configuration folder. + + -k --kmers Specifies the length of Kmer to look for in the Kmer content + module. Specified Kmer length must be between 2 and 10. Default + length is 7 if not specified. + + -q --quiet Supress all progress messages on stdout and only report errors. + + -d --dir Selects a directory to be used for temporary files written when + generating report images. Defaults to system temp directory if + not specified. + +BUGS + + Any bugs in fastqc should be reported either to simon.andrews@babraham.ac.uk + or in www.bioinformatics.babraham.ac.uk/bugzilla/ + + \ No newline at end of file diff --git a/code/utilities/fastqc_v0.11.3/fastqc_icon.ico b/code/utilities/fastqc_v0.11.3/fastqc_icon.ico new file mode 100755 index 0000000..6b5567f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/fastqc_icon.ico differ diff --git a/code/utilities/fastqc_v0.11.3/jbzip2-0.9.jar b/code/utilities/fastqc_v0.11.3/jbzip2-0.9.jar new file mode 100755 index 0000000..803be9d Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/jbzip2-0.9.jar differ diff --git a/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$1.class b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$1.class new file mode 100755 index 0000000..3294940 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$InputStream.class b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$InputStream.class new file mode 100755 index 0000000..b35be85 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$InputStream.class differ diff --git a/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$OutputStream.class b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$OutputStream.class new file mode 100755 index 0000000..98dfc32 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64$OutputStream.class differ diff --git a/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64.class b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64.class new file mode 100755 index 0000000..9870f88 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/net/sourceforge/iharder/base64/Base64.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/UnivariateFunction.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/UnivariateFunction.class new file mode 100755 index 0000000..d33b9ca Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/UnivariateFunction.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.class new file mode 100755 index 0000000..7ec3c9a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AllowedSolution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AllowedSolution.class new file mode 100755 index 0000000..a165fc1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/AllowedSolution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.class new file mode 100755 index 0000000..a0bb4a7 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.class new file mode 100755 index 0000000..992ce4d Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.class new file mode 100755 index 0000000..aade0b1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BrentSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BrentSolver.class new file mode 100755 index 0000000..7ce07ce Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/BrentSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolver.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolver.class new file mode 100755 index 0000000..b72d320 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolver.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.class new file mode 100755 index 0000000..04531ec Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractIntegerDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractIntegerDistribution.class new file mode 100755 index 0000000..b536472 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractIntegerDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution$1.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution$1.class new file mode 100755 index 0000000..fd8fa9c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution.class new file mode 100755 index 0000000..de34f4f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/AbstractRealDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BetaDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BetaDistribution.class new file mode 100755 index 0000000..a99ee20 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BetaDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BinomialDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BinomialDistribution.class new file mode 100755 index 0000000..32a61b8 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/BinomialDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/CauchyDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/CauchyDistribution.class new file mode 100755 index 0000000..6453680 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/CauchyDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ChiSquaredDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ChiSquaredDistribution.class new file mode 100755 index 0000000..922f177 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ChiSquaredDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/FDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/FDistribution.class new file mode 100755 index 0000000..1c30dfa Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/FDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/GammaDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/GammaDistribution.class new file mode 100755 index 0000000..897f214 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/GammaDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/HypergeometricDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/HypergeometricDistribution.class new file mode 100755 index 0000000..dfef2f0 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/HypergeometricDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/IntegerDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/IntegerDistribution.class new file mode 100755 index 0000000..a2096cf Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/IntegerDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/NormalDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/NormalDistribution.class new file mode 100755 index 0000000..d12a930 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/NormalDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PascalDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PascalDistribution.class new file mode 100755 index 0000000..335b7b3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PascalDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PoissonDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PoissonDistribution.class new file mode 100755 index 0000000..3d94938 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/PoissonDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/RealDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/RealDistribution.class new file mode 100755 index 0000000..e388ccf Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/RealDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/SaddlePointExpansion.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/SaddlePointExpansion.class new file mode 100755 index 0000000..3a06a50 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/SaddlePointExpansion.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/TDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/TDistribution.class new file mode 100755 index 0000000..8d7baa4 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/TDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/WeibullDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/WeibullDistribution.class new file mode 100755 index 0000000..247515c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/WeibullDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ZipfDistribution.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ZipfDistribution.class new file mode 100755 index 0000000..20ea56b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/distribution/ZipfDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/ConvergenceException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/ConvergenceException.class new file mode 100755 index 0000000..febb874 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/ConvergenceException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/DimensionMismatchException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/DimensionMismatchException.class new file mode 100755 index 0000000..68ceab8 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/DimensionMismatchException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathArithmeticException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathArithmeticException.class new file mode 100755 index 0000000..68e6dc5 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathArithmeticException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalArgumentException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalArgumentException.class new file mode 100755 index 0000000..7e08da5 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalArgumentException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalNumberException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalNumberException.class new file mode 100755 index 0000000..b2b6c99 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalNumberException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalStateException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalStateException.class new file mode 100755 index 0000000..da59cba Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathIllegalStateException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathInternalError.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathInternalError.class new file mode 100755 index 0000000..bde2f52 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MathInternalError.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MaxCountExceededException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MaxCountExceededException.class new file mode 100755 index 0000000..bda4ddd Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/MaxCountExceededException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NoBracketingException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NoBracketingException.class new file mode 100755 index 0000000..c04783d Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NoBracketingException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotFiniteNumberException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotFiniteNumberException.class new file mode 100755 index 0000000..f3d56e4 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotFiniteNumberException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotPositiveException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotPositiveException.class new file mode 100755 index 0000000..b233299 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotPositiveException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotStrictlyPositiveException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotStrictlyPositiveException.class new file mode 100755 index 0000000..08966ba Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NotStrictlyPositiveException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NullArgumentException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NullArgumentException.class new file mode 100755 index 0000000..2322c9b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NullArgumentException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooLargeException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooLargeException.class new file mode 100755 index 0000000..cc7c158 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooLargeException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooSmallException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooSmallException.class new file mode 100755 index 0000000..2e40d1f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/NumberIsTooSmallException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/OutOfRangeException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/OutOfRangeException.class new file mode 100755 index 0000000..39b1aef Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/OutOfRangeException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/TooManyEvaluationsException.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/TooManyEvaluationsException.class new file mode 100755 index 0000000..a8a6f67 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/TooManyEvaluationsException.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ArgUtils.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ArgUtils.class new file mode 100755 index 0000000..29043d1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ArgUtils.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContext.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContext.class new file mode 100755 index 0000000..f2bdf46 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContext.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContextProvider.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContextProvider.class new file mode 100755 index 0000000..f5567cc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/ExceptionContextProvider.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/Localizable.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/Localizable.class new file mode 100755 index 0000000..b73e2ec Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/Localizable.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/LocalizedFormats.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/LocalizedFormats.class new file mode 100755 index 0000000..20c6734 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/exception/util/LocalizedFormats.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/AbstractWell.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/AbstractWell.class new file mode 100755 index 0000000..7e1b502 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/AbstractWell.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/BitsStreamGenerator.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/BitsStreamGenerator.class new file mode 100755 index 0000000..c1e8cb7 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/BitsStreamGenerator.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomData.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomData.class new file mode 100755 index 0000000..42e5a45 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomData.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomDataImpl.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomDataImpl.class new file mode 100755 index 0000000..0c3dc3f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomDataImpl.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomGenerator.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomGenerator.class new file mode 100755 index 0000000..b856df6 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/RandomGenerator.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/Well19937c.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/Well19937c.class new file mode 100755 index 0000000..a2940cf Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/random/Well19937c.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta$1.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta$1.class new file mode 100755 index 0000000..e65ac49 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta.class new file mode 100755 index 0000000..2bd6b65 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Beta.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Erf.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Erf.class new file mode 100755 index 0000000..e71da1c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Erf.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma$1.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma$1.class new file mode 100755 index 0000000..48f3b74 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma.class new file mode 100755 index 0000000..f62d8dc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/special/Gamma.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ArithmeticUtils.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ArithmeticUtils.class new file mode 100755 index 0000000..49fdd29 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ArithmeticUtils.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ContinuedFraction.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ContinuedFraction.class new file mode 100755 index 0000000..1f1392f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ContinuedFraction.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/DoubleArray.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/DoubleArray.class new file mode 100755 index 0000000..b2fef4e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/DoubleArray.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpFracTable.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpFracTable.class new file mode 100755 index 0000000..dd9d092 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpFracTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpIntTable.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpIntTable.class new file mode 100755 index 0000000..9bdd8fa Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$ExpIntTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$lnMant.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$lnMant.class new file mode 100755 index 0000000..5b7e8fd Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath$lnMant.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath.class new file mode 100755 index 0000000..f5fada5 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMath.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathCalc.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathCalc.class new file mode 100755 index 0000000..e125892 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathCalc.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathLiteralArrays.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathLiteralArrays.class new file mode 100755 index 0000000..75307f3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/FastMathLiteralArrays.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$1.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$1.class new file mode 100755 index 0000000..6c70bf0 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$MaxCountExceededCallback.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$MaxCountExceededCallback.class new file mode 100755 index 0000000..d3684af Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor$MaxCountExceededCallback.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor.class new file mode 100755 index 0000000..ef2dd8a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Incrementor.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/MathUtils.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/MathUtils.class new file mode 100755 index 0000000..0836347 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/MathUtils.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Precision.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Precision.class new file mode 100755 index 0000000..eed7d8c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/Precision.class differ diff --git a/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ResizableDoubleArray.class b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ResizableDoubleArray.class new file mode 100755 index 0000000..ee29366 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/org/apache/commons/math3/util/ResizableDoubleArray.class differ diff --git a/code/utilities/fastqc_v0.11.3/run_fastqc.bat b/code/utilities/fastqc_v0.11.3/run_fastqc.bat new file mode 100755 index 0000000..9510dde --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/run_fastqc.bat @@ -0,0 +1 @@ +java -Xmx250m -classpath .;./sam-1.103.jar;./jbzip2-0.9.jar uk.ac.babraham.FastQC.FastQCApplication diff --git a/code/utilities/fastqc_v0.11.3/sam-1.103.jar b/code/utilities/fastqc_v0.11.3/sam-1.103.jar new file mode 100755 index 0000000..310065b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/sam-1.103.jar differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisListener.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisListener.class new file mode 100755 index 0000000..c8210a9 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisListener.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisQueue.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisQueue.class new file mode 100755 index 0000000..59afcb4 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisQueue.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisRunner.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisRunner.class new file mode 100755 index 0000000..b3368b9 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/AnalysisRunner.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/OfflineRunner.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/OfflineRunner.class new file mode 100755 index 0000000..b5ce879 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Analysis/OfflineRunner.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog$1.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog$1.class new file mode 100755 index 0000000..e3532ee Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog.class new file mode 100755 index 0000000..3799ecc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/AboutDialog.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel$SmoothJLabel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel$SmoothJLabel.class new file mode 100755 index 0000000..443524c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel$SmoothJLabel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel.class new file mode 100755 index 0000000..6da5c07 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/FastQCTitlePanel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/WelcomePanel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/WelcomePanel.class new file mode 100755 index 0000000..a017271 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Dialogs/WelcomePanel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication$1.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication$1.class new file mode 100755 index 0000000..ae8e616 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication$1.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication.class new file mode 100755 index 0000000..ace0e36 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCApplication.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCConfig.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCConfig.class new file mode 100755 index 0000000..0de9eea Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCConfig.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCMenuBar.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCMenuBar.class new file mode 100755 index 0000000..a0c3943 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FastQCMenuBar.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/BAMFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/BAMFileFilter.class new file mode 100755 index 0000000..3d83e00 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/BAMFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/CasavaFastQFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/CasavaFastQFileFilter.class new file mode 100755 index 0000000..abdbf2f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/CasavaFastQFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/FastQFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/FastQFileFilter.class new file mode 100755 index 0000000..c005190 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/FastQFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/GobyFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/GobyFileFilter.class new file mode 100755 index 0000000..8b3d5e5 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/GobyFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/MappedBAMFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/MappedBAMFileFilter.class new file mode 100755 index 0000000..8946ede Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/MappedBAMFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/SequenceFileFilter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/SequenceFileFilter.class new file mode 100755 index 0000000..8435589 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/FileFilters/SequenceFileFilter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/BaseGroup.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/BaseGroup.class new file mode 100755 index 0000000..de77bf1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/BaseGroup.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/LineGraph.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/LineGraph.class new file mode 100755 index 0000000..fd0ab3e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/LineGraph.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/QualityBoxPlot.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/QualityBoxPlot.class new file mode 100755 index 0000000..1ad880e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/QualityBoxPlot.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/TileGraph.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/TileGraph.class new file mode 100755 index 0000000..f00977d Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Graphs/TileGraph.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpDialog.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpDialog.class new file mode 100755 index 0000000..5bbbb21 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpDialog.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot$FileSorter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot$FileSorter.class new file mode 100755 index 0000000..e944f3b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot$FileSorter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot.class new file mode 100755 index 0000000..313ef31 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpIndexRoot.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPage.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPage.class new file mode 100755 index 0000000..d2da4bc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPage.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay$HelpEditor.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay$HelpEditor.class new file mode 100755 index 0000000..2554434 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay$HelpEditor.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay.class new file mode 100755 index 0000000..ed169ef Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpPageDisplay.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpSearchPanel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpSearchPanel.class new file mode 100755 index 0000000..f04c6cc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Help/HelpSearchPanel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AbstractQCModule.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AbstractQCModule.class new file mode 100755 index 0000000..0147770 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AbstractQCModule.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$Adapter.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$Adapter.class new file mode 100755 index 0000000..16c5867 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$Adapter.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$ResultsTable.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$ResultsTable.class new file mode 100755 index 0000000..f179b72 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent$ResultsTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent.class new file mode 100755 index 0000000..da6908a Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/AdapterContent.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats$ResultsTable.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats$ResultsTable.class new file mode 100755 index 0000000..031ce9d Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats$ResultsTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats.class new file mode 100755 index 0000000..e4be1c3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/BasicStats.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/DuplicationLevel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/DuplicationLevel.class new file mode 100755 index 0000000..c23fb48 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/DuplicationLevel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModel.class new file mode 100755 index 0000000..da1dfb1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModelValue.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModelValue.class new file mode 100755 index 0000000..f7974cc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/GCModel/GCModelValue.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$Kmer.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$Kmer.class new file mode 100755 index 0000000..88aa00b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$Kmer.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$ResultsTable.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$ResultsTable.class new file mode 100755 index 0000000..6e33046 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent$ResultsTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent.class new file mode 100755 index 0000000..06a8e18 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/KmerContent.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleConfig.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleConfig.class new file mode 100755 index 0000000..b6446e2 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleConfig.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleFactory.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleFactory.class new file mode 100755 index 0000000..d93fb87 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/ModuleFactory.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/NContent.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/NContent.class new file mode 100755 index 0000000..18941ee Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/NContent.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$OverrepresentedSeq.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$OverrepresentedSeq.class new file mode 100755 index 0000000..224c000 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$OverrepresentedSeq.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$ResultsTable.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$ResultsTable.class new file mode 100755 index 0000000..6d212ca Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs$ResultsTable.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs.class new file mode 100755 index 0000000..e56821b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/OverRepresentedSeqs.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseQualityScores.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseQualityScores.class new file mode 100755 index 0000000..db2ee1f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseQualityScores.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseSequenceContent.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseSequenceContent.class new file mode 100755 index 0000000..0ae4a2b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerBaseSequenceContent.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceGCContent.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceGCContent.class new file mode 100755 index 0000000..d0c671f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceGCContent.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceQualityScores.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceQualityScores.class new file mode 100755 index 0000000..c91f462 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerSequenceQualityScores.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerTileQualityScores.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerTileQualityScores.class new file mode 100755 index 0000000..6418f60 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/PerTileQualityScores.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/QCModule.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/QCModule.class new file mode 100755 index 0000000..88728cf Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/QCModule.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/SequenceLengthDistribution.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/SequenceLengthDistribution.class new file mode 100755 index 0000000..ac0a3f7 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Modules/SequenceLengthDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/HTMLReportArchive.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/HTMLReportArchive.class new file mode 100755 index 0000000..db6cb79 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/HTMLReportArchive.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/stylesheet.txt b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/stylesheet.txt new file mode 100755 index 0000000..3d5a57b --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Report/stylesheet.txt @@ -0,0 +1,55 @@ + body { + font-family: sans-serif; + color: #000000; + background-color: #FFFFFF; + } + + a { + color: #000080; + } + + a:hover { + color: #800000; + } + + h2 { + color: #800000; + padding-bottom: 0; + margin-bottom: 0; + padding-top: 2em; + } + + table { + margin-left: 3em; + text-align: center; + } + + th { + text-align: center; + background-color: #000080; + color: #FFFFFF; + padding: 0.4em; + } + + td { + font-family: monospace; + text-align: left; + background-color: #EEEEEE; + color: #000000; + padding: 0.4em; + } + + img { + padding-top: 0; + margin-top: 0; + border-top: 0; + } + + img.indented { + margin-left: 3em; + } + + p { + padding-top: 0; + margin-top: 0; + } diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/error.png b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/error.png new file mode 100755 index 0000000..edb1fd8 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/error.png differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.png b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.png new file mode 100755 index 0000000..348c93b Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.png differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.svg b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.svg new file mode 100755 index 0000000..04bf1d5 --- /dev/null +++ b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon.svg @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + C + + + + + + + Q + + diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon_100.png b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon_100.png new file mode 100755 index 0000000..668c917 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/fastqc_icon_100.png differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/tick.png b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/tick.png new file mode 100755 index 0000000..9c6a456 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/tick.png differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/warning.png b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/warning.png new file mode 100755 index 0000000..34db221 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Resources/warning.png differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel$ModuleRenderer.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel$ModuleRenderer.class new file mode 100755 index 0000000..56a90d0 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel$ModuleRenderer.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel.class new file mode 100755 index 0000000..d45cd98 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Results/ResultsPanel.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/BAMFile.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/BAMFile.class new file mode 100755 index 0000000..3f01a92 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/BAMFile.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/Contaminant.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/Contaminant.class new file mode 100755 index 0000000..c024119 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/Contaminant.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminantHit.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminantHit.class new file mode 100755 index 0000000..0888553 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminantHit.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminentFinder.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminentFinder.class new file mode 100755 index 0000000..9a78af3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Contaminant/ContaminentFinder.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Fast5File.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Fast5File.class new file mode 100755 index 0000000..d56ddd3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Fast5File.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/FastQFile.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/FastQFile.class new file mode 100755 index 0000000..06b5ea1 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/FastQFile.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/QualityEncoding/PhredEncoding.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/QualityEncoding/PhredEncoding.class new file mode 100755 index 0000000..21acc28 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/QualityEncoding/PhredEncoding.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Sequence.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Sequence.class new file mode 100755 index 0000000..97971cd Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/Sequence.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFactory.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFactory.class new file mode 100755 index 0000000..a02465c Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFactory.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFile.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFile.class new file mode 100755 index 0000000..8e7cca3 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFile.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFileGroup.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFileGroup.class new file mode 100755 index 0000000..9280396 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFileGroup.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFormatException.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFormatException.class new file mode 100755 index 0000000..a76e648 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Sequence/SequenceFormatException.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/NormalDistribution.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/NormalDistribution.class new file mode 100755 index 0000000..4f037ec Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/NormalDistribution.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/PearsonCorrelation.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/PearsonCorrelation.class new file mode 100755 index 0000000..a8fa3c8 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Statistics/PearsonCorrelation.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/CasavaBasename.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/CasavaBasename.class new file mode 100755 index 0000000..ccba85f Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/CasavaBasename.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/HotColdColourGradient.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/HotColdColourGradient.class new file mode 100755 index 0000000..118b168 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/HotColdColourGradient.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/ImageToBase64.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/ImageToBase64.class new file mode 100755 index 0000000..61b4359 Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/ImageToBase64.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/MultiMemberGZIPInputStream.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/MultiMemberGZIPInputStream.class new file mode 100755 index 0000000..e0eaffc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/MultiMemberGZIPInputStream.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NameFormatException.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NameFormatException.class new file mode 100755 index 0000000..daeaaff Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NameFormatException.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NanoporeBasename.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NanoporeBasename.class new file mode 100755 index 0000000..471e9fc Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/NanoporeBasename.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/QualityCount.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/QualityCount.class new file mode 100755 index 0000000..fb7a0da Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/QualityCount.class differ diff --git a/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/RGB.class b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/RGB.class new file mode 100755 index 0000000..b10000e Binary files /dev/null and b/code/utilities/fastqc_v0.11.3/uk/ac/babraham/FastQC/Utilities/RGB.class differ diff --git a/code/utilities/genePredToGtf b/code/utilities/genePredToGtf new file mode 100755 index 0000000..b88e7d0 Binary files /dev/null and b/code/utilities/genePredToGtf differ diff --git a/code/utilities/sratoolkit b/code/utilities/sratoolkit new file mode 120000 index 0000000..6196d71 --- /dev/null +++ b/code/utilities/sratoolkit @@ -0,0 +1 @@ +sratoolkit.2.4.2-centos_linux64/bin \ No newline at end of file diff --git a/code/utilities/sratoolkit.2.4.2-centos_linux64/bin/fastq-dump.2.4.2 b/code/utilities/sratoolkit.2.4.2-centos_linux64/bin/fastq-dump.2.4.2 new file mode 100755 index 0000000..21ab6ef Binary files /dev/null and b/code/utilities/sratoolkit.2.4.2-centos_linux64/bin/fastq-dump.2.4.2 differ diff --git a/code/utilities/subread b/code/utilities/subread new file mode 120000 index 0000000..fc222a2 --- /dev/null +++ b/code/utilities/subread @@ -0,0 +1 @@ +subread-1.4.6-Linux-x86_64/bin/ \ No newline at end of file diff --git a/code/utilities/subread-1.4.6-Linux-x86_64/bin/featureCounts b/code/utilities/subread-1.4.6-Linux-x86_64/bin/featureCounts new file mode 100755 index 0000000..3047ca0 Binary files /dev/null and b/code/utilities/subread-1.4.6-Linux-x86_64/bin/featureCounts differ diff --git a/code/utilities/twoBitToFa b/code/utilities/twoBitToFa new file mode 100755 index 0000000..a32f5fb Binary files /dev/null and b/code/utilities/twoBitToFa differ diff --git a/code/utilities/wigToBigWig b/code/utilities/wigToBigWig new file mode 100755 index 0000000..ae8de5e Binary files /dev/null and b/code/utilities/wigToBigWig differ diff --git a/code/wait_jobs.bash b/code/wait_jobs.bash new file mode 100755 index 0000000..43b10b4 --- /dev/null +++ b/code/wait_jobs.bash @@ -0,0 +1,15 @@ +#!/bin/bash + +source code/custom-bashrc + +INPUT=$@ + +TOTAL=`echo ${INPUT[*]} | sed 's/\s\+/\n/g' | wc -l` + +STATUS=`echo ${INPUT[*]} | sed 's/\s\+\|$/.out /g' | xargs -n1 tail -1 | grep "^###### Done ######$" | wc -l` + +while [ $STATUS -lt $TOTAL ] +do + STATUS=`echo ${INPUT[*]} | sed 's/\s\+\|$/.out /g' | xargs -n1 tail -1 | grep "^###### Done ######$" | wc -l` + sleep 10 +done diff --git a/params b/params index 38c2f2b..b21836d 100644 --- a/params +++ b/params @@ -1,4 +1,4 @@ -#STAR-Genome --genomeFastaFiles referenceFiles/genome.fa +STAR-Genome --genomeFastaFiles referenceFiles/genome.fa fastq-download meta_data fastq-link meta_data/20160425.txt #meta_data/sra_info.txt #fastqc meta_data/sra_info.txt diff --git a/referenceFiles/chromInfo.txt b/referenceFiles/chromInfo.txt deleted file mode 120000 index 7a4df2d..0000000 --- a/referenceFiles/chromInfo.txt +++ /dev/null @@ -1 +0,0 @@ -/ifs/home/gongy05/references/hg19/chromInfo.txt \ No newline at end of file diff --git a/referenceFiles/chromInfo.txt b/referenceFiles/chromInfo.txt new file mode 100755 index 0000000..3a5d586 --- /dev/null +++ b/referenceFiles/chromInfo.txt @@ -0,0 +1,93 @@ +chr1 249250621 +chr1_gl000191_random 106433 +chr1_gl000192_random 547496 +chr2 243199373 +chr3 198022430 +chr4 191154276 +chr4_ctg9_hap1 590426 +chr4_gl000193_random 189789 +chr4_gl000194_random 191469 +chr5 180915260 +chr6 171115067 +chr6_apd_hap1 4622290 +chr6_cox_hap2 4795371 +chr6_dbb_hap3 4610396 +chr6_mann_hap4 4683263 +chr6_mcf_hap5 4833398 +chr6_qbl_hap6 4611984 +chr6_ssto_hap7 4928567 +chr7 159138663 +chr7_gl000195_random 182896 +chr8 146364022 +chr8_gl000196_random 38914 +chr8_gl000197_random 37175 +chr9 141213431 +chr9_gl000198_random 90085 +chr9_gl000199_random 169874 +chr9_gl000200_random 187035 +chr9_gl000201_random 36148 +chr10 135534747 +chr11 135006516 +chr11_gl000202_random 40103 +chr12 133851895 +chr13 115169878 +chr14 107349540 +chr15 102531392 +chr16 90354753 +chr17 81195210 +chr17_ctg5_hap1 1680828 +chr17_gl000203_random 37498 +chr17_gl000204_random 81310 +chr17_gl000205_random 174588 +chr17_gl000206_random 41001 +chr18 78077248 +chr18_gl000207_random 4262 +chr19 59128983 +chr19_gl000208_random 92689 +chr19_gl000209_random 159169 +chr20 63025520 +chr21 48129895 +chr21_gl000210_random 27682 +chr22 51304566 +chrX 155270560 +chrY 59373566 +chrUn_gl000211 166566 +chrUn_gl000212 186858 +chrUn_gl000213 164239 +chrUn_gl000214 137718 +chrUn_gl000215 172545 +chrUn_gl000216 172294 +chrUn_gl000217 172149 +chrUn_gl000218 161147 +chrUn_gl000219 179198 +chrUn_gl000220 161802 +chrUn_gl000221 155397 +chrUn_gl000222 186861 +chrUn_gl000223 180455 +chrUn_gl000224 179693 +chrUn_gl000225 211173 +chrUn_gl000226 15008 +chrUn_gl000227 128374 +chrUn_gl000228 129120 +chrUn_gl000229 19913 +chrUn_gl000230 43691 +chrUn_gl000231 27386 +chrUn_gl000232 40652 +chrUn_gl000233 45941 +chrUn_gl000234 40531 +chrUn_gl000235 34474 +chrUn_gl000236 41934 +chrUn_gl000237 45867 +chrUn_gl000238 39939 +chrUn_gl000239 33824 +chrUn_gl000240 41933 +chrUn_gl000241 42152 +chrUn_gl000242 43523 +chrUn_gl000243 43341 +chrUn_gl000244 39929 +chrUn_gl000245 36651 +chrUn_gl000246 38154 +chrUn_gl000247 36422 +chrUn_gl000248 39786 +chrUn_gl000249 38502 +chrM 16571 \ No newline at end of file diff --git a/referenceFiles/files_needed.bash b/referenceFiles/files_needed.bash new file mode 100644 index 0000000..8d09c01 --- /dev/null +++ b/referenceFiles/files_needed.bash @@ -0,0 +1,23 @@ +#!/bin/bash + + +# genome.fa +wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.2bit + +twoBitToFa hg19.2bit genome.fa + +samtools index genome.fa + +# gene.gtf +wget ftp://ftp.sanger.ac.uk/pub/gencode/Gencode_human/release_19/gencode.v19.annotation.gtf.gz + +gunzip gencode.v19.annotation.gtf.gz + +# chromosome sizes +wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes +mv hg19.chrom.sizes chromInfo.txt + +# STAR Index +cd ../ +code/generate_STAR-Index 6 params referenceFiles/STAR_Reference + diff --git a/referenceFiles/files_needed.txt b/referenceFiles/files_needed.txt deleted file mode 100644 index ba0ece4..0000000 --- a/referenceFiles/files_needed.txt +++ /dev/null @@ -1,3 +0,0 @@ -genome.fa -chromInfo.txt -gene.gtf diff --git a/referenceFiles/genome.fa b/referenceFiles/genome.fa new file mode 120000 index 0000000..6b61aee --- /dev/null +++ b/referenceFiles/genome.fa @@ -0,0 +1 @@ +/ifs/home/gongy05/references/hg19/genome.fa \ No newline at end of file diff --git a/referenceFiles/genome.fa.fai b/referenceFiles/genome.fa.fai new file mode 120000 index 0000000..1602bee --- /dev/null +++ b/referenceFiles/genome.fa.fai @@ -0,0 +1 @@ +/ifs/home/gongy05/references/hg19/genome.fa.fai \ No newline at end of file diff --git a/referenceFiles/maskPlussnRNA.gtf b/referenceFiles/maskPlussnRNA.gtf deleted file mode 120000 index a88428b..0000000 --- a/referenceFiles/maskPlussnRNA.gtf +++ /dev/null @@ -1 +0,0 @@ -/ifs/home/gongy05/references/hg19/maskPlussnRNA.gtf \ No newline at end of file diff --git a/referenceFiles/maskPlussnRNA.gtf b/referenceFiles/maskPlussnRNA.gtf new file mode 100755 index 0000000..d2747b9 --- /dev/null +++ b/referenceFiles/maskPlussnRNA.gtf @@ -0,0 +1,10287 @@ +chr1 Cufflinks exon 1484379 1484447 . + . gene_id "XLOC_000001"; transcript_id "TCONS_00000001"; exon_number "1"; oId "CUFF.6.1"; tss_id "TSS1"; +chr1 Cufflinks exon 1501884 1501932 . + . gene_id "XLOC_000002"; transcript_id "TCONS_00000002"; exon_number "1"; oId "CUFF.7.1"; tss_id "TSS2"; +chr1 Cufflinks exon 1815108 1815204 . + . gene_id "XLOC_000003"; transcript_id "TCONS_00000003"; exon_number "1"; oId "CUFF.8.1"; tss_id "TSS3"; +chr1 Cufflinks exon 3699379 3699694 . + . gene_id "XLOC_000004"; transcript_id "TCONS_00000004"; exon_number "1"; oId "CUFF.10.1"; tss_id "TSS4"; +chr1 Cufflinks exon 6600914 6600994 . + . gene_id "XLOC_000005"; transcript_id "TCONS_00000005"; exon_number "1"; oId "CUFF.15.1"; tss_id "TSS5"; +chr1 Cufflinks exon 6812798 6812884 . + . gene_id "XLOC_000006"; transcript_id "TCONS_00000006"; exon_number "1"; oId "CUFF.16.1"; tss_id "TSS6"; +chr1 Cufflinks exon 7279420 7279584 . + . gene_id "XLOC_000007"; transcript_id "TCONS_00000007"; exon_number "1"; oId "CUFF.17.1"; tss_id "TSS7"; +chr1 Cufflinks exon 7588814 7588845 . + . gene_id "XLOC_000008"; transcript_id "TCONS_00000008"; exon_number "1"; oId "CUFF.18.1"; tss_id "TSS8"; +chr1 Cufflinks exon 7876434 7876473 . + . gene_id "XLOC_000009"; transcript_id "TCONS_00000009"; exon_number "1"; oId "CUFF.20.1"; tss_id "TSS9"; +chr1 Cufflinks exon 8429528 8429573 . + . gene_id "XLOC_000010"; transcript_id "TCONS_00000010"; exon_number "1"; oId "CUFF.25.1"; tss_id "TSS10"; +chr1 Cufflinks exon 8595100 8595227 . + . gene_id "XLOC_000011"; transcript_id "TCONS_00000011"; exon_number "1"; oId "CUFF.26.1"; tss_id "TSS11"; +chr1 Cufflinks exon 9156974 9157009 . + . gene_id "XLOC_000012"; transcript_id "TCONS_00000012"; exon_number "1"; oId "CUFF.29.1"; tss_id "TSS12"; +chr1 Cufflinks exon 10007377 10007620 . + . gene_id "XLOC_000013"; transcript_id "TCONS_00000013"; exon_number "1"; oId "CUFF.32.1"; tss_id "TSS13"; +chr1 Cufflinks exon 10223334 10223431 . + . gene_id "XLOC_000014"; transcript_id "TCONS_00000014"; exon_number "1"; oId "CUFF.34.1"; tss_id "TSS14"; +chr1 Cufflinks exon 10359024 10359128 . + . gene_id "XLOC_000015"; transcript_id "TCONS_00000015"; exon_number "1"; oId "CUFF.35.1"; tss_id "TSS15"; +chr1 Cufflinks exon 10366523 10366835 . + . gene_id "XLOC_000016"; transcript_id "TCONS_00000016"; exon_number "1"; oId "CUFF.36.1"; tss_id "TSS16"; +chr1 Cufflinks exon 10676893 10677179 . + . gene_id "XLOC_000017"; transcript_id "TCONS_00000017"; exon_number "1"; oId "CUFF.37.1"; tss_id "TSS17"; +chr1 Cufflinks exon 11212407 11212470 . + . gene_id "XLOC_000018"; transcript_id "TCONS_00000018"; exon_number "1"; oId "CUFF.38.1"; tss_id "TSS18"; +chr1 Cufflinks exon 11286311 11286417 . + . gene_id "XLOC_000019"; transcript_id "TCONS_00000019"; exon_number "1"; oId "CUFF.40.1"; tss_id "TSS19"; +chr1 Cufflinks exon 11968209 11968328 . + . gene_id "XLOC_000020"; transcript_id "TCONS_00000020"; exon_number "1"; oId "CUFF.41.1"; tss_id "TSS20"; +chr1 Cufflinks exon 12096111 12096179 . + . gene_id "XLOC_000021"; transcript_id "TCONS_00000021"; exon_number "1"; oId "CUFF.43.1"; tss_id "TSS21"; +chr1 Cufflinks exon 12799692 12799798 . + . gene_id "XLOC_000022"; transcript_id "TCONS_00000022"; exon_number "1"; oId "CUFF.47.1"; tss_id "TSS22"; +chr1 Cufflinks exon 12982374 12982480 . + . gene_id "XLOC_000023"; transcript_id "TCONS_00000023"; exon_number "1"; oId "CUFF.48.1"; tss_id "TSS23"; +chr1 Cufflinks exon 16214190 16214231 . + . gene_id "XLOC_000024"; transcript_id "TCONS_00000024"; exon_number "1"; oId "CUFF.59.1"; tss_id "TSS24"; +chr1 Cufflinks exon 16220184 16220246 . + . gene_id "XLOC_000025"; transcript_id "TCONS_00000025"; exon_number "1"; oId "CUFF.60.1"; tss_id "TSS25"; +chr1 Cufflinks exon 16237391 16237495 . + . gene_id "XLOC_000026"; transcript_id "TCONS_00000026"; exon_number "1"; oId "CUFF.61.1"; tss_id "TSS26"; +chr1 Cufflinks exon 16860014 16860081 . + . gene_id "XLOC_000027"; transcript_id "TCONS_00000027"; exon_number "1"; oId "CUFF.66.1"; tss_id "TSS27"; +chr1 Cufflinks exon 16879957 16880028 . + . gene_id "XLOC_000028"; transcript_id "TCONS_00000028"; exon_number "1"; oId "CUFF.72.1"; tss_id "TSS28"; +chr1 Cufflinks exon 17052061 17052133 . + . gene_id "XLOC_000029"; transcript_id "TCONS_00000029"; exon_number "1"; oId "CUFF.78.1"; tss_id "TSS29"; +chr1 Cufflinks exon 17053780 17053853 . + . gene_id "XLOC_000030"; transcript_id "TCONS_00000030"; exon_number "1"; oId "CUFF.79.1"; tss_id "TSS30"; +chr1 Cufflinks exon 17055076 17055143 . + . gene_id "XLOC_000031"; transcript_id "TCONS_00000031"; exon_number "1"; oId "CUFF.80.1"; tss_id "TSS31"; +chr1 Cufflinks exon 17067011 17067174 . + . gene_id "XLOC_000032"; transcript_id "TCONS_00000032"; exon_number "1"; oId "CUFF.81.1"; tss_id "TSS32"; +chr1 Cufflinks exon 17074822 17074854 . + . gene_id "XLOC_000033"; transcript_id "TCONS_00000033"; exon_number "1"; oId "CUFF.82.1"; tss_id "TSS33"; +chr1 Cufflinks exon 17186693 17186767 . + . gene_id "XLOC_000034"; transcript_id "TCONS_00000034"; exon_number "1"; oId "CUFF.84.1"; tss_id "TSS34"; +chr1 Cufflinks exon 17188416 17188486 . + . gene_id "XLOC_000035"; transcript_id "TCONS_00000035"; exon_number "1"; oId "CUFF.85.1"; tss_id "TSS35"; +chr1 Cufflinks exon 17189721 17189788 . + . gene_id "XLOC_000036"; transcript_id "TCONS_00000036"; exon_number "1"; oId "CUFF.86.1"; tss_id "TSS36"; +chr1 Cufflinks exon 17199078 17199149 . + . gene_id "XLOC_000037"; transcript_id "TCONS_00000037"; exon_number "1"; oId "CUFF.87.1"; tss_id "TSS37"; +chr1 Cufflinks exon 17200205 17200343 . + . gene_id "XLOC_000038"; transcript_id "TCONS_00000038"; exon_number "1"; oId "CUFF.88.1"; tss_id "TSS38"; +chr1 Cufflinks exon 17201958 17202031 . + . gene_id "XLOC_000039"; transcript_id "TCONS_00000039"; exon_number "1"; oId "CUFF.90.1"; tss_id "TSS39"; +chr1 Cufflinks exon 17216172 17216246 . + . gene_id "XLOC_000040"; transcript_id "TCONS_00000040"; exon_number "1"; oId "CUFF.91.1"; tss_id "TSS40"; +chr1 Cufflinks exon 17222475 17222638 . + . gene_id "XLOC_000041"; transcript_id "TCONS_00000041"; exon_number "1"; oId "CUFF.92.1"; tss_id "TSS41"; +chr1 Cufflinks exon 17776262 17776362 . + . gene_id "XLOC_000042"; transcript_id "TCONS_00000042"; exon_number "1"; oId "CUFF.95.1"; tss_id "TSS42"; +chr1 Cufflinks exon 18920246 18920281 . + . gene_id "XLOC_000043"; transcript_id "TCONS_00000043"; exon_number "1"; oId "CUFF.96.1"; tss_id "TSS43"; +chr1 Cufflinks exon 19447042 19447081 . + . gene_id "XLOC_000044"; transcript_id "TCONS_00000044"; exon_number "1"; oId "CUFF.97.1"; tss_id "TSS44"; +chr1 Cufflinks exon 19750878 19751093 . + . gene_id "XLOC_000045"; transcript_id "TCONS_00000045"; exon_number "1"; oId "CUFF.99.1"; tss_id "TSS45"; +chr1 Cufflinks exon 19837087 19837205 . + . gene_id "XLOC_000046"; transcript_id "TCONS_00000046"; exon_number "1"; oId "CUFF.100.1"; tss_id "TSS46"; +chr1 Cufflinks exon 20297463 20297763 . + . gene_id "XLOC_000047"; transcript_id "TCONS_00000047"; exon_number "1"; oId "CUFF.102.1"; tss_id "TSS47"; +chr1 Cufflinks exon 20936270 20936422 . + . gene_id "XLOC_000048"; transcript_id "TCONS_00000048"; exon_number "1"; oId "CUFF.103.1"; tss_id "TSS48"; +chr1 Cufflinks exon 21167735 21167791 . + . gene_id "XLOC_000049"; transcript_id "TCONS_00000049"; exon_number "1"; oId "CUFF.104.1"; tss_id "TSS49"; +chr1 Cufflinks exon 21421354 21421448 . + . gene_id "XLOC_000050"; transcript_id "TCONS_00000050"; exon_number "1"; oId "CUFF.105.1"; tss_id "TSS50"; +chr1 Cufflinks exon 21740714 21740785 . + . gene_id "XLOC_000051"; transcript_id "TCONS_00000051"; exon_number "1"; oId "CUFF.106.1"; tss_id "TSS51"; +chr1 Cufflinks exon 22067633 22067672 . + . gene_id "XLOC_000052"; transcript_id "TCONS_00000052"; exon_number "1"; oId "CUFF.109.1"; tss_id "TSS52"; +chr1 Cufflinks exon 22313974 22314406 . + . gene_id "XLOC_000053"; transcript_id "TCONS_00000053"; exon_number "1"; oId "CUFF.110.1"; tss_id "TSS53"; +chr1 Cufflinks exon 22337143 22337574 . + . gene_id "XLOC_000054"; transcript_id "TCONS_00000054"; exon_number "1"; oId "CUFF.111.1"; tss_id "TSS54"; +chr1 Cufflinks exon 23489197 23489303 . + . gene_id "XLOC_000055"; transcript_id "TCONS_00000055"; exon_number "1"; oId "CUFF.113.1"; tss_id "TSS55"; +chr1 Cufflinks exon 23490450 23490518 . + . gene_id "XLOC_000056"; transcript_id "TCONS_00000056"; exon_number "1"; oId "CUFF.114.1"; tss_id "TSS56"; +chr1 Cufflinks exon 23592221 23592257 . + . gene_id "XLOC_000057"; transcript_id "TCONS_00000057"; exon_number "1"; oId "CUFF.115.1"; tss_id "TSS57"; +chr1 Cufflinks exon 23831837 23831872 . + . gene_id "XLOC_000058"; transcript_id "TCONS_00000058"; exon_number "1"; oId "CUFF.116.1"; tss_id "TSS58"; +chr1 Cufflinks exon 23956118 23956158 . + . gene_id "XLOC_000059"; transcript_id "TCONS_00000059"; exon_number "1"; oId "CUFF.117.1"; tss_id "TSS59"; +chr1 Cufflinks exon 24208744 24208844 . + . gene_id "XLOC_000060"; transcript_id "TCONS_00000060"; exon_number "1"; oId "CUFF.120.1"; tss_id "TSS60"; +chr1 Cufflinks exon 24330616 24330672 . + . gene_id "XLOC_000061"; transcript_id "TCONS_00000061"; exon_number "1"; oId "CUFF.121.1"; tss_id "TSS61"; +chr1 Cufflinks exon 25667462 25667525 . + . gene_id "XLOC_000062"; transcript_id "TCONS_00000062"; exon_number "1"; oId "CUFF.126.1"; tss_id "TSS62"; +chr1 Cufflinks exon 26290688 26290791 . + . gene_id "XLOC_000063"; transcript_id "TCONS_00000063"; exon_number "1"; oId "CUFF.128.1"; tss_id "TSS63"; +chr1 Cufflinks exon 26573245 26573315 . + . gene_id "XLOC_000064"; transcript_id "TCONS_00000064"; exon_number "1"; oId "CUFF.130.1"; tss_id "TSS64"; +chr1 Cufflinks exon 26690267 26690313 . + . gene_id "XLOC_000065"; transcript_id "TCONS_00000065"; exon_number "1"; oId "CUFF.131.1"; tss_id "TSS65"; +chr1 Cufflinks exon 26928831 26928865 . + . gene_id "XLOC_000066"; transcript_id "TCONS_00000066"; exon_number "1"; oId "CUFF.133.1"; tss_id "TSS66"; +chr1 Cufflinks exon 27141328 27141619 . + . gene_id "XLOC_000067"; transcript_id "TCONS_00000067"; exon_number "1"; oId "CUFF.136.1"; tss_id "TSS67"; +chr1 Cufflinks exon 27651710 27651816 . + . gene_id "XLOC_000068"; transcript_id "TCONS_00000068"; exon_number "1"; oId "CUFF.138.1"; tss_id "TSS68"; +chr1 Cufflinks exon 28020242 28020343 . + . gene_id "XLOC_000069"; transcript_id "TCONS_00000069"; exon_number "1"; oId "CUFF.140.1"; tss_id "TSS69"; +chr1 Cufflinks exon 28151049 28151139 . + . gene_id "XLOC_000070"; transcript_id "TCONS_00000070"; exon_number "1"; oId "CUFF.141.1"; tss_id "TSS70"; +chr1 Cufflinks exon 28442512 28442552 . + . gene_id "XLOC_000071"; transcript_id "TCONS_00000071"; exon_number "1"; oId "CUFF.144.1"; tss_id "TSS71"; +chr1 Cufflinks exon 28833877 28834083 . + . gene_id "XLOC_000072"; transcript_id "TCONS_00000072"; exon_number "1"; oId "CUFF.147.1"; tss_id "TSS72"; +chr1 Cufflinks exon 28835070 28835271 . + . gene_id "XLOC_000073"; transcript_id "TCONS_00000073"; exon_number "1"; oId "CUFF.148.1"; tss_id "TSS73"; +chr1 Cufflinks exon 28843987 28844088 . + . gene_id "XLOC_000074"; transcript_id "TCONS_00000074"; exon_number "1"; oId "CUFF.149.1"; tss_id "TSS74"; +chr1 Cufflinks exon 29424626 29424700 . + . gene_id "XLOC_000075"; transcript_id "TCONS_00000075"; exon_number "1"; oId "CUFF.150.1"; tss_id "TSS75"; +chr1 Cufflinks exon 30172500 30172556 . + . gene_id "XLOC_000076"; transcript_id "TCONS_00000076"; exon_number "1"; oId "CUFF.151.1"; tss_id "TSS76"; +chr1 Cufflinks exon 31316672 31316909 . + . gene_id "XLOC_000077"; transcript_id "TCONS_00000077"; exon_number "1"; oId "CUFF.154.1"; tss_id "TSS77"; +chr1 Cufflinks exon 31583542 31583592 . + . gene_id "XLOC_000078"; transcript_id "TCONS_00000078"; exon_number "1"; oId "CUFF.155.1"; tss_id "TSS78"; +chr1 Cufflinks exon 32371345 32371403 . + . gene_id "XLOC_000079"; transcript_id "TCONS_00000079"; exon_number "1"; oId "CUFF.158.1"; tss_id "TSS79"; +chr1 Cufflinks exon 32402072 32402104 . + . gene_id "XLOC_000080"; transcript_id "TCONS_00000080"; exon_number "1"; oId "CUFF.159.1"; tss_id "TSS80"; +chr1 Cufflinks exon 32833270 32833349 . + . gene_id "XLOC_000081"; transcript_id "TCONS_00000081"; exon_number "1"; oId "CUFF.164.1"; tss_id "TSS81"; +chr1 Cufflinks exon 32923437 32923757 . + . gene_id "XLOC_000082"; transcript_id "TCONS_00000082"; exon_number "1"; oId "CUFF.165.1"; tss_id "TSS82"; +chr1 Cufflinks exon 34578551 34578639 . + . gene_id "XLOC_000083"; transcript_id "TCONS_00000083"; exon_number "1"; oId "CUFF.170.1"; tss_id "TSS83"; +chr1 Cufflinks exon 35810763 35810799 . + . gene_id "XLOC_000084"; transcript_id "TCONS_00000084"; exon_number "1"; oId "CUFF.174.1"; tss_id "TSS84"; +chr1 Cufflinks exon 37669211 37669317 . + . gene_id "XLOC_000085"; transcript_id "TCONS_00000085"; exon_number "1"; oId "CUFF.180.1"; tss_id "TSS85"; +chr1 Cufflinks exon 38215873 38215977 . + . gene_id "XLOC_000086"; transcript_id "TCONS_00000086"; exon_number "1"; oId "CUFF.183.1"; tss_id "TSS86"; +chr1 Cufflinks exon 38350695 38350779 . + . gene_id "XLOC_000087"; transcript_id "TCONS_00000087"; exon_number "1"; oId "CUFF.184.1"; tss_id "TSS87"; +chr1 Cufflinks exon 38457134 38457206 . + . gene_id "XLOC_000088"; transcript_id "TCONS_00000088"; exon_number "1"; oId "CUFF.185.1"; tss_id "TSS88"; +chr1 Cufflinks exon 38862331 38862436 . + . gene_id "XLOC_000089"; transcript_id "TCONS_00000089"; exon_number "1"; oId "CUFF.187.1"; tss_id "TSS89"; +chr1 Cufflinks exon 39392542 39392644 . + . gene_id "XLOC_000090"; transcript_id "TCONS_00000090"; exon_number "1"; oId "CUFF.189.1"; tss_id "TSS90"; +chr1 Cufflinks exon 39579940 39579976 . + . gene_id "XLOC_000091"; transcript_id "TCONS_00000091"; exon_number "1"; oId "CUFF.190.1"; tss_id "TSS91"; +chr1 Cufflinks exon 39673434 39673475 . + . gene_id "XLOC_000092"; transcript_id "TCONS_00000092"; exon_number "1"; oId "CUFF.193.1"; tss_id "TSS92"; +chr1 Cufflinks exon 39970205 39970270 . + . gene_id "XLOC_000093"; transcript_id "TCONS_00000093"; exon_number "1"; oId "CUFF.195.1"; tss_id "TSS93"; +chr1 Cufflinks exon 40643515 40643621 . + . gene_id "XLOC_000094"; transcript_id "TCONS_00000094"; exon_number "1"; oId "CUFF.197.1"; tss_id "TSS94"; +chr1 Cufflinks exon 40651860 40651922 . + . gene_id "XLOC_000095"; transcript_id "TCONS_00000095"; exon_number "1"; oId "CUFF.198.1"; tss_id "TSS95"; +chr1 Cufflinks exon 40861759 40861807 . + . gene_id "XLOC_000096"; transcript_id "TCONS_00000096"; exon_number "1"; oId "CUFF.199.1"; tss_id "TSS96"; +chr1 Cufflinks exon 41270518 41270822 . + . gene_id "XLOC_000097"; transcript_id "TCONS_00000097"; exon_number "1"; oId "CUFF.202.1"; tss_id "TSS97"; +chr1 Cufflinks exon 42521374 42521417 . + . gene_id "XLOC_000098"; transcript_id "TCONS_00000098"; exon_number "1"; oId "CUFF.205.1"; tss_id "TSS98"; +chr1 Cufflinks exon 42779299 42779471 . + . gene_id "XLOC_000099"; transcript_id "TCONS_00000099"; exon_number "1"; oId "CUFF.207.1"; tss_id "TSS99"; +chr1 Cufflinks exon 42956317 42956359 . + . gene_id "XLOC_000100"; transcript_id "TCONS_00000100"; exon_number "1"; oId "CUFF.208.1"; tss_id "TSS100"; +chr1 Cufflinks exon 43034705 43034810 . + . gene_id "XLOC_000101"; transcript_id "TCONS_00000101"; exon_number "1"; oId "CUFF.209.1"; tss_id "TSS101"; +chr1 Cufflinks exon 43045773 43046173 . + . gene_id "XLOC_000102"; transcript_id "TCONS_00000102"; exon_number "1"; oId "CUFF.210.1"; tss_id "TSS102"; +chr1 Cufflinks exon 43457109 43457215 . + . gene_id "XLOC_000103"; transcript_id "TCONS_00000103"; exon_number "1"; oId "CUFF.212.1"; tss_id "TSS103"; +chr1 Cufflinks exon 43662088 43662177 . + . gene_id "XLOC_000104"; transcript_id "TCONS_00000104"; exon_number "1"; oId "CUFF.215.1"; tss_id "TSS104"; +chr1 Cufflinks exon 44099855 44099892 . + . gene_id "XLOC_000105"; transcript_id "TCONS_00000105"; exon_number "1"; oId "CUFF.216.1"; tss_id "TSS105"; +chr1 Cufflinks exon 44182140 44182222 . + . gene_id "XLOC_000106"; transcript_id "TCONS_00000106"; exon_number "1"; oId "CUFF.217.1"; tss_id "TSS106"; +chr1 Cufflinks exon 44856396 44856493 . + . gene_id "XLOC_000107"; transcript_id "TCONS_00000107"; exon_number "1"; oId "CUFF.220.1"; tss_id "TSS107"; +chr1 Cufflinks exon 45238315 45238395 . + . gene_id "XLOC_000108"; transcript_id "TCONS_00000108"; exon_number "1"; oId "CUFF.224.1"; tss_id "TSS108"; +chr1 Cufflinks exon 45397995 45398096 . + . gene_id "XLOC_000109"; transcript_id "TCONS_00000109"; exon_number "1"; oId "CUFF.226.1"; tss_id "TSS109"; +chr1 Cufflinks exon 45885807 45885900 . + . gene_id "XLOC_000110"; transcript_id "TCONS_00000110"; exon_number "1"; oId "CUFF.228.1"; tss_id "TSS110"; +chr1 Cufflinks exon 45932805 45932843 . + . gene_id "XLOC_000111"; transcript_id "TCONS_00000111"; exon_number "1"; oId "CUFF.229.1"; tss_id "TSS111"; +chr1 Cufflinks exon 46732738 46733034 . + . gene_id "XLOC_000112"; transcript_id "TCONS_00000112"; exon_number "1"; oId "CUFF.231.1"; tss_id "TSS112"; +chr1 Cufflinks exon 47289949 47290019 . + . gene_id "XLOC_000113"; transcript_id "TCONS_00000113"; exon_number "1"; oId "CUFF.234.1"; tss_id "TSS113"; +chr1 Cufflinks exon 48809881 48809987 . + . gene_id "XLOC_000114"; transcript_id "TCONS_00000114"; exon_number "1"; oId "CUFF.235.1"; tss_id "TSS114"; +chr1 Cufflinks exon 48913608 48913678 . + . gene_id "XLOC_000115"; transcript_id "TCONS_00000115"; exon_number "1"; oId "CUFF.236.1"; tss_id "TSS115"; +chr1 Cufflinks exon 49617080 49617178 . + . gene_id "XLOC_000116"; transcript_id "TCONS_00000116"; exon_number "1"; oId "CUFF.237.1"; tss_id "TSS116"; +chr1 Cufflinks exon 49736705 49736777 . + . gene_id "XLOC_000117"; transcript_id "TCONS_00000117"; exon_number "1"; oId "CUFF.238.1"; tss_id "TSS117"; +chr1 Cufflinks exon 51048076 51048183 . + . gene_id "XLOC_000118"; transcript_id "TCONS_00000118"; exon_number "1"; oId "CUFF.239.1"; tss_id "TSS118"; +chr1 Cufflinks exon 51215968 51216025 . + . gene_id "XLOC_000119"; transcript_id "TCONS_00000119"; exon_number "1"; oId "CUFF.240.1"; tss_id "TSS119"; +chr1 Cufflinks exon 51847980 51848081 . + . gene_id "XLOC_000120"; transcript_id "TCONS_00000120"; exon_number "1"; oId "CUFF.243.1"; tss_id "TSS120"; +chr1 Cufflinks exon 52439083 52439177 . + . gene_id "XLOC_000121"; transcript_id "TCONS_00000121"; exon_number "1"; oId "CUFF.248.1"; tss_id "TSS121"; +chr1 Cufflinks exon 52461416 52461731 . + . gene_id "XLOC_000122"; transcript_id "TCONS_00000122"; exon_number "1"; oId "CUFF.249.1"; tss_id "TSS122"; +chr1 Cufflinks exon 52615780 52616090 . + . gene_id "XLOC_000123"; transcript_id "TCONS_00000123"; exon_number "1"; oId "CUFF.250.1"; tss_id "TSS123"; +chr1 Cufflinks exon 52795600 52795694 . + . gene_id "XLOC_000124"; transcript_id "TCONS_00000124"; exon_number "1"; oId "CUFF.251.1"; tss_id "TSS124"; +chr1 Cufflinks exon 52877125 52877197 . + . gene_id "XLOC_000125"; transcript_id "TCONS_00000125"; exon_number "1"; oId "CUFF.252.1"; tss_id "TSS125"; +chr1 Cufflinks exon 53024737 53024838 . + . gene_id "XLOC_000126"; transcript_id "TCONS_00000126"; exon_number "1"; oId "CUFF.253.1"; tss_id "TSS126"; +chr1 Cufflinks exon 53180071 53180363 . + . gene_id "XLOC_000127"; transcript_id "TCONS_00000127"; exon_number "1"; oId "CUFF.254.1"; tss_id "TSS127"; +chr1 Cufflinks exon 53219999 53220049 . + . gene_id "XLOC_000128"; transcript_id "TCONS_00000128"; exon_number "1"; oId "CUFF.255.1"; tss_id "TSS128"; +chr1 Cufflinks exon 53267886 53267999 . + . gene_id "XLOC_000129"; transcript_id "TCONS_00000129"; exon_number "1"; oId "CUFF.256.1"; tss_id "TSS129"; +chr1 Cufflinks exon 53541212 53541246 . + . gene_id "XLOC_000130"; transcript_id "TCONS_00000130"; exon_number "1"; oId "CUFF.260.1"; tss_id "TSS130"; +chr1 Cufflinks exon 54160559 54160623 . + . gene_id "XLOC_000131"; transcript_id "TCONS_00000131"; exon_number "1"; oId "CUFF.262.1"; tss_id "TSS131"; +chr1 Cufflinks exon 54275947 54276056 . + . gene_id "XLOC_000132"; transcript_id "TCONS_00000132"; exon_number "1"; oId "CUFF.263.1"; tss_id "TSS132"; +chr1 Cufflinks exon 54993081 54993123 . + . gene_id "XLOC_000133"; transcript_id "TCONS_00000133"; exon_number "1"; oId "CUFF.264.1"; tss_id "TSS133"; +chr1 Cufflinks exon 55604507 55604577 . + . gene_id "XLOC_000134"; transcript_id "TCONS_00000134"; exon_number "1"; oId "CUFF.266.1"; tss_id "TSS134"; +chr1 Cufflinks exon 55864187 55864285 . + . gene_id "XLOC_000135"; transcript_id "TCONS_00000135"; exon_number "1"; oId "CUFF.268.1"; tss_id "TSS135"; +chr1 Cufflinks exon 58122046 58122075 . + . gene_id "XLOC_000136"; transcript_id "TCONS_00000136"; exon_number "1"; oId "CUFF.270.1"; tss_id "TSS136"; +chr1 Cufflinks exon 58921422 58921606 . + . gene_id "XLOC_000137"; transcript_id "TCONS_00000137"; exon_number "1"; oId "CUFF.271.1"; tss_id "TSS137"; +chr1 Cufflinks exon 59213663 59213771 . + . gene_id "XLOC_000138"; transcript_id "TCONS_00000138"; exon_number "1"; oId "CUFF.273.1"; tss_id "TSS138"; +chr1 Cufflinks exon 61255261 61255310 . + . gene_id "XLOC_000139"; transcript_id "TCONS_00000139"; exon_number "1"; oId "CUFF.275.1"; tss_id "TSS139"; +chr1 Cufflinks exon 62282092 62282187 . + . gene_id "XLOC_000140"; transcript_id "TCONS_00000140"; exon_number "1"; oId "CUFF.276.1"; tss_id "TSS140"; +chr1 Cufflinks exon 62318171 62318274 . + . gene_id "XLOC_000141"; transcript_id "TCONS_00000141"; exon_number "1"; oId "CUFF.277.1"; tss_id "TSS141"; +chr1 Cufflinks exon 62538120 62538436 . + . gene_id "XLOC_000142"; transcript_id "TCONS_00000142"; exon_number "1"; oId "CUFF.278.1"; tss_id "TSS142"; +chr1 Cufflinks exon 63704614 63704748 . + . gene_id "XLOC_000143"; transcript_id "TCONS_00000143"; exon_number "1"; oId "CUFF.282.1"; tss_id "TSS143"; +chr1 Cufflinks exon 63799431 63799487 . + . gene_id "XLOC_000144"; transcript_id "TCONS_00000144"; exon_number "1"; oId "CUFF.283.1"; tss_id "TSS144"; +chr1 Cufflinks exon 64121426 64121739 . + . gene_id "XLOC_000145"; transcript_id "TCONS_00000145"; exon_number "1"; oId "CUFF.286.1"; tss_id "TSS145"; +chr1 Cufflinks exon 64305143 64305178 . + . gene_id "XLOC_000146"; transcript_id "TCONS_00000146"; exon_number "1"; oId "CUFF.287.1"; tss_id "TSS146"; +chr1 Cufflinks exon 64356533 64356571 . + . gene_id "XLOC_000147"; transcript_id "TCONS_00000147"; exon_number "1"; oId "CUFF.288.1"; tss_id "TSS147"; +chr1 Cufflinks exon 65591705 65591863 . + . gene_id "XLOC_000148"; transcript_id "TCONS_00000148"; exon_number "1"; oId "CUFF.295.1"; tss_id "TSS148"; +chr1 Cufflinks exon 65881499 65881685 . + . gene_id "XLOC_000149"; transcript_id "TCONS_00000149"; exon_number "1"; oId "CUFF.297.1"; tss_id "TSS149"; +chr1 Cufflinks exon 66037249 66037336 . + . gene_id "XLOC_000150"; transcript_id "TCONS_00000150"; exon_number "1"; oId "CUFF.298.1"; tss_id "TSS150"; +chr1 Cufflinks exon 67661827 67661918 . + . gene_id "XLOC_000151"; transcript_id "TCONS_00000151"; exon_number "1"; oId "CUFF.305.1"; tss_id "TSS151"; +chr1 Cufflinks exon 67688477 67688523 . + . gene_id "XLOC_000152"; transcript_id "TCONS_00000152"; exon_number "1"; oId "CUFF.306.1"; tss_id "TSS152"; +chr1 Cufflinks exon 67882897 67883000 . + . gene_id "XLOC_000153"; transcript_id "TCONS_00000153"; exon_number "1"; oId "CUFF.307.1"; tss_id "TSS153"; +chr1 Cufflinks exon 68006810 68006916 . + . gene_id "XLOC_000154"; transcript_id "TCONS_00000154"; exon_number "1"; oId "CUFF.308.1"; tss_id "TSS154"; +chr1 Cufflinks exon 68837829 68837900 . + . gene_id "XLOC_000155"; transcript_id "TCONS_00000155"; exon_number "1"; oId "CUFF.313.1"; tss_id "TSS155"; +chr1 Cufflinks exon 70070623 70070708 . + . gene_id "XLOC_000156"; transcript_id "TCONS_00000156"; exon_number "1"; oId "CUFF.315.1"; tss_id "TSS156"; +chr1 Cufflinks exon 70227102 70227137 . + . gene_id "XLOC_000157"; transcript_id "TCONS_00000157"; exon_number "1"; oId "CUFF.316.1"; tss_id "TSS157"; +chr1 Cufflinks exon 70345274 70345503 . + . gene_id "XLOC_000158"; transcript_id "TCONS_00000158"; exon_number "1"; oId "CUFF.317.1"; tss_id "TSS158"; +chr1 Cufflinks exon 71100071 71100105 . + . gene_id "XLOC_000159"; transcript_id "TCONS_00000159"; exon_number "1"; oId "CUFF.320.1"; tss_id "TSS159"; +chr1 Cufflinks exon 73232482 73232533 . + . gene_id "XLOC_000160"; transcript_id "TCONS_00000160"; exon_number "1"; oId "CUFF.323.1"; tss_id "TSS160"; +chr1 Cufflinks exon 75648730 75648832 . + . gene_id "XLOC_000161"; transcript_id "TCONS_00000161"; exon_number "1"; oId "CUFF.328.1"; tss_id "TSS161"; +chr1 Cufflinks exon 77040503 77040706 . + . gene_id "XLOC_000162"; transcript_id "TCONS_00000162"; exon_number "1"; oId "CUFF.333.1"; tss_id "TSS162"; +chr1 Cufflinks exon 77218821 77218919 . + . gene_id "XLOC_000163"; transcript_id "TCONS_00000163"; exon_number "1"; oId "CUFF.334.1"; tss_id "TSS163"; +chr1 Cufflinks exon 77886011 77886069 . + . gene_id "XLOC_000164"; transcript_id "TCONS_00000164"; exon_number "1"; oId "CUFF.337.1"; tss_id "TSS164"; +chr1 Cufflinks exon 78080554 78080625 . + . gene_id "XLOC_000165"; transcript_id "TCONS_00000165"; exon_number "1"; oId "CUFF.338.1"; tss_id "TSS165"; +chr1 Cufflinks exon 78111009 78111324 . + . gene_id "XLOC_000166"; transcript_id "TCONS_00000166"; exon_number "1"; oId "CUFF.339.1"; tss_id "TSS166"; +chr1 Cufflinks exon 78245583 78245672 . + . gene_id "XLOC_000167"; transcript_id "TCONS_00000167"; exon_number "1"; oId "CUFF.340.1"; tss_id "TSS167"; +chr1 Cufflinks exon 80565625 80565695 . + . gene_id "XLOC_000168"; transcript_id "TCONS_00000168"; exon_number "1"; oId "CUFF.346.1"; tss_id "TSS168"; +chr1 Cufflinks exon 80851093 80851133 . + . gene_id "XLOC_000169"; transcript_id "TCONS_00000169"; exon_number "1"; oId "CUFF.347.1"; tss_id "TSS169"; +chr1 Cufflinks exon 81436227 81436343 . + . gene_id "XLOC_000170"; transcript_id "TCONS_00000170"; exon_number "1"; oId "CUFF.349.1"; tss_id "TSS170"; +chr1 Cufflinks exon 81717474 81717697 . + . gene_id "XLOC_000171"; transcript_id "TCONS_00000171"; exon_number "1"; oId "CUFF.350.1"; tss_id "TSS171"; +chr1 Cufflinks exon 84692488 84692526 . + . gene_id "XLOC_000172"; transcript_id "TCONS_00000172"; exon_number "1"; oId "CUFF.351.1"; tss_id "TSS172"; +chr1 Cufflinks exon 85464500 85464545 . + . gene_id "XLOC_000173"; transcript_id "TCONS_00000173"; exon_number "1"; oId "CUFF.353.1"; tss_id "TSS173"; +chr1 Cufflinks exon 86168473 86168542 . + . gene_id "XLOC_000174"; transcript_id "TCONS_00000174"; exon_number "1"; oId "CUFF.354.1"; tss_id "TSS174"; +chr1 Cufflinks exon 87506868 87506928 . + . gene_id "XLOC_000175"; transcript_id "TCONS_00000175"; exon_number "1"; oId "CUFF.358.1"; tss_id "TSS175"; +chr1 Cufflinks exon 89282462 89282568 . + . gene_id "XLOC_000176"; transcript_id "TCONS_00000176"; exon_number "1"; oId "CUFF.363.1"; tss_id "TSS176"; +chr1 Cufflinks exon 90002764 90002834 . + . gene_id "XLOC_000177"; transcript_id "TCONS_00000177"; exon_number "1"; oId "CUFF.364.1"; tss_id "TSS177"; +chr1 Cufflinks exon 91123307 91123521 . + . gene_id "XLOC_000178"; transcript_id "TCONS_00000178"; exon_number "1"; oId "CUFF.370.1"; tss_id "TSS178"; +chr1 Cufflinks exon 91690596 91690663 . + . gene_id "XLOC_000179"; transcript_id "TCONS_00000179"; exon_number "1"; oId "CUFF.371.1"; tss_id "TSS179"; +chr1 Cufflinks exon 91878206 91878259 . + . gene_id "XLOC_000180"; transcript_id "TCONS_00000180"; exon_number "1"; oId "CUFF.374.1"; tss_id "TSS180"; +chr1 Cufflinks exon 92655310 92655379 . + . gene_id "XLOC_000181"; transcript_id "TCONS_00000181"; exon_number "1"; oId "CUFF.379.1"; tss_id "TSS181"; +chr1 Cufflinks exon 92889326 92889470 . + . gene_id "XLOC_000182"; transcript_id "TCONS_00000182"; exon_number "1"; oId "CUFF.382.1"; tss_id "TSS182"; +chr1 Cufflinks exon 93474524 93474552 . + . gene_id "XLOC_000183"; transcript_id "TCONS_00000183"; exon_number "1"; oId "CUFF.388.1"; tss_id "TSS183"; +chr1 Cufflinks exon 93475827 93475908 . + . gene_id "XLOC_000184"; transcript_id "TCONS_00000184"; exon_number "1"; oId "CUFF.389.1"; tss_id "TSS184"; +chr1 Cufflinks exon 93491809 93491988 . + . gene_id "XLOC_000185"; transcript_id "TCONS_00000185"; exon_number "1"; oId "CUFF.390.1"; tss_id "TSS185"; +chr1 Cufflinks exon 93492416 93492560 . + . gene_id "XLOC_000186"; transcript_id "TCONS_00000186"; exon_number "1"; oId "CUFF.391.1"; tss_id "TSS186"; +chr1 Cufflinks exon 94279762 94279796 . + . gene_id "XLOC_000187"; transcript_id "TCONS_00000187"; exon_number "1"; oId "CUFF.394.1"; tss_id "TSS187"; +chr1 Cufflinks exon 94313129 94313213 . + . gene_id "XLOC_000188"; transcript_id "TCONS_00000188"; exon_number "1"; oId "CUFF.395.1"; tss_id "TSS188"; +chr1 Cufflinks exon 94616976 94617080 . + . gene_id "XLOC_000189"; transcript_id "TCONS_00000189"; exon_number "1"; oId "CUFF.396.1"; tss_id "TSS189"; +chr1 Cufflinks exon 94858111 94858153 . + . gene_id "XLOC_000190"; transcript_id "TCONS_00000190"; exon_number "1"; oId "CUFF.397.1"; tss_id "TSS190"; +chr1 Cufflinks exon 94860357 94860407 . + . gene_id "XLOC_000191"; transcript_id "TCONS_00000191"; exon_number "1"; oId "CUFF.398.1"; tss_id "TSS191"; +chr1 Cufflinks exon 95554735 95554784 . + . gene_id "XLOC_000192"; transcript_id "TCONS_00000192"; exon_number "1"; oId "CUFF.401.1"; tss_id "TSS192"; +chr1 Cufflinks exon 96691458 96691619 . + . gene_id "XLOC_000193"; transcript_id "TCONS_00000193"; exon_number "1"; oId "CUFF.402.1"; tss_id "TSS193"; +chr1 Cufflinks exon 97018452 97018485 . + . gene_id "XLOC_000194"; transcript_id "TCONS_00000194"; exon_number "1"; oId "CUFF.403.1"; tss_id "TSS194"; +chr1 Cufflinks exon 97048768 97049100 . + . gene_id "XLOC_000195"; transcript_id "TCONS_00000195"; exon_number "1"; oId "CUFF.404.1"; tss_id "TSS195"; +chr1 Cufflinks exon 97993995 97994057 . + . gene_id "XLOC_000196"; transcript_id "TCONS_00000196"; exon_number "1"; oId "CUFF.406.1"; tss_id "TSS196"; +chr1 Cufflinks exon 99495633 99495678 . + . gene_id "XLOC_000197"; transcript_id "TCONS_00000197"; exon_number "1"; oId "CUFF.408.1"; tss_id "TSS197"; +chr1 Cufflinks exon 100271939 100272091 . + . gene_id "XLOC_000198"; transcript_id "TCONS_00000198"; exon_number "1"; oId "CUFF.410.1"; tss_id "TSS198"; +chr1 Cufflinks exon 100444495 100444593 . + . gene_id "XLOC_000199"; transcript_id "TCONS_00000199"; exon_number "1"; oId "CUFF.412.1"; tss_id "TSS199"; +chr1 Cufflinks exon 102267674 102267710 . + . gene_id "XLOC_000200"; transcript_id "TCONS_00000200"; exon_number "1"; oId "CUFF.418.1"; tss_id "TSS200"; +chr1 Cufflinks exon 102325407 102325479 . + . gene_id "XLOC_000201"; transcript_id "TCONS_00000201"; exon_number "1"; oId "CUFF.419.1"; tss_id "TSS201"; +chr1 Cufflinks exon 102563935 102563988 . + . gene_id "XLOC_000202"; transcript_id "TCONS_00000202"; exon_number "1"; oId "CUFF.420.1"; tss_id "TSS202"; +chr1 Cufflinks exon 104066184 104066420 . + . gene_id "XLOC_000203"; transcript_id "TCONS_00000203"; exon_number "1"; oId "CUFF.424.1"; tss_id "TSS203"; +chr1 Cufflinks exon 104738943 104739017 . + . gene_id "XLOC_000204"; transcript_id "TCONS_00000204"; exon_number "1"; oId "CUFF.425.1"; tss_id "TSS204"; +chr1 Cufflinks exon 105973698 105973741 . + . gene_id "XLOC_000205"; transcript_id "TCONS_00000205"; exon_number "1"; oId "CUFF.426.1"; tss_id "TSS205"; +chr1 Cufflinks exon 106026772 106026837 . + . gene_id "XLOC_000206"; transcript_id "TCONS_00000206"; exon_number "1"; oId "CUFF.427.1"; tss_id "TSS206"; +chr1 Cufflinks exon 106315626 106315681 . + . gene_id "XLOC_000207"; transcript_id "TCONS_00000207"; exon_number "1"; oId "CUFF.428.1"; tss_id "TSS207"; +chr1 Cufflinks exon 107347023 107347091 . + . gene_id "XLOC_000208"; transcript_id "TCONS_00000208"; exon_number "1"; oId "CUFF.429.1"; tss_id "TSS208"; +chr1 Cufflinks exon 107771994 107772035 . + . gene_id "XLOC_000209"; transcript_id "TCONS_00000209"; exon_number "1"; oId "CUFF.430.1"; tss_id "TSS209"; +chr1 Cufflinks exon 109786181 109786293 . + . gene_id "XLOC_000210"; transcript_id "TCONS_00000210"; exon_number "1"; oId "CUFF.434.1"; tss_id "TSS210"; +chr1 Cufflinks exon 110120224 110120297 . + . gene_id "XLOC_000211"; transcript_id "TCONS_00000211"; exon_number "1"; oId "CUFF.435.1"; tss_id "TSS211"; +chr1 Cufflinks exon 111584456 111584545 . + . gene_id "XLOC_000212"; transcript_id "TCONS_00000212"; exon_number "1"; oId "CUFF.440.1"; tss_id "TSS212"; +chr1 Cufflinks exon 111672677 111672711 . + . gene_id "XLOC_000213"; transcript_id "TCONS_00000213"; exon_number "1"; oId "CUFF.441.1"; tss_id "TSS213"; +chr1 Cufflinks exon 112738147 112738230 . + . gene_id "XLOC_000214"; transcript_id "TCONS_00000214"; exon_number "1"; oId "CUFF.444.1"; tss_id "TSS214"; +chr1 Cufflinks exon 112913625 112913731 . + . gene_id "XLOC_000215"; transcript_id "TCONS_00000215"; exon_number "1"; oId "CUFF.445.1"; tss_id "TSS215"; +chr1 Cufflinks exon 112962099 112962172 . + . gene_id "XLOC_000216"; transcript_id "TCONS_00000216"; exon_number "1"; oId "CUFF.446.1"; tss_id "TSS216"; +chr1 Cufflinks exon 113193439 113193472 . + . gene_id "XLOC_000217"; transcript_id "TCONS_00000217"; exon_number "1"; oId "CUFF.448.1"; tss_id "TSS217"; +chr1 Cufflinks exon 113195210 113195312 . + . gene_id "XLOC_000218"; transcript_id "TCONS_00000218"; exon_number "1"; oId "CUFF.449.1"; tss_id "TSS218"; +chr1 Cufflinks exon 115671397 115671431 . + . gene_id "XLOC_000219"; transcript_id "TCONS_00000219"; exon_number "1"; oId "CUFF.455.1"; tss_id "TSS219"; +chr1 Cufflinks exon 116149092 116149349 . + . gene_id "XLOC_000220"; transcript_id "TCONS_00000220"; exon_number "1"; oId "CUFF.456.1"; tss_id "TSS220"; +chr1 Cufflinks exon 116149653 116149724 . + . gene_id "XLOC_000221"; transcript_id "TCONS_00000221"; exon_number "1"; oId "CUFF.457.1"; tss_id "TSS221"; +chr1 Cufflinks exon 116821228 116821443 . + . gene_id "XLOC_000222"; transcript_id "TCONS_00000222"; exon_number "1"; oId "CUFF.459.1"; tss_id "TSS222"; +chr1 Cufflinks exon 116892438 116892474 . + . gene_id "XLOC_000223"; transcript_id "TCONS_00000223"; exon_number "1"; oId "CUFF.460.1"; tss_id "TSS223"; +chr1 Cufflinks exon 117217053 117217108 . + . gene_id "XLOC_000224"; transcript_id "TCONS_00000224"; exon_number "1"; oId "CUFF.462.1"; tss_id "TSS224"; +chr1 Cufflinks exon 117382311 117382390 . + . gene_id "XLOC_000225"; transcript_id "TCONS_00000225"; exon_number "1"; oId "CUFF.463.1"; tss_id "TSS225"; +chr1 Cufflinks exon 119801664 119801763 . + . gene_id "XLOC_000226"; transcript_id "TCONS_00000226"; exon_number "1"; oId "CUFF.469.1"; tss_id "TSS226"; +chr1 Cufflinks exon 119860626 119860663 . + . gene_id "XLOC_000227"; transcript_id "TCONS_00000227"; exon_number "1"; oId "CUFF.470.1"; tss_id "TSS227"; +chr1 Cufflinks exon 119901910 119901977 . + . gene_id "XLOC_000228"; transcript_id "TCONS_00000228"; exon_number "1"; oId "CUFF.471.1"; tss_id "TSS228"; +chr1 Cufflinks exon 120669563 120669662 . + . gene_id "XLOC_000229"; transcript_id "TCONS_00000229"; exon_number "1"; oId "CUFF.475.1"; tss_id "TSS229"; +chr1 Cufflinks exon 143687359 143687521 . + . gene_id "XLOC_000230"; transcript_id "TCONS_00000230"; exon_number "1"; oId "CUFF.482.1"; tss_id "TSS230"; +chr1 Cufflinks exon 143690028 143690104 . + . gene_id "XLOC_000231"; transcript_id "TCONS_00000231"; exon_number "1"; oId "CUFF.483.1"; tss_id "TSS231"; +chr1 Cufflinks exon 144301611 144301685 . + . gene_id "XLOC_000232"; transcript_id "TCONS_00000232"; exon_number "1"; oId "CUFF.485.1"; tss_id "TSS232"; +chr1 Cufflinks exon 144481840 144481914 . + . gene_id "XLOC_000233"; transcript_id "TCONS_00000233"; exon_number "1"; oId "CUFF.488.1"; tss_id "TSS233"; +chr1 Cufflinks exon 144534038 144534201 . + . gene_id "XLOC_000234"; transcript_id "TCONS_00000234"; exon_number "1"; oId "CUFF.491.1"; tss_id "TSS234"; +chr1 Cufflinks exon 144935534 144935575 . + . gene_id "XLOC_000235"; transcript_id "TCONS_00000235"; exon_number "1"; oId "CUFF.493.1"; tss_id "TSS235"; +chr1 Cufflinks exon 144944672 144944728 . + . gene_id "XLOC_000236"; transcript_id "TCONS_00000236"; exon_number "1"; oId "CUFF.494.1"; tss_id "TSS236"; +chr1 Cufflinks exon 145044652 145044831 . + . gene_id "XLOC_000237"; transcript_id "TCONS_00000237"; exon_number "1"; oId "CUFF.495.1"; tss_id "TSS237"; +chr1 Cufflinks exon 145277250 145277491 . + . gene_id "XLOC_000238"; transcript_id "TCONS_00000238"; exon_number "1"; oId "CUFF.497.1"; tss_id "TSS238"; +chr1 Cufflinks exon 145382757 145382920 . + . gene_id "XLOC_000239"; transcript_id "TCONS_00000239"; exon_number "1"; oId "CUFF.499.1"; tss_id "TSS239"; +chr1 Cufflinks exon 145385729 145385804 . + . gene_id "XLOC_000240"; transcript_id "TCONS_00000240"; exon_number "1"; oId "CUFF.500.1"; tss_id "TSS240"; +chr1 Cufflinks exon 145941579 145941649 . + . gene_id "XLOC_000241"; transcript_id "TCONS_00000241"; exon_number "1"; oId "CUFF.507.1"; tss_id "TSS241"; +chr1 Cufflinks exon 145950996 145951066 . + . gene_id "XLOC_000242"; transcript_id "TCONS_00000242"; exon_number "1"; oId "CUFF.509.1"; tss_id "TSS242"; +chr1 Cufflinks exon 145963304 145963375 . + . gene_id "XLOC_000243"; transcript_id "TCONS_00000243"; exon_number "1"; oId "CUFF.510.1"; tss_id "TSS243"; +chr1 Cufflinks exon 145992280 145992338 . + . gene_id "XLOC_000244"; transcript_id "TCONS_00000244"; exon_number "1"; oId "CUFF.514.1"; tss_id "TSS244"; +chr1 Cufflinks exon 146087816 146087883 . + . gene_id "XLOC_000245"; transcript_id "TCONS_00000245"; exon_number "1"; oId "CUFF.516.1"; tss_id "TSS245"; +chr1 Cufflinks exon 146124158 146124246 . + . gene_id "XLOC_000246"; transcript_id "TCONS_00000246"; exon_number "1"; oId "CUFF.519.1"; tss_id "TSS246"; +chr1 Cufflinks exon 146369352 146369410 . + . gene_id "XLOC_000247"; transcript_id "TCONS_00000247"; exon_number "1"; oId "CUFF.521.1"; tss_id "TSS247"; +chr1 Cufflinks exon 146544773 146544844 . + . gene_id "XLOC_000248"; transcript_id "TCONS_00000248"; exon_number "1"; oId "CUFF.523.1"; tss_id "TSS248"; +chr1 Cufflinks exon 146550178 146550249 . + . gene_id "XLOC_000249"; transcript_id "TCONS_00000249"; exon_number "1"; oId "CUFF.524.1"; tss_id "TSS249"; +chr1 Cufflinks exon 146551298 146551461 . + . gene_id "XLOC_000250"; transcript_id "TCONS_00000250"; exon_number "1"; oId "CUFF.525.1"; tss_id "TSS250"; +chr1 Cufflinks exon 146560929 146560984 . + . gene_id "XLOC_000251"; transcript_id "TCONS_00000251"; exon_number "1"; oId "CUFF.527.1"; tss_id "TSS251"; +chr1 Cufflinks exon 147161384 147161671 . + . gene_id "XLOC_000252"; transcript_id "TCONS_00000252"; exon_number "1"; oId "CUFF.529.1"; tss_id "TSS252"; +chr1 Cufflinks exon 147483291 147483361 . + . gene_id "XLOC_000253"; transcript_id "TCONS_00000253"; exon_number "1"; oId "CUFF.531.1"; tss_id "TSS253"; +chr1 Cufflinks exon 147492714 147492784 . + . gene_id "XLOC_000254"; transcript_id "TCONS_00000254"; exon_number "1"; oId "CUFF.533.1"; tss_id "TSS254"; +chr1 Cufflinks exon 147505038 147505109 . + . gene_id "XLOC_000255"; transcript_id "TCONS_00000255"; exon_number "1"; oId "CUFF.534.1"; tss_id "TSS255"; +chr1 Cufflinks exon 147534071 147534129 . + . gene_id "XLOC_000256"; transcript_id "TCONS_00000256"; exon_number "1"; oId "CUFF.538.1"; tss_id "TSS256"; +chr1 Cufflinks exon 147629653 147629720 . + . gene_id "XLOC_000257"; transcript_id "TCONS_00000257"; exon_number "1"; oId "CUFF.540.1"; tss_id "TSS257"; +chr1 Cufflinks exon 147665990 147666078 . + . gene_id "XLOC_000258"; transcript_id "TCONS_00000258"; exon_number "1"; oId "CUFF.543.1"; tss_id "TSS258"; +chr1 Cufflinks exon 147719029 147719104 . + . gene_id "XLOC_000259"; transcript_id "TCONS_00000259"; exon_number "1"; oId "CUFF.545.1"; tss_id "TSS259"; +chr1 Cufflinks exon 147735752 147735907 . + . gene_id "XLOC_000260"; transcript_id "TCONS_00000260"; exon_number "1"; oId "CUFF.546.1"; tss_id "TSS260"; +chr1 Cufflinks exon 147753471 147753542 . + . gene_id "XLOC_000261"; transcript_id "TCONS_00000261"; exon_number "1"; oId "CUFF.549.1"; tss_id "TSS261"; +chr1 Cufflinks exon 147781527 147781590 . + . gene_id "XLOC_000262"; transcript_id "TCONS_00000262"; exon_number "1"; oId "CUFF.552.1"; tss_id "TSS262"; +chr1 Cufflinks exon 147790852 147790918 . + . gene_id "XLOC_000263"; transcript_id "TCONS_00000263"; exon_number "1"; oId "CUFF.554.1"; tss_id "TSS263"; +chr1 Cufflinks exon 147800937 147801008 . + . gene_id "XLOC_000264"; transcript_id "TCONS_00000264"; exon_number "1"; oId "CUFF.555.1"; tss_id "TSS264"; +chr1 Cufflinks exon 147825689 147825760 . + . gene_id "XLOC_000265"; transcript_id "TCONS_00000265"; exon_number "1"; oId "CUFF.557.1"; tss_id "TSS265"; +chr1 Cufflinks exon 147874868 147875030 . + . gene_id "XLOC_000266"; transcript_id "TCONS_00000266"; exon_number "1"; oId "CUFF.563.1"; tss_id "TSS266"; +chr1 Cufflinks exon 147877537 147877613 . + . gene_id "XLOC_000267"; transcript_id "TCONS_00000267"; exon_number "1"; oId "CUFF.564.1"; tss_id "TSS267"; +chr1 Cufflinks exon 147994146 147994314 . + . gene_id "XLOC_000268"; transcript_id "TCONS_00000268"; exon_number "1"; oId "CUFF.565.1"; tss_id "TSS268"; +chr1 Cufflinks exon 148000805 148000879 . + . gene_id "XLOC_000269"; transcript_id "TCONS_00000269"; exon_number "1"; oId "CUFF.566.1"; tss_id "TSS269"; +chr1 Cufflinks exon 148241465 148241630 . + . gene_id "XLOC_000270"; transcript_id "TCONS_00000270"; exon_number "1"; oId "CUFF.567.1"; tss_id "TSS270"; +chr1 Cufflinks exon 148248115 148248190 . + . gene_id "XLOC_000271"; transcript_id "TCONS_00000271"; exon_number "1"; oId "CUFF.568.1"; tss_id "TSS271"; +chr1 Cufflinks exon 149079364 149079435 . + . gene_id "XLOC_000272"; transcript_id "TCONS_00000272"; exon_number "1"; oId "CUFF.574.1"; tss_id "TSS272"; +chr1 Cufflinks exon 149144632 149144697 . + . gene_id "XLOC_000273"; transcript_id "TCONS_00000273"; exon_number "1"; oId "CUFF.576.1"; tss_id "TSS273"; +chr1 Cufflinks exon 149162113 149162178 . + . gene_id "XLOC_000274"; transcript_id "TCONS_00000274"; exon_number "1"; oId "CUFF.581.1"; tss_id "TSS274"; +chr1 Cufflinks exon 149170298 149170369 . + . gene_id "XLOC_000275"; transcript_id "TCONS_00000275"; exon_number "1"; oId "CUFF.582.1"; tss_id "TSS275"; +chr1 Cufflinks exon 149173911 149173981 . + . gene_id "XLOC_000276"; transcript_id "TCONS_00000276"; exon_number "1"; oId "CUFF.583.1"; tss_id "TSS276"; +chr1 Cufflinks exon 149186125 149186196 . + . gene_id "XLOC_000277"; transcript_id "TCONS_00000277"; exon_number "1"; oId "CUFF.584.1"; tss_id "TSS277"; +chr1 Cufflinks exon 149235581 149235653 . + . gene_id "XLOC_000278"; transcript_id "TCONS_00000278"; exon_number "1"; oId "CUFF.590.1"; tss_id "TSS278"; +chr1 Cufflinks exon 149274939 149275007 . + . gene_id "XLOC_000279"; transcript_id "TCONS_00000279"; exon_number "1"; oId "CUFF.591.1"; tss_id "TSS279"; +chr1 Cufflinks exon 149282873 149282933 . + . gene_id "XLOC_000280"; transcript_id "TCONS_00000280"; exon_number "1"; oId "CUFF.593.1"; tss_id "TSS280"; +chr1 Cufflinks exon 149285620 149285687 . + . gene_id "XLOC_000281"; transcript_id "TCONS_00000281"; exon_number "1"; oId "CUFF.595.1"; tss_id "TSS281"; +chr1 Cufflinks exon 149327943 149328016 . + . gene_id "XLOC_000282"; transcript_id "TCONS_00000282"; exon_number "1"; oId "CUFF.602.1"; tss_id "TSS282"; +chr1 Cufflinks exon 149334272 149334341 . + . gene_id "XLOC_000283"; transcript_id "TCONS_00000283"; exon_number "1"; oId "CUFF.603.1"; tss_id "TSS283"; +chr1 Cufflinks exon 149605917 149606081 . + . gene_id "XLOC_000284"; transcript_id "TCONS_00000284"; exon_number "1"; oId "CUFF.607.1"; tss_id "TSS284"; +chr1 Cufflinks exon 149608609 149608685 . + . gene_id "XLOC_000285"; transcript_id "TCONS_00000285"; exon_number "1"; oId "CUFF.608.1"; tss_id "TSS285"; +chr1 Cufflinks exon 149660527 149660595 . + . gene_id "XLOC_000286"; transcript_id "TCONS_00000286"; exon_number "1"; oId "CUFF.610.1"; tss_id "TSS286"; +chr1 Cufflinks exon 149668443 149668503 . + . gene_id "XLOC_000287"; transcript_id "TCONS_00000287"; exon_number "1"; oId "CUFF.612.1"; tss_id "TSS287"; +chr1 Cufflinks exon 149671166 149671233 . + . gene_id "XLOC_000288"; transcript_id "TCONS_00000288"; exon_number "1"; oId "CUFF.614.1"; tss_id "TSS288"; +chr1 Cufflinks exon 149713461 149713534 . + . gene_id "XLOC_000289"; transcript_id "TCONS_00000289"; exon_number "1"; oId "CUFF.621.1"; tss_id "TSS289"; +chr1 Cufflinks exon 149719802 149719871 . + . gene_id "XLOC_000290"; transcript_id "TCONS_00000290"; exon_number "1"; oId "CUFF.622.1"; tss_id "TSS290"; +chr1 Cufflinks exon 150183930 150184223 . + . gene_id "XLOC_000291"; transcript_id "TCONS_00000291"; exon_number "1"; oId "CUFF.626.1"; tss_id "TSS291"; +chr1 Cufflinks exon 150209315 150209500 . + . gene_id "XLOC_000292"; transcript_id "TCONS_00000292"; exon_number "1"; oId "CUFF.627.1"; tss_id "TSS292"; +chr1 Cufflinks exon 150234092 150234199 . + . gene_id "XLOC_000293"; transcript_id "TCONS_00000293"; exon_number "1"; oId "CUFF.628.1"; tss_id "TSS293"; +chr1 Cufflinks exon 150674342 150674448 . + . gene_id "XLOC_000294"; transcript_id "TCONS_00000294"; exon_number "1"; oId "CUFF.636.1"; tss_id "TSS294"; +chr1 Cufflinks exon 151362245 151362316 . + . gene_id "XLOC_000295"; transcript_id "TCONS_00000295"; exon_number "1"; oId "CUFF.641.1"; tss_id "TSS295"; +chr1 Cufflinks exon 151601800 151601902 . + . gene_id "XLOC_000296"; transcript_id "TCONS_00000296"; exon_number "1"; oId "CUFF.642.1"; tss_id "TSS296"; +chr1 Cufflinks exon 151979550 151979617 . + . gene_id "XLOC_000297"; transcript_id "TCONS_00000297"; exon_number "1"; oId "CUFF.644.1"; tss_id "TSS297"; +chr1 Cufflinks exon 153304098 153304202 . + . gene_id "XLOC_000298"; transcript_id "TCONS_00000298"; exon_number "1"; oId "CUFF.646.1"; tss_id "TSS298"; +chr1 Cufflinks exon 153643726 153643799 . + . gene_id "XLOC_000299"; transcript_id "TCONS_00000299"; exon_number "1"; oId "CUFF.648.1"; tss_id "TSS299"; +chr1 Cufflinks exon 153676564 153676856 . + . gene_id "XLOC_000300"; transcript_id "TCONS_00000300"; exon_number "1"; oId "CUFF.649.1"; tss_id "TSS300"; +chr1 Cufflinks exon 153874352 153874393 . + . gene_id "XLOC_000301"; transcript_id "TCONS_00000301"; exon_number "1"; oId "CUFF.651.1"; tss_id "TSS301"; +chr1 Cufflinks exon 153911262 153911303 . + . gene_id "XLOC_000302"; transcript_id "TCONS_00000302"; exon_number "1"; oId "CUFF.652.1"; tss_id "TSS302"; +chr1 Cufflinks exon 154089440 154089513 . + . gene_id "XLOC_000303"; transcript_id "TCONS_00000303"; exon_number "1"; oId "CUFF.655.1"; tss_id "TSS303"; +chr1 Cufflinks exon 154267987 154268077 . + . gene_id "XLOC_000304"; transcript_id "TCONS_00000304"; exon_number "1"; oId "CUFF.657.1"; tss_id "TSS304"; +chr1 Cufflinks exon 154270134 154270224 . + . gene_id "XLOC_000305"; transcript_id "TCONS_00000305"; exon_number "1"; oId "CUFF.658.1"; tss_id "TSS305"; +chr1 Cufflinks exon 154311219 154311278 . + . gene_id "XLOC_000306"; transcript_id "TCONS_00000306"; exon_number "1"; oId "CUFF.659.1"; tss_id "TSS306"; +chr1 Cufflinks exon 155115751 155115807 . + . gene_id "XLOC_000307"; transcript_id "TCONS_00000307"; exon_number "1"; oId "CUFF.660.1"; tss_id "TSS307"; +chr1 Cufflinks exon 155389188 155389291 . + . gene_id "XLOC_000308"; transcript_id "TCONS_00000308"; exon_number "1"; oId "CUFF.663.1"; tss_id "TSS308"; +chr1 Cufflinks exon 155864072 155864180 . + . gene_id "XLOC_000309"; transcript_id "TCONS_00000309"; exon_number "1"; oId "CUFF.665.1"; tss_id "TSS309"; +chr1 Cufflinks exon 156499121 156499223 . + . gene_id "XLOC_000310"; transcript_id "TCONS_00000310"; exon_number "1"; oId "CUFF.666.1"; tss_id "TSS310"; +chr1 Cufflinks exon 157139813 157139887 . + . gene_id "XLOC_000311"; transcript_id "TCONS_00000311"; exon_number "1"; oId "CUFF.669.1"; tss_id "TSS311"; +chr1 Cufflinks exon 158591190 158591295 . + . gene_id "XLOC_000312"; transcript_id "TCONS_00000312"; exon_number "1"; oId "CUFF.670.1"; tss_id "TSS312"; +chr1 Cufflinks exon 158940286 158940339 . + . gene_id "XLOC_000313"; transcript_id "TCONS_00000313"; exon_number "1"; oId "CUFF.671.1"; tss_id "TSS313"; +chr1 Cufflinks exon 159148263 159148352 . + . gene_id "XLOC_000314"; transcript_id "TCONS_00000314"; exon_number "1"; oId "CUFF.673.1"; tss_id "TSS314"; +chr1 Cufflinks exon 160326727 160326763 . + . gene_id "XLOC_000315"; transcript_id "TCONS_00000315"; exon_number "1"; oId "CUFF.676.1"; tss_id "TSS315"; +chr1 Cufflinks exon 161371079 161371185 . + . gene_id "XLOC_000316"; transcript_id "TCONS_00000316"; exon_number "1"; oId "CUFF.681.1"; tss_id "TSS316"; +chr1 Cufflinks exon 161390661 161390733 . + . gene_id "XLOC_000317"; transcript_id "TCONS_00000317"; exon_number "1"; oId "CUFF.683.1"; tss_id "TSS317"; +chr1 Cufflinks exon 161411323 161411405 . + . gene_id "XLOC_000318"; transcript_id "TCONS_00000318"; exon_number "1"; oId "CUFF.688.1"; tss_id "TSS318"; +chr1 Cufflinks exon 161413094 161413167 . + . gene_id "XLOC_000319"; transcript_id "TCONS_00000319"; exon_number "1"; oId "CUFF.689.1"; tss_id "TSS319"; +chr1 Cufflinks exon 161418741 161418823 . + . gene_id "XLOC_000320"; transcript_id "TCONS_00000320"; exon_number "1"; oId "CUFF.693.1"; tss_id "TSS320"; +chr1 Cufflinks exon 161420467 161420540 . + . gene_id "XLOC_000321"; transcript_id "TCONS_00000321"; exon_number "1"; oId "CUFF.694.1"; tss_id "TSS321"; +chr1 Cufflinks exon 161426122 161426204 . + . gene_id "XLOC_000322"; transcript_id "TCONS_00000322"; exon_number "1"; oId "CUFF.698.1"; tss_id "TSS322"; +chr1 Cufflinks exon 161427898 161427971 . + . gene_id "XLOC_000323"; transcript_id "TCONS_00000323"; exon_number "1"; oId "CUFF.699.1"; tss_id "TSS323"; +chr1 Cufflinks exon 161433532 161433614 . + . gene_id "XLOC_000324"; transcript_id "TCONS_00000324"; exon_number "1"; oId "CUFF.703.1"; tss_id "TSS324"; +chr1 Cufflinks exon 161435258 161435331 . + . gene_id "XLOC_000325"; transcript_id "TCONS_00000325"; exon_number "1"; oId "CUFF.704.1"; tss_id "TSS325"; +chr1 Cufflinks exon 161440913 161440995 . + . gene_id "XLOC_000326"; transcript_id "TCONS_00000326"; exon_number "1"; oId "CUFF.708.1"; tss_id "TSS326"; +chr1 Cufflinks exon 161450356 161450429 . + . gene_id "XLOC_000327"; transcript_id "TCONS_00000327"; exon_number "1"; oId "CUFF.709.1"; tss_id "TSS327"; +chr1 Cufflinks exon 161492935 161493006 . + . gene_id "XLOC_000328"; transcript_id "TCONS_00000328"; exon_number "1"; oId "CUFF.710.1"; tss_id "TSS328"; +chr1 Cufflinks exon 161500903 161500974 . + . gene_id "XLOC_000329"; transcript_id "TCONS_00000329"; exon_number "1"; oId "CUFF.713.1"; tss_id "TSS329"; +chr1 Cufflinks exon 161501917 161501986 . + . gene_id "XLOC_000330"; transcript_id "TCONS_00000330"; exon_number "1"; oId "CUFF.714.1"; tss_id "TSS330"; +chr1 Cufflinks exon 161510031 161510104 . + . gene_id "XLOC_000331"; transcript_id "TCONS_00000331"; exon_number "1"; oId "CUFF.715.1"; tss_id "TSS331"; +chr1 Cufflinks exon 161574588 161574659 . + . gene_id "XLOC_000332"; transcript_id "TCONS_00000332"; exon_number "1"; oId "CUFF.716.1"; tss_id "TSS332"; +chr1 Cufflinks exon 161582508 161582577 . + . gene_id "XLOC_000333"; transcript_id "TCONS_00000333"; exon_number "1"; oId "CUFF.719.1"; tss_id "TSS333"; +chr1 Cufflinks exon 161591465 161591537 . + . gene_id "XLOC_000334"; transcript_id "TCONS_00000334"; exon_number "1"; oId "CUFF.720.1"; tss_id "TSS334"; +chr1 Cufflinks exon 161705598 161705911 . + . gene_id "XLOC_000335"; transcript_id "TCONS_00000335"; exon_number "1"; oId "CUFF.721.1"; tss_id "TSS335"; +chr1 Cufflinks exon 162308433 162308512 . + . gene_id "XLOC_000336"; transcript_id "TCONS_00000336"; exon_number "1"; oId "CUFF.723.1"; tss_id "TSS336"; +chr1 Cufflinks exon 162747523 162747816 . + . gene_id "XLOC_000337"; transcript_id "TCONS_00000337"; exon_number "1"; oId "CUFF.724.1"; tss_id "TSS337"; +chr1 Cufflinks exon 163051440 163051477 . + . gene_id "XLOC_000338"; transcript_id "TCONS_00000338"; exon_number "1"; oId "CUFF.725.1"; tss_id "TSS338"; +chr1 Cufflinks exon 163109727 163109906 . + . gene_id "XLOC_000339"; transcript_id "TCONS_00000339"; exon_number "1"; oId "CUFF.726.1"; tss_id "TSS339"; +chr1 Cufflinks exon 163433285 163433320 . + . gene_id "XLOC_000340"; transcript_id "TCONS_00000340"; exon_number "1"; oId "CUFF.727.1"; tss_id "TSS340"; +chr1 Cufflinks exon 163479274 163479362 . + . gene_id "XLOC_000341"; transcript_id "TCONS_00000341"; exon_number "1"; oId "CUFF.729.1"; tss_id "TSS341"; +chr1 Cufflinks exon 163892907 163893110 . + . gene_id "XLOC_000342"; transcript_id "TCONS_00000342"; exon_number "1"; oId "CUFF.730.1"; tss_id "TSS342"; +chr1 Cufflinks exon 164320516 164320626 . + . gene_id "XLOC_000343"; transcript_id "TCONS_00000343"; exon_number "1"; oId "CUFF.732.1"; tss_id "TSS343"; +chr1 Cufflinks exon 164608802 164608903 . + . gene_id "XLOC_000344"; transcript_id "TCONS_00000344"; exon_number "1"; oId "CUFF.734.1"; tss_id "TSS344"; +chr1 Cufflinks exon 164838403 164838442 . + . gene_id "XLOC_000345"; transcript_id "TCONS_00000345"; exon_number "1"; oId "CUFF.736.1"; tss_id "TSS345"; +chr1 Cufflinks exon 165127484 165127558 . + . gene_id "XLOC_000346"; transcript_id "TCONS_00000346"; exon_number "1"; oId "CUFF.740.1"; tss_id "TSS346"; +chr1 Cufflinks exon 165566150 165566223 . + . gene_id "XLOC_000347"; transcript_id "TCONS_00000347"; exon_number "1"; oId "CUFF.741.1"; tss_id "TSS347"; +chr1 Cufflinks exon 165694567 165694668 . + . gene_id "XLOC_000348"; transcript_id "TCONS_00000348"; exon_number "1"; oId "CUFF.743.1"; tss_id "TSS348"; +chr1 Cufflinks exon 166011481 166011587 . + . gene_id "XLOC_000349"; transcript_id "TCONS_00000349"; exon_number "1"; oId "CUFF.744.1"; tss_id "TSS349"; +chr1 Cufflinks exon 166640297 166640359 . + . gene_id "XLOC_000350"; transcript_id "TCONS_00000350"; exon_number "1"; oId "CUFF.746.1"; tss_id "TSS350"; +chr1 Cufflinks exon 166975196 166975316 . + . gene_id "XLOC_000351"; transcript_id "TCONS_00000351"; exon_number "1"; oId "CUFF.747.1"; tss_id "TSS351"; +chr1 Cufflinks exon 167010675 167010776 . + . gene_id "XLOC_000352"; transcript_id "TCONS_00000352"; exon_number "1"; oId "CUFF.748.1"; tss_id "TSS352"; +chr1 Cufflinks exon 167683962 167684033 . + . gene_id "XLOC_000353"; transcript_id "TCONS_00000353"; exon_number "1"; oId "CUFF.750.1"; tss_id "TSS353"; +chr1 Cufflinks exon 168591437 168591479 . + . gene_id "XLOC_000354"; transcript_id "TCONS_00000354"; exon_number "1"; oId "CUFF.754.1"; tss_id "TSS354"; +chr1 Cufflinks exon 168795897 168796039 . + . gene_id "XLOC_000355"; transcript_id "TCONS_00000355"; exon_number "1"; oId "CUFF.755.1"; tss_id "TSS355"; +chr1 Cufflinks exon 169036502 169036578 . + . gene_id "XLOC_000356"; transcript_id "TCONS_00000356"; exon_number "1"; oId "CUFF.756.1"; tss_id "TSS356"; +chr1 Cufflinks exon 169113387 169113470 . + . gene_id "XLOC_000357"; transcript_id "TCONS_00000357"; exon_number "1"; oId "CUFF.757.1"; tss_id "TSS357"; +chr1 Cufflinks exon 169624223 169624281 . + . gene_id "XLOC_000358"; transcript_id "TCONS_00000358"; exon_number "1"; oId "CUFF.758.1"; tss_id "TSS358"; +chr1 Cufflinks exon 169828897 169829197 . + . gene_id "XLOC_000359"; transcript_id "TCONS_00000359"; exon_number "1"; oId "CUFF.759.1"; tss_id "TSS359"; +chr1 Cufflinks exon 171451045 171451151 . + . gene_id "XLOC_000360"; transcript_id "TCONS_00000360"; exon_number "1"; oId "CUFF.764.1"; tss_id "TSS360"; +chr1 Cufflinks exon 171461550 171461844 . + . gene_id "XLOC_000361"; transcript_id "TCONS_00000361"; exon_number "1"; oId "CUFF.765.1"; tss_id "TSS361"; +chr1 Cufflinks exon 171964787 171964958 . + . gene_id "XLOC_000362"; transcript_id "TCONS_00000362"; exon_number "1"; oId "CUFF.768.1"; tss_id "TSS362"; +chr1 Cufflinks exon 172335680 172335786 . + . gene_id "XLOC_000363"; transcript_id "TCONS_00000363"; exon_number "1"; oId "CUFF.770.1"; tss_id "TSS363"; +chr1 Cufflinks exon 173250216 173250343 . + . gene_id "XLOC_000364"; transcript_id "TCONS_00000364"; exon_number "1"; oId "CUFF.771.1"; tss_id "TSS364"; +chr1 Cufflinks exon 173286505 173286536 . + . gene_id "XLOC_000365"; transcript_id "TCONS_00000365"; exon_number "1"; oId "CUFF.772.1"; tss_id "TSS365"; +chr1 Cufflinks exon 173690785 173690945 . + . gene_id "XLOC_000366"; transcript_id "TCONS_00000366"; exon_number "1"; oId "CUFF.774.1"; tss_id "TSS366"; +chr1 Cufflinks exon 173760687 173761025 . + . gene_id "XLOC_000367"; transcript_id "TCONS_00000367"; exon_number "1"; oId "CUFF.775.1"; tss_id "TSS367"; +chr1 Cufflinks exon 173890208 173890285 . + . gene_id "XLOC_000368"; transcript_id "TCONS_00000368"; exon_number "1"; oId "CUFF.777.1"; tss_id "TSS368"; +chr1 Cufflinks exon 174734419 174734460 . + . gene_id "XLOC_000369"; transcript_id "TCONS_00000369"; exon_number "1"; oId "CUFF.782.1"; tss_id "TSS369"; +chr1 Cufflinks exon 174965661 174965765 . + . gene_id "XLOC_000370"; transcript_id "TCONS_00000370"; exon_number "1"; oId "CUFF.783.1"; tss_id "TSS370"; +chr1 Cufflinks exon 175512956 175513004 . + . gene_id "XLOC_000371"; transcript_id "TCONS_00000371"; exon_number "1"; oId "CUFF.785.1"; tss_id "TSS371"; +chr1 Cufflinks exon 175662838 175662882 . + . gene_id "XLOC_000372"; transcript_id "TCONS_00000372"; exon_number "1"; oId "CUFF.786.1"; tss_id "TSS372"; +chr1 Cufflinks exon 175893782 175893850 . + . gene_id "XLOC_000373"; transcript_id "TCONS_00000373"; exon_number "1"; oId "CUFF.787.1"; tss_id "TSS373"; +chr1 Cufflinks exon 176186678 176186714 . + . gene_id "XLOC_000374"; transcript_id "TCONS_00000374"; exon_number "1"; oId "CUFF.788.1"; tss_id "TSS374"; +chr1 Cufflinks exon 176951666 176951709 . + . gene_id "XLOC_000375"; transcript_id "TCONS_00000375"; exon_number "1"; oId "CUFF.790.1"; tss_id "TSS375"; +chr1 Cufflinks exon 177028422 177028486 . + . gene_id "XLOC_000376"; transcript_id "TCONS_00000376"; exon_number "1"; oId "CUFF.791.1"; tss_id "TSS376"; +chr1 Cufflinks exon 178530048 178530136 . + . gene_id "XLOC_000377"; transcript_id "TCONS_00000377"; exon_number "1"; oId "CUFF.793.1"; tss_id "TSS377"; +chr1 Cufflinks exon 179545406 179545491 . + . gene_id "XLOC_000378"; transcript_id "TCONS_00000378"; exon_number "1"; oId "CUFF.795.1"; tss_id "TSS378"; +chr1 Cufflinks exon 179869397 179869720 . + . gene_id "XLOC_000379"; transcript_id "TCONS_00000379"; exon_number "1"; oId "CUFF.797.1"; tss_id "TSS379"; +chr1 Cufflinks exon 180421083 180421111 . + . gene_id "XLOC_000380"; transcript_id "TCONS_00000380"; exon_number "1"; oId "CUFF.801.1"; tss_id "TSS380"; +chr1 Cufflinks exon 180727858 180727953 . + . gene_id "XLOC_000381"; transcript_id "TCONS_00000381"; exon_number "1"; oId "CUFF.803.1"; tss_id "TSS381"; +chr1 Cufflinks exon 180765885 180765919 . + . gene_id "XLOC_000382"; transcript_id "TCONS_00000382"; exon_number "1"; oId "CUFF.804.1"; tss_id "TSS382"; +chr1 Cufflinks exon 181740702 181740791 . + . gene_id "XLOC_000383"; transcript_id "TCONS_00000383"; exon_number "1"; oId "CUFF.805.1"; tss_id "TSS383"; +chr1 Cufflinks exon 182296203 182296309 . + . gene_id "XLOC_000384"; transcript_id "TCONS_00000384"; exon_number "1"; oId "CUFF.808.1"; tss_id "TSS384"; +chr1 Cufflinks exon 183429931 183429970 . + . gene_id "XLOC_000385"; transcript_id "TCONS_00000385"; exon_number "1"; oId "CUFF.813.1"; tss_id "TSS385"; +chr1 Cufflinks exon 184304797 184305102 . + . gene_id "XLOC_000386"; transcript_id "TCONS_00000386"; exon_number "1"; oId "CUFF.815.1"; tss_id "TSS386"; +chr1 Cufflinks exon 184322852 184323063 . + . gene_id "XLOC_000387"; transcript_id "TCONS_00000387"; exon_number "1"; oId "CUFF.816.1"; tss_id "TSS387"; +chr1 Cufflinks exon 185067561 185067696 . + . gene_id "XLOC_000388"; transcript_id "TCONS_00000388"; exon_number "1"; oId "CUFF.819.1"; tss_id "TSS388"; +chr1 Cufflinks exon 185403377 185403436 . + . gene_id "XLOC_000389"; transcript_id "TCONS_00000389"; exon_number "1"; oId "CUFF.820.1"; tss_id "TSS389"; +chr1 Cufflinks exon 186341760 186341849 . + . gene_id "XLOC_000390"; transcript_id "TCONS_00000390"; exon_number "1"; oId "CUFF.822.1"; tss_id "TSS390"; +chr1 Cufflinks exon 187728651 187728699 . + . gene_id "XLOC_000391"; transcript_id "TCONS_00000391"; exon_number "1"; oId "CUFF.823.1"; tss_id "TSS391"; +chr1 Cufflinks exon 192840106 192840148 . + . gene_id "XLOC_000392"; transcript_id "TCONS_00000392"; exon_number "1"; oId "CUFF.831.1"; tss_id "TSS392"; +chr1 Cufflinks exon 192939928 192939968 . + . gene_id "XLOC_000393"; transcript_id "TCONS_00000393"; exon_number "1"; oId "CUFF.833.1"; tss_id "TSS393"; +chr1 Cufflinks exon 198053631 198053669 . + . gene_id "XLOC_000394"; transcript_id "TCONS_00000394"; exon_number "1"; oId "CUFF.839.1"; tss_id "TSS394"; +chr1 Cufflinks exon 198856993 198857035 . + . gene_id "XLOC_000395"; transcript_id "TCONS_00000395"; exon_number "1"; oId "CUFF.841.1"; tss_id "TSS395"; +chr1 Cufflinks exon 198926351 198926474 . + . gene_id "XLOC_000396"; transcript_id "TCONS_00000396"; exon_number "1"; oId "CUFF.842.1"; tss_id "TSS396"; +chr1 Cufflinks exon 199857287 199857386 . + . gene_id "XLOC_000397"; transcript_id "TCONS_00000397"; exon_number "1"; oId "CUFF.843.1"; tss_id "TSS397"; +chr1 Cufflinks exon 199930736 199930820 . + . gene_id "XLOC_000398"; transcript_id "TCONS_00000398"; exon_number "1"; oId "CUFF.844.1"; tss_id "TSS398"; +chr1 Cufflinks exon 200023191 200023288 . + . gene_id "XLOC_000399"; transcript_id "TCONS_00000399"; exon_number "1"; oId "CUFF.847.1"; tss_id "TSS399"; +chr1 Cufflinks exon 201702534 201702631 . + . gene_id "XLOC_000400"; transcript_id "TCONS_00000400"; exon_number "1"; oId "CUFF.851.1"; tss_id "TSS400"; +chr1 Cufflinks exon 201796617 201796731 . + . gene_id "XLOC_000401"; transcript_id "TCONS_00000401"; exon_number "1"; oId "CUFF.852.1"; tss_id "TSS401"; +chr1 Cufflinks exon 202195473 202195503 . + . gene_id "XLOC_000402"; transcript_id "TCONS_00000402"; exon_number "1"; oId "CUFF.854.1"; tss_id "TSS402"; +chr1 Cufflinks exon 202200791 202200895 . + . gene_id "XLOC_000403"; transcript_id "TCONS_00000403"; exon_number "1"; oId "CUFF.855.1"; tss_id "TSS403"; +chr1 Cufflinks exon 202469295 202469333 . + . gene_id "XLOC_000404"; transcript_id "TCONS_00000404"; exon_number "1"; oId "CUFF.857.1"; tss_id "TSS404"; +chr1 Cufflinks exon 204475655 204475727 . + . gene_id "XLOC_000405"; transcript_id "TCONS_00000405"; exon_number "1"; oId "CUFF.859.1"; tss_id "TSS405"; +chr1 Cufflinks exon 205443271 205443345 . + . gene_id "XLOC_000406"; transcript_id "TCONS_00000406"; exon_number "1"; oId "CUFF.864.1"; tss_id "TSS406"; +chr1 Cufflinks exon 205535844 205535907 . + . gene_id "XLOC_000407"; transcript_id "TCONS_00000407"; exon_number "1"; oId "CUFF.865.1"; tss_id "TSS407"; +chr1 Cufflinks exon 205564169 205564267 . + . gene_id "XLOC_000408"; transcript_id "TCONS_00000408"; exon_number "1"; oId "CUFF.866.1"; tss_id "TSS408"; +chr1 Cufflinks exon 205707710 205707743 . + . gene_id "XLOC_000409"; transcript_id "TCONS_00000409"; exon_number "1"; oId "CUFF.867.1"; tss_id "TSS409"; +chr1 Cufflinks exon 207359638 207359689 . + . gene_id "XLOC_000410"; transcript_id "TCONS_00000410"; exon_number "1"; oId "CUFF.871.1"; tss_id "TSS410"; +chr1 Cufflinks exon 208102324 208102369 . + . gene_id "XLOC_000411"; transcript_id "TCONS_00000411"; exon_number "1"; oId "CUFF.879.1"; tss_id "TSS411"; +chr1 Cufflinks exon 208763875 208763978 . + . gene_id "XLOC_000412"; transcript_id "TCONS_00000412"; exon_number "1"; oId "CUFF.880.1"; tss_id "TSS412"; +chr1 Cufflinks exon 211366115 211366158 . + . gene_id "XLOC_000413"; transcript_id "TCONS_00000413"; exon_number "1"; oId "CUFF.883.1"; tss_id "TSS413"; +chr1 Cufflinks exon 211559169 211559224 . + . gene_id "XLOC_000414"; transcript_id "TCONS_00000414"; exon_number "1"; oId "CUFF.885.1"; tss_id "TSS414"; +chr1 Cufflinks exon 212865606 212865709 . + . gene_id "XLOC_000415"; transcript_id "TCONS_00000415"; exon_number "1"; oId "CUFF.892.1"; tss_id "TSS415"; +chr1 Cufflinks exon 213020170 213020206 . + . gene_id "XLOC_000416"; transcript_id "TCONS_00000416"; exon_number "1"; oId "CUFF.893.1"; tss_id "TSS416"; +chr1 Cufflinks exon 217893868 217893937 . + . gene_id "XLOC_000417"; transcript_id "TCONS_00000417"; exon_number "1"; oId "CUFF.899.1"; tss_id "TSS417"; +chr1 Cufflinks exon 218303137 218303299 . + . gene_id "XLOC_000418"; transcript_id "TCONS_00000418"; exon_number "1"; oId "CUFF.900.1"; tss_id "TSS418"; +chr1 Cufflinks exon 218728955 218728987 . + . gene_id "XLOC_000419"; transcript_id "TCONS_00000419"; exon_number "1"; oId "CUFF.904.1"; tss_id "TSS419"; +chr1 Cufflinks exon 219776810 219776852 . + . gene_id "XLOC_000420"; transcript_id "TCONS_00000420"; exon_number "1"; oId "CUFF.905.1"; tss_id "TSS420"; +chr1 Cufflinks exon 219836017 219836058 . + . gene_id "XLOC_000421"; transcript_id "TCONS_00000421"; exon_number "1"; oId "CUFF.906.1"; tss_id "TSS421"; +chr1 Cufflinks exon 219935131 219935215 . + . gene_id "XLOC_000422"; transcript_id "TCONS_00000422"; exon_number "1"; oId "CUFF.907.1"; tss_id "TSS422"; +chr1 Cufflinks exon 220046619 220046661 . + . gene_id "XLOC_000423"; transcript_id "TCONS_00000423"; exon_number "1"; oId "CUFF.908.1"; tss_id "TSS423"; +chr1 Cufflinks exon 220136031 220136207 . + . gene_id "XLOC_000424"; transcript_id "TCONS_00000424"; exon_number "1"; oId "CUFF.909.1"; tss_id "TSS424"; +chr1 Cufflinks exon 220310505 220310611 . + . gene_id "XLOC_000425"; transcript_id "TCONS_00000425"; exon_number "1"; oId "CUFF.911.1"; tss_id "TSS425"; +chr1 Cufflinks exon 222522769 222522879 . + . gene_id "XLOC_000426"; transcript_id "TCONS_00000426"; exon_number "1"; oId "CUFF.914.1"; tss_id "TSS426"; +chr1 Cufflinks exon 222638347 222638421 . + . gene_id "XLOC_000427"; transcript_id "TCONS_00000427"; exon_number "1"; oId "CUFF.915.1"; tss_id "TSS427"; +chr1 Cufflinks exon 223547164 223547229 . + . gene_id "XLOC_000428"; transcript_id "TCONS_00000428"; exon_number "1"; oId "CUFF.919.1"; tss_id "TSS428"; +chr1 Cufflinks exon 223877753 223877816 . + . gene_id "XLOC_000429"; transcript_id "TCONS_00000429"; exon_number "1"; oId "CUFF.920.1"; tss_id "TSS429"; +chr1 Cufflinks exon 224401056 224401144 . + . gene_id "XLOC_000430"; transcript_id "TCONS_00000430"; exon_number "1"; oId "CUFF.925.1"; tss_id "TSS430"; +chr1 Cufflinks exon 224493082 224493181 . + . gene_id "XLOC_000431"; transcript_id "TCONS_00000431"; exon_number "1"; oId "CUFF.926.1"; tss_id "TSS431"; +chr1 Cufflinks exon 224524494 224524593 . + . gene_id "XLOC_000432"; transcript_id "TCONS_00000432"; exon_number "1"; oId "CUFF.927.1"; tss_id "TSS432"; +chr1 Cufflinks exon 224606548 224606579 . + . gene_id "XLOC_000433"; transcript_id "TCONS_00000433"; exon_number "1"; oId "CUFF.928.1"; tss_id "TSS433"; +chr1 Cufflinks exon 225449613 225449652 . + . gene_id "XLOC_000434"; transcript_id "TCONS_00000434"; exon_number "1"; oId "CUFF.930.1"; tss_id "TSS434"; +chr1 Cufflinks exon 225866682 225866722 . + . gene_id "XLOC_000435"; transcript_id "TCONS_00000435"; exon_number "1"; oId "CUFF.931.1"; tss_id "TSS435"; +chr1 Cufflinks exon 225928977 225929046 . + . gene_id "XLOC_000436"; transcript_id "TCONS_00000436"; exon_number "1"; oId "CUFF.932.1"; tss_id "TSS436"; +chr1 Cufflinks exon 226491964 226492066 . + . gene_id "XLOC_000437"; transcript_id "TCONS_00000437"; exon_number "1"; oId "CUFF.933.1"; tss_id "TSS437"; +chr1 Cufflinks exon 226633639 226633872 . + . gene_id "XLOC_000438"; transcript_id "TCONS_00000438"; exon_number "1"; oId "CUFF.937.1"; tss_id "TSS438"; +chr1 Cufflinks exon 227748882 227749003 . + . gene_id "XLOC_000439"; transcript_id "TCONS_00000439"; exon_number "1"; oId "CUFF.940.1"; tss_id "TSS439"; +chr1 Cufflinks exon 228743494 228743604 . + . gene_id "XLOC_000440"; transcript_id "TCONS_00000440"; exon_number "1"; oId "CUFF.942.1"; tss_id "TSS440"; +chr1 Cufflinks exon 229518875 229518935 . + . gene_id "XLOC_000441"; transcript_id "TCONS_00000441"; exon_number "1"; oId "CUFF.963.1"; tss_id "TSS441"; +chr1 Cufflinks exon 229673604 229673639 . + . gene_id "XLOC_000442"; transcript_id "TCONS_00000442"; exon_number "1"; oId "CUFF.967.1"; tss_id "TSS442"; +chr1 Cufflinks exon 229685652 229685771 . + . gene_id "XLOC_000443"; transcript_id "TCONS_00000443"; exon_number "1"; oId "CUFF.968.1"; tss_id "TSS443"; +chr1 Cufflinks exon 229886284 229886321 . + . gene_id "XLOC_000444"; transcript_id "TCONS_00000444"; exon_number "1"; oId "CUFF.969.1"; tss_id "TSS444"; +chr1 Cufflinks exon 230955996 230956106 . + . gene_id "XLOC_000445"; transcript_id "TCONS_00000445"; exon_number "1"; oId "CUFF.972.1"; tss_id "TSS445"; +chr1 Cufflinks exon 231029892 231030190 . + . gene_id "XLOC_000446"; transcript_id "TCONS_00000446"; exon_number "1"; oId "CUFF.973.1"; tss_id "TSS446"; +chr1 Cufflinks exon 231806381 231806480 . + . gene_id "XLOC_000447"; transcript_id "TCONS_00000447"; exon_number "1"; oId "CUFF.977.1"; tss_id "TSS447"; +chr1 Cufflinks exon 232358625 232358886 . + . gene_id "XLOC_000448"; transcript_id "TCONS_00000448"; exon_number "1"; oId "CUFF.978.1"; tss_id "TSS448"; +chr1 Cufflinks exon 232835968 232836050 . + . gene_id "XLOC_000449"; transcript_id "TCONS_00000449"; exon_number "1"; oId "CUFF.981.1"; tss_id "TSS449"; +chr1 Cufflinks exon 234729020 234729149 . + . gene_id "XLOC_000450"; transcript_id "TCONS_00000450"; exon_number "1"; oId "CUFF.987.1"; tss_id "TSS450"; +chr1 Cufflinks exon 235039934 235040251 . + . gene_id "XLOC_000451"; transcript_id "TCONS_00000451"; exon_number "1"; oId "CUFF.988.1"; tss_id "TSS451"; +chr1 Cufflinks exon 236078715 236078821 . + . gene_id "XLOC_000452"; transcript_id "TCONS_00000452"; exon_number "1"; oId "CUFF.990.1"; tss_id "TSS452"; +chr1 Cufflinks exon 236431080 236431254 . + . gene_id "XLOC_000453"; transcript_id "TCONS_00000453"; exon_number "1"; oId "CUFF.991.1"; tss_id "TSS453"; +chr1 Cufflinks exon 236464279 236464349 . + . gene_id "XLOC_000454"; transcript_id "TCONS_00000454"; exon_number "1"; oId "CUFF.992.1"; tss_id "TSS454"; +chr1 Cufflinks exon 236588072 236588136 . + . gene_id "XLOC_000455"; transcript_id "TCONS_00000455"; exon_number "1"; oId "CUFF.993.1"; tss_id "TSS455"; +chr1 Cufflinks exon 237284107 237284313 . + . gene_id "XLOC_000456"; transcript_id "TCONS_00000456"; exon_number "1"; oId "CUFF.994.1"; tss_id "TSS456"; +chr1 Cufflinks exon 237766309 237766764 . + . gene_id "XLOC_000457"; transcript_id "TCONS_00000457"; exon_number "1"; oId "CUFF.995.1"; tss_id "TSS457"; +chr1 Cufflinks exon 237980428 237980466 . + . gene_id "XLOC_000458"; transcript_id "TCONS_00000458"; exon_number "1"; oId "CUFF.996.1"; tss_id "TSS458"; +chr1 Cufflinks exon 238105862 238105933 . + . gene_id "XLOC_000459"; transcript_id "TCONS_00000459"; exon_number "1"; oId "CUFF.997.1"; tss_id "TSS459"; +chr1 Cufflinks exon 239847429 239847464 . + . gene_id "XLOC_000460"; transcript_id "TCONS_00000460"; exon_number "1"; oId "CUFF.1002.1"; tss_id "TSS460"; +chr1 Cufflinks exon 239864163 239864201 . + . gene_id "XLOC_000461"; transcript_id "TCONS_00000461"; exon_number "1"; oId "CUFF.1003.1"; tss_id "TSS461"; +chr1 Cufflinks exon 240816675 240816778 . + . gene_id "XLOC_000462"; transcript_id "TCONS_00000462"; exon_number "1"; oId "CUFF.1005.1"; tss_id "TSS462"; +chr1 Cufflinks exon 241105566 241105616 . + . gene_id "XLOC_000463"; transcript_id "TCONS_00000463"; exon_number "1"; oId "CUFF.1006.1"; tss_id "TSS463"; +chr1 Cufflinks exon 242118383 242118420 . + . gene_id "XLOC_000464"; transcript_id "TCONS_00000464"; exon_number "1"; oId "CUFF.1008.1"; tss_id "TSS464"; +chr1 Cufflinks exon 242175904 242175945 . + . gene_id "XLOC_000465"; transcript_id "TCONS_00000465"; exon_number "1"; oId "CUFF.1009.1"; tss_id "TSS465"; +chr1 Cufflinks exon 242198438 242198488 . + . gene_id "XLOC_000466"; transcript_id "TCONS_00000466"; exon_number "1"; oId "CUFF.1011.1"; tss_id "TSS466"; +chr1 Cufflinks exon 242198792 242198825 . + . gene_id "XLOC_000467"; transcript_id "TCONS_00000467"; exon_number "1"; oId "CUFF.1012.1"; tss_id "TSS467"; +chr1 Cufflinks exon 242297574 242297684 . + . gene_id "XLOC_000468"; transcript_id "TCONS_00000468"; exon_number "1"; oId "CUFF.1014.1"; tss_id "TSS468"; +chr1 Cufflinks exon 242526700 242526773 . + . gene_id "XLOC_000469"; transcript_id "TCONS_00000469"; exon_number "1"; oId "CUFF.1017.1"; tss_id "TSS469"; +chr1 Cufflinks exon 242543303 242543345 . + . gene_id "XLOC_000470"; transcript_id "TCONS_00000470"; exon_number "1"; oId "CUFF.1018.1"; tss_id "TSS470"; +chr1 Cufflinks exon 244267234 244267518 . + . gene_id "XLOC_000471"; transcript_id "TCONS_00000471"; exon_number "1"; oId "CUFF.1021.1"; tss_id "TSS471"; +chr1 Cufflinks exon 244406734 244406796 . + . gene_id "XLOC_000472"; transcript_id "TCONS_00000472"; exon_number "1"; oId "CUFF.1022.1"; tss_id "TSS472"; +chr1 Cufflinks exon 245107204 245107517 . + . gene_id "XLOC_000473"; transcript_id "TCONS_00000473"; exon_number "1"; oId "CUFF.1023.1"; tss_id "TSS473"; +chr1 Cufflinks exon 245118184 245118265 . + . gene_id "XLOC_000474"; transcript_id "TCONS_00000474"; exon_number "1"; oId "CUFF.1024.1"; tss_id "TSS474"; +chr1 Cufflinks exon 245176683 245176753 . + . gene_id "XLOC_000475"; transcript_id "TCONS_00000475"; exon_number "1"; oId "CUFF.1025.1"; tss_id "TSS475"; +chr1 Cufflinks exon 245186317 245186418 . + . gene_id "XLOC_000476"; transcript_id "TCONS_00000476"; exon_number "1"; oId "CUFF.1026.1"; tss_id "TSS476"; +chr1 Cufflinks exon 245207230 245207334 . + . gene_id "XLOC_000477"; transcript_id "TCONS_00000477"; exon_number "1"; oId "CUFF.1027.1"; tss_id "TSS477"; +chr1 Cufflinks exon 246061437 246061474 . + . gene_id "XLOC_000478"; transcript_id "TCONS_00000478"; exon_number "1"; oId "CUFF.1029.1"; tss_id "TSS478"; +chr1 Cufflinks exon 246220320 246220392 . + . gene_id "XLOC_000479"; transcript_id "TCONS_00000479"; exon_number "1"; oId "CUFF.1032.1"; tss_id "TSS479"; +chr1 Cufflinks exon 248783006 248783057 . + . gene_id "XLOC_000480"; transcript_id "TCONS_00000480"; exon_number "1"; oId "CUFF.1037.1"; tss_id "TSS480"; +chr1 Cufflinks exon 249168054 249168160 . + . gene_id "XLOC_000481"; transcript_id "TCONS_00000481"; exon_number "1"; oId "CUFF.1038.1"; tss_id "TSS481"; +chr1 Cufflinks exon 249168447 249168518 . + . gene_id "XLOC_000482"; transcript_id "TCONS_00000482"; exon_number "1"; oId "CUFF.1039.1"; tss_id "TSS482"; +chr1 Cufflinks exon 157784 157886 . - . gene_id "XLOC_000483"; transcript_id "TCONS_00000483"; exon_number "1"; oId "CUFF.1.1"; tss_id "TSS483"; +chr1 Cufflinks exon 564879 564950 . - . gene_id "XLOC_000484"; transcript_id "TCONS_00000484"; exon_number "1"; oId "CUFF.2.1"; tss_id "TSS484"; +chr1 Cufflinks exon 567999 568065 . - . gene_id "XLOC_000485"; transcript_id "TCONS_00000485"; exon_number "1"; oId "CUFF.3.1"; tss_id "TSS485"; +chr1 Cufflinks exon 693613 693715 . - . gene_id "XLOC_000486"; transcript_id "TCONS_00000486"; exon_number "1"; oId "CUFF.4.1"; tss_id "TSS486"; +chr1 Cufflinks exon 1340826 1341132 . - . gene_id "XLOC_000487"; transcript_id "TCONS_00000487"; exon_number "1"; oId "CUFF.5.1"; tss_id "TSS487"; +chr1 Cufflinks exon 3041068 3041105 . - . gene_id "XLOC_000488"; transcript_id "TCONS_00000488"; exon_number "1"; oId "CUFF.9.1"; tss_id "TSS488"; +chr1 Cufflinks exon 4295267 4295311 . - . gene_id "XLOC_000489"; transcript_id "TCONS_00000489"; exon_number "1"; oId "CUFF.11.1"; tss_id "TSS489"; +chr1 Cufflinks exon 4417099 4417211 . - . gene_id "XLOC_000490"; transcript_id "TCONS_00000490"; exon_number "1"; oId "CUFF.12.1"; tss_id "TSS490"; +chr1 Cufflinks exon 4907332 4907399 . - . gene_id "XLOC_000491"; transcript_id "TCONS_00000491"; exon_number "1"; oId "CUFF.13.1"; tss_id "TSS491"; +chr1 Cufflinks exon 6010164 6010200 . - . gene_id "XLOC_000492"; transcript_id "TCONS_00000492"; exon_number "1"; oId "CUFF.14.1"; tss_id "TSS492"; +chr1 Cufflinks exon 7856843 7856877 . - . gene_id "XLOC_000493"; transcript_id "TCONS_00000493"; exon_number "1"; oId "CUFF.19.1"; tss_id "TSS493"; +chr1 Cufflinks exon 7990339 7990408 . - . gene_id "XLOC_000494"; transcript_id "TCONS_00000494"; exon_number "1"; oId "CUFF.21.1"; tss_id "TSS494"; +chr1 Cufflinks exon 8054473 8054535 . - . gene_id "XLOC_000495"; transcript_id "TCONS_00000495"; exon_number "1"; oId "CUFF.22.1"; tss_id "TSS495"; +chr1 Cufflinks exon 8266494 8266654 . - . gene_id "XLOC_000496"; transcript_id "TCONS_00000496"; exon_number "1"; oId "CUFF.23.1"; tss_id "TSS496"; +chr1 Cufflinks exon 8352223 8352323 . - . gene_id "XLOC_000497"; transcript_id "TCONS_00000497"; exon_number "1"; oId "CUFF.24.1"; tss_id "TSS497"; +chr1 Cufflinks exon 8943488 8943584 . - . gene_id "XLOC_000498"; transcript_id "TCONS_00000498"; exon_number "1"; oId "CUFF.27.1"; tss_id "TSS498"; +chr1 Cufflinks exon 9039616 9039933 . - . gene_id "XLOC_000499"; transcript_id "TCONS_00000499"; exon_number "1"; oId "CUFF.28.1"; tss_id "TSS499"; +chr1 Cufflinks exon 9497767 9497837 . - . gene_id "XLOC_000500"; transcript_id "TCONS_00000500"; exon_number "1"; oId "CUFF.30.1"; tss_id "TSS500"; +chr1 Cufflinks exon 9595295 9595329 . - . gene_id "XLOC_000501"; transcript_id "TCONS_00000501"; exon_number "1"; oId "CUFF.31.1"; tss_id "TSS501"; +chr1 Cufflinks exon 10020615 10020684 . - . gene_id "XLOC_000502"; transcript_id "TCONS_00000502"; exon_number "1"; oId "CUFF.33.1"; tss_id "TSS502"; +chr1 Cufflinks exon 11229562 11229670 . - . gene_id "XLOC_000503"; transcript_id "TCONS_00000503"; exon_number "1"; oId "CUFF.39.1"; tss_id "TSS503"; +chr1 Cufflinks exon 11969864 11969983 . - . gene_id "XLOC_000504"; transcript_id "TCONS_00000504"; exon_number "1"; oId "CUFF.42.1"; tss_id "TSS504"; +chr1 Cufflinks exon 12096791 12097067 . - . gene_id "XLOC_000505"; transcript_id "TCONS_00000505"; exon_number "1"; oId "CUFF.44.1"; tss_id "TSS505"; +chr1 Cufflinks exon 12137940 12138041 . - . gene_id "XLOC_000506"; transcript_id "TCONS_00000506"; exon_number "1"; oId "CUFF.45.1"; tss_id "TSS506"; +chr1 Cufflinks exon 12469242 12469304 . - . gene_id "XLOC_000507"; transcript_id "TCONS_00000507"; exon_number "1"; oId "CUFF.46.1"; tss_id "TSS507"; +chr1 Cufflinks exon 13384735 13384841 . - . gene_id "XLOC_000508"; transcript_id "TCONS_00000508"; exon_number "1"; oId "CUFF.49.1"; tss_id "TSS508"; +chr1 Cufflinks exon 13923134 13923172 . - . gene_id "XLOC_000509"; transcript_id "TCONS_00000509"; exon_number "1"; oId "CUFF.50.1"; tss_id "TSS509"; +chr1 Cufflinks exon 13949706 13949779 . - . gene_id "XLOC_000510"; transcript_id "TCONS_00000510"; exon_number "1"; oId "CUFF.51.1"; tss_id "TSS510"; +chr1 Cufflinks exon 14450729 14450830 . - . gene_id "XLOC_000511"; transcript_id "TCONS_00000511"; exon_number "1"; oId "CUFF.52.1"; tss_id "TSS511"; +chr1 Cufflinks exon 14665391 14665505 . - . gene_id "XLOC_000512"; transcript_id "TCONS_00000512"; exon_number "1"; oId "CUFF.53.1"; tss_id "TSS512"; +chr1 Cufflinks exon 14938794 14938828 . - . gene_id "XLOC_000513"; transcript_id "TCONS_00000513"; exon_number "1"; oId "CUFF.54.1"; tss_id "TSS513"; +chr1 Cufflinks exon 15258254 15258307 . - . gene_id "XLOC_000514"; transcript_id "TCONS_00000514"; exon_number "1"; oId "CUFF.55.1"; tss_id "TSS514"; +chr1 Cufflinks exon 15934258 15934297 . - . gene_id "XLOC_000515"; transcript_id "TCONS_00000515"; exon_number "1"; oId "CUFF.56.1"; tss_id "TSS515"; +chr1 Cufflinks exon 15934607 15934639 . - . gene_id "XLOC_000516"; transcript_id "TCONS_00000516"; exon_number "1"; oId "CUFF.57.1"; tss_id "TSS516"; +chr1 Cufflinks exon 15976865 15976906 . - . gene_id "XLOC_000517"; transcript_id "TCONS_00000517"; exon_number "1"; oId "CUFF.58.1"; tss_id "TSS517"; +chr1 Cufflinks exon 16832939 16832971 . - . gene_id "XLOC_000518"; transcript_id "TCONS_00000518"; exon_number "1"; oId "CUFF.62.1"; tss_id "TSS518"; +chr1 Cufflinks exon 16840617 16840780 . - . gene_id "XLOC_000519"; transcript_id "TCONS_00000519"; exon_number "1"; oId "CUFF.63.1"; tss_id "TSS519"; +chr1 Cufflinks exon 16847079 16847153 . - . gene_id "XLOC_000520"; transcript_id "TCONS_00000520"; exon_number "1"; oId "CUFF.64.1"; tss_id "TSS520"; +chr1 Cufflinks exon 16858893 16858966 . - . gene_id "XLOC_000521"; transcript_id "TCONS_00000521"; exon_number "1"; oId "CUFF.65.1"; tss_id "TSS521"; +chr1 Cufflinks exon 16860579 16860715 . - . gene_id "XLOC_000522"; transcript_id "TCONS_00000522"; exon_number "1"; oId "CUFF.67.1"; tss_id "TSS522"; +chr1 Cufflinks exon 16861774 16861845 . - . gene_id "XLOC_000523"; transcript_id "TCONS_00000523"; exon_number "1"; oId "CUFF.68.1"; tss_id "TSS523"; +chr1 Cufflinks exon 16871136 16871203 . - . gene_id "XLOC_000524"; transcript_id "TCONS_00000524"; exon_number "1"; oId "CUFF.69.1"; tss_id "TSS524"; +chr1 Cufflinks exon 16872434 16872504 . - . gene_id "XLOC_000525"; transcript_id "TCONS_00000525"; exon_number "1"; oId "CUFF.70.1"; tss_id "TSS525"; +chr1 Cufflinks exon 16874158 16874232 . - . gene_id "XLOC_000526"; transcript_id "TCONS_00000526"; exon_number "1"; oId "CUFF.71.1"; tss_id "TSS526"; +chr1 Cufflinks exon 16985601 16985633 . - . gene_id "XLOC_000527"; transcript_id "TCONS_00000527"; exon_number "1"; oId "CUFF.73.1"; tss_id "TSS527"; +chr1 Cufflinks exon 16993280 16993443 . - . gene_id "XLOC_000528"; transcript_id "TCONS_00000528"; exon_number "1"; oId "CUFF.74.1"; tss_id "TSS528"; +chr1 Cufflinks exon 17003471 17003538 . - . gene_id "XLOC_000529"; transcript_id "TCONS_00000529"; exon_number "1"; oId "CUFF.75.1"; tss_id "TSS529"; +chr1 Cufflinks exon 17004765 17004836 . - . gene_id "XLOC_000530"; transcript_id "TCONS_00000530"; exon_number "1"; oId "CUFF.76.1"; tss_id "TSS530"; +chr1 Cufflinks exon 17006502 17006573 . - . gene_id "XLOC_000531"; transcript_id "TCONS_00000531"; exon_number "1"; oId "CUFF.77.1"; tss_id "TSS531"; +chr1 Cufflinks exon 17180900 17180971 . - . gene_id "XLOC_000532"; transcript_id "TCONS_00000532"; exon_number "1"; oId "CUFF.83.1"; tss_id "TSS532"; +chr1 Cufflinks exon 17200843 17200910 . - . gene_id "XLOC_000533"; transcript_id "TCONS_00000533"; exon_number "1"; oId "CUFF.89.1"; tss_id "TSS533"; +chr1 Cufflinks exon 17509435 17509472 . - . gene_id "XLOC_000534"; transcript_id "TCONS_00000534"; exon_number "1"; oId "CUFF.93.1"; tss_id "TSS534"; +chr1 Cufflinks exon 17617162 17617205 . - . gene_id "XLOC_000535"; transcript_id "TCONS_00000535"; exon_number "1"; oId "CUFF.94.1"; tss_id "TSS535"; +chr1 Cufflinks exon 19631570 19631675 . - . gene_id "XLOC_000536"; transcript_id "TCONS_00000536"; exon_number "1"; oId "CUFF.98.1"; tss_id "TSS536"; +chr1 Cufflinks exon 19858661 19858769 . - . gene_id "XLOC_000537"; transcript_id "TCONS_00000537"; exon_number "1"; oId "CUFF.101.1"; tss_id "TSS537"; +chr1 Cufflinks exon 21876327 21876369 . - . gene_id "XLOC_000538"; transcript_id "TCONS_00000538"; exon_number "1"; oId "CUFF.107.1"; tss_id "TSS538"; +chr1 Cufflinks exon 22012181 22012217 . - . gene_id "XLOC_000539"; transcript_id "TCONS_00000539"; exon_number "1"; oId "CUFF.108.1"; tss_id "TSS539"; +chr1 Cufflinks exon 22355829 22355905 . - . gene_id "XLOC_000540"; transcript_id "TCONS_00000540"; exon_number "1"; oId "CUFF.112.1"; tss_id "TSS540"; +chr1 Cufflinks exon 24000997 24001031 . - . gene_id "XLOC_000541"; transcript_id "TCONS_00000541"; exon_number "1"; oId "CUFF.118.1"; tss_id "TSS541"; +chr1 Cufflinks exon 24063086 24063380 . - . gene_id "XLOC_000542"; transcript_id "TCONS_00000542"; exon_number "1"; oId "CUFF.119.1"; tss_id "TSS542"; +chr1 Cufflinks exon 24993473 24993579 . - . gene_id "XLOC_000543"; transcript_id "TCONS_00000543"; exon_number "1"; oId "CUFF.122.1"; tss_id "TSS543"; +chr1 Cufflinks exon 25104365 25104470 . - . gene_id "XLOC_000544"; transcript_id "TCONS_00000544"; exon_number "1"; oId "CUFF.123.1"; tss_id "TSS544"; +chr1 Cufflinks exon 25483509 25483621 . - . gene_id "XLOC_000545"; transcript_id "TCONS_00000545"; exon_number "1"; oId "CUFF.124.1"; tss_id "TSS545"; +chr1 Cufflinks exon 25487187 25487225 . - . gene_id "XLOC_000546"; transcript_id "TCONS_00000546"; exon_number "1"; oId "CUFF.125.1"; tss_id "TSS546"; +chr1 Cufflinks exon 25672764 25672869 . - . gene_id "XLOC_000547"; transcript_id "TCONS_00000547"; exon_number "1"; oId "CUFF.127.1"; tss_id "TSS547"; +chr1 Cufflinks exon 26465960 26465994 . - . gene_id "XLOC_000548"; transcript_id "TCONS_00000548"; exon_number "1"; oId "CUFF.129.1"; tss_id "TSS548"; +chr1 Cufflinks exon 26919714 26920037 . - . gene_id "XLOC_000549"; transcript_id "TCONS_00000549"; exon_number "1"; oId "CUFF.132.1"; tss_id "TSS549"; +chr1 Cufflinks exon 26928869 26928922 . - . gene_id "XLOC_000550"; transcript_id "TCONS_00000550"; exon_number "1"; oId "CUFF.134.1"; tss_id "TSS550"; +chr1 Cufflinks exon 26968774 26968881 . - . gene_id "XLOC_000551"; transcript_id "TCONS_00000551"; exon_number "1"; oId "CUFF.135.1"; tss_id "TSS551"; +chr1 Cufflinks exon 27641232 27641361 . - . gene_id "XLOC_000552"; transcript_id "TCONS_00000552"; exon_number "1"; oId "CUFF.137.1"; tss_id "TSS552"; +chr1 Cufflinks exon 28002114 28002220 . - . gene_id "XLOC_000553"; transcript_id "TCONS_00000553"; exon_number "1"; oId "CUFF.139.1"; tss_id "TSS553"; +chr1 Cufflinks exon 28242610 28242680 . - . gene_id "XLOC_000554"; transcript_id "TCONS_00000554"; exon_number "1"; oId "CUFF.142.1"; tss_id "TSS554"; +chr1 Cufflinks exon 28358379 28358691 . - . gene_id "XLOC_000555"; transcript_id "TCONS_00000555"; exon_number "1"; oId "CUFF.143.1"; tss_id "TSS555"; +chr1 Cufflinks exon 28469252 28469352 . - . gene_id "XLOC_000556"; transcript_id "TCONS_00000556"; exon_number "1"; oId "CUFF.145.1"; tss_id "TSS556"; +chr1 Cufflinks exon 28470667 28470728 . - . gene_id "XLOC_000557"; transcript_id "TCONS_00000557"; exon_number "1"; oId "CUFF.146.1"; tss_id "TSS557"; +chr1 Cufflinks exon 30383829 30383862 . - . gene_id "XLOC_000558"; transcript_id "TCONS_00000558"; exon_number "1"; oId "CUFF.152.1"; tss_id "TSS558"; +chr1 Cufflinks exon 30802099 30802177 . - . gene_id "XLOC_000559"; transcript_id "TCONS_00000559"; exon_number "1"; oId "CUFF.153.1"; tss_id "TSS559"; +chr1 Cufflinks exon 31851407 31851445 . - . gene_id "XLOC_000560"; transcript_id "TCONS_00000560"; exon_number "1"; oId "CUFF.156.1"; tss_id "TSS560"; +chr1 Cufflinks exon 31970419 31970525 . - . gene_id "XLOC_000561"; transcript_id "TCONS_00000561"; exon_number "1"; oId "CUFF.157.1"; tss_id "TSS561"; +chr1 Cufflinks exon 32544666 32544778 . - . gene_id "XLOC_000562"; transcript_id "TCONS_00000562"; exon_number "1"; oId "CUFF.160.1"; tss_id "TSS562"; +chr1 Cufflinks exon 32545085 32545298 . - . gene_id "XLOC_000563"; transcript_id "TCONS_00000563"; exon_number "1"; oId "CUFF.161.1"; tss_id "TSS563"; +chr1 Cufflinks exon 32597441 32597507 . - . gene_id "XLOC_000564"; transcript_id "TCONS_00000564"; exon_number "1"; oId "CUFF.162.1"; tss_id "TSS564"; +chr1 Cufflinks exon 32726118 32726199 . - . gene_id "XLOC_000565"; transcript_id "TCONS_00000565"; exon_number "1"; oId "CUFF.163.1"; tss_id "TSS565"; +chr1 Cufflinks exon 33104923 33105026 . - . gene_id "XLOC_000566"; transcript_id "TCONS_00000566"; exon_number "1"; oId "CUFF.166.1"; tss_id "TSS566"; +chr1 Cufflinks exon 33494815 33495010 . - . gene_id "XLOC_000567"; transcript_id "TCONS_00000567"; exon_number "1"; oId "CUFF.167.1"; tss_id "TSS567"; +chr1 Cufflinks exon 33495314 33495443 . - . gene_id "XLOC_000568"; transcript_id "TCONS_00000568"; exon_number "1"; oId "CUFF.168.1"; tss_id "TSS568"; +chr1 Cufflinks exon 33802226 33802465 . - . gene_id "XLOC_000569"; transcript_id "TCONS_00000569"; exon_number "1"; oId "CUFF.169.1"; tss_id "TSS569"; +chr1 Cufflinks exon 35409146 35409194 . - . gene_id "XLOC_000570"; transcript_id "TCONS_00000570"; exon_number "1"; oId "CUFF.171.1"; tss_id "TSS570"; +chr1 Cufflinks exon 35554804 35554863 . - . gene_id "XLOC_000571"; transcript_id "TCONS_00000571"; exon_number "1"; oId "CUFF.172.1"; tss_id "TSS571"; +chr1 Cufflinks exon 35757781 35758089 . - . gene_id "XLOC_000572"; transcript_id "TCONS_00000572"; exon_number "1"; oId "CUFF.173.1"; tss_id "TSS572"; +chr1 Cufflinks exon 36264895 36264931 . - . gene_id "XLOC_000573"; transcript_id "TCONS_00000573"; exon_number "1"; oId "CUFF.175.1"; tss_id "TSS573"; +chr1 Cufflinks exon 36325797 36325836 . - . gene_id "XLOC_000574"; transcript_id "TCONS_00000574"; exon_number "1"; oId "CUFF.176.1"; tss_id "TSS574"; +chr1 Cufflinks exon 36868319 36868449 . - . gene_id "XLOC_000575"; transcript_id "TCONS_00000575"; exon_number "1"; oId "CUFF.177.1"; tss_id "TSS575"; +chr1 Cufflinks exon 37168240 37168281 . - . gene_id "XLOC_000576"; transcript_id "TCONS_00000576"; exon_number "1"; oId "CUFF.178.1"; tss_id "TSS576"; +chr1 Cufflinks exon 37315506 37315568 . - . gene_id "XLOC_000577"; transcript_id "TCONS_00000577"; exon_number "1"; oId "CUFF.179.1"; tss_id "TSS577"; +chr1 Cufflinks exon 37730290 37730387 . - . gene_id "XLOC_000578"; transcript_id "TCONS_00000578"; exon_number "1"; oId "CUFF.181.1"; tss_id "TSS578"; +chr1 Cufflinks exon 37983032 37983069 . - . gene_id "XLOC_000579"; transcript_id "TCONS_00000579"; exon_number "1"; oId "CUFF.182.1"; tss_id "TSS579"; +chr1 Cufflinks exon 38744803 38744835 . - . gene_id "XLOC_000580"; transcript_id "TCONS_00000580"; exon_number "1"; oId "CUFF.186.1"; tss_id "TSS580"; +chr1 Cufflinks exon 39354489 39354536 . - . gene_id "XLOC_000581"; transcript_id "TCONS_00000581"; exon_number "1"; oId "CUFF.188.1"; tss_id "TSS581"; +chr1 Cufflinks exon 39586612 39586715 . - . gene_id "XLOC_000582"; transcript_id "TCONS_00000582"; exon_number "1"; oId "CUFF.191.1"; tss_id "TSS582"; +chr1 Cufflinks exon 39619879 39619968 . - . gene_id "XLOC_000583"; transcript_id "TCONS_00000583"; exon_number "1"; oId "CUFF.192.1"; tss_id "TSS583"; +chr1 Cufflinks exon 39891119 39891167 . - . gene_id "XLOC_000584"; transcript_id "TCONS_00000584"; exon_number "1"; oId "CUFF.194.1"; tss_id "TSS584"; +chr1 Cufflinks exon 40189239 40189297 . - . gene_id "XLOC_000585"; transcript_id "TCONS_00000585"; exon_number "1"; oId "CUFF.196.1"; tss_id "TSS585"; +chr1 Cufflinks exon 40995290 40995322 . - . gene_id "XLOC_000586"; transcript_id "TCONS_00000586"; exon_number "1"; oId "CUFF.200.1"; tss_id "TSS586"; +chr1 Cufflinks exon 41072472 41072639 . - . gene_id "XLOC_000587"; transcript_id "TCONS_00000587"; exon_number "1"; oId "CUFF.201.1"; tss_id "TSS587"; +chr1 Cufflinks exon 41932608 41932698 . - . gene_id "XLOC_000588"; transcript_id "TCONS_00000588"; exon_number "1"; oId "CUFF.203.1"; tss_id "TSS588"; +chr1 Cufflinks exon 42255127 42255161 . - . gene_id "XLOC_000589"; transcript_id "TCONS_00000589"; exon_number "1"; oId "CUFF.204.1"; tss_id "TSS589"; +chr1 Cufflinks exon 42640454 42640488 . - . gene_id "XLOC_000590"; transcript_id "TCONS_00000590"; exon_number "1"; oId "CUFF.206.1"; tss_id "TSS590"; +chr1 Cufflinks exon 43215464 43215643 . - . gene_id "XLOC_000591"; transcript_id "TCONS_00000591"; exon_number "1"; oId "CUFF.211.1"; tss_id "TSS591"; +chr1 Cufflinks exon 43489220 43489308 . - . gene_id "XLOC_000592"; transcript_id "TCONS_00000592"; exon_number "1"; oId "CUFF.213.1"; tss_id "TSS592"; +chr1 Cufflinks exon 43577998 43578077 . - . gene_id "XLOC_000593"; transcript_id "TCONS_00000593"; exon_number "1"; oId "CUFF.214.1"; tss_id "TSS593"; +chr1 Cufflinks exon 44480551 44480593 . - . gene_id "XLOC_000594"; transcript_id "TCONS_00000594"; exon_number "1"; oId "CUFF.218.1"; tss_id "TSS594"; +chr1 Cufflinks exon 44582751 44583061 . - . gene_id "XLOC_000595"; transcript_id "TCONS_00000595"; exon_number "1"; oId "CUFF.219.1"; tss_id "TSS595"; +chr1 Cufflinks exon 45136059 45136137 . - . gene_id "XLOC_000596"; transcript_id "TCONS_00000596"; exon_number "1"; oId "CUFF.221.1"; tss_id "TSS596"; +chr1 Cufflinks exon 45187458 45187571 . - . gene_id "XLOC_000597"; transcript_id "TCONS_00000597"; exon_number "1"; oId "CUFF.222.1"; tss_id "TSS597"; +chr1 Cufflinks exon 45196727 45196842 . - . gene_id "XLOC_000598"; transcript_id "TCONS_00000598"; exon_number "1"; oId "CUFF.223.1"; tss_id "TSS598"; +chr1 Cufflinks exon 45285575 45285669 . - . gene_id "XLOC_000599"; transcript_id "TCONS_00000599"; exon_number "1"; oId "CUFF.225.1"; tss_id "TSS599"; +chr1 Cufflinks exon 45824321 45824419 . - . gene_id "XLOC_000600"; transcript_id "TCONS_00000600"; exon_number "1"; oId "CUFF.227.1"; tss_id "TSS600"; +chr1 Cufflinks exon 45955547 45955598 . - . gene_id "XLOC_000601"; transcript_id "TCONS_00000601"; exon_number "1"; oId "CUFF.230.1"; tss_id "TSS601"; +chr1 Cufflinks exon 46753609 46753647 . - . gene_id "XLOC_000602"; transcript_id "TCONS_00000602"; exon_number "1"; oId "CUFF.232.1"; tss_id "TSS602"; +chr1 Cufflinks exon 46902469 46902566 . - . gene_id "XLOC_000603"; transcript_id "TCONS_00000603"; exon_number "1"; oId "CUFF.233.1"; tss_id "TSS603"; +chr1 Cufflinks exon 51524306 51524347 . - . gene_id "XLOC_000604"; transcript_id "TCONS_00000604"; exon_number "1"; oId "CUFF.241.1"; tss_id "TSS604"; +chr1 Cufflinks exon 51696922 51697029 . - . gene_id "XLOC_000605"; transcript_id "TCONS_00000605"; exon_number "1"; oId "CUFF.242.1"; tss_id "TSS605"; +chr1 Cufflinks exon 52004301 52004401 . - . gene_id "XLOC_000606"; transcript_id "TCONS_00000606"; exon_number "1"; oId "CUFF.244.1"; tss_id "TSS606"; +chr1 Cufflinks exon 52038470 52038553 . - . gene_id "XLOC_000607"; transcript_id "TCONS_00000607"; exon_number "1"; oId "CUFF.245.1"; tss_id "TSS607"; +chr1 Cufflinks exon 52078445 52078482 . - . gene_id "XLOC_000608"; transcript_id "TCONS_00000608"; exon_number "1"; oId "CUFF.246.1"; tss_id "TSS608"; +chr1 Cufflinks exon 52404822 52404915 . - . gene_id "XLOC_000609"; transcript_id "TCONS_00000609"; exon_number "1"; oId "CUFF.247.1"; tss_id "TSS609"; +chr1 Cufflinks exon 53270787 53270884 . - . gene_id "XLOC_000610"; transcript_id "TCONS_00000610"; exon_number "1"; oId "CUFF.257.1"; tss_id "TSS610"; +chr1 Cufflinks exon 53386690 53386725 . - . gene_id "XLOC_000611"; transcript_id "TCONS_00000611"; exon_number "1"; oId "CUFF.258.1"; tss_id "TSS611"; +chr1 Cufflinks exon 53391740 53391775 . - . gene_id "XLOC_000612"; transcript_id "TCONS_00000612"; exon_number "1"; oId "CUFF.259.1"; tss_id "TSS612"; +chr1 Cufflinks exon 54154428 54154484 . - . gene_id "XLOC_000613"; transcript_id "TCONS_00000613"; exon_number "1"; oId "CUFF.261.1"; tss_id "TSS613"; +chr1 Cufflinks exon 55423539 55423614 . - . gene_id "XLOC_000614"; transcript_id "TCONS_00000614"; exon_number "1"; oId "CUFF.265.1"; tss_id "TSS614"; +chr1 Cufflinks exon 55842295 55842524 . - . gene_id "XLOC_000615"; transcript_id "TCONS_00000615"; exon_number "1"; oId "CUFF.267.1"; tss_id "TSS615"; +chr1 Cufflinks exon 56627719 56627753 . - . gene_id "XLOC_000616"; transcript_id "TCONS_00000616"; exon_number "1"; oId "CUFF.269.1"; tss_id "TSS616"; +chr1 Cufflinks exon 59031320 59031601 . - . gene_id "XLOC_000617"; transcript_id "TCONS_00000617"; exon_number "1"; oId "CUFF.272.1"; tss_id "TSS617"; +chr1 Cufflinks exon 60440410 60440726 . - . gene_id "XLOC_000618"; transcript_id "TCONS_00000618"; exon_number "1"; oId "CUFF.274.1"; tss_id "TSS618"; +chr1 Cufflinks exon 62763823 62763928 . - . gene_id "XLOC_000619"; transcript_id "TCONS_00000619"; exon_number "1"; oId "CUFF.279.1"; tss_id "TSS619"; +chr1 Cufflinks exon 63329118 63329152 . - . gene_id "XLOC_000620"; transcript_id "TCONS_00000620"; exon_number "1"; oId "CUFF.280.1"; tss_id "TSS620"; +chr1 Cufflinks exon 63652005 63652098 . - . gene_id "XLOC_000621"; transcript_id "TCONS_00000621"; exon_number "1"; oId "CUFF.281.1"; tss_id "TSS621"; +chr1 Cufflinks exon 64002385 64002441 . - . gene_id "XLOC_000622"; transcript_id "TCONS_00000622"; exon_number "1"; oId "CUFF.284.1"; tss_id "TSS622"; +chr1 Cufflinks exon 64064486 64064554 . - . gene_id "XLOC_000623"; transcript_id "TCONS_00000623"; exon_number "1"; oId "CUFF.285.1"; tss_id "TSS623"; +chr1 Cufflinks exon 64494566 64494670 . - . gene_id "XLOC_000624"; transcript_id "TCONS_00000624"; exon_number "1"; oId "CUFF.289.1"; tss_id "TSS624"; +chr1 Cufflinks exon 64850082 64850141 . - . gene_id "XLOC_000625"; transcript_id "TCONS_00000625"; exon_number "1"; oId "CUFF.290.1"; tss_id "TSS625"; +chr1 Cufflinks exon 64982856 64982892 . - . gene_id "XLOC_000626"; transcript_id "TCONS_00000626"; exon_number "1"; oId "CUFF.291.1"; tss_id "TSS626"; +chr1 Cufflinks exon 65154803 65154841 . - . gene_id "XLOC_000627"; transcript_id "TCONS_00000627"; exon_number "1"; oId "CUFF.292.1"; tss_id "TSS627"; +chr1 Cufflinks exon 65217260 65217329 . - . gene_id "XLOC_000628"; transcript_id "TCONS_00000628"; exon_number "1"; oId "CUFF.293.1"; tss_id "TSS628"; +chr1 Cufflinks exon 65488674 65488735 . - . gene_id "XLOC_000629"; transcript_id "TCONS_00000629"; exon_number "1"; oId "CUFF.294.1"; tss_id "TSS629"; +chr1 Cufflinks exon 65818105 65818141 . - . gene_id "XLOC_000630"; transcript_id "TCONS_00000630"; exon_number "1"; oId "CUFF.296.1"; tss_id "TSS630"; +chr1 Cufflinks exon 66216584 66216636 . - . gene_id "XLOC_000631"; transcript_id "TCONS_00000631"; exon_number "1"; oId "CUFF.299.1"; tss_id "TSS631"; +chr1 Cufflinks exon 66226724 66227032 . - . gene_id "XLOC_000632"; transcript_id "TCONS_00000632"; exon_number "1"; oId "CUFF.300.1"; tss_id "TSS632"; +chr1 Cufflinks exon 66560158 66560229 . - . gene_id "XLOC_000633"; transcript_id "TCONS_00000633"; exon_number "1"; oId "CUFF.301.1"; tss_id "TSS633"; +chr1 Cufflinks exon 66845086 66845149 . - . gene_id "XLOC_000634"; transcript_id "TCONS_00000634"; exon_number "1"; oId "CUFF.302.1"; tss_id "TSS634"; +chr1 Cufflinks exon 67016503 67016545 . - . gene_id "XLOC_000635"; transcript_id "TCONS_00000635"; exon_number "1"; oId "CUFF.303.1"; tss_id "TSS635"; +chr1 Cufflinks exon 67442503 67442536 . - . gene_id "XLOC_000636"; transcript_id "TCONS_00000636"; exon_number "1"; oId "CUFF.304.1"; tss_id "TSS636"; +chr1 Cufflinks exon 68122500 68122811 . - . gene_id "XLOC_000637"; transcript_id "TCONS_00000637"; exon_number "1"; oId "CUFF.309.1"; tss_id "TSS637"; +chr1 Cufflinks exon 68238277 68238335 . - . gene_id "XLOC_000638"; transcript_id "TCONS_00000638"; exon_number "1"; oId "CUFF.310.1"; tss_id "TSS638"; +chr1 Cufflinks exon 68458491 68458634 . - . gene_id "XLOC_000639"; transcript_id "TCONS_00000639"; exon_number "1"; oId "CUFF.311.1"; tss_id "TSS639"; +chr1 Cufflinks exon 68461908 68462474 . - . gene_id "XLOC_000640"; transcript_id "TCONS_00000640"; exon_number "1"; oId "CUFF.312.1"; tss_id "TSS640"; +chr1 Cufflinks exon 69262050 69262103 . - . gene_id "XLOC_000641"; transcript_id "TCONS_00000641"; exon_number "1"; oId "CUFF.314.1"; tss_id "TSS641"; +chr1 Cufflinks exon 70645800 70646122 . - . gene_id "XLOC_000642"; transcript_id "TCONS_00000642"; exon_number "1"; oId "CUFF.318.1"; tss_id "TSS642"; +chr1 Cufflinks exon 70813405 70813526 . - . gene_id "XLOC_000643"; transcript_id "TCONS_00000643"; exon_number "1"; oId "CUFF.319.1"; tss_id "TSS643"; +chr1 Cufflinks exon 72642634 72642675 . - . gene_id "XLOC_000644"; transcript_id "TCONS_00000644"; exon_number "1"; oId "CUFF.321.1"; tss_id "TSS644"; +chr1 Cufflinks exon 73183346 73183451 . - . gene_id "XLOC_000645"; transcript_id "TCONS_00000645"; exon_number "1"; oId "CUFF.322.1"; tss_id "TSS645"; +chr1 Cufflinks exon 73657374 73657530 . - . gene_id "XLOC_000646"; transcript_id "TCONS_00000646"; exon_number "1"; oId "CUFF.324.1"; tss_id "TSS646"; +chr1 Cufflinks exon 74215219 74215309 . - . gene_id "XLOC_000647"; transcript_id "TCONS_00000647"; exon_number "1"; oId "CUFF.325.1"; tss_id "TSS647"; +chr1 Cufflinks exon 74272630 74272664 . - . gene_id "XLOC_000648"; transcript_id "TCONS_00000648"; exon_number "1"; oId "CUFF.326.1"; tss_id "TSS648"; +chr1 Cufflinks exon 75188120 75188216 . - . gene_id "XLOC_000649"; transcript_id "TCONS_00000649"; exon_number "1"; oId "CUFF.327.1"; tss_id "TSS649"; +chr1 Cufflinks exon 75917609 75917642 . - . gene_id "XLOC_000650"; transcript_id "TCONS_00000650"; exon_number "1"; oId "CUFF.329.1"; tss_id "TSS650"; +chr1 Cufflinks exon 76003700 76003782 . - . gene_id "XLOC_000651"; transcript_id "TCONS_00000651"; exon_number "1"; oId "CUFF.330.1"; tss_id "TSS651"; +chr1 Cufflinks exon 76240337 76240470 . - . gene_id "XLOC_000652"; transcript_id "TCONS_00000652"; exon_number "1"; oId "CUFF.331.1"; tss_id "TSS652"; +chr1 Cufflinks exon 76645360 76645394 . - . gene_id "XLOC_000653"; transcript_id "TCONS_00000653"; exon_number "1"; oId "CUFF.332.1"; tss_id "TSS653"; +chr1 Cufflinks exon 77289482 77289575 . - . gene_id "XLOC_000654"; transcript_id "TCONS_00000654"; exon_number "1"; oId "CUFF.335.1"; tss_id "TSS654"; +chr1 Cufflinks exon 77424365 77424423 . - . gene_id "XLOC_000655"; transcript_id "TCONS_00000655"; exon_number "1"; oId "CUFF.336.1"; tss_id "TSS655"; +chr1 Cufflinks exon 78554678 78554767 . - . gene_id "XLOC_000656"; transcript_id "TCONS_00000656"; exon_number "1"; oId "CUFF.341.1"; tss_id "TSS656"; +chr1 Cufflinks exon 78560490 78560589 . - . gene_id "XLOC_000657"; transcript_id "TCONS_00000657"; exon_number "1"; oId "CUFF.342.1"; tss_id "TSS657"; +chr1 Cufflinks exon 78688253 78688284 . - . gene_id "XLOC_000658"; transcript_id "TCONS_00000658"; exon_number "1"; oId "CUFF.343.1"; tss_id "TSS658"; +chr1 Cufflinks exon 78840874 78840952 . - . gene_id "XLOC_000659"; transcript_id "TCONS_00000659"; exon_number "1"; oId "CUFF.344.1"; tss_id "TSS659"; +chr1 Cufflinks exon 79161173 79161210 . - . gene_id "XLOC_000660"; transcript_id "TCONS_00000660"; exon_number "1"; oId "CUFF.345.1"; tss_id "TSS660"; +chr1 Cufflinks exon 81274199 81274433 . - . gene_id "XLOC_000661"; transcript_id "TCONS_00000661"; exon_number "1"; oId "CUFF.348.1"; tss_id "TSS661"; +chr1 Cufflinks exon 84855442 84855545 . - . gene_id "XLOC_000662"; transcript_id "TCONS_00000662"; exon_number "1"; oId "CUFF.352.1"; tss_id "TSS662"; +chr1 Cufflinks exon 86349361 86349480 . - . gene_id "XLOC_000663"; transcript_id "TCONS_00000663"; exon_number "1"; oId "CUFF.355.1"; tss_id "TSS663"; +chr1 Cufflinks exon 86375303 86375346 . - . gene_id "XLOC_000664"; transcript_id "TCONS_00000664"; exon_number "1"; oId "CUFF.356.1"; tss_id "TSS664"; +chr1 Cufflinks exon 86865158 86865195 . - . gene_id "XLOC_000665"; transcript_id "TCONS_00000665"; exon_number "1"; oId "CUFF.357.1"; tss_id "TSS665"; +chr1 Cufflinks exon 87918967 87919056 . - . gene_id "XLOC_000666"; transcript_id "TCONS_00000666"; exon_number "1"; oId "CUFF.359.1"; tss_id "TSS666"; +chr1 Cufflinks exon 88800563 88800662 . - . gene_id "XLOC_000667"; transcript_id "TCONS_00000667"; exon_number "1"; oId "CUFF.360.1"; tss_id "TSS667"; +chr1 Cufflinks exon 88943491 88943788 . - . gene_id "XLOC_000668"; transcript_id "TCONS_00000668"; exon_number "1"; oId "CUFF.361.1"; tss_id "TSS668"; +chr1 Cufflinks exon 89025826 89025866 . - . gene_id "XLOC_000669"; transcript_id "TCONS_00000669"; exon_number "1"; oId "CUFF.362.1"; tss_id "TSS669"; +chr1 Cufflinks exon 90072309 90072359 . - . gene_id "XLOC_000670"; transcript_id "TCONS_00000670"; exon_number "1"; oId "CUFF.365.1"; tss_id "TSS670"; +chr1 Cufflinks exon 90233768 90233877 . - . gene_id "XLOC_000671"; transcript_id "TCONS_00000671"; exon_number "1"; oId "CUFF.366.1"; tss_id "TSS671"; +chr1 Cufflinks exon 90453326 90453499 . - . gene_id "XLOC_000672"; transcript_id "TCONS_00000672"; exon_number "1"; oId "CUFF.367.1"; tss_id "TSS672"; +chr1 Cufflinks exon 90656881 90656916 . - . gene_id "XLOC_000673"; transcript_id "TCONS_00000673"; exon_number "1"; oId "CUFF.368.1"; tss_id "TSS673"; +chr1 Cufflinks exon 90719018 90719117 . - . gene_id "XLOC_000674"; transcript_id "TCONS_00000674"; exon_number "1"; oId "CUFF.369.1"; tss_id "TSS674"; +chr1 Cufflinks exon 91852786 91853147 . - . gene_id "XLOC_000675"; transcript_id "TCONS_00000675"; exon_number "1"; oId "CUFF.372.1"; tss_id "TSS675"; +chr1 Cufflinks exon 91861061 91861135 . - . gene_id "XLOC_000676"; transcript_id "TCONS_00000676"; exon_number "1"; oId "CUFF.373.1"; tss_id "TSS676"; +chr1 Cufflinks exon 92226012 92226050 . - . gene_id "XLOC_000677"; transcript_id "TCONS_00000677"; exon_number "1"; oId "CUFF.375.1"; tss_id "TSS677"; +chr1 Cufflinks exon 92295331 92295589 . - . gene_id "XLOC_000678"; transcript_id "TCONS_00000678"; exon_number "1"; oId "CUFF.376.1"; tss_id "TSS678"; +chr1 Cufflinks exon 92410895 92410993 . - . gene_id "XLOC_000679"; transcript_id "TCONS_00000679"; exon_number "1"; oId "CUFF.377.1"; tss_id "TSS679"; +chr1 Cufflinks exon 92411300 92411360 . - . gene_id "XLOC_000680"; transcript_id "TCONS_00000680"; exon_number "1"; oId "CUFF.378.1"; tss_id "TSS680"; +chr1 Cufflinks exon 92655380 92655447 . - . gene_id "XLOC_000681"; transcript_id "TCONS_00000681"; exon_number "1"; oId "CUFF.380.1"; tss_id "TSS681"; +chr1 Cufflinks exon 92867925 92868242 . - . gene_id "XLOC_000682"; transcript_id "TCONS_00000682"; exon_number "1"; oId "CUFF.381.1"; tss_id "TSS682"; +chr1 Cufflinks exon 92972728 92972802 . - . gene_id "XLOC_000683"; transcript_id "TCONS_00000683"; exon_number "1"; oId "CUFF.383.1"; tss_id "TSS683"; +chr1 Cufflinks exon 93166425 93166491 . - . gene_id "XLOC_000684"; transcript_id "TCONS_00000684"; exon_number "1"; oId "CUFF.384.1"; tss_id "TSS684"; +chr1 Cufflinks exon 93262987 93263111 . - . gene_id "XLOC_000685"; transcript_id "TCONS_00000685"; exon_number "1"; oId "CUFF.385.1"; tss_id "TSS685"; +chr1 Cufflinks exon 93435161 93435266 . - . gene_id "XLOC_000686"; transcript_id "TCONS_00000686"; exon_number "1"; oId "CUFF.386.1"; tss_id "TSS686"; +chr1 Cufflinks exon 93440361 93440680 . - . gene_id "XLOC_000687"; transcript_id "TCONS_00000687"; exon_number "1"; oId "CUFF.387.1"; tss_id "TSS687"; +chr1 Cufflinks exon 93953888 93954009 . - . gene_id "XLOC_000688"; transcript_id "TCONS_00000688"; exon_number "1"; oId "CUFF.392.1"; tss_id "TSS688"; +chr1 Cufflinks exon 93981832 93981906 . - . gene_id "XLOC_000689"; transcript_id "TCONS_00000689"; exon_number "1"; oId "CUFF.393.1"; tss_id "TSS689"; +chr1 Cufflinks exon 95411469 95411610 . - . gene_id "XLOC_000690"; transcript_id "TCONS_00000690"; exon_number "1"; oId "CUFF.399.1"; tss_id "TSS690"; +chr1 Cufflinks exon 95450521 95450566 . - . gene_id "XLOC_000691"; transcript_id "TCONS_00000691"; exon_number "1"; oId "CUFF.400.1"; tss_id "TSS691"; +chr1 Cufflinks exon 97161515 97161732 . - . gene_id "XLOC_000692"; transcript_id "TCONS_00000692"; exon_number "1"; oId "CUFF.405.1"; tss_id "TSS692"; +chr1 Cufflinks exon 99207465 99207540 . - . gene_id "XLOC_000693"; transcript_id "TCONS_00000693"; exon_number "1"; oId "CUFF.407.1"; tss_id "TSS693"; +chr1 Cufflinks exon 100250284 100250441 . - . gene_id "XLOC_000694"; transcript_id "TCONS_00000694"; exon_number "1"; oId "CUFF.409.1"; tss_id "TSS694"; +chr1 Cufflinks exon 100339368 100339403 . - . gene_id "XLOC_000695"; transcript_id "TCONS_00000695"; exon_number "1"; oId "CUFF.411.1"; tss_id "TSS695"; +chr1 Cufflinks exon 100466194 100466299 . - . gene_id "XLOC_000696"; transcript_id "TCONS_00000696"; exon_number "1"; oId "CUFF.413.1"; tss_id "TSS696"; +chr1 Cufflinks exon 100531452 100531527 . - . gene_id "XLOC_000697"; transcript_id "TCONS_00000697"; exon_number "1"; oId "CUFF.414.1"; tss_id "TSS697"; +chr1 Cufflinks exon 101603628 101603675 . - . gene_id "XLOC_000698"; transcript_id "TCONS_00000698"; exon_number "1"; oId "CUFF.415.1"; tss_id "TSS698"; +chr1 Cufflinks exon 101694217 101694321 . - . gene_id "XLOC_000699"; transcript_id "TCONS_00000699"; exon_number "1"; oId "CUFF.416.1"; tss_id "TSS699"; +chr1 Cufflinks exon 102194215 102194293 . - . gene_id "XLOC_000700"; transcript_id "TCONS_00000700"; exon_number "1"; oId "CUFF.417.1"; tss_id "TSS700"; +chr1 Cufflinks exon 102572193 102572245 . - . gene_id "XLOC_000701"; transcript_id "TCONS_00000701"; exon_number "1"; oId "CUFF.421.1"; tss_id "TSS701"; +chr1 Cufflinks exon 103646451 103646502 . - . gene_id "XLOC_000702"; transcript_id "TCONS_00000702"; exon_number "1"; oId "CUFF.422.1"; tss_id "TSS702"; +chr1 Cufflinks exon 104008168 104008210 . - . gene_id "XLOC_000703"; transcript_id "TCONS_00000703"; exon_number "1"; oId "CUFF.423.1"; tss_id "TSS703"; +chr1 Cufflinks exon 108113072 108113729 . - . gene_id "XLOC_000704"; transcript_id "TCONS_00000704"; exon_number "1"; oId "CUFF.431.1"; tss_id "TSS704"; +chr1 Cufflinks exon 108432811 108432843 . - . gene_id "XLOC_000705"; transcript_id "TCONS_00000705"; exon_number "1"; oId "CUFF.432.1"; tss_id "TSS705"; +chr1 Cufflinks exon 109750420 109750465 . - . gene_id "XLOC_000706"; transcript_id "TCONS_00000706"; exon_number "1"; oId "CUFF.433.1"; tss_id "TSS706"; +chr1 Cufflinks exon 110134156 110134262 . - . gene_id "XLOC_000707"; transcript_id "TCONS_00000707"; exon_number "1"; oId "CUFF.436.1"; tss_id "TSS707"; +chr1 Cufflinks exon 110347946 110347982 . - . gene_id "XLOC_000708"; transcript_id "TCONS_00000708"; exon_number "1"; oId "CUFF.437.1"; tss_id "TSS708"; +chr1 Cufflinks exon 110844895 110844929 . - . gene_id "XLOC_000709"; transcript_id "TCONS_00000709"; exon_number "1"; oId "CUFF.438.1"; tss_id "TSS709"; +chr1 Cufflinks exon 110856158 110856192 . - . gene_id "XLOC_000710"; transcript_id "TCONS_00000710"; exon_number "1"; oId "CUFF.439.1"; tss_id "TSS710"; +chr1 Cufflinks exon 112032939 112033042 . - . gene_id "XLOC_000711"; transcript_id "TCONS_00000711"; exon_number "1"; oId "CUFF.442.1"; tss_id "TSS711"; +chr1 Cufflinks exon 112193053 112193158 . - . gene_id "XLOC_000712"; transcript_id "TCONS_00000712"; exon_number "1"; oId "CUFF.443.1"; tss_id "TSS712"; +chr1 Cufflinks exon 113177350 113177402 . - . gene_id "XLOC_000713"; transcript_id "TCONS_00000713"; exon_number "1"; oId "CUFF.447.1"; tss_id "TSS713"; +chr1 Cufflinks exon 113490521 113490559 . - . gene_id "XLOC_000714"; transcript_id "TCONS_00000714"; exon_number "1"; oId "CUFF.450.1"; tss_id "TSS714"; +chr1 Cufflinks exon 113490864 113490906 . - . gene_id "XLOC_000715"; transcript_id "TCONS_00000715"; exon_number "1"; oId "CUFF.451.1"; tss_id "TSS715"; +chr1 Cufflinks exon 114319053 114319127 . - . gene_id "XLOC_000716"; transcript_id "TCONS_00000716"; exon_number "1"; oId "CUFF.452.1"; tss_id "TSS716"; +chr1 Cufflinks exon 115082685 115082711 . - . gene_id "XLOC_000717"; transcript_id "TCONS_00000717"; exon_number "1"; oId "CUFF.453.1"; tss_id "TSS717"; +chr1 Cufflinks exon 115240240 115240545 . - . gene_id "XLOC_000718"; transcript_id "TCONS_00000718"; exon_number "1"; oId "CUFF.454.1"; tss_id "TSS718"; +chr1 Cufflinks exon 116769666 116769889 . - . gene_id "XLOC_000719"; transcript_id "TCONS_00000719"; exon_number "1"; oId "CUFF.458.1"; tss_id "TSS719"; +chr1 Cufflinks exon 116956388 116956491 . - . gene_id "XLOC_000720"; transcript_id "TCONS_00000720"; exon_number "1"; oId "CUFF.461.1"; tss_id "TSS720"; +chr1 Cufflinks exon 117504997 117505074 . - . gene_id "XLOC_000721"; transcript_id "TCONS_00000721"; exon_number "1"; oId "CUFF.464.1"; tss_id "TSS721"; +chr1 Cufflinks exon 117785835 117786128 . - . gene_id "XLOC_000722"; transcript_id "TCONS_00000722"; exon_number "1"; oId "CUFF.465.1"; tss_id "TSS722"; +chr1 Cufflinks exon 118807025 118807112 . - . gene_id "XLOC_000723"; transcript_id "TCONS_00000723"; exon_number "1"; oId "CUFF.466.1"; tss_id "TSS723"; +chr1 Cufflinks exon 118984307 118984406 . - . gene_id "XLOC_000724"; transcript_id "TCONS_00000724"; exon_number "1"; oId "CUFF.467.1"; tss_id "TSS724"; +chr1 Cufflinks exon 119726387 119726416 . - . gene_id "XLOC_000725"; transcript_id "TCONS_00000725"; exon_number "1"; oId "CUFF.468.1"; tss_id "TSS725"; +chr1 Cufflinks exon 120264122 120264159 . - . gene_id "XLOC_000726"; transcript_id "TCONS_00000726"; exon_number "1"; oId "CUFF.472.1"; tss_id "TSS726"; +chr1 Cufflinks exon 120543884 120544125 . - . gene_id "XLOC_000727"; transcript_id "TCONS_00000727"; exon_number "1"; oId "CUFF.473.1"; tss_id "TSS727"; +chr1 Cufflinks exon 120656405 120656468 . - . gene_id "XLOC_000728"; transcript_id "TCONS_00000728"; exon_number "1"; oId "CUFF.474.1"; tss_id "TSS728"; +chr1 Cufflinks exon 121153239 121153279 . - . gene_id "XLOC_000729"; transcript_id "TCONS_00000729"; exon_number "1"; oId "CUFF.476.1"; tss_id "TSS729"; +chr1 Cufflinks exon 143647014 143647177 . - . gene_id "XLOC_000730"; transcript_id "TCONS_00000730"; exon_number "1"; oId "CUFF.477.1"; tss_id "TSS730"; +chr1 Cufflinks exon 143663556 143663631 . - . gene_id "XLOC_000731"; transcript_id "TCONS_00000731"; exon_number "1"; oId "CUFF.478.1"; tss_id "TSS731"; +chr1 Cufflinks exon 143669914 143669946 . - . gene_id "XLOC_000732"; transcript_id "TCONS_00000732"; exon_number "1"; oId "CUFF.479.1"; tss_id "TSS732"; +chr1 Cufflinks exon 143670472 143670600 . - . gene_id "XLOC_000733"; transcript_id "TCONS_00000733"; exon_number "1"; oId "CUFF.480.1"; tss_id "TSS733"; +chr1 Cufflinks exon 143673129 143673290 . - . gene_id "XLOC_000734"; transcript_id "TCONS_00000734"; exon_number "1"; oId "CUFF.481.1"; tss_id "TSS734"; +chr1 Cufflinks exon 143879830 143879905 . - . gene_id "XLOC_000735"; transcript_id "TCONS_00000735"; exon_number "1"; oId "CUFF.484.1"; tss_id "TSS735"; +chr1 Cufflinks exon 144308611 144308687 . - . gene_id "XLOC_000736"; transcript_id "TCONS_00000736"; exon_number "1"; oId "CUFF.486.1"; tss_id "TSS736"; +chr1 Cufflinks exon 144311212 144311376 . - . gene_id "XLOC_000737"; transcript_id "TCONS_00000737"; exon_number "1"; oId "CUFF.487.1"; tss_id "TSS737"; +chr1 Cufflinks exon 144488840 144488916 . - . gene_id "XLOC_000738"; transcript_id "TCONS_00000738"; exon_number "1"; oId "CUFF.489.1"; tss_id "TSS738"; +chr1 Cufflinks exon 144491441 144491605 . - . gene_id "XLOC_000739"; transcript_id "TCONS_00000739"; exon_number "1"; oId "CUFF.490.1"; tss_id "TSS739"; +chr1 Cufflinks exon 144839436 144839507 . - . gene_id "XLOC_000740"; transcript_id "TCONS_00000740"; exon_number "1"; oId "CUFF.492.1"; tss_id "TSS740"; +chr1 Cufflinks exon 145149740 145149839 . - . gene_id "XLOC_000741"; transcript_id "TCONS_00000741"; exon_number "1"; oId "CUFF.496.1"; tss_id "TSS741"; +chr1 Cufflinks exon 145379320 145379391 . - . gene_id "XLOC_000742"; transcript_id "TCONS_00000742"; exon_number "1"; oId "CUFF.498.1"; tss_id "TSS742"; +chr1 Cufflinks exon 145395521 145395594 . - . gene_id "XLOC_000743"; transcript_id "TCONS_00000743"; exon_number "1"; oId "CUFF.501.1"; tss_id "TSS743"; +chr1 Cufflinks exon 145396881 145396952 . - . gene_id "XLOC_000744"; transcript_id "TCONS_00000744"; exon_number "1"; oId "CUFF.502.1"; tss_id "TSS744"; +chr1 Cufflinks exon 145397864 145397935 . - . gene_id "XLOC_000745"; transcript_id "TCONS_00000745"; exon_number "1"; oId "CUFF.503.1"; tss_id "TSS745"; +chr1 Cufflinks exon 145399233 145399304 . - . gene_id "XLOC_000746"; transcript_id "TCONS_00000746"; exon_number "1"; oId "CUFF.504.1"; tss_id "TSS746"; +chr1 Cufflinks exon 145606863 145606916 . - . gene_id "XLOC_000747"; transcript_id "TCONS_00000747"; exon_number "1"; oId "CUFF.505.1"; tss_id "TSS747"; +chr1 Cufflinks exon 145940470 145940540 . - . gene_id "XLOC_000748"; transcript_id "TCONS_00000748"; exon_number "1"; oId "CUFF.506.1"; tss_id "TSS748"; +chr1 Cufflinks exon 145944947 145945101 . - . gene_id "XLOC_000749"; transcript_id "TCONS_00000749"; exon_number "1"; oId "CUFF.508.1"; tss_id "TSS749"; +chr1 Cufflinks exon 145969270 145969433 . - . gene_id "XLOC_000750"; transcript_id "TCONS_00000750"; exon_number "1"; oId "CUFF.511.1"; tss_id "TSS750"; +chr1 Cufflinks exon 145979033 145979107 . - . gene_id "XLOC_000751"; transcript_id "TCONS_00000751"; exon_number "1"; oId "CUFF.512.1"; tss_id "TSS751"; +chr1 Cufflinks exon 145990591 145990648 . - . gene_id "XLOC_000752"; transcript_id "TCONS_00000752"; exon_number "1"; oId "CUFF.513.1"; tss_id "TSS752"; +chr1 Cufflinks exon 146086906 146086980 . - . gene_id "XLOC_000753"; transcript_id "TCONS_00000753"; exon_number "1"; oId "CUFF.515.1"; tss_id "TSS753"; +chr1 Cufflinks exon 146091451 146091605 . - . gene_id "XLOC_000754"; transcript_id "TCONS_00000754"; exon_number "1"; oId "CUFF.517.1"; tss_id "TSS754"; +chr1 Cufflinks exon 146092658 146092727 . - . gene_id "XLOC_000755"; transcript_id "TCONS_00000755"; exon_number "1"; oId "CUFF.518.1"; tss_id "TSS755"; +chr1 Cufflinks exon 146368451 146368518 . - . gene_id "XLOC_000756"; transcript_id "TCONS_00000756"; exon_number "1"; oId "CUFF.520.1"; tss_id "TSS756"; +chr1 Cufflinks exon 146476760 146476831 . - . gene_id "XLOC_000757"; transcript_id "TCONS_00000757"; exon_number "1"; oId "CUFF.522.1"; tss_id "TSS757"; +chr1 Cufflinks exon 146556166 146556303 . - . gene_id "XLOC_000758"; transcript_id "TCONS_00000758"; exon_number "1"; oId "CUFF.526.1"; tss_id "TSS758"; +chr1 Cufflinks exon 146888520 146888550 . - . gene_id "XLOC_000759"; transcript_id "TCONS_00000759"; exon_number "1"; oId "CUFF.528.1"; tss_id "TSS759"; +chr1 Cufflinks exon 147482181 147482251 . - . gene_id "XLOC_000760"; transcript_id "TCONS_00000760"; exon_number "1"; oId "CUFF.530.1"; tss_id "TSS760"; +chr1 Cufflinks exon 147486658 147486812 . - . gene_id "XLOC_000761"; transcript_id "TCONS_00000761"; exon_number "1"; oId "CUFF.532.1"; tss_id "TSS761"; +chr1 Cufflinks exon 147511004 147511167 . - . gene_id "XLOC_000762"; transcript_id "TCONS_00000762"; exon_number "1"; oId "CUFF.535.1"; tss_id "TSS762"; +chr1 Cufflinks exon 147520766 147520840 . - . gene_id "XLOC_000763"; transcript_id "TCONS_00000763"; exon_number "1"; oId "CUFF.536.1"; tss_id "TSS763"; +chr1 Cufflinks exon 147532335 147532392 . - . gene_id "XLOC_000764"; transcript_id "TCONS_00000764"; exon_number "1"; oId "CUFF.537.1"; tss_id "TSS764"; +chr1 Cufflinks exon 147628744 147628818 . - . gene_id "XLOC_000765"; transcript_id "TCONS_00000765"; exon_number "1"; oId "CUFF.539.1"; tss_id "TSS765"; +chr1 Cufflinks exon 147633283 147633437 . - . gene_id "XLOC_000766"; transcript_id "TCONS_00000766"; exon_number "1"; oId "CUFF.541.1"; tss_id "TSS766"; +chr1 Cufflinks exon 147634490 147634559 . - . gene_id "XLOC_000767"; transcript_id "TCONS_00000767"; exon_number "1"; oId "CUFF.542.1"; tss_id "TSS767"; +chr1 Cufflinks exon 147716738 147716809 . - . gene_id "XLOC_000768"; transcript_id "TCONS_00000768"; exon_number "1"; oId "CUFF.544.1"; tss_id "TSS768"; +chr1 Cufflinks exon 147737382 147737453 . - . gene_id "XLOC_000769"; transcript_id "TCONS_00000769"; exon_number "1"; oId "CUFF.547.1"; tss_id "TSS769"; +chr1 Cufflinks exon 147747674 147747744 . - . gene_id "XLOC_000770"; transcript_id "TCONS_00000770"; exon_number "1"; oId "CUFF.548.1"; tss_id "TSS770"; +chr1 Cufflinks exon 147774845 147774916 . - . gene_id "XLOC_000771"; transcript_id "TCONS_00000771"; exon_number "1"; oId "CUFF.550.1"; tss_id "TSS771"; +chr1 Cufflinks exon 147781030 147781101 . - . gene_id "XLOC_000772"; transcript_id "TCONS_00000772"; exon_number "1"; oId "CUFF.551.1"; tss_id "TSS772"; +chr1 Cufflinks exon 147789483 147789554 . - . gene_id "XLOC_000773"; transcript_id "TCONS_00000773"; exon_number "1"; oId "CUFF.553.1"; tss_id "TSS773"; +chr1 Cufflinks exon 147806736 147806890 . - . gene_id "XLOC_000774"; transcript_id "TCONS_00000774"; exon_number "1"; oId "CUFF.556.1"; tss_id "TSS774"; +chr1 Cufflinks exon 147834502 147834665 . - . gene_id "XLOC_000775"; transcript_id "TCONS_00000775"; exon_number "1"; oId "CUFF.558.1"; tss_id "TSS775"; +chr1 Cufflinks exon 147851058 147851133 . - . gene_id "XLOC_000776"; transcript_id "TCONS_00000776"; exon_number "1"; oId "CUFF.559.1"; tss_id "TSS776"; +chr1 Cufflinks exon 147857431 147857463 . - . gene_id "XLOC_000777"; transcript_id "TCONS_00000777"; exon_number "1"; oId "CUFF.560.1"; tss_id "TSS777"; +chr1 Cufflinks exon 147857989 147858117 . - . gene_id "XLOC_000778"; transcript_id "TCONS_00000778"; exon_number "1"; oId "CUFF.561.1"; tss_id "TSS778"; +chr1 Cufflinks exon 147860642 147860803 . - . gene_id "XLOC_000779"; transcript_id "TCONS_00000779"; exon_number "1"; oId "CUFF.562.1"; tss_id "TSS779"; +chr1 Cufflinks exon 148598313 148598387 . - . gene_id "XLOC_000780"; transcript_id "TCONS_00000780"; exon_number "1"; oId "CUFF.569.1"; tss_id "TSS780"; +chr1 Cufflinks exon 148604907 148605072 . - . gene_id "XLOC_000781"; transcript_id "TCONS_00000781"; exon_number "1"; oId "CUFF.570.1"; tss_id "TSS781"; +chr1 Cufflinks exon 148760355 148760429 . - . gene_id "XLOC_000782"; transcript_id "TCONS_00000782"; exon_number "1"; oId "CUFF.571.1"; tss_id "TSS782"; +chr1 Cufflinks exon 148766937 148767102 . - . gene_id "XLOC_000783"; transcript_id "TCONS_00000783"; exon_number "1"; oId "CUFF.572.1"; tss_id "TSS783"; +chr1 Cufflinks exon 148913294 148913380 . - . gene_id "XLOC_000784"; transcript_id "TCONS_00000784"; exon_number "1"; oId "CUFF.573.1"; tss_id "TSS784"; +chr1 Cufflinks exon 149143696 149143770 . - . gene_id "XLOC_000785"; transcript_id "TCONS_00000785"; exon_number "1"; oId "CUFF.575.1"; tss_id "TSS785"; +chr1 Cufflinks exon 149146714 149146876 . - . gene_id "XLOC_000786"; transcript_id "TCONS_00000786"; exon_number "1"; oId "CUFF.577.1"; tss_id "TSS786"; +chr1 Cufflinks exon 149147925 149147995 . - . gene_id "XLOC_000787"; transcript_id "TCONS_00000787"; exon_number "1"; oId "CUFF.578.1"; tss_id "TSS787"; +chr1 Cufflinks exon 149155828 149155899 . - . gene_id "XLOC_000788"; transcript_id "TCONS_00000788"; exon_number "1"; oId "CUFF.579.1"; tss_id "TSS788"; +chr1 Cufflinks exon 149161628 149161696 . - . gene_id "XLOC_000789"; transcript_id "TCONS_00000789"; exon_number "1"; oId "CUFF.580.1"; tss_id "TSS789"; +chr1 Cufflinks exon 149194106 149194269 . - . gene_id "XLOC_000790"; transcript_id "TCONS_00000790"; exon_number "1"; oId "CUFF.585.1"; tss_id "TSS790"; +chr1 Cufflinks exon 149211948 149212021 . - . gene_id "XLOC_000791"; transcript_id "TCONS_00000791"; exon_number "1"; oId "CUFF.586.1"; tss_id "TSS791"; +chr1 Cufflinks exon 149215170 149215298 . - . gene_id "XLOC_000792"; transcript_id "TCONS_00000792"; exon_number "1"; oId "CUFF.587.1"; tss_id "TSS792"; +chr1 Cufflinks exon 149224058 149224221 . - . gene_id "XLOC_000793"; transcript_id "TCONS_00000793"; exon_number "1"; oId "CUFF.588.1"; tss_id "TSS793"; +chr1 Cufflinks exon 149230569 149230643 . - . gene_id "XLOC_000794"; transcript_id "TCONS_00000794"; exon_number "1"; oId "CUFF.589.1"; tss_id "TSS794"; +chr1 Cufflinks exon 149278785 149278857 . - . gene_id "XLOC_000795"; transcript_id "TCONS_00000795"; exon_number "1"; oId "CUFF.592.1"; tss_id "TSS795"; +chr1 Cufflinks exon 149284503 149284575 . - . gene_id "XLOC_000796"; transcript_id "TCONS_00000796"; exon_number "1"; oId "CUFF.594.1"; tss_id "TSS796"; +chr1 Cufflinks exon 149286181 149286320 . - . gene_id "XLOC_000797"; transcript_id "TCONS_00000797"; exon_number "1"; oId "CUFF.596.1"; tss_id "TSS797"; +chr1 Cufflinks exon 149287359 149287426 . - . gene_id "XLOC_000798"; transcript_id "TCONS_00000798"; exon_number "1"; oId "CUFF.597.1"; tss_id "TSS798"; +chr1 Cufflinks exon 149293352 149293419 . - . gene_id "XLOC_000799"; transcript_id "TCONS_00000799"; exon_number "1"; oId "CUFF.598.1"; tss_id "TSS799"; +chr1 Cufflinks exon 149294666 149294736 . - . gene_id "XLOC_000800"; transcript_id "TCONS_00000800"; exon_number "1"; oId "CUFF.599.1"; tss_id "TSS800"; +chr1 Cufflinks exon 149298555 149298627 . - . gene_id "XLOC_000801"; transcript_id "TCONS_00000801"; exon_number "1"; oId "CUFF.600.1"; tss_id "TSS801"; +chr1 Cufflinks exon 149326270 149326345 . - . gene_id "XLOC_000802"; transcript_id "TCONS_00000802"; exon_number "1"; oId "CUFF.601.1"; tss_id "TSS802"; +chr1 Cufflinks exon 149343078 149343148 . - . gene_id "XLOC_000803"; transcript_id "TCONS_00000803"; exon_number "1"; oId "CUFF.604.1"; tss_id "TSS803"; +chr1 Cufflinks exon 149348598 149348670 . - . gene_id "XLOC_000804"; transcript_id "TCONS_00000804"; exon_number "1"; oId "CUFF.605.1"; tss_id "TSS804"; +chr1 Cufflinks exon 149514089 149514256 . - . gene_id "XLOC_000805"; transcript_id "TCONS_00000805"; exon_number "1"; oId "CUFF.606.1"; tss_id "TSS805"; +chr1 Cufflinks exon 149615616 149615690 . - . gene_id "XLOC_000806"; transcript_id "TCONS_00000806"; exon_number "1"; oId "CUFF.609.1"; tss_id "TSS806"; +chr1 Cufflinks exon 149664355 149664427 . - . gene_id "XLOC_000807"; transcript_id "TCONS_00000807"; exon_number "1"; oId "CUFF.611.1"; tss_id "TSS807"; +chr1 Cufflinks exon 149670057 149670129 . - . gene_id "XLOC_000808"; transcript_id "TCONS_00000808"; exon_number "1"; oId "CUFF.613.1"; tss_id "TSS808"; +chr1 Cufflinks exon 149671727 149671866 . - . gene_id "XLOC_000809"; transcript_id "TCONS_00000809"; exon_number "1"; oId "CUFF.615.1"; tss_id "TSS809"; +chr1 Cufflinks exon 149672905 149672972 . - . gene_id "XLOC_000810"; transcript_id "TCONS_00000810"; exon_number "1"; oId "CUFF.616.1"; tss_id "TSS810"; +chr1 Cufflinks exon 149678894 149678961 . - . gene_id "XLOC_000811"; transcript_id "TCONS_00000811"; exon_number "1"; oId "CUFF.617.1"; tss_id "TSS811"; +chr1 Cufflinks exon 149680214 149680280 . - . gene_id "XLOC_000812"; transcript_id "TCONS_00000812"; exon_number "1"; oId "CUFF.618.1"; tss_id "TSS812"; +chr1 Cufflinks exon 149684088 149684161 . - . gene_id "XLOC_000813"; transcript_id "TCONS_00000813"; exon_number "1"; oId "CUFF.619.1"; tss_id "TSS813"; +chr1 Cufflinks exon 149711796 149711871 . - . gene_id "XLOC_000814"; transcript_id "TCONS_00000814"; exon_number "1"; oId "CUFF.620.1"; tss_id "TSS814"; +chr1 Cufflinks exon 149728268 149728338 . - . gene_id "XLOC_000815"; transcript_id "TCONS_00000815"; exon_number "1"; oId "CUFF.623.1"; tss_id "TSS815"; +chr1 Cufflinks exon 149733800 149733872 . - . gene_id "XLOC_000816"; transcript_id "TCONS_00000816"; exon_number "1"; oId "CUFF.624.1"; tss_id "TSS816"; +chr1 Cufflinks exon 150017381 150017452 . - . gene_id "XLOC_000817"; transcript_id "TCONS_00000817"; exon_number "1"; oId "CUFF.625.1"; tss_id "TSS817"; +chr1 Cufflinks exon 150239194 150239284 . - . gene_id "XLOC_000818"; transcript_id "TCONS_00000818"; exon_number "1"; oId "CUFF.629.1"; tss_id "TSS818"; +chr1 Cufflinks exon 150323004 150323032 . - . gene_id "XLOC_000819"; transcript_id "TCONS_00000819"; exon_number "1"; oId "CUFF.630.1"; tss_id "TSS819"; +chr1 Cufflinks exon 150539027 150539336 . - . gene_id "XLOC_000820"; transcript_id "TCONS_00000820"; exon_number "1"; oId "CUFF.631.1"; tss_id "TSS820"; +chr1 Cufflinks exon 150541437 150541745 . - . gene_id "XLOC_000821"; transcript_id "TCONS_00000821"; exon_number "1"; oId "CUFF.632.1"; tss_id "TSS821"; +chr1 Cufflinks exon 150580073 150580146 . - . gene_id "XLOC_000822"; transcript_id "TCONS_00000822"; exon_number "1"; oId "CUFF.633.1"; tss_id "TSS822"; +chr1 Cufflinks exon 150580412 150580422 . - . gene_id "XLOC_000823"; transcript_id "TCONS_00000823"; exon_number "1"; oId "CUFF.634.1"; tss_id "TSS823"; +chr1 Cufflinks exon 150581025 150581099 . - . gene_id "XLOC_000824"; transcript_id "TCONS_00000824"; exon_number "1"; oId "CUFF.635.1"; tss_id "TSS824"; +chr1 Cufflinks exon 150699305 150699359 . - . gene_id "XLOC_000825"; transcript_id "TCONS_00000825"; exon_number "1"; oId "CUFF.637.1"; tss_id "TSS825"; +chr1 Cufflinks exon 150785073 150785174 . - . gene_id "XLOC_000826"; transcript_id "TCONS_00000826"; exon_number "1"; oId "CUFF.638.1"; tss_id "TSS826"; +chr1 Cufflinks exon 150995227 150995328 . - . gene_id "XLOC_000827"; transcript_id "TCONS_00000827"; exon_number "1"; oId "CUFF.639.1"; tss_id "TSS827"; +chr1 Cufflinks exon 151273133 151273439 . - . gene_id "XLOC_000828"; transcript_id "TCONS_00000828"; exon_number "1"; oId "CUFF.640.1"; tss_id "TSS828"; +chr1 Cufflinks exon 151720073 151720176 . - . gene_id "XLOC_000829"; transcript_id "TCONS_00000829"; exon_number "1"; oId "CUFF.643.1"; tss_id "TSS829"; +chr1 Cufflinks exon 152028591 152028623 . - . gene_id "XLOC_000830"; transcript_id "TCONS_00000830"; exon_number "1"; oId "CUFF.645.1"; tss_id "TSS830"; +chr1 Cufflinks exon 153472921 153473240 . - . gene_id "XLOC_000831"; transcript_id "TCONS_00000831"; exon_number "1"; oId "CUFF.647.1"; tss_id "TSS831"; +chr1 Cufflinks exon 153726597 153726704 . - . gene_id "XLOC_000832"; transcript_id "TCONS_00000832"; exon_number "1"; oId "CUFF.650.1"; tss_id "TSS832"; +chr1 Cufflinks exon 153970562 153970625 . - . gene_id "XLOC_000833"; transcript_id "TCONS_00000833"; exon_number "1"; oId "CUFF.653.1"; tss_id "TSS833"; +chr1 Cufflinks exon 154012398 154012498 . - . gene_id "XLOC_000834"; transcript_id "TCONS_00000834"; exon_number "1"; oId "CUFF.654.1"; tss_id "TSS834"; +chr1 Cufflinks exon 154138715 154139025 . - . gene_id "XLOC_000835"; transcript_id "TCONS_00000835"; exon_number "1"; oId "CUFF.656.1"; tss_id "TSS835"; +chr1 Cufflinks exon 155328508 155328609 . - . gene_id "XLOC_000836"; transcript_id "TCONS_00000836"; exon_number "1"; oId "CUFF.661.1"; tss_id "TSS836"; +chr1 Cufflinks exon 155385347 155385454 . - . gene_id "XLOC_000837"; transcript_id "TCONS_00000837"; exon_number "1"; oId "CUFF.662.1"; tss_id "TSS837"; +chr1 Cufflinks exon 155654206 155654262 . - . gene_id "XLOC_000838"; transcript_id "TCONS_00000838"; exon_number "1"; oId "CUFF.664.1"; tss_id "TSS838"; +chr1 Cufflinks exon 156835378 156835450 . - . gene_id "XLOC_000839"; transcript_id "TCONS_00000839"; exon_number "1"; oId "CUFF.667.1"; tss_id "TSS839"; +chr1 Cufflinks exon 156955523 156955841 . - . gene_id "XLOC_000840"; transcript_id "TCONS_00000840"; exon_number "1"; oId "CUFF.668.1"; tss_id "TSS840"; +chr1 Cufflinks exon 159111404 159111472 . - . gene_id "XLOC_000841"; transcript_id "TCONS_00000841"; exon_number "1"; oId "CUFF.672.1"; tss_id "TSS841"; +chr1 Cufflinks exon 160082438 160082480 . - . gene_id "XLOC_000842"; transcript_id "TCONS_00000842"; exon_number "1"; oId "CUFF.674.1"; tss_id "TSS842"; +chr1 Cufflinks exon 160145609 160145659 . - . gene_id "XLOC_000843"; transcript_id "TCONS_00000843"; exon_number "1"; oId "CUFF.675.1"; tss_id "TSS843"; +chr1 Cufflinks exon 160362555 160362699 . - . gene_id "XLOC_000844"; transcript_id "TCONS_00000844"; exon_number "1"; oId "CUFF.677.1"; tss_id "TSS844"; +chr1 Cufflinks exon 160895774 160895840 . - . gene_id "XLOC_000845"; transcript_id "TCONS_00000845"; exon_number "1"; oId "CUFF.678.1"; tss_id "TSS845"; +chr1 Cufflinks exon 160914616 160914670 . - . gene_id "XLOC_000846"; transcript_id "TCONS_00000846"; exon_number "1"; oId "CUFF.679.1"; tss_id "TSS846"; +chr1 Cufflinks exon 161369490 161369562 . - . gene_id "XLOC_000847"; transcript_id "TCONS_00000847"; exon_number "1"; oId "CUFF.680.1"; tss_id "TSS847"; +chr1 Cufflinks exon 161389168 161389229 . - . gene_id "XLOC_000848"; transcript_id "TCONS_00000848"; exon_number "1"; oId "CUFF.682.1"; tss_id "TSS848"; +chr1 Cufflinks exon 161391883 161391954 . - . gene_id "XLOC_000849"; transcript_id "TCONS_00000849"; exon_number "1"; oId "CUFF.684.1"; tss_id "TSS849"; +chr1 Cufflinks exon 161397867 161397940 . - . gene_id "XLOC_000850"; transcript_id "TCONS_00000850"; exon_number "1"; oId "CUFF.685.1"; tss_id "TSS850"; +chr1 Cufflinks exon 161409959 161410032 . - . gene_id "XLOC_000851"; transcript_id "TCONS_00000851"; exon_number "1"; oId "CUFF.686.1"; tss_id "TSS851"; +chr1 Cufflinks exon 161410612 161410686 . - . gene_id "XLOC_000852"; transcript_id "TCONS_00000852"; exon_number "1"; oId "CUFF.687.1"; tss_id "TSS852"; +chr1 Cufflinks exon 161417018 161417089 . - . gene_id "XLOC_000853"; transcript_id "TCONS_00000853"; exon_number "1"; oId "CUFF.690.1"; tss_id "TSS853"; +chr1 Cufflinks exon 161417375 161417446 . - . gene_id "XLOC_000854"; transcript_id "TCONS_00000854"; exon_number "1"; oId "CUFF.691.1"; tss_id "TSS854"; +chr1 Cufflinks exon 161418030 161418104 . - . gene_id "XLOC_000855"; transcript_id "TCONS_00000855"; exon_number "1"; oId "CUFF.692.1"; tss_id "TSS855"; +chr1 Cufflinks exon 161424398 161424469 . - . gene_id "XLOC_000856"; transcript_id "TCONS_00000856"; exon_number "1"; oId "CUFF.695.1"; tss_id "TSS856"; +chr1 Cufflinks exon 161424756 161424827 . - . gene_id "XLOC_000857"; transcript_id "TCONS_00000857"; exon_number "1"; oId "CUFF.696.1"; tss_id "TSS857"; +chr1 Cufflinks exon 161425411 161425485 . - . gene_id "XLOC_000858"; transcript_id "TCONS_00000858"; exon_number "1"; oId "CUFF.697.1"; tss_id "TSS858"; +chr1 Cufflinks exon 161431809 161431880 . - . gene_id "XLOC_000859"; transcript_id "TCONS_00000859"; exon_number "1"; oId "CUFF.700.1"; tss_id "TSS859"; +chr1 Cufflinks exon 161432166 161432237 . - . gene_id "XLOC_000860"; transcript_id "TCONS_00000860"; exon_number "1"; oId "CUFF.701.1"; tss_id "TSS860"; +chr1 Cufflinks exon 161432821 161432895 . - . gene_id "XLOC_000861"; transcript_id "TCONS_00000861"; exon_number "1"; oId "CUFF.702.1"; tss_id "TSS861"; +chr1 Cufflinks exon 161439189 161439260 . - . gene_id "XLOC_000862"; transcript_id "TCONS_00000862"; exon_number "1"; oId "CUFF.705.1"; tss_id "TSS862"; +chr1 Cufflinks exon 161439547 161439618 . - . gene_id "XLOC_000863"; transcript_id "TCONS_00000863"; exon_number "1"; oId "CUFF.706.1"; tss_id "TSS863"; +chr1 Cufflinks exon 161440202 161440276 . - . gene_id "XLOC_000864"; transcript_id "TCONS_00000864"; exon_number "1"; oId "CUFF.707.1"; tss_id "TSS864"; +chr1 Cufflinks exon 161493636 161493707 . - . gene_id "XLOC_000865"; transcript_id "TCONS_00000865"; exon_number "1"; oId "CUFF.711.1"; tss_id "TSS865"; +chr1 Cufflinks exon 161500132 161500214 . - . gene_id "XLOC_000866"; transcript_id "TCONS_00000866"; exon_number "1"; oId "CUFF.712.1"; tss_id "TSS866"; +chr1 Cufflinks exon 161575285 161575356 . - . gene_id "XLOC_000867"; transcript_id "TCONS_00000867"; exon_number "1"; oId "CUFF.717.1"; tss_id "TSS867"; +chr1 Cufflinks exon 161581736 161581819 . - . gene_id "XLOC_000868"; transcript_id "TCONS_00000868"; exon_number "1"; oId "CUFF.718.1"; tss_id "TSS868"; +chr1 Cufflinks exon 161745921 161745969 . - . gene_id "XLOC_000869"; transcript_id "TCONS_00000869"; exon_number "1"; oId "CUFF.722.1"; tss_id "TSS869"; +chr1 Cufflinks exon 163438306 163438395 . - . gene_id "XLOC_000870"; transcript_id "TCONS_00000870"; exon_number "1"; oId "CUFF.728.1"; tss_id "TSS870"; +chr1 Cufflinks exon 164084076 164084114 . - . gene_id "XLOC_000871"; transcript_id "TCONS_00000871"; exon_number "1"; oId "CUFF.731.1"; tss_id "TSS871"; +chr1 Cufflinks exon 164509411 164509457 . - . gene_id "XLOC_000872"; transcript_id "TCONS_00000872"; exon_number "1"; oId "CUFF.733.1"; tss_id "TSS872"; +chr1 Cufflinks exon 164672263 164672531 . - . gene_id "XLOC_000873"; transcript_id "TCONS_00000873"; exon_number "1"; oId "CUFF.735.1"; tss_id "TSS873"; +chr1 Cufflinks exon 164853882 164853992 . - . gene_id "XLOC_000874"; transcript_id "TCONS_00000874"; exon_number "1"; oId "CUFF.737.1"; tss_id "TSS874"; +chr1 Cufflinks exon 164949299 164949374 . - . gene_id "XLOC_000875"; transcript_id "TCONS_00000875"; exon_number "1"; oId "CUFF.738.1"; tss_id "TSS875"; +chr1 Cufflinks exon 165097497 165097543 . - . gene_id "XLOC_000876"; transcript_id "TCONS_00000876"; exon_number "1"; oId "CUFF.739.1"; tss_id "TSS876"; +chr1 Cufflinks exon 165663550 165663622 . - . gene_id "XLOC_000877"; transcript_id "TCONS_00000877"; exon_number "1"; oId "CUFF.742.1"; tss_id "TSS877"; +chr1 Cufflinks exon 166268871 166268942 . - . gene_id "XLOC_000878"; transcript_id "TCONS_00000878"; exon_number "1"; oId "CUFF.745.1"; tss_id "TSS878"; +chr1 Cufflinks exon 167341913 167341938 . - . gene_id "XLOC_000879"; transcript_id "TCONS_00000879"; exon_number "1"; oId "CUFF.749.1"; tss_id "TSS879"; +chr1 Cufflinks exon 167684725 167684796 . - . gene_id "XLOC_000880"; transcript_id "TCONS_00000880"; exon_number "1"; oId "CUFF.751.1"; tss_id "TSS880"; +chr1 Cufflinks exon 167940751 167940915 . - . gene_id "XLOC_000881"; transcript_id "TCONS_00000881"; exon_number "1"; oId "CUFF.752.1"; tss_id "TSS881"; +chr1 Cufflinks exon 168232616 168232719 . - . gene_id "XLOC_000882"; transcript_id "TCONS_00000882"; exon_number "1"; oId "CUFF.753.1"; tss_id "TSS882"; +chr1 Cufflinks exon 169878692 169878920 . - . gene_id "XLOC_000883"; transcript_id "TCONS_00000883"; exon_number "1"; oId "CUFF.760.1"; tss_id "TSS883"; +chr1 Cufflinks exon 169927071 169927386 . - . gene_id "XLOC_000884"; transcript_id "TCONS_00000884"; exon_number "1"; oId "CUFF.761.1"; tss_id "TSS884"; +chr1 Cufflinks exon 171387788 171387889 . - . gene_id "XLOC_000885"; transcript_id "TCONS_00000885"; exon_number "1"; oId "CUFF.762.1"; tss_id "TSS885"; +chr1 Cufflinks exon 171423722 171423777 . - . gene_id "XLOC_000886"; transcript_id "TCONS_00000886"; exon_number "1"; oId "CUFF.763.1"; tss_id "TSS886"; +chr1 Cufflinks exon 171488955 171489051 . - . gene_id "XLOC_000887"; transcript_id "TCONS_00000887"; exon_number "1"; oId "CUFF.766.1"; tss_id "TSS887"; +chr1 Cufflinks exon 171682581 171682622 . - . gene_id "XLOC_000888"; transcript_id "TCONS_00000888"; exon_number "1"; oId "CUFF.767.1"; tss_id "TSS888"; +chr1 Cufflinks exon 172157535 172157607 . - . gene_id "XLOC_000889"; transcript_id "TCONS_00000889"; exon_number "1"; oId "CUFF.769.1"; tss_id "TSS889"; +chr1 Cufflinks exon 173629233 173629340 . - . gene_id "XLOC_000890"; transcript_id "TCONS_00000890"; exon_number "1"; oId "CUFF.773.1"; tss_id "TSS890"; +chr1 Cufflinks exon 173807609 173807663 . - . gene_id "XLOC_000891"; transcript_id "TCONS_00000891"; exon_number "1"; oId "CUFF.776.1"; tss_id "TSS891"; +chr1 Cufflinks exon 173938454 173938574 . - . gene_id "XLOC_000892"; transcript_id "TCONS_00000892"; exon_number "1"; oId "CUFF.778.1"; tss_id "TSS892"; +chr1 Cufflinks exon 174064380 174064435 . - . gene_id "XLOC_000893"; transcript_id "TCONS_00000893"; exon_number "1"; oId "CUFF.779.1"; tss_id "TSS893"; +chr1 Cufflinks exon 174169265 174169369 . - . gene_id "XLOC_000894"; transcript_id "TCONS_00000894"; exon_number "1"; oId "CUFF.780.1"; tss_id "TSS894"; +chr1 Cufflinks exon 174372414 174372492 . - . gene_id "XLOC_000895"; transcript_id "TCONS_00000895"; exon_number "1"; oId "CUFF.781.1"; tss_id "TSS895"; +chr1 Cufflinks exon 175396176 175396226 . - . gene_id "XLOC_000896"; transcript_id "TCONS_00000896"; exon_number "1"; oId "CUFF.784.1"; tss_id "TSS896"; +chr1 Cufflinks exon 176213119 176213165 . - . gene_id "XLOC_000897"; transcript_id "TCONS_00000897"; exon_number "1"; oId "CUFF.789.1"; tss_id "TSS897"; +chr1 Cufflinks exon 178237811 178237892 . - . gene_id "XLOC_000898"; transcript_id "TCONS_00000898"; exon_number "1"; oId "CUFF.792.1"; tss_id "TSS898"; +chr1 Cufflinks exon 179064547 179064593 . - . gene_id "XLOC_000899"; transcript_id "TCONS_00000899"; exon_number "1"; oId "CUFF.794.1"; tss_id "TSS899"; +chr1 Cufflinks exon 179699423 179699532 . - . gene_id "XLOC_000900"; transcript_id "TCONS_00000900"; exon_number "1"; oId "CUFF.796.1"; tss_id "TSS900"; +chr1 Cufflinks exon 180020391 180020429 . - . gene_id "XLOC_000901"; transcript_id "TCONS_00000901"; exon_number "1"; oId "CUFF.798.1"; tss_id "TSS901"; +chr1 Cufflinks exon 180184276 180184348 . - . gene_id "XLOC_000902"; transcript_id "TCONS_00000902"; exon_number "1"; oId "CUFF.799.1"; tss_id "TSS902"; +chr1 Cufflinks exon 180318293 180318371 . - . gene_id "XLOC_000903"; transcript_id "TCONS_00000903"; exon_number "1"; oId "CUFF.800.1"; tss_id "TSS903"; +chr1 Cufflinks exon 180535043 180535077 . - . gene_id "XLOC_000904"; transcript_id "TCONS_00000904"; exon_number "1"; oId "CUFF.802.1"; tss_id "TSS904"; +chr1 Cufflinks exon 181808674 181808909 . - . gene_id "XLOC_000905"; transcript_id "TCONS_00000905"; exon_number "1"; oId "CUFF.806.1"; tss_id "TSS905"; +chr1 Cufflinks exon 182181588 182181637 . - . gene_id "XLOC_000906"; transcript_id "TCONS_00000906"; exon_number "1"; oId "CUFF.807.1"; tss_id "TSS906"; +chr1 Cufflinks exon 182913540 182913624 . - . gene_id "XLOC_000907"; transcript_id "TCONS_00000907"; exon_number "1"; oId "CUFF.809.1"; tss_id "TSS907"; +chr1 Cufflinks exon 182916435 182916471 . - . gene_id "XLOC_000908"; transcript_id "TCONS_00000908"; exon_number "1"; oId "CUFF.810.1"; tss_id "TSS908"; +chr1 Cufflinks exon 182951347 182951453 . - . gene_id "XLOC_000909"; transcript_id "TCONS_00000909"; exon_number "1"; oId "CUFF.811.1"; tss_id "TSS909"; +chr1 Cufflinks exon 183382444 183382519 . - . gene_id "XLOC_000910"; transcript_id "TCONS_00000910"; exon_number "1"; oId "CUFF.812.1"; tss_id "TSS910"; +chr1 Cufflinks exon 183472722 183472868 . - . gene_id "XLOC_000911"; transcript_id "TCONS_00000911"; exon_number "1"; oId "CUFF.814.1"; tss_id "TSS911"; +chr1 Cufflinks exon 184790564 184790622 . - . gene_id "XLOC_000912"; transcript_id "TCONS_00000912"; exon_number "1"; oId "CUFF.817.1"; tss_id "TSS912"; +chr1 Cufflinks exon 184984081 184984199 . - . gene_id "XLOC_000913"; transcript_id "TCONS_00000913"; exon_number "1"; oId "CUFF.818.1"; tss_id "TSS913"; +chr1 Cufflinks exon 186280969 186281060 . - . gene_id "XLOC_000914"; transcript_id "TCONS_00000914"; exon_number "1"; oId "CUFF.821.1"; tss_id "TSS914"; +chr1 Cufflinks exon 188124974 188125308 . - . gene_id "XLOC_000915"; transcript_id "TCONS_00000915"; exon_number "1"; oId "CUFF.824.1"; tss_id "TSS915"; +chr1 Cufflinks exon 189525951 189525986 . - . gene_id "XLOC_000916"; transcript_id "TCONS_00000916"; exon_number "1"; oId "CUFF.825.1"; tss_id "TSS916"; +chr1 Cufflinks exon 189635307 189635385 . - . gene_id "XLOC_000917"; transcript_id "TCONS_00000917"; exon_number "1"; oId "CUFF.826.1"; tss_id "TSS917"; +chr1 Cufflinks exon 189747045 189747089 . - . gene_id "XLOC_000918"; transcript_id "TCONS_00000918"; exon_number "1"; oId "CUFF.827.1"; tss_id "TSS918"; +chr1 Cufflinks exon 190612339 190612383 . - . gene_id "XLOC_000919"; transcript_id "TCONS_00000919"; exon_number "1"; oId "CUFF.828.1"; tss_id "TSS919"; +chr1 Cufflinks exon 191467231 191467318 . - . gene_id "XLOC_000920"; transcript_id "TCONS_00000920"; exon_number "1"; oId "CUFF.829.1"; tss_id "TSS920"; +chr1 Cufflinks exon 192283781 192283815 . - . gene_id "XLOC_000921"; transcript_id "TCONS_00000921"; exon_number "1"; oId "CUFF.830.1"; tss_id "TSS921"; +chr1 Cufflinks exon 192844877 192845113 . - . gene_id "XLOC_000922"; transcript_id "TCONS_00000922"; exon_number "1"; oId "CUFF.832.1"; tss_id "TSS922"; +chr1 Cufflinks exon 193113369 193113400 . - . gene_id "XLOC_000923"; transcript_id "TCONS_00000923"; exon_number "1"; oId "CUFF.834.1"; tss_id "TSS923"; +chr1 Cufflinks exon 193700977 193701116 . - . gene_id "XLOC_000924"; transcript_id "TCONS_00000924"; exon_number "1"; oId "CUFF.835.1"; tss_id "TSS924"; +chr1 Cufflinks exon 193701441 193701506 . - . gene_id "XLOC_000925"; transcript_id "TCONS_00000925"; exon_number "1"; oId "CUFF.836.1"; tss_id "TSS925"; +chr1 Cufflinks exon 194290895 194290935 . - . gene_id "XLOC_000926"; transcript_id "TCONS_00000926"; exon_number "1"; oId "CUFF.837.1"; tss_id "TSS926"; +chr1 Cufflinks exon 194457231 194457335 . - . gene_id "XLOC_000927"; transcript_id "TCONS_00000927"; exon_number "1"; oId "CUFF.838.1"; tss_id "TSS927"; +chr1 Cufflinks exon 198087192 198087224 . - . gene_id "XLOC_000928"; transcript_id "TCONS_00000928"; exon_number "1"; oId "CUFF.840.1"; tss_id "TSS928"; +chr1 Cufflinks exon 199977637 199977722 . - . gene_id "XLOC_000929"; transcript_id "TCONS_00000929"; exon_number "1"; oId "CUFF.845.1"; tss_id "TSS929"; +chr1 Cufflinks exon 199983818 199983923 . - . gene_id "XLOC_000930"; transcript_id "TCONS_00000930"; exon_number "1"; oId "CUFF.846.1"; tss_id "TSS930"; +chr1 Cufflinks exon 200428779 200428912 . - . gene_id "XLOC_000931"; transcript_id "TCONS_00000931"; exon_number "1"; oId "CUFF.848.1"; tss_id "TSS931"; +chr1 Cufflinks exon 200902478 200902573 . - . gene_id "XLOC_000932"; transcript_id "TCONS_00000932"; exon_number "1"; oId "CUFF.849.1"; tss_id "TSS932"; +chr1 Cufflinks exon 201450105 201450137 . - . gene_id "XLOC_000933"; transcript_id "TCONS_00000933"; exon_number "1"; oId "CUFF.850.1"; tss_id "TSS933"; +chr1 Cufflinks exon 202166760 202166860 . - . gene_id "XLOC_000934"; transcript_id "TCONS_00000934"; exon_number "1"; oId "CUFF.853.1"; tss_id "TSS934"; +chr1 Cufflinks exon 202379236 202379338 . - . gene_id "XLOC_000935"; transcript_id "TCONS_00000935"; exon_number "1"; oId "CUFF.856.1"; tss_id "TSS935"; +chr1 Cufflinks exon 203288124 203288226 . - . gene_id "XLOC_000936"; transcript_id "TCONS_00000936"; exon_number "1"; oId "CUFF.858.1"; tss_id "TSS936"; +chr1 Cufflinks exon 204476156 204476230 . - . gene_id "XLOC_000937"; transcript_id "TCONS_00000937"; exon_number "1"; oId "CUFF.860.1"; tss_id "TSS937"; +chr1 Cufflinks exon 204531539 204531649 . - . gene_id "XLOC_000938"; transcript_id "TCONS_00000938"; exon_number "1"; oId "CUFF.861.1"; tss_id "TSS938"; +chr1 Cufflinks exon 204676469 204676556 . - . gene_id "XLOC_000939"; transcript_id "TCONS_00000939"; exon_number "1"; oId "CUFF.862.1"; tss_id "TSS939"; +chr1 Cufflinks exon 205382723 205382781 . - . gene_id "XLOC_000940"; transcript_id "TCONS_00000940"; exon_number "1"; oId "CUFF.863.1"; tss_id "TSS940"; +chr1 Cufflinks exon 205793232 205793342 . - . gene_id "XLOC_000941"; transcript_id "TCONS_00000941"; exon_number "1"; oId "CUFF.868.1"; tss_id "TSS941"; +chr1 Cufflinks exon 206971479 206971562 . - . gene_id "XLOC_000942"; transcript_id "TCONS_00000942"; exon_number "1"; oId "CUFF.869.1"; tss_id "TSS942"; +chr1 Cufflinks exon 207212036 207212146 . - . gene_id "XLOC_000943"; transcript_id "TCONS_00000943"; exon_number "1"; oId "CUFF.870.1"; tss_id "TSS943"; +chr1 Cufflinks exon 207675731 207675772 . - . gene_id "XLOC_000944"; transcript_id "TCONS_00000944"; exon_number "1"; oId "CUFF.872.1"; tss_id "TSS944"; +chr1 Cufflinks exon 207714086 207714135 . - . gene_id "XLOC_000945"; transcript_id "TCONS_00000945"; exon_number "1"; oId "CUFF.873.1"; tss_id "TSS945"; +chr1 Cufflinks exon 207732643 207732692 . - . gene_id "XLOC_000946"; transcript_id "TCONS_00000946"; exon_number "1"; oId "CUFF.874.1"; tss_id "TSS946"; +chr1 Cufflinks exon 207749694 207749743 . - . gene_id "XLOC_000947"; transcript_id "TCONS_00000947"; exon_number "1"; oId "CUFF.875.1"; tss_id "TSS947"; +chr1 Cufflinks exon 207848679 207848721 . - . gene_id "XLOC_000948"; transcript_id "TCONS_00000948"; exon_number "1"; oId "CUFF.876.1"; tss_id "TSS948"; +chr1 Cufflinks exon 207882276 207882325 . - . gene_id "XLOC_000949"; transcript_id "TCONS_00000949"; exon_number "1"; oId "CUFF.877.1"; tss_id "TSS949"; +chr1 Cufflinks exon 208003651 208003776 . - . gene_id "XLOC_000950"; transcript_id "TCONS_00000950"; exon_number "1"; oId "CUFF.878.1"; tss_id "TSS950"; +chr1 Cufflinks exon 208847353 208847387 . - . gene_id "XLOC_000951"; transcript_id "TCONS_00000951"; exon_number "1"; oId "CUFF.881.1"; tss_id "TSS951"; +chr1 Cufflinks exon 210547500 210547612 . - . gene_id "XLOC_000952"; transcript_id "TCONS_00000952"; exon_number "1"; oId "CUFF.882.1"; tss_id "TSS952"; +chr1 Cufflinks exon 211465587 211465624 . - . gene_id "XLOC_000953"; transcript_id "TCONS_00000953"; exon_number "1"; oId "CUFF.884.1"; tss_id "TSS953"; +chr1 Cufflinks exon 211799053 211799116 . - . gene_id "XLOC_000954"; transcript_id "TCONS_00000954"; exon_number "1"; oId "CUFF.886.1"; tss_id "TSS954"; +chr1 Cufflinks exon 211799884 211800066 . - . gene_id "XLOC_000955"; transcript_id "TCONS_00000955"; exon_number "1"; oId "CUFF.887.1"; tss_id "TSS955"; +chr1 Cufflinks exon 211965444 211965748 . - . gene_id "XLOC_000956"; transcript_id "TCONS_00000956"; exon_number "1"; oId "CUFF.888.1"; tss_id "TSS956"; +chr1 Cufflinks exon 212101174 212101244 . - . gene_id "XLOC_000957"; transcript_id "TCONS_00000957"; exon_number "1"; oId "CUFF.889.1"; tss_id "TSS957"; +chr1 Cufflinks exon 212272890 212273017 . - . gene_id "XLOC_000958"; transcript_id "TCONS_00000958"; exon_number "1"; oId "CUFF.890.1"; tss_id "TSS958"; +chr1 Cufflinks exon 212725375 212725423 . - . gene_id "XLOC_000959"; transcript_id "TCONS_00000959"; exon_number "1"; oId "CUFF.891.1"; tss_id "TSS959"; +chr1 Cufflinks exon 213282320 213282356 . - . gene_id "XLOC_000960"; transcript_id "TCONS_00000960"; exon_number "1"; oId "CUFF.894.1"; tss_id "TSS960"; +chr1 Cufflinks exon 214115161 214115218 . - . gene_id "XLOC_000961"; transcript_id "TCONS_00000961"; exon_number "1"; oId "CUFF.895.1"; tss_id "TSS961"; +chr1 Cufflinks exon 214427875 214427913 . - . gene_id "XLOC_000962"; transcript_id "TCONS_00000962"; exon_number "1"; oId "CUFF.896.1"; tss_id "TSS962"; +chr1 Cufflinks exon 215783627 215783661 . - . gene_id "XLOC_000963"; transcript_id "TCONS_00000963"; exon_number "1"; oId "CUFF.897.1"; tss_id "TSS963"; +chr1 Cufflinks exon 216619874 216619964 . - . gene_id "XLOC_000964"; transcript_id "TCONS_00000964"; exon_number "1"; oId "CUFF.898.1"; tss_id "TSS964"; +chr1 Cufflinks exon 218371231 218371266 . - . gene_id "XLOC_000965"; transcript_id "TCONS_00000965"; exon_number "1"; oId "CUFF.901.1"; tss_id "TSS965"; +chr1 Cufflinks exon 218403797 218403831 . - . gene_id "XLOC_000966"; transcript_id "TCONS_00000966"; exon_number "1"; oId "CUFF.902.1"; tss_id "TSS966"; +chr1 Cufflinks exon 218715032 218715241 . - . gene_id "XLOC_000967"; transcript_id "TCONS_00000967"; exon_number "1"; oId "CUFF.903.1"; tss_id "TSS967"; +chr1 Cufflinks exon 220160855 220160957 . - . gene_id "XLOC_000968"; transcript_id "TCONS_00000968"; exon_number "1"; oId "CUFF.910.1"; tss_id "TSS968"; +chr1 Cufflinks exon 220745060 220745377 . - . gene_id "XLOC_000969"; transcript_id "TCONS_00000969"; exon_number "1"; oId "CUFF.912.1"; tss_id "TSS969"; +chr1 Cufflinks exon 222010677 222010782 . - . gene_id "XLOC_000970"; transcript_id "TCONS_00000970"; exon_number "1"; oId "CUFF.913.1"; tss_id "TSS970"; +chr1 Cufflinks exon 222676974 222677076 . - . gene_id "XLOC_000971"; transcript_id "TCONS_00000971"; exon_number "1"; oId "CUFF.916.1"; tss_id "TSS971"; +chr1 Cufflinks exon 222869881 222869970 . - . gene_id "XLOC_000972"; transcript_id "TCONS_00000972"; exon_number "1"; oId "CUFF.917.1"; tss_id "TSS972"; +chr1 Cufflinks exon 223085183 223085288 . - . gene_id "XLOC_000973"; transcript_id "TCONS_00000973"; exon_number "1"; oId "CUFF.918.1"; tss_id "TSS973"; +chr1 Cufflinks exon 223895846 223895892 . - . gene_id "XLOC_000974"; transcript_id "TCONS_00000974"; exon_number "1"; oId "CUFF.921.1"; tss_id "TSS974"; +chr1 Cufflinks exon 224163848 224163950 . - . gene_id "XLOC_000975"; transcript_id "TCONS_00000975"; exon_number "1"; oId "CUFF.922.1"; tss_id "TSS975"; +chr1 Cufflinks exon 224295105 224295237 . - . gene_id "XLOC_000976"; transcript_id "TCONS_00000976"; exon_number "1"; oId "CUFF.923.1"; tss_id "TSS976"; +chr1 Cufflinks exon 224363622 224363657 . - . gene_id "XLOC_000977"; transcript_id "TCONS_00000977"; exon_number "1"; oId "CUFF.924.1"; tss_id "TSS977"; +chr1 Cufflinks exon 224850904 224850959 . - . gene_id "XLOC_000978"; transcript_id "TCONS_00000978"; exon_number "1"; oId "CUFF.929.1"; tss_id "TSS978"; +chr1 Cufflinks exon 226503760 226503865 . - . gene_id "XLOC_000979"; transcript_id "TCONS_00000979"; exon_number "1"; oId "CUFF.934.1"; tss_id "TSS979"; +chr1 Cufflinks exon 226613128 226613277 . - . gene_id "XLOC_000980"; transcript_id "TCONS_00000980"; exon_number "1"; oId "CUFF.935.1"; tss_id "TSS980"; +chr1 Cufflinks exon 226614558 226614721 . - . gene_id "XLOC_000981"; transcript_id "TCONS_00000981"; exon_number "1"; oId "CUFF.936.1"; tss_id "TSS981"; +chr1 Cufflinks exon 226655844 226655885 . - . gene_id "XLOC_000982"; transcript_id "TCONS_00000982"; exon_number "1"; oId "CUFF.938.1"; tss_id "TSS982"; +chr1 Cufflinks exon 227016949 227017088 . - . gene_id "XLOC_000983"; transcript_id "TCONS_00000983"; exon_number "1"; oId "CUFF.939.1"; tss_id "TSS983"; +chr1 Cufflinks exon 228317659 228317693 . - . gene_id "XLOC_000984"; transcript_id "TCONS_00000984"; exon_number "1"; oId "CUFF.941.1"; tss_id "TSS984"; +chr1 Cufflinks exon 228746013 228746133 . - . gene_id "XLOC_000985"; transcript_id "TCONS_00000985"; exon_number "1"; oId "CUFF.943.1"; tss_id "TSS985"; +chr1 Cufflinks exon 228748254 228748374 . - . gene_id "XLOC_000986"; transcript_id "TCONS_00000986"; exon_number "1"; oId "CUFF.944.1"; tss_id "TSS986"; +chr1 Cufflinks exon 228750495 228750615 . - . gene_id "XLOC_000987"; transcript_id "TCONS_00000987"; exon_number "1"; oId "CUFF.945.1"; tss_id "TSS987"; +chr1 Cufflinks exon 228752736 228752856 . - . gene_id "XLOC_000988"; transcript_id "TCONS_00000988"; exon_number "1"; oId "CUFF.946.1"; tss_id "TSS988"; +chr1 Cufflinks exon 228754977 228755097 . - . gene_id "XLOC_000989"; transcript_id "TCONS_00000989"; exon_number "1"; oId "CUFF.947.1"; tss_id "TSS989"; +chr1 Cufflinks exon 228757192 228757312 . - . gene_id "XLOC_000990"; transcript_id "TCONS_00000990"; exon_number "1"; oId "CUFF.948.1"; tss_id "TSS990"; +chr1 Cufflinks exon 228759412 228759532 . - . gene_id "XLOC_000991"; transcript_id "TCONS_00000991"; exon_number "1"; oId "CUFF.949.1"; tss_id "TSS991"; +chr1 Cufflinks exon 228761654 228761774 . - . gene_id "XLOC_000992"; transcript_id "TCONS_00000992"; exon_number "1"; oId "CUFF.950.1"; tss_id "TSS992"; +chr1 Cufflinks exon 228763893 228764013 . - . gene_id "XLOC_000993"; transcript_id "TCONS_00000993"; exon_number "1"; oId "CUFF.951.1"; tss_id "TSS993"; +chr1 Cufflinks exon 228766135 228766255 . - . gene_id "XLOC_000994"; transcript_id "TCONS_00000994"; exon_number "1"; oId "CUFF.952.1"; tss_id "TSS994"; +chr1 Cufflinks exon 228768376 228768496 . - . gene_id "XLOC_000995"; transcript_id "TCONS_00000995"; exon_number "1"; oId "CUFF.953.1"; tss_id "TSS995"; +chr1 Cufflinks exon 228770616 228770736 . - . gene_id "XLOC_000996"; transcript_id "TCONS_00000996"; exon_number "1"; oId "CUFF.954.1"; tss_id "TSS996"; +chr1 Cufflinks exon 228772841 228772961 . - . gene_id "XLOC_000997"; transcript_id "TCONS_00000997"; exon_number "1"; oId "CUFF.955.1"; tss_id "TSS997"; +chr1 Cufflinks exon 228775082 228775202 . - . gene_id "XLOC_000998"; transcript_id "TCONS_00000998"; exon_number "1"; oId "CUFF.956.1"; tss_id "TSS998"; +chr1 Cufflinks exon 228777313 228777433 . - . gene_id "XLOC_000999"; transcript_id "TCONS_00000999"; exon_number "1"; oId "CUFF.957.1"; tss_id "TSS999"; +chr1 Cufflinks exon 228779554 228779674 . - . gene_id "XLOC_001000"; transcript_id "TCONS_00001000"; exon_number "1"; oId "CUFF.958.1"; tss_id "TSS1000"; +chr1 Cufflinks exon 228781785 228781905 . - . gene_id "XLOC_001001"; transcript_id "TCONS_00001001"; exon_number "1"; oId "CUFF.959.1"; tss_id "TSS1001"; +chr1 Cufflinks exon 228783658 228783779 . - . gene_id "XLOC_001002"; transcript_id "TCONS_00001002"; exon_number "1"; oId "CUFF.960.1"; tss_id "TSS1002"; +chr1 Cufflinks exon 229166003 229166045 . - . gene_id "XLOC_001003"; transcript_id "TCONS_00001003"; exon_number "1"; oId "CUFF.961.1"; tss_id "TSS1003"; +chr1 Cufflinks exon 229298863 229298890 . - . gene_id "XLOC_001004"; transcript_id "TCONS_00001004"; exon_number "1"; oId "CUFF.962.1"; tss_id "TSS1004"; +chr1 Cufflinks exon 229546331 229546515 . - . gene_id "XLOC_001005"; transcript_id "TCONS_00001005"; exon_number "1"; oId "CUFF.964.1"; tss_id "TSS1005"; +chr1 Cufflinks exon 229670156 229670190 . - . gene_id "XLOC_001006"; transcript_id "TCONS_00001006"; exon_number "1"; oId "CUFF.965.1"; tss_id "TSS1006"; +chr1 Cufflinks exon 229670816 229670936 . - . gene_id "XLOC_001007"; transcript_id "TCONS_00001007"; exon_number "1"; oId "CUFF.966.1"; tss_id "TSS1007"; +chr1 Cufflinks exon 230197589 230197646 . - . gene_id "XLOC_001008"; transcript_id "TCONS_00001008"; exon_number "1"; oId "CUFF.970.1"; tss_id "TSS1008"; +chr1 Cufflinks exon 230556934 230556970 . - . gene_id "XLOC_001009"; transcript_id "TCONS_00001009"; exon_number "1"; oId "CUFF.971.1"; tss_id "TSS1009"; +chr1 Cufflinks exon 231031175 231031283 . - . gene_id "XLOC_001010"; transcript_id "TCONS_00001010"; exon_number "1"; oId "CUFF.974.1"; tss_id "TSS1010"; +chr1 Cufflinks exon 231417194 231417274 . - . gene_id "XLOC_001011"; transcript_id "TCONS_00001011"; exon_number "1"; oId "CUFF.975.1"; tss_id "TSS1011"; +chr1 Cufflinks exon 231510066 231510258 . - . gene_id "XLOC_001012"; transcript_id "TCONS_00001012"; exon_number "1"; oId "CUFF.976.1"; tss_id "TSS1012"; +chr1 Cufflinks exon 232363677 232363720 . - . gene_id "XLOC_001013"; transcript_id "TCONS_00001013"; exon_number "1"; oId "CUFF.979.1"; tss_id "TSS1013"; +chr1 Cufflinks exon 232480650 232480724 . - . gene_id "XLOC_001014"; transcript_id "TCONS_00001014"; exon_number "1"; oId "CUFF.980.1"; tss_id "TSS1014"; +chr1 Cufflinks exon 232967763 232967933 . - . gene_id "XLOC_001015"; transcript_id "TCONS_00001015"; exon_number "1"; oId "CUFF.982.1"; tss_id "TSS1015"; +chr1 Cufflinks exon 232970084 232970119 . - . gene_id "XLOC_001016"; transcript_id "TCONS_00001016"; exon_number "1"; oId "CUFF.983.1"; tss_id "TSS1016"; +chr1 Cufflinks exon 233584463 233584527 . - . gene_id "XLOC_001017"; transcript_id "TCONS_00001017"; exon_number "1"; oId "CUFF.984.1"; tss_id "TSS1017"; +chr1 Cufflinks exon 233943582 233943619 . - . gene_id "XLOC_001018"; transcript_id "TCONS_00001018"; exon_number "1"; oId "CUFF.985.1"; tss_id "TSS1018"; +chr1 Cufflinks exon 234436992 234437029 . - . gene_id "XLOC_001019"; transcript_id "TCONS_00001019"; exon_number "1"; oId "CUFF.986.1"; tss_id "TSS1019"; +chr1 Cufflinks exon 236026692 236026750 . - . gene_id "XLOC_001020"; transcript_id "TCONS_00001020"; exon_number "1"; oId "CUFF.989.1"; tss_id "TSS1020"; +chr1 Cufflinks exon 238106956 238107030 . - . gene_id "XLOC_001021"; transcript_id "TCONS_00001021"; exon_number "1"; oId "CUFF.998.1"; tss_id "TSS1021"; +chr1 Cufflinks exon 238349762 238349802 . - . gene_id "XLOC_001022"; transcript_id "TCONS_00001022"; exon_number "1"; oId "CUFF.999.1"; tss_id "TSS1022"; +chr1 Cufflinks exon 238488987 238489069 . - . gene_id "XLOC_001023"; transcript_id "TCONS_00001023"; exon_number "1"; oId "CUFF.1000.1"; tss_id "TSS1023"; +chr1 Cufflinks exon 238839888 238839937 . - . gene_id "XLOC_001024"; transcript_id "TCONS_00001024"; exon_number "1"; oId "CUFF.1001.1"; tss_id "TSS1024"; +chr1 Cufflinks exon 240433757 240433815 . - . gene_id "XLOC_001025"; transcript_id "TCONS_00001025"; exon_number "1"; oId "CUFF.1004.1"; tss_id "TSS1025"; +chr1 Cufflinks exon 242108861 242108991 . - . gene_id "XLOC_001026"; transcript_id "TCONS_00001026"; exon_number "1"; oId "CUFF.1007.1"; tss_id "TSS1026"; +chr1 Cufflinks exon 242187261 242187356 . - . gene_id "XLOC_001027"; transcript_id "TCONS_00001027"; exon_number "1"; oId "CUFF.1010.1"; tss_id "TSS1027"; +chr1 Cufflinks exon 242247814 242247851 . - . gene_id "XLOC_001028"; transcript_id "TCONS_00001028"; exon_number "1"; oId "CUFF.1013.1"; tss_id "TSS1028"; +chr1 Cufflinks exon 242351981 242352090 . - . gene_id "XLOC_001029"; transcript_id "TCONS_00001029"; exon_number "1"; oId "CUFF.1015.1"; tss_id "TSS1029"; +chr1 Cufflinks exon 242466330 242466365 . - . gene_id "XLOC_001030"; transcript_id "TCONS_00001030"; exon_number "1"; oId "CUFF.1016.1"; tss_id "TSS1030"; +chr1 Cufflinks exon 243244458 243244560 . - . gene_id "XLOC_001031"; transcript_id "TCONS_00001031"; exon_number "1"; oId "CUFF.1019.1"; tss_id "TSS1031"; +chr1 Cufflinks exon 243868459 243868504 . - . gene_id "XLOC_001032"; transcript_id "TCONS_00001032"; exon_number "1"; oId "CUFF.1020.1"; tss_id "TSS1032"; +chr1 Cufflinks exon 245297230 245297392 . - . gene_id "XLOC_001033"; transcript_id "TCONS_00001033"; exon_number "1"; oId "CUFF.1028.1"; tss_id "TSS1033"; +chr1 Cufflinks exon 246079292 246079364 . - . gene_id "XLOC_001034"; transcript_id "TCONS_00001034"; exon_number "1"; oId "CUFF.1030.1"; tss_id "TSS1034"; +chr1 Cufflinks exon 246081275 246081416 . - . gene_id "XLOC_001035"; transcript_id "TCONS_00001035"; exon_number "1"; oId "CUFF.1031.1"; tss_id "TSS1035"; +chr1 Cufflinks exon 246352316 246352418 . - . gene_id "XLOC_001036"; transcript_id "TCONS_00001036"; exon_number "1"; oId "CUFF.1033.1"; tss_id "TSS1036"; +chr1 Cufflinks exon 247367870 247367963 . - . gene_id "XLOC_001037"; transcript_id "TCONS_00001037"; exon_number "1"; oId "CUFF.1034.1"; tss_id "TSS1037"; +chr1 Cufflinks exon 247525120 247525186 . - . gene_id "XLOC_001038"; transcript_id "TCONS_00001038"; exon_number "1"; oId "CUFF.1035.1"; tss_id "TSS1038"; +chr1 Cufflinks exon 247770426 247770501 . - . gene_id "XLOC_001039"; transcript_id "TCONS_00001039"; exon_number "1"; oId "CUFF.1036.1"; tss_id "TSS1039"; +chr1 Cufflinks exon 249206891 249206994 . - . gene_id "XLOC_001040"; transcript_id "TCONS_00001040"; exon_number "1"; oId "CUFF.1040.1"; tss_id "TSS1040"; +chr10 Cufflinks exon 744625 744661 . + . gene_id "XLOC_001041"; transcript_id "TCONS_00001041"; exon_number "1"; oId "CUFF.1046.1"; tss_id "TSS1041"; +chr10 Cufflinks exon 965268 965313 . + . gene_id "XLOC_001042"; transcript_id "TCONS_00001042"; exon_number "1"; oId "CUFF.1047.1"; tss_id "TSS1042"; +chr10 Cufflinks exon 969234 969312 . + . gene_id "XLOC_001043"; transcript_id "TCONS_00001043"; exon_number "1"; oId "CUFF.1048.1"; tss_id "TSS1043"; +chr10 Cufflinks exon 2140359 2140444 . + . gene_id "XLOC_001044"; transcript_id "TCONS_00001044"; exon_number "1"; oId "CUFF.1050.1"; tss_id "TSS1044"; +chr10 Cufflinks exon 2241613 2241682 . + . gene_id "XLOC_001045"; transcript_id "TCONS_00001045"; exon_number "1"; oId "CUFF.1051.1"; tss_id "TSS1045"; +chr10 Cufflinks exon 4557144 4557249 . + . gene_id "XLOC_001046"; transcript_id "TCONS_00001046"; exon_number "1"; oId "CUFF.1053.1"; tss_id "TSS1046"; +chr10 Cufflinks exon 5046901 5047032 . + . gene_id "XLOC_001047"; transcript_id "TCONS_00001047"; exon_number "1"; oId "CUFF.1055.1"; tss_id "TSS1047"; +chr10 Cufflinks exon 5178407 5178457 . + . gene_id "XLOC_001048"; transcript_id "TCONS_00001048"; exon_number "1"; oId "CUFF.1058.1"; tss_id "TSS1048"; +chr10 Cufflinks exon 5178715 5178738 . + . gene_id "XLOC_001049"; transcript_id "TCONS_00001049"; exon_number "1"; oId "CUFF.1059.1"; tss_id "TSS1049"; +chr10 Cufflinks exon 5673440 5673727 . + . gene_id "XLOC_001050"; transcript_id "TCONS_00001050"; exon_number "1"; oId "CUFF.1062.1"; tss_id "TSS1050"; +chr10 Cufflinks exon 6191586 6191832 . + . gene_id "XLOC_001051"; transcript_id "TCONS_00001051"; exon_number "1"; oId "CUFF.1065.1"; tss_id "TSS1051"; +chr10 Cufflinks exon 6548397 6548447 . + . gene_id "XLOC_001052"; transcript_id "TCONS_00001052"; exon_number "1"; oId "CUFF.1067.1"; tss_id "TSS1052"; +chr10 Cufflinks exon 6786102 6786140 . + . gene_id "XLOC_001053"; transcript_id "TCONS_00001053"; exon_number "1"; oId "CUFF.1068.1"; tss_id "TSS1053"; +chr10 Cufflinks exon 7251269 7251301 . + . gene_id "XLOC_001054"; transcript_id "TCONS_00001054"; exon_number "1"; oId "CUFF.1069.1"; tss_id "TSS1054"; +chr10 Cufflinks exon 8431780 8431886 . + . gene_id "XLOC_001055"; transcript_id "TCONS_00001055"; exon_number "1"; oId "CUFF.1072.1"; tss_id "TSS1055"; +chr10 Cufflinks exon 9206290 9206370 . + . gene_id "XLOC_001056"; transcript_id "TCONS_00001056"; exon_number "1"; oId "CUFF.1074.1"; tss_id "TSS1056"; +chr10 Cufflinks exon 9863687 9863725 . + . gene_id "XLOC_001057"; transcript_id "TCONS_00001057"; exon_number "1"; oId "CUFF.1076.1"; tss_id "TSS1057"; +chr10 Cufflinks exon 10521931 10521966 . + . gene_id "XLOC_001058"; transcript_id "TCONS_00001058"; exon_number "1"; oId "CUFF.1078.1"; tss_id "TSS1058"; +chr10 Cufflinks exon 11965180 11965265 . + . gene_id "XLOC_001059"; transcript_id "TCONS_00001059"; exon_number "1"; oId "CUFF.1079.1"; tss_id "TSS1059"; +chr10 Cufflinks exon 11965857 11965885 . + . gene_id "XLOC_001060"; transcript_id "TCONS_00001060"; exon_number "1"; oId "CUFF.1080.1"; tss_id "TSS1060"; +chr10 Cufflinks exon 12187661 12187768 . + . gene_id "XLOC_001061"; transcript_id "TCONS_00001061"; exon_number "1"; oId "CUFF.1082.1"; tss_id "TSS1061"; +chr10 Cufflinks exon 13259269 13259375 . + . gene_id "XLOC_001062"; transcript_id "TCONS_00001062"; exon_number "1"; oId "CUFF.1084.1"; tss_id "TSS1062"; +chr10 Cufflinks exon 13769796 13769885 . + . gene_id "XLOC_001063"; transcript_id "TCONS_00001063"; exon_number "1"; oId "CUFF.1086.1"; tss_id "TSS1063"; +chr10 Cufflinks exon 14805729 14805846 . + . gene_id "XLOC_001064"; transcript_id "TCONS_00001064"; exon_number "1"; oId "CUFF.1089.1"; tss_id "TSS1064"; +chr10 Cufflinks exon 14847607 14847644 . + . gene_id "XLOC_001065"; transcript_id "TCONS_00001065"; exon_number "1"; oId "CUFF.1090.1"; tss_id "TSS1065"; +chr10 Cufflinks exon 14981699 14981740 . + . gene_id "XLOC_001066"; transcript_id "TCONS_00001066"; exon_number "1"; oId "CUFF.1092.1"; tss_id "TSS1066"; +chr10 Cufflinks exon 15673746 15673782 . + . gene_id "XLOC_001067"; transcript_id "TCONS_00001067"; exon_number "1"; oId "CUFF.1093.1"; tss_id "TSS1067"; +chr10 Cufflinks exon 15928356 15928466 . + . gene_id "XLOC_001068"; transcript_id "TCONS_00001068"; exon_number "1"; oId "CUFF.1094.1"; tss_id "TSS1068"; +chr10 Cufflinks exon 16518002 16518060 . + . gene_id "XLOC_001069"; transcript_id "TCONS_00001069"; exon_number "1"; oId "CUFF.1097.1"; tss_id "TSS1069"; +chr10 Cufflinks exon 17535955 17535989 . + . gene_id "XLOC_001070"; transcript_id "TCONS_00001070"; exon_number "1"; oId "CUFF.1100.1"; tss_id "TSS1070"; +chr10 Cufflinks exon 17944817 17944882 . + . gene_id "XLOC_001071"; transcript_id "TCONS_00001071"; exon_number "1"; oId "CUFF.1102.1"; tss_id "TSS1071"; +chr10 Cufflinks exon 18191731 18191796 . + . gene_id "XLOC_001072"; transcript_id "TCONS_00001072"; exon_number "1"; oId "CUFF.1104.1"; tss_id "TSS1072"; +chr10 Cufflinks exon 18907898 18907948 . + . gene_id "XLOC_001073"; transcript_id "TCONS_00001073"; exon_number "1"; oId "CUFF.1105.1"; tss_id "TSS1073"; +chr10 Cufflinks exon 19887176 19887392 . + . gene_id "XLOC_001074"; transcript_id "TCONS_00001074"; exon_number "1"; oId "CUFF.1106.1"; tss_id "TSS1074"; +chr10 Cufflinks exon 21454526 21454564 . + . gene_id "XLOC_001075"; transcript_id "TCONS_00001075"; exon_number "1"; oId "CUFF.1111.1"; tss_id "TSS1075"; +chr10 Cufflinks exon 21610890 21610996 . + . gene_id "XLOC_001076"; transcript_id "TCONS_00001076"; exon_number "1"; oId "CUFF.1112.1"; tss_id "TSS1076"; +chr10 Cufflinks exon 21774567 21774632 . + . gene_id "XLOC_001077"; transcript_id "TCONS_00001077"; exon_number "1"; oId "CUFF.1114.1"; tss_id "TSS1077"; +chr10 Cufflinks exon 22222072 22222310 . + . gene_id "XLOC_001078"; transcript_id "TCONS_00001078"; exon_number "1"; oId "CUFF.1117.1"; tss_id "TSS1078"; +chr10 Cufflinks exon 23076322 23076428 . + . gene_id "XLOC_001079"; transcript_id "TCONS_00001079"; exon_number "1"; oId "CUFF.1121.1"; tss_id "TSS1079"; +chr10 Cufflinks exon 23286210 23286280 . + . gene_id "XLOC_001080"; transcript_id "TCONS_00001080"; exon_number "1"; oId "CUFF.1122.1"; tss_id "TSS1080"; +chr10 Cufflinks exon 24061784 24061821 . + . gene_id "XLOC_001081"; transcript_id "TCONS_00001081"; exon_number "1"; oId "CUFF.1126.1"; tss_id "TSS1081"; +chr10 Cufflinks exon 24157020 24157067 . + . gene_id "XLOC_001082"; transcript_id "TCONS_00001082"; exon_number "1"; oId "CUFF.1127.1"; tss_id "TSS1082"; +chr10 Cufflinks exon 24929095 24929215 . + . gene_id "XLOC_001083"; transcript_id "TCONS_00001083"; exon_number "1"; oId "CUFF.1130.1"; tss_id "TSS1083"; +chr10 Cufflinks exon 24932456 24932491 . + . gene_id "XLOC_001084"; transcript_id "TCONS_00001084"; exon_number "1"; oId "CUFF.1131.1"; tss_id "TSS1084"; +chr10 Cufflinks exon 26341314 26341394 . + . gene_id "XLOC_001085"; transcript_id "TCONS_00001085"; exon_number "1"; oId "CUFF.1139.1"; tss_id "TSS1085"; +chr10 Cufflinks exon 26798523 26798615 . + . gene_id "XLOC_001086"; transcript_id "TCONS_00001086"; exon_number "1"; oId "CUFF.1140.1"; tss_id "TSS1086"; +chr10 Cufflinks exon 27157093 27157195 . + . gene_id "XLOC_001087"; transcript_id "TCONS_00001087"; exon_number "1"; oId "CUFF.1142.1"; tss_id "TSS1087"; +chr10 Cufflinks exon 27521084 27521118 . + . gene_id "XLOC_001088"; transcript_id "TCONS_00001088"; exon_number "1"; oId "CUFF.1145.1"; tss_id "TSS1088"; +chr10 Cufflinks exon 27604050 27604153 . + . gene_id "XLOC_001089"; transcript_id "TCONS_00001089"; exon_number "1"; oId "CUFF.1147.1"; tss_id "TSS1089"; +chr10 Cufflinks exon 28956848 28956954 . + . gene_id "XLOC_001090"; transcript_id "TCONS_00001090"; exon_number "1"; oId "CUFF.1153.1"; tss_id "TSS1090"; +chr10 Cufflinks exon 28961080 28961109 . + . gene_id "XLOC_001091"; transcript_id "TCONS_00001091"; exon_number "1"; oId "CUFF.1154.1"; tss_id "TSS1091"; +chr10 Cufflinks exon 30000838 30000937 . + . gene_id "XLOC_001092"; transcript_id "TCONS_00001092"; exon_number "1"; oId "CUFF.1157.1"; tss_id "TSS1092"; +chr10 Cufflinks exon 30618656 30618693 . + . gene_id "XLOC_001093"; transcript_id "TCONS_00001093"; exon_number "1"; oId "CUFF.1161.1"; tss_id "TSS1093"; +chr10 Cufflinks exon 30725517 30725575 . + . gene_id "XLOC_001094"; transcript_id "TCONS_00001094"; exon_number "1"; oId "CUFF.1163.1"; tss_id "TSS1094"; +chr10 Cufflinks exon 31548528 31548617 . + . gene_id "XLOC_001095"; transcript_id "TCONS_00001095"; exon_number "1"; oId "CUFF.1167.1"; tss_id "TSS1095"; +chr10 Cufflinks exon 31828325 31828373 . + . gene_id "XLOC_001096"; transcript_id "TCONS_00001096"; exon_number "1"; oId "CUFF.1169.1"; tss_id "TSS1096"; +chr10 Cufflinks exon 32462613 32462671 . + . gene_id "XLOC_001097"; transcript_id "TCONS_00001097"; exon_number "1"; oId "CUFF.1172.1"; tss_id "TSS1097"; +chr10 Cufflinks exon 34308327 34308363 . + . gene_id "XLOC_001098"; transcript_id "TCONS_00001098"; exon_number "1"; oId "CUFF.1177.1"; tss_id "TSS1098"; +chr10 Cufflinks exon 34394698 34394733 . + . gene_id "XLOC_001099"; transcript_id "TCONS_00001099"; exon_number "1"; oId "CUFF.1178.1"; tss_id "TSS1099"; +chr10 Cufflinks exon 34791585 34791696 . + . gene_id "XLOC_001100"; transcript_id "TCONS_00001100"; exon_number "1"; oId "CUFF.1179.1"; tss_id "TSS1100"; +chr10 Cufflinks exon 35215703 35215786 . + . gene_id "XLOC_001101"; transcript_id "TCONS_00001101"; exon_number "1"; oId "CUFF.1180.1"; tss_id "TSS1101"; +chr10 Cufflinks exon 35231898 35231976 . + . gene_id "XLOC_001102"; transcript_id "TCONS_00001102"; exon_number "1"; oId "CUFF.1181.1"; tss_id "TSS1102"; +chr10 Cufflinks exon 35424371 35424428 . + . gene_id "XLOC_001103"; transcript_id "TCONS_00001103"; exon_number "1"; oId "CUFF.1183.1"; tss_id "TSS1103"; +chr10 Cufflinks exon 36822361 36822586 . + . gene_id "XLOC_001104"; transcript_id "TCONS_00001104"; exon_number "1"; oId "CUFF.1188.1"; tss_id "TSS1104"; +chr10 Cufflinks exon 37424165 37424269 . + . gene_id "XLOC_001105"; transcript_id "TCONS_00001105"; exon_number "1"; oId "CUFF.1189.1"; tss_id "TSS1105"; +chr10 Cufflinks exon 37586368 37586626 . + . gene_id "XLOC_001106"; transcript_id "TCONS_00001106"; exon_number "1"; oId "CUFF.1191.1"; tss_id "TSS1106"; +chr10 Cufflinks exon 38123896 38123948 . + . gene_id "XLOC_001107"; transcript_id "TCONS_00001107"; exon_number "1"; oId "CUFF.1194.1"; tss_id "TSS1107"; +chr10 Cufflinks exon 38584628 38584663 . + . gene_id "XLOC_001108"; transcript_id "TCONS_00001108"; exon_number "1"; oId "CUFF.1197.1"; tss_id "TSS1108"; +chr10 Cufflinks exon 38712554 38712656 . + . gene_id "XLOC_001109"; transcript_id "TCONS_00001109"; exon_number "1"; oId "CUFF.1198.1"; tss_id "TSS1109"; +chr10 Cufflinks exon 42964889 42964922 . + . gene_id "XLOC_001110"; transcript_id "TCONS_00001110"; exon_number "1"; oId "CUFF.1199.1"; tss_id "TSS1110"; +chr10 Cufflinks exon 43100607 43100705 . + . gene_id "XLOC_001111"; transcript_id "TCONS_00001111"; exon_number "1"; oId "CUFF.1200.1"; tss_id "TSS1111"; +chr10 Cufflinks exon 43879130 43879439 . + . gene_id "XLOC_001112"; transcript_id "TCONS_00001112"; exon_number "1"; oId "CUFF.1203.1"; tss_id "TSS1112"; +chr10 Cufflinks exon 43938285 43938337 . + . gene_id "XLOC_001113"; transcript_id "TCONS_00001113"; exon_number "1"; oId "CUFF.1205.1"; tss_id "TSS1113"; +chr10 Cufflinks exon 43953513 43953565 . + . gene_id "XLOC_001114"; transcript_id "TCONS_00001114"; exon_number "1"; oId "CUFF.1206.1"; tss_id "TSS1114"; +chr10 Cufflinks exon 43954029 43954042 . + . gene_id "XLOC_001115"; transcript_id "TCONS_00001115"; exon_number "1"; oId "CUFF.1207.1"; tss_id "TSS1115"; +chr10 Cufflinks exon 44430353 44430388 . + . gene_id "XLOC_001116"; transcript_id "TCONS_00001116"; exon_number "1"; oId "CUFF.1209.1"; tss_id "TSS1116"; +chr10 Cufflinks exon 45197175 45197216 . + . gene_id "XLOC_001117"; transcript_id "TCONS_00001117"; exon_number "1"; oId "CUFF.1212.1"; tss_id "TSS1117"; +chr10 Cufflinks exon 46351768 46351870 . + . gene_id "XLOC_001118"; transcript_id "TCONS_00001118"; exon_number "1"; oId "CUFF.1214.1"; tss_id "TSS1118"; +chr10 Cufflinks exon 46612998 46613032 . + . gene_id "XLOC_001119"; transcript_id "TCONS_00001119"; exon_number "1"; oId "CUFF.1215.1"; tss_id "TSS1119"; +chr10 Cufflinks exon 46730266 46730339 . + . gene_id "XLOC_001120"; transcript_id "TCONS_00001120"; exon_number "1"; oId "CUFF.1216.1"; tss_id "TSS1120"; +chr10 Cufflinks exon 46742029 46742143 . + . gene_id "XLOC_001121"; transcript_id "TCONS_00001121"; exon_number "1"; oId "CUFF.1217.1"; tss_id "TSS1121"; +chr10 Cufflinks exon 47210703 47210776 . + . gene_id "XLOC_001122"; transcript_id "TCONS_00001122"; exon_number "1"; oId "CUFF.1221.1"; tss_id "TSS1122"; +chr10 Cufflinks exon 47222342 47222456 . + . gene_id "XLOC_001123"; transcript_id "TCONS_00001123"; exon_number "1"; oId "CUFF.1222.1"; tss_id "TSS1123"; +chr10 Cufflinks exon 48799926 48799960 . + . gene_id "XLOC_001124"; transcript_id "TCONS_00001124"; exon_number "1"; oId "CUFF.1229.1"; tss_id "TSS1124"; +chr10 Cufflinks exon 48920042 48920115 . + . gene_id "XLOC_001125"; transcript_id "TCONS_00001125"; exon_number "1"; oId "CUFF.1230.1"; tss_id "TSS1125"; +chr10 Cufflinks exon 48931790 48931904 . + . gene_id "XLOC_001126"; transcript_id "TCONS_00001126"; exon_number "1"; oId "CUFF.1231.1"; tss_id "TSS1126"; +chr10 Cufflinks exon 49236805 49236878 . + . gene_id "XLOC_001127"; transcript_id "TCONS_00001127"; exon_number "1"; oId "CUFF.1235.1"; tss_id "TSS1127"; +chr10 Cufflinks exon 49320443 49320477 . + . gene_id "XLOC_001128"; transcript_id "TCONS_00001128"; exon_number "1"; oId "CUFF.1236.1"; tss_id "TSS1128"; +chr10 Cufflinks exon 50581057 50581112 . + . gene_id "XLOC_001129"; transcript_id "TCONS_00001129"; exon_number "1"; oId "CUFF.1237.1"; tss_id "TSS1129"; +chr10 Cufflinks exon 51255393 51255495 . + . gene_id "XLOC_001130"; transcript_id "TCONS_00001130"; exon_number "1"; oId "CUFF.1239.1"; tss_id "TSS1130"; +chr10 Cufflinks exon 51483390 51483463 . + . gene_id "XLOC_001131"; transcript_id "TCONS_00001131"; exon_number "1"; oId "CUFF.1240.1"; tss_id "TSS1131"; +chr10 Cufflinks exon 54227207 54227277 . + . gene_id "XLOC_001132"; transcript_id "TCONS_00001132"; exon_number "1"; oId "CUFF.1245.1"; tss_id "TSS1132"; +chr10 Cufflinks exon 55217948 55218035 . + . gene_id "XLOC_001133"; transcript_id "TCONS_00001133"; exon_number "1"; oId "CUFF.1247.1"; tss_id "TSS1133"; +chr10 Cufflinks exon 55934992 55935033 . + . gene_id "XLOC_001134"; transcript_id "TCONS_00001134"; exon_number "1"; oId "CUFF.1250.1"; tss_id "TSS1134"; +chr10 Cufflinks exon 57327498 57327605 . + . gene_id "XLOC_001135"; transcript_id "TCONS_00001135"; exon_number "1"; oId "CUFF.1253.1"; tss_id "TSS1135"; +chr10 Cufflinks exon 57359617 57359764 . + . gene_id "XLOC_001136"; transcript_id "TCONS_00001136"; exon_number "1"; oId "CUFF.1254.1"; tss_id "TSS1136"; +chr10 Cufflinks exon 59254381 59254448 . + . gene_id "XLOC_001137"; transcript_id "TCONS_00001137"; exon_number "1"; oId "CUFF.1257.1"; tss_id "TSS1137"; +chr10 Cufflinks exon 60576321 60576502 . + . gene_id "XLOC_001138"; transcript_id "TCONS_00001138"; exon_number "1"; oId "CUFF.1259.1"; tss_id "TSS1138"; +chr10 Cufflinks exon 60628940 60629157 . + . gene_id "XLOC_001139"; transcript_id "TCONS_00001139"; exon_number "1"; oId "CUFF.1260.1"; tss_id "TSS1139"; +chr10 Cufflinks exon 60739121 60739203 . + . gene_id "XLOC_001140"; transcript_id "TCONS_00001140"; exon_number "1"; oId "CUFF.1261.1"; tss_id "TSS1140"; +chr10 Cufflinks exon 61679155 61679233 . + . gene_id "XLOC_001141"; transcript_id "TCONS_00001141"; exon_number "1"; oId "CUFF.1263.1"; tss_id "TSS1141"; +chr10 Cufflinks exon 62277182 62277222 . + . gene_id "XLOC_001142"; transcript_id "TCONS_00001142"; exon_number "1"; oId "CUFF.1264.1"; tss_id "TSS1142"; +chr10 Cufflinks exon 64085552 64085589 . + . gene_id "XLOC_001143"; transcript_id "TCONS_00001143"; exon_number "1"; oId "CUFF.1267.1"; tss_id "TSS1143"; +chr10 Cufflinks exon 64109805 64110077 . + . gene_id "XLOC_001144"; transcript_id "TCONS_00001144"; exon_number "1"; oId "CUFF.1268.1"; tss_id "TSS1144"; +chr10 Cufflinks exon 64139439 64139672 . + . gene_id "XLOC_001145"; transcript_id "TCONS_00001145"; exon_number "1"; oId "CUFF.1269.1"; tss_id "TSS1145"; +chr10 Cufflinks exon 64869899 64869993 . + . gene_id "XLOC_001146"; transcript_id "TCONS_00001146"; exon_number "1"; oId "CUFF.1271.1"; tss_id "TSS1146"; +chr10 Cufflinks exon 65298588 65298681 . + . gene_id "XLOC_001147"; transcript_id "TCONS_00001147"; exon_number "1"; oId "CUFF.1272.1"; tss_id "TSS1147"; +chr10 Cufflinks exon 65329955 65329988 . + . gene_id "XLOC_001148"; transcript_id "TCONS_00001148"; exon_number "1"; oId "CUFF.1273.1"; tss_id "TSS1148"; +chr10 Cufflinks exon 66049758 66049806 . + . gene_id "XLOC_001149"; transcript_id "TCONS_00001149"; exon_number "1"; oId "CUFF.1275.1"; tss_id "TSS1149"; +chr10 Cufflinks exon 66499051 66499122 . + . gene_id "XLOC_001150"; transcript_id "TCONS_00001150"; exon_number "1"; oId "CUFF.1276.1"; tss_id "TSS1150"; +chr10 Cufflinks exon 68732846 68732878 . + . gene_id "XLOC_001151"; transcript_id "TCONS_00001151"; exon_number "1"; oId "CUFF.1280.1"; tss_id "TSS1151"; +chr10 Cufflinks exon 68915503 68915540 . + . gene_id "XLOC_001152"; transcript_id "TCONS_00001152"; exon_number "1"; oId "CUFF.1282.1"; tss_id "TSS1152"; +chr10 Cufflinks exon 69385527 69385594 . + . gene_id "XLOC_001153"; transcript_id "TCONS_00001153"; exon_number "1"; oId "CUFF.1283.1"; tss_id "TSS1153"; +chr10 Cufflinks exon 69524261 69524342 . + . gene_id "XLOC_001154"; transcript_id "TCONS_00001154"; exon_number "1"; oId "CUFF.1284.1"; tss_id "TSS1154"; +chr10 Cufflinks exon 69568260 69568360 . + . gene_id "XLOC_001155"; transcript_id "TCONS_00001155"; exon_number "1"; oId "CUFF.1285.1"; tss_id "TSS1155"; +chr10 Cufflinks exon 69917836 69918075 . + . gene_id "XLOC_001156"; transcript_id "TCONS_00001156"; exon_number "1"; oId "CUFF.1289.1"; tss_id "TSS1156"; +chr10 Cufflinks exon 70221164 70221283 . + . gene_id "XLOC_001157"; transcript_id "TCONS_00001157"; exon_number "1"; oId "CUFF.1291.1"; tss_id "TSS1157"; +chr10 Cufflinks exon 70414820 70414955 . + . gene_id "XLOC_001158"; transcript_id "TCONS_00001158"; exon_number "1"; oId "CUFF.1294.1"; tss_id "TSS1158"; +chr10 Cufflinks exon 70472715 70472799 . + . gene_id "XLOC_001159"; transcript_id "TCONS_00001159"; exon_number "1"; oId "CUFF.1295.1"; tss_id "TSS1159"; +chr10 Cufflinks exon 70606561 70606660 . + . gene_id "XLOC_001160"; transcript_id "TCONS_00001160"; exon_number "1"; oId "CUFF.1296.1"; tss_id "TSS1160"; +chr10 Cufflinks exon 70649053 70649087 . + . gene_id "XLOC_001161"; transcript_id "TCONS_00001161"; exon_number "1"; oId "CUFF.1297.1"; tss_id "TSS1161"; +chr10 Cufflinks exon 70922597 70922710 . + . gene_id "XLOC_001162"; transcript_id "TCONS_00001162"; exon_number "1"; oId "CUFF.1301.1"; tss_id "TSS1162"; +chr10 Cufflinks exon 71000001 71000094 . + . gene_id "XLOC_001163"; transcript_id "TCONS_00001163"; exon_number "1"; oId "CUFF.1302.1"; tss_id "TSS1163"; +chr10 Cufflinks exon 71351090 71351155 . + . gene_id "XLOC_001164"; transcript_id "TCONS_00001164"; exon_number "1"; oId "CUFF.1305.1"; tss_id "TSS1164"; +chr10 Cufflinks exon 71355104 71355174 . + . gene_id "XLOC_001165"; transcript_id "TCONS_00001165"; exon_number "1"; oId "CUFF.1306.1"; tss_id "TSS1165"; +chr10 Cufflinks exon 71592249 71592286 . + . gene_id "XLOC_001166"; transcript_id "TCONS_00001166"; exon_number "1"; oId "CUFF.1307.1"; tss_id "TSS1166"; +chr10 Cufflinks exon 71881392 71881492 . + . gene_id "XLOC_001167"; transcript_id "TCONS_00001167"; exon_number "1"; oId "CUFF.1308.1"; tss_id "TSS1167"; +chr10 Cufflinks exon 71982317 71982352 . + . gene_id "XLOC_001168"; transcript_id "TCONS_00001168"; exon_number "1"; oId "CUFF.1309.1"; tss_id "TSS1168"; +chr10 Cufflinks exon 73085086 73085188 . + . gene_id "XLOC_001169"; transcript_id "TCONS_00001169"; exon_number "1"; oId "CUFF.1312.1"; tss_id "TSS1169"; +chr10 Cufflinks exon 73707823 73707874 . + . gene_id "XLOC_001170"; transcript_id "TCONS_00001170"; exon_number "1"; oId "CUFF.1314.1"; tss_id "TSS1170"; +chr10 Cufflinks exon 74151722 74151826 . + . gene_id "XLOC_001171"; transcript_id "TCONS_00001171"; exon_number "1"; oId "CUFF.1315.1"; tss_id "TSS1171"; +chr10 Cufflinks exon 74342562 74342865 . + . gene_id "XLOC_001172"; transcript_id "TCONS_00001172"; exon_number "1"; oId "CUFF.1316.1"; tss_id "TSS1172"; +chr10 Cufflinks exon 74349691 74349785 . + . gene_id "XLOC_001173"; transcript_id "TCONS_00001173"; exon_number "1"; oId "CUFF.1317.1"; tss_id "TSS1173"; +chr10 Cufflinks exon 74456160 74456225 . + . gene_id "XLOC_001174"; transcript_id "TCONS_00001174"; exon_number "1"; oId "CUFF.1319.1"; tss_id "TSS1174"; +chr10 Cufflinks exon 75038820 75038925 . + . gene_id "XLOC_001175"; transcript_id "TCONS_00001175"; exon_number "1"; oId "CUFF.1322.1"; tss_id "TSS1175"; +chr10 Cufflinks exon 75281056 75281093 . + . gene_id "XLOC_001176"; transcript_id "TCONS_00001176"; exon_number "1"; oId "CUFF.1324.1"; tss_id "TSS1176"; +chr10 Cufflinks exon 75454710 75454783 . + . gene_id "XLOC_001177"; transcript_id "TCONS_00001177"; exon_number "1"; oId "CUFF.1327.1"; tss_id "TSS1177"; +chr10 Cufflinks exon 75466255 75466373 . + . gene_id "XLOC_001178"; transcript_id "TCONS_00001178"; exon_number "1"; oId "CUFF.1328.1"; tss_id "TSS1178"; +chr10 Cufflinks exon 75986833 75986898 . + . gene_id "XLOC_001179"; transcript_id "TCONS_00001179"; exon_number "1"; oId "CUFF.1329.1"; tss_id "TSS1179"; +chr10 Cufflinks exon 76045147 76045181 . + . gene_id "XLOC_001180"; transcript_id "TCONS_00001180"; exon_number "1"; oId "CUFF.1330.1"; tss_id "TSS1180"; +chr10 Cufflinks exon 76738086 76738214 . + . gene_id "XLOC_001181"; transcript_id "TCONS_00001181"; exon_number "1"; oId "CUFF.1331.1"; tss_id "TSS1181"; +chr10 Cufflinks exon 77091405 77091436 . + . gene_id "XLOC_001182"; transcript_id "TCONS_00001182"; exon_number "1"; oId "CUFF.1332.1"; tss_id "TSS1182"; +chr10 Cufflinks exon 78166378 78166490 . + . gene_id "XLOC_001183"; transcript_id "TCONS_00001183"; exon_number "1"; oId "CUFF.1336.1"; tss_id "TSS1183"; +chr10 Cufflinks exon 78604923 78604963 . + . gene_id "XLOC_001184"; transcript_id "TCONS_00001184"; exon_number "1"; oId "CUFF.1337.1"; tss_id "TSS1184"; +chr10 Cufflinks exon 79346808 79346896 . + . gene_id "XLOC_001185"; transcript_id "TCONS_00001185"; exon_number "1"; oId "CUFF.1339.1"; tss_id "TSS1185"; +chr10 Cufflinks exon 79712941 79713145 . + . gene_id "XLOC_001186"; transcript_id "TCONS_00001186"; exon_number "1"; oId "CUFF.1342.1"; tss_id "TSS1186"; +chr10 Cufflinks exon 79714319 79714427 . + . gene_id "XLOC_001187"; transcript_id "TCONS_00001187"; exon_number "1"; oId "CUFF.1343.1"; tss_id "TSS1187"; +chr10 Cufflinks exon 84100527 84100632 . + . gene_id "XLOC_001188"; transcript_id "TCONS_00001188"; exon_number "1"; oId "CUFF.1345.1"; tss_id "TSS1188"; +chr10 Cufflinks exon 85195604 85195658 . + . gene_id "XLOC_001189"; transcript_id "TCONS_00001189"; exon_number "1"; oId "CUFF.1347.1"; tss_id "TSS1189"; +chr10 Cufflinks exon 85524114 85524219 . + . gene_id "XLOC_001190"; transcript_id "TCONS_00001190"; exon_number "1"; oId "CUFF.1348.1"; tss_id "TSS1190"; +chr10 Cufflinks exon 85763088 85763214 . + . gene_id "XLOC_001191"; transcript_id "TCONS_00001191"; exon_number "1"; oId "CUFF.1349.1"; tss_id "TSS1191"; +chr10 Cufflinks exon 86029807 86029852 . + . gene_id "XLOC_001192"; transcript_id "TCONS_00001192"; exon_number "1"; oId "CUFF.1350.1"; tss_id "TSS1192"; +chr10 Cufflinks exon 87297136 87297214 . + . gene_id "XLOC_001193"; transcript_id "TCONS_00001193"; exon_number "1"; oId "CUFF.1353.1"; tss_id "TSS1193"; +chr10 Cufflinks exon 87318475 87318711 . + . gene_id "XLOC_001194"; transcript_id "TCONS_00001194"; exon_number "1"; oId "CUFF.1354.1"; tss_id "TSS1194"; +chr10 Cufflinks exon 87812205 87812325 . + . gene_id "XLOC_001195"; transcript_id "TCONS_00001195"; exon_number "1"; oId "CUFF.1357.1"; tss_id "TSS1195"; +chr10 Cufflinks exon 88248203 88248296 . + . gene_id "XLOC_001196"; transcript_id "TCONS_00001196"; exon_number "1"; oId "CUFF.1358.1"; tss_id "TSS1196"; +chr10 Cufflinks exon 88264436 88264600 . + . gene_id "XLOC_001197"; transcript_id "TCONS_00001197"; exon_number "1"; oId "CUFF.1359.1"; tss_id "TSS1197"; +chr10 Cufflinks exon 88619795 88619918 . + . gene_id "XLOC_001198"; transcript_id "TCONS_00001198"; exon_number "1"; oId "CUFF.1361.1"; tss_id "TSS1198"; +chr10 Cufflinks exon 88649332 88649491 . + . gene_id "XLOC_001199"; transcript_id "TCONS_00001199"; exon_number "1"; oId "CUFF.1362.1"; tss_id "TSS1199"; +chr10 Cufflinks exon 88810003 88810075 . + . gene_id "XLOC_001200"; transcript_id "TCONS_00001200"; exon_number "1"; oId "CUFF.1364.1"; tss_id "TSS1200"; +chr10 Cufflinks exon 91637247 91637275 . + . gene_id "XLOC_001201"; transcript_id "TCONS_00001201"; exon_number "1"; oId "CUFF.1371.1"; tss_id "TSS1201"; +chr10 Cufflinks exon 91973234 91973275 . + . gene_id "XLOC_001202"; transcript_id "TCONS_00001202"; exon_number "1"; oId "CUFF.1373.1"; tss_id "TSS1202"; +chr10 Cufflinks exon 94746173 94746361 . + . gene_id "XLOC_001203"; transcript_id "TCONS_00001203"; exon_number "1"; oId "CUFF.1380.1"; tss_id "TSS1203"; +chr10 Cufflinks exon 95062947 95063031 . + . gene_id "XLOC_001204"; transcript_id "TCONS_00001204"; exon_number "1"; oId "CUFF.1382.1"; tss_id "TSS1204"; +chr10 Cufflinks exon 95727397 95727433 . + . gene_id "XLOC_001205"; transcript_id "TCONS_00001205"; exon_number "1"; oId "CUFF.1385.1"; tss_id "TSS1205"; +chr10 Cufflinks exon 95952620 95952669 . + . gene_id "XLOC_001206"; transcript_id "TCONS_00001206"; exon_number "1"; oId "CUFF.1387.1"; tss_id "TSS1206"; +chr10 Cufflinks exon 96142214 96142286 . + . gene_id "XLOC_001207"; transcript_id "TCONS_00001207"; exon_number "1"; oId "CUFF.1388.1"; tss_id "TSS1207"; +chr10 Cufflinks exon 97473301 97473373 . + . gene_id "XLOC_001208"; transcript_id "TCONS_00001208"; exon_number "1"; oId "CUFF.1390.1"; tss_id "TSS1208"; +chr10 Cufflinks exon 97670490 97670524 . + . gene_id "XLOC_001209"; transcript_id "TCONS_00001209"; exon_number "1"; oId "CUFF.1391.1"; tss_id "TSS1209"; +chr10 Cufflinks exon 97872506 97872608 . + . gene_id "XLOC_001210"; transcript_id "TCONS_00001210"; exon_number "1"; oId "CUFF.1392.1"; tss_id "TSS1210"; +chr10 Cufflinks exon 98286630 98286679 . + . gene_id "XLOC_001211"; transcript_id "TCONS_00001211"; exon_number "1"; oId "CUFF.1394.1"; tss_id "TSS1211"; +chr10 Cufflinks exon 98379133 98379232 . + . gene_id "XLOC_001212"; transcript_id "TCONS_00001212"; exon_number "1"; oId "CUFF.1396.1"; tss_id "TSS1212"; +chr10 Cufflinks exon 98452480 98452515 . + . gene_id "XLOC_001213"; transcript_id "TCONS_00001213"; exon_number "1"; oId "CUFF.1397.1"; tss_id "TSS1213"; +chr10 Cufflinks exon 98502924 98503027 . + . gene_id "XLOC_001214"; transcript_id "TCONS_00001214"; exon_number "1"; oId "CUFF.1398.1"; tss_id "TSS1214"; +chr10 Cufflinks exon 99057051 99057331 . + . gene_id "XLOC_001215"; transcript_id "TCONS_00001215"; exon_number "1"; oId "CUFF.1399.1"; tss_id "TSS1215"; +chr10 Cufflinks exon 99057459 99057567 . + . gene_id "XLOC_001216"; transcript_id "TCONS_00001216"; exon_number "1"; oId "CUFF.1400.1"; tss_id "TSS1216"; +chr10 Cufflinks exon 99627863 99627898 . + . gene_id "XLOC_001217"; transcript_id "TCONS_00001217"; exon_number "1"; oId "CUFF.1402.1"; tss_id "TSS1217"; +chr10 Cufflinks exon 99798568 99798602 . + . gene_id "XLOC_001218"; transcript_id "TCONS_00001218"; exon_number "1"; oId "CUFF.1403.1"; tss_id "TSS1218"; +chr10 Cufflinks exon 101198812 101198878 . + . gene_id "XLOC_001219"; transcript_id "TCONS_00001219"; exon_number "1"; oId "CUFF.1404.1"; tss_id "TSS1219"; +chr10 Cufflinks exon 101262423 101262461 . + . gene_id "XLOC_001220"; transcript_id "TCONS_00001220"; exon_number "1"; oId "CUFF.1405.1"; tss_id "TSS1220"; +chr10 Cufflinks exon 101361537 101361635 . + . gene_id "XLOC_001221"; transcript_id "TCONS_00001221"; exon_number "1"; oId "CUFF.1408.1"; tss_id "TSS1221"; +chr10 Cufflinks exon 101730307 101730345 . + . gene_id "XLOC_001222"; transcript_id "TCONS_00001222"; exon_number "1"; oId "CUFF.1409.1"; tss_id "TSS1222"; +chr10 Cufflinks exon 101776526 101776587 . + . gene_id "XLOC_001223"; transcript_id "TCONS_00001223"; exon_number "1"; oId "CUFF.1410.1"; tss_id "TSS1223"; +chr10 Cufflinks exon 101779350 101779457 . + . gene_id "XLOC_001224"; transcript_id "TCONS_00001224"; exon_number "1"; oId "CUFF.1411.1"; tss_id "TSS1224"; +chr10 Cufflinks exon 102018328 102018431 . + . gene_id "XLOC_001225"; transcript_id "TCONS_00001225"; exon_number "1"; oId "CUFF.1412.1"; tss_id "TSS1225"; +chr10 Cufflinks exon 102353911 102353996 . + . gene_id "XLOC_001226"; transcript_id "TCONS_00001226"; exon_number "1"; oId "CUFF.1413.1"; tss_id "TSS1226"; +chr10 Cufflinks exon 103040654 103040726 . + . gene_id "XLOC_001227"; transcript_id "TCONS_00001227"; exon_number "1"; oId "CUFF.1414.1"; tss_id "TSS1227"; +chr10 Cufflinks exon 103067286 103067472 . + . gene_id "XLOC_001228"; transcript_id "TCONS_00001228"; exon_number "1"; oId "CUFF.1415.1"; tss_id "TSS1228"; +chr10 Cufflinks exon 103382617 103382716 . + . gene_id "XLOC_001229"; transcript_id "TCONS_00001229"; exon_number "1"; oId "CUFF.1418.1"; tss_id "TSS1229"; +chr10 Cufflinks exon 103700022 103700204 . + . gene_id "XLOC_001230"; transcript_id "TCONS_00001230"; exon_number "1"; oId "CUFF.1419.1"; tss_id "TSS1230"; +chr10 Cufflinks exon 104285746 104286011 . + . gene_id "XLOC_001231"; transcript_id "TCONS_00001231"; exon_number "1"; oId "CUFF.1420.1"; tss_id "TSS1231"; +chr10 Cufflinks exon 104351281 104351384 . + . gene_id "XLOC_001232"; transcript_id "TCONS_00001232"; exon_number "1"; oId "CUFF.1421.1"; tss_id "TSS1232"; +chr10 Cufflinks exon 104563686 104563783 . + . gene_id "XLOC_001233"; transcript_id "TCONS_00001233"; exon_number "1"; oId "CUFF.1422.1"; tss_id "TSS1233"; +chr10 Cufflinks exon 104628178 104628274 . + . gene_id "XLOC_001234"; transcript_id "TCONS_00001234"; exon_number "1"; oId "CUFF.1423.1"; tss_id "TSS1234"; +chr10 Cufflinks exon 105027697 105027750 . + . gene_id "XLOC_001235"; transcript_id "TCONS_00001235"; exon_number "1"; oId "CUFF.1426.1"; tss_id "TSS1235"; +chr10 Cufflinks exon 106159583 106159664 . + . gene_id "XLOC_001236"; transcript_id "TCONS_00001236"; exon_number "1"; oId "CUFF.1428.1"; tss_id "TSS1236"; +chr10 Cufflinks exon 106406525 106406609 . + . gene_id "XLOC_001237"; transcript_id "TCONS_00001237"; exon_number "1"; oId "CUFF.1429.1"; tss_id "TSS1237"; +chr10 Cufflinks exon 107294417 107294523 . + . gene_id "XLOC_001238"; transcript_id "TCONS_00001238"; exon_number "1"; oId "CUFF.1430.1"; tss_id "TSS1238"; +chr10 Cufflinks exon 107761100 107761146 . + . gene_id "XLOC_001239"; transcript_id "TCONS_00001239"; exon_number "1"; oId "CUFF.1431.1"; tss_id "TSS1239"; +chr10 Cufflinks exon 108057718 108057752 . + . gene_id "XLOC_001240"; transcript_id "TCONS_00001240"; exon_number "1"; oId "CUFF.1432.1"; tss_id "TSS1240"; +chr10 Cufflinks exon 108729780 108729868 . + . gene_id "XLOC_001241"; transcript_id "TCONS_00001241"; exon_number "1"; oId "CUFF.1433.1"; tss_id "TSS1241"; +chr10 Cufflinks exon 109105515 109105549 . + . gene_id "XLOC_001242"; transcript_id "TCONS_00001242"; exon_number "1"; oId "CUFF.1434.1"; tss_id "TSS1242"; +chr10 Cufflinks exon 109221319 109221407 . + . gene_id "XLOC_001243"; transcript_id "TCONS_00001243"; exon_number "1"; oId "CUFF.1435.1"; tss_id "TSS1243"; +chr10 Cufflinks exon 110727045 110727087 . + . gene_id "XLOC_001244"; transcript_id "TCONS_00001244"; exon_number "1"; oId "CUFF.1437.1"; tss_id "TSS1244"; +chr10 Cufflinks exon 110999397 110999497 . + . gene_id "XLOC_001245"; transcript_id "TCONS_00001245"; exon_number "1"; oId "CUFF.1439.1"; tss_id "TSS1245"; +chr10 Cufflinks exon 111629616 111629682 . + . gene_id "XLOC_001246"; transcript_id "TCONS_00001246"; exon_number "1"; oId "CUFF.1440.1"; tss_id "TSS1246"; +chr10 Cufflinks exon 112336117 112336221 . + . gene_id "XLOC_001247"; transcript_id "TCONS_00001247"; exon_number "1"; oId "CUFF.1442.1"; tss_id "TSS1247"; +chr10 Cufflinks exon 112516214 112516421 . + . gene_id "XLOC_001248"; transcript_id "TCONS_00001248"; exon_number "1"; oId "CUFF.1443.1"; tss_id "TSS1248"; +chr10 Cufflinks exon 112520900 112520989 . + . gene_id "XLOC_001249"; transcript_id "TCONS_00001249"; exon_number "1"; oId "CUFF.1444.1"; tss_id "TSS1249"; +chr10 Cufflinks exon 114588051 114588082 . + . gene_id "XLOC_001250"; transcript_id "TCONS_00001250"; exon_number "1"; oId "CUFF.1447.1"; tss_id "TSS1250"; +chr10 Cufflinks exon 115113186 115113238 . + . gene_id "XLOC_001251"; transcript_id "TCONS_00001251"; exon_number "1"; oId "CUFF.1448.1"; tss_id "TSS1251"; +chr10 Cufflinks exon 116416280 116416356 . + . gene_id "XLOC_001252"; transcript_id "TCONS_00001252"; exon_number "1"; oId "CUFF.1452.1"; tss_id "TSS1252"; +chr10 Cufflinks exon 118297695 118297769 . + . gene_id "XLOC_001253"; transcript_id "TCONS_00001253"; exon_number "1"; oId "CUFF.1455.1"; tss_id "TSS1253"; +chr10 Cufflinks exon 120263455 120263487 . + . gene_id "XLOC_001254"; transcript_id "TCONS_00001254"; exon_number "1"; oId "CUFF.1459.1"; tss_id "TSS1254"; +chr10 Cufflinks exon 120263851 120263883 . + . gene_id "XLOC_001255"; transcript_id "TCONS_00001255"; exon_number "1"; oId "CUFF.1460.1"; tss_id "TSS1255"; +chr10 Cufflinks exon 120827690 120827758 . + . gene_id "XLOC_001256"; transcript_id "TCONS_00001256"; exon_number "1"; oId "CUFF.1462.1"; tss_id "TSS1256"; +chr10 Cufflinks exon 120972369 120972675 . + . gene_id "XLOC_001257"; transcript_id "TCONS_00001257"; exon_number "1"; oId "CUFF.1463.1"; tss_id "TSS1257"; +chr10 Cufflinks exon 121527759 121528074 . + . gene_id "XLOC_001258"; transcript_id "TCONS_00001258"; exon_number "1"; oId "CUFF.1464.1"; tss_id "TSS1258"; +chr10 Cufflinks exon 122289206 122289270 . + . gene_id "XLOC_001259"; transcript_id "TCONS_00001259"; exon_number "1"; oId "CUFF.1465.1"; tss_id "TSS1259"; +chr10 Cufflinks exon 123170430 123170665 . + . gene_id "XLOC_001260"; transcript_id "TCONS_00001260"; exon_number "1"; oId "CUFF.1466.1"; tss_id "TSS1260"; +chr10 Cufflinks exon 123576309 123576350 . + . gene_id "XLOC_001261"; transcript_id "TCONS_00001261"; exon_number "1"; oId "CUFF.1468.1"; tss_id "TSS1261"; +chr10 Cufflinks exon 124105206 124105308 . + . gene_id "XLOC_001262"; transcript_id "TCONS_00001262"; exon_number "1"; oId "CUFF.1469.1"; tss_id "TSS1262"; +chr10 Cufflinks exon 124717100 124717141 . + . gene_id "XLOC_001263"; transcript_id "TCONS_00001263"; exon_number "1"; oId "CUFF.1470.1"; tss_id "TSS1263"; +chr10 Cufflinks exon 126398359 126398426 . + . gene_id "XLOC_001264"; transcript_id "TCONS_00001264"; exon_number "1"; oId "CUFF.1472.1"; tss_id "TSS1264"; +chr10 Cufflinks exon 128263383 128263451 . + . gene_id "XLOC_001265"; transcript_id "TCONS_00001265"; exon_number "1"; oId "CUFF.1477.1"; tss_id "TSS1265"; +chr10 Cufflinks exon 129309528 129309564 . + . gene_id "XLOC_001266"; transcript_id "TCONS_00001266"; exon_number "1"; oId "CUFF.1478.1"; tss_id "TSS1266"; +chr10 Cufflinks exon 129386662 129386696 . + . gene_id "XLOC_001267"; transcript_id "TCONS_00001267"; exon_number "1"; oId "CUFF.1479.1"; tss_id "TSS1267"; +chr10 Cufflinks exon 134314955 134314994 . + . gene_id "XLOC_001268"; transcript_id "TCONS_00001268"; exon_number "1"; oId "CUFF.1483.1"; tss_id "TSS1268"; +chr10 Cufflinks exon 135337581 135337622 . + . gene_id "XLOC_001269"; transcript_id "TCONS_00001269"; exon_number "1"; oId "CUFF.1484.1"; tss_id "TSS1269"; +chr10 Cufflinks exon 200794 200880 . - . gene_id "XLOC_001270"; transcript_id "TCONS_00001270"; exon_number "1"; oId "CUFF.1041.1"; tss_id "TSS1270"; +chr10 Cufflinks exon 307835 307905 . - . gene_id "XLOC_001271"; transcript_id "TCONS_00001271"; exon_number "1"; oId "CUFF.1042.1"; tss_id "TSS1271"; +chr10 Cufflinks exon 327976 328065 . - . gene_id "XLOC_001272"; transcript_id "TCONS_00001272"; exon_number "1"; oId "CUFF.1043.1"; tss_id "TSS1272"; +chr10 Cufflinks exon 476159 476444 . - . gene_id "XLOC_001273"; transcript_id "TCONS_00001273"; exon_number "1"; oId "CUFF.1044.1"; tss_id "TSS1273"; +chr10 Cufflinks exon 476761 476798 . - . gene_id "XLOC_001274"; transcript_id "TCONS_00001274"; exon_number "1"; oId "CUFF.1045.1"; tss_id "TSS1274"; +chr10 Cufflinks exon 1088235 1088295 . - . gene_id "XLOC_001275"; transcript_id "TCONS_00001275"; exon_number "1"; oId "CUFF.1049.1"; tss_id "TSS1275"; +chr10 Cufflinks exon 4176715 4176756 . - . gene_id "XLOC_001276"; transcript_id "TCONS_00001276"; exon_number "1"; oId "CUFF.1052.1"; tss_id "TSS1276"; +chr10 Cufflinks exon 5004630 5004761 . - . gene_id "XLOC_001277"; transcript_id "TCONS_00001277"; exon_number "1"; oId "CUFF.1054.1"; tss_id "TSS1277"; +chr10 Cufflinks exon 5090054 5090163 . - . gene_id "XLOC_001278"; transcript_id "TCONS_00001278"; exon_number "1"; oId "CUFF.1056.1"; tss_id "TSS1278"; +chr10 Cufflinks exon 5135602 5135732 . - . gene_id "XLOC_001279"; transcript_id "TCONS_00001279"; exon_number "1"; oId "CUFF.1057.1"; tss_id "TSS1279"; +chr10 Cufflinks exon 5237874 5237937 . - . gene_id "XLOC_001280"; transcript_id "TCONS_00001280"; exon_number "1"; oId "CUFF.1060.1"; tss_id "TSS1280"; +chr10 Cufflinks exon 5341747 5341873 . - . gene_id "XLOC_001281"; transcript_id "TCONS_00001281"; exon_number "1"; oId "CUFF.1061.1"; tss_id "TSS1281"; +chr10 Cufflinks exon 5895674 5895746 . - . gene_id "XLOC_001282"; transcript_id "TCONS_00001282"; exon_number "1"; oId "CUFF.1063.1"; tss_id "TSS1282"; +chr10 Cufflinks exon 5942281 5942322 . - . gene_id "XLOC_001283"; transcript_id "TCONS_00001283"; exon_number "1"; oId "CUFF.1064.1"; tss_id "TSS1283"; +chr10 Cufflinks exon 6252978 6253021 . - . gene_id "XLOC_001284"; transcript_id "TCONS_00001284"; exon_number "1"; oId "CUFF.1066.1"; tss_id "TSS1284"; +chr10 Cufflinks exon 7528665 7528771 . - . gene_id "XLOC_001285"; transcript_id "TCONS_00001285"; exon_number "1"; oId "CUFF.1070.1"; tss_id "TSS1285"; +chr10 Cufflinks exon 8271494 8271579 . - . gene_id "XLOC_001286"; transcript_id "TCONS_00001286"; exon_number "1"; oId "CUFF.1071.1"; tss_id "TSS1286"; +chr10 Cufflinks exon 8698679 8698794 . - . gene_id "XLOC_001287"; transcript_id "TCONS_00001287"; exon_number "1"; oId "CUFF.1073.1"; tss_id "TSS1287"; +chr10 Cufflinks exon 9847662 9847696 . - . gene_id "XLOC_001288"; transcript_id "TCONS_00001288"; exon_number "1"; oId "CUFF.1075.1"; tss_id "TSS1288"; +chr10 Cufflinks exon 10365947 10366043 . - . gene_id "XLOC_001289"; transcript_id "TCONS_00001289"; exon_number "1"; oId "CUFF.1077.1"; tss_id "TSS1289"; +chr10 Cufflinks exon 12158301 12158378 . - . gene_id "XLOC_001290"; transcript_id "TCONS_00001290"; exon_number "1"; oId "CUFF.1081.1"; tss_id "TSS1290"; +chr10 Cufflinks exon 12966698 12966784 . - . gene_id "XLOC_001291"; transcript_id "TCONS_00001291"; exon_number "1"; oId "CUFF.1083.1"; tss_id "TSS1291"; +chr10 Cufflinks exon 13574400 13574438 . - . gene_id "XLOC_001292"; transcript_id "TCONS_00001292"; exon_number "1"; oId "CUFF.1085.1"; tss_id "TSS1292"; +chr10 Cufflinks exon 14700659 14700695 . - . gene_id "XLOC_001293"; transcript_id "TCONS_00001293"; exon_number "1"; oId "CUFF.1087.1"; tss_id "TSS1293"; +chr10 Cufflinks exon 14705404 14705493 . - . gene_id "XLOC_001294"; transcript_id "TCONS_00001294"; exon_number "1"; oId "CUFF.1088.1"; tss_id "TSS1294"; +chr10 Cufflinks exon 14947214 14947253 . - . gene_id "XLOC_001295"; transcript_id "TCONS_00001295"; exon_number "1"; oId "CUFF.1091.1"; tss_id "TSS1295"; +chr10 Cufflinks exon 16249820 16249925 . - . gene_id "XLOC_001296"; transcript_id "TCONS_00001296"; exon_number "1"; oId "CUFF.1095.1"; tss_id "TSS1296"; +chr10 Cufflinks exon 16440651 16440759 . - . gene_id "XLOC_001297"; transcript_id "TCONS_00001297"; exon_number "1"; oId "CUFF.1096.1"; tss_id "TSS1297"; +chr10 Cufflinks exon 17350048 17350084 . - . gene_id "XLOC_001298"; transcript_id "TCONS_00001298"; exon_number "1"; oId "CUFF.1098.1"; tss_id "TSS1298"; +chr10 Cufflinks exon 17524461 17524708 . - . gene_id "XLOC_001299"; transcript_id "TCONS_00001299"; exon_number "1"; oId "CUFF.1099.1"; tss_id "TSS1299"; +chr10 Cufflinks exon 17919392 17919444 . - . gene_id "XLOC_001300"; transcript_id "TCONS_00001300"; exon_number "1"; oId "CUFF.1101.1"; tss_id "TSS1300"; +chr10 Cufflinks exon 18166309 18166361 . - . gene_id "XLOC_001301"; transcript_id "TCONS_00001301"; exon_number "1"; oId "CUFF.1103.1"; tss_id "TSS1301"; +chr10 Cufflinks exon 19922611 19922732 . - . gene_id "XLOC_001302"; transcript_id "TCONS_00001302"; exon_number "1"; oId "CUFF.1107.1"; tss_id "TSS1302"; +chr10 Cufflinks exon 20036367 20036441 . - . gene_id "XLOC_001303"; transcript_id "TCONS_00001303"; exon_number "1"; oId "CUFF.1108.1"; tss_id "TSS1303"; +chr10 Cufflinks exon 20036616 20036681 . - . gene_id "XLOC_001304"; transcript_id "TCONS_00001304"; exon_number "1"; oId "CUFF.1109.1"; tss_id "TSS1304"; +chr10 Cufflinks exon 20081927 20082030 . - . gene_id "XLOC_001305"; transcript_id "TCONS_00001305"; exon_number "1"; oId "CUFF.1110.1"; tss_id "TSS1305"; +chr10 Cufflinks exon 21680467 21680531 . - . gene_id "XLOC_001306"; transcript_id "TCONS_00001306"; exon_number "1"; oId "CUFF.1113.1"; tss_id "TSS1306"; +chr10 Cufflinks exon 21853403 21853506 . - . gene_id "XLOC_001307"; transcript_id "TCONS_00001307"; exon_number "1"; oId "CUFF.1115.1"; tss_id "TSS1307"; +chr10 Cufflinks exon 21950568 21950670 . - . gene_id "XLOC_001308"; transcript_id "TCONS_00001308"; exon_number "1"; oId "CUFF.1116.1"; tss_id "TSS1308"; +chr10 Cufflinks exon 22518437 22518511 . - . gene_id "XLOC_001309"; transcript_id "TCONS_00001309"; exon_number "1"; oId "CUFF.1118.1"; tss_id "TSS1309"; +chr10 Cufflinks exon 22778322 22778416 . - . gene_id "XLOC_001310"; transcript_id "TCONS_00001310"; exon_number "1"; oId "CUFF.1119.1"; tss_id "TSS1310"; +chr10 Cufflinks exon 23011615 23011654 . - . gene_id "XLOC_001311"; transcript_id "TCONS_00001311"; exon_number "1"; oId "CUFF.1120.1"; tss_id "TSS1311"; +chr10 Cufflinks exon 23510509 23510574 . - . gene_id "XLOC_001312"; transcript_id "TCONS_00001312"; exon_number "1"; oId "CUFF.1123.1"; tss_id "TSS1312"; +chr10 Cufflinks exon 23688108 23688160 . - . gene_id "XLOC_001313"; transcript_id "TCONS_00001313"; exon_number "1"; oId "CUFF.1124.1"; tss_id "TSS1313"; +chr10 Cufflinks exon 23688462 23688529 . - . gene_id "XLOC_001314"; transcript_id "TCONS_00001314"; exon_number "1"; oId "CUFF.1125.1"; tss_id "TSS1314"; +chr10 Cufflinks exon 24253790 24253832 . - . gene_id "XLOC_001315"; transcript_id "TCONS_00001315"; exon_number "1"; oId "CUFF.1128.1"; tss_id "TSS1315"; +chr10 Cufflinks exon 24281731 24281870 . - . gene_id "XLOC_001316"; transcript_id "TCONS_00001316"; exon_number "1"; oId "CUFF.1129.1"; tss_id "TSS1316"; +chr10 Cufflinks exon 25197506 25197741 . - . gene_id "XLOC_001317"; transcript_id "TCONS_00001317"; exon_number "1"; oId "CUFF.1132.1"; tss_id "TSS1317"; +chr10 Cufflinks exon 25546444 25546479 . - . gene_id "XLOC_001318"; transcript_id "TCONS_00001318"; exon_number "1"; oId "CUFF.1133.1"; tss_id "TSS1318"; +chr10 Cufflinks exon 25682534 25682771 . - . gene_id "XLOC_001319"; transcript_id "TCONS_00001319"; exon_number "1"; oId "CUFF.1134.1"; tss_id "TSS1319"; +chr10 Cufflinks exon 25810629 25810685 . - . gene_id "XLOC_001320"; transcript_id "TCONS_00001320"; exon_number "1"; oId "CUFF.1135.1"; tss_id "TSS1320"; +chr10 Cufflinks exon 26102738 26102846 . - . gene_id "XLOC_001321"; transcript_id "TCONS_00001321"; exon_number "1"; oId "CUFF.1136.1"; tss_id "TSS1321"; +chr10 Cufflinks exon 26108292 26108355 . - . gene_id "XLOC_001322"; transcript_id "TCONS_00001322"; exon_number "1"; oId "CUFF.1137.1"; tss_id "TSS1322"; +chr10 Cufflinks exon 26208985 26209085 . - . gene_id "XLOC_001323"; transcript_id "TCONS_00001323"; exon_number "1"; oId "CUFF.1138.1"; tss_id "TSS1323"; +chr10 Cufflinks exon 27079469 27079575 . - . gene_id "XLOC_001324"; transcript_id "TCONS_00001324"; exon_number "1"; oId "CUFF.1141.1"; tss_id "TSS1324"; +chr10 Cufflinks exon 27377251 27377356 . - . gene_id "XLOC_001325"; transcript_id "TCONS_00001325"; exon_number "1"; oId "CUFF.1143.1"; tss_id "TSS1325"; +chr10 Cufflinks exon 27482378 27482429 . - . gene_id "XLOC_001326"; transcript_id "TCONS_00001326"; exon_number "1"; oId "CUFF.1144.1"; tss_id "TSS1326"; +chr10 Cufflinks exon 27521187 27521244 . - . gene_id "XLOC_001327"; transcript_id "TCONS_00001327"; exon_number "1"; oId "CUFF.1146.1"; tss_id "TSS1327"; +chr10 Cufflinks exon 27624432 27624536 . - . gene_id "XLOC_001328"; transcript_id "TCONS_00001328"; exon_number "1"; oId "CUFF.1148.1"; tss_id "TSS1328"; +chr10 Cufflinks exon 27851473 27851504 . - . gene_id "XLOC_001329"; transcript_id "TCONS_00001329"; exon_number "1"; oId "CUFF.1149.1"; tss_id "TSS1329"; +chr10 Cufflinks exon 28072846 28072957 . - . gene_id "XLOC_001330"; transcript_id "TCONS_00001330"; exon_number "1"; oId "CUFF.1150.1"; tss_id "TSS1330"; +chr10 Cufflinks exon 28696968 28697180 . - . gene_id "XLOC_001331"; transcript_id "TCONS_00001331"; exon_number "1"; oId "CUFF.1151.1"; tss_id "TSS1331"; +chr10 Cufflinks exon 28731517 28731825 . - . gene_id "XLOC_001332"; transcript_id "TCONS_00001332"; exon_number "1"; oId "CUFF.1152.1"; tss_id "TSS1332"; +chr10 Cufflinks exon 29049631 29049732 . - . gene_id "XLOC_001333"; transcript_id "TCONS_00001333"; exon_number "1"; oId "CUFF.1155.1"; tss_id "TSS1333"; +chr10 Cufflinks exon 29163321 29163419 . - . gene_id "XLOC_001334"; transcript_id "TCONS_00001334"; exon_number "1"; oId "CUFF.1156.1"; tss_id "TSS1334"; +chr10 Cufflinks exon 30100172 30100336 . - . gene_id "XLOC_001335"; transcript_id "TCONS_00001335"; exon_number "1"; oId "CUFF.1158.1"; tss_id "TSS1335"; +chr10 Cufflinks exon 30459422 30459454 . - . gene_id "XLOC_001336"; transcript_id "TCONS_00001336"; exon_number "1"; oId "CUFF.1159.1"; tss_id "TSS1336"; +chr10 Cufflinks exon 30588499 30588602 . - . gene_id "XLOC_001337"; transcript_id "TCONS_00001337"; exon_number "1"; oId "CUFF.1160.1"; tss_id "TSS1337"; +chr10 Cufflinks exon 30655019 30655172 . - . gene_id "XLOC_001338"; transcript_id "TCONS_00001338"; exon_number "1"; oId "CUFF.1162.1"; tss_id "TSS1338"; +chr10 Cufflinks exon 30844515 30844828 . - . gene_id "XLOC_001339"; transcript_id "TCONS_00001339"; exon_number "1"; oId "CUFF.1164.1"; tss_id "TSS1339"; +chr10 Cufflinks exon 30847349 30847383 . - . gene_id "XLOC_001340"; transcript_id "TCONS_00001340"; exon_number "1"; oId "CUFF.1165.1"; tss_id "TSS1340"; +chr10 Cufflinks exon 31103814 31103855 . - . gene_id "XLOC_001341"; transcript_id "TCONS_00001341"; exon_number "1"; oId "CUFF.1166.1"; tss_id "TSS1341"; +chr10 Cufflinks exon 31720239 31720310 . - . gene_id "XLOC_001342"; transcript_id "TCONS_00001342"; exon_number "1"; oId "CUFF.1168.1"; tss_id "TSS1342"; +chr10 Cufflinks exon 32122001 32122053 . - . gene_id "XLOC_001343"; transcript_id "TCONS_00001343"; exon_number "1"; oId "CUFF.1170.1"; tss_id "TSS1343"; +chr10 Cufflinks exon 32281001 32281309 . - . gene_id "XLOC_001344"; transcript_id "TCONS_00001344"; exon_number "1"; oId "CUFF.1171.1"; tss_id "TSS1344"; +chr10 Cufflinks exon 32683509 32683593 . - . gene_id "XLOC_001345"; transcript_id "TCONS_00001345"; exon_number "1"; oId "CUFF.1173.1"; tss_id "TSS1345"; +chr10 Cufflinks exon 32699247 32699626 . - . gene_id "XLOC_001346"; transcript_id "TCONS_00001346"; exon_number "1"; oId "CUFF.1174.1"; tss_id "TSS1346"; +chr10 Cufflinks exon 33092096 33092128 . - . gene_id "XLOC_001347"; transcript_id "TCONS_00001347"; exon_number "1"; oId "CUFF.1175.1"; tss_id "TSS1347"; +chr10 Cufflinks exon 33577215 33577529 . - . gene_id "XLOC_001348"; transcript_id "TCONS_00001348"; exon_number "1"; oId "CUFF.1176.1"; tss_id "TSS1348"; +chr10 Cufflinks exon 35370877 35370941 . - . gene_id "XLOC_001349"; transcript_id "TCONS_00001349"; exon_number "1"; oId "CUFF.1182.1"; tss_id "TSS1349"; +chr10 Cufflinks exon 35520259 35520322 . - . gene_id "XLOC_001350"; transcript_id "TCONS_00001350"; exon_number "1"; oId "CUFF.1184.1"; tss_id "TSS1350"; +chr10 Cufflinks exon 35525804 35525876 . - . gene_id "XLOC_001351"; transcript_id "TCONS_00001351"; exon_number "1"; oId "CUFF.1185.1"; tss_id "TSS1351"; +chr10 Cufflinks exon 35539888 35539964 . - . gene_id "XLOC_001352"; transcript_id "TCONS_00001352"; exon_number "1"; oId "CUFF.1186.1"; tss_id "TSS1352"; +chr10 Cufflinks exon 36707368 36707409 . - . gene_id "XLOC_001353"; transcript_id "TCONS_00001353"; exon_number "1"; oId "CUFF.1187.1"; tss_id "TSS1353"; +chr10 Cufflinks exon 37555507 37555543 . - . gene_id "XLOC_001354"; transcript_id "TCONS_00001354"; exon_number "1"; oId "CUFF.1190.1"; tss_id "TSS1354"; +chr10 Cufflinks exon 37890300 37890372 . - . gene_id "XLOC_001355"; transcript_id "TCONS_00001355"; exon_number "1"; oId "CUFF.1192.1"; tss_id "TSS1355"; +chr10 Cufflinks exon 37893299 37893340 . - . gene_id "XLOC_001356"; transcript_id "TCONS_00001356"; exon_number "1"; oId "CUFF.1193.1"; tss_id "TSS1356"; +chr10 Cufflinks exon 38332807 38332902 . - . gene_id "XLOC_001357"; transcript_id "TCONS_00001357"; exon_number "1"; oId "CUFF.1195.1"; tss_id "TSS1357"; +chr10 Cufflinks exon 38522133 38522206 . - . gene_id "XLOC_001358"; transcript_id "TCONS_00001358"; exon_number "1"; oId "CUFF.1196.1"; tss_id "TSS1358"; +chr10 Cufflinks exon 43305672 43305779 . - . gene_id "XLOC_001359"; transcript_id "TCONS_00001359"; exon_number "1"; oId "CUFF.1201.1"; tss_id "TSS1359"; +chr10 Cufflinks exon 43327899 43327995 . - . gene_id "XLOC_001360"; transcript_id "TCONS_00001360"; exon_number "1"; oId "CUFF.1202.1"; tss_id "TSS1360"; +chr10 Cufflinks exon 43912697 43912879 . - . gene_id "XLOC_001361"; transcript_id "TCONS_00001361"; exon_number "1"; oId "CUFF.1204.1"; tss_id "TSS1361"; +chr10 Cufflinks exon 44003423 44003495 . - . gene_id "XLOC_001362"; transcript_id "TCONS_00001362"; exon_number "1"; oId "CUFF.1208.1"; tss_id "TSS1362"; +chr10 Cufflinks exon 44446481 44446515 . - . gene_id "XLOC_001363"; transcript_id "TCONS_00001363"; exon_number "1"; oId "CUFF.1210.1"; tss_id "TSS1363"; +chr10 Cufflinks exon 44585112 44585164 . - . gene_id "XLOC_001364"; transcript_id "TCONS_00001364"; exon_number "1"; oId "CUFF.1211.1"; tss_id "TSS1364"; +chr10 Cufflinks exon 45684240 45684344 . - . gene_id "XLOC_001365"; transcript_id "TCONS_00001365"; exon_number "1"; oId "CUFF.1213.1"; tss_id "TSS1365"; +chr10 Cufflinks exon 46862108 46862142 . - . gene_id "XLOC_001366"; transcript_id "TCONS_00001366"; exon_number "1"; oId "CUFF.1218.1"; tss_id "TSS1366"; +chr10 Cufflinks exon 46900202 46900302 . - . gene_id "XLOC_001367"; transcript_id "TCONS_00001367"; exon_number "1"; oId "CUFF.1219.1"; tss_id "TSS1367"; +chr10 Cufflinks exon 46900453 46900668 . - . gene_id "XLOC_001368"; transcript_id "TCONS_00001368"; exon_number "1"; oId "CUFF.1220.1"; tss_id "TSS1368"; +chr10 Cufflinks exon 47342917 47342951 . - . gene_id "XLOC_001369"; transcript_id "TCONS_00001369"; exon_number "1"; oId "CUFF.1223.1"; tss_id "TSS1369"; +chr10 Cufflinks exon 47382280 47382380 . - . gene_id "XLOC_001370"; transcript_id "TCONS_00001370"; exon_number "1"; oId "CUFF.1224.1"; tss_id "TSS1370"; +chr10 Cufflinks exon 47382531 47382746 . - . gene_id "XLOC_001371"; transcript_id "TCONS_00001371"; exon_number "1"; oId "CUFF.1225.1"; tss_id "TSS1371"; +chr10 Cufflinks exon 47711194 47711267 . - . gene_id "XLOC_001372"; transcript_id "TCONS_00001372"; exon_number "1"; oId "CUFF.1226.1"; tss_id "TSS1372"; +chr10 Cufflinks exon 48206895 48207009 . - . gene_id "XLOC_001373"; transcript_id "TCONS_00001373"; exon_number "1"; oId "CUFF.1227.1"; tss_id "TSS1373"; +chr10 Cufflinks exon 48218574 48218647 . - . gene_id "XLOC_001374"; transcript_id "TCONS_00001374"; exon_number "1"; oId "CUFF.1228.1"; tss_id "TSS1374"; +chr10 Cufflinks exon 49051866 49051900 . - . gene_id "XLOC_001375"; transcript_id "TCONS_00001375"; exon_number "1"; oId "CUFF.1232.1"; tss_id "TSS1375"; +chr10 Cufflinks exon 49089952 49090052 . - . gene_id "XLOC_001376"; transcript_id "TCONS_00001376"; exon_number "1"; oId "CUFF.1233.1"; tss_id "TSS1376"; +chr10 Cufflinks exon 49090203 49090418 . - . gene_id "XLOC_001377"; transcript_id "TCONS_00001377"; exon_number "1"; oId "CUFF.1234.1"; tss_id "TSS1377"; +chr10 Cufflinks exon 50911037 50911419 . - . gene_id "XLOC_001378"; transcript_id "TCONS_00001378"; exon_number "1"; oId "CUFF.1238.1"; tss_id "TSS1378"; +chr10 Cufflinks exon 51739425 51739539 . - . gene_id "XLOC_001379"; transcript_id "TCONS_00001379"; exon_number "1"; oId "CUFF.1241.1"; tss_id "TSS1379"; +chr10 Cufflinks exon 51751215 51751288 . - . gene_id "XLOC_001380"; transcript_id "TCONS_00001380"; exon_number "1"; oId "CUFF.1242.1"; tss_id "TSS1380"; +chr10 Cufflinks exon 52345472 52345509 . - . gene_id "XLOC_001381"; transcript_id "TCONS_00001381"; exon_number "1"; oId "CUFF.1243.1"; tss_id "TSS1381"; +chr10 Cufflinks exon 52350412 52350463 . - . gene_id "XLOC_001382"; transcript_id "TCONS_00001382"; exon_number "1"; oId "CUFF.1244.1"; tss_id "TSS1382"; +chr10 Cufflinks exon 54760401 54760436 . - . gene_id "XLOC_001383"; transcript_id "TCONS_00001383"; exon_number "1"; oId "CUFF.1246.1"; tss_id "TSS1383"; +chr10 Cufflinks exon 55643223 55643351 . - . gene_id "XLOC_001384"; transcript_id "TCONS_00001384"; exon_number "1"; oId "CUFF.1248.1"; tss_id "TSS1384"; +chr10 Cufflinks exon 55654118 55654162 . - . gene_id "XLOC_001385"; transcript_id "TCONS_00001385"; exon_number "1"; oId "CUFF.1249.1"; tss_id "TSS1385"; +chr10 Cufflinks exon 56212207 56212272 . - . gene_id "XLOC_001386"; transcript_id "TCONS_00001386"; exon_number "1"; oId "CUFF.1251.1"; tss_id "TSS1386"; +chr10 Cufflinks exon 57291450 57291490 . - . gene_id "XLOC_001387"; transcript_id "TCONS_00001387"; exon_number "1"; oId "CUFF.1252.1"; tss_id "TSS1387"; +chr10 Cufflinks exon 57693609 57693662 . - . gene_id "XLOC_001388"; transcript_id "TCONS_00001388"; exon_number "1"; oId "CUFF.1255.1"; tss_id "TSS1388"; +chr10 Cufflinks exon 58801970 58802007 . - . gene_id "XLOC_001389"; transcript_id "TCONS_00001389"; exon_number "1"; oId "CUFF.1256.1"; tss_id "TSS1389"; +chr10 Cufflinks exon 59998420 59998522 . - . gene_id "XLOC_001390"; transcript_id "TCONS_00001390"; exon_number "1"; oId "CUFF.1258.1"; tss_id "TSS1390"; +chr10 Cufflinks exon 61447836 61448128 . - . gene_id "XLOC_001391"; transcript_id "TCONS_00001391"; exon_number "1"; oId "CUFF.1262.1"; tss_id "TSS1391"; +chr10 Cufflinks exon 62672629 62672685 . - . gene_id "XLOC_001392"; transcript_id "TCONS_00001392"; exon_number "1"; oId "CUFF.1265.1"; tss_id "TSS1392"; +chr10 Cufflinks exon 63226455 63226528 . - . gene_id "XLOC_001393"; transcript_id "TCONS_00001393"; exon_number "1"; oId "CUFF.1266.1"; tss_id "TSS1393"; +chr10 Cufflinks exon 64694921 64694973 . - . gene_id "XLOC_001394"; transcript_id "TCONS_00001394"; exon_number "1"; oId "CUFF.1270.1"; tss_id "TSS1394"; +chr10 Cufflinks exon 65535031 65535109 . - . gene_id "XLOC_001395"; transcript_id "TCONS_00001395"; exon_number "1"; oId "CUFF.1274.1"; tss_id "TSS1395"; +chr10 Cufflinks exon 66572203 66572244 . - . gene_id "XLOC_001396"; transcript_id "TCONS_00001396"; exon_number "1"; oId "CUFF.1277.1"; tss_id "TSS1396"; +chr10 Cufflinks exon 66785216 66785428 . - . gene_id "XLOC_001397"; transcript_id "TCONS_00001397"; exon_number "1"; oId "CUFF.1278.1"; tss_id "TSS1397"; +chr10 Cufflinks exon 68374992 68375097 . - . gene_id "XLOC_001398"; transcript_id "TCONS_00001398"; exon_number "1"; oId "CUFF.1279.1"; tss_id "TSS1398"; +chr10 Cufflinks exon 68805211 68805496 . - . gene_id "XLOC_001399"; transcript_id "TCONS_00001399"; exon_number "1"; oId "CUFF.1281.1"; tss_id "TSS1399"; +chr10 Cufflinks exon 69585047 69585352 . - . gene_id "XLOC_001400"; transcript_id "TCONS_00001400"; exon_number "1"; oId "CUFF.1286.1"; tss_id "TSS1400"; +chr10 Cufflinks exon 69618576 69618629 . - . gene_id "XLOC_001401"; transcript_id "TCONS_00001401"; exon_number "1"; oId "CUFF.1287.1"; tss_id "TSS1401"; +chr10 Cufflinks exon 69767460 69767774 . - . gene_id "XLOC_001402"; transcript_id "TCONS_00001402"; exon_number "1"; oId "CUFF.1288.1"; tss_id "TSS1402"; +chr10 Cufflinks exon 69980223 69980276 . - . gene_id "XLOC_001403"; transcript_id "TCONS_00001403"; exon_number "1"; oId "CUFF.1290.1"; tss_id "TSS1403"; +chr10 Cufflinks exon 70318709 70318743 . - . gene_id "XLOC_001404"; transcript_id "TCONS_00001404"; exon_number "1"; oId "CUFF.1292.1"; tss_id "TSS1404"; +chr10 Cufflinks exon 70401079 70401230 . - . gene_id "XLOC_001405"; transcript_id "TCONS_00001405"; exon_number "1"; oId "CUFF.1293.1"; tss_id "TSS1405"; +chr10 Cufflinks exon 70671412 70671515 . - . gene_id "XLOC_001406"; transcript_id "TCONS_00001406"; exon_number "1"; oId "CUFF.1298.1"; tss_id "TSS1406"; +chr10 Cufflinks exon 70681941 70682019 . - . gene_id "XLOC_001407"; transcript_id "TCONS_00001407"; exon_number "1"; oId "CUFF.1299.1"; tss_id "TSS1407"; +chr10 Cufflinks exon 70770155 70770289 . - . gene_id "XLOC_001408"; transcript_id "TCONS_00001408"; exon_number "1"; oId "CUFF.1300.1"; tss_id "TSS1408"; +chr10 Cufflinks exon 71212148 71212200 . - . gene_id "XLOC_001409"; transcript_id "TCONS_00001409"; exon_number "1"; oId "CUFF.1303.1"; tss_id "TSS1409"; +chr10 Cufflinks exon 71323212 71323247 . - . gene_id "XLOC_001410"; transcript_id "TCONS_00001410"; exon_number "1"; oId "CUFF.1304.1"; tss_id "TSS1410"; +chr10 Cufflinks exon 72130847 72130897 . - . gene_id "XLOC_001411"; transcript_id "TCONS_00001411"; exon_number "1"; oId "CUFF.1310.1"; tss_id "TSS1411"; +chr10 Cufflinks exon 72163005 72163140 . - . gene_id "XLOC_001412"; transcript_id "TCONS_00001412"; exon_number "1"; oId "CUFF.1311.1"; tss_id "TSS1412"; +chr10 Cufflinks exon 73604493 73604548 . - . gene_id "XLOC_001413"; transcript_id "TCONS_00001413"; exon_number "1"; oId "CUFF.1313.1"; tss_id "TSS1413"; +chr10 Cufflinks exon 74446071 74446183 . - . gene_id "XLOC_001414"; transcript_id "TCONS_00001414"; exon_number "1"; oId "CUFF.1318.1"; tss_id "TSS1414"; +chr10 Cufflinks exon 74732137 74732178 . - . gene_id "XLOC_001415"; transcript_id "TCONS_00001415"; exon_number "1"; oId "CUFF.1320.1"; tss_id "TSS1415"; +chr10 Cufflinks exon 74830269 74830390 . - . gene_id "XLOC_001416"; transcript_id "TCONS_00001416"; exon_number "1"; oId "CUFF.1321.1"; tss_id "TSS1416"; +chr10 Cufflinks exon 75061536 75061643 . - . gene_id "XLOC_001417"; transcript_id "TCONS_00001417"; exon_number "1"; oId "CUFF.1323.1"; tss_id "TSS1417"; +chr10 Cufflinks exon 75288809 75288915 . - . gene_id "XLOC_001418"; transcript_id "TCONS_00001418"; exon_number "1"; oId "CUFF.1325.1"; tss_id "TSS1418"; +chr10 Cufflinks exon 75354988 75355059 . - . gene_id "XLOC_001419"; transcript_id "TCONS_00001419"; exon_number "1"; oId "CUFF.1326.1"; tss_id "TSS1419"; +chr10 Cufflinks exon 77154272 77154309 . - . gene_id "XLOC_001420"; transcript_id "TCONS_00001420"; exon_number "1"; oId "CUFF.1333.1"; tss_id "TSS1420"; +chr10 Cufflinks exon 78001770 78002055 . - . gene_id "XLOC_001421"; transcript_id "TCONS_00001421"; exon_number "1"; oId "CUFF.1334.1"; tss_id "TSS1421"; +chr10 Cufflinks exon 78020558 78020660 . - . gene_id "XLOC_001422"; transcript_id "TCONS_00001422"; exon_number "1"; oId "CUFF.1335.1"; tss_id "TSS1422"; +chr10 Cufflinks exon 78616114 78616149 . - . gene_id "XLOC_001423"; transcript_id "TCONS_00001423"; exon_number "1"; oId "CUFF.1338.1"; tss_id "TSS1423"; +chr10 Cufflinks exon 79536710 79536813 . - . gene_id "XLOC_001424"; transcript_id "TCONS_00001424"; exon_number "1"; oId "CUFF.1340.1"; tss_id "TSS1424"; +chr10 Cufflinks exon 79672016 79672301 . - . gene_id "XLOC_001425"; transcript_id "TCONS_00001425"; exon_number "1"; oId "CUFF.1341.1"; tss_id "TSS1425"; +chr10 Cufflinks exon 79729672 79729756 . - . gene_id "XLOC_001426"; transcript_id "TCONS_00001426"; exon_number "1"; oId "CUFF.1344.1"; tss_id "TSS1426"; +chr10 Cufflinks exon 84827718 84827826 . - . gene_id "XLOC_001427"; transcript_id "TCONS_00001427"; exon_number "1"; oId "CUFF.1346.1"; tss_id "TSS1427"; +chr10 Cufflinks exon 86633051 86633083 . - . gene_id "XLOC_001428"; transcript_id "TCONS_00001428"; exon_number "1"; oId "CUFF.1351.1"; tss_id "TSS1428"; +chr10 Cufflinks exon 86948448 86948503 . - . gene_id "XLOC_001429"; transcript_id "TCONS_00001429"; exon_number "1"; oId "CUFF.1352.1"; tss_id "TSS1429"; +chr10 Cufflinks exon 87334499 87334546 . - . gene_id "XLOC_001430"; transcript_id "TCONS_00001430"; exon_number "1"; oId "CUFF.1355.1"; tss_id "TSS1430"; +chr10 Cufflinks exon 87409870 87410008 . - . gene_id "XLOC_001431"; transcript_id "TCONS_00001431"; exon_number "1"; oId "CUFF.1356.1"; tss_id "TSS1431"; +chr10 Cufflinks exon 88505630 88505706 . - . gene_id "XLOC_001432"; transcript_id "TCONS_00001432"; exon_number "1"; oId "CUFF.1360.1"; tss_id "TSS1432"; +chr10 Cufflinks exon 88800997 88801097 . - . gene_id "XLOC_001433"; transcript_id "TCONS_00001433"; exon_number "1"; oId "CUFF.1363.1"; tss_id "TSS1433"; +chr10 Cufflinks exon 88874066 88874101 . - . gene_id "XLOC_001434"; transcript_id "TCONS_00001434"; exon_number "1"; oId "CUFF.1365.1"; tss_id "TSS1434"; +chr10 Cufflinks exon 88913659 88913759 . - . gene_id "XLOC_001435"; transcript_id "TCONS_00001435"; exon_number "1"; oId "CUFF.1366.1"; tss_id "TSS1435"; +chr10 Cufflinks exon 88913910 88914125 . - . gene_id "XLOC_001436"; transcript_id "TCONS_00001436"; exon_number "1"; oId "CUFF.1367.1"; tss_id "TSS1436"; +chr10 Cufflinks exon 89414173 89414274 . - . gene_id "XLOC_001437"; transcript_id "TCONS_00001437"; exon_number "1"; oId "CUFF.1368.1"; tss_id "TSS1437"; +chr10 Cufflinks exon 89592561 89592843 . - . gene_id "XLOC_001438"; transcript_id "TCONS_00001438"; exon_number "1"; oId "CUFF.1369.1"; tss_id "TSS1438"; +chr10 Cufflinks exon 90820785 90820889 . - . gene_id "XLOC_001439"; transcript_id "TCONS_00001439"; exon_number "1"; oId "CUFF.1370.1"; tss_id "TSS1439"; +chr10 Cufflinks exon 91923461 91923717 . - . gene_id "XLOC_001440"; transcript_id "TCONS_00001440"; exon_number "1"; oId "CUFF.1372.1"; tss_id "TSS1440"; +chr10 Cufflinks exon 92445899 92445940 . - . gene_id "XLOC_001441"; transcript_id "TCONS_00001441"; exon_number "1"; oId "CUFF.1374.1"; tss_id "TSS1441"; +chr10 Cufflinks exon 92682492 92682593 . - . gene_id "XLOC_001442"; transcript_id "TCONS_00001442"; exon_number "1"; oId "CUFF.1375.1"; tss_id "TSS1442"; +chr10 Cufflinks exon 92759320 92759358 . - . gene_id "XLOC_001443"; transcript_id "TCONS_00001443"; exon_number "1"; oId "CUFF.1376.1"; tss_id "TSS1443"; +chr10 Cufflinks exon 93339521 93339598 . - . gene_id "XLOC_001444"; transcript_id "TCONS_00001444"; exon_number "1"; oId "CUFF.1377.1"; tss_id "TSS1444"; +chr10 Cufflinks exon 93697804 93697839 . - . gene_id "XLOC_001445"; transcript_id "TCONS_00001445"; exon_number "1"; oId "CUFF.1378.1"; tss_id "TSS1445"; +chr10 Cufflinks exon 94420235 94420299 . - . gene_id "XLOC_001446"; transcript_id "TCONS_00001446"; exon_number "1"; oId "CUFF.1379.1"; tss_id "TSS1446"; +chr10 Cufflinks exon 94853015 94853073 . - . gene_id "XLOC_001447"; transcript_id "TCONS_00001447"; exon_number "1"; oId "CUFF.1381.1"; tss_id "TSS1447"; +chr10 Cufflinks exon 95270348 95270437 . - . gene_id "XLOC_001448"; transcript_id "TCONS_00001448"; exon_number "1"; oId "CUFF.1383.1"; tss_id "TSS1448"; +chr10 Cufflinks exon 95707851 95707887 . - . gene_id "XLOC_001449"; transcript_id "TCONS_00001449"; exon_number "1"; oId "CUFF.1384.1"; tss_id "TSS1449"; +chr10 Cufflinks exon 95915396 95915502 . - . gene_id "XLOC_001450"; transcript_id "TCONS_00001450"; exon_number "1"; oId "CUFF.1386.1"; tss_id "TSS1450"; +chr10 Cufflinks exon 97252272 97252311 . - . gene_id "XLOC_001451"; transcript_id "TCONS_00001451"; exon_number "1"; oId "CUFF.1389.1"; tss_id "TSS1451"; +chr10 Cufflinks exon 97887640 97887699 . - . gene_id "XLOC_001452"; transcript_id "TCONS_00001452"; exon_number "1"; oId "CUFF.1393.1"; tss_id "TSS1452"; +chr10 Cufflinks exon 98319094 98319132 . - . gene_id "XLOC_001453"; transcript_id "TCONS_00001453"; exon_number "1"; oId "CUFF.1395.1"; tss_id "TSS1453"; +chr10 Cufflinks exon 99497761 99497796 . - . gene_id "XLOC_001454"; transcript_id "TCONS_00001454"; exon_number "1"; oId "CUFF.1401.1"; tss_id "TSS1454"; +chr10 Cufflinks exon 101329616 101329676 . - . gene_id "XLOC_001455"; transcript_id "TCONS_00001455"; exon_number "1"; oId "CUFF.1406.1"; tss_id "TSS1455"; +chr10 Cufflinks exon 101358198 101358324 . - . gene_id "XLOC_001456"; transcript_id "TCONS_00001456"; exon_number "1"; oId "CUFF.1407.1"; tss_id "TSS1456"; +chr10 Cufflinks exon 103124607 103124792 . - . gene_id "XLOC_001457"; transcript_id "TCONS_00001457"; exon_number "1"; oId "CUFF.1416.1"; tss_id "TSS1457"; +chr10 Cufflinks exon 103131607 103131710 . - . gene_id "XLOC_001458"; transcript_id "TCONS_00001458"; exon_number "1"; oId "CUFF.1417.1"; tss_id "TSS1458"; +chr10 Cufflinks exon 104730364 104730505 . - . gene_id "XLOC_001459"; transcript_id "TCONS_00001459"; exon_number "1"; oId "CUFF.1424.1"; tss_id "TSS1459"; +chr10 Cufflinks exon 104744769 104744804 . - . gene_id "XLOC_001460"; transcript_id "TCONS_00001460"; exon_number "1"; oId "CUFF.1425.1"; tss_id "TSS1460"; +chr10 Cufflinks exon 105686034 105686084 . - . gene_id "XLOC_001461"; transcript_id "TCONS_00001461"; exon_number "1"; oId "CUFF.1427.1"; tss_id "TSS1461"; +chr10 Cufflinks exon 110700831 110701068 . - . gene_id "XLOC_001462"; transcript_id "TCONS_00001462"; exon_number "1"; oId "CUFF.1436.1"; tss_id "TSS1462"; +chr10 Cufflinks exon 110944688 110944765 . - . gene_id "XLOC_001463"; transcript_id "TCONS_00001463"; exon_number "1"; oId "CUFF.1438.1"; tss_id "TSS1463"; +chr10 Cufflinks exon 111785734 111785834 . - . gene_id "XLOC_001464"; transcript_id "TCONS_00001464"; exon_number "1"; oId "CUFF.1441.1"; tss_id "TSS1464"; +chr10 Cufflinks exon 112778896 112778929 . - . gene_id "XLOC_001465"; transcript_id "TCONS_00001465"; exon_number "1"; oId "CUFF.1445.1"; tss_id "TSS1465"; +chr10 Cufflinks exon 112781295 112781424 . - . gene_id "XLOC_001466"; transcript_id "TCONS_00001466"; exon_number "1"; oId "CUFF.1446.1"; tss_id "TSS1466"; +chr10 Cufflinks exon 115119791 115119825 . - . gene_id "XLOC_001467"; transcript_id "TCONS_00001467"; exon_number "1"; oId "CUFF.1449.1"; tss_id "TSS1467"; +chr10 Cufflinks exon 116183517 116183826 . - . gene_id "XLOC_001468"; transcript_id "TCONS_00001468"; exon_number "1"; oId "CUFF.1450.1"; tss_id "TSS1468"; +chr10 Cufflinks exon 116414081 116414132 . - . gene_id "XLOC_001469"; transcript_id "TCONS_00001469"; exon_number "1"; oId "CUFF.1451.1"; tss_id "TSS1469"; +chr10 Cufflinks exon 116729220 116729274 . - . gene_id "XLOC_001470"; transcript_id "TCONS_00001470"; exon_number "1"; oId "CUFF.1453.1"; tss_id "TSS1470"; +chr10 Cufflinks exon 116826499 116826531 . - . gene_id "XLOC_001471"; transcript_id "TCONS_00001471"; exon_number "1"; oId "CUFF.1454.1"; tss_id "TSS1471"; +chr10 Cufflinks exon 119631836 119631884 . - . gene_id "XLOC_001472"; transcript_id "TCONS_00001472"; exon_number "1"; oId "CUFF.1456.1"; tss_id "TSS1472"; +chr10 Cufflinks exon 119964560 119964677 . - . gene_id "XLOC_001473"; transcript_id "TCONS_00001473"; exon_number "1"; oId "CUFF.1457.1"; tss_id "TSS1473"; +chr10 Cufflinks exon 120050214 120050254 . - . gene_id "XLOC_001474"; transcript_id "TCONS_00001474"; exon_number "1"; oId "CUFF.1458.1"; tss_id "TSS1474"; +chr10 Cufflinks exon 120545401 120545475 . - . gene_id "XLOC_001475"; transcript_id "TCONS_00001475"; exon_number "1"; oId "CUFF.1461.1"; tss_id "TSS1475"; +chr10 Cufflinks exon 123506506 123506665 . - . gene_id "XLOC_001476"; transcript_id "TCONS_00001476"; exon_number "1"; oId "CUFF.1467.1"; tss_id "TSS1476"; +chr10 Cufflinks exon 125664631 125664667 . - . gene_id "XLOC_001477"; transcript_id "TCONS_00001477"; exon_number "1"; oId "CUFF.1471.1"; tss_id "TSS1477"; +chr10 Cufflinks exon 127311181 127311235 . - . gene_id "XLOC_001478"; transcript_id "TCONS_00001478"; exon_number "1"; oId "CUFF.1473.1"; tss_id "TSS1478"; +chr10 Cufflinks exon 127544445 127544481 . - . gene_id "XLOC_001479"; transcript_id "TCONS_00001479"; exon_number "1"; oId "CUFF.1474.1"; tss_id "TSS1479"; +chr10 Cufflinks exon 127579188 127579247 . - . gene_id "XLOC_001480"; transcript_id "TCONS_00001480"; exon_number "1"; oId "CUFF.1475.1"; tss_id "TSS1480"; +chr10 Cufflinks exon 127834062 127834151 . - . gene_id "XLOC_001481"; transcript_id "TCONS_00001481"; exon_number "1"; oId "CUFF.1476.1"; tss_id "TSS1481"; +chr10 Cufflinks exon 131929394 131929445 . - . gene_id "XLOC_001482"; transcript_id "TCONS_00001482"; exon_number "1"; oId "CUFF.1480.1"; tss_id "TSS1482"; +chr10 Cufflinks exon 133158960 133158991 . - . gene_id "XLOC_001483"; transcript_id "TCONS_00001483"; exon_number "1"; oId "CUFF.1481.1"; tss_id "TSS1483"; +chr10 Cufflinks exon 133990083 133990119 . - . gene_id "XLOC_001484"; transcript_id "TCONS_00001484"; exon_number "1"; oId "CUFF.1482.1"; tss_id "TSS1484"; +chr11 Cufflinks exon 948422 948519 . + . gene_id "XLOC_001485"; transcript_id "TCONS_00001485"; exon_number "1"; oId "CUFF.1488.1"; tss_id "TSS1485"; +chr11 Cufflinks exon 2342948 2343057 . + . gene_id "XLOC_001486"; transcript_id "TCONS_00001486"; exon_number "1"; oId "CUFF.1489.1"; tss_id "TSS1486"; +chr11 Cufflinks exon 3713277 3713378 . + . gene_id "XLOC_001487"; transcript_id "TCONS_00001487"; exon_number "1"; oId "CUFF.1492.1"; tss_id "TSS1487"; +chr11 Cufflinks exon 3802625 3802682 . + . gene_id "XLOC_001488"; transcript_id "TCONS_00001488"; exon_number "1"; oId "CUFF.1494.1"; tss_id "TSS1488"; +chr11 Cufflinks exon 5599597 5599632 . + . gene_id "XLOC_001489"; transcript_id "TCONS_00001489"; exon_number "1"; oId "CUFF.1496.1"; tss_id "TSS1489"; +chr11 Cufflinks exon 6038226 6038342 . + . gene_id "XLOC_001490"; transcript_id "TCONS_00001490"; exon_number "1"; oId "CUFF.1498.1"; tss_id "TSS1490"; +chr11 Cufflinks exon 7721505 7721550 . + . gene_id "XLOC_001491"; transcript_id "TCONS_00001491"; exon_number "1"; oId "CUFF.1499.1"; tss_id "TSS1491"; +chr11 Cufflinks exon 8143495 8143565 . + . gene_id "XLOC_001492"; transcript_id "TCONS_00001492"; exon_number "1"; oId "CUFF.1501.1"; tss_id "TSS1492"; +chr11 Cufflinks exon 9230779 9230821 . + . gene_id "XLOC_001493"; transcript_id "TCONS_00001493"; exon_number "1"; oId "CUFF.1503.1"; tss_id "TSS1493"; +chr11 Cufflinks exon 9296790 9296863 . + . gene_id "XLOC_001494"; transcript_id "TCONS_00001494"; exon_number "1"; oId "CUFF.1504.1"; tss_id "TSS1494"; +chr11 Cufflinks exon 9599578 9599681 . + . gene_id "XLOC_001495"; transcript_id "TCONS_00001495"; exon_number "1"; oId "CUFF.1506.1"; tss_id "TSS1495"; +chr11 Cufflinks exon 9602453 9602788 . + . gene_id "XLOC_001496"; transcript_id "TCONS_00001496"; exon_number "1"; oId "CUFF.1507.1"; tss_id "TSS1496"; +chr11 Cufflinks exon 9702471 9702730 . + . gene_id "XLOC_001497"; transcript_id "TCONS_00001497"; exon_number "1"; oId "CUFF.1508.1"; tss_id "TSS1497"; +chr11 Cufflinks exon 11007043 11007123 . + . gene_id "XLOC_001498"; transcript_id "TCONS_00001498"; exon_number "1"; oId "CUFF.1513.1"; tss_id "TSS1498"; +chr11 Cufflinks exon 11532111 11532147 . + . gene_id "XLOC_001499"; transcript_id "TCONS_00001499"; exon_number "1"; oId "CUFF.1514.1"; tss_id "TSS1499"; +chr11 Cufflinks exon 12348971 12349005 . + . gene_id "XLOC_001500"; transcript_id "TCONS_00001500"; exon_number "1"; oId "CUFF.1517.1"; tss_id "TSS1500"; +chr11 Cufflinks exon 12809472 12809509 . + . gene_id "XLOC_001501"; transcript_id "TCONS_00001501"; exon_number "1"; oId "CUFF.1518.1"; tss_id "TSS1501"; +chr11 Cufflinks exon 13285471 13285642 . + . gene_id "XLOC_001502"; transcript_id "TCONS_00001502"; exon_number "1"; oId "CUFF.1520.1"; tss_id "TSS1502"; +chr11 Cufflinks exon 13374755 13374997 . + . gene_id "XLOC_001503"; transcript_id "TCONS_00001503"; exon_number "1"; oId "CUFF.1521.1"; tss_id "TSS1503"; +chr11 Cufflinks exon 13453211 13453268 . + . gene_id "XLOC_001504"; transcript_id "TCONS_00001504"; exon_number "1"; oId "CUFF.1522.1"; tss_id "TSS1504"; +chr11 Cufflinks exon 13639651 13639737 . + . gene_id "XLOC_001505"; transcript_id "TCONS_00001505"; exon_number "1"; oId "CUFF.1523.1"; tss_id "TSS1505"; +chr11 Cufflinks exon 14156532 14156626 . + . gene_id "XLOC_001506"; transcript_id "TCONS_00001506"; exon_number "1"; oId "CUFF.1526.1"; tss_id "TSS1506"; +chr11 Cufflinks exon 14500439 14500497 . + . gene_id "XLOC_001507"; transcript_id "TCONS_00001507"; exon_number "1"; oId "CUFF.1528.1"; tss_id "TSS1507"; +chr11 Cufflinks exon 15266857 15266899 . + . gene_id "XLOC_001508"; transcript_id "TCONS_00001508"; exon_number "1"; oId "CUFF.1529.1"; tss_id "TSS1508"; +chr11 Cufflinks exon 16590981 16591018 . + . gene_id "XLOC_001509"; transcript_id "TCONS_00001509"; exon_number "1"; oId "CUFF.1531.1"; tss_id "TSS1509"; +chr11 Cufflinks exon 16598399 16598627 . + . gene_id "XLOC_001510"; transcript_id "TCONS_00001510"; exon_number "1"; oId "CUFF.1532.1"; tss_id "TSS1510"; +chr11 Cufflinks exon 16766673 16766746 . + . gene_id "XLOC_001511"; transcript_id "TCONS_00001511"; exon_number "1"; oId "CUFF.1534.1"; tss_id "TSS1511"; +chr11 Cufflinks exon 16863800 16864037 . + . gene_id "XLOC_001512"; transcript_id "TCONS_00001512"; exon_number "1"; oId "CUFF.1535.1"; tss_id "TSS1512"; +chr11 Cufflinks exon 17006887 17006921 . + . gene_id "XLOC_001513"; transcript_id "TCONS_00001513"; exon_number "1"; oId "CUFF.1537.1"; tss_id "TSS1513"; +chr11 Cufflinks exon 17272944 17272979 . + . gene_id "XLOC_001514"; transcript_id "TCONS_00001514"; exon_number "1"; oId "CUFF.1541.1"; tss_id "TSS1514"; +chr11 Cufflinks exon 18074689 18074723 . + . gene_id "XLOC_001515"; transcript_id "TCONS_00001515"; exon_number "1"; oId "CUFF.1545.1"; tss_id "TSS1515"; +chr11 Cufflinks exon 18287943 18288059 . + . gene_id "XLOC_001516"; transcript_id "TCONS_00001516"; exon_number "1"; oId "CUFF.1547.1"; tss_id "TSS1516"; +chr11 Cufflinks exon 21175203 21175236 . + . gene_id "XLOC_001517"; transcript_id "TCONS_00001517"; exon_number "1"; oId "CUFF.1553.1"; tss_id "TSS1517"; +chr11 Cufflinks exon 22195519 22195561 . + . gene_id "XLOC_001518"; transcript_id "TCONS_00001518"; exon_number "1"; oId "CUFF.1556.1"; tss_id "TSS1518"; +chr11 Cufflinks exon 22502385 22502526 . + . gene_id "XLOC_001519"; transcript_id "TCONS_00001519"; exon_number "1"; oId "CUFF.1558.1"; tss_id "TSS1519"; +chr11 Cufflinks exon 22709897 22709986 . + . gene_id "XLOC_001520"; transcript_id "TCONS_00001520"; exon_number "1"; oId "CUFF.1559.1"; tss_id "TSS1520"; +chr11 Cufflinks exon 23871321 23871424 . + . gene_id "XLOC_001521"; transcript_id "TCONS_00001521"; exon_number "1"; oId "CUFF.1560.1"; tss_id "TSS1521"; +chr11 Cufflinks exon 29053259 29053297 . + . gene_id "XLOC_001522"; transcript_id "TCONS_00001522"; exon_number "1"; oId "CUFF.1564.1"; tss_id "TSS1522"; +chr11 Cufflinks exon 29902064 29902135 . + . gene_id "XLOC_001523"; transcript_id "TCONS_00001523"; exon_number "1"; oId "CUFF.1566.1"; tss_id "TSS1523"; +chr11 Cufflinks exon 30348687 30348741 . + . gene_id "XLOC_001524"; transcript_id "TCONS_00001524"; exon_number "1"; oId "CUFF.1567.1"; tss_id "TSS1524"; +chr11 Cufflinks exon 31857187 31857310 . + . gene_id "XLOC_001525"; transcript_id "TCONS_00001525"; exon_number "1"; oId "CUFF.1569.1"; tss_id "TSS1525"; +chr11 Cufflinks exon 32103310 32103519 . + . gene_id "XLOC_001526"; transcript_id "TCONS_00001526"; exon_number "1"; oId "CUFF.1571.1"; tss_id "TSS1526"; +chr11 Cufflinks exon 32185732 32185772 . + . gene_id "XLOC_001527"; transcript_id "TCONS_00001527"; exon_number "1"; oId "CUFF.1573.1"; tss_id "TSS1527"; +chr11 Cufflinks exon 32670420 32670458 . + . gene_id "XLOC_001528"; transcript_id "TCONS_00001528"; exon_number "1"; oId "CUFF.1574.1"; tss_id "TSS1528"; +chr11 Cufflinks exon 35001077 35001114 . + . gene_id "XLOC_001529"; transcript_id "TCONS_00001529"; exon_number "1"; oId "CUFF.1578.1"; tss_id "TSS1529"; +chr11 Cufflinks exon 35428703 35428841 . + . gene_id "XLOC_001530"; transcript_id "TCONS_00001530"; exon_number "1"; oId "CUFF.1580.1"; tss_id "TSS1530"; +chr11 Cufflinks exon 36024701 36024789 . + . gene_id "XLOC_001531"; transcript_id "TCONS_00001531"; exon_number "1"; oId "CUFF.1582.1"; tss_id "TSS1531"; +chr11 Cufflinks exon 36829213 36829328 . + . gene_id "XLOC_001532"; transcript_id "TCONS_00001532"; exon_number "1"; oId "CUFF.1583.1"; tss_id "TSS1532"; +chr11 Cufflinks exon 38785183 38785223 . + . gene_id "XLOC_001533"; transcript_id "TCONS_00001533"; exon_number "1"; oId "CUFF.1584.1"; tss_id "TSS1533"; +chr11 Cufflinks exon 39282658 39282762 . + . gene_id "XLOC_001534"; transcript_id "TCONS_00001534"; exon_number "1"; oId "CUFF.1585.1"; tss_id "TSS1534"; +chr11 Cufflinks exon 39845095 39845168 . + . gene_id "XLOC_001535"; transcript_id "TCONS_00001535"; exon_number "1"; oId "CUFF.1587.1"; tss_id "TSS1535"; +chr11 Cufflinks exon 40282769 40282799 . + . gene_id "XLOC_001536"; transcript_id "TCONS_00001536"; exon_number "1"; oId "CUFF.1588.1"; tss_id "TSS1536"; +chr11 Cufflinks exon 41810778 41810846 . + . gene_id "XLOC_001537"; transcript_id "TCONS_00001537"; exon_number "1"; oId "CUFF.1592.1"; tss_id "TSS1537"; +chr11 Cufflinks exon 44144592 44144798 . + . gene_id "XLOC_001538"; transcript_id "TCONS_00001538"; exon_number "1"; oId "CUFF.1597.1"; tss_id "TSS1538"; +chr11 Cufflinks exon 46235331 46235372 . + . gene_id "XLOC_001539"; transcript_id "TCONS_00001539"; exon_number "1"; oId "CUFF.1600.1"; tss_id "TSS1539"; +chr11 Cufflinks exon 47374510 47374575 . + . gene_id "XLOC_001540"; transcript_id "TCONS_00001540"; exon_number "1"; oId "CUFF.1604.1"; tss_id "TSS1540"; +chr11 Cufflinks exon 47749101 47749192 . + . gene_id "XLOC_001541"; transcript_id "TCONS_00001541"; exon_number "1"; oId "CUFF.1608.1"; tss_id "TSS1541"; +chr11 Cufflinks exon 47820460 47820510 . + . gene_id "XLOC_001542"; transcript_id "TCONS_00001542"; exon_number "1"; oId "CUFF.1609.1"; tss_id "TSS1542"; +chr11 Cufflinks exon 48499424 48499498 . + . gene_id "XLOC_001543"; transcript_id "TCONS_00001543"; exon_number "1"; oId "CUFF.1613.1"; tss_id "TSS1543"; +chr11 Cufflinks exon 49244063 49244119 . + . gene_id "XLOC_001544"; transcript_id "TCONS_00001544"; exon_number "1"; oId "CUFF.1615.1"; tss_id "TSS1544"; +chr11 Cufflinks exon 51359902 51359975 . + . gene_id "XLOC_001545"; transcript_id "TCONS_00001545"; exon_number "1"; oId "CUFF.1620.1"; tss_id "TSS1545"; +chr11 Cufflinks exon 56578509 56578558 . + . gene_id "XLOC_001546"; transcript_id "TCONS_00001546"; exon_number "1"; oId "CUFF.1622.1"; tss_id "TSS1546"; +chr11 Cufflinks exon 57217656 57217742 . + . gene_id "XLOC_001547"; transcript_id "TCONS_00001547"; exon_number "1"; oId "CUFF.1624.1"; tss_id "TSS1547"; +chr11 Cufflinks exon 57219165 57219400 . + . gene_id "XLOC_001548"; transcript_id "TCONS_00001548"; exon_number "1"; oId "CUFF.1625.1"; tss_id "TSS1548"; +chr11 Cufflinks exon 57391060 57391154 . + . gene_id "XLOC_001549"; transcript_id "TCONS_00001549"; exon_number "1"; oId "CUFF.1627.1"; tss_id "TSS1549"; +chr11 Cufflinks exon 59266429 59266534 . + . gene_id "XLOC_001550"; transcript_id "TCONS_00001550"; exon_number "1"; oId "CUFF.1634.1"; tss_id "TSS1550"; +chr11 Cufflinks exon 59318767 59318853 . + . gene_id "XLOC_001551"; transcript_id "TCONS_00001551"; exon_number "1"; oId "CUFF.1637.1"; tss_id "TSS1551"; +chr11 Cufflinks exon 59319228 59319310 . + . gene_id "XLOC_001552"; transcript_id "TCONS_00001552"; exon_number "1"; oId "CUFF.1638.1"; tss_id "TSS1552"; +chr11 Cufflinks exon 59323902 59323974 . + . gene_id "XLOC_001553"; transcript_id "TCONS_00001553"; exon_number "1"; oId "CUFF.1639.1"; tss_id "TSS1553"; +chr11 Cufflinks exon 59326274 59326328 . + . gene_id "XLOC_001554"; transcript_id "TCONS_00001554"; exon_number "1"; oId "CUFF.1642.1"; tss_id "TSS1554"; +chr11 Cufflinks exon 59384954 59385013 . + . gene_id "XLOC_001555"; transcript_id "TCONS_00001555"; exon_number "1"; oId "CUFF.1645.1"; tss_id "TSS1555"; +chr11 Cufflinks exon 60254424 60254459 . + . gene_id "XLOC_001556"; transcript_id "TCONS_00001556"; exon_number "1"; oId "CUFF.1647.1"; tss_id "TSS1556"; +chr11 Cufflinks exon 60361858 60361900 . + . gene_id "XLOC_001557"; transcript_id "TCONS_00001557"; exon_number "1"; oId "CUFF.1648.1"; tss_id "TSS1557"; +chr11 Cufflinks exon 61211612 61211884 . + . gene_id "XLOC_001558"; transcript_id "TCONS_00001558"; exon_number "1"; oId "CUFF.1650.1"; tss_id "TSS1558"; +chr11 Cufflinks exon 61705366 61705466 . + . gene_id "XLOC_001559"; transcript_id "TCONS_00001559"; exon_number "1"; oId "CUFF.1651.1"; tss_id "TSS1559"; +chr11 Cufflinks exon 62236163 62236278 . + . gene_id "XLOC_001560"; transcript_id "TCONS_00001560"; exon_number "1"; oId "CUFF.1652.1"; tss_id "TSS1560"; +chr11 Cufflinks exon 62360191 62360221 . + . gene_id "XLOC_001561"; transcript_id "TCONS_00001561"; exon_number "1"; oId "CUFF.1653.1"; tss_id "TSS1561"; +chr11 Cufflinks exon 62535239 62535313 . + . gene_id "XLOC_001562"; transcript_id "TCONS_00001562"; exon_number "1"; oId "CUFF.1655.1"; tss_id "TSS1562"; +chr11 Cufflinks exon 62634173 62634346 . + . gene_id "XLOC_001563"; transcript_id "TCONS_00001563"; exon_number "1"; oId "CUFF.1658.1"; tss_id "TSS1563"; +chr11 Cufflinks exon 62641709 62641798 . + . gene_id "XLOC_001564"; transcript_id "TCONS_00001564"; exon_number "1"; oId "CUFF.1659.1"; tss_id "TSS1564"; +chr11 Cufflinks exon 63254986 63255029 . + . gene_id "XLOC_001565"; transcript_id "TCONS_00001565"; exon_number "1"; oId "CUFF.1661.1"; tss_id "TSS1565"; +chr11 Cufflinks exon 63345090 63345124 . + . gene_id "XLOC_001566"; transcript_id "TCONS_00001566"; exon_number "1"; oId "CUFF.1662.1"; tss_id "TSS1566"; +chr11 Cufflinks exon 63345196 63345230 . + . gene_id "XLOC_001567"; transcript_id "TCONS_00001567"; exon_number "1"; oId "CUFF.1663.1"; tss_id "TSS1567"; +chr11 Cufflinks exon 63661767 63661835 . + . gene_id "XLOC_001568"; transcript_id "TCONS_00001568"; exon_number "1"; oId "CUFF.1667.1"; tss_id "TSS1568"; +chr11 Cufflinks exon 63737942 63738048 . + . gene_id "XLOC_001569"; transcript_id "TCONS_00001569"; exon_number "1"; oId "CUFF.1668.1"; tss_id "TSS1569"; +chr11 Cufflinks exon 64915060 64915245 . + . gene_id "XLOC_001570"; transcript_id "TCONS_00001570"; exon_number "1"; oId "CUFF.1671.1"; tss_id "TSS1570"; +chr11 Cufflinks exon 65463006 65463317 . + . gene_id "XLOC_001571"; transcript_id "TCONS_00001571"; exon_number "1"; oId "CUFF.1673.1"; tss_id "TSS1571"; +chr11 Cufflinks exon 65820614 65820702 . + . gene_id "XLOC_001572"; transcript_id "TCONS_00001572"; exon_number "1"; oId "CUFF.1674.1"; tss_id "TSS1572"; +chr11 Cufflinks exon 65920091 65920194 . + . gene_id "XLOC_001573"; transcript_id "TCONS_00001573"; exon_number "1"; oId "CUFF.1675.1"; tss_id "TSS1573"; +chr11 Cufflinks exon 66115591 66115672 . + . gene_id "XLOC_001574"; transcript_id "TCONS_00001574"; exon_number "1"; oId "CUFF.1676.1"; tss_id "TSS1574"; +chr11 Cufflinks exon 66160922 66161083 . + . gene_id "XLOC_001575"; transcript_id "TCONS_00001575"; exon_number "1"; oId "CUFF.1677.1"; tss_id "TSS1575"; +chr11 Cufflinks exon 66344461 66344497 . + . gene_id "XLOC_001576"; transcript_id "TCONS_00001576"; exon_number "1"; oId "CUFF.1679.1"; tss_id "TSS1576"; +chr11 Cufflinks exon 66687234 66687293 . + . gene_id "XLOC_001577"; transcript_id "TCONS_00001577"; exon_number "1"; oId "CUFF.1681.1"; tss_id "TSS1577"; +chr11 Cufflinks exon 66934049 66934265 . + . gene_id "XLOC_001578"; transcript_id "TCONS_00001578"; exon_number "1"; oId "CUFF.1683.1"; tss_id "TSS1578"; +chr11 Cufflinks exon 66988378 66988486 . + . gene_id "XLOC_001579"; transcript_id "TCONS_00001579"; exon_number "1"; oId "CUFF.1684.1"; tss_id "TSS1579"; +chr11 Cufflinks exon 67129885 67130127 . + . gene_id "XLOC_001580"; transcript_id "TCONS_00001580"; exon_number "1"; oId "CUFF.1685.1"; tss_id "TSS1580"; +chr11 Cufflinks exon 67330972 67331038 . + . gene_id "XLOC_001581"; transcript_id "TCONS_00001581"; exon_number "1"; oId "CUFF.1687.1"; tss_id "TSS1581"; +chr11 Cufflinks exon 67663102 67663208 . + . gene_id "XLOC_001582"; transcript_id "TCONS_00001582"; exon_number "1"; oId "CUFF.1688.1"; tss_id "TSS1582"; +chr11 Cufflinks exon 68571597 68571685 . + . gene_id "XLOC_001583"; transcript_id "TCONS_00001583"; exon_number "1"; oId "CUFF.1691.1"; tss_id "TSS1583"; +chr11 Cufflinks exon 69921469 69921573 . + . gene_id "XLOC_001584"; transcript_id "TCONS_00001584"; exon_number "1"; oId "CUFF.1692.1"; tss_id "TSS1584"; +chr11 Cufflinks exon 71815119 71815219 . + . gene_id "XLOC_001585"; transcript_id "TCONS_00001585"; exon_number "1"; oId "CUFF.1695.1"; tss_id "TSS1585"; +chr11 Cufflinks exon 72332814 72332870 . + . gene_id "XLOC_001586"; transcript_id "TCONS_00001586"; exon_number "1"; oId "CUFF.1696.1"; tss_id "TSS1586"; +chr11 Cufflinks exon 72913400 72913516 . + . gene_id "XLOC_001587"; transcript_id "TCONS_00001587"; exon_number "1"; oId "CUFF.1699.1"; tss_id "TSS1587"; +chr11 Cufflinks exon 73130221 73130307 . + . gene_id "XLOC_001588"; transcript_id "TCONS_00001588"; exon_number "1"; oId "CUFF.1700.1"; tss_id "TSS1588"; +chr11 Cufflinks exon 73217390 73217426 . + . gene_id "XLOC_001589"; transcript_id "TCONS_00001589"; exon_number "1"; oId "CUFF.1701.1"; tss_id "TSS1589"; +chr11 Cufflinks exon 73503099 73503365 . + . gene_id "XLOC_001590"; transcript_id "TCONS_00001590"; exon_number "1"; oId "CUFF.1703.1"; tss_id "TSS1590"; +chr11 Cufflinks exon 74071380 74071486 . + . gene_id "XLOC_001591"; transcript_id "TCONS_00001591"; exon_number "1"; oId "CUFF.1706.1"; tss_id "TSS1591"; +chr11 Cufflinks exon 74396270 74396508 . + . gene_id "XLOC_001592"; transcript_id "TCONS_00001592"; exon_number "1"; oId "CUFF.1707.1"; tss_id "TSS1592"; +chr11 Cufflinks exon 74556956 74557247 . + . gene_id "XLOC_001593"; transcript_id "TCONS_00001593"; exon_number "1"; oId "CUFF.1709.1"; tss_id "TSS1593"; +chr11 Cufflinks exon 75453174 75453492 . + . gene_id "XLOC_001594"; transcript_id "TCONS_00001594"; exon_number "1"; oId "CUFF.1711.1"; tss_id "TSS1594"; +chr11 Cufflinks exon 75645977 75646064 . + . gene_id "XLOC_001595"; transcript_id "TCONS_00001595"; exon_number "1"; oId "CUFF.1712.1"; tss_id "TSS1595"; +chr11 Cufflinks exon 75858510 75858684 . + . gene_id "XLOC_001596"; transcript_id "TCONS_00001596"; exon_number "1"; oId "CUFF.1713.1"; tss_id "TSS1596"; +chr11 Cufflinks exon 75946557 75946631 . + . gene_id "XLOC_001597"; transcript_id "TCONS_00001597"; exon_number "1"; oId "CUFF.1714.1"; tss_id "TSS1597"; +chr11 Cufflinks exon 76588589 76588673 . + . gene_id "XLOC_001598"; transcript_id "TCONS_00001598"; exon_number "1"; oId "CUFF.1718.1"; tss_id "TSS1598"; +chr11 Cufflinks exon 77484945 77484998 . + . gene_id "XLOC_001599"; transcript_id "TCONS_00001599"; exon_number "1"; oId "CUFF.1721.1"; tss_id "TSS1599"; +chr11 Cufflinks exon 77499950 77500000 . + . gene_id "XLOC_001600"; transcript_id "TCONS_00001600"; exon_number "1"; oId "CUFF.1722.1"; tss_id "TSS1600"; +chr11 Cufflinks exon 77504687 77504928 . + . gene_id "XLOC_001601"; transcript_id "TCONS_00001601"; exon_number "1"; oId "CUFF.1723.1"; tss_id "TSS1601"; +chr11 Cufflinks exon 77597474 77597831 . + . gene_id "XLOC_001602"; transcript_id "TCONS_00001602"; exon_number "1"; oId "CUFF.1724.1"; tss_id "TSS1602"; +chr11 Cufflinks exon 77694820 77694855 . + . gene_id "XLOC_001603"; transcript_id "TCONS_00001603"; exon_number "1"; oId "CUFF.1725.1"; tss_id "TSS1603"; +chr11 Cufflinks exon 78237441 78237489 . + . gene_id "XLOC_001604"; transcript_id "TCONS_00001604"; exon_number "1"; oId "CUFF.1727.1"; tss_id "TSS1604"; +chr11 Cufflinks exon 80239004 80239100 . + . gene_id "XLOC_001605"; transcript_id "TCONS_00001605"; exon_number "1"; oId "CUFF.1729.1"; tss_id "TSS1605"; +chr11 Cufflinks exon 82554942 82555029 . + . gene_id "XLOC_001606"; transcript_id "TCONS_00001606"; exon_number "1"; oId "CUFF.1730.1"; tss_id "TSS1606"; +chr11 Cufflinks exon 82815953 82816035 . + . gene_id "XLOC_001607"; transcript_id "TCONS_00001607"; exon_number "1"; oId "CUFF.1731.1"; tss_id "TSS1607"; +chr11 Cufflinks exon 84297519 84297569 . + . gene_id "XLOC_001608"; transcript_id "TCONS_00001608"; exon_number "1"; oId "CUFF.1732.1"; tss_id "TSS1608"; +chr11 Cufflinks exon 84531974 84532007 . + . gene_id "XLOC_001609"; transcript_id "TCONS_00001609"; exon_number "1"; oId "CUFF.1733.1"; tss_id "TSS1609"; +chr11 Cufflinks exon 85195012 85195307 . + . gene_id "XLOC_001610"; transcript_id "TCONS_00001610"; exon_number "1"; oId "CUFF.1735.1"; tss_id "TSS1610"; +chr11 Cufflinks exon 85220982 85221088 . + . gene_id "XLOC_001611"; transcript_id "TCONS_00001611"; exon_number "1"; oId "CUFF.1736.1"; tss_id "TSS1611"; +chr11 Cufflinks exon 85805233 85805340 . + . gene_id "XLOC_001612"; transcript_id "TCONS_00001612"; exon_number "1"; oId "CUFF.1739.1"; tss_id "TSS1612"; +chr11 Cufflinks exon 85864270 85864373 . + . gene_id "XLOC_001613"; transcript_id "TCONS_00001613"; exon_number "1"; oId "CUFF.1740.1"; tss_id "TSS1613"; +chr11 Cufflinks exon 85938260 85938294 . + . gene_id "XLOC_001614"; transcript_id "TCONS_00001614"; exon_number "1"; oId "CUFF.1741.1"; tss_id "TSS1614"; +chr11 Cufflinks exon 86246363 86246512 . + . gene_id "XLOC_001615"; transcript_id "TCONS_00001615"; exon_number "1"; oId "CUFF.1743.1"; tss_id "TSS1615"; +chr11 Cufflinks exon 86890580 86890627 . + . gene_id "XLOC_001616"; transcript_id "TCONS_00001616"; exon_number "1"; oId "CUFF.1745.1"; tss_id "TSS1616"; +chr11 Cufflinks exon 87317675 87317777 . + . gene_id "XLOC_001617"; transcript_id "TCONS_00001617"; exon_number "1"; oId "CUFF.1746.1"; tss_id "TSS1617"; +chr11 Cufflinks exon 87864738 87864814 . + . gene_id "XLOC_001618"; transcript_id "TCONS_00001618"; exon_number "1"; oId "CUFF.1748.1"; tss_id "TSS1618"; +chr11 Cufflinks exon 88102604 88102641 . + . gene_id "XLOC_001619"; transcript_id "TCONS_00001619"; exon_number "1"; oId "CUFF.1749.1"; tss_id "TSS1619"; +chr11 Cufflinks exon 89007517 89007566 . + . gene_id "XLOC_001620"; transcript_id "TCONS_00001620"; exon_number "1"; oId "CUFF.1751.1"; tss_id "TSS1620"; +chr11 Cufflinks exon 89449879 89449912 . + . gene_id "XLOC_001621"; transcript_id "TCONS_00001621"; exon_number "1"; oId "CUFF.1753.1"; tss_id "TSS1621"; +chr11 Cufflinks exon 93290079 93290371 . + . gene_id "XLOC_001622"; transcript_id "TCONS_00001622"; exon_number "1"; oId "CUFF.1758.1"; tss_id "TSS1622"; +chr11 Cufflinks exon 93527740 93527941 . + . gene_id "XLOC_001623"; transcript_id "TCONS_00001623"; exon_number "1"; oId "CUFF.1759.1"; tss_id "TSS1623"; +chr11 Cufflinks exon 93530378 93530482 . + . gene_id "XLOC_001624"; transcript_id "TCONS_00001624"; exon_number "1"; oId "CUFF.1760.1"; tss_id "TSS1624"; +chr11 Cufflinks exon 94453233 94453365 . + . gene_id "XLOC_001625"; transcript_id "TCONS_00001625"; exon_number "1"; oId "CUFF.1761.1"; tss_id "TSS1625"; +chr11 Cufflinks exon 95453399 95453434 . + . gene_id "XLOC_001626"; transcript_id "TCONS_00001626"; exon_number "1"; oId "CUFF.1765.1"; tss_id "TSS1626"; +chr11 Cufflinks exon 96757917 96757952 . + . gene_id "XLOC_001627"; transcript_id "TCONS_00001627"; exon_number "1"; oId "CUFF.1767.1"; tss_id "TSS1627"; +chr11 Cufflinks exon 97528464 97528584 . + . gene_id "XLOC_001628"; transcript_id "TCONS_00001628"; exon_number "1"; oId "CUFF.1768.1"; tss_id "TSS1628"; +chr11 Cufflinks exon 98990918 98991151 . + . gene_id "XLOC_001629"; transcript_id "TCONS_00001629"; exon_number "1"; oId "CUFF.1770.1"; tss_id "TSS1629"; +chr11 Cufflinks exon 99219887 99219928 . + . gene_id "XLOC_001630"; transcript_id "TCONS_00001630"; exon_number "1"; oId "CUFF.1771.1"; tss_id "TSS1630"; +chr11 Cufflinks exon 99643208 99643277 . + . gene_id "XLOC_001631"; transcript_id "TCONS_00001631"; exon_number "1"; oId "CUFF.1772.1"; tss_id "TSS1631"; +chr11 Cufflinks exon 100710362 100710594 . + . gene_id "XLOC_001632"; transcript_id "TCONS_00001632"; exon_number "1"; oId "CUFF.1774.1"; tss_id "TSS1632"; +chr11 Cufflinks exon 100765357 100765395 . + . gene_id "XLOC_001633"; transcript_id "TCONS_00001633"; exon_number "1"; oId "CUFF.1775.1"; tss_id "TSS1633"; +chr11 Cufflinks exon 100805004 100805112 . + . gene_id "XLOC_001634"; transcript_id "TCONS_00001634"; exon_number "1"; oId "CUFF.1776.1"; tss_id "TSS1634"; +chr11 Cufflinks exon 101927694 101927751 . + . gene_id "XLOC_001635"; transcript_id "TCONS_00001635"; exon_number "1"; oId "CUFF.1778.1"; tss_id "TSS1635"; +chr11 Cufflinks exon 101928585 101928804 . + . gene_id "XLOC_001636"; transcript_id "TCONS_00001636"; exon_number "1"; oId "CUFF.1779.1"; tss_id "TSS1636"; +chr11 Cufflinks exon 102184453 102184530 . + . gene_id "XLOC_001637"; transcript_id "TCONS_00001637"; exon_number "1"; oId "CUFF.1782.1"; tss_id "TSS1637"; +chr11 Cufflinks exon 102270297 102270351 . + . gene_id "XLOC_001638"; transcript_id "TCONS_00001638"; exon_number "1"; oId "CUFF.1783.1"; tss_id "TSS1638"; +chr11 Cufflinks exon 102902522 102902555 . + . gene_id "XLOC_001639"; transcript_id "TCONS_00001639"; exon_number "1"; oId "CUFF.1784.1"; tss_id "TSS1639"; +chr11 Cufflinks exon 103089842 103089965 . + . gene_id "XLOC_001640"; transcript_id "TCONS_00001640"; exon_number "1"; oId "CUFF.1785.1"; tss_id "TSS1640"; +chr11 Cufflinks exon 103274968 103275033 . + . gene_id "XLOC_001641"; transcript_id "TCONS_00001641"; exon_number "1"; oId "CUFF.1786.1"; tss_id "TSS1641"; +chr11 Cufflinks exon 103278039 103278110 . + . gene_id "XLOC_001642"; transcript_id "TCONS_00001642"; exon_number "1"; oId "CUFF.1787.1"; tss_id "TSS1642"; +chr11 Cufflinks exon 104012071 104012117 . + . gene_id "XLOC_001643"; transcript_id "TCONS_00001643"; exon_number "1"; oId "CUFF.1790.1"; tss_id "TSS1643"; +chr11 Cufflinks exon 104112789 104112824 . + . gene_id "XLOC_001644"; transcript_id "TCONS_00001644"; exon_number "1"; oId "CUFF.1791.1"; tss_id "TSS1644"; +chr11 Cufflinks exon 104123311 104123377 . + . gene_id "XLOC_001645"; transcript_id "TCONS_00001645"; exon_number "1"; oId "CUFF.1792.1"; tss_id "TSS1645"; +chr11 Cufflinks exon 104224718 104224753 . + . gene_id "XLOC_001646"; transcript_id "TCONS_00001646"; exon_number "1"; oId "CUFF.1793.1"; tss_id "TSS1646"; +chr11 Cufflinks exon 105265688 105265729 . + . gene_id "XLOC_001647"; transcript_id "TCONS_00001647"; exon_number "1"; oId "CUFF.1795.1"; tss_id "TSS1647"; +chr11 Cufflinks exon 105695360 105695428 . + . gene_id "XLOC_001648"; transcript_id "TCONS_00001648"; exon_number "1"; oId "CUFF.1796.1"; tss_id "TSS1648"; +chr11 Cufflinks exon 105866798 105866843 . + . gene_id "XLOC_001649"; transcript_id "TCONS_00001649"; exon_number "1"; oId "CUFF.1798.1"; tss_id "TSS1649"; +chr11 Cufflinks exon 108000563 108000644 . + . gene_id "XLOC_001650"; transcript_id "TCONS_00001650"; exon_number "1"; oId "CUFF.1804.1"; tss_id "TSS1650"; +chr11 Cufflinks exon 108876245 108876350 . + . gene_id "XLOC_001651"; transcript_id "TCONS_00001651"; exon_number "1"; oId "CUFF.1806.1"; tss_id "TSS1651"; +chr11 Cufflinks exon 109036041 109036120 . + . gene_id "XLOC_001652"; transcript_id "TCONS_00001652"; exon_number "1"; oId "CUFF.1808.1"; tss_id "TSS1652"; +chr11 Cufflinks exon 109473924 109473959 . + . gene_id "XLOC_001653"; transcript_id "TCONS_00001653"; exon_number "1"; oId "CUFF.1809.1"; tss_id "TSS1653"; +chr11 Cufflinks exon 109709716 109709753 . + . gene_id "XLOC_001654"; transcript_id "TCONS_00001654"; exon_number "1"; oId "CUFF.1810.1"; tss_id "TSS1654"; +chr11 Cufflinks exon 111253817 111253881 . + . gene_id "XLOC_001655"; transcript_id "TCONS_00001655"; exon_number "1"; oId "CUFF.1814.1"; tss_id "TSS1655"; +chr11 Cufflinks exon 111553836 111554074 . + . gene_id "XLOC_001656"; transcript_id "TCONS_00001656"; exon_number "1"; oId "CUFF.1816.1"; tss_id "TSS1656"; +chr11 Cufflinks exon 111799128 111799202 . + . gene_id "XLOC_001657"; transcript_id "TCONS_00001657"; exon_number "1"; oId "CUFF.1819.1"; tss_id "TSS1657"; +chr11 Cufflinks exon 112848076 112848132 . + . gene_id "XLOC_001658"; transcript_id "TCONS_00001658"; exon_number "1"; oId "CUFF.1822.1"; tss_id "TSS1658"; +chr11 Cufflinks exon 113297897 113297939 . + . gene_id "XLOC_001659"; transcript_id "TCONS_00001659"; exon_number "1"; oId "CUFF.1823.1"; tss_id "TSS1659"; +chr11 Cufflinks exon 113539318 113539356 . + . gene_id "XLOC_001660"; transcript_id "TCONS_00001660"; exon_number "1"; oId "CUFF.1825.1"; tss_id "TSS1660"; +chr11 Cufflinks exon 113730068 113730170 . + . gene_id "XLOC_001661"; transcript_id "TCONS_00001661"; exon_number "1"; oId "CUFF.1826.1"; tss_id "TSS1661"; +chr11 Cufflinks exon 114397850 114397957 . + . gene_id "XLOC_001662"; transcript_id "TCONS_00001662"; exon_number "1"; oId "CUFF.1829.1"; tss_id "TSS1662"; +chr11 Cufflinks exon 114582851 114582887 . + . gene_id "XLOC_001663"; transcript_id "TCONS_00001663"; exon_number "1"; oId "CUFF.1830.1"; tss_id "TSS1663"; +chr11 Cufflinks exon 115446761 115446815 . + . gene_id "XLOC_001664"; transcript_id "TCONS_00001664"; exon_number "1"; oId "CUFF.1831.1"; tss_id "TSS1664"; +chr11 Cufflinks exon 116191065 116191165 . + . gene_id "XLOC_001665"; transcript_id "TCONS_00001665"; exon_number "1"; oId "CUFF.1834.1"; tss_id "TSS1665"; +chr11 Cufflinks exon 117937953 117938264 . + . gene_id "XLOC_001666"; transcript_id "TCONS_00001666"; exon_number "1"; oId "CUFF.1836.1"; tss_id "TSS1666"; +chr11 Cufflinks exon 118387123 118387185 . + . gene_id "XLOC_001667"; transcript_id "TCONS_00001667"; exon_number "1"; oId "CUFF.1837.1"; tss_id "TSS1667"; +chr11 Cufflinks exon 118464703 118464806 . + . gene_id "XLOC_001668"; transcript_id "TCONS_00001668"; exon_number "1"; oId "CUFF.1838.1"; tss_id "TSS1668"; +chr11 Cufflinks exon 118573051 118573153 . + . gene_id "XLOC_001669"; transcript_id "TCONS_00001669"; exon_number "1"; oId "CUFF.1839.1"; tss_id "TSS1669"; +chr11 Cufflinks exon 118801925 118802151 . + . gene_id "XLOC_001670"; transcript_id "TCONS_00001670"; exon_number "1"; oId "CUFF.1841.1"; tss_id "TSS1670"; +chr11 Cufflinks exon 118865044 118865269 . + . gene_id "XLOC_001671"; transcript_id "TCONS_00001671"; exon_number "1"; oId "CUFF.1842.1"; tss_id "TSS1671"; +chr11 Cufflinks exon 118865363 118865480 . + . gene_id "XLOC_001672"; transcript_id "TCONS_00001672"; exon_number "1"; oId "CUFF.1843.1"; tss_id "TSS1672"; +chr11 Cufflinks exon 119527021 119527120 . + . gene_id "XLOC_001673"; transcript_id "TCONS_00001673"; exon_number "1"; oId "CUFF.1847.1"; tss_id "TSS1673"; +chr11 Cufflinks exon 120236399 120236592 . + . gene_id "XLOC_001674"; transcript_id "TCONS_00001674"; exon_number "1"; oId "CUFF.1849.1"; tss_id "TSS1674"; +chr11 Cufflinks exon 121627817 121627909 . + . gene_id "XLOC_001675"; transcript_id "TCONS_00001675"; exon_number "1"; oId "CUFF.1850.1"; tss_id "TSS1675"; +chr11 Cufflinks exon 121875099 121875156 . + . gene_id "XLOC_001676"; transcript_id "TCONS_00001676"; exon_number "1"; oId "CUFF.1851.1"; tss_id "TSS1676"; +chr11 Cufflinks exon 122283536 122283601 . + . gene_id "XLOC_001677"; transcript_id "TCONS_00001677"; exon_number "1"; oId "CUFF.1852.1"; tss_id "TSS1677"; +chr11 Cufflinks exon 122430655 122430727 . + . gene_id "XLOC_001678"; transcript_id "TCONS_00001678"; exon_number "1"; oId "CUFF.1853.1"; tss_id "TSS1678"; +chr11 Cufflinks exon 122797742 122797884 . + . gene_id "XLOC_001679"; transcript_id "TCONS_00001679"; exon_number "1"; oId "CUFF.1856.1"; tss_id "TSS1679"; +chr11 Cufflinks exon 123172100 123172232 . + . gene_id "XLOC_001680"; transcript_id "TCONS_00001680"; exon_number "1"; oId "CUFF.1861.1"; tss_id "TSS1680"; +chr11 Cufflinks exon 123634638 123634796 . + . gene_id "XLOC_001681"; transcript_id "TCONS_00001681"; exon_number "1"; oId "CUFF.1863.1"; tss_id "TSS1681"; +chr11 Cufflinks exon 124407924 124407954 . + . gene_id "XLOC_001682"; transcript_id "TCONS_00001682"; exon_number "1"; oId "CUFF.1866.1"; tss_id "TSS1682"; +chr11 Cufflinks exon 124506355 124506444 . + . gene_id "XLOC_001683"; transcript_id "TCONS_00001683"; exon_number "1"; oId "CUFF.1867.1"; tss_id "TSS1683"; +chr11 Cufflinks exon 124570147 124570183 . + . gene_id "XLOC_001684"; transcript_id "TCONS_00001684"; exon_number "1"; oId "CUFF.1868.1"; tss_id "TSS1684"; +chr11 Cufflinks exon 125147448 125147552 . + . gene_id "XLOC_001685"; transcript_id "TCONS_00001685"; exon_number "1"; oId "CUFF.1870.1"; tss_id "TSS1685"; +chr11 Cufflinks exon 125267614 125267649 . + . gene_id "XLOC_001686"; transcript_id "TCONS_00001686"; exon_number "1"; oId "CUFF.1871.1"; tss_id "TSS1686"; +chr11 Cufflinks exon 125444615 125444712 . + . gene_id "XLOC_001687"; transcript_id "TCONS_00001687"; exon_number "1"; oId "CUFF.1872.1"; tss_id "TSS1687"; +chr11 Cufflinks exon 125519642 125519697 . + . gene_id "XLOC_001688"; transcript_id "TCONS_00001688"; exon_number "1"; oId "CUFF.1873.1"; tss_id "TSS1688"; +chr11 Cufflinks exon 126114930 126115188 . + . gene_id "XLOC_001689"; transcript_id "TCONS_00001689"; exon_number "1"; oId "CUFF.1878.1"; tss_id "TSS1689"; +chr11 Cufflinks exon 126151551 126151652 . + . gene_id "XLOC_001690"; transcript_id "TCONS_00001690"; exon_number "1"; oId "CUFF.1879.1"; tss_id "TSS1690"; +chr11 Cufflinks exon 127277746 127277976 . + . gene_id "XLOC_001691"; transcript_id "TCONS_00001691"; exon_number "1"; oId "CUFF.1881.1"; tss_id "TSS1691"; +chr11 Cufflinks exon 128604169 128604249 . + . gene_id "XLOC_001692"; transcript_id "TCONS_00001692"; exon_number "1"; oId "CUFF.1882.1"; tss_id "TSS1692"; +chr11 Cufflinks exon 129072861 129072940 . + . gene_id "XLOC_001693"; transcript_id "TCONS_00001693"; exon_number "1"; oId "CUFF.1885.1"; tss_id "TSS1693"; +chr11 Cufflinks exon 129159799 129159883 . + . gene_id "XLOC_001694"; transcript_id "TCONS_00001694"; exon_number "1"; oId "CUFF.1886.1"; tss_id "TSS1694"; +chr11 Cufflinks exon 129278798 129279018 . + . gene_id "XLOC_001695"; transcript_id "TCONS_00001695"; exon_number "1"; oId "CUFF.1887.1"; tss_id "TSS1695"; +chr11 Cufflinks exon 130180075 130180385 . + . gene_id "XLOC_001696"; transcript_id "TCONS_00001696"; exon_number "1"; oId "CUFF.1890.1"; tss_id "TSS1696"; +chr11 Cufflinks exon 131611664 131611698 . + . gene_id "XLOC_001697"; transcript_id "TCONS_00001697"; exon_number "1"; oId "CUFF.1894.1"; tss_id "TSS1697"; +chr11 Cufflinks exon 132131069 132131146 . + . gene_id "XLOC_001698"; transcript_id "TCONS_00001698"; exon_number "1"; oId "CUFF.1895.1"; tss_id "TSS1698"; +chr11 Cufflinks exon 132395718 132395759 . + . gene_id "XLOC_001699"; transcript_id "TCONS_00001699"; exon_number "1"; oId "CUFF.1896.1"; tss_id "TSS1699"; +chr11 Cufflinks exon 152999 153101 . - . gene_id "XLOC_001700"; transcript_id "TCONS_00001700"; exon_number "1"; oId "CUFF.1485.1"; tss_id "TSS1700"; +chr11 Cufflinks exon 276084 276134 . - . gene_id "XLOC_001701"; transcript_id "TCONS_00001701"; exon_number "1"; oId "CUFF.1486.1"; tss_id "TSS1701"; +chr11 Cufflinks exon 440473 440692 . - . gene_id "XLOC_001702"; transcript_id "TCONS_00001702"; exon_number "1"; oId "CUFF.1487.1"; tss_id "TSS1702"; +chr11 Cufflinks exon 2996796 2996860 . - . gene_id "XLOC_001703"; transcript_id "TCONS_00001703"; exon_number "1"; oId "CUFF.1490.1"; tss_id "TSS1703"; +chr11 Cufflinks exon 3069591 3069751 . - . gene_id "XLOC_001704"; transcript_id "TCONS_00001704"; exon_number "1"; oId "CUFF.1491.1"; tss_id "TSS1704"; +chr11 Cufflinks exon 3736002 3736068 . - . gene_id "XLOC_001705"; transcript_id "TCONS_00001705"; exon_number "1"; oId "CUFF.1493.1"; tss_id "TSS1705"; +chr11 Cufflinks exon 5060883 5061021 . - . gene_id "XLOC_001706"; transcript_id "TCONS_00001706"; exon_number "1"; oId "CUFF.1495.1"; tss_id "TSS1706"; +chr11 Cufflinks exon 5967124 5967185 . - . gene_id "XLOC_001707"; transcript_id "TCONS_00001707"; exon_number "1"; oId "CUFF.1497.1"; tss_id "TSS1707"; +chr11 Cufflinks exon 7910757 7910826 . - . gene_id "XLOC_001708"; transcript_id "TCONS_00001708"; exon_number "1"; oId "CUFF.1500.1"; tss_id "TSS1708"; +chr11 Cufflinks exon 8739124 8739166 . - . gene_id "XLOC_001709"; transcript_id "TCONS_00001709"; exon_number "1"; oId "CUFF.1502.1"; tss_id "TSS1709"; +chr11 Cufflinks exon 9427660 9427726 . - . gene_id "XLOC_001710"; transcript_id "TCONS_00001710"; exon_number "1"; oId "CUFF.1505.1"; tss_id "TSS1710"; +chr11 Cufflinks exon 9865364 9865422 . - . gene_id "XLOC_001711"; transcript_id "TCONS_00001711"; exon_number "1"; oId "CUFF.1509.1"; tss_id "TSS1711"; +chr11 Cufflinks exon 10403723 10403756 . - . gene_id "XLOC_001712"; transcript_id "TCONS_00001712"; exon_number "1"; oId "CUFF.1510.1"; tss_id "TSS1712"; +chr11 Cufflinks exon 10529434 10530723 . - . gene_id "XLOC_001713"; transcript_id "TCONS_00001713"; exon_number "1"; oId "CUFF.1511.1"; tss_id "TSS1713"; +chr11 Cufflinks exon 10924427 10924468 . - . gene_id "XLOC_001714"; transcript_id "TCONS_00001714"; exon_number "1"; oId "CUFF.1512.1"; tss_id "TSS1714"; +chr11 Cufflinks exon 11956031 11956080 . - . gene_id "XLOC_001715"; transcript_id "TCONS_00001715"; exon_number "1"; oId "CUFF.1515.1"; tss_id "TSS1715"; +chr11 Cufflinks exon 11963529 11963570 . - . gene_id "XLOC_001716"; transcript_id "TCONS_00001716"; exon_number "1"; oId "CUFF.1516.1"; tss_id "TSS1716"; +chr11 Cufflinks exon 12888698 12888740 . - . gene_id "XLOC_001717"; transcript_id "TCONS_00001717"; exon_number "1"; oId "CUFF.1519.1"; tss_id "TSS1717"; +chr11 Cufflinks exon 13910277 13910316 . - . gene_id "XLOC_001718"; transcript_id "TCONS_00001718"; exon_number "1"; oId "CUFF.1524.1"; tss_id "TSS1718"; +chr11 Cufflinks exon 13929048 13929136 . - . gene_id "XLOC_001719"; transcript_id "TCONS_00001719"; exon_number "1"; oId "CUFF.1525.1"; tss_id "TSS1719"; +chr11 Cufflinks exon 14262099 14262133 . - . gene_id "XLOC_001720"; transcript_id "TCONS_00001720"; exon_number "1"; oId "CUFF.1527.1"; tss_id "TSS1720"; +chr11 Cufflinks exon 15425878 15425925 . - . gene_id "XLOC_001721"; transcript_id "TCONS_00001721"; exon_number "1"; oId "CUFF.1530.1"; tss_id "TSS1721"; +chr11 Cufflinks exon 16675371 16675401 . - . gene_id "XLOC_001722"; transcript_id "TCONS_00001722"; exon_number "1"; oId "CUFF.1533.1"; tss_id "TSS1722"; +chr11 Cufflinks exon 16995969 16996030 . - . gene_id "XLOC_001723"; transcript_id "TCONS_00001723"; exon_number "1"; oId "CUFF.1536.1"; tss_id "TSS1723"; +chr11 Cufflinks exon 17096201 17096291 . - . gene_id "XLOC_001724"; transcript_id "TCONS_00001724"; exon_number "1"; oId "CUFF.1538.1"; tss_id "TSS1724"; +chr11 Cufflinks exon 17097326 17097415 . - . gene_id "XLOC_001725"; transcript_id "TCONS_00001725"; exon_number "1"; oId "CUFF.1539.1"; tss_id "TSS1725"; +chr11 Cufflinks exon 17137213 17137310 . - . gene_id "XLOC_001726"; transcript_id "TCONS_00001726"; exon_number "1"; oId "CUFF.1540.1"; tss_id "TSS1726"; +chr11 Cufflinks exon 17295409 17295552 . - . gene_id "XLOC_001727"; transcript_id "TCONS_00001727"; exon_number "1"; oId "CUFF.1542.1"; tss_id "TSS1727"; +chr11 Cufflinks exon 17296351 17296374 . - . gene_id "XLOC_001728"; transcript_id "TCONS_00001728"; exon_number "1"; oId "CUFF.1543.1"; tss_id "TSS1728"; +chr11 Cufflinks exon 17336522 17336661 . - . gene_id "XLOC_001729"; transcript_id "TCONS_00001729"; exon_number "1"; oId "CUFF.1544.1"; tss_id "TSS1729"; +chr11 Cufflinks exon 18269934 18270050 . - . gene_id "XLOC_001730"; transcript_id "TCONS_00001730"; exon_number "1"; oId "CUFF.1546.1"; tss_id "TSS1730"; +chr11 Cufflinks exon 18770708 18770826 . - . gene_id "XLOC_001731"; transcript_id "TCONS_00001731"; exon_number "1"; oId "CUFF.1548.1"; tss_id "TSS1731"; +chr11 Cufflinks exon 19423439 19423528 . - . gene_id "XLOC_001732"; transcript_id "TCONS_00001732"; exon_number "1"; oId "CUFF.1549.1"; tss_id "TSS1732"; +chr11 Cufflinks exon 19738599 19738650 . - . gene_id "XLOC_001733"; transcript_id "TCONS_00001733"; exon_number "1"; oId "CUFF.1550.1"; tss_id "TSS1733"; +chr11 Cufflinks exon 20221809 20221851 . - . gene_id "XLOC_001734"; transcript_id "TCONS_00001734"; exon_number "1"; oId "CUFF.1551.1"; tss_id "TSS1734"; +chr11 Cufflinks exon 21022386 21022511 . - . gene_id "XLOC_001735"; transcript_id "TCONS_00001735"; exon_number "1"; oId "CUFF.1552.1"; tss_id "TSS1735"; +chr11 Cufflinks exon 21318776 21318815 . - . gene_id "XLOC_001736"; transcript_id "TCONS_00001736"; exon_number "1"; oId "CUFF.1554.1"; tss_id "TSS1736"; +chr11 Cufflinks exon 21405351 21405455 . - . gene_id "XLOC_001737"; transcript_id "TCONS_00001737"; exon_number "1"; oId "CUFF.1555.1"; tss_id "TSS1737"; +chr11 Cufflinks exon 22415892 22415924 . - . gene_id "XLOC_001738"; transcript_id "TCONS_00001738"; exon_number "1"; oId "CUFF.1557.1"; tss_id "TSS1738"; +chr11 Cufflinks exon 27129279 27129356 . - . gene_id "XLOC_001739"; transcript_id "TCONS_00001739"; exon_number "1"; oId "CUFF.1561.1"; tss_id "TSS1739"; +chr11 Cufflinks exon 27543184 27543272 . - . gene_id "XLOC_001740"; transcript_id "TCONS_00001740"; exon_number "1"; oId "CUFF.1562.1"; tss_id "TSS1740"; +chr11 Cufflinks exon 28282825 28283059 . - . gene_id "XLOC_001741"; transcript_id "TCONS_00001741"; exon_number "1"; oId "CUFF.1563.1"; tss_id "TSS1741"; +chr11 Cufflinks exon 29743013 29743231 . - . gene_id "XLOC_001742"; transcript_id "TCONS_00001742"; exon_number "1"; oId "CUFF.1565.1"; tss_id "TSS1742"; +chr11 Cufflinks exon 31621436 31621485 . - . gene_id "XLOC_001743"; transcript_id "TCONS_00001743"; exon_number "1"; oId "CUFF.1568.1"; tss_id "TSS1743"; +chr11 Cufflinks exon 31858423 31858458 . - . gene_id "XLOC_001744"; transcript_id "TCONS_00001744"; exon_number "1"; oId "CUFF.1570.1"; tss_id "TSS1744"; +chr11 Cufflinks exon 32134177 32134247 . - . gene_id "XLOC_001745"; transcript_id "TCONS_00001745"; exon_number "1"; oId "CUFF.1572.1"; tss_id "TSS1745"; +chr11 Cufflinks exon 33285922 33285981 . - . gene_id "XLOC_001746"; transcript_id "TCONS_00001746"; exon_number "1"; oId "CUFF.1575.1"; tss_id "TSS1746"; +chr11 Cufflinks exon 33456020 33456070 . - . gene_id "XLOC_001747"; transcript_id "TCONS_00001747"; exon_number "1"; oId "CUFF.1576.1"; tss_id "TSS1747"; +chr11 Cufflinks exon 34621145 34621180 . - . gene_id "XLOC_001748"; transcript_id "TCONS_00001748"; exon_number "1"; oId "CUFF.1577.1"; tss_id "TSS1748"; +chr11 Cufflinks exon 35413504 35413540 . - . gene_id "XLOC_001749"; transcript_id "TCONS_00001749"; exon_number "1"; oId "CUFF.1579.1"; tss_id "TSS1749"; +chr11 Cufflinks exon 35676140 35676201 . - . gene_id "XLOC_001750"; transcript_id "TCONS_00001750"; exon_number "1"; oId "CUFF.1581.1"; tss_id "TSS1750"; +chr11 Cufflinks exon 39788430 39788497 . - . gene_id "XLOC_001751"; transcript_id "TCONS_00001751"; exon_number "1"; oId "CUFF.1586.1"; tss_id "TSS1751"; +chr11 Cufflinks exon 40349025 40349061 . - . gene_id "XLOC_001752"; transcript_id "TCONS_00001752"; exon_number "1"; oId "CUFF.1589.1"; tss_id "TSS1752"; +chr11 Cufflinks exon 40722222 40722264 . - . gene_id "XLOC_001753"; transcript_id "TCONS_00001753"; exon_number "1"; oId "CUFF.1590.1"; tss_id "TSS1753"; +chr11 Cufflinks exon 41144469 41144564 . - . gene_id "XLOC_001754"; transcript_id "TCONS_00001754"; exon_number "1"; oId "CUFF.1591.1"; tss_id "TSS1754"; +chr11 Cufflinks exon 43456701 43456943 . - . gene_id "XLOC_001755"; transcript_id "TCONS_00001755"; exon_number "1"; oId "CUFF.1593.1"; tss_id "TSS1755"; +chr11 Cufflinks exon 43816809 43816875 . - . gene_id "XLOC_001756"; transcript_id "TCONS_00001756"; exon_number "1"; oId "CUFF.1594.1"; tss_id "TSS1756"; +chr11 Cufflinks exon 43890562 43890599 . - . gene_id "XLOC_001757"; transcript_id "TCONS_00001757"; exon_number "1"; oId "CUFF.1595.1"; tss_id "TSS1757"; +chr11 Cufflinks exon 44126193 44126275 . - . gene_id "XLOC_001758"; transcript_id "TCONS_00001758"; exon_number "1"; oId "CUFF.1596.1"; tss_id "TSS1758"; +chr11 Cufflinks exon 44778892 44778925 . - . gene_id "XLOC_001759"; transcript_id "TCONS_00001759"; exon_number "1"; oId "CUFF.1598.1"; tss_id "TSS1759"; +chr11 Cufflinks exon 44784467 44784503 . - . gene_id "XLOC_001760"; transcript_id "TCONS_00001760"; exon_number "1"; oId "CUFF.1599.1"; tss_id "TSS1760"; +chr11 Cufflinks exon 46793218 46793252 . - . gene_id "XLOC_001761"; transcript_id "TCONS_00001761"; exon_number "1"; oId "CUFF.1601.1"; tss_id "TSS1761"; +chr11 Cufflinks exon 46801064 46801161 . - . gene_id "XLOC_001762"; transcript_id "TCONS_00001762"; exon_number "1"; oId "CUFF.1602.1"; tss_id "TSS1762"; +chr11 Cufflinks exon 46801472 46801678 . - . gene_id "XLOC_001763"; transcript_id "TCONS_00001763"; exon_number "1"; oId "CUFF.1603.1"; tss_id "TSS1763"; +chr11 Cufflinks exon 47461557 47461617 . - . gene_id "XLOC_001764"; transcript_id "TCONS_00001764"; exon_number "1"; oId "CUFF.1605.1"; tss_id "TSS1764"; +chr11 Cufflinks exon 47579071 47579385 . - . gene_id "XLOC_001765"; transcript_id "TCONS_00001765"; exon_number "1"; oId "CUFF.1606.1"; tss_id "TSS1765"; +chr11 Cufflinks exon 47598044 47598140 . - . gene_id "XLOC_001766"; transcript_id "TCONS_00001766"; exon_number "1"; oId "CUFF.1607.1"; tss_id "TSS1766"; +chr11 Cufflinks exon 47825844 47825953 . - . gene_id "XLOC_001767"; transcript_id "TCONS_00001767"; exon_number "1"; oId "CUFF.1610.1"; tss_id "TSS1767"; +chr11 Cufflinks exon 47844668 47844699 . - . gene_id "XLOC_001768"; transcript_id "TCONS_00001768"; exon_number "1"; oId "CUFF.1611.1"; tss_id "TSS1768"; +chr11 Cufflinks exon 47906348 47906379 . - . gene_id "XLOC_001769"; transcript_id "TCONS_00001769"; exon_number "1"; oId "CUFF.1612.1"; tss_id "TSS1769"; +chr11 Cufflinks exon 49139696 49139729 . - . gene_id "XLOC_001770"; transcript_id "TCONS_00001770"; exon_number "1"; oId "CUFF.1614.1"; tss_id "TSS1770"; +chr11 Cufflinks exon 49447712 49447761 . - . gene_id "XLOC_001771"; transcript_id "TCONS_00001771"; exon_number "1"; oId "CUFF.1616.1"; tss_id "TSS1771"; +chr11 Cufflinks exon 49957300 49957375 . - . gene_id "XLOC_001772"; transcript_id "TCONS_00001772"; exon_number "1"; oId "CUFF.1617.1"; tss_id "TSS1772"; +chr11 Cufflinks exon 50221582 50221642 . - . gene_id "XLOC_001773"; transcript_id "TCONS_00001773"; exon_number "1"; oId "CUFF.1618.1"; tss_id "TSS1773"; +chr11 Cufflinks exon 50233879 50233950 . - . gene_id "XLOC_001774"; transcript_id "TCONS_00001774"; exon_number "1"; oId "CUFF.1619.1"; tss_id "TSS1774"; +chr11 Cufflinks exon 51470428 51470502 . - . gene_id "XLOC_001775"; transcript_id "TCONS_00001775"; exon_number "1"; oId "CUFF.1621.1"; tss_id "TSS1775"; +chr11 Cufflinks exon 57096331 57096435 . - . gene_id "XLOC_001776"; transcript_id "TCONS_00001776"; exon_number "1"; oId "CUFF.1623.1"; tss_id "TSS1776"; +chr11 Cufflinks exon 57352891 57352955 . - . gene_id "XLOC_001777"; transcript_id "TCONS_00001777"; exon_number "1"; oId "CUFF.1626.1"; tss_id "TSS1777"; +chr11 Cufflinks exon 57587125 57587168 . - . gene_id "XLOC_001778"; transcript_id "TCONS_00001778"; exon_number "1"; oId "CUFF.1628.1"; tss_id "TSS1778"; +chr11 Cufflinks exon 57794182 57794284 . - . gene_id "XLOC_001779"; transcript_id "TCONS_00001779"; exon_number "1"; oId "CUFF.1629.1"; tss_id "TSS1779"; +chr11 Cufflinks exon 58123135 58123220 . - . gene_id "XLOC_001780"; transcript_id "TCONS_00001780"; exon_number "1"; oId "CUFF.1630.1"; tss_id "TSS1780"; +chr11 Cufflinks exon 58143193 58143228 . - . gene_id "XLOC_001781"; transcript_id "TCONS_00001781"; exon_number "1"; oId "CUFF.1631.1"; tss_id "TSS1781"; +chr11 Cufflinks exon 58981868 58982172 . - . gene_id "XLOC_001782"; transcript_id "TCONS_00001782"; exon_number "1"; oId "CUFF.1632.1"; tss_id "TSS1782"; +chr11 Cufflinks exon 59058513 59058804 . - . gene_id "XLOC_001783"; transcript_id "TCONS_00001783"; exon_number "1"; oId "CUFF.1633.1"; tss_id "TSS1783"; +chr11 Cufflinks exon 59318102 59318174 . - . gene_id "XLOC_001784"; transcript_id "TCONS_00001784"; exon_number "1"; oId "CUFF.1635.1"; tss_id "TSS1784"; +chr11 Cufflinks exon 59318459 59318532 . - . gene_id "XLOC_001785"; transcript_id "TCONS_00001785"; exon_number "1"; oId "CUFF.1636.1"; tss_id "TSS1785"; +chr11 Cufflinks exon 59324547 59324598 . - . gene_id "XLOC_001786"; transcript_id "TCONS_00001786"; exon_number "1"; oId "CUFF.1640.1"; tss_id "TSS1786"; +chr11 Cufflinks exon 59324970 59325042 . - . gene_id "XLOC_001787"; transcript_id "TCONS_00001787"; exon_number "1"; oId "CUFF.1641.1"; tss_id "TSS1787"; +chr11 Cufflinks exon 59327808 59327880 . - . gene_id "XLOC_001788"; transcript_id "TCONS_00001788"; exon_number "1"; oId "CUFF.1643.1"; tss_id "TSS1788"; +chr11 Cufflinks exon 59333853 59333925 . - . gene_id "XLOC_001789"; transcript_id "TCONS_00001789"; exon_number "1"; oId "CUFF.1644.1"; tss_id "TSS1789"; +chr11 Cufflinks exon 59473620 59473856 . - . gene_id "XLOC_001790"; transcript_id "TCONS_00001790"; exon_number "1"; oId "CUFF.1646.1"; tss_id "TSS1790"; +chr11 Cufflinks exon 60752533 60752639 . - . gene_id "XLOC_001791"; transcript_id "TCONS_00001791"; exon_number "1"; oId "CUFF.1649.1"; tss_id "TSS1791"; +chr11 Cufflinks exon 62388461 62388502 . - . gene_id "XLOC_001792"; transcript_id "TCONS_00001792"; exon_number "1"; oId "CUFF.1654.1"; tss_id "TSS1792"; +chr11 Cufflinks exon 62583438 62583539 . - . gene_id "XLOC_001793"; transcript_id "TCONS_00001793"; exon_number "1"; oId "CUFF.1656.1"; tss_id "TSS1793"; +chr11 Cufflinks exon 62609096 62609281 . - . gene_id "XLOC_001794"; transcript_id "TCONS_00001794"; exon_number "1"; oId "CUFF.1657.1"; tss_id "TSS1794"; +chr11 Cufflinks exon 62703438 62703701 . - . gene_id "XLOC_001795"; transcript_id "TCONS_00001795"; exon_number "1"; oId "CUFF.1660.1"; tss_id "TSS1795"; +chr11 Cufflinks exon 63456639 63456693 . - . gene_id "XLOC_001796"; transcript_id "TCONS_00001796"; exon_number "1"; oId "CUFF.1664.1"; tss_id "TSS1796"; +chr11 Cufflinks exon 63470882 63470942 . - . gene_id "XLOC_001797"; transcript_id "TCONS_00001797"; exon_number "1"; oId "CUFF.1665.1"; tss_id "TSS1797"; +chr11 Cufflinks exon 63650067 63650151 . - . gene_id "XLOC_001798"; transcript_id "TCONS_00001798"; exon_number "1"; oId "CUFF.1666.1"; tss_id "TSS1798"; +chr11 Cufflinks exon 64273961 64274014 . - . gene_id "XLOC_001799"; transcript_id "TCONS_00001799"; exon_number "1"; oId "CUFF.1669.1"; tss_id "TSS1799"; +chr11 Cufflinks exon 64854323 64854361 . - . gene_id "XLOC_001800"; transcript_id "TCONS_00001800"; exon_number "1"; oId "CUFF.1670.1"; tss_id "TSS1800"; +chr11 Cufflinks exon 65318324 65318367 . - . gene_id "XLOC_001801"; transcript_id "TCONS_00001801"; exon_number "1"; oId "CUFF.1672.1"; tss_id "TSS1801"; +chr11 Cufflinks exon 66312198 66312263 . - . gene_id "XLOC_001802"; transcript_id "TCONS_00001802"; exon_number "1"; oId "CUFF.1678.1"; tss_id "TSS1802"; +chr11 Cufflinks exon 66480159 66480480 . - . gene_id "XLOC_001803"; transcript_id "TCONS_00001803"; exon_number "1"; oId "CUFF.1680.1"; tss_id "TSS1803"; +chr11 Cufflinks exon 66763029 66763096 . - . gene_id "XLOC_001804"; transcript_id "TCONS_00001804"; exon_number "1"; oId "CUFF.1682.1"; tss_id "TSS1804"; +chr11 Cufflinks exon 67162712 67162782 . - . gene_id "XLOC_001805"; transcript_id "TCONS_00001805"; exon_number "1"; oId "CUFF.1686.1"; tss_id "TSS1805"; +chr11 Cufflinks exon 67999043 67999437 . - . gene_id "XLOC_001806"; transcript_id "TCONS_00001806"; exon_number "1"; oId "CUFF.1689.1"; tss_id "TSS1806"; +chr11 Cufflinks exon 68227615 68227687 . - . gene_id "XLOC_001807"; transcript_id "TCONS_00001807"; exon_number "1"; oId "CUFF.1690.1"; tss_id "TSS1807"; +chr11 Cufflinks exon 71556255 71556305 . - . gene_id "XLOC_001808"; transcript_id "TCONS_00001808"; exon_number "1"; oId "CUFF.1693.1"; tss_id "TSS1808"; +chr11 Cufflinks exon 71758919 71759038 . - . gene_id "XLOC_001809"; transcript_id "TCONS_00001809"; exon_number "1"; oId "CUFF.1694.1"; tss_id "TSS1809"; +chr11 Cufflinks exon 72580589 72580695 . - . gene_id "XLOC_001810"; transcript_id "TCONS_00001810"; exon_number "1"; oId "CUFF.1697.1"; tss_id "TSS1810"; +chr11 Cufflinks exon 72688642 72688673 . - . gene_id "XLOC_001811"; transcript_id "TCONS_00001811"; exon_number "1"; oId "CUFF.1698.1"; tss_id "TSS1811"; +chr11 Cufflinks exon 73359642 73359679 . - . gene_id "XLOC_001812"; transcript_id "TCONS_00001812"; exon_number "1"; oId "CUFF.1702.1"; tss_id "TSS1812"; +chr11 Cufflinks exon 73543496 73543735 . - . gene_id "XLOC_001813"; transcript_id "TCONS_00001813"; exon_number "1"; oId "CUFF.1704.1"; tss_id "TSS1813"; +chr11 Cufflinks exon 73909810 73909899 . - . gene_id "XLOC_001814"; transcript_id "TCONS_00001814"; exon_number "1"; oId "CUFF.1705.1"; tss_id "TSS1814"; +chr11 Cufflinks exon 74490943 74491018 . - . gene_id "XLOC_001815"; transcript_id "TCONS_00001815"; exon_number "1"; oId "CUFF.1708.1"; tss_id "TSS1815"; +chr11 Cufflinks exon 74679240 74679337 . - . gene_id "XLOC_001816"; transcript_id "TCONS_00001816"; exon_number "1"; oId "CUFF.1710.1"; tss_id "TSS1816"; +chr11 Cufflinks exon 75946868 75946940 . - . gene_id "XLOC_001817"; transcript_id "TCONS_00001817"; exon_number "1"; oId "CUFF.1715.1"; tss_id "TSS1817"; +chr11 Cufflinks exon 76147487 76147559 . - . gene_id "XLOC_001818"; transcript_id "TCONS_00001818"; exon_number "1"; oId "CUFF.1716.1"; tss_id "TSS1818"; +chr11 Cufflinks exon 76157410 76157452 . - . gene_id "XLOC_001819"; transcript_id "TCONS_00001819"; exon_number "1"; oId "CUFF.1717.1"; tss_id "TSS1819"; +chr11 Cufflinks exon 77068232 77068316 . - . gene_id "XLOC_001820"; transcript_id "TCONS_00001820"; exon_number "1"; oId "CUFF.1719.1"; tss_id "TSS1820"; +chr11 Cufflinks exon 77277980 77278038 . - . gene_id "XLOC_001821"; transcript_id "TCONS_00001821"; exon_number "1"; oId "CUFF.1720.1"; tss_id "TSS1821"; +chr11 Cufflinks exon 77844466 77844547 . - . gene_id "XLOC_001822"; transcript_id "TCONS_00001822"; exon_number "1"; oId "CUFF.1726.1"; tss_id "TSS1822"; +chr11 Cufflinks exon 78290303 78290398 . - . gene_id "XLOC_001823"; transcript_id "TCONS_00001823"; exon_number "1"; oId "CUFF.1728.1"; tss_id "TSS1823"; +chr11 Cufflinks exon 84792606 84792846 . - . gene_id "XLOC_001824"; transcript_id "TCONS_00001824"; exon_number "1"; oId "CUFF.1734.1"; tss_id "TSS1824"; +chr11 Cufflinks exon 85746313 85746437 . - . gene_id "XLOC_001825"; transcript_id "TCONS_00001825"; exon_number "1"; oId "CUFF.1737.1"; tss_id "TSS1825"; +chr11 Cufflinks exon 85755322 85755619 . - . gene_id "XLOC_001826"; transcript_id "TCONS_00001826"; exon_number "1"; oId "CUFF.1738.1"; tss_id "TSS1826"; +chr11 Cufflinks exon 86035033 86035340 . - . gene_id "XLOC_001827"; transcript_id "TCONS_00001827"; exon_number "1"; oId "CUFF.1742.1"; tss_id "TSS1827"; +chr11 Cufflinks exon 86478535 86478575 . - . gene_id "XLOC_001828"; transcript_id "TCONS_00001828"; exon_number "1"; oId "CUFF.1744.1"; tss_id "TSS1828"; +chr11 Cufflinks exon 87359381 87359494 . - . gene_id "XLOC_001829"; transcript_id "TCONS_00001829"; exon_number "1"; oId "CUFF.1747.1"; tss_id "TSS1829"; +chr11 Cufflinks exon 88345973 88346079 . - . gene_id "XLOC_001830"; transcript_id "TCONS_00001830"; exon_number "1"; oId "CUFF.1750.1"; tss_id "TSS1830"; +chr11 Cufflinks exon 89357220 89357276 . - . gene_id "XLOC_001831"; transcript_id "TCONS_00001831"; exon_number "1"; oId "CUFF.1752.1"; tss_id "TSS1831"; +chr11 Cufflinks exon 90124291 90124327 . - . gene_id "XLOC_001832"; transcript_id "TCONS_00001832"; exon_number "1"; oId "CUFF.1754.1"; tss_id "TSS1832"; +chr11 Cufflinks exon 91736240 91736271 . - . gene_id "XLOC_001833"; transcript_id "TCONS_00001833"; exon_number "1"; oId "CUFF.1755.1"; tss_id "TSS1833"; +chr11 Cufflinks exon 91818550 91818587 . - . gene_id "XLOC_001834"; transcript_id "TCONS_00001834"; exon_number "1"; oId "CUFF.1756.1"; tss_id "TSS1834"; +chr11 Cufflinks exon 92462493 92462582 . - . gene_id "XLOC_001835"; transcript_id "TCONS_00001835"; exon_number "1"; oId "CUFF.1757.1"; tss_id "TSS1835"; +chr11 Cufflinks exon 94729569 94729612 . - . gene_id "XLOC_001836"; transcript_id "TCONS_00001836"; exon_number "1"; oId "CUFF.1762.1"; tss_id "TSS1836"; +chr11 Cufflinks exon 94803733 94803771 . - . gene_id "XLOC_001837"; transcript_id "TCONS_00001837"; exon_number "1"; oId "CUFF.1763.1"; tss_id "TSS1837"; +chr11 Cufflinks exon 95257210 95257298 . - . gene_id "XLOC_001838"; transcript_id "TCONS_00001838"; exon_number "1"; oId "CUFF.1764.1"; tss_id "TSS1838"; +chr11 Cufflinks exon 95573201 95573287 . - . gene_id "XLOC_001839"; transcript_id "TCONS_00001839"; exon_number "1"; oId "CUFF.1766.1"; tss_id "TSS1839"; +chr11 Cufflinks exon 97716839 97716905 . - . gene_id "XLOC_001840"; transcript_id "TCONS_00001840"; exon_number "1"; oId "CUFF.1769.1"; tss_id "TSS1840"; +chr11 Cufflinks exon 100512694 100513001 . - . gene_id "XLOC_001841"; transcript_id "TCONS_00001841"; exon_number "1"; oId "CUFF.1773.1"; tss_id "TSS1841"; +chr11 Cufflinks exon 101399066 101399157 . - . gene_id "XLOC_001842"; transcript_id "TCONS_00001842"; exon_number "1"; oId "CUFF.1777.1"; tss_id "TSS1842"; +chr11 Cufflinks exon 101929033 101929140 . - . gene_id "XLOC_001843"; transcript_id "TCONS_00001843"; exon_number "1"; oId "CUFF.1780.1"; tss_id "TSS1843"; +chr11 Cufflinks exon 101965396 101965433 . - . gene_id "XLOC_001844"; transcript_id "TCONS_00001844"; exon_number "1"; oId "CUFF.1781.1"; tss_id "TSS1844"; +chr11 Cufflinks exon 103279107 103279174 . - . gene_id "XLOC_001845"; transcript_id "TCONS_00001845"; exon_number "1"; oId "CUFF.1788.1"; tss_id "TSS1845"; +chr11 Cufflinks exon 103279644 103279808 . - . gene_id "XLOC_001846"; transcript_id "TCONS_00001846"; exon_number "1"; oId "CUFF.1789.1"; tss_id "TSS1846"; +chr11 Cufflinks exon 105223376 105223693 . - . gene_id "XLOC_001847"; transcript_id "TCONS_00001847"; exon_number "1"; oId "CUFF.1794.1"; tss_id "TSS1847"; +chr11 Cufflinks exon 105845587 105845658 . - . gene_id "XLOC_001848"; transcript_id "TCONS_00001848"; exon_number "1"; oId "CUFF.1797.1"; tss_id "TSS1848"; +chr11 Cufflinks exon 106201704 106201745 . - . gene_id "XLOC_001849"; transcript_id "TCONS_00001849"; exon_number "1"; oId "CUFF.1799.1"; tss_id "TSS1849"; +chr11 Cufflinks exon 106285321 106285369 . - . gene_id "XLOC_001850"; transcript_id "TCONS_00001850"; exon_number "1"; oId "CUFF.1800.1"; tss_id "TSS1850"; +chr11 Cufflinks exon 106638935 106639000 . - . gene_id "XLOC_001851"; transcript_id "TCONS_00001851"; exon_number "1"; oId "CUFF.1801.1"; tss_id "TSS1851"; +chr11 Cufflinks exon 107127365 107127436 . - . gene_id "XLOC_001852"; transcript_id "TCONS_00001852"; exon_number "1"; oId "CUFF.1802.1"; tss_id "TSS1852"; +chr11 Cufflinks exon 107970651 107970719 . - . gene_id "XLOC_001853"; transcript_id "TCONS_00001853"; exon_number "1"; oId "CUFF.1803.1"; tss_id "TSS1853"; +chr11 Cufflinks exon 108768246 108768319 . - . gene_id "XLOC_001854"; transcript_id "TCONS_00001854"; exon_number "1"; oId "CUFF.1805.1"; tss_id "TSS1854"; +chr11 Cufflinks exon 108991603 108991713 . - . gene_id "XLOC_001855"; transcript_id "TCONS_00001855"; exon_number "1"; oId "CUFF.1807.1"; tss_id "TSS1855"; +chr11 Cufflinks exon 109760260 109760298 . - . gene_id "XLOC_001856"; transcript_id "TCONS_00001856"; exon_number "1"; oId "CUFF.1811.1"; tss_id "TSS1856"; +chr11 Cufflinks exon 110022144 110022185 . - . gene_id "XLOC_001857"; transcript_id "TCONS_00001857"; exon_number "1"; oId "CUFF.1812.1"; tss_id "TSS1857"; +chr11 Cufflinks exon 110910844 110910932 . - . gene_id "XLOC_001858"; transcript_id "TCONS_00001858"; exon_number "1"; oId "CUFF.1813.1"; tss_id "TSS1858"; +chr11 Cufflinks exon 111276928 111276998 . - . gene_id "XLOC_001859"; transcript_id "TCONS_00001859"; exon_number "1"; oId "CUFF.1815.1"; tss_id "TSS1859"; +chr11 Cufflinks exon 111691908 111692362 . - . gene_id "XLOC_001860"; transcript_id "TCONS_00001860"; exon_number "1"; oId "CUFF.1817.1"; tss_id "TSS1860"; +chr11 Cufflinks exon 111692657 111692748 . - . gene_id "XLOC_001861"; transcript_id "TCONS_00001861"; exon_number "1"; oId "CUFF.1818.1"; tss_id "TSS1861"; +chr11 Cufflinks exon 111903226 111903322 . - . gene_id "XLOC_001862"; transcript_id "TCONS_00001862"; exon_number "1"; oId "CUFF.1820.1"; tss_id "TSS1862"; +chr11 Cufflinks exon 112223279 112223385 . - . gene_id "XLOC_001863"; transcript_id "TCONS_00001863"; exon_number "1"; oId "CUFF.1821.1"; tss_id "TSS1863"; +chr11 Cufflinks exon 113432996 113433078 . - . gene_id "XLOC_001864"; transcript_id "TCONS_00001864"; exon_number "1"; oId "CUFF.1824.1"; tss_id "TSS1864"; +chr11 Cufflinks exon 113735982 113736035 . - . gene_id "XLOC_001865"; transcript_id "TCONS_00001865"; exon_number "1"; oId "CUFF.1827.1"; tss_id "TSS1865"; +chr11 Cufflinks exon 113856086 113856121 . - . gene_id "XLOC_001866"; transcript_id "TCONS_00001866"; exon_number "1"; oId "CUFF.1828.1"; tss_id "TSS1866"; +chr11 Cufflinks exon 115497797 115497904 . - . gene_id "XLOC_001867"; transcript_id "TCONS_00001867"; exon_number "1"; oId "CUFF.1832.1"; tss_id "TSS1867"; +chr11 Cufflinks exon 115719900 115719936 . - . gene_id "XLOC_001868"; transcript_id "TCONS_00001868"; exon_number "1"; oId "CUFF.1833.1"; tss_id "TSS1868"; +chr11 Cufflinks exon 117202312 117202370 . - . gene_id "XLOC_001869"; transcript_id "TCONS_00001869"; exon_number "1"; oId "CUFF.1835.1"; tss_id "TSS1869"; +chr11 Cufflinks exon 118677611 118677649 . - . gene_id "XLOC_001870"; transcript_id "TCONS_00001870"; exon_number "1"; oId "CUFF.1840.1"; tss_id "TSS1870"; +chr11 Cufflinks exon 119160275 119160387 . - . gene_id "XLOC_001871"; transcript_id "TCONS_00001871"; exon_number "1"; oId "CUFF.1844.1"; tss_id "TSS1871"; +chr11 Cufflinks exon 119199389 119199520 . - . gene_id "XLOC_001872"; transcript_id "TCONS_00001872"; exon_number "1"; oId "CUFF.1845.1"; tss_id "TSS1872"; +chr11 Cufflinks exon 119199829 119200019 . - . gene_id "XLOC_001873"; transcript_id "TCONS_00001873"; exon_number "1"; oId "CUFF.1846.1"; tss_id "TSS1873"; +chr11 Cufflinks exon 119879822 119879919 . - . gene_id "XLOC_001874"; transcript_id "TCONS_00001874"; exon_number "1"; oId "CUFF.1848.1"; tss_id "TSS1874"; +chr11 Cufflinks exon 122449913 122450013 . - . gene_id "XLOC_001875"; transcript_id "TCONS_00001875"; exon_number "1"; oId "CUFF.1854.1"; tss_id "TSS1875"; +chr11 Cufflinks exon 122596913 122597020 . - . gene_id "XLOC_001876"; transcript_id "TCONS_00001876"; exon_number "1"; oId "CUFF.1855.1"; tss_id "TSS1876"; +chr11 Cufflinks exon 122928785 122928864 . - . gene_id "XLOC_001877"; transcript_id "TCONS_00001877"; exon_number "1"; oId "CUFF.1857.1"; tss_id "TSS1877"; +chr11 Cufflinks exon 122929617 122929703 . - . gene_id "XLOC_001878"; transcript_id "TCONS_00001878"; exon_number "1"; oId "CUFF.1858.1"; tss_id "TSS1878"; +chr11 Cufflinks exon 122930043 122930130 . - . gene_id "XLOC_001879"; transcript_id "TCONS_00001879"; exon_number "1"; oId "CUFF.1859.1"; tss_id "TSS1879"; +chr11 Cufflinks exon 123154929 123155007 . - . gene_id "XLOC_001880"; transcript_id "TCONS_00001880"; exon_number "1"; oId "CUFF.1860.1"; tss_id "TSS1880"; +chr11 Cufflinks exon 123293368 123293403 . - . gene_id "XLOC_001881"; transcript_id "TCONS_00001881"; exon_number "1"; oId "CUFF.1862.1"; tss_id "TSS1881"; +chr11 Cufflinks exon 123651895 123651925 . - . gene_id "XLOC_001882"; transcript_id "TCONS_00001882"; exon_number "1"; oId "CUFF.1864.1"; tss_id "TSS1882"; +chr11 Cufflinks exon 123835841 123835886 . - . gene_id "XLOC_001883"; transcript_id "TCONS_00001883"; exon_number "1"; oId "CUFF.1865.1"; tss_id "TSS1883"; +chr11 Cufflinks exon 125023197 125023237 . - . gene_id "XLOC_001884"; transcript_id "TCONS_00001884"; exon_number "1"; oId "CUFF.1869.1"; tss_id "TSS1884"; +chr11 Cufflinks exon 126046315 126046368 . - . gene_id "XLOC_001885"; transcript_id "TCONS_00001885"; exon_number "1"; oId "CUFF.1874.1"; tss_id "TSS1885"; +chr11 Cufflinks exon 126047219 126047316 . - . gene_id "XLOC_001886"; transcript_id "TCONS_00001886"; exon_number "1"; oId "CUFF.1875.1"; tss_id "TSS1886"; +chr11 Cufflinks exon 126054702 126054736 . - . gene_id "XLOC_001887"; transcript_id "TCONS_00001887"; exon_number "1"; oId "CUFF.1876.1"; tss_id "TSS1887"; +chr11 Cufflinks exon 126084304 126084373 . - . gene_id "XLOC_001888"; transcript_id "TCONS_00001888"; exon_number "1"; oId "CUFF.1877.1"; tss_id "TSS1888"; +chr11 Cufflinks exon 127275989 127276227 . - . gene_id "XLOC_001889"; transcript_id "TCONS_00001889"; exon_number "1"; oId "CUFF.1880.1"; tss_id "TSS1889"; +chr11 Cufflinks exon 128863136 128863235 . - . gene_id "XLOC_001890"; transcript_id "TCONS_00001890"; exon_number "1"; oId "CUFF.1883.1"; tss_id "TSS1890"; +chr11 Cufflinks exon 128937889 128937924 . - . gene_id "XLOC_001891"; transcript_id "TCONS_00001891"; exon_number "1"; oId "CUFF.1884.1"; tss_id "TSS1891"; +chr11 Cufflinks exon 129984157 129984230 . - . gene_id "XLOC_001892"; transcript_id "TCONS_00001892"; exon_number "1"; oId "CUFF.1888.1"; tss_id "TSS1892"; +chr11 Cufflinks exon 130174535 130174609 . - . gene_id "XLOC_001893"; transcript_id "TCONS_00001893"; exon_number "1"; oId "CUFF.1889.1"; tss_id "TSS1893"; +chr11 Cufflinks exon 130209307 130209350 . - . gene_id "XLOC_001894"; transcript_id "TCONS_00001894"; exon_number "1"; oId "CUFF.1891.1"; tss_id "TSS1894"; +chr11 Cufflinks exon 130621678 130621720 . - . gene_id "XLOC_001895"; transcript_id "TCONS_00001895"; exon_number "1"; oId "CUFF.1892.1"; tss_id "TSS1895"; +chr11 Cufflinks exon 130874004 130874324 . - . gene_id "XLOC_001896"; transcript_id "TCONS_00001896"; exon_number "1"; oId "CUFF.1893.1"; tss_id "TSS1896"; +chr11 Cufflinks exon 133306830 133306931 . - . gene_id "XLOC_001897"; transcript_id "TCONS_00001897"; exon_number "1"; oId "CUFF.1897.1"; tss_id "TSS1897"; +chr11 Cufflinks exon 134482050 134482094 . - . gene_id "XLOC_001898"; transcript_id "TCONS_00001898"; exon_number "1"; oId "CUFF.1898.1"; tss_id "TSS1898"; +chr11 Cufflinks exon 134547733 134547770 . - . gene_id "XLOC_001899"; transcript_id "TCONS_00001899"; exon_number "1"; oId "CUFF.1899.1"; tss_id "TSS1899"; +chr11 Cufflinks exon 134644965 134644998 . - . gene_id "XLOC_001900"; transcript_id "TCONS_00001900"; exon_number "1"; oId "CUFF.1900.1"; tss_id "TSS1900"; +chr12 Cufflinks exon 413668 413704 . + . gene_id "XLOC_001901"; transcript_id "TCONS_00001901"; exon_number "1"; oId "CUFF.1901.1"; tss_id "TSS1901"; +chr12 Cufflinks exon 1250604 1250649 . + . gene_id "XLOC_001902"; transcript_id "TCONS_00001902"; exon_number "1"; oId "CUFF.1903.1"; tss_id "TSS1902"; +chr12 Cufflinks exon 1456423 1456455 . + . gene_id "XLOC_001903"; transcript_id "TCONS_00001903"; exon_number "1"; oId "CUFF.1904.1"; tss_id "TSS1903"; +chr12 Cufflinks exon 3038132 3038188 . + . gene_id "XLOC_001904"; transcript_id "TCONS_00001904"; exon_number "1"; oId "CUFF.1905.1"; tss_id "TSS1904"; +chr12 Cufflinks exon 4048120 4048158 . + . gene_id "XLOC_001905"; transcript_id "TCONS_00001905"; exon_number "1"; oId "CUFF.1908.1"; tss_id "TSS1905"; +chr12 Cufflinks exon 5006176 5006210 . + . gene_id "XLOC_001906"; transcript_id "TCONS_00001906"; exon_number "1"; oId "CUFF.1910.1"; tss_id "TSS1906"; +chr12 Cufflinks exon 5142491 5142550 . + . gene_id "XLOC_001907"; transcript_id "TCONS_00001907"; exon_number "1"; oId "CUFF.1911.1"; tss_id "TSS1907"; +chr12 Cufflinks exon 6817253 6817288 . + . gene_id "XLOC_001908"; transcript_id "TCONS_00001908"; exon_number "1"; oId "CUFF.1913.1"; tss_id "TSS1908"; +chr12 Cufflinks exon 6818650 6818717 . + . gene_id "XLOC_001909"; transcript_id "TCONS_00001909"; exon_number "1"; oId "CUFF.1914.1"; tss_id "TSS1909"; +chr12 Cufflinks exon 7052980 7053041 . + . gene_id "XLOC_001910"; transcript_id "TCONS_00001910"; exon_number "1"; oId "CUFF.1916.1"; tss_id "TSS1910"; +chr12 Cufflinks exon 7271382 7271477 . + . gene_id "XLOC_001911"; transcript_id "TCONS_00001911"; exon_number "1"; oId "CUFF.1918.1"; tss_id "TSS1911"; +chr12 Cufflinks exon 7912130 7912169 . + . gene_id "XLOC_001912"; transcript_id "TCONS_00001912"; exon_number "1"; oId "CUFF.1919.1"; tss_id "TSS1912"; +chr12 Cufflinks exon 7961467 7961505 . + . gene_id "XLOC_001913"; transcript_id "TCONS_00001913"; exon_number "1"; oId "CUFF.1920.1"; tss_id "TSS1913"; +chr12 Cufflinks exon 8008767 8009071 . + . gene_id "XLOC_001914"; transcript_id "TCONS_00001914"; exon_number "1"; oId "CUFF.1923.1"; tss_id "TSS1914"; +chr12 Cufflinks exon 8637342 8637443 . + . gene_id "XLOC_001915"; transcript_id "TCONS_00001915"; exon_number "1"; oId "CUFF.1926.1"; tss_id "TSS1915"; +chr12 Cufflinks exon 9308600 9308635 . + . gene_id "XLOC_001916"; transcript_id "TCONS_00001916"; exon_number "1"; oId "CUFF.1927.1"; tss_id "TSS1916"; +chr12 Cufflinks exon 9362169 9362212 . + . gene_id "XLOC_001917"; transcript_id "TCONS_00001917"; exon_number "1"; oId "CUFF.1928.1"; tss_id "TSS1917"; +chr12 Cufflinks exon 10020167 10020206 . + . gene_id "XLOC_001918"; transcript_id "TCONS_00001918"; exon_number "1"; oId "CUFF.1930.1"; tss_id "TSS1918"; +chr12 Cufflinks exon 10104433 10104478 . + . gene_id "XLOC_001919"; transcript_id "TCONS_00001919"; exon_number "1"; oId "CUFF.1931.1"; tss_id "TSS1919"; +chr12 Cufflinks exon 10236785 10237021 . + . gene_id "XLOC_001920"; transcript_id "TCONS_00001920"; exon_number "1"; oId "CUFF.1932.1"; tss_id "TSS1920"; +chr12 Cufflinks exon 10541795 10541828 . + . gene_id "XLOC_001921"; transcript_id "TCONS_00001921"; exon_number "1"; oId "CUFF.1933.1"; tss_id "TSS1921"; +chr12 Cufflinks exon 10969926 10969960 . + . gene_id "XLOC_001922"; transcript_id "TCONS_00001922"; exon_number "1"; oId "CUFF.1934.1"; tss_id "TSS1922"; +chr12 Cufflinks exon 11315699 11315763 . + . gene_id "XLOC_001923"; transcript_id "TCONS_00001923"; exon_number "1"; oId "CUFF.1935.1"; tss_id "TSS1923"; +chr12 Cufflinks exon 11699414 11699474 . + . gene_id "XLOC_001924"; transcript_id "TCONS_00001924"; exon_number "1"; oId "CUFF.1936.1"; tss_id "TSS1924"; +chr12 Cufflinks exon 11714805 11714846 . + . gene_id "XLOC_001925"; transcript_id "TCONS_00001925"; exon_number "1"; oId "CUFF.1937.1"; tss_id "TSS1925"; +chr12 Cufflinks exon 12227225 12227253 . + . gene_id "XLOC_001926"; transcript_id "TCONS_00001926"; exon_number "1"; oId "CUFF.1939.1"; tss_id "TSS1926"; +chr12 Cufflinks exon 12379608 12379710 . + . gene_id "XLOC_001927"; transcript_id "TCONS_00001927"; exon_number "1"; oId "CUFF.1940.1"; tss_id "TSS1927"; +chr12 Cufflinks exon 12670801 12671023 . + . gene_id "XLOC_001928"; transcript_id "TCONS_00001928"; exon_number "1"; oId "CUFF.1943.1"; tss_id "TSS1928"; +chr12 Cufflinks exon 13199086 13199175 . + . gene_id "XLOC_001929"; transcript_id "TCONS_00001929"; exon_number "1"; oId "CUFF.1945.1"; tss_id "TSS1929"; +chr12 Cufflinks exon 13836476 13836714 . + . gene_id "XLOC_001930"; transcript_id "TCONS_00001930"; exon_number "1"; oId "CUFF.1950.1"; tss_id "TSS1930"; +chr12 Cufflinks exon 14278814 14279016 . + . gene_id "XLOC_001931"; transcript_id "TCONS_00001931"; exon_number "1"; oId "CUFF.1951.1"; tss_id "TSS1931"; +chr12 Cufflinks exon 14279416 14279535 . + . gene_id "XLOC_001932"; transcript_id "TCONS_00001932"; exon_number "1"; oId "CUFF.1952.1"; tss_id "TSS1932"; +chr12 Cufflinks exon 16032818 16032880 . + . gene_id "XLOC_001933"; transcript_id "TCONS_00001933"; exon_number "1"; oId "CUFF.1958.1"; tss_id "TSS1933"; +chr12 Cufflinks exon 16195213 16195248 . + . gene_id "XLOC_001934"; transcript_id "TCONS_00001934"; exon_number "1"; oId "CUFF.1959.1"; tss_id "TSS1934"; +chr12 Cufflinks exon 17094599 17094642 . + . gene_id "XLOC_001935"; transcript_id "TCONS_00001935"; exon_number "1"; oId "CUFF.1961.1"; tss_id "TSS1935"; +chr12 Cufflinks exon 17130123 17130155 . + . gene_id "XLOC_001936"; transcript_id "TCONS_00001936"; exon_number "1"; oId "CUFF.1962.1"; tss_id "TSS1936"; +chr12 Cufflinks exon 17434681 17434713 . + . gene_id "XLOC_001937"; transcript_id "TCONS_00001937"; exon_number "1"; oId "CUFF.1966.1"; tss_id "TSS1937"; +chr12 Cufflinks exon 18134209 18134279 . + . gene_id "XLOC_001938"; transcript_id "TCONS_00001938"; exon_number "1"; oId "CUFF.1967.1"; tss_id "TSS1938"; +chr12 Cufflinks exon 18342413 18342466 . + . gene_id "XLOC_001939"; transcript_id "TCONS_00001939"; exon_number "1"; oId "CUFF.1968.1"; tss_id "TSS1939"; +chr12 Cufflinks exon 19361678 19361793 . + . gene_id "XLOC_001940"; transcript_id "TCONS_00001940"; exon_number "1"; oId "CUFF.1971.1"; tss_id "TSS1940"; +chr12 Cufflinks exon 19456417 19456708 . + . gene_id "XLOC_001941"; transcript_id "TCONS_00001941"; exon_number "1"; oId "CUFF.1972.1"; tss_id "TSS1941"; +chr12 Cufflinks exon 19766759 19766796 . + . gene_id "XLOC_001942"; transcript_id "TCONS_00001942"; exon_number "1"; oId "CUFF.1974.1"; tss_id "TSS1942"; +chr12 Cufflinks exon 19877370 19877530 . + . gene_id "XLOC_001943"; transcript_id "TCONS_00001943"; exon_number "1"; oId "CUFF.1975.1"; tss_id "TSS1943"; +chr12 Cufflinks exon 19926145 19926303 . + . gene_id "XLOC_001944"; transcript_id "TCONS_00001944"; exon_number "1"; oId "CUFF.1976.1"; tss_id "TSS1944"; +chr12 Cufflinks exon 20704358 20704522 . + . gene_id "XLOC_001945"; transcript_id "TCONS_00001945"; exon_number "1"; oId "CUFF.1978.1"; tss_id "TSS1945"; +chr12 Cufflinks exon 20828529 20828567 . + . gene_id "XLOC_001946"; transcript_id "TCONS_00001946"; exon_number "1"; oId "CUFF.1979.1"; tss_id "TSS1946"; +chr12 Cufflinks exon 21384223 21384319 . + . gene_id "XLOC_001947"; transcript_id "TCONS_00001947"; exon_number "1"; oId "CUFF.1980.1"; tss_id "TSS1947"; +chr12 Cufflinks exon 21763810 21763845 . + . gene_id "XLOC_001948"; transcript_id "TCONS_00001948"; exon_number "1"; oId "CUFF.1982.1"; tss_id "TSS1948"; +chr12 Cufflinks exon 22700489 22700538 . + . gene_id "XLOC_001949"; transcript_id "TCONS_00001949"; exon_number "1"; oId "CUFF.1985.1"; tss_id "TSS1949"; +chr12 Cufflinks exon 23308352 23308401 . + . gene_id "XLOC_001950"; transcript_id "TCONS_00001950"; exon_number "1"; oId "CUFF.1987.1"; tss_id "TSS1950"; +chr12 Cufflinks exon 23894174 23894212 . + . gene_id "XLOC_001951"; transcript_id "TCONS_00001951"; exon_number "1"; oId "CUFF.1988.1"; tss_id "TSS1951"; +chr12 Cufflinks exon 24421534 24421599 . + . gene_id "XLOC_001952"; transcript_id "TCONS_00001952"; exon_number "1"; oId "CUFF.1990.1"; tss_id "TSS1952"; +chr12 Cufflinks exon 24859722 24860021 . + . gene_id "XLOC_001953"; transcript_id "TCONS_00001953"; exon_number "1"; oId "CUFF.1991.1"; tss_id "TSS1953"; +chr12 Cufflinks exon 24865464 24865597 . + . gene_id "XLOC_001954"; transcript_id "TCONS_00001954"; exon_number "1"; oId "CUFF.1992.1"; tss_id "TSS1954"; +chr12 Cufflinks exon 26626253 26626468 . + . gene_id "XLOC_001955"; transcript_id "TCONS_00001955"; exon_number "1"; oId "CUFF.1998.1"; tss_id "TSS1955"; +chr12 Cufflinks exon 27101805 27101941 . + . gene_id "XLOC_001956"; transcript_id "TCONS_00001956"; exon_number "1"; oId "CUFF.1999.1"; tss_id "TSS1956"; +chr12 Cufflinks exon 27283911 27283949 . + . gene_id "XLOC_001957"; transcript_id "TCONS_00001957"; exon_number "1"; oId "CUFF.2000.1"; tss_id "TSS1957"; +chr12 Cufflinks exon 27795976 27796014 . + . gene_id "XLOC_001958"; transcript_id "TCONS_00001958"; exon_number "1"; oId "CUFF.2002.1"; tss_id "TSS1958"; +chr12 Cufflinks exon 27843307 27843378 . + . gene_id "XLOC_001959"; transcript_id "TCONS_00001959"; exon_number "1"; oId "CUFF.2003.1"; tss_id "TSS1959"; +chr12 Cufflinks exon 28133345 28133449 . + . gene_id "XLOC_001960"; transcript_id "TCONS_00001960"; exon_number "1"; oId "CUFF.2007.1"; tss_id "TSS1960"; +chr12 Cufflinks exon 28658327 28658416 . + . gene_id "XLOC_001961"; transcript_id "TCONS_00001961"; exon_number "1"; oId "CUFF.2009.1"; tss_id "TSS1961"; +chr12 Cufflinks exon 29581903 29581971 . + . gene_id "XLOC_001962"; transcript_id "TCONS_00001962"; exon_number "1"; oId "CUFF.2010.1"; tss_id "TSS1962"; +chr12 Cufflinks exon 30052836 30052873 . + . gene_id "XLOC_001963"; transcript_id "TCONS_00001963"; exon_number "1"; oId "CUFF.2011.1"; tss_id "TSS1963"; +chr12 Cufflinks exon 30657033 30657073 . + . gene_id "XLOC_001964"; transcript_id "TCONS_00001964"; exon_number "1"; oId "CUFF.2013.1"; tss_id "TSS1964"; +chr12 Cufflinks exon 30846810 30846883 . + . gene_id "XLOC_001965"; transcript_id "TCONS_00001965"; exon_number "1"; oId "CUFF.2014.1"; tss_id "TSS1965"; +chr12 Cufflinks exon 31456650 31456744 . + . gene_id "XLOC_001966"; transcript_id "TCONS_00001966"; exon_number "1"; oId "CUFF.2016.1"; tss_id "TSS1966"; +chr12 Cufflinks exon 31519185 31519292 . + . gene_id "XLOC_001967"; transcript_id "TCONS_00001967"; exon_number "1"; oId "CUFF.2017.1"; tss_id "TSS1967"; +chr12 Cufflinks exon 31549325 31549435 . + . gene_id "XLOC_001968"; transcript_id "TCONS_00001968"; exon_number "1"; oId "CUFF.2018.1"; tss_id "TSS1968"; +chr12 Cufflinks exon 31603103 31603209 . + . gene_id "XLOC_001969"; transcript_id "TCONS_00001969"; exon_number "1"; oId "CUFF.2020.1"; tss_id "TSS1969"; +chr12 Cufflinks exon 32629545 32629662 . + . gene_id "XLOC_001970"; transcript_id "TCONS_00001970"; exon_number "1"; oId "CUFF.2025.1"; tss_id "TSS1970"; +chr12 Cufflinks exon 32664773 32664822 . + . gene_id "XLOC_001971"; transcript_id "TCONS_00001971"; exon_number "1"; oId "CUFF.2027.1"; tss_id "TSS1971"; +chr12 Cufflinks exon 32884657 32884721 . + . gene_id "XLOC_001972"; transcript_id "TCONS_00001972"; exon_number "1"; oId "CUFF.2029.1"; tss_id "TSS1972"; +chr12 Cufflinks exon 33196488 33196621 . + . gene_id "XLOC_001973"; transcript_id "TCONS_00001973"; exon_number "1"; oId "CUFF.2030.1"; tss_id "TSS1973"; +chr12 Cufflinks exon 33729041 33729131 . + . gene_id "XLOC_001974"; transcript_id "TCONS_00001974"; exon_number "1"; oId "CUFF.2032.1"; tss_id "TSS1974"; +chr12 Cufflinks exon 34356804 34356856 . + . gene_id "XLOC_001975"; transcript_id "TCONS_00001975"; exon_number "1"; oId "CUFF.2034.1"; tss_id "TSS1975"; +chr12 Cufflinks exon 34358634 34358754 . + . gene_id "XLOC_001976"; transcript_id "TCONS_00001976"; exon_number "1"; oId "CUFF.2035.1"; tss_id "TSS1976"; +chr12 Cufflinks exon 38531377 38531930 . + . gene_id "XLOC_001977"; transcript_id "TCONS_00001977"; exon_number "1"; oId "CUFF.2038.1"; tss_id "TSS1977"; +chr12 Cufflinks exon 40033141 40033207 . + . gene_id "XLOC_001978"; transcript_id "TCONS_00001978"; exon_number "1"; oId "CUFF.2041.1"; tss_id "TSS1978"; +chr12 Cufflinks exon 41097352 41097455 . + . gene_id "XLOC_001979"; transcript_id "TCONS_00001979"; exon_number "1"; oId "CUFF.2044.1"; tss_id "TSS1979"; +chr12 Cufflinks exon 42052482 42052567 . + . gene_id "XLOC_001980"; transcript_id "TCONS_00001980"; exon_number "1"; oId "CUFF.2048.1"; tss_id "TSS1980"; +chr12 Cufflinks exon 42093056 42093127 . + . gene_id "XLOC_001981"; transcript_id "TCONS_00001981"; exon_number "1"; oId "CUFF.2049.1"; tss_id "TSS1981"; +chr12 Cufflinks exon 42636039 42636246 . + . gene_id "XLOC_001982"; transcript_id "TCONS_00001982"; exon_number "1"; oId "CUFF.2050.1"; tss_id "TSS1982"; +chr12 Cufflinks exon 42636548 42636645 . + . gene_id "XLOC_001983"; transcript_id "TCONS_00001983"; exon_number "1"; oId "CUFF.2051.1"; tss_id "TSS1983"; +chr12 Cufflinks exon 42792351 42792450 . + . gene_id "XLOC_001984"; transcript_id "TCONS_00001984"; exon_number "1"; oId "CUFF.2052.1"; tss_id "TSS1984"; +chr12 Cufflinks exon 44082971 44083025 . + . gene_id "XLOC_001985"; transcript_id "TCONS_00001985"; exon_number "1"; oId "CUFF.2054.1"; tss_id "TSS1985"; +chr12 Cufflinks exon 44279447 44279481 . + . gene_id "XLOC_001986"; transcript_id "TCONS_00001986"; exon_number "1"; oId "CUFF.2055.1"; tss_id "TSS1986"; +chr12 Cufflinks exon 45417402 45417451 . + . gene_id "XLOC_001987"; transcript_id "TCONS_00001987"; exon_number "1"; oId "CUFF.2056.1"; tss_id "TSS1987"; +chr12 Cufflinks exon 45511555 45511672 . + . gene_id "XLOC_001988"; transcript_id "TCONS_00001988"; exon_number "1"; oId "CUFF.2057.1"; tss_id "TSS1988"; +chr12 Cufflinks exon 46267823 46268128 . + . gene_id "XLOC_001989"; transcript_id "TCONS_00001989"; exon_number "1"; oId "CUFF.2059.1"; tss_id "TSS1989"; +chr12 Cufflinks exon 46634765 46634806 . + . gene_id "XLOC_001990"; transcript_id "TCONS_00001990"; exon_number "1"; oId "CUFF.2060.1"; tss_id "TSS1990"; +chr12 Cufflinks exon 48475104 48475197 . + . gene_id "XLOC_001991"; transcript_id "TCONS_00001991"; exon_number "1"; oId "CUFF.2061.1"; tss_id "TSS1991"; +chr12 Cufflinks exon 48588241 48588308 . + . gene_id "XLOC_001992"; transcript_id "TCONS_00001992"; exon_number "1"; oId "CUFF.2062.1"; tss_id "TSS1992"; +chr12 Cufflinks exon 48732416 48732474 . + . gene_id "XLOC_001993"; transcript_id "TCONS_00001993"; exon_number "1"; oId "CUFF.2063.1"; tss_id "TSS1993"; +chr12 Cufflinks exon 49071773 49071835 . + . gene_id "XLOC_001994"; transcript_id "TCONS_00001994"; exon_number "1"; oId "CUFF.2065.1"; tss_id "TSS1994"; +chr12 Cufflinks exon 49369326 49369428 . + . gene_id "XLOC_001995"; transcript_id "TCONS_00001995"; exon_number "1"; oId "CUFF.2068.1"; tss_id "TSS1995"; +chr12 Cufflinks exon 49986887 49986989 . + . gene_id "XLOC_001996"; transcript_id "TCONS_00001996"; exon_number "1"; oId "CUFF.2069.1"; tss_id "TSS1996"; +chr12 Cufflinks exon 50413366 50413440 . + . gene_id "XLOC_001997"; transcript_id "TCONS_00001997"; exon_number "1"; oId "CUFF.2072.1"; tss_id "TSS1997"; +chr12 Cufflinks exon 50637226 50637275 . + . gene_id "XLOC_001998"; transcript_id "TCONS_00001998"; exon_number "1"; oId "CUFF.2074.1"; tss_id "TSS1998"; +chr12 Cufflinks exon 51027056 51027159 . + . gene_id "XLOC_001999"; transcript_id "TCONS_00001999"; exon_number "1"; oId "CUFF.2077.1"; tss_id "TSS1999"; +chr12 Cufflinks exon 51050756 51050855 . + . gene_id "XLOC_002000"; transcript_id "TCONS_00002000"; exon_number "1"; oId "CUFF.2078.1"; tss_id "TSS2000"; +chr12 Cufflinks exon 51404782 51404843 . + . gene_id "XLOC_002001"; transcript_id "TCONS_00002001"; exon_number "1"; oId "CUFF.2081.1"; tss_id "TSS2001"; +chr12 Cufflinks exon 51431282 51431381 . + . gene_id "XLOC_002002"; transcript_id "TCONS_00002002"; exon_number "1"; oId "CUFF.2083.1"; tss_id "TSS2002"; +chr12 Cufflinks exon 51556685 51556789 . + . gene_id "XLOC_002003"; transcript_id "TCONS_00002003"; exon_number "1"; oId "CUFF.2084.1"; tss_id "TSS2003"; +chr12 Cufflinks exon 52117886 52117930 . + . gene_id "XLOC_002004"; transcript_id "TCONS_00002004"; exon_number "1"; oId "CUFF.2085.1"; tss_id "TSS2004"; +chr12 Cufflinks exon 52248194 52248295 . + . gene_id "XLOC_002005"; transcript_id "TCONS_00002005"; exon_number "1"; oId "CUFF.2086.1"; tss_id "TSS2005"; +chr12 Cufflinks exon 52381441 52381547 . + . gene_id "XLOC_002006"; transcript_id "TCONS_00002006"; exon_number "1"; oId "CUFF.2087.1"; tss_id "TSS2006"; +chr12 Cufflinks exon 52415235 52415282 . + . gene_id "XLOC_002007"; transcript_id "TCONS_00002007"; exon_number "1"; oId "CUFF.2088.1"; tss_id "TSS2007"; +chr12 Cufflinks exon 52579767 52579815 . + . gene_id "XLOC_002008"; transcript_id "TCONS_00002008"; exon_number "1"; oId "CUFF.2089.1"; tss_id "TSS2008"; +chr12 Cufflinks exon 53095849 53095885 . + . gene_id "XLOC_002009"; transcript_id "TCONS_00002009"; exon_number "1"; oId "CUFF.2090.1"; tss_id "TSS2009"; +chr12 Cufflinks exon 54209985 54210088 . + . gene_id "XLOC_002010"; transcript_id "TCONS_00002010"; exon_number "1"; oId "CUFF.2094.1"; tss_id "TSS2010"; +chr12 Cufflinks exon 55412564 55412612 . + . gene_id "XLOC_002011"; transcript_id "TCONS_00002011"; exon_number "1"; oId "CUFF.2097.1"; tss_id "TSS2011"; +chr12 Cufflinks exon 56268462 56268625 . + . gene_id "XLOC_002012"; transcript_id "TCONS_00002012"; exon_number "1"; oId "CUFF.2098.1"; tss_id "TSS2012"; +chr12 Cufflinks exon 56584153 56584223 . + . gene_id "XLOC_002013"; transcript_id "TCONS_00002013"; exon_number "1"; oId "CUFF.2099.1"; tss_id "TSS2013"; +chr12 Cufflinks exon 56590698 56590753 . + . gene_id "XLOC_002014"; transcript_id "TCONS_00002014"; exon_number "1"; oId "CUFF.2100.1"; tss_id "TSS2014"; +chr12 Cufflinks exon 56761200 56761235 . + . gene_id "XLOC_002015"; transcript_id "TCONS_00002015"; exon_number "1"; oId "CUFF.2102.1"; tss_id "TSS2015"; +chr12 Cufflinks exon 56982302 56982403 . + . gene_id "XLOC_002016"; transcript_id "TCONS_00002016"; exon_number "1"; oId "CUFF.2103.1"; tss_id "TSS2016"; +chr12 Cufflinks exon 57264353 57264552 . + . gene_id "XLOC_002017"; transcript_id "TCONS_00002017"; exon_number "1"; oId "CUFF.2105.1"; tss_id "TSS2017"; +chr12 Cufflinks exon 57706195 57706252 . + . gene_id "XLOC_002018"; transcript_id "TCONS_00002018"; exon_number "1"; oId "CUFF.2106.1"; tss_id "TSS2018"; +chr12 Cufflinks exon 57787207 57787284 . + . gene_id "XLOC_002019"; transcript_id "TCONS_00002019"; exon_number "1"; oId "CUFF.2107.1"; tss_id "TSS2019"; +chr12 Cufflinks exon 57797779 57797808 . + . gene_id "XLOC_002020"; transcript_id "TCONS_00002020"; exon_number "1"; oId "CUFF.2108.1"; tss_id "TSS2020"; +chr12 Cufflinks exon 57809079 57809180 . + . gene_id "XLOC_002021"; transcript_id "TCONS_00002021"; exon_number "1"; oId "CUFF.2109.1"; tss_id "TSS2021"; +chr12 Cufflinks exon 57815268 57815305 . + . gene_id "XLOC_002022"; transcript_id "TCONS_00002022"; exon_number "1"; oId "CUFF.2110.1"; tss_id "TSS2022"; +chr12 Cufflinks exon 57904850 57904918 . + . gene_id "XLOC_002023"; transcript_id "TCONS_00002023"; exon_number "1"; oId "CUFF.2111.1"; tss_id "TSS2023"; +chr12 Cufflinks exon 58889118 58889157 . + . gene_id "XLOC_002024"; transcript_id "TCONS_00002024"; exon_number "1"; oId "CUFF.2117.1"; tss_id "TSS2024"; +chr12 Cufflinks exon 62787811 62787851 . + . gene_id "XLOC_002025"; transcript_id "TCONS_00002025"; exon_number "1"; oId "CUFF.2124.1"; tss_id "TSS2025"; +chr12 Cufflinks exon 63044955 63045060 . + . gene_id "XLOC_002026"; transcript_id "TCONS_00002026"; exon_number "1"; oId "CUFF.2126.1"; tss_id "TSS2026"; +chr12 Cufflinks exon 64598575 64598651 . + . gene_id "XLOC_002027"; transcript_id "TCONS_00002027"; exon_number "1"; oId "CUFF.2129.1"; tss_id "TSS2027"; +chr12 Cufflinks exon 65489529 65489635 . + . gene_id "XLOC_002028"; transcript_id "TCONS_00002028"; exon_number "1"; oId "CUFF.2134.1"; tss_id "TSS2028"; +chr12 Cufflinks exon 66686463 66686705 . + . gene_id "XLOC_002029"; transcript_id "TCONS_00002029"; exon_number "1"; oId "CUFF.2135.1"; tss_id "TSS2029"; +chr12 Cufflinks exon 66739498 66739605 . + . gene_id "XLOC_002030"; transcript_id "TCONS_00002030"; exon_number "1"; oId "CUFF.2136.1"; tss_id "TSS2030"; +chr12 Cufflinks exon 68471366 68471450 . + . gene_id "XLOC_002031"; transcript_id "TCONS_00002031"; exon_number "1"; oId "CUFF.2140.1"; tss_id "TSS2031"; +chr12 Cufflinks exon 68558310 68558433 . + . gene_id "XLOC_002032"; transcript_id "TCONS_00002032"; exon_number "1"; oId "CUFF.2141.1"; tss_id "TSS2032"; +chr12 Cufflinks exon 68713748 68713783 . + . gene_id "XLOC_002033"; transcript_id "TCONS_00002033"; exon_number "1"; oId "CUFF.2142.1"; tss_id "TSS2033"; +chr12 Cufflinks exon 69305702 69305761 . + . gene_id "XLOC_002034"; transcript_id "TCONS_00002034"; exon_number "1"; oId "CUFF.2144.1"; tss_id "TSS2034"; +chr12 Cufflinks exon 69322839 69322910 . + . gene_id "XLOC_002035"; transcript_id "TCONS_00002035"; exon_number "1"; oId "CUFF.2145.1"; tss_id "TSS2035"; +chr12 Cufflinks exon 69794684 69794995 . + . gene_id "XLOC_002036"; transcript_id "TCONS_00002036"; exon_number "1"; oId "CUFF.2146.1"; tss_id "TSS2036"; +chr12 Cufflinks exon 70034623 70034705 . + . gene_id "XLOC_002037"; transcript_id "TCONS_00002037"; exon_number "1"; oId "CUFF.2147.1"; tss_id "TSS2037"; +chr12 Cufflinks exon 70039269 70039352 . + . gene_id "XLOC_002038"; transcript_id "TCONS_00002038"; exon_number "1"; oId "CUFF.2148.1"; tss_id "TSS2038"; +chr12 Cufflinks exon 70492195 70492269 . + . gene_id "XLOC_002039"; transcript_id "TCONS_00002039"; exon_number "1"; oId "CUFF.2151.1"; tss_id "TSS2039"; +chr12 Cufflinks exon 71907781 71907859 . + . gene_id "XLOC_002040"; transcript_id "TCONS_00002040"; exon_number "1"; oId "CUFF.2155.1"; tss_id "TSS2040"; +chr12 Cufflinks exon 74614137 74614213 . + . gene_id "XLOC_002041"; transcript_id "TCONS_00002041"; exon_number "1"; oId "CUFF.2161.1"; tss_id "TSS2041"; +chr12 Cufflinks exon 74851182 74851254 . + . gene_id "XLOC_002042"; transcript_id "TCONS_00002042"; exon_number "1"; oId "CUFF.2162.1"; tss_id "TSS2042"; +chr12 Cufflinks exon 75641984 75642030 . + . gene_id "XLOC_002043"; transcript_id "TCONS_00002043"; exon_number "1"; oId "CUFF.2164.1"; tss_id "TSS2043"; +chr12 Cufflinks exon 75891845 75892084 . + . gene_id "XLOC_002044"; transcript_id "TCONS_00002044"; exon_number "1"; oId "CUFF.2165.1"; tss_id "TSS2044"; +chr12 Cufflinks exon 76205827 76205920 . + . gene_id "XLOC_002045"; transcript_id "TCONS_00002045"; exon_number "1"; oId "CUFF.2166.1"; tss_id "TSS2045"; +chr12 Cufflinks exon 76533347 76533451 . + . gene_id "XLOC_002046"; transcript_id "TCONS_00002046"; exon_number "1"; oId "CUFF.2168.1"; tss_id "TSS2046"; +chr12 Cufflinks exon 76709532 76709759 . + . gene_id "XLOC_002047"; transcript_id "TCONS_00002047"; exon_number "1"; oId "CUFF.2169.1"; tss_id "TSS2047"; +chr12 Cufflinks exon 83415671 83415769 . + . gene_id "XLOC_002048"; transcript_id "TCONS_00002048"; exon_number "1"; oId "CUFF.2178.1"; tss_id "TSS2048"; +chr12 Cufflinks exon 84215628 84215687 . + . gene_id "XLOC_002049"; transcript_id "TCONS_00002049"; exon_number "1"; oId "CUFF.2180.1"; tss_id "TSS2049"; +chr12 Cufflinks exon 84255164 84255199 . + . gene_id "XLOC_002050"; transcript_id "TCONS_00002050"; exon_number "1"; oId "CUFF.2181.1"; tss_id "TSS2050"; +chr12 Cufflinks exon 84683560 84683596 . + . gene_id "XLOC_002051"; transcript_id "TCONS_00002051"; exon_number "1"; oId "CUFF.2183.1"; tss_id "TSS2051"; +chr12 Cufflinks exon 86580981 86581021 . + . gene_id "XLOC_002052"; transcript_id "TCONS_00002052"; exon_number "1"; oId "CUFF.2187.1"; tss_id "TSS2052"; +chr12 Cufflinks exon 88403859 88403895 . + . gene_id "XLOC_002053"; transcript_id "TCONS_00002053"; exon_number "1"; oId "CUFF.2188.1"; tss_id "TSS2053"; +chr12 Cufflinks exon 88445471 88445561 . + . gene_id "XLOC_002054"; transcript_id "TCONS_00002054"; exon_number "1"; oId "CUFF.2189.1"; tss_id "TSS2054"; +chr12 Cufflinks exon 88789440 88789491 . + . gene_id "XLOC_002055"; transcript_id "TCONS_00002055"; exon_number "1"; oId "CUFF.2191.1"; tss_id "TSS2055"; +chr12 Cufflinks exon 88975462 88975573 . + . gene_id "XLOC_002056"; transcript_id "TCONS_00002056"; exon_number "1"; oId "CUFF.2192.1"; tss_id "TSS2056"; +chr12 Cufflinks exon 89690267 89690301 . + . gene_id "XLOC_002057"; transcript_id "TCONS_00002057"; exon_number "1"; oId "CUFF.2194.1"; tss_id "TSS2057"; +chr12 Cufflinks exon 89698973 89699007 . + . gene_id "XLOC_002058"; transcript_id "TCONS_00002058"; exon_number "1"; oId "CUFF.2195.1"; tss_id "TSS2058"; +chr12 Cufflinks exon 90120711 90120795 . + . gene_id "XLOC_002059"; transcript_id "TCONS_00002059"; exon_number "1"; oId "CUFF.2196.1"; tss_id "TSS2059"; +chr12 Cufflinks exon 90147837 90147927 . + . gene_id "XLOC_002060"; transcript_id "TCONS_00002060"; exon_number "1"; oId "CUFF.2197.1"; tss_id "TSS2060"; +chr12 Cufflinks exon 92300686 92300727 . + . gene_id "XLOC_002061"; transcript_id "TCONS_00002061"; exon_number "1"; oId "CUFF.2201.1"; tss_id "TSS2061"; +chr12 Cufflinks exon 93152646 93152677 . + . gene_id "XLOC_002062"; transcript_id "TCONS_00002062"; exon_number "1"; oId "CUFF.2203.1"; tss_id "TSS2062"; +chr12 Cufflinks exon 93346416 93346514 . + . gene_id "XLOC_002063"; transcript_id "TCONS_00002063"; exon_number "1"; oId "CUFF.2204.1"; tss_id "TSS2063"; +chr12 Cufflinks exon 93585059 93585103 . + . gene_id "XLOC_002064"; transcript_id "TCONS_00002064"; exon_number "1"; oId "CUFF.2205.1"; tss_id "TSS2064"; +chr12 Cufflinks exon 93744395 93744495 . + . gene_id "XLOC_002065"; transcript_id "TCONS_00002065"; exon_number "1"; oId "CUFF.2207.1"; tss_id "TSS2065"; +chr12 Cufflinks exon 93903263 93903562 . + . gene_id "XLOC_002066"; transcript_id "TCONS_00002066"; exon_number "1"; oId "CUFF.2208.1"; tss_id "TSS2066"; +chr12 Cufflinks exon 94224852 94225154 . + . gene_id "XLOC_002067"; transcript_id "TCONS_00002067"; exon_number "1"; oId "CUFF.2210.1"; tss_id "TSS2067"; +chr12 Cufflinks exon 94448739 94448903 . + . gene_id "XLOC_002068"; transcript_id "TCONS_00002068"; exon_number "1"; oId "CUFF.2212.1"; tss_id "TSS2068"; +chr12 Cufflinks exon 94450201 94450285 . + . gene_id "XLOC_002069"; transcript_id "TCONS_00002069"; exon_number "1"; oId "CUFF.2213.1"; tss_id "TSS2069"; +chr12 Cufflinks exon 94724244 94724329 . + . gene_id "XLOC_002070"; transcript_id "TCONS_00002070"; exon_number "1"; oId "CUFF.2214.1"; tss_id "TSS2070"; +chr12 Cufflinks exon 94754999 94755323 . + . gene_id "XLOC_002071"; transcript_id "TCONS_00002071"; exon_number "1"; oId "CUFF.2215.1"; tss_id "TSS2071"; +chr12 Cufflinks exon 94909252 94909550 . + . gene_id "XLOC_002072"; transcript_id "TCONS_00002072"; exon_number "1"; oId "CUFF.2216.1"; tss_id "TSS2072"; +chr12 Cufflinks exon 95684475 95684574 . + . gene_id "XLOC_002073"; transcript_id "TCONS_00002073"; exon_number "1"; oId "CUFF.2218.1"; tss_id "TSS2073"; +chr12 Cufflinks exon 95728869 95728896 . + . gene_id "XLOC_002074"; transcript_id "TCONS_00002074"; exon_number "1"; oId "CUFF.2219.1"; tss_id "TSS2074"; +chr12 Cufflinks exon 96011924 96011958 . + . gene_id "XLOC_002075"; transcript_id "TCONS_00002075"; exon_number "1"; oId "CUFF.2221.1"; tss_id "TSS2075"; +chr12 Cufflinks exon 96236649 96236683 . + . gene_id "XLOC_002076"; transcript_id "TCONS_00002076"; exon_number "1"; oId "CUFF.2223.1"; tss_id "TSS2076"; +chr12 Cufflinks exon 96429799 96429873 . + . gene_id "XLOC_002077"; transcript_id "TCONS_00002077"; exon_number "1"; oId "CUFF.2224.1"; tss_id "TSS2077"; +chr12 Cufflinks exon 97597069 97597135 . + . gene_id "XLOC_002078"; transcript_id "TCONS_00002078"; exon_number "1"; oId "CUFF.2229.1"; tss_id "TSS2078"; +chr12 Cufflinks exon 98115494 98115600 . + . gene_id "XLOC_002079"; transcript_id "TCONS_00002079"; exon_number "1"; oId "CUFF.2232.1"; tss_id "TSS2079"; +chr12 Cufflinks exon 98546511 98546548 . + . gene_id "XLOC_002080"; transcript_id "TCONS_00002080"; exon_number "1"; oId "CUFF.2233.1"; tss_id "TSS2080"; +chr12 Cufflinks exon 98897281 98897352 . + . gene_id "XLOC_002081"; transcript_id "TCONS_00002081"; exon_number "1"; oId "CUFF.2235.1"; tss_id "TSS2081"; +chr12 Cufflinks exon 98898030 98898101 . + . gene_id "XLOC_002082"; transcript_id "TCONS_00002082"; exon_number "1"; oId "CUFF.2236.1"; tss_id "TSS2082"; +chr12 Cufflinks exon 100183537 100183578 . + . gene_id "XLOC_002083"; transcript_id "TCONS_00002083"; exon_number "1"; oId "CUFF.2241.1"; tss_id "TSS2083"; +chr12 Cufflinks exon 100795922 100796031 . + . gene_id "XLOC_002084"; transcript_id "TCONS_00002084"; exon_number "1"; oId "CUFF.2243.1"; tss_id "TSS2084"; +chr12 Cufflinks exon 100988927 100988961 . + . gene_id "XLOC_002085"; transcript_id "TCONS_00002085"; exon_number "1"; oId "CUFF.2244.1"; tss_id "TSS2085"; +chr12 Cufflinks exon 101805137 101805236 . + . gene_id "XLOC_002086"; transcript_id "TCONS_00002086"; exon_number "1"; oId "CUFF.2249.1"; tss_id "TSS2086"; +chr12 Cufflinks exon 101860483 101860597 . + . gene_id "XLOC_002087"; transcript_id "TCONS_00002087"; exon_number "1"; oId "CUFF.2250.1"; tss_id "TSS2087"; +chr12 Cufflinks exon 101866118 101866224 . + . gene_id "XLOC_002088"; transcript_id "TCONS_00002088"; exon_number "1"; oId "CUFF.2251.1"; tss_id "TSS2088"; +chr12 Cufflinks exon 101923908 101923949 . + . gene_id "XLOC_002089"; transcript_id "TCONS_00002089"; exon_number "1"; oId "CUFF.2252.1"; tss_id "TSS2089"; +chr12 Cufflinks exon 102173592 102173682 . + . gene_id "XLOC_002090"; transcript_id "TCONS_00002090"; exon_number "1"; oId "CUFF.2254.1"; tss_id "TSS2090"; +chr12 Cufflinks exon 102183592 102183696 . + . gene_id "XLOC_002091"; transcript_id "TCONS_00002091"; exon_number "1"; oId "CUFF.2255.1"; tss_id "TSS2091"; +chr12 Cufflinks exon 102230596 102230686 . + . gene_id "XLOC_002092"; transcript_id "TCONS_00002092"; exon_number "1"; oId "CUFF.2260.1"; tss_id "TSS2092"; +chr12 Cufflinks exon 102820175 102820280 . + . gene_id "XLOC_002093"; transcript_id "TCONS_00002093"; exon_number "1"; oId "CUFF.2265.1"; tss_id "TSS2093"; +chr12 Cufflinks exon 103985889 103986022 . + . gene_id "XLOC_002094"; transcript_id "TCONS_00002094"; exon_number "1"; oId "CUFF.2267.1"; tss_id "TSS2094"; +chr12 Cufflinks exon 104519014 104519103 . + . gene_id "XLOC_002095"; transcript_id "TCONS_00002095"; exon_number "1"; oId "CUFF.2269.1"; tss_id "TSS2095"; +chr12 Cufflinks exon 105455907 105455936 . + . gene_id "XLOC_002096"; transcript_id "TCONS_00002096"; exon_number "1"; oId "CUFF.2270.1"; tss_id "TSS2096"; +chr12 Cufflinks exon 105586823 105586888 . + . gene_id "XLOC_002097"; transcript_id "TCONS_00002097"; exon_number "1"; oId "CUFF.2271.1"; tss_id "TSS2097"; +chr12 Cufflinks exon 106129143 106129202 . + . gene_id "XLOC_002098"; transcript_id "TCONS_00002098"; exon_number "1"; oId "CUFF.2274.1"; tss_id "TSS2098"; +chr12 Cufflinks exon 106728926 106728977 . + . gene_id "XLOC_002099"; transcript_id "TCONS_00002099"; exon_number "1"; oId "CUFF.2277.1"; tss_id "TSS2099"; +chr12 Cufflinks exon 108104517 108104559 . + . gene_id "XLOC_002100"; transcript_id "TCONS_00002100"; exon_number "1"; oId "CUFF.2280.1"; tss_id "TSS2100"; +chr12 Cufflinks exon 109062224 109062271 . + . gene_id "XLOC_002101"; transcript_id "TCONS_00002101"; exon_number "1"; oId "CUFF.2281.1"; tss_id "TSS2101"; +chr12 Cufflinks exon 109497791 109497878 . + . gene_id "XLOC_002102"; transcript_id "TCONS_00002102"; exon_number "1"; oId "CUFF.2283.1"; tss_id "TSS2102"; +chr12 Cufflinks exon 110795218 110795287 . + . gene_id "XLOC_002103"; transcript_id "TCONS_00002103"; exon_number "1"; oId "CUFF.2289.1"; tss_id "TSS2103"; +chr12 Cufflinks exon 111777331 111777415 . + . gene_id "XLOC_002104"; transcript_id "TCONS_00002104"; exon_number "1"; oId "CUFF.2291.1"; tss_id "TSS2104"; +chr12 Cufflinks exon 112168130 112168185 . + . gene_id "XLOC_002105"; transcript_id "TCONS_00002105"; exon_number "1"; oId "CUFF.2293.1"; tss_id "TSS2105"; +chr12 Cufflinks exon 112679625 112679665 . + . gene_id "XLOC_002106"; transcript_id "TCONS_00002106"; exon_number "1"; oId "CUFF.2297.1"; tss_id "TSS2106"; +chr12 Cufflinks exon 112704881 112705119 . + . gene_id "XLOC_002107"; transcript_id "TCONS_00002107"; exon_number "1"; oId "CUFF.2298.1"; tss_id "TSS2107"; +chr12 Cufflinks exon 114631329 114631364 . + . gene_id "XLOC_002108"; transcript_id "TCONS_00002108"; exon_number "1"; oId "CUFF.2304.1"; tss_id "TSS2108"; +chr12 Cufflinks exon 116155544 116155839 . + . gene_id "XLOC_002109"; transcript_id "TCONS_00002109"; exon_number "1"; oId "CUFF.2310.1"; tss_id "TSS2109"; +chr12 Cufflinks exon 116520376 116520481 . + . gene_id "XLOC_002110"; transcript_id "TCONS_00002110"; exon_number "1"; oId "CUFF.2311.1"; tss_id "TSS2110"; +chr12 Cufflinks exon 117219911 117220013 . + . gene_id "XLOC_002111"; transcript_id "TCONS_00002111"; exon_number "1"; oId "CUFF.2313.1"; tss_id "TSS2111"; +chr12 Cufflinks exon 118820980 118821009 . + . gene_id "XLOC_002112"; transcript_id "TCONS_00002112"; exon_number "1"; oId "CUFF.2315.1"; tss_id "TSS2112"; +chr12 Cufflinks exon 119267486 119267575 . + . gene_id "XLOC_002113"; transcript_id "TCONS_00002113"; exon_number "1"; oId "CUFF.2316.1"; tss_id "TSS2113"; +chr12 Cufflinks exon 119431662 119431990 . + . gene_id "XLOC_002114"; transcript_id "TCONS_00002114"; exon_number "1"; oId "CUFF.2317.1"; tss_id "TSS2114"; +chr12 Cufflinks exon 119767633 119767668 . + . gene_id "XLOC_002115"; transcript_id "TCONS_00002115"; exon_number "1"; oId "CUFF.2318.1"; tss_id "TSS2115"; +chr12 Cufflinks exon 120045142 120045179 . + . gene_id "XLOC_002116"; transcript_id "TCONS_00002116"; exon_number "1"; oId "CUFF.2319.1"; tss_id "TSS2116"; +chr12 Cufflinks exon 120456890 120457077 . + . gene_id "XLOC_002117"; transcript_id "TCONS_00002117"; exon_number "1"; oId "CUFF.2321.1"; tss_id "TSS2117"; +chr12 Cufflinks exon 120486233 120486334 . + . gene_id "XLOC_002118"; transcript_id "TCONS_00002118"; exon_number "1"; oId "CUFF.2322.1"; tss_id "TSS2118"; +chr12 Cufflinks exon 122042814 122042920 . + . gene_id "XLOC_002119"; transcript_id "TCONS_00002119"; exon_number "1"; oId "CUFF.2330.1"; tss_id "TSS2119"; +chr12 Cufflinks exon 122346010 122346068 . + . gene_id "XLOC_002120"; transcript_id "TCONS_00002120"; exon_number "1"; oId "CUFF.2332.1"; tss_id "TSS2120"; +chr12 Cufflinks exon 122860924 122860997 . + . gene_id "XLOC_002121"; transcript_id "TCONS_00002121"; exon_number "1"; oId "CUFF.2333.1"; tss_id "TSS2121"; +chr12 Cufflinks exon 123165832 123165885 . + . gene_id "XLOC_002122"; transcript_id "TCONS_00002122"; exon_number "1"; oId "CUFF.2336.1"; tss_id "TSS2122"; +chr12 Cufflinks exon 123308211 123308267 . + . gene_id "XLOC_002123"; transcript_id "TCONS_00002123"; exon_number "1"; oId "CUFF.2337.1"; tss_id "TSS2123"; +chr12 Cufflinks exon 123689060 123689092 . + . gene_id "XLOC_002124"; transcript_id "TCONS_00002124"; exon_number "1"; oId "CUFF.2338.1"; tss_id "TSS2124"; +chr12 Cufflinks exon 124128752 124128825 . + . gene_id "XLOC_002125"; transcript_id "TCONS_00002125"; exon_number "1"; oId "CUFF.2340.1"; tss_id "TSS2125"; +chr12 Cufflinks exon 124773195 124773227 . + . gene_id "XLOC_002126"; transcript_id "TCONS_00002126"; exon_number "1"; oId "CUFF.2342.1"; tss_id "TSS2126"; +chr12 Cufflinks exon 125386058 125386122 . + . gene_id "XLOC_002127"; transcript_id "TCONS_00002127"; exon_number "1"; oId "CUFF.2343.1"; tss_id "TSS2127"; +chr12 Cufflinks exon 125424512 125424583 . + . gene_id "XLOC_002128"; transcript_id "TCONS_00002128"; exon_number "1"; oId "CUFF.2348.1"; tss_id "TSS2128"; +chr12 Cufflinks exon 125555997 125556085 . + . gene_id "XLOC_002129"; transcript_id "TCONS_00002129"; exon_number "1"; oId "CUFF.2349.1"; tss_id "TSS2129"; +chr12 Cufflinks exon 126068966 126069003 . + . gene_id "XLOC_002130"; transcript_id "TCONS_00002130"; exon_number "1"; oId "CUFF.2350.1"; tss_id "TSS2130"; +chr12 Cufflinks exon 127208025 127208057 . + . gene_id "XLOC_002131"; transcript_id "TCONS_00002131"; exon_number "1"; oId "CUFF.2351.1"; tss_id "TSS2131"; +chr12 Cufflinks exon 127497589 127497641 . + . gene_id "XLOC_002132"; transcript_id "TCONS_00002132"; exon_number "1"; oId "CUFF.2352.1"; tss_id "TSS2132"; +chr12 Cufflinks exon 127497794 127497897 . + . gene_id "XLOC_002133"; transcript_id "TCONS_00002133"; exon_number "1"; oId "CUFF.2353.1"; tss_id "TSS2133"; +chr12 Cufflinks exon 127805900 127805970 . + . gene_id "XLOC_002134"; transcript_id "TCONS_00002134"; exon_number "1"; oId "CUFF.2355.1"; tss_id "TSS2134"; +chr12 Cufflinks exon 128882952 128883070 . + . gene_id "XLOC_002135"; transcript_id "TCONS_00002135"; exon_number "1"; oId "CUFF.2356.1"; tss_id "TSS2135"; +chr12 Cufflinks exon 129716199 129716271 . + . gene_id "XLOC_002136"; transcript_id "TCONS_00002136"; exon_number "1"; oId "CUFF.2357.1"; tss_id "TSS2136"; +chr12 Cufflinks exon 131299898 131299997 . + . gene_id "XLOC_002137"; transcript_id "TCONS_00002137"; exon_number "1"; oId "CUFF.2358.1"; tss_id "TSS2137"; +chr12 Cufflinks exon 132145608 132145698 . + . gene_id "XLOC_002138"; transcript_id "TCONS_00002138"; exon_number "1"; oId "CUFF.2362.1"; tss_id "TSS2138"; +chr12 Cufflinks exon 698701 698755 . - . gene_id "XLOC_002139"; transcript_id "TCONS_00002139"; exon_number "1"; oId "CUFF.1902.1"; tss_id "TSS2139"; +chr12 Cufflinks exon 3063412 3063504 . - . gene_id "XLOC_002140"; transcript_id "TCONS_00002140"; exon_number "1"; oId "CUFF.1906.1"; tss_id "TSS2140"; +chr12 Cufflinks exon 3835411 3835493 . - . gene_id "XLOC_002141"; transcript_id "TCONS_00002141"; exon_number "1"; oId "CUFF.1907.1"; tss_id "TSS2141"; +chr12 Cufflinks exon 4908688 4908754 . - . gene_id "XLOC_002142"; transcript_id "TCONS_00002142"; exon_number "1"; oId "CUFF.1909.1"; tss_id "TSS2142"; +chr12 Cufflinks exon 6204844 6205136 . - . gene_id "XLOC_002143"; transcript_id "TCONS_00002143"; exon_number "1"; oId "CUFF.1912.1"; tss_id "TSS2143"; +chr12 Cufflinks exon 6892999 6893327 . - . gene_id "XLOC_002144"; transcript_id "TCONS_00002144"; exon_number "1"; oId "CUFF.1915.1"; tss_id "TSS2144"; +chr12 Cufflinks exon 7240919 7240995 . - . gene_id "XLOC_002145"; transcript_id "TCONS_00002145"; exon_number "1"; oId "CUFF.1917.1"; tss_id "TSS2145"; +chr12 Cufflinks exon 7995031 7995064 . - . gene_id "XLOC_002146"; transcript_id "TCONS_00002146"; exon_number "1"; oId "CUFF.1921.1"; tss_id "TSS2146"; +chr12 Cufflinks exon 8006662 8006694 . - . gene_id "XLOC_002147"; transcript_id "TCONS_00002147"; exon_number "1"; oId "CUFF.1922.1"; tss_id "TSS2147"; +chr12 Cufflinks exon 8111155 8111188 . - . gene_id "XLOC_002148"; transcript_id "TCONS_00002148"; exon_number "1"; oId "CUFF.1924.1"; tss_id "TSS2148"; +chr12 Cufflinks exon 8138304 8138336 . - . gene_id "XLOC_002149"; transcript_id "TCONS_00002149"; exon_number "1"; oId "CUFF.1925.1"; tss_id "TSS2149"; +chr12 Cufflinks exon 9776724 9776824 . - . gene_id "XLOC_002150"; transcript_id "TCONS_00002150"; exon_number "1"; oId "CUFF.1929.1"; tss_id "TSS2150"; +chr12 Cufflinks exon 12079079 12079107 . - . gene_id "XLOC_002151"; transcript_id "TCONS_00002151"; exon_number "1"; oId "CUFF.1938.1"; tss_id "TSS2151"; +chr12 Cufflinks exon 12442161 12442263 . - . gene_id "XLOC_002152"; transcript_id "TCONS_00002152"; exon_number "1"; oId "CUFF.1941.1"; tss_id "TSS2152"; +chr12 Cufflinks exon 12490900 12490940 . - . gene_id "XLOC_002153"; transcript_id "TCONS_00002153"; exon_number "1"; oId "CUFF.1942.1"; tss_id "TSS2153"; +chr12 Cufflinks exon 13088541 13088578 . - . gene_id "XLOC_002154"; transcript_id "TCONS_00002154"; exon_number "1"; oId "CUFF.1944.1"; tss_id "TSS2154"; +chr12 Cufflinks exon 13310574 13310608 . - . gene_id "XLOC_002155"; transcript_id "TCONS_00002155"; exon_number "1"; oId "CUFF.1946.1"; tss_id "TSS2155"; +chr12 Cufflinks exon 13440667 13440713 . - . gene_id "XLOC_002156"; transcript_id "TCONS_00002156"; exon_number "1"; oId "CUFF.1947.1"; tss_id "TSS2156"; +chr12 Cufflinks exon 13593844 13593935 . - . gene_id "XLOC_002157"; transcript_id "TCONS_00002157"; exon_number "1"; oId "CUFF.1948.1"; tss_id "TSS2157"; +chr12 Cufflinks exon 13612609 13612710 . - . gene_id "XLOC_002158"; transcript_id "TCONS_00002158"; exon_number "1"; oId "CUFF.1949.1"; tss_id "TSS2158"; +chr12 Cufflinks exon 14305294 14305335 . - . gene_id "XLOC_002159"; transcript_id "TCONS_00002159"; exon_number "1"; oId "CUFF.1953.1"; tss_id "TSS2159"; +chr12 Cufflinks exon 14403169 14403274 . - . gene_id "XLOC_002160"; transcript_id "TCONS_00002160"; exon_number "1"; oId "CUFF.1954.1"; tss_id "TSS2160"; +chr12 Cufflinks exon 14706666 14706904 . - . gene_id "XLOC_002161"; transcript_id "TCONS_00002161"; exon_number "1"; oId "CUFF.1955.1"; tss_id "TSS2161"; +chr12 Cufflinks exon 15824642 15824744 . - . gene_id "XLOC_002162"; transcript_id "TCONS_00002162"; exon_number "1"; oId "CUFF.1956.1"; tss_id "TSS2162"; +chr12 Cufflinks exon 15871590 15871628 . - . gene_id "XLOC_002163"; transcript_id "TCONS_00002163"; exon_number "1"; oId "CUFF.1957.1"; tss_id "TSS2163"; +chr12 Cufflinks exon 16442791 16442826 . - . gene_id "XLOC_002164"; transcript_id "TCONS_00002164"; exon_number "1"; oId "CUFF.1960.1"; tss_id "TSS2164"; +chr12 Cufflinks exon 17219718 17219795 . - . gene_id "XLOC_002165"; transcript_id "TCONS_00002165"; exon_number "1"; oId "CUFF.1963.1"; tss_id "TSS2165"; +chr12 Cufflinks exon 17220158 17220174 . - . gene_id "XLOC_002166"; transcript_id "TCONS_00002166"; exon_number "1"; oId "CUFF.1964.1"; tss_id "TSS2166"; +chr12 Cufflinks exon 17224349 17224439 . - . gene_id "XLOC_002167"; transcript_id "TCONS_00002167"; exon_number "1"; oId "CUFF.1965.1"; tss_id "TSS2167"; +chr12 Cufflinks exon 18511179 18511391 . - . gene_id "XLOC_002168"; transcript_id "TCONS_00002168"; exon_number "1"; oId "CUFF.1969.1"; tss_id "TSS2168"; +chr12 Cufflinks exon 19329210 19329522 . - . gene_id "XLOC_002169"; transcript_id "TCONS_00002169"; exon_number "1"; oId "CUFF.1970.1"; tss_id "TSS2169"; +chr12 Cufflinks exon 19598883 19598988 . - . gene_id "XLOC_002170"; transcript_id "TCONS_00002170"; exon_number "1"; oId "CUFF.1973.1"; tss_id "TSS2170"; +chr12 Cufflinks exon 20076609 20076657 . - . gene_id "XLOC_002171"; transcript_id "TCONS_00002171"; exon_number "1"; oId "CUFF.1977.1"; tss_id "TSS2171"; +chr12 Cufflinks exon 21569547 21569647 . - . gene_id "XLOC_002172"; transcript_id "TCONS_00002172"; exon_number "1"; oId "CUFF.1981.1"; tss_id "TSS2172"; +chr12 Cufflinks exon 22149732 22149763 . - . gene_id "XLOC_002173"; transcript_id "TCONS_00002173"; exon_number "1"; oId "CUFF.1983.1"; tss_id "TSS2173"; +chr12 Cufflinks exon 22348402 22348538 . - . gene_id "XLOC_002174"; transcript_id "TCONS_00002174"; exon_number "1"; oId "CUFF.1984.1"; tss_id "TSS2174"; +chr12 Cufflinks exon 22845058 22845086 . - . gene_id "XLOC_002175"; transcript_id "TCONS_00002175"; exon_number "1"; oId "CUFF.1986.1"; tss_id "TSS2175"; +chr12 Cufflinks exon 24025737 24025851 . - . gene_id "XLOC_002176"; transcript_id "TCONS_00002176"; exon_number "1"; oId "CUFF.1989.1"; tss_id "TSS2176"; +chr12 Cufflinks exon 25557219 25557362 . - . gene_id "XLOC_002177"; transcript_id "TCONS_00002177"; exon_number "1"; oId "CUFF.1993.1"; tss_id "TSS2177"; +chr12 Cufflinks exon 25756233 25756330 . - . gene_id "XLOC_002178"; transcript_id "TCONS_00002178"; exon_number "1"; oId "CUFF.1994.1"; tss_id "TSS2178"; +chr12 Cufflinks exon 25932280 25932503 . - . gene_id "XLOC_002179"; transcript_id "TCONS_00002179"; exon_number "1"; oId "CUFF.1995.1"; tss_id "TSS2179"; +chr12 Cufflinks exon 26092193 26092289 . - . gene_id "XLOC_002180"; transcript_id "TCONS_00002180"; exon_number "1"; oId "CUFF.1996.1"; tss_id "TSS2180"; +chr12 Cufflinks exon 26526584 26526666 . - . gene_id "XLOC_002181"; transcript_id "TCONS_00002181"; exon_number "1"; oId "CUFF.1997.1"; tss_id "TSS2181"; +chr12 Cufflinks exon 27420425 27420462 . - . gene_id "XLOC_002182"; transcript_id "TCONS_00002182"; exon_number "1"; oId "CUFF.2001.1"; tss_id "TSS2182"; +chr12 Cufflinks exon 27872173 27872220 . - . gene_id "XLOC_002183"; transcript_id "TCONS_00002183"; exon_number "1"; oId "CUFF.2004.1"; tss_id "TSS2183"; +chr12 Cufflinks exon 27959082 27959323 . - . gene_id "XLOC_002184"; transcript_id "TCONS_00002184"; exon_number "1"; oId "CUFF.2005.1"; tss_id "TSS2184"; +chr12 Cufflinks exon 27960716 27960754 . - . gene_id "XLOC_002185"; transcript_id "TCONS_00002185"; exon_number "1"; oId "CUFF.2006.1"; tss_id "TSS2185"; +chr12 Cufflinks exon 28472331 28472396 . - . gene_id "XLOC_002186"; transcript_id "TCONS_00002186"; exon_number "1"; oId "CUFF.2008.1"; tss_id "TSS2186"; +chr12 Cufflinks exon 30459368 30459458 . - . gene_id "XLOC_002187"; transcript_id "TCONS_00002187"; exon_number "1"; oId "CUFF.2012.1"; tss_id "TSS2187"; +chr12 Cufflinks exon 30887693 30887752 . - . gene_id "XLOC_002188"; transcript_id "TCONS_00002188"; exon_number "1"; oId "CUFF.2015.1"; tss_id "TSS2188"; +chr12 Cufflinks exon 31587335 31587375 . - . gene_id "XLOC_002189"; transcript_id "TCONS_00002189"; exon_number "1"; oId "CUFF.2019.1"; tss_id "TSS2189"; +chr12 Cufflinks exon 31746730 31746751 . - . gene_id "XLOC_002190"; transcript_id "TCONS_00002190"; exon_number "1"; oId "CUFF.2021.1"; tss_id "TSS2190"; +chr12 Cufflinks exon 31747052 31747140 . - . gene_id "XLOC_002191"; transcript_id "TCONS_00002191"; exon_number "1"; oId "CUFF.2022.1"; tss_id "TSS2191"; +chr12 Cufflinks exon 31955892 31955986 . - . gene_id "XLOC_002192"; transcript_id "TCONS_00002192"; exon_number "1"; oId "CUFF.2023.1"; tss_id "TSS2192"; +chr12 Cufflinks exon 32363724 32363837 . - . gene_id "XLOC_002193"; transcript_id "TCONS_00002193"; exon_number "1"; oId "CUFF.2024.1"; tss_id "TSS2193"; +chr12 Cufflinks exon 32630319 32630405 . - . gene_id "XLOC_002194"; transcript_id "TCONS_00002194"; exon_number "1"; oId "CUFF.2026.1"; tss_id "TSS2194"; +chr12 Cufflinks exon 32861251 32861286 . - . gene_id "XLOC_002195"; transcript_id "TCONS_00002195"; exon_number "1"; oId "CUFF.2028.1"; tss_id "TSS2195"; +chr12 Cufflinks exon 33572511 33572566 . - . gene_id "XLOC_002196"; transcript_id "TCONS_00002196"; exon_number "1"; oId "CUFF.2031.1"; tss_id "TSS2196"; +chr12 Cufflinks exon 34076309 34076415 . - . gene_id "XLOC_002197"; transcript_id "TCONS_00002197"; exon_number "1"; oId "CUFF.2033.1"; tss_id "TSS2197"; +chr12 Cufflinks exon 34372316 34372825 . - . gene_id "XLOC_002198"; transcript_id "TCONS_00002198"; exon_number "1"; oId "CUFF.2036.1"; tss_id "TSS2198"; +chr12 Cufflinks exon 34382365 34382421 . - . gene_id "XLOC_002199"; transcript_id "TCONS_00002199"; exon_number "1"; oId "CUFF.2037.1"; tss_id "TSS2199"; +chr12 Cufflinks exon 38555266 38555384 . - . gene_id "XLOC_002200"; transcript_id "TCONS_00002200"; exon_number "1"; oId "CUFF.2039.1"; tss_id "TSS2200"; +chr12 Cufflinks exon 38557203 38557317 . - . gene_id "XLOC_002201"; transcript_id "TCONS_00002201"; exon_number "1"; oId "CUFF.2040.1"; tss_id "TSS2201"; +chr12 Cufflinks exon 40147265 40147413 . - . gene_id "XLOC_002202"; transcript_id "TCONS_00002202"; exon_number "1"; oId "CUFF.2042.1"; tss_id "TSS2202"; +chr12 Cufflinks exon 40947963 40948069 . - . gene_id "XLOC_002203"; transcript_id "TCONS_00002203"; exon_number "1"; oId "CUFF.2043.1"; tss_id "TSS2203"; +chr12 Cufflinks exon 41387701 41387739 . - . gene_id "XLOC_002204"; transcript_id "TCONS_00002204"; exon_number "1"; oId "CUFF.2045.1"; tss_id "TSS2204"; +chr12 Cufflinks exon 41492775 41492814 . - . gene_id "XLOC_002205"; transcript_id "TCONS_00002205"; exon_number "1"; oId "CUFF.2046.1"; tss_id "TSS2205"; +chr12 Cufflinks exon 41947047 41947086 . - . gene_id "XLOC_002206"; transcript_id "TCONS_00002206"; exon_number "1"; oId "CUFF.2047.1"; tss_id "TSS2206"; +chr12 Cufflinks exon 43834414 43834574 . - . gene_id "XLOC_002207"; transcript_id "TCONS_00002207"; exon_number "1"; oId "CUFF.2053.1"; tss_id "TSS2207"; +chr12 Cufflinks exon 45948373 45948442 . - . gene_id "XLOC_002208"; transcript_id "TCONS_00002208"; exon_number "1"; oId "CUFF.2058.1"; tss_id "TSS2208"; +chr12 Cufflinks exon 49039893 49039947 . - . gene_id "XLOC_002209"; transcript_id "TCONS_00002209"; exon_number "1"; oId "CUFF.2064.1"; tss_id "TSS2209"; +chr12 Cufflinks exon 49285935 49286011 . - . gene_id "XLOC_002210"; transcript_id "TCONS_00002210"; exon_number "1"; oId "CUFF.2066.1"; tss_id "TSS2210"; +chr12 Cufflinks exon 49354518 49354620 . - . gene_id "XLOC_002211"; transcript_id "TCONS_00002211"; exon_number "1"; oId "CUFF.2067.1"; tss_id "TSS2211"; +chr12 Cufflinks exon 50177028 50177100 . - . gene_id "XLOC_002212"; transcript_id "TCONS_00002212"; exon_number "1"; oId "CUFF.2070.1"; tss_id "TSS2212"; +chr12 Cufflinks exon 50211192 50211262 . - . gene_id "XLOC_002213"; transcript_id "TCONS_00002213"; exon_number "1"; oId "CUFF.2071.1"; tss_id "TSS2213"; +chr12 Cufflinks exon 50610755 50610797 . - . gene_id "XLOC_002214"; transcript_id "TCONS_00002214"; exon_number "1"; oId "CUFF.2073.1"; tss_id "TSS2214"; +chr12 Cufflinks exon 50650023 50650127 . - . gene_id "XLOC_002215"; transcript_id "TCONS_00002215"; exon_number "1"; oId "CUFF.2075.1"; tss_id "TSS2215"; +chr12 Cufflinks exon 50882276 50882349 . - . gene_id "XLOC_002216"; transcript_id "TCONS_00002216"; exon_number "1"; oId "CUFF.2076.1"; tss_id "TSS2216"; +chr12 Cufflinks exon 51166468 51166526 . - . gene_id "XLOC_002217"; transcript_id "TCONS_00002217"; exon_number "1"; oId "CUFF.2079.1"; tss_id "TSS2217"; +chr12 Cufflinks exon 51235264 51235540 . - . gene_id "XLOC_002218"; transcript_id "TCONS_00002218"; exon_number "1"; oId "CUFF.2080.1"; tss_id "TSS2218"; +chr12 Cufflinks exon 51407920 51408024 . - . gene_id "XLOC_002219"; transcript_id "TCONS_00002219"; exon_number "1"; oId "CUFF.2082.1"; tss_id "TSS2219"; +chr12 Cufflinks exon 53532329 53532435 . - . gene_id "XLOC_002220"; transcript_id "TCONS_00002220"; exon_number "1"; oId "CUFF.2091.1"; tss_id "TSS2220"; +chr12 Cufflinks exon 53546503 53546539 . - . gene_id "XLOC_002221"; transcript_id "TCONS_00002221"; exon_number "1"; oId "CUFF.2092.1"; tss_id "TSS2221"; +chr12 Cufflinks exon 54020736 54020776 . - . gene_id "XLOC_002222"; transcript_id "TCONS_00002222"; exon_number "1"; oId "CUFF.2093.1"; tss_id "TSS2222"; +chr12 Cufflinks exon 54649404 54649693 . - . gene_id "XLOC_002223"; transcript_id "TCONS_00002223"; exon_number "1"; oId "CUFF.2095.1"; tss_id "TSS2223"; +chr12 Cufflinks exon 54711580 54711671 . - . gene_id "XLOC_002224"; transcript_id "TCONS_00002224"; exon_number "1"; oId "CUFF.2096.1"; tss_id "TSS2224"; +chr12 Cufflinks exon 56746179 56746234 . - . gene_id "XLOC_002225"; transcript_id "TCONS_00002225"; exon_number "1"; oId "CUFF.2101.1"; tss_id "TSS2225"; +chr12 Cufflinks exon 57064218 57064530 . - . gene_id "XLOC_002226"; transcript_id "TCONS_00002226"; exon_number "1"; oId "CUFF.2104.1"; tss_id "TSS2226"; +chr12 Cufflinks exon 58062727 58062823 . - . gene_id "XLOC_002227"; transcript_id "TCONS_00002227"; exon_number "1"; oId "CUFF.2112.1"; tss_id "TSS2227"; +chr12 Cufflinks exon 58199940 58200043 . - . gene_id "XLOC_002228"; transcript_id "TCONS_00002228"; exon_number "1"; oId "CUFF.2113.1"; tss_id "TSS2228"; +chr12 Cufflinks exon 58251185 58251295 . - . gene_id "XLOC_002229"; transcript_id "TCONS_00002229"; exon_number "1"; oId "CUFF.2114.1"; tss_id "TSS2229"; +chr12 Cufflinks exon 58251585 58251765 . - . gene_id "XLOC_002230"; transcript_id "TCONS_00002230"; exon_number "1"; oId "CUFF.2115.1"; tss_id "TSS2230"; +chr12 Cufflinks exon 58371821 58372045 . - . gene_id "XLOC_002231"; transcript_id "TCONS_00002231"; exon_number "1"; oId "CUFF.2116.1"; tss_id "TSS2231"; +chr12 Cufflinks exon 59762851 59762932 . - . gene_id "XLOC_002232"; transcript_id "TCONS_00002232"; exon_number "1"; oId "CUFF.2118.1"; tss_id "TSS2232"; +chr12 Cufflinks exon 59844081 59844127 . - . gene_id "XLOC_002233"; transcript_id "TCONS_00002233"; exon_number "1"; oId "CUFF.2119.1"; tss_id "TSS2233"; +chr12 Cufflinks exon 59844456 59844526 . - . gene_id "XLOC_002234"; transcript_id "TCONS_00002234"; exon_number "1"; oId "CUFF.2120.1"; tss_id "TSS2234"; +chr12 Cufflinks exon 59980571 59980719 . - . gene_id "XLOC_002235"; transcript_id "TCONS_00002235"; exon_number "1"; oId "CUFF.2121.1"; tss_id "TSS2235"; +chr12 Cufflinks exon 60878045 60878080 . - . gene_id "XLOC_002236"; transcript_id "TCONS_00002236"; exon_number "1"; oId "CUFF.2122.1"; tss_id "TSS2236"; +chr12 Cufflinks exon 62727895 62727978 . - . gene_id "XLOC_002237"; transcript_id "TCONS_00002237"; exon_number "1"; oId "CUFF.2123.1"; tss_id "TSS2237"; +chr12 Cufflinks exon 62939362 62939459 . - . gene_id "XLOC_002238"; transcript_id "TCONS_00002238"; exon_number "1"; oId "CUFF.2125.1"; tss_id "TSS2238"; +chr12 Cufflinks exon 63193534 63193787 . - . gene_id "XLOC_002239"; transcript_id "TCONS_00002239"; exon_number "1"; oId "CUFF.2127.1"; tss_id "TSS2239"; +chr12 Cufflinks exon 63244519 63244678 . - . gene_id "XLOC_002240"; transcript_id "TCONS_00002240"; exon_number "1"; oId "CUFF.2128.1"; tss_id "TSS2240"; +chr12 Cufflinks exon 64622339 64622455 . - . gene_id "XLOC_002241"; transcript_id "TCONS_00002241"; exon_number "1"; oId "CUFF.2130.1"; tss_id "TSS2241"; +chr12 Cufflinks exon 64749539 64749645 . - . gene_id "XLOC_002242"; transcript_id "TCONS_00002242"; exon_number "1"; oId "CUFF.2131.1"; tss_id "TSS2242"; +chr12 Cufflinks exon 65154646 65154754 . - . gene_id "XLOC_002243"; transcript_id "TCONS_00002243"; exon_number "1"; oId "CUFF.2132.1"; tss_id "TSS2243"; +chr12 Cufflinks exon 65317865 65317928 . - . gene_id "XLOC_002244"; transcript_id "TCONS_00002244"; exon_number "1"; oId "CUFF.2133.1"; tss_id "TSS2244"; +chr12 Cufflinks exon 67762433 67762471 . - . gene_id "XLOC_002245"; transcript_id "TCONS_00002245"; exon_number "1"; oId "CUFF.2137.1"; tss_id "TSS2245"; +chr12 Cufflinks exon 67766647 67766781 . - . gene_id "XLOC_002246"; transcript_id "TCONS_00002246"; exon_number "1"; oId "CUFF.2138.1"; tss_id "TSS2246"; +chr12 Cufflinks exon 67817780 67817823 . - . gene_id "XLOC_002247"; transcript_id "TCONS_00002247"; exon_number "1"; oId "CUFF.2139.1"; tss_id "TSS2247"; +chr12 Cufflinks exon 69075786 69075872 . - . gene_id "XLOC_002248"; transcript_id "TCONS_00002248"; exon_number "1"; oId "CUFF.2143.1"; tss_id "TSS2248"; +chr12 Cufflinks exon 70063036 70063099 . - . gene_id "XLOC_002249"; transcript_id "TCONS_00002249"; exon_number "1"; oId "CUFF.2149.1"; tss_id "TSS2249"; +chr12 Cufflinks exon 70220759 70220827 . - . gene_id "XLOC_002250"; transcript_id "TCONS_00002250"; exon_number "1"; oId "CUFF.2150.1"; tss_id "TSS2250"; +chr12 Cufflinks exon 70837565 70837679 . - . gene_id "XLOC_002251"; transcript_id "TCONS_00002251"; exon_number "1"; oId "CUFF.2152.1"; tss_id "TSS2251"; +chr12 Cufflinks exon 70941146 70941183 . - . gene_id "XLOC_002252"; transcript_id "TCONS_00002252"; exon_number "1"; oId "CUFF.2153.1"; tss_id "TSS2252"; +chr12 Cufflinks exon 71869718 71869887 . - . gene_id "XLOC_002253"; transcript_id "TCONS_00002253"; exon_number "1"; oId "CUFF.2154.1"; tss_id "TSS2253"; +chr12 Cufflinks exon 71936902 71936943 . - . gene_id "XLOC_002254"; transcript_id "TCONS_00002254"; exon_number "1"; oId "CUFF.2156.1"; tss_id "TSS2254"; +chr12 Cufflinks exon 72129473 72129525 . - . gene_id "XLOC_002255"; transcript_id "TCONS_00002255"; exon_number "1"; oId "CUFF.2157.1"; tss_id "TSS2255"; +chr12 Cufflinks exon 72228954 72228995 . - . gene_id "XLOC_002256"; transcript_id "TCONS_00002256"; exon_number "1"; oId "CUFF.2158.1"; tss_id "TSS2256"; +chr12 Cufflinks exon 74072968 74073066 . - . gene_id "XLOC_002257"; transcript_id "TCONS_00002257"; exon_number "1"; oId "CUFF.2159.1"; tss_id "TSS2257"; +chr12 Cufflinks exon 74158058 74158194 . - . gene_id "XLOC_002258"; transcript_id "TCONS_00002258"; exon_number "1"; oId "CUFF.2160.1"; tss_id "TSS2258"; +chr12 Cufflinks exon 75347341 75347612 . - . gene_id "XLOC_002259"; transcript_id "TCONS_00002259"; exon_number "1"; oId "CUFF.2163.1"; tss_id "TSS2259"; +chr12 Cufflinks exon 76351612 76351909 . - . gene_id "XLOC_002260"; transcript_id "TCONS_00002260"; exon_number "1"; oId "CUFF.2167.1"; tss_id "TSS2260"; +chr12 Cufflinks exon 77556704 77556806 . - . gene_id "XLOC_002261"; transcript_id "TCONS_00002261"; exon_number "1"; oId "CUFF.2170.1"; tss_id "TSS2261"; +chr12 Cufflinks exon 78172582 78172629 . - . gene_id "XLOC_002262"; transcript_id "TCONS_00002262"; exon_number "1"; oId "CUFF.2171.1"; tss_id "TSS2262"; +chr12 Cufflinks exon 79918646 79918950 . - . gene_id "XLOC_002263"; transcript_id "TCONS_00002263"; exon_number "1"; oId "CUFF.2172.1"; tss_id "TSS2263"; +chr12 Cufflinks exon 80272093 80272195 . - . gene_id "XLOC_002264"; transcript_id "TCONS_00002264"; exon_number "1"; oId "CUFF.2173.1"; tss_id "TSS2264"; +chr12 Cufflinks exon 80462490 80462534 . - . gene_id "XLOC_002265"; transcript_id "TCONS_00002265"; exon_number "1"; oId "CUFF.2174.1"; tss_id "TSS2265"; +chr12 Cufflinks exon 80737339 80737571 . - . gene_id "XLOC_002266"; transcript_id "TCONS_00002266"; exon_number "1"; oId "CUFF.2175.1"; tss_id "TSS2266"; +chr12 Cufflinks exon 81493999 81494077 . - . gene_id "XLOC_002267"; transcript_id "TCONS_00002267"; exon_number "1"; oId "CUFF.2176.1"; tss_id "TSS2267"; +chr12 Cufflinks exon 83369168 83369200 . - . gene_id "XLOC_002268"; transcript_id "TCONS_00002268"; exon_number "1"; oId "CUFF.2177.1"; tss_id "TSS2268"; +chr12 Cufflinks exon 83458422 83458479 . - . gene_id "XLOC_002269"; transcript_id "TCONS_00002269"; exon_number "1"; oId "CUFF.2179.1"; tss_id "TSS2269"; +chr12 Cufflinks exon 84601691 84601732 . - . gene_id "XLOC_002270"; transcript_id "TCONS_00002270"; exon_number "1"; oId "CUFF.2182.1"; tss_id "TSS2270"; +chr12 Cufflinks exon 85287749 85287805 . - . gene_id "XLOC_002271"; transcript_id "TCONS_00002271"; exon_number "1"; oId "CUFF.2184.1"; tss_id "TSS2271"; +chr12 Cufflinks exon 85340544 85340585 . - . gene_id "XLOC_002272"; transcript_id "TCONS_00002272"; exon_number "1"; oId "CUFF.2185.1"; tss_id "TSS2272"; +chr12 Cufflinks exon 85562697 85562760 . - . gene_id "XLOC_002273"; transcript_id "TCONS_00002273"; exon_number "1"; oId "CUFF.2186.1"; tss_id "TSS2273"; +chr12 Cufflinks exon 88782328 88782366 . - . gene_id "XLOC_002274"; transcript_id "TCONS_00002274"; exon_number "1"; oId "CUFF.2190.1"; tss_id "TSS2274"; +chr12 Cufflinks exon 89676001 89676062 . - . gene_id "XLOC_002275"; transcript_id "TCONS_00002275"; exon_number "1"; oId "CUFF.2193.1"; tss_id "TSS2275"; +chr12 Cufflinks exon 90682699 90682740 . - . gene_id "XLOC_002276"; transcript_id "TCONS_00002276"; exon_number "1"; oId "CUFF.2198.1"; tss_id "TSS2276"; +chr12 Cufflinks exon 90697591 90697625 . - . gene_id "XLOC_002277"; transcript_id "TCONS_00002277"; exon_number "1"; oId "CUFF.2199.1"; tss_id "TSS2277"; +chr12 Cufflinks exon 90737325 90737383 . - . gene_id "XLOC_002278"; transcript_id "TCONS_00002278"; exon_number "1"; oId "CUFF.2200.1"; tss_id "TSS2278"; +chr12 Cufflinks exon 92938692 92938755 . - . gene_id "XLOC_002279"; transcript_id "TCONS_00002279"; exon_number "1"; oId "CUFF.2202.1"; tss_id "TSS2279"; +chr12 Cufflinks exon 93659406 93659509 . - . gene_id "XLOC_002280"; transcript_id "TCONS_00002280"; exon_number "1"; oId "CUFF.2206.1"; tss_id "TSS2280"; +chr12 Cufflinks exon 93919890 93919921 . - . gene_id "XLOC_002281"; transcript_id "TCONS_00002281"; exon_number "1"; oId "CUFF.2209.1"; tss_id "TSS2281"; +chr12 Cufflinks exon 94402594 94402823 . - . gene_id "XLOC_002282"; transcript_id "TCONS_00002282"; exon_number "1"; oId "CUFF.2211.1"; tss_id "TSS2282"; +chr12 Cufflinks exon 95519026 95519063 . - . gene_id "XLOC_002283"; transcript_id "TCONS_00002283"; exon_number "1"; oId "CUFF.2217.1"; tss_id "TSS2283"; +chr12 Cufflinks exon 95832519 95832605 . - . gene_id "XLOC_002284"; transcript_id "TCONS_00002284"; exon_number "1"; oId "CUFF.2220.1"; tss_id "TSS2284"; +chr12 Cufflinks exon 96186307 96186413 . - . gene_id "XLOC_002285"; transcript_id "TCONS_00002285"; exon_number "1"; oId "CUFF.2222.1"; tss_id "TSS2285"; +chr12 Cufflinks exon 96495712 96496027 . - . gene_id "XLOC_002286"; transcript_id "TCONS_00002286"; exon_number "1"; oId "CUFF.2225.1"; tss_id "TSS2286"; +chr12 Cufflinks exon 96697149 96697291 . - . gene_id "XLOC_002287"; transcript_id "TCONS_00002287"; exon_number "1"; oId "CUFF.2226.1"; tss_id "TSS2287"; +chr12 Cufflinks exon 96821141 96821263 . - . gene_id "XLOC_002288"; transcript_id "TCONS_00002288"; exon_number "1"; oId "CUFF.2227.1"; tss_id "TSS2288"; +chr12 Cufflinks exon 97063110 97063140 . - . gene_id "XLOC_002289"; transcript_id "TCONS_00002289"; exon_number "1"; oId "CUFF.2228.1"; tss_id "TSS2289"; +chr12 Cufflinks exon 97834006 97834053 . - . gene_id "XLOC_002290"; transcript_id "TCONS_00002290"; exon_number "1"; oId "CUFF.2230.1"; tss_id "TSS2290"; +chr12 Cufflinks exon 97862877 97862919 . - . gene_id "XLOC_002291"; transcript_id "TCONS_00002291"; exon_number "1"; oId "CUFF.2231.1"; tss_id "TSS2291"; +chr12 Cufflinks exon 98811674 98811816 . - . gene_id "XLOC_002292"; transcript_id "TCONS_00002292"; exon_number "1"; oId "CUFF.2234.1"; tss_id "TSS2292"; +chr12 Cufflinks exon 99027725 99027766 . - . gene_id "XLOC_002293"; transcript_id "TCONS_00002293"; exon_number "1"; oId "CUFF.2237.1"; tss_id "TSS2293"; +chr12 Cufflinks exon 99477594 99477682 . - . gene_id "XLOC_002294"; transcript_id "TCONS_00002294"; exon_number "1"; oId "CUFF.2238.1"; tss_id "TSS2294"; +chr12 Cufflinks exon 99491617 99491785 . - . gene_id "XLOC_002295"; transcript_id "TCONS_00002295"; exon_number "1"; oId "CUFF.2239.1"; tss_id "TSS2295"; +chr12 Cufflinks exon 99558901 99558936 . - . gene_id "XLOC_002296"; transcript_id "TCONS_00002296"; exon_number "1"; oId "CUFF.2240.1"; tss_id "TSS2296"; +chr12 Cufflinks exon 100552272 100552468 . - . gene_id "XLOC_002297"; transcript_id "TCONS_00002297"; exon_number "1"; oId "CUFF.2242.1"; tss_id "TSS2297"; +chr12 Cufflinks exon 101000777 101000820 . - . gene_id "XLOC_002298"; transcript_id "TCONS_00002298"; exon_number "1"; oId "CUFF.2245.1"; tss_id "TSS2298"; +chr12 Cufflinks exon 101593049 101593155 . - . gene_id "XLOC_002299"; transcript_id "TCONS_00002299"; exon_number "1"; oId "CUFF.2246.1"; tss_id "TSS2299"; +chr12 Cufflinks exon 101669895 101669932 . - . gene_id "XLOC_002300"; transcript_id "TCONS_00002300"; exon_number "1"; oId "CUFF.2247.1"; tss_id "TSS2300"; +chr12 Cufflinks exon 101752524 101752623 . - . gene_id "XLOC_002301"; transcript_id "TCONS_00002301"; exon_number "1"; oId "CUFF.2248.1"; tss_id "TSS2301"; +chr12 Cufflinks exon 102159187 102159287 . - . gene_id "XLOC_002302"; transcript_id "TCONS_00002302"; exon_number "1"; oId "CUFF.2253.1"; tss_id "TSS2302"; +chr12 Cufflinks exon 102190188 102190314 . - . gene_id "XLOC_002303"; transcript_id "TCONS_00002303"; exon_number "1"; oId "CUFF.2256.1"; tss_id "TSS2303"; +chr12 Cufflinks exon 102206205 102206251 . - . gene_id "XLOC_002304"; transcript_id "TCONS_00002304"; exon_number "1"; oId "CUFF.2257.1"; tss_id "TSS2304"; +chr12 Cufflinks exon 102206553 102206580 . - . gene_id "XLOC_002305"; transcript_id "TCONS_00002305"; exon_number "1"; oId "CUFF.2258.1"; tss_id "TSS2305"; +chr12 Cufflinks exon 102206911 102206969 . - . gene_id "XLOC_002306"; transcript_id "TCONS_00002306"; exon_number "1"; oId "CUFF.2259.1"; tss_id "TSS2306"; +chr12 Cufflinks exon 102265520 102265579 . - . gene_id "XLOC_002307"; transcript_id "TCONS_00002307"; exon_number "1"; oId "CUFF.2261.1"; tss_id "TSS2307"; +chr12 Cufflinks exon 102279096 102279224 . - . gene_id "XLOC_002308"; transcript_id "TCONS_00002308"; exon_number "1"; oId "CUFF.2262.1"; tss_id "TSS2308"; +chr12 Cufflinks exon 102539648 102539682 . - . gene_id "XLOC_002309"; transcript_id "TCONS_00002309"; exon_number "1"; oId "CUFF.2263.1"; tss_id "TSS2309"; +chr12 Cufflinks exon 102611074 102611391 . - . gene_id "XLOC_002310"; transcript_id "TCONS_00002310"; exon_number "1"; oId "CUFF.2264.1"; tss_id "TSS2310"; +chr12 Cufflinks exon 103507813 103507861 . - . gene_id "XLOC_002311"; transcript_id "TCONS_00002311"; exon_number "1"; oId "CUFF.2266.1"; tss_id "TSS2311"; +chr12 Cufflinks exon 104319850 104319959 . - . gene_id "XLOC_002312"; transcript_id "TCONS_00002312"; exon_number "1"; oId "CUFF.2268.1"; tss_id "TSS2312"; +chr12 Cufflinks exon 105658493 105658531 . - . gene_id "XLOC_002313"; transcript_id "TCONS_00002313"; exon_number "1"; oId "CUFF.2272.1"; tss_id "TSS2313"; +chr12 Cufflinks exon 106126439 106126480 . - . gene_id "XLOC_002314"; transcript_id "TCONS_00002314"; exon_number "1"; oId "CUFF.2273.1"; tss_id "TSS2314"; +chr12 Cufflinks exon 106591496 106591533 . - . gene_id "XLOC_002315"; transcript_id "TCONS_00002315"; exon_number "1"; oId "CUFF.2275.1"; tss_id "TSS2315"; +chr12 Cufflinks exon 106676712 106676766 . - . gene_id "XLOC_002316"; transcript_id "TCONS_00002316"; exon_number "1"; oId "CUFF.2276.1"; tss_id "TSS2316"; +chr12 Cufflinks exon 107665097 107665171 . - . gene_id "XLOC_002317"; transcript_id "TCONS_00002317"; exon_number "1"; oId "CUFF.2278.1"; tss_id "TSS2317"; +chr12 Cufflinks exon 107880323 107880412 . - . gene_id "XLOC_002318"; transcript_id "TCONS_00002318"; exon_number "1"; oId "CUFF.2279.1"; tss_id "TSS2318"; +chr12 Cufflinks exon 109320211 109320316 . - . gene_id "XLOC_002319"; transcript_id "TCONS_00002319"; exon_number "1"; oId "CUFF.2282.1"; tss_id "TSS2319"; +chr12 Cufflinks exon 110005778 110005916 . - . gene_id "XLOC_002320"; transcript_id "TCONS_00002320"; exon_number "1"; oId "CUFF.2284.1"; tss_id "TSS2320"; +chr12 Cufflinks exon 110058040 110058136 . - . gene_id "XLOC_002321"; transcript_id "TCONS_00002321"; exon_number "1"; oId "CUFF.2285.1"; tss_id "TSS2321"; +chr12 Cufflinks exon 110100750 110100988 . - . gene_id "XLOC_002322"; transcript_id "TCONS_00002322"; exon_number "1"; oId "CUFF.2286.1"; tss_id "TSS2322"; +chr12 Cufflinks exon 110226759 110226938 . - . gene_id "XLOC_002323"; transcript_id "TCONS_00002323"; exon_number "1"; oId "CUFF.2287.1"; tss_id "TSS2323"; +chr12 Cufflinks exon 110304013 110304314 . - . gene_id "XLOC_002324"; transcript_id "TCONS_00002324"; exon_number "1"; oId "CUFF.2288.1"; tss_id "TSS2324"; +chr12 Cufflinks exon 110798243 110798551 . - . gene_id "XLOC_002325"; transcript_id "TCONS_00002325"; exon_number "1"; oId "CUFF.2290.1"; tss_id "TSS2325"; +chr12 Cufflinks exon 112002626 112002686 . - . gene_id "XLOC_002326"; transcript_id "TCONS_00002326"; exon_number "1"; oId "CUFF.2292.1"; tss_id "TSS2326"; +chr12 Cufflinks exon 112298015 112298061 . - . gene_id "XLOC_002327"; transcript_id "TCONS_00002327"; exon_number "1"; oId "CUFF.2294.1"; tss_id "TSS2327"; +chr12 Cufflinks exon 112442404 112442460 . - . gene_id "XLOC_002328"; transcript_id "TCONS_00002328"; exon_number "1"; oId "CUFF.2295.1"; tss_id "TSS2328"; +chr12 Cufflinks exon 112442751 112442803 . - . gene_id "XLOC_002329"; transcript_id "TCONS_00002329"; exon_number "1"; oId "CUFF.2296.1"; tss_id "TSS2329"; +chr12 Cufflinks exon 112719135 112719166 . - . gene_id "XLOC_002330"; transcript_id "TCONS_00002330"; exon_number "1"; oId "CUFF.2299.1"; tss_id "TSS2330"; +chr12 Cufflinks exon 112731944 112732004 . - . gene_id "XLOC_002331"; transcript_id "TCONS_00002331"; exon_number "1"; oId "CUFF.2300.1"; tss_id "TSS2331"; +chr12 Cufflinks exon 113166369 113166433 . - . gene_id "XLOC_002332"; transcript_id "TCONS_00002332"; exon_number "1"; oId "CUFF.2301.1"; tss_id "TSS2332"; +chr12 Cufflinks exon 113774419 113774471 . - . gene_id "XLOC_002333"; transcript_id "TCONS_00002333"; exon_number "1"; oId "CUFF.2302.1"; tss_id "TSS2333"; +chr12 Cufflinks exon 114040596 114040658 . - . gene_id "XLOC_002334"; transcript_id "TCONS_00002334"; exon_number "1"; oId "CUFF.2303.1"; tss_id "TSS2334"; +chr12 Cufflinks exon 114642866 114642907 . - . gene_id "XLOC_002335"; transcript_id "TCONS_00002335"; exon_number "1"; oId "CUFF.2305.1"; tss_id "TSS2335"; +chr12 Cufflinks exon 114942754 114942992 . - . gene_id "XLOC_002336"; transcript_id "TCONS_00002336"; exon_number "1"; oId "CUFF.2306.1"; tss_id "TSS2336"; +chr12 Cufflinks exon 114943531 114943673 . - . gene_id "XLOC_002337"; transcript_id "TCONS_00002337"; exon_number "1"; oId "CUFF.2307.1"; tss_id "TSS2337"; +chr12 Cufflinks exon 115008319 115008361 . - . gene_id "XLOC_002338"; transcript_id "TCONS_00002338"; exon_number "1"; oId "CUFF.2308.1"; tss_id "TSS2338"; +chr12 Cufflinks exon 115260207 115260244 . - . gene_id "XLOC_002339"; transcript_id "TCONS_00002339"; exon_number "1"; oId "CUFF.2309.1"; tss_id "TSS2339"; +chr12 Cufflinks exon 116661808 116661845 . - . gene_id "XLOC_002340"; transcript_id "TCONS_00002340"; exon_number "1"; oId "CUFF.2312.1"; tss_id "TSS2340"; +chr12 Cufflinks exon 118573639 118573695 . - . gene_id "XLOC_002341"; transcript_id "TCONS_00002341"; exon_number "1"; oId "CUFF.2314.1"; tss_id "TSS2341"; +chr12 Cufflinks exon 120068985 120069195 . - . gene_id "XLOC_002342"; transcript_id "TCONS_00002342"; exon_number "1"; oId "CUFF.2320.1"; tss_id "TSS2342"; +chr12 Cufflinks exon 120729563 120729706 . - . gene_id "XLOC_002343"; transcript_id "TCONS_00002343"; exon_number "1"; oId "CUFF.2323.1"; tss_id "TSS2343"; +chr12 Cufflinks exon 120730897 120731040 . - . gene_id "XLOC_002344"; transcript_id "TCONS_00002344"; exon_number "1"; oId "CUFF.2324.1"; tss_id "TSS2344"; +chr12 Cufflinks exon 120751045 120751144 . - . gene_id "XLOC_002345"; transcript_id "TCONS_00002345"; exon_number "1"; oId "CUFF.2325.1"; tss_id "TSS2345"; +chr12 Cufflinks exon 120877350 120877388 . - . gene_id "XLOC_002346"; transcript_id "TCONS_00002346"; exon_number "1"; oId "CUFF.2326.1"; tss_id "TSS2346"; +chr12 Cufflinks exon 120956695 120956745 . - . gene_id "XLOC_002347"; transcript_id "TCONS_00002347"; exon_number "1"; oId "CUFF.2327.1"; tss_id "TSS2347"; +chr12 Cufflinks exon 121111555 121111589 . - . gene_id "XLOC_002348"; transcript_id "TCONS_00002348"; exon_number "1"; oId "CUFF.2328.1"; tss_id "TSS2348"; +chr12 Cufflinks exon 121410754 121410799 . - . gene_id "XLOC_002349"; transcript_id "TCONS_00002349"; exon_number "1"; oId "CUFF.2329.1"; tss_id "TSS2349"; +chr12 Cufflinks exon 122180411 122180474 . - . gene_id "XLOC_002350"; transcript_id "TCONS_00002350"; exon_number "1"; oId "CUFF.2331.1"; tss_id "TSS2350"; +chr12 Cufflinks exon 122999965 123000000 . - . gene_id "XLOC_002351"; transcript_id "TCONS_00002351"; exon_number "1"; oId "CUFF.2334.1"; tss_id "TSS2351"; +chr12 Cufflinks exon 123117728 123117794 . - . gene_id "XLOC_002352"; transcript_id "TCONS_00002352"; exon_number "1"; oId "CUFF.2335.1"; tss_id "TSS2352"; +chr12 Cufflinks exon 123767463 123767580 . - . gene_id "XLOC_002353"; transcript_id "TCONS_00002353"; exon_number "1"; oId "CUFF.2339.1"; tss_id "TSS2353"; +chr12 Cufflinks exon 124326537 124326565 . - . gene_id "XLOC_002354"; transcript_id "TCONS_00002354"; exon_number "1"; oId "CUFF.2341.1"; tss_id "TSS2354"; +chr12 Cufflinks exon 125406301 125406372 . - . gene_id "XLOC_002355"; transcript_id "TCONS_00002355"; exon_number "1"; oId "CUFF.2344.1"; tss_id "TSS2355"; +chr12 Cufflinks exon 125411891 125411962 . - . gene_id "XLOC_002356"; transcript_id "TCONS_00002356"; exon_number "1"; oId "CUFF.2345.1"; tss_id "TSS2356"; +chr12 Cufflinks exon 125412388 125412461 . - . gene_id "XLOC_002357"; transcript_id "TCONS_00002357"; exon_number "1"; oId "CUFF.2346.1"; tss_id "TSS2357"; +chr12 Cufflinks exon 125424193 125424264 . - . gene_id "XLOC_002358"; transcript_id "TCONS_00002358"; exon_number "1"; oId "CUFF.2347.1"; tss_id "TSS2358"; +chr12 Cufflinks exon 127650453 127650987 . - . gene_id "XLOC_002359"; transcript_id "TCONS_00002359"; exon_number "1"; oId "CUFF.2354.1"; tss_id "TSS2359"; +chr12 Cufflinks exon 131354305 131354382 . - . gene_id "XLOC_002360"; transcript_id "TCONS_00002360"; exon_number "1"; oId "CUFF.2359.1"; tss_id "TSS2360"; +chr12 Cufflinks exon 131499436 131499486 . - . gene_id "XLOC_002361"; transcript_id "TCONS_00002361"; exon_number "1"; oId "CUFF.2360.1"; tss_id "TSS2361"; +chr12 Cufflinks exon 131784206 131784296 . - . gene_id "XLOC_002362"; transcript_id "TCONS_00002362"; exon_number "1"; oId "CUFF.2361.1"; tss_id "TSS2362"; +chr12 Cufflinks exon 132285859 132285971 . - . gene_id "XLOC_002363"; transcript_id "TCONS_00002363"; exon_number "1"; oId "CUFF.2363.1"; tss_id "TSS2363"; +chr12 Cufflinks exon 132299808 132299910 . - . gene_id "XLOC_002364"; transcript_id "TCONS_00002364"; exon_number "1"; oId "CUFF.2364.1"; tss_id "TSS2364"; +chr12 Cufflinks exon 133300530 133300642 . - . gene_id "XLOC_002365"; transcript_id "TCONS_00002365"; exon_number "1"; oId "CUFF.2365.1"; tss_id "TSS2365"; +chr12 Cufflinks exon 133411962 133412050 . - . gene_id "XLOC_002366"; transcript_id "TCONS_00002366"; exon_number "1"; oId "CUFF.2366.1"; tss_id "TSS2366"; +chr12 Cufflinks exon 133624127 133624211 . - . gene_id "XLOC_002367"; transcript_id "TCONS_00002367"; exon_number "1"; oId "CUFF.2367.1"; tss_id "TSS2367"; +chr12 Cufflinks exon 133814923 133815024 . - . gene_id "XLOC_002368"; transcript_id "TCONS_00002368"; exon_number "1"; oId "CUFF.2368.1"; tss_id "TSS2368"; +chr13 Cufflinks exon 19454194 19454297 . + . gene_id "XLOC_002369"; transcript_id "TCONS_00002369"; exon_number "1"; oId "CUFF.2370.1"; tss_id "TSS2369"; +chr13 Cufflinks exon 19519854 19519888 . + . gene_id "XLOC_002370"; transcript_id "TCONS_00002370"; exon_number "1"; oId "CUFF.2371.1"; tss_id "TSS2370"; +chr13 Cufflinks exon 19662624 19662715 . + . gene_id "XLOC_002371"; transcript_id "TCONS_00002371"; exon_number "1"; oId "CUFF.2372.1"; tss_id "TSS2371"; +chr13 Cufflinks exon 19717122 19717182 . + . gene_id "XLOC_002372"; transcript_id "TCONS_00002372"; exon_number "1"; oId "CUFF.2373.1"; tss_id "TSS2372"; +chr13 Cufflinks exon 20449326 20449418 . + . gene_id "XLOC_002373"; transcript_id "TCONS_00002373"; exon_number "1"; oId "CUFF.2376.1"; tss_id "TSS2373"; +chr13 Cufflinks exon 20639936 20639971 . + . gene_id "XLOC_002374"; transcript_id "TCONS_00002374"; exon_number "1"; oId "CUFF.2377.1"; tss_id "TSS2374"; +chr13 Cufflinks exon 21063263 21063312 . + . gene_id "XLOC_002375"; transcript_id "TCONS_00002375"; exon_number "1"; oId "CUFF.2379.1"; tss_id "TSS2375"; +chr13 Cufflinks exon 21186304 21186473 . + . gene_id "XLOC_002376"; transcript_id "TCONS_00002376"; exon_number "1"; oId "CUFF.2380.1"; tss_id "TSS2376"; +chr13 Cufflinks exon 21432651 21432702 . + . gene_id "XLOC_002377"; transcript_id "TCONS_00002377"; exon_number "1"; oId "CUFF.2381.1"; tss_id "TSS2377"; +chr13 Cufflinks exon 21543457 21543558 . + . gene_id "XLOC_002378"; transcript_id "TCONS_00002378"; exon_number "1"; oId "CUFF.2382.1"; tss_id "TSS2378"; +chr13 Cufflinks exon 21920155 21920196 . + . gene_id "XLOC_002379"; transcript_id "TCONS_00002379"; exon_number "1"; oId "CUFF.2385.1"; tss_id "TSS2379"; +chr13 Cufflinks exon 22041029 22041069 . + . gene_id "XLOC_002380"; transcript_id "TCONS_00002380"; exon_number "1"; oId "CUFF.2388.1"; tss_id "TSS2380"; +chr13 Cufflinks exon 22364677 22365006 . + . gene_id "XLOC_002381"; transcript_id "TCONS_00002381"; exon_number "1"; oId "CUFF.2391.1"; tss_id "TSS2381"; +chr13 Cufflinks exon 23617566 23617703 . + . gene_id "XLOC_002382"; transcript_id "TCONS_00002382"; exon_number "1"; oId "CUFF.2394.1"; tss_id "TSS2382"; +chr13 Cufflinks exon 24752609 24752645 . + . gene_id "XLOC_002383"; transcript_id "TCONS_00002383"; exon_number "1"; oId "CUFF.2396.1"; tss_id "TSS2383"; +chr13 Cufflinks exon 24857499 24857534 . + . gene_id "XLOC_002384"; transcript_id "TCONS_00002384"; exon_number "1"; oId "CUFF.2397.1"; tss_id "TSS2384"; +chr13 Cufflinks exon 25046182 25046243 . + . gene_id "XLOC_002385"; transcript_id "TCONS_00002385"; exon_number "1"; oId "CUFF.2398.1"; tss_id "TSS2385"; +chr13 Cufflinks exon 26091258 26091363 . + . gene_id "XLOC_002386"; transcript_id "TCONS_00002386"; exon_number "1"; oId "CUFF.2400.1"; tss_id "TSS2386"; +chr13 Cufflinks exon 26518662 26518888 . + . gene_id "XLOC_002387"; transcript_id "TCONS_00002387"; exon_number "1"; oId "CUFF.2401.1"; tss_id "TSS2387"; +chr13 Cufflinks exon 26867159 26867201 . + . gene_id "XLOC_002388"; transcript_id "TCONS_00002388"; exon_number "1"; oId "CUFF.2403.1"; tss_id "TSS2388"; +chr13 Cufflinks exon 28062274 28062369 . + . gene_id "XLOC_002389"; transcript_id "TCONS_00002389"; exon_number "1"; oId "CUFF.2407.1"; tss_id "TSS2389"; +chr13 Cufflinks exon 28109702 28109743 . + . gene_id "XLOC_002390"; transcript_id "TCONS_00002390"; exon_number "1"; oId "CUFF.2408.1"; tss_id "TSS2390"; +chr13 Cufflinks exon 28402900 28403006 . + . gene_id "XLOC_002391"; transcript_id "TCONS_00002391"; exon_number "1"; oId "CUFF.2409.1"; tss_id "TSS2391"; +chr13 Cufflinks exon 28806639 28806741 . + . gene_id "XLOC_002392"; transcript_id "TCONS_00002392"; exon_number "1"; oId "CUFF.2412.1"; tss_id "TSS2392"; +chr13 Cufflinks exon 29681946 29681993 . + . gene_id "XLOC_002393"; transcript_id "TCONS_00002393"; exon_number "1"; oId "CUFF.2414.1"; tss_id "TSS2393"; +chr13 Cufflinks exon 29940639 29940670 . + . gene_id "XLOC_002394"; transcript_id "TCONS_00002394"; exon_number "1"; oId "CUFF.2415.1"; tss_id "TSS2394"; +chr13 Cufflinks exon 30855902 30856006 . + . gene_id "XLOC_002395"; transcript_id "TCONS_00002395"; exon_number "1"; oId "CUFF.2418.1"; tss_id "TSS2395"; +chr13 Cufflinks exon 32374762 32374799 . + . gene_id "XLOC_002396"; transcript_id "TCONS_00002396"; exon_number "1"; oId "CUFF.2420.1"; tss_id "TSS2396"; +chr13 Cufflinks exon 32489367 32489439 . + . gene_id "XLOC_002397"; transcript_id "TCONS_00002397"; exon_number "1"; oId "CUFF.2421.1"; tss_id "TSS2397"; +chr13 Cufflinks exon 33510116 33510167 . + . gene_id "XLOC_002398"; transcript_id "TCONS_00002398"; exon_number "1"; oId "CUFF.2425.1"; tss_id "TSS2398"; +chr13 Cufflinks exon 34512265 34512306 . + . gene_id "XLOC_002399"; transcript_id "TCONS_00002399"; exon_number "1"; oId "CUFF.2428.1"; tss_id "TSS2399"; +chr13 Cufflinks exon 36341888 36341995 . + . gene_id "XLOC_002400"; transcript_id "TCONS_00002400"; exon_number "1"; oId "CUFF.2431.1"; tss_id "TSS2400"; +chr13 Cufflinks exon 36841305 36841411 . + . gene_id "XLOC_002401"; transcript_id "TCONS_00002401"; exon_number "1"; oId "CUFF.2433.1"; tss_id "TSS2401"; +chr13 Cufflinks exon 37000119 37000150 . + . gene_id "XLOC_002402"; transcript_id "TCONS_00002402"; exon_number "1"; oId "CUFF.2434.1"; tss_id "TSS2402"; +chr13 Cufflinks exon 38696214 38696247 . + . gene_id "XLOC_002403"; transcript_id "TCONS_00002403"; exon_number "1"; oId "CUFF.2439.1"; tss_id "TSS2403"; +chr13 Cufflinks exon 39353561 39353653 . + . gene_id "XLOC_002404"; transcript_id "TCONS_00002404"; exon_number "1"; oId "CUFF.2440.1"; tss_id "TSS2404"; +chr13 Cufflinks exon 41696012 41696317 . + . gene_id "XLOC_002405"; transcript_id "TCONS_00002405"; exon_number "1"; oId "CUFF.2444.1"; tss_id "TSS2405"; +chr13 Cufflinks exon 42381813 42382078 . + . gene_id "XLOC_002406"; transcript_id "TCONS_00002406"; exon_number "1"; oId "CUFF.2448.1"; tss_id "TSS2406"; +chr13 Cufflinks exon 42479254 42479360 . + . gene_id "XLOC_002407"; transcript_id "TCONS_00002407"; exon_number "1"; oId "CUFF.2450.1"; tss_id "TSS2407"; +chr13 Cufflinks exon 42805952 42805988 . + . gene_id "XLOC_002408"; transcript_id "TCONS_00002408"; exon_number "1"; oId "CUFF.2451.1"; tss_id "TSS2408"; +chr13 Cufflinks exon 43409804 43409845 . + . gene_id "XLOC_002409"; transcript_id "TCONS_00002409"; exon_number "1"; oId "CUFF.2452.1"; tss_id "TSS2409"; +chr13 Cufflinks exon 45576285 45576602 . + . gene_id "XLOC_002410"; transcript_id "TCONS_00002410"; exon_number "1"; oId "CUFF.2456.1"; tss_id "TSS2410"; +chr13 Cufflinks exon 45634864 45635102 . + . gene_id "XLOC_002411"; transcript_id "TCONS_00002411"; exon_number "1"; oId "CUFF.2457.1"; tss_id "TSS2411"; +chr13 Cufflinks exon 45697228 45697466 . + . gene_id "XLOC_002412"; transcript_id "TCONS_00002412"; exon_number "1"; oId "CUFF.2458.1"; tss_id "TSS2412"; +chr13 Cufflinks exon 45882387 45882421 . + . gene_id "XLOC_002413"; transcript_id "TCONS_00002413"; exon_number "1"; oId "CUFF.2460.1"; tss_id "TSS2413"; +chr13 Cufflinks exon 46824077 46824277 . + . gene_id "XLOC_002414"; transcript_id "TCONS_00002414"; exon_number "1"; oId "CUFF.2466.1"; tss_id "TSS2414"; +chr13 Cufflinks exon 46937540 46937569 . + . gene_id "XLOC_002415"; transcript_id "TCONS_00002415"; exon_number "1"; oId "CUFF.2467.1"; tss_id "TSS2415"; +chr13 Cufflinks exon 46984590 46984692 . + . gene_id "XLOC_002416"; transcript_id "TCONS_00002416"; exon_number "1"; oId "CUFF.2469.1"; tss_id "TSS2416"; +chr13 Cufflinks exon 48060757 48060789 . + . gene_id "XLOC_002417"; transcript_id "TCONS_00002417"; exon_number "1"; oId "CUFF.2473.1"; tss_id "TSS2417"; +chr13 Cufflinks exon 48742567 48742622 . + . gene_id "XLOC_002418"; transcript_id "TCONS_00002418"; exon_number "1"; oId "CUFF.2474.1"; tss_id "TSS2418"; +chr13 Cufflinks exon 49003405 49003602 . + . gene_id "XLOC_002419"; transcript_id "TCONS_00002419"; exon_number "1"; oId "CUFF.2475.1"; tss_id "TSS2419"; +chr13 Cufflinks exon 49339028 49339116 . + . gene_id "XLOC_002420"; transcript_id "TCONS_00002420"; exon_number "1"; oId "CUFF.2476.1"; tss_id "TSS2420"; +chr13 Cufflinks exon 49562047 49562153 . + . gene_id "XLOC_002421"; transcript_id "TCONS_00002421"; exon_number "1"; oId "CUFF.2477.1"; tss_id "TSS2421"; +chr13 Cufflinks exon 49603824 49603860 . + . gene_id "XLOC_002422"; transcript_id "TCONS_00002422"; exon_number "1"; oId "CUFF.2478.1"; tss_id "TSS2422"; +chr13 Cufflinks exon 50577125 50577180 . + . gene_id "XLOC_002423"; transcript_id "TCONS_00002423"; exon_number "1"; oId "CUFF.2480.1"; tss_id "TSS2423"; +chr13 Cufflinks exon 51396091 51396124 . + . gene_id "XLOC_002424"; transcript_id "TCONS_00002424"; exon_number "1"; oId "CUFF.2482.1"; tss_id "TSS2424"; +chr13 Cufflinks exon 52043888 52044181 . + . gene_id "XLOC_002425"; transcript_id "TCONS_00002425"; exon_number "1"; oId "CUFF.2485.1"; tss_id "TSS2425"; +chr13 Cufflinks exon 52139548 52139612 . + . gene_id "XLOC_002426"; transcript_id "TCONS_00002426"; exon_number "1"; oId "CUFF.2486.1"; tss_id "TSS2426"; +chr13 Cufflinks exon 53103837 53103896 . + . gene_id "XLOC_002427"; transcript_id "TCONS_00002427"; exon_number "1"; oId "CUFF.2489.1"; tss_id "TSS2427"; +chr13 Cufflinks exon 53832216 53832527 . + . gene_id "XLOC_002428"; transcript_id "TCONS_00002428"; exon_number "1"; oId "CUFF.2490.1"; tss_id "TSS2428"; +chr13 Cufflinks exon 54916472 54916543 . + . gene_id "XLOC_002429"; transcript_id "TCONS_00002429"; exon_number "1"; oId "CUFF.2495.1"; tss_id "TSS2429"; +chr13 Cufflinks exon 55465414 55465462 . + . gene_id "XLOC_002430"; transcript_id "TCONS_00002430"; exon_number "1"; oId "CUFF.2496.1"; tss_id "TSS2430"; +chr13 Cufflinks exon 57133757 57133862 . + . gene_id "XLOC_002431"; transcript_id "TCONS_00002431"; exon_number "1"; oId "CUFF.2498.1"; tss_id "TSS2431"; +chr13 Cufflinks exon 58448937 58448972 . + . gene_id "XLOC_002432"; transcript_id "TCONS_00002432"; exon_number "1"; oId "CUFF.2501.1"; tss_id "TSS2432"; +chr13 Cufflinks exon 58565484 58565573 . + . gene_id "XLOC_002433"; transcript_id "TCONS_00002433"; exon_number "1"; oId "CUFF.2503.1"; tss_id "TSS2433"; +chr13 Cufflinks exon 59290776 59290838 . + . gene_id "XLOC_002434"; transcript_id "TCONS_00002434"; exon_number "1"; oId "CUFF.2504.1"; tss_id "TSS2434"; +chr13 Cufflinks exon 59391275 59391309 . + . gene_id "XLOC_002435"; transcript_id "TCONS_00002435"; exon_number "1"; oId "CUFF.2505.1"; tss_id "TSS2435"; +chr13 Cufflinks exon 59909147 59909179 . + . gene_id "XLOC_002436"; transcript_id "TCONS_00002436"; exon_number "1"; oId "CUFF.2507.1"; tss_id "TSS2436"; +chr13 Cufflinks exon 60054204 60054263 . + . gene_id "XLOC_002437"; transcript_id "TCONS_00002437"; exon_number "1"; oId "CUFF.2508.1"; tss_id "TSS2437"; +chr13 Cufflinks exon 61103845 61103879 . + . gene_id "XLOC_002438"; transcript_id "TCONS_00002438"; exon_number "1"; oId "CUFF.2511.1"; tss_id "TSS2438"; +chr13 Cufflinks exon 61187742 61187831 . + . gene_id "XLOC_002439"; transcript_id "TCONS_00002439"; exon_number "1"; oId "CUFF.2512.1"; tss_id "TSS2439"; +chr13 Cufflinks exon 63343042 63343119 . + . gene_id "XLOC_002440"; transcript_id "TCONS_00002440"; exon_number "1"; oId "CUFF.2517.1"; tss_id "TSS2440"; +chr13 Cufflinks exon 64357935 64358037 . + . gene_id "XLOC_002441"; transcript_id "TCONS_00002441"; exon_number "1"; oId "CUFF.2519.1"; tss_id "TSS2441"; +chr13 Cufflinks exon 68208613 68208701 . + . gene_id "XLOC_002442"; transcript_id "TCONS_00002442"; exon_number "1"; oId "CUFF.2523.1"; tss_id "TSS2442"; +chr13 Cufflinks exon 68846579 68846644 . + . gene_id "XLOC_002443"; transcript_id "TCONS_00002443"; exon_number "1"; oId "CUFF.2525.1"; tss_id "TSS2443"; +chr13 Cufflinks exon 68965871 68965961 . + . gene_id "XLOC_002444"; transcript_id "TCONS_00002444"; exon_number "1"; oId "CUFF.2526.1"; tss_id "TSS2444"; +chr13 Cufflinks exon 69247529 69247562 . + . gene_id "XLOC_002445"; transcript_id "TCONS_00002445"; exon_number "1"; oId "CUFF.2527.1"; tss_id "TSS2445"; +chr13 Cufflinks exon 71033598 71033677 . + . gene_id "XLOC_002446"; transcript_id "TCONS_00002446"; exon_number "1"; oId "CUFF.2530.1"; tss_id "TSS2446"; +chr13 Cufflinks exon 71893748 71893823 . + . gene_id "XLOC_002447"; transcript_id "TCONS_00002447"; exon_number "1"; oId "CUFF.2531.1"; tss_id "TSS2447"; +chr13 Cufflinks exon 71970834 71971003 . + . gene_id "XLOC_002448"; transcript_id "TCONS_00002448"; exon_number "1"; oId "CUFF.2532.1"; tss_id "TSS2448"; +chr13 Cufflinks exon 72552232 72552346 . + . gene_id "XLOC_002449"; transcript_id "TCONS_00002449"; exon_number "1"; oId "CUFF.2533.1"; tss_id "TSS2449"; +chr13 Cufflinks exon 73765665 73765807 . + . gene_id "XLOC_002450"; transcript_id "TCONS_00002450"; exon_number "1"; oId "CUFF.2538.1"; tss_id "TSS2450"; +chr13 Cufflinks exon 74715232 74715274 . + . gene_id "XLOC_002451"; transcript_id "TCONS_00002451"; exon_number "1"; oId "CUFF.2540.1"; tss_id "TSS2451"; +chr13 Cufflinks exon 75683724 75683830 . + . gene_id "XLOC_002452"; transcript_id "TCONS_00002452"; exon_number "1"; oId "CUFF.2541.1"; tss_id "TSS2452"; +chr13 Cufflinks exon 76709067 76709342 . + . gene_id "XLOC_002453"; transcript_id "TCONS_00002453"; exon_number "1"; oId "CUFF.2543.1"; tss_id "TSS2453"; +chr13 Cufflinks exon 77575983 77576152 . + . gene_id "XLOC_002454"; transcript_id "TCONS_00002454"; exon_number "1"; oId "CUFF.2544.1"; tss_id "TSS2454"; +chr13 Cufflinks exon 77825145 77825175 . + . gene_id "XLOC_002455"; transcript_id "TCONS_00002455"; exon_number "1"; oId "CUFF.2545.1"; tss_id "TSS2455"; +chr13 Cufflinks exon 78083246 78083282 . + . gene_id "XLOC_002456"; transcript_id "TCONS_00002456"; exon_number "1"; oId "CUFF.2546.1"; tss_id "TSS2456"; +chr13 Cufflinks exon 80476551 80476588 . + . gene_id "XLOC_002457"; transcript_id "TCONS_00002457"; exon_number "1"; oId "CUFF.2549.1"; tss_id "TSS2457"; +chr13 Cufflinks exon 81433700 81433738 . + . gene_id "XLOC_002458"; transcript_id "TCONS_00002458"; exon_number "1"; oId "CUFF.2552.1"; tss_id "TSS2458"; +chr13 Cufflinks exon 81839882 81839951 . + . gene_id "XLOC_002459"; transcript_id "TCONS_00002459"; exon_number "1"; oId "CUFF.2553.1"; tss_id "TSS2459"; +chr13 Cufflinks exon 85257703 85257813 . + . gene_id "XLOC_002460"; transcript_id "TCONS_00002460"; exon_number "1"; oId "CUFF.2555.1"; tss_id "TSS2460"; +chr13 Cufflinks exon 87788838 87788874 . + . gene_id "XLOC_002461"; transcript_id "TCONS_00002461"; exon_number "1"; oId "CUFF.2559.1"; tss_id "TSS2461"; +chr13 Cufflinks exon 88457611 88457640 . + . gene_id "XLOC_002462"; transcript_id "TCONS_00002462"; exon_number "1"; oId "CUFF.2560.1"; tss_id "TSS2462"; +chr13 Cufflinks exon 89494694 89494729 . + . gene_id "XLOC_002463"; transcript_id "TCONS_00002463"; exon_number "1"; oId "CUFF.2561.1"; tss_id "TSS2463"; +chr13 Cufflinks exon 91177244 91177274 . + . gene_id "XLOC_002464"; transcript_id "TCONS_00002464"; exon_number "1"; oId "CUFF.2563.1"; tss_id "TSS2464"; +chr13 Cufflinks exon 94622266 94622307 . + . gene_id "XLOC_002465"; transcript_id "TCONS_00002465"; exon_number "1"; oId "CUFF.2567.1"; tss_id "TSS2465"; +chr13 Cufflinks exon 95203007 95203044 . + . gene_id "XLOC_002466"; transcript_id "TCONS_00002466"; exon_number "1"; oId "CUFF.2570.1"; tss_id "TSS2466"; +chr13 Cufflinks exon 95671489 95671549 . + . gene_id "XLOC_002467"; transcript_id "TCONS_00002467"; exon_number "1"; oId "CUFF.2574.1"; tss_id "TSS2467"; +chr13 Cufflinks exon 95857447 95857538 . + . gene_id "XLOC_002468"; transcript_id "TCONS_00002468"; exon_number "1"; oId "CUFF.2575.1"; tss_id "TSS2468"; +chr13 Cufflinks exon 95862598 95862705 . + . gene_id "XLOC_002469"; transcript_id "TCONS_00002469"; exon_number "1"; oId "CUFF.2576.1"; tss_id "TSS2469"; +chr13 Cufflinks exon 96821826 96822118 . + . gene_id "XLOC_002470"; transcript_id "TCONS_00002470"; exon_number "1"; oId "CUFF.2579.1"; tss_id "TSS2470"; +chr13 Cufflinks exon 97709632 97709737 . + . gene_id "XLOC_002471"; transcript_id "TCONS_00002471"; exon_number "1"; oId "CUFF.2582.1"; tss_id "TSS2471"; +chr13 Cufflinks exon 98360063 98360104 . + . gene_id "XLOC_002472"; transcript_id "TCONS_00002472"; exon_number "1"; oId "CUFF.2584.1"; tss_id "TSS2472"; +chr13 Cufflinks exon 98538062 98538169 . + . gene_id "XLOC_002473"; transcript_id "TCONS_00002473"; exon_number "1"; oId "CUFF.2585.1"; tss_id "TSS2473"; +chr13 Cufflinks exon 99324235 99324542 . + . gene_id "XLOC_002474"; transcript_id "TCONS_00002474"; exon_number "1"; oId "CUFF.2587.1"; tss_id "TSS2474"; +chr13 Cufflinks exon 99677488 99677596 . + . gene_id "XLOC_002475"; transcript_id "TCONS_00002475"; exon_number "1"; oId "CUFF.2588.1"; tss_id "TSS2475"; +chr13 Cufflinks exon 99813287 99813433 . + . gene_id "XLOC_002476"; transcript_id "TCONS_00002476"; exon_number "1"; oId "CUFF.2589.1"; tss_id "TSS2476"; +chr13 Cufflinks exon 99813796 99813938 . + . gene_id "XLOC_002477"; transcript_id "TCONS_00002477"; exon_number "1"; oId "CUFF.2590.1"; tss_id "TSS2477"; +chr13 Cufflinks exon 99857962 99858203 . + . gene_id "XLOC_002478"; transcript_id "TCONS_00002478"; exon_number "1"; oId "CUFF.2591.1"; tss_id "TSS2478"; +chr13 Cufflinks exon 100498344 100498409 . + . gene_id "XLOC_002479"; transcript_id "TCONS_00002479"; exon_number "1"; oId "CUFF.2593.1"; tss_id "TSS2479"; +chr13 Cufflinks exon 100584138 100584331 . + . gene_id "XLOC_002480"; transcript_id "TCONS_00002480"; exon_number "1"; oId "CUFF.2594.1"; tss_id "TSS2480"; +chr13 Cufflinks exon 101660645 101660734 . + . gene_id "XLOC_002481"; transcript_id "TCONS_00002481"; exon_number "1"; oId "CUFF.2598.1"; tss_id "TSS2481"; +chr13 Cufflinks exon 102311111 102311221 . + . gene_id "XLOC_002482"; transcript_id "TCONS_00002482"; exon_number "1"; oId "CUFF.2601.1"; tss_id "TSS2482"; +chr13 Cufflinks exon 103060937 103060978 . + . gene_id "XLOC_002483"; transcript_id "TCONS_00002483"; exon_number "1"; oId "CUFF.2603.1"; tss_id "TSS2483"; +chr13 Cufflinks exon 103374151 103374254 . + . gene_id "XLOC_002484"; transcript_id "TCONS_00002484"; exon_number "1"; oId "CUFF.2604.1"; tss_id "TSS2484"; +chr13 Cufflinks exon 105199269 105199312 . + . gene_id "XLOC_002485"; transcript_id "TCONS_00002485"; exon_number "1"; oId "CUFF.2607.1"; tss_id "TSS2485"; +chr13 Cufflinks exon 105691586 105691628 . + . gene_id "XLOC_002486"; transcript_id "TCONS_00002486"; exon_number "1"; oId "CUFF.2608.1"; tss_id "TSS2486"; +chr13 Cufflinks exon 110567443 110567680 . + . gene_id "XLOC_002487"; transcript_id "TCONS_00002487"; exon_number "1"; oId "CUFF.2613.1"; tss_id "TSS2487"; +chr13 Cufflinks exon 111066553 111066656 . + . gene_id "XLOC_002488"; transcript_id "TCONS_00002488"; exon_number "1"; oId "CUFF.2616.1"; tss_id "TSS2488"; +chr13 Cufflinks exon 111460162 111460286 . + . gene_id "XLOC_002489"; transcript_id "TCONS_00002489"; exon_number "1"; oId "CUFF.2618.1"; tss_id "TSS2489"; +chr13 Cufflinks exon 112246642 112246681 . + . gene_id "XLOC_002490"; transcript_id "TCONS_00002490"; exon_number "1"; oId "CUFF.2619.1"; tss_id "TSS2490"; +chr13 Cufflinks exon 19443326 19443431 . - . gene_id "XLOC_002491"; transcript_id "TCONS_00002491"; exon_number "1"; oId "CUFF.2369.1"; tss_id "TSS2491"; +chr13 Cufflinks exon 20040983 20041048 . - . gene_id "XLOC_002492"; transcript_id "TCONS_00002492"; exon_number "1"; oId "CUFF.2374.1"; tss_id "TSS2492"; +chr13 Cufflinks exon 20311102 20311394 . - . gene_id "XLOC_002493"; transcript_id "TCONS_00002493"; exon_number "1"; oId "CUFF.2375.1"; tss_id "TSS2493"; +chr13 Cufflinks exon 21020712 21020783 . - . gene_id "XLOC_002494"; transcript_id "TCONS_00002494"; exon_number "1"; oId "CUFF.2378.1"; tss_id "TSS2494"; +chr13 Cufflinks exon 21573548 21573606 . - . gene_id "XLOC_002495"; transcript_id "TCONS_00002495"; exon_number "1"; oId "CUFF.2383.1"; tss_id "TSS2495"; +chr13 Cufflinks exon 21612665 21612806 . - . gene_id "XLOC_002496"; transcript_id "TCONS_00002496"; exon_number "1"; oId "CUFF.2384.1"; tss_id "TSS2496"; +chr13 Cufflinks exon 21943950 21944036 . - . gene_id "XLOC_002497"; transcript_id "TCONS_00002497"; exon_number "1"; oId "CUFF.2386.1"; tss_id "TSS2497"; +chr13 Cufflinks exon 22026209 22026257 . - . gene_id "XLOC_002498"; transcript_id "TCONS_00002498"; exon_number "1"; oId "CUFF.2387.1"; tss_id "TSS2498"; +chr13 Cufflinks exon 22101936 22102030 . - . gene_id "XLOC_002499"; transcript_id "TCONS_00002499"; exon_number "1"; oId "CUFF.2389.1"; tss_id "TSS2499"; +chr13 Cufflinks exon 22125441 22125549 . - . gene_id "XLOC_002500"; transcript_id "TCONS_00002500"; exon_number "1"; oId "CUFF.2390.1"; tss_id "TSS2500"; +chr13 Cufflinks exon 23453247 23453427 . - . gene_id "XLOC_002501"; transcript_id "TCONS_00002501"; exon_number "1"; oId "CUFF.2392.1"; tss_id "TSS2501"; +chr13 Cufflinks exon 23567922 23567959 . - . gene_id "XLOC_002502"; transcript_id "TCONS_00002502"; exon_number "1"; oId "CUFF.2393.1"; tss_id "TSS2502"; +chr13 Cufflinks exon 23791572 23791672 . - . gene_id "XLOC_002503"; transcript_id "TCONS_00002503"; exon_number "1"; oId "CUFF.2395.1"; tss_id "TSS2503"; +chr13 Cufflinks exon 25629783 25629825 . - . gene_id "XLOC_002504"; transcript_id "TCONS_00002504"; exon_number "1"; oId "CUFF.2399.1"; tss_id "TSS2504"; +chr13 Cufflinks exon 26790618 26790687 . - . gene_id "XLOC_002505"; transcript_id "TCONS_00002505"; exon_number "1"; oId "CUFF.2402.1"; tss_id "TSS2505"; +chr13 Cufflinks exon 27248433 27248467 . - . gene_id "XLOC_002506"; transcript_id "TCONS_00002506"; exon_number "1"; oId "CUFF.2404.1"; tss_id "TSS2506"; +chr13 Cufflinks exon 27890060 27890107 . - . gene_id "XLOC_002507"; transcript_id "TCONS_00002507"; exon_number "1"; oId "CUFF.2405.1"; tss_id "TSS2507"; +chr13 Cufflinks exon 27917824 27917881 . - . gene_id "XLOC_002508"; transcript_id "TCONS_00002508"; exon_number "1"; oId "CUFF.2406.1"; tss_id "TSS2508"; +chr13 Cufflinks exon 28563434 28563715 . - . gene_id "XLOC_002509"; transcript_id "TCONS_00002509"; exon_number "1"; oId "CUFF.2410.1"; tss_id "TSS2509"; +chr13 Cufflinks exon 28718750 28718788 . - . gene_id "XLOC_002510"; transcript_id "TCONS_00002510"; exon_number "1"; oId "CUFF.2411.1"; tss_id "TSS2510"; +chr13 Cufflinks exon 29277840 29277944 . - . gene_id "XLOC_002511"; transcript_id "TCONS_00002511"; exon_number "1"; oId "CUFF.2413.1"; tss_id "TSS2511"; +chr13 Cufflinks exon 30438249 30438333 . - . gene_id "XLOC_002512"; transcript_id "TCONS_00002512"; exon_number "1"; oId "CUFF.2416.1"; tss_id "TSS2512"; +chr13 Cufflinks exon 30438626 30438765 . - . gene_id "XLOC_002513"; transcript_id "TCONS_00002513"; exon_number "1"; oId "CUFF.2417.1"; tss_id "TSS2513"; +chr13 Cufflinks exon 31248101 31248174 . - . gene_id "XLOC_002514"; transcript_id "TCONS_00002514"; exon_number "1"; oId "CUFF.2419.1"; tss_id "TSS2514"; +chr13 Cufflinks exon 33278623 33278657 . - . gene_id "XLOC_002515"; transcript_id "TCONS_00002515"; exon_number "1"; oId "CUFF.2422.1"; tss_id "TSS2515"; +chr13 Cufflinks exon 33387509 33387568 . - . gene_id "XLOC_002516"; transcript_id "TCONS_00002516"; exon_number "1"; oId "CUFF.2423.1"; tss_id "TSS2516"; +chr13 Cufflinks exon 33509917 33510021 . - . gene_id "XLOC_002517"; transcript_id "TCONS_00002517"; exon_number "1"; oId "CUFF.2424.1"; tss_id "TSS2517"; +chr13 Cufflinks exon 34269714 34269820 . - . gene_id "XLOC_002518"; transcript_id "TCONS_00002518"; exon_number "1"; oId "CUFF.2426.1"; tss_id "TSS2518"; +chr13 Cufflinks exon 34403674 34403786 . - . gene_id "XLOC_002519"; transcript_id "TCONS_00002519"; exon_number "1"; oId "CUFF.2427.1"; tss_id "TSS2519"; +chr13 Cufflinks exon 35378112 35378160 . - . gene_id "XLOC_002520"; transcript_id "TCONS_00002520"; exon_number "1"; oId "CUFF.2429.1"; tss_id "TSS2520"; +chr13 Cufflinks exon 35676778 35676812 . - . gene_id "XLOC_002521"; transcript_id "TCONS_00002521"; exon_number "1"; oId "CUFF.2430.1"; tss_id "TSS2521"; +chr13 Cufflinks exon 36639747 36639818 . - . gene_id "XLOC_002522"; transcript_id "TCONS_00002522"; exon_number "1"; oId "CUFF.2432.1"; tss_id "TSS2522"; +chr13 Cufflinks exon 37372430 37372511 . - . gene_id "XLOC_002523"; transcript_id "TCONS_00002523"; exon_number "1"; oId "CUFF.2435.1"; tss_id "TSS2523"; +chr13 Cufflinks exon 37438519 37438593 . - . gene_id "XLOC_002524"; transcript_id "TCONS_00002524"; exon_number "1"; oId "CUFF.2436.1"; tss_id "TSS2524"; +chr13 Cufflinks exon 37740539 37740795 . - . gene_id "XLOC_002525"; transcript_id "TCONS_00002525"; exon_number "1"; oId "CUFF.2437.1"; tss_id "TSS2525"; +chr13 Cufflinks exon 38429018 38429107 . - . gene_id "XLOC_002526"; transcript_id "TCONS_00002526"; exon_number "1"; oId "CUFF.2438.1"; tss_id "TSS2526"; +chr13 Cufflinks exon 40021249 40021354 . - . gene_id "XLOC_002527"; transcript_id "TCONS_00002527"; exon_number "1"; oId "CUFF.2441.1"; tss_id "TSS2527"; +chr13 Cufflinks exon 40541540 40541604 . - . gene_id "XLOC_002528"; transcript_id "TCONS_00002528"; exon_number "1"; oId "CUFF.2442.1"; tss_id "TSS2528"; +chr13 Cufflinks exon 41634873 41634945 . - . gene_id "XLOC_002529"; transcript_id "TCONS_00002529"; exon_number "1"; oId "CUFF.2443.1"; tss_id "TSS2529"; +chr13 Cufflinks exon 41754114 41754224 . - . gene_id "XLOC_002530"; transcript_id "TCONS_00002530"; exon_number "1"; oId "CUFF.2445.1"; tss_id "TSS2530"; +chr13 Cufflinks exon 41928694 41928795 . - . gene_id "XLOC_002531"; transcript_id "TCONS_00002531"; exon_number "1"; oId "CUFF.2446.1"; tss_id "TSS2531"; +chr13 Cufflinks exon 42030060 42030132 . - . gene_id "XLOC_002532"; transcript_id "TCONS_00002532"; exon_number "1"; oId "CUFF.2447.1"; tss_id "TSS2532"; +chr13 Cufflinks exon 42420182 42420245 . - . gene_id "XLOC_002533"; transcript_id "TCONS_00002533"; exon_number "1"; oId "CUFF.2449.1"; tss_id "TSS2533"; +chr13 Cufflinks exon 44303990 44304036 . - . gene_id "XLOC_002534"; transcript_id "TCONS_00002534"; exon_number "1"; oId "CUFF.2453.1"; tss_id "TSS2534"; +chr13 Cufflinks exon 45202702 45202810 . - . gene_id "XLOC_002535"; transcript_id "TCONS_00002535"; exon_number "1"; oId "CUFF.2454.1"; tss_id "TSS2535"; +chr13 Cufflinks exon 45492061 45492133 . - . gene_id "XLOC_002536"; transcript_id "TCONS_00002536"; exon_number "1"; oId "CUFF.2455.1"; tss_id "TSS2536"; +chr13 Cufflinks exon 45711998 45712100 . - . gene_id "XLOC_002537"; transcript_id "TCONS_00002537"; exon_number "1"; oId "CUFF.2459.1"; tss_id "TSS2537"; +chr13 Cufflinks exon 46125617 46125737 . - . gene_id "XLOC_002538"; transcript_id "TCONS_00002538"; exon_number "1"; oId "CUFF.2461.1"; tss_id "TSS2538"; +chr13 Cufflinks exon 46306206 46306476 . - . gene_id "XLOC_002539"; transcript_id "TCONS_00002539"; exon_number "1"; oId "CUFF.2462.1"; tss_id "TSS2539"; +chr13 Cufflinks exon 46306775 46306826 . - . gene_id "XLOC_002540"; transcript_id "TCONS_00002540"; exon_number "1"; oId "CUFF.2463.1"; tss_id "TSS2540"; +chr13 Cufflinks exon 46743579 46743879 . - . gene_id "XLOC_002541"; transcript_id "TCONS_00002541"; exon_number "1"; oId "CUFF.2464.1"; tss_id "TSS2541"; +chr13 Cufflinks exon 46809802 46809908 . - . gene_id "XLOC_002542"; transcript_id "TCONS_00002542"; exon_number "1"; oId "CUFF.2465.1"; tss_id "TSS2542"; +chr13 Cufflinks exon 46948540 46948725 . - . gene_id "XLOC_002543"; transcript_id "TCONS_00002543"; exon_number "1"; oId "CUFF.2468.1"; tss_id "TSS2543"; +chr13 Cufflinks exon 47531275 47531437 . - . gene_id "XLOC_002544"; transcript_id "TCONS_00002544"; exon_number "1"; oId "CUFF.2470.1"; tss_id "TSS2544"; +chr13 Cufflinks exon 47872696 47872875 . - . gene_id "XLOC_002545"; transcript_id "TCONS_00002545"; exon_number "1"; oId "CUFF.2471.1"; tss_id "TSS2545"; +chr13 Cufflinks exon 48033060 48033369 . - . gene_id "XLOC_002546"; transcript_id "TCONS_00002546"; exon_number "1"; oId "CUFF.2472.1"; tss_id "TSS2546"; +chr13 Cufflinks exon 49705794 49705871 . - . gene_id "XLOC_002547"; transcript_id "TCONS_00002547"; exon_number "1"; oId "CUFF.2479.1"; tss_id "TSS2547"; +chr13 Cufflinks exon 51387123 51387242 . - . gene_id "XLOC_002548"; transcript_id "TCONS_00002548"; exon_number "1"; oId "CUFF.2481.1"; tss_id "TSS2548"; +chr13 Cufflinks exon 51601901 51601987 . - . gene_id "XLOC_002549"; transcript_id "TCONS_00002549"; exon_number "1"; oId "CUFF.2483.1"; tss_id "TSS2549"; +chr13 Cufflinks exon 51881428 51881468 . - . gene_id "XLOC_002550"; transcript_id "TCONS_00002550"; exon_number "1"; oId "CUFF.2484.1"; tss_id "TSS2550"; +chr13 Cufflinks exon 52168055 52168348 . - . gene_id "XLOC_002551"; transcript_id "TCONS_00002551"; exon_number "1"; oId "CUFF.2487.1"; tss_id "TSS2551"; +chr13 Cufflinks exon 52856993 52857052 . - . gene_id "XLOC_002552"; transcript_id "TCONS_00002552"; exon_number "1"; oId "CUFF.2488.1"; tss_id "TSS2552"; +chr13 Cufflinks exon 53917559 53917625 . - . gene_id "XLOC_002553"; transcript_id "TCONS_00002553"; exon_number "1"; oId "CUFF.2491.1"; tss_id "TSS2553"; +chr13 Cufflinks exon 54250580 54250627 . - . gene_id "XLOC_002554"; transcript_id "TCONS_00002554"; exon_number "1"; oId "CUFF.2492.1"; tss_id "TSS2554"; +chr13 Cufflinks exon 54365340 54365455 . - . gene_id "XLOC_002555"; transcript_id "TCONS_00002555"; exon_number "1"; oId "CUFF.2493.1"; tss_id "TSS2555"; +chr13 Cufflinks exon 54596460 54596525 . - . gene_id "XLOC_002556"; transcript_id "TCONS_00002556"; exon_number "1"; oId "CUFF.2494.1"; tss_id "TSS2556"; +chr13 Cufflinks exon 56995693 56995724 . - . gene_id "XLOC_002557"; transcript_id "TCONS_00002557"; exon_number "1"; oId "CUFF.2497.1"; tss_id "TSS2557"; +chr13 Cufflinks exon 57459498 57459734 . - . gene_id "XLOC_002558"; transcript_id "TCONS_00002558"; exon_number "1"; oId "CUFF.2499.1"; tss_id "TSS2558"; +chr13 Cufflinks exon 58037373 58037541 . - . gene_id "XLOC_002559"; transcript_id "TCONS_00002559"; exon_number "1"; oId "CUFF.2500.1"; tss_id "TSS2559"; +chr13 Cufflinks exon 58458546 58458621 . - . gene_id "XLOC_002560"; transcript_id "TCONS_00002560"; exon_number "1"; oId "CUFF.2502.1"; tss_id "TSS2560"; +chr13 Cufflinks exon 59817765 59817830 . - . gene_id "XLOC_002561"; transcript_id "TCONS_00002561"; exon_number "1"; oId "CUFF.2506.1"; tss_id "TSS2561"; +chr13 Cufflinks exon 60287374 60287490 . - . gene_id "XLOC_002562"; transcript_id "TCONS_00002562"; exon_number "1"; oId "CUFF.2509.1"; tss_id "TSS2562"; +chr13 Cufflinks exon 60608579 60608896 . - . gene_id "XLOC_002563"; transcript_id "TCONS_00002563"; exon_number "1"; oId "CUFF.2510.1"; tss_id "TSS2563"; +chr13 Cufflinks exon 61340765 61340809 . - . gene_id "XLOC_002564"; transcript_id "TCONS_00002564"; exon_number "1"; oId "CUFF.2513.1"; tss_id "TSS2564"; +chr13 Cufflinks exon 62232148 62232210 . - . gene_id "XLOC_002565"; transcript_id "TCONS_00002565"; exon_number "1"; oId "CUFF.2514.1"; tss_id "TSS2565"; +chr13 Cufflinks exon 62341476 62341511 . - . gene_id "XLOC_002566"; transcript_id "TCONS_00002566"; exon_number "1"; oId "CUFF.2515.1"; tss_id "TSS2566"; +chr13 Cufflinks exon 62479782 62479843 . - . gene_id "XLOC_002567"; transcript_id "TCONS_00002567"; exon_number "1"; oId "CUFF.2516.1"; tss_id "TSS2567"; +chr13 Cufflinks exon 63602062 63602090 . - . gene_id "XLOC_002568"; transcript_id "TCONS_00002568"; exon_number "1"; oId "CUFF.2518.1"; tss_id "TSS2568"; +chr13 Cufflinks exon 64791523 64791560 . - . gene_id "XLOC_002569"; transcript_id "TCONS_00002569"; exon_number "1"; oId "CUFF.2520.1"; tss_id "TSS2569"; +chr13 Cufflinks exon 65304857 65304903 . - . gene_id "XLOC_002570"; transcript_id "TCONS_00002570"; exon_number "1"; oId "CUFF.2521.1"; tss_id "TSS2570"; +chr13 Cufflinks exon 67204853 67204907 . - . gene_id "XLOC_002571"; transcript_id "TCONS_00002571"; exon_number "1"; oId "CUFF.2522.1"; tss_id "TSS2571"; +chr13 Cufflinks exon 68586330 68586591 . - . gene_id "XLOC_002572"; transcript_id "TCONS_00002572"; exon_number "1"; oId "CUFF.2524.1"; tss_id "TSS2572"; +chr13 Cufflinks exon 69267932 69268211 . - . gene_id "XLOC_002573"; transcript_id "TCONS_00002573"; exon_number "1"; oId "CUFF.2528.1"; tss_id "TSS2573"; +chr13 Cufflinks exon 70598214 70598262 . - . gene_id "XLOC_002574"; transcript_id "TCONS_00002574"; exon_number "1"; oId "CUFF.2529.1"; tss_id "TSS2574"; +chr13 Cufflinks exon 73280155 73280261 . - . gene_id "XLOC_002575"; transcript_id "TCONS_00002575"; exon_number "1"; oId "CUFF.2534.1"; tss_id "TSS2575"; +chr13 Cufflinks exon 73455256 73455352 . - . gene_id "XLOC_002576"; transcript_id "TCONS_00002576"; exon_number "1"; oId "CUFF.2535.1"; tss_id "TSS2576"; +chr13 Cufflinks exon 73687057 73687155 . - . gene_id "XLOC_002577"; transcript_id "TCONS_00002577"; exon_number "1"; oId "CUFF.2536.1"; tss_id "TSS2577"; +chr13 Cufflinks exon 73742227 73742284 . - . gene_id "XLOC_002578"; transcript_id "TCONS_00002578"; exon_number "1"; oId "CUFF.2537.1"; tss_id "TSS2578"; +chr13 Cufflinks exon 73803229 73803290 . - . gene_id "XLOC_002579"; transcript_id "TCONS_00002579"; exon_number "1"; oId "CUFF.2539.1"; tss_id "TSS2579"; +chr13 Cufflinks exon 76138099 76138188 . - . gene_id "XLOC_002580"; transcript_id "TCONS_00002580"; exon_number "1"; oId "CUFF.2542.1"; tss_id "TSS2580"; +chr13 Cufflinks exon 78521655 78521907 . - . gene_id "XLOC_002581"; transcript_id "TCONS_00002581"; exon_number "1"; oId "CUFF.2547.1"; tss_id "TSS2581"; +chr13 Cufflinks exon 79963677 79963765 . - . gene_id "XLOC_002582"; transcript_id "TCONS_00002582"; exon_number "1"; oId "CUFF.2548.1"; tss_id "TSS2582"; +chr13 Cufflinks exon 80655092 80655133 . - . gene_id "XLOC_002583"; transcript_id "TCONS_00002583"; exon_number "1"; oId "CUFF.2550.1"; tss_id "TSS2583"; +chr13 Cufflinks exon 80943562 80943667 . - . gene_id "XLOC_002584"; transcript_id "TCONS_00002584"; exon_number "1"; oId "CUFF.2551.1"; tss_id "TSS2584"; +chr13 Cufflinks exon 83872206 83872301 . - . gene_id "XLOC_002585"; transcript_id "TCONS_00002585"; exon_number "1"; oId "CUFF.2554.1"; tss_id "TSS2585"; +chr13 Cufflinks exon 85547881 85547958 . - . gene_id "XLOC_002586"; transcript_id "TCONS_00002586"; exon_number "1"; oId "CUFF.2556.1"; tss_id "TSS2586"; +chr13 Cufflinks exon 86158883 86158988 . - . gene_id "XLOC_002587"; transcript_id "TCONS_00002587"; exon_number "1"; oId "CUFF.2557.1"; tss_id "TSS2587"; +chr13 Cufflinks exon 86468164 86468203 . - . gene_id "XLOC_002588"; transcript_id "TCONS_00002588"; exon_number "1"; oId "CUFF.2558.1"; tss_id "TSS2588"; +chr13 Cufflinks exon 90788000 90788094 . - . gene_id "XLOC_002589"; transcript_id "TCONS_00002589"; exon_number "1"; oId "CUFF.2562.1"; tss_id "TSS2589"; +chr13 Cufflinks exon 91434024 91434122 . - . gene_id "XLOC_002590"; transcript_id "TCONS_00002590"; exon_number "1"; oId "CUFF.2564.1"; tss_id "TSS2590"; +chr13 Cufflinks exon 91713627 91713688 . - . gene_id "XLOC_002591"; transcript_id "TCONS_00002591"; exon_number "1"; oId "CUFF.2565.1"; tss_id "TSS2591"; +chr13 Cufflinks exon 92957223 92957262 . - . gene_id "XLOC_002592"; transcript_id "TCONS_00002592"; exon_number "1"; oId "CUFF.2566.1"; tss_id "TSS2592"; +chr13 Cufflinks exon 94677763 94677852 . - . gene_id "XLOC_002593"; transcript_id "TCONS_00002593"; exon_number "1"; oId "CUFF.2568.1"; tss_id "TSS2593"; +chr13 Cufflinks exon 95201904 95201976 . - . gene_id "XLOC_002594"; transcript_id "TCONS_00002594"; exon_number "1"; oId "CUFF.2569.1"; tss_id "TSS2594"; +chr13 Cufflinks exon 95286501 95286593 . - . gene_id "XLOC_002595"; transcript_id "TCONS_00002595"; exon_number "1"; oId "CUFF.2571.1"; tss_id "TSS2595"; +chr13 Cufflinks exon 95303651 95303765 . - . gene_id "XLOC_002596"; transcript_id "TCONS_00002596"; exon_number "1"; oId "CUFF.2572.1"; tss_id "TSS2596"; +chr13 Cufflinks exon 95351459 95351756 . - . gene_id "XLOC_002597"; transcript_id "TCONS_00002597"; exon_number "1"; oId "CUFF.2573.1"; tss_id "TSS2597"; +chr13 Cufflinks exon 96493580 96493819 . - . gene_id "XLOC_002598"; transcript_id "TCONS_00002598"; exon_number "1"; oId "CUFF.2577.1"; tss_id "TSS2598"; +chr13 Cufflinks exon 96732492 96732581 . - . gene_id "XLOC_002599"; transcript_id "TCONS_00002599"; exon_number "1"; oId "CUFF.2578.1"; tss_id "TSS2599"; +chr13 Cufflinks exon 97349937 97349981 . - . gene_id "XLOC_002600"; transcript_id "TCONS_00002600"; exon_number "1"; oId "CUFF.2580.1"; tss_id "TSS2600"; +chr13 Cufflinks exon 97601549 97601787 . - . gene_id "XLOC_002601"; transcript_id "TCONS_00002601"; exon_number "1"; oId "CUFF.2581.1"; tss_id "TSS2601"; +chr13 Cufflinks exon 98015266 98015355 . - . gene_id "XLOC_002602"; transcript_id "TCONS_00002602"; exon_number "1"; oId "CUFF.2583.1"; tss_id "TSS2602"; +chr13 Cufflinks exon 98856177 98856446 . - . gene_id "XLOC_002603"; transcript_id "TCONS_00002603"; exon_number "1"; oId "CUFF.2586.1"; tss_id "TSS2603"; +chr13 Cufflinks exon 100436305 100436412 . - . gene_id "XLOC_002604"; transcript_id "TCONS_00002604"; exon_number "1"; oId "CUFF.2592.1"; tss_id "TSS2604"; +chr13 Cufflinks exon 100712298 100712409 . - . gene_id "XLOC_002605"; transcript_id "TCONS_00002605"; exon_number "1"; oId "CUFF.2595.1"; tss_id "TSS2605"; +chr13 Cufflinks exon 100995961 100995993 . - . gene_id "XLOC_002606"; transcript_id "TCONS_00002606"; exon_number "1"; oId "CUFF.2596.1"; tss_id "TSS2606"; +chr13 Cufflinks exon 101316259 101316325 . - . gene_id "XLOC_002607"; transcript_id "TCONS_00002607"; exon_number "1"; oId "CUFF.2597.1"; tss_id "TSS2607"; +chr13 Cufflinks exon 101845668 101845700 . - . gene_id "XLOC_002608"; transcript_id "TCONS_00002608"; exon_number "1"; oId "CUFF.2599.1"; tss_id "TSS2608"; +chr13 Cufflinks exon 102304492 102304523 . - . gene_id "XLOC_002609"; transcript_id "TCONS_00002609"; exon_number "1"; oId "CUFF.2600.1"; tss_id "TSS2609"; +chr13 Cufflinks exon 102431235 102431395 . - . gene_id "XLOC_002610"; transcript_id "TCONS_00002610"; exon_number "1"; oId "CUFF.2602.1"; tss_id "TSS2610"; +chr13 Cufflinks exon 103810428 103810458 . - . gene_id "XLOC_002611"; transcript_id "TCONS_00002611"; exon_number "1"; oId "CUFF.2605.1"; tss_id "TSS2611"; +chr13 Cufflinks exon 104850118 104850200 . - . gene_id "XLOC_002612"; transcript_id "TCONS_00002612"; exon_number "1"; oId "CUFF.2606.1"; tss_id "TSS2612"; +chr13 Cufflinks exon 106527570 106527773 . - . gene_id "XLOC_002613"; transcript_id "TCONS_00002613"; exon_number "1"; oId "CUFF.2609.1"; tss_id "TSS2613"; +chr13 Cufflinks exon 106807750 106807839 . - . gene_id "XLOC_002614"; transcript_id "TCONS_00002614"; exon_number "1"; oId "CUFF.2610.1"; tss_id "TSS2614"; +chr13 Cufflinks exon 108953590 108953677 . - . gene_id "XLOC_002615"; transcript_id "TCONS_00002615"; exon_number "1"; oId "CUFF.2611.1"; tss_id "TSS2615"; +chr13 Cufflinks exon 110047930 110047968 . - . gene_id "XLOC_002616"; transcript_id "TCONS_00002616"; exon_number "1"; oId "CUFF.2612.1"; tss_id "TSS2616"; +chr13 Cufflinks exon 110750182 110750498 . - . gene_id "XLOC_002617"; transcript_id "TCONS_00002617"; exon_number "1"; oId "CUFF.2614.1"; tss_id "TSS2617"; +chr13 Cufflinks exon 110786643 110786699 . - . gene_id "XLOC_002618"; transcript_id "TCONS_00002618"; exon_number "1"; oId "CUFF.2615.1"; tss_id "TSS2618"; +chr13 Cufflinks exon 111136043 111136078 . - . gene_id "XLOC_002619"; transcript_id "TCONS_00002619"; exon_number "1"; oId "CUFF.2617.1"; tss_id "TSS2619"; +chr13 Cufflinks exon 113598642 113598869 . - . gene_id "XLOC_002620"; transcript_id "TCONS_00002620"; exon_number "1"; oId "CUFF.2620.1"; tss_id "TSS2620"; +chr13 Cufflinks exon 113925587 113925665 . - . gene_id "XLOC_002621"; transcript_id "TCONS_00002621"; exon_number "1"; oId "CUFF.2621.1"; tss_id "TSS2621"; +chr13 Cufflinks exon 114133229 114133386 . - . gene_id "XLOC_002622"; transcript_id "TCONS_00002622"; exon_number "1"; oId "CUFF.2622.1"; tss_id "TSS2622"; +chr14 Cufflinks exon 19119515 19119619 . + . gene_id "XLOC_002623"; transcript_id "TCONS_00002623"; exon_number "1"; oId "CUFF.2623.1"; tss_id "TSS2623"; +chr14 Cufflinks exon 19564785 19564890 . + . gene_id "XLOC_002624"; transcript_id "TCONS_00002624"; exon_number "1"; oId "CUFF.2624.1"; tss_id "TSS2624"; +chr14 Cufflinks exon 20558289 20558368 . + . gene_id "XLOC_002625"; transcript_id "TCONS_00002625"; exon_number "1"; oId "CUFF.2627.1"; tss_id "TSS2625"; +chr14 Cufflinks exon 20803144 20803190 . + . gene_id "XLOC_002626"; transcript_id "TCONS_00002626"; exon_number "1"; oId "CUFF.2629.1"; tss_id "TSS2626"; +chr14 Cufflinks exon 20883146 20883235 . + . gene_id "XLOC_002627"; transcript_id "TCONS_00002627"; exon_number "1"; oId "CUFF.2631.1"; tss_id "TSS2627"; +chr14 Cufflinks exon 21078291 21078372 . + . gene_id "XLOC_002628"; transcript_id "TCONS_00002628"; exon_number "1"; oId "CUFF.2633.1"; tss_id "TSS2628"; +chr14 Cufflinks exon 21093529 21093610 . + . gene_id "XLOC_002629"; transcript_id "TCONS_00002629"; exon_number "1"; oId "CUFF.2636.1"; tss_id "TSS2629"; +chr14 Cufflinks exon 21101165 21101237 . + . gene_id "XLOC_002630"; transcript_id "TCONS_00002630"; exon_number "1"; oId "CUFF.2639.1"; tss_id "TSS2630"; +chr14 Cufflinks exon 21149849 21149921 . + . gene_id "XLOC_002631"; transcript_id "TCONS_00002631"; exon_number "1"; oId "CUFF.2646.1"; tss_id "TSS2631"; +chr14 Cufflinks exon 21151432 21151520 . + . gene_id "XLOC_002632"; transcript_id "TCONS_00002632"; exon_number "1"; oId "CUFF.2647.1"; tss_id "TSS2632"; +chr14 Cufflinks exon 21152175 21152248 . + . gene_id "XLOC_002633"; transcript_id "TCONS_00002633"; exon_number "1"; oId "CUFF.2648.1"; tss_id "TSS2633"; +chr14 Cufflinks exon 21431746 21432048 . + . gene_id "XLOC_002634"; transcript_id "TCONS_00002634"; exon_number "1"; oId "CUFF.2650.1"; tss_id "TSS2634"; +chr14 Cufflinks exon 23094160 23094194 . + . gene_id "XLOC_002635"; transcript_id "TCONS_00002635"; exon_number "1"; oId "CUFF.2658.1"; tss_id "TSS2635"; +chr14 Cufflinks exon 23137982 23138031 . + . gene_id "XLOC_002636"; transcript_id "TCONS_00002636"; exon_number "1"; oId "CUFF.2659.1"; tss_id "TSS2636"; +chr14 Cufflinks exon 23398910 23398982 . + . gene_id "XLOC_002637"; transcript_id "TCONS_00002637"; exon_number "1"; oId "CUFF.2660.1"; tss_id "TSS2637"; +chr14 Cufflinks exon 23557738 23557774 . + . gene_id "XLOC_002638"; transcript_id "TCONS_00002638"; exon_number "1"; oId "CUFF.2661.1"; tss_id "TSS2638"; +chr14 Cufflinks exon 24261131 24261338 . + . gene_id "XLOC_002639"; transcript_id "TCONS_00002639"; exon_number "1"; oId "CUFF.2667.1"; tss_id "TSS2639"; +chr14 Cufflinks exon 24627812 24627933 . + . gene_id "XLOC_002640"; transcript_id "TCONS_00002640"; exon_number "1"; oId "CUFF.2668.1"; tss_id "TSS2640"; +chr14 Cufflinks exon 28279433 28279470 . + . gene_id "XLOC_002641"; transcript_id "TCONS_00002641"; exon_number "1"; oId "CUFF.2672.1"; tss_id "TSS2641"; +chr14 Cufflinks exon 28507636 28507671 . + . gene_id "XLOC_002642"; transcript_id "TCONS_00002642"; exon_number "1"; oId "CUFF.2673.1"; tss_id "TSS2642"; +chr14 Cufflinks exon 29208919 29209056 . + . gene_id "XLOC_002643"; transcript_id "TCONS_00002643"; exon_number "1"; oId "CUFF.2675.1"; tss_id "TSS2643"; +chr14 Cufflinks exon 29323523 29323608 . + . gene_id "XLOC_002644"; transcript_id "TCONS_00002644"; exon_number "1"; oId "CUFF.2676.1"; tss_id "TSS2644"; +chr14 Cufflinks exon 30281123 30281224 . + . gene_id "XLOC_002645"; transcript_id "TCONS_00002645"; exon_number "1"; oId "CUFF.2679.1"; tss_id "TSS2645"; +chr14 Cufflinks exon 30758726 30758796 . + . gene_id "XLOC_002646"; transcript_id "TCONS_00002646"; exon_number "1"; oId "CUFF.2681.1"; tss_id "TSS2646"; +chr14 Cufflinks exon 30887920 30887976 . + . gene_id "XLOC_002647"; transcript_id "TCONS_00002647"; exon_number "1"; oId "CUFF.2682.1"; tss_id "TSS2647"; +chr14 Cufflinks exon 31009034 31009094 . + . gene_id "XLOC_002648"; transcript_id "TCONS_00002648"; exon_number "1"; oId "CUFF.2683.1"; tss_id "TSS2648"; +chr14 Cufflinks exon 31122528 31122557 . + . gene_id "XLOC_002649"; transcript_id "TCONS_00002649"; exon_number "1"; oId "CUFF.2684.1"; tss_id "TSS2649"; +chr14 Cufflinks exon 31235138 31235171 . + . gene_id "XLOC_002650"; transcript_id "TCONS_00002650"; exon_number "1"; oId "CUFF.2686.1"; tss_id "TSS2650"; +chr14 Cufflinks exon 31612153 31612254 . + . gene_id "XLOC_002651"; transcript_id "TCONS_00002651"; exon_number "1"; oId "CUFF.2689.1"; tss_id "TSS2651"; +chr14 Cufflinks exon 31775726 31775799 . + . gene_id "XLOC_002652"; transcript_id "TCONS_00002652"; exon_number "1"; oId "CUFF.2690.1"; tss_id "TSS2652"; +chr14 Cufflinks exon 32071631 32071703 . + . gene_id "XLOC_002653"; transcript_id "TCONS_00002653"; exon_number "1"; oId "CUFF.2691.1"; tss_id "TSS2653"; +chr14 Cufflinks exon 32373682 32373715 . + . gene_id "XLOC_002654"; transcript_id "TCONS_00002654"; exon_number "1"; oId "CUFF.2695.1"; tss_id "TSS2654"; +chr14 Cufflinks exon 32671251 32671356 . + . gene_id "XLOC_002655"; transcript_id "TCONS_00002655"; exon_number "1"; oId "CUFF.2696.1"; tss_id "TSS2655"; +chr14 Cufflinks exon 32748812 32748857 . + . gene_id "XLOC_002656"; transcript_id "TCONS_00002656"; exon_number "1"; oId "CUFF.2698.1"; tss_id "TSS2656"; +chr14 Cufflinks exon 32784154 32784218 . + . gene_id "XLOC_002657"; transcript_id "TCONS_00002657"; exon_number "1"; oId "CUFF.2699.1"; tss_id "TSS2657"; +chr14 Cufflinks exon 32911547 32911861 . + . gene_id "XLOC_002658"; transcript_id "TCONS_00002658"; exon_number "1"; oId "CUFF.2700.1"; tss_id "TSS2658"; +chr14 Cufflinks exon 32960253 32960372 . + . gene_id "XLOC_002659"; transcript_id "TCONS_00002659"; exon_number "1"; oId "CUFF.2701.1"; tss_id "TSS2659"; +chr14 Cufflinks exon 32993264 32993335 . + . gene_id "XLOC_002660"; transcript_id "TCONS_00002660"; exon_number "1"; oId "CUFF.2702.1"; tss_id "TSS2660"; +chr14 Cufflinks exon 35015920 35016083 . + . gene_id "XLOC_002661"; transcript_id "TCONS_00002661"; exon_number "1"; oId "CUFF.2704.1"; tss_id "TSS2661"; +chr14 Cufflinks exon 35145098 35145198 . + . gene_id "XLOC_002662"; transcript_id "TCONS_00002662"; exon_number "1"; oId "CUFF.2706.1"; tss_id "TSS2662"; +chr14 Cufflinks exon 35320883 35320969 . + . gene_id "XLOC_002663"; transcript_id "TCONS_00002663"; exon_number "1"; oId "CUFF.2709.1"; tss_id "TSS2663"; +chr14 Cufflinks exon 35517176 35517229 . + . gene_id "XLOC_002664"; transcript_id "TCONS_00002664"; exon_number "1"; oId "CUFF.2711.1"; tss_id "TSS2664"; +chr14 Cufflinks exon 36874423 36874479 . + . gene_id "XLOC_002665"; transcript_id "TCONS_00002665"; exon_number "1"; oId "CUFF.2715.1"; tss_id "TSS2665"; +chr14 Cufflinks exon 37656438 37656516 . + . gene_id "XLOC_002666"; transcript_id "TCONS_00002666"; exon_number "1"; oId "CUFF.2717.1"; tss_id "TSS2666"; +chr14 Cufflinks exon 38020080 38020115 . + . gene_id "XLOC_002667"; transcript_id "TCONS_00002667"; exon_number "1"; oId "CUFF.2719.1"; tss_id "TSS2667"; +chr14 Cufflinks exon 39399593 39399627 . + . gene_id "XLOC_002668"; transcript_id "TCONS_00002668"; exon_number "1"; oId "CUFF.2721.1"; tss_id "TSS2668"; +chr14 Cufflinks exon 40991535 40991569 . + . gene_id "XLOC_002669"; transcript_id "TCONS_00002669"; exon_number "1"; oId "CUFF.2724.1"; tss_id "TSS2669"; +chr14 Cufflinks exon 43722996 43723045 . + . gene_id "XLOC_002670"; transcript_id "TCONS_00002670"; exon_number "1"; oId "CUFF.2728.1"; tss_id "TSS2670"; +chr14 Cufflinks exon 45486422 45486547 . + . gene_id "XLOC_002671"; transcript_id "TCONS_00002671"; exon_number "1"; oId "CUFF.2731.1"; tss_id "TSS2671"; +chr14 Cufflinks exon 49480413 49480478 . + . gene_id "XLOC_002672"; transcript_id "TCONS_00002672"; exon_number "1"; oId "CUFF.2735.1"; tss_id "TSS2672"; +chr14 Cufflinks exon 49554431 49554472 . + . gene_id "XLOC_002673"; transcript_id "TCONS_00002673"; exon_number "1"; oId "CUFF.2736.1"; tss_id "TSS2673"; +chr14 Cufflinks exon 50019351 50019437 . + . gene_id "XLOC_002674"; transcript_id "TCONS_00002674"; exon_number "1"; oId "CUFF.2737.1"; tss_id "TSS2674"; +chr14 Cufflinks exon 50053298 50053597 . + . gene_id "XLOC_002675"; transcript_id "TCONS_00002675"; exon_number "1"; oId "CUFF.2738.1"; tss_id "TSS2675"; +chr14 Cufflinks exon 50306445 50306545 . + . gene_id "XLOC_002676"; transcript_id "TCONS_00002676"; exon_number "1"; oId "CUFF.2739.1"; tss_id "TSS2676"; +chr14 Cufflinks exon 50535286 50535530 . + . gene_id "XLOC_002677"; transcript_id "TCONS_00002677"; exon_number "1"; oId "CUFF.2744.1"; tss_id "TSS2677"; +chr14 Cufflinks exon 50763480 50763527 . + . gene_id "XLOC_002678"; transcript_id "TCONS_00002678"; exon_number "1"; oId "CUFF.2745.1"; tss_id "TSS2678"; +chr14 Cufflinks exon 51989585 51989666 . + . gene_id "XLOC_002679"; transcript_id "TCONS_00002679"; exon_number "1"; oId "CUFF.2748.1"; tss_id "TSS2679"; +chr14 Cufflinks exon 52159470 52159560 . + . gene_id "XLOC_002680"; transcript_id "TCONS_00002680"; exon_number "1"; oId "CUFF.2750.1"; tss_id "TSS2680"; +chr14 Cufflinks exon 52190821 52190927 . + . gene_id "XLOC_002681"; transcript_id "TCONS_00002681"; exon_number "1"; oId "CUFF.2751.1"; tss_id "TSS2681"; +chr14 Cufflinks exon 55423375 55423429 . + . gene_id "XLOC_002682"; transcript_id "TCONS_00002682"; exon_number "1"; oId "CUFF.2754.1"; tss_id "TSS2682"; +chr14 Cufflinks exon 55437297 55437340 . + . gene_id "XLOC_002683"; transcript_id "TCONS_00002683"; exon_number "1"; oId "CUFF.2755.1"; tss_id "TSS2683"; +chr14 Cufflinks exon 55752114 55752291 . + . gene_id "XLOC_002684"; transcript_id "TCONS_00002684"; exon_number "1"; oId "CUFF.2757.1"; tss_id "TSS2684"; +chr14 Cufflinks exon 55883663 55883705 . + . gene_id "XLOC_002685"; transcript_id "TCONS_00002685"; exon_number "1"; oId "CUFF.2758.1"; tss_id "TSS2685"; +chr14 Cufflinks exon 56492159 56492206 . + . gene_id "XLOC_002686"; transcript_id "TCONS_00002686"; exon_number "1"; oId "CUFF.2759.1"; tss_id "TSS2686"; +chr14 Cufflinks exon 57291704 57291810 . + . gene_id "XLOC_002687"; transcript_id "TCONS_00002687"; exon_number "1"; oId "CUFF.2765.1"; tss_id "TSS2687"; +chr14 Cufflinks exon 58601119 58601159 . + . gene_id "XLOC_002688"; transcript_id "TCONS_00002688"; exon_number "1"; oId "CUFF.2767.1"; tss_id "TSS2688"; +chr14 Cufflinks exon 58646489 58646802 . + . gene_id "XLOC_002689"; transcript_id "TCONS_00002689"; exon_number "1"; oId "CUFF.2768.1"; tss_id "TSS2689"; +chr14 Cufflinks exon 59833663 59833721 . + . gene_id "XLOC_002690"; transcript_id "TCONS_00002690"; exon_number "1"; oId "CUFF.2773.1"; tss_id "TSS2690"; +chr14 Cufflinks exon 61073785 61073830 . + . gene_id "XLOC_002691"; transcript_id "TCONS_00002691"; exon_number "1"; oId "CUFF.2774.1"; tss_id "TSS2691"; +chr14 Cufflinks exon 61441045 61441150 . + . gene_id "XLOC_002692"; transcript_id "TCONS_00002692"; exon_number "1"; oId "CUFF.2776.1"; tss_id "TSS2692"; +chr14 Cufflinks exon 61716131 61716241 . + . gene_id "XLOC_002693"; transcript_id "TCONS_00002693"; exon_number "1"; oId "CUFF.2777.1"; tss_id "TSS2693"; +chr14 Cufflinks exon 63944492 63944557 . + . gene_id "XLOC_002694"; transcript_id "TCONS_00002694"; exon_number "1"; oId "CUFF.2780.1"; tss_id "TSS2694"; +chr14 Cufflinks exon 64084761 64084862 . + . gene_id "XLOC_002695"; transcript_id "TCONS_00002695"; exon_number "1"; oId "CUFF.2781.1"; tss_id "TSS2695"; +chr14 Cufflinks exon 64097396 64097499 . + . gene_id "XLOC_002696"; transcript_id "TCONS_00002696"; exon_number "1"; oId "CUFF.2782.1"; tss_id "TSS2696"; +chr14 Cufflinks exon 64125838 64125904 . + . gene_id "XLOC_002697"; transcript_id "TCONS_00002697"; exon_number "1"; oId "CUFF.2784.1"; tss_id "TSS2697"; +chr14 Cufflinks exon 64203162 64203222 . + . gene_id "XLOC_002698"; transcript_id "TCONS_00002698"; exon_number "1"; oId "CUFF.2786.1"; tss_id "TSS2698"; +chr14 Cufflinks exon 64263447 64263548 . + . gene_id "XLOC_002699"; transcript_id "TCONS_00002699"; exon_number "1"; oId "CUFF.2788.1"; tss_id "TSS2699"; +chr14 Cufflinks exon 66708591 66708628 . + . gene_id "XLOC_002700"; transcript_id "TCONS_00002700"; exon_number "1"; oId "CUFF.2795.1"; tss_id "TSS2700"; +chr14 Cufflinks exon 67000063 67000131 . + . gene_id "XLOC_002701"; transcript_id "TCONS_00002701"; exon_number "1"; oId "CUFF.2796.1"; tss_id "TSS2701"; +chr14 Cufflinks exon 67726944 67727031 . + . gene_id "XLOC_002702"; transcript_id "TCONS_00002702"; exon_number "1"; oId "CUFF.2797.1"; tss_id "TSS2702"; +chr14 Cufflinks exon 68172673 68172991 . + . gene_id "XLOC_002703"; transcript_id "TCONS_00002703"; exon_number "1"; oId "CUFF.2799.1"; tss_id "TSS2703"; +chr14 Cufflinks exon 68190306 68190354 . + . gene_id "XLOC_002704"; transcript_id "TCONS_00002704"; exon_number "1"; oId "CUFF.2800.1"; tss_id "TSS2704"; +chr14 Cufflinks exon 68765741 68765866 . + . gene_id "XLOC_002705"; transcript_id "TCONS_00002705"; exon_number "1"; oId "CUFF.2805.1"; tss_id "TSS2705"; +chr14 Cufflinks exon 70827621 70827801 . + . gene_id "XLOC_002706"; transcript_id "TCONS_00002706"; exon_number "1"; oId "CUFF.2810.1"; tss_id "TSS2706"; +chr14 Cufflinks exon 70962822 70962927 . + . gene_id "XLOC_002707"; transcript_id "TCONS_00002707"; exon_number "1"; oId "CUFF.2811.1"; tss_id "TSS2707"; +chr14 Cufflinks exon 71076806 71077108 . + . gene_id "XLOC_002708"; transcript_id "TCONS_00002708"; exon_number "1"; oId "CUFF.2812.1"; tss_id "TSS2708"; +chr14 Cufflinks exon 71691202 71691238 . + . gene_id "XLOC_002709"; transcript_id "TCONS_00002709"; exon_number "1"; oId "CUFF.2813.1"; tss_id "TSS2709"; +chr14 Cufflinks exon 71915406 71915684 . + . gene_id "XLOC_002710"; transcript_id "TCONS_00002710"; exon_number "1"; oId "CUFF.2814.1"; tss_id "TSS2710"; +chr14 Cufflinks exon 72684649 72684746 . + . gene_id "XLOC_002711"; transcript_id "TCONS_00002711"; exon_number "1"; oId "CUFF.2815.1"; tss_id "TSS2711"; +chr14 Cufflinks exon 73429679 73429752 . + . gene_id "XLOC_002712"; transcript_id "TCONS_00002712"; exon_number "1"; oId "CUFF.2817.1"; tss_id "TSS2712"; +chr14 Cufflinks exon 73468168 73468209 . + . gene_id "XLOC_002713"; transcript_id "TCONS_00002713"; exon_number "1"; oId "CUFF.2818.1"; tss_id "TSS2713"; +chr14 Cufflinks exon 73669513 73669569 . + . gene_id "XLOC_002714"; transcript_id "TCONS_00002714"; exon_number "1"; oId "CUFF.2822.1"; tss_id "TSS2714"; +chr14 Cufflinks exon 73786038 73786075 . + . gene_id "XLOC_002715"; transcript_id "TCONS_00002715"; exon_number "1"; oId "CUFF.2824.1"; tss_id "TSS2715"; +chr14 Cufflinks exon 74122737 74122773 . + . gene_id "XLOC_002716"; transcript_id "TCONS_00002716"; exon_number "1"; oId "CUFF.2826.1"; tss_id "TSS2716"; +chr14 Cufflinks exon 74265718 74265823 . + . gene_id "XLOC_002717"; transcript_id "TCONS_00002717"; exon_number "1"; oId "CUFF.2828.1"; tss_id "TSS2717"; +chr14 Cufflinks exon 74641159 74641470 . + . gene_id "XLOC_002718"; transcript_id "TCONS_00002718"; exon_number "1"; oId "CUFF.2829.1"; tss_id "TSS2718"; +chr14 Cufflinks exon 75188420 75188454 . + . gene_id "XLOC_002719"; transcript_id "TCONS_00002719"; exon_number "1"; oId "CUFF.2830.1"; tss_id "TSS2719"; +chr14 Cufflinks exon 75487464 75487567 . + . gene_id "XLOC_002720"; transcript_id "TCONS_00002720"; exon_number "1"; oId "CUFF.2832.1"; tss_id "TSS2720"; +chr14 Cufflinks exon 75644694 75644729 . + . gene_id "XLOC_002721"; transcript_id "TCONS_00002721"; exon_number "1"; oId "CUFF.2833.1"; tss_id "TSS2721"; +chr14 Cufflinks exon 76070516 76070605 . + . gene_id "XLOC_002722"; transcript_id "TCONS_00002722"; exon_number "1"; oId "CUFF.2837.1"; tss_id "TSS2722"; +chr14 Cufflinks exon 76255625 76255659 . + . gene_id "XLOC_002723"; transcript_id "TCONS_00002723"; exon_number "1"; oId "CUFF.2838.1"; tss_id "TSS2723"; +chr14 Cufflinks exon 76529560 76529601 . + . gene_id "XLOC_002724"; transcript_id "TCONS_00002724"; exon_number "1"; oId "CUFF.2839.1"; tss_id "TSS2724"; +chr14 Cufflinks exon 77356615 77356830 . + . gene_id "XLOC_002725"; transcript_id "TCONS_00002725"; exon_number "1"; oId "CUFF.2843.1"; tss_id "TSS2725"; +chr14 Cufflinks exon 77854611 77854640 . + . gene_id "XLOC_002726"; transcript_id "TCONS_00002726"; exon_number "1"; oId "CUFF.2844.1"; tss_id "TSS2726"; +chr14 Cufflinks exon 81047583 81047601 . + . gene_id "XLOC_002727"; transcript_id "TCONS_00002727"; exon_number "1"; oId "CUFF.2849.1"; tss_id "TSS2727"; +chr14 Cufflinks exon 81231432 81231467 . + . gene_id "XLOC_002728"; transcript_id "TCONS_00002728"; exon_number "1"; oId "CUFF.2850.1"; tss_id "TSS2728"; +chr14 Cufflinks exon 81668791 81668989 . + . gene_id "XLOC_002729"; transcript_id "TCONS_00002729"; exon_number "1"; oId "CUFF.2851.1"; tss_id "TSS2729"; +chr14 Cufflinks exon 82634363 82634391 . + . gene_id "XLOC_002730"; transcript_id "TCONS_00002730"; exon_number "1"; oId "CUFF.2853.1"; tss_id "TSS2730"; +chr14 Cufflinks exon 82896221 82896506 . + . gene_id "XLOC_002731"; transcript_id "TCONS_00002731"; exon_number "1"; oId "CUFF.2854.1"; tss_id "TSS2731"; +chr14 Cufflinks exon 82928431 82928534 . + . gene_id "XLOC_002732"; transcript_id "TCONS_00002732"; exon_number "1"; oId "CUFF.2855.1"; tss_id "TSS2732"; +chr14 Cufflinks exon 83054697 83054858 . + . gene_id "XLOC_002733"; transcript_id "TCONS_00002733"; exon_number "1"; oId "CUFF.2856.1"; tss_id "TSS2733"; +chr14 Cufflinks exon 83514924 83514982 . + . gene_id "XLOC_002734"; transcript_id "TCONS_00002734"; exon_number "1"; oId "CUFF.2857.1"; tss_id "TSS2734"; +chr14 Cufflinks exon 83622172 83622209 . + . gene_id "XLOC_002735"; transcript_id "TCONS_00002735"; exon_number "1"; oId "CUFF.2858.1"; tss_id "TSS2735"; +chr14 Cufflinks exon 84310245 84310489 . + . gene_id "XLOC_002736"; transcript_id "TCONS_00002736"; exon_number "1"; oId "CUFF.2860.1"; tss_id "TSS2736"; +chr14 Cufflinks exon 84639100 84639174 . + . gene_id "XLOC_002737"; transcript_id "TCONS_00002737"; exon_number "1"; oId "CUFF.2862.1"; tss_id "TSS2737"; +chr14 Cufflinks exon 85206286 85206349 . + . gene_id "XLOC_002738"; transcript_id "TCONS_00002738"; exon_number "1"; oId "CUFF.2863.1"; tss_id "TSS2738"; +chr14 Cufflinks exon 85655240 85655474 . + . gene_id "XLOC_002739"; transcript_id "TCONS_00002739"; exon_number "1"; oId "CUFF.2864.1"; tss_id "TSS2739"; +chr14 Cufflinks exon 85738276 85738349 . + . gene_id "XLOC_002740"; transcript_id "TCONS_00002740"; exon_number "1"; oId "CUFF.2865.1"; tss_id "TSS2740"; +chr14 Cufflinks exon 86503223 86503318 . + . gene_id "XLOC_002741"; transcript_id "TCONS_00002741"; exon_number "1"; oId "CUFF.2866.1"; tss_id "TSS2741"; +chr14 Cufflinks exon 87789724 87789766 . + . gene_id "XLOC_002742"; transcript_id "TCONS_00002742"; exon_number "1"; oId "CUFF.2868.1"; tss_id "TSS2742"; +chr14 Cufflinks exon 88428629 88428670 . + . gene_id "XLOC_002743"; transcript_id "TCONS_00002743"; exon_number "1"; oId "CUFF.2870.1"; tss_id "TSS2743"; +chr14 Cufflinks exon 88596630 88596850 . + . gene_id "XLOC_002744"; transcript_id "TCONS_00002744"; exon_number "1"; oId "CUFF.2872.1"; tss_id "TSS2744"; +chr14 Cufflinks exon 88596901 88597173 . + . gene_id "XLOC_002745"; transcript_id "TCONS_00002745"; exon_number "1"; oId "CUFF.2873.1"; tss_id "TSS2745"; +chr14 Cufflinks exon 88795486 88795519 . + . gene_id "XLOC_002746"; transcript_id "TCONS_00002746"; exon_number "1"; oId "CUFF.2875.1"; tss_id "TSS2746"; +chr14 Cufflinks exon 88979842 88979908 . + . gene_id "XLOC_002747"; transcript_id "TCONS_00002747"; exon_number "1"; oId "CUFF.2876.1"; tss_id "TSS2747"; +chr14 Cufflinks exon 89286641 89286779 . + . gene_id "XLOC_002748"; transcript_id "TCONS_00002748"; exon_number "1"; oId "CUFF.2877.1"; tss_id "TSS2748"; +chr14 Cufflinks exon 89344162 89344221 . + . gene_id "XLOC_002749"; transcript_id "TCONS_00002749"; exon_number "1"; oId "CUFF.2878.1"; tss_id "TSS2749"; +chr14 Cufflinks exon 89445442 89445514 . + . gene_id "XLOC_002750"; transcript_id "TCONS_00002750"; exon_number "1"; oId "CUFF.2879.1"; tss_id "TSS2750"; +chr14 Cufflinks exon 90088262 90088499 . + . gene_id "XLOC_002751"; transcript_id "TCONS_00002751"; exon_number "1"; oId "CUFF.2881.1"; tss_id "TSS2751"; +chr14 Cufflinks exon 90178855 90179094 . + . gene_id "XLOC_002752"; transcript_id "TCONS_00002752"; exon_number "1"; oId "CUFF.2882.1"; tss_id "TSS2752"; +chr14 Cufflinks exon 90659034 90659073 . + . gene_id "XLOC_002753"; transcript_id "TCONS_00002753"; exon_number "1"; oId "CUFF.2884.1"; tss_id "TSS2753"; +chr14 Cufflinks exon 90817382 90817444 . + . gene_id "XLOC_002754"; transcript_id "TCONS_00002754"; exon_number "1"; oId "CUFF.2885.1"; tss_id "TSS2754"; +chr14 Cufflinks exon 91557422 91557481 . + . gene_id "XLOC_002755"; transcript_id "TCONS_00002755"; exon_number "1"; oId "CUFF.2887.1"; tss_id "TSS2755"; +chr14 Cufflinks exon 91737034 91737074 . + . gene_id "XLOC_002756"; transcript_id "TCONS_00002756"; exon_number "1"; oId "CUFF.2888.1"; tss_id "TSS2756"; +chr14 Cufflinks exon 92539064 92539097 . + . gene_id "XLOC_002757"; transcript_id "TCONS_00002757"; exon_number "1"; oId "CUFF.2892.1"; tss_id "TSS2757"; +chr14 Cufflinks exon 92732051 92732151 . + . gene_id "XLOC_002758"; transcript_id "TCONS_00002758"; exon_number "1"; oId "CUFF.2894.1"; tss_id "TSS2758"; +chr14 Cufflinks exon 93689764 93689820 . + . gene_id "XLOC_002759"; transcript_id "TCONS_00002759"; exon_number "1"; oId "CUFF.2895.1"; tss_id "TSS2759"; +chr14 Cufflinks exon 93860470 93860533 . + . gene_id "XLOC_002760"; transcript_id "TCONS_00002760"; exon_number "1"; oId "CUFF.2896.1"; tss_id "TSS2760"; +chr14 Cufflinks exon 96850961 96851148 . + . gene_id "XLOC_002761"; transcript_id "TCONS_00002761"; exon_number "1"; oId "CUFF.2901.1"; tss_id "TSS2761"; +chr14 Cufflinks exon 96867957 96868012 . + . gene_id "XLOC_002762"; transcript_id "TCONS_00002762"; exon_number "1"; oId "CUFF.2902.1"; tss_id "TSS2762"; +chr14 Cufflinks exon 97294895 97294936 . + . gene_id "XLOC_002763"; transcript_id "TCONS_00002763"; exon_number "1"; oId "CUFF.2904.1"; tss_id "TSS2763"; +chr14 Cufflinks exon 99910644 99910749 . + . gene_id "XLOC_002764"; transcript_id "TCONS_00002764"; exon_number "1"; oId "CUFF.2907.1"; tss_id "TSS2764"; +chr14 Cufflinks exon 100048780 100048821 . + . gene_id "XLOC_002765"; transcript_id "TCONS_00002765"; exon_number "1"; oId "CUFF.2908.1"; tss_id "TSS2765"; +chr14 Cufflinks exon 100411653 100411815 . + . gene_id "XLOC_002766"; transcript_id "TCONS_00002766"; exon_number "1"; oId "CUFF.2909.1"; tss_id "TSS2766"; +chr14 Cufflinks exon 100953882 100954090 . + . gene_id "XLOC_002767"; transcript_id "TCONS_00002767"; exon_number "1"; oId "CUFF.2911.1"; tss_id "TSS2767"; +chr14 Cufflinks exon 102269564 102269668 . + . gene_id "XLOC_002768"; transcript_id "TCONS_00002768"; exon_number "1"; oId "CUFF.2914.1"; tss_id "TSS2768"; +chr14 Cufflinks exon 102783429 102783502 . + . gene_id "XLOC_002769"; transcript_id "TCONS_00002769"; exon_number "1"; oId "CUFF.2917.1"; tss_id "TSS2769"; +chr14 Cufflinks exon 102968013 102968111 . + . gene_id "XLOC_002770"; transcript_id "TCONS_00002770"; exon_number "1"; oId "CUFF.2921.1"; tss_id "TSS2770"; +chr14 Cufflinks exon 103332193 103332300 . + . gene_id "XLOC_002771"; transcript_id "TCONS_00002771"; exon_number "1"; oId "CUFF.2926.1"; tss_id "TSS2771"; +chr14 Cufflinks exon 103886164 103886344 . + . gene_id "XLOC_002772"; transcript_id "TCONS_00002772"; exon_number "1"; oId "CUFF.2929.1"; tss_id "TSS2772"; +chr14 Cufflinks exon 104016683 104016743 . + . gene_id "XLOC_002773"; transcript_id "TCONS_00002773"; exon_number "1"; oId "CUFF.2930.1"; tss_id "TSS2773"; +chr14 Cufflinks exon 104033742 104033885 . + . gene_id "XLOC_002774"; transcript_id "TCONS_00002774"; exon_number "1"; oId "CUFF.2931.1"; tss_id "TSS2774"; +chr14 Cufflinks exon 104479979 104480279 . + . gene_id "XLOC_002775"; transcript_id "TCONS_00002775"; exon_number "1"; oId "CUFF.2932.1"; tss_id "TSS2775"; +chr14 Cufflinks exon 105313360 105313416 . + . gene_id "XLOC_002776"; transcript_id "TCONS_00002776"; exon_number "1"; oId "CUFF.2934.1"; tss_id "TSS2776"; +chr14 Cufflinks exon 106803757 106803802 . + . gene_id "XLOC_002777"; transcript_id "TCONS_00002777"; exon_number "1"; oId "CUFF.2936.1"; tss_id "TSS2777"; +chr14 Cufflinks exon 107092677 107092766 . + . gene_id "XLOC_002778"; transcript_id "TCONS_00002778"; exon_number "1"; oId "CUFF.2937.1"; tss_id "TSS2778"; +chr14 Cufflinks exon 107279296 107279341 . + . gene_id "XLOC_002779"; transcript_id "TCONS_00002779"; exon_number "1"; oId "CUFF.2938.1"; tss_id "TSS2779"; +chr14 Cufflinks exon 20008754 20008859 . - . gene_id "XLOC_002780"; transcript_id "TCONS_00002780"; exon_number "1"; oId "CUFF.2625.1"; tss_id "TSS2780"; +chr14 Cufflinks exon 20232063 20232167 . - . gene_id "XLOC_002781"; transcript_id "TCONS_00002781"; exon_number "1"; oId "CUFF.2626.1"; tss_id "TSS2781"; +chr14 Cufflinks exon 20614223 20614314 . - . gene_id "XLOC_002782"; transcript_id "TCONS_00002782"; exon_number "1"; oId "CUFF.2628.1"; tss_id "TSS2782"; +chr14 Cufflinks exon 20811230 20811570 . - . gene_id "XLOC_002783"; transcript_id "TCONS_00002783"; exon_number "1"; oId "CUFF.2630.1"; tss_id "TSS2783"; +chr14 Cufflinks exon 21077495 21077566 . - . gene_id "XLOC_002784"; transcript_id "TCONS_00002784"; exon_number "1"; oId "CUFF.2632.1"; tss_id "TSS2784"; +chr14 Cufflinks exon 21081558 21081631 . - . gene_id "XLOC_002785"; transcript_id "TCONS_00002785"; exon_number "1"; oId "CUFF.2634.1"; tss_id "TSS2785"; +chr14 Cufflinks exon 21081949 21082021 . - . gene_id "XLOC_002786"; transcript_id "TCONS_00002786"; exon_number "1"; oId "CUFF.2635.1"; tss_id "TSS2786"; +chr14 Cufflinks exon 21098591 21098668 . - . gene_id "XLOC_002787"; transcript_id "TCONS_00002787"; exon_number "1"; oId "CUFF.2637.1"; tss_id "TSS2787"; +chr14 Cufflinks exon 21099318 21099391 . - . gene_id "XLOC_002788"; transcript_id "TCONS_00002788"; exon_number "1"; oId "CUFF.2638.1"; tss_id "TSS2788"; +chr14 Cufflinks exon 21121258 21121351 . - . gene_id "XLOC_002789"; transcript_id "TCONS_00002789"; exon_number "1"; oId "CUFF.2640.1"; tss_id "TSS2789"; +chr14 Cufflinks exon 21125623 21125716 . - . gene_id "XLOC_002790"; transcript_id "TCONS_00002790"; exon_number "1"; oId "CUFF.2641.1"; tss_id "TSS2790"; +chr14 Cufflinks exon 21128117 21128210 . - . gene_id "XLOC_002791"; transcript_id "TCONS_00002791"; exon_number "1"; oId "CUFF.2642.1"; tss_id "TSS2791"; +chr14 Cufflinks exon 21131351 21131444 . - . gene_id "XLOC_002792"; transcript_id "TCONS_00002792"; exon_number "1"; oId "CUFF.2643.1"; tss_id "TSS2792"; +chr14 Cufflinks exon 21137334 21137417 . - . gene_id "XLOC_002793"; transcript_id "TCONS_00002793"; exon_number "1"; oId "CUFF.2644.1"; tss_id "TSS2793"; +chr14 Cufflinks exon 21145180 21145259 . - . gene_id "XLOC_002794"; transcript_id "TCONS_00002794"; exon_number "1"; oId "CUFF.2645.1"; tss_id "TSS2794"; +chr14 Cufflinks exon 21205527 21205593 . - . gene_id "XLOC_002795"; transcript_id "TCONS_00002795"; exon_number "1"; oId "CUFF.2649.1"; tss_id "TSS2795"; +chr14 Cufflinks exon 21581799 21581904 . - . gene_id "XLOC_002796"; transcript_id "TCONS_00002796"; exon_number "1"; oId "CUFF.2651.1"; tss_id "TSS2796"; +chr14 Cufflinks exon 21828873 21828910 . - . gene_id "XLOC_002797"; transcript_id "TCONS_00002797"; exon_number "1"; oId "CUFF.2652.1"; tss_id "TSS2797"; +chr14 Cufflinks exon 21897652 21897965 . - . gene_id "XLOC_002798"; transcript_id "TCONS_00002798"; exon_number "1"; oId "CUFF.2653.1"; tss_id "TSS2798"; +chr14 Cufflinks exon 22069930 22070018 . - . gene_id "XLOC_002799"; transcript_id "TCONS_00002799"; exon_number "1"; oId "CUFF.2654.1"; tss_id "TSS2799"; +chr14 Cufflinks exon 22198248 22198313 . - . gene_id "XLOC_002800"; transcript_id "TCONS_00002800"; exon_number "1"; oId "CUFF.2655.1"; tss_id "TSS2800"; +chr14 Cufflinks exon 22640695 22640766 . - . gene_id "XLOC_002801"; transcript_id "TCONS_00002801"; exon_number "1"; oId "CUFF.2656.1"; tss_id "TSS2801"; +chr14 Cufflinks exon 23031631 23031690 . - . gene_id "XLOC_002802"; transcript_id "TCONS_00002802"; exon_number "1"; oId "CUFF.2657.1"; tss_id "TSS2802"; +chr14 Cufflinks exon 23625521 23625623 . - . gene_id "XLOC_002803"; transcript_id "TCONS_00002803"; exon_number "1"; oId "CUFF.2662.1"; tss_id "TSS2803"; +chr14 Cufflinks exon 23728674 23728775 . - . gene_id "XLOC_002804"; transcript_id "TCONS_00002804"; exon_number "1"; oId "CUFF.2663.1"; tss_id "TSS2804"; +chr14 Cufflinks exon 23986958 23987095 . - . gene_id "XLOC_002805"; transcript_id "TCONS_00002805"; exon_number "1"; oId "CUFF.2664.1"; tss_id "TSS2805"; +chr14 Cufflinks exon 24027031 24027100 . - . gene_id "XLOC_002806"; transcript_id "TCONS_00002806"; exon_number "1"; oId "CUFF.2665.1"; tss_id "TSS2806"; +chr14 Cufflinks exon 24152427 24152469 . - . gene_id "XLOC_002807"; transcript_id "TCONS_00002807"; exon_number "1"; oId "CUFF.2666.1"; tss_id "TSS2807"; +chr14 Cufflinks exon 24821263 24821363 . - . gene_id "XLOC_002808"; transcript_id "TCONS_00002808"; exon_number "1"; oId "CUFF.2669.1"; tss_id "TSS2808"; +chr14 Cufflinks exon 26865067 26865140 . - . gene_id "XLOC_002809"; transcript_id "TCONS_00002809"; exon_number "1"; oId "CUFF.2670.1"; tss_id "TSS2809"; +chr14 Cufflinks exon 27934051 27934088 . - . gene_id "XLOC_002810"; transcript_id "TCONS_00002810"; exon_number "1"; oId "CUFF.2671.1"; tss_id "TSS2810"; +chr14 Cufflinks exon 28870737 28870860 . - . gene_id "XLOC_002811"; transcript_id "TCONS_00002811"; exon_number "1"; oId "CUFF.2674.1"; tss_id "TSS2811"; +chr14 Cufflinks exon 29451541 29451616 . - . gene_id "XLOC_002812"; transcript_id "TCONS_00002812"; exon_number "1"; oId "CUFF.2677.1"; tss_id "TSS2812"; +chr14 Cufflinks exon 29891924 29891967 . - . gene_id "XLOC_002813"; transcript_id "TCONS_00002813"; exon_number "1"; oId "CUFF.2678.1"; tss_id "TSS2813"; +chr14 Cufflinks exon 30505489 30505524 . - . gene_id "XLOC_002814"; transcript_id "TCONS_00002814"; exon_number "1"; oId "CUFF.2680.1"; tss_id "TSS2814"; +chr14 Cufflinks exon 31207662 31207691 . - . gene_id "XLOC_002815"; transcript_id "TCONS_00002815"; exon_number "1"; oId "CUFF.2685.1"; tss_id "TSS2815"; +chr14 Cufflinks exon 31563385 31563467 . - . gene_id "XLOC_002816"; transcript_id "TCONS_00002816"; exon_number "1"; oId "CUFF.2687.1"; tss_id "TSS2816"; +chr14 Cufflinks exon 31591280 31591332 . - . gene_id "XLOC_002817"; transcript_id "TCONS_00002817"; exon_number "1"; oId "CUFF.2688.1"; tss_id "TSS2817"; +chr14 Cufflinks exon 32131268 32131349 . - . gene_id "XLOC_002818"; transcript_id "TCONS_00002818"; exon_number "1"; oId "CUFF.2692.1"; tss_id "TSS2818"; +chr14 Cufflinks exon 32155901 32156004 . - . gene_id "XLOC_002819"; transcript_id "TCONS_00002819"; exon_number "1"; oId "CUFF.2693.1"; tss_id "TSS2819"; +chr14 Cufflinks exon 32236813 32236885 . - . gene_id "XLOC_002820"; transcript_id "TCONS_00002820"; exon_number "1"; oId "CUFF.2694.1"; tss_id "TSS2820"; +chr14 Cufflinks exon 32672370 32672475 . - . gene_id "XLOC_002821"; transcript_id "TCONS_00002821"; exon_number "1"; oId "CUFF.2697.1"; tss_id "TSS2821"; +chr14 Cufflinks exon 33550350 33550392 . - . gene_id "XLOC_002822"; transcript_id "TCONS_00002822"; exon_number "1"; oId "CUFF.2703.1"; tss_id "TSS2822"; +chr14 Cufflinks exon 35025432 35025595 . - . gene_id "XLOC_002823"; transcript_id "TCONS_00002823"; exon_number "1"; oId "CUFF.2705.1"; tss_id "TSS2823"; +chr14 Cufflinks exon 35254028 35254062 . - . gene_id "XLOC_002824"; transcript_id "TCONS_00002824"; exon_number "1"; oId "CUFF.2707.1"; tss_id "TSS2824"; +chr14 Cufflinks exon 35314506 35314566 . - . gene_id "XLOC_002825"; transcript_id "TCONS_00002825"; exon_number "1"; oId "CUFF.2708.1"; tss_id "TSS2825"; +chr14 Cufflinks exon 35388550 35388588 . - . gene_id "XLOC_002826"; transcript_id "TCONS_00002826"; exon_number "1"; oId "CUFF.2710.1"; tss_id "TSS2826"; +chr14 Cufflinks exon 36162762 36162822 . - . gene_id "XLOC_002827"; transcript_id "TCONS_00002827"; exon_number "1"; oId "CUFF.2712.1"; tss_id "TSS2827"; +chr14 Cufflinks exon 36256062 36256169 . - . gene_id "XLOC_002828"; transcript_id "TCONS_00002828"; exon_number "1"; oId "CUFF.2713.1"; tss_id "TSS2828"; +chr14 Cufflinks exon 36700823 36700976 . - . gene_id "XLOC_002829"; transcript_id "TCONS_00002829"; exon_number "1"; oId "CUFF.2714.1"; tss_id "TSS2829"; +chr14 Cufflinks exon 37063113 37063352 . - . gene_id "XLOC_002830"; transcript_id "TCONS_00002830"; exon_number "1"; oId "CUFF.2716.1"; tss_id "TSS2830"; +chr14 Cufflinks exon 37903674 37903778 . - . gene_id "XLOC_002831"; transcript_id "TCONS_00002831"; exon_number "1"; oId "CUFF.2718.1"; tss_id "TSS2831"; +chr14 Cufflinks exon 38297003 38297108 . - . gene_id "XLOC_002832"; transcript_id "TCONS_00002832"; exon_number "1"; oId "CUFF.2720.1"; tss_id "TSS2832"; +chr14 Cufflinks exon 39652831 39652885 . - . gene_id "XLOC_002833"; transcript_id "TCONS_00002833"; exon_number "1"; oId "CUFF.2722.1"; tss_id "TSS2833"; +chr14 Cufflinks exon 39653191 39653228 . - . gene_id "XLOC_002834"; transcript_id "TCONS_00002834"; exon_number "1"; oId "CUFF.2723.1"; tss_id "TSS2834"; +chr14 Cufflinks exon 41639592 41639628 . - . gene_id "XLOC_002835"; transcript_id "TCONS_00002835"; exon_number "1"; oId "CUFF.2725.1"; tss_id "TSS2835"; +chr14 Cufflinks exon 42207886 42207933 . - . gene_id "XLOC_002836"; transcript_id "TCONS_00002836"; exon_number "1"; oId "CUFF.2726.1"; tss_id "TSS2836"; +chr14 Cufflinks exon 42544661 42544709 . - . gene_id "XLOC_002837"; transcript_id "TCONS_00002837"; exon_number "1"; oId "CUFF.2727.1"; tss_id "TSS2837"; +chr14 Cufflinks exon 44339320 44339392 . - . gene_id "XLOC_002838"; transcript_id "TCONS_00002838"; exon_number "1"; oId "CUFF.2729.1"; tss_id "TSS2838"; +chr14 Cufflinks exon 45036113 45036197 . - . gene_id "XLOC_002839"; transcript_id "TCONS_00002839"; exon_number "1"; oId "CUFF.2730.1"; tss_id "TSS2839"; +chr14 Cufflinks exon 45743562 45743657 . - . gene_id "XLOC_002840"; transcript_id "TCONS_00002840"; exon_number "1"; oId "CUFF.2732.1"; tss_id "TSS2840"; +chr14 Cufflinks exon 45876988 45877027 . - . gene_id "XLOC_002841"; transcript_id "TCONS_00002841"; exon_number "1"; oId "CUFF.2733.1"; tss_id "TSS2841"; +chr14 Cufflinks exon 48810429 48810535 . - . gene_id "XLOC_002842"; transcript_id "TCONS_00002842"; exon_number "1"; oId "CUFF.2734.1"; tss_id "TSS2842"; +chr14 Cufflinks exon 50307345 50307388 . - . gene_id "XLOC_002843"; transcript_id "TCONS_00002843"; exon_number "1"; oId "CUFF.2740.1"; tss_id "TSS2843"; +chr14 Cufflinks exon 50320333 50320632 . - . gene_id "XLOC_002844"; transcript_id "TCONS_00002844"; exon_number "1"; oId "CUFF.2741.1"; tss_id "TSS2844"; +chr14 Cufflinks exon 50329268 50329567 . - . gene_id "XLOC_002845"; transcript_id "TCONS_00002845"; exon_number "1"; oId "CUFF.2742.1"; tss_id "TSS2845"; +chr14 Cufflinks exon 50368572 50368667 . - . gene_id "XLOC_002846"; transcript_id "TCONS_00002846"; exon_number "1"; oId "CUFF.2743.1"; tss_id "TSS2846"; +chr14 Cufflinks exon 51104388 51104699 . - . gene_id "XLOC_002847"; transcript_id "TCONS_00002847"; exon_number "1"; oId "CUFF.2746.1"; tss_id "TSS2847"; +chr14 Cufflinks exon 51714649 51714691 . - . gene_id "XLOC_002848"; transcript_id "TCONS_00002848"; exon_number "1"; oId "CUFF.2747.1"; tss_id "TSS2848"; +chr14 Cufflinks exon 52071557 52071618 . - . gene_id "XLOC_002849"; transcript_id "TCONS_00002849"; exon_number "1"; oId "CUFF.2749.1"; tss_id "TSS2849"; +chr14 Cufflinks exon 53546001 53546075 . - . gene_id "XLOC_002850"; transcript_id "TCONS_00002850"; exon_number "1"; oId "CUFF.2752.1"; tss_id "TSS2850"; +chr14 Cufflinks exon 55252245 55252280 . - . gene_id "XLOC_002851"; transcript_id "TCONS_00002851"; exon_number "1"; oId "CUFF.2753.1"; tss_id "TSS2851"; +chr14 Cufflinks exon 55554258 55554339 . - . gene_id "XLOC_002852"; transcript_id "TCONS_00002852"; exon_number "1"; oId "CUFF.2756.1"; tss_id "TSS2852"; +chr14 Cufflinks exon 56582159 56582310 . - . gene_id "XLOC_002853"; transcript_id "TCONS_00002853"; exon_number "1"; oId "CUFF.2760.1"; tss_id "TSS2853"; +chr14 Cufflinks exon 56679274 56679413 . - . gene_id "XLOC_002854"; transcript_id "TCONS_00002854"; exon_number "1"; oId "CUFF.2761.1"; tss_id "TSS2854"; +chr14 Cufflinks exon 57162835 57162892 . - . gene_id "XLOC_002855"; transcript_id "TCONS_00002855"; exon_number "1"; oId "CUFF.2762.1"; tss_id "TSS2855"; +chr14 Cufflinks exon 57290209 57290280 . - . gene_id "XLOC_002856"; transcript_id "TCONS_00002856"; exon_number "1"; oId "CUFF.2763.1"; tss_id "TSS2856"; +chr14 Cufflinks exon 57291083 57291374 . - . gene_id "XLOC_002857"; transcript_id "TCONS_00002857"; exon_number "1"; oId "CUFF.2764.1"; tss_id "TSS2857"; +chr14 Cufflinks exon 58304162 58304376 . - . gene_id "XLOC_002858"; transcript_id "TCONS_00002858"; exon_number "1"; oId "CUFF.2766.1"; tss_id "TSS2858"; +chr14 Cufflinks exon 58706612 58706685 . - . gene_id "XLOC_002859"; transcript_id "TCONS_00002859"; exon_number "1"; oId "CUFF.2769.1"; tss_id "TSS2859"; +chr14 Cufflinks exon 58759017 58759105 . - . gene_id "XLOC_002860"; transcript_id "TCONS_00002860"; exon_number "1"; oId "CUFF.2770.1"; tss_id "TSS2860"; +chr14 Cufflinks exon 59095907 59096001 . - . gene_id "XLOC_002861"; transcript_id "TCONS_00002861"; exon_number "1"; oId "CUFF.2771.1"; tss_id "TSS2861"; +chr14 Cufflinks exon 59270789 59270826 . - . gene_id "XLOC_002862"; transcript_id "TCONS_00002862"; exon_number "1"; oId "CUFF.2772.1"; tss_id "TSS2862"; +chr14 Cufflinks exon 61089037 61089149 . - . gene_id "XLOC_002863"; transcript_id "TCONS_00002863"; exon_number "1"; oId "CUFF.2775.1"; tss_id "TSS2863"; +chr14 Cufflinks exon 62160881 62160922 . - . gene_id "XLOC_002864"; transcript_id "TCONS_00002864"; exon_number "1"; oId "CUFF.2778.1"; tss_id "TSS2864"; +chr14 Cufflinks exon 62489499 62489555 . - . gene_id "XLOC_002865"; transcript_id "TCONS_00002865"; exon_number "1"; oId "CUFF.2779.1"; tss_id "TSS2865"; +chr14 Cufflinks exon 64118014 64118217 . - . gene_id "XLOC_002866"; transcript_id "TCONS_00002866"; exon_number "1"; oId "CUFF.2783.1"; tss_id "TSS2866"; +chr14 Cufflinks exon 64157915 64157949 . - . gene_id "XLOC_002867"; transcript_id "TCONS_00002867"; exon_number "1"; oId "CUFF.2785.1"; tss_id "TSS2867"; +chr14 Cufflinks exon 64225419 64225454 . - . gene_id "XLOC_002868"; transcript_id "TCONS_00002868"; exon_number "1"; oId "CUFF.2787.1"; tss_id "TSS2868"; +chr14 Cufflinks exon 64398549 64398639 . - . gene_id "XLOC_002869"; transcript_id "TCONS_00002869"; exon_number "1"; oId "CUFF.2789.1"; tss_id "TSS2869"; +chr14 Cufflinks exon 65336094 65336132 . - . gene_id "XLOC_002870"; transcript_id "TCONS_00002870"; exon_number "1"; oId "CUFF.2790.1"; tss_id "TSS2870"; +chr14 Cufflinks exon 65591074 65591260 . - . gene_id "XLOC_002871"; transcript_id "TCONS_00002871"; exon_number "1"; oId "CUFF.2791.1"; tss_id "TSS2871"; +chr14 Cufflinks exon 66126279 66126313 . - . gene_id "XLOC_002872"; transcript_id "TCONS_00002872"; exon_number "1"; oId "CUFF.2792.1"; tss_id "TSS2872"; +chr14 Cufflinks exon 66369712 66369746 . - . gene_id "XLOC_002873"; transcript_id "TCONS_00002873"; exon_number "1"; oId "CUFF.2793.1"; tss_id "TSS2873"; +chr14 Cufflinks exon 66624585 66624622 . - . gene_id "XLOC_002874"; transcript_id "TCONS_00002874"; exon_number "1"; oId "CUFF.2794.1"; tss_id "TSS2874"; +chr14 Cufflinks exon 68123820 68123926 . - . gene_id "XLOC_002875"; transcript_id "TCONS_00002875"; exon_number "1"; oId "CUFF.2798.1"; tss_id "TSS2875"; +chr14 Cufflinks exon 68212124 68212190 . - . gene_id "XLOC_002876"; transcript_id "TCONS_00002876"; exon_number "1"; oId "CUFF.2801.1"; tss_id "TSS2876"; +chr14 Cufflinks exon 68217931 68218261 . - . gene_id "XLOC_002877"; transcript_id "TCONS_00002877"; exon_number "1"; oId "CUFF.2802.1"; tss_id "TSS2877"; +chr14 Cufflinks exon 68616331 68616623 . - . gene_id "XLOC_002878"; transcript_id "TCONS_00002878"; exon_number "1"; oId "CUFF.2803.1"; tss_id "TSS2878"; +chr14 Cufflinks exon 68702958 68703255 . - . gene_id "XLOC_002879"; transcript_id "TCONS_00002879"; exon_number "1"; oId "CUFF.2804.1"; tss_id "TSS2879"; +chr14 Cufflinks exon 68884790 68884833 . - . gene_id "XLOC_002880"; transcript_id "TCONS_00002880"; exon_number "1"; oId "CUFF.2806.1"; tss_id "TSS2880"; +chr14 Cufflinks exon 69202639 69202745 . - . gene_id "XLOC_002881"; transcript_id "TCONS_00002881"; exon_number "1"; oId "CUFF.2807.1"; tss_id "TSS2881"; +chr14 Cufflinks exon 69570342 69570379 . - . gene_id "XLOC_002882"; transcript_id "TCONS_00002882"; exon_number "1"; oId "CUFF.2808.1"; tss_id "TSS2882"; +chr14 Cufflinks exon 70534101 70534190 . - . gene_id "XLOC_002883"; transcript_id "TCONS_00002883"; exon_number "1"; oId "CUFF.2809.1"; tss_id "TSS2883"; +chr14 Cufflinks exon 73376143 73376231 . - . gene_id "XLOC_002884"; transcript_id "TCONS_00002884"; exon_number "1"; oId "CUFF.2816.1"; tss_id "TSS2884"; +chr14 Cufflinks exon 73507322 73507621 . - . gene_id "XLOC_002885"; transcript_id "TCONS_00002885"; exon_number "1"; oId "CUFF.2819.1"; tss_id "TSS2885"; +chr14 Cufflinks exon 73528577 73528837 . - . gene_id "XLOC_002886"; transcript_id "TCONS_00002886"; exon_number "1"; oId "CUFF.2820.1"; tss_id "TSS2886"; +chr14 Cufflinks exon 73551006 73551044 . - . gene_id "XLOC_002887"; transcript_id "TCONS_00002887"; exon_number "1"; oId "CUFF.2821.1"; tss_id "TSS2887"; +chr14 Cufflinks exon 73713480 73713587 . - . gene_id "XLOC_002888"; transcript_id "TCONS_00002888"; exon_number "1"; oId "CUFF.2823.1"; tss_id "TSS2888"; +chr14 Cufflinks exon 74055534 74055600 . - . gene_id "XLOC_002889"; transcript_id "TCONS_00002889"; exon_number "1"; oId "CUFF.2825.1"; tss_id "TSS2889"; +chr14 Cufflinks exon 74126269 74126362 . - . gene_id "XLOC_002890"; transcript_id "TCONS_00002890"; exon_number "1"; oId "CUFF.2827.1"; tss_id "TSS2890"; +chr14 Cufflinks exon 75358454 75358488 . - . gene_id "XLOC_002891"; transcript_id "TCONS_00002891"; exon_number "1"; oId "CUFF.2831.1"; tss_id "TSS2891"; +chr14 Cufflinks exon 75737440 75737483 . - . gene_id "XLOC_002892"; transcript_id "TCONS_00002892"; exon_number "1"; oId "CUFF.2834.1"; tss_id "TSS2892"; +chr14 Cufflinks exon 75819588 75819627 . - . gene_id "XLOC_002893"; transcript_id "TCONS_00002893"; exon_number "1"; oId "CUFF.2835.1"; tss_id "TSS2893"; +chr14 Cufflinks exon 75883147 75883209 . - . gene_id "XLOC_002894"; transcript_id "TCONS_00002894"; exon_number "1"; oId "CUFF.2836.1"; tss_id "TSS2894"; +chr14 Cufflinks exon 76973439 76973483 . - . gene_id "XLOC_002895"; transcript_id "TCONS_00002895"; exon_number "1"; oId "CUFF.2840.1"; tss_id "TSS2895"; +chr14 Cufflinks exon 77048572 77048609 . - . gene_id "XLOC_002896"; transcript_id "TCONS_00002896"; exon_number "1"; oId "CUFF.2841.1"; tss_id "TSS2896"; +chr14 Cufflinks exon 77355933 77356011 . - . gene_id "XLOC_002897"; transcript_id "TCONS_00002897"; exon_number "1"; oId "CUFF.2842.1"; tss_id "TSS2897"; +chr14 Cufflinks exon 77870248 77870336 . - . gene_id "XLOC_002898"; transcript_id "TCONS_00002898"; exon_number "1"; oId "CUFF.2845.1"; tss_id "TSS2898"; +chr14 Cufflinks exon 78013888 78014201 . - . gene_id "XLOC_002899"; transcript_id "TCONS_00002899"; exon_number "1"; oId "CUFF.2846.1"; tss_id "TSS2899"; +chr14 Cufflinks exon 78644176 78644264 . - . gene_id "XLOC_002900"; transcript_id "TCONS_00002900"; exon_number "1"; oId "CUFF.2847.1"; tss_id "TSS2900"; +chr14 Cufflinks exon 79036170 79036239 . - . gene_id "XLOC_002901"; transcript_id "TCONS_00002901"; exon_number "1"; oId "CUFF.2848.1"; tss_id "TSS2901"; +chr14 Cufflinks exon 82126929 82126962 . - . gene_id "XLOC_002902"; transcript_id "TCONS_00002902"; exon_number "1"; oId "CUFF.2852.1"; tss_id "TSS2902"; +chr14 Cufflinks exon 84279570 84279616 . - . gene_id "XLOC_002903"; transcript_id "TCONS_00002903"; exon_number "1"; oId "CUFF.2859.1"; tss_id "TSS2903"; +chr14 Cufflinks exon 84519479 84519513 . - . gene_id "XLOC_002904"; transcript_id "TCONS_00002904"; exon_number "1"; oId "CUFF.2861.1"; tss_id "TSS2904"; +chr14 Cufflinks exon 87535511 87535568 . - . gene_id "XLOC_002905"; transcript_id "TCONS_00002905"; exon_number "1"; oId "CUFF.2867.1"; tss_id "TSS2905"; +chr14 Cufflinks exon 87921874 87921909 . - . gene_id "XLOC_002906"; transcript_id "TCONS_00002906"; exon_number "1"; oId "CUFF.2869.1"; tss_id "TSS2906"; +chr14 Cufflinks exon 88462692 88462792 . - . gene_id "XLOC_002907"; transcript_id "TCONS_00002907"; exon_number "1"; oId "CUFF.2871.1"; tss_id "TSS2907"; +chr14 Cufflinks exon 88664605 88664706 . - . gene_id "XLOC_002908"; transcript_id "TCONS_00002908"; exon_number "1"; oId "CUFF.2874.1"; tss_id "TSS2908"; +chr14 Cufflinks exon 89988578 89988621 . - . gene_id "XLOC_002909"; transcript_id "TCONS_00002909"; exon_number "1"; oId "CUFF.2880.1"; tss_id "TSS2909"; +chr14 Cufflinks exon 90341371 90341573 . - . gene_id "XLOC_002910"; transcript_id "TCONS_00002910"; exon_number "1"; oId "CUFF.2883.1"; tss_id "TSS2910"; +chr14 Cufflinks exon 91535987 91536109 . - . gene_id "XLOC_002911"; transcript_id "TCONS_00002911"; exon_number "1"; oId "CUFF.2886.1"; tss_id "TSS2911"; +chr14 Cufflinks exon 92181259 92181474 . - . gene_id "XLOC_002912"; transcript_id "TCONS_00002912"; exon_number "1"; oId "CUFF.2889.1"; tss_id "TSS2912"; +chr14 Cufflinks exon 92270233 92270316 . - . gene_id "XLOC_002913"; transcript_id "TCONS_00002913"; exon_number "1"; oId "CUFF.2890.1"; tss_id "TSS2913"; +chr14 Cufflinks exon 92454246 92454414 . - . gene_id "XLOC_002914"; transcript_id "TCONS_00002914"; exon_number "1"; oId "CUFF.2891.1"; tss_id "TSS2914"; +chr14 Cufflinks exon 92630838 92630879 . - . gene_id "XLOC_002915"; transcript_id "TCONS_00002915"; exon_number "1"; oId "CUFF.2893.1"; tss_id "TSS2915"; +chr14 Cufflinks exon 93903750 93903823 . - . gene_id "XLOC_002916"; transcript_id "TCONS_00002916"; exon_number "1"; oId "CUFF.2897.1"; tss_id "TSS2916"; +chr14 Cufflinks exon 94883064 94883100 . - . gene_id "XLOC_002917"; transcript_id "TCONS_00002917"; exon_number "1"; oId "CUFF.2898.1"; tss_id "TSS2917"; +chr14 Cufflinks exon 96784912 96785032 . - . gene_id "XLOC_002918"; transcript_id "TCONS_00002918"; exon_number "1"; oId "CUFF.2899.1"; tss_id "TSS2918"; +chr14 Cufflinks exon 96790049 96790125 . - . gene_id "XLOC_002919"; transcript_id "TCONS_00002919"; exon_number "1"; oId "CUFF.2900.1"; tss_id "TSS2919"; +chr14 Cufflinks exon 97104624 97104851 . - . gene_id "XLOC_002920"; transcript_id "TCONS_00002920"; exon_number "1"; oId "CUFF.2903.1"; tss_id "TSS2920"; +chr14 Cufflinks exon 97996218 97996505 . - . gene_id "XLOC_002921"; transcript_id "TCONS_00002921"; exon_number "1"; oId "CUFF.2905.1"; tss_id "TSS2921"; +chr14 Cufflinks exon 98817683 98818001 . - . gene_id "XLOC_002922"; transcript_id "TCONS_00002922"; exon_number "1"; oId "CUFF.2906.1"; tss_id "TSS2922"; +chr14 Cufflinks exon 100785393 100785707 . - . gene_id "XLOC_002923"; transcript_id "TCONS_00002923"; exon_number "1"; oId "CUFF.2910.1"; tss_id "TSS2923"; +chr14 Cufflinks exon 101611817 101612032 . - . gene_id "XLOC_002924"; transcript_id "TCONS_00002924"; exon_number "1"; oId "CUFF.2912.1"; tss_id "TSS2924"; +chr14 Cufflinks exon 102246129 102246168 . - . gene_id "XLOC_002925"; transcript_id "TCONS_00002925"; exon_number "1"; oId "CUFF.2913.1"; tss_id "TSS2925"; +chr14 Cufflinks exon 102543517 102543806 . - . gene_id "XLOC_002926"; transcript_id "TCONS_00002926"; exon_number "1"; oId "CUFF.2915.1"; tss_id "TSS2926"; +chr14 Cufflinks exon 102772416 102772457 . - . gene_id "XLOC_002927"; transcript_id "TCONS_00002927"; exon_number "1"; oId "CUFF.2916.1"; tss_id "TSS2927"; +chr14 Cufflinks exon 102825134 102825240 . - . gene_id "XLOC_002928"; transcript_id "TCONS_00002928"; exon_number "1"; oId "CUFF.2918.1"; tss_id "TSS2928"; +chr14 Cufflinks exon 102840589 102840656 . - . gene_id "XLOC_002929"; transcript_id "TCONS_00002929"; exon_number "1"; oId "CUFF.2919.1"; tss_id "TSS2929"; +chr14 Cufflinks exon 102851505 102851554 . - . gene_id "XLOC_002930"; transcript_id "TCONS_00002930"; exon_number "1"; oId "CUFF.2920.1"; tss_id "TSS2930"; +chr14 Cufflinks exon 103048864 103048896 . - . gene_id "XLOC_002931"; transcript_id "TCONS_00002931"; exon_number "1"; oId "CUFF.2922.1"; tss_id "TSS2931"; +chr14 Cufflinks exon 103049226 103049514 . - . gene_id "XLOC_002932"; transcript_id "TCONS_00002932"; exon_number "1"; oId "CUFF.2923.1"; tss_id "TSS2932"; +chr14 Cufflinks exon 103197455 103197490 . - . gene_id "XLOC_002933"; transcript_id "TCONS_00002933"; exon_number "1"; oId "CUFF.2924.1"; tss_id "TSS2933"; +chr14 Cufflinks exon 103255825 103255928 . - . gene_id "XLOC_002934"; transcript_id "TCONS_00002934"; exon_number "1"; oId "CUFF.2925.1"; tss_id "TSS2934"; +chr14 Cufflinks exon 103754975 103755014 . - . gene_id "XLOC_002935"; transcript_id "TCONS_00002935"; exon_number "1"; oId "CUFF.2927.1"; tss_id "TSS2935"; +chr14 Cufflinks exon 103783284 103783373 . - . gene_id "XLOC_002936"; transcript_id "TCONS_00002936"; exon_number "1"; oId "CUFF.2928.1"; tss_id "TSS2936"; +chr14 Cufflinks exon 104867308 104867385 . - . gene_id "XLOC_002937"; transcript_id "TCONS_00002937"; exon_number "1"; oId "CUFF.2933.1"; tss_id "TSS2937"; +chr14 Cufflinks exon 105590081 105590122 . - . gene_id "XLOC_002938"; transcript_id "TCONS_00002938"; exon_number "1"; oId "CUFF.2935.1"; tss_id "TSS2938"; +chr15 Cufflinks exon 20088864 20088967 . + . gene_id "XLOC_002939"; transcript_id "TCONS_00002939"; exon_number "1"; oId "CUFF.2939.1"; tss_id "TSS2939"; +chr15 Cufflinks exon 20466419 20466459 . + . gene_id "XLOC_002940"; transcript_id "TCONS_00002940"; exon_number "1"; oId "CUFF.2942.1"; tss_id "TSS2940"; +chr15 Cufflinks exon 20776285 20776439 . + . gene_id "XLOC_002941"; transcript_id "TCONS_00002941"; exon_number "1"; oId "CUFF.2945.1"; tss_id "TSS2941"; +chr15 Cufflinks exon 20883246 20883280 . + . gene_id "XLOC_002942"; transcript_id "TCONS_00002942"; exon_number "1"; oId "CUFF.2946.1"; tss_id "TSS2942"; +chr15 Cufflinks exon 20944008 20944114 . + . gene_id "XLOC_002943"; transcript_id "TCONS_00002943"; exon_number "1"; oId "CUFF.2947.1"; tss_id "TSS2943"; +chr15 Cufflinks exon 21889891 21889925 . + . gene_id "XLOC_002944"; transcript_id "TCONS_00002944"; exon_number "1"; oId "CUFF.2952.1"; tss_id "TSS2944"; +chr15 Cufflinks exon 21950659 21950765 . + . gene_id "XLOC_002945"; transcript_id "TCONS_00002945"; exon_number "1"; oId "CUFF.2953.1"; tss_id "TSS2945"; +chr15 Cufflinks exon 23263775 23263940 . + . gene_id "XLOC_002946"; transcript_id "TCONS_00002946"; exon_number "1"; oId "CUFF.2958.1"; tss_id "TSS2946"; +chr15 Cufflinks exon 23443683 23443837 . + . gene_id "XLOC_002947"; transcript_id "TCONS_00002947"; exon_number "1"; oId "CUFF.2960.1"; tss_id "TSS2947"; +chr15 Cufflinks exon 23608495 23608649 . + . gene_id "XLOC_002948"; transcript_id "TCONS_00002948"; exon_number "1"; oId "CUFF.2961.1"; tss_id "TSS2948"; +chr15 Cufflinks exon 23918507 23918549 . + . gene_id "XLOC_002949"; transcript_id "TCONS_00002949"; exon_number "1"; oId "CUFF.2964.1"; tss_id "TSS2949"; +chr15 Cufflinks exon 25138893 25138998 . + . gene_id "XLOC_002950"; transcript_id "TCONS_00002950"; exon_number "1"; oId "CUFF.2966.1"; tss_id "TSS2950"; +chr15 Cufflinks exon 25853931 25854009 . + . gene_id "XLOC_002951"; transcript_id "TCONS_00002951"; exon_number "1"; oId "CUFF.2967.1"; tss_id "TSS2951"; +chr15 Cufflinks exon 25983656 25983735 . + . gene_id "XLOC_002952"; transcript_id "TCONS_00002952"; exon_number "1"; oId "CUFF.2968.1"; tss_id "TSS2952"; +chr15 Cufflinks exon 26657555 26657599 . + . gene_id "XLOC_002953"; transcript_id "TCONS_00002953"; exon_number "1"; oId "CUFF.2972.1"; tss_id "TSS2953"; +chr15 Cufflinks exon 26785087 26785118 . + . gene_id "XLOC_002954"; transcript_id "TCONS_00002954"; exon_number "1"; oId "CUFF.2973.1"; tss_id "TSS2954"; +chr15 Cufflinks exon 27997240 27997544 . + . gene_id "XLOC_002955"; transcript_id "TCONS_00002955"; exon_number "1"; oId "CUFF.2975.1"; tss_id "TSS2955"; +chr15 Cufflinks exon 28632418 28632572 . + . gene_id "XLOC_002956"; transcript_id "TCONS_00002956"; exon_number "1"; oId "CUFF.2977.1"; tss_id "TSS2956"; +chr15 Cufflinks exon 28857858 28857895 . + . gene_id "XLOC_002957"; transcript_id "TCONS_00002957"; exon_number "1"; oId "CUFF.2979.1"; tss_id "TSS2957"; +chr15 Cufflinks exon 30383921 30384086 . + . gene_id "XLOC_002958"; transcript_id "TCONS_00002958"; exon_number "1"; oId "CUFF.2981.1"; tss_id "TSS2958"; +chr15 Cufflinks exon 30404403 30404534 . + . gene_id "XLOC_002959"; transcript_id "TCONS_00002959"; exon_number "1"; oId "CUFF.2982.1"; tss_id "TSS2959"; +chr15 Cufflinks exon 30435992 30436146 . + . gene_id "XLOC_002960"; transcript_id "TCONS_00002960"; exon_number "1"; oId "CUFF.2983.1"; tss_id "TSS2960"; +chr15 Cufflinks exon 30852922 30853087 . + . gene_id "XLOC_002961"; transcript_id "TCONS_00002961"; exon_number "1"; oId "CUFF.2987.1"; tss_id "TSS2961"; +chr15 Cufflinks exon 30873389 30873520 . + . gene_id "XLOC_002962"; transcript_id "TCONS_00002962"; exon_number "1"; oId "CUFF.2988.1"; tss_id "TSS2962"; +chr15 Cufflinks exon 30904983 30905148 . + . gene_id "XLOC_002963"; transcript_id "TCONS_00002963"; exon_number "1"; oId "CUFF.2989.1"; tss_id "TSS2963"; +chr15 Cufflinks exon 30935160 30935248 . + . gene_id "XLOC_002964"; transcript_id "TCONS_00002964"; exon_number "1"; oId "CUFF.2990.1"; tss_id "TSS2964"; +chr15 Cufflinks exon 31092419 31092584 . + . gene_id "XLOC_002965"; transcript_id "TCONS_00002965"; exon_number "1"; oId "CUFF.2991.1"; tss_id "TSS2965"; +chr15 Cufflinks exon 31280676 31280704 . + . gene_id "XLOC_002966"; transcript_id "TCONS_00002966"; exon_number "1"; oId "CUFF.2993.1"; tss_id "TSS2966"; +chr15 Cufflinks exon 32576353 32576459 . + . gene_id "XLOC_002967"; transcript_id "TCONS_00002967"; exon_number "1"; oId "CUFF.2994.1"; tss_id "TSS2967"; +chr15 Cufflinks exon 32894397 32894562 . + . gene_id "XLOC_002968"; transcript_id "TCONS_00002968"; exon_number "1"; oId "CUFF.2998.1"; tss_id "TSS2968"; +chr15 Cufflinks exon 33187410 33187505 . + . gene_id "XLOC_002969"; transcript_id "TCONS_00002969"; exon_number "1"; oId "CUFF.2999.1"; tss_id "TSS2969"; +chr15 Cufflinks exon 34473608 34473669 . + . gene_id "XLOC_002970"; transcript_id "TCONS_00002970"; exon_number "1"; oId "CUFF.3001.1"; tss_id "TSS2970"; +chr15 Cufflinks exon 35003396 35003466 . + . gene_id "XLOC_002971"; transcript_id "TCONS_00002971"; exon_number "1"; oId "CUFF.3002.1"; tss_id "TSS2971"; +chr15 Cufflinks exon 35119025 35119059 . + . gene_id "XLOC_002972"; transcript_id "TCONS_00002972"; exon_number "1"; oId "CUFF.3003.1"; tss_id "TSS2972"; +chr15 Cufflinks exon 35284046 35284094 . + . gene_id "XLOC_002973"; transcript_id "TCONS_00002973"; exon_number "1"; oId "CUFF.3004.1"; tss_id "TSS2973"; +chr15 Cufflinks exon 35760566 35760654 . + . gene_id "XLOC_002974"; transcript_id "TCONS_00002974"; exon_number "1"; oId "CUFF.3005.1"; tss_id "TSS2974"; +chr15 Cufflinks exon 36416468 36416513 . + . gene_id "XLOC_002975"; transcript_id "TCONS_00002975"; exon_number "1"; oId "CUFF.3006.1"; tss_id "TSS2975"; +chr15 Cufflinks exon 37144841 37145060 . + . gene_id "XLOC_002976"; transcript_id "TCONS_00002976"; exon_number "1"; oId "CUFF.3008.1"; tss_id "TSS2976"; +chr15 Cufflinks exon 38178984 38179018 . + . gene_id "XLOC_002977"; transcript_id "TCONS_00002977"; exon_number "1"; oId "CUFF.3009.1"; tss_id "TSS2977"; +chr15 Cufflinks exon 39163363 39163406 . + . gene_id "XLOC_002978"; transcript_id "TCONS_00002978"; exon_number "1"; oId "CUFF.3010.1"; tss_id "TSS2978"; +chr15 Cufflinks exon 39308012 39308082 . + . gene_id "XLOC_002979"; transcript_id "TCONS_00002979"; exon_number "1"; oId "CUFF.3011.1"; tss_id "TSS2979"; +chr15 Cufflinks exon 40242906 40243012 . + . gene_id "XLOC_002980"; transcript_id "TCONS_00002980"; exon_number "1"; oId "CUFF.3014.1"; tss_id "TSS2980"; +chr15 Cufflinks exon 40821769 40821841 . + . gene_id "XLOC_002981"; transcript_id "TCONS_00002981"; exon_number "1"; oId "CUFF.3016.1"; tss_id "TSS2981"; +chr15 Cufflinks exon 40823247 40823277 . + . gene_id "XLOC_002982"; transcript_id "TCONS_00002982"; exon_number "1"; oId "CUFF.3017.1"; tss_id "TSS2982"; +chr15 Cufflinks exon 41276739 41276813 . + . gene_id "XLOC_002983"; transcript_id "TCONS_00002983"; exon_number "1"; oId "CUFF.3022.1"; tss_id "TSS2983"; +chr15 Cufflinks exon 41907430 41907497 . + . gene_id "XLOC_002984"; transcript_id "TCONS_00002984"; exon_number "1"; oId "CUFF.3025.1"; tss_id "TSS2984"; +chr15 Cufflinks exon 43894742 43894838 . + . gene_id "XLOC_002985"; transcript_id "TCONS_00002985"; exon_number "1"; oId "CUFF.3031.1"; tss_id "TSS2985"; +chr15 Cufflinks exon 43905879 43905986 . + . gene_id "XLOC_002986"; transcript_id "TCONS_00002986"; exon_number "1"; oId "CUFF.3032.1"; tss_id "TSS2986"; +chr15 Cufflinks exon 43994561 43994669 . + . gene_id "XLOC_002987"; transcript_id "TCONS_00002987"; exon_number "1"; oId "CUFF.3034.1"; tss_id "TSS2987"; +chr15 Cufflinks exon 44005341 44005448 . + . gene_id "XLOC_002988"; transcript_id "TCONS_00002988"; exon_number "1"; oId "CUFF.3035.1"; tss_id "TSS2988"; +chr15 Cufflinks exon 44049339 44049463 . + . gene_id "XLOC_002989"; transcript_id "TCONS_00002989"; exon_number "1"; oId "CUFF.3037.1"; tss_id "TSS2989"; +chr15 Cufflinks exon 44218572 44218605 . + . gene_id "XLOC_002990"; transcript_id "TCONS_00002990"; exon_number "1"; oId "CUFF.3038.1"; tss_id "TSS2990"; +chr15 Cufflinks exon 44524506 44524544 . + . gene_id "XLOC_002991"; transcript_id "TCONS_00002991"; exon_number "1"; oId "CUFF.3039.1"; tss_id "TSS2991"; +chr15 Cufflinks exon 44937349 44937384 . + . gene_id "XLOC_002992"; transcript_id "TCONS_00002992"; exon_number "1"; oId "CUFF.3040.1"; tss_id "TSS2992"; +chr15 Cufflinks exon 45007980 45008022 . + . gene_id "XLOC_002993"; transcript_id "TCONS_00002993"; exon_number "1"; oId "CUFF.3041.1"; tss_id "TSS2993"; +chr15 Cufflinks exon 45176817 45176980 . + . gene_id "XLOC_002994"; transcript_id "TCONS_00002994"; exon_number "1"; oId "CUFF.3042.1"; tss_id "TSS2994"; +chr15 Cufflinks exon 45216413 45216458 . + . gene_id "XLOC_002995"; transcript_id "TCONS_00002995"; exon_number "1"; oId "CUFF.3043.1"; tss_id "TSS2995"; +chr15 Cufflinks exon 45255028 45255126 . + . gene_id "XLOC_002996"; transcript_id "TCONS_00002996"; exon_number "1"; oId "CUFF.3045.1"; tss_id "TSS2996"; +chr15 Cufflinks exon 45265756 45265859 . + . gene_id "XLOC_002997"; transcript_id "TCONS_00002997"; exon_number "1"; oId "CUFF.3047.1"; tss_id "TSS2997"; +chr15 Cufflinks exon 45493349 45493420 . + . gene_id "XLOC_002998"; transcript_id "TCONS_00002998"; exon_number "1"; oId "CUFF.3051.1"; tss_id "TSS2998"; +chr15 Cufflinks exon 46568669 46568728 . + . gene_id "XLOC_002999"; transcript_id "TCONS_00002999"; exon_number "1"; oId "CUFF.3062.1"; tss_id "TSS2999"; +chr15 Cufflinks exon 46952856 46952958 . + . gene_id "XLOC_003000"; transcript_id "TCONS_00003000"; exon_number "1"; oId "CUFF.3063.1"; tss_id "TSS3000"; +chr15 Cufflinks exon 47564795 47565026 . + . gene_id "XLOC_003001"; transcript_id "TCONS_00003001"; exon_number "1"; oId "CUFF.3065.1"; tss_id "TSS3001"; +chr15 Cufflinks exon 50274640 50274759 . + . gene_id "XLOC_003002"; transcript_id "TCONS_00003002"; exon_number "1"; oId "CUFF.3071.1"; tss_id "TSS3002"; +chr15 Cufflinks exon 50755578 50755655 . + . gene_id "XLOC_003003"; transcript_id "TCONS_00003003"; exon_number "1"; oId "CUFF.3074.1"; tss_id "TSS3003"; +chr15 Cufflinks exon 50981097 50981398 . + . gene_id "XLOC_003004"; transcript_id "TCONS_00003004"; exon_number "1"; oId "CUFF.3075.1"; tss_id "TSS3004"; +chr15 Cufflinks exon 51002460 51002495 . + . gene_id "XLOC_003005"; transcript_id "TCONS_00003005"; exon_number "1"; oId "CUFF.3076.1"; tss_id "TSS3005"; +chr15 Cufflinks exon 51174498 51174629 . + . gene_id "XLOC_003006"; transcript_id "TCONS_00003006"; exon_number "1"; oId "CUFF.3077.1"; tss_id "TSS3006"; +chr15 Cufflinks exon 51817567 51817612 . + . gene_id "XLOC_003007"; transcript_id "TCONS_00003007"; exon_number "1"; oId "CUFF.3078.1"; tss_id "TSS3007"; +chr15 Cufflinks exon 52199398 52199502 . + . gene_id "XLOC_003008"; transcript_id "TCONS_00003008"; exon_number "1"; oId "CUFF.3079.1"; tss_id "TSS3008"; +chr15 Cufflinks exon 52328303 52328377 . + . gene_id "XLOC_003009"; transcript_id "TCONS_00003009"; exon_number "1"; oId "CUFF.3080.1"; tss_id "TSS3009"; +chr15 Cufflinks exon 52708617 52708666 . + . gene_id "XLOC_003010"; transcript_id "TCONS_00003010"; exon_number "1"; oId "CUFF.3081.1"; tss_id "TSS3010"; +chr15 Cufflinks exon 53944174 53944233 . + . gene_id "XLOC_003011"; transcript_id "TCONS_00003011"; exon_number "1"; oId "CUFF.3085.1"; tss_id "TSS3011"; +chr15 Cufflinks exon 54056401 54056505 . + . gene_id "XLOC_003012"; transcript_id "TCONS_00003012"; exon_number "1"; oId "CUFF.3086.1"; tss_id "TSS3012"; +chr15 Cufflinks exon 55578306 55578394 . + . gene_id "XLOC_003013"; transcript_id "TCONS_00003013"; exon_number "1"; oId "CUFF.3088.1"; tss_id "TSS3013"; +chr15 Cufflinks exon 55655754 55655843 . + . gene_id "XLOC_003014"; transcript_id "TCONS_00003014"; exon_number "1"; oId "CUFF.3089.1"; tss_id "TSS3014"; +chr15 Cufflinks exon 57899131 57899271 . + . gene_id "XLOC_003015"; transcript_id "TCONS_00003015"; exon_number "1"; oId "CUFF.3100.1"; tss_id "TSS3015"; +chr15 Cufflinks exon 57960669 57960721 . + . gene_id "XLOC_003016"; transcript_id "TCONS_00003016"; exon_number "1"; oId "CUFF.3101.1"; tss_id "TSS3016"; +chr15 Cufflinks exon 59093507 59093599 . + . gene_id "XLOC_003017"; transcript_id "TCONS_00003017"; exon_number "1"; oId "CUFF.3105.1"; tss_id "TSS3017"; +chr15 Cufflinks exon 59203645 59203752 . + . gene_id "XLOC_003018"; transcript_id "TCONS_00003018"; exon_number "1"; oId "CUFF.3106.1"; tss_id "TSS3018"; +chr15 Cufflinks exon 59616546 59616641 . + . gene_id "XLOC_003019"; transcript_id "TCONS_00003019"; exon_number "1"; oId "CUFF.3108.1"; tss_id "TSS3019"; +chr15 Cufflinks exon 59682406 59682518 . + . gene_id "XLOC_003020"; transcript_id "TCONS_00003020"; exon_number "1"; oId "CUFF.3110.1"; tss_id "TSS3020"; +chr15 Cufflinks exon 61028969 61029057 . + . gene_id "XLOC_003021"; transcript_id "TCONS_00003021"; exon_number "1"; oId "CUFF.3113.1"; tss_id "TSS3021"; +chr15 Cufflinks exon 61571605 61571776 . + . gene_id "XLOC_003022"; transcript_id "TCONS_00003022"; exon_number "1"; oId "CUFF.3114.1"; tss_id "TSS3022"; +chr15 Cufflinks exon 62458090 62458125 . + . gene_id "XLOC_003023"; transcript_id "TCONS_00003023"; exon_number "1"; oId "CUFF.3116.1"; tss_id "TSS3023"; +chr15 Cufflinks exon 62977554 62977594 . + . gene_id "XLOC_003024"; transcript_id "TCONS_00003024"; exon_number "1"; oId "CUFF.3119.1"; tss_id "TSS3024"; +chr15 Cufflinks exon 63720697 63720735 . + . gene_id "XLOC_003025"; transcript_id "TCONS_00003025"; exon_number "1"; oId "CUFF.3121.1"; tss_id "TSS3025"; +chr15 Cufflinks exon 64749568 64749603 . + . gene_id "XLOC_003026"; transcript_id "TCONS_00003026"; exon_number "1"; oId "CUFF.3124.1"; tss_id "TSS3026"; +chr15 Cufflinks exon 64963462 64963568 . + . gene_id "XLOC_003027"; transcript_id "TCONS_00003027"; exon_number "1"; oId "CUFF.3125.1"; tss_id "TSS3027"; +chr15 Cufflinks exon 65273977 65274028 . + . gene_id "XLOC_003028"; transcript_id "TCONS_00003028"; exon_number "1"; oId "CUFF.3126.1"; tss_id "TSS3028"; +chr15 Cufflinks exon 65402277 65402323 . + . gene_id "XLOC_003029"; transcript_id "TCONS_00003029"; exon_number "1"; oId "CUFF.3127.1"; tss_id "TSS3029"; +chr15 Cufflinks exon 65522199 65522304 . + . gene_id "XLOC_003030"; transcript_id "TCONS_00003030"; exon_number "1"; oId "CUFF.3128.1"; tss_id "TSS3030"; +chr15 Cufflinks exon 65588389 65588505 . + . gene_id "XLOC_003031"; transcript_id "TCONS_00003031"; exon_number "1"; oId "CUFF.3129.1"; tss_id "TSS3031"; +chr15 Cufflinks exon 65597015 65597131 . + . gene_id "XLOC_003032"; transcript_id "TCONS_00003032"; exon_number "1"; oId "CUFF.3130.1"; tss_id "TSS3032"; +chr15 Cufflinks exon 65615802 65615863 . + . gene_id "XLOC_003033"; transcript_id "TCONS_00003033"; exon_number "1"; oId "CUFF.3131.1"; tss_id "TSS3033"; +chr15 Cufflinks exon 65846793 65846832 . + . gene_id "XLOC_003034"; transcript_id "TCONS_00003034"; exon_number "1"; oId "CUFF.3133.1"; tss_id "TSS3034"; +chr15 Cufflinks exon 66135771 66135883 . + . gene_id "XLOC_003035"; transcript_id "TCONS_00003035"; exon_number "1"; oId "CUFF.3137.1"; tss_id "TSS3035"; +chr15 Cufflinks exon 69659924 69660012 . + . gene_id "XLOC_003036"; transcript_id "TCONS_00003036"; exon_number "1"; oId "CUFF.3145.1"; tss_id "TSS3036"; +chr15 Cufflinks exon 70485575 70485676 . + . gene_id "XLOC_003037"; transcript_id "TCONS_00003037"; exon_number "1"; oId "CUFF.3147.1"; tss_id "TSS3037"; +chr15 Cufflinks exon 70686623 70686761 . + . gene_id "XLOC_003038"; transcript_id "TCONS_00003038"; exon_number "1"; oId "CUFF.3148.1"; tss_id "TSS3038"; +chr15 Cufflinks exon 71998883 71998917 . + . gene_id "XLOC_003039"; transcript_id "TCONS_00003039"; exon_number "1"; oId "CUFF.3150.1"; tss_id "TSS3039"; +chr15 Cufflinks exon 72150911 72151008 . + . gene_id "XLOC_003040"; transcript_id "TCONS_00003040"; exon_number "1"; oId "CUFF.3151.1"; tss_id "TSS3040"; +chr15 Cufflinks exon 72337524 72337607 . + . gene_id "XLOC_003041"; transcript_id "TCONS_00003041"; exon_number "1"; oId "CUFF.3152.1"; tss_id "TSS3041"; +chr15 Cufflinks exon 72337907 72338003 . + . gene_id "XLOC_003042"; transcript_id "TCONS_00003042"; exon_number "1"; oId "CUFF.3153.1"; tss_id "TSS3042"; +chr15 Cufflinks exon 72394875 72394917 . + . gene_id "XLOC_003043"; transcript_id "TCONS_00003043"; exon_number "1"; oId "CUFF.3154.1"; tss_id "TSS3043"; +chr15 Cufflinks exon 72904207 72904373 . + . gene_id "XLOC_003044"; transcript_id "TCONS_00003044"; exon_number "1"; oId "CUFF.3156.1"; tss_id "TSS3044"; +chr15 Cufflinks exon 72956957 72957114 . + . gene_id "XLOC_003045"; transcript_id "TCONS_00003045"; exon_number "1"; oId "CUFF.3157.1"; tss_id "TSS3045"; +chr15 Cufflinks exon 75560810 75560967 . + . gene_id "XLOC_003046"; transcript_id "TCONS_00003046"; exon_number "1"; oId "CUFF.3163.1"; tss_id "TSS3046"; +chr15 Cufflinks exon 75585086 75585243 . + . gene_id "XLOC_003047"; transcript_id "TCONS_00003047"; exon_number "1"; oId "CUFF.3164.1"; tss_id "TSS3047"; +chr15 Cufflinks exon 75791088 75791122 . + . gene_id "XLOC_003048"; transcript_id "TCONS_00003048"; exon_number "1"; oId "CUFF.3165.1"; tss_id "TSS3048"; +chr15 Cufflinks exon 75828623 75828654 . + . gene_id "XLOC_003049"; transcript_id "TCONS_00003049"; exon_number "1"; oId "CUFF.3166.1"; tss_id "TSS3049"; +chr15 Cufflinks exon 76077514 76077710 . + . gene_id "XLOC_003050"; transcript_id "TCONS_00003050"; exon_number "1"; oId "CUFF.3167.1"; tss_id "TSS3050"; +chr15 Cufflinks exon 76965152 76965187 . + . gene_id "XLOC_003051"; transcript_id "TCONS_00003051"; exon_number "1"; oId "CUFF.3170.1"; tss_id "TSS3051"; +chr15 Cufflinks exon 77028982 77029220 . + . gene_id "XLOC_003052"; transcript_id "TCONS_00003052"; exon_number "1"; oId "CUFF.3171.1"; tss_id "TSS3052"; +chr15 Cufflinks exon 77083037 77083074 . + . gene_id "XLOC_003053"; transcript_id "TCONS_00003053"; exon_number "1"; oId "CUFF.3172.1"; tss_id "TSS3053"; +chr15 Cufflinks exon 78691414 78691455 . + . gene_id "XLOC_003054"; transcript_id "TCONS_00003054"; exon_number "1"; oId "CUFF.3176.1"; tss_id "TSS3054"; +chr15 Cufflinks exon 79152904 79152976 . + . gene_id "XLOC_003055"; transcript_id "TCONS_00003055"; exon_number "1"; oId "CUFF.3177.1"; tss_id "TSS3055"; +chr15 Cufflinks exon 79789536 79789574 . + . gene_id "XLOC_003056"; transcript_id "TCONS_00003056"; exon_number "1"; oId "CUFF.3179.1"; tss_id "TSS3056"; +chr15 Cufflinks exon 80036997 80037069 . + . gene_id "XLOC_003057"; transcript_id "TCONS_00003057"; exon_number "1"; oId "CUFF.3181.1"; tss_id "TSS3057"; +chr15 Cufflinks exon 80269654 80269691 . + . gene_id "XLOC_003058"; transcript_id "TCONS_00003058"; exon_number "1"; oId "CUFF.3183.1"; tss_id "TSS3058"; +chr15 Cufflinks exon 80941441 80941530 . + . gene_id "XLOC_003059"; transcript_id "TCONS_00003059"; exon_number "1"; oId "CUFF.3185.1"; tss_id "TSS3059"; +chr15 Cufflinks exon 80956113 80956204 . + . gene_id "XLOC_003060"; transcript_id "TCONS_00003060"; exon_number "1"; oId "CUFF.3186.1"; tss_id "TSS3060"; +chr15 Cufflinks exon 82969493 82969688 . + . gene_id "XLOC_003061"; transcript_id "TCONS_00003061"; exon_number "1"; oId "CUFF.3190.1"; tss_id "TSS3061"; +chr15 Cufflinks exon 83764266 83764313 . + . gene_id "XLOC_003062"; transcript_id "TCONS_00003062"; exon_number "1"; oId "CUFF.3196.1"; tss_id "TSS3062"; +chr15 Cufflinks exon 84386179 84386272 . + . gene_id "XLOC_003063"; transcript_id "TCONS_00003063"; exon_number "1"; oId "CUFF.3198.1"; tss_id "TSS3063"; +chr15 Cufflinks exon 84948845 84949040 . + . gene_id "XLOC_003064"; transcript_id "TCONS_00003064"; exon_number "1"; oId "CUFF.3203.1"; tss_id "TSS3064"; +chr15 Cufflinks exon 85352062 85352122 . + . gene_id "XLOC_003065"; transcript_id "TCONS_00003065"; exon_number "1"; oId "CUFF.3205.1"; tss_id "TSS3065"; +chr15 Cufflinks exon 85948462 85948512 . + . gene_id "XLOC_003066"; transcript_id "TCONS_00003066"; exon_number "1"; oId "CUFF.3210.1"; tss_id "TSS3066"; +chr15 Cufflinks exon 86365083 86365187 . + . gene_id "XLOC_003067"; transcript_id "TCONS_00003067"; exon_number "1"; oId "CUFF.3212.1"; tss_id "TSS3067"; +chr15 Cufflinks exon 86810627 86810857 . + . gene_id "XLOC_003068"; transcript_id "TCONS_00003068"; exon_number "1"; oId "CUFF.3214.1"; tss_id "TSS3068"; +chr15 Cufflinks exon 88362146 88362252 . + . gene_id "XLOC_003069"; transcript_id "TCONS_00003069"; exon_number "1"; oId "CUFF.3216.1"; tss_id "TSS3069"; +chr15 Cufflinks exon 89664016 89664070 . + . gene_id "XLOC_003070"; transcript_id "TCONS_00003070"; exon_number "1"; oId "CUFF.3219.1"; tss_id "TSS3070"; +chr15 Cufflinks exon 89878304 89878376 . + . gene_id "XLOC_003071"; transcript_id "TCONS_00003071"; exon_number "1"; oId "CUFF.3220.1"; tss_id "TSS3071"; +chr15 Cufflinks exon 90257463 90257557 . + . gene_id "XLOC_003072"; transcript_id "TCONS_00003072"; exon_number "1"; oId "CUFF.3221.1"; tss_id "TSS3072"; +chr15 Cufflinks exon 90305871 90305971 . + . gene_id "XLOC_003073"; transcript_id "TCONS_00003073"; exon_number "1"; oId "CUFF.3222.1"; tss_id "TSS3073"; +chr15 Cufflinks exon 90440808 90440869 . + . gene_id "XLOC_003074"; transcript_id "TCONS_00003074"; exon_number "1"; oId "CUFF.3224.1"; tss_id "TSS3074"; +chr15 Cufflinks exon 90619657 90619684 . + . gene_id "XLOC_003075"; transcript_id "TCONS_00003075"; exon_number "1"; oId "CUFF.3225.1"; tss_id "TSS3075"; +chr15 Cufflinks exon 90619991 90620034 . + . gene_id "XLOC_003076"; transcript_id "TCONS_00003076"; exon_number "1"; oId "CUFF.3226.1"; tss_id "TSS3076"; +chr15 Cufflinks exon 90673649 90673947 . + . gene_id "XLOC_003077"; transcript_id "TCONS_00003077"; exon_number "1"; oId "CUFF.3227.1"; tss_id "TSS3077"; +chr15 Cufflinks exon 90709468 90709765 . + . gene_id "XLOC_003078"; transcript_id "TCONS_00003078"; exon_number "1"; oId "CUFF.3228.1"; tss_id "TSS3078"; +chr15 Cufflinks exon 90837247 90837445 . + . gene_id "XLOC_003079"; transcript_id "TCONS_00003079"; exon_number "1"; oId "CUFF.3229.1"; tss_id "TSS3079"; +chr15 Cufflinks exon 92378610 92378709 . + . gene_id "XLOC_003080"; transcript_id "TCONS_00003080"; exon_number "1"; oId "CUFF.3234.1"; tss_id "TSS3080"; +chr15 Cufflinks exon 93024515 93024548 . + . gene_id "XLOC_003081"; transcript_id "TCONS_00003081"; exon_number "1"; oId "CUFF.3235.1"; tss_id "TSS3081"; +chr15 Cufflinks exon 93562800 93562858 . + . gene_id "XLOC_003082"; transcript_id "TCONS_00003082"; exon_number "1"; oId "CUFF.3236.1"; tss_id "TSS3082"; +chr15 Cufflinks exon 93741152 93741191 . + . gene_id "XLOC_003083"; transcript_id "TCONS_00003083"; exon_number "1"; oId "CUFF.3237.1"; tss_id "TSS3083"; +chr15 Cufflinks exon 95459022 95459062 . + . gene_id "XLOC_003084"; transcript_id "TCONS_00003084"; exon_number "1"; oId "CUFF.3241.1"; tss_id "TSS3084"; +chr15 Cufflinks exon 96289033 96289219 . + . gene_id "XLOC_003085"; transcript_id "TCONS_00003085"; exon_number "1"; oId "CUFF.3242.1"; tss_id "TSS3085"; +chr15 Cufflinks exon 96327885 96327949 . + . gene_id "XLOC_003086"; transcript_id "TCONS_00003086"; exon_number "1"; oId "CUFF.3243.1"; tss_id "TSS3086"; +chr15 Cufflinks exon 96351987 96352033 . + . gene_id "XLOC_003087"; transcript_id "TCONS_00003087"; exon_number "1"; oId "CUFF.3244.1"; tss_id "TSS3087"; +chr15 Cufflinks exon 97029822 97030045 . + . gene_id "XLOC_003088"; transcript_id "TCONS_00003088"; exon_number "1"; oId "CUFF.3245.1"; tss_id "TSS3088"; +chr15 Cufflinks exon 97896727 97896956 . + . gene_id "XLOC_003089"; transcript_id "TCONS_00003089"; exon_number "1"; oId "CUFF.3246.1"; tss_id "TSS3089"; +chr15 Cufflinks exon 98569271 98569366 . + . gene_id "XLOC_003090"; transcript_id "TCONS_00003090"; exon_number "1"; oId "CUFF.3248.1"; tss_id "TSS3090"; +chr15 Cufflinks exon 100331451 100331606 . + . gene_id "XLOC_003091"; transcript_id "TCONS_00003091"; exon_number "1"; oId "CUFF.3250.1"; tss_id "TSS3091"; +chr15 Cufflinks exon 102223717 102223822 . + . gene_id "XLOC_003092"; transcript_id "TCONS_00003092"; exon_number "1"; oId "CUFF.3256.1"; tss_id "TSS3092"; +chr15 Cufflinks exon 20264553 20264593 . - . gene_id "XLOC_003093"; transcript_id "TCONS_00003093"; exon_number "1"; oId "CUFF.2940.1"; tss_id "TSS3093"; +chr15 Cufflinks exon 20300973 20301282 . - . gene_id "XLOC_003094"; transcript_id "TCONS_00003094"; exon_number "1"; oId "CUFF.2941.1"; tss_id "TSS3094"; +chr15 Cufflinks exon 20557337 20557435 . - . gene_id "XLOC_003095"; transcript_id "TCONS_00003095"; exon_number "1"; oId "CUFF.2943.1"; tss_id "TSS3095"; +chr15 Cufflinks exon 20688080 20688117 . - . gene_id "XLOC_003096"; transcript_id "TCONS_00003096"; exon_number "1"; oId "CUFF.2944.1"; tss_id "TSS3096"; +chr15 Cufflinks exon 21060581 21060686 . - . gene_id "XLOC_003097"; transcript_id "TCONS_00003097"; exon_number "1"; oId "CUFF.2948.1"; tss_id "TSS3097"; +chr15 Cufflinks exon 21118913 21118975 . - . gene_id "XLOC_003098"; transcript_id "TCONS_00003098"; exon_number "1"; oId "CUFF.2949.1"; tss_id "TSS3098"; +chr15 Cufflinks exon 21271317 21271357 . - . gene_id "XLOC_003099"; transcript_id "TCONS_00003099"; exon_number "1"; oId "CUFF.2950.1"; tss_id "TSS3099"; +chr15 Cufflinks exon 21308159 21308467 . - . gene_id "XLOC_003100"; transcript_id "TCONS_00003100"; exon_number "1"; oId "CUFF.2951.1"; tss_id "TSS3100"; +chr15 Cufflinks exon 22071735 22071840 . - . gene_id "XLOC_003101"; transcript_id "TCONS_00003101"; exon_number "1"; oId "CUFF.2954.1"; tss_id "TSS3101"; +chr15 Cufflinks exon 22130069 22130131 . - . gene_id "XLOC_003102"; transcript_id "TCONS_00003102"; exon_number "1"; oId "CUFF.2955.1"; tss_id "TSS3102"; +chr15 Cufflinks exon 22348675 22348779 . - . gene_id "XLOC_003103"; transcript_id "TCONS_00003103"; exon_number "1"; oId "CUFF.2956.1"; tss_id "TSS3103"; +chr15 Cufflinks exon 22706941 22707095 . - . gene_id "XLOC_003104"; transcript_id "TCONS_00003104"; exon_number "1"; oId "CUFF.2957.1"; tss_id "TSS3104"; +chr15 Cufflinks exon 23355530 23355567 . - . gene_id "XLOC_003105"; transcript_id "TCONS_00003105"; exon_number "1"; oId "CUFF.2959.1"; tss_id "TSS3105"; +chr15 Cufflinks exon 23738841 23738889 . - . gene_id "XLOC_003106"; transcript_id "TCONS_00003106"; exon_number "1"; oId "CUFF.2962.1"; tss_id "TSS3106"; +chr15 Cufflinks exon 23842428 23842478 . - . gene_id "XLOC_003107"; transcript_id "TCONS_00003107"; exon_number "1"; oId "CUFF.2963.1"; tss_id "TSS3107"; +chr15 Cufflinks exon 24022584 24022690 . - . gene_id "XLOC_003108"; transcript_id "TCONS_00003108"; exon_number "1"; oId "CUFF.2965.1"; tss_id "TSS3108"; +chr15 Cufflinks exon 26327381 26327452 . - . gene_id "XLOC_003109"; transcript_id "TCONS_00003109"; exon_number "1"; oId "CUFF.2969.1"; tss_id "TSS3109"; +chr15 Cufflinks exon 26331789 26331845 . - . gene_id "XLOC_003110"; transcript_id "TCONS_00003110"; exon_number "1"; oId "CUFF.2970.1"; tss_id "TSS3110"; +chr15 Cufflinks exon 26387894 26387928 . - . gene_id "XLOC_003111"; transcript_id "TCONS_00003111"; exon_number "1"; oId "CUFF.2971.1"; tss_id "TSS3111"; +chr15 Cufflinks exon 27525464 27525582 . - . gene_id "XLOC_003112"; transcript_id "TCONS_00003112"; exon_number "1"; oId "CUFF.2974.1"; tss_id "TSS3112"; +chr15 Cufflinks exon 28543972 28544009 . - . gene_id "XLOC_003113"; transcript_id "TCONS_00003113"; exon_number "1"; oId "CUFF.2976.1"; tss_id "TSS3113"; +chr15 Cufflinks exon 28769356 28769510 . - . gene_id "XLOC_003114"; transcript_id "TCONS_00003114"; exon_number "1"; oId "CUFF.2978.1"; tss_id "TSS3114"; +chr15 Cufflinks exon 28948715 28948880 . - . gene_id "XLOC_003115"; transcript_id "TCONS_00003115"; exon_number "1"; oId "CUFF.2980.1"; tss_id "TSS3115"; +chr15 Cufflinks exon 30546605 30546711 . - . gene_id "XLOC_003116"; transcript_id "TCONS_00003116"; exon_number "1"; oId "CUFF.2984.1"; tss_id "TSS3116"; +chr15 Cufflinks exon 30677161 30677292 . - . gene_id "XLOC_003117"; transcript_id "TCONS_00003117"; exon_number "1"; oId "CUFF.2985.1"; tss_id "TSS3117"; +chr15 Cufflinks exon 30697571 30697725 . - . gene_id "XLOC_003118"; transcript_id "TCONS_00003118"; exon_number "1"; oId "CUFF.2986.1"; tss_id "TSS3118"; +chr15 Cufflinks exon 31248452 31248554 . - . gene_id "XLOC_003119"; transcript_id "TCONS_00003119"; exon_number "1"; oId "CUFF.2992.1"; tss_id "TSS3119"; +chr15 Cufflinks exon 32686593 32686758 . - . gene_id "XLOC_003120"; transcript_id "TCONS_00003120"; exon_number "1"; oId "CUFF.2995.1"; tss_id "TSS3120"; +chr15 Cufflinks exon 32718488 32718619 . - . gene_id "XLOC_003121"; transcript_id "TCONS_00003121"; exon_number "1"; oId "CUFF.2996.1"; tss_id "TSS3121"; +chr15 Cufflinks exon 32738936 32739090 . - . gene_id "XLOC_003122"; transcript_id "TCONS_00003122"; exon_number "1"; oId "CUFF.2997.1"; tss_id "TSS3122"; +chr15 Cufflinks exon 34340076 34340119 . - . gene_id "XLOC_003123"; transcript_id "TCONS_00003123"; exon_number "1"; oId "CUFF.3000.1"; tss_id "TSS3123"; +chr15 Cufflinks exon 36862003 36862221 . - . gene_id "XLOC_003124"; transcript_id "TCONS_00003124"; exon_number "1"; oId "CUFF.3007.1"; tss_id "TSS3124"; +chr15 Cufflinks exon 39344655 39344720 . - . gene_id "XLOC_003125"; transcript_id "TCONS_00003125"; exon_number "1"; oId "CUFF.3012.1"; tss_id "TSS3125"; +chr15 Cufflinks exon 39604595 39604635 . - . gene_id "XLOC_003126"; transcript_id "TCONS_00003126"; exon_number "1"; oId "CUFF.3013.1"; tss_id "TSS3126"; +chr15 Cufflinks exon 40623773 40623849 . - . gene_id "XLOC_003127"; transcript_id "TCONS_00003127"; exon_number "1"; oId "CUFF.3015.1"; tss_id "TSS3127"; +chr15 Cufflinks exon 40886023 40886104 . - . gene_id "XLOC_003128"; transcript_id "TCONS_00003128"; exon_number "1"; oId "CUFF.3018.1"; tss_id "TSS3128"; +chr15 Cufflinks exon 40899407 40899511 . - . gene_id "XLOC_003129"; transcript_id "TCONS_00003129"; exon_number "1"; oId "CUFF.3019.1"; tss_id "TSS3129"; +chr15 Cufflinks exon 41137670 41137740 . - . gene_id "XLOC_003130"; transcript_id "TCONS_00003130"; exon_number "1"; oId "CUFF.3020.1"; tss_id "TSS3130"; +chr15 Cufflinks exon 41177676 41177687 . - . gene_id "XLOC_003131"; transcript_id "TCONS_00003131"; exon_number "1"; oId "CUFF.3021.1"; tss_id "TSS3131"; +chr15 Cufflinks exon 41484150 41484463 . - . gene_id "XLOC_003132"; transcript_id "TCONS_00003132"; exon_number "1"; oId "CUFF.3023.1"; tss_id "TSS3132"; +chr15 Cufflinks exon 41740943 41741041 . - . gene_id "XLOC_003133"; transcript_id "TCONS_00003133"; exon_number "1"; oId "CUFF.3024.1"; tss_id "TSS3133"; +chr15 Cufflinks exon 42144139 42144227 . - . gene_id "XLOC_003134"; transcript_id "TCONS_00003134"; exon_number "1"; oId "CUFF.3026.1"; tss_id "TSS3134"; +chr15 Cufflinks exon 42402159 42402219 . - . gene_id "XLOC_003135"; transcript_id "TCONS_00003135"; exon_number "1"; oId "CUFF.3027.1"; tss_id "TSS3135"; +chr15 Cufflinks exon 42719790 42719895 . - . gene_id "XLOC_003136"; transcript_id "TCONS_00003136"; exon_number "1"; oId "CUFF.3028.1"; tss_id "TSS3136"; +chr15 Cufflinks exon 43000887 43000991 . - . gene_id "XLOC_003137"; transcript_id "TCONS_00003137"; exon_number "1"; oId "CUFF.3029.1"; tss_id "TSS3137"; +chr15 Cufflinks exon 43683694 43683918 . - . gene_id "XLOC_003138"; transcript_id "TCONS_00003138"; exon_number "1"; oId "CUFF.3030.1"; tss_id "TSS3138"; +chr15 Cufflinks exon 43929830 43929936 . - . gene_id "XLOC_003139"; transcript_id "TCONS_00003139"; exon_number "1"; oId "CUFF.3033.1"; tss_id "TSS3139"; +chr15 Cufflinks exon 44026377 44026483 . - . gene_id "XLOC_003140"; transcript_id "TCONS_00003140"; exon_number "1"; oId "CUFF.3036.1"; tss_id "TSS3140"; +chr15 Cufflinks exon 45219803 45219901 . - . gene_id "XLOC_003141"; transcript_id "TCONS_00003141"; exon_number "1"; oId "CUFF.3044.1"; tss_id "TSS3141"; +chr15 Cufflinks exon 45258836 45258881 . - . gene_id "XLOC_003142"; transcript_id "TCONS_00003142"; exon_number "1"; oId "CUFF.3046.1"; tss_id "TSS3142"; +chr15 Cufflinks exon 45295060 45295223 . - . gene_id "XLOC_003143"; transcript_id "TCONS_00003143"; exon_number "1"; oId "CUFF.3048.1"; tss_id "TSS3143"; +chr15 Cufflinks exon 45490804 45490875 . - . gene_id "XLOC_003144"; transcript_id "TCONS_00003144"; exon_number "1"; oId "CUFF.3049.1"; tss_id "TSS3144"; +chr15 Cufflinks exon 45492611 45492682 . - . gene_id "XLOC_003145"; transcript_id "TCONS_00003145"; exon_number "1"; oId "CUFF.3050.1"; tss_id "TSS3145"; +chr15 Cufflinks exon 45646977 45647083 . - . gene_id "XLOC_003146"; transcript_id "TCONS_00003146"; exon_number "1"; oId "CUFF.3052.1"; tss_id "TSS3146"; +chr15 Cufflinks exon 45738662 45738722 . - . gene_id "XLOC_003147"; transcript_id "TCONS_00003147"; exon_number "1"; oId "CUFF.3053.1"; tss_id "TSS3147"; +chr15 Cufflinks exon 45783779 45783886 . - . gene_id "XLOC_003148"; transcript_id "TCONS_00003148"; exon_number "1"; oId "CUFF.3054.1"; tss_id "TSS3148"; +chr15 Cufflinks exon 45845717 45845802 . - . gene_id "XLOC_003149"; transcript_id "TCONS_00003149"; exon_number "1"; oId "CUFF.3055.1"; tss_id "TSS3149"; +chr15 Cufflinks exon 46213210 46213338 . - . gene_id "XLOC_003150"; transcript_id "TCONS_00003150"; exon_number "1"; oId "CUFF.3056.1"; tss_id "TSS3150"; +chr15 Cufflinks exon 46366808 46367317 . - . gene_id "XLOC_003151"; transcript_id "TCONS_00003151"; exon_number "1"; oId "CUFF.3057.1"; tss_id "TSS3151"; +chr15 Cufflinks exon 46367530 46367610 . - . gene_id "XLOC_003152"; transcript_id "TCONS_00003152"; exon_number "1"; oId "CUFF.3058.1"; tss_id "TSS3152"; +chr15 Cufflinks exon 46368205 46368338 . - . gene_id "XLOC_003153"; transcript_id "TCONS_00003153"; exon_number "1"; oId "CUFF.3059.1"; tss_id "TSS3153"; +chr15 Cufflinks exon 46368400 46368706 . - . gene_id "XLOC_003154"; transcript_id "TCONS_00003154"; exon_number "1"; oId "CUFF.3060.1"; tss_id "TSS3154"; +chr15 Cufflinks exon 46544450 46544487 . - . gene_id "XLOC_003155"; transcript_id "TCONS_00003155"; exon_number "1"; oId "CUFF.3061.1"; tss_id "TSS3155"; +chr15 Cufflinks exon 47012473 47012709 . - . gene_id "XLOC_003156"; transcript_id "TCONS_00003156"; exon_number "1"; oId "CUFF.3064.1"; tss_id "TSS3156"; +chr15 Cufflinks exon 49087735 49087785 . - . gene_id "XLOC_003157"; transcript_id "TCONS_00003157"; exon_number "1"; oId "CUFF.3066.1"; tss_id "TSS3157"; +chr15 Cufflinks exon 49132848 49132895 . - . gene_id "XLOC_003158"; transcript_id "TCONS_00003158"; exon_number "1"; oId "CUFF.3067.1"; tss_id "TSS3158"; +chr15 Cufflinks exon 49161950 49162001 . - . gene_id "XLOC_003159"; transcript_id "TCONS_00003159"; exon_number "1"; oId "CUFF.3068.1"; tss_id "TSS3159"; +chr15 Cufflinks exon 49334538 49334840 . - . gene_id "XLOC_003160"; transcript_id "TCONS_00003160"; exon_number "1"; oId "CUFF.3069.1"; tss_id "TSS3160"; +chr15 Cufflinks exon 49491080 49491391 . - . gene_id "XLOC_003161"; transcript_id "TCONS_00003161"; exon_number "1"; oId "CUFF.3070.1"; tss_id "TSS3161"; +chr15 Cufflinks exon 50536888 50537128 . - . gene_id "XLOC_003162"; transcript_id "TCONS_00003162"; exon_number "1"; oId "CUFF.3072.1"; tss_id "TSS3162"; +chr15 Cufflinks exon 50639622 50639726 . - . gene_id "XLOC_003163"; transcript_id "TCONS_00003163"; exon_number "1"; oId "CUFF.3073.1"; tss_id "TSS3163"; +chr15 Cufflinks exon 52976824 52976857 . - . gene_id "XLOC_003164"; transcript_id "TCONS_00003164"; exon_number "1"; oId "CUFF.3082.1"; tss_id "TSS3164"; +chr15 Cufflinks exon 53185236 53185340 . - . gene_id "XLOC_003165"; transcript_id "TCONS_00003165"; exon_number "1"; oId "CUFF.3083.1"; tss_id "TSS3165"; +chr15 Cufflinks exon 53889711 53889747 . - . gene_id "XLOC_003166"; transcript_id "TCONS_00003166"; exon_number "1"; oId "CUFF.3084.1"; tss_id "TSS3166"; +chr15 Cufflinks exon 54153692 54153726 . - . gene_id "XLOC_003167"; transcript_id "TCONS_00003167"; exon_number "1"; oId "CUFF.3087.1"; tss_id "TSS3167"; +chr15 Cufflinks exon 55950321 55950362 . - . gene_id "XLOC_003168"; transcript_id "TCONS_00003168"; exon_number "1"; oId "CUFF.3090.1"; tss_id "TSS3168"; +chr15 Cufflinks exon 56093241 56093283 . - . gene_id "XLOC_003169"; transcript_id "TCONS_00003169"; exon_number "1"; oId "CUFF.3091.1"; tss_id "TSS3169"; +chr15 Cufflinks exon 56145651 56145682 . - . gene_id "XLOC_003170"; transcript_id "TCONS_00003170"; exon_number "1"; oId "CUFF.3092.1"; tss_id "TSS3170"; +chr15 Cufflinks exon 56247896 56248003 . - . gene_id "XLOC_003171"; transcript_id "TCONS_00003171"; exon_number "1"; oId "CUFF.3093.1"; tss_id "TSS3171"; +chr15 Cufflinks exon 56321865 56322179 . - . gene_id "XLOC_003172"; transcript_id "TCONS_00003172"; exon_number "1"; oId "CUFF.3094.1"; tss_id "TSS3172"; +chr15 Cufflinks exon 56566734 56566834 . - . gene_id "XLOC_003173"; transcript_id "TCONS_00003173"; exon_number "1"; oId "CUFF.3095.1"; tss_id "TSS3173"; +chr15 Cufflinks exon 56724896 56724968 . - . gene_id "XLOC_003174"; transcript_id "TCONS_00003174"; exon_number "1"; oId "CUFF.3096.1"; tss_id "TSS3174"; +chr15 Cufflinks exon 57570769 57570872 . - . gene_id "XLOC_003175"; transcript_id "TCONS_00003175"; exon_number "1"; oId "CUFF.3097.1"; tss_id "TSS3175"; +chr15 Cufflinks exon 57686864 57686942 . - . gene_id "XLOC_003176"; transcript_id "TCONS_00003176"; exon_number "1"; oId "CUFF.3098.1"; tss_id "TSS3176"; +chr15 Cufflinks exon 57697274 57697371 . - . gene_id "XLOC_003177"; transcript_id "TCONS_00003177"; exon_number "1"; oId "CUFF.3099.1"; tss_id "TSS3177"; +chr15 Cufflinks exon 58892333 58892435 . - . gene_id "XLOC_003178"; transcript_id "TCONS_00003178"; exon_number "1"; oId "CUFF.3102.1"; tss_id "TSS3178"; +chr15 Cufflinks exon 58996114 58996353 . - . gene_id "XLOC_003179"; transcript_id "TCONS_00003179"; exon_number "1"; oId "CUFF.3103.1"; tss_id "TSS3179"; +chr15 Cufflinks exon 59052665 59052880 . - . gene_id "XLOC_003180"; transcript_id "TCONS_00003180"; exon_number "1"; oId "CUFF.3104.1"; tss_id "TSS3180"; +chr15 Cufflinks exon 59504844 59504987 . - . gene_id "XLOC_003181"; transcript_id "TCONS_00003181"; exon_number "1"; oId "CUFF.3107.1"; tss_id "TSS3181"; +chr15 Cufflinks exon 59633524 59633615 . - . gene_id "XLOC_003182"; transcript_id "TCONS_00003182"; exon_number "1"; oId "CUFF.3109.1"; tss_id "TSS3182"; +chr15 Cufflinks exon 59866301 59866421 . - . gene_id "XLOC_003183"; transcript_id "TCONS_00003183"; exon_number "1"; oId "CUFF.3111.1"; tss_id "TSS3183"; +chr15 Cufflinks exon 60822273 60822434 . - . gene_id "XLOC_003184"; transcript_id "TCONS_00003184"; exon_number "1"; oId "CUFF.3112.1"; tss_id "TSS3184"; +chr15 Cufflinks exon 61877546 61877585 . - . gene_id "XLOC_003185"; transcript_id "TCONS_00003185"; exon_number "1"; oId "CUFF.3115.1"; tss_id "TSS3185"; +chr15 Cufflinks exon 62488759 62488798 . - . gene_id "XLOC_003186"; transcript_id "TCONS_00003186"; exon_number "1"; oId "CUFF.3117.1"; tss_id "TSS3186"; +chr15 Cufflinks exon 62536520 62536720 . - . gene_id "XLOC_003187"; transcript_id "TCONS_00003187"; exon_number "1"; oId "CUFF.3118.1"; tss_id "TSS3187"; +chr15 Cufflinks exon 63506752 63506782 . - . gene_id "XLOC_003188"; transcript_id "TCONS_00003188"; exon_number "1"; oId "CUFF.3120.1"; tss_id "TSS3188"; +chr15 Cufflinks exon 64015780 64015825 . - . gene_id "XLOC_003189"; transcript_id "TCONS_00003189"; exon_number "1"; oId "CUFF.3122.1"; tss_id "TSS3189"; +chr15 Cufflinks exon 64683113 64683154 . - . gene_id "XLOC_003190"; transcript_id "TCONS_00003190"; exon_number "1"; oId "CUFF.3123.1"; tss_id "TSS3190"; +chr15 Cufflinks exon 65845419 65845525 . - . gene_id "XLOC_003191"; transcript_id "TCONS_00003191"; exon_number "1"; oId "CUFF.3132.1"; tss_id "TSS3191"; +chr15 Cufflinks exon 65863308 65863412 . - . gene_id "XLOC_003192"; transcript_id "TCONS_00003192"; exon_number "1"; oId "CUFF.3134.1"; tss_id "TSS3192"; +chr15 Cufflinks exon 65989168 65989275 . - . gene_id "XLOC_003193"; transcript_id "TCONS_00003193"; exon_number "1"; oId "CUFF.3135.1"; tss_id "TSS3193"; +chr15 Cufflinks exon 66101405 66101476 . - . gene_id "XLOC_003194"; transcript_id "TCONS_00003194"; exon_number "1"; oId "CUFF.3136.1"; tss_id "TSS3194"; +chr15 Cufflinks exon 66161397 66161471 . - . gene_id "XLOC_003195"; transcript_id "TCONS_00003195"; exon_number "1"; oId "CUFF.3138.1"; tss_id "TSS3195"; +chr15 Cufflinks exon 67554005 67554052 . - . gene_id "XLOC_003196"; transcript_id "TCONS_00003196"; exon_number "1"; oId "CUFF.3139.1"; tss_id "TSS3196"; +chr15 Cufflinks exon 68132277 68132383 . - . gene_id "XLOC_003197"; transcript_id "TCONS_00003197"; exon_number "1"; oId "CUFF.3140.1"; tss_id "TSS3197"; +chr15 Cufflinks exon 68197859 68197908 . - . gene_id "XLOC_003198"; transcript_id "TCONS_00003198"; exon_number "1"; oId "CUFF.3141.1"; tss_id "TSS3198"; +chr15 Cufflinks exon 68559101 68559136 . - . gene_id "XLOC_003199"; transcript_id "TCONS_00003199"; exon_number "1"; oId "CUFF.3142.1"; tss_id "TSS3199"; +chr15 Cufflinks exon 68959199 68959238 . - . gene_id "XLOC_003200"; transcript_id "TCONS_00003200"; exon_number "1"; oId "CUFF.3143.1"; tss_id "TSS3200"; +chr15 Cufflinks exon 69542844 69543132 . - . gene_id "XLOC_003201"; transcript_id "TCONS_00003201"; exon_number "1"; oId "CUFF.3144.1"; tss_id "TSS3201"; +chr15 Cufflinks exon 69750281 69750488 . - . gene_id "XLOC_003202"; transcript_id "TCONS_00003202"; exon_number "1"; oId "CUFF.3146.1"; tss_id "TSS3202"; +chr15 Cufflinks exon 71727546 71727614 . - . gene_id "XLOC_003203"; transcript_id "TCONS_00003203"; exon_number "1"; oId "CUFF.3149.1"; tss_id "TSS3203"; +chr15 Cufflinks exon 72842556 72842622 . - . gene_id "XLOC_003204"; transcript_id "TCONS_00003204"; exon_number "1"; oId "CUFF.3155.1"; tss_id "TSS3204"; +chr15 Cufflinks exon 73478577 73478646 . - . gene_id "XLOC_003205"; transcript_id "TCONS_00003205"; exon_number "1"; oId "CUFF.3158.1"; tss_id "TSS3205"; +chr15 Cufflinks exon 73643301 73643337 . - . gene_id "XLOC_003206"; transcript_id "TCONS_00003206"; exon_number "1"; oId "CUFF.3159.1"; tss_id "TSS3206"; +chr15 Cufflinks exon 74364821 74364978 . - . gene_id "XLOC_003207"; transcript_id "TCONS_00003207"; exon_number "1"; oId "CUFF.3160.1"; tss_id "TSS3207"; +chr15 Cufflinks exon 74962719 74962756 . - . gene_id "XLOC_003208"; transcript_id "TCONS_00003208"; exon_number "1"; oId "CUFF.3161.1"; tss_id "TSS3208"; +chr15 Cufflinks exon 75240288 75240322 . - . gene_id "XLOC_003209"; transcript_id "TCONS_00003209"; exon_number "1"; oId "CUFF.3162.1"; tss_id "TSS3209"; +chr15 Cufflinks exon 76271213 76271280 . - . gene_id "XLOC_003210"; transcript_id "TCONS_00003210"; exon_number "1"; oId "CUFF.3168.1"; tss_id "TSS3210"; +chr15 Cufflinks exon 76674765 76674838 . - . gene_id "XLOC_003211"; transcript_id "TCONS_00003211"; exon_number "1"; oId "CUFF.3169.1"; tss_id "TSS3211"; +chr15 Cufflinks exon 77126863 77126899 . - . gene_id "XLOC_003212"; transcript_id "TCONS_00003212"; exon_number "1"; oId "CUFF.3173.1"; tss_id "TSS3212"; +chr15 Cufflinks exon 77269236 77269551 . - . gene_id "XLOC_003213"; transcript_id "TCONS_00003213"; exon_number "1"; oId "CUFF.3174.1"; tss_id "TSS3213"; +chr15 Cufflinks exon 78209097 78209254 . - . gene_id "XLOC_003214"; transcript_id "TCONS_00003214"; exon_number "1"; oId "CUFF.3175.1"; tss_id "TSS3214"; +chr15 Cufflinks exon 79191183 79191283 . - . gene_id "XLOC_003215"; transcript_id "TCONS_00003215"; exon_number "1"; oId "CUFF.3178.1"; tss_id "TSS3215"; +chr15 Cufflinks exon 79858898 79858949 . - . gene_id "XLOC_003216"; transcript_id "TCONS_00003216"; exon_number "1"; oId "CUFF.3180.1"; tss_id "TSS3216"; +chr15 Cufflinks exon 80109697 80109791 . - . gene_id "XLOC_003217"; transcript_id "TCONS_00003217"; exon_number "1"; oId "CUFF.3182.1"; tss_id "TSS3217"; +chr15 Cufflinks exon 80349744 80350026 . - . gene_id "XLOC_003218"; transcript_id "TCONS_00003218"; exon_number "1"; oId "CUFF.3184.1"; tss_id "TSS3218"; +chr15 Cufflinks exon 81734431 81734468 . - . gene_id "XLOC_003219"; transcript_id "TCONS_00003219"; exon_number "1"; oId "CUFF.3187.1"; tss_id "TSS3219"; +chr15 Cufflinks exon 82466566 82466725 . - . gene_id "XLOC_003220"; transcript_id "TCONS_00003220"; exon_number "1"; oId "CUFF.3188.1"; tss_id "TSS3220"; +chr15 Cufflinks exon 82770190 82770385 . - . gene_id "XLOC_003221"; transcript_id "TCONS_00003221"; exon_number "1"; oId "CUFF.3189.1"; tss_id "TSS3221"; +chr15 Cufflinks exon 83146774 83146969 . - . gene_id "XLOC_003222"; transcript_id "TCONS_00003222"; exon_number "1"; oId "CUFF.3191.1"; tss_id "TSS3222"; +chr15 Cufflinks exon 83259188 83259229 . - . gene_id "XLOC_003223"; transcript_id "TCONS_00003223"; exon_number "1"; oId "CUFF.3192.1"; tss_id "TSS3223"; +chr15 Cufflinks exon 83355377 83355453 . - . gene_id "XLOC_003224"; transcript_id "TCONS_00003224"; exon_number "1"; oId "CUFF.3193.1"; tss_id "TSS3224"; +chr15 Cufflinks exon 83422193 83422258 . - . gene_id "XLOC_003225"; transcript_id "TCONS_00003225"; exon_number "1"; oId "CUFF.3194.1"; tss_id "TSS3225"; +chr15 Cufflinks exon 83761388 83761432 . - . gene_id "XLOC_003226"; transcript_id "TCONS_00003226"; exon_number "1"; oId "CUFF.3195.1"; tss_id "TSS3226"; +chr15 Cufflinks exon 83825856 83825936 . - . gene_id "XLOC_003227"; transcript_id "TCONS_00003227"; exon_number "1"; oId "CUFF.3197.1"; tss_id "TSS3227"; +chr15 Cufflinks exon 84394088 84394140 . - . gene_id "XLOC_003228"; transcript_id "TCONS_00003228"; exon_number "1"; oId "CUFF.3199.1"; tss_id "TSS3228"; +chr15 Cufflinks exon 84493621 84493748 . - . gene_id "XLOC_003229"; transcript_id "TCONS_00003229"; exon_number "1"; oId "CUFF.3200.1"; tss_id "TSS3229"; +chr15 Cufflinks exon 84549838 84549883 . - . gene_id "XLOC_003230"; transcript_id "TCONS_00003230"; exon_number "1"; oId "CUFF.3201.1"; tss_id "TSS3230"; +chr15 Cufflinks exon 84874194 84874392 . - . gene_id "XLOC_003231"; transcript_id "TCONS_00003231"; exon_number "1"; oId "CUFF.3202.1"; tss_id "TSS3231"; +chr15 Cufflinks exon 85238983 85239016 . - . gene_id "XLOC_003232"; transcript_id "TCONS_00003232"; exon_number "1"; oId "CUFF.3204.1"; tss_id "TSS3232"; +chr15 Cufflinks exon 85481647 85481753 . - . gene_id "XLOC_003233"; transcript_id "TCONS_00003233"; exon_number "1"; oId "CUFF.3206.1"; tss_id "TSS3233"; +chr15 Cufflinks exon 85482850 85482954 . - . gene_id "XLOC_003234"; transcript_id "TCONS_00003234"; exon_number "1"; oId "CUFF.3207.1"; tss_id "TSS3234"; +chr15 Cufflinks exon 85753272 85753470 . - . gene_id "XLOC_003235"; transcript_id "TCONS_00003235"; exon_number "1"; oId "CUFF.3208.1"; tss_id "TSS3235"; +chr15 Cufflinks exon 85933055 85933115 . - . gene_id "XLOC_003236"; transcript_id "TCONS_00003236"; exon_number "1"; oId "CUFF.3209.1"; tss_id "TSS3236"; +chr15 Cufflinks exon 86194766 86194859 . - . gene_id "XLOC_003237"; transcript_id "TCONS_00003237"; exon_number "1"; oId "CUFF.3211.1"; tss_id "TSS3237"; +chr15 Cufflinks exon 86681509 86681573 . - . gene_id "XLOC_003238"; transcript_id "TCONS_00003238"; exon_number "1"; oId "CUFF.3213.1"; tss_id "TSS3238"; +chr15 Cufflinks exon 88017414 88017520 . - . gene_id "XLOC_003239"; transcript_id "TCONS_00003239"; exon_number "1"; oId "CUFF.3215.1"; tss_id "TSS3239"; +chr15 Cufflinks exon 88753980 88754155 . - . gene_id "XLOC_003240"; transcript_id "TCONS_00003240"; exon_number "1"; oId "CUFF.3217.1"; tss_id "TSS3240"; +chr15 Cufflinks exon 89108350 89108484 . - . gene_id "XLOC_003241"; transcript_id "TCONS_00003241"; exon_number "1"; oId "CUFF.3218.1"; tss_id "TSS3241"; +chr15 Cufflinks exon 90429720 90429823 . - . gene_id "XLOC_003242"; transcript_id "TCONS_00003242"; exon_number "1"; oId "CUFF.3223.1"; tss_id "TSS3242"; +chr15 Cufflinks exon 91024542 91024609 . - . gene_id "XLOC_003243"; transcript_id "TCONS_00003243"; exon_number "1"; oId "CUFF.3230.1"; tss_id "TSS3243"; +chr15 Cufflinks exon 91398837 91398873 . - . gene_id "XLOC_003244"; transcript_id "TCONS_00003244"; exon_number "1"; oId "CUFF.3231.1"; tss_id "TSS3244"; +chr15 Cufflinks exon 91399175 91399434 . - . gene_id "XLOC_003245"; transcript_id "TCONS_00003245"; exon_number "1"; oId "CUFF.3232.1"; tss_id "TSS3245"; +chr15 Cufflinks exon 91575843 91576033 . - . gene_id "XLOC_003246"; transcript_id "TCONS_00003246"; exon_number "1"; oId "CUFF.3233.1"; tss_id "TSS3246"; +chr15 Cufflinks exon 93963510 93963569 . - . gene_id "XLOC_003247"; transcript_id "TCONS_00003247"; exon_number "1"; oId "CUFF.3238.1"; tss_id "TSS3247"; +chr15 Cufflinks exon 94424433 94424470 . - . gene_id "XLOC_003248"; transcript_id "TCONS_00003248"; exon_number "1"; oId "CUFF.3239.1"; tss_id "TSS3248"; +chr15 Cufflinks exon 95083551 95083586 . - . gene_id "XLOC_003249"; transcript_id "TCONS_00003249"; exon_number "1"; oId "CUFF.3240.1"; tss_id "TSS3249"; +chr15 Cufflinks exon 98057741 98057776 . - . gene_id "XLOC_003250"; transcript_id "TCONS_00003250"; exon_number "1"; oId "CUFF.3247.1"; tss_id "TSS3250"; +chr15 Cufflinks exon 98617896 98617966 . - . gene_id "XLOC_003251"; transcript_id "TCONS_00003251"; exon_number "1"; oId "CUFF.3249.1"; tss_id "TSS3251"; +chr15 Cufflinks exon 100614306 100614393 . - . gene_id "XLOC_003252"; transcript_id "TCONS_00003252"; exon_number "1"; oId "CUFF.3251.1"; tss_id "TSS3252"; +chr15 Cufflinks exon 101092025 101092130 . - . gene_id "XLOC_003253"; transcript_id "TCONS_00003253"; exon_number "1"; oId "CUFF.3252.1"; tss_id "TSS3253"; +chr15 Cufflinks exon 101100892 101100996 . - . gene_id "XLOC_003254"; transcript_id "TCONS_00003254"; exon_number "1"; oId "CUFF.3253.1"; tss_id "TSS3254"; +chr15 Cufflinks exon 101811262 101811338 . - . gene_id "XLOC_003255"; transcript_id "TCONS_00003255"; exon_number "1"; oId "CUFF.3254.1"; tss_id "TSS3255"; +chr15 Cufflinks exon 102188419 102188515 . - . gene_id "XLOC_003256"; transcript_id "TCONS_00003256"; exon_number "1"; oId "CUFF.3255.1"; tss_id "TSS3256"; +chr15 Cufflinks exon 102313490 102313643 . - . gene_id "XLOC_003257"; transcript_id "TCONS_00003257"; exon_number "1"; oId "CUFF.3257.1"; tss_id "TSS3257"; +chr16 Cufflinks exon 1729306 1729341 . + . gene_id "XLOC_003258"; transcript_id "TCONS_00003258"; exon_number "1"; oId "CUFF.3259.1"; tss_id "TSS3258"; +chr16 Cufflinks exon 2063182 2063477 . + . gene_id "XLOC_003259"; transcript_id "TCONS_00003259"; exon_number "1"; oId "CUFF.3260.1"; tss_id "TSS3259"; +chr16 Cufflinks exon 2952854 2952954 . + . gene_id "XLOC_003260"; transcript_id "TCONS_00003260"; exon_number "1"; oId "CUFF.3261.1"; tss_id "TSS3260"; +chr16 Cufflinks exon 2977663 2977737 . + . gene_id "XLOC_003261"; transcript_id "TCONS_00003261"; exon_number "1"; oId "CUFF.3262.1"; tss_id "TSS3261"; +chr16 Cufflinks exon 3119524 3119592 . + . gene_id "XLOC_003262"; transcript_id "TCONS_00003262"; exon_number "1"; oId "CUFF.3263.1"; tss_id "TSS3262"; +chr16 Cufflinks exon 3132166 3132234 . + . gene_id "XLOC_003263"; transcript_id "TCONS_00003263"; exon_number "1"; oId "CUFF.3264.1"; tss_id "TSS3263"; +chr16 Cufflinks exon 3136202 3136301 . + . gene_id "XLOC_003264"; transcript_id "TCONS_00003264"; exon_number "1"; oId "CUFF.3265.1"; tss_id "TSS3264"; +chr16 Cufflinks exon 3200675 3200747 . + . gene_id "XLOC_003265"; transcript_id "TCONS_00003265"; exon_number "1"; oId "CUFF.3266.1"; tss_id "TSS3265"; +chr16 Cufflinks exon 3202901 3202973 . + . gene_id "XLOC_003266"; transcript_id "TCONS_00003266"; exon_number "1"; oId "CUFF.3268.1"; tss_id "TSS3266"; +chr16 Cufflinks exon 3208923 3208994 . + . gene_id "XLOC_003267"; transcript_id "TCONS_00003267"; exon_number "1"; oId "CUFF.3270.1"; tss_id "TSS3267"; +chr16 Cufflinks exon 3210386 3210483 . + . gene_id "XLOC_003268"; transcript_id "TCONS_00003268"; exon_number "1"; oId "CUFF.3271.1"; tss_id "TSS3268"; +chr16 Cufflinks exon 3214939 3215011 . + . gene_id "XLOC_003269"; transcript_id "TCONS_00003269"; exon_number "1"; oId "CUFF.3272.1"; tss_id "TSS3269"; +chr16 Cufflinks exon 3222049 3222120 . + . gene_id "XLOC_003270"; transcript_id "TCONS_00003270"; exon_number "1"; oId "CUFF.3274.1"; tss_id "TSS3270"; +chr16 Cufflinks exon 3225692 3225764 . + . gene_id "XLOC_003271"; transcript_id "TCONS_00003271"; exon_number "1"; oId "CUFF.3275.1"; tss_id "TSS3271"; +chr16 Cufflinks exon 3238094 3238167 . + . gene_id "XLOC_003272"; transcript_id "TCONS_00003272"; exon_number "1"; oId "CUFF.3279.1"; tss_id "TSS3272"; +chr16 Cufflinks exon 3239634 3239705 . + . gene_id "XLOC_003273"; transcript_id "TCONS_00003273"; exon_number "1"; oId "CUFF.3280.1"; tss_id "TSS3273"; +chr16 Cufflinks exon 3241501 3241573 . + . gene_id "XLOC_003274"; transcript_id "TCONS_00003274"; exon_number "1"; oId "CUFF.3281.1"; tss_id "TSS3274"; +chr16 Cufflinks exon 3241989 3242061 . + . gene_id "XLOC_003275"; transcript_id "TCONS_00003275"; exon_number "1"; oId "CUFF.3282.1"; tss_id "TSS3275"; +chr16 Cufflinks exon 3243918 3243990 . + . gene_id "XLOC_003276"; transcript_id "TCONS_00003276"; exon_number "1"; oId "CUFF.3283.1"; tss_id "TSS3276"; +chr16 Cufflinks exon 3246153 3246226 . + . gene_id "XLOC_003277"; transcript_id "TCONS_00003277"; exon_number "1"; oId "CUFF.3284.1"; tss_id "TSS3277"; +chr16 Cufflinks exon 3318138 3318182 . + . gene_id "XLOC_003278"; transcript_id "TCONS_00003278"; exon_number "1"; oId "CUFF.3285.1"; tss_id "TSS3278"; +chr16 Cufflinks exon 3417650 3417713 . + . gene_id "XLOC_003279"; transcript_id "TCONS_00003279"; exon_number "1"; oId "CUFF.3286.1"; tss_id "TSS3279"; +chr16 Cufflinks exon 3419813 3419884 . + . gene_id "XLOC_003280"; transcript_id "TCONS_00003280"; exon_number "1"; oId "CUFF.3287.1"; tss_id "TSS3280"; +chr16 Cufflinks exon 4709006 4709176 . + . gene_id "XLOC_003281"; transcript_id "TCONS_00003281"; exon_number "1"; oId "CUFF.3292.1"; tss_id "TSS3281"; +chr16 Cufflinks exon 6798910 6798968 . + . gene_id "XLOC_003282"; transcript_id "TCONS_00003282"; exon_number "1"; oId "CUFF.3293.1"; tss_id "TSS3282"; +chr16 Cufflinks exon 6923901 6924006 . + . gene_id "XLOC_003283"; transcript_id "TCONS_00003283"; exon_number "1"; oId "CUFF.3294.1"; tss_id "TSS3283"; +chr16 Cufflinks exon 8777112 8777428 . + . gene_id "XLOC_003284"; transcript_id "TCONS_00003284"; exon_number "1"; oId "CUFF.3296.1"; tss_id "TSS3284"; +chr16 Cufflinks exon 9178578 9178703 . + . gene_id "XLOC_003285"; transcript_id "TCONS_00003285"; exon_number "1"; oId "CUFF.3298.1"; tss_id "TSS3285"; +chr16 Cufflinks exon 9631534 9631573 . + . gene_id "XLOC_003286"; transcript_id "TCONS_00003286"; exon_number "1"; oId "CUFF.3299.1"; tss_id "TSS3286"; +chr16 Cufflinks exon 9693946 9694041 . + . gene_id "XLOC_003287"; transcript_id "TCONS_00003287"; exon_number "1"; oId "CUFF.3301.1"; tss_id "TSS3287"; +chr16 Cufflinks exon 9911077 9911113 . + . gene_id "XLOC_003288"; transcript_id "TCONS_00003288"; exon_number "1"; oId "CUFF.3302.1"; tss_id "TSS3288"; +chr16 Cufflinks exon 10590127 10590231 . + . gene_id "XLOC_003289"; transcript_id "TCONS_00003289"; exon_number "1"; oId "CUFF.3304.1"; tss_id "TSS3289"; +chr16 Cufflinks exon 10859147 10859200 . + . gene_id "XLOC_003290"; transcript_id "TCONS_00003290"; exon_number "1"; oId "CUFF.3305.1"; tss_id "TSS3290"; +chr16 Cufflinks exon 11320279 11320354 . + . gene_id "XLOC_003291"; transcript_id "TCONS_00003291"; exon_number "1"; oId "CUFF.3306.1"; tss_id "TSS3291"; +chr16 Cufflinks exon 11387071 11387173 . + . gene_id "XLOC_003292"; transcript_id "TCONS_00003292"; exon_number "1"; oId "CUFF.3307.1"; tss_id "TSS3292"; +chr16 Cufflinks exon 11561501 11561583 . + . gene_id "XLOC_003293"; transcript_id "TCONS_00003293"; exon_number "1"; oId "CUFF.3308.1"; tss_id "TSS3293"; +chr16 Cufflinks exon 14379750 14379821 . + . gene_id "XLOC_003294"; transcript_id "TCONS_00003294"; exon_number "1"; oId "CUFF.3313.1"; tss_id "TSS3294"; +chr16 Cufflinks exon 14734971 14735000 . + . gene_id "XLOC_003295"; transcript_id "TCONS_00003295"; exon_number "1"; oId "CUFF.3315.1"; tss_id "TSS3295"; +chr16 Cufflinks exon 14737646 14737705 . + . gene_id "XLOC_003296"; transcript_id "TCONS_00003296"; exon_number "1"; oId "CUFF.3316.1"; tss_id "TSS3296"; +chr16 Cufflinks exon 15720307 15720381 . + . gene_id "XLOC_003297"; transcript_id "TCONS_00003297"; exon_number "1"; oId "CUFF.3318.1"; tss_id "TSS3297"; +chr16 Cufflinks exon 16767637 16767697 . + . gene_id "XLOC_003298"; transcript_id "TCONS_00003298"; exon_number "1"; oId "CUFF.3321.1"; tss_id "TSS3298"; +chr16 Cufflinks exon 18571788 18571817 . + . gene_id "XLOC_003299"; transcript_id "TCONS_00003299"; exon_number "1"; oId "CUFF.3324.1"; tss_id "TSS3299"; +chr16 Cufflinks exon 19023479 19023581 . + . gene_id "XLOC_003300"; transcript_id "TCONS_00003300"; exon_number "1"; oId "CUFF.3327.1"; tss_id "TSS3300"; +chr16 Cufflinks exon 19074481 19074520 . + . gene_id "XLOC_003301"; transcript_id "TCONS_00003301"; exon_number "1"; oId "CUFF.3328.1"; tss_id "TSS3301"; +chr16 Cufflinks exon 19336848 19336911 . + . gene_id "XLOC_003302"; transcript_id "TCONS_00003302"; exon_number "1"; oId "CUFF.3329.1"; tss_id "TSS3302"; +chr16 Cufflinks exon 19509932 19510072 . + . gene_id "XLOC_003303"; transcript_id "TCONS_00003303"; exon_number "1"; oId "CUFF.3330.1"; tss_id "TSS3303"; +chr16 Cufflinks exon 20795831 20795931 . + . gene_id "XLOC_003304"; transcript_id "TCONS_00003304"; exon_number "1"; oId "CUFF.3332.1"; tss_id "TSS3304"; +chr16 Cufflinks exon 21653375 21653481 . + . gene_id "XLOC_003305"; transcript_id "TCONS_00003305"; exon_number "1"; oId "CUFF.3336.1"; tss_id "TSS3305"; +chr16 Cufflinks exon 21653615 21653716 . + . gene_id "XLOC_003306"; transcript_id "TCONS_00003306"; exon_number "1"; oId "CUFF.3337.1"; tss_id "TSS3306"; +chr16 Cufflinks exon 21661493 21661541 . + . gene_id "XLOC_003307"; transcript_id "TCONS_00003307"; exon_number "1"; oId "CUFF.3338.1"; tss_id "TSS3307"; +chr16 Cufflinks exon 22154920 22154949 . + . gene_id "XLOC_003308"; transcript_id "TCONS_00003308"; exon_number "1"; oId "CUFF.3340.1"; tss_id "TSS3308"; +chr16 Cufflinks exon 22308461 22308542 . + . gene_id "XLOC_003309"; transcript_id "TCONS_00003309"; exon_number "1"; oId "CUFF.3342.1"; tss_id "TSS3309"; +chr16 Cufflinks exon 22492794 22492901 . + . gene_id "XLOC_003310"; transcript_id "TCONS_00003310"; exon_number "1"; oId "CUFF.3345.1"; tss_id "TSS3310"; +chr16 Cufflinks exon 22695058 22695185 . + . gene_id "XLOC_003311"; transcript_id "TCONS_00003311"; exon_number "1"; oId "CUFF.3346.1"; tss_id "TSS3311"; +chr16 Cufflinks exon 23443674 23443819 . + . gene_id "XLOC_003312"; transcript_id "TCONS_00003312"; exon_number "1"; oId "CUFF.3349.1"; tss_id "TSS3312"; +chr16 Cufflinks exon 24424195 24424265 . + . gene_id "XLOC_003313"; transcript_id "TCONS_00003313"; exon_number "1"; oId "CUFF.3354.1"; tss_id "TSS3313"; +chr16 Cufflinks exon 25275814 25275927 . + . gene_id "XLOC_003314"; transcript_id "TCONS_00003314"; exon_number "1"; oId "CUFF.3355.1"; tss_id "TSS3314"; +chr16 Cufflinks exon 26040233 26040322 . + . gene_id "XLOC_003315"; transcript_id "TCONS_00003315"; exon_number "1"; oId "CUFF.3356.1"; tss_id "TSS3315"; +chr16 Cufflinks exon 27874572 27874675 . + . gene_id "XLOC_003316"; transcript_id "TCONS_00003316"; exon_number "1"; oId "CUFF.3357.1"; tss_id "TSS3316"; +chr16 Cufflinks exon 28173467 28173533 . + . gene_id "XLOC_003317"; transcript_id "TCONS_00003317"; exon_number "1"; oId "CUFF.3360.1"; tss_id "TSS3317"; +chr16 Cufflinks exon 28453987 28454093 . + . gene_id "XLOC_003318"; transcript_id "TCONS_00003318"; exon_number "1"; oId "CUFF.3361.1"; tss_id "TSS3318"; +chr16 Cufflinks exon 29138039 29138128 . + . gene_id "XLOC_003319"; transcript_id "TCONS_00003319"; exon_number "1"; oId "CUFF.3368.1"; tss_id "TSS3319"; +chr16 Cufflinks exon 29327126 29327170 . + . gene_id "XLOC_003320"; transcript_id "TCONS_00003320"; exon_number "1"; oId "CUFF.3370.1"; tss_id "TSS3320"; +chr16 Cufflinks exon 30712298 30712449 . + . gene_id "XLOC_003321"; transcript_id "TCONS_00003321"; exon_number "1"; oId "CUFF.3378.1"; tss_id "TSS3321"; +chr16 Cufflinks exon 33488341 33488438 . + . gene_id "XLOC_003322"; transcript_id "TCONS_00003322"; exon_number "1"; oId "CUFF.3381.1"; tss_id "TSS3322"; +chr16 Cufflinks exon 33962497 33964361 . + . gene_id "XLOC_003323"; transcript_id "TCONS_00003323"; exon_number "1"; oId "CUFF.3383.1"; tss_id "TSS3323"; +chr16 Cufflinks exon 34368171 34368209 . + . gene_id "XLOC_003324"; transcript_id "TCONS_00003324"; exon_number "1"; oId "CUFF.3385.1"; tss_id "TSS3324"; +chr16 Cufflinks exon 34968518 34968621 . + . gene_id "XLOC_003325"; transcript_id "TCONS_00003325"; exon_number "1"; oId "CUFF.3386.1"; tss_id "TSS3325"; +chr16 Cufflinks exon 34968778 34968874 . + . gene_id "XLOC_003326"; transcript_id "TCONS_00003326"; exon_number "1"; oId "CUFF.3387.1"; tss_id "TSS3326"; +chr16 Cufflinks exon 34969019 34969121 . + . gene_id "XLOC_003327"; transcript_id "TCONS_00003327"; exon_number "1"; oId "CUFF.3388.1"; tss_id "TSS3327"; +chr16 Cufflinks exon 34969280 34969355 . + . gene_id "XLOC_003328"; transcript_id "TCONS_00003328"; exon_number "1"; oId "CUFF.3389.1"; tss_id "TSS3328"; +chr16 Cufflinks exon 34969505 34969608 . + . gene_id "XLOC_003329"; transcript_id "TCONS_00003329"; exon_number "1"; oId "CUFF.3390.1"; tss_id "TSS3329"; +chr16 Cufflinks exon 34969751 34969854 . + . gene_id "XLOC_003330"; transcript_id "TCONS_00003330"; exon_number "1"; oId "CUFF.3391.1"; tss_id "TSS3330"; +chr16 Cufflinks exon 34970002 34970106 . + . gene_id "XLOC_003331"; transcript_id "TCONS_00003331"; exon_number "1"; oId "CUFF.3392.1"; tss_id "TSS3331"; +chr16 Cufflinks exon 34970263 34970357 . + . gene_id "XLOC_003332"; transcript_id "TCONS_00003332"; exon_number "1"; oId "CUFF.3393.1"; tss_id "TSS3332"; +chr16 Cufflinks exon 34970530 34970602 . + . gene_id "XLOC_003333"; transcript_id "TCONS_00003333"; exon_number "1"; oId "CUFF.3394.1"; tss_id "TSS3333"; +chr16 Cufflinks exon 34980141 34980218 . + . gene_id "XLOC_003334"; transcript_id "TCONS_00003334"; exon_number "1"; oId "CUFF.3395.1"; tss_id "TSS3334"; +chr16 Cufflinks exon 34980367 34980470 . + . gene_id "XLOC_003335"; transcript_id "TCONS_00003335"; exon_number "1"; oId "CUFF.3396.1"; tss_id "TSS3335"; +chr16 Cufflinks exon 34980665 34980742 . + . gene_id "XLOC_003336"; transcript_id "TCONS_00003336"; exon_number "1"; oId "CUFF.3397.1"; tss_id "TSS3336"; +chr16 Cufflinks exon 34980915 34981017 . + . gene_id "XLOC_003337"; transcript_id "TCONS_00003337"; exon_number "1"; oId "CUFF.3398.1"; tss_id "TSS3337"; +chr16 Cufflinks exon 34981193 34981267 . + . gene_id "XLOC_003338"; transcript_id "TCONS_00003338"; exon_number "1"; oId "CUFF.3399.1"; tss_id "TSS3338"; +chr16 Cufflinks exon 34981410 34981513 . + . gene_id "XLOC_003339"; transcript_id "TCONS_00003339"; exon_number "1"; oId "CUFF.3400.1"; tss_id "TSS3339"; +chr16 Cufflinks exon 34981711 34981775 . + . gene_id "XLOC_003340"; transcript_id "TCONS_00003340"; exon_number "1"; oId "CUFF.3401.1"; tss_id "TSS3340"; +chr16 Cufflinks exon 34981935 34982012 . + . gene_id "XLOC_003341"; transcript_id "TCONS_00003341"; exon_number "1"; oId "CUFF.3402.1"; tss_id "TSS3341"; +chr16 Cufflinks exon 34982151 34982254 . + . gene_id "XLOC_003342"; transcript_id "TCONS_00003342"; exon_number "1"; oId "CUFF.3403.1"; tss_id "TSS3342"; +chr16 Cufflinks exon 34982431 34982510 . + . gene_id "XLOC_003343"; transcript_id "TCONS_00003343"; exon_number "1"; oId "CUFF.3404.1"; tss_id "TSS3343"; +chr16 Cufflinks exon 34982692 34982766 . + . gene_id "XLOC_003344"; transcript_id "TCONS_00003344"; exon_number "1"; oId "CUFF.3405.1"; tss_id "TSS3344"; +chr16 Cufflinks exon 34982951 34983028 . + . gene_id "XLOC_003345"; transcript_id "TCONS_00003345"; exon_number "1"; oId "CUFF.3406.1"; tss_id "TSS3345"; +chr16 Cufflinks exon 34983175 34983278 . + . gene_id "XLOC_003346"; transcript_id "TCONS_00003346"; exon_number "1"; oId "CUFF.3407.1"; tss_id "TSS3346"; +chr16 Cufflinks exon 34983426 34983529 . + . gene_id "XLOC_003347"; transcript_id "TCONS_00003347"; exon_number "1"; oId "CUFF.3408.1"; tss_id "TSS3347"; +chr16 Cufflinks exon 34983687 34983780 . + . gene_id "XLOC_003348"; transcript_id "TCONS_00003348"; exon_number "1"; oId "CUFF.3409.1"; tss_id "TSS3348"; +chr16 Cufflinks exon 34983932 34984034 . + . gene_id "XLOC_003349"; transcript_id "TCONS_00003349"; exon_number "1"; oId "CUFF.3410.1"; tss_id "TSS3349"; +chr16 Cufflinks exon 34984184 34984286 . + . gene_id "XLOC_003350"; transcript_id "TCONS_00003350"; exon_number "1"; oId "CUFF.3411.1"; tss_id "TSS3350"; +chr16 Cufflinks exon 34984439 34984541 . + . gene_id "XLOC_003351"; transcript_id "TCONS_00003351"; exon_number "1"; oId "CUFF.3412.1"; tss_id "TSS3351"; +chr16 Cufflinks exon 34984720 34984792 . + . gene_id "XLOC_003352"; transcript_id "TCONS_00003352"; exon_number "1"; oId "CUFF.3413.1"; tss_id "TSS3352"; +chr16 Cufflinks exon 34984968 34985045 . + . gene_id "XLOC_003353"; transcript_id "TCONS_00003353"; exon_number "1"; oId "CUFF.3414.1"; tss_id "TSS3353"; +chr16 Cufflinks exon 34985216 34985295 . + . gene_id "XLOC_003354"; transcript_id "TCONS_00003354"; exon_number "1"; oId "CUFF.3415.1"; tss_id "TSS3354"; +chr16 Cufflinks exon 34985470 34985544 . + . gene_id "XLOC_003355"; transcript_id "TCONS_00003355"; exon_number "1"; oId "CUFF.3416.1"; tss_id "TSS3355"; +chr16 Cufflinks exon 34985738 34985807 . + . gene_id "XLOC_003356"; transcript_id "TCONS_00003356"; exon_number "1"; oId "CUFF.3417.1"; tss_id "TSS3356"; +chr16 Cufflinks exon 34985976 34986057 . + . gene_id "XLOC_003357"; transcript_id "TCONS_00003357"; exon_number "1"; oId "CUFF.3418.1"; tss_id "TSS3357"; +chr16 Cufflinks exon 34986232 34986308 . + . gene_id "XLOC_003358"; transcript_id "TCONS_00003358"; exon_number "1"; oId "CUFF.3419.1"; tss_id "TSS3358"; +chr16 Cufflinks exon 34986457 34986559 . + . gene_id "XLOC_003359"; transcript_id "TCONS_00003359"; exon_number "1"; oId "CUFF.3420.1"; tss_id "TSS3359"; +chr16 Cufflinks exon 34986730 34986809 . + . gene_id "XLOC_003360"; transcript_id "TCONS_00003360"; exon_number "1"; oId "CUFF.3421.1"; tss_id "TSS3360"; +chr16 Cufflinks exon 34986980 34987057 . + . gene_id "XLOC_003361"; transcript_id "TCONS_00003361"; exon_number "1"; oId "CUFF.3422.1"; tss_id "TSS3361"; +chr16 Cufflinks exon 34987229 34987308 . + . gene_id "XLOC_003362"; transcript_id "TCONS_00003362"; exon_number "1"; oId "CUFF.3423.1"; tss_id "TSS3362"; +chr16 Cufflinks exon 34987698 34987799 . + . gene_id "XLOC_003363"; transcript_id "TCONS_00003363"; exon_number "1"; oId "CUFF.3424.1"; tss_id "TSS3363"; +chr16 Cufflinks exon 34987949 34988051 . + . gene_id "XLOC_003364"; transcript_id "TCONS_00003364"; exon_number "1"; oId "CUFF.3425.1"; tss_id "TSS3364"; +chr16 Cufflinks exon 34988200 34988303 . + . gene_id "XLOC_003365"; transcript_id "TCONS_00003365"; exon_number "1"; oId "CUFF.3426.1"; tss_id "TSS3365"; +chr16 Cufflinks exon 34988453 34988555 . + . gene_id "XLOC_003366"; transcript_id "TCONS_00003366"; exon_number "1"; oId "CUFF.3427.1"; tss_id "TSS3366"; +chr16 Cufflinks exon 34988704 34988807 . + . gene_id "XLOC_003367"; transcript_id "TCONS_00003367"; exon_number "1"; oId "CUFF.3428.1"; tss_id "TSS3367"; +chr16 Cufflinks exon 34988987 34989061 . + . gene_id "XLOC_003368"; transcript_id "TCONS_00003368"; exon_number "1"; oId "CUFF.3429.1"; tss_id "TSS3368"; +chr16 Cufflinks exon 34989331 34989402 . + . gene_id "XLOC_003369"; transcript_id "TCONS_00003369"; exon_number "1"; oId "CUFF.3430.1"; tss_id "TSS3369"; +chr16 Cufflinks exon 34989573 34989658 . + . gene_id "XLOC_003370"; transcript_id "TCONS_00003370"; exon_number "1"; oId "CUFF.3431.1"; tss_id "TSS3370"; +chr16 Cufflinks exon 47519473 47519518 . + . gene_id "XLOC_003371"; transcript_id "TCONS_00003371"; exon_number "1"; oId "CUFF.3436.1"; tss_id "TSS3371"; +chr16 Cufflinks exon 47538630 47539430 . + . gene_id "XLOC_003372"; transcript_id "TCONS_00003372"; exon_number "1"; oId "CUFF.3437.1"; tss_id "TSS3372"; +chr16 Cufflinks exon 48094702 48094745 . + . gene_id "XLOC_003373"; transcript_id "TCONS_00003373"; exon_number "1"; oId "CUFF.3438.1"; tss_id "TSS3373"; +chr16 Cufflinks exon 53335130 53335166 . + . gene_id "XLOC_003374"; transcript_id "TCONS_00003374"; exon_number "1"; oId "CUFF.3452.1"; tss_id "TSS3374"; +chr16 Cufflinks exon 53368474 53368579 . + . gene_id "XLOC_003375"; transcript_id "TCONS_00003375"; exon_number "1"; oId "CUFF.3453.1"; tss_id "TSS3375"; +chr16 Cufflinks exon 53371365 53371484 . + . gene_id "XLOC_003376"; transcript_id "TCONS_00003376"; exon_number "1"; oId "CUFF.3454.1"; tss_id "TSS3376"; +chr16 Cufflinks exon 55758636 55758833 . + . gene_id "XLOC_003377"; transcript_id "TCONS_00003377"; exon_number "1"; oId "CUFF.3459.1"; tss_id "TSS3377"; +chr16 Cufflinks exon 55789821 55789974 . + . gene_id "XLOC_003378"; transcript_id "TCONS_00003378"; exon_number "1"; oId "CUFF.3460.1"; tss_id "TSS3378"; +chr16 Cufflinks exon 55875368 55875655 . + . gene_id "XLOC_003379"; transcript_id "TCONS_00003379"; exon_number "1"; oId "CUFF.3462.1"; tss_id "TSS3379"; +chr16 Cufflinks exon 56608318 56608372 . + . gene_id "XLOC_003380"; transcript_id "TCONS_00003380"; exon_number "1"; oId "CUFF.3464.1"; tss_id "TSS3380"; +chr16 Cufflinks exon 57333863 57333945 . + . gene_id "XLOC_003381"; transcript_id "TCONS_00003381"; exon_number "1"; oId "CUFF.3469.1"; tss_id "TSS3381"; +chr16 Cufflinks exon 58414793 58414824 . + . gene_id "XLOC_003382"; transcript_id "TCONS_00003382"; exon_number "1"; oId "CUFF.3476.1"; tss_id "TSS3382"; +chr16 Cufflinks exon 58530812 58530916 . + . gene_id "XLOC_003383"; transcript_id "TCONS_00003383"; exon_number "1"; oId "CUFF.3478.1"; tss_id "TSS3383"; +chr16 Cufflinks exon 58652578 58652671 . + . gene_id "XLOC_003384"; transcript_id "TCONS_00003384"; exon_number "1"; oId "CUFF.3479.1"; tss_id "TSS3384"; +chr16 Cufflinks exon 58804428 58804745 . + . gene_id "XLOC_003385"; transcript_id "TCONS_00003385"; exon_number "1"; oId "CUFF.3481.1"; tss_id "TSS3385"; +chr16 Cufflinks exon 58958965 58959010 . + . gene_id "XLOC_003386"; transcript_id "TCONS_00003386"; exon_number "1"; oId "CUFF.3482.1"; tss_id "TSS3386"; +chr16 Cufflinks exon 59528154 59528195 . + . gene_id "XLOC_003387"; transcript_id "TCONS_00003387"; exon_number "1"; oId "CUFF.3483.1"; tss_id "TSS3387"; +chr16 Cufflinks exon 59574030 59574173 . + . gene_id "XLOC_003388"; transcript_id "TCONS_00003388"; exon_number "1"; oId "CUFF.3484.1"; tss_id "TSS3388"; +chr16 Cufflinks exon 59765259 59765347 . + . gene_id "XLOC_003389"; transcript_id "TCONS_00003389"; exon_number "1"; oId "CUFF.3485.1"; tss_id "TSS3389"; +chr16 Cufflinks exon 62438159 62438259 . + . gene_id "XLOC_003390"; transcript_id "TCONS_00003390"; exon_number "1"; oId "CUFF.3494.1"; tss_id "TSS3390"; +chr16 Cufflinks exon 64677365 64677399 . + . gene_id "XLOC_003391"; transcript_id "TCONS_00003391"; exon_number "1"; oId "CUFF.3498.1"; tss_id "TSS3391"; +chr16 Cufflinks exon 64878073 64878121 . + . gene_id "XLOC_003392"; transcript_id "TCONS_00003392"; exon_number "1"; oId "CUFF.3499.1"; tss_id "TSS3392"; +chr16 Cufflinks exon 65818009 65818044 . + . gene_id "XLOC_003393"; transcript_id "TCONS_00003393"; exon_number "1"; oId "CUFF.3501.1"; tss_id "TSS3393"; +chr16 Cufflinks exon 66159299 66159335 . + . gene_id "XLOC_003394"; transcript_id "TCONS_00003394"; exon_number "1"; oId "CUFF.3502.1"; tss_id "TSS3394"; +chr16 Cufflinks exon 66335712 66335801 . + . gene_id "XLOC_003395"; transcript_id "TCONS_00003395"; exon_number "1"; oId "CUFF.3503.1"; tss_id "TSS3395"; +chr16 Cufflinks exon 67053422 67053739 . + . gene_id "XLOC_003396"; transcript_id "TCONS_00003396"; exon_number "1"; oId "CUFF.3504.1"; tss_id "TSS3396"; +chr16 Cufflinks exon 67528713 67528748 . + . gene_id "XLOC_003397"; transcript_id "TCONS_00003397"; exon_number "1"; oId "CUFF.3507.1"; tss_id "TSS3397"; +chr16 Cufflinks exon 67659510 67659547 . + . gene_id "XLOC_003398"; transcript_id "TCONS_00003398"; exon_number "1"; oId "CUFF.3508.1"; tss_id "TSS3398"; +chr16 Cufflinks exon 68049323 68049378 . + . gene_id "XLOC_003399"; transcript_id "TCONS_00003399"; exon_number "1"; oId "CUFF.3509.1"; tss_id "TSS3399"; +chr16 Cufflinks exon 68569418 68569564 . + . gene_id "XLOC_003400"; transcript_id "TCONS_00003400"; exon_number "1"; oId "CUFF.3515.1"; tss_id "TSS3400"; +chr16 Cufflinks exon 68776382 68776476 . + . gene_id "XLOC_003401"; transcript_id "TCONS_00003401"; exon_number "1"; oId "CUFF.3516.1"; tss_id "TSS3401"; +chr16 Cufflinks exon 69137942 69138001 . + . gene_id "XLOC_003402"; transcript_id "TCONS_00003402"; exon_number "1"; oId "CUFF.3520.1"; tss_id "TSS3402"; +chr16 Cufflinks exon 69312854 69312883 . + . gene_id "XLOC_003403"; transcript_id "TCONS_00003403"; exon_number "1"; oId "CUFF.3522.1"; tss_id "TSS3403"; +chr16 Cufflinks exon 69536818 69536856 . + . gene_id "XLOC_003404"; transcript_id "TCONS_00003404"; exon_number "1"; oId "CUFF.3523.1"; tss_id "TSS3404"; +chr16 Cufflinks exon 69537147 69537213 . + . gene_id "XLOC_003405"; transcript_id "TCONS_00003405"; exon_number "1"; oId "CUFF.3524.1"; tss_id "TSS3405"; +chr16 Cufflinks exon 69555874 69555918 . + . gene_id "XLOC_003406"; transcript_id "TCONS_00003406"; exon_number "1"; oId "CUFF.3525.1"; tss_id "TSS3406"; +chr16 Cufflinks exon 70533232 70533269 . + . gene_id "XLOC_003407"; transcript_id "TCONS_00003407"; exon_number "1"; oId "CUFF.3530.1"; tss_id "TSS3407"; +chr16 Cufflinks exon 70822597 70822667 . + . gene_id "XLOC_003408"; transcript_id "TCONS_00003408"; exon_number "1"; oId "CUFF.3533.1"; tss_id "TSS3408"; +chr16 Cufflinks exon 70823410 70823483 . + . gene_id "XLOC_003409"; transcript_id "TCONS_00003409"; exon_number "1"; oId "CUFF.3534.1"; tss_id "TSS3409"; +chr16 Cufflinks exon 71460396 71460468 . + . gene_id "XLOC_003410"; transcript_id "TCONS_00003410"; exon_number "1"; oId "CUFF.3535.1"; tss_id "TSS3410"; +chr16 Cufflinks exon 71699994 71700097 . + . gene_id "XLOC_003411"; transcript_id "TCONS_00003411"; exon_number "1"; oId "CUFF.3538.1"; tss_id "TSS3411"; +chr16 Cufflinks exon 72410603 72410718 . + . gene_id "XLOC_003412"; transcript_id "TCONS_00003412"; exon_number "1"; oId "CUFF.3540.1"; tss_id "TSS3412"; +chr16 Cufflinks exon 72510018 72510086 . + . gene_id "XLOC_003413"; transcript_id "TCONS_00003413"; exon_number "1"; oId "CUFF.3541.1"; tss_id "TSS3413"; +chr16 Cufflinks exon 72625632 72625690 . + . gene_id "XLOC_003414"; transcript_id "TCONS_00003414"; exon_number "1"; oId "CUFF.3542.1"; tss_id "TSS3414"; +chr16 Cufflinks exon 72707402 72707462 . + . gene_id "XLOC_003415"; transcript_id "TCONS_00003415"; exon_number "1"; oId "CUFF.3543.1"; tss_id "TSS3415"; +chr16 Cufflinks exon 72856482 72856569 . + . gene_id "XLOC_003416"; transcript_id "TCONS_00003416"; exon_number "1"; oId "CUFF.3545.1"; tss_id "TSS3416"; +chr16 Cufflinks exon 73143361 73143461 . + . gene_id "XLOC_003417"; transcript_id "TCONS_00003417"; exon_number "1"; oId "CUFF.3546.1"; tss_id "TSS3417"; +chr16 Cufflinks exon 73172897 73172965 . + . gene_id "XLOC_003418"; transcript_id "TCONS_00003418"; exon_number "1"; oId "CUFF.3547.1"; tss_id "TSS3418"; +chr16 Cufflinks exon 74490446 74490509 . + . gene_id "XLOC_003419"; transcript_id "TCONS_00003419"; exon_number "1"; oId "CUFF.3550.1"; tss_id "TSS3419"; +chr16 Cufflinks exon 75438755 75438791 . + . gene_id "XLOC_003420"; transcript_id "TCONS_00003420"; exon_number "1"; oId "CUFF.3557.1"; tss_id "TSS3420"; +chr16 Cufflinks exon 75532602 75532756 . + . gene_id "XLOC_003421"; transcript_id "TCONS_00003421"; exon_number "1"; oId "CUFF.3558.1"; tss_id "TSS3421"; +chr16 Cufflinks exon 76321527 76321641 . + . gene_id "XLOC_003422"; transcript_id "TCONS_00003422"; exon_number "1"; oId "CUFF.3561.1"; tss_id "TSS3422"; +chr16 Cufflinks exon 77285571 77285606 . + . gene_id "XLOC_003423"; transcript_id "TCONS_00003423"; exon_number "1"; oId "CUFF.3563.1"; tss_id "TSS3423"; +chr16 Cufflinks exon 79298351 79298442 . + . gene_id "XLOC_003424"; transcript_id "TCONS_00003424"; exon_number "1"; oId "CUFF.3566.1"; tss_id "TSS3424"; +chr16 Cufflinks exon 80388721 80388762 . + . gene_id "XLOC_003425"; transcript_id "TCONS_00003425"; exon_number "1"; oId "CUFF.3567.1"; tss_id "TSS3425"; +chr16 Cufflinks exon 81294749 81294784 . + . gene_id "XLOC_003426"; transcript_id "TCONS_00003426"; exon_number "1"; oId "CUFF.3568.1"; tss_id "TSS3426"; +chr16 Cufflinks exon 81995531 81995772 . + . gene_id "XLOC_003427"; transcript_id "TCONS_00003427"; exon_number "1"; oId "CUFF.3570.1"; tss_id "TSS3427"; +chr16 Cufflinks exon 82487925 82488023 . + . gene_id "XLOC_003428"; transcript_id "TCONS_00003428"; exon_number "1"; oId "CUFF.3572.1"; tss_id "TSS3428"; +chr16 Cufflinks exon 85052971 85053030 . + . gene_id "XLOC_003429"; transcript_id "TCONS_00003429"; exon_number "1"; oId "CUFF.3578.1"; tss_id "TSS3429"; +chr16 Cufflinks exon 85692984 85693300 . + . gene_id "XLOC_003430"; transcript_id "TCONS_00003430"; exon_number "1"; oId "CUFF.3579.1"; tss_id "TSS3430"; +chr16 Cufflinks exon 87348325 87348432 . + . gene_id "XLOC_003431"; transcript_id "TCONS_00003431"; exon_number "1"; oId "CUFF.3581.1"; tss_id "TSS3431"; +chr16 Cufflinks exon 88055915 88055959 . + . gene_id "XLOC_003432"; transcript_id "TCONS_00003432"; exon_number "1"; oId "CUFF.3585.1"; tss_id "TSS3432"; +chr16 Cufflinks exon 89509727 89509831 . + . gene_id "XLOC_003433"; transcript_id "TCONS_00003433"; exon_number "1"; oId "CUFF.3588.1"; tss_id "TSS3433"; +chr16 Cufflinks exon 90211001 90211103 . + . gene_id "XLOC_003434"; transcript_id "TCONS_00003434"; exon_number "1"; oId "CUFF.3590.1"; tss_id "TSS3434"; +chr16 Cufflinks exon 531910 532157 . - . gene_id "XLOC_003435"; transcript_id "TCONS_00003435"; exon_number "1"; oId "CUFF.3258.1"; tss_id "TSS3435"; +chr16 Cufflinks exon 3202610 3202679 . - . gene_id "XLOC_003436"; transcript_id "TCONS_00003436"; exon_number "1"; oId "CUFF.3267.1"; tss_id "TSS3436"; +chr16 Cufflinks exon 3207406 3207478 . - . gene_id "XLOC_003437"; transcript_id "TCONS_00003437"; exon_number "1"; oId "CUFF.3269.1"; tss_id "TSS3437"; +chr16 Cufflinks exon 3220961 3221031 . - . gene_id "XLOC_003438"; transcript_id "TCONS_00003438"; exon_number "1"; oId "CUFF.3273.1"; tss_id "TSS3438"; +chr16 Cufflinks exon 3230555 3230627 . - . gene_id "XLOC_003439"; transcript_id "TCONS_00003439"; exon_number "1"; oId "CUFF.3276.1"; tss_id "TSS3439"; +chr16 Cufflinks exon 3232635 3232706 . - . gene_id "XLOC_003440"; transcript_id "TCONS_00003440"; exon_number "1"; oId "CUFF.3277.1"; tss_id "TSS3440"; +chr16 Cufflinks exon 3234131 3234204 . - . gene_id "XLOC_003441"; transcript_id "TCONS_00003441"; exon_number "1"; oId "CUFF.3278.1"; tss_id "TSS3441"; +chr16 Cufflinks exon 3420908 3420981 . - . gene_id "XLOC_003442"; transcript_id "TCONS_00003442"; exon_number "1"; oId "CUFF.3288.1"; tss_id "TSS3442"; +chr16 Cufflinks exon 3684835 3685119 . - . gene_id "XLOC_003443"; transcript_id "TCONS_00003443"; exon_number "1"; oId "CUFF.3289.1"; tss_id "TSS3443"; +chr16 Cufflinks exon 3800170 3800238 . - . gene_id "XLOC_003444"; transcript_id "TCONS_00003444"; exon_number "1"; oId "CUFF.3290.1"; tss_id "TSS3444"; +chr16 Cufflinks exon 3804271 3804356 . - . gene_id "XLOC_003445"; transcript_id "TCONS_00003445"; exon_number "1"; oId "CUFF.3291.1"; tss_id "TSS3445"; +chr16 Cufflinks exon 7054009 7054113 . - . gene_id "XLOC_003446"; transcript_id "TCONS_00003446"; exon_number "1"; oId "CUFF.3295.1"; tss_id "TSS3446"; +chr16 Cufflinks exon 8799314 8799373 . - . gene_id "XLOC_003447"; transcript_id "TCONS_00003447"; exon_number "1"; oId "CUFF.3297.1"; tss_id "TSS3447"; +chr16 Cufflinks exon 9658266 9658354 . - . gene_id "XLOC_003448"; transcript_id "TCONS_00003448"; exon_number "1"; oId "CUFF.3300.1"; tss_id "TSS3448"; +chr16 Cufflinks exon 10315613 10315930 . - . gene_id "XLOC_003449"; transcript_id "TCONS_00003449"; exon_number "1"; oId "CUFF.3303.1"; tss_id "TSS3449"; +chr16 Cufflinks exon 11658436 11658523 . - . gene_id "XLOC_003450"; transcript_id "TCONS_00003450"; exon_number "1"; oId "CUFF.3309.1"; tss_id "TSS3450"; +chr16 Cufflinks exon 13158241 13158276 . - . gene_id "XLOC_003451"; transcript_id "TCONS_00003451"; exon_number "1"; oId "CUFF.3310.1"; tss_id "TSS3451"; +chr16 Cufflinks exon 13791443 13791509 . - . gene_id "XLOC_003452"; transcript_id "TCONS_00003452"; exon_number "1"; oId "CUFF.3311.1"; tss_id "TSS3452"; +chr16 Cufflinks exon 14298241 14298280 . - . gene_id "XLOC_003453"; transcript_id "TCONS_00003453"; exon_number "1"; oId "CUFF.3312.1"; tss_id "TSS3453"; +chr16 Cufflinks exon 14731234 14731265 . - . gene_id "XLOC_003454"; transcript_id "TCONS_00003454"; exon_number "1"; oId "CUFF.3314.1"; tss_id "TSS3454"; +chr16 Cufflinks exon 14929244 14929273 . - . gene_id "XLOC_003455"; transcript_id "TCONS_00003455"; exon_number "1"; oId "CUFF.3317.1"; tss_id "TSS3455"; +chr16 Cufflinks exon 15971020 15971123 . - . gene_id "XLOC_003456"; transcript_id "TCONS_00003456"; exon_number "1"; oId "CUFF.3319.1"; tss_id "TSS3456"; +chr16 Cufflinks exon 16218051 16218082 . - . gene_id "XLOC_003457"; transcript_id "TCONS_00003457"; exon_number "1"; oId "CUFF.3320.1"; tss_id "TSS3457"; +chr16 Cufflinks exon 17258196 17258245 . - . gene_id "XLOC_003458"; transcript_id "TCONS_00003458"; exon_number "1"; oId "CUFF.3322.1"; tss_id "TSS3458"; +chr16 Cufflinks exon 18103586 18103627 . - . gene_id "XLOC_003459"; transcript_id "TCONS_00003459"; exon_number "1"; oId "CUFF.3323.1"; tss_id "TSS3459"; +chr16 Cufflinks exon 18696667 18696727 . - . gene_id "XLOC_003460"; transcript_id "TCONS_00003460"; exon_number "1"; oId "CUFF.3325.1"; tss_id "TSS3460"; +chr16 Cufflinks exon 18881485 18881592 . - . gene_id "XLOC_003461"; transcript_id "TCONS_00003461"; exon_number "1"; oId "CUFF.3326.1"; tss_id "TSS3461"; +chr16 Cufflinks exon 20183564 20183613 . - . gene_id "XLOC_003462"; transcript_id "TCONS_00003462"; exon_number "1"; oId "CUFF.3331.1"; tss_id "TSS3462"; +chr16 Cufflinks exon 21049821 21049862 . - . gene_id "XLOC_003463"; transcript_id "TCONS_00003463"; exon_number "1"; oId "CUFF.3333.1"; tss_id "TSS3463"; +chr16 Cufflinks exon 21074329 21074369 . - . gene_id "XLOC_003464"; transcript_id "TCONS_00003464"; exon_number "1"; oId "CUFF.3334.1"; tss_id "TSS3464"; +chr16 Cufflinks exon 21468644 21468751 . - . gene_id "XLOC_003465"; transcript_id "TCONS_00003465"; exon_number "1"; oId "CUFF.3335.1"; tss_id "TSS3465"; +chr16 Cufflinks exon 21900885 21900992 . - . gene_id "XLOC_003466"; transcript_id "TCONS_00003466"; exon_number "1"; oId "CUFF.3339.1"; tss_id "TSS3466"; +chr16 Cufflinks exon 22207031 22207113 . - . gene_id "XLOC_003467"; transcript_id "TCONS_00003467"; exon_number "1"; oId "CUFF.3341.1"; tss_id "TSS3467"; +chr16 Cufflinks exon 22331521 22331574 . - . gene_id "XLOC_003468"; transcript_id "TCONS_00003468"; exon_number "1"; oId "CUFF.3343.1"; tss_id "TSS3468"; +chr16 Cufflinks exon 22373882 22373925 . - . gene_id "XLOC_003469"; transcript_id "TCONS_00003469"; exon_number "1"; oId "CUFF.3344.1"; tss_id "TSS3469"; +chr16 Cufflinks exon 23236839 23236873 . - . gene_id "XLOC_003470"; transcript_id "TCONS_00003470"; exon_number "1"; oId "CUFF.3347.1"; tss_id "TSS3470"; +chr16 Cufflinks exon 23424978 23425131 . - . gene_id "XLOC_003471"; transcript_id "TCONS_00003471"; exon_number "1"; oId "CUFF.3348.1"; tss_id "TSS3471"; +chr16 Cufflinks exon 23666305 23666340 . - . gene_id "XLOC_003472"; transcript_id "TCONS_00003472"; exon_number "1"; oId "CUFF.3350.1"; tss_id "TSS3472"; +chr16 Cufflinks exon 23761262 23761349 . - . gene_id "XLOC_003473"; transcript_id "TCONS_00003473"; exon_number "1"; oId "CUFF.3351.1"; tss_id "TSS3473"; +chr16 Cufflinks exon 24376595 24376655 . - . gene_id "XLOC_003474"; transcript_id "TCONS_00003474"; exon_number "1"; oId "CUFF.3352.1"; tss_id "TSS3474"; +chr16 Cufflinks exon 24411378 24411437 . - . gene_id "XLOC_003475"; transcript_id "TCONS_00003475"; exon_number "1"; oId "CUFF.3353.1"; tss_id "TSS3475"; +chr16 Cufflinks exon 27909914 27909949 . - . gene_id "XLOC_003476"; transcript_id "TCONS_00003476"; exon_number "1"; oId "CUFF.3358.1"; tss_id "TSS3476"; +chr16 Cufflinks exon 28009616 28009722 . - . gene_id "XLOC_003477"; transcript_id "TCONS_00003477"; exon_number "1"; oId "CUFF.3359.1"; tss_id "TSS3477"; +chr16 Cufflinks exon 28683551 28683657 . - . gene_id "XLOC_003478"; transcript_id "TCONS_00003478"; exon_number "1"; oId "CUFF.3362.1"; tss_id "TSS3478"; +chr16 Cufflinks exon 28797728 28797834 . - . gene_id "XLOC_003479"; transcript_id "TCONS_00003479"; exon_number "1"; oId "CUFF.3363.1"; tss_id "TSS3479"; +chr16 Cufflinks exon 28853517 28853607 . - . gene_id "XLOC_003480"; transcript_id "TCONS_00003480"; exon_number "1"; oId "CUFF.3364.1"; tss_id "TSS3480"; +chr16 Cufflinks exon 29039067 29039160 . - . gene_id "XLOC_003481"; transcript_id "TCONS_00003481"; exon_number "1"; oId "CUFF.3365.1"; tss_id "TSS3481"; +chr16 Cufflinks exon 29077573 29077679 . - . gene_id "XLOC_003482"; transcript_id "TCONS_00003482"; exon_number "1"; oId "CUFF.3366.1"; tss_id "TSS3482"; +chr16 Cufflinks exon 29121986 29122033 . - . gene_id "XLOC_003483"; transcript_id "TCONS_00003483"; exon_number "1"; oId "CUFF.3367.1"; tss_id "TSS3483"; +chr16 Cufflinks exon 29175225 29175273 . - . gene_id "XLOC_003484"; transcript_id "TCONS_00003484"; exon_number "1"; oId "CUFF.3369.1"; tss_id "TSS3484"; +chr16 Cufflinks exon 29448815 29448922 . - . gene_id "XLOC_003485"; transcript_id "TCONS_00003485"; exon_number "1"; oId "CUFF.3371.1"; tss_id "TSS3485"; +chr16 Cufflinks exon 29550580 29550687 . - . gene_id "XLOC_003486"; transcript_id "TCONS_00003486"; exon_number "1"; oId "CUFF.3372.1"; tss_id "TSS3486"; +chr16 Cufflinks exon 29742489 29742725 . - . gene_id "XLOC_003487"; transcript_id "TCONS_00003487"; exon_number "1"; oId "CUFF.3373.1"; tss_id "TSS3487"; +chr16 Cufflinks exon 29941277 29941461 . - . gene_id "XLOC_003488"; transcript_id "TCONS_00003488"; exon_number "1"; oId "CUFF.3374.1"; tss_id "TSS3488"; +chr16 Cufflinks exon 30290566 30290673 . - . gene_id "XLOC_003489"; transcript_id "TCONS_00003489"; exon_number "1"; oId "CUFF.3375.1"; tss_id "TSS3489"; +chr16 Cufflinks exon 30494469 30494515 . - . gene_id "XLOC_003490"; transcript_id "TCONS_00003490"; exon_number "1"; oId "CUFF.3376.1"; tss_id "TSS3490"; +chr16 Cufflinks exon 30686634 30686703 . - . gene_id "XLOC_003491"; transcript_id "TCONS_00003491"; exon_number "1"; oId "CUFF.3377.1"; tss_id "TSS3491"; +chr16 Cufflinks exon 30712678 30712755 . - . gene_id "XLOC_003492"; transcript_id "TCONS_00003492"; exon_number "1"; oId "CUFF.3379.1"; tss_id "TSS3492"; +chr16 Cufflinks exon 33392131 33392171 . - . gene_id "XLOC_003493"; transcript_id "TCONS_00003493"; exon_number "1"; oId "CUFF.3380.1"; tss_id "TSS3493"; +chr16 Cufflinks exon 33563199 33563255 . - . gene_id "XLOC_003494"; transcript_id "TCONS_00003494"; exon_number "1"; oId "CUFF.3382.1"; tss_id "TSS3494"; +chr16 Cufflinks exon 34361226 34361263 . - . gene_id "XLOC_003495"; transcript_id "TCONS_00003495"; exon_number "1"; oId "CUFF.3384.1"; tss_id "TSS3495"; +chr16 Cufflinks exon 46590002 46590103 . - . gene_id "XLOC_003496"; transcript_id "TCONS_00003496"; exon_number "1"; oId "CUFF.3432.1"; tss_id "TSS3496"; +chr16 Cufflinks exon 47154827 47154928 . - . gene_id "XLOC_003497"; transcript_id "TCONS_00003497"; exon_number "1"; oId "CUFF.3433.1"; tss_id "TSS3497"; +chr16 Cufflinks exon 47453060 47453137 . - . gene_id "XLOC_003498"; transcript_id "TCONS_00003498"; exon_number "1"; oId "CUFF.3434.1"; tss_id "TSS3498"; +chr16 Cufflinks exon 47484277 47484372 . - . gene_id "XLOC_003499"; transcript_id "TCONS_00003499"; exon_number "1"; oId "CUFF.3435.1"; tss_id "TSS3499"; +chr16 Cufflinks exon 48526310 48526413 . - . gene_id "XLOC_003500"; transcript_id "TCONS_00003500"; exon_number "1"; oId "CUFF.3439.1"; tss_id "TSS3500"; +chr16 Cufflinks exon 48667165 48667250 . - . gene_id "XLOC_003501"; transcript_id "TCONS_00003501"; exon_number "1"; oId "CUFF.3440.1"; tss_id "TSS3501"; +chr16 Cufflinks exon 48692290 48692392 . - . gene_id "XLOC_003502"; transcript_id "TCONS_00003502"; exon_number "1"; oId "CUFF.3441.1"; tss_id "TSS3502"; +chr16 Cufflinks exon 48765615 48765708 . - . gene_id "XLOC_003503"; transcript_id "TCONS_00003503"; exon_number "1"; oId "CUFF.3442.1"; tss_id "TSS3503"; +chr16 Cufflinks exon 48903017 48903054 . - . gene_id "XLOC_003504"; transcript_id "TCONS_00003504"; exon_number "1"; oId "CUFF.3443.1"; tss_id "TSS3504"; +chr16 Cufflinks exon 48934359 48934400 . - . gene_id "XLOC_003505"; transcript_id "TCONS_00003505"; exon_number "1"; oId "CUFF.3444.1"; tss_id "TSS3505"; +chr16 Cufflinks exon 49072804 49072839 . - . gene_id "XLOC_003506"; transcript_id "TCONS_00003506"; exon_number "1"; oId "CUFF.3445.1"; tss_id "TSS3506"; +chr16 Cufflinks exon 50159791 50159852 . - . gene_id "XLOC_003507"; transcript_id "TCONS_00003507"; exon_number "1"; oId "CUFF.3446.1"; tss_id "TSS3507"; +chr16 Cufflinks exon 50386097 50386204 . - . gene_id "XLOC_003508"; transcript_id "TCONS_00003508"; exon_number "1"; oId "CUFF.3447.1"; tss_id "TSS3508"; +chr16 Cufflinks exon 50394694 50394884 . - . gene_id "XLOC_003509"; transcript_id "TCONS_00003509"; exon_number "1"; oId "CUFF.3448.1"; tss_id "TSS3509"; +chr16 Cufflinks exon 50903365 50903478 . - . gene_id "XLOC_003510"; transcript_id "TCONS_00003510"; exon_number "1"; oId "CUFF.3449.1"; tss_id "TSS3510"; +chr16 Cufflinks exon 51705233 51705474 . - . gene_id "XLOC_003511"; transcript_id "TCONS_00003511"; exon_number "1"; oId "CUFF.3450.1"; tss_id "TSS3511"; +chr16 Cufflinks exon 52570698 52570746 . - . gene_id "XLOC_003512"; transcript_id "TCONS_00003512"; exon_number "1"; oId "CUFF.3451.1"; tss_id "TSS3512"; +chr16 Cufflinks exon 53477178 53477244 . - . gene_id "XLOC_003513"; transcript_id "TCONS_00003513"; exon_number "1"; oId "CUFF.3455.1"; tss_id "TSS3513"; +chr16 Cufflinks exon 53675472 53675508 . - . gene_id "XLOC_003514"; transcript_id "TCONS_00003514"; exon_number "1"; oId "CUFF.3456.1"; tss_id "TSS3514"; +chr16 Cufflinks exon 55061615 55061656 . - . gene_id "XLOC_003515"; transcript_id "TCONS_00003515"; exon_number "1"; oId "CUFF.3457.1"; tss_id "TSS3515"; +chr16 Cufflinks exon 55325283 55325585 . - . gene_id "XLOC_003516"; transcript_id "TCONS_00003516"; exon_number "1"; oId "CUFF.3458.1"; tss_id "TSS3516"; +chr16 Cufflinks exon 55871466 55871650 . - . gene_id "XLOC_003517"; transcript_id "TCONS_00003517"; exon_number "1"; oId "CUFF.3461.1"; tss_id "TSS3517"; +chr16 Cufflinks exon 56230954 56230986 . - . gene_id "XLOC_003518"; transcript_id "TCONS_00003518"; exon_number "1"; oId "CUFF.3463.1"; tss_id "TSS3518"; +chr16 Cufflinks exon 56740761 56740806 . - . gene_id "XLOC_003519"; transcript_id "TCONS_00003519"; exon_number "1"; oId "CUFF.3465.1"; tss_id "TSS3519"; +chr16 Cufflinks exon 56746291 56746331 . - . gene_id "XLOC_003520"; transcript_id "TCONS_00003520"; exon_number "1"; oId "CUFF.3466.1"; tss_id "TSS3520"; +chr16 Cufflinks exon 56980399 56980469 . - . gene_id "XLOC_003521"; transcript_id "TCONS_00003521"; exon_number "1"; oId "CUFF.3467.1"; tss_id "TSS3521"; +chr16 Cufflinks exon 57201727 57201766 . - . gene_id "XLOC_003522"; transcript_id "TCONS_00003522"; exon_number "1"; oId "CUFF.3468.1"; tss_id "TSS3522"; +chr16 Cufflinks exon 57334392 57334474 . - . gene_id "XLOC_003523"; transcript_id "TCONS_00003523"; exon_number "1"; oId "CUFF.3470.1"; tss_id "TSS3523"; +chr16 Cufflinks exon 57839544 57839585 . - . gene_id "XLOC_003524"; transcript_id "TCONS_00003524"; exon_number "1"; oId "CUFF.3471.1"; tss_id "TSS3524"; +chr16 Cufflinks exon 57864440 57864546 . - . gene_id "XLOC_003525"; transcript_id "TCONS_00003525"; exon_number "1"; oId "CUFF.3472.1"; tss_id "TSS3525"; +chr16 Cufflinks exon 58201282 58201322 . - . gene_id "XLOC_003526"; transcript_id "TCONS_00003526"; exon_number "1"; oId "CUFF.3473.1"; tss_id "TSS3526"; +chr16 Cufflinks exon 58233465 58233733 . - . gene_id "XLOC_003527"; transcript_id "TCONS_00003527"; exon_number "1"; oId "CUFF.3474.1"; tss_id "TSS3527"; +chr16 Cufflinks exon 58411956 58412052 . - . gene_id "XLOC_003528"; transcript_id "TCONS_00003528"; exon_number "1"; oId "CUFF.3475.1"; tss_id "TSS3528"; +chr16 Cufflinks exon 58418346 58418445 . - . gene_id "XLOC_003529"; transcript_id "TCONS_00003529"; exon_number "1"; oId "CUFF.3477.1"; tss_id "TSS3529"; +chr16 Cufflinks exon 58778156 58778261 . - . gene_id "XLOC_003530"; transcript_id "TCONS_00003530"; exon_number "1"; oId "CUFF.3480.1"; tss_id "TSS3530"; +chr16 Cufflinks exon 60095840 60095907 . - . gene_id "XLOC_003531"; transcript_id "TCONS_00003531"; exon_number "1"; oId "CUFF.3486.1"; tss_id "TSS3531"; +chr16 Cufflinks exon 60257819 60257887 . - . gene_id "XLOC_003532"; transcript_id "TCONS_00003532"; exon_number "1"; oId "CUFF.3487.1"; tss_id "TSS3532"; +chr16 Cufflinks exon 60668141 60668212 . - . gene_id "XLOC_003533"; transcript_id "TCONS_00003533"; exon_number "1"; oId "CUFF.3488.1"; tss_id "TSS3533"; +chr16 Cufflinks exon 60677020 60677053 . - . gene_id "XLOC_003534"; transcript_id "TCONS_00003534"; exon_number "1"; oId "CUFF.3489.1"; tss_id "TSS3534"; +chr16 Cufflinks exon 61487936 61487970 . - . gene_id "XLOC_003535"; transcript_id "TCONS_00003535"; exon_number "1"; oId "CUFF.3490.1"; tss_id "TSS3535"; +chr16 Cufflinks exon 61777058 61777380 . - . gene_id "XLOC_003536"; transcript_id "TCONS_00003536"; exon_number "1"; oId "CUFF.3491.1"; tss_id "TSS3536"; +chr16 Cufflinks exon 62221444 62221550 . - . gene_id "XLOC_003537"; transcript_id "TCONS_00003537"; exon_number "1"; oId "CUFF.3492.1"; tss_id "TSS3537"; +chr16 Cufflinks exon 62361763 62361795 . - . gene_id "XLOC_003538"; transcript_id "TCONS_00003538"; exon_number "1"; oId "CUFF.3493.1"; tss_id "TSS3538"; +chr16 Cufflinks exon 63044617 63044655 . - . gene_id "XLOC_003539"; transcript_id "TCONS_00003539"; exon_number "1"; oId "CUFF.3495.1"; tss_id "TSS3539"; +chr16 Cufflinks exon 63461993 63462024 . - . gene_id "XLOC_003540"; transcript_id "TCONS_00003540"; exon_number "1"; oId "CUFF.3496.1"; tss_id "TSS3540"; +chr16 Cufflinks exon 64091240 64091275 . - . gene_id "XLOC_003541"; transcript_id "TCONS_00003541"; exon_number "1"; oId "CUFF.3497.1"; tss_id "TSS3541"; +chr16 Cufflinks exon 65097450 65097489 . - . gene_id "XLOC_003542"; transcript_id "TCONS_00003542"; exon_number "1"; oId "CUFF.3500.1"; tss_id "TSS3542"; +chr16 Cufflinks exon 67355565 67355890 . - . gene_id "XLOC_003543"; transcript_id "TCONS_00003543"; exon_number "1"; oId "CUFF.3505.1"; tss_id "TSS3543"; +chr16 Cufflinks exon 67424584 67424738 . - . gene_id "XLOC_003544"; transcript_id "TCONS_00003544"; exon_number "1"; oId "CUFF.3506.1"; tss_id "TSS3544"; +chr16 Cufflinks exon 68051615 68051719 . - . gene_id "XLOC_003545"; transcript_id "TCONS_00003545"; exon_number "1"; oId "CUFF.3510.1"; tss_id "TSS3545"; +chr16 Cufflinks exon 68318157 68318221 . - . gene_id "XLOC_003546"; transcript_id "TCONS_00003546"; exon_number "1"; oId "CUFF.3511.1"; tss_id "TSS3546"; +chr16 Cufflinks exon 68347144 68347243 . - . gene_id "XLOC_003547"; transcript_id "TCONS_00003547"; exon_number "1"; oId "CUFF.3512.1"; tss_id "TSS3547"; +chr16 Cufflinks exon 68360983 68361020 . - . gene_id "XLOC_003548"; transcript_id "TCONS_00003548"; exon_number "1"; oId "CUFF.3513.1"; tss_id "TSS3548"; +chr16 Cufflinks exon 68363366 68363432 . - . gene_id "XLOC_003549"; transcript_id "TCONS_00003549"; exon_number "1"; oId "CUFF.3514.1"; tss_id "TSS3549"; +chr16 Cufflinks exon 68960800 68960859 . - . gene_id "XLOC_003550"; transcript_id "TCONS_00003550"; exon_number "1"; oId "CUFF.3517.1"; tss_id "TSS3550"; +chr16 Cufflinks exon 68971729 68971767 . - . gene_id "XLOC_003551"; transcript_id "TCONS_00003551"; exon_number "1"; oId "CUFF.3518.1"; tss_id "TSS3551"; +chr16 Cufflinks exon 69040958 69041058 . - . gene_id "XLOC_003552"; transcript_id "TCONS_00003552"; exon_number "1"; oId "CUFF.3519.1"; tss_id "TSS3552"; +chr16 Cufflinks exon 69209574 69209680 . - . gene_id "XLOC_003553"; transcript_id "TCONS_00003553"; exon_number "1"; oId "CUFF.3521.1"; tss_id "TSS3553"; +chr16 Cufflinks exon 69742472 69742579 . - . gene_id "XLOC_003554"; transcript_id "TCONS_00003554"; exon_number "1"; oId "CUFF.3526.1"; tss_id "TSS3554"; +chr16 Cufflinks exon 70266879 70266986 . - . gene_id "XLOC_003555"; transcript_id "TCONS_00003555"; exon_number "1"; oId "CUFF.3527.1"; tss_id "TSS3555"; +chr16 Cufflinks exon 70392380 70392432 . - . gene_id "XLOC_003556"; transcript_id "TCONS_00003556"; exon_number "1"; oId "CUFF.3528.1"; tss_id "TSS3556"; +chr16 Cufflinks exon 70479199 70479302 . - . gene_id "XLOC_003557"; transcript_id "TCONS_00003557"; exon_number "1"; oId "CUFF.3529.1"; tss_id "TSS3557"; +chr16 Cufflinks exon 70812114 70812184 . - . gene_id "XLOC_003558"; transcript_id "TCONS_00003558"; exon_number "1"; oId "CUFF.3531.1"; tss_id "TSS3558"; +chr16 Cufflinks exon 70812939 70813012 . - . gene_id "XLOC_003559"; transcript_id "TCONS_00003559"; exon_number "1"; oId "CUFF.3532.1"; tss_id "TSS3559"; +chr16 Cufflinks exon 71546868 71546912 . - . gene_id "XLOC_003560"; transcript_id "TCONS_00003560"; exon_number "1"; oId "CUFF.3536.1"; tss_id "TSS3560"; +chr16 Cufflinks exon 71597373 71597431 . - . gene_id "XLOC_003561"; transcript_id "TCONS_00003561"; exon_number "1"; oId "CUFF.3537.1"; tss_id "TSS3561"; +chr16 Cufflinks exon 72066968 72067036 . - . gene_id "XLOC_003562"; transcript_id "TCONS_00003562"; exon_number "1"; oId "CUFF.3539.1"; tss_id "TSS3562"; +chr16 Cufflinks exon 72855834 72855890 . - . gene_id "XLOC_003563"; transcript_id "TCONS_00003563"; exon_number "1"; oId "CUFF.3544.1"; tss_id "TSS3563"; +chr16 Cufflinks exon 73512217 73512288 . - . gene_id "XLOC_003564"; transcript_id "TCONS_00003564"; exon_number "1"; oId "CUFF.3548.1"; tss_id "TSS3564"; +chr16 Cufflinks exon 73737988 73738029 . - . gene_id "XLOC_003565"; transcript_id "TCONS_00003565"; exon_number "1"; oId "CUFF.3549.1"; tss_id "TSS3565"; +chr16 Cufflinks exon 74559272 74559336 . - . gene_id "XLOC_003566"; transcript_id "TCONS_00003566"; exon_number "1"; oId "CUFF.3551.1"; tss_id "TSS3566"; +chr16 Cufflinks exon 74803428 74803475 . - . gene_id "XLOC_003567"; transcript_id "TCONS_00003567"; exon_number "1"; oId "CUFF.3552.1"; tss_id "TSS3567"; +chr16 Cufflinks exon 74880688 74880722 . - . gene_id "XLOC_003568"; transcript_id "TCONS_00003568"; exon_number "1"; oId "CUFF.3553.1"; tss_id "TSS3568"; +chr16 Cufflinks exon 75019810 75019852 . - . gene_id "XLOC_003569"; transcript_id "TCONS_00003569"; exon_number "1"; oId "CUFF.3554.1"; tss_id "TSS3569"; +chr16 Cufflinks exon 75320260 75320292 . - . gene_id "XLOC_003570"; transcript_id "TCONS_00003570"; exon_number "1"; oId "CUFF.3555.1"; tss_id "TSS3570"; +chr16 Cufflinks exon 75320643 75320735 . - . gene_id "XLOC_003571"; transcript_id "TCONS_00003571"; exon_number "1"; oId "CUFF.3556.1"; tss_id "TSS3571"; +chr16 Cufflinks exon 75732413 75732724 . - . gene_id "XLOC_003572"; transcript_id "TCONS_00003572"; exon_number "1"; oId "CUFF.3559.1"; tss_id "TSS3572"; +chr16 Cufflinks exon 75894944 75895055 . - . gene_id "XLOC_003573"; transcript_id "TCONS_00003573"; exon_number "1"; oId "CUFF.3560.1"; tss_id "TSS3573"; +chr16 Cufflinks exon 76778888 76778923 . - . gene_id "XLOC_003574"; transcript_id "TCONS_00003574"; exon_number "1"; oId "CUFF.3562.1"; tss_id "TSS3574"; +chr16 Cufflinks exon 78028930 78028992 . - . gene_id "XLOC_003575"; transcript_id "TCONS_00003575"; exon_number "1"; oId "CUFF.3564.1"; tss_id "TSS3575"; +chr16 Cufflinks exon 79287400 79287432 . - . gene_id "XLOC_003576"; transcript_id "TCONS_00003576"; exon_number "1"; oId "CUFF.3565.1"; tss_id "TSS3576"; +chr16 Cufflinks exon 81901993 81902316 . - . gene_id "XLOC_003577"; transcript_id "TCONS_00003577"; exon_number "1"; oId "CUFF.3569.1"; tss_id "TSS3577"; +chr16 Cufflinks exon 82226189 82226411 . - . gene_id "XLOC_003578"; transcript_id "TCONS_00003578"; exon_number "1"; oId "CUFF.3571.1"; tss_id "TSS3578"; +chr16 Cufflinks exon 82985901 82985969 . - . gene_id "XLOC_003579"; transcript_id "TCONS_00003579"; exon_number "1"; oId "CUFF.3573.1"; tss_id "TSS3579"; +chr16 Cufflinks exon 83811522 83811588 . - . gene_id "XLOC_003580"; transcript_id "TCONS_00003580"; exon_number "1"; oId "CUFF.3574.1"; tss_id "TSS3580"; +chr16 Cufflinks exon 84073551 84073641 . - . gene_id "XLOC_003581"; transcript_id "TCONS_00003581"; exon_number "1"; oId "CUFF.3575.1"; tss_id "TSS3581"; +chr16 Cufflinks exon 84296443 84296534 . - . gene_id "XLOC_003582"; transcript_id "TCONS_00003582"; exon_number "1"; oId "CUFF.3576.1"; tss_id "TSS3582"; +chr16 Cufflinks exon 84594922 84595075 . - . gene_id "XLOC_003583"; transcript_id "TCONS_00003583"; exon_number "1"; oId "CUFF.3577.1"; tss_id "TSS3583"; +chr16 Cufflinks exon 85815391 85815504 . - . gene_id "XLOC_003584"; transcript_id "TCONS_00003584"; exon_number "1"; oId "CUFF.3580.1"; tss_id "TSS3584"; +chr16 Cufflinks exon 87395908 87396061 . - . gene_id "XLOC_003585"; transcript_id "TCONS_00003585"; exon_number "1"; oId "CUFF.3582.1"; tss_id "TSS3585"; +chr16 Cufflinks exon 87417628 87417700 . - . gene_id "XLOC_003586"; transcript_id "TCONS_00003586"; exon_number "1"; oId "CUFF.3583.1"; tss_id "TSS3586"; +chr16 Cufflinks exon 88012246 88012293 . - . gene_id "XLOC_003587"; transcript_id "TCONS_00003587"; exon_number "1"; oId "CUFF.3584.1"; tss_id "TSS3587"; +chr16 Cufflinks exon 88159258 88159305 . - . gene_id "XLOC_003588"; transcript_id "TCONS_00003588"; exon_number "1"; oId "CUFF.3586.1"; tss_id "TSS3588"; +chr16 Cufflinks exon 89452272 89452449 . - . gene_id "XLOC_003589"; transcript_id "TCONS_00003589"; exon_number "1"; oId "CUFF.3587.1"; tss_id "TSS3589"; +chr16 Cufflinks exon 89599901 89599961 . - . gene_id "XLOC_003590"; transcript_id "TCONS_00003590"; exon_number "1"; oId "CUFF.3589.1"; tss_id "TSS3590"; +chr17 Cufflinks exon 425652 425699 . + . gene_id "XLOC_003591"; transcript_id "TCONS_00003591"; exon_number "1"; oId "CUFF.3591.1"; tss_id "TSS3591"; +chr17 Cufflinks exon 647332 647405 . + . gene_id "XLOC_003592"; transcript_id "TCONS_00003592"; exon_number "1"; oId "CUFF.3592.1"; tss_id "TSS3592"; +chr17 Cufflinks exon 1290436 1290482 . + . gene_id "XLOC_003593"; transcript_id "TCONS_00003593"; exon_number "1"; oId "CUFF.3594.1"; tss_id "TSS3593"; +chr17 Cufflinks exon 1448903 1448940 . + . gene_id "XLOC_003594"; transcript_id "TCONS_00003594"; exon_number "1"; oId "CUFF.3595.1"; tss_id "TSS3594"; +chr17 Cufflinks exon 2092239 2092280 . + . gene_id "XLOC_003595"; transcript_id "TCONS_00003595"; exon_number "1"; oId "CUFF.3599.1"; tss_id "TSS3595"; +chr17 Cufflinks exon 2558972 2559079 . + . gene_id "XLOC_003596"; transcript_id "TCONS_00003596"; exon_number "1"; oId "CUFF.3604.1"; tss_id "TSS3596"; +chr17 Cufflinks exon 2584250 2584546 . + . gene_id "XLOC_003597"; transcript_id "TCONS_00003597"; exon_number "1"; oId "CUFF.3605.1"; tss_id "TSS3597"; +chr17 Cufflinks exon 3228991 3229025 . + . gene_id "XLOC_003598"; transcript_id "TCONS_00003598"; exon_number "1"; oId "CUFF.3606.1"; tss_id "TSS3598"; +chr17 Cufflinks exon 3492299 3492376 . + . gene_id "XLOC_003599"; transcript_id "TCONS_00003599"; exon_number "1"; oId "CUFF.3607.1"; tss_id "TSS3599"; +chr17 Cufflinks exon 4017901 4018002 . + . gene_id "XLOC_003600"; transcript_id "TCONS_00003600"; exon_number "1"; oId "CUFF.3609.1"; tss_id "TSS3600"; +chr17 Cufflinks exon 5346371 5346437 . + . gene_id "XLOC_003601"; transcript_id "TCONS_00003601"; exon_number "1"; oId "CUFF.3612.1"; tss_id "TSS3601"; +chr17 Cufflinks exon 6110483 6110584 . + . gene_id "XLOC_003602"; transcript_id "TCONS_00003602"; exon_number "1"; oId "CUFF.3615.1"; tss_id "TSS3602"; +chr17 Cufflinks exon 6694817 6694879 . + . gene_id "XLOC_003603"; transcript_id "TCONS_00003603"; exon_number "1"; oId "CUFF.3617.1"; tss_id "TSS3603"; +chr17 Cufflinks exon 6890784 6890877 . + . gene_id "XLOC_003604"; transcript_id "TCONS_00003604"; exon_number "1"; oId "CUFF.3618.1"; tss_id "TSS3604"; +chr17 Cufflinks exon 7514503 7514576 . + . gene_id "XLOC_003605"; transcript_id "TCONS_00003605"; exon_number "1"; oId "CUFF.3619.1"; tss_id "TSS3605"; +chr17 Cufflinks exon 7524457 7524524 . + . gene_id "XLOC_003606"; transcript_id "TCONS_00003606"; exon_number "1"; oId "CUFF.3620.1"; tss_id "TSS3606"; +chr17 Cufflinks exon 7631666 7631756 . + . gene_id "XLOC_003607"; transcript_id "TCONS_00003607"; exon_number "1"; oId "CUFF.3621.1"; tss_id "TSS3607"; +chr17 Cufflinks exon 8022473 8022548 . + . gene_id "XLOC_003608"; transcript_id "TCONS_00003608"; exon_number "1"; oId "CUFF.3623.1"; tss_id "TSS3608"; +chr17 Cufflinks exon 8023070 8023141 . + . gene_id "XLOC_003609"; transcript_id "TCONS_00003609"; exon_number "1"; oId "CUFF.3624.1"; tss_id "TSS3609"; +chr17 Cufflinks exon 8024243 8024330 . + . gene_id "XLOC_003610"; transcript_id "TCONS_00003610"; exon_number "1"; oId "CUFF.3626.1"; tss_id "TSS3610"; +chr17 Cufflinks exon 8029064 8029135 . + . gene_id "XLOC_003611"; transcript_id "TCONS_00003611"; exon_number "1"; oId "CUFF.3627.1"; tss_id "TSS3611"; +chr17 Cufflinks exon 8089676 8089747 . + . gene_id "XLOC_003612"; transcript_id "TCONS_00003612"; exon_number "1"; oId "CUFF.3631.1"; tss_id "TSS3612"; +chr17 Cufflinks exon 8090184 8090265 . + . gene_id "XLOC_003613"; transcript_id "TCONS_00003613"; exon_number "1"; oId "CUFF.3632.1"; tss_id "TSS3613"; +chr17 Cufflinks exon 8090478 8090553 . + . gene_id "XLOC_003614"; transcript_id "TCONS_00003614"; exon_number "1"; oId "CUFF.3633.1"; tss_id "TSS3614"; +chr17 Cufflinks exon 8090911 8090984 . + . gene_id "XLOC_003615"; transcript_id "TCONS_00003615"; exon_number "1"; oId "CUFF.3634.1"; tss_id "TSS3615"; +chr17 Cufflinks exon 8124866 8124937 . + . gene_id "XLOC_003616"; transcript_id "TCONS_00003616"; exon_number "1"; oId "CUFF.3637.1"; tss_id "TSS3616"; +chr17 Cufflinks exon 8414443 8414503 . + . gene_id "XLOC_003617"; transcript_id "TCONS_00003617"; exon_number "1"; oId "CUFF.3643.1"; tss_id "TSS3617"; +chr17 Cufflinks exon 8460173 8460227 . + . gene_id "XLOC_003618"; transcript_id "TCONS_00003618"; exon_number "1"; oId "CUFF.3645.1"; tss_id "TSS3618"; +chr17 Cufflinks exon 9845156 9845197 . + . gene_id "XLOC_003619"; transcript_id "TCONS_00003619"; exon_number "1"; oId "CUFF.3648.1"; tss_id "TSS3619"; +chr17 Cufflinks exon 11060772 11061055 . + . gene_id "XLOC_003620"; transcript_id "TCONS_00003620"; exon_number "1"; oId "CUFF.3652.1"; tss_id "TSS3620"; +chr17 Cufflinks exon 11191818 11191892 . + . gene_id "XLOC_003621"; transcript_id "TCONS_00003621"; exon_number "1"; oId "CUFF.3653.1"; tss_id "TSS3621"; +chr17 Cufflinks exon 15050430 15050498 . + . gene_id "XLOC_003622"; transcript_id "TCONS_00003622"; exon_number "1"; oId "CUFF.3656.1"; tss_id "TSS3622"; +chr17 Cufflinks exon 15214663 15214770 . + . gene_id "XLOC_003623"; transcript_id "TCONS_00003623"; exon_number "1"; oId "CUFF.3658.1"; tss_id "TSS3623"; +chr17 Cufflinks exon 15311701 15312018 . + . gene_id "XLOC_003624"; transcript_id "TCONS_00003624"; exon_number "1"; oId "CUFF.3659.1"; tss_id "TSS3624"; +chr17 Cufflinks exon 15482360 15482431 . + . gene_id "XLOC_003625"; transcript_id "TCONS_00003625"; exon_number "1"; oId "CUFF.3660.1"; tss_id "TSS3625"; +chr17 Cufflinks exon 15611351 15611391 . + . gene_id "XLOC_003626"; transcript_id "TCONS_00003626"; exon_number "1"; oId "CUFF.3662.1"; tss_id "TSS3626"; +chr17 Cufflinks exon 15685656 15685729 . + . gene_id "XLOC_003627"; transcript_id "TCONS_00003627"; exon_number "1"; oId "CUFF.3663.1"; tss_id "TSS3627"; +chr17 Cufflinks exon 16002018 16002118 . + . gene_id "XLOC_003628"; transcript_id "TCONS_00003628"; exon_number "1"; oId "CUFF.3664.1"; tss_id "TSS3628"; +chr17 Cufflinks exon 16095146 16095483 . + . gene_id "XLOC_003629"; transcript_id "TCONS_00003629"; exon_number "1"; oId "CUFF.3666.1"; tss_id "TSS3629"; +chr17 Cufflinks exon 16314125 16314209 . + . gene_id "XLOC_003630"; transcript_id "TCONS_00003630"; exon_number "1"; oId "CUFF.3667.1"; tss_id "TSS3630"; +chr17 Cufflinks exon 16595111 16595220 . + . gene_id "XLOC_003631"; transcript_id "TCONS_00003631"; exon_number "1"; oId "CUFF.3669.1"; tss_id "TSS3631"; +chr17 Cufflinks exon 16613375 16613696 . + . gene_id "XLOC_003632"; transcript_id "TCONS_00003632"; exon_number "1"; oId "CUFF.3670.1"; tss_id "TSS3632"; +chr17 Cufflinks exon 17073397 17073499 . + . gene_id "XLOC_003633"; transcript_id "TCONS_00003633"; exon_number "1"; oId "CUFF.3673.1"; tss_id "TSS3633"; +chr17 Cufflinks exon 17081741 17081947 . + . gene_id "XLOC_003634"; transcript_id "TCONS_00003634"; exon_number "1"; oId "CUFF.3674.1"; tss_id "TSS3634"; +chr17 Cufflinks exon 17082254 17082343 . + . gene_id "XLOC_003635"; transcript_id "TCONS_00003635"; exon_number "1"; oId "CUFF.3675.1"; tss_id "TSS3635"; +chr17 Cufflinks exon 17481945 17482053 . + . gene_id "XLOC_003636"; transcript_id "TCONS_00003636"; exon_number "1"; oId "CUFF.3676.1"; tss_id "TSS3636"; +chr17 Cufflinks exon 17956243 17956313 . + . gene_id "XLOC_003637"; transcript_id "TCONS_00003637"; exon_number "1"; oId "CUFF.3677.1"; tss_id "TSS3637"; +chr17 Cufflinks exon 18049866 18049955 . + . gene_id "XLOC_003638"; transcript_id "TCONS_00003638"; exon_number "1"; oId "CUFF.3678.1"; tss_id "TSS3638"; +chr17 Cufflinks exon 18743933 18744256 . + . gene_id "XLOC_003639"; transcript_id "TCONS_00003639"; exon_number "1"; oId "CUFF.3681.1"; tss_id "TSS3639"; +chr17 Cufflinks exon 18965225 18965441 . + . gene_id "XLOC_003640"; transcript_id "TCONS_00003640"; exon_number "1"; oId "CUFF.3682.1"; tss_id "TSS3640"; +chr17 Cufflinks exon 19091329 19091545 . + . gene_id "XLOC_003641"; transcript_id "TCONS_00003641"; exon_number "1"; oId "CUFF.3686.1"; tss_id "TSS3641"; +chr17 Cufflinks exon 19214670 19214790 . + . gene_id "XLOC_003642"; transcript_id "TCONS_00003642"; exon_number "1"; oId "CUFF.3688.1"; tss_id "TSS3642"; +chr17 Cufflinks exon 19355539 19356096 . + . gene_id "XLOC_003643"; transcript_id "TCONS_00003643"; exon_number "1"; oId "CUFF.3689.1"; tss_id "TSS3643"; +chr17 Cufflinks exon 19356673 19356850 . + . gene_id "XLOC_003644"; transcript_id "TCONS_00003644"; exon_number "1"; oId "CUFF.3690.1"; tss_id "TSS3644"; +chr17 Cufflinks exon 19356937 19357097 . + . gene_id "XLOC_003645"; transcript_id "TCONS_00003645"; exon_number "1"; oId "CUFF.3691.1"; tss_id "TSS3645"; +chr17 Cufflinks exon 19411494 19411565 . + . gene_id "XLOC_003646"; transcript_id "TCONS_00003646"; exon_number "1"; oId "CUFF.3692.1"; tss_id "TSS3646"; +chr17 Cufflinks exon 19505153 19505193 . + . gene_id "XLOC_003647"; transcript_id "TCONS_00003647"; exon_number "1"; oId "CUFF.3693.1"; tss_id "TSS3647"; +chr17 Cufflinks exon 19505527 19505569 . + . gene_id "XLOC_003648"; transcript_id "TCONS_00003648"; exon_number "1"; oId "CUFF.3694.1"; tss_id "TSS3648"; +chr17 Cufflinks exon 19591171 19591207 . + . gene_id "XLOC_003649"; transcript_id "TCONS_00003649"; exon_number "1"; oId "CUFF.3696.1"; tss_id "TSS3649"; +chr17 Cufflinks exon 19697555 19697592 . + . gene_id "XLOC_003650"; transcript_id "TCONS_00003650"; exon_number "1"; oId "CUFF.3697.1"; tss_id "TSS3650"; +chr17 Cufflinks exon 19751382 19751437 . + . gene_id "XLOC_003651"; transcript_id "TCONS_00003651"; exon_number "1"; oId "CUFF.3698.1"; tss_id "TSS3651"; +chr17 Cufflinks exon 19764175 19764245 . + . gene_id "XLOC_003652"; transcript_id "TCONS_00003652"; exon_number "1"; oId "CUFF.3699.1"; tss_id "TSS3652"; +chr17 Cufflinks exon 19901007 19901089 . + . gene_id "XLOC_003653"; transcript_id "TCONS_00003653"; exon_number "1"; oId "CUFF.3700.1"; tss_id "TSS3653"; +chr17 Cufflinks exon 20193570 20193654 . + . gene_id "XLOC_003654"; transcript_id "TCONS_00003654"; exon_number "1"; oId "CUFF.3703.1"; tss_id "TSS3654"; +chr17 Cufflinks exon 20226313 20226422 . + . gene_id "XLOC_003655"; transcript_id "TCONS_00003655"; exon_number "1"; oId "CUFF.3705.1"; tss_id "TSS3655"; +chr17 Cufflinks exon 20244058 20244379 . + . gene_id "XLOC_003656"; transcript_id "TCONS_00003656"; exon_number "1"; oId "CUFF.3706.1"; tss_id "TSS3656"; +chr17 Cufflinks exon 20675613 20675661 . + . gene_id "XLOC_003657"; transcript_id "TCONS_00003657"; exon_number "1"; oId "CUFF.3708.1"; tss_id "TSS3657"; +chr17 Cufflinks exon 21686128 21686164 . + . gene_id "XLOC_003658"; transcript_id "TCONS_00003658"; exon_number "1"; oId "CUFF.3712.1"; tss_id "TSS3658"; +chr17 Cufflinks exon 21926969 21927003 . + . gene_id "XLOC_003659"; transcript_id "TCONS_00003659"; exon_number "1"; oId "CUFF.3713.1"; tss_id "TSS3659"; +chr17 Cufflinks exon 22023345 22023500 . + . gene_id "XLOC_003660"; transcript_id "TCONS_00003660"; exon_number "1"; oId "CUFF.3714.1"; tss_id "TSS3660"; +chr17 Cufflinks exon 22023985 22024062 . + . gene_id "XLOC_003661"; transcript_id "TCONS_00003661"; exon_number "1"; oId "CUFF.3715.1"; tss_id "TSS3661"; +chr17 Cufflinks exon 26163810 26163869 . + . gene_id "XLOC_003662"; transcript_id "TCONS_00003662"; exon_number "1"; oId "CUFF.3719.1"; tss_id "TSS3662"; +chr17 Cufflinks exon 26300001 26300055 . + . gene_id "XLOC_003663"; transcript_id "TCONS_00003663"; exon_number "1"; oId "CUFF.3720.1"; tss_id "TSS3663"; +chr17 Cufflinks exon 27715578 27715645 . + . gene_id "XLOC_003664"; transcript_id "TCONS_00003664"; exon_number "1"; oId "CUFF.3722.1"; tss_id "TSS3664"; +chr17 Cufflinks exon 27853804 27853857 . + . gene_id "XLOC_003665"; transcript_id "TCONS_00003665"; exon_number "1"; oId "CUFF.3725.1"; tss_id "TSS3665"; +chr17 Cufflinks exon 27870639 27870674 . + . gene_id "XLOC_003666"; transcript_id "TCONS_00003666"; exon_number "1"; oId "CUFF.3726.1"; tss_id "TSS3666"; +chr17 Cufflinks exon 28210024 28210130 . + . gene_id "XLOC_003667"; transcript_id "TCONS_00003667"; exon_number "1"; oId "CUFF.3728.1"; tss_id "TSS3667"; +chr17 Cufflinks exon 28614408 28614441 . + . gene_id "XLOC_003668"; transcript_id "TCONS_00003668"; exon_number "1"; oId "CUFF.3729.1"; tss_id "TSS3668"; +chr17 Cufflinks exon 28687481 28687584 . + . gene_id "XLOC_003669"; transcript_id "TCONS_00003669"; exon_number "1"; oId "CUFF.3731.1"; tss_id "TSS3669"; +chr17 Cufflinks exon 28909258 28909340 . + . gene_id "XLOC_003670"; transcript_id "TCONS_00003670"; exon_number "1"; oId "CUFF.3732.1"; tss_id "TSS3670"; +chr17 Cufflinks exon 28941168 28941259 . + . gene_id "XLOC_003671"; transcript_id "TCONS_00003671"; exon_number "1"; oId "CUFF.3733.1"; tss_id "TSS3671"; +chr17 Cufflinks exon 29188861 29188939 . + . gene_id "XLOC_003672"; transcript_id "TCONS_00003672"; exon_number "1"; oId "CUFF.3736.1"; tss_id "TSS3672"; +chr17 Cufflinks exon 29286586 29286879 . + . gene_id "XLOC_003673"; transcript_id "TCONS_00003673"; exon_number "1"; oId "CUFF.3737.1"; tss_id "TSS3673"; +chr17 Cufflinks exon 29354659 29354729 . + . gene_id "XLOC_003674"; transcript_id "TCONS_00003674"; exon_number "1"; oId "CUFF.3738.1"; tss_id "TSS3674"; +chr17 Cufflinks exon 29606329 29606370 . + . gene_id "XLOC_003675"; transcript_id "TCONS_00003675"; exon_number "1"; oId "CUFF.3740.1"; tss_id "TSS3675"; +chr17 Cufflinks exon 29792561 29792871 . + . gene_id "XLOC_003676"; transcript_id "TCONS_00003676"; exon_number "1"; oId "CUFF.3741.1"; tss_id "TSS3676"; +chr17 Cufflinks exon 29845450 29845765 . + . gene_id "XLOC_003677"; transcript_id "TCONS_00003677"; exon_number "1"; oId "CUFF.3742.1"; tss_id "TSS3677"; +chr17 Cufflinks exon 29877093 29877164 . + . gene_id "XLOC_003678"; transcript_id "TCONS_00003678"; exon_number "1"; oId "CUFF.3743.1"; tss_id "TSS3678"; +chr17 Cufflinks exon 30040782 30040872 . + . gene_id "XLOC_003679"; transcript_id "TCONS_00003679"; exon_number "1"; oId "CUFF.3744.1"; tss_id "TSS3679"; +chr17 Cufflinks exon 30126453 30126650 . + . gene_id "XLOC_003680"; transcript_id "TCONS_00003680"; exon_number "1"; oId "CUFF.3745.1"; tss_id "TSS3680"; +chr17 Cufflinks exon 32820400 32820532 . + . gene_id "XLOC_003681"; transcript_id "TCONS_00003681"; exon_number "1"; oId "CUFF.3751.1"; tss_id "TSS3681"; +chr17 Cufflinks exon 33420928 33420992 . + . gene_id "XLOC_003682"; transcript_id "TCONS_00003682"; exon_number "1"; oId "CUFF.3753.1"; tss_id "TSS3682"; +chr17 Cufflinks exon 34215194 34215252 . + . gene_id "XLOC_003683"; transcript_id "TCONS_00003683"; exon_number "1"; oId "CUFF.3758.1"; tss_id "TSS3683"; +chr17 Cufflinks exon 34215799 34215884 . + . gene_id "XLOC_003684"; transcript_id "TCONS_00003684"; exon_number "1"; oId "CUFF.3759.1"; tss_id "TSS3684"; +chr17 Cufflinks exon 34216619 34216807 . + . gene_id "XLOC_003685"; transcript_id "TCONS_00003685"; exon_number "1"; oId "CUFF.3760.1"; tss_id "TSS3685"; +chr17 Cufflinks exon 34437545 34437861 . + . gene_id "XLOC_003686"; transcript_id "TCONS_00003686"; exon_number "1"; oId "CUFF.3761.1"; tss_id "TSS3686"; +chr17 Cufflinks exon 35038649 35038890 . + . gene_id "XLOC_003687"; transcript_id "TCONS_00003687"; exon_number "1"; oId "CUFF.3765.1"; tss_id "TSS3687"; +chr17 Cufflinks exon 35254753 35254785 . + . gene_id "XLOC_003688"; transcript_id "TCONS_00003688"; exon_number "1"; oId "CUFF.3766.1"; tss_id "TSS3688"; +chr17 Cufflinks exon 36267502 36267607 . + . gene_id "XLOC_003689"; transcript_id "TCONS_00003689"; exon_number "1"; oId "CUFF.3769.1"; tss_id "TSS3689"; +chr17 Cufflinks exon 36874642 36874734 . + . gene_id "XLOC_003690"; transcript_id "TCONS_00003690"; exon_number "1"; oId "CUFF.3771.1"; tss_id "TSS3690"; +chr17 Cufflinks exon 37011097 37011135 . + . gene_id "XLOC_003691"; transcript_id "TCONS_00003691"; exon_number "1"; oId "CUFF.3779.1"; tss_id "TSS3691"; +chr17 Cufflinks exon 37023898 37023970 . + . gene_id "XLOC_003692"; transcript_id "TCONS_00003692"; exon_number "1"; oId "CUFF.3781.1"; tss_id "TSS3692"; +chr17 Cufflinks exon 37769647 37769690 . + . gene_id "XLOC_003693"; transcript_id "TCONS_00003693"; exon_number "1"; oId "CUFF.3788.1"; tss_id "TSS3693"; +chr17 Cufflinks exon 38383642 38383708 . + . gene_id "XLOC_003694"; transcript_id "TCONS_00003694"; exon_number "1"; oId "CUFF.3791.1"; tss_id "TSS3694"; +chr17 Cufflinks exon 38530342 38530409 . + . gene_id "XLOC_003695"; transcript_id "TCONS_00003695"; exon_number "1"; oId "CUFF.3792.1"; tss_id "TSS3695"; +chr17 Cufflinks exon 38738606 38738644 . + . gene_id "XLOC_003696"; transcript_id "TCONS_00003696"; exon_number "1"; oId "CUFF.3793.1"; tss_id "TSS3696"; +chr17 Cufflinks exon 39624208 39624394 . + . gene_id "XLOC_003697"; transcript_id "TCONS_00003697"; exon_number "1"; oId "CUFF.3794.1"; tss_id "TSS3697"; +chr17 Cufflinks exon 39874406 39874495 . + . gene_id "XLOC_003698"; transcript_id "TCONS_00003698"; exon_number "1"; oId "CUFF.3795.1"; tss_id "TSS3698"; +chr17 Cufflinks exon 40155616 40155672 . + . gene_id "XLOC_003699"; transcript_id "TCONS_00003699"; exon_number "1"; oId "CUFF.3797.1"; tss_id "TSS3699"; +chr17 Cufflinks exon 40796218 40796270 . + . gene_id "XLOC_003700"; transcript_id "TCONS_00003700"; exon_number "1"; oId "CUFF.3800.1"; tss_id "TSS3700"; +chr17 Cufflinks exon 41489795 41489898 . + . gene_id "XLOC_003701"; transcript_id "TCONS_00003701"; exon_number "1"; oId "CUFF.3806.1"; tss_id "TSS3701"; +chr17 Cufflinks exon 41522876 41522979 . + . gene_id "XLOC_003702"; transcript_id "TCONS_00003702"; exon_number "1"; oId "CUFF.3807.1"; tss_id "TSS3702"; +chr17 Cufflinks exon 41550953 41551058 . + . gene_id "XLOC_003703"; transcript_id "TCONS_00003703"; exon_number "1"; oId "CUFF.3808.1"; tss_id "TSS3703"; +chr17 Cufflinks exon 42381378 42381571 . + . gene_id "XLOC_003704"; transcript_id "TCONS_00003704"; exon_number "1"; oId "CUFF.3814.1"; tss_id "TSS3704"; +chr17 Cufflinks exon 42384474 42384540 . + . gene_id "XLOC_003705"; transcript_id "TCONS_00003705"; exon_number "1"; oId "CUFF.3815.1"; tss_id "TSS3705"; +chr17 Cufflinks exon 42612551 42612596 . + . gene_id "XLOC_003706"; transcript_id "TCONS_00003706"; exon_number "1"; oId "CUFF.3817.1"; tss_id "TSS3706"; +chr17 Cufflinks exon 42673611 42673649 . + . gene_id "XLOC_003707"; transcript_id "TCONS_00003707"; exon_number "1"; oId "CUFF.3818.1"; tss_id "TSS3707"; +chr17 Cufflinks exon 44017648 44017689 . + . gene_id "XLOC_003708"; transcript_id "TCONS_00003708"; exon_number "1"; oId "CUFF.3825.1"; tss_id "TSS3708"; +chr17 Cufflinks exon 44029381 44029415 . + . gene_id "XLOC_003709"; transcript_id "TCONS_00003709"; exon_number "1"; oId "CUFF.3826.1"; tss_id "TSS3709"; +chr17 Cufflinks exon 44204763 44204811 . + . gene_id "XLOC_003710"; transcript_id "TCONS_00003710"; exon_number "1"; oId "CUFF.3827.1"; tss_id "TSS3710"; +chr17 Cufflinks exon 44306668 44306704 . + . gene_id "XLOC_003711"; transcript_id "TCONS_00003711"; exon_number "1"; oId "CUFF.3828.1"; tss_id "TSS3711"; +chr17 Cufflinks exon 44397049 44397356 . + . gene_id "XLOC_003712"; transcript_id "TCONS_00003712"; exon_number "1"; oId "CUFF.3829.1"; tss_id "TSS3712"; +chr17 Cufflinks exon 44582719 44582760 . + . gene_id "XLOC_003713"; transcript_id "TCONS_00003713"; exon_number "1"; oId "CUFF.3830.1"; tss_id "TSS3713"; +chr17 Cufflinks exon 44614904 44615211 . + . gene_id "XLOC_003714"; transcript_id "TCONS_00003714"; exon_number "1"; oId "CUFF.3831.1"; tss_id "TSS3714"; +chr17 Cufflinks exon 45119195 45119496 . + . gene_id "XLOC_003715"; transcript_id "TCONS_00003715"; exon_number "1"; oId "CUFF.3832.1"; tss_id "TSS3715"; +chr17 Cufflinks exon 45298007 45298083 . + . gene_id "XLOC_003716"; transcript_id "TCONS_00003716"; exon_number "1"; oId "CUFF.3833.1"; tss_id "TSS3716"; +chr17 Cufflinks exon 45736777 45736835 . + . gene_id "XLOC_003717"; transcript_id "TCONS_00003717"; exon_number "1"; oId "CUFF.3836.1"; tss_id "TSS3717"; +chr17 Cufflinks exon 45736961 45737023 . + . gene_id "XLOC_003718"; transcript_id "TCONS_00003718"; exon_number "1"; oId "CUFF.3837.1"; tss_id "TSS3718"; +chr17 Cufflinks exon 45913332 45913364 . + . gene_id "XLOC_003719"; transcript_id "TCONS_00003719"; exon_number "1"; oId "CUFF.3839.1"; tss_id "TSS3719"; +chr17 Cufflinks exon 46850742 46850789 . + . gene_id "XLOC_003720"; transcript_id "TCONS_00003720"; exon_number "1"; oId "CUFF.3844.1"; tss_id "TSS3720"; +chr17 Cufflinks exon 47113714 47113811 . + . gene_id "XLOC_003721"; transcript_id "TCONS_00003721"; exon_number "1"; oId "CUFF.3848.1"; tss_id "TSS3721"; +chr17 Cufflinks exon 47269890 47269962 . + . gene_id "XLOC_003722"; transcript_id "TCONS_00003722"; exon_number "1"; oId "CUFF.3849.1"; tss_id "TSS3722"; +chr17 Cufflinks exon 47692519 47692578 . + . gene_id "XLOC_003723"; transcript_id "TCONS_00003723"; exon_number "1"; oId "CUFF.3851.1"; tss_id "TSS3723"; +chr17 Cufflinks exon 47693434 47693475 . + . gene_id "XLOC_003724"; transcript_id "TCONS_00003724"; exon_number "1"; oId "CUFF.3852.1"; tss_id "TSS3724"; +chr17 Cufflinks exon 50099397 50099426 . + . gene_id "XLOC_003725"; transcript_id "TCONS_00003725"; exon_number "1"; oId "CUFF.3857.1"; tss_id "TSS3725"; +chr17 Cufflinks exon 50979466 50979505 . + . gene_id "XLOC_003726"; transcript_id "TCONS_00003726"; exon_number "1"; oId "CUFF.3858.1"; tss_id "TSS3726"; +chr17 Cufflinks exon 50997397 50997436 . + . gene_id "XLOC_003727"; transcript_id "TCONS_00003727"; exon_number "1"; oId "CUFF.3859.1"; tss_id "TSS3727"; +chr17 Cufflinks exon 52848312 52848586 . + . gene_id "XLOC_003728"; transcript_id "TCONS_00003728"; exon_number "1"; oId "CUFF.3862.1"; tss_id "TSS3728"; +chr17 Cufflinks exon 53056946 53056987 . + . gene_id "XLOC_003729"; transcript_id "TCONS_00003729"; exon_number "1"; oId "CUFF.3863.1"; tss_id "TSS3729"; +chr17 Cufflinks exon 53629171 53629271 . + . gene_id "XLOC_003730"; transcript_id "TCONS_00003730"; exon_number "1"; oId "CUFF.3864.1"; tss_id "TSS3730"; +chr17 Cufflinks exon 54323598 54323637 . + . gene_id "XLOC_003731"; transcript_id "TCONS_00003731"; exon_number "1"; oId "CUFF.3865.1"; tss_id "TSS3731"; +chr17 Cufflinks exon 54916064 54916107 . + . gene_id "XLOC_003732"; transcript_id "TCONS_00003732"; exon_number "1"; oId "CUFF.3866.1"; tss_id "TSS3732"; +chr17 Cufflinks exon 54948531 54948637 . + . gene_id "XLOC_003733"; transcript_id "TCONS_00003733"; exon_number "1"; oId "CUFF.3867.1"; tss_id "TSS3733"; +chr17 Cufflinks exon 55217582 55217656 . + . gene_id "XLOC_003734"; transcript_id "TCONS_00003734"; exon_number "1"; oId "CUFF.3869.1"; tss_id "TSS3734"; +chr17 Cufflinks exon 55313618 55313668 . + . gene_id "XLOC_003735"; transcript_id "TCONS_00003735"; exon_number "1"; oId "CUFF.3870.1"; tss_id "TSS3735"; +chr17 Cufflinks exon 55369203 55369244 . + . gene_id "XLOC_003736"; transcript_id "TCONS_00003736"; exon_number "1"; oId "CUFF.3871.1"; tss_id "TSS3736"; +chr17 Cufflinks exon 55695469 55695781 . + . gene_id "XLOC_003737"; transcript_id "TCONS_00003737"; exon_number "1"; oId "CUFF.3872.1"; tss_id "TSS3737"; +chr17 Cufflinks exon 55866810 55867037 . + . gene_id "XLOC_003738"; transcript_id "TCONS_00003738"; exon_number "1"; oId "CUFF.3874.1"; tss_id "TSS3738"; +chr17 Cufflinks exon 56702062 56702094 . + . gene_id "XLOC_003739"; transcript_id "TCONS_00003739"; exon_number "1"; oId "CUFF.3876.1"; tss_id "TSS3739"; +chr17 Cufflinks exon 56913260 56913337 . + . gene_id "XLOC_003740"; transcript_id "TCONS_00003740"; exon_number "1"; oId "CUFF.3884.1"; tss_id "TSS3740"; +chr17 Cufflinks exon 57007390 57007431 . + . gene_id "XLOC_003741"; transcript_id "TCONS_00003741"; exon_number "1"; oId "CUFF.3885.1"; tss_id "TSS3741"; +chr17 Cufflinks exon 57028546 57028758 . + . gene_id "XLOC_003742"; transcript_id "TCONS_00003742"; exon_number "1"; oId "CUFF.3886.1"; tss_id "TSS3742"; +chr17 Cufflinks exon 57029066 57029175 . + . gene_id "XLOC_003743"; transcript_id "TCONS_00003743"; exon_number "1"; oId "CUFF.3887.1"; tss_id "TSS3743"; +chr17 Cufflinks exon 57363030 57363062 . + . gene_id "XLOC_003744"; transcript_id "TCONS_00003744"; exon_number "1"; oId "CUFF.3889.1"; tss_id "TSS3744"; +chr17 Cufflinks exon 57469467 57469502 . + . gene_id "XLOC_003745"; transcript_id "TCONS_00003745"; exon_number "1"; oId "CUFF.3890.1"; tss_id "TSS3745"; +chr17 Cufflinks exon 58080073 58080121 . + . gene_id "XLOC_003746"; transcript_id "TCONS_00003746"; exon_number "1"; oId "CUFF.3895.1"; tss_id "TSS3746"; +chr17 Cufflinks exon 58117391 58117478 . + . gene_id "XLOC_003747"; transcript_id "TCONS_00003747"; exon_number "1"; oId "CUFF.3896.1"; tss_id "TSS3747"; +chr17 Cufflinks exon 58291855 58291908 . + . gene_id "XLOC_003748"; transcript_id "TCONS_00003748"; exon_number "1"; oId "CUFF.3898.1"; tss_id "TSS3748"; +chr17 Cufflinks exon 58434857 58434900 . + . gene_id "XLOC_003749"; transcript_id "TCONS_00003749"; exon_number "1"; oId "CUFF.3899.1"; tss_id "TSS3749"; +chr17 Cufflinks exon 58457577 58457625 . + . gene_id "XLOC_003750"; transcript_id "TCONS_00003750"; exon_number "1"; oId "CUFF.3900.1"; tss_id "TSS3750"; +chr17 Cufflinks exon 58773674 58773975 . + . gene_id "XLOC_003751"; transcript_id "TCONS_00003751"; exon_number "1"; oId "CUFF.3902.1"; tss_id "TSS3751"; +chr17 Cufflinks exon 58863593 58863663 . + . gene_id "XLOC_003752"; transcript_id "TCONS_00003752"; exon_number "1"; oId "CUFF.3903.1"; tss_id "TSS3752"; +chr17 Cufflinks exon 58977252 58977566 . + . gene_id "XLOC_003753"; transcript_id "TCONS_00003753"; exon_number "1"; oId "CUFF.3904.1"; tss_id "TSS3753"; +chr17 Cufflinks exon 60012337 60012392 . + . gene_id "XLOC_003754"; transcript_id "TCONS_00003754"; exon_number "1"; oId "CUFF.3906.1"; tss_id "TSS3754"; +chr17 Cufflinks exon 60369114 60369167 . + . gene_id "XLOC_003755"; transcript_id "TCONS_00003755"; exon_number "1"; oId "CUFF.3909.1"; tss_id "TSS3755"; +chr17 Cufflinks exon 60460466 60460527 . + . gene_id "XLOC_003756"; transcript_id "TCONS_00003756"; exon_number "1"; oId "CUFF.3910.1"; tss_id "TSS3756"; +chr17 Cufflinks exon 60481462 60481571 . + . gene_id "XLOC_003757"; transcript_id "TCONS_00003757"; exon_number "1"; oId "CUFF.3911.1"; tss_id "TSS3757"; +chr17 Cufflinks exon 60687228 60687305 . + . gene_id "XLOC_003758"; transcript_id "TCONS_00003758"; exon_number "1"; oId "CUFF.3913.1"; tss_id "TSS3758"; +chr17 Cufflinks exon 60761267 60761369 . + . gene_id "XLOC_003759"; transcript_id "TCONS_00003759"; exon_number "1"; oId "CUFF.3914.1"; tss_id "TSS3759"; +chr17 Cufflinks exon 61706868 61706923 . + . gene_id "XLOC_003760"; transcript_id "TCONS_00003760"; exon_number "1"; oId "CUFF.3918.1"; tss_id "TSS3760"; +chr17 Cufflinks exon 61758436 61758490 . + . gene_id "XLOC_003761"; transcript_id "TCONS_00003761"; exon_number "1"; oId "CUFF.3919.1"; tss_id "TSS3761"; +chr17 Cufflinks exon 62106848 62106884 . + . gene_id "XLOC_003762"; transcript_id "TCONS_00003762"; exon_number "1"; oId "CUFF.3920.1"; tss_id "TSS3762"; +chr17 Cufflinks exon 63072263 63072428 . + . gene_id "XLOC_003763"; transcript_id "TCONS_00003763"; exon_number "1"; oId "CUFF.3925.1"; tss_id "TSS3763"; +chr17 Cufflinks exon 64078176 64078224 . + . gene_id "XLOC_003764"; transcript_id "TCONS_00003764"; exon_number "1"; oId "CUFF.3927.1"; tss_id "TSS3764"; +chr17 Cufflinks exon 64263861 64263949 . + . gene_id "XLOC_003765"; transcript_id "TCONS_00003765"; exon_number "1"; oId "CUFF.3929.1"; tss_id "TSS3765"; +chr17 Cufflinks exon 64360147 64360437 . + . gene_id "XLOC_003766"; transcript_id "TCONS_00003766"; exon_number "1"; oId "CUFF.3930.1"; tss_id "TSS3766"; +chr17 Cufflinks exon 64502441 64502489 . + . gene_id "XLOC_003767"; transcript_id "TCONS_00003767"; exon_number "1"; oId "CUFF.3932.1"; tss_id "TSS3767"; +chr17 Cufflinks exon 64634389 64634488 . + . gene_id "XLOC_003768"; transcript_id "TCONS_00003768"; exon_number "1"; oId "CUFF.3933.1"; tss_id "TSS3768"; +chr17 Cufflinks exon 64635387 64635465 . + . gene_id "XLOC_003769"; transcript_id "TCONS_00003769"; exon_number "1"; oId "CUFF.3934.1"; tss_id "TSS3769"; +chr17 Cufflinks exon 64751916 64751997 . + . gene_id "XLOC_003770"; transcript_id "TCONS_00003770"; exon_number "1"; oId "CUFF.3935.1"; tss_id "TSS3770"; +chr17 Cufflinks exon 64891610 64891687 . + . gene_id "XLOC_003771"; transcript_id "TCONS_00003771"; exon_number "1"; oId "CUFF.3936.1"; tss_id "TSS3771"; +chr17 Cufflinks exon 65264226 65264345 . + . gene_id "XLOC_003772"; transcript_id "TCONS_00003772"; exon_number "1"; oId "CUFF.3937.1"; tss_id "TSS3772"; +chr17 Cufflinks exon 69300372 69300421 . + . gene_id "XLOC_003773"; transcript_id "TCONS_00003773"; exon_number "1"; oId "CUFF.3944.1"; tss_id "TSS3773"; +chr17 Cufflinks exon 69307309 69307377 . + . gene_id "XLOC_003774"; transcript_id "TCONS_00003774"; exon_number "1"; oId "CUFF.3945.1"; tss_id "TSS3774"; +chr17 Cufflinks exon 70325070 70325251 . + . gene_id "XLOC_003775"; transcript_id "TCONS_00003775"; exon_number "1"; oId "CUFF.3948.1"; tss_id "TSS3775"; +chr17 Cufflinks exon 70863797 70863886 . + . gene_id "XLOC_003776"; transcript_id "TCONS_00003776"; exon_number "1"; oId "CUFF.3950.1"; tss_id "TSS3776"; +chr17 Cufflinks exon 73026876 73026911 . + . gene_id "XLOC_003777"; transcript_id "TCONS_00003777"; exon_number "1"; oId "CUFF.3955.1"; tss_id "TSS3777"; +chr17 Cufflinks exon 73027221 73027253 . + . gene_id "XLOC_003778"; transcript_id "TCONS_00003778"; exon_number "1"; oId "CUFF.3956.1"; tss_id "TSS3778"; +chr17 Cufflinks exon 73030001 73030073 . + . gene_id "XLOC_003779"; transcript_id "TCONS_00003779"; exon_number "1"; oId "CUFF.3957.1"; tss_id "TSS3779"; +chr17 Cufflinks exon 73031208 73031280 . + . gene_id "XLOC_003780"; transcript_id "TCONS_00003780"; exon_number "1"; oId "CUFF.3960.1"; tss_id "TSS3780"; +chr17 Cufflinks exon 73037838 73038046 . + . gene_id "XLOC_003781"; transcript_id "TCONS_00003781"; exon_number "1"; oId "CUFF.3961.1"; tss_id "TSS3781"; +chr17 Cufflinks exon 73264416 73264454 . + . gene_id "XLOC_003782"; transcript_id "TCONS_00003782"; exon_number "1"; oId "CUFF.3962.1"; tss_id "TSS3782"; +chr17 Cufflinks exon 74320276 74320381 . + . gene_id "XLOC_003783"; transcript_id "TCONS_00003783"; exon_number "1"; oId "CUFF.3964.1"; tss_id "TSS3783"; +chr17 Cufflinks exon 74333397 74333500 . + . gene_id "XLOC_003784"; transcript_id "TCONS_00003784"; exon_number "1"; oId "CUFF.3965.1"; tss_id "TSS3784"; +chr17 Cufflinks exon 74652398 74652500 . + . gene_id "XLOC_003785"; transcript_id "TCONS_00003785"; exon_number "1"; oId "CUFF.3967.1"; tss_id "TSS3785"; +chr17 Cufflinks exon 74748994 74749095 . + . gene_id "XLOC_003786"; transcript_id "TCONS_00003786"; exon_number "1"; oId "CUFF.3968.1"; tss_id "TSS3786"; +chr17 Cufflinks exon 74884893 74884929 . + . gene_id "XLOC_003787"; transcript_id "TCONS_00003787"; exon_number "1"; oId "CUFF.3969.1"; tss_id "TSS3787"; +chr17 Cufflinks exon 75916180 75916340 . + . gene_id "XLOC_003788"; transcript_id "TCONS_00003788"; exon_number "1"; oId "CUFF.3973.1"; tss_id "TSS3788"; +chr17 Cufflinks exon 76063029 76063130 . + . gene_id "XLOC_003789"; transcript_id "TCONS_00003789"; exon_number "1"; oId "CUFF.3974.1"; tss_id "TSS3789"; +chr17 Cufflinks exon 77687492 77687590 . + . gene_id "XLOC_003790"; transcript_id "TCONS_00003790"; exon_number "1"; oId "CUFF.3979.1"; tss_id "TSS3790"; +chr17 Cufflinks exon 79050997 79051070 . + . gene_id "XLOC_003791"; transcript_id "TCONS_00003791"; exon_number "1"; oId "CUFF.3980.1"; tss_id "TSS3791"; +chr17 Cufflinks exon 80099538 80099649 . + . gene_id "XLOC_003792"; transcript_id "TCONS_00003792"; exon_number "1"; oId "CUFF.3981.1"; tss_id "TSS3792"; +chr17 Cufflinks exon 80540376 80540476 . + . gene_id "XLOC_003793"; transcript_id "TCONS_00003793"; exon_number "1"; oId "CUFF.3984.1"; tss_id "TSS3793"; +chr17 Cufflinks exon 1288295 1288368 . - . gene_id "XLOC_003794"; transcript_id "TCONS_00003794"; exon_number "1"; oId "CUFF.3593.1"; tss_id "TSS3794"; +chr17 Cufflinks exon 1507649 1507965 . - . gene_id "XLOC_003795"; transcript_id "TCONS_00003795"; exon_number "1"; oId "CUFF.3596.1"; tss_id "TSS3795"; +chr17 Cufflinks exon 1519483 1519589 . - . gene_id "XLOC_003796"; transcript_id "TCONS_00003796"; exon_number "1"; oId "CUFF.3597.1"; tss_id "TSS3796"; +chr17 Cufflinks exon 1719928 1719986 . - . gene_id "XLOC_003797"; transcript_id "TCONS_00003797"; exon_number "1"; oId "CUFF.3598.1"; tss_id "TSS3797"; +chr17 Cufflinks exon 2186792 2186850 . - . gene_id "XLOC_003798"; transcript_id "TCONS_00003798"; exon_number "1"; oId "CUFF.3600.1"; tss_id "TSS3798"; +chr17 Cufflinks exon 2460758 2460852 . - . gene_id "XLOC_003799"; transcript_id "TCONS_00003799"; exon_number "1"; oId "CUFF.3601.1"; tss_id "TSS3799"; +chr17 Cufflinks exon 2461164 2461388 . - . gene_id "XLOC_003800"; transcript_id "TCONS_00003800"; exon_number "1"; oId "CUFF.3602.1"; tss_id "TSS3800"; +chr17 Cufflinks exon 2467957 2467993 . - . gene_id "XLOC_003801"; transcript_id "TCONS_00003801"; exon_number "1"; oId "CUFF.3603.1"; tss_id "TSS3801"; +chr17 Cufflinks exon 3960099 3960168 . - . gene_id "XLOC_003802"; transcript_id "TCONS_00003802"; exon_number "1"; oId "CUFF.3608.1"; tss_id "TSS3802"; +chr17 Cufflinks exon 4185068 4185139 . - . gene_id "XLOC_003803"; transcript_id "TCONS_00003803"; exon_number "1"; oId "CUFF.3610.1"; tss_id "TSS3803"; +chr17 Cufflinks exon 4523048 4523147 . - . gene_id "XLOC_003804"; transcript_id "TCONS_00003804"; exon_number "1"; oId "CUFF.3611.1"; tss_id "TSS3804"; +chr17 Cufflinks exon 5382424 5382465 . - . gene_id "XLOC_003805"; transcript_id "TCONS_00003805"; exon_number "1"; oId "CUFF.3613.1"; tss_id "TSS3805"; +chr17 Cufflinks exon 5417529 5417589 . - . gene_id "XLOC_003806"; transcript_id "TCONS_00003806"; exon_number "1"; oId "CUFF.3614.1"; tss_id "TSS3806"; +chr17 Cufflinks exon 6504282 6504371 . - . gene_id "XLOC_003807"; transcript_id "TCONS_00003807"; exon_number "1"; oId "CUFF.3616.1"; tss_id "TSS3807"; +chr17 Cufflinks exon 7937810 7937903 . - . gene_id "XLOC_003808"; transcript_id "TCONS_00003808"; exon_number "1"; oId "CUFF.3622.1"; tss_id "TSS3808"; +chr17 Cufflinks exon 8023632 8023713 . - . gene_id "XLOC_003809"; transcript_id "TCONS_00003809"; exon_number "1"; oId "CUFF.3625.1"; tss_id "TSS3809"; +chr17 Cufflinks exon 8042196 8042280 . - . gene_id "XLOC_003810"; transcript_id "TCONS_00003810"; exon_number "1"; oId "CUFF.3628.1"; tss_id "TSS3810"; +chr17 Cufflinks exon 8042770 8042843 . - . gene_id "XLOC_003811"; transcript_id "TCONS_00003811"; exon_number "1"; oId "CUFF.3629.1"; tss_id "TSS3811"; +chr17 Cufflinks exon 8076771 8076906 . - . gene_id "XLOC_003812"; transcript_id "TCONS_00003812"; exon_number "1"; oId "CUFF.3630.1"; tss_id "TSS3812"; +chr17 Cufflinks exon 8109391 8109448 . - . gene_id "XLOC_003813"; transcript_id "TCONS_00003813"; exon_number "1"; oId "CUFF.3635.1"; tss_id "TSS3813"; +chr17 Cufflinks exon 8124187 8124258 . - . gene_id "XLOC_003814"; transcript_id "TCONS_00003814"; exon_number "1"; oId "CUFF.3636.1"; tss_id "TSS3814"; +chr17 Cufflinks exon 8125556 8125627 . - . gene_id "XLOC_003815"; transcript_id "TCONS_00003815"; exon_number "1"; oId "CUFF.3638.1"; tss_id "TSS3815"; +chr17 Cufflinks exon 8126149 8126222 . - . gene_id "XLOC_003816"; transcript_id "TCONS_00003816"; exon_number "1"; oId "CUFF.3639.1"; tss_id "TSS3816"; +chr17 Cufflinks exon 8129550 8129626 . - . gene_id "XLOC_003817"; transcript_id "TCONS_00003817"; exon_number "1"; oId "CUFF.3640.1"; tss_id "TSS3817"; +chr17 Cufflinks exon 8129925 8130009 . - . gene_id "XLOC_003818"; transcript_id "TCONS_00003818"; exon_number "1"; oId "CUFF.3641.1"; tss_id "TSS3818"; +chr17 Cufflinks exon 8130309 8130382 . - . gene_id "XLOC_003819"; transcript_id "TCONS_00003819"; exon_number "1"; oId "CUFF.3642.1"; tss_id "TSS3819"; +chr17 Cufflinks exon 8450226 8450526 . - . gene_id "XLOC_003820"; transcript_id "TCONS_00003820"; exon_number "1"; oId "CUFF.3644.1"; tss_id "TSS3820"; +chr17 Cufflinks exon 8506310 8506354 . - . gene_id "XLOC_003821"; transcript_id "TCONS_00003821"; exon_number "1"; oId "CUFF.3646.1"; tss_id "TSS3821"; +chr17 Cufflinks exon 9624777 9624811 . - . gene_id "XLOC_003822"; transcript_id "TCONS_00003822"; exon_number "1"; oId "CUFF.3647.1"; tss_id "TSS3822"; +chr17 Cufflinks exon 10640766 10640800 . - . gene_id "XLOC_003823"; transcript_id "TCONS_00003823"; exon_number "1"; oId "CUFF.3649.1"; tss_id "TSS3823"; +chr17 Cufflinks exon 10761216 10761321 . - . gene_id "XLOC_003824"; transcript_id "TCONS_00003824"; exon_number "1"; oId "CUFF.3650.1"; tss_id "TSS3824"; +chr17 Cufflinks exon 10789616 10789700 . - . gene_id "XLOC_003825"; transcript_id "TCONS_00003825"; exon_number "1"; oId "CUFF.3651.1"; tss_id "TSS3825"; +chr17 Cufflinks exon 11796270 11796322 . - . gene_id "XLOC_003826"; transcript_id "TCONS_00003826"; exon_number "1"; oId "CUFF.3654.1"; tss_id "TSS3826"; +chr17 Cufflinks exon 11980413 11980485 . - . gene_id "XLOC_003827"; transcript_id "TCONS_00003827"; exon_number "1"; oId "CUFF.3655.1"; tss_id "TSS3827"; +chr17 Cufflinks exon 15141099 15141190 . - . gene_id "XLOC_003828"; transcript_id "TCONS_00003828"; exon_number "1"; oId "CUFF.3657.1"; tss_id "TSS3828"; +chr17 Cufflinks exon 15560507 15560547 . - . gene_id "XLOC_003829"; transcript_id "TCONS_00003829"; exon_number "1"; oId "CUFF.3661.1"; tss_id "TSS3829"; +chr17 Cufflinks exon 16041084 16041186 . - . gene_id "XLOC_003830"; transcript_id "TCONS_00003830"; exon_number "1"; oId "CUFF.3665.1"; tss_id "TSS3830"; +chr17 Cufflinks exon 16441138 16441259 . - . gene_id "XLOC_003831"; transcript_id "TCONS_00003831"; exon_number "1"; oId "CUFF.3668.1"; tss_id "TSS3831"; +chr17 Cufflinks exon 16870086 16870115 . - . gene_id "XLOC_003832"; transcript_id "TCONS_00003832"; exon_number "1"; oId "CUFF.3671.1"; tss_id "TSS3832"; +chr17 Cufflinks exon 16891426 16891460 . - . gene_id "XLOC_003833"; transcript_id "TCONS_00003833"; exon_number "1"; oId "CUFF.3672.1"; tss_id "TSS3833"; +chr17 Cufflinks exon 18508344 18508667 . - . gene_id "XLOC_003834"; transcript_id "TCONS_00003834"; exon_number "1"; oId "CUFF.3679.1"; tss_id "TSS3834"; +chr17 Cufflinks exon 18526959 18527057 . - . gene_id "XLOC_003835"; transcript_id "TCONS_00003835"; exon_number "1"; oId "CUFF.3680.1"; tss_id "TSS3835"; +chr17 Cufflinks exon 18967233 18967449 . - . gene_id "XLOC_003836"; transcript_id "TCONS_00003836"; exon_number "1"; oId "CUFF.3683.1"; tss_id "TSS3836"; +chr17 Cufflinks exon 19015733 19015949 . - . gene_id "XLOC_003837"; transcript_id "TCONS_00003837"; exon_number "1"; oId "CUFF.3684.1"; tss_id "TSS3837"; +chr17 Cufflinks exon 19041347 19041421 . - . gene_id "XLOC_003838"; transcript_id "TCONS_00003838"; exon_number "1"; oId "CUFF.3685.1"; tss_id "TSS3838"; +chr17 Cufflinks exon 19093342 19093558 . - . gene_id "XLOC_003839"; transcript_id "TCONS_00003839"; exon_number "1"; oId "CUFF.3687.1"; tss_id "TSS3839"; +chr17 Cufflinks exon 19506587 19506658 . - . gene_id "XLOC_003840"; transcript_id "TCONS_00003840"; exon_number "1"; oId "CUFF.3695.1"; tss_id "TSS3840"; +chr17 Cufflinks exon 19938924 19939001 . - . gene_id "XLOC_003841"; transcript_id "TCONS_00003841"; exon_number "1"; oId "CUFF.3701.1"; tss_id "TSS3841"; +chr17 Cufflinks exon 20029702 20029786 . - . gene_id "XLOC_003842"; transcript_id "TCONS_00003842"; exon_number "1"; oId "CUFF.3702.1"; tss_id "TSS3842"; +chr17 Cufflinks exon 20205947 20206010 . - . gene_id "XLOC_003843"; transcript_id "TCONS_00003843"; exon_number "1"; oId "CUFF.3704.1"; tss_id "TSS3843"; +chr17 Cufflinks exon 20655553 20655636 . - . gene_id "XLOC_003844"; transcript_id "TCONS_00003844"; exon_number "1"; oId "CUFF.3707.1"; tss_id "TSS3844"; +chr17 Cufflinks exon 20797846 20797952 . - . gene_id "XLOC_003845"; transcript_id "TCONS_00003845"; exon_number "1"; oId "CUFF.3709.1"; tss_id "TSS3845"; +chr17 Cufflinks exon 21132620 21132941 . - . gene_id "XLOC_003846"; transcript_id "TCONS_00003846"; exon_number "1"; oId "CUFF.3710.1"; tss_id "TSS3846"; +chr17 Cufflinks exon 21461517 21461551 . - . gene_id "XLOC_003847"; transcript_id "TCONS_00003847"; exon_number "1"; oId "CUFF.3711.1"; tss_id "TSS3847"; +chr17 Cufflinks exon 22025084 22025154 . - . gene_id "XLOC_003848"; transcript_id "TCONS_00003848"; exon_number "1"; oId "CUFF.3716.1"; tss_id "TSS3848"; +chr17 Cufflinks exon 22028181 22028247 . - . gene_id "XLOC_003849"; transcript_id "TCONS_00003849"; exon_number "1"; oId "CUFF.3717.1"; tss_id "TSS3849"; +chr17 Cufflinks exon 25911224 25911259 . - . gene_id "XLOC_003850"; transcript_id "TCONS_00003850"; exon_number "1"; oId "CUFF.3718.1"; tss_id "TSS3850"; +chr17 Cufflinks exon 26794683 26794733 . - . gene_id "XLOC_003851"; transcript_id "TCONS_00003851"; exon_number "1"; oId "CUFF.3721.1"; tss_id "TSS3851"; +chr17 Cufflinks exon 27751786 27751885 . - . gene_id "XLOC_003852"; transcript_id "TCONS_00003852"; exon_number "1"; oId "CUFF.3723.1"; tss_id "TSS3852"; +chr17 Cufflinks exon 27772320 27772418 . - . gene_id "XLOC_003853"; transcript_id "TCONS_00003853"; exon_number "1"; oId "CUFF.3724.1"; tss_id "TSS3853"; +chr17 Cufflinks exon 27968643 27968720 . - . gene_id "XLOC_003854"; transcript_id "TCONS_00003854"; exon_number "1"; oId "CUFF.3727.1"; tss_id "TSS3854"; +chr17 Cufflinks exon 28615090 28615195 . - . gene_id "XLOC_003855"; transcript_id "TCONS_00003855"; exon_number "1"; oId "CUFF.3730.1"; tss_id "TSS3855"; +chr17 Cufflinks exon 29029524 29029793 . - . gene_id "XLOC_003856"; transcript_id "TCONS_00003856"; exon_number "1"; oId "CUFF.3734.1"; tss_id "TSS3856"; +chr17 Cufflinks exon 29186681 29186736 . - . gene_id "XLOC_003857"; transcript_id "TCONS_00003857"; exon_number "1"; oId "CUFF.3735.1"; tss_id "TSS3857"; +chr17 Cufflinks exon 29427486 29427526 . - . gene_id "XLOC_003858"; transcript_id "TCONS_00003858"; exon_number "1"; oId "CUFF.3739.1"; tss_id "TSS3858"; +chr17 Cufflinks exon 30290873 30290952 . - . gene_id "XLOC_003859"; transcript_id "TCONS_00003859"; exon_number "1"; oId "CUFF.3746.1"; tss_id "TSS3859"; +chr17 Cufflinks exon 30852588 30852625 . - . gene_id "XLOC_003860"; transcript_id "TCONS_00003860"; exon_number "1"; oId "CUFF.3747.1"; tss_id "TSS3860"; +chr17 Cufflinks exon 30919113 30919237 . - . gene_id "XLOC_003861"; transcript_id "TCONS_00003861"; exon_number "1"; oId "CUFF.3748.1"; tss_id "TSS3861"; +chr17 Cufflinks exon 31159060 31159094 . - . gene_id "XLOC_003862"; transcript_id "TCONS_00003862"; exon_number "1"; oId "CUFF.3749.1"; tss_id "TSS3862"; +chr17 Cufflinks exon 32447100 32447187 . - . gene_id "XLOC_003863"; transcript_id "TCONS_00003863"; exon_number "1"; oId "CUFF.3750.1"; tss_id "TSS3863"; +chr17 Cufflinks exon 33381405 33381514 . - . gene_id "XLOC_003864"; transcript_id "TCONS_00003864"; exon_number "1"; oId "CUFF.3752.1"; tss_id "TSS3864"; +chr17 Cufflinks exon 33478115 33478372 . - . gene_id "XLOC_003865"; transcript_id "TCONS_00003865"; exon_number "1"; oId "CUFF.3754.1"; tss_id "TSS3865"; +chr17 Cufflinks exon 33524207 33524238 . - . gene_id "XLOC_003866"; transcript_id "TCONS_00003866"; exon_number "1"; oId "CUFF.3755.1"; tss_id "TSS3866"; +chr17 Cufflinks exon 33972224 33972251 . - . gene_id "XLOC_003867"; transcript_id "TCONS_00003867"; exon_number "1"; oId "CUFF.3756.1"; tss_id "TSS3867"; +chr17 Cufflinks exon 34169049 34169126 . - . gene_id "XLOC_003868"; transcript_id "TCONS_00003868"; exon_number "1"; oId "CUFF.3757.1"; tss_id "TSS3868"; +chr17 Cufflinks exon 34773400 34773505 . - . gene_id "XLOC_003869"; transcript_id "TCONS_00003869"; exon_number "1"; oId "CUFF.3762.1"; tss_id "TSS3869"; +chr17 Cufflinks exon 34847076 34847166 . - . gene_id "XLOC_003870"; transcript_id "TCONS_00003870"; exon_number "1"; oId "CUFF.3763.1"; tss_id "TSS3870"; +chr17 Cufflinks exon 34926888 34926929 . - . gene_id "XLOC_003871"; transcript_id "TCONS_00003871"; exon_number "1"; oId "CUFF.3764.1"; tss_id "TSS3871"; +chr17 Cufflinks exon 35487328 35487364 . - . gene_id "XLOC_003872"; transcript_id "TCONS_00003872"; exon_number "1"; oId "CUFF.3767.1"; tss_id "TSS3872"; +chr17 Cufflinks exon 35630900 35630941 . - . gene_id "XLOC_003873"; transcript_id "TCONS_00003873"; exon_number "1"; oId "CUFF.3768.1"; tss_id "TSS3873"; +chr17 Cufflinks exon 36300287 36300335 . - . gene_id "XLOC_003874"; transcript_id "TCONS_00003874"; exon_number "1"; oId "CUFF.3770.1"; tss_id "TSS3874"; +chr17 Cufflinks exon 36888053 36888173 . - . gene_id "XLOC_003875"; transcript_id "TCONS_00003875"; exon_number "1"; oId "CUFF.3772.1"; tss_id "TSS3875"; +chr17 Cufflinks exon 36908031 36908107 . - . gene_id "XLOC_003876"; transcript_id "TCONS_00003876"; exon_number "1"; oId "CUFF.3773.1"; tss_id "TSS3876"; +chr17 Cufflinks exon 36911535 36911616 . - . gene_id "XLOC_003877"; transcript_id "TCONS_00003877"; exon_number "1"; oId "CUFF.3774.1"; tss_id "TSS3877"; +chr17 Cufflinks exon 36911970 36911985 . - . gene_id "XLOC_003878"; transcript_id "TCONS_00003878"; exon_number "1"; oId "CUFF.3775.1"; tss_id "TSS3878"; +chr17 Cufflinks exon 36917642 36917667 . - . gene_id "XLOC_003879"; transcript_id "TCONS_00003879"; exon_number "1"; oId "CUFF.3776.1"; tss_id "TSS3879"; +chr17 Cufflinks exon 36989973 36990046 . - . gene_id "XLOC_003880"; transcript_id "TCONS_00003880"; exon_number "1"; oId "CUFF.3777.1"; tss_id "TSS3880"; +chr17 Cufflinks exon 37003090 37003162 . - . gene_id "XLOC_003881"; transcript_id "TCONS_00003881"; exon_number "1"; oId "CUFF.3778.1"; tss_id "TSS3881"; +chr17 Cufflinks exon 37017936 37018008 . - . gene_id "XLOC_003882"; transcript_id "TCONS_00003882"; exon_number "1"; oId "CUFF.3780.1"; tss_id "TSS3882"; +chr17 Cufflinks exon 37025544 37025616 . - . gene_id "XLOC_003883"; transcript_id "TCONS_00003883"; exon_number "1"; oId "CUFF.3782.1"; tss_id "TSS3883"; +chr17 Cufflinks exon 37309986 37310058 . - . gene_id "XLOC_003884"; transcript_id "TCONS_00003884"; exon_number "1"; oId "CUFF.3783.1"; tss_id "TSS3884"; +chr17 Cufflinks exon 37310743 37310815 . - . gene_id "XLOC_003885"; transcript_id "TCONS_00003885"; exon_number "1"; oId "CUFF.3784.1"; tss_id "TSS3885"; +chr17 Cufflinks exon 37638744 37638842 . - . gene_id "XLOC_003886"; transcript_id "TCONS_00003886"; exon_number "1"; oId "CUFF.3785.1"; tss_id "TSS3886"; +chr17 Cufflinks exon 37702362 37702433 . - . gene_id "XLOC_003887"; transcript_id "TCONS_00003887"; exon_number "1"; oId "CUFF.3786.1"; tss_id "TSS3887"; +chr17 Cufflinks exon 37702737 37702774 . - . gene_id "XLOC_003888"; transcript_id "TCONS_00003888"; exon_number "1"; oId "CUFF.3787.1"; tss_id "TSS3888"; +chr17 Cufflinks exon 38238932 38239005 . - . gene_id "XLOC_003889"; transcript_id "TCONS_00003889"; exon_number "1"; oId "CUFF.3789.1"; tss_id "TSS3889"; +chr17 Cufflinks exon 38273553 38273626 . - . gene_id "XLOC_003890"; transcript_id "TCONS_00003890"; exon_number "1"; oId "CUFF.3790.1"; tss_id "TSS3890"; +chr17 Cufflinks exon 39886378 39886657 . - . gene_id "XLOC_003891"; transcript_id "TCONS_00003891"; exon_number "1"; oId "CUFF.3796.1"; tss_id "TSS3891"; +chr17 Cufflinks exon 40409950 40409986 . - . gene_id "XLOC_003892"; transcript_id "TCONS_00003892"; exon_number "1"; oId "CUFF.3798.1"; tss_id "TSS3892"; +chr17 Cufflinks exon 40592218 40592277 . - . gene_id "XLOC_003893"; transcript_id "TCONS_00003893"; exon_number "1"; oId "CUFF.3799.1"; tss_id "TSS3893"; +chr17 Cufflinks exon 41000089 41000149 . - . gene_id "XLOC_003894"; transcript_id "TCONS_00003894"; exon_number "1"; oId "CUFF.3801.1"; tss_id "TSS3894"; +chr17 Cufflinks exon 41043360 41043452 . - . gene_id "XLOC_003895"; transcript_id "TCONS_00003895"; exon_number "1"; oId "CUFF.3802.1"; tss_id "TSS3895"; +chr17 Cufflinks exon 41445276 41445450 . - . gene_id "XLOC_003896"; transcript_id "TCONS_00003896"; exon_number "1"; oId "CUFF.3803.1"; tss_id "TSS3896"; +chr17 Cufflinks exon 41464598 41464785 . - . gene_id "XLOC_003897"; transcript_id "TCONS_00003897"; exon_number "1"; oId "CUFF.3804.1"; tss_id "TSS3897"; +chr17 Cufflinks exon 41473361 41473433 . - . gene_id "XLOC_003898"; transcript_id "TCONS_00003898"; exon_number "1"; oId "CUFF.3805.1"; tss_id "TSS3898"; +chr17 Cufflinks exon 41563771 41563825 . - . gene_id "XLOC_003899"; transcript_id "TCONS_00003899"; exon_number "1"; oId "CUFF.3809.1"; tss_id "TSS3899"; +chr17 Cufflinks exon 42102389 42102591 . - . gene_id "XLOC_003900"; transcript_id "TCONS_00003900"; exon_number "1"; oId "CUFF.3810.1"; tss_id "TSS3900"; +chr17 Cufflinks exon 42213251 42213357 . - . gene_id "XLOC_003901"; transcript_id "TCONS_00003901"; exon_number "1"; oId "CUFF.3811.1"; tss_id "TSS3901"; +chr17 Cufflinks exon 42367896 42367920 . - . gene_id "XLOC_003902"; transcript_id "TCONS_00003902"; exon_number "1"; oId "CUFF.3812.1"; tss_id "TSS3902"; +chr17 Cufflinks exon 42368224 42368519 . - . gene_id "XLOC_003903"; transcript_id "TCONS_00003903"; exon_number "1"; oId "CUFF.3813.1"; tss_id "TSS3903"; +chr17 Cufflinks exon 42486418 42486726 . - . gene_id "XLOC_003904"; transcript_id "TCONS_00003904"; exon_number "1"; oId "CUFF.3816.1"; tss_id "TSS3904"; +chr17 Cufflinks exon 43291782 43291813 . - . gene_id "XLOC_003905"; transcript_id "TCONS_00003905"; exon_number "1"; oId "CUFF.3819.1"; tss_id "TSS3905"; +chr17 Cufflinks exon 43404774 43404863 . - . gene_id "XLOC_003906"; transcript_id "TCONS_00003906"; exon_number "1"; oId "CUFF.3820.1"; tss_id "TSS3906"; +chr17 Cufflinks exon 43556413 43556454 . - . gene_id "XLOC_003907"; transcript_id "TCONS_00003907"; exon_number "1"; oId "CUFF.3821.1"; tss_id "TSS3907"; +chr17 Cufflinks exon 43603807 43604108 . - . gene_id "XLOC_003908"; transcript_id "TCONS_00003908"; exon_number "1"; oId "CUFF.3822.1"; tss_id "TSS3908"; +chr17 Cufflinks exon 43635021 43635062 . - . gene_id "XLOC_003909"; transcript_id "TCONS_00003909"; exon_number "1"; oId "CUFF.3823.1"; tss_id "TSS3909"; +chr17 Cufflinks exon 43693747 43693783 . - . gene_id "XLOC_003910"; transcript_id "TCONS_00003910"; exon_number "1"; oId "CUFF.3824.1"; tss_id "TSS3910"; +chr17 Cufflinks exon 45336727 45336785 . - . gene_id "XLOC_003911"; transcript_id "TCONS_00003911"; exon_number "1"; oId "CUFF.3834.1"; tss_id "TSS3911"; +chr17 Cufflinks exon 45508267 45508302 . - . gene_id "XLOC_003912"; transcript_id "TCONS_00003912"; exon_number "1"; oId "CUFF.3835.1"; tss_id "TSS3912"; +chr17 Cufflinks exon 45769901 45769971 . - . gene_id "XLOC_003913"; transcript_id "TCONS_00003913"; exon_number "1"; oId "CUFF.3838.1"; tss_id "TSS3913"; +chr17 Cufflinks exon 46166040 46166146 . - . gene_id "XLOC_003914"; transcript_id "TCONS_00003914"; exon_number "1"; oId "CUFF.3840.1"; tss_id "TSS3914"; +chr17 Cufflinks exon 46274042 46274148 . - . gene_id "XLOC_003915"; transcript_id "TCONS_00003915"; exon_number "1"; oId "CUFF.3841.1"; tss_id "TSS3915"; +chr17 Cufflinks exon 46459733 46459948 . - . gene_id "XLOC_003916"; transcript_id "TCONS_00003916"; exon_number "1"; oId "CUFF.3842.1"; tss_id "TSS3916"; +chr17 Cufflinks exon 46842902 46843209 . - . gene_id "XLOC_003917"; transcript_id "TCONS_00003917"; exon_number "1"; oId "CUFF.3843.1"; tss_id "TSS3917"; +chr17 Cufflinks exon 46946864 46946895 . - . gene_id "XLOC_003918"; transcript_id "TCONS_00003918"; exon_number "1"; oId "CUFF.3845.1"; tss_id "TSS3918"; +chr17 Cufflinks exon 47026727 47026882 . - . gene_id "XLOC_003919"; transcript_id "TCONS_00003919"; exon_number "1"; oId "CUFF.3846.1"; tss_id "TSS3919"; +chr17 Cufflinks exon 47034009 47034116 . - . gene_id "XLOC_003920"; transcript_id "TCONS_00003920"; exon_number "1"; oId "CUFF.3847.1"; tss_id "TSS3920"; +chr17 Cufflinks exon 47403203 47403263 . - . gene_id "XLOC_003921"; transcript_id "TCONS_00003921"; exon_number "1"; oId "CUFF.3850.1"; tss_id "TSS3921"; +chr17 Cufflinks exon 48043440 48043519 . - . gene_id "XLOC_003922"; transcript_id "TCONS_00003922"; exon_number "1"; oId "CUFF.3853.1"; tss_id "TSS3922"; +chr17 Cufflinks exon 48322257 48322366 . - . gene_id "XLOC_003923"; transcript_id "TCONS_00003923"; exon_number "1"; oId "CUFF.3854.1"; tss_id "TSS3923"; +chr17 Cufflinks exon 48510742 48510817 . - . gene_id "XLOC_003924"; transcript_id "TCONS_00003924"; exon_number "1"; oId "CUFF.3855.1"; tss_id "TSS3924"; +chr17 Cufflinks exon 49175548 49175634 . - . gene_id "XLOC_003925"; transcript_id "TCONS_00003925"; exon_number "1"; oId "CUFF.3856.1"; tss_id "TSS3925"; +chr17 Cufflinks exon 51596050 51596116 . - . gene_id "XLOC_003926"; transcript_id "TCONS_00003926"; exon_number "1"; oId "CUFF.3860.1"; tss_id "TSS3926"; +chr17 Cufflinks exon 51686863 51686896 . - . gene_id "XLOC_003927"; transcript_id "TCONS_00003927"; exon_number "1"; oId "CUFF.3861.1"; tss_id "TSS3927"; +chr17 Cufflinks exon 55075116 55075174 . - . gene_id "XLOC_003928"; transcript_id "TCONS_00003928"; exon_number "1"; oId "CUFF.3868.1"; tss_id "TSS3928"; +chr17 Cufflinks exon 55762892 55762952 . - . gene_id "XLOC_003929"; transcript_id "TCONS_00003929"; exon_number "1"; oId "CUFF.3873.1"; tss_id "TSS3929"; +chr17 Cufflinks exon 55868619 55868752 . - . gene_id "XLOC_003930"; transcript_id "TCONS_00003930"; exon_number "1"; oId "CUFF.3875.1"; tss_id "TSS3930"; +chr17 Cufflinks exon 56709002 56709197 . - . gene_id "XLOC_003931"; transcript_id "TCONS_00003931"; exon_number "1"; oId "CUFF.3877.1"; tss_id "TSS3931"; +chr17 Cufflinks exon 56736514 56736657 . - . gene_id "XLOC_003932"; transcript_id "TCONS_00003932"; exon_number "1"; oId "CUFF.3878.1"; tss_id "TSS3932"; +chr17 Cufflinks exon 56743897 56744058 . - . gene_id "XLOC_003933"; transcript_id "TCONS_00003933"; exon_number "1"; oId "CUFF.3879.1"; tss_id "TSS3933"; +chr17 Cufflinks exon 56754935 56755094 . - . gene_id "XLOC_003934"; transcript_id "TCONS_00003934"; exon_number "1"; oId "CUFF.3880.1"; tss_id "TSS3934"; +chr17 Cufflinks exon 56756887 56757051 . - . gene_id "XLOC_003935"; transcript_id "TCONS_00003935"; exon_number "1"; oId "CUFF.3881.1"; tss_id "TSS3935"; +chr17 Cufflinks exon 56804100 56804142 . - . gene_id "XLOC_003936"; transcript_id "TCONS_00003936"; exon_number "1"; oId "CUFF.3882.1"; tss_id "TSS3936"; +chr17 Cufflinks exon 56866298 56866377 . - . gene_id "XLOC_003937"; transcript_id "TCONS_00003937"; exon_number "1"; oId "CUFF.3883.1"; tss_id "TSS3937"; +chr17 Cufflinks exon 57206763 57206815 . - . gene_id "XLOC_003938"; transcript_id "TCONS_00003938"; exon_number "1"; oId "CUFF.3888.1"; tss_id "TSS3938"; +chr17 Cufflinks exon 57614717 57614860 . - . gene_id "XLOC_003939"; transcript_id "TCONS_00003939"; exon_number "1"; oId "CUFF.3891.1"; tss_id "TSS3939"; +chr17 Cufflinks exon 57924807 57924905 . - . gene_id "XLOC_003940"; transcript_id "TCONS_00003940"; exon_number "1"; oId "CUFF.3892.1"; tss_id "TSS3940"; +chr17 Cufflinks exon 57992108 57992142 . - . gene_id "XLOC_003941"; transcript_id "TCONS_00003941"; exon_number "1"; oId "CUFF.3893.1"; tss_id "TSS3941"; +chr17 Cufflinks exon 58038303 58038385 . - . gene_id "XLOC_003942"; transcript_id "TCONS_00003942"; exon_number "1"; oId "CUFF.3894.1"; tss_id "TSS3942"; +chr17 Cufflinks exon 58117742 58117829 . - . gene_id "XLOC_003943"; transcript_id "TCONS_00003943"; exon_number "1"; oId "CUFF.3897.1"; tss_id "TSS3943"; +chr17 Cufflinks exon 58739696 58739798 . - . gene_id "XLOC_003944"; transcript_id "TCONS_00003944"; exon_number "1"; oId "CUFF.3901.1"; tss_id "TSS3944"; +chr17 Cufflinks exon 59039148 59039255 . - . gene_id "XLOC_003945"; transcript_id "TCONS_00003945"; exon_number "1"; oId "CUFF.3905.1"; tss_id "TSS3945"; +chr17 Cufflinks exon 60083091 60083321 . - . gene_id "XLOC_003946"; transcript_id "TCONS_00003946"; exon_number "1"; oId "CUFF.3907.1"; tss_id "TSS3946"; +chr17 Cufflinks exon 60093633 60093688 . - . gene_id "XLOC_003947"; transcript_id "TCONS_00003947"; exon_number "1"; oId "CUFF.3908.1"; tss_id "TSS3947"; +chr17 Cufflinks exon 60502546 60502623 . - . gene_id "XLOC_003948"; transcript_id "TCONS_00003948"; exon_number "1"; oId "CUFF.3912.1"; tss_id "TSS3948"; +chr17 Cufflinks exon 61372906 61373057 . - . gene_id "XLOC_003949"; transcript_id "TCONS_00003949"; exon_number "1"; oId "CUFF.3915.1"; tss_id "TSS3949"; +chr17 Cufflinks exon 61441915 61441949 . - . gene_id "XLOC_003950"; transcript_id "TCONS_00003950"; exon_number "1"; oId "CUFF.3916.1"; tss_id "TSS3950"; +chr17 Cufflinks exon 61650604 61650706 . - . gene_id "XLOC_003951"; transcript_id "TCONS_00003951"; exon_number "1"; oId "CUFF.3917.1"; tss_id "TSS3951"; +chr17 Cufflinks exon 62526917 62526990 . - . gene_id "XLOC_003952"; transcript_id "TCONS_00003952"; exon_number "1"; oId "CUFF.3921.1"; tss_id "TSS3952"; +chr17 Cufflinks exon 62821888 62821929 . - . gene_id "XLOC_003953"; transcript_id "TCONS_00003953"; exon_number "1"; oId "CUFF.3922.1"; tss_id "TSS3953"; +chr17 Cufflinks exon 62867594 62867898 . - . gene_id "XLOC_003954"; transcript_id "TCONS_00003954"; exon_number "1"; oId "CUFF.3923.1"; tss_id "TSS3954"; +chr17 Cufflinks exon 62900684 62900725 . - . gene_id "XLOC_003955"; transcript_id "TCONS_00003955"; exon_number "1"; oId "CUFF.3924.1"; tss_id "TSS3955"; +chr17 Cufflinks exon 63223231 63223264 . - . gene_id "XLOC_003956"; transcript_id "TCONS_00003956"; exon_number "1"; oId "CUFF.3926.1"; tss_id "TSS3956"; +chr17 Cufflinks exon 64233787 64233845 . - . gene_id "XLOC_003957"; transcript_id "TCONS_00003957"; exon_number "1"; oId "CUFF.3928.1"; tss_id "TSS3957"; +chr17 Cufflinks exon 64441233 64441269 . - . gene_id "XLOC_003958"; transcript_id "TCONS_00003958"; exon_number "1"; oId "CUFF.3931.1"; tss_id "TSS3958"; +chr17 Cufflinks exon 65403956 65404063 . - . gene_id "XLOC_003959"; transcript_id "TCONS_00003959"; exon_number "1"; oId "CUFF.3938.1"; tss_id "TSS3959"; +chr17 Cufflinks exon 65453122 65453406 . - . gene_id "XLOC_003960"; transcript_id "TCONS_00003960"; exon_number "1"; oId "CUFF.3939.1"; tss_id "TSS3960"; +chr17 Cufflinks exon 66016016 66016083 . - . gene_id "XLOC_003961"; transcript_id "TCONS_00003961"; exon_number "1"; oId "CUFF.3940.1"; tss_id "TSS3961"; +chr17 Cufflinks exon 66254229 66254267 . - . gene_id "XLOC_003962"; transcript_id "TCONS_00003962"; exon_number "1"; oId "CUFF.3941.1"; tss_id "TSS3962"; +chr17 Cufflinks exon 69003155 69003222 . - . gene_id "XLOC_003963"; transcript_id "TCONS_00003963"; exon_number "1"; oId "CUFF.3942.1"; tss_id "TSS3963"; +chr17 Cufflinks exon 69294298 69294351 . - . gene_id "XLOC_003964"; transcript_id "TCONS_00003964"; exon_number "1"; oId "CUFF.3943.1"; tss_id "TSS3964"; +chr17 Cufflinks exon 70222806 70222846 . - . gene_id "XLOC_003965"; transcript_id "TCONS_00003965"; exon_number "1"; oId "CUFF.3946.1"; tss_id "TSS3965"; +chr17 Cufflinks exon 70248724 70248892 . - . gene_id "XLOC_003966"; transcript_id "TCONS_00003966"; exon_number "1"; oId "CUFF.3947.1"; tss_id "TSS3966"; +chr17 Cufflinks exon 70660052 70660291 . - . gene_id "XLOC_003967"; transcript_id "TCONS_00003967"; exon_number "1"; oId "CUFF.3949.1"; tss_id "TSS3967"; +chr17 Cufflinks exon 71183664 71183713 . - . gene_id "XLOC_003968"; transcript_id "TCONS_00003968"; exon_number "1"; oId "CUFF.3951.1"; tss_id "TSS3968"; +chr17 Cufflinks exon 71347733 71347783 . - . gene_id "XLOC_003969"; transcript_id "TCONS_00003969"; exon_number "1"; oId "CUFF.3952.1"; tss_id "TSS3969"; +chr17 Cufflinks exon 71812309 71812383 . - . gene_id "XLOC_003970"; transcript_id "TCONS_00003970"; exon_number "1"; oId "CUFF.3953.1"; tss_id "TSS3970"; +chr17 Cufflinks exon 72413753 72413843 . - . gene_id "XLOC_003971"; transcript_id "TCONS_00003971"; exon_number "1"; oId "CUFF.3954.1"; tss_id "TSS3971"; +chr17 Cufflinks exon 73030527 73030598 . - . gene_id "XLOC_003972"; transcript_id "TCONS_00003972"; exon_number "1"; oId "CUFF.3958.1"; tss_id "TSS3972"; +chr17 Cufflinks exon 73030950 73031014 . - . gene_id "XLOC_003973"; transcript_id "TCONS_00003973"; exon_number "1"; oId "CUFF.3959.1"; tss_id "TSS3973"; +chr17 Cufflinks exon 73332293 73332359 . - . gene_id "XLOC_003974"; transcript_id "TCONS_00003974"; exon_number "1"; oId "CUFF.3963.1"; tss_id "TSS3974"; +chr17 Cufflinks exon 74634212 74634261 . - . gene_id "XLOC_003975"; transcript_id "TCONS_00003975"; exon_number "1"; oId "CUFF.3966.1"; tss_id "TSS3975"; +chr17 Cufflinks exon 75148300 75148335 . - . gene_id "XLOC_003976"; transcript_id "TCONS_00003976"; exon_number "1"; oId "CUFF.3970.1"; tss_id "TSS3976"; +chr17 Cufflinks exon 75148637 75148754 . - . gene_id "XLOC_003977"; transcript_id "TCONS_00003977"; exon_number "1"; oId "CUFF.3971.1"; tss_id "TSS3977"; +chr17 Cufflinks exon 75158032 75158389 . - . gene_id "XLOC_003978"; transcript_id "TCONS_00003978"; exon_number "1"; oId "CUFF.3972.1"; tss_id "TSS3978"; +chr17 Cufflinks exon 76366587 76366625 . - . gene_id "XLOC_003979"; transcript_id "TCONS_00003979"; exon_number "1"; oId "CUFF.3975.1"; tss_id "TSS3979"; +chr17 Cufflinks exon 76366936 76367216 . - . gene_id "XLOC_003980"; transcript_id "TCONS_00003980"; exon_number "1"; oId "CUFF.3976.1"; tss_id "TSS3980"; +chr17 Cufflinks exon 76528941 76529137 . - . gene_id "XLOC_003981"; transcript_id "TCONS_00003981"; exon_number "1"; oId "CUFF.3977.1"; tss_id "TSS3981"; +chr17 Cufflinks exon 76692777 76692879 . - . gene_id "XLOC_003982"; transcript_id "TCONS_00003982"; exon_number "1"; oId "CUFF.3978.1"; tss_id "TSS3982"; +chr17 Cufflinks exon 80452597 80452668 . - . gene_id "XLOC_003983"; transcript_id "TCONS_00003983"; exon_number "1"; oId "CUFF.3982.1"; tss_id "TSS3983"; +chr17 Cufflinks exon 80458716 80458793 . - . gene_id "XLOC_003984"; transcript_id "TCONS_00003984"; exon_number "1"; oId "CUFF.3983.1"; tss_id "TSS3984"; +chr17_ctg5_hap1 Cufflinks exon 1174403 1174439 . + . gene_id "XLOC_003985"; transcript_id "TCONS_00003985"; exon_number "1"; oId "CUFF.3994.1"; tss_id "TSS3985"; +chr17_ctg5_hap1 Cufflinks exon 1439559 1439600 . + . gene_id "XLOC_003986"; transcript_id "TCONS_00003986"; exon_number "1"; oId "CUFF.3995.1"; tss_id "TSS3986"; +chr17_ctg5_hap1 Cufflinks exon 1471743 1472051 . + . gene_id "XLOC_003987"; transcript_id "TCONS_00003987"; exon_number "1"; oId "CUFF.3996.1"; tss_id "TSS3987"; +chr17_ctg5_hap1 Cufflinks exon 19910 19999 . - . gene_id "XLOC_003988"; transcript_id "TCONS_00003988"; exon_number "1"; oId "CUFF.3985.1"; tss_id "TSS3988"; +chr17_ctg5_hap1 Cufflinks exon 171474 171515 . - . gene_id "XLOC_003989"; transcript_id "TCONS_00003989"; exon_number "1"; oId "CUFF.3986.1"; tss_id "TSS3989"; +chr17_ctg5_hap1 Cufflinks exon 215525 215833 . - . gene_id "XLOC_003990"; transcript_id "TCONS_00003990"; exon_number "1"; oId "CUFF.3987.1"; tss_id "TSS3990"; +chr17_ctg5_hap1 Cufflinks exon 247971 248012 . - . gene_id "XLOC_003991"; transcript_id "TCONS_00003991"; exon_number "1"; oId "CUFF.3988.1"; tss_id "TSS3991"; +chr17_ctg5_hap1 Cufflinks exon 433442 433750 . - . gene_id "XLOC_003992"; transcript_id "TCONS_00003992"; exon_number "1"; oId "CUFF.3989.1"; tss_id "TSS3992"; +chr17_ctg5_hap1 Cufflinks exon 465906 465947 . - . gene_id "XLOC_003993"; transcript_id "TCONS_00003993"; exon_number "1"; oId "CUFF.3990.1"; tss_id "TSS3993"; +chr17_ctg5_hap1 Cufflinks exon 559537 559573 . - . gene_id "XLOC_003994"; transcript_id "TCONS_00003994"; exon_number "1"; oId "CUFF.3991.1"; tss_id "TSS3994"; +chr17_ctg5_hap1 Cufflinks exon 661283 661331 . - . gene_id "XLOC_003995"; transcript_id "TCONS_00003995"; exon_number "1"; oId "CUFF.3992.1"; tss_id "TSS3995"; +chr17_ctg5_hap1 Cufflinks exon 838254 838288 . - . gene_id "XLOC_003996"; transcript_id "TCONS_00003996"; exon_number "1"; oId "CUFF.3993.1"; tss_id "TSS3996"; +chr17_gl000203_random Cufflinks exon 14112 14148 . - . gene_id "XLOC_003997"; transcript_id "TCONS_00003997"; exon_number "1"; oId "CUFF.3997.1"; tss_id "TSS3997"; +chr18 Cufflinks exon 849858 850064 . + . gene_id "XLOC_003998"; transcript_id "TCONS_00003998"; exon_number "1"; oId "CUFF.4000.1"; tss_id "TSS3998"; +chr18 Cufflinks exon 1844842 1844918 . + . gene_id "XLOC_003999"; transcript_id "TCONS_00003999"; exon_number "1"; oId "CUFF.4002.1"; tss_id "TSS3999"; +chr18 Cufflinks exon 2774880 2774964 . + . gene_id "XLOC_004000"; transcript_id "TCONS_00004000"; exon_number "1"; oId "CUFF.4006.1"; tss_id "TSS4000"; +chr18 Cufflinks exon 3093566 3093626 . + . gene_id "XLOC_004001"; transcript_id "TCONS_00004001"; exon_number "1"; oId "CUFF.4007.1"; tss_id "TSS4001"; +chr18 Cufflinks exon 3811316 3811423 . + . gene_id "XLOC_004002"; transcript_id "TCONS_00004002"; exon_number "1"; oId "CUFF.4011.1"; tss_id "TSS4002"; +chr18 Cufflinks exon 6454961 6455065 . + . gene_id "XLOC_004003"; transcript_id "TCONS_00004003"; exon_number "1"; oId "CUFF.4018.1"; tss_id "TSS4003"; +chr18 Cufflinks exon 6601539 6601831 . + . gene_id "XLOC_004004"; transcript_id "TCONS_00004004"; exon_number "1"; oId "CUFF.4019.1"; tss_id "TSS4004"; +chr18 Cufflinks exon 6602138 6602158 . + . gene_id "XLOC_004005"; transcript_id "TCONS_00004005"; exon_number "1"; oId "CUFF.4020.1"; tss_id "TSS4005"; +chr18 Cufflinks exon 7995568 7995781 . + . gene_id "XLOC_004006"; transcript_id "TCONS_00004006"; exon_number "1"; oId "CUFF.4022.1"; tss_id "TSS4006"; +chr18 Cufflinks exon 8471829 8472139 . + . gene_id "XLOC_004007"; transcript_id "TCONS_00004007"; exon_number "1"; oId "CUFF.4023.1"; tss_id "TSS4007"; +chr18 Cufflinks exon 9235204 9235336 . + . gene_id "XLOC_004008"; transcript_id "TCONS_00004008"; exon_number "1"; oId "CUFF.4024.1"; tss_id "TSS4008"; +chr18 Cufflinks exon 9277976 9278079 . + . gene_id "XLOC_004009"; transcript_id "TCONS_00004009"; exon_number "1"; oId "CUFF.4025.1"; tss_id "TSS4009"; +chr18 Cufflinks exon 9923916 9923999 . + . gene_id "XLOC_004010"; transcript_id "TCONS_00004010"; exon_number "1"; oId "CUFF.4030.1"; tss_id "TSS4010"; +chr18 Cufflinks exon 12098426 12098530 . + . gene_id "XLOC_004011"; transcript_id "TCONS_00004011"; exon_number "1"; oId "CUFF.4033.1"; tss_id "TSS4011"; +chr18 Cufflinks exon 12400411 12400470 . + . gene_id "XLOC_004012"; transcript_id "TCONS_00004012"; exon_number "1"; oId "CUFF.4035.1"; tss_id "TSS4012"; +chr18 Cufflinks exon 12544871 12544980 . + . gene_id "XLOC_004013"; transcript_id "TCONS_00004013"; exon_number "1"; oId "CUFF.4037.1"; tss_id "TSS4013"; +chr18 Cufflinks exon 12577683 12577717 . + . gene_id "XLOC_004014"; transcript_id "TCONS_00004014"; exon_number "1"; oId "CUFF.4038.1"; tss_id "TSS4014"; +chr18 Cufflinks exon 13407510 13407554 . + . gene_id "XLOC_004015"; transcript_id "TCONS_00004015"; exon_number "1"; oId "CUFF.4039.1"; tss_id "TSS4015"; +chr18 Cufflinks exon 14190699 14190804 . + . gene_id "XLOC_004016"; transcript_id "TCONS_00004016"; exon_number "1"; oId "CUFF.4041.1"; tss_id "TSS4016"; +chr18 Cufflinks exon 14759187 14759291 . + . gene_id "XLOC_004017"; transcript_id "TCONS_00004017"; exon_number "1"; oId "CUFF.4043.1"; tss_id "TSS4017"; +chr18 Cufflinks exon 19373844 19374147 . + . gene_id "XLOC_004018"; transcript_id "TCONS_00004018"; exon_number "1"; oId "CUFF.4046.1"; tss_id "TSS4018"; +chr18 Cufflinks exon 19397584 19397786 . + . gene_id "XLOC_004019"; transcript_id "TCONS_00004019"; exon_number "1"; oId "CUFF.4047.1"; tss_id "TSS4019"; +chr18 Cufflinks exon 19459762 19459862 . + . gene_id "XLOC_004020"; transcript_id "TCONS_00004020"; exon_number "1"; oId "CUFF.4048.1"; tss_id "TSS4020"; +chr18 Cufflinks exon 19623319 19623380 . + . gene_id "XLOC_004021"; transcript_id "TCONS_00004021"; exon_number "1"; oId "CUFF.4050.1"; tss_id "TSS4021"; +chr18 Cufflinks exon 19840541 19840639 . + . gene_id "XLOC_004022"; transcript_id "TCONS_00004022"; exon_number "1"; oId "CUFF.4052.1"; tss_id "TSS4022"; +chr18 Cufflinks exon 20227545 20227651 . + . gene_id "XLOC_004023"; transcript_id "TCONS_00004023"; exon_number "1"; oId "CUFF.4055.1"; tss_id "TSS4023"; +chr18 Cufflinks exon 20584522 20584837 . + . gene_id "XLOC_004024"; transcript_id "TCONS_00004024"; exon_number "1"; oId "CUFF.4057.1"; tss_id "TSS4024"; +chr18 Cufflinks exon 21191674 21191827 . + . gene_id "XLOC_004025"; transcript_id "TCONS_00004025"; exon_number "1"; oId "CUFF.4058.1"; tss_id "TSS4025"; +chr18 Cufflinks exon 21464093 21464127 . + . gene_id "XLOC_004026"; transcript_id "TCONS_00004026"; exon_number "1"; oId "CUFF.4059.1"; tss_id "TSS4026"; +chr18 Cufflinks exon 21798264 21798368 . + . gene_id "XLOC_004027"; transcript_id "TCONS_00004027"; exon_number "1"; oId "CUFF.4063.1"; tss_id "TSS4027"; +chr18 Cufflinks exon 21868884 21868956 . + . gene_id "XLOC_004028"; transcript_id "TCONS_00004028"; exon_number "1"; oId "CUFF.4064.1"; tss_id "TSS4028"; +chr18 Cufflinks exon 23657546 23657580 . + . gene_id "XLOC_004029"; transcript_id "TCONS_00004029"; exon_number "1"; oId "CUFF.4068.1"; tss_id "TSS4029"; +chr18 Cufflinks exon 24278053 24278088 . + . gene_id "XLOC_004030"; transcript_id "TCONS_00004030"; exon_number "1"; oId "CUFF.4072.1"; tss_id "TSS4030"; +chr18 Cufflinks exon 26628585 26628679 . + . gene_id "XLOC_004031"; transcript_id "TCONS_00004031"; exon_number "1"; oId "CUFF.4075.1"; tss_id "TSS4031"; +chr18 Cufflinks exon 28564072 28564177 . + . gene_id "XLOC_004032"; transcript_id "TCONS_00004032"; exon_number "1"; oId "CUFF.4077.1"; tss_id "TSS4032"; +chr18 Cufflinks exon 28652473 28652576 . + . gene_id "XLOC_004033"; transcript_id "TCONS_00004033"; exon_number "1"; oId "CUFF.4078.1"; tss_id "TSS4033"; +chr18 Cufflinks exon 29100681 29100718 . + . gene_id "XLOC_004034"; transcript_id "TCONS_00004034"; exon_number "1"; oId "CUFF.4080.1"; tss_id "TSS4034"; +chr18 Cufflinks exon 29298856 29299097 . + . gene_id "XLOC_004035"; transcript_id "TCONS_00004035"; exon_number "1"; oId "CUFF.4082.1"; tss_id "TSS4035"; +chr18 Cufflinks exon 29517497 29517574 . + . gene_id "XLOC_004036"; transcript_id "TCONS_00004036"; exon_number "1"; oId "CUFF.4084.1"; tss_id "TSS4036"; +chr18 Cufflinks exon 29674466 29674572 . + . gene_id "XLOC_004037"; transcript_id "TCONS_00004037"; exon_number "1"; oId "CUFF.4086.1"; tss_id "TSS4037"; +chr18 Cufflinks exon 30511384 30511527 . + . gene_id "XLOC_004038"; transcript_id "TCONS_00004038"; exon_number "1"; oId "CUFF.4089.1"; tss_id "TSS4038"; +chr18 Cufflinks exon 31530149 31530205 . + . gene_id "XLOC_004039"; transcript_id "TCONS_00004039"; exon_number "1"; oId "CUFF.4090.1"; tss_id "TSS4039"; +chr18 Cufflinks exon 31985039 31985086 . + . gene_id "XLOC_004040"; transcript_id "TCONS_00004040"; exon_number "1"; oId "CUFF.4091.1"; tss_id "TSS4040"; +chr18 Cufflinks exon 32061880 32061922 . + . gene_id "XLOC_004041"; transcript_id "TCONS_00004041"; exon_number "1"; oId "CUFF.4092.1"; tss_id "TSS4041"; +chr18 Cufflinks exon 33319683 33319719 . + . gene_id "XLOC_004042"; transcript_id "TCONS_00004042"; exon_number "1"; oId "CUFF.4093.1"; tss_id "TSS4042"; +chr18 Cufflinks exon 33576390 33576438 . + . gene_id "XLOC_004043"; transcript_id "TCONS_00004043"; exon_number "1"; oId "CUFF.4094.1"; tss_id "TSS4043"; +chr18 Cufflinks exon 33844752 33844830 . + . gene_id "XLOC_004044"; transcript_id "TCONS_00004044"; exon_number "1"; oId "CUFF.4095.1"; tss_id "TSS4044"; +chr18 Cufflinks exon 34267964 34268019 . + . gene_id "XLOC_004045"; transcript_id "TCONS_00004045"; exon_number "1"; oId "CUFF.4096.1"; tss_id "TSS4045"; +chr18 Cufflinks exon 35190674 35190799 . + . gene_id "XLOC_004046"; transcript_id "TCONS_00004046"; exon_number "1"; oId "CUFF.4097.1"; tss_id "TSS4046"; +chr18 Cufflinks exon 36057894 36057941 . + . gene_id "XLOC_004047"; transcript_id "TCONS_00004047"; exon_number "1"; oId "CUFF.4098.1"; tss_id "TSS4047"; +chr18 Cufflinks exon 36613971 36614072 . + . gene_id "XLOC_004048"; transcript_id "TCONS_00004048"; exon_number "1"; oId "CUFF.4101.1"; tss_id "TSS4048"; +chr18 Cufflinks exon 38052786 38052846 . + . gene_id "XLOC_004049"; transcript_id "TCONS_00004049"; exon_number "1"; oId "CUFF.4104.1"; tss_id "TSS4049"; +chr18 Cufflinks exon 39580483 39580546 . + . gene_id "XLOC_004050"; transcript_id "TCONS_00004050"; exon_number "1"; oId "CUFF.4107.1"; tss_id "TSS4050"; +chr18 Cufflinks exon 39850554 39850643 . + . gene_id "XLOC_004051"; transcript_id "TCONS_00004051"; exon_number "1"; oId "CUFF.4108.1"; tss_id "TSS4051"; +chr18 Cufflinks exon 40961563 40961603 . + . gene_id "XLOC_004052"; transcript_id "TCONS_00004052"; exon_number "1"; oId "CUFF.4109.1"; tss_id "TSS4052"; +chr18 Cufflinks exon 41651548 41651667 . + . gene_id "XLOC_004053"; transcript_id "TCONS_00004053"; exon_number "1"; oId "CUFF.4112.1"; tss_id "TSS4053"; +chr18 Cufflinks exon 41720884 41720921 . + . gene_id "XLOC_004054"; transcript_id "TCONS_00004054"; exon_number "1"; oId "CUFF.4113.1"; tss_id "TSS4054"; +chr18 Cufflinks exon 42572311 42572343 . + . gene_id "XLOC_004055"; transcript_id "TCONS_00004055"; exon_number "1"; oId "CUFF.4114.1"; tss_id "TSS4055"; +chr18 Cufflinks exon 42876592 42876663 . + . gene_id "XLOC_004056"; transcript_id "TCONS_00004056"; exon_number "1"; oId "CUFF.4115.1"; tss_id "TSS4056"; +chr18 Cufflinks exon 43123360 43123395 . + . gene_id "XLOC_004057"; transcript_id "TCONS_00004057"; exon_number "1"; oId "CUFF.4116.1"; tss_id "TSS4057"; +chr18 Cufflinks exon 43299752 43299822 . + . gene_id "XLOC_004058"; transcript_id "TCONS_00004058"; exon_number "1"; oId "CUFF.4117.1"; tss_id "TSS4058"; +chr18 Cufflinks exon 43516370 43516411 . + . gene_id "XLOC_004059"; transcript_id "TCONS_00004059"; exon_number "1"; oId "CUFF.4118.1"; tss_id "TSS4059"; +chr18 Cufflinks exon 45251700 45251812 . + . gene_id "XLOC_004060"; transcript_id "TCONS_00004060"; exon_number "1"; oId "CUFF.4125.1"; tss_id "TSS4060"; +chr18 Cufflinks exon 45816176 45816213 . + . gene_id "XLOC_004061"; transcript_id "TCONS_00004061"; exon_number "1"; oId "CUFF.4128.1"; tss_id "TSS4061"; +chr18 Cufflinks exon 45918963 45919016 . + . gene_id "XLOC_004062"; transcript_id "TCONS_00004062"; exon_number "1"; oId "CUFF.4129.1"; tss_id "TSS4062"; +chr18 Cufflinks exon 47467044 47467078 . + . gene_id "XLOC_004063"; transcript_id "TCONS_00004063"; exon_number "1"; oId "CUFF.4133.1"; tss_id "TSS4063"; +chr18 Cufflinks exon 47845374 47845466 . + . gene_id "XLOC_004064"; transcript_id "TCONS_00004064"; exon_number "1"; oId "CUFF.4138.1"; tss_id "TSS4064"; +chr18 Cufflinks exon 48515700 48515778 . + . gene_id "XLOC_004065"; transcript_id "TCONS_00004065"; exon_number "1"; oId "CUFF.4141.1"; tss_id "TSS4065"; +chr18 Cufflinks exon 49072716 49072821 . + . gene_id "XLOC_004066"; transcript_id "TCONS_00004066"; exon_number "1"; oId "CUFF.4145.1"; tss_id "TSS4066"; +chr18 Cufflinks exon 51613940 51614023 . + . gene_id "XLOC_004067"; transcript_id "TCONS_00004067"; exon_number "1"; oId "CUFF.4149.1"; tss_id "TSS4067"; +chr18 Cufflinks exon 53808951 53808984 . + . gene_id "XLOC_004068"; transcript_id "TCONS_00004068"; exon_number "1"; oId "CUFF.4154.1"; tss_id "TSS4068"; +chr18 Cufflinks exon 54065255 54065293 . + . gene_id "XLOC_004069"; transcript_id "TCONS_00004069"; exon_number "1"; oId "CUFF.4155.1"; tss_id "TSS4069"; +chr18 Cufflinks exon 54460380 54460421 . + . gene_id "XLOC_004070"; transcript_id "TCONS_00004070"; exon_number "1"; oId "CUFF.4156.1"; tss_id "TSS4070"; +chr18 Cufflinks exon 54624502 54624699 . + . gene_id "XLOC_004071"; transcript_id "TCONS_00004071"; exon_number "1"; oId "CUFF.4157.1"; tss_id "TSS4071"; +chr18 Cufflinks exon 55124062 55124226 . + . gene_id "XLOC_004072"; transcript_id "TCONS_00004072"; exon_number "1"; oId "CUFF.4159.1"; tss_id "TSS4072"; +chr18 Cufflinks exon 55124822 55124892 . + . gene_id "XLOC_004073"; transcript_id "TCONS_00004073"; exon_number "1"; oId "CUFF.4160.1"; tss_id "TSS4073"; +chr18 Cufflinks exon 55345854 55345928 . + . gene_id "XLOC_004074"; transcript_id "TCONS_00004074"; exon_number "1"; oId "CUFF.4161.1"; tss_id "TSS4074"; +chr18 Cufflinks exon 55346177 55346251 . + . gene_id "XLOC_004075"; transcript_id "TCONS_00004075"; exon_number "1"; oId "CUFF.4162.1"; tss_id "TSS4075"; +chr18 Cufflinks exon 55422626 55422726 . + . gene_id "XLOC_004076"; transcript_id "TCONS_00004076"; exon_number "1"; oId "CUFF.4163.1"; tss_id "TSS4076"; +chr18 Cufflinks exon 56470253 56470576 . + . gene_id "XLOC_004077"; transcript_id "TCONS_00004077"; exon_number "1"; oId "CUFF.4165.1"; tss_id "TSS4077"; +chr18 Cufflinks exon 56472500 56472605 . + . gene_id "XLOC_004078"; transcript_id "TCONS_00004078"; exon_number "1"; oId "CUFF.4166.1"; tss_id "TSS4078"; +chr18 Cufflinks exon 57640146 57640448 . + . gene_id "XLOC_004079"; transcript_id "TCONS_00004079"; exon_number "1"; oId "CUFF.4171.1"; tss_id "TSS4079"; +chr18 Cufflinks exon 57685857 57685953 . + . gene_id "XLOC_004080"; transcript_id "TCONS_00004080"; exon_number "1"; oId "CUFF.4172.1"; tss_id "TSS4080"; +chr18 Cufflinks exon 57830800 57830943 . + . gene_id "XLOC_004081"; transcript_id "TCONS_00004081"; exon_number "1"; oId "CUFF.4174.1"; tss_id "TSS4081"; +chr18 Cufflinks exon 59058828 59058936 . + . gene_id "XLOC_004082"; transcript_id "TCONS_00004082"; exon_number "1"; oId "CUFF.4176.1"; tss_id "TSS4082"; +chr18 Cufflinks exon 62547225 62547261 . + . gene_id "XLOC_004083"; transcript_id "TCONS_00004083"; exon_number "1"; oId "CUFF.4183.1"; tss_id "TSS4083"; +chr18 Cufflinks exon 63142749 63142836 . + . gene_id "XLOC_004084"; transcript_id "TCONS_00004084"; exon_number "1"; oId "CUFF.4185.1"; tss_id "TSS4084"; +chr18 Cufflinks exon 64613353 64613458 . + . gene_id "XLOC_004085"; transcript_id "TCONS_00004085"; exon_number "1"; oId "CUFF.4188.1"; tss_id "TSS4085"; +chr18 Cufflinks exon 65164428 65164548 . + . gene_id "XLOC_004086"; transcript_id "TCONS_00004086"; exon_number "1"; oId "CUFF.4189.1"; tss_id "TSS4086"; +chr18 Cufflinks exon 66526171 66526277 . + . gene_id "XLOC_004087"; transcript_id "TCONS_00004087"; exon_number "1"; oId "CUFF.4190.1"; tss_id "TSS4087"; +chr18 Cufflinks exon 67339200 67339241 . + . gene_id "XLOC_004088"; transcript_id "TCONS_00004088"; exon_number "1"; oId "CUFF.4192.1"; tss_id "TSS4088"; +chr18 Cufflinks exon 67944651 67944696 . + . gene_id "XLOC_004089"; transcript_id "TCONS_00004089"; exon_number "1"; oId "CUFF.4193.1"; tss_id "TSS4089"; +chr18 Cufflinks exon 68179963 68180254 . + . gene_id "XLOC_004090"; transcript_id "TCONS_00004090"; exon_number "1"; oId "CUFF.4194.1"; tss_id "TSS4090"; +chr18 Cufflinks exon 69084595 69084629 . + . gene_id "XLOC_004091"; transcript_id "TCONS_00004091"; exon_number "1"; oId "CUFF.4195.1"; tss_id "TSS4091"; +chr18 Cufflinks exon 70419231 70419285 . + . gene_id "XLOC_004092"; transcript_id "TCONS_00004092"; exon_number "1"; oId "CUFF.4199.1"; tss_id "TSS4092"; +chr18 Cufflinks exon 71412170 71412485 . + . gene_id "XLOC_004093"; transcript_id "TCONS_00004093"; exon_number "1"; oId "CUFF.4200.1"; tss_id "TSS4093"; +chr18 Cufflinks exon 71894741 71895051 . + . gene_id "XLOC_004094"; transcript_id "TCONS_00004094"; exon_number "1"; oId "CUFF.4201.1"; tss_id "TSS4094"; +chr18 Cufflinks exon 72245077 72245117 . + . gene_id "XLOC_004095"; transcript_id "TCONS_00004095"; exon_number "1"; oId "CUFF.4203.1"; tss_id "TSS4095"; +chr18 Cufflinks exon 75796739 75796841 . + . gene_id "XLOC_004096"; transcript_id "TCONS_00004096"; exon_number "1"; oId "CUFF.4209.1"; tss_id "TSS4096"; +chr18 Cufflinks exon 77772847 77773065 . + . gene_id "XLOC_004097"; transcript_id "TCONS_00004097"; exon_number "1"; oId "CUFF.4212.1"; tss_id "TSS4097"; +chr18 Cufflinks exon 586607 586850 . - . gene_id "XLOC_004098"; transcript_id "TCONS_00004098"; exon_number "1"; oId "CUFF.3998.1"; tss_id "TSS4098"; +chr18 Cufflinks exon 797990 798134 . - . gene_id "XLOC_004099"; transcript_id "TCONS_00004099"; exon_number "1"; oId "CUFF.3999.1"; tss_id "TSS4099"; +chr18 Cufflinks exon 1323847 1324086 . - . gene_id "XLOC_004100"; transcript_id "TCONS_00004100"; exon_number "1"; oId "CUFF.4001.1"; tss_id "TSS4100"; +chr18 Cufflinks exon 2392602 2392682 . - . gene_id "XLOC_004101"; transcript_id "TCONS_00004101"; exon_number "1"; oId "CUFF.4003.1"; tss_id "TSS4101"; +chr18 Cufflinks exon 2649763 2649866 . - . gene_id "XLOC_004102"; transcript_id "TCONS_00004102"; exon_number "1"; oId "CUFF.4004.1"; tss_id "TSS4102"; +chr18 Cufflinks exon 2693103 2693135 . - . gene_id "XLOC_004103"; transcript_id "TCONS_00004103"; exon_number "1"; oId "CUFF.4005.1"; tss_id "TSS4103"; +chr18 Cufflinks exon 3424256 3424348 . - . gene_id "XLOC_004104"; transcript_id "TCONS_00004104"; exon_number "1"; oId "CUFF.4008.1"; tss_id "TSS4104"; +chr18 Cufflinks exon 3571215 3571504 . - . gene_id "XLOC_004105"; transcript_id "TCONS_00004105"; exon_number "1"; oId "CUFF.4009.1"; tss_id "TSS4105"; +chr18 Cufflinks exon 3572935 3573042 . - . gene_id "XLOC_004106"; transcript_id "TCONS_00004106"; exon_number "1"; oId "CUFF.4010.1"; tss_id "TSS4106"; +chr18 Cufflinks exon 3894699 3894805 . - . gene_id "XLOC_004107"; transcript_id "TCONS_00004107"; exon_number "1"; oId "CUFF.4012.1"; tss_id "TSS4107"; +chr18 Cufflinks exon 4070380 4070420 . - . gene_id "XLOC_004108"; transcript_id "TCONS_00004108"; exon_number "1"; oId "CUFF.4013.1"; tss_id "TSS4108"; +chr18 Cufflinks exon 5676172 5676207 . - . gene_id "XLOC_004109"; transcript_id "TCONS_00004109"; exon_number "1"; oId "CUFF.4014.1"; tss_id "TSS4109"; +chr18 Cufflinks exon 5787184 5787253 . - . gene_id "XLOC_004110"; transcript_id "TCONS_00004110"; exon_number "1"; oId "CUFF.4015.1"; tss_id "TSS4110"; +chr18 Cufflinks exon 5918967 5919014 . - . gene_id "XLOC_004111"; transcript_id "TCONS_00004111"; exon_number "1"; oId "CUFF.4016.1"; tss_id "TSS4111"; +chr18 Cufflinks exon 6017721 6017835 . - . gene_id "XLOC_004112"; transcript_id "TCONS_00004112"; exon_number "1"; oId "CUFF.4017.1"; tss_id "TSS4112"; +chr18 Cufflinks exon 6936911 6937018 . - . gene_id "XLOC_004113"; transcript_id "TCONS_00004113"; exon_number "1"; oId "CUFF.4021.1"; tss_id "TSS4113"; +chr18 Cufflinks exon 9518120 9518255 . - . gene_id "XLOC_004114"; transcript_id "TCONS_00004114"; exon_number "1"; oId "CUFF.4026.1"; tss_id "TSS4114"; +chr18 Cufflinks exon 9617985 9618070 . - . gene_id "XLOC_004115"; transcript_id "TCONS_00004115"; exon_number "1"; oId "CUFF.4027.1"; tss_id "TSS4115"; +chr18 Cufflinks exon 9830308 9830624 . - . gene_id "XLOC_004116"; transcript_id "TCONS_00004116"; exon_number "1"; oId "CUFF.4028.1"; tss_id "TSS4116"; +chr18 Cufflinks exon 9844757 9844826 . - . gene_id "XLOC_004117"; transcript_id "TCONS_00004117"; exon_number "1"; oId "CUFF.4029.1"; tss_id "TSS4117"; +chr18 Cufflinks exon 10183175 10183210 . - . gene_id "XLOC_004118"; transcript_id "TCONS_00004118"; exon_number "1"; oId "CUFF.4031.1"; tss_id "TSS4118"; +chr18 Cufflinks exon 10389891 10389998 . - . gene_id "XLOC_004119"; transcript_id "TCONS_00004119"; exon_number "1"; oId "CUFF.4032.1"; tss_id "TSS4119"; +chr18 Cufflinks exon 12304097 12304194 . - . gene_id "XLOC_004120"; transcript_id "TCONS_00004120"; exon_number "1"; oId "CUFF.4034.1"; tss_id "TSS4120"; +chr18 Cufflinks exon 12533420 12533525 . - . gene_id "XLOC_004121"; transcript_id "TCONS_00004121"; exon_number "1"; oId "CUFF.4036.1"; tss_id "TSS4121"; +chr18 Cufflinks exon 13715080 13715367 . - . gene_id "XLOC_004122"; transcript_id "TCONS_00004122"; exon_number "1"; oId "CUFF.4040.1"; tss_id "TSS4122"; +chr18 Cufflinks exon 14531676 14531781 . - . gene_id "XLOC_004123"; transcript_id "TCONS_00004123"; exon_number "1"; oId "CUFF.4042.1"; tss_id "TSS4123"; +chr18 Cufflinks exon 15320841 15320943 . - . gene_id "XLOC_004124"; transcript_id "TCONS_00004124"; exon_number "1"; oId "CUFF.4044.1"; tss_id "TSS4124"; +chr18 Cufflinks exon 18700386 18700466 . - . gene_id "XLOC_004125"; transcript_id "TCONS_00004125"; exon_number "1"; oId "CUFF.4045.1"; tss_id "TSS4125"; +chr18 Cufflinks exon 19508949 19509055 . - . gene_id "XLOC_004126"; transcript_id "TCONS_00004126"; exon_number "1"; oId "CUFF.4049.1"; tss_id "TSS4126"; +chr18 Cufflinks exon 19760075 19760178 . - . gene_id "XLOC_004127"; transcript_id "TCONS_00004127"; exon_number "1"; oId "CUFF.4051.1"; tss_id "TSS4127"; +chr18 Cufflinks exon 19856797 19856861 . - . gene_id "XLOC_004128"; transcript_id "TCONS_00004128"; exon_number "1"; oId "CUFF.4053.1"; tss_id "TSS4128"; +chr18 Cufflinks exon 19872249 19872290 . - . gene_id "XLOC_004129"; transcript_id "TCONS_00004129"; exon_number "1"; oId "CUFF.4054.1"; tss_id "TSS4129"; +chr18 Cufflinks exon 20481489 20481590 . - . gene_id "XLOC_004130"; transcript_id "TCONS_00004130"; exon_number "1"; oId "CUFF.4056.1"; tss_id "TSS4130"; +chr18 Cufflinks exon 21704134 21704249 . - . gene_id "XLOC_004131"; transcript_id "TCONS_00004131"; exon_number "1"; oId "CUFF.4060.1"; tss_id "TSS4131"; +chr18 Cufflinks exon 21750467 21750587 . - . gene_id "XLOC_004132"; transcript_id "TCONS_00004132"; exon_number "1"; oId "CUFF.4061.1"; tss_id "TSS4132"; +chr18 Cufflinks exon 21758994 21759259 . - . gene_id "XLOC_004133"; transcript_id "TCONS_00004133"; exon_number "1"; oId "CUFF.4062.1"; tss_id "TSS4133"; +chr18 Cufflinks exon 23046952 23046987 . - . gene_id "XLOC_004134"; transcript_id "TCONS_00004134"; exon_number "1"; oId "CUFF.4065.1"; tss_id "TSS4134"; +chr18 Cufflinks exon 23398181 23398496 . - . gene_id "XLOC_004135"; transcript_id "TCONS_00004135"; exon_number "1"; oId "CUFF.4066.1"; tss_id "TSS4135"; +chr18 Cufflinks exon 23498947 23498984 . - . gene_id "XLOC_004136"; transcript_id "TCONS_00004136"; exon_number "1"; oId "CUFF.4067.1"; tss_id "TSS4136"; +chr18 Cufflinks exon 23879149 23879219 . - . gene_id "XLOC_004137"; transcript_id "TCONS_00004137"; exon_number "1"; oId "CUFF.4069.1"; tss_id "TSS4137"; +chr18 Cufflinks exon 23946265 23946370 . - . gene_id "XLOC_004138"; transcript_id "TCONS_00004138"; exon_number "1"; oId "CUFF.4070.1"; tss_id "TSS4138"; +chr18 Cufflinks exon 24269282 24269493 . - . gene_id "XLOC_004139"; transcript_id "TCONS_00004139"; exon_number "1"; oId "CUFF.4071.1"; tss_id "TSS4139"; +chr18 Cufflinks exon 24328782 24328816 . - . gene_id "XLOC_004140"; transcript_id "TCONS_00004140"; exon_number "1"; oId "CUFF.4073.1"; tss_id "TSS4140"; +chr18 Cufflinks exon 24402667 24402703 . - . gene_id "XLOC_004141"; transcript_id "TCONS_00004141"; exon_number "1"; oId "CUFF.4074.1"; tss_id "TSS4141"; +chr18 Cufflinks exon 28322501 28322541 . - . gene_id "XLOC_004142"; transcript_id "TCONS_00004142"; exon_number "1"; oId "CUFF.4076.1"; tss_id "TSS4142"; +chr18 Cufflinks exon 28925325 28925430 . - . gene_id "XLOC_004143"; transcript_id "TCONS_00004143"; exon_number "1"; oId "CUFF.4079.1"; tss_id "TSS4143"; +chr18 Cufflinks exon 29249269 29249345 . - . gene_id "XLOC_004144"; transcript_id "TCONS_00004144"; exon_number "1"; oId "CUFF.4081.1"; tss_id "TSS4144"; +chr18 Cufflinks exon 29348702 29348779 . - . gene_id "XLOC_004145"; transcript_id "TCONS_00004145"; exon_number "1"; oId "CUFF.4083.1"; tss_id "TSS4145"; +chr18 Cufflinks exon 29607113 29607179 . - . gene_id "XLOC_004146"; transcript_id "TCONS_00004146"; exon_number "1"; oId "CUFF.4085.1"; tss_id "TSS4146"; +chr18 Cufflinks exon 29756011 29756130 . - . gene_id "XLOC_004147"; transcript_id "TCONS_00004147"; exon_number "1"; oId "CUFF.4087.1"; tss_id "TSS4147"; +chr18 Cufflinks exon 30058132 30058164 . - . gene_id "XLOC_004148"; transcript_id "TCONS_00004148"; exon_number "1"; oId "CUFF.4088.1"; tss_id "TSS4148"; +chr18 Cufflinks exon 36530251 36530358 . - . gene_id "XLOC_004149"; transcript_id "TCONS_00004149"; exon_number "1"; oId "CUFF.4099.1"; tss_id "TSS4149"; +chr18 Cufflinks exon 36596078 36596308 . - . gene_id "XLOC_004150"; transcript_id "TCONS_00004150"; exon_number "1"; oId "CUFF.4100.1"; tss_id "TSS4150"; +chr18 Cufflinks exon 37258484 37258551 . - . gene_id "XLOC_004151"; transcript_id "TCONS_00004151"; exon_number "1"; oId "CUFF.4102.1"; tss_id "TSS4151"; +chr18 Cufflinks exon 37258847 37258887 . - . gene_id "XLOC_004152"; transcript_id "TCONS_00004152"; exon_number "1"; oId "CUFF.4103.1"; tss_id "TSS4152"; +chr18 Cufflinks exon 38772394 38772432 . - . gene_id "XLOC_004153"; transcript_id "TCONS_00004153"; exon_number "1"; oId "CUFF.4105.1"; tss_id "TSS4153"; +chr18 Cufflinks exon 39101106 39101136 . - . gene_id "XLOC_004154"; transcript_id "TCONS_00004154"; exon_number "1"; oId "CUFF.4106.1"; tss_id "TSS4154"; +chr18 Cufflinks exon 41412124 41412229 . - . gene_id "XLOC_004155"; transcript_id "TCONS_00004155"; exon_number "1"; oId "CUFF.4110.1"; tss_id "TSS4155"; +chr18 Cufflinks exon 41535704 41535749 . - . gene_id "XLOC_004156"; transcript_id "TCONS_00004156"; exon_number "1"; oId "CUFF.4111.1"; tss_id "TSS4156"; +chr18 Cufflinks exon 43569679 43569911 . - . gene_id "XLOC_004157"; transcript_id "TCONS_00004157"; exon_number "1"; oId "CUFF.4119.1"; tss_id "TSS4157"; +chr18 Cufflinks exon 43669268 43669338 . - . gene_id "XLOC_004158"; transcript_id "TCONS_00004158"; exon_number "1"; oId "CUFF.4120.1"; tss_id "TSS4158"; +chr18 Cufflinks exon 43701582 43701687 . - . gene_id "XLOC_004159"; transcript_id "TCONS_00004159"; exon_number "1"; oId "CUFF.4121.1"; tss_id "TSS4159"; +chr18 Cufflinks exon 43814108 43814142 . - . gene_id "XLOC_004160"; transcript_id "TCONS_00004160"; exon_number "1"; oId "CUFF.4122.1"; tss_id "TSS4160"; +chr18 Cufflinks exon 44731051 44731086 . - . gene_id "XLOC_004161"; transcript_id "TCONS_00004161"; exon_number "1"; oId "CUFF.4123.1"; tss_id "TSS4161"; +chr18 Cufflinks exon 44760815 44760918 . - . gene_id "XLOC_004162"; transcript_id "TCONS_00004162"; exon_number "1"; oId "CUFF.4124.1"; tss_id "TSS4162"; +chr18 Cufflinks exon 45292916 45293163 . - . gene_id "XLOC_004163"; transcript_id "TCONS_00004163"; exon_number "1"; oId "CUFF.4126.1"; tss_id "TSS4163"; +chr18 Cufflinks exon 45696155 45696261 . - . gene_id "XLOC_004164"; transcript_id "TCONS_00004164"; exon_number "1"; oId "CUFF.4127.1"; tss_id "TSS4164"; +chr18 Cufflinks exon 46001884 46001971 . - . gene_id "XLOC_004165"; transcript_id "TCONS_00004165"; exon_number "1"; oId "CUFF.4130.1"; tss_id "TSS4165"; +chr18 Cufflinks exon 46259320 46259362 . - . gene_id "XLOC_004166"; transcript_id "TCONS_00004166"; exon_number "1"; oId "CUFF.4131.1"; tss_id "TSS4166"; +chr18 Cufflinks exon 47162878 47162941 . - . gene_id "XLOC_004167"; transcript_id "TCONS_00004167"; exon_number "1"; oId "CUFF.4132.1"; tss_id "TSS4167"; +chr18 Cufflinks exon 47472671 47472758 . - . gene_id "XLOC_004168"; transcript_id "TCONS_00004168"; exon_number "1"; oId "CUFF.4134.1"; tss_id "TSS4168"; +chr18 Cufflinks exon 47479436 47479473 . - . gene_id "XLOC_004169"; transcript_id "TCONS_00004169"; exon_number "1"; oId "CUFF.4135.1"; tss_id "TSS4169"; +chr18 Cufflinks exon 47733358 47733645 . - . gene_id "XLOC_004170"; transcript_id "TCONS_00004170"; exon_number "1"; oId "CUFF.4136.1"; tss_id "TSS4170"; +chr18 Cufflinks exon 47740422 47740456 . - . gene_id "XLOC_004171"; transcript_id "TCONS_00004171"; exon_number "1"; oId "CUFF.4137.1"; tss_id "TSS4171"; +chr18 Cufflinks exon 47913655 47913691 . - . gene_id "XLOC_004172"; transcript_id "TCONS_00004172"; exon_number "1"; oId "CUFF.4139.1"; tss_id "TSS4172"; +chr18 Cufflinks exon 48287958 48288132 . - . gene_id "XLOC_004173"; transcript_id "TCONS_00004173"; exon_number "1"; oId "CUFF.4140.1"; tss_id "TSS4173"; +chr18 Cufflinks exon 48523983 48524014 . - . gene_id "XLOC_004174"; transcript_id "TCONS_00004174"; exon_number "1"; oId "CUFF.4142.1"; tss_id "TSS4174"; +chr18 Cufflinks exon 48633099 48633396 . - . gene_id "XLOC_004175"; transcript_id "TCONS_00004175"; exon_number "1"; oId "CUFF.4143.1"; tss_id "TSS4175"; +chr18 Cufflinks exon 48810103 48810260 . - . gene_id "XLOC_004176"; transcript_id "TCONS_00004176"; exon_number "1"; oId "CUFF.4144.1"; tss_id "TSS4176"; +chr18 Cufflinks exon 50298075 50298106 . - . gene_id "XLOC_004177"; transcript_id "TCONS_00004177"; exon_number "1"; oId "CUFF.4146.1"; tss_id "TSS4177"; +chr18 Cufflinks exon 50819647 50819683 . - . gene_id "XLOC_004178"; transcript_id "TCONS_00004178"; exon_number "1"; oId "CUFF.4147.1"; tss_id "TSS4178"; +chr18 Cufflinks exon 50940569 50940603 . - . gene_id "XLOC_004179"; transcript_id "TCONS_00004179"; exon_number "1"; oId "CUFF.4148.1"; tss_id "TSS4179"; +chr18 Cufflinks exon 51663990 51664098 . - . gene_id "XLOC_004180"; transcript_id "TCONS_00004180"; exon_number "1"; oId "CUFF.4150.1"; tss_id "TSS4180"; +chr18 Cufflinks exon 52813796 52813876 . - . gene_id "XLOC_004181"; transcript_id "TCONS_00004181"; exon_number "1"; oId "CUFF.4151.1"; tss_id "TSS4181"; +chr18 Cufflinks exon 53083686 53083718 . - . gene_id "XLOC_004182"; transcript_id "TCONS_00004182"; exon_number "1"; oId "CUFF.4152.1"; tss_id "TSS4182"; +chr18 Cufflinks exon 53746630 53746826 . - . gene_id "XLOC_004183"; transcript_id "TCONS_00004183"; exon_number "1"; oId "CUFF.4153.1"; tss_id "TSS4183"; +chr18 Cufflinks exon 54951833 54951938 . - . gene_id "XLOC_004184"; transcript_id "TCONS_00004184"; exon_number "1"; oId "CUFF.4158.1"; tss_id "TSS4184"; +chr18 Cufflinks exon 55998346 55998383 . - . gene_id "XLOC_004185"; transcript_id "TCONS_00004185"; exon_number "1"; oId "CUFF.4164.1"; tss_id "TSS4185"; +chr18 Cufflinks exon 56486114 56486249 . - . gene_id "XLOC_004186"; transcript_id "TCONS_00004186"; exon_number "1"; oId "CUFF.4167.1"; tss_id "TSS4186"; +chr18 Cufflinks exon 56593472 56593528 . - . gene_id "XLOC_004187"; transcript_id "TCONS_00004187"; exon_number "1"; oId "CUFF.4168.1"; tss_id "TSS4187"; +chr18 Cufflinks exon 56907487 56907565 . - . gene_id "XLOC_004188"; transcript_id "TCONS_00004188"; exon_number "1"; oId "CUFF.4169.1"; tss_id "TSS4188"; +chr18 Cufflinks exon 57379954 57379994 . - . gene_id "XLOC_004189"; transcript_id "TCONS_00004189"; exon_number "1"; oId "CUFF.4170.1"; tss_id "TSS4189"; +chr18 Cufflinks exon 57739383 57739417 . - . gene_id "XLOC_004190"; transcript_id "TCONS_00004190"; exon_number "1"; oId "CUFF.4173.1"; tss_id "TSS4190"; +chr18 Cufflinks exon 58715936 58716021 . - . gene_id "XLOC_004191"; transcript_id "TCONS_00004191"; exon_number "1"; oId "CUFF.4175.1"; tss_id "TSS4191"; +chr18 Cufflinks exon 60317528 60317823 . - . gene_id "XLOC_004192"; transcript_id "TCONS_00004192"; exon_number "1"; oId "CUFF.4177.1"; tss_id "TSS4192"; +chr18 Cufflinks exon 60398459 60398565 . - . gene_id "XLOC_004193"; transcript_id "TCONS_00004193"; exon_number "1"; oId "CUFF.4178.1"; tss_id "TSS4193"; +chr18 Cufflinks exon 60861831 60861899 . - . gene_id "XLOC_004194"; transcript_id "TCONS_00004194"; exon_number "1"; oId "CUFF.4179.1"; tss_id "TSS4194"; +chr18 Cufflinks exon 62036810 62036933 . - . gene_id "XLOC_004195"; transcript_id "TCONS_00004195"; exon_number "1"; oId "CUFF.4180.1"; tss_id "TSS4195"; +chr18 Cufflinks exon 62216700 62216742 . - . gene_id "XLOC_004196"; transcript_id "TCONS_00004196"; exon_number "1"; oId "CUFF.4181.1"; tss_id "TSS4196"; +chr18 Cufflinks exon 62364176 62364208 . - . gene_id "XLOC_004197"; transcript_id "TCONS_00004197"; exon_number "1"; oId "CUFF.4182.1"; tss_id "TSS4197"; +chr18 Cufflinks exon 63057534 63057617 . - . gene_id "XLOC_004198"; transcript_id "TCONS_00004198"; exon_number "1"; oId "CUFF.4184.1"; tss_id "TSS4198"; +chr18 Cufflinks exon 63212160 63212201 . - . gene_id "XLOC_004199"; transcript_id "TCONS_00004199"; exon_number "1"; oId "CUFF.4186.1"; tss_id "TSS4199"; +chr18 Cufflinks exon 64446256 64446290 . - . gene_id "XLOC_004200"; transcript_id "TCONS_00004200"; exon_number "1"; oId "CUFF.4187.1"; tss_id "TSS4200"; +chr18 Cufflinks exon 66746453 66746509 . - . gene_id "XLOC_004201"; transcript_id "TCONS_00004201"; exon_number "1"; oId "CUFF.4191.1"; tss_id "TSS4201"; +chr18 Cufflinks exon 69334618 69334676 . - . gene_id "XLOC_004202"; transcript_id "TCONS_00004202"; exon_number "1"; oId "CUFF.4196.1"; tss_id "TSS4202"; +chr18 Cufflinks exon 69560085 69560119 . - . gene_id "XLOC_004203"; transcript_id "TCONS_00004203"; exon_number "1"; oId "CUFF.4197.1"; tss_id "TSS4203"; +chr18 Cufflinks exon 69955498 69955533 . - . gene_id "XLOC_004204"; transcript_id "TCONS_00004204"; exon_number "1"; oId "CUFF.4198.1"; tss_id "TSS4204"; +chr18 Cufflinks exon 72244400 72244658 . - . gene_id "XLOC_004205"; transcript_id "TCONS_00004205"; exon_number "1"; oId "CUFF.4202.1"; tss_id "TSS4205"; +chr18 Cufflinks exon 73404765 73404801 . - . gene_id "XLOC_004206"; transcript_id "TCONS_00004206"; exon_number "1"; oId "CUFF.4204.1"; tss_id "TSS4206"; +chr18 Cufflinks exon 73829910 73829947 . - . gene_id "XLOC_004207"; transcript_id "TCONS_00004207"; exon_number "1"; oId "CUFF.4205.1"; tss_id "TSS4207"; +chr18 Cufflinks exon 74512661 74512696 . - . gene_id "XLOC_004208"; transcript_id "TCONS_00004208"; exon_number "1"; oId "CUFF.4206.1"; tss_id "TSS4208"; +chr18 Cufflinks exon 74792959 74793008 . - . gene_id "XLOC_004209"; transcript_id "TCONS_00004209"; exon_number "1"; oId "CUFF.4207.1"; tss_id "TSS4209"; +chr18 Cufflinks exon 75575444 75575523 . - . gene_id "XLOC_004210"; transcript_id "TCONS_00004210"; exon_number "1"; oId "CUFF.4208.1"; tss_id "TSS4210"; +chr18 Cufflinks exon 77610884 77610966 . - . gene_id "XLOC_004211"; transcript_id "TCONS_00004211"; exon_number "1"; oId "CUFF.4210.1"; tss_id "TSS4211"; +chr18 Cufflinks exon 77611491 77611555 . - . gene_id "XLOC_004212"; transcript_id "TCONS_00004212"; exon_number "1"; oId "CUFF.4211.1"; tss_id "TSS4212"; +chr19 Cufflinks exon 453136 453224 . + . gene_id "XLOC_004213"; transcript_id "TCONS_00004213"; exon_number "1"; oId "CUFF.4214.1"; tss_id "TSS4213"; +chr19 Cufflinks exon 893484 893585 . + . gene_id "XLOC_004214"; transcript_id "TCONS_00004214"; exon_number "1"; oId "CUFF.4215.1"; tss_id "TSS4214"; +chr19 Cufflinks exon 1021521 1021627 . + . gene_id "XLOC_004215"; transcript_id "TCONS_00004215"; exon_number "1"; oId "CUFF.4216.1"; tss_id "TSS4215"; +chr19 Cufflinks exon 1383562 1383636 . + . gene_id "XLOC_004216"; transcript_id "TCONS_00004216"; exon_number "1"; oId "CUFF.4218.1"; tss_id "TSS4216"; +chr19 Cufflinks exon 2886563 2886597 . + . gene_id "XLOC_004217"; transcript_id "TCONS_00004217"; exon_number "1"; oId "CUFF.4222.1"; tss_id "TSS4217"; +chr19 Cufflinks exon 4724082 4724153 . + . gene_id "XLOC_004218"; transcript_id "TCONS_00004218"; exon_number "1"; oId "CUFF.4225.1"; tss_id "TSS4218"; +chr19 Cufflinks exon 6886994 6887046 . + . gene_id "XLOC_004219"; transcript_id "TCONS_00004219"; exon_number "1"; oId "CUFF.4228.1"; tss_id "TSS4219"; +chr19 Cufflinks exon 8331508 8331518 . + . gene_id "XLOC_004220"; transcript_id "TCONS_00004220"; exon_number "1"; oId "CUFF.4230.1"; tss_id "TSS4220"; +chr19 Cufflinks exon 10778408 10778561 . + . gene_id "XLOC_004221"; transcript_id "TCONS_00004221"; exon_number "1"; oId "CUFF.4235.1"; tss_id "TSS4221"; +chr19 Cufflinks exon 10963143 10963180 . + . gene_id "XLOC_004222"; transcript_id "TCONS_00004222"; exon_number "1"; oId "CUFF.4236.1"; tss_id "TSS4222"; +chr19 Cufflinks exon 11122384 11122703 . + . gene_id "XLOC_004223"; transcript_id "TCONS_00004223"; exon_number "1"; oId "CUFF.4237.1"; tss_id "TSS4223"; +chr19 Cufflinks exon 11549692 11549720 . + . gene_id "XLOC_004224"; transcript_id "TCONS_00004224"; exon_number "1"; oId "CUFF.4238.1"; tss_id "TSS4224"; +chr19 Cufflinks exon 11549996 11550099 . + . gene_id "XLOC_004225"; transcript_id "TCONS_00004225"; exon_number "1"; oId "CUFF.4239.1"; tss_id "TSS4225"; +chr19 Cufflinks exon 11610213 11610259 . + . gene_id "XLOC_004226"; transcript_id "TCONS_00004226"; exon_number "1"; oId "CUFF.4241.1"; tss_id "TSS4226"; +chr19 Cufflinks exon 12107630 12107733 . + . gene_id "XLOC_004227"; transcript_id "TCONS_00004227"; exon_number "1"; oId "CUFF.4243.1"; tss_id "TSS4227"; +chr19 Cufflinks exon 12180985 12181087 . + . gene_id "XLOC_004228"; transcript_id "TCONS_00004228"; exon_number "1"; oId "CUFF.4245.1"; tss_id "TSS4228"; +chr19 Cufflinks exon 12206964 12207035 . + . gene_id "XLOC_004229"; transcript_id "TCONS_00004229"; exon_number "1"; oId "CUFF.4246.1"; tss_id "TSS4229"; +chr19 Cufflinks exon 12217315 12217431 . + . gene_id "XLOC_004230"; transcript_id "TCONS_00004230"; exon_number "1"; oId "CUFF.4247.1"; tss_id "TSS4230"; +chr19 Cufflinks exon 12299376 12299450 . + . gene_id "XLOC_004231"; transcript_id "TCONS_00004231"; exon_number "1"; oId "CUFF.4249.1"; tss_id "TSS4231"; +chr19 Cufflinks exon 14323864 14324133 . + . gene_id "XLOC_004232"; transcript_id "TCONS_00004232"; exon_number "1"; oId "CUFF.4252.1"; tss_id "TSS4232"; +chr19 Cufflinks exon 14694907 14695228 . + . gene_id "XLOC_004233"; transcript_id "TCONS_00004233"; exon_number "1"; oId "CUFF.4253.1"; tss_id "TSS4233"; +chr19 Cufflinks exon 14699176 14699489 . + . gene_id "XLOC_004234"; transcript_id "TCONS_00004234"; exon_number "1"; oId "CUFF.4254.1"; tss_id "TSS4234"; +chr19 Cufflinks exon 15256026 15256122 . + . gene_id "XLOC_004235"; transcript_id "TCONS_00004235"; exon_number "1"; oId "CUFF.4257.1"; tss_id "TSS4235"; +chr19 Cufflinks exon 15418447 15418643 . + . gene_id "XLOC_004236"; transcript_id "TCONS_00004236"; exon_number "1"; oId "CUFF.4258.1"; tss_id "TSS4236"; +chr19 Cufflinks exon 15418948 15419108 . + . gene_id "XLOC_004237"; transcript_id "TCONS_00004237"; exon_number "1"; oId "CUFF.4259.1"; tss_id "TSS4237"; +chr19 Cufflinks exon 15837287 15837358 . + . gene_id "XLOC_004238"; transcript_id "TCONS_00004238"; exon_number "1"; oId "CUFF.4261.1"; tss_id "TSS4238"; +chr19 Cufflinks exon 16936864 16936947 . + . gene_id "XLOC_004239"; transcript_id "TCONS_00004239"; exon_number "1"; oId "CUFF.4265.1"; tss_id "TSS4239"; +chr19 Cufflinks exon 16959782 16959818 . + . gene_id "XLOC_004240"; transcript_id "TCONS_00004240"; exon_number "1"; oId "CUFF.4266.1"; tss_id "TSS4240"; +chr19 Cufflinks exon 17338116 17338215 . + . gene_id "XLOC_004241"; transcript_id "TCONS_00004241"; exon_number "1"; oId "CUFF.4269.1"; tss_id "TSS4241"; +chr19 Cufflinks exon 17963435 17963491 . + . gene_id "XLOC_004242"; transcript_id "TCONS_00004242"; exon_number "1"; oId "CUFF.4270.1"; tss_id "TSS4242"; +chr19 Cufflinks exon 18082835 18082881 . + . gene_id "XLOC_004243"; transcript_id "TCONS_00004243"; exon_number "1"; oId "CUFF.4271.1"; tss_id "TSS4243"; +chr19 Cufflinks exon 18187532 18187585 . + . gene_id "XLOC_004244"; transcript_id "TCONS_00004244"; exon_number "1"; oId "CUFF.4272.1"; tss_id "TSS4244"; +chr19 Cufflinks exon 18444086 18444395 . + . gene_id "XLOC_004245"; transcript_id "TCONS_00004245"; exon_number "1"; oId "CUFF.4273.1"; tss_id "TSS4245"; +chr19 Cufflinks exon 19269220 19269275 . + . gene_id "XLOC_004246"; transcript_id "TCONS_00004246"; exon_number "1"; oId "CUFF.4276.1"; tss_id "TSS4246"; +chr19 Cufflinks exon 19343664 19343736 . + . gene_id "XLOC_004247"; transcript_id "TCONS_00004247"; exon_number "1"; oId "CUFF.4277.1"; tss_id "TSS4247"; +chr19 Cufflinks exon 19818693 19818767 . + . gene_id "XLOC_004248"; transcript_id "TCONS_00004248"; exon_number "1"; oId "CUFF.4278.1"; tss_id "TSS4248"; +chr19 Cufflinks exon 19852208 19852280 . + . gene_id "XLOC_004249"; transcript_id "TCONS_00004249"; exon_number "1"; oId "CUFF.4279.1"; tss_id "TSS4249"; +chr19 Cufflinks exon 22738063 22738169 . + . gene_id "XLOC_004250"; transcript_id "TCONS_00004250"; exon_number "1"; oId "CUFF.4281.1"; tss_id "TSS4250"; +chr19 Cufflinks exon 22784327 22784528 . + . gene_id "XLOC_004251"; transcript_id "TCONS_00004251"; exon_number "1"; oId "CUFF.4282.1"; tss_id "TSS4251"; +chr19 Cufflinks exon 23464550 23464587 . + . gene_id "XLOC_004252"; transcript_id "TCONS_00004252"; exon_number "1"; oId "CUFF.4284.1"; tss_id "TSS4252"; +chr19 Cufflinks exon 23469414 23469453 . + . gene_id "XLOC_004253"; transcript_id "TCONS_00004253"; exon_number "1"; oId "CUFF.4285.1"; tss_id "TSS4253"; +chr19 Cufflinks exon 23766251 23766289 . + . gene_id "XLOC_004254"; transcript_id "TCONS_00004254"; exon_number "1"; oId "CUFF.4286.1"; tss_id "TSS4254"; +chr19 Cufflinks exon 24182337 24182381 . + . gene_id "XLOC_004255"; transcript_id "TCONS_00004255"; exon_number "1"; oId "CUFF.4287.1"; tss_id "TSS4255"; +chr19 Cufflinks exon 28563321 28563392 . + . gene_id "XLOC_004256"; transcript_id "TCONS_00004256"; exon_number "1"; oId "CUFF.4290.1"; tss_id "TSS4256"; +chr19 Cufflinks exon 29421909 29422015 . + . gene_id "XLOC_004257"; transcript_id "TCONS_00004257"; exon_number "1"; oId "CUFF.4291.1"; tss_id "TSS4257"; +chr19 Cufflinks exon 29492574 29492663 . + . gene_id "XLOC_004258"; transcript_id "TCONS_00004258"; exon_number "1"; oId "CUFF.4292.1"; tss_id "TSS4258"; +chr19 Cufflinks exon 29858600 29858633 . + . gene_id "XLOC_004259"; transcript_id "TCONS_00004259"; exon_number "1"; oId "CUFF.4294.1"; tss_id "TSS4259"; +chr19 Cufflinks exon 32486717 32486769 . + . gene_id "XLOC_004260"; transcript_id "TCONS_00004260"; exon_number "1"; oId "CUFF.4297.1"; tss_id "TSS4260"; +chr19 Cufflinks exon 33501933 33501973 . + . gene_id "XLOC_004261"; transcript_id "TCONS_00004261"; exon_number "1"; oId "CUFF.4304.1"; tss_id "TSS4261"; +chr19 Cufflinks exon 33542309 33542376 . + . gene_id "XLOC_004262"; transcript_id "TCONS_00004262"; exon_number "1"; oId "CUFF.4305.1"; tss_id "TSS4262"; +chr19 Cufflinks exon 33667963 33668037 . + . gene_id "XLOC_004263"; transcript_id "TCONS_00004263"; exon_number "1"; oId "CUFF.4307.1"; tss_id "TSS4263"; +chr19 Cufflinks exon 33966709 33966750 . + . gene_id "XLOC_004264"; transcript_id "TCONS_00004264"; exon_number "1"; oId "CUFF.4308.1"; tss_id "TSS4264"; +chr19 Cufflinks exon 34688934 34688968 . + . gene_id "XLOC_004265"; transcript_id "TCONS_00004265"; exon_number "1"; oId "CUFF.4313.1"; tss_id "TSS4265"; +chr19 Cufflinks exon 36066506 36066825 . + . gene_id "XLOC_004266"; transcript_id "TCONS_00004266"; exon_number "1"; oId "CUFF.4315.1"; tss_id "TSS4266"; +chr19 Cufflinks exon 36372792 36373053 . + . gene_id "XLOC_004267"; transcript_id "TCONS_00004267"; exon_number "1"; oId "CUFF.4316.1"; tss_id "TSS4267"; +chr19 Cufflinks exon 38201791 38201823 . + . gene_id "XLOC_004268"; transcript_id "TCONS_00004268"; exon_number "1"; oId "CUFF.4321.1"; tss_id "TSS4268"; +chr19 Cufflinks exon 38690874 38691183 . + . gene_id "XLOC_004269"; transcript_id "TCONS_00004269"; exon_number "1"; oId "CUFF.4322.1"; tss_id "TSS4269"; +chr19 Cufflinks exon 39859790 39860108 . + . gene_id "XLOC_004270"; transcript_id "TCONS_00004270"; exon_number "1"; oId "CUFF.4327.1"; tss_id "TSS4270"; +chr19 Cufflinks exon 39951955 39952035 . + . gene_id "XLOC_004271"; transcript_id "TCONS_00004271"; exon_number "1"; oId "CUFF.4329.1"; tss_id "TSS4271"; +chr19 Cufflinks exon 42977028 42977105 . + . gene_id "XLOC_004272"; transcript_id "TCONS_00004272"; exon_number "1"; oId "CUFF.4338.1"; tss_id "TSS4272"; +chr19 Cufflinks exon 43205357 43205429 . + . gene_id "XLOC_004273"; transcript_id "TCONS_00004273"; exon_number "1"; oId "CUFF.4341.1"; tss_id "TSS4273"; +chr19 Cufflinks exon 43910306 43911078 . + . gene_id "XLOC_004274"; transcript_id "TCONS_00004274"; exon_number "1"; oId "CUFF.4342.1"; tss_id "TSS4274"; +chr19 Cufflinks exon 43911249 43911354 . + . gene_id "XLOC_004275"; transcript_id "TCONS_00004275"; exon_number "1"; oId "CUFF.4343.1"; tss_id "TSS4275"; +chr19 Cufflinks exon 43911666 43912167 . + . gene_id "XLOC_004276"; transcript_id "TCONS_00004276"; exon_number "1"; oId "CUFF.4344.1"; tss_id "TSS4276"; +chr19 Cufflinks exon 44326048 44326088 . + . gene_id "XLOC_004277"; transcript_id "TCONS_00004277"; exon_number "1"; oId "CUFF.4346.1"; tss_id "TSS4277"; +chr19 Cufflinks exon 44596263 44596551 . + . gene_id "XLOC_004278"; transcript_id "TCONS_00004278"; exon_number "1"; oId "CUFF.4348.1"; tss_id "TSS4278"; +chr19 Cufflinks exon 45482079 45482145 . + . gene_id "XLOC_004279"; transcript_id "TCONS_00004279"; exon_number "1"; oId "CUFF.4352.1"; tss_id "TSS4279"; +chr19 Cufflinks exon 45550718 45550819 . + . gene_id "XLOC_004280"; transcript_id "TCONS_00004280"; exon_number "1"; oId "CUFF.4353.1"; tss_id "TSS4280"; +chr19 Cufflinks exon 46154768 46155076 . + . gene_id "XLOC_004281"; transcript_id "TCONS_00004281"; exon_number "1"; oId "CUFF.4355.1"; tss_id "TSS4281"; +chr19 Cufflinks exon 47450739 47450778 . + . gene_id "XLOC_004282"; transcript_id "TCONS_00004282"; exon_number "1"; oId "CUFF.4359.1"; tss_id "TSS4282"; +chr19 Cufflinks exon 47451565 47451626 . + . gene_id "XLOC_004283"; transcript_id "TCONS_00004283"; exon_number "1"; oId "CUFF.4360.1"; tss_id "TSS4283"; +chr19 Cufflinks exon 48084280 48084593 . + . gene_id "XLOC_004284"; transcript_id "TCONS_00004284"; exon_number "1"; oId "CUFF.4362.1"; tss_id "TSS4284"; +chr19 Cufflinks exon 48746068 48746096 . + . gene_id "XLOC_004285"; transcript_id "TCONS_00004285"; exon_number "1"; oId "CUFF.4363.1"; tss_id "TSS4285"; +chr19 Cufflinks exon 49584589 49584893 . + . gene_id "XLOC_004286"; transcript_id "TCONS_00004286"; exon_number "1"; oId "CUFF.4367.1"; tss_id "TSS4286"; +chr19 Cufflinks exon 52172657 52172759 . + . gene_id "XLOC_004287"; transcript_id "TCONS_00004287"; exon_number "1"; oId "CUFF.4372.1"; tss_id "TSS4287"; +chr19 Cufflinks exon 52286863 52286922 . + . gene_id "XLOC_004288"; transcript_id "TCONS_00004288"; exon_number "1"; oId "CUFF.4373.1"; tss_id "TSS4288"; +chr19 Cufflinks exon 52333774 52333826 . + . gene_id "XLOC_004289"; transcript_id "TCONS_00004289"; exon_number "1"; oId "CUFF.4374.1"; tss_id "TSS4289"; +chr19 Cufflinks exon 52571512 52571601 . + . gene_id "XLOC_004290"; transcript_id "TCONS_00004290"; exon_number "1"; oId "CUFF.4376.1"; tss_id "TSS4290"; +chr19 Cufflinks exon 52621011 52621090 . + . gene_id "XLOC_004291"; transcript_id "TCONS_00004291"; exon_number "1"; oId "CUFF.4377.1"; tss_id "TSS4291"; +chr19 Cufflinks exon 54132967 54133178 . + . gene_id "XLOC_004292"; transcript_id "TCONS_00004292"; exon_number "1"; oId "CUFF.4382.1"; tss_id "TSS4292"; +chr19 Cufflinks exon 54133484 54133544 . + . gene_id "XLOC_004293"; transcript_id "TCONS_00004293"; exon_number "1"; oId "CUFF.4383.1"; tss_id "TSS4293"; +chr19 Cufflinks exon 54156939 54157044 . + . gene_id "XLOC_004294"; transcript_id "TCONS_00004294"; exon_number "1"; oId "CUFF.4384.1"; tss_id "TSS4294"; +chr19 Cufflinks exon 54195015 54195083 . + . gene_id "XLOC_004295"; transcript_id "TCONS_00004295"; exon_number "1"; oId "CUFF.4387.1"; tss_id "TSS4295"; +chr19 Cufflinks exon 54206832 54206900 . + . gene_id "XLOC_004296"; transcript_id "TCONS_00004296"; exon_number "1"; oId "CUFF.4388.1"; tss_id "TSS4296"; +chr19 Cufflinks exon 54213187 54213254 . + . gene_id "XLOC_004297"; transcript_id "TCONS_00004297"; exon_number "1"; oId "CUFF.4389.1"; tss_id "TSS4297"; +chr19 Cufflinks exon 54405264 54405298 . + . gene_id "XLOC_004298"; transcript_id "TCONS_00004298"; exon_number "1"; oId "CUFF.4398.1"; tss_id "TSS4298"; +chr19 Cufflinks exon 55678538 55678645 . + . gene_id "XLOC_004299"; transcript_id "TCONS_00004299"; exon_number "1"; oId "CUFF.4403.1"; tss_id "TSS4299"; +chr19 Cufflinks exon 56248651 56248892 . + . gene_id "XLOC_004300"; transcript_id "TCONS_00004300"; exon_number "1"; oId "CUFF.4405.1"; tss_id "TSS4300"; +chr19 Cufflinks exon 56360734 56360765 . + . gene_id "XLOC_004301"; transcript_id "TCONS_00004301"; exon_number "1"; oId "CUFF.4406.1"; tss_id "TSS4301"; +chr19 Cufflinks exon 58336276 58336306 . + . gene_id "XLOC_004302"; transcript_id "TCONS_00004302"; exon_number "1"; oId "CUFF.4413.1"; tss_id "TSS4302"; +chr19 Cufflinks exon 58378631 58378720 . + . gene_id "XLOC_004303"; transcript_id "TCONS_00004303"; exon_number "1"; oId "CUFF.4414.1"; tss_id "TSS4303"; +chr19 Cufflinks exon 58472364 58472398 . + . gene_id "XLOC_004304"; transcript_id "TCONS_00004304"; exon_number "1"; oId "CUFF.4416.1"; tss_id "TSS4304"; +chr19 Cufflinks exon 58581338 58581552 . + . gene_id "XLOC_004305"; transcript_id "TCONS_00004305"; exon_number "1"; oId "CUFF.4417.1"; tss_id "TSS4305"; +chr19 Cufflinks exon 58581838 58581931 . + . gene_id "XLOC_004306"; transcript_id "TCONS_00004306"; exon_number "1"; oId "CUFF.4418.1"; tss_id "TSS4306"; +chr19 Cufflinks exon 58709795 58709849 . + . gene_id "XLOC_004307"; transcript_id "TCONS_00004307"; exon_number "1"; oId "CUFF.4419.1"; tss_id "TSS4307"; +chr19 Cufflinks exon 58874865 58874939 . + . gene_id "XLOC_004308"; transcript_id "TCONS_00004308"; exon_number "1"; oId "CUFF.4420.1"; tss_id "TSS4308"; +chr19 Cufflinks exon 223158 223260 . - . gene_id "XLOC_004309"; transcript_id "TCONS_00004309"; exon_number "1"; oId "CUFF.4213.1"; tss_id "TSS4309"; +chr19 Cufflinks exon 1383361 1383433 . - . gene_id "XLOC_004310"; transcript_id "TCONS_00004310"; exon_number "1"; oId "CUFF.4217.1"; tss_id "TSS4310"; +chr19 Cufflinks exon 1570554 1570859 . - . gene_id "XLOC_004311"; transcript_id "TCONS_00004311"; exon_number "1"; oId "CUFF.4219.1"; tss_id "TSS4311"; +chr19 Cufflinks exon 1616498 1616566 . - . gene_id "XLOC_004312"; transcript_id "TCONS_00004312"; exon_number "1"; oId "CUFF.4220.1"; tss_id "TSS4312"; +chr19 Cufflinks exon 2503045 2503138 . - . gene_id "XLOC_004313"; transcript_id "TCONS_00004313"; exon_number "1"; oId "CUFF.4221.1"; tss_id "TSS4313"; +chr19 Cufflinks exon 4384484 4384557 . - . gene_id "XLOC_004314"; transcript_id "TCONS_00004314"; exon_number "1"; oId "CUFF.4223.1"; tss_id "TSS4314"; +chr19 Cufflinks exon 4723065 4723103 . - . gene_id "XLOC_004315"; transcript_id "TCONS_00004315"; exon_number "1"; oId "CUFF.4224.1"; tss_id "TSS4315"; +chr19 Cufflinks exon 4724647 4724719 . - . gene_id "XLOC_004316"; transcript_id "TCONS_00004316"; exon_number "1"; oId "CUFF.4226.1"; tss_id "TSS4316"; +chr19 Cufflinks exon 6786888 6786964 . - . gene_id "XLOC_004317"; transcript_id "TCONS_00004317"; exon_number "1"; oId "CUFF.4227.1"; tss_id "TSS4317"; +chr19 Cufflinks exon 7951861 7951980 . - . gene_id "XLOC_004318"; transcript_id "TCONS_00004318"; exon_number "1"; oId "CUFF.4229.1"; tss_id "TSS4318"; +chr19 Cufflinks exon 8793667 8793703 . - . gene_id "XLOC_004319"; transcript_id "TCONS_00004319"; exon_number "1"; oId "CUFF.4231.1"; tss_id "TSS4319"; +chr19 Cufflinks exon 10350629 10350659 . - . gene_id "XLOC_004320"; transcript_id "TCONS_00004320"; exon_number "1"; oId "CUFF.4232.1"; tss_id "TSS4320"; +chr19 Cufflinks exon 10661710 10661768 . - . gene_id "XLOC_004321"; transcript_id "TCONS_00004321"; exon_number "1"; oId "CUFF.4233.1"; tss_id "TSS4321"; +chr19 Cufflinks exon 10705133 10705210 . - . gene_id "XLOC_004322"; transcript_id "TCONS_00004322"; exon_number "1"; oId "CUFF.4234.1"; tss_id "TSS4322"; +chr19 Cufflinks exon 11561344 11561421 . - . gene_id "XLOC_004323"; transcript_id "TCONS_00004323"; exon_number "1"; oId "CUFF.4240.1"; tss_id "TSS4323"; +chr19 Cufflinks exon 11626858 11627124 . - . gene_id "XLOC_004324"; transcript_id "TCONS_00004324"; exon_number "1"; oId "CUFF.4242.1"; tss_id "TSS4324"; +chr19 Cufflinks exon 12138727 12138836 . - . gene_id "XLOC_004325"; transcript_id "TCONS_00004325"; exon_number "1"; oId "CUFF.4244.1"; tss_id "TSS4325"; +chr19 Cufflinks exon 12261921 12262002 . - . gene_id "XLOC_004326"; transcript_id "TCONS_00004326"; exon_number "1"; oId "CUFF.4248.1"; tss_id "TSS4326"; +chr19 Cufflinks exon 13454661 13454694 . - . gene_id "XLOC_004327"; transcript_id "TCONS_00004327"; exon_number "1"; oId "CUFF.4250.1"; tss_id "TSS4327"; +chr19 Cufflinks exon 13852272 13852317 . - . gene_id "XLOC_004328"; transcript_id "TCONS_00004328"; exon_number "1"; oId "CUFF.4251.1"; tss_id "TSS4328"; +chr19 Cufflinks exon 14724804 14724884 . - . gene_id "XLOC_004329"; transcript_id "TCONS_00004329"; exon_number "1"; oId "CUFF.4255.1"; tss_id "TSS4329"; +chr19 Cufflinks exon 15037943 15037993 . - . gene_id "XLOC_004330"; transcript_id "TCONS_00004330"; exon_number "1"; oId "CUFF.4256.1"; tss_id "TSS4330"; +chr19 Cufflinks exon 15449292 15449384 . - . gene_id "XLOC_004331"; transcript_id "TCONS_00004331"; exon_number "1"; oId "CUFF.4260.1"; tss_id "TSS4331"; +chr19 Cufflinks exon 16357897 16357932 . - . gene_id "XLOC_004332"; transcript_id "TCONS_00004332"; exon_number "1"; oId "CUFF.4262.1"; tss_id "TSS4332"; +chr19 Cufflinks exon 16509466 16509770 . - . gene_id "XLOC_004333"; transcript_id "TCONS_00004333"; exon_number "1"; oId "CUFF.4263.1"; tss_id "TSS4333"; +chr19 Cufflinks exon 16650489 16650795 . - . gene_id "XLOC_004334"; transcript_id "TCONS_00004334"; exon_number "1"; oId "CUFF.4264.1"; tss_id "TSS4334"; +chr19 Cufflinks exon 17020567 17020666 . - . gene_id "XLOC_004335"; transcript_id "TCONS_00004335"; exon_number "1"; oId "CUFF.4267.1"; tss_id "TSS4335"; +chr19 Cufflinks exon 17021279 17021594 . - . gene_id "XLOC_004336"; transcript_id "TCONS_00004336"; exon_number "1"; oId "CUFF.4268.1"; tss_id "TSS4336"; +chr19 Cufflinks exon 18652081 18652131 . - . gene_id "XLOC_004337"; transcript_id "TCONS_00004337"; exon_number "1"; oId "CUFF.4274.1"; tss_id "TSS4337"; +chr19 Cufflinks exon 19068750 19069067 . - . gene_id "XLOC_004338"; transcript_id "TCONS_00004338"; exon_number "1"; oId "CUFF.4275.1"; tss_id "TSS4338"; +chr19 Cufflinks exon 21295932 21296041 . - . gene_id "XLOC_004339"; transcript_id "TCONS_00004339"; exon_number "1"; oId "CUFF.4280.1"; tss_id "TSS4339"; +chr19 Cufflinks exon 22877615 22877696 . - . gene_id "XLOC_004340"; transcript_id "TCONS_00004340"; exon_number "1"; oId "CUFF.4283.1"; tss_id "TSS4340"; +chr19 Cufflinks exon 24182399 24182565 . - . gene_id "XLOC_004341"; transcript_id "TCONS_00004341"; exon_number "1"; oId "CUFF.4288.1"; tss_id "TSS4341"; +chr19 Cufflinks exon 24182636 24186210 . - . gene_id "XLOC_004342"; transcript_id "TCONS_00004342"; exon_number "1"; oId "CUFF.4289.1"; tss_id "TSS4342"; +chr19 Cufflinks exon 29723977 29724292 . - . gene_id "XLOC_004343"; transcript_id "TCONS_00004343"; exon_number "1"; oId "CUFF.4293.1"; tss_id "TSS4343"; +chr19 Cufflinks exon 32146300 32146367 . - . gene_id "XLOC_004344"; transcript_id "TCONS_00004344"; exon_number "1"; oId "CUFF.4295.1"; tss_id "TSS4344"; +chr19 Cufflinks exon 32278054 32278159 . - . gene_id "XLOC_004345"; transcript_id "TCONS_00004345"; exon_number "1"; oId "CUFF.4296.1"; tss_id "TSS4345"; +chr19 Cufflinks exon 32734869 32734979 . - . gene_id "XLOC_004346"; transcript_id "TCONS_00004346"; exon_number "1"; oId "CUFF.4298.1"; tss_id "TSS4346"; +chr19 Cufflinks exon 33145563 33145670 . - . gene_id "XLOC_004347"; transcript_id "TCONS_00004347"; exon_number "1"; oId "CUFF.4299.1"; tss_id "TSS4347"; +chr19 Cufflinks exon 33145987 33146214 . - . gene_id "XLOC_004348"; transcript_id "TCONS_00004348"; exon_number "1"; oId "CUFF.4300.1"; tss_id "TSS4348"; +chr19 Cufflinks exon 33197918 33197982 . - . gene_id "XLOC_004349"; transcript_id "TCONS_00004349"; exon_number "1"; oId "CUFF.4301.1"; tss_id "TSS4349"; +chr19 Cufflinks exon 33223683 33223713 . - . gene_id "XLOC_004350"; transcript_id "TCONS_00004350"; exon_number "1"; oId "CUFF.4302.1"; tss_id "TSS4350"; +chr19 Cufflinks exon 33353762 33353998 . - . gene_id "XLOC_004351"; transcript_id "TCONS_00004351"; exon_number "1"; oId "CUFF.4303.1"; tss_id "TSS4351"; +chr19 Cufflinks exon 33581270 33581304 . - . gene_id "XLOC_004352"; transcript_id "TCONS_00004352"; exon_number "1"; oId "CUFF.4306.1"; tss_id "TSS4352"; +chr19 Cufflinks exon 34417932 34417999 . - . gene_id "XLOC_004353"; transcript_id "TCONS_00004353"; exon_number "1"; oId "CUFF.4309.1"; tss_id "TSS4353"; +chr19 Cufflinks exon 34418309 34418530 . - . gene_id "XLOC_004354"; transcript_id "TCONS_00004354"; exon_number "1"; oId "CUFF.4310.1"; tss_id "TSS4354"; +chr19 Cufflinks exon 34507783 34507824 . - . gene_id "XLOC_004355"; transcript_id "TCONS_00004355"; exon_number "1"; oId "CUFF.4311.1"; tss_id "TSS4355"; +chr19 Cufflinks exon 34628206 34628247 . - . gene_id "XLOC_004356"; transcript_id "TCONS_00004356"; exon_number "1"; oId "CUFF.4312.1"; tss_id "TSS4356"; +chr19 Cufflinks exon 35143449 35143490 . - . gene_id "XLOC_004357"; transcript_id "TCONS_00004357"; exon_number "1"; oId "CUFF.4314.1"; tss_id "TSS4357"; +chr19 Cufflinks exon 36441776 36441810 . - . gene_id "XLOC_004358"; transcript_id "TCONS_00004358"; exon_number "1"; oId "CUFF.4317.1"; tss_id "TSS4358"; +chr19 Cufflinks exon 36538000 36538044 . - . gene_id "XLOC_004359"; transcript_id "TCONS_00004359"; exon_number "1"; oId "CUFF.4318.1"; tss_id "TSS4359"; +chr19 Cufflinks exon 36710708 36710768 . - . gene_id "XLOC_004360"; transcript_id "TCONS_00004360"; exon_number "1"; oId "CUFF.4319.1"; tss_id "TSS4360"; +chr19 Cufflinks exon 37344896 37344931 . - . gene_id "XLOC_004361"; transcript_id "TCONS_00004361"; exon_number "1"; oId "CUFF.4320.1"; tss_id "TSS4361"; +chr19 Cufflinks exon 38839646 38839751 . - . gene_id "XLOC_004362"; transcript_id "TCONS_00004362"; exon_number "1"; oId "CUFF.4323.1"; tss_id "TSS4362"; +chr19 Cufflinks exon 39287642 39287749 . - . gene_id "XLOC_004363"; transcript_id "TCONS_00004363"; exon_number "1"; oId "CUFF.4324.1"; tss_id "TSS4363"; +chr19 Cufflinks exon 39539825 39539875 . - . gene_id "XLOC_004364"; transcript_id "TCONS_00004364"; exon_number "1"; oId "CUFF.4325.1"; tss_id "TSS4364"; +chr19 Cufflinks exon 39540550 39540608 . - . gene_id "XLOC_004365"; transcript_id "TCONS_00004365"; exon_number "1"; oId "CUFF.4326.1"; tss_id "TSS4365"; +chr19 Cufflinks exon 39902807 39902900 . - . gene_id "XLOC_004366"; transcript_id "TCONS_00004366"; exon_number "1"; oId "CUFF.4328.1"; tss_id "TSS4366"; +chr19 Cufflinks exon 40620541 40620612 . - . gene_id "XLOC_004367"; transcript_id "TCONS_00004367"; exon_number "1"; oId "CUFF.4330.1"; tss_id "TSS4367"; +chr19 Cufflinks exon 40805385 40805491 . - . gene_id "XLOC_004368"; transcript_id "TCONS_00004368"; exon_number "1"; oId "CUFF.4331.1"; tss_id "TSS4368"; +chr19 Cufflinks exon 41213964 41214068 . - . gene_id "XLOC_004369"; transcript_id "TCONS_00004369"; exon_number "1"; oId "CUFF.4332.1"; tss_id "TSS4369"; +chr19 Cufflinks exon 41748142 41748214 . - . gene_id "XLOC_004370"; transcript_id "TCONS_00004370"; exon_number "1"; oId "CUFF.4333.1"; tss_id "TSS4370"; +chr19 Cufflinks exon 41792312 41792599 . - . gene_id "XLOC_004371"; transcript_id "TCONS_00004371"; exon_number "1"; oId "CUFF.4334.1"; tss_id "TSS4371"; +chr19 Cufflinks exon 42069990 42071297 . - . gene_id "XLOC_004372"; transcript_id "TCONS_00004372"; exon_number "1"; oId "CUFF.4335.1"; tss_id "TSS4372"; +chr19 Cufflinks exon 42071436 42071891 . - . gene_id "XLOC_004373"; transcript_id "TCONS_00004373"; exon_number "1"; oId "CUFF.4336.1"; tss_id "TSS4373"; +chr19 Cufflinks exon 42299770 42299847 . - . gene_id "XLOC_004374"; transcript_id "TCONS_00004374"; exon_number "1"; oId "CUFF.4337.1"; tss_id "TSS4374"; +chr19 Cufflinks exon 43000241 43000295 . - . gene_id "XLOC_004375"; transcript_id "TCONS_00004375"; exon_number "1"; oId "CUFF.4339.1"; tss_id "TSS4375"; +chr19 Cufflinks exon 43177835 43177872 . - . gene_id "XLOC_004376"; transcript_id "TCONS_00004376"; exon_number "1"; oId "CUFF.4340.1"; tss_id "TSS4376"; +chr19 Cufflinks exon 44164628 44164928 . - . gene_id "XLOC_004377"; transcript_id "TCONS_00004377"; exon_number "1"; oId "CUFF.4345.1"; tss_id "TSS4377"; +chr19 Cufflinks exon 44589366 44589456 . - . gene_id "XLOC_004378"; transcript_id "TCONS_00004378"; exon_number "1"; oId "CUFF.4347.1"; tss_id "TSS4378"; +chr19 Cufflinks exon 44687731 44687783 . - . gene_id "XLOC_004379"; transcript_id "TCONS_00004379"; exon_number "1"; oId "CUFF.4349.1"; tss_id "TSS4379"; +chr19 Cufflinks exon 44835203 44835247 . - . gene_id "XLOC_004380"; transcript_id "TCONS_00004380"; exon_number "1"; oId "CUFF.4350.1"; tss_id "TSS4380"; +chr19 Cufflinks exon 45095624 45095671 . - . gene_id "XLOC_004381"; transcript_id "TCONS_00004381"; exon_number "1"; oId "CUFF.4351.1"; tss_id "TSS4381"; +chr19 Cufflinks exon 45981860 45981945 . - . gene_id "XLOC_004382"; transcript_id "TCONS_00004382"; exon_number "1"; oId "CUFF.4354.1"; tss_id "TSS4382"; +chr19 Cufflinks exon 46735612 46736114 . - . gene_id "XLOC_004383"; transcript_id "TCONS_00004383"; exon_number "1"; oId "CUFF.4356.1"; tss_id "TSS4383"; +chr19 Cufflinks exon 46809730 46809833 . - . gene_id "XLOC_004384"; transcript_id "TCONS_00004384"; exon_number "1"; oId "CUFF.4357.1"; tss_id "TSS4384"; +chr19 Cufflinks exon 47192034 47192325 . - . gene_id "XLOC_004385"; transcript_id "TCONS_00004385"; exon_number "1"; oId "CUFF.4358.1"; tss_id "TSS4385"; +chr19 Cufflinks exon 47511979 47512019 . - . gene_id "XLOC_004386"; transcript_id "TCONS_00004386"; exon_number "1"; oId "CUFF.4361.1"; tss_id "TSS4386"; +chr19 Cufflinks exon 49137508 49137543 . - . gene_id "XLOC_004387"; transcript_id "TCONS_00004387"; exon_number "1"; oId "CUFF.4364.1"; tss_id "TSS4387"; +chr19 Cufflinks exon 49160047 49160136 . - . gene_id "XLOC_004388"; transcript_id "TCONS_00004388"; exon_number "1"; oId "CUFF.4365.1"; tss_id "TSS4388"; +chr19 Cufflinks exon 49296409 49296515 . - . gene_id "XLOC_004389"; transcript_id "TCONS_00004389"; exon_number "1"; oId "CUFF.4366.1"; tss_id "TSS4389"; +chr19 Cufflinks exon 50037932 50038004 . - . gene_id "XLOC_004390"; transcript_id "TCONS_00004390"; exon_number "1"; oId "CUFF.4368.1"; tss_id "TSS4390"; +chr19 Cufflinks exon 50267781 50267887 . - . gene_id "XLOC_004391"; transcript_id "TCONS_00004391"; exon_number "1"; oId "CUFF.4369.1"; tss_id "TSS4391"; +chr19 Cufflinks exon 50452573 50452784 . - . gene_id "XLOC_004392"; transcript_id "TCONS_00004392"; exon_number "1"; oId "CUFF.4370.1"; tss_id "TSS4392"; +chr19 Cufflinks exon 51654205 51654248 . - . gene_id "XLOC_004393"; transcript_id "TCONS_00004393"; exon_number "1"; oId "CUFF.4371.1"; tss_id "TSS4393"; +chr19 Cufflinks exon 52425393 52425465 . - . gene_id "XLOC_004394"; transcript_id "TCONS_00004394"; exon_number "1"; oId "CUFF.4375.1"; tss_id "TSS4394"; +chr19 Cufflinks exon 52637511 52637594 . - . gene_id "XLOC_004395"; transcript_id "TCONS_00004395"; exon_number "1"; oId "CUFF.4378.1"; tss_id "TSS4395"; +chr19 Cufflinks exon 53615664 53615711 . - . gene_id "XLOC_004396"; transcript_id "TCONS_00004396"; exon_number "1"; oId "CUFF.4379.1"; tss_id "TSS4396"; +chr19 Cufflinks exon 54067330 54067470 . - . gene_id "XLOC_004397"; transcript_id "TCONS_00004397"; exon_number "1"; oId "CUFF.4380.1"; tss_id "TSS4397"; +chr19 Cufflinks exon 54128141 54128184 . - . gene_id "XLOC_004398"; transcript_id "TCONS_00004398"; exon_number "1"; oId "CUFF.4381.1"; tss_id "TSS4398"; +chr19 Cufflinks exon 54158224 54158402 . - . gene_id "XLOC_004399"; transcript_id "TCONS_00004399"; exon_number "1"; oId "CUFF.4385.1"; tss_id "TSS4399"; +chr19 Cufflinks exon 54190256 54190340 . - . gene_id "XLOC_004400"; transcript_id "TCONS_00004400"; exon_number "1"; oId "CUFF.4386.1"; tss_id "TSS4400"; +chr19 Cufflinks exon 54218440 54218539 . - . gene_id "XLOC_004401"; transcript_id "TCONS_00004401"; exon_number "1"; oId "CUFF.4390.1"; tss_id "TSS4401"; +chr19 Cufflinks exon 54222321 54222419 . - . gene_id "XLOC_004402"; transcript_id "TCONS_00004402"; exon_number "1"; oId "CUFF.4391.1"; tss_id "TSS4402"; +chr19 Cufflinks exon 54227271 54227370 . - . gene_id "XLOC_004403"; transcript_id "TCONS_00004403"; exon_number "1"; oId "CUFF.4392.1"; tss_id "TSS4403"; +chr19 Cufflinks exon 54231670 54231742 . - . gene_id "XLOC_004404"; transcript_id "TCONS_00004404"; exon_number "1"; oId "CUFF.4393.1"; tss_id "TSS4404"; +chr19 Cufflinks exon 54236237 54236337 . - . gene_id "XLOC_004405"; transcript_id "TCONS_00004405"; exon_number "1"; oId "CUFF.4394.1"; tss_id "TSS4405"; +chr19 Cufflinks exon 54248260 54248359 . - . gene_id "XLOC_004406"; transcript_id "TCONS_00004406"; exon_number "1"; oId "CUFF.4395.1"; tss_id "TSS4406"; +chr19 Cufflinks exon 54263343 54263442 . - . gene_id "XLOC_004407"; transcript_id "TCONS_00004407"; exon_number "1"; oId "CUFF.4396.1"; tss_id "TSS4407"; +chr19 Cufflinks exon 54269790 54269886 . - . gene_id "XLOC_004408"; transcript_id "TCONS_00004408"; exon_number "1"; oId "CUFF.4397.1"; tss_id "TSS4408"; +chr19 Cufflinks exon 54674664 54674755 . - . gene_id "XLOC_004409"; transcript_id "TCONS_00004409"; exon_number "1"; oId "CUFF.4399.1"; tss_id "TSS4409"; +chr19 Cufflinks exon 54767809 54767907 . - . gene_id "XLOC_004410"; transcript_id "TCONS_00004410"; exon_number "1"; oId "CUFF.4400.1"; tss_id "TSS4410"; +chr19 Cufflinks exon 55380396 55380499 . - . gene_id "XLOC_004411"; transcript_id "TCONS_00004411"; exon_number "1"; oId "CUFF.4401.1"; tss_id "TSS4411"; +chr19 Cufflinks exon 55419284 55419342 . - . gene_id "XLOC_004412"; transcript_id "TCONS_00004412"; exon_number "1"; oId "CUFF.4402.1"; tss_id "TSS4412"; +chr19 Cufflinks exon 55804382 55804416 . - . gene_id "XLOC_004413"; transcript_id "TCONS_00004413"; exon_number "1"; oId "CUFF.4404.1"; tss_id "TSS4413"; +chr19 Cufflinks exon 57126994 57127030 . - . gene_id "XLOC_004414"; transcript_id "TCONS_00004414"; exon_number "1"; oId "CUFF.4407.1"; tss_id "TSS4414"; +chr19 Cufflinks exon 57307761 57307865 . - . gene_id "XLOC_004415"; transcript_id "TCONS_00004415"; exon_number "1"; oId "CUFF.4408.1"; tss_id "TSS4415"; +chr19 Cufflinks exon 57645477 57645623 . - . gene_id "XLOC_004416"; transcript_id "TCONS_00004416"; exon_number "1"; oId "CUFF.4409.1"; tss_id "TSS4416"; +chr19 Cufflinks exon 57904021 57904056 . - . gene_id "XLOC_004417"; transcript_id "TCONS_00004417"; exon_number "1"; oId "CUFF.4410.1"; tss_id "TSS4417"; +chr19 Cufflinks exon 58093133 58093265 . - . gene_id "XLOC_004418"; transcript_id "TCONS_00004418"; exon_number "1"; oId "CUFF.4411.1"; tss_id "TSS4418"; +chr19 Cufflinks exon 58146501 58146556 . - . gene_id "XLOC_004419"; transcript_id "TCONS_00004419"; exon_number "1"; oId "CUFF.4412.1"; tss_id "TSS4419"; +chr19 Cufflinks exon 58416776 58416805 . - . gene_id "XLOC_004420"; transcript_id "TCONS_00004420"; exon_number "1"; oId "CUFF.4415.1"; tss_id "TSS4420"; +chr19 Cufflinks exon 58995120 58995208 . - . gene_id "XLOC_004421"; transcript_id "TCONS_00004421"; exon_number "1"; oId "CUFF.4421.1"; tss_id "TSS4421"; +chr1_gl000191_random Cufflinks exon 73814 73870 . + . gene_id "XLOC_004422"; transcript_id "TCONS_00004422"; exon_number "1"; oId "CUFF.4422.1"; tss_id "TSS4422"; +chr1_gl000192_random Cufflinks exon 21386 21453 . + . gene_id "XLOC_004423"; transcript_id "TCONS_00004423"; exon_number "1"; oId "CUFF.4424.1"; tss_id "TSS4423"; +chr1_gl000192_random Cufflinks exon 415329 415417 . + . gene_id "XLOC_004424"; transcript_id "TCONS_00004424"; exon_number "1"; oId "CUFF.4425.1"; tss_id "TSS4424"; +chr1_gl000192_random Cufflinks exon 468370 468445 . + . gene_id "XLOC_004425"; transcript_id "TCONS_00004425"; exon_number "1"; oId "CUFF.4427.1"; tss_id "TSS4425"; +chr1_gl000192_random Cufflinks exon 20494 20552 . - . gene_id "XLOC_004426"; transcript_id "TCONS_00004426"; exon_number "1"; oId "CUFF.4423.1"; tss_id "TSS4426"; +chr1_gl000192_random Cufflinks exon 466079 466149 . - . gene_id "XLOC_004427"; transcript_id "TCONS_00004427"; exon_number "1"; oId "CUFF.4426.1"; tss_id "TSS4427"; +chr1_gl000192_random Cufflinks exon 544946 545107 . - . gene_id "XLOC_004428"; transcript_id "TCONS_00004428"; exon_number "1"; oId "CUFF.4428.1"; tss_id "TSS4428"; +chr2 Cufflinks exon 2741843 2741884 . + . gene_id "XLOC_004429"; transcript_id "TCONS_00004429"; exon_number "1"; oId "CUFF.4429.1"; tss_id "TSS4429"; +chr2 Cufflinks exon 2885518 2885563 . + . gene_id "XLOC_004430"; transcript_id "TCONS_00004430"; exon_number "1"; oId "CUFF.4430.1"; tss_id "TSS4430"; +chr2 Cufflinks exon 3426729 3426952 . + . gene_id "XLOC_004431"; transcript_id "TCONS_00004431"; exon_number "1"; oId "CUFF.4432.1"; tss_id "TSS4431"; +chr2 Cufflinks exon 4249789 4249823 . + . gene_id "XLOC_004432"; transcript_id "TCONS_00004432"; exon_number "1"; oId "CUFF.4433.1"; tss_id "TSS4432"; +chr2 Cufflinks exon 4992867 4992972 . + . gene_id "XLOC_004433"; transcript_id "TCONS_00004433"; exon_number "1"; oId "CUFF.4434.1"; tss_id "TSS4433"; +chr2 Cufflinks exon 9119024 9119125 . + . gene_id "XLOC_004434"; transcript_id "TCONS_00004434"; exon_number "1"; oId "CUFF.4440.1"; tss_id "TSS4434"; +chr2 Cufflinks exon 9831177 9831220 . + . gene_id "XLOC_004435"; transcript_id "TCONS_00004435"; exon_number "1"; oId "CUFF.4442.1"; tss_id "TSS4435"; +chr2 Cufflinks exon 9926107 9926153 . + . gene_id "XLOC_004436"; transcript_id "TCONS_00004436"; exon_number "1"; oId "CUFF.4444.1"; tss_id "TSS4436"; +chr2 Cufflinks exon 10275349 10275435 . + . gene_id "XLOC_004437"; transcript_id "TCONS_00004437"; exon_number "1"; oId "CUFF.4446.1"; tss_id "TSS4437"; +chr2 Cufflinks exon 10831668 10831974 . + . gene_id "XLOC_004438"; transcript_id "TCONS_00004438"; exon_number "1"; oId "CUFF.4447.1"; tss_id "TSS4438"; +chr2 Cufflinks exon 10884318 10884375 . + . gene_id "XLOC_004439"; transcript_id "TCONS_00004439"; exon_number "1"; oId "CUFF.4448.1"; tss_id "TSS4439"; +chr2 Cufflinks exon 11374114 11374220 . + . gene_id "XLOC_004440"; transcript_id "TCONS_00004440"; exon_number "1"; oId "CUFF.4450.1"; tss_id "TSS4440"; +chr2 Cufflinks exon 11657524 11657630 . + . gene_id "XLOC_004441"; transcript_id "TCONS_00004441"; exon_number "1"; oId "CUFF.4451.1"; tss_id "TSS4441"; +chr2 Cufflinks exon 11691833 11691901 . + . gene_id "XLOC_004442"; transcript_id "TCONS_00004442"; exon_number "1"; oId "CUFF.4452.1"; tss_id "TSS4442"; +chr2 Cufflinks exon 11701320 11701376 . + . gene_id "XLOC_004443"; transcript_id "TCONS_00004443"; exon_number "1"; oId "CUFF.4453.1"; tss_id "TSS4443"; +chr2 Cufflinks exon 11724899 11725098 . + . gene_id "XLOC_004444"; transcript_id "TCONS_00004444"; exon_number "1"; oId "CUFF.4455.1"; tss_id "TSS4444"; +chr2 Cufflinks exon 11834850 11834903 . + . gene_id "XLOC_004445"; transcript_id "TCONS_00004445"; exon_number "1"; oId "CUFF.4456.1"; tss_id "TSS4445"; +chr2 Cufflinks exon 13287184 13287273 . + . gene_id "XLOC_004446"; transcript_id "TCONS_00004446"; exon_number "1"; oId "CUFF.4460.1"; tss_id "TSS4446"; +chr2 Cufflinks exon 15671493 15671542 . + . gene_id "XLOC_004447"; transcript_id "TCONS_00004447"; exon_number "1"; oId "CUFF.4462.1"; tss_id "TSS4447"; +chr2 Cufflinks exon 16005059 16005176 . + . gene_id "XLOC_004448"; transcript_id "TCONS_00004448"; exon_number "1"; oId "CUFF.4463.1"; tss_id "TSS4448"; +chr2 Cufflinks exon 16043791 16043898 . + . gene_id "XLOC_004449"; transcript_id "TCONS_00004449"; exon_number "1"; oId "CUFF.4464.1"; tss_id "TSS4449"; +chr2 Cufflinks exon 16700972 16701007 . + . gene_id "XLOC_004450"; transcript_id "TCONS_00004450"; exon_number "1"; oId "CUFF.4466.1"; tss_id "TSS4450"; +chr2 Cufflinks exon 18353880 18353912 . + . gene_id "XLOC_004451"; transcript_id "TCONS_00004451"; exon_number "1"; oId "CUFF.4469.1"; tss_id "TSS4451"; +chr2 Cufflinks exon 20136936 20137004 . + . gene_id "XLOC_004452"; transcript_id "TCONS_00004452"; exon_number "1"; oId "CUFF.4471.1"; tss_id "TSS4452"; +chr2 Cufflinks exon 20375107 20375509 . + . gene_id "XLOC_004453"; transcript_id "TCONS_00004453"; exon_number "1"; oId "CUFF.4472.1"; tss_id "TSS4453"; +chr2 Cufflinks exon 20375566 20375669 . + . gene_id "XLOC_004454"; transcript_id "TCONS_00004454"; exon_number "1"; oId "CUFF.4474.1"; tss_id "TSS4454"; +chr2 Cufflinks exon 20486647 20486688 . + . gene_id "XLOC_004455"; transcript_id "TCONS_00004455"; exon_number "1"; oId "CUFF.4476.1"; tss_id "TSS4455"; +chr2 Cufflinks exon 20539001 20539118 . + . gene_id "XLOC_004456"; transcript_id "TCONS_00004456"; exon_number "1"; oId "CUFF.4477.1"; tss_id "TSS4456"; +chr2 Cufflinks exon 20608181 20608256 . + . gene_id "XLOC_004457"; transcript_id "TCONS_00004457"; exon_number "1"; oId "CUFF.4479.1"; tss_id "TSS4457"; +chr2 Cufflinks exon 22145865 22146160 . + . gene_id "XLOC_004458"; transcript_id "TCONS_00004458"; exon_number "1"; oId "CUFF.4480.1"; tss_id "TSS4458"; +chr2 Cufflinks exon 23084426 23084650 . + . gene_id "XLOC_004459"; transcript_id "TCONS_00004459"; exon_number "1"; oId "CUFF.4484.1"; tss_id "TSS4459"; +chr2 Cufflinks exon 23393776 23393818 . + . gene_id "XLOC_004460"; transcript_id "TCONS_00004460"; exon_number "1"; oId "CUFF.4485.1"; tss_id "TSS4460"; +chr2 Cufflinks exon 24228262 24228483 . + . gene_id "XLOC_004461"; transcript_id "TCONS_00004461"; exon_number "1"; oId "CUFF.4487.1"; tss_id "TSS4461"; +chr2 Cufflinks exon 24268708 24268803 . + . gene_id "XLOC_004462"; transcript_id "TCONS_00004462"; exon_number "1"; oId "CUFF.4488.1"; tss_id "TSS4462"; +chr2 Cufflinks exon 24587369 24587413 . + . gene_id "XLOC_004463"; transcript_id "TCONS_00004463"; exon_number "1"; oId "CUFF.4489.1"; tss_id "TSS4463"; +chr2 Cufflinks exon 24587506 24587639 . + . gene_id "XLOC_004464"; transcript_id "TCONS_00004464"; exon_number "1"; oId "CUFF.4490.1"; tss_id "TSS4464"; +chr2 Cufflinks exon 24899178 24899284 . + . gene_id "XLOC_004465"; transcript_id "TCONS_00004465"; exon_number "1"; oId "CUFF.4493.1"; tss_id "TSS4465"; +chr2 Cufflinks exon 25280904 25281210 . + . gene_id "XLOC_004466"; transcript_id "TCONS_00004466"; exon_number "1"; oId "CUFF.4495.1"; tss_id "TSS4466"; +chr2 Cufflinks exon 25647386 25647436 . + . gene_id "XLOC_004467"; transcript_id "TCONS_00004467"; exon_number "1"; oId "CUFF.4496.1"; tss_id "TSS4467"; +chr2 Cufflinks exon 25991890 25991945 . + . gene_id "XLOC_004468"; transcript_id "TCONS_00004468"; exon_number "1"; oId "CUFF.4497.1"; tss_id "TSS4468"; +chr2 Cufflinks exon 26265544 26265648 . + . gene_id "XLOC_004469"; transcript_id "TCONS_00004469"; exon_number "1"; oId "CUFF.4498.1"; tss_id "TSS4469"; +chr2 Cufflinks exon 27273650 27273739 . + . gene_id "XLOC_004470"; transcript_id "TCONS_00004470"; exon_number "1"; oId "CUFF.4500.1"; tss_id "TSS4470"; +chr2 Cufflinks exon 27274082 27274155 . + . gene_id "XLOC_004471"; transcript_id "TCONS_00004471"; exon_number "1"; oId "CUFF.4501.1"; tss_id "TSS4471"; +chr2 Cufflinks exon 27504367 27504402 . + . gene_id "XLOC_004472"; transcript_id "TCONS_00004472"; exon_number "1"; oId "CUFF.4502.1"; tss_id "TSS4472"; +chr2 Cufflinks exon 28124571 28124612 . + . gene_id "XLOC_004473"; transcript_id "TCONS_00004473"; exon_number "1"; oId "CUFF.4507.1"; tss_id "TSS4473"; +chr2 Cufflinks exon 28906842 28906922 . + . gene_id "XLOC_004474"; transcript_id "TCONS_00004474"; exon_number "1"; oId "CUFF.4509.1"; tss_id "TSS4474"; +chr2 Cufflinks exon 30277568 30277639 . + . gene_id "XLOC_004475"; transcript_id "TCONS_00004475"; exon_number "1"; oId "CUFF.4511.1"; tss_id "TSS4475"; +chr2 Cufflinks exon 31451178 31451268 . + . gene_id "XLOC_004476"; transcript_id "TCONS_00004476"; exon_number "1"; oId "CUFF.4512.1"; tss_id "TSS4476"; +chr2 Cufflinks exon 32342391 32342531 . + . gene_id "XLOC_004477"; transcript_id "TCONS_00004477"; exon_number "1"; oId "CUFF.4514.1"; tss_id "TSS4477"; +chr2 Cufflinks exon 32536144 32536243 . + . gene_id "XLOC_004478"; transcript_id "TCONS_00004478"; exon_number "1"; oId "CUFF.4516.1"; tss_id "TSS4478"; +chr2 Cufflinks exon 33069211 33069275 . + . gene_id "XLOC_004479"; transcript_id "TCONS_00004479"; exon_number "1"; oId "CUFF.4517.1"; tss_id "TSS4479"; +chr2 Cufflinks exon 33557965 33558051 . + . gene_id "XLOC_004480"; transcript_id "TCONS_00004480"; exon_number "1"; oId "CUFF.4520.1"; tss_id "TSS4480"; +chr2 Cufflinks exon 33762279 33762371 . + . gene_id "XLOC_004481"; transcript_id "TCONS_00004481"; exon_number "1"; oId "CUFF.4521.1"; tss_id "TSS4481"; +chr2 Cufflinks exon 35696671 35696774 . + . gene_id "XLOC_004482"; transcript_id "TCONS_00004482"; exon_number "1"; oId "CUFF.4526.1"; tss_id "TSS4482"; +chr2 Cufflinks exon 37140074 37140130 . + . gene_id "XLOC_004483"; transcript_id "TCONS_00004483"; exon_number "1"; oId "CUFF.4528.1"; tss_id "TSS4483"; +chr2 Cufflinks exon 37186505 37186572 . + . gene_id "XLOC_004484"; transcript_id "TCONS_00004484"; exon_number "1"; oId "CUFF.4529.1"; tss_id "TSS4484"; +chr2 Cufflinks exon 37305251 37305308 . + . gene_id "XLOC_004485"; transcript_id "TCONS_00004485"; exon_number "1"; oId "CUFF.4530.1"; tss_id "TSS4485"; +chr2 Cufflinks exon 38374557 38374662 . + . gene_id "XLOC_004486"; transcript_id "TCONS_00004486"; exon_number "1"; oId "CUFF.4535.1"; tss_id "TSS4486"; +chr2 Cufflinks exon 39073873 39073908 . + . gene_id "XLOC_004487"; transcript_id "TCONS_00004487"; exon_number "1"; oId "CUFF.4537.1"; tss_id "TSS4487"; +chr2 Cufflinks exon 39198155 39198242 . + . gene_id "XLOC_004488"; transcript_id "TCONS_00004488"; exon_number "1"; oId "CUFF.4539.1"; tss_id "TSS4488"; +chr2 Cufflinks exon 39309730 39309834 . + . gene_id "XLOC_004489"; transcript_id "TCONS_00004489"; exon_number "1"; oId "CUFF.4540.1"; tss_id "TSS4489"; +chr2 Cufflinks exon 42021662 42021705 . + . gene_id "XLOC_004490"; transcript_id "TCONS_00004490"; exon_number "1"; oId "CUFF.4543.1"; tss_id "TSS4490"; +chr2 Cufflinks exon 42098411 42098479 . + . gene_id "XLOC_004491"; transcript_id "TCONS_00004491"; exon_number "1"; oId "CUFF.4544.1"; tss_id "TSS4491"; +chr2 Cufflinks exon 42820897 42820965 . + . gene_id "XLOC_004492"; transcript_id "TCONS_00004492"; exon_number "1"; oId "CUFF.4546.1"; tss_id "TSS4492"; +chr2 Cufflinks exon 42939880 42939986 . + . gene_id "XLOC_004493"; transcript_id "TCONS_00004493"; exon_number "1"; oId "CUFF.4547.1"; tss_id "TSS4493"; +chr2 Cufflinks exon 43003086 43003120 . + . gene_id "XLOC_004494"; transcript_id "TCONS_00004494"; exon_number "1"; oId "CUFF.4548.1"; tss_id "TSS4494"; +chr2 Cufflinks exon 43037676 43037768 . + . gene_id "XLOC_004495"; transcript_id "TCONS_00004495"; exon_number "1"; oId "CUFF.4549.1"; tss_id "TSS4495"; +chr2 Cufflinks exon 43487617 43487674 . + . gene_id "XLOC_004496"; transcript_id "TCONS_00004496"; exon_number "1"; oId "CUFF.4551.1"; tss_id "TSS4496"; +chr2 Cufflinks exon 43635446 43635516 . + . gene_id "XLOC_004497"; transcript_id "TCONS_00004497"; exon_number "1"; oId "CUFF.4552.1"; tss_id "TSS4497"; +chr2 Cufflinks exon 43796461 43796496 . + . gene_id "XLOC_004498"; transcript_id "TCONS_00004498"; exon_number "1"; oId "CUFF.4553.1"; tss_id "TSS4498"; +chr2 Cufflinks exon 44310858 44310977 . + . gene_id "XLOC_004499"; transcript_id "TCONS_00004499"; exon_number "1"; oId "CUFF.4557.1"; tss_id "TSS4499"; +chr2 Cufflinks exon 47389888 47389973 . + . gene_id "XLOC_004500"; transcript_id "TCONS_00004500"; exon_number "1"; oId "CUFF.4565.1"; tss_id "TSS4500"; +chr2 Cufflinks exon 47414071 47414109 . + . gene_id "XLOC_004501"; transcript_id "TCONS_00004501"; exon_number "1"; oId "CUFF.4566.1"; tss_id "TSS4501"; +chr2 Cufflinks exon 48008518 48008604 . + . gene_id "XLOC_004502"; transcript_id "TCONS_00004502"; exon_number "1"; oId "CUFF.4569.1"; tss_id "TSS4502"; +chr2 Cufflinks exon 48444715 48444953 . + . gene_id "XLOC_004503"; transcript_id "TCONS_00004503"; exon_number "1"; oId "CUFF.4572.1"; tss_id "TSS4503"; +chr2 Cufflinks exon 48569826 48569867 . + . gene_id "XLOC_004504"; transcript_id "TCONS_00004504"; exon_number "1"; oId "CUFF.4574.1"; tss_id "TSS4504"; +chr2 Cufflinks exon 50291780 50291838 . + . gene_id "XLOC_004505"; transcript_id "TCONS_00004505"; exon_number "1"; oId "CUFF.4580.1"; tss_id "TSS4505"; +chr2 Cufflinks exon 52386008 52386056 . + . gene_id "XLOC_004506"; transcript_id "TCONS_00004506"; exon_number "1"; oId "CUFF.4584.1"; tss_id "TSS4506"; +chr2 Cufflinks exon 52403193 52403258 . + . gene_id "XLOC_004507"; transcript_id "TCONS_00004507"; exon_number "1"; oId "CUFF.4585.1"; tss_id "TSS4507"; +chr2 Cufflinks exon 52758172 52758213 . + . gene_id "XLOC_004508"; transcript_id "TCONS_00004508"; exon_number "1"; oId "CUFF.4586.1"; tss_id "TSS4508"; +chr2 Cufflinks exon 53945826 53945866 . + . gene_id "XLOC_004509"; transcript_id "TCONS_00004509"; exon_number "1"; oId "CUFF.4588.1"; tss_id "TSS4509"; +chr2 Cufflinks exon 53965355 53965499 . + . gene_id "XLOC_004510"; transcript_id "TCONS_00004510"; exon_number "1"; oId "CUFF.4589.1"; tss_id "TSS4510"; +chr2 Cufflinks exon 54053028 54053062 . + . gene_id "XLOC_004511"; transcript_id "TCONS_00004511"; exon_number "1"; oId "CUFF.4592.1"; tss_id "TSS4511"; +chr2 Cufflinks exon 54071031 54071113 . + . gene_id "XLOC_004512"; transcript_id "TCONS_00004512"; exon_number "1"; oId "CUFF.4595.1"; tss_id "TSS4512"; +chr2 Cufflinks exon 54173551 54173592 . + . gene_id "XLOC_004513"; transcript_id "TCONS_00004513"; exon_number "1"; oId "CUFF.4596.1"; tss_id "TSS4513"; +chr2 Cufflinks exon 54261173 54261223 . + . gene_id "XLOC_004514"; transcript_id "TCONS_00004514"; exon_number "1"; oId "CUFF.4597.1"; tss_id "TSS4514"; +chr2 Cufflinks exon 55077426 55077486 . + . gene_id "XLOC_004515"; transcript_id "TCONS_00004515"; exon_number "1"; oId "CUFF.4600.1"; tss_id "TSS4515"; +chr2 Cufflinks exon 55727086 55727150 . + . gene_id "XLOC_004516"; transcript_id "TCONS_00004516"; exon_number "1"; oId "CUFF.4605.1"; tss_id "TSS4516"; +chr2 Cufflinks exon 58326659 58326816 . + . gene_id "XLOC_004517"; transcript_id "TCONS_00004517"; exon_number "1"; oId "CUFF.4611.1"; tss_id "TSS4517"; +chr2 Cufflinks exon 59549315 59549403 . + . gene_id "XLOC_004518"; transcript_id "TCONS_00004518"; exon_number "1"; oId "CUFF.4612.1"; tss_id "TSS4518"; +chr2 Cufflinks exon 59874756 59874843 . + . gene_id "XLOC_004519"; transcript_id "TCONS_00004519"; exon_number "1"; oId "CUFF.4614.1"; tss_id "TSS4519"; +chr2 Cufflinks exon 59921897 59921986 . + . gene_id "XLOC_004520"; transcript_id "TCONS_00004520"; exon_number "1"; oId "CUFF.4615.1"; tss_id "TSS4520"; +chr2 Cufflinks exon 60611740 60611897 . + . gene_id "XLOC_004521"; transcript_id "TCONS_00004521"; exon_number "1"; oId "CUFF.4616.1"; tss_id "TSS4521"; +chr2 Cufflinks exon 60867840 60868152 . + . gene_id "XLOC_004522"; transcript_id "TCONS_00004522"; exon_number "1"; oId "CUFF.4617.1"; tss_id "TSS4522"; +chr2 Cufflinks exon 60946779 60946869 . + . gene_id "XLOC_004523"; transcript_id "TCONS_00004523"; exon_number "1"; oId "CUFF.4618.1"; tss_id "TSS4523"; +chr2 Cufflinks exon 61138438 61138580 . + . gene_id "XLOC_004524"; transcript_id "TCONS_00004524"; exon_number "1"; oId "CUFF.4620.1"; tss_id "TSS4524"; +chr2 Cufflinks exon 61225887 61225973 . + . gene_id "XLOC_004525"; transcript_id "TCONS_00004525"; exon_number "1"; oId "CUFF.4621.1"; tss_id "TSS4525"; +chr2 Cufflinks exon 61428745 61428903 . + . gene_id "XLOC_004526"; transcript_id "TCONS_00004526"; exon_number "1"; oId "CUFF.4622.1"; tss_id "TSS4526"; +chr2 Cufflinks exon 61832751 61832857 . + . gene_id "XLOC_004527"; transcript_id "TCONS_00004527"; exon_number "1"; oId "CUFF.4623.1"; tss_id "TSS4527"; +chr2 Cufflinks exon 61874067 61874116 . + . gene_id "XLOC_004528"; transcript_id "TCONS_00004528"; exon_number "1"; oId "CUFF.4624.1"; tss_id "TSS4528"; +chr2 Cufflinks exon 61892493 61892559 . + . gene_id "XLOC_004529"; transcript_id "TCONS_00004529"; exon_number "1"; oId "CUFF.4625.1"; tss_id "TSS4529"; +chr2 Cufflinks exon 62492129 62492236 . + . gene_id "XLOC_004530"; transcript_id "TCONS_00004530"; exon_number "1"; oId "CUFF.4627.1"; tss_id "TSS4530"; +chr2 Cufflinks exon 62718313 62718625 . + . gene_id "XLOC_004531"; transcript_id "TCONS_00004531"; exon_number "1"; oId "CUFF.4628.1"; tss_id "TSS4531"; +chr2 Cufflinks exon 63356607 63356638 . + . gene_id "XLOC_004532"; transcript_id "TCONS_00004532"; exon_number "1"; oId "CUFF.4630.1"; tss_id "TSS4532"; +chr2 Cufflinks exon 63395767 63395997 . + . gene_id "XLOC_004533"; transcript_id "TCONS_00004533"; exon_number "1"; oId "CUFF.4631.1"; tss_id "TSS4533"; +chr2 Cufflinks exon 63997343 63997384 . + . gene_id "XLOC_004534"; transcript_id "TCONS_00004534"; exon_number "1"; oId "CUFF.4634.1"; tss_id "TSS4534"; +chr2 Cufflinks exon 64806027 64806110 . + . gene_id "XLOC_004535"; transcript_id "TCONS_00004535"; exon_number "1"; oId "CUFF.4635.1"; tss_id "TSS4535"; +chr2 Cufflinks exon 65044512 65044803 . + . gene_id "XLOC_004536"; transcript_id "TCONS_00004536"; exon_number "1"; oId "CUFF.4636.1"; tss_id "TSS4536"; +chr2 Cufflinks exon 65221880 65221994 . + . gene_id "XLOC_004537"; transcript_id "TCONS_00004537"; exon_number "1"; oId "CUFF.4640.1"; tss_id "TSS4537"; +chr2 Cufflinks exon 69410009 69410112 . + . gene_id "XLOC_004538"; transcript_id "TCONS_00004538"; exon_number "1"; oId "CUFF.4650.1"; tss_id "TSS4538"; +chr2 Cufflinks exon 69616354 69616382 . + . gene_id "XLOC_004539"; transcript_id "TCONS_00004539"; exon_number "1"; oId "CUFF.4651.1"; tss_id "TSS4539"; +chr2 Cufflinks exon 69743883 69744199 . + . gene_id "XLOC_004540"; transcript_id "TCONS_00004540"; exon_number "1"; oId "CUFF.4652.1"; tss_id "TSS4540"; +chr2 Cufflinks exon 69894490 69894596 . + . gene_id "XLOC_004541"; transcript_id "TCONS_00004541"; exon_number "1"; oId "CUFF.4653.1"; tss_id "TSS4541"; +chr2 Cufflinks exon 70139826 70139933 . + . gene_id "XLOC_004542"; transcript_id "TCONS_00004542"; exon_number "1"; oId "CUFF.4654.1"; tss_id "TSS4542"; +chr2 Cufflinks exon 70151828 70151862 . + . gene_id "XLOC_004543"; transcript_id "TCONS_00004543"; exon_number "1"; oId "CUFF.4655.1"; tss_id "TSS4543"; +chr2 Cufflinks exon 70182776 70182882 . + . gene_id "XLOC_004544"; transcript_id "TCONS_00004544"; exon_number "1"; oId "CUFF.4656.1"; tss_id "TSS4544"; +chr2 Cufflinks exon 71192721 71193015 . + . gene_id "XLOC_004545"; transcript_id "TCONS_00004545"; exon_number "1"; oId "CUFF.4659.1"; tss_id "TSS4545"; +chr2 Cufflinks exon 71302310 71302354 . + . gene_id "XLOC_004546"; transcript_id "TCONS_00004546"; exon_number "1"; oId "CUFF.4661.1"; tss_id "TSS4546"; +chr2 Cufflinks exon 72215338 72215380 . + . gene_id "XLOC_004547"; transcript_id "TCONS_00004547"; exon_number "1"; oId "CUFF.4664.1"; tss_id "TSS4547"; +chr2 Cufflinks exon 72489595 72489645 . + . gene_id "XLOC_004548"; transcript_id "TCONS_00004548"; exon_number "1"; oId "CUFF.4665.1"; tss_id "TSS4548"; +chr2 Cufflinks exon 72948935 72949125 . + . gene_id "XLOC_004549"; transcript_id "TCONS_00004549"; exon_number "1"; oId "CUFF.4666.1"; tss_id "TSS4549"; +chr2 Cufflinks exon 73246472 73246506 . + . gene_id "XLOC_004550"; transcript_id "TCONS_00004550"; exon_number "1"; oId "CUFF.4667.1"; tss_id "TSS4550"; +chr2 Cufflinks exon 73525812 73525874 . + . gene_id "XLOC_004551"; transcript_id "TCONS_00004551"; exon_number "1"; oId "CUFF.4668.1"; tss_id "TSS4551"; +chr2 Cufflinks exon 74546526 74546599 . + . gene_id "XLOC_004552"; transcript_id "TCONS_00004552"; exon_number "1"; oId "CUFF.4673.1"; tss_id "TSS4552"; +chr2 Cufflinks exon 74576984 74577053 . + . gene_id "XLOC_004553"; transcript_id "TCONS_00004553"; exon_number "1"; oId "CUFF.4674.1"; tss_id "TSS4553"; +chr2 Cufflinks exon 75124050 75124118 . + . gene_id "XLOC_004554"; transcript_id "TCONS_00004554"; exon_number "1"; oId "CUFF.4677.1"; tss_id "TSS4554"; +chr2 Cufflinks exon 75855084 75855288 . + . gene_id "XLOC_004555"; transcript_id "TCONS_00004555"; exon_number "1"; oId "CUFF.4680.1"; tss_id "TSS4555"; +chr2 Cufflinks exon 75860870 75860931 . + . gene_id "XLOC_004556"; transcript_id "TCONS_00004556"; exon_number "1"; oId "CUFF.4681.1"; tss_id "TSS4556"; +chr2 Cufflinks exon 75862266 75862373 . + . gene_id "XLOC_004557"; transcript_id "TCONS_00004557"; exon_number "1"; oId "CUFF.4682.1"; tss_id "TSS4557"; +chr2 Cufflinks exon 77000035 77000127 . + . gene_id "XLOC_004558"; transcript_id "TCONS_00004558"; exon_number "1"; oId "CUFF.4686.1"; tss_id "TSS4558"; +chr2 Cufflinks exon 77895593 77895663 . + . gene_id "XLOC_004559"; transcript_id "TCONS_00004559"; exon_number "1"; oId "CUFF.4687.1"; tss_id "TSS4559"; +chr2 Cufflinks exon 78928722 78928992 . + . gene_id "XLOC_004560"; transcript_id "TCONS_00004560"; exon_number "1"; oId "CUFF.4688.1"; tss_id "TSS4560"; +chr2 Cufflinks exon 79109573 79109678 . + . gene_id "XLOC_004561"; transcript_id "TCONS_00004561"; exon_number "1"; oId "CUFF.4689.1"; tss_id "TSS4561"; +chr2 Cufflinks exon 79109754 79109858 . + . gene_id "XLOC_004562"; transcript_id "TCONS_00004562"; exon_number "1"; oId "CUFF.4690.1"; tss_id "TSS4562"; +chr2 Cufflinks exon 81968070 81968105 . + . gene_id "XLOC_004563"; transcript_id "TCONS_00004563"; exon_number "1"; oId "CUFF.4695.1"; tss_id "TSS4563"; +chr2 Cufflinks exon 82194203 82194520 . + . gene_id "XLOC_004564"; transcript_id "TCONS_00004564"; exon_number "1"; oId "CUFF.4696.1"; tss_id "TSS4564"; +chr2 Cufflinks exon 82495735 82495830 . + . gene_id "XLOC_004565"; transcript_id "TCONS_00004565"; exon_number "1"; oId "CUFF.4697.1"; tss_id "TSS4565"; +chr2 Cufflinks exon 83038782 83038824 . + . gene_id "XLOC_004566"; transcript_id "TCONS_00004566"; exon_number "1"; oId "CUFF.4698.1"; tss_id "TSS4566"; +chr2 Cufflinks exon 83884871 83884964 . + . gene_id "XLOC_004567"; transcript_id "TCONS_00004567"; exon_number "1"; oId "CUFF.4699.1"; tss_id "TSS4567"; +chr2 Cufflinks exon 84883882 84883927 . + . gene_id "XLOC_004568"; transcript_id "TCONS_00004568"; exon_number "1"; oId "CUFF.4700.1"; tss_id "TSS4568"; +chr2 Cufflinks exon 85085876 85085948 . + . gene_id "XLOC_004569"; transcript_id "TCONS_00004569"; exon_number "1"; oId "CUFF.4701.1"; tss_id "TSS4569"; +chr2 Cufflinks exon 85432051 85432154 . + . gene_id "XLOC_004570"; transcript_id "TCONS_00004570"; exon_number "1"; oId "CUFF.4702.1"; tss_id "TSS4570"; +chr2 Cufflinks exon 85595405 85595715 . + . gene_id "XLOC_004571"; transcript_id "TCONS_00004571"; exon_number "1"; oId "CUFF.4704.1"; tss_id "TSS4571"; +chr2 Cufflinks exon 85669627 85669928 . + . gene_id "XLOC_004572"; transcript_id "TCONS_00004572"; exon_number "1"; oId "CUFF.4707.1"; tss_id "TSS4572"; +chr2 Cufflinks exon 86379906 86379944 . + . gene_id "XLOC_004573"; transcript_id "TCONS_00004573"; exon_number "1"; oId "CUFF.4711.1"; tss_id "TSS4573"; +chr2 Cufflinks exon 86910825 86910861 . + . gene_id "XLOC_004574"; transcript_id "TCONS_00004574"; exon_number "1"; oId "CUFF.4714.1"; tss_id "TSS4574"; +chr2 Cufflinks exon 87339573 87339644 . + . gene_id "XLOC_004575"; transcript_id "TCONS_00004575"; exon_number "1"; oId "CUFF.4715.1"; tss_id "TSS4575"; +chr2 Cufflinks exon 87792130 87792174 . + . gene_id "XLOC_004576"; transcript_id "TCONS_00004576"; exon_number "1"; oId "CUFF.4716.1"; tss_id "TSS4576"; +chr2 Cufflinks exon 88314118 88314214 . + . gene_id "XLOC_004577"; transcript_id "TCONS_00004577"; exon_number "1"; oId "CUFF.4718.1"; tss_id "TSS4577"; +chr2 Cufflinks exon 88606878 88606985 . + . gene_id "XLOC_004578"; transcript_id "TCONS_00004578"; exon_number "1"; oId "CUFF.4720.1"; tss_id "TSS4578"; +chr2 Cufflinks exon 88987853 88987913 . + . gene_id "XLOC_004579"; transcript_id "TCONS_00004579"; exon_number "1"; oId "CUFF.4724.1"; tss_id "TSS4579"; +chr2 Cufflinks exon 91862885 91862971 . + . gene_id "XLOC_004580"; transcript_id "TCONS_00004580"; exon_number "1"; oId "CUFF.4725.1"; tss_id "TSS4580"; +chr2 Cufflinks exon 96746594 96746640 . + . gene_id "XLOC_004581"; transcript_id "TCONS_00004581"; exon_number "1"; oId "CUFF.4731.1"; tss_id "TSS4581"; +chr2 Cufflinks exon 96960585 96960623 . + . gene_id "XLOC_004582"; transcript_id "TCONS_00004582"; exon_number "1"; oId "CUFF.4732.1"; tss_id "TSS4582"; +chr2 Cufflinks exon 97729428 97729505 . + . gene_id "XLOC_004583"; transcript_id "TCONS_00004583"; exon_number "1"; oId "CUFF.4735.1"; tss_id "TSS4583"; +chr2 Cufflinks exon 97766328 97766631 . + . gene_id "XLOC_004584"; transcript_id "TCONS_00004584"; exon_number "1"; oId "CUFF.4736.1"; tss_id "TSS4584"; +chr2 Cufflinks exon 97791634 97791692 . + . gene_id "XLOC_004585"; transcript_id "TCONS_00004585"; exon_number "1"; oId "CUFF.4737.1"; tss_id "TSS4585"; +chr2 Cufflinks exon 98068893 98068998 . + . gene_id "XLOC_004586"; transcript_id "TCONS_00004586"; exon_number "1"; oId "CUFF.4739.1"; tss_id "TSS4586"; +chr2 Cufflinks exon 98665704 98665751 . + . gene_id "XLOC_004587"; transcript_id "TCONS_00004587"; exon_number "1"; oId "CUFF.4743.1"; tss_id "TSS4587"; +chr2 Cufflinks exon 99398873 99399016 . + . gene_id "XLOC_004588"; transcript_id "TCONS_00004588"; exon_number "1"; oId "CUFF.4745.1"; tss_id "TSS4588"; +chr2 Cufflinks exon 100099145 100099202 . + . gene_id "XLOC_004589"; transcript_id "TCONS_00004589"; exon_number "1"; oId "CUFF.4747.1"; tss_id "TSS4589"; +chr2 Cufflinks exon 101193932 101194022 . + . gene_id "XLOC_004590"; transcript_id "TCONS_00004590"; exon_number "1"; oId "CUFF.4751.1"; tss_id "TSS4590"; +chr2 Cufflinks exon 102881940 102882007 . + . gene_id "XLOC_004591"; transcript_id "TCONS_00004591"; exon_number "1"; oId "CUFF.4753.1"; tss_id "TSS4591"; +chr2 Cufflinks exon 104811227 104811299 . + . gene_id "XLOC_004592"; transcript_id "TCONS_00004592"; exon_number "1"; oId "CUFF.4757.1"; tss_id "TSS4592"; +chr2 Cufflinks exon 105149231 105149443 . + . gene_id "XLOC_004593"; transcript_id "TCONS_00004593"; exon_number "1"; oId "CUFF.4758.1"; tss_id "TSS4593"; +chr2 Cufflinks exon 112687804 112688067 . + . gene_id "XLOC_004594"; transcript_id "TCONS_00004594"; exon_number "1"; oId "CUFF.4766.1"; tss_id "TSS4594"; +chr2 Cufflinks exon 112761901 112762107 . + . gene_id "XLOC_004595"; transcript_id "TCONS_00004595"; exon_number "1"; oId "CUFF.4768.1"; tss_id "TSS4595"; +chr2 Cufflinks exon 112791847 112791882 . + . gene_id "XLOC_004596"; transcript_id "TCONS_00004596"; exon_number "1"; oId "CUFF.4769.1"; tss_id "TSS4596"; +chr2 Cufflinks exon 113221302 113221366 . + . gene_id "XLOC_004597"; transcript_id "TCONS_00004597"; exon_number "1"; oId "CUFF.4771.1"; tss_id "TSS4597"; +chr2 Cufflinks exon 113538733 113538773 . + . gene_id "XLOC_004598"; transcript_id "TCONS_00004598"; exon_number "1"; oId "CUFF.4773.1"; tss_id "TSS4598"; +chr2 Cufflinks exon 113844382 113844483 . + . gene_id "XLOC_004599"; transcript_id "TCONS_00004599"; exon_number "1"; oId "CUFF.4774.1"; tss_id "TSS4599"; +chr2 Cufflinks exon 114212954 114212988 . + . gene_id "XLOC_004600"; transcript_id "TCONS_00004600"; exon_number "1"; oId "CUFF.4775.1"; tss_id "TSS4600"; +chr2 Cufflinks exon 114438689 114438791 . + . gene_id "XLOC_004601"; transcript_id "TCONS_00004601"; exon_number "1"; oId "CUFF.4776.1"; tss_id "TSS4601"; +chr2 Cufflinks exon 114988354 114988390 . + . gene_id "XLOC_004602"; transcript_id "TCONS_00004602"; exon_number "1"; oId "CUFF.4779.1"; tss_id "TSS4602"; +chr2 Cufflinks exon 115177702 115177758 . + . gene_id "XLOC_004603"; transcript_id "TCONS_00004603"; exon_number "1"; oId "CUFF.4782.1"; tss_id "TSS4603"; +chr2 Cufflinks exon 115585780 115585822 . + . gene_id "XLOC_004604"; transcript_id "TCONS_00004604"; exon_number "1"; oId "CUFF.4783.1"; tss_id "TSS4604"; +chr2 Cufflinks exon 115695292 115695382 . + . gene_id "XLOC_004605"; transcript_id "TCONS_00004605"; exon_number "1"; oId "CUFF.4785.1"; tss_id "TSS4605"; +chr2 Cufflinks exon 117000316 117000353 . + . gene_id "XLOC_004606"; transcript_id "TCONS_00004606"; exon_number "1"; oId "CUFF.4788.1"; tss_id "TSS4606"; +chr2 Cufflinks exon 117780780 117780925 . + . gene_id "XLOC_004607"; transcript_id "TCONS_00004607"; exon_number "1"; oId "CUFF.4789.1"; tss_id "TSS4607"; +chr2 Cufflinks exon 117781417 117781494 . + . gene_id "XLOC_004608"; transcript_id "TCONS_00004608"; exon_number "1"; oId "CUFF.4790.1"; tss_id "TSS4608"; +chr2 Cufflinks exon 118649525 118649562 . + . gene_id "XLOC_004609"; transcript_id "TCONS_00004609"; exon_number "1"; oId "CUFF.4793.1"; tss_id "TSS4609"; +chr2 Cufflinks exon 118773961 118774262 . + . gene_id "XLOC_004610"; transcript_id "TCONS_00004610"; exon_number "1"; oId "CUFF.4794.1"; tss_id "TSS4610"; +chr2 Cufflinks exon 119262686 119262726 . + . gene_id "XLOC_004611"; transcript_id "TCONS_00004611"; exon_number "1"; oId "CUFF.4795.1"; tss_id "TSS4611"; +chr2 Cufflinks exon 119927398 119927696 . + . gene_id "XLOC_004612"; transcript_id "TCONS_00004612"; exon_number "1"; oId "CUFF.4796.1"; tss_id "TSS4612"; +chr2 Cufflinks exon 120288530 120288605 . + . gene_id "XLOC_004613"; transcript_id "TCONS_00004613"; exon_number "1"; oId "CUFF.4797.1"; tss_id "TSS4613"; +chr2 Cufflinks exon 120628997 120629125 . + . gene_id "XLOC_004614"; transcript_id "TCONS_00004614"; exon_number "1"; oId "CUFF.4799.1"; tss_id "TSS4614"; +chr2 Cufflinks exon 120670054 120670091 . + . gene_id "XLOC_004615"; transcript_id "TCONS_00004615"; exon_number "1"; oId "CUFF.4800.1"; tss_id "TSS4615"; +chr2 Cufflinks exon 120674893 120674998 . + . gene_id "XLOC_004616"; transcript_id "TCONS_00004616"; exon_number "1"; oId "CUFF.4801.1"; tss_id "TSS4616"; +chr2 Cufflinks exon 121608645 121608679 . + . gene_id "XLOC_004617"; transcript_id "TCONS_00004617"; exon_number "1"; oId "CUFF.4802.1"; tss_id "TSS4617"; +chr2 Cufflinks exon 121836198 121836528 . + . gene_id "XLOC_004618"; transcript_id "TCONS_00004618"; exon_number "1"; oId "CUFF.4803.1"; tss_id "TSS4618"; +chr2 Cufflinks exon 121948305 121948426 . + . gene_id "XLOC_004619"; transcript_id "TCONS_00004619"; exon_number "1"; oId "CUFF.4805.1"; tss_id "TSS4619"; +chr2 Cufflinks exon 125690492 125690570 . + . gene_id "XLOC_004620"; transcript_id "TCONS_00004620"; exon_number "1"; oId "CUFF.4810.1"; tss_id "TSS4620"; +chr2 Cufflinks exon 125728170 125728202 . + . gene_id "XLOC_004621"; transcript_id "TCONS_00004621"; exon_number "1"; oId "CUFF.4811.1"; tss_id "TSS4621"; +chr2 Cufflinks exon 125746796 125746902 . + . gene_id "XLOC_004622"; transcript_id "TCONS_00004622"; exon_number "1"; oId "CUFF.4812.1"; tss_id "TSS4622"; +chr2 Cufflinks exon 127599409 127599442 . + . gene_id "XLOC_004623"; transcript_id "TCONS_00004623"; exon_number "1"; oId "CUFF.4815.1"; tss_id "TSS4623"; +chr2 Cufflinks exon 127775007 127775058 . + . gene_id "XLOC_004624"; transcript_id "TCONS_00004624"; exon_number "1"; oId "CUFF.4816.1"; tss_id "TSS4624"; +chr2 Cufflinks exon 128074450 128074551 . + . gene_id "XLOC_004625"; transcript_id "TCONS_00004625"; exon_number "1"; oId "CUFF.4819.1"; tss_id "TSS4625"; +chr2 Cufflinks exon 128229810 128229877 . + . gene_id "XLOC_004626"; transcript_id "TCONS_00004626"; exon_number "1"; oId "CUFF.4820.1"; tss_id "TSS4626"; +chr2 Cufflinks exon 128602810 128602905 . + . gene_id "XLOC_004627"; transcript_id "TCONS_00004627"; exon_number "1"; oId "CUFF.4821.1"; tss_id "TSS4627"; +chr2 Cufflinks exon 130184994 130185099 . + . gene_id "XLOC_004628"; transcript_id "TCONS_00004628"; exon_number "1"; oId "CUFF.4825.1"; tss_id "TSS4628"; +chr2 Cufflinks exon 131380411 131380516 . + . gene_id "XLOC_004629"; transcript_id "TCONS_00004629"; exon_number "1"; oId "CUFF.4831.1"; tss_id "TSS4629"; +chr2 Cufflinks exon 131987180 131987285 . + . gene_id "XLOC_004630"; transcript_id "TCONS_00004630"; exon_number "1"; oId "CUFF.4834.1"; tss_id "TSS4630"; +chr2 Cufflinks exon 132140142 132140212 . + . gene_id "XLOC_004631"; transcript_id "TCONS_00004631"; exon_number "1"; oId "CUFF.4835.1"; tss_id "TSS4631"; +chr2 Cufflinks exon 132143133 132143204 . + . gene_id "XLOC_004632"; transcript_id "TCONS_00004632"; exon_number "1"; oId "CUFF.4836.1"; tss_id "TSS4632"; +chr2 Cufflinks exon 132360363 132360468 . + . gene_id "XLOC_004633"; transcript_id "TCONS_00004633"; exon_number "1"; oId "CUFF.4837.1"; tss_id "TSS4633"; +chr2 Cufflinks exon 133166508 133166604 . + . gene_id "XLOC_004634"; transcript_id "TCONS_00004634"; exon_number "1"; oId "CUFF.4842.1"; tss_id "TSS4634"; +chr2 Cufflinks exon 133281190 133281431 . + . gene_id "XLOC_004635"; transcript_id "TCONS_00004635"; exon_number "1"; oId "CUFF.4843.1"; tss_id "TSS4635"; +chr2 Cufflinks exon 133718522 133718559 . + . gene_id "XLOC_004636"; transcript_id "TCONS_00004636"; exon_number "1"; oId "CUFF.4844.1"; tss_id "TSS4636"; +chr2 Cufflinks exon 134091405 134091498 . + . gene_id "XLOC_004637"; transcript_id "TCONS_00004637"; exon_number "1"; oId "CUFF.4846.1"; tss_id "TSS4637"; +chr2 Cufflinks exon 134353662 134353900 . + . gene_id "XLOC_004638"; transcript_id "TCONS_00004638"; exon_number "1"; oId "CUFF.4848.1"; tss_id "TSS4638"; +chr2 Cufflinks exon 134988767 134988855 . + . gene_id "XLOC_004639"; transcript_id "TCONS_00004639"; exon_number "1"; oId "CUFF.4849.1"; tss_id "TSS4639"; +chr2 Cufflinks exon 135574486 135574523 . + . gene_id "XLOC_004640"; transcript_id "TCONS_00004640"; exon_number "1"; oId "CUFF.4850.1"; tss_id "TSS4640"; +chr2 Cufflinks exon 135816594 135816636 . + . gene_id "XLOC_004641"; transcript_id "TCONS_00004641"; exon_number "1"; oId "CUFF.4851.1"; tss_id "TSS4641"; +chr2 Cufflinks exon 137147901 137148087 . + . gene_id "XLOC_004642"; transcript_id "TCONS_00004642"; exon_number "1"; oId "CUFF.4855.1"; tss_id "TSS4642"; +chr2 Cufflinks exon 137621043 137621086 . + . gene_id "XLOC_004643"; transcript_id "TCONS_00004643"; exon_number "1"; oId "CUFF.4856.1"; tss_id "TSS4643"; +chr2 Cufflinks exon 140740253 140740483 . + . gene_id "XLOC_004644"; transcript_id "TCONS_00004644"; exon_number "1"; oId "CUFF.4861.1"; tss_id "TSS4644"; +chr2 Cufflinks exon 140978005 140978076 . + . gene_id "XLOC_004645"; transcript_id "TCONS_00004645"; exon_number "1"; oId "CUFF.4863.1"; tss_id "TSS4645"; +chr2 Cufflinks exon 142369733 142369794 . + . gene_id "XLOC_004646"; transcript_id "TCONS_00004646"; exon_number "1"; oId "CUFF.4868.1"; tss_id "TSS4646"; +chr2 Cufflinks exon 142398758 142398802 . + . gene_id "XLOC_004647"; transcript_id "TCONS_00004647"; exon_number "1"; oId "CUFF.4869.1"; tss_id "TSS4647"; +chr2 Cufflinks exon 144996997 144997176 . + . gene_id "XLOC_004648"; transcript_id "TCONS_00004648"; exon_number "1"; oId "CUFF.4872.1"; tss_id "TSS4648"; +chr2 Cufflinks exon 145609978 145610075 . + . gene_id "XLOC_004649"; transcript_id "TCONS_00004649"; exon_number "1"; oId "CUFF.4873.1"; tss_id "TSS4649"; +chr2 Cufflinks exon 146902724 146902785 . + . gene_id "XLOC_004650"; transcript_id "TCONS_00004650"; exon_number "1"; oId "CUFF.4875.1"; tss_id "TSS4650"; +chr2 Cufflinks exon 148081539 148081646 . + . gene_id "XLOC_004651"; transcript_id "TCONS_00004651"; exon_number "1"; oId "CUFF.4877.1"; tss_id "TSS4651"; +chr2 Cufflinks exon 148165910 148166016 . + . gene_id "XLOC_004652"; transcript_id "TCONS_00004652"; exon_number "1"; oId "CUFF.4878.1"; tss_id "TSS4652"; +chr2 Cufflinks exon 148634991 148635083 . + . gene_id "XLOC_004653"; transcript_id "TCONS_00004653"; exon_number "1"; oId "CUFF.4880.1"; tss_id "TSS4653"; +chr2 Cufflinks exon 149225076 149225116 . + . gene_id "XLOC_004654"; transcript_id "TCONS_00004654"; exon_number "1"; oId "CUFF.4881.1"; tss_id "TSS4654"; +chr2 Cufflinks exon 151219280 151219348 . + . gene_id "XLOC_004655"; transcript_id "TCONS_00004655"; exon_number "1"; oId "CUFF.4889.1"; tss_id "TSS4655"; +chr2 Cufflinks exon 152228526 152228814 . + . gene_id "XLOC_004656"; transcript_id "TCONS_00004656"; exon_number "1"; oId "CUFF.4892.1"; tss_id "TSS4656"; +chr2 Cufflinks exon 152651563 152651600 . + . gene_id "XLOC_004657"; transcript_id "TCONS_00004657"; exon_number "1"; oId "CUFF.4893.1"; tss_id "TSS4657"; +chr2 Cufflinks exon 155446922 155447020 . + . gene_id "XLOC_004658"; transcript_id "TCONS_00004658"; exon_number "1"; oId "CUFF.4894.1"; tss_id "TSS4658"; +chr2 Cufflinks exon 156186933 156187037 . + . gene_id "XLOC_004659"; transcript_id "TCONS_00004659"; exon_number "1"; oId "CUFF.4896.1"; tss_id "TSS4659"; +chr2 Cufflinks exon 157257281 157257352 . + . gene_id "XLOC_004660"; transcript_id "TCONS_00004660"; exon_number "1"; oId "CUFF.4897.1"; tss_id "TSS4660"; +chr2 Cufflinks exon 157278708 157278812 . + . gene_id "XLOC_004661"; transcript_id "TCONS_00004661"; exon_number "1"; oId "CUFF.4900.1"; tss_id "TSS4661"; +chr2 Cufflinks exon 158769302 158769385 . + . gene_id "XLOC_004662"; transcript_id "TCONS_00004662"; exon_number "1"; oId "CUFF.4904.1"; tss_id "TSS4662"; +chr2 Cufflinks exon 159262501 159262632 . + . gene_id "XLOC_004663"; transcript_id "TCONS_00004663"; exon_number "1"; oId "CUFF.4906.1"; tss_id "TSS4663"; +chr2 Cufflinks exon 159453105 159453157 . + . gene_id "XLOC_004664"; transcript_id "TCONS_00004664"; exon_number "1"; oId "CUFF.4911.1"; tss_id "TSS4664"; +chr2 Cufflinks exon 160535040 160535108 . + . gene_id "XLOC_004665"; transcript_id "TCONS_00004665"; exon_number "1"; oId "CUFF.4917.1"; tss_id "TSS4665"; +chr2 Cufflinks exon 160870910 160870951 . + . gene_id "XLOC_004666"; transcript_id "TCONS_00004666"; exon_number "1"; oId "CUFF.4918.1"; tss_id "TSS4666"; +chr2 Cufflinks exon 161713279 161713400 . + . gene_id "XLOC_004667"; transcript_id "TCONS_00004667"; exon_number "1"; oId "CUFF.4920.1"; tss_id "TSS4667"; +chr2 Cufflinks exon 161734086 161734371 . + . gene_id "XLOC_004668"; transcript_id "TCONS_00004668"; exon_number "1"; oId "CUFF.4921.1"; tss_id "TSS4668"; +chr2 Cufflinks exon 162415053 162415159 . + . gene_id "XLOC_004669"; transcript_id "TCONS_00004669"; exon_number "1"; oId "CUFF.4922.1"; tss_id "TSS4669"; +chr2 Cufflinks exon 163353447 163353535 . + . gene_id "XLOC_004670"; transcript_id "TCONS_00004670"; exon_number "1"; oId "CUFF.4924.1"; tss_id "TSS4670"; +chr2 Cufflinks exon 163484215 163484274 . + . gene_id "XLOC_004671"; transcript_id "TCONS_00004671"; exon_number "1"; oId "CUFF.4925.1"; tss_id "TSS4671"; +chr2 Cufflinks exon 163732575 163732647 . + . gene_id "XLOC_004672"; transcript_id "TCONS_00004672"; exon_number "1"; oId "CUFF.4927.1"; tss_id "TSS4672"; +chr2 Cufflinks exon 164145502 164145602 . + . gene_id "XLOC_004673"; transcript_id "TCONS_00004673"; exon_number "1"; oId "CUFF.4929.1"; tss_id "TSS4673"; +chr2 Cufflinks exon 165006664 165006760 . + . gene_id "XLOC_004674"; transcript_id "TCONS_00004674"; exon_number "1"; oId "CUFF.4930.1"; tss_id "TSS4674"; +chr2 Cufflinks exon 165525831 165525865 . + . gene_id "XLOC_004675"; transcript_id "TCONS_00004675"; exon_number "1"; oId "CUFF.4931.1"; tss_id "TSS4675"; +chr2 Cufflinks exon 165602822 165602886 . + . gene_id "XLOC_004676"; transcript_id "TCONS_00004676"; exon_number "1"; oId "CUFF.4932.1"; tss_id "TSS4676"; +chr2 Cufflinks exon 165714942 165715049 . + . gene_id "XLOC_004677"; transcript_id "TCONS_00004677"; exon_number "1"; oId "CUFF.4933.1"; tss_id "TSS4677"; +chr2 Cufflinks exon 166880202 166880286 . + . gene_id "XLOC_004678"; transcript_id "TCONS_00004678"; exon_number "1"; oId "CUFF.4936.1"; tss_id "TSS4678"; +chr2 Cufflinks exon 167215248 167215346 . + . gene_id "XLOC_004679"; transcript_id "TCONS_00004679"; exon_number "1"; oId "CUFF.4939.1"; tss_id "TSS4679"; +chr2 Cufflinks exon 167786762 167786877 . + . gene_id "XLOC_004680"; transcript_id "TCONS_00004680"; exon_number "1"; oId "CUFF.4940.1"; tss_id "TSS4680"; +chr2 Cufflinks exon 169307834 169308126 . + . gene_id "XLOC_004681"; transcript_id "TCONS_00004681"; exon_number "1"; oId "CUFF.4944.1"; tss_id "TSS4681"; +chr2 Cufflinks exon 170672789 170672859 . + . gene_id "XLOC_004682"; transcript_id "TCONS_00004682"; exon_number "1"; oId "CUFF.4946.1"; tss_id "TSS4682"; +chr2 Cufflinks exon 170767640 170767677 . + . gene_id "XLOC_004683"; transcript_id "TCONS_00004683"; exon_number "1"; oId "CUFF.4947.1"; tss_id "TSS4683"; +chr2 Cufflinks exon 171634646 171634676 . + . gene_id "XLOC_004684"; transcript_id "TCONS_00004684"; exon_number "1"; oId "CUFF.4949.1"; tss_id "TSS4684"; +chr2 Cufflinks exon 172002839 172002935 . + . gene_id "XLOC_004685"; transcript_id "TCONS_00004685"; exon_number "1"; oId "CUFF.4950.1"; tss_id "TSS4685"; +chr2 Cufflinks exon 173556026 173556133 . + . gene_id "XLOC_004686"; transcript_id "TCONS_00004686"; exon_number "1"; oId "CUFF.4952.1"; tss_id "TSS4686"; +chr2 Cufflinks exon 173672436 173672508 . + . gene_id "XLOC_004687"; transcript_id "TCONS_00004687"; exon_number "1"; oId "CUFF.4955.1"; tss_id "TSS4687"; +chr2 Cufflinks exon 174312919 174312965 . + . gene_id "XLOC_004688"; transcript_id "TCONS_00004688"; exon_number "1"; oId "CUFF.4957.1"; tss_id "TSS4688"; +chr2 Cufflinks exon 175886942 175887046 . + . gene_id "XLOC_004689"; transcript_id "TCONS_00004689"; exon_number "1"; oId "CUFF.4961.1"; tss_id "TSS4689"; +chr2 Cufflinks exon 175894497 175894604 . + . gene_id "XLOC_004690"; transcript_id "TCONS_00004690"; exon_number "1"; oId "CUFF.4962.1"; tss_id "TSS4690"; +chr2 Cufflinks exon 176772560 176772597 . + . gene_id "XLOC_004691"; transcript_id "TCONS_00004691"; exon_number "1"; oId "CUFF.4963.1"; tss_id "TSS4691"; +chr2 Cufflinks exon 177125140 177125176 . + . gene_id "XLOC_004692"; transcript_id "TCONS_00004692"; exon_number "1"; oId "CUFF.4965.1"; tss_id "TSS4692"; +chr2 Cufflinks exon 178003430 178003531 . + . gene_id "XLOC_004693"; transcript_id "TCONS_00004693"; exon_number "1"; oId "CUFF.4968.1"; tss_id "TSS4693"; +chr2 Cufflinks exon 178903629 178903731 . + . gene_id "XLOC_004694"; transcript_id "TCONS_00004694"; exon_number "1"; oId "CUFF.4971.1"; tss_id "TSS4694"; +chr2 Cufflinks exon 179007273 179007361 . + . gene_id "XLOC_004695"; transcript_id "TCONS_00004695"; exon_number "1"; oId "CUFF.4972.1"; tss_id "TSS4695"; +chr2 Cufflinks exon 179488081 179488210 . + . gene_id "XLOC_004696"; transcript_id "TCONS_00004696"; exon_number "1"; oId "CUFF.4975.1"; tss_id "TSS4696"; +chr2 Cufflinks exon 180051523 180051594 . + . gene_id "XLOC_004697"; transcript_id "TCONS_00004697"; exon_number "1"; oId "CUFF.4978.1"; tss_id "TSS4697"; +chr2 Cufflinks exon 181797682 181797775 . + . gene_id "XLOC_004698"; transcript_id "TCONS_00004698"; exon_number "1"; oId "CUFF.4979.1"; tss_id "TSS4698"; +chr2 Cufflinks exon 181875141 181875192 . + . gene_id "XLOC_004699"; transcript_id "TCONS_00004699"; exon_number "1"; oId "CUFF.4980.1"; tss_id "TSS4699"; +chr2 Cufflinks exon 182913549 182913639 . + . gene_id "XLOC_004700"; transcript_id "TCONS_00004700"; exon_number "1"; oId "CUFF.4981.1"; tss_id "TSS4700"; +chr2 Cufflinks exon 183179028 183179282 . + . gene_id "XLOC_004701"; transcript_id "TCONS_00004701"; exon_number "1"; oId "CUFF.4982.1"; tss_id "TSS4701"; +chr2 Cufflinks exon 183275905 183275951 . + . gene_id "XLOC_004702"; transcript_id "TCONS_00004702"; exon_number "1"; oId "CUFF.4983.1"; tss_id "TSS4702"; +chr2 Cufflinks exon 183356379 183356418 . + . gene_id "XLOC_004703"; transcript_id "TCONS_00004703"; exon_number "1"; oId "CUFF.4984.1"; tss_id "TSS4703"; +chr2 Cufflinks exon 183738569 183738675 . + . gene_id "XLOC_004704"; transcript_id "TCONS_00004704"; exon_number "1"; oId "CUFF.4985.1"; tss_id "TSS4704"; +chr2 Cufflinks exon 184554367 184554401 . + . gene_id "XLOC_004705"; transcript_id "TCONS_00004705"; exon_number "1"; oId "CUFF.4986.1"; tss_id "TSS4705"; +chr2 Cufflinks exon 186526500 186526634 . + . gene_id "XLOC_004706"; transcript_id "TCONS_00004706"; exon_number "1"; oId "CUFF.4989.1"; tss_id "TSS4706"; +chr2 Cufflinks exon 190435596 190435684 . + . gene_id "XLOC_004707"; transcript_id "TCONS_00004707"; exon_number "1"; oId "CUFF.4995.1"; tss_id "TSS4707"; +chr2 Cufflinks exon 191984681 191984720 . + . gene_id "XLOC_004708"; transcript_id "TCONS_00004708"; exon_number "1"; oId "CUFF.5000.1"; tss_id "TSS4708"; +chr2 Cufflinks exon 191986676 191986782 . + . gene_id "XLOC_004709"; transcript_id "TCONS_00004709"; exon_number "1"; oId "CUFF.5001.1"; tss_id "TSS4709"; +chr2 Cufflinks exon 192235664 192235729 . + . gene_id "XLOC_004710"; transcript_id "TCONS_00004710"; exon_number "1"; oId "CUFF.5002.1"; tss_id "TSS4710"; +chr2 Cufflinks exon 195208717 195208758 . + . gene_id "XLOC_004711"; transcript_id "TCONS_00004711"; exon_number "1"; oId "CUFF.5004.1"; tss_id "TSS4711"; +chr2 Cufflinks exon 195594419 195594460 . + . gene_id "XLOC_004712"; transcript_id "TCONS_00004712"; exon_number "1"; oId "CUFF.5006.1"; tss_id "TSS4712"; +chr2 Cufflinks exon 196378760 196378859 . + . gene_id "XLOC_004713"; transcript_id "TCONS_00004713"; exon_number "1"; oId "CUFF.5008.1"; tss_id "TSS4713"; +chr2 Cufflinks exon 197154135 197154440 . + . gene_id "XLOC_004714"; transcript_id "TCONS_00004714"; exon_number "1"; oId "CUFF.5012.1"; tss_id "TSS4714"; +chr2 Cufflinks exon 197743183 197743219 . + . gene_id "XLOC_004715"; transcript_id "TCONS_00004715"; exon_number "1"; oId "CUFF.5013.1"; tss_id "TSS4715"; +chr2 Cufflinks exon 198025424 198025538 . + . gene_id "XLOC_004716"; transcript_id "TCONS_00004716"; exon_number "1"; oId "CUFF.5014.1"; tss_id "TSS4716"; +chr2 Cufflinks exon 198099548 198099585 . + . gene_id "XLOC_004717"; transcript_id "TCONS_00004717"; exon_number "1"; oId "CUFF.5015.1"; tss_id "TSS4717"; +chr2 Cufflinks exon 198312469 198312575 . + . gene_id "XLOC_004718"; transcript_id "TCONS_00004718"; exon_number "1"; oId "CUFF.5016.1"; tss_id "TSS4718"; +chr2 Cufflinks exon 199466271 199466312 . + . gene_id "XLOC_004719"; transcript_id "TCONS_00004719"; exon_number "1"; oId "CUFF.5018.1"; tss_id "TSS4719"; +chr2 Cufflinks exon 200055783 200055842 . + . gene_id "XLOC_004720"; transcript_id "TCONS_00004720"; exon_number "1"; oId "CUFF.5020.1"; tss_id "TSS4720"; +chr2 Cufflinks exon 201124403 201124517 . + . gene_id "XLOC_004721"; transcript_id "TCONS_00004721"; exon_number "1"; oId "CUFF.5022.1"; tss_id "TSS4721"; +chr2 Cufflinks exon 201607572 201607687 . + . gene_id "XLOC_004722"; transcript_id "TCONS_00004722"; exon_number "1"; oId "CUFF.5024.1"; tss_id "TSS4722"; +chr2 Cufflinks exon 201640308 201640472 . + . gene_id "XLOC_004723"; transcript_id "TCONS_00004723"; exon_number "1"; oId "CUFF.5025.1"; tss_id "TSS4723"; +chr2 Cufflinks exon 201694732 201694839 . + . gene_id "XLOC_004724"; transcript_id "TCONS_00004724"; exon_number "1"; oId "CUFF.5026.1"; tss_id "TSS4724"; +chr2 Cufflinks exon 201763743 201763843 . + . gene_id "XLOC_004725"; transcript_id "TCONS_00004725"; exon_number "1"; oId "CUFF.5029.1"; tss_id "TSS4725"; +chr2 Cufflinks exon 201911899 201911943 . + . gene_id "XLOC_004726"; transcript_id "TCONS_00004726"; exon_number "1"; oId "CUFF.5030.1"; tss_id "TSS4726"; +chr2 Cufflinks exon 201944565 201944633 . + . gene_id "XLOC_004727"; transcript_id "TCONS_00004727"; exon_number "1"; oId "CUFF.5031.1"; tss_id "TSS4727"; +chr2 Cufflinks exon 201962467 201962835 . + . gene_id "XLOC_004728"; transcript_id "TCONS_00004728"; exon_number "1"; oId "CUFF.5032.1"; tss_id "TSS4728"; +chr2 Cufflinks exon 202006628 202006687 . + . gene_id "XLOC_004729"; transcript_id "TCONS_00004729"; exon_number "1"; oId "CUFF.5034.1"; tss_id "TSS4729"; +chr2 Cufflinks exon 202511439 202511544 . + . gene_id "XLOC_004730"; transcript_id "TCONS_00004730"; exon_number "1"; oId "CUFF.5036.1"; tss_id "TSS4730"; +chr2 Cufflinks exon 202792156 202792266 . + . gene_id "XLOC_004731"; transcript_id "TCONS_00004731"; exon_number "1"; oId "CUFF.5037.1"; tss_id "TSS4731"; +chr2 Cufflinks exon 202793904 202793943 . + . gene_id "XLOC_004732"; transcript_id "TCONS_00004732"; exon_number "1"; oId "CUFF.5038.1"; tss_id "TSS4732"; +chr2 Cufflinks exon 202946597 202946704 . + . gene_id "XLOC_004733"; transcript_id "TCONS_00004733"; exon_number "1"; oId "CUFF.5040.1"; tss_id "TSS4733"; +chr2 Cufflinks exon 203198162 203198471 . + . gene_id "XLOC_004734"; transcript_id "TCONS_00004734"; exon_number "1"; oId "CUFF.5041.1"; tss_id "TSS4734"; +chr2 Cufflinks exon 204646760 204646866 . + . gene_id "XLOC_004735"; transcript_id "TCONS_00004735"; exon_number "1"; oId "CUFF.5048.1"; tss_id "TSS4735"; +chr2 Cufflinks exon 206078211 206078305 . + . gene_id "XLOC_004736"; transcript_id "TCONS_00004736"; exon_number "1"; oId "CUFF.5050.1"; tss_id "TSS4736"; +chr2 Cufflinks exon 206218954 206219028 . + . gene_id "XLOC_004737"; transcript_id "TCONS_00004737"; exon_number "1"; oId "CUFF.5051.1"; tss_id "TSS4737"; +chr2 Cufflinks exon 206765354 206765676 . + . gene_id "XLOC_004738"; transcript_id "TCONS_00004738"; exon_number "1"; oId "CUFF.5052.1"; tss_id "TSS4738"; +chr2 Cufflinks exon 207086039 207086276 . + . gene_id "XLOC_004739"; transcript_id "TCONS_00004739"; exon_number "1"; oId "CUFF.5053.1"; tss_id "TSS4739"; +chr2 Cufflinks exon 209136490 209136517 . + . gene_id "XLOC_004740"; transcript_id "TCONS_00004740"; exon_number "1"; oId "CUFF.5061.1"; tss_id "TSS4740"; +chr2 Cufflinks exon 210437187 210437281 . + . gene_id "XLOC_004741"; transcript_id "TCONS_00004741"; exon_number "1"; oId "CUFF.5064.1"; tss_id "TSS4741"; +chr2 Cufflinks exon 211796824 211796861 . + . gene_id "XLOC_004742"; transcript_id "TCONS_00004742"; exon_number "1"; oId "CUFF.5067.1"; tss_id "TSS4742"; +chr2 Cufflinks exon 212014595 212014719 . + . gene_id "XLOC_004743"; transcript_id "TCONS_00004743"; exon_number "1"; oId "CUFF.5068.1"; tss_id "TSS4743"; +chr2 Cufflinks exon 212400378 212400467 . + . gene_id "XLOC_004744"; transcript_id "TCONS_00004744"; exon_number "1"; oId "CUFF.5069.1"; tss_id "TSS4744"; +chr2 Cufflinks exon 214122837 214122884 . + . gene_id "XLOC_004745"; transcript_id "TCONS_00004745"; exon_number "1"; oId "CUFF.5072.1"; tss_id "TSS4745"; +chr2 Cufflinks exon 214443364 214443398 . + . gene_id "XLOC_004746"; transcript_id "TCONS_00004746"; exon_number "1"; oId "CUFF.5074.1"; tss_id "TSS4746"; +chr2 Cufflinks exon 214637027 214637102 . + . gene_id "XLOC_004747"; transcript_id "TCONS_00004747"; exon_number "1"; oId "CUFF.5075.1"; tss_id "TSS4747"; +chr2 Cufflinks exon 214775024 214775096 . + . gene_id "XLOC_004748"; transcript_id "TCONS_00004748"; exon_number "1"; oId "CUFF.5076.1"; tss_id "TSS4748"; +chr2 Cufflinks exon 215244471 215244516 . + . gene_id "XLOC_004749"; transcript_id "TCONS_00004749"; exon_number "1"; oId "CUFF.5077.1"; tss_id "TSS4749"; +chr2 Cufflinks exon 216167488 216167569 . + . gene_id "XLOC_004750"; transcript_id "TCONS_00004750"; exon_number "1"; oId "CUFF.5079.1"; tss_id "TSS4750"; +chr2 Cufflinks exon 216167867 216167913 . + . gene_id "XLOC_004751"; transcript_id "TCONS_00004751"; exon_number "1"; oId "CUFF.5080.1"; tss_id "TSS4751"; +chr2 Cufflinks exon 217063110 217063147 . + . gene_id "XLOC_004752"; transcript_id "TCONS_00004752"; exon_number "1"; oId "CUFF.5084.1"; tss_id "TSS4752"; +chr2 Cufflinks exon 218116279 218116456 . + . gene_id "XLOC_004753"; transcript_id "TCONS_00004753"; exon_number "1"; oId "CUFF.5087.1"; tss_id "TSS4753"; +chr2 Cufflinks exon 218633881 218633933 . + . gene_id "XLOC_004754"; transcript_id "TCONS_00004754"; exon_number "1"; oId "CUFF.5088.1"; tss_id "TSS4754"; +chr2 Cufflinks exon 219110549 219110641 . + . gene_id "XLOC_004755"; transcript_id "TCONS_00004755"; exon_number "1"; oId "CUFF.5090.1"; tss_id "TSS4755"; +chr2 Cufflinks exon 219179371 219179405 . + . gene_id "XLOC_004756"; transcript_id "TCONS_00004756"; exon_number "1"; oId "CUFF.5091.1"; tss_id "TSS4756"; +chr2 Cufflinks exon 219193302 219193406 . + . gene_id "XLOC_004757"; transcript_id "TCONS_00004757"; exon_number "1"; oId "CUFF.5092.1"; tss_id "TSS4757"; +chr2 Cufflinks exon 219484524 219484598 . + . gene_id "XLOC_004758"; transcript_id "TCONS_00004758"; exon_number "1"; oId "CUFF.5095.1"; tss_id "TSS4758"; +chr2 Cufflinks exon 219967156 219967433 . + . gene_id "XLOC_004759"; transcript_id "TCONS_00004759"; exon_number "1"; oId "CUFF.5097.1"; tss_id "TSS4759"; +chr2 Cufflinks exon 223100343 223100493 . + . gene_id "XLOC_004760"; transcript_id "TCONS_00004760"; exon_number "1"; oId "CUFF.5101.1"; tss_id "TSS4760"; +chr2 Cufflinks exon 223363011 223363117 . + . gene_id "XLOC_004761"; transcript_id "TCONS_00004761"; exon_number "1"; oId "CUFF.5102.1"; tss_id "TSS4761"; +chr2 Cufflinks exon 223630926 223630984 . + . gene_id "XLOC_004762"; transcript_id "TCONS_00004762"; exon_number "1"; oId "CUFF.5104.1"; tss_id "TSS4762"; +chr2 Cufflinks exon 224581439 224581477 . + . gene_id "XLOC_004763"; transcript_id "TCONS_00004763"; exon_number "1"; oId "CUFF.5107.1"; tss_id "TSS4763"; +chr2 Cufflinks exon 225086146 225086242 . + . gene_id "XLOC_004764"; transcript_id "TCONS_00004764"; exon_number "1"; oId "CUFF.5108.1"; tss_id "TSS4764"; +chr2 Cufflinks exon 225513680 225513716 . + . gene_id "XLOC_004765"; transcript_id "TCONS_00004765"; exon_number "1"; oId "CUFF.5109.1"; tss_id "TSS4765"; +chr2 Cufflinks exon 225798823 225798879 . + . gene_id "XLOC_004766"; transcript_id "TCONS_00004766"; exon_number "1"; oId "CUFF.5110.1"; tss_id "TSS4766"; +chr2 Cufflinks exon 226899281 226899313 . + . gene_id "XLOC_004767"; transcript_id "TCONS_00004767"; exon_number "1"; oId "CUFF.5112.1"; tss_id "TSS4767"; +chr2 Cufflinks exon 227408566 227408624 . + . gene_id "XLOC_004768"; transcript_id "TCONS_00004768"; exon_number "1"; oId "CUFF.5114.1"; tss_id "TSS4768"; +chr2 Cufflinks exon 228096966 228097014 . + . gene_id "XLOC_004769"; transcript_id "TCONS_00004769"; exon_number "1"; oId "CUFF.5115.1"; tss_id "TSS4769"; +chr2 Cufflinks exon 228525098 228525141 . + . gene_id "XLOC_004770"; transcript_id "TCONS_00004770"; exon_number "1"; oId "CUFF.5117.1"; tss_id "TSS4770"; +chr2 Cufflinks exon 228535221 228535261 . + . gene_id "XLOC_004771"; transcript_id "TCONS_00004771"; exon_number "1"; oId "CUFF.5118.1"; tss_id "TSS4771"; +chr2 Cufflinks exon 228976954 228976988 . + . gene_id "XLOC_004772"; transcript_id "TCONS_00004772"; exon_number "1"; oId "CUFF.5120.1"; tss_id "TSS4772"; +chr2 Cufflinks exon 229460927 229460968 . + . gene_id "XLOC_004773"; transcript_id "TCONS_00004773"; exon_number "1"; oId "CUFF.5121.1"; tss_id "TSS4773"; +chr2 Cufflinks exon 229521122 229521186 . + . gene_id "XLOC_004774"; transcript_id "TCONS_00004774"; exon_number "1"; oId "CUFF.5122.1"; tss_id "TSS4774"; +chr2 Cufflinks exon 230015753 230015823 . + . gene_id "XLOC_004775"; transcript_id "TCONS_00004775"; exon_number "1"; oId "CUFF.5124.1"; tss_id "TSS4775"; +chr2 Cufflinks exon 230103189 230103227 . + . gene_id "XLOC_004776"; transcript_id "TCONS_00004776"; exon_number "1"; oId "CUFF.5127.1"; tss_id "TSS4776"; +chr2 Cufflinks exon 230470955 230471015 . + . gene_id "XLOC_004777"; transcript_id "TCONS_00004777"; exon_number "1"; oId "CUFF.5128.1"; tss_id "TSS4777"; +chr2 Cufflinks exon 230759062 230759140 . + . gene_id "XLOC_004778"; transcript_id "TCONS_00004778"; exon_number "1"; oId "CUFF.5129.1"; tss_id "TSS4778"; +chr2 Cufflinks exon 230838031 230838137 . + . gene_id "XLOC_004779"; transcript_id "TCONS_00004779"; exon_number "1"; oId "CUFF.5131.1"; tss_id "TSS4779"; +chr2 Cufflinks exon 231371816 231372114 . + . gene_id "XLOC_004780"; transcript_id "TCONS_00004780"; exon_number "1"; oId "CUFF.5132.1"; tss_id "TSS4780"; +chr2 Cufflinks exon 231451837 231451936 . + . gene_id "XLOC_004781"; transcript_id "TCONS_00004781"; exon_number "1"; oId "CUFF.5133.1"; tss_id "TSS4781"; +chr2 Cufflinks exon 231616856 231616960 . + . gene_id "XLOC_004782"; transcript_id "TCONS_00004782"; exon_number "1"; oId "CUFF.5134.1"; tss_id "TSS4782"; +chr2 Cufflinks exon 231998179 231998345 . + . gene_id "XLOC_004783"; transcript_id "TCONS_00004783"; exon_number "1"; oId "CUFF.5135.1"; tss_id "TSS4783"; +chr2 Cufflinks exon 232110068 232110184 . + . gene_id "XLOC_004784"; transcript_id "TCONS_00004784"; exon_number "1"; oId "CUFF.5136.1"; tss_id "TSS4784"; +chr2 Cufflinks exon 232576236 232576305 . + . gene_id "XLOC_004785"; transcript_id "TCONS_00004785"; exon_number "1"; oId "CUFF.5140.1"; tss_id "TSS4785"; +chr2 Cufflinks exon 232622597 232622660 . + . gene_id "XLOC_004786"; transcript_id "TCONS_00004786"; exon_number "1"; oId "CUFF.5141.1"; tss_id "TSS4786"; +chr2 Cufflinks exon 232687135 232687177 . + . gene_id "XLOC_004787"; transcript_id "TCONS_00004787"; exon_number "1"; oId "CUFF.5142.1"; tss_id "TSS4787"; +chr2 Cufflinks exon 233325536 233325612 . + . gene_id "XLOC_004788"; transcript_id "TCONS_00004788"; exon_number "1"; oId "CUFF.5143.1"; tss_id "TSS4788"; +chr2 Cufflinks exon 233514560 233514862 . + . gene_id "XLOC_004789"; transcript_id "TCONS_00004789"; exon_number "1"; oId "CUFF.5144.1"; tss_id "TSS4789"; +chr2 Cufflinks exon 233543672 233543774 . + . gene_id "XLOC_004790"; transcript_id "TCONS_00004790"; exon_number "1"; oId "CUFF.5145.1"; tss_id "TSS4790"; +chr2 Cufflinks exon 233647375 233647444 . + . gene_id "XLOC_004791"; transcript_id "TCONS_00004791"; exon_number "1"; oId "CUFF.5146.1"; tss_id "TSS4791"; +chr2 Cufflinks exon 234624498 234624574 . + . gene_id "XLOC_004792"; transcript_id "TCONS_00004792"; exon_number "1"; oId "CUFF.5147.1"; tss_id "TSS4792"; +chr2 Cufflinks exon 235098242 235098283 . + . gene_id "XLOC_004793"; transcript_id "TCONS_00004793"; exon_number "1"; oId "CUFF.5148.1"; tss_id "TSS4793"; +chr2 Cufflinks exon 236577684 236577751 . + . gene_id "XLOC_004794"; transcript_id "TCONS_00004794"; exon_number "1"; oId "CUFF.5150.1"; tss_id "TSS4794"; +chr2 Cufflinks exon 236945896 236945954 . + . gene_id "XLOC_004795"; transcript_id "TCONS_00004795"; exon_number "1"; oId "CUFF.5151.1"; tss_id "TSS4795"; +chr2 Cufflinks exon 237237341 237237394 . + . gene_id "XLOC_004796"; transcript_id "TCONS_00004796"; exon_number "1"; oId "CUFF.5153.1"; tss_id "TSS4796"; +chr2 Cufflinks exon 238471808 238471875 . + . gene_id "XLOC_004797"; transcript_id "TCONS_00004797"; exon_number "1"; oId "CUFF.5156.1"; tss_id "TSS4797"; +chr2 Cufflinks exon 239321301 239321382 . + . gene_id "XLOC_004798"; transcript_id "TCONS_00004798"; exon_number "1"; oId "CUFF.5158.1"; tss_id "TSS4798"; +chr2 Cufflinks exon 239711520 239711600 . + . gene_id "XLOC_004799"; transcript_id "TCONS_00004799"; exon_number "1"; oId "CUFF.5160.1"; tss_id "TSS4799"; +chr2 Cufflinks exon 241228633 241228860 . + . gene_id "XLOC_004800"; transcript_id "TCONS_00004800"; exon_number "1"; oId "CUFF.5161.1"; tss_id "TSS4800"; +chr2 Cufflinks exon 242524383 242524472 . + . gene_id "XLOC_004801"; transcript_id "TCONS_00004801"; exon_number "1"; oId "CUFF.5164.1"; tss_id "TSS4801"; +chr2 Cufflinks exon 242527356 242527424 . + . gene_id "XLOC_004802"; transcript_id "TCONS_00004802"; exon_number "1"; oId "CUFF.5165.1"; tss_id "TSS4802"; +chr2 Cufflinks exon 3079443 3079545 . - . gene_id "XLOC_004803"; transcript_id "TCONS_00004803"; exon_number "1"; oId "CUFF.4431.1"; tss_id "TSS4803"; +chr2 Cufflinks exon 5990359 5990394 . - . gene_id "XLOC_004804"; transcript_id "TCONS_00004804"; exon_number "1"; oId "CUFF.4435.1"; tss_id "TSS4804"; +chr2 Cufflinks exon 7281434 7281656 . - . gene_id "XLOC_004805"; transcript_id "TCONS_00004805"; exon_number "1"; oId "CUFF.4436.1"; tss_id "TSS4805"; +chr2 Cufflinks exon 8209442 8209492 . - . gene_id "XLOC_004806"; transcript_id "TCONS_00004806"; exon_number "1"; oId "CUFF.4437.1"; tss_id "TSS4806"; +chr2 Cufflinks exon 8486925 8487043 . - . gene_id "XLOC_004807"; transcript_id "TCONS_00004807"; exon_number "1"; oId "CUFF.4438.1"; tss_id "TSS4807"; +chr2 Cufflinks exon 8932604 8932646 . - . gene_id "XLOC_004808"; transcript_id "TCONS_00004808"; exon_number "1"; oId "CUFF.4439.1"; tss_id "TSS4808"; +chr2 Cufflinks exon 9672368 9672475 . - . gene_id "XLOC_004809"; transcript_id "TCONS_00004809"; exon_number "1"; oId "CUFF.4441.1"; tss_id "TSS4809"; +chr2 Cufflinks exon 9880769 9880912 . - . gene_id "XLOC_004810"; transcript_id "TCONS_00004810"; exon_number "1"; oId "CUFF.4443.1"; tss_id "TSS4810"; +chr2 Cufflinks exon 10026425 10026466 . - . gene_id "XLOC_004811"; transcript_id "TCONS_00004811"; exon_number "1"; oId "CUFF.4445.1"; tss_id "TSS4811"; +chr2 Cufflinks exon 10955611 10955670 . - . gene_id "XLOC_004812"; transcript_id "TCONS_00004812"; exon_number "1"; oId "CUFF.4449.1"; tss_id "TSS4812"; +chr2 Cufflinks exon 11701791 11701905 . - . gene_id "XLOC_004813"; transcript_id "TCONS_00004813"; exon_number "1"; oId "CUFF.4454.1"; tss_id "TSS4813"; +chr2 Cufflinks exon 12102008 12102041 . - . gene_id "XLOC_004814"; transcript_id "TCONS_00004814"; exon_number "1"; oId "CUFF.4457.1"; tss_id "TSS4814"; +chr2 Cufflinks exon 12185873 12185914 . - . gene_id "XLOC_004815"; transcript_id "TCONS_00004815"; exon_number "1"; oId "CUFF.4458.1"; tss_id "TSS4815"; +chr2 Cufflinks exon 12551524 12551627 . - . gene_id "XLOC_004816"; transcript_id "TCONS_00004816"; exon_number "1"; oId "CUFF.4459.1"; tss_id "TSS4816"; +chr2 Cufflinks exon 14414746 14414845 . - . gene_id "XLOC_004817"; transcript_id "TCONS_00004817"; exon_number "1"; oId "CUFF.4461.1"; tss_id "TSS4817"; +chr2 Cufflinks exon 16090790 16091112 . - . gene_id "XLOC_004818"; transcript_id "TCONS_00004818"; exon_number "1"; oId "CUFF.4465.1"; tss_id "TSS4818"; +chr2 Cufflinks exon 16858492 16858526 . - . gene_id "XLOC_004819"; transcript_id "TCONS_00004819"; exon_number "1"; oId "CUFF.4467.1"; tss_id "TSS4819"; +chr2 Cufflinks exon 17304193 17304407 . - . gene_id "XLOC_004820"; transcript_id "TCONS_00004820"; exon_number "1"; oId "CUFF.4468.1"; tss_id "TSS4820"; +chr2 Cufflinks exon 18764633 18764731 . - . gene_id "XLOC_004821"; transcript_id "TCONS_00004821"; exon_number "1"; oId "CUFF.4470.1"; tss_id "TSS4821"; +chr2 Cufflinks exon 20375389 20375427 . - . gene_id "XLOC_004822"; transcript_id "TCONS_00004822"; exon_number "1"; oId "CUFF.4473.1"; tss_id "TSS4822"; +chr2 Cufflinks exon 20446089 20446148 . - . gene_id "XLOC_004823"; transcript_id "TCONS_00004823"; exon_number "1"; oId "CUFF.4475.1"; tss_id "TSS4823"; +chr2 Cufflinks exon 20601398 20601485 . - . gene_id "XLOC_004824"; transcript_id "TCONS_00004824"; exon_number "1"; oId "CUFF.4478.1"; tss_id "TSS4824"; +chr2 Cufflinks exon 22451486 22451515 . - . gene_id "XLOC_004825"; transcript_id "TCONS_00004825"; exon_number "1"; oId "CUFF.4481.1"; tss_id "TSS4825"; +chr2 Cufflinks exon 22561758 22561875 . - . gene_id "XLOC_004826"; transcript_id "TCONS_00004826"; exon_number "1"; oId "CUFF.4482.1"; tss_id "TSS4826"; +chr2 Cufflinks exon 22875572 22875621 . - . gene_id "XLOC_004827"; transcript_id "TCONS_00004827"; exon_number "1"; oId "CUFF.4483.1"; tss_id "TSS4827"; +chr2 Cufflinks exon 24219645 24219954 . - . gene_id "XLOC_004828"; transcript_id "TCONS_00004828"; exon_number "1"; oId "CUFF.4486.1"; tss_id "TSS4828"; +chr2 Cufflinks exon 24787497 24787607 . - . gene_id "XLOC_004829"; transcript_id "TCONS_00004829"; exon_number "1"; oId "CUFF.4491.1"; tss_id "TSS4829"; +chr2 Cufflinks exon 24872019 24872096 . - . gene_id "XLOC_004830"; transcript_id "TCONS_00004830"; exon_number "1"; oId "CUFF.4492.1"; tss_id "TSS4830"; +chr2 Cufflinks exon 25192263 25192346 . - . gene_id "XLOC_004831"; transcript_id "TCONS_00004831"; exon_number "1"; oId "CUFF.4494.1"; tss_id "TSS4831"; +chr2 Cufflinks exon 26794602 26794643 . - . gene_id "XLOC_004832"; transcript_id "TCONS_00004832"; exon_number "1"; oId "CUFF.4499.1"; tss_id "TSS4832"; +chr2 Cufflinks exon 27588927 27588961 . - . gene_id "XLOC_004833"; transcript_id "TCONS_00004833"; exon_number "1"; oId "CUFF.4503.1"; tss_id "TSS4833"; +chr2 Cufflinks exon 27652965 27653032 . - . gene_id "XLOC_004834"; transcript_id "TCONS_00004834"; exon_number "1"; oId "CUFF.4504.1"; tss_id "TSS4834"; +chr2 Cufflinks exon 27698368 27698463 . - . gene_id "XLOC_004835"; transcript_id "TCONS_00004835"; exon_number "1"; oId "CUFF.4505.1"; tss_id "TSS4835"; +chr2 Cufflinks exon 27877763 27877994 . - . gene_id "XLOC_004836"; transcript_id "TCONS_00004836"; exon_number "1"; oId "CUFF.4506.1"; tss_id "TSS4836"; +chr2 Cufflinks exon 28780916 28780958 . - . gene_id "XLOC_004837"; transcript_id "TCONS_00004837"; exon_number "1"; oId "CUFF.4508.1"; tss_id "TSS4837"; +chr2 Cufflinks exon 29903892 29904189 . - . gene_id "XLOC_004838"; transcript_id "TCONS_00004838"; exon_number "1"; oId "CUFF.4510.1"; tss_id "TSS4838"; +chr2 Cufflinks exon 32116022 32116139 . - . gene_id "XLOC_004839"; transcript_id "TCONS_00004839"; exon_number "1"; oId "CUFF.4513.1"; tss_id "TSS4839"; +chr2 Cufflinks exon 32439526 32439631 . - . gene_id "XLOC_004840"; transcript_id "TCONS_00004840"; exon_number "1"; oId "CUFF.4515.1"; tss_id "TSS4840"; +chr2 Cufflinks exon 33459430 33459471 . - . gene_id "XLOC_004841"; transcript_id "TCONS_00004841"; exon_number "1"; oId "CUFF.4518.1"; tss_id "TSS4841"; +chr2 Cufflinks exon 33510866 33510954 . - . gene_id "XLOC_004842"; transcript_id "TCONS_00004842"; exon_number "1"; oId "CUFF.4519.1"; tss_id "TSS4842"; +chr2 Cufflinks exon 35082719 35082761 . - . gene_id "XLOC_004843"; transcript_id "TCONS_00004843"; exon_number "1"; oId "CUFF.4522.1"; tss_id "TSS4843"; +chr2 Cufflinks exon 35619115 35619146 . - . gene_id "XLOC_004844"; transcript_id "TCONS_00004844"; exon_number "1"; oId "CUFF.4523.1"; tss_id "TSS4844"; +chr2 Cufflinks exon 35650066 35650124 . - . gene_id "XLOC_004845"; transcript_id "TCONS_00004845"; exon_number "1"; oId "CUFF.4524.1"; tss_id "TSS4845"; +chr2 Cufflinks exon 35650663 35650795 . - . gene_id "XLOC_004846"; transcript_id "TCONS_00004846"; exon_number "1"; oId "CUFF.4525.1"; tss_id "TSS4846"; +chr2 Cufflinks exon 37094541 37094642 . - . gene_id "XLOC_004847"; transcript_id "TCONS_00004847"; exon_number "1"; oId "CUFF.4527.1"; tss_id "TSS4847"; +chr2 Cufflinks exon 37424520 37424555 . - . gene_id "XLOC_004848"; transcript_id "TCONS_00004848"; exon_number "1"; oId "CUFF.4531.1"; tss_id "TSS4848"; +chr2 Cufflinks exon 37544941 37545030 . - . gene_id "XLOC_004849"; transcript_id "TCONS_00004849"; exon_number "1"; oId "CUFF.4532.1"; tss_id "TSS4849"; +chr2 Cufflinks exon 37558916 37559019 . - . gene_id "XLOC_004850"; transcript_id "TCONS_00004850"; exon_number "1"; oId "CUFF.4533.1"; tss_id "TSS4850"; +chr2 Cufflinks exon 37662657 37662749 . - . gene_id "XLOC_004851"; transcript_id "TCONS_00004851"; exon_number "1"; oId "CUFF.4534.1"; tss_id "TSS4851"; +chr2 Cufflinks exon 39047517 39047559 . - . gene_id "XLOC_004852"; transcript_id "TCONS_00004852"; exon_number "1"; oId "CUFF.4536.1"; tss_id "TSS4852"; +chr2 Cufflinks exon 39111704 39111807 . - . gene_id "XLOC_004853"; transcript_id "TCONS_00004853"; exon_number "1"; oId "CUFF.4538.1"; tss_id "TSS4853"; +chr2 Cufflinks exon 39620690 39620758 . - . gene_id "XLOC_004854"; transcript_id "TCONS_00004854"; exon_number "1"; oId "CUFF.4541.1"; tss_id "TSS4854"; +chr2 Cufflinks exon 39715319 39715584 . - . gene_id "XLOC_004855"; transcript_id "TCONS_00004855"; exon_number "1"; oId "CUFF.4542.1"; tss_id "TSS4855"; +chr2 Cufflinks exon 42682226 42682284 . - . gene_id "XLOC_004856"; transcript_id "TCONS_00004856"; exon_number "1"; oId "CUFF.4545.1"; tss_id "TSS4856"; +chr2 Cufflinks exon 43318529 43318632 . - . gene_id "XLOC_004857"; transcript_id "TCONS_00004857"; exon_number "1"; oId "CUFF.4550.1"; tss_id "TSS4857"; +chr2 Cufflinks exon 43884398 43884435 . - . gene_id "XLOC_004858"; transcript_id "TCONS_00004858"; exon_number "1"; oId "CUFF.4554.1"; tss_id "TSS4858"; +chr2 Cufflinks exon 43999325 43999481 . - . gene_id "XLOC_004859"; transcript_id "TCONS_00004859"; exon_number "1"; oId "CUFF.4555.1"; tss_id "TSS4859"; +chr2 Cufflinks exon 44292159 44292200 . - . gene_id "XLOC_004860"; transcript_id "TCONS_00004860"; exon_number "1"; oId "CUFF.4556.1"; tss_id "TSS4860"; +chr2 Cufflinks exon 44381937 44381996 . - . gene_id "XLOC_004861"; transcript_id "TCONS_00004861"; exon_number "1"; oId "CUFF.4558.1"; tss_id "TSS4861"; +chr2 Cufflinks exon 44466704 44466801 . - . gene_id "XLOC_004862"; transcript_id "TCONS_00004862"; exon_number "1"; oId "CUFF.4559.1"; tss_id "TSS4862"; +chr2 Cufflinks exon 45093025 45093066 . - . gene_id "XLOC_004863"; transcript_id "TCONS_00004863"; exon_number "1"; oId "CUFF.4560.1"; tss_id "TSS4863"; +chr2 Cufflinks exon 45635497 45635531 . - . gene_id "XLOC_004864"; transcript_id "TCONS_00004864"; exon_number "1"; oId "CUFF.4561.1"; tss_id "TSS4864"; +chr2 Cufflinks exon 45740194 45740232 . - . gene_id "XLOC_004865"; transcript_id "TCONS_00004865"; exon_number "1"; oId "CUFF.4562.1"; tss_id "TSS4865"; +chr2 Cufflinks exon 45796323 45796626 . - . gene_id "XLOC_004866"; transcript_id "TCONS_00004866"; exon_number "1"; oId "CUFF.4563.1"; tss_id "TSS4866"; +chr2 Cufflinks exon 46675342 46675640 . - . gene_id "XLOC_004867"; transcript_id "TCONS_00004867"; exon_number "1"; oId "CUFF.4564.1"; tss_id "TSS4867"; +chr2 Cufflinks exon 47507895 47507932 . - . gene_id "XLOC_004868"; transcript_id "TCONS_00004868"; exon_number "1"; oId "CUFF.4567.1"; tss_id "TSS4868"; +chr2 Cufflinks exon 47586679 47586901 . - . gene_id "XLOC_004869"; transcript_id "TCONS_00004869"; exon_number "1"; oId "CUFF.4568.1"; tss_id "TSS4869"; +chr2 Cufflinks exon 48079049 48079118 . - . gene_id "XLOC_004870"; transcript_id "TCONS_00004870"; exon_number "1"; oId "CUFF.4570.1"; tss_id "TSS4870"; +chr2 Cufflinks exon 48167771 48167849 . - . gene_id "XLOC_004871"; transcript_id "TCONS_00004871"; exon_number "1"; oId "CUFF.4571.1"; tss_id "TSS4871"; +chr2 Cufflinks exon 48567825 48567965 . - . gene_id "XLOC_004872"; transcript_id "TCONS_00004872"; exon_number "1"; oId "CUFF.4573.1"; tss_id "TSS4872"; +chr2 Cufflinks exon 48729062 48729163 . - . gene_id "XLOC_004873"; transcript_id "TCONS_00004873"; exon_number "1"; oId "CUFF.4575.1"; tss_id "TSS4873"; +chr2 Cufflinks exon 48902314 48902350 . - . gene_id "XLOC_004874"; transcript_id "TCONS_00004874"; exon_number "1"; oId "CUFF.4576.1"; tss_id "TSS4874"; +chr2 Cufflinks exon 49059867 49059909 . - . gene_id "XLOC_004875"; transcript_id "TCONS_00004875"; exon_number "1"; oId "CUFF.4577.1"; tss_id "TSS4875"; +chr2 Cufflinks exon 49460933 49461038 . - . gene_id "XLOC_004876"; transcript_id "TCONS_00004876"; exon_number "1"; oId "CUFF.4578.1"; tss_id "TSS4876"; +chr2 Cufflinks exon 50196805 50196894 . - . gene_id "XLOC_004877"; transcript_id "TCONS_00004877"; exon_number "1"; oId "CUFF.4579.1"; tss_id "TSS4877"; +chr2 Cufflinks exon 51139792 51139864 . - . gene_id "XLOC_004878"; transcript_id "TCONS_00004878"; exon_number "1"; oId "CUFF.4581.1"; tss_id "TSS4878"; +chr2 Cufflinks exon 51163329 51163367 . - . gene_id "XLOC_004879"; transcript_id "TCONS_00004879"; exon_number "1"; oId "CUFF.4582.1"; tss_id "TSS4879"; +chr2 Cufflinks exon 52013334 52013397 . - . gene_id "XLOC_004880"; transcript_id "TCONS_00004880"; exon_number "1"; oId "CUFF.4583.1"; tss_id "TSS4880"; +chr2 Cufflinks exon 53797509 53797617 . - . gene_id "XLOC_004881"; transcript_id "TCONS_00004881"; exon_number "1"; oId "CUFF.4587.1"; tss_id "TSS4881"; +chr2 Cufflinks exon 54046244 54046317 . - . gene_id "XLOC_004882"; transcript_id "TCONS_00004882"; exon_number "1"; oId "CUFF.4590.1"; tss_id "TSS4882"; +chr2 Cufflinks exon 54049929 54050088 . - . gene_id "XLOC_004883"; transcript_id "TCONS_00004883"; exon_number "1"; oId "CUFF.4591.1"; tss_id "TSS4883"; +chr2 Cufflinks exon 54066476 54066515 . - . gene_id "XLOC_004884"; transcript_id "TCONS_00004884"; exon_number "1"; oId "CUFF.4593.1"; tss_id "TSS4884"; +chr2 Cufflinks exon 54066896 54066967 . - . gene_id "XLOC_004885"; transcript_id "TCONS_00004885"; exon_number "1"; oId "CUFF.4594.1"; tss_id "TSS4885"; +chr2 Cufflinks exon 54394083 54394140 . - . gene_id "XLOC_004886"; transcript_id "TCONS_00004886"; exon_number "1"; oId "CUFF.4598.1"; tss_id "TSS4886"; +chr2 Cufflinks exon 54979817 54979852 . - . gene_id "XLOC_004887"; transcript_id "TCONS_00004887"; exon_number "1"; oId "CUFF.4599.1"; tss_id "TSS4887"; +chr2 Cufflinks exon 55241554 55241658 . - . gene_id "XLOC_004888"; transcript_id "TCONS_00004888"; exon_number "1"; oId "CUFF.4601.1"; tss_id "TSS4888"; +chr2 Cufflinks exon 55678140 55678227 . - . gene_id "XLOC_004889"; transcript_id "TCONS_00004889"; exon_number "1"; oId "CUFF.4602.1"; tss_id "TSS4889"; +chr2 Cufflinks exon 55683242 55683312 . - . gene_id "XLOC_004890"; transcript_id "TCONS_00004890"; exon_number "1"; oId "CUFF.4603.1"; tss_id "TSS4890"; +chr2 Cufflinks exon 55683617 55683654 . - . gene_id "XLOC_004891"; transcript_id "TCONS_00004891"; exon_number "1"; oId "CUFF.4604.1"; tss_id "TSS4891"; +chr2 Cufflinks exon 55806556 55806626 . - . gene_id "XLOC_004892"; transcript_id "TCONS_00004892"; exon_number "1"; oId "CUFF.4606.1"; tss_id "TSS4892"; +chr2 Cufflinks exon 56178914 56179149 . - . gene_id "XLOC_004893"; transcript_id "TCONS_00004893"; exon_number "1"; oId "CUFF.4607.1"; tss_id "TSS4893"; +chr2 Cufflinks exon 56462367 56462465 . - . gene_id "XLOC_004894"; transcript_id "TCONS_00004894"; exon_number "1"; oId "CUFF.4608.1"; tss_id "TSS4894"; +chr2 Cufflinks exon 57243193 57243295 . - . gene_id "XLOC_004895"; transcript_id "TCONS_00004895"; exon_number "1"; oId "CUFF.4609.1"; tss_id "TSS4895"; +chr2 Cufflinks exon 57517365 57517405 . - . gene_id "XLOC_004896"; transcript_id "TCONS_00004896"; exon_number "1"; oId "CUFF.4610.1"; tss_id "TSS4896"; +chr2 Cufflinks exon 59830731 59830959 . - . gene_id "XLOC_004897"; transcript_id "TCONS_00004897"; exon_number "1"; oId "CUFF.4613.1"; tss_id "TSS4897"; +chr2 Cufflinks exon 61058770 61059023 . - . gene_id "XLOC_004898"; transcript_id "TCONS_00004898"; exon_number "1"; oId "CUFF.4619.1"; tss_id "TSS4898"; +chr2 Cufflinks exon 62489507 62489803 . - . gene_id "XLOC_004899"; transcript_id "TCONS_00004899"; exon_number "1"; oId "CUFF.4626.1"; tss_id "TSS4899"; +chr2 Cufflinks exon 62989160 62989236 . - . gene_id "XLOC_004900"; transcript_id "TCONS_00004900"; exon_number "1"; oId "CUFF.4629.1"; tss_id "TSS4900"; +chr2 Cufflinks exon 63435927 63436321 . - . gene_id "XLOC_004901"; transcript_id "TCONS_00004901"; exon_number "1"; oId "CUFF.4632.1"; tss_id "TSS4901"; +chr2 Cufflinks exon 63436376 63436640 . - . gene_id "XLOC_004902"; transcript_id "TCONS_00004902"; exon_number "1"; oId "CUFF.4633.1"; tss_id "TSS4902"; +chr2 Cufflinks exon 65103097 65103154 . - . gene_id "XLOC_004903"; transcript_id "TCONS_00004903"; exon_number "1"; oId "CUFF.4637.1"; tss_id "TSS4903"; +chr2 Cufflinks exon 65133976 65134272 . - . gene_id "XLOC_004904"; transcript_id "TCONS_00004904"; exon_number "1"; oId "CUFF.4638.1"; tss_id "TSS4904"; +chr2 Cufflinks exon 65135718 65135821 . - . gene_id "XLOC_004905"; transcript_id "TCONS_00004905"; exon_number "1"; oId "CUFF.4639.1"; tss_id "TSS4905"; +chr2 Cufflinks exon 65551686 65551847 . - . gene_id "XLOC_004906"; transcript_id "TCONS_00004906"; exon_number "1"; oId "CUFF.4641.1"; tss_id "TSS4906"; +chr2 Cufflinks exon 65684032 65684070 . - . gene_id "XLOC_004907"; transcript_id "TCONS_00004907"; exon_number "1"; oId "CUFF.4642.1"; tss_id "TSS4907"; +chr2 Cufflinks exon 65772520 65772825 . - . gene_id "XLOC_004908"; transcript_id "TCONS_00004908"; exon_number "1"; oId "CUFF.4643.1"; tss_id "TSS4908"; +chr2 Cufflinks exon 67081362 67081395 . - . gene_id "XLOC_004909"; transcript_id "TCONS_00004909"; exon_number "1"; oId "CUFF.4644.1"; tss_id "TSS4909"; +chr2 Cufflinks exon 67256237 67256269 . - . gene_id "XLOC_004910"; transcript_id "TCONS_00004910"; exon_number "1"; oId "CUFF.4645.1"; tss_id "TSS4910"; +chr2 Cufflinks exon 68570557 68570598 . - . gene_id "XLOC_004911"; transcript_id "TCONS_00004911"; exon_number "1"; oId "CUFF.4646.1"; tss_id "TSS4911"; +chr2 Cufflinks exon 68935848 68935909 . - . gene_id "XLOC_004912"; transcript_id "TCONS_00004912"; exon_number "1"; oId "CUFF.4647.1"; tss_id "TSS4912"; +chr2 Cufflinks exon 69047691 69047723 . - . gene_id "XLOC_004913"; transcript_id "TCONS_00004913"; exon_number "1"; oId "CUFF.4648.1"; tss_id "TSS4913"; +chr2 Cufflinks exon 69409056 69409135 . - . gene_id "XLOC_004914"; transcript_id "TCONS_00004914"; exon_number "1"; oId "CUFF.4649.1"; tss_id "TSS4914"; +chr2 Cufflinks exon 70870932 70870982 . - . gene_id "XLOC_004915"; transcript_id "TCONS_00004915"; exon_number "1"; oId "CUFF.4657.1"; tss_id "TSS4915"; +chr2 Cufflinks exon 71157474 71157546 . - . gene_id "XLOC_004916"; transcript_id "TCONS_00004916"; exon_number "1"; oId "CUFF.4658.1"; tss_id "TSS4916"; +chr2 Cufflinks exon 71273483 71273559 . - . gene_id "XLOC_004917"; transcript_id "TCONS_00004917"; exon_number "1"; oId "CUFF.4660.1"; tss_id "TSS4917"; +chr2 Cufflinks exon 71606886 71606986 . - . gene_id "XLOC_004918"; transcript_id "TCONS_00004918"; exon_number "1"; oId "CUFF.4662.1"; tss_id "TSS4918"; +chr2 Cufflinks exon 72034389 72034426 . - . gene_id "XLOC_004919"; transcript_id "TCONS_00004919"; exon_number "1"; oId "CUFF.4663.1"; tss_id "TSS4919"; +chr2 Cufflinks exon 73854006 73854061 . - . gene_id "XLOC_004920"; transcript_id "TCONS_00004920"; exon_number "1"; oId "CUFF.4669.1"; tss_id "TSS4920"; +chr2 Cufflinks exon 73914345 73914400 . - . gene_id "XLOC_004921"; transcript_id "TCONS_00004921"; exon_number "1"; oId "CUFF.4670.1"; tss_id "TSS4921"; +chr2 Cufflinks exon 74195245 74195332 . - . gene_id "XLOC_004922"; transcript_id "TCONS_00004922"; exon_number "1"; oId "CUFF.4671.1"; tss_id "TSS4922"; +chr2 Cufflinks exon 74457585 74457666 . - . gene_id "XLOC_004923"; transcript_id "TCONS_00004923"; exon_number "1"; oId "CUFF.4672.1"; tss_id "TSS4923"; +chr2 Cufflinks exon 74801528 74801563 . - . gene_id "XLOC_004924"; transcript_id "TCONS_00004924"; exon_number "1"; oId "CUFF.4675.1"; tss_id "TSS4924"; +chr2 Cufflinks exon 74893434 74893469 . - . gene_id "XLOC_004925"; transcript_id "TCONS_00004925"; exon_number "1"; oId "CUFF.4676.1"; tss_id "TSS4925"; +chr2 Cufflinks exon 75239650 75239773 . - . gene_id "XLOC_004926"; transcript_id "TCONS_00004926"; exon_number "1"; oId "CUFF.4678.1"; tss_id "TSS4926"; +chr2 Cufflinks exon 75645969 75646076 . - . gene_id "XLOC_004927"; transcript_id "TCONS_00004927"; exon_number "1"; oId "CUFF.4679.1"; tss_id "TSS4927"; +chr2 Cufflinks exon 76585377 76585408 . - . gene_id "XLOC_004928"; transcript_id "TCONS_00004928"; exon_number "1"; oId "CUFF.4683.1"; tss_id "TSS4928"; +chr2 Cufflinks exon 76672296 76672536 . - . gene_id "XLOC_004929"; transcript_id "TCONS_00004929"; exon_number "1"; oId "CUFF.4684.1"; tss_id "TSS4929"; +chr2 Cufflinks exon 76822619 76822786 . - . gene_id "XLOC_004930"; transcript_id "TCONS_00004930"; exon_number "1"; oId "CUFF.4685.1"; tss_id "TSS4930"; +chr2 Cufflinks exon 79426915 79426970 . - . gene_id "XLOC_004931"; transcript_id "TCONS_00004931"; exon_number "1"; oId "CUFF.4691.1"; tss_id "TSS4931"; +chr2 Cufflinks exon 79640310 79640373 . - . gene_id "XLOC_004932"; transcript_id "TCONS_00004932"; exon_number "1"; oId "CUFF.4692.1"; tss_id "TSS4932"; +chr2 Cufflinks exon 79863988 79864080 . - . gene_id "XLOC_004933"; transcript_id "TCONS_00004933"; exon_number "1"; oId "CUFF.4693.1"; tss_id "TSS4933"; +chr2 Cufflinks exon 81723362 81723451 . - . gene_id "XLOC_004934"; transcript_id "TCONS_00004934"; exon_number "1"; oId "CUFF.4694.1"; tss_id "TSS4934"; +chr2 Cufflinks exon 85588046 85588102 . - . gene_id "XLOC_004935"; transcript_id "TCONS_00004935"; exon_number "1"; oId "CUFF.4703.1"; tss_id "TSS4935"; +chr2 Cufflinks exon 85600577 85600636 . - . gene_id "XLOC_004936"; transcript_id "TCONS_00004936"; exon_number "1"; oId "CUFF.4705.1"; tss_id "TSS4936"; +chr2 Cufflinks exon 85669040 85669099 . - . gene_id "XLOC_004937"; transcript_id "TCONS_00004937"; exon_number "1"; oId "CUFF.4706.1"; tss_id "TSS4937"; +chr2 Cufflinks exon 85794770 85795083 . - . gene_id "XLOC_004938"; transcript_id "TCONS_00004938"; exon_number "1"; oId "CUFF.4708.1"; tss_id "TSS4938"; +chr2 Cufflinks exon 85955349 85955460 . - . gene_id "XLOC_004939"; transcript_id "TCONS_00004939"; exon_number "1"; oId "CUFF.4709.1"; tss_id "TSS4939"; +chr2 Cufflinks exon 86047583 86047727 . - . gene_id "XLOC_004940"; transcript_id "TCONS_00004940"; exon_number "1"; oId "CUFF.4710.1"; tss_id "TSS4940"; +chr2 Cufflinks exon 86574184 86574319 . - . gene_id "XLOC_004941"; transcript_id "TCONS_00004941"; exon_number "1"; oId "CUFF.4712.1"; tss_id "TSS4941"; +chr2 Cufflinks exon 86742327 86742431 . - . gene_id "XLOC_004942"; transcript_id "TCONS_00004942"; exon_number "1"; oId "CUFF.4713.1"; tss_id "TSS4942"; +chr2 Cufflinks exon 88310618 88310722 . - . gene_id "XLOC_004943"; transcript_id "TCONS_00004943"; exon_number "1"; oId "CUFF.4717.1"; tss_id "TSS4943"; +chr2 Cufflinks exon 88315877 88316066 . - . gene_id "XLOC_004944"; transcript_id "TCONS_00004944"; exon_number "1"; oId "CUFF.4719.1"; tss_id "TSS4944"; +chr2 Cufflinks exon 88667313 88667379 . - . gene_id "XLOC_004945"; transcript_id "TCONS_00004945"; exon_number "1"; oId "CUFF.4721.1"; tss_id "TSS4945"; +chr2 Cufflinks exon 88683019 88683118 . - . gene_id "XLOC_004946"; transcript_id "TCONS_00004946"; exon_number "1"; oId "CUFF.4722.1"; tss_id "TSS4946"; +chr2 Cufflinks exon 88714422 88714523 . - . gene_id "XLOC_004947"; transcript_id "TCONS_00004947"; exon_number "1"; oId "CUFF.4723.1"; tss_id "TSS4947"; +chr2 Cufflinks exon 95512279 95512384 . - . gene_id "XLOC_004948"; transcript_id "TCONS_00004948"; exon_number "1"; oId "CUFF.4726.1"; tss_id "TSS4948"; +chr2 Cufflinks exon 95669266 95669588 . - . gene_id "XLOC_004949"; transcript_id "TCONS_00004949"; exon_number "1"; oId "CUFF.4727.1"; tss_id "TSS4949"; +chr2 Cufflinks exon 96217191 96217264 . - . gene_id "XLOC_004950"; transcript_id "TCONS_00004950"; exon_number "1"; oId "CUFF.4728.1"; tss_id "TSS4950"; +chr2 Cufflinks exon 96645052 96645110 . - . gene_id "XLOC_004951"; transcript_id "TCONS_00004951"; exon_number "1"; oId "CUFF.4729.1"; tss_id "TSS4951"; +chr2 Cufflinks exon 96670311 96670594 . - . gene_id "XLOC_004952"; transcript_id "TCONS_00004952"; exon_number "1"; oId "CUFF.4730.1"; tss_id "TSS4952"; +chr2 Cufflinks exon 97622463 97622552 . - . gene_id "XLOC_004953"; transcript_id "TCONS_00004953"; exon_number "1"; oId "CUFF.4733.1"; tss_id "TSS4953"; +chr2 Cufflinks exon 97647021 97647122 . - . gene_id "XLOC_004954"; transcript_id "TCONS_00004954"; exon_number "1"; oId "CUFF.4734.1"; tss_id "TSS4954"; +chr2 Cufflinks exon 97969898 97970003 . - . gene_id "XLOC_004955"; transcript_id "TCONS_00004955"; exon_number "1"; oId "CUFF.4738.1"; tss_id "TSS4955"; +chr2 Cufflinks exon 98194026 98194084 . - . gene_id "XLOC_004956"; transcript_id "TCONS_00004956"; exon_number "1"; oId "CUFF.4740.1"; tss_id "TSS4956"; +chr2 Cufflinks exon 98281052 98281194 . - . gene_id "XLOC_004957"; transcript_id "TCONS_00004957"; exon_number "1"; oId "CUFF.4741.1"; tss_id "TSS4957"; +chr2 Cufflinks exon 98642892 98642968 . - . gene_id "XLOC_004958"; transcript_id "TCONS_00004958"; exon_number "1"; oId "CUFF.4742.1"; tss_id "TSS4958"; +chr2 Cufflinks exon 99208677 99208752 . - . gene_id "XLOC_004959"; transcript_id "TCONS_00004959"; exon_number "1"; oId "CUFF.4744.1"; tss_id "TSS4959"; +chr2 Cufflinks exon 99457142 99457197 . - . gene_id "XLOC_004960"; transcript_id "TCONS_00004960"; exon_number "1"; oId "CUFF.4746.1"; tss_id "TSS4960"; +chr2 Cufflinks exon 100929101 100929136 . - . gene_id "XLOC_004961"; transcript_id "TCONS_00004961"; exon_number "1"; oId "CUFF.4748.1"; tss_id "TSS4961"; +chr2 Cufflinks exon 101021028 101021064 . - . gene_id "XLOC_004962"; transcript_id "TCONS_00004962"; exon_number "1"; oId "CUFF.4749.1"; tss_id "TSS4962"; +chr2 Cufflinks exon 101169114 101169152 . - . gene_id "XLOC_004963"; transcript_id "TCONS_00004963"; exon_number "1"; oId "CUFF.4750.1"; tss_id "TSS4963"; +chr2 Cufflinks exon 101390345 101390377 . - . gene_id "XLOC_004964"; transcript_id "TCONS_00004964"; exon_number "1"; oId "CUFF.4752.1"; tss_id "TSS4964"; +chr2 Cufflinks exon 103260231 103260341 . - . gene_id "XLOC_004965"; transcript_id "TCONS_00004965"; exon_number "1"; oId "CUFF.4754.1"; tss_id "TSS4965"; +chr2 Cufflinks exon 103340479 103340512 . - . gene_id "XLOC_004966"; transcript_id "TCONS_00004966"; exon_number "1"; oId "CUFF.4755.1"; tss_id "TSS4966"; +chr2 Cufflinks exon 103517640 103517674 . - . gene_id "XLOC_004967"; transcript_id "TCONS_00004967"; exon_number "1"; oId "CUFF.4756.1"; tss_id "TSS4967"; +chr2 Cufflinks exon 107828905 107828971 . - . gene_id "XLOC_004968"; transcript_id "TCONS_00004968"; exon_number "1"; oId "CUFF.4759.1"; tss_id "TSS4968"; +chr2 Cufflinks exon 108090713 108090749 . - . gene_id "XLOC_004969"; transcript_id "TCONS_00004969"; exon_number "1"; oId "CUFF.4760.1"; tss_id "TSS4969"; +chr2 Cufflinks exon 108630946 108630982 . - . gene_id "XLOC_004970"; transcript_id "TCONS_00004970"; exon_number "1"; oId "CUFF.4761.1"; tss_id "TSS4970"; +chr2 Cufflinks exon 111066032 111066106 . - . gene_id "XLOC_004971"; transcript_id "TCONS_00004971"; exon_number "1"; oId "CUFF.4762.1"; tss_id "TSS4971"; +chr2 Cufflinks exon 111976077 111976111 . - . gene_id "XLOC_004972"; transcript_id "TCONS_00004972"; exon_number "1"; oId "CUFF.4763.1"; tss_id "TSS4972"; +chr2 Cufflinks exon 112215148 112215192 . - . gene_id "XLOC_004973"; transcript_id "TCONS_00004973"; exon_number "1"; oId "CUFF.4764.1"; tss_id "TSS4973"; +chr2 Cufflinks exon 112381415 112381495 . - . gene_id "XLOC_004974"; transcript_id "TCONS_00004974"; exon_number "1"; oId "CUFF.4765.1"; tss_id "TSS4974"; +chr2 Cufflinks exon 112710250 112710309 . - . gene_id "XLOC_004975"; transcript_id "TCONS_00004975"; exon_number "1"; oId "CUFF.4767.1"; tss_id "TSS4975"; +chr2 Cufflinks exon 113028855 113028944 . - . gene_id "XLOC_004976"; transcript_id "TCONS_00004976"; exon_number "1"; oId "CUFF.4770.1"; tss_id "TSS4976"; +chr2 Cufflinks exon 113268905 113268942 . - . gene_id "XLOC_004977"; transcript_id "TCONS_00004977"; exon_number "1"; oId "CUFF.4772.1"; tss_id "TSS4977"; +chr2 Cufflinks exon 114605707 114605814 . - . gene_id "XLOC_004978"; transcript_id "TCONS_00004978"; exon_number "1"; oId "CUFF.4777.1"; tss_id "TSS4978"; +chr2 Cufflinks exon 114763017 114763232 . - . gene_id "XLOC_004979"; transcript_id "TCONS_00004979"; exon_number "1"; oId "CUFF.4778.1"; tss_id "TSS4979"; +chr2 Cufflinks exon 115038658 115038752 . - . gene_id "XLOC_004980"; transcript_id "TCONS_00004980"; exon_number "1"; oId "CUFF.4780.1"; tss_id "TSS4980"; +chr2 Cufflinks exon 115075275 115075316 . - . gene_id "XLOC_004981"; transcript_id "TCONS_00004981"; exon_number "1"; oId "CUFF.4781.1"; tss_id "TSS4981"; +chr2 Cufflinks exon 115695018 115695281 . - . gene_id "XLOC_004982"; transcript_id "TCONS_00004982"; exon_number "1"; oId "CUFF.4784.1"; tss_id "TSS4982"; +chr2 Cufflinks exon 116364085 116364147 . - . gene_id "XLOC_004983"; transcript_id "TCONS_00004983"; exon_number "1"; oId "CUFF.4786.1"; tss_id "TSS4983"; +chr2 Cufflinks exon 116509736 116509792 . - . gene_id "XLOC_004984"; transcript_id "TCONS_00004984"; exon_number "1"; oId "CUFF.4787.1"; tss_id "TSS4984"; +chr2 Cufflinks exon 117782509 117782580 . - . gene_id "XLOC_004985"; transcript_id "TCONS_00004985"; exon_number "1"; oId "CUFF.4791.1"; tss_id "TSS4985"; +chr2 Cufflinks exon 117897291 117897351 . - . gene_id "XLOC_004986"; transcript_id "TCONS_00004986"; exon_number "1"; oId "CUFF.4792.1"; tss_id "TSS4986"; +chr2 Cufflinks exon 120476852 120476885 . - . gene_id "XLOC_004987"; transcript_id "TCONS_00004987"; exon_number "1"; oId "CUFF.4798.1"; tss_id "TSS4987"; +chr2 Cufflinks exon 121915236 121915280 . - . gene_id "XLOC_004988"; transcript_id "TCONS_00004988"; exon_number "1"; oId "CUFF.4804.1"; tss_id "TSS4988"; +chr2 Cufflinks exon 122098960 122099020 . - . gene_id "XLOC_004989"; transcript_id "TCONS_00004989"; exon_number "1"; oId "CUFF.4806.1"; tss_id "TSS4989"; +chr2 Cufflinks exon 122463540 122463616 . - . gene_id "XLOC_004990"; transcript_id "TCONS_00004990"; exon_number "1"; oId "CUFF.4807.1"; tss_id "TSS4990"; +chr2 Cufflinks exon 122557539 122557581 . - . gene_id "XLOC_004991"; transcript_id "TCONS_00004991"; exon_number "1"; oId "CUFF.4808.1"; tss_id "TSS4991"; +chr2 Cufflinks exon 124626904 124627147 . - . gene_id "XLOC_004992"; transcript_id "TCONS_00004992"; exon_number "1"; oId "CUFF.4809.1"; tss_id "TSS4992"; +chr2 Cufflinks exon 125935169 125935207 . - . gene_id "XLOC_004993"; transcript_id "TCONS_00004993"; exon_number "1"; oId "CUFF.4813.1"; tss_id "TSS4993"; +chr2 Cufflinks exon 127460415 127460518 . - . gene_id "XLOC_004994"; transcript_id "TCONS_00004994"; exon_number "1"; oId "CUFF.4814.1"; tss_id "TSS4994"; +chr2 Cufflinks exon 128049144 128049488 . - . gene_id "XLOC_004995"; transcript_id "TCONS_00004995"; exon_number "1"; oId "CUFF.4817.1"; tss_id "TSS4995"; +chr2 Cufflinks exon 128049841 128049865 . - . gene_id "XLOC_004996"; transcript_id "TCONS_00004996"; exon_number "1"; oId "CUFF.4818.1"; tss_id "TSS4996"; +chr2 Cufflinks exon 129087843 129087876 . - . gene_id "XLOC_004997"; transcript_id "TCONS_00004997"; exon_number "1"; oId "CUFF.4822.1"; tss_id "TSS4997"; +chr2 Cufflinks exon 129113037 129113087 . - . gene_id "XLOC_004998"; transcript_id "TCONS_00004998"; exon_number "1"; oId "CUFF.4823.1"; tss_id "TSS4998"; +chr2 Cufflinks exon 129202653 129202766 . - . gene_id "XLOC_004999"; transcript_id "TCONS_00004999"; exon_number "1"; oId "CUFF.4824.1"; tss_id "TSS4999"; +chr2 Cufflinks exon 130866778 130866883 . - . gene_id "XLOC_005000"; transcript_id "TCONS_00005000"; exon_number "1"; oId "CUFF.4826.1"; tss_id "TSS5000"; +chr2 Cufflinks exon 131029911 131029982 . - . gene_id "XLOC_005001"; transcript_id "TCONS_00005001"; exon_number "1"; oId "CUFF.4827.1"; tss_id "TSS5001"; +chr2 Cufflinks exon 131033023 131033093 . - . gene_id "XLOC_005002"; transcript_id "TCONS_00005002"; exon_number "1"; oId "CUFF.4828.1"; tss_id "TSS5002"; +chr2 Cufflinks exon 131094700 131094772 . - . gene_id "XLOC_005003"; transcript_id "TCONS_00005003"; exon_number "1"; oId "CUFF.4829.1"; tss_id "TSS5003"; +chr2 Cufflinks exon 131255317 131255422 . - . gene_id "XLOC_005004"; transcript_id "TCONS_00005004"; exon_number "1"; oId "CUFF.4830.1"; tss_id "TSS5004"; +chr2 Cufflinks exon 131584241 131584291 . - . gene_id "XLOC_005005"; transcript_id "TCONS_00005005"; exon_number "1"; oId "CUFF.4832.1"; tss_id "TSS5005"; +chr2 Cufflinks exon 131586208 131586247 . - . gene_id "XLOC_005006"; transcript_id "TCONS_00005006"; exon_number "1"; oId "CUFF.4833.1"; tss_id "TSS5006"; +chr2 Cufflinks exon 132909816 132909922 . - . gene_id "XLOC_005007"; transcript_id "TCONS_00005007"; exon_number "1"; oId "CUFF.4838.1"; tss_id "TSS5007"; +chr2 Cufflinks exon 133011920 133013768 . - . gene_id "XLOC_005008"; transcript_id "TCONS_00005008"; exon_number "1"; oId "CUFF.4839.1"; tss_id "TSS5008"; +chr2 Cufflinks exon 133036251 133039236 . - . gene_id "XLOC_005009"; transcript_id "TCONS_00005009"; exon_number "1"; oId "CUFF.4840.1"; tss_id "TSS5009"; +chr2 Cufflinks exon 133164331 133164431 . - . gene_id "XLOC_005010"; transcript_id "TCONS_00005010"; exon_number "1"; oId "CUFF.4841.1"; tss_id "TSS5010"; +chr2 Cufflinks exon 133817519 133817609 . - . gene_id "XLOC_005011"; transcript_id "TCONS_00005011"; exon_number "1"; oId "CUFF.4845.1"; tss_id "TSS5011"; +chr2 Cufflinks exon 134148730 134148970 . - . gene_id "XLOC_005012"; transcript_id "TCONS_00005012"; exon_number "1"; oId "CUFF.4847.1"; tss_id "TSS5012"; +chr2 Cufflinks exon 135823199 135823305 . - . gene_id "XLOC_005013"; transcript_id "TCONS_00005013"; exon_number "1"; oId "CUFF.4852.1"; tss_id "TSS5013"; +chr2 Cufflinks exon 136334907 136334945 . - . gene_id "XLOC_005014"; transcript_id "TCONS_00005014"; exon_number "1"; oId "CUFF.4853.1"; tss_id "TSS5014"; +chr2 Cufflinks exon 136414050 136414127 . - . gene_id "XLOC_005015"; transcript_id "TCONS_00005015"; exon_number "1"; oId "CUFF.4854.1"; tss_id "TSS5015"; +chr2 Cufflinks exon 138269695 138269782 . - . gene_id "XLOC_005016"; transcript_id "TCONS_00005016"; exon_number "1"; oId "CUFF.4857.1"; tss_id "TSS5016"; +chr2 Cufflinks exon 139203797 139203884 . - . gene_id "XLOC_005017"; transcript_id "TCONS_00005017"; exon_number "1"; oId "CUFF.4858.1"; tss_id "TSS5017"; +chr2 Cufflinks exon 139621228 139621465 . - . gene_id "XLOC_005018"; transcript_id "TCONS_00005018"; exon_number "1"; oId "CUFF.4859.1"; tss_id "TSS5018"; +chr2 Cufflinks exon 140490231 140490272 . - . gene_id "XLOC_005019"; transcript_id "TCONS_00005019"; exon_number "1"; oId "CUFF.4860.1"; tss_id "TSS5019"; +chr2 Cufflinks exon 140863431 140863464 . - . gene_id "XLOC_005020"; transcript_id "TCONS_00005020"; exon_number "1"; oId "CUFF.4862.1"; tss_id "TSS5020"; +chr2 Cufflinks exon 140979058 140979125 . - . gene_id "XLOC_005021"; transcript_id "TCONS_00005021"; exon_number "1"; oId "CUFF.4864.1"; tss_id "TSS5021"; +chr2 Cufflinks exon 141685670 141685706 . - . gene_id "XLOC_005022"; transcript_id "TCONS_00005022"; exon_number "1"; oId "CUFF.4865.1"; tss_id "TSS5022"; +chr2 Cufflinks exon 141878969 141879006 . - . gene_id "XLOC_005023"; transcript_id "TCONS_00005023"; exon_number "1"; oId "CUFF.4866.1"; tss_id "TSS5023"; +chr2 Cufflinks exon 141924831 141924921 . - . gene_id "XLOC_005024"; transcript_id "TCONS_00005024"; exon_number "1"; oId "CUFF.4867.1"; tss_id "TSS5024"; +chr2 Cufflinks exon 143438001 143438042 . - . gene_id "XLOC_005025"; transcript_id "TCONS_00005025"; exon_number "1"; oId "CUFF.4870.1"; tss_id "TSS5025"; +chr2 Cufflinks exon 143627506 143627572 . - . gene_id "XLOC_005026"; transcript_id "TCONS_00005026"; exon_number "1"; oId "CUFF.4871.1"; tss_id "TSS5026"; +chr2 Cufflinks exon 146404931 146404965 . - . gene_id "XLOC_005027"; transcript_id "TCONS_00005027"; exon_number "1"; oId "CUFF.4874.1"; tss_id "TSS5027"; +chr2 Cufflinks exon 146930832 146930974 . - . gene_id "XLOC_005028"; transcript_id "TCONS_00005028"; exon_number "1"; oId "CUFF.4876.1"; tss_id "TSS5028"; +chr2 Cufflinks exon 148471044 148471123 . - . gene_id "XLOC_005029"; transcript_id "TCONS_00005029"; exon_number "1"; oId "CUFF.4879.1"; tss_id "TSS5029"; +chr2 Cufflinks exon 149511839 149511884 . - . gene_id "XLOC_005030"; transcript_id "TCONS_00005030"; exon_number "1"; oId "CUFF.4882.1"; tss_id "TSS5030"; +chr2 Cufflinks exon 149583259 149583404 . - . gene_id "XLOC_005031"; transcript_id "TCONS_00005031"; exon_number "1"; oId "CUFF.4883.1"; tss_id "TSS5031"; +chr2 Cufflinks exon 149583768 149583803 . - . gene_id "XLOC_005032"; transcript_id "TCONS_00005032"; exon_number "1"; oId "CUFF.4884.1"; tss_id "TSS5032"; +chr2 Cufflinks exon 149903841 149903883 . - . gene_id "XLOC_005033"; transcript_id "TCONS_00005033"; exon_number "1"; oId "CUFF.4885.1"; tss_id "TSS5033"; +chr2 Cufflinks exon 150222165 150222267 . - . gene_id "XLOC_005034"; transcript_id "TCONS_00005034"; exon_number "1"; oId "CUFF.4886.1"; tss_id "TSS5034"; +chr2 Cufflinks exon 150467182 150467288 . - . gene_id "XLOC_005035"; transcript_id "TCONS_00005035"; exon_number "1"; oId "CUFF.4887.1"; tss_id "TSS5035"; +chr2 Cufflinks exon 150745538 150745570 . - . gene_id "XLOC_005036"; transcript_id "TCONS_00005036"; exon_number "1"; oId "CUFF.4888.1"; tss_id "TSS5036"; +chr2 Cufflinks exon 151302759 151302794 . - . gene_id "XLOC_005037"; transcript_id "TCONS_00005037"; exon_number "1"; oId "CUFF.4890.1"; tss_id "TSS5037"; +chr2 Cufflinks exon 152095446 152095482 . - . gene_id "XLOC_005038"; transcript_id "TCONS_00005038"; exon_number "1"; oId "CUFF.4891.1"; tss_id "TSS5038"; +chr2 Cufflinks exon 155945951 155946051 . - . gene_id "XLOC_005039"; transcript_id "TCONS_00005039"; exon_number "1"; oId "CUFF.4895.1"; tss_id "TSS5039"; +chr2 Cufflinks exon 157257659 157257729 . - . gene_id "XLOC_005040"; transcript_id "TCONS_00005040"; exon_number "1"; oId "CUFF.4898.1"; tss_id "TSS5040"; +chr2 Cufflinks exon 157266658 157266759 . - . gene_id "XLOC_005041"; transcript_id "TCONS_00005041"; exon_number "1"; oId "CUFF.4899.1"; tss_id "TSS5041"; +chr2 Cufflinks exon 158155342 158155670 . - . gene_id "XLOC_005042"; transcript_id "TCONS_00005042"; exon_number "1"; oId "CUFF.4901.1"; tss_id "TSS5042"; +chr2 Cufflinks exon 158443350 158443384 . - . gene_id "XLOC_005043"; transcript_id "TCONS_00005043"; exon_number "1"; oId "CUFF.4902.1"; tss_id "TSS5043"; +chr2 Cufflinks exon 158741349 158741396 . - . gene_id "XLOC_005044"; transcript_id "TCONS_00005044"; exon_number "1"; oId "CUFF.4903.1"; tss_id "TSS5044"; +chr2 Cufflinks exon 158842301 158842406 . - . gene_id "XLOC_005045"; transcript_id "TCONS_00005045"; exon_number "1"; oId "CUFF.4905.1"; tss_id "TSS5045"; +chr2 Cufflinks exon 159303667 159303973 . - . gene_id "XLOC_005046"; transcript_id "TCONS_00005046"; exon_number "1"; oId "CUFF.4907.1"; tss_id "TSS5046"; +chr2 Cufflinks exon 159305915 159305962 . - . gene_id "XLOC_005047"; transcript_id "TCONS_00005047"; exon_number "1"; oId "CUFF.4908.1"; tss_id "TSS5047"; +chr2 Cufflinks exon 159306261 159306314 . - . gene_id "XLOC_005048"; transcript_id "TCONS_00005048"; exon_number "1"; oId "CUFF.4909.1"; tss_id "TSS5048"; +chr2 Cufflinks exon 159440392 159440797 . - . gene_id "XLOC_005049"; transcript_id "TCONS_00005049"; exon_number "1"; oId "CUFF.4910.1"; tss_id "TSS5049"; +chr2 Cufflinks exon 159738168 159738241 . - . gene_id "XLOC_005050"; transcript_id "TCONS_00005050"; exon_number "1"; oId "CUFF.4912.1"; tss_id "TSS5050"; +chr2 Cufflinks exon 159792316 159792492 . - . gene_id "XLOC_005051"; transcript_id "TCONS_00005051"; exon_number "1"; oId "CUFF.4913.1"; tss_id "TSS5051"; +chr2 Cufflinks exon 159883550 159883652 . - . gene_id "XLOC_005052"; transcript_id "TCONS_00005052"; exon_number "1"; oId "CUFF.4914.1"; tss_id "TSS5052"; +chr2 Cufflinks exon 160162286 160162319 . - . gene_id "XLOC_005053"; transcript_id "TCONS_00005053"; exon_number "1"; oId "CUFF.4915.1"; tss_id "TSS5053"; +chr2 Cufflinks exon 160450396 160450460 . - . gene_id "XLOC_005054"; transcript_id "TCONS_00005054"; exon_number "1"; oId "CUFF.4916.1"; tss_id "TSS5054"; +chr2 Cufflinks exon 161511255 161511291 . - . gene_id "XLOC_005055"; transcript_id "TCONS_00005055"; exon_number "1"; oId "CUFF.4919.1"; tss_id "TSS5055"; +chr2 Cufflinks exon 162597798 162597834 . - . gene_id "XLOC_005056"; transcript_id "TCONS_00005056"; exon_number "1"; oId "CUFF.4923.1"; tss_id "TSS5056"; +chr2 Cufflinks exon 163574715 163574757 . - . gene_id "XLOC_005057"; transcript_id "TCONS_00005057"; exon_number "1"; oId "CUFF.4926.1"; tss_id "TSS5057"; +chr2 Cufflinks exon 163920235 163920270 . - . gene_id "XLOC_005058"; transcript_id "TCONS_00005058"; exon_number "1"; oId "CUFF.4928.1"; tss_id "TSS5058"; +chr2 Cufflinks exon 165752198 165752287 . - . gene_id "XLOC_005059"; transcript_id "TCONS_00005059"; exon_number "1"; oId "CUFF.4934.1"; tss_id "TSS5059"; +chr2 Cufflinks exon 166505021 166505063 . - . gene_id "XLOC_005060"; transcript_id "TCONS_00005060"; exon_number "1"; oId "CUFF.4935.1"; tss_id "TSS5060"; +chr2 Cufflinks exon 166926853 166926915 . - . gene_id "XLOC_005061"; transcript_id "TCONS_00005061"; exon_number "1"; oId "CUFF.4937.1"; tss_id "TSS5061"; +chr2 Cufflinks exon 167037211 167037444 . - . gene_id "XLOC_005062"; transcript_id "TCONS_00005062"; exon_number "1"; oId "CUFF.4938.1"; tss_id "TSS5062"; +chr2 Cufflinks exon 168487993 168488050 . - . gene_id "XLOC_005063"; transcript_id "TCONS_00005063"; exon_number "1"; oId "CUFF.4941.1"; tss_id "TSS5063"; +chr2 Cufflinks exon 169296992 169297078 . - . gene_id "XLOC_005064"; transcript_id "TCONS_00005064"; exon_number "1"; oId "CUFF.4942.1"; tss_id "TSS5064"; +chr2 Cufflinks exon 169297474 169297715 . - . gene_id "XLOC_005065"; transcript_id "TCONS_00005065"; exon_number "1"; oId "CUFF.4943.1"; tss_id "TSS5065"; +chr2 Cufflinks exon 170199913 170199999 . - . gene_id "XLOC_005066"; transcript_id "TCONS_00005066"; exon_number "1"; oId "CUFF.4945.1"; tss_id "TSS5066"; +chr2 Cufflinks exon 170976522 170976612 . - . gene_id "XLOC_005067"; transcript_id "TCONS_00005067"; exon_number "1"; oId "CUFF.4948.1"; tss_id "TSS5067"; +chr2 Cufflinks exon 172713120 172713180 . - . gene_id "XLOC_005068"; transcript_id "TCONS_00005068"; exon_number "1"; oId "CUFF.4951.1"; tss_id "TSS5068"; +chr2 Cufflinks exon 173648938 173648965 . - . gene_id "XLOC_005069"; transcript_id "TCONS_00005069"; exon_number "1"; oId "CUFF.4953.1"; tss_id "TSS5069"; +chr2 Cufflinks exon 173649259 173649279 . - . gene_id "XLOC_005070"; transcript_id "TCONS_00005070"; exon_number "1"; oId "CUFF.4954.1"; tss_id "TSS5070"; +chr2 Cufflinks exon 173704950 173705121 . - . gene_id "XLOC_005071"; transcript_id "TCONS_00005071"; exon_number "1"; oId "CUFF.4956.1"; tss_id "TSS5071"; +chr2 Cufflinks exon 175104873 175105190 . - . gene_id "XLOC_005072"; transcript_id "TCONS_00005072"; exon_number "1"; oId "CUFF.4958.1"; tss_id "TSS5072"; +chr2 Cufflinks exon 175422694 175422800 . - . gene_id "XLOC_005073"; transcript_id "TCONS_00005073"; exon_number "1"; oId "CUFF.4959.1"; tss_id "TSS5073"; +chr2 Cufflinks exon 175430944 175431006 . - . gene_id "XLOC_005074"; transcript_id "TCONS_00005074"; exon_number "1"; oId "CUFF.4960.1"; tss_id "TSS5074"; +chr2 Cufflinks exon 176882680 176882714 . - . gene_id "XLOC_005075"; transcript_id "TCONS_00005075"; exon_number "1"; oId "CUFF.4964.1"; tss_id "TSS5075"; +chr2 Cufflinks exon 177166753 177166788 . - . gene_id "XLOC_005076"; transcript_id "TCONS_00005076"; exon_number "1"; oId "CUFF.4966.1"; tss_id "TSS5076"; +chr2 Cufflinks exon 177794713 177794818 . - . gene_id "XLOC_005077"; transcript_id "TCONS_00005077"; exon_number "1"; oId "CUFF.4967.1"; tss_id "TSS5077"; +chr2 Cufflinks exon 178210587 178210690 . - . gene_id "XLOC_005078"; transcript_id "TCONS_00005078"; exon_number "1"; oId "CUFF.4969.1"; tss_id "TSS5078"; +chr2 Cufflinks exon 178270048 178270120 . - . gene_id "XLOC_005079"; transcript_id "TCONS_00005079"; exon_number "1"; oId "CUFF.4970.1"; tss_id "TSS5079"; +chr2 Cufflinks exon 179066126 179066186 . - . gene_id "XLOC_005080"; transcript_id "TCONS_00005080"; exon_number "1"; oId "CUFF.4973.1"; tss_id "TSS5080"; +chr2 Cufflinks exon 179285635 179285734 . - . gene_id "XLOC_005081"; transcript_id "TCONS_00005081"; exon_number "1"; oId "CUFF.4974.1"; tss_id "TSS5081"; +chr2 Cufflinks exon 179696134 179696174 . - . gene_id "XLOC_005082"; transcript_id "TCONS_00005082"; exon_number "1"; oId "CUFF.4976.1"; tss_id "TSS5082"; +chr2 Cufflinks exon 179990260 179990364 . - . gene_id "XLOC_005083"; transcript_id "TCONS_00005083"; exon_number "1"; oId "CUFF.4977.1"; tss_id "TSS5083"; +chr2 Cufflinks exon 184814059 184814164 . - . gene_id "XLOC_005084"; transcript_id "TCONS_00005084"; exon_number "1"; oId "CUFF.4987.1"; tss_id "TSS5084"; +chr2 Cufflinks exon 185290437 185290472 . - . gene_id "XLOC_005085"; transcript_id "TCONS_00005085"; exon_number "1"; oId "CUFF.4988.1"; tss_id "TSS5085"; +chr2 Cufflinks exon 187987360 187987588 . - . gene_id "XLOC_005086"; transcript_id "TCONS_00005086"; exon_number "1"; oId "CUFF.4990.1"; tss_id "TSS5086"; +chr2 Cufflinks exon 188135426 188135531 . - . gene_id "XLOC_005087"; transcript_id "TCONS_00005087"; exon_number "1"; oId "CUFF.4991.1"; tss_id "TSS5087"; +chr2 Cufflinks exon 188794006 188794041 . - . gene_id "XLOC_005088"; transcript_id "TCONS_00005088"; exon_number "1"; oId "CUFF.4992.1"; tss_id "TSS5088"; +chr2 Cufflinks exon 189141483 189141571 . - . gene_id "XLOC_005089"; transcript_id "TCONS_00005089"; exon_number "1"; oId "CUFF.4993.1"; tss_id "TSS5089"; +chr2 Cufflinks exon 189331566 189331602 . - . gene_id "XLOC_005090"; transcript_id "TCONS_00005090"; exon_number "1"; oId "CUFF.4994.1"; tss_id "TSS5090"; +chr2 Cufflinks exon 190524823 190524895 . - . gene_id "XLOC_005091"; transcript_id "TCONS_00005091"; exon_number "1"; oId "CUFF.4996.1"; tss_id "TSS5091"; +chr2 Cufflinks exon 191402648 191402786 . - . gene_id "XLOC_005092"; transcript_id "TCONS_00005092"; exon_number "1"; oId "CUFF.4997.1"; tss_id "TSS5092"; +chr2 Cufflinks exon 191417791 191417842 . - . gene_id "XLOC_005093"; transcript_id "TCONS_00005093"; exon_number "1"; oId "CUFF.4998.1"; tss_id "TSS5093"; +chr2 Cufflinks exon 191418066 191418205 . - . gene_id "XLOC_005094"; transcript_id "TCONS_00005094"; exon_number "1"; oId "CUFF.4999.1"; tss_id "TSS5094"; +chr2 Cufflinks exon 194384037 194384085 . - . gene_id "XLOC_005095"; transcript_id "TCONS_00005095"; exon_number "1"; oId "CUFF.5003.1"; tss_id "TSS5095"; +chr2 Cufflinks exon 195523096 195523406 . - . gene_id "XLOC_005096"; transcript_id "TCONS_00005096"; exon_number "1"; oId "CUFF.5005.1"; tss_id "TSS5096"; +chr2 Cufflinks exon 195980638 195980710 . - . gene_id "XLOC_005097"; transcript_id "TCONS_00005097"; exon_number "1"; oId "CUFF.5007.1"; tss_id "TSS5097"; +chr2 Cufflinks exon 196535099 196535202 . - . gene_id "XLOC_005098"; transcript_id "TCONS_00005098"; exon_number "1"; oId "CUFF.5009.1"; tss_id "TSS5098"; +chr2 Cufflinks exon 197053936 197053974 . - . gene_id "XLOC_005099"; transcript_id "TCONS_00005099"; exon_number "1"; oId "CUFF.5010.1"; tss_id "TSS5099"; +chr2 Cufflinks exon 197079941 197080047 . - . gene_id "XLOC_005100"; transcript_id "TCONS_00005100"; exon_number "1"; oId "CUFF.5011.1"; tss_id "TSS5100"; +chr2 Cufflinks exon 198781607 198781650 . - . gene_id "XLOC_005101"; transcript_id "TCONS_00005101"; exon_number "1"; oId "CUFF.5017.1"; tss_id "TSS5101"; +chr2 Cufflinks exon 199695024 199695061 . - . gene_id "XLOC_005102"; transcript_id "TCONS_00005102"; exon_number "1"; oId "CUFF.5019.1"; tss_id "TSS5102"; +chr2 Cufflinks exon 200765796 200766099 . - . gene_id "XLOC_005103"; transcript_id "TCONS_00005103"; exon_number "1"; oId "CUFF.5021.1"; tss_id "TSS5103"; +chr2 Cufflinks exon 201528146 201528182 . - . gene_id "XLOC_005104"; transcript_id "TCONS_00005104"; exon_number "1"; oId "CUFF.5023.1"; tss_id "TSS5104"; +chr2 Cufflinks exon 201713766 201713867 . - . gene_id "XLOC_005105"; transcript_id "TCONS_00005105"; exon_number "1"; oId "CUFF.5027.1"; tss_id "TSS5105"; +chr2 Cufflinks exon 201746440 201746544 . - . gene_id "XLOC_005106"; transcript_id "TCONS_00005106"; exon_number "1"; oId "CUFF.5028.1"; tss_id "TSS5106"; +chr2 Cufflinks exon 201969402 201969459 . - . gene_id "XLOC_005107"; transcript_id "TCONS_00005107"; exon_number "1"; oId "CUFF.5033.1"; tss_id "TSS5107"; +chr2 Cufflinks exon 202414211 202414279 . - . gene_id "XLOC_005108"; transcript_id "TCONS_00005108"; exon_number "1"; oId "CUFF.5035.1"; tss_id "TSS5108"; +chr2 Cufflinks exon 202852569 202852608 . - . gene_id "XLOC_005109"; transcript_id "TCONS_00005109"; exon_number "1"; oId "CUFF.5039.1"; tss_id "TSS5109"; +chr2 Cufflinks exon 203210989 203211097 . - . gene_id "XLOC_005110"; transcript_id "TCONS_00005110"; exon_number "1"; oId "CUFF.5042.1"; tss_id "TSS5110"; +chr2 Cufflinks exon 203221514 203221614 . - . gene_id "XLOC_005111"; transcript_id "TCONS_00005111"; exon_number "1"; oId "CUFF.5043.1"; tss_id "TSS5111"; +chr2 Cufflinks exon 203221914 203222140 . - . gene_id "XLOC_005112"; transcript_id "TCONS_00005112"; exon_number "1"; oId "CUFF.5044.1"; tss_id "TSS5112"; +chr2 Cufflinks exon 203479438 203479503 . - . gene_id "XLOC_005113"; transcript_id "TCONS_00005113"; exon_number "1"; oId "CUFF.5045.1"; tss_id "TSS5113"; +chr2 Cufflinks exon 203820013 203820044 . - . gene_id "XLOC_005114"; transcript_id "TCONS_00005114"; exon_number "1"; oId "CUFF.5046.1"; tss_id "TSS5114"; +chr2 Cufflinks exon 204229130 204229197 . - . gene_id "XLOC_005115"; transcript_id "TCONS_00005115"; exon_number "1"; oId "CUFF.5047.1"; tss_id "TSS5115"; +chr2 Cufflinks exon 205969571 205969607 . - . gene_id "XLOC_005116"; transcript_id "TCONS_00005116"; exon_number "1"; oId "CUFF.5049.1"; tss_id "TSS5116"; +chr2 Cufflinks exon 207124813 207124966 . - . gene_id "XLOC_005117"; transcript_id "TCONS_00005117"; exon_number "1"; oId "CUFF.5054.1"; tss_id "TSS5117"; +chr2 Cufflinks exon 207161441 207161562 . - . gene_id "XLOC_005118"; transcript_id "TCONS_00005118"; exon_number "1"; oId "CUFF.5055.1"; tss_id "TSS5118"; +chr2 Cufflinks exon 207821318 207821352 . - . gene_id "XLOC_005119"; transcript_id "TCONS_00005119"; exon_number "1"; oId "CUFF.5056.1"; tss_id "TSS5119"; +chr2 Cufflinks exon 208545258 208545363 . - . gene_id "XLOC_005120"; transcript_id "TCONS_00005120"; exon_number "1"; oId "CUFF.5057.1"; tss_id "TSS5120"; +chr2 Cufflinks exon 208884371 208884465 . - . gene_id "XLOC_005121"; transcript_id "TCONS_00005121"; exon_number "1"; oId "CUFF.5058.1"; tss_id "TSS5121"; +chr2 Cufflinks exon 208918885 208918981 . - . gene_id "XLOC_005122"; transcript_id "TCONS_00005122"; exon_number "1"; oId "CUFF.5059.1"; tss_id "TSS5122"; +chr2 Cufflinks exon 208938782 208938885 . - . gene_id "XLOC_005123"; transcript_id "TCONS_00005123"; exon_number "1"; oId "CUFF.5060.1"; tss_id "TSS5123"; +chr2 Cufflinks exon 209785269 209785388 . - . gene_id "XLOC_005124"; transcript_id "TCONS_00005124"; exon_number "1"; oId "CUFF.5062.1"; tss_id "TSS5124"; +chr2 Cufflinks exon 209830234 209830280 . - . gene_id "XLOC_005125"; transcript_id "TCONS_00005125"; exon_number "1"; oId "CUFF.5063.1"; tss_id "TSS5125"; +chr2 Cufflinks exon 210586656 210586744 . - . gene_id "XLOC_005126"; transcript_id "TCONS_00005126"; exon_number "1"; oId "CUFF.5065.1"; tss_id "TSS5126"; +chr2 Cufflinks exon 210787831 210787865 . - . gene_id "XLOC_005127"; transcript_id "TCONS_00005127"; exon_number "1"; oId "CUFF.5066.1"; tss_id "TSS5127"; +chr2 Cufflinks exon 212574511 212574543 . - . gene_id "XLOC_005128"; transcript_id "TCONS_00005128"; exon_number "1"; oId "CUFF.5070.1"; tss_id "TSS5128"; +chr2 Cufflinks exon 212644496 212644564 . - . gene_id "XLOC_005129"; transcript_id "TCONS_00005129"; exon_number "1"; oId "CUFF.5071.1"; tss_id "TSS5129"; +chr2 Cufflinks exon 214365738 214365846 . - . gene_id "XLOC_005130"; transcript_id "TCONS_00005130"; exon_number "1"; oId "CUFF.5073.1"; tss_id "TSS5130"; +chr2 Cufflinks exon 215572057 215572098 . - . gene_id "XLOC_005131"; transcript_id "TCONS_00005131"; exon_number "1"; oId "CUFF.5078.1"; tss_id "TSS5131"; +chr2 Cufflinks exon 216597103 216597137 . - . gene_id "XLOC_005132"; transcript_id "TCONS_00005132"; exon_number "1"; oId "CUFF.5081.1"; tss_id "TSS5132"; +chr2 Cufflinks exon 216912663 216912700 . - . gene_id "XLOC_005133"; transcript_id "TCONS_00005133"; exon_number "1"; oId "CUFF.5082.1"; tss_id "TSS5133"; +chr2 Cufflinks exon 216936761 216936820 . - . gene_id "XLOC_005134"; transcript_id "TCONS_00005134"; exon_number "1"; oId "CUFF.5083.1"; tss_id "TSS5134"; +chr2 Cufflinks exon 217658240 217658323 . - . gene_id "XLOC_005135"; transcript_id "TCONS_00005135"; exon_number "1"; oId "CUFF.5085.1"; tss_id "TSS5135"; +chr2 Cufflinks exon 217866085 217866121 . - . gene_id "XLOC_005136"; transcript_id "TCONS_00005136"; exon_number "1"; oId "CUFF.5086.1"; tss_id "TSS5136"; +chr2 Cufflinks exon 219049699 219049806 . - . gene_id "XLOC_005137"; transcript_id "TCONS_00005137"; exon_number "1"; oId "CUFF.5089.1"; tss_id "TSS5137"; +chr2 Cufflinks exon 219365522 219365760 . - . gene_id "XLOC_005138"; transcript_id "TCONS_00005138"; exon_number "1"; oId "CUFF.5093.1"; tss_id "TSS5138"; +chr2 Cufflinks exon 219453941 219454043 . - . gene_id "XLOC_005139"; transcript_id "TCONS_00005139"; exon_number "1"; oId "CUFF.5094.1"; tss_id "TSS5139"; +chr2 Cufflinks exon 219780909 219781008 . - . gene_id "XLOC_005140"; transcript_id "TCONS_00005140"; exon_number "1"; oId "CUFF.5096.1"; tss_id "TSS5140"; +chr2 Cufflinks exon 220455468 220455706 . - . gene_id "XLOC_005141"; transcript_id "TCONS_00005141"; exon_number "1"; oId "CUFF.5098.1"; tss_id "TSS5141"; +chr2 Cufflinks exon 221860941 221861033 . - . gene_id "XLOC_005142"; transcript_id "TCONS_00005142"; exon_number "1"; oId "CUFF.5099.1"; tss_id "TSS5142"; +chr2 Cufflinks exon 222010786 222010858 . - . gene_id "XLOC_005143"; transcript_id "TCONS_00005143"; exon_number "1"; oId "CUFF.5100.1"; tss_id "TSS5143"; +chr2 Cufflinks exon 223562612 223562720 . - . gene_id "XLOC_005144"; transcript_id "TCONS_00005144"; exon_number "1"; oId "CUFF.5103.1"; tss_id "TSS5144"; +chr2 Cufflinks exon 224113210 224113512 . - . gene_id "XLOC_005145"; transcript_id "TCONS_00005145"; exon_number "1"; oId "CUFF.5105.1"; tss_id "TSS5145"; +chr2 Cufflinks exon 224186316 224186383 . - . gene_id "XLOC_005146"; transcript_id "TCONS_00005146"; exon_number "1"; oId "CUFF.5106.1"; tss_id "TSS5146"; +chr2 Cufflinks exon 225887044 225887126 . - . gene_id "XLOC_005147"; transcript_id "TCONS_00005147"; exon_number "1"; oId "CUFF.5111.1"; tss_id "TSS5147"; +chr2 Cufflinks exon 227307897 227307936 . - . gene_id "XLOC_005148"; transcript_id "TCONS_00005148"; exon_number "1"; oId "CUFF.5113.1"; tss_id "TSS5148"; +chr2 Cufflinks exon 228158385 228158421 . - . gene_id "XLOC_005149"; transcript_id "TCONS_00005149"; exon_number "1"; oId "CUFF.5116.1"; tss_id "TSS5149"; +chr2 Cufflinks exon 228627780 228627868 . - . gene_id "XLOC_005150"; transcript_id "TCONS_00005150"; exon_number "1"; oId "CUFF.5119.1"; tss_id "TSS5150"; +chr2 Cufflinks exon 229844569 229844606 . - . gene_id "XLOC_005151"; transcript_id "TCONS_00005151"; exon_number "1"; oId "CUFF.5123.1"; tss_id "TSS5151"; +chr2 Cufflinks exon 230045488 230045734 . - . gene_id "XLOC_005152"; transcript_id "TCONS_00005152"; exon_number "1"; oId "CUFF.5125.1"; tss_id "TSS5152"; +chr2 Cufflinks exon 230101156 230101324 . - . gene_id "XLOC_005153"; transcript_id "TCONS_00005153"; exon_number "1"; oId "CUFF.5126.1"; tss_id "TSS5153"; +chr2 Cufflinks exon 230802521 230802598 . - . gene_id "XLOC_005154"; transcript_id "TCONS_00005154"; exon_number "1"; oId "CUFF.5130.1"; tss_id "TSS5154"; +chr2 Cufflinks exon 232366842 232366912 . - . gene_id "XLOC_005155"; transcript_id "TCONS_00005155"; exon_number "1"; oId "CUFF.5137.1"; tss_id "TSS5155"; +chr2 Cufflinks exon 232376601 232376635 . - . gene_id "XLOC_005156"; transcript_id "TCONS_00005156"; exon_number "1"; oId "CUFF.5138.1"; tss_id "TSS5156"; +chr2 Cufflinks exon 232510684 232510984 . - . gene_id "XLOC_005157"; transcript_id "TCONS_00005157"; exon_number "1"; oId "CUFF.5139.1"; tss_id "TSS5157"; +chr2 Cufflinks exon 235935600 235935642 . - . gene_id "XLOC_005158"; transcript_id "TCONS_00005158"; exon_number "1"; oId "CUFF.5149.1"; tss_id "TSS5158"; +chr2 Cufflinks exon 237119017 237119188 . - . gene_id "XLOC_005159"; transcript_id "TCONS_00005159"; exon_number "1"; oId "CUFF.5152.1"; tss_id "TSS5159"; +chr2 Cufflinks exon 237923848 237923945 . - . gene_id "XLOC_005160"; transcript_id "TCONS_00005160"; exon_number "1"; oId "CUFF.5154.1"; tss_id "TSS5160"; +chr2 Cufflinks exon 237936112 237936285 . - . gene_id "XLOC_005161"; transcript_id "TCONS_00005161"; exon_number "1"; oId "CUFF.5155.1"; tss_id "TSS5161"; +chr2 Cufflinks exon 238937648 238937704 . - . gene_id "XLOC_005162"; transcript_id "TCONS_00005162"; exon_number "1"; oId "CUFF.5157.1"; tss_id "TSS5162"; +chr2 Cufflinks exon 239532931 239532984 . - . gene_id "XLOC_005163"; transcript_id "TCONS_00005163"; exon_number "1"; oId "CUFF.5159.1"; tss_id "TSS5163"; +chr2 Cufflinks exon 242150408 242150456 . - . gene_id "XLOC_005164"; transcript_id "TCONS_00005164"; exon_number "1"; oId "CUFF.5162.1"; tss_id "TSS5164"; +chr2 Cufflinks exon 242304242 242304314 . - . gene_id "XLOC_005165"; transcript_id "TCONS_00005165"; exon_number "1"; oId "CUFF.5163.1"; tss_id "TSS5165"; +chr20 Cufflinks exon 1430625 1430673 . + . gene_id "XLOC_005166"; transcript_id "TCONS_00005166"; exon_number "1"; oId "CUFF.5167.1"; tss_id "TSS5166"; +chr20 Cufflinks exon 1647007 1647309 . + . gene_id "XLOC_005167"; transcript_id "TCONS_00005167"; exon_number "1"; oId "CUFF.5169.1"; tss_id "TSS5167"; +chr20 Cufflinks exon 2620385 2620417 . + . gene_id "XLOC_005168"; transcript_id "TCONS_00005168"; exon_number "1"; oId "CUFF.5170.1"; tss_id "TSS5168"; +chr20 Cufflinks exon 3064520 3064556 . + . gene_id "XLOC_005169"; transcript_id "TCONS_00005169"; exon_number "1"; oId "CUFF.5171.1"; tss_id "TSS5169"; +chr20 Cufflinks exon 3074817 3075174 . + . gene_id "XLOC_005170"; transcript_id "TCONS_00005170"; exon_number "1"; oId "CUFF.5172.1"; tss_id "TSS5170"; +chr20 Cufflinks exon 3340683 3340788 . + . gene_id "XLOC_005171"; transcript_id "TCONS_00005171"; exon_number "1"; oId "CUFF.5174.1"; tss_id "TSS5171"; +chr20 Cufflinks exon 3364876 3365085 . + . gene_id "XLOC_005172"; transcript_id "TCONS_00005172"; exon_number "1"; oId "CUFF.5175.1"; tss_id "TSS5172"; +chr20 Cufflinks exon 3436287 3436338 . + . gene_id "XLOC_005173"; transcript_id "TCONS_00005173"; exon_number "1"; oId "CUFF.5176.1"; tss_id "TSS5173"; +chr20 Cufflinks exon 4016482 4016535 . + . gene_id "XLOC_005174"; transcript_id "TCONS_00005174"; exon_number "1"; oId "CUFF.5177.1"; tss_id "TSS5174"; +chr20 Cufflinks exon 4863042 4863099 . + . gene_id "XLOC_005175"; transcript_id "TCONS_00005175"; exon_number "1"; oId "CUFF.5178.1"; tss_id "TSS5175"; +chr20 Cufflinks exon 5028699 5028764 . + . gene_id "XLOC_005176"; transcript_id "TCONS_00005176"; exon_number "1"; oId "CUFF.5179.1"; tss_id "TSS5176"; +chr20 Cufflinks exon 5380260 5380294 . + . gene_id "XLOC_005177"; transcript_id "TCONS_00005177"; exon_number "1"; oId "CUFF.5181.1"; tss_id "TSS5177"; +chr20 Cufflinks exon 5870701 5870857 . + . gene_id "XLOC_005178"; transcript_id "TCONS_00005178"; exon_number "1"; oId "CUFF.5184.1"; tss_id "TSS5178"; +chr20 Cufflinks exon 5982379 5982692 . + . gene_id "XLOC_005179"; transcript_id "TCONS_00005179"; exon_number "1"; oId "CUFF.5185.1"; tss_id "TSS5179"; +chr20 Cufflinks exon 8548292 8548401 . + . gene_id "XLOC_005180"; transcript_id "TCONS_00005180"; exon_number "1"; oId "CUFF.5187.1"; tss_id "TSS5180"; +chr20 Cufflinks exon 8811832 8812040 . + . gene_id "XLOC_005181"; transcript_id "TCONS_00005181"; exon_number "1"; oId "CUFF.5189.1"; tss_id "TSS5181"; +chr20 Cufflinks exon 10006565 10006816 . + . gene_id "XLOC_005182"; transcript_id "TCONS_00005182"; exon_number "1"; oId "CUFF.5192.1"; tss_id "TSS5182"; +chr20 Cufflinks exon 11890638 11890749 . + . gene_id "XLOC_005183"; transcript_id "TCONS_00005183"; exon_number "1"; oId "CUFF.5196.1"; tss_id "TSS5183"; +chr20 Cufflinks exon 12549517 12549564 . + . gene_id "XLOC_005184"; transcript_id "TCONS_00005184"; exon_number "1"; oId "CUFF.5197.1"; tss_id "TSS5184"; +chr20 Cufflinks exon 13685263 13685298 . + . gene_id "XLOC_005185"; transcript_id "TCONS_00005185"; exon_number "1"; oId "CUFF.5198.1"; tss_id "TSS5185"; +chr20 Cufflinks exon 14203705 14203915 . + . gene_id "XLOC_005186"; transcript_id "TCONS_00005186"; exon_number "1"; oId "CUFF.5202.1"; tss_id "TSS5186"; +chr20 Cufflinks exon 14332968 14333069 . + . gene_id "XLOC_005187"; transcript_id "TCONS_00005187"; exon_number "1"; oId "CUFF.5203.1"; tss_id "TSS5187"; +chr20 Cufflinks exon 15003498 15003599 . + . gene_id "XLOC_005188"; transcript_id "TCONS_00005188"; exon_number "1"; oId "CUFF.5206.1"; tss_id "TSS5188"; +chr20 Cufflinks exon 15305801 15305966 . + . gene_id "XLOC_005189"; transcript_id "TCONS_00005189"; exon_number "1"; oId "CUFF.5209.1"; tss_id "TSS5189"; +chr20 Cufflinks exon 15933520 15933569 . + . gene_id "XLOC_005190"; transcript_id "TCONS_00005190"; exon_number "1"; oId "CUFF.5211.1"; tss_id "TSS5190"; +chr20 Cufflinks exon 16058408 16058472 . + . gene_id "XLOC_005191"; transcript_id "TCONS_00005191"; exon_number "1"; oId "CUFF.5212.1"; tss_id "TSS5191"; +chr20 Cufflinks exon 17168155 17168261 . + . gene_id "XLOC_005192"; transcript_id "TCONS_00005192"; exon_number "1"; oId "CUFF.5215.1"; tss_id "TSS5192"; +chr20 Cufflinks exon 17189705 17189866 . + . gene_id "XLOC_005193"; transcript_id "TCONS_00005193"; exon_number "1"; oId "CUFF.5216.1"; tss_id "TSS5193"; +chr20 Cufflinks exon 17469658 17470083 . + . gene_id "XLOC_005194"; transcript_id "TCONS_00005194"; exon_number "1"; oId "CUFF.5217.1"; tss_id "TSS5194"; +chr20 Cufflinks exon 17884105 17884143 . + . gene_id "XLOC_005195"; transcript_id "TCONS_00005195"; exon_number "1"; oId "CUFF.5219.1"; tss_id "TSS5195"; +chr20 Cufflinks exon 17884431 17884501 . + . gene_id "XLOC_005196"; transcript_id "TCONS_00005196"; exon_number "1"; oId "CUFF.5220.1"; tss_id "TSS5196"; +chr20 Cufflinks exon 18304569 18304635 . + . gene_id "XLOC_005197"; transcript_id "TCONS_00005197"; exon_number "1"; oId "CUFF.5225.1"; tss_id "TSS5197"; +chr20 Cufflinks exon 18327541 18327644 . + . gene_id "XLOC_005198"; transcript_id "TCONS_00005198"; exon_number "1"; oId "CUFF.5226.1"; tss_id "TSS5198"; +chr20 Cufflinks exon 18414486 18414573 . + . gene_id "XLOC_005199"; transcript_id "TCONS_00005199"; exon_number "1"; oId "CUFF.5227.1"; tss_id "TSS5199"; +chr20 Cufflinks exon 18572974 18573286 . + . gene_id "XLOC_005200"; transcript_id "TCONS_00005200"; exon_number "1"; oId "CUFF.5228.1"; tss_id "TSS5200"; +chr20 Cufflinks exon 19856930 19856984 . + . gene_id "XLOC_005201"; transcript_id "TCONS_00005201"; exon_number "1"; oId "CUFF.5231.1"; tss_id "TSS5201"; +chr20 Cufflinks exon 24217893 24218036 . + . gene_id "XLOC_005202"; transcript_id "TCONS_00005202"; exon_number "1"; oId "CUFF.5241.1"; tss_id "TSS5202"; +chr20 Cufflinks exon 24954807 24954916 . + . gene_id "XLOC_005203"; transcript_id "TCONS_00005203"; exon_number "1"; oId "CUFF.5243.1"; tss_id "TSS5203"; +chr20 Cufflinks exon 26170323 26170368 . + . gene_id "XLOC_005204"; transcript_id "TCONS_00005204"; exon_number "1"; oId "CUFF.5245.1"; tss_id "TSS5204"; +chr20 Cufflinks exon 29651587 29651623 . + . gene_id "XLOC_005205"; transcript_id "TCONS_00005205"; exon_number "1"; oId "CUFF.5248.1"; tss_id "TSS5205"; +chr20 Cufflinks exon 29944673 29944761 . + . gene_id "XLOC_005206"; transcript_id "TCONS_00005206"; exon_number "1"; oId "CUFF.5249.1"; tss_id "TSS5206"; +chr20 Cufflinks exon 30168892 30168990 . + . gene_id "XLOC_005207"; transcript_id "TCONS_00005207"; exon_number "1"; oId "CUFF.5250.1"; tss_id "TSS5207"; +chr20 Cufflinks exon 30348634 30348668 . + . gene_id "XLOC_005208"; transcript_id "TCONS_00005208"; exon_number "1"; oId "CUFF.5251.1"; tss_id "TSS5208"; +chr20 Cufflinks exon 30489057 30489201 . + . gene_id "XLOC_005209"; transcript_id "TCONS_00005209"; exon_number "1"; oId "CUFF.5253.1"; tss_id "TSS5209"; +chr20 Cufflinks exon 30596179 30596240 . + . gene_id "XLOC_005210"; transcript_id "TCONS_00005210"; exon_number "1"; oId "CUFF.5254.1"; tss_id "TSS5210"; +chr20 Cufflinks exon 30638391 30638508 . + . gene_id "XLOC_005211"; transcript_id "TCONS_00005211"; exon_number "1"; oId "CUFF.5255.1"; tss_id "TSS5211"; +chr20 Cufflinks exon 32330774 32330829 . + . gene_id "XLOC_005212"; transcript_id "TCONS_00005212"; exon_number "1"; oId "CUFF.5259.1"; tss_id "TSS5212"; +chr20 Cufflinks exon 32331448 32331479 . + . gene_id "XLOC_005213"; transcript_id "TCONS_00005213"; exon_number "1"; oId "CUFF.5260.1"; tss_id "TSS5213"; +chr20 Cufflinks exon 33783109 33783226 . + . gene_id "XLOC_005214"; transcript_id "TCONS_00005214"; exon_number "1"; oId "CUFF.5265.1"; tss_id "TSS5214"; +chr20 Cufflinks exon 34231071 34231291 . + . gene_id "XLOC_005215"; transcript_id "TCONS_00005215"; exon_number "1"; oId "CUFF.5267.1"; tss_id "TSS5215"; +chr20 Cufflinks exon 34304397 34304490 . + . gene_id "XLOC_005216"; transcript_id "TCONS_00005216"; exon_number "1"; oId "CUFF.5269.1"; tss_id "TSS5216"; +chr20 Cufflinks exon 34475581 34475725 . + . gene_id "XLOC_005217"; transcript_id "TCONS_00005217"; exon_number "1"; oId "CUFF.5271.1"; tss_id "TSS5217"; +chr20 Cufflinks exon 34708883 34708997 . + . gene_id "XLOC_005218"; transcript_id "TCONS_00005218"; exon_number "1"; oId "CUFF.5273.1"; tss_id "TSS5218"; +chr20 Cufflinks exon 35441610 35441735 . + . gene_id "XLOC_005219"; transcript_id "TCONS_00005219"; exon_number "1"; oId "CUFF.5274.1"; tss_id "TSS5219"; +chr20 Cufflinks exon 35498502 35498725 . + . gene_id "XLOC_005220"; transcript_id "TCONS_00005220"; exon_number "1"; oId "CUFF.5275.1"; tss_id "TSS5220"; +chr20 Cufflinks exon 37390171 37390409 . + . gene_id "XLOC_005221"; transcript_id "TCONS_00005221"; exon_number "1"; oId "CUFF.5280.1"; tss_id "TSS5221"; +chr20 Cufflinks exon 37501415 37501642 . + . gene_id "XLOC_005222"; transcript_id "TCONS_00005222"; exon_number "1"; oId "CUFF.5281.1"; tss_id "TSS5222"; +chr20 Cufflinks exon 37572666 37572700 . + . gene_id "XLOC_005223"; transcript_id "TCONS_00005223"; exon_number "1"; oId "CUFF.5282.1"; tss_id "TSS5223"; +chr20 Cufflinks exon 37981496 37981634 . + . gene_id "XLOC_005224"; transcript_id "TCONS_00005224"; exon_number "1"; oId "CUFF.5285.1"; tss_id "TSS5224"; +chr20 Cufflinks exon 39652845 39653030 . + . gene_id "XLOC_005225"; transcript_id "TCONS_00005225"; exon_number "1"; oId "CUFF.5288.1"; tss_id "TSS5225"; +chr20 Cufflinks exon 41168028 41168067 . + . gene_id "XLOC_005226"; transcript_id "TCONS_00005226"; exon_number "1"; oId "CUFF.5292.1"; tss_id "TSS5226"; +chr20 Cufflinks exon 41455197 41455253 . + . gene_id "XLOC_005227"; transcript_id "TCONS_00005227"; exon_number "1"; oId "CUFF.5293.1"; tss_id "TSS5227"; +chr20 Cufflinks exon 41691966 41692201 . + . gene_id "XLOC_005228"; transcript_id "TCONS_00005228"; exon_number "1"; oId "CUFF.5294.1"; tss_id "TSS5228"; +chr20 Cufflinks exon 41850846 41851155 . + . gene_id "XLOC_005229"; transcript_id "TCONS_00005229"; exon_number "1"; oId "CUFF.5295.1"; tss_id "TSS5229"; +chr20 Cufflinks exon 42034113 42034208 . + . gene_id "XLOC_005230"; transcript_id "TCONS_00005230"; exon_number "1"; oId "CUFF.5296.1"; tss_id "TSS5230"; +chr20 Cufflinks exon 42101653 42101758 . + . gene_id "XLOC_005231"; transcript_id "TCONS_00005231"; exon_number "1"; oId "CUFF.5297.1"; tss_id "TSS5231"; +chr20 Cufflinks exon 42635888 42636195 . + . gene_id "XLOC_005232"; transcript_id "TCONS_00005232"; exon_number "1"; oId "CUFF.5299.1"; tss_id "TSS5232"; +chr20 Cufflinks exon 42840346 42840408 . + . gene_id "XLOC_005233"; transcript_id "TCONS_00005233"; exon_number "1"; oId "CUFF.5300.1"; tss_id "TSS5233"; +chr20 Cufflinks exon 43089781 43089947 . + . gene_id "XLOC_005234"; transcript_id "TCONS_00005234"; exon_number "1"; oId "CUFF.5301.1"; tss_id "TSS5234"; +chr20 Cufflinks exon 43296190 43296228 . + . gene_id "XLOC_005235"; transcript_id "TCONS_00005235"; exon_number "1"; oId "CUFF.5302.1"; tss_id "TSS5235"; +chr20 Cufflinks exon 43296543 43296621 . + . gene_id "XLOC_005236"; transcript_id "TCONS_00005236"; exon_number "1"; oId "CUFF.5303.1"; tss_id "TSS5236"; +chr20 Cufflinks exon 43951001 43951074 . + . gene_id "XLOC_005237"; transcript_id "TCONS_00005237"; exon_number "1"; oId "CUFF.5305.1"; tss_id "TSS5237"; +chr20 Cufflinks exon 45487973 45488211 . + . gene_id "XLOC_005238"; transcript_id "TCONS_00005238"; exon_number "1"; oId "CUFF.5308.1"; tss_id "TSS5238"; +chr20 Cufflinks exon 46099815 46099881 . + . gene_id "XLOC_005239"; transcript_id "TCONS_00005239"; exon_number "1"; oId "CUFF.5311.1"; tss_id "TSS5239"; +chr20 Cufflinks exon 46501941 46501997 . + . gene_id "XLOC_005240"; transcript_id "TCONS_00005240"; exon_number "1"; oId "CUFF.5315.1"; tss_id "TSS5240"; +chr20 Cufflinks exon 46533092 46533141 . + . gene_id "XLOC_005241"; transcript_id "TCONS_00005241"; exon_number "1"; oId "CUFF.5316.1"; tss_id "TSS5241"; +chr20 Cufflinks exon 47716973 47716998 . + . gene_id "XLOC_005242"; transcript_id "TCONS_00005242"; exon_number "1"; oId "CUFF.5319.1"; tss_id "TSS5242"; +chr20 Cufflinks exon 47860768 47860820 . + . gene_id "XLOC_005243"; transcript_id "TCONS_00005243"; exon_number "1"; oId "CUFF.5320.1"; tss_id "TSS5243"; +chr20 Cufflinks exon 48290169 48290202 . + . gene_id "XLOC_005244"; transcript_id "TCONS_00005244"; exon_number "1"; oId "CUFF.5321.1"; tss_id "TSS5244"; +chr20 Cufflinks exon 48338486 48338806 . + . gene_id "XLOC_005245"; transcript_id "TCONS_00005245"; exon_number "1"; oId "CUFF.5322.1"; tss_id "TSS5245"; +chr20 Cufflinks exon 48411348 48411447 . + . gene_id "XLOC_005246"; transcript_id "TCONS_00005246"; exon_number "1"; oId "CUFF.5323.1"; tss_id "TSS5246"; +chr20 Cufflinks exon 48444533 48444589 . + . gene_id "XLOC_005247"; transcript_id "TCONS_00005247"; exon_number "1"; oId "CUFF.5324.1"; tss_id "TSS5247"; +chr20 Cufflinks exon 48588643 48588749 . + . gene_id "XLOC_005248"; transcript_id "TCONS_00005248"; exon_number "1"; oId "CUFF.5326.1"; tss_id "TSS5248"; +chr20 Cufflinks exon 50518831 50518930 . + . gene_id "XLOC_005249"; transcript_id "TCONS_00005249"; exon_number "1"; oId "CUFF.5331.1"; tss_id "TSS5249"; +chr20 Cufflinks exon 50521509 50521569 . + . gene_id "XLOC_005250"; transcript_id "TCONS_00005250"; exon_number "1"; oId "CUFF.5332.1"; tss_id "TSS5250"; +chr20 Cufflinks exon 51714192 51714436 . + . gene_id "XLOC_005251"; transcript_id "TCONS_00005251"; exon_number "1"; oId "CUFF.5333.1"; tss_id "TSS5251"; +chr20 Cufflinks exon 51880565 51880612 . + . gene_id "XLOC_005252"; transcript_id "TCONS_00005252"; exon_number "1"; oId "CUFF.5334.1"; tss_id "TSS5252"; +chr20 Cufflinks exon 54460609 54460645 . + . gene_id "XLOC_005253"; transcript_id "TCONS_00005253"; exon_number "1"; oId "CUFF.5337.1"; tss_id "TSS5253"; +chr20 Cufflinks exon 54956058 54956136 . + . gene_id "XLOC_005254"; transcript_id "TCONS_00005254"; exon_number "1"; oId "CUFF.5339.1"; tss_id "TSS5254"; +chr20 Cufflinks exon 55050698 55050804 . + . gene_id "XLOC_005255"; transcript_id "TCONS_00005255"; exon_number "1"; oId "CUFF.5340.1"; tss_id "TSS5255"; +chr20 Cufflinks exon 55182737 55182802 . + . gene_id "XLOC_005256"; transcript_id "TCONS_00005256"; exon_number "1"; oId "CUFF.5341.1"; tss_id "TSS5256"; +chr20 Cufflinks exon 55242486 55242589 . + . gene_id "XLOC_005257"; transcript_id "TCONS_00005257"; exon_number "1"; oId "CUFF.5342.1"; tss_id "TSS5257"; +chr20 Cufflinks exon 55263457 55263774 . + . gene_id "XLOC_005258"; transcript_id "TCONS_00005258"; exon_number "1"; oId "CUFF.5343.1"; tss_id "TSS5258"; +chr20 Cufflinks exon 56349272 56349306 . + . gene_id "XLOC_005259"; transcript_id "TCONS_00005259"; exon_number "1"; oId "CUFF.5347.1"; tss_id "TSS5259"; +chr20 Cufflinks exon 57208772 57208866 . + . gene_id "XLOC_005260"; transcript_id "TCONS_00005260"; exon_number "1"; oId "CUFF.5349.1"; tss_id "TSS5260"; +chr20 Cufflinks exon 57790306 57790383 . + . gene_id "XLOC_005261"; transcript_id "TCONS_00005261"; exon_number "1"; oId "CUFF.5350.1"; tss_id "TSS5261"; +chr20 Cufflinks exon 61968707 61968776 . + . gene_id "XLOC_005262"; transcript_id "TCONS_00005262"; exon_number "1"; oId "CUFF.5354.1"; tss_id "TSS5262"; +chr20 Cufflinks exon 62540308 62540470 . + . gene_id "XLOC_005263"; transcript_id "TCONS_00005263"; exon_number "1"; oId "CUFF.5355.1"; tss_id "TSS5263"; +chr20 Cufflinks exon 62675744 62675777 . + . gene_id "XLOC_005264"; transcript_id "TCONS_00005264"; exon_number "1"; oId "CUFF.5356.1"; tss_id "TSS5264"; +chr20 Cufflinks exon 317603 317647 . - . gene_id "XLOC_005265"; transcript_id "TCONS_00005265"; exon_number "1"; oId "CUFF.5166.1"; tss_id "TSS5265"; +chr20 Cufflinks exon 1509702 1509805 . - . gene_id "XLOC_005266"; transcript_id "TCONS_00005266"; exon_number "1"; oId "CUFF.5168.1"; tss_id "TSS5266"; +chr20 Cufflinks exon 3328138 3328176 . - . gene_id "XLOC_005267"; transcript_id "TCONS_00005267"; exon_number "1"; oId "CUFF.5173.1"; tss_id "TSS5267"; +chr20 Cufflinks exon 5079033 5079121 . - . gene_id "XLOC_005268"; transcript_id "TCONS_00005268"; exon_number "1"; oId "CUFF.5180.1"; tss_id "TSS5268"; +chr20 Cufflinks exon 5624548 5624585 . - . gene_id "XLOC_005269"; transcript_id "TCONS_00005269"; exon_number "1"; oId "CUFF.5182.1"; tss_id "TSS5269"; +chr20 Cufflinks exon 5749454 5749513 . - . gene_id "XLOC_005270"; transcript_id "TCONS_00005270"; exon_number "1"; oId "CUFF.5183.1"; tss_id "TSS5270"; +chr20 Cufflinks exon 7614194 7614495 . - . gene_id "XLOC_005271"; transcript_id "TCONS_00005271"; exon_number "1"; oId "CUFF.5186.1"; tss_id "TSS5271"; +chr20 Cufflinks exon 8593446 8593480 . - . gene_id "XLOC_005272"; transcript_id "TCONS_00005272"; exon_number "1"; oId "CUFF.5188.1"; tss_id "TSS5272"; +chr20 Cufflinks exon 9365376 9365415 . - . gene_id "XLOC_005273"; transcript_id "TCONS_00005273"; exon_number "1"; oId "CUFF.5190.1"; tss_id "TSS5273"; +chr20 Cufflinks exon 9984920 9984955 . - . gene_id "XLOC_005274"; transcript_id "TCONS_00005274"; exon_number "1"; oId "CUFF.5191.1"; tss_id "TSS5274"; +chr20 Cufflinks exon 10507605 10507665 . - . gene_id "XLOC_005275"; transcript_id "TCONS_00005275"; exon_number "1"; oId "CUFF.5193.1"; tss_id "TSS5275"; +chr20 Cufflinks exon 11036355 11036493 . - . gene_id "XLOC_005276"; transcript_id "TCONS_00005276"; exon_number "1"; oId "CUFF.5194.1"; tss_id "TSS5276"; +chr20 Cufflinks exon 11799508 11799738 . - . gene_id "XLOC_005277"; transcript_id "TCONS_00005277"; exon_number "1"; oId "CUFF.5195.1"; tss_id "TSS5277"; +chr20 Cufflinks exon 13754343 13754406 . - . gene_id "XLOC_005278"; transcript_id "TCONS_00005278"; exon_number "1"; oId "CUFF.5199.1"; tss_id "TSS5278"; +chr20 Cufflinks exon 13953962 13954051 . - . gene_id "XLOC_005279"; transcript_id "TCONS_00005279"; exon_number "1"; oId "CUFF.5200.1"; tss_id "TSS5279"; +chr20 Cufflinks exon 13970470 13970541 . - . gene_id "XLOC_005280"; transcript_id "TCONS_00005280"; exon_number "1"; oId "CUFF.5201.1"; tss_id "TSS5280"; +chr20 Cufflinks exon 14937750 14937779 . - . gene_id "XLOC_005281"; transcript_id "TCONS_00005281"; exon_number "1"; oId "CUFF.5204.1"; tss_id "TSS5281"; +chr20 Cufflinks exon 15002205 15002305 . - . gene_id "XLOC_005282"; transcript_id "TCONS_00005282"; exon_number "1"; oId "CUFF.5205.1"; tss_id "TSS5282"; +chr20 Cufflinks exon 15029241 15029305 . - . gene_id "XLOC_005283"; transcript_id "TCONS_00005283"; exon_number "1"; oId "CUFF.5207.1"; tss_id "TSS5283"; +chr20 Cufflinks exon 15261430 15261513 . - . gene_id "XLOC_005284"; transcript_id "TCONS_00005284"; exon_number "1"; oId "CUFF.5208.1"; tss_id "TSS5284"; +chr20 Cufflinks exon 15874303 15874337 . - . gene_id "XLOC_005285"; transcript_id "TCONS_00005285"; exon_number "1"; oId "CUFF.5210.1"; tss_id "TSS5285"; +chr20 Cufflinks exon 16572303 16572340 . - . gene_id "XLOC_005286"; transcript_id "TCONS_00005286"; exon_number "1"; oId "CUFF.5213.1"; tss_id "TSS5286"; +chr20 Cufflinks exon 16963476 16963678 . - . gene_id "XLOC_005287"; transcript_id "TCONS_00005287"; exon_number "1"; oId "CUFF.5214.1"; tss_id "TSS5287"; +chr20 Cufflinks exon 17556925 17557154 . - . gene_id "XLOC_005288"; transcript_id "TCONS_00005288"; exon_number "1"; oId "CUFF.5218.1"; tss_id "TSS5288"; +chr20 Cufflinks exon 18076216 18076272 . - . gene_id "XLOC_005289"; transcript_id "TCONS_00005289"; exon_number "1"; oId "CUFF.5221.1"; tss_id "TSS5289"; +chr20 Cufflinks exon 18239187 18239495 . - . gene_id "XLOC_005290"; transcript_id "TCONS_00005290"; exon_number "1"; oId "CUFF.5222.1"; tss_id "TSS5290"; +chr20 Cufflinks exon 18246344 18246523 . - . gene_id "XLOC_005291"; transcript_id "TCONS_00005291"; exon_number "1"; oId "CUFF.5223.1"; tss_id "TSS5291"; +chr20 Cufflinks exon 18275854 18276095 . - . gene_id "XLOC_005292"; transcript_id "TCONS_00005292"; exon_number "1"; oId "CUFF.5224.1"; tss_id "TSS5292"; +chr20 Cufflinks exon 18589037 18589093 . - . gene_id "XLOC_005293"; transcript_id "TCONS_00005293"; exon_number "1"; oId "CUFF.5229.1"; tss_id "TSS5293"; +chr20 Cufflinks exon 18696137 18696179 . - . gene_id "XLOC_005294"; transcript_id "TCONS_00005294"; exon_number "1"; oId "CUFF.5230.1"; tss_id "TSS5294"; +chr20 Cufflinks exon 20719055 20719374 . - . gene_id "XLOC_005295"; transcript_id "TCONS_00005295"; exon_number "1"; oId "CUFF.5232.1"; tss_id "TSS5295"; +chr20 Cufflinks exon 20753816 20753849 . - . gene_id "XLOC_005296"; transcript_id "TCONS_00005296"; exon_number "1"; oId "CUFF.5233.1"; tss_id "TSS5296"; +chr20 Cufflinks exon 21119592 21119713 . - . gene_id "XLOC_005297"; transcript_id "TCONS_00005297"; exon_number "1"; oId "CUFF.5234.1"; tss_id "TSS5297"; +chr20 Cufflinks exon 21405445 21405679 . - . gene_id "XLOC_005298"; transcript_id "TCONS_00005298"; exon_number "1"; oId "CUFF.5235.1"; tss_id "TSS5298"; +chr20 Cufflinks exon 21465226 21465316 . - . gene_id "XLOC_005299"; transcript_id "TCONS_00005299"; exon_number "1"; oId "CUFF.5236.1"; tss_id "TSS5299"; +chr20 Cufflinks exon 22765837 22765878 . - . gene_id "XLOC_005300"; transcript_id "TCONS_00005300"; exon_number "1"; oId "CUFF.5237.1"; tss_id "TSS5300"; +chr20 Cufflinks exon 23141493 23141601 . - . gene_id "XLOC_005301"; transcript_id "TCONS_00005301"; exon_number "1"; oId "CUFF.5238.1"; tss_id "TSS5301"; +chr20 Cufflinks exon 23361532 23361649 . - . gene_id "XLOC_005302"; transcript_id "TCONS_00005302"; exon_number "1"; oId "CUFF.5239.1"; tss_id "TSS5302"; +chr20 Cufflinks exon 23946335 23946385 . - . gene_id "XLOC_005303"; transcript_id "TCONS_00005303"; exon_number "1"; oId "CUFF.5240.1"; tss_id "TSS5303"; +chr20 Cufflinks exon 24382438 24382475 . - . gene_id "XLOC_005304"; transcript_id "TCONS_00005304"; exon_number "1"; oId "CUFF.5242.1"; tss_id "TSS5304"; +chr20 Cufflinks exon 25635213 25635517 . - . gene_id "XLOC_005305"; transcript_id "TCONS_00005305"; exon_number "1"; oId "CUFF.5244.1"; tss_id "TSS5305"; +chr20 Cufflinks exon 29629429 29629475 . - . gene_id "XLOC_005306"; transcript_id "TCONS_00005306"; exon_number "1"; oId "CUFF.5246.1"; tss_id "TSS5306"; +chr20 Cufflinks exon 29647122 29647186 . - . gene_id "XLOC_005307"; transcript_id "TCONS_00005307"; exon_number "1"; oId "CUFF.5247.1"; tss_id "TSS5307"; +chr20 Cufflinks exon 30463691 30463727 . - . gene_id "XLOC_005308"; transcript_id "TCONS_00005308"; exon_number "1"; oId "CUFF.5252.1"; tss_id "TSS5308"; +chr20 Cufflinks exon 30953216 30953258 . - . gene_id "XLOC_005309"; transcript_id "TCONS_00005309"; exon_number "1"; oId "CUFF.5256.1"; tss_id "TSS5309"; +chr20 Cufflinks exon 31205737 31205784 . - . gene_id "XLOC_005310"; transcript_id "TCONS_00005310"; exon_number "1"; oId "CUFF.5257.1"; tss_id "TSS5310"; +chr20 Cufflinks exon 31886836 31886900 . - . gene_id "XLOC_005311"; transcript_id "TCONS_00005311"; exon_number "1"; oId "CUFF.5258.1"; tss_id "TSS5311"; +chr20 Cufflinks exon 32430070 32430117 . - . gene_id "XLOC_005312"; transcript_id "TCONS_00005312"; exon_number "1"; oId "CUFF.5261.1"; tss_id "TSS5312"; +chr20 Cufflinks exon 32966672 32966774 . - . gene_id "XLOC_005313"; transcript_id "TCONS_00005313"; exon_number "1"; oId "CUFF.5262.1"; tss_id "TSS5313"; +chr20 Cufflinks exon 33618122 33618222 . - . gene_id "XLOC_005314"; transcript_id "TCONS_00005314"; exon_number "1"; oId "CUFF.5263.1"; tss_id "TSS5314"; +chr20 Cufflinks exon 33720138 33720173 . - . gene_id "XLOC_005315"; transcript_id "TCONS_00005315"; exon_number "1"; oId "CUFF.5264.1"; tss_id "TSS5315"; +chr20 Cufflinks exon 33969364 33969610 . - . gene_id "XLOC_005316"; transcript_id "TCONS_00005316"; exon_number "1"; oId "CUFF.5266.1"; tss_id "TSS5316"; +chr20 Cufflinks exon 34235259 34235352 . - . gene_id "XLOC_005317"; transcript_id "TCONS_00005317"; exon_number "1"; oId "CUFF.5268.1"; tss_id "TSS5317"; +chr20 Cufflinks exon 34357707 34357783 . - . gene_id "XLOC_005318"; transcript_id "TCONS_00005318"; exon_number "1"; oId "CUFF.5270.1"; tss_id "TSS5318"; +chr20 Cufflinks exon 34516493 34516597 . - . gene_id "XLOC_005319"; transcript_id "TCONS_00005319"; exon_number "1"; oId "CUFF.5272.1"; tss_id "TSS5319"; +chr20 Cufflinks exon 36090350 36090384 . - . gene_id "XLOC_005320"; transcript_id "TCONS_00005320"; exon_number "1"; oId "CUFF.5276.1"; tss_id "TSS5320"; +chr20 Cufflinks exon 36603558 36603883 . - . gene_id "XLOC_005321"; transcript_id "TCONS_00005321"; exon_number "1"; oId "CUFF.5277.1"; tss_id "TSS5321"; +chr20 Cufflinks exon 36726862 36727102 . - . gene_id "XLOC_005322"; transcript_id "TCONS_00005322"; exon_number "1"; oId "CUFF.5278.1"; tss_id "TSS5322"; +chr20 Cufflinks exon 37131550 37131638 . - . gene_id "XLOC_005323"; transcript_id "TCONS_00005323"; exon_number "1"; oId "CUFF.5279.1"; tss_id "TSS5323"; +chr20 Cufflinks exon 37847592 37847750 . - . gene_id "XLOC_005324"; transcript_id "TCONS_00005324"; exon_number "1"; oId "CUFF.5283.1"; tss_id "TSS5324"; +chr20 Cufflinks exon 37977724 37978035 . - . gene_id "XLOC_005325"; transcript_id "TCONS_00005325"; exon_number "1"; oId "CUFF.5284.1"; tss_id "TSS5325"; +chr20 Cufflinks exon 38691522 38691568 . - . gene_id "XLOC_005326"; transcript_id "TCONS_00005326"; exon_number "1"; oId "CUFF.5286.1"; tss_id "TSS5326"; +chr20 Cufflinks exon 39482779 39482869 . - . gene_id "XLOC_005327"; transcript_id "TCONS_00005327"; exon_number "1"; oId "CUFF.5287.1"; tss_id "TSS5327"; +chr20 Cufflinks exon 39918907 39919216 . - . gene_id "XLOC_005328"; transcript_id "TCONS_00005328"; exon_number "1"; oId "CUFF.5289.1"; tss_id "TSS5328"; +chr20 Cufflinks exon 39998290 39998354 . - . gene_id "XLOC_005329"; transcript_id "TCONS_00005329"; exon_number "1"; oId "CUFF.5290.1"; tss_id "TSS5329"; +chr20 Cufflinks exon 40313636 40313730 . - . gene_id "XLOC_005330"; transcript_id "TCONS_00005330"; exon_number "1"; oId "CUFF.5291.1"; tss_id "TSS5330"; +chr20 Cufflinks exon 42425077 42425183 . - . gene_id "XLOC_005331"; transcript_id "TCONS_00005331"; exon_number "1"; oId "CUFF.5298.1"; tss_id "TSS5331"; +chr20 Cufflinks exon 43509455 43509775 . - . gene_id "XLOC_005332"; transcript_id "TCONS_00005332"; exon_number "1"; oId "CUFF.5304.1"; tss_id "TSS5332"; +chr20 Cufflinks exon 44188395 44188511 . - . gene_id "XLOC_005333"; transcript_id "TCONS_00005333"; exon_number "1"; oId "CUFF.5306.1"; tss_id "TSS5333"; +chr20 Cufflinks exon 45112774 45112879 . - . gene_id "XLOC_005334"; transcript_id "TCONS_00005334"; exon_number "1"; oId "CUFF.5307.1"; tss_id "TSS5334"; +chr20 Cufflinks exon 45869600 45869716 . - . gene_id "XLOC_005335"; transcript_id "TCONS_00005335"; exon_number "1"; oId "CUFF.5309.1"; tss_id "TSS5335"; +chr20 Cufflinks exon 46089434 46089467 . - . gene_id "XLOC_005336"; transcript_id "TCONS_00005336"; exon_number "1"; oId "CUFF.5310.1"; tss_id "TSS5336"; +chr20 Cufflinks exon 46113025 46113124 . - . gene_id "XLOC_005337"; transcript_id "TCONS_00005337"; exon_number "1"; oId "CUFF.5312.1"; tss_id "TSS5337"; +chr20 Cufflinks exon 46121729 46121828 . - . gene_id "XLOC_005338"; transcript_id "TCONS_00005338"; exon_number "1"; oId "CUFF.5313.1"; tss_id "TSS5338"; +chr20 Cufflinks exon 46455739 46455788 . - . gene_id "XLOC_005339"; transcript_id "TCONS_00005339"; exon_number "1"; oId "CUFF.5314.1"; tss_id "TSS5339"; +chr20 Cufflinks exon 47122506 47122555 . - . gene_id "XLOC_005340"; transcript_id "TCONS_00005340"; exon_number "1"; oId "CUFF.5317.1"; tss_id "TSS5340"; +chr20 Cufflinks exon 47709398 47709450 . - . gene_id "XLOC_005341"; transcript_id "TCONS_00005341"; exon_number "1"; oId "CUFF.5318.1"; tss_id "TSS5341"; +chr20 Cufflinks exon 48556832 48556938 . - . gene_id "XLOC_005342"; transcript_id "TCONS_00005342"; exon_number "1"; oId "CUFF.5325.1"; tss_id "TSS5342"; +chr20 Cufflinks exon 48952342 48952423 . - . gene_id "XLOC_005343"; transcript_id "TCONS_00005343"; exon_number "1"; oId "CUFF.5327.1"; tss_id "TSS5343"; +chr20 Cufflinks exon 49045708 49046020 . - . gene_id "XLOC_005344"; transcript_id "TCONS_00005344"; exon_number "1"; oId "CUFF.5328.1"; tss_id "TSS5344"; +chr20 Cufflinks exon 49174195 49174534 . - . gene_id "XLOC_005345"; transcript_id "TCONS_00005345"; exon_number "1"; oId "CUFF.5329.1"; tss_id "TSS5345"; +chr20 Cufflinks exon 49421152 49421193 . - . gene_id "XLOC_005346"; transcript_id "TCONS_00005346"; exon_number "1"; oId "CUFF.5330.1"; tss_id "TSS5346"; +chr20 Cufflinks exon 52285237 52285296 . - . gene_id "XLOC_005347"; transcript_id "TCONS_00005347"; exon_number "1"; oId "CUFF.5335.1"; tss_id "TSS5347"; +chr20 Cufflinks exon 52518340 52518475 . - . gene_id "XLOC_005348"; transcript_id "TCONS_00005348"; exon_number "1"; oId "CUFF.5336.1"; tss_id "TSS5348"; +chr20 Cufflinks exon 54780138 54780229 . - . gene_id "XLOC_005349"; transcript_id "TCONS_00005349"; exon_number "1"; oId "CUFF.5338.1"; tss_id "TSS5349"; +chr20 Cufflinks exon 55361037 55361143 . - . gene_id "XLOC_005350"; transcript_id "TCONS_00005350"; exon_number "1"; oId "CUFF.5344.1"; tss_id "TSS5350"; +chr20 Cufflinks exon 55912852 55912922 . - . gene_id "XLOC_005351"; transcript_id "TCONS_00005351"; exon_number "1"; oId "CUFF.5345.1"; tss_id "TSS5351"; +chr20 Cufflinks exon 55933425 55933502 . - . gene_id "XLOC_005352"; transcript_id "TCONS_00005352"; exon_number "1"; oId "CUFF.5346.1"; tss_id "TSS5352"; +chr20 Cufflinks exon 56671546 56671580 . - . gene_id "XLOC_005353"; transcript_id "TCONS_00005353"; exon_number "1"; oId "CUFF.5348.1"; tss_id "TSS5353"; +chr20 Cufflinks exon 58427724 58427781 . - . gene_id "XLOC_005354"; transcript_id "TCONS_00005354"; exon_number "1"; oId "CUFF.5351.1"; tss_id "TSS5354"; +chr20 Cufflinks exon 60096670 60096730 . - . gene_id "XLOC_005355"; transcript_id "TCONS_00005355"; exon_number "1"; oId "CUFF.5352.1"; tss_id "TSS5355"; +chr20 Cufflinks exon 60392557 60392615 . - . gene_id "XLOC_005356"; transcript_id "TCONS_00005356"; exon_number "1"; oId "CUFF.5353.1"; tss_id "TSS5356"; +chr21 Cufflinks exon 9827005 9827578 . + . gene_id "XLOC_005357"; transcript_id "TCONS_00005357"; exon_number "1"; oId "CUFF.5357.1"; tss_id "TSS5357"; +chr21 Cufflinks exon 14419904 14420008 . + . gene_id "XLOC_005358"; transcript_id "TCONS_00005358"; exon_number "1"; oId "CUFF.5360.1"; tss_id "TSS5358"; +chr21 Cufflinks exon 14688013 14688049 . + . gene_id "XLOC_005359"; transcript_id "TCONS_00005359"; exon_number "1"; oId "CUFF.5361.1"; tss_id "TSS5359"; +chr21 Cufflinks exon 14993898 14994003 . + . gene_id "XLOC_005360"; transcript_id "TCONS_00005360"; exon_number "1"; oId "CUFF.5362.1"; tss_id "TSS5360"; +chr21 Cufflinks exon 15443192 15443309 . + . gene_id "XLOC_005361"; transcript_id "TCONS_00005361"; exon_number "1"; oId "CUFF.5365.1"; tss_id "TSS5361"; +chr21 Cufflinks exon 15527457 15527494 . + . gene_id "XLOC_005362"; transcript_id "TCONS_00005362"; exon_number "1"; oId "CUFF.5367.1"; tss_id "TSS5362"; +chr21 Cufflinks exon 16833199 16833296 . + . gene_id "XLOC_005363"; transcript_id "TCONS_00005363"; exon_number "1"; oId "CUFF.5368.1"; tss_id "TSS5363"; +chr21 Cufflinks exon 16986603 16986707 . + . gene_id "XLOC_005364"; transcript_id "TCONS_00005364"; exon_number "1"; oId "CUFF.5369.1"; tss_id "TSS5364"; +chr21 Cufflinks exon 17080977 17081083 . + . gene_id "XLOC_005365"; transcript_id "TCONS_00005365"; exon_number "1"; oId "CUFF.5370.1"; tss_id "TSS5365"; +chr21 Cufflinks exon 17267634 17267691 . + . gene_id "XLOC_005366"; transcript_id "TCONS_00005366"; exon_number "1"; oId "CUFF.5371.1"; tss_id "TSS5366"; +chr21 Cufflinks exon 18091319 18091477 . + . gene_id "XLOC_005367"; transcript_id "TCONS_00005367"; exon_number "1"; oId "CUFF.5373.1"; tss_id "TSS5367"; +chr21 Cufflinks exon 18735037 18735108 . + . gene_id "XLOC_005368"; transcript_id "TCONS_00005368"; exon_number "1"; oId "CUFF.5375.1"; tss_id "TSS5368"; +chr21 Cufflinks exon 18803874 18803965 . + . gene_id "XLOC_005369"; transcript_id "TCONS_00005369"; exon_number "1"; oId "CUFF.5376.1"; tss_id "TSS5369"; +chr21 Cufflinks exon 18824998 18825050 . + . gene_id "XLOC_005370"; transcript_id "TCONS_00005370"; exon_number "1"; oId "CUFF.5377.1"; tss_id "TSS5370"; +chr21 Cufflinks exon 20195359 20195394 . + . gene_id "XLOC_005371"; transcript_id "TCONS_00005371"; exon_number "1"; oId "CUFF.5382.1"; tss_id "TSS5371"; +chr21 Cufflinks exon 20426588 20426628 . + . gene_id "XLOC_005372"; transcript_id "TCONS_00005372"; exon_number "1"; oId "CUFF.5383.1"; tss_id "TSS5372"; +chr21 Cufflinks exon 20717465 20717630 . + . gene_id "XLOC_005373"; transcript_id "TCONS_00005373"; exon_number "1"; oId "CUFF.5384.1"; tss_id "TSS5373"; +chr21 Cufflinks exon 21108437 21108472 . + . gene_id "XLOC_005374"; transcript_id "TCONS_00005374"; exon_number "1"; oId "CUFF.5385.1"; tss_id "TSS5374"; +chr21 Cufflinks exon 21728966 21729139 . + . gene_id "XLOC_005375"; transcript_id "TCONS_00005375"; exon_number "1"; oId "CUFF.5388.1"; tss_id "TSS5375"; +chr21 Cufflinks exon 21908132 21908164 . + . gene_id "XLOC_005376"; transcript_id "TCONS_00005376"; exon_number "1"; oId "CUFF.5389.1"; tss_id "TSS5376"; +chr21 Cufflinks exon 21999577 21999629 . + . gene_id "XLOC_005377"; transcript_id "TCONS_00005377"; exon_number "1"; oId "CUFF.5390.1"; tss_id "TSS5377"; +chr21 Cufflinks exon 22807013 22807046 . + . gene_id "XLOC_005378"; transcript_id "TCONS_00005378"; exon_number "1"; oId "CUFF.5391.1"; tss_id "TSS5378"; +chr21 Cufflinks exon 23099384 23099415 . + . gene_id "XLOC_005379"; transcript_id "TCONS_00005379"; exon_number "1"; oId "CUFF.5392.1"; tss_id "TSS5379"; +chr21 Cufflinks exon 23577513 23577654 . + . gene_id "XLOC_005380"; transcript_id "TCONS_00005380"; exon_number "1"; oId "CUFF.5393.1"; tss_id "TSS5380"; +chr21 Cufflinks exon 26473445 26473683 . + . gene_id "XLOC_005381"; transcript_id "TCONS_00005381"; exon_number "1"; oId "CUFF.5395.1"; tss_id "TSS5381"; +chr21 Cufflinks exon 26479054 26479094 . + . gene_id "XLOC_005382"; transcript_id "TCONS_00005382"; exon_number "1"; oId "CUFF.5396.1"; tss_id "TSS5382"; +chr21 Cufflinks exon 26574521 26574610 . + . gene_id "XLOC_005383"; transcript_id "TCONS_00005383"; exon_number "1"; oId "CUFF.5398.1"; tss_id "TSS5383"; +chr21 Cufflinks exon 27228059 27228147 . + . gene_id "XLOC_005384"; transcript_id "TCONS_00005384"; exon_number "1"; oId "CUFF.5400.1"; tss_id "TSS5384"; +chr21 Cufflinks exon 27504484 27504555 . + . gene_id "XLOC_005385"; transcript_id "TCONS_00005385"; exon_number "1"; oId "CUFF.5402.1"; tss_id "TSS5385"; +chr21 Cufflinks exon 27563026 27563132 . + . gene_id "XLOC_005386"; transcript_id "TCONS_00005386"; exon_number "1"; oId "CUFF.5403.1"; tss_id "TSS5386"; +chr21 Cufflinks exon 27718849 27718945 . + . gene_id "XLOC_005387"; transcript_id "TCONS_00005387"; exon_number "1"; oId "CUFF.5404.1"; tss_id "TSS5387"; +chr21 Cufflinks exon 28284983 28285023 . + . gene_id "XLOC_005388"; transcript_id "TCONS_00005388"; exon_number "1"; oId "CUFF.5406.1"; tss_id "TSS5388"; +chr21 Cufflinks exon 30115526 30115612 . + . gene_id "XLOC_005389"; transcript_id "TCONS_00005389"; exon_number "1"; oId "CUFF.5408.1"; tss_id "TSS5389"; +chr21 Cufflinks exon 30342574 30342629 . + . gene_id "XLOC_005390"; transcript_id "TCONS_00005390"; exon_number "1"; oId "CUFF.5409.1"; tss_id "TSS5390"; +chr21 Cufflinks exon 31154797 31155001 . + . gene_id "XLOC_005391"; transcript_id "TCONS_00005391"; exon_number "1"; oId "CUFF.5413.1"; tss_id "TSS5391"; +chr21 Cufflinks exon 31672345 31672455 . + . gene_id "XLOC_005392"; transcript_id "TCONS_00005392"; exon_number "1"; oId "CUFF.5414.1"; tss_id "TSS5392"; +chr21 Cufflinks exon 32607119 32607148 . + . gene_id "XLOC_005393"; transcript_id "TCONS_00005393"; exon_number "1"; oId "CUFF.5415.1"; tss_id "TSS5393"; +chr21 Cufflinks exon 33868923 33868960 . + . gene_id "XLOC_005394"; transcript_id "TCONS_00005394"; exon_number "1"; oId "CUFF.5420.1"; tss_id "TSS5394"; +chr21 Cufflinks exon 33935388 33935474 . + . gene_id "XLOC_005395"; transcript_id "TCONS_00005395"; exon_number "1"; oId "CUFF.5421.1"; tss_id "TSS5395"; +chr21 Cufflinks exon 34279598 34279698 . + . gene_id "XLOC_005396"; transcript_id "TCONS_00005396"; exon_number "1"; oId "CUFF.5422.1"; tss_id "TSS5396"; +chr21 Cufflinks exon 35615231 35615265 . + . gene_id "XLOC_005397"; transcript_id "TCONS_00005397"; exon_number "1"; oId "CUFF.5428.1"; tss_id "TSS5397"; +chr21 Cufflinks exon 36901859 36901913 . + . gene_id "XLOC_005398"; transcript_id "TCONS_00005398"; exon_number "1"; oId "CUFF.5430.1"; tss_id "TSS5398"; +chr21 Cufflinks exon 37012237 37012277 . + . gene_id "XLOC_005399"; transcript_id "TCONS_00005399"; exon_number "1"; oId "CUFF.5431.1"; tss_id "TSS5399"; +chr21 Cufflinks exon 37273509 37273552 . + . gene_id "XLOC_005400"; transcript_id "TCONS_00005400"; exon_number "1"; oId "CUFF.5432.1"; tss_id "TSS5400"; +chr21 Cufflinks exon 37438843 37438944 . + . gene_id "XLOC_005401"; transcript_id "TCONS_00005401"; exon_number "1"; oId "CUFF.5433.1"; tss_id "TSS5401"; +chr21 Cufflinks exon 38224211 38224329 . + . gene_id "XLOC_005402"; transcript_id "TCONS_00005402"; exon_number "1"; oId "CUFF.5436.1"; tss_id "TSS5402"; +chr21 Cufflinks exon 38417831 38417933 . + . gene_id "XLOC_005403"; transcript_id "TCONS_00005403"; exon_number "1"; oId "CUFF.5437.1"; tss_id "TSS5403"; +chr21 Cufflinks exon 38587906 38588218 . + . gene_id "XLOC_005404"; transcript_id "TCONS_00005404"; exon_number "1"; oId "CUFF.5438.1"; tss_id "TSS5404"; +chr21 Cufflinks exon 38636345 38636412 . + . gene_id "XLOC_005405"; transcript_id "TCONS_00005405"; exon_number "1"; oId "CUFF.5439.1"; tss_id "TSS5405"; +chr21 Cufflinks exon 39194581 39194623 . + . gene_id "XLOC_005406"; transcript_id "TCONS_00005406"; exon_number "1"; oId "CUFF.5441.1"; tss_id "TSS5406"; +chr21 Cufflinks exon 40257604 40257676 . + . gene_id "XLOC_005407"; transcript_id "TCONS_00005407"; exon_number "1"; oId "CUFF.5443.1"; tss_id "TSS5407"; +chr21 Cufflinks exon 41300089 41300129 . + . gene_id "XLOC_005408"; transcript_id "TCONS_00005408"; exon_number "1"; oId "CUFF.5447.1"; tss_id "TSS5408"; +chr21 Cufflinks exon 42133675 42133745 . + . gene_id "XLOC_005409"; transcript_id "TCONS_00005409"; exon_number "1"; oId "CUFF.5448.1"; tss_id "TSS5409"; +chr21 Cufflinks exon 43641287 43641397 . + . gene_id "XLOC_005410"; transcript_id "TCONS_00005410"; exon_number "1"; oId "CUFF.5450.1"; tss_id "TSS5410"; +chr21 Cufflinks exon 45250833 45250888 . + . gene_id "XLOC_005411"; transcript_id "TCONS_00005411"; exon_number "1"; oId "CUFF.5454.1"; tss_id "TSS5411"; +chr21 Cufflinks exon 46664114 46664167 . + . gene_id "XLOC_005412"; transcript_id "TCONS_00005412"; exon_number "1"; oId "CUFF.5457.1"; tss_id "TSS5412"; +chr21 Cufflinks exon 47945532 47945633 . + . gene_id "XLOC_005413"; transcript_id "TCONS_00005413"; exon_number "1"; oId "CUFF.5458.1"; tss_id "TSS5413"; +chr21 Cufflinks exon 47955709 47956005 . + . gene_id "XLOC_005414"; transcript_id "TCONS_00005414"; exon_number "1"; oId "CUFF.5459.1"; tss_id "TSS5414"; +chr21 Cufflinks exon 10380358 10380657 . - . gene_id "XLOC_005415"; transcript_id "TCONS_00005415"; exon_number "1"; oId "CUFF.5358.1"; tss_id "TSS5415"; +chr21 Cufflinks exon 10944285 10944350 . - . gene_id "XLOC_005416"; transcript_id "TCONS_00005416"; exon_number "1"; oId "CUFF.5359.1"; tss_id "TSS5416"; +chr21 Cufflinks exon 15340811 15340916 . - . gene_id "XLOC_005417"; transcript_id "TCONS_00005417"; exon_number "1"; oId "CUFF.5363.1"; tss_id "TSS5417"; +chr21 Cufflinks exon 15419865 15419906 . - . gene_id "XLOC_005418"; transcript_id "TCONS_00005418"; exon_number "1"; oId "CUFF.5364.1"; tss_id "TSS5418"; +chr21 Cufflinks exon 15456973 15457585 . - . gene_id "XLOC_005419"; transcript_id "TCONS_00005419"; exon_number "1"; oId "CUFF.5366.1"; tss_id "TSS5419"; +chr21 Cufflinks exon 17407734 17407832 . - . gene_id "XLOC_005420"; transcript_id "TCONS_00005420"; exon_number "1"; oId "CUFF.5372.1"; tss_id "TSS5420"; +chr21 Cufflinks exon 18223196 18223239 . - . gene_id "XLOC_005421"; transcript_id "TCONS_00005421"; exon_number "1"; oId "CUFF.5374.1"; tss_id "TSS5421"; +chr21 Cufflinks exon 18827104 18827177 . - . gene_id "XLOC_005422"; transcript_id "TCONS_00005422"; exon_number "1"; oId "CUFF.5378.1"; tss_id "TSS5422"; +chr21 Cufflinks exon 18946329 18946362 . - . gene_id "XLOC_005423"; transcript_id "TCONS_00005423"; exon_number "1"; oId "CUFF.5379.1"; tss_id "TSS5423"; +chr21 Cufflinks exon 18989719 18989749 . - . gene_id "XLOC_005424"; transcript_id "TCONS_00005424"; exon_number "1"; oId "CUFF.5380.1"; tss_id "TSS5424"; +chr21 Cufflinks exon 19374788 19374922 . - . gene_id "XLOC_005425"; transcript_id "TCONS_00005425"; exon_number "1"; oId "CUFF.5381.1"; tss_id "TSS5425"; +chr21 Cufflinks exon 21425662 21425694 . - . gene_id "XLOC_005426"; transcript_id "TCONS_00005426"; exon_number "1"; oId "CUFF.5386.1"; tss_id "TSS5426"; +chr21 Cufflinks exon 21728060 21728164 . - . gene_id "XLOC_005427"; transcript_id "TCONS_00005427"; exon_number "1"; oId "CUFF.5387.1"; tss_id "TSS5427"; +chr21 Cufflinks exon 24654178 24654231 . - . gene_id "XLOC_005428"; transcript_id "TCONS_00005428"; exon_number "1"; oId "CUFF.5394.1"; tss_id "TSS5428"; +chr21 Cufflinks exon 26530179 26530216 . - . gene_id "XLOC_005429"; transcript_id "TCONS_00005429"; exon_number "1"; oId "CUFF.5397.1"; tss_id "TSS5429"; +chr21 Cufflinks exon 26842419 26842514 . - . gene_id "XLOC_005430"; transcript_id "TCONS_00005430"; exon_number "1"; oId "CUFF.5399.1"; tss_id "TSS5430"; +chr21 Cufflinks exon 27315363 27315463 . - . gene_id "XLOC_005431"; transcript_id "TCONS_00005431"; exon_number "1"; oId "CUFF.5401.1"; tss_id "TSS5431"; +chr21 Cufflinks exon 27770601 27770639 . - . gene_id "XLOC_005432"; transcript_id "TCONS_00005432"; exon_number "1"; oId "CUFF.5405.1"; tss_id "TSS5432"; +chr21 Cufflinks exon 28654498 28654609 . - . gene_id "XLOC_005433"; transcript_id "TCONS_00005433"; exon_number "1"; oId "CUFF.5407.1"; tss_id "TSS5433"; +chr21 Cufflinks exon 30552746 30552960 . - . gene_id "XLOC_005434"; transcript_id "TCONS_00005434"; exon_number "1"; oId "CUFF.5410.1"; tss_id "TSS5434"; +chr21 Cufflinks exon 30580387 30580428 . - . gene_id "XLOC_005435"; transcript_id "TCONS_00005435"; exon_number "1"; oId "CUFF.5411.1"; tss_id "TSS5435"; +chr21 Cufflinks exon 30761704 30761811 . - . gene_id "XLOC_005436"; transcript_id "TCONS_00005436"; exon_number "1"; oId "CUFF.5412.1"; tss_id "TSS5436"; +chr21 Cufflinks exon 33083344 33083417 . - . gene_id "XLOC_005437"; transcript_id "TCONS_00005437"; exon_number "1"; oId "CUFF.5416.1"; tss_id "TSS5437"; +chr21 Cufflinks exon 33396005 33396042 . - . gene_id "XLOC_005438"; transcript_id "TCONS_00005438"; exon_number "1"; oId "CUFF.5417.1"; tss_id "TSS5438"; +chr21 Cufflinks exon 33714775 33715062 . - . gene_id "XLOC_005439"; transcript_id "TCONS_00005439"; exon_number "1"; oId "CUFF.5418.1"; tss_id "TSS5439"; +chr21 Cufflinks exon 33856170 33856215 . - . gene_id "XLOC_005440"; transcript_id "TCONS_00005440"; exon_number "1"; oId "CUFF.5419.1"; tss_id "TSS5440"; +chr21 Cufflinks exon 34883098 34883148 . - . gene_id "XLOC_005441"; transcript_id "TCONS_00005441"; exon_number "1"; oId "CUFF.5423.1"; tss_id "TSS5441"; +chr21 Cufflinks exon 35106564 35106595 . - . gene_id "XLOC_005442"; transcript_id "TCONS_00005442"; exon_number "1"; oId "CUFF.5424.1"; tss_id "TSS5442"; +chr21 Cufflinks exon 35145671 35145764 . - . gene_id "XLOC_005443"; transcript_id "TCONS_00005443"; exon_number "1"; oId "CUFF.5425.1"; tss_id "TSS5443"; +chr21 Cufflinks exon 35290990 35291099 . - . gene_id "XLOC_005444"; transcript_id "TCONS_00005444"; exon_number "1"; oId "CUFF.5426.1"; tss_id "TSS5444"; +chr21 Cufflinks exon 35291416 35291641 . - . gene_id "XLOC_005445"; transcript_id "TCONS_00005445"; exon_number "1"; oId "CUFF.5427.1"; tss_id "TSS5445"; +chr21 Cufflinks exon 36062346 36062436 . - . gene_id "XLOC_005446"; transcript_id "TCONS_00005446"; exon_number "1"; oId "CUFF.5429.1"; tss_id "TSS5446"; +chr21 Cufflinks exon 37630726 37630830 . - . gene_id "XLOC_005447"; transcript_id "TCONS_00005447"; exon_number "1"; oId "CUFF.5434.1"; tss_id "TSS5447"; +chr21 Cufflinks exon 37725742 37725777 . - . gene_id "XLOC_005448"; transcript_id "TCONS_00005448"; exon_number "1"; oId "CUFF.5435.1"; tss_id "TSS5448"; +chr21 Cufflinks exon 39001382 39001423 . - . gene_id "XLOC_005449"; transcript_id "TCONS_00005449"; exon_number "1"; oId "CUFF.5440.1"; tss_id "TSS5449"; +chr21 Cufflinks exon 39559549 39559657 . - . gene_id "XLOC_005450"; transcript_id "TCONS_00005450"; exon_number "1"; oId "CUFF.5442.1"; tss_id "TSS5450"; +chr21 Cufflinks exon 40625857 40625892 . - . gene_id "XLOC_005451"; transcript_id "TCONS_00005451"; exon_number "1"; oId "CUFF.5444.1"; tss_id "TSS5451"; +chr21 Cufflinks exon 40717274 40717384 . - . gene_id "XLOC_005452"; transcript_id "TCONS_00005452"; exon_number "1"; oId "CUFF.5445.1"; tss_id "TSS5452"; +chr21 Cufflinks exon 40722819 40723036 . - . gene_id "XLOC_005453"; transcript_id "TCONS_00005453"; exon_number "1"; oId "CUFF.5446.1"; tss_id "TSS5453"; +chr21 Cufflinks exon 43024743 43024831 . - . gene_id "XLOC_005454"; transcript_id "TCONS_00005454"; exon_number "1"; oId "CUFF.5449.1"; tss_id "TSS5454"; +chr21 Cufflinks exon 43824377 43824430 . - . gene_id "XLOC_005455"; transcript_id "TCONS_00005455"; exon_number "1"; oId "CUFF.5451.1"; tss_id "TSS5455"; +chr21 Cufflinks exon 43837636 43837702 . - . gene_id "XLOC_005456"; transcript_id "TCONS_00005456"; exon_number "1"; oId "CUFF.5452.1"; tss_id "TSS5456"; +chr21 Cufflinks exon 45128125 45128187 . - . gene_id "XLOC_005457"; transcript_id "TCONS_00005457"; exon_number "1"; oId "CUFF.5453.1"; tss_id "TSS5457"; +chr21 Cufflinks exon 45339676 45339781 . - . gene_id "XLOC_005458"; transcript_id "TCONS_00005458"; exon_number "1"; oId "CUFF.5455.1"; tss_id "TSS5458"; +chr21 Cufflinks exon 45416203 45416285 . - . gene_id "XLOC_005459"; transcript_id "TCONS_00005459"; exon_number "1"; oId "CUFF.5456.1"; tss_id "TSS5459"; +chr22 Cufflinks exon 17062944 17062981 . + . gene_id "XLOC_005460"; transcript_id "TCONS_00005460"; exon_number "1"; oId "CUFF.5461.1"; tss_id "TSS5460"; +chr22 Cufflinks exon 19353288 19353588 . + . gene_id "XLOC_005461"; transcript_id "TCONS_00005461"; exon_number "1"; oId "CUFF.5467.1"; tss_id "TSS5461"; +chr22 Cufflinks exon 20465452 20465649 . + . gene_id "XLOC_005462"; transcript_id "TCONS_00005462"; exon_number "1"; oId "CUFF.5472.1"; tss_id "TSS5462"; +chr22 Cufflinks exon 20772685 20772952 . + . gene_id "XLOC_005463"; transcript_id "TCONS_00005463"; exon_number "1"; oId "CUFF.5474.1"; tss_id "TSS5463"; +chr22 Cufflinks exon 21265392 21265525 . + . gene_id "XLOC_005464"; transcript_id "TCONS_00005464"; exon_number "1"; oId "CUFF.5477.1"; tss_id "TSS5464"; +chr22 Cufflinks exon 21300933 21301002 . + . gene_id "XLOC_005465"; transcript_id "TCONS_00005465"; exon_number "1"; oId "CUFF.5478.1"; tss_id "TSS5465"; +chr22 Cufflinks exon 21743480 21743717 . + . gene_id "XLOC_005466"; transcript_id "TCONS_00005466"; exon_number "1"; oId "CUFF.5480.1"; tss_id "TSS5466"; +chr22 Cufflinks exon 21765338 21765413 . + . gene_id "XLOC_005467"; transcript_id "TCONS_00005467"; exon_number "1"; oId "CUFF.5481.1"; tss_id "TSS5467"; +chr22 Cufflinks exon 21765714 21765763 . + . gene_id "XLOC_005468"; transcript_id "TCONS_00005468"; exon_number "1"; oId "CUFF.5482.1"; tss_id "TSS5468"; +chr22 Cufflinks exon 21909431 21909628 . + . gene_id "XLOC_005469"; transcript_id "TCONS_00005469"; exon_number "1"; oId "CUFF.5486.1"; tss_id "TSS5469"; +chr22 Cufflinks exon 22055723 22055752 . + . gene_id "XLOC_005470"; transcript_id "TCONS_00005470"; exon_number "1"; oId "CUFF.5487.1"; tss_id "TSS5470"; +chr22 Cufflinks exon 22146729 22146810 . + . gene_id "XLOC_005471"; transcript_id "TCONS_00005471"; exon_number "1"; oId "CUFF.5489.1"; tss_id "TSS5471"; +chr22 Cufflinks exon 22210545 22210856 . + . gene_id "XLOC_005472"; transcript_id "TCONS_00005472"; exon_number "1"; oId "CUFF.5490.1"; tss_id "TSS5472"; +chr22 Cufflinks exon 22872115 22872214 . + . gene_id "XLOC_005473"; transcript_id "TCONS_00005473"; exon_number "1"; oId "CUFF.5491.1"; tss_id "TSS5473"; +chr22 Cufflinks exon 23697967 23698141 . + . gene_id "XLOC_005474"; transcript_id "TCONS_00005474"; exon_number "1"; oId "CUFF.5499.1"; tss_id "TSS5474"; +chr22 Cufflinks exon 23757600 23757699 . + . gene_id "XLOC_005475"; transcript_id "TCONS_00005475"; exon_number "1"; oId "CUFF.5500.1"; tss_id "TSS5475"; +chr22 Cufflinks exon 23972734 23972777 . + . gene_id "XLOC_005476"; transcript_id "TCONS_00005476"; exon_number "1"; oId "CUFF.5501.1"; tss_id "TSS5476"; +chr22 Cufflinks exon 24732434 24732559 . + . gene_id "XLOC_005477"; transcript_id "TCONS_00005477"; exon_number "1"; oId "CUFF.5506.1"; tss_id "TSS5477"; +chr22 Cufflinks exon 25515264 25515312 . + . gene_id "XLOC_005478"; transcript_id "TCONS_00005478"; exon_number "1"; oId "CUFF.5507.1"; tss_id "TSS5478"; +chr22 Cufflinks exon 27057261 27057380 . + . gene_id "XLOC_005479"; transcript_id "TCONS_00005479"; exon_number "1"; oId "CUFF.5512.1"; tss_id "TSS5479"; +chr22 Cufflinks exon 27431863 27431943 . + . gene_id "XLOC_005480"; transcript_id "TCONS_00005480"; exon_number "1"; oId "CUFF.5515.1"; tss_id "TSS5480"; +chr22 Cufflinks exon 28086960 28086998 . + . gene_id "XLOC_005481"; transcript_id "TCONS_00005481"; exon_number "1"; oId "CUFF.5516.1"; tss_id "TSS5481"; +chr22 Cufflinks exon 28189339 28189382 . + . gene_id "XLOC_005482"; transcript_id "TCONS_00005482"; exon_number "1"; oId "CUFF.5517.1"; tss_id "TSS5482"; +chr22 Cufflinks exon 28496163 28496200 . + . gene_id "XLOC_005483"; transcript_id "TCONS_00005483"; exon_number "1"; oId "CUFF.5519.1"; tss_id "TSS5483"; +chr22 Cufflinks exon 29001532 29001635 . + . gene_id "XLOC_005484"; transcript_id "TCONS_00005484"; exon_number "1"; oId "CUFF.5520.1"; tss_id "TSS5484"; +chr22 Cufflinks exon 29530002 29530106 . + . gene_id "XLOC_005485"; transcript_id "TCONS_00005485"; exon_number "1"; oId "CUFF.5524.1"; tss_id "TSS5485"; +chr22 Cufflinks exon 30509990 30510051 . + . gene_id "XLOC_005486"; transcript_id "TCONS_00005486"; exon_number "1"; oId "CUFF.5530.1"; tss_id "TSS5486"; +chr22 Cufflinks exon 30817034 30817108 . + . gene_id "XLOC_005487"; transcript_id "TCONS_00005487"; exon_number "1"; oId "CUFF.5531.1"; tss_id "TSS5487"; +chr22 Cufflinks exon 31455975 31456284 . + . gene_id "XLOC_005488"; transcript_id "TCONS_00005488"; exon_number "1"; oId "CUFF.5532.1"; tss_id "TSS5488"; +chr22 Cufflinks exon 31611705 31611810 . + . gene_id "XLOC_005489"; transcript_id "TCONS_00005489"; exon_number "1"; oId "CUFF.5533.1"; tss_id "TSS5489"; +chr22 Cufflinks exon 31701390 31701479 . + . gene_id "XLOC_005490"; transcript_id "TCONS_00005490"; exon_number "1"; oId "CUFF.5535.1"; tss_id "TSS5490"; +chr22 Cufflinks exon 32153188 32153501 . + . gene_id "XLOC_005491"; transcript_id "TCONS_00005491"; exon_number "1"; oId "CUFF.5538.1"; tss_id "TSS5491"; +chr22 Cufflinks exon 32233224 32233284 . + . gene_id "XLOC_005492"; transcript_id "TCONS_00005492"; exon_number "1"; oId "CUFF.5539.1"; tss_id "TSS5492"; +chr22 Cufflinks exon 32349391 32349495 . + . gene_id "XLOC_005493"; transcript_id "TCONS_00005493"; exon_number "1"; oId "CUFF.5540.1"; tss_id "TSS5493"; +chr22 Cufflinks exon 34726677 34726711 . + . gene_id "XLOC_005494"; transcript_id "TCONS_00005494"; exon_number "1"; oId "CUFF.5545.1"; tss_id "TSS5494"; +chr22 Cufflinks exon 35645765 35645826 . + . gene_id "XLOC_005495"; transcript_id "TCONS_00005495"; exon_number "1"; oId "CUFF.5547.1"; tss_id "TSS5495"; +chr22 Cufflinks exon 36713015 36713159 . + . gene_id "XLOC_005496"; transcript_id "TCONS_00005496"; exon_number "1"; oId "CUFF.5551.1"; tss_id "TSS5496"; +chr22 Cufflinks exon 37008072 37008141 . + . gene_id "XLOC_005497"; transcript_id "TCONS_00005497"; exon_number "1"; oId "CUFF.5552.1"; tss_id "TSS5497"; +chr22 Cufflinks exon 37344521 37344599 . + . gene_id "XLOC_005498"; transcript_id "TCONS_00005498"; exon_number "1"; oId "CUFF.5553.1"; tss_id "TSS5498"; +chr22 Cufflinks exon 37345160 37345193 . + . gene_id "XLOC_005499"; transcript_id "TCONS_00005499"; exon_number "1"; oId "CUFF.5554.1"; tss_id "TSS5499"; +chr22 Cufflinks exon 38181532 38181610 . + . gene_id "XLOC_005500"; transcript_id "TCONS_00005500"; exon_number "1"; oId "CUFF.5557.1"; tss_id "TSS5500"; +chr22 Cufflinks exon 38287354 38287447 . + . gene_id "XLOC_005501"; transcript_id "TCONS_00005501"; exon_number "1"; oId "CUFF.5559.1"; tss_id "TSS5501"; +chr22 Cufflinks exon 38627727 38628006 . + . gene_id "XLOC_005502"; transcript_id "TCONS_00005502"; exon_number "1"; oId "CUFF.5560.1"; tss_id "TSS5502"; +chr22 Cufflinks exon 39139874 39139912 . + . gene_id "XLOC_005503"; transcript_id "TCONS_00005503"; exon_number "1"; oId "CUFF.5561.1"; tss_id "TSS5503"; +chr22 Cufflinks exon 39644734 39644831 . + . gene_id "XLOC_005504"; transcript_id "TCONS_00005504"; exon_number "1"; oId "CUFF.5562.1"; tss_id "TSS5504"; +chr22 Cufflinks exon 40681897 40681934 . + . gene_id "XLOC_005505"; transcript_id "TCONS_00005505"; exon_number "1"; oId "CUFF.5566.1"; tss_id "TSS5505"; +chr22 Cufflinks exon 40739119 40739168 . + . gene_id "XLOC_005506"; transcript_id "TCONS_00005506"; exon_number "1"; oId "CUFF.5567.1"; tss_id "TSS5506"; +chr22 Cufflinks exon 41043648 41043689 . + . gene_id "XLOC_005507"; transcript_id "TCONS_00005507"; exon_number "1"; oId "CUFF.5568.1"; tss_id "TSS5507"; +chr22 Cufflinks exon 41051850 41051944 . + . gene_id "XLOC_005508"; transcript_id "TCONS_00005508"; exon_number "1"; oId "CUFF.5569.1"; tss_id "TSS5508"; +chr22 Cufflinks exon 41124444 41124486 . + . gene_id "XLOC_005509"; transcript_id "TCONS_00005509"; exon_number "1"; oId "CUFF.5570.1"; tss_id "TSS5509"; +chr22 Cufflinks exon 41310882 41310989 . + . gene_id "XLOC_005510"; transcript_id "TCONS_00005510"; exon_number "1"; oId "CUFF.5572.1"; tss_id "TSS5510"; +chr22 Cufflinks exon 41313116 41313400 . + . gene_id "XLOC_005511"; transcript_id "TCONS_00005511"; exon_number "1"; oId "CUFF.5573.1"; tss_id "TSS5511"; +chr22 Cufflinks exon 41313747 41313846 . + . gene_id "XLOC_005512"; transcript_id "TCONS_00005512"; exon_number "1"; oId "CUFF.5574.1"; tss_id "TSS5512"; +chr22 Cufflinks exon 41564217 41564306 . + . gene_id "XLOC_005513"; transcript_id "TCONS_00005513"; exon_number "1"; oId "CUFF.5576.1"; tss_id "TSS5513"; +chr22 Cufflinks exon 41748427 41748482 . + . gene_id "XLOC_005514"; transcript_id "TCONS_00005514"; exon_number "1"; oId "CUFF.5577.1"; tss_id "TSS5514"; +chr22 Cufflinks exon 42075715 42075821 . + . gene_id "XLOC_005515"; transcript_id "TCONS_00005515"; exon_number "1"; oId "CUFF.5581.1"; tss_id "TSS5515"; +chr22 Cufflinks exon 43246133 43246169 . + . gene_id "XLOC_005516"; transcript_id "TCONS_00005516"; exon_number "1"; oId "CUFF.5588.1"; tss_id "TSS5516"; +chr22 Cufflinks exon 44546537 44546617 . + . gene_id "XLOC_005517"; transcript_id "TCONS_00005517"; exon_number "1"; oId "CUFF.5589.1"; tss_id "TSS5517"; +chr22 Cufflinks exon 46961872 46961951 . + . gene_id "XLOC_005518"; transcript_id "TCONS_00005518"; exon_number "1"; oId "CUFF.5592.1"; tss_id "TSS5518"; +chr22 Cufflinks exon 49923423 49923473 . + . gene_id "XLOC_005519"; transcript_id "TCONS_00005519"; exon_number "1"; oId "CUFF.5593.1"; tss_id "TSS5519"; +chr22 Cufflinks exon 50132335 50132572 . + . gene_id "XLOC_005520"; transcript_id "TCONS_00005520"; exon_number "1"; oId "CUFF.5594.1"; tss_id "TSS5520"; +chr22 Cufflinks exon 50809639 50809944 . + . gene_id "XLOC_005521"; transcript_id "TCONS_00005521"; exon_number "1"; oId "CUFF.5597.1"; tss_id "TSS5521"; +chr22 Cufflinks exon 50918730 50918940 . + . gene_id "XLOC_005522"; transcript_id "TCONS_00005522"; exon_number "1"; oId "CUFF.5598.1"; tss_id "TSS5522"; +chr22 Cufflinks exon 51101992 51102019 . + . gene_id "XLOC_005523"; transcript_id "TCONS_00005523"; exon_number "1"; oId "CUFF.5599.1"; tss_id "TSS5523"; +chr22 Cufflinks exon 51102289 51102319 . + . gene_id "XLOC_005524"; transcript_id "TCONS_00005524"; exon_number "1"; oId "CUFF.5600.1"; tss_id "TSS5524"; +chr22 Cufflinks exon 16276399 16276504 . - . gene_id "XLOC_005525"; transcript_id "TCONS_00005525"; exon_number "1"; oId "CUFF.5460.1"; tss_id "TSS5525"; +chr22 Cufflinks exon 17833745 17834067 . - . gene_id "XLOC_005526"; transcript_id "TCONS_00005526"; exon_number "1"; oId "CUFF.5462.1"; tss_id "TSS5526"; +chr22 Cufflinks exon 17861324 17861365 . - . gene_id "XLOC_005527"; transcript_id "TCONS_00005527"; exon_number "1"; oId "CUFF.5463.1"; tss_id "TSS5527"; +chr22 Cufflinks exon 18105845 18105904 . - . gene_id "XLOC_005528"; transcript_id "TCONS_00005528"; exon_number "1"; oId "CUFF.5464.1"; tss_id "TSS5528"; +chr22 Cufflinks exon 18124174 18124285 . - . gene_id "XLOC_005529"; transcript_id "TCONS_00005529"; exon_number "1"; oId "CUFF.5465.1"; tss_id "TSS5529"; +chr22 Cufflinks exon 19084224 19084303 . - . gene_id "XLOC_005530"; transcript_id "TCONS_00005530"; exon_number "1"; oId "CUFF.5466.1"; tss_id "TSS5530"; +chr22 Cufflinks exon 20116305 20116413 . - . gene_id "XLOC_005531"; transcript_id "TCONS_00005531"; exon_number "1"; oId "CUFF.5468.1"; tss_id "TSS5531"; +chr22 Cufflinks exon 20433730 20433779 . - . gene_id "XLOC_005532"; transcript_id "TCONS_00005532"; exon_number "1"; oId "CUFF.5469.1"; tss_id "TSS5532"; +chr22 Cufflinks exon 20434079 20434154 . - . gene_id "XLOC_005533"; transcript_id "TCONS_00005533"; exon_number "1"; oId "CUFF.5470.1"; tss_id "TSS5533"; +chr22 Cufflinks exon 20455732 20455969 . - . gene_id "XLOC_005534"; transcript_id "TCONS_00005534"; exon_number "1"; oId "CUFF.5471.1"; tss_id "TSS5534"; +chr22 Cufflinks exon 20771087 20771189 . - . gene_id "XLOC_005535"; transcript_id "TCONS_00005535"; exon_number "1"; oId "CUFF.5473.1"; tss_id "TSS5535"; +chr22 Cufflinks exon 20836199 20836500 . - . gene_id "XLOC_005536"; transcript_id "TCONS_00005536"; exon_number "1"; oId "CUFF.5475.1"; tss_id "TSS5536"; +chr22 Cufflinks exon 21130086 21130116 . - . gene_id "XLOC_005537"; transcript_id "TCONS_00005537"; exon_number "1"; oId "CUFF.5476.1"; tss_id "TSS5537"; +chr22 Cufflinks exon 21733789 21733986 . - . gene_id "XLOC_005538"; transcript_id "TCONS_00005538"; exon_number "1"; oId "CUFF.5479.1"; tss_id "TSS5538"; +chr22 Cufflinks exon 21877700 21877749 . - . gene_id "XLOC_005539"; transcript_id "TCONS_00005539"; exon_number "1"; oId "CUFF.5483.1"; tss_id "TSS5539"; +chr22 Cufflinks exon 21878049 21878124 . - . gene_id "XLOC_005540"; transcript_id "TCONS_00005540"; exon_number "1"; oId "CUFF.5484.1"; tss_id "TSS5540"; +chr22 Cufflinks exon 21899696 21899933 . - . gene_id "XLOC_005541"; transcript_id "TCONS_00005541"; exon_number "1"; oId "CUFF.5485.1"; tss_id "TSS5541"; +chr22 Cufflinks exon 22077163 22077451 . - . gene_id "XLOC_005542"; transcript_id "TCONS_00005542"; exon_number "1"; oId "CUFF.5488.1"; tss_id "TSS5542"; +chr22 Cufflinks exon 23218223 23218263 . - . gene_id "XLOC_005543"; transcript_id "TCONS_00005543"; exon_number "1"; oId "CUFF.5492.1"; tss_id "TSS5543"; +chr22 Cufflinks exon 23469877 23469918 . - . gene_id "XLOC_005544"; transcript_id "TCONS_00005544"; exon_number "1"; oId "CUFF.5493.1"; tss_id "TSS5544"; +chr22 Cufflinks exon 23474900 23475187 . - . gene_id "XLOC_005545"; transcript_id "TCONS_00005545"; exon_number "1"; oId "CUFF.5494.1"; tss_id "TSS5545"; +chr22 Cufflinks exon 23479997 23480050 . - . gene_id "XLOC_005546"; transcript_id "TCONS_00005546"; exon_number "1"; oId "CUFF.5495.1"; tss_id "TSS5546"; +chr22 Cufflinks exon 23513051 23513149 . - . gene_id "XLOC_005547"; transcript_id "TCONS_00005547"; exon_number "1"; oId "CUFF.5496.1"; tss_id "TSS5547"; +chr22 Cufflinks exon 23513453 23513663 . - . gene_id "XLOC_005548"; transcript_id "TCONS_00005548"; exon_number "1"; oId "CUFF.5497.1"; tss_id "TSS5548"; +chr22 Cufflinks exon 23603957 23604248 . - . gene_id "XLOC_005549"; transcript_id "TCONS_00005549"; exon_number "1"; oId "CUFF.5498.1"; tss_id "TSS5549"; +chr22 Cufflinks exon 24221328 24221435 . - . gene_id "XLOC_005550"; transcript_id "TCONS_00005550"; exon_number "1"; oId "CUFF.5502.1"; tss_id "TSS5550"; +chr22 Cufflinks exon 24221752 24221977 . - . gene_id "XLOC_005551"; transcript_id "TCONS_00005551"; exon_number "1"; oId "CUFF.5503.1"; tss_id "TSS5551"; +chr22 Cufflinks exon 24253629 24253709 . - . gene_id "XLOC_005552"; transcript_id "TCONS_00005552"; exon_number "1"; oId "CUFF.5504.1"; tss_id "TSS5552"; +chr22 Cufflinks exon 24349560 24349631 . - . gene_id "XLOC_005553"; transcript_id "TCONS_00005553"; exon_number "1"; oId "CUFF.5505.1"; tss_id "TSS5553"; +chr22 Cufflinks exon 25727372 25727415 . - . gene_id "XLOC_005554"; transcript_id "TCONS_00005554"; exon_number "1"; oId "CUFF.5508.1"; tss_id "TSS5554"; +chr22 Cufflinks exon 26111046 26111136 . - . gene_id "XLOC_005555"; transcript_id "TCONS_00005555"; exon_number "1"; oId "CUFF.5509.1"; tss_id "TSS5555"; +chr22 Cufflinks exon 26360023 26360239 . - . gene_id "XLOC_005556"; transcript_id "TCONS_00005556"; exon_number "1"; oId "CUFF.5510.1"; tss_id "TSS5556"; +chr22 Cufflinks exon 26786621 26786748 . - . gene_id "XLOC_005557"; transcript_id "TCONS_00005557"; exon_number "1"; oId "CUFF.5511.1"; tss_id "TSS5557"; +chr22 Cufflinks exon 27314981 27315016 . - . gene_id "XLOC_005558"; transcript_id "TCONS_00005558"; exon_number "1"; oId "CUFF.5513.1"; tss_id "TSS5558"; +chr22 Cufflinks exon 27424408 27424441 . - . gene_id "XLOC_005559"; transcript_id "TCONS_00005559"; exon_number "1"; oId "CUFF.5514.1"; tss_id "TSS5559"; +chr22 Cufflinks exon 28452132 28452427 . - . gene_id "XLOC_005560"; transcript_id "TCONS_00005560"; exon_number "1"; oId "CUFF.5518.1"; tss_id "TSS5560"; +chr22 Cufflinks exon 29038947 29039258 . - . gene_id "XLOC_005561"; transcript_id "TCONS_00005561"; exon_number "1"; oId "CUFF.5521.1"; tss_id "TSS5561"; +chr22 Cufflinks exon 29254151 29254222 . - . gene_id "XLOC_005562"; transcript_id "TCONS_00005562"; exon_number "1"; oId "CUFF.5522.1"; tss_id "TSS5562"; +chr22 Cufflinks exon 29328787 29328822 . - . gene_id "XLOC_005563"; transcript_id "TCONS_00005563"; exon_number "1"; oId "CUFF.5523.1"; tss_id "TSS5563"; +chr22 Cufflinks exon 29587732 29587796 . - . gene_id "XLOC_005564"; transcript_id "TCONS_00005564"; exon_number "1"; oId "CUFF.5525.1"; tss_id "TSS5564"; +chr22 Cufflinks exon 30222063 30222113 . - . gene_id "XLOC_005565"; transcript_id "TCONS_00005565"; exon_number "1"; oId "CUFF.5526.1"; tss_id "TSS5565"; +chr22 Cufflinks exon 30295578 30295682 . - . gene_id "XLOC_005566"; transcript_id "TCONS_00005566"; exon_number "1"; oId "CUFF.5527.1"; tss_id "TSS5566"; +chr22 Cufflinks exon 30306777 30306841 . - . gene_id "XLOC_005567"; transcript_id "TCONS_00005567"; exon_number "1"; oId "CUFF.5528.1"; tss_id "TSS5567"; +chr22 Cufflinks exon 30335678 30335719 . - . gene_id "XLOC_005568"; transcript_id "TCONS_00005568"; exon_number "1"; oId "CUFF.5529.1"; tss_id "TSS5568"; +chr22 Cufflinks exon 31618745 31618834 . - . gene_id "XLOC_005569"; transcript_id "TCONS_00005569"; exon_number "1"; oId "CUFF.5534.1"; tss_id "TSS5569"; +chr22 Cufflinks exon 31784719 31784823 . - . gene_id "XLOC_005570"; transcript_id "TCONS_00005570"; exon_number "1"; oId "CUFF.5536.1"; tss_id "TSS5570"; +chr22 Cufflinks exon 31875371 31875474 . - . gene_id "XLOC_005571"; transcript_id "TCONS_00005571"; exon_number "1"; oId "CUFF.5537.1"; tss_id "TSS5571"; +chr22 Cufflinks exon 32377115 32377402 . - . gene_id "XLOC_005572"; transcript_id "TCONS_00005572"; exon_number "1"; oId "CUFF.5541.1"; tss_id "TSS5572"; +chr22 Cufflinks exon 32917950 32917984 . - . gene_id "XLOC_005573"; transcript_id "TCONS_00005573"; exon_number "1"; oId "CUFF.5542.1"; tss_id "TSS5573"; +chr22 Cufflinks exon 33031096 33031184 . - . gene_id "XLOC_005574"; transcript_id "TCONS_00005574"; exon_number "1"; oId "CUFF.5543.1"; tss_id "TSS5574"; +chr22 Cufflinks exon 33816271 33816312 . - . gene_id "XLOC_005575"; transcript_id "TCONS_00005575"; exon_number "1"; oId "CUFF.5544.1"; tss_id "TSS5575"; +chr22 Cufflinks exon 34979653 34979688 . - . gene_id "XLOC_005576"; transcript_id "TCONS_00005576"; exon_number "1"; oId "CUFF.5546.1"; tss_id "TSS5576"; +chr22 Cufflinks exon 35777777 35777843 . - . gene_id "XLOC_005577"; transcript_id "TCONS_00005577"; exon_number "1"; oId "CUFF.5548.1"; tss_id "TSS5577"; +chr22 Cufflinks exon 36568834 36568905 . - . gene_id "XLOC_005578"; transcript_id "TCONS_00005578"; exon_number "1"; oId "CUFF.5549.1"; tss_id "TSS5578"; +chr22 Cufflinks exon 36575506 36575577 . - . gene_id "XLOC_005579"; transcript_id "TCONS_00005579"; exon_number "1"; oId "CUFF.5550.1"; tss_id "TSS5579"; +chr22 Cufflinks exon 37451148 37451387 . - . gene_id "XLOC_005580"; transcript_id "TCONS_00005580"; exon_number "1"; oId "CUFF.5555.1"; tss_id "TSS5580"; +chr22 Cufflinks exon 38065471 38065746 . - . gene_id "XLOC_005581"; transcript_id "TCONS_00005581"; exon_number "1"; oId "CUFF.5556.1"; tss_id "TSS5581"; +chr22 Cufflinks exon 38275746 38275809 . - . gene_id "XLOC_005582"; transcript_id "TCONS_00005582"; exon_number "1"; oId "CUFF.5558.1"; tss_id "TSS5582"; +chr22 Cufflinks exon 40203437 40203472 . - . gene_id "XLOC_005583"; transcript_id "TCONS_00005583"; exon_number "1"; oId "CUFF.5563.1"; tss_id "TSS5583"; +chr22 Cufflinks exon 40270305 40270506 . - . gene_id "XLOC_005584"; transcript_id "TCONS_00005584"; exon_number "1"; oId "CUFF.5564.1"; tss_id "TSS5584"; +chr22 Cufflinks exon 40492992 40493113 . - . gene_id "XLOC_005585"; transcript_id "TCONS_00005585"; exon_number "1"; oId "CUFF.5565.1"; tss_id "TSS5585"; +chr22 Cufflinks exon 41291691 41291744 . - . gene_id "XLOC_005586"; transcript_id "TCONS_00005586"; exon_number "1"; oId "CUFF.5571.1"; tss_id "TSS5586"; +chr22 Cufflinks exon 41446911 41447007 . - . gene_id "XLOC_005587"; transcript_id "TCONS_00005587"; exon_number "1"; oId "CUFF.5575.1"; tss_id "TSS5587"; +chr22 Cufflinks exon 41773201 41773287 . - . gene_id "XLOC_005588"; transcript_id "TCONS_00005588"; exon_number "1"; oId "CUFF.5578.1"; tss_id "TSS5588"; +chr22 Cufflinks exon 42032864 42032935 . - . gene_id "XLOC_005589"; transcript_id "TCONS_00005589"; exon_number "1"; oId "CUFF.5579.1"; tss_id "TSS5589"; +chr22 Cufflinks exon 42046407 42046485 . - . gene_id "XLOC_005590"; transcript_id "TCONS_00005590"; exon_number "1"; oId "CUFF.5580.1"; tss_id "TSS5590"; +chr22 Cufflinks exon 42281931 42281966 . - . gene_id "XLOC_005591"; transcript_id "TCONS_00005591"; exon_number "1"; oId "CUFF.5582.1"; tss_id "TSS5591"; +chr22 Cufflinks exon 42286081 42286163 . - . gene_id "XLOC_005592"; transcript_id "TCONS_00005592"; exon_number "1"; oId "CUFF.5583.1"; tss_id "TSS5592"; +chr22 Cufflinks exon 42472060 42472166 . - . gene_id "XLOC_005593"; transcript_id "TCONS_00005593"; exon_number "1"; oId "CUFF.5584.1"; tss_id "TSS5593"; +chr22 Cufflinks exon 42530234 42530285 . - . gene_id "XLOC_005594"; transcript_id "TCONS_00005594"; exon_number "1"; oId "CUFF.5585.1"; tss_id "TSS5594"; +chr22 Cufflinks exon 42961068 42961333 . - . gene_id "XLOC_005595"; transcript_id "TCONS_00005595"; exon_number "1"; oId "CUFF.5586.1"; tss_id "TSS5595"; +chr22 Cufflinks exon 42965156 42965256 . - . gene_id "XLOC_005596"; transcript_id "TCONS_00005596"; exon_number "1"; oId "CUFF.5587.1"; tss_id "TSS5596"; +chr22 Cufflinks exon 45667700 45667732 . - . gene_id "XLOC_005597"; transcript_id "TCONS_00005597"; exon_number "1"; oId "CUFF.5590.1"; tss_id "TSS5597"; +chr22 Cufflinks exon 46020411 46020511 . - . gene_id "XLOC_005598"; transcript_id "TCONS_00005598"; exon_number "1"; oId "CUFF.5591.1"; tss_id "TSS5598"; +chr22 Cufflinks exon 50229814 50229869 . - . gene_id "XLOC_005599"; transcript_id "TCONS_00005599"; exon_number "1"; oId "CUFF.5595.1"; tss_id "TSS5599"; +chr22 Cufflinks exon 50446136 50446190 . - . gene_id "XLOC_005600"; transcript_id "TCONS_00005600"; exon_number "1"; oId "CUFF.5596.1"; tss_id "TSS5600"; +chr22 Cufflinks exon 51129690 51129791 . - . gene_id "XLOC_005601"; transcript_id "TCONS_00005601"; exon_number "1"; oId "CUFF.5601.1"; tss_id "TSS5601"; +chr3 Cufflinks exon 1794995 1795030 . + . gene_id "XLOC_005602"; transcript_id "TCONS_00005602"; exon_number "1"; oId "CUFF.5606.1"; tss_id "TSS5602"; +chr3 Cufflinks exon 2717701 2717744 . + . gene_id "XLOC_005603"; transcript_id "TCONS_00005603"; exon_number "1"; oId "CUFF.5608.1"; tss_id "TSS5603"; +chr3 Cufflinks exon 4122439 4122514 . + . gene_id "XLOC_005604"; transcript_id "TCONS_00005604"; exon_number "1"; oId "CUFF.5609.1"; tss_id "TSS5604"; +chr3 Cufflinks exon 5066429 5066480 . + . gene_id "XLOC_005605"; transcript_id "TCONS_00005605"; exon_number "1"; oId "CUFF.5613.1"; tss_id "TSS5605"; +chr3 Cufflinks exon 6150001 6150038 . + . gene_id "XLOC_005606"; transcript_id "TCONS_00005606"; exon_number "1"; oId "CUFF.5615.1"; tss_id "TSS5606"; +chr3 Cufflinks exon 8157422 8157454 . + . gene_id "XLOC_005607"; transcript_id "TCONS_00005607"; exon_number "1"; oId "CUFF.5616.1"; tss_id "TSS5607"; +chr3 Cufflinks exon 8709667 8709712 . + . gene_id "XLOC_005608"; transcript_id "TCONS_00005608"; exon_number "1"; oId "CUFF.5617.1"; tss_id "TSS5608"; +chr3 Cufflinks exon 9416007 9416133 . + . gene_id "XLOC_005609"; transcript_id "TCONS_00005609"; exon_number "1"; oId "CUFF.5620.1"; tss_id "TSS5609"; +chr3 Cufflinks exon 9613701 9613770 . + . gene_id "XLOC_005610"; transcript_id "TCONS_00005610"; exon_number "1"; oId "CUFF.5621.1"; tss_id "TSS5610"; +chr3 Cufflinks exon 10079236 10079335 . + . gene_id "XLOC_005611"; transcript_id "TCONS_00005611"; exon_number "1"; oId "CUFF.5623.1"; tss_id "TSS5611"; +chr3 Cufflinks exon 10175073 10175175 . + . gene_id "XLOC_005612"; transcript_id "TCONS_00005612"; exon_number "1"; oId "CUFF.5624.1"; tss_id "TSS5612"; +chr3 Cufflinks exon 10182836 10182934 . + . gene_id "XLOC_005613"; transcript_id "TCONS_00005613"; exon_number "1"; oId "CUFF.5625.1"; tss_id "TSS5613"; +chr3 Cufflinks exon 10258896 10258973 . + . gene_id "XLOC_005614"; transcript_id "TCONS_00005614"; exon_number "1"; oId "CUFF.5626.1"; tss_id "TSS5614"; +chr3 Cufflinks exon 12206414 12206475 . + . gene_id "XLOC_005615"; transcript_id "TCONS_00005615"; exon_number "1"; oId "CUFF.5629.1"; tss_id "TSS5615"; +chr3 Cufflinks exon 12556212 12556303 . + . gene_id "XLOC_005616"; transcript_id "TCONS_00005616"; exon_number "1"; oId "CUFF.5633.1"; tss_id "TSS5616"; +chr3 Cufflinks exon 12674232 12674336 . + . gene_id "XLOC_005617"; transcript_id "TCONS_00005617"; exon_number "1"; oId "CUFF.5634.1"; tss_id "TSS5617"; +chr3 Cufflinks exon 14436148 14436259 . + . gene_id "XLOC_005618"; transcript_id "TCONS_00005618"; exon_number "1"; oId "CUFF.5635.1"; tss_id "TSS5618"; +chr3 Cufflinks exon 15097196 15097242 . + . gene_id "XLOC_005619"; transcript_id "TCONS_00005619"; exon_number "1"; oId "CUFF.5638.1"; tss_id "TSS5619"; +chr3 Cufflinks exon 15252973 15253048 . + . gene_id "XLOC_005620"; transcript_id "TCONS_00005620"; exon_number "1"; oId "CUFF.5639.1"; tss_id "TSS5620"; +chr3 Cufflinks exon 15345125 15345190 . + . gene_id "XLOC_005621"; transcript_id "TCONS_00005621"; exon_number "1"; oId "CUFF.5640.1"; tss_id "TSS5621"; +chr3 Cufflinks exon 15358126 15358232 . + . gene_id "XLOC_005622"; transcript_id "TCONS_00005622"; exon_number "1"; oId "CUFF.5642.1"; tss_id "TSS5622"; +chr3 Cufflinks exon 15381256 15381357 . + . gene_id "XLOC_005623"; transcript_id "TCONS_00005623"; exon_number "1"; oId "CUFF.5643.1"; tss_id "TSS5623"; +chr3 Cufflinks exon 15780027 15780227 . + . gene_id "XLOC_005624"; transcript_id "TCONS_00005624"; exon_number "1"; oId "CUFF.5647.1"; tss_id "TSS5624"; +chr3 Cufflinks exon 17706459 17706516 . + . gene_id "XLOC_005625"; transcript_id "TCONS_00005625"; exon_number "1"; oId "CUFF.5654.1"; tss_id "TSS5625"; +chr3 Cufflinks exon 18189731 18189770 . + . gene_id "XLOC_005626"; transcript_id "TCONS_00005626"; exon_number "1"; oId "CUFF.5656.1"; tss_id "TSS5626"; +chr3 Cufflinks exon 18271203 18271389 . + . gene_id "XLOC_005627"; transcript_id "TCONS_00005627"; exon_number "1"; oId "CUFF.5657.1"; tss_id "TSS5627"; +chr3 Cufflinks exon 19375848 19375950 . + . gene_id "XLOC_005628"; transcript_id "TCONS_00005628"; exon_number "1"; oId "CUFF.5660.1"; tss_id "TSS5628"; +chr3 Cufflinks exon 19867444 19867485 . + . gene_id "XLOC_005629"; transcript_id "TCONS_00005629"; exon_number "1"; oId "CUFF.5661.1"; tss_id "TSS5629"; +chr3 Cufflinks exon 20038295 20038414 . + . gene_id "XLOC_005630"; transcript_id "TCONS_00005630"; exon_number "1"; oId "CUFF.5662.1"; tss_id "TSS5630"; +chr3 Cufflinks exon 21507509 21507551 . + . gene_id "XLOC_005631"; transcript_id "TCONS_00005631"; exon_number "1"; oId "CUFF.5665.1"; tss_id "TSS5631"; +chr3 Cufflinks exon 23487471 23487523 . + . gene_id "XLOC_005632"; transcript_id "TCONS_00005632"; exon_number "1"; oId "CUFF.5669.1"; tss_id "TSS5632"; +chr3 Cufflinks exon 23768084 23768153 . + . gene_id "XLOC_005633"; transcript_id "TCONS_00005633"; exon_number "1"; oId "CUFF.5672.1"; tss_id "TSS5633"; +chr3 Cufflinks exon 24063079 24063140 . + . gene_id "XLOC_005634"; transcript_id "TCONS_00005634"; exon_number "1"; oId "CUFF.5673.1"; tss_id "TSS5634"; +chr3 Cufflinks exon 25066498 25066584 . + . gene_id "XLOC_005635"; transcript_id "TCONS_00005635"; exon_number "1"; oId "CUFF.5675.1"; tss_id "TSS5635"; +chr3 Cufflinks exon 25377484 25377546 . + . gene_id "XLOC_005636"; transcript_id "TCONS_00005636"; exon_number "1"; oId "CUFF.5676.1"; tss_id "TSS5636"; +chr3 Cufflinks exon 25659341 25659401 . + . gene_id "XLOC_005637"; transcript_id "TCONS_00005637"; exon_number "1"; oId "CUFF.5678.1"; tss_id "TSS5637"; +chr3 Cufflinks exon 26257577 26257647 . + . gene_id "XLOC_005638"; transcript_id "TCONS_00005638"; exon_number "1"; oId "CUFF.5680.1"; tss_id "TSS5638"; +chr3 Cufflinks exon 27555362 27555525 . + . gene_id "XLOC_005639"; transcript_id "TCONS_00005639"; exon_number "1"; oId "CUFF.5684.1"; tss_id "TSS5639"; +chr3 Cufflinks exon 27558845 27558889 . + . gene_id "XLOC_005640"; transcript_id "TCONS_00005640"; exon_number "1"; oId "CUFF.5685.1"; tss_id "TSS5640"; +chr3 Cufflinks exon 27884754 27884790 . + . gene_id "XLOC_005641"; transcript_id "TCONS_00005641"; exon_number "1"; oId "CUFF.5686.1"; tss_id "TSS5641"; +chr3 Cufflinks exon 27965358 27965460 . + . gene_id "XLOC_005642"; transcript_id "TCONS_00005642"; exon_number "1"; oId "CUFF.5688.1"; tss_id "TSS5642"; +chr3 Cufflinks exon 28345644 28345693 . + . gene_id "XLOC_005643"; transcript_id "TCONS_00005643"; exon_number "1"; oId "CUFF.5690.1"; tss_id "TSS5643"; +chr3 Cufflinks exon 31098505 31098540 . + . gene_id "XLOC_005644"; transcript_id "TCONS_00005644"; exon_number "1"; oId "CUFF.5695.1"; tss_id "TSS5644"; +chr3 Cufflinks exon 31114352 31114384 . + . gene_id "XLOC_005645"; transcript_id "TCONS_00005645"; exon_number "1"; oId "CUFF.5696.1"; tss_id "TSS5645"; +chr3 Cufflinks exon 31118187 31118242 . + . gene_id "XLOC_005646"; transcript_id "TCONS_00005646"; exon_number "1"; oId "CUFF.5697.1"; tss_id "TSS5646"; +chr3 Cufflinks exon 31270207 31270295 . + . gene_id "XLOC_005647"; transcript_id "TCONS_00005647"; exon_number "1"; oId "CUFF.5698.1"; tss_id "TSS5647"; +chr3 Cufflinks exon 32043197 32043231 . + . gene_id "XLOC_005648"; transcript_id "TCONS_00005648"; exon_number "1"; oId "CUFF.5700.1"; tss_id "TSS5648"; +chr3 Cufflinks exon 32214147 32214250 . + . gene_id "XLOC_005649"; transcript_id "TCONS_00005649"; exon_number "1"; oId "CUFF.5701.1"; tss_id "TSS5649"; +chr3 Cufflinks exon 32717631 32717670 . + . gene_id "XLOC_005650"; transcript_id "TCONS_00005650"; exon_number "1"; oId "CUFF.5702.1"; tss_id "TSS5650"; +chr3 Cufflinks exon 33144500 33144806 . + . gene_id "XLOC_005651"; transcript_id "TCONS_00005651"; exon_number "1"; oId "CUFF.5706.1"; tss_id "TSS5651"; +chr3 Cufflinks exon 33455655 33455702 . + . gene_id "XLOC_005652"; transcript_id "TCONS_00005652"; exon_number "1"; oId "CUFF.5707.1"; tss_id "TSS5652"; +chr3 Cufflinks exon 33814874 33814910 . + . gene_id "XLOC_005653"; transcript_id "TCONS_00005653"; exon_number "1"; oId "CUFF.5709.1"; tss_id "TSS5653"; +chr3 Cufflinks exon 36726531 36726861 . + . gene_id "XLOC_005654"; transcript_id "TCONS_00005654"; exon_number "1"; oId "CUFF.5712.1"; tss_id "TSS5654"; +chr3 Cufflinks exon 37181818 37181910 . + . gene_id "XLOC_005655"; transcript_id "TCONS_00005655"; exon_number "1"; oId "CUFF.5713.1"; tss_id "TSS5655"; +chr3 Cufflinks exon 37224483 37224565 . + . gene_id "XLOC_005656"; transcript_id "TCONS_00005656"; exon_number "1"; oId "CUFF.5714.1"; tss_id "TSS5656"; +chr3 Cufflinks exon 37238231 37238338 . + . gene_id "XLOC_005657"; transcript_id "TCONS_00005657"; exon_number "1"; oId "CUFF.5715.1"; tss_id "TSS5657"; +chr3 Cufflinks exon 37383140 37383229 . + . gene_id "XLOC_005658"; transcript_id "TCONS_00005658"; exon_number "1"; oId "CUFF.5716.1"; tss_id "TSS5658"; +chr3 Cufflinks exon 39067478 39067584 . + . gene_id "XLOC_005659"; transcript_id "TCONS_00005659"; exon_number "1"; oId "CUFF.5719.1"; tss_id "TSS5659"; +chr3 Cufflinks exon 39382513 39382653 . + . gene_id "XLOC_005660"; transcript_id "TCONS_00005660"; exon_number "1"; oId "CUFF.5722.1"; tss_id "TSS5660"; +chr3 Cufflinks exon 39434448 39434482 . + . gene_id "XLOC_005661"; transcript_id "TCONS_00005661"; exon_number "1"; oId "CUFF.5723.1"; tss_id "TSS5661"; +chr3 Cufflinks exon 40011616 40011759 . + . gene_id "XLOC_005662"; transcript_id "TCONS_00005662"; exon_number "1"; oId "CUFF.5724.1"; tss_id "TSS5662"; +chr3 Cufflinks exon 40250496 40250800 . + . gene_id "XLOC_005663"; transcript_id "TCONS_00005663"; exon_number "1"; oId "CUFF.5725.1"; tss_id "TSS5663"; +chr3 Cufflinks exon 41297686 41297724 . + . gene_id "XLOC_005664"; transcript_id "TCONS_00005664"; exon_number "1"; oId "CUFF.5728.1"; tss_id "TSS5664"; +chr3 Cufflinks exon 42263332 42263460 . + . gene_id "XLOC_005665"; transcript_id "TCONS_00005665"; exon_number "1"; oId "CUFF.5733.1"; tss_id "TSS5665"; +chr3 Cufflinks exon 42370809 42370844 . + . gene_id "XLOC_005666"; transcript_id "TCONS_00005666"; exon_number "1"; oId "CUFF.5734.1"; tss_id "TSS5666"; +chr3 Cufflinks exon 43356443 43356757 . + . gene_id "XLOC_005667"; transcript_id "TCONS_00005667"; exon_number "1"; oId "CUFF.5736.1"; tss_id "TSS5667"; +chr3 Cufflinks exon 44112606 44112675 . + . gene_id "XLOC_005668"; transcript_id "TCONS_00005668"; exon_number "1"; oId "CUFF.5737.1"; tss_id "TSS5668"; +chr3 Cufflinks exon 44348109 44348157 . + . gene_id "XLOC_005669"; transcript_id "TCONS_00005669"; exon_number "1"; oId "CUFF.5738.1"; tss_id "TSS5669"; +chr3 Cufflinks exon 44431792 44431827 . + . gene_id "XLOC_005670"; transcript_id "TCONS_00005670"; exon_number "1"; oId "CUFF.5740.1"; tss_id "TSS5670"; +chr3 Cufflinks exon 44432122 44432152 . + . gene_id "XLOC_005671"; transcript_id "TCONS_00005671"; exon_number "1"; oId "CUFF.5741.1"; tss_id "TSS5671"; +chr3 Cufflinks exon 45784167 45784470 . + . gene_id "XLOC_005672"; transcript_id "TCONS_00005672"; exon_number "1"; oId "CUFF.5747.1"; tss_id "TSS5672"; +chr3 Cufflinks exon 46693774 46693815 . + . gene_id "XLOC_005673"; transcript_id "TCONS_00005673"; exon_number "1"; oId "CUFF.5749.1"; tss_id "TSS5673"; +chr3 Cufflinks exon 47130097 47130168 . + . gene_id "XLOC_005674"; transcript_id "TCONS_00005674"; exon_number "1"; oId "CUFF.5751.1"; tss_id "TSS5674"; +chr3 Cufflinks exon 47310647 47310725 . + . gene_id "XLOC_005675"; transcript_id "TCONS_00005675"; exon_number "1"; oId "CUFF.5753.1"; tss_id "TSS5675"; +chr3 Cufflinks exon 47507841 47507941 . + . gene_id "XLOC_005676"; transcript_id "TCONS_00005676"; exon_number "1"; oId "CUFF.5754.1"; tss_id "TSS5676"; +chr3 Cufflinks exon 48221819 48221879 . + . gene_id "XLOC_005677"; transcript_id "TCONS_00005677"; exon_number "1"; oId "CUFF.5757.1"; tss_id "TSS5677"; +chr3 Cufflinks exon 48421324 48421638 . + . gene_id "XLOC_005678"; transcript_id "TCONS_00005678"; exon_number "1"; oId "CUFF.5758.1"; tss_id "TSS5678"; +chr3 Cufflinks exon 48521763 48521802 . + . gene_id "XLOC_005679"; transcript_id "TCONS_00005679"; exon_number "1"; oId "CUFF.5759.1"; tss_id "TSS5679"; +chr3 Cufflinks exon 48789985 48790025 . + . gene_id "XLOC_005680"; transcript_id "TCONS_00005680"; exon_number "1"; oId "CUFF.5761.1"; tss_id "TSS5680"; +chr3 Cufflinks exon 48995473 48995524 . + . gene_id "XLOC_005681"; transcript_id "TCONS_00005681"; exon_number "1"; oId "CUFF.5763.1"; tss_id "TSS5681"; +chr3 Cufflinks exon 48995778 48995856 . + . gene_id "XLOC_005682"; transcript_id "TCONS_00005682"; exon_number "1"; oId "CUFF.5764.1"; tss_id "TSS5682"; +chr3 Cufflinks exon 49113652 49113955 . + . gene_id "XLOC_005683"; transcript_id "TCONS_00005683"; exon_number "1"; oId "CUFF.5765.1"; tss_id "TSS5683"; +chr3 Cufflinks exon 49120666 49120974 . + . gene_id "XLOC_005684"; transcript_id "TCONS_00005684"; exon_number "1"; oId "CUFF.5766.1"; tss_id "TSS5684"; +chr3 Cufflinks exon 49450186 49450251 . + . gene_id "XLOC_005685"; transcript_id "TCONS_00005685"; exon_number "1"; oId "CUFF.5768.1"; tss_id "TSS5685"; +chr3 Cufflinks exon 49475518 49475589 . + . gene_id "XLOC_005686"; transcript_id "TCONS_00005686"; exon_number "1"; oId "CUFF.5769.1"; tss_id "TSS5686"; +chr3 Cufflinks exon 49987457 49987902 . + . gene_id "XLOC_005687"; transcript_id "TCONS_00005687"; exon_number "1"; oId "CUFF.5773.1"; tss_id "TSS5687"; +chr3 Cufflinks exon 50457213 50457332 . + . gene_id "XLOC_005688"; transcript_id "TCONS_00005688"; exon_number "1"; oId "CUFF.5774.1"; tss_id "TSS5688"; +chr3 Cufflinks exon 50561993 50562034 . + . gene_id "XLOC_005689"; transcript_id "TCONS_00005689"; exon_number "1"; oId "CUFF.5775.1"; tss_id "TSS5689"; +chr3 Cufflinks exon 50795939 50795979 . + . gene_id "XLOC_005690"; transcript_id "TCONS_00005690"; exon_number "1"; oId "CUFF.5776.1"; tss_id "TSS5690"; +chr3 Cufflinks exon 51004103 51004302 . + . gene_id "XLOC_005691"; transcript_id "TCONS_00005691"; exon_number "1"; oId "CUFF.5778.1"; tss_id "TSS5691"; +chr3 Cufflinks exon 51906267 51906499 . + . gene_id "XLOC_005692"; transcript_id "TCONS_00005692"; exon_number "1"; oId "CUFF.5780.1"; tss_id "TSS5692"; +chr3 Cufflinks exon 53313646 53313700 . + . gene_id "XLOC_005693"; transcript_id "TCONS_00005693"; exon_number "1"; oId "CUFF.5782.1"; tss_id "TSS5693"; +chr3 Cufflinks exon 54417639 54417724 . + . gene_id "XLOC_005694"; transcript_id "TCONS_00005694"; exon_number "1"; oId "CUFF.5785.1"; tss_id "TSS5694"; +chr3 Cufflinks exon 54805084 54805266 . + . gene_id "XLOC_005695"; transcript_id "TCONS_00005695"; exon_number "1"; oId "CUFF.5786.1"; tss_id "TSS5695"; +chr3 Cufflinks exon 55801231 55801269 . + . gene_id "XLOC_005696"; transcript_id "TCONS_00005696"; exon_number "1"; oId "CUFF.5787.1"; tss_id "TSS5696"; +chr3 Cufflinks exon 56106132 56106369 . + . gene_id "XLOC_005697"; transcript_id "TCONS_00005697"; exon_number "1"; oId "CUFF.5788.1"; tss_id "TSS5697"; +chr3 Cufflinks exon 56219154 56219252 . + . gene_id "XLOC_005698"; transcript_id "TCONS_00005698"; exon_number "1"; oId "CUFF.5789.1"; tss_id "TSS5698"; +chr3 Cufflinks exon 57498177 57498282 . + . gene_id "XLOC_005699"; transcript_id "TCONS_00005699"; exon_number "1"; oId "CUFF.5791.1"; tss_id "TSS5699"; +chr3 Cufflinks exon 57534565 57534672 . + . gene_id "XLOC_005700"; transcript_id "TCONS_00005700"; exon_number "1"; oId "CUFF.5793.1"; tss_id "TSS5700"; +chr3 Cufflinks exon 57860203 57860306 . + . gene_id "XLOC_005701"; transcript_id "TCONS_00005701"; exon_number "1"; oId "CUFF.5795.1"; tss_id "TSS5701"; +chr3 Cufflinks exon 58439090 58439126 . + . gene_id "XLOC_005702"; transcript_id "TCONS_00005702"; exon_number "1"; oId "CUFF.5796.1"; tss_id "TSS5702"; +chr3 Cufflinks exon 59968237 59968277 . + . gene_id "XLOC_005703"; transcript_id "TCONS_00005703"; exon_number "1"; oId "CUFF.5797.1"; tss_id "TSS5703"; +chr3 Cufflinks exon 61244914 61244952 . + . gene_id "XLOC_005704"; transcript_id "TCONS_00005704"; exon_number "1"; oId "CUFF.5800.1"; tss_id "TSS5704"; +chr3 Cufflinks exon 62124439 62124471 . + . gene_id "XLOC_005705"; transcript_id "TCONS_00005705"; exon_number "1"; oId "CUFF.5803.1"; tss_id "TSS5705"; +chr3 Cufflinks exon 62330366 62330426 . + . gene_id "XLOC_005706"; transcript_id "TCONS_00005706"; exon_number "1"; oId "CUFF.5804.1"; tss_id "TSS5706"; +chr3 Cufflinks exon 62800063 62800162 . + . gene_id "XLOC_005707"; transcript_id "TCONS_00005707"; exon_number "1"; oId "CUFF.5806.1"; tss_id "TSS5707"; +chr3 Cufflinks exon 63531116 63531196 . + . gene_id "XLOC_005708"; transcript_id "TCONS_00005708"; exon_number "1"; oId "CUFF.5809.1"; tss_id "TSS5708"; +chr3 Cufflinks exon 64497430 64497530 . + . gene_id "XLOC_005709"; transcript_id "TCONS_00005709"; exon_number "1"; oId "CUFF.5813.1"; tss_id "TSS5709"; +chr3 Cufflinks exon 66062408 66062446 . + . gene_id "XLOC_005710"; transcript_id "TCONS_00005710"; exon_number "1"; oId "CUFF.5814.1"; tss_id "TSS5710"; +chr3 Cufflinks exon 66374280 66374556 . + . gene_id "XLOC_005711"; transcript_id "TCONS_00005711"; exon_number "1"; oId "CUFF.5816.1"; tss_id "TSS5711"; +chr3 Cufflinks exon 68907300 68907336 . + . gene_id "XLOC_005712"; transcript_id "TCONS_00005712"; exon_number "1"; oId "CUFF.5822.1"; tss_id "TSS5712"; +chr3 Cufflinks exon 68932119 68932196 . + . gene_id "XLOC_005713"; transcript_id "TCONS_00005713"; exon_number "1"; oId "CUFF.5823.1"; tss_id "TSS5713"; +chr3 Cufflinks exon 68994223 68994325 . + . gene_id "XLOC_005714"; transcript_id "TCONS_00005714"; exon_number "1"; oId "CUFF.5824.1"; tss_id "TSS5714"; +chr3 Cufflinks exon 69280185 69280280 . + . gene_id "XLOC_005715"; transcript_id "TCONS_00005715"; exon_number "1"; oId "CUFF.5826.1"; tss_id "TSS5715"; +chr3 Cufflinks exon 69762553 69762587 . + . gene_id "XLOC_005716"; transcript_id "TCONS_00005716"; exon_number "1"; oId "CUFF.5829.1"; tss_id "TSS5716"; +chr3 Cufflinks exon 70857501 70857603 . + . gene_id "XLOC_005717"; transcript_id "TCONS_00005717"; exon_number "1"; oId "CUFF.5831.1"; tss_id "TSS5717"; +chr3 Cufflinks exon 71876328 71876630 . + . gene_id "XLOC_005718"; transcript_id "TCONS_00005718"; exon_number "1"; oId "CUFF.5832.1"; tss_id "TSS5718"; +chr3 Cufflinks exon 71893389 71893436 . + . gene_id "XLOC_005719"; transcript_id "TCONS_00005719"; exon_number "1"; oId "CUFF.5833.1"; tss_id "TSS5719"; +chr3 Cufflinks exon 72298208 72298260 . + . gene_id "XLOC_005720"; transcript_id "TCONS_00005720"; exon_number "1"; oId "CUFF.5834.1"; tss_id "TSS5720"; +chr3 Cufflinks exon 72622115 72622222 . + . gene_id "XLOC_005721"; transcript_id "TCONS_00005721"; exon_number "1"; oId "CUFF.5835.1"; tss_id "TSS5721"; +chr3 Cufflinks exon 72625847 72626004 . + . gene_id "XLOC_005722"; transcript_id "TCONS_00005722"; exon_number "1"; oId "CUFF.5836.1"; tss_id "TSS5722"; +chr3 Cufflinks exon 72794948 72794987 . + . gene_id "XLOC_005723"; transcript_id "TCONS_00005723"; exon_number "1"; oId "CUFF.5839.1"; tss_id "TSS5723"; +chr3 Cufflinks exon 72848113 72848163 . + . gene_id "XLOC_005724"; transcript_id "TCONS_00005724"; exon_number "1"; oId "CUFF.5840.1"; tss_id "TSS5724"; +chr3 Cufflinks exon 73076960 73077023 . + . gene_id "XLOC_005725"; transcript_id "TCONS_00005725"; exon_number "1"; oId "CUFF.5841.1"; tss_id "TSS5725"; +chr3 Cufflinks exon 73131137 73131244 . + . gene_id "XLOC_005726"; transcript_id "TCONS_00005726"; exon_number "1"; oId "CUFF.5842.1"; tss_id "TSS5726"; +chr3 Cufflinks exon 73160145 73160329 . + . gene_id "XLOC_005727"; transcript_id "TCONS_00005727"; exon_number "1"; oId "CUFF.5844.1"; tss_id "TSS5727"; +chr3 Cufflinks exon 73580630 73580853 . + . gene_id "XLOC_005728"; transcript_id "TCONS_00005728"; exon_number "1"; oId "CUFF.5847.1"; tss_id "TSS5728"; +chr3 Cufflinks exon 77141208 77141300 . + . gene_id "XLOC_005729"; transcript_id "TCONS_00005729"; exon_number "1"; oId "CUFF.5851.1"; tss_id "TSS5729"; +chr3 Cufflinks exon 78164309 78164625 . + . gene_id "XLOC_005730"; transcript_id "TCONS_00005730"; exon_number "1"; oId "CUFF.5853.1"; tss_id "TSS5730"; +chr3 Cufflinks exon 78210849 78211142 . + . gene_id "XLOC_005731"; transcript_id "TCONS_00005731"; exon_number "1"; oId "CUFF.5854.1"; tss_id "TSS5731"; +chr3 Cufflinks exon 79159066 79159105 . + . gene_id "XLOC_005732"; transcript_id "TCONS_00005732"; exon_number "1"; oId "CUFF.5856.1"; tss_id "TSS5732"; +chr3 Cufflinks exon 79836883 79836967 . + . gene_id "XLOC_005733"; transcript_id "TCONS_00005733"; exon_number "1"; oId "CUFF.5857.1"; tss_id "TSS5733"; +chr3 Cufflinks exon 81320943 81320990 . + . gene_id "XLOC_005734"; transcript_id "TCONS_00005734"; exon_number "1"; oId "CUFF.5860.1"; tss_id "TSS5734"; +chr3 Cufflinks exon 81558628 81558689 . + . gene_id "XLOC_005735"; transcript_id "TCONS_00005735"; exon_number "1"; oId "CUFF.5861.1"; tss_id "TSS5735"; +chr3 Cufflinks exon 84169350 84169453 . + . gene_id "XLOC_005736"; transcript_id "TCONS_00005736"; exon_number "1"; oId "CUFF.5863.1"; tss_id "TSS5736"; +chr3 Cufflinks exon 86284472 86284574 . + . gene_id "XLOC_005737"; transcript_id "TCONS_00005737"; exon_number "1"; oId "CUFF.5866.1"; tss_id "TSS5737"; +chr3 Cufflinks exon 86411282 86411545 . + . gene_id "XLOC_005738"; transcript_id "TCONS_00005738"; exon_number "1"; oId "CUFF.5867.1"; tss_id "TSS5738"; +chr3 Cufflinks exon 87752527 87752562 . + . gene_id "XLOC_005739"; transcript_id "TCONS_00005739"; exon_number "1"; oId "CUFF.5870.1"; tss_id "TSS5739"; +chr3 Cufflinks exon 89637790 89637857 . + . gene_id "XLOC_005740"; transcript_id "TCONS_00005740"; exon_number "1"; oId "CUFF.5873.1"; tss_id "TSS5740"; +chr3 Cufflinks exon 90079434 90079645 . + . gene_id "XLOC_005741"; transcript_id "TCONS_00005741"; exon_number "1"; oId "CUFF.5875.1"; tss_id "TSS5741"; +chr3 Cufflinks exon 90233784 90233860 . + . gene_id "XLOC_005742"; transcript_id "TCONS_00005742"; exon_number "1"; oId "CUFF.5876.1"; tss_id "TSS5742"; +chr3 Cufflinks exon 90475385 90475432 . + . gene_id "XLOC_005743"; transcript_id "TCONS_00005743"; exon_number "1"; oId "CUFF.5877.1"; tss_id "TSS5743"; +chr3 Cufflinks exon 93562608 93562684 . + . gene_id "XLOC_005744"; transcript_id "TCONS_00005744"; exon_number "1"; oId "CUFF.5878.1"; tss_id "TSS5744"; +chr3 Cufflinks exon 93695873 93695974 . + . gene_id "XLOC_005745"; transcript_id "TCONS_00005745"; exon_number "1"; oId "CUFF.5879.1"; tss_id "TSS5745"; +chr3 Cufflinks exon 94257307 94257351 . + . gene_id "XLOC_005746"; transcript_id "TCONS_00005746"; exon_number "1"; oId "CUFF.5882.1"; tss_id "TSS5746"; +chr3 Cufflinks exon 97298633 97298667 . + . gene_id "XLOC_005747"; transcript_id "TCONS_00005747"; exon_number "1"; oId "CUFF.5884.1"; tss_id "TSS5747"; +chr3 Cufflinks exon 97752845 97752909 . + . gene_id "XLOC_005748"; transcript_id "TCONS_00005748"; exon_number "1"; oId "CUFF.5885.1"; tss_id "TSS5748"; +chr3 Cufflinks exon 98055197 98055230 . + . gene_id "XLOC_005749"; transcript_id "TCONS_00005749"; exon_number "1"; oId "CUFF.5886.1"; tss_id "TSS5749"; +chr3 Cufflinks exon 98627303 98627408 . + . gene_id "XLOC_005750"; transcript_id "TCONS_00005750"; exon_number "1"; oId "CUFF.5889.1"; tss_id "TSS5750"; +chr3 Cufflinks exon 98706232 98706286 . + . gene_id "XLOC_005751"; transcript_id "TCONS_00005751"; exon_number "1"; oId "CUFF.5890.1"; tss_id "TSS5751"; +chr3 Cufflinks exon 98802349 98802385 . + . gene_id "XLOC_005752"; transcript_id "TCONS_00005752"; exon_number "1"; oId "CUFF.5891.1"; tss_id "TSS5752"; +chr3 Cufflinks exon 100671471 100671576 . + . gene_id "XLOC_005753"; transcript_id "TCONS_00005753"; exon_number "1"; oId "CUFF.5894.1"; tss_id "TSS5753"; +chr3 Cufflinks exon 100772728 100772762 . + . gene_id "XLOC_005754"; transcript_id "TCONS_00005754"; exon_number "1"; oId "CUFF.5895.1"; tss_id "TSS5754"; +chr3 Cufflinks exon 100920676 100920782 . + . gene_id "XLOC_005755"; transcript_id "TCONS_00005755"; exon_number "1"; oId "CUFF.5897.1"; tss_id "TSS5755"; +chr3 Cufflinks exon 101220998 101221104 . + . gene_id "XLOC_005756"; transcript_id "TCONS_00005756"; exon_number "1"; oId "CUFF.5898.1"; tss_id "TSS5756"; +chr3 Cufflinks exon 101334671 101334771 . + . gene_id "XLOC_005757"; transcript_id "TCONS_00005757"; exon_number "1"; oId "CUFF.5899.1"; tss_id "TSS5757"; +chr3 Cufflinks exon 102441716 102441773 . + . gene_id "XLOC_005758"; transcript_id "TCONS_00005758"; exon_number "1"; oId "CUFF.5902.1"; tss_id "TSS5758"; +chr3 Cufflinks exon 102878806 102878968 . + . gene_id "XLOC_005759"; transcript_id "TCONS_00005759"; exon_number "1"; oId "CUFF.5904.1"; tss_id "TSS5759"; +chr3 Cufflinks exon 106726415 106726517 . + . gene_id "XLOC_005760"; transcript_id "TCONS_00005760"; exon_number "1"; oId "CUFF.5910.1"; tss_id "TSS5760"; +chr3 Cufflinks exon 108250094 108250368 . + . gene_id "XLOC_005761"; transcript_id "TCONS_00005761"; exon_number "1"; oId "CUFF.5911.1"; tss_id "TSS5761"; +chr3 Cufflinks exon 108572964 108572993 . + . gene_id "XLOC_005762"; transcript_id "TCONS_00005762"; exon_number "1"; oId "CUFF.5912.1"; tss_id "TSS5762"; +chr3 Cufflinks exon 108687395 108687429 . + . gene_id "XLOC_005763"; transcript_id "TCONS_00005763"; exon_number "1"; oId "CUFF.5913.1"; tss_id "TSS5763"; +chr3 Cufflinks exon 108943026 108943061 . + . gene_id "XLOC_005764"; transcript_id "TCONS_00005764"; exon_number "1"; oId "CUFF.5915.1"; tss_id "TSS5764"; +chr3 Cufflinks exon 108944004 108944068 . + . gene_id "XLOC_005765"; transcript_id "TCONS_00005765"; exon_number "1"; oId "CUFF.5916.1"; tss_id "TSS5765"; +chr3 Cufflinks exon 109066515 109066546 . + . gene_id "XLOC_005766"; transcript_id "TCONS_00005766"; exon_number "1"; oId "CUFF.5917.1"; tss_id "TSS5766"; +chr3 Cufflinks exon 110359089 110359144 . + . gene_id "XLOC_005767"; transcript_id "TCONS_00005767"; exon_number "1"; oId "CUFF.5919.1"; tss_id "TSS5767"; +chr3 Cufflinks exon 110404889 110405037 . + . gene_id "XLOC_005768"; transcript_id "TCONS_00005768"; exon_number "1"; oId "CUFF.5920.1"; tss_id "TSS5768"; +chr3 Cufflinks exon 111513866 111513902 . + . gene_id "XLOC_005769"; transcript_id "TCONS_00005769"; exon_number "1"; oId "CUFF.5922.1"; tss_id "TSS5769"; +chr3 Cufflinks exon 111558669 111558704 . + . gene_id "XLOC_005770"; transcript_id "TCONS_00005770"; exon_number "1"; oId "CUFF.5923.1"; tss_id "TSS5770"; +chr3 Cufflinks exon 111840744 111840787 . + . gene_id "XLOC_005771"; transcript_id "TCONS_00005771"; exon_number "1"; oId "CUFF.5926.1"; tss_id "TSS5771"; +chr3 Cufflinks exon 113351551 113351746 . + . gene_id "XLOC_005772"; transcript_id "TCONS_00005772"; exon_number "1"; oId "CUFF.5927.1"; tss_id "TSS5772"; +chr3 Cufflinks exon 113888321 113888355 . + . gene_id "XLOC_005773"; transcript_id "TCONS_00005773"; exon_number "1"; oId "CUFF.5928.1"; tss_id "TSS5773"; +chr3 Cufflinks exon 115556717 115557016 . + . gene_id "XLOC_005774"; transcript_id "TCONS_00005774"; exon_number "1"; oId "CUFF.5930.1"; tss_id "TSS5774"; +chr3 Cufflinks exon 117120665 117120706 . + . gene_id "XLOC_005775"; transcript_id "TCONS_00005775"; exon_number "1"; oId "CUFF.5933.1"; tss_id "TSS5775"; +chr3 Cufflinks exon 117263052 117263158 . + . gene_id "XLOC_005776"; transcript_id "TCONS_00005776"; exon_number "1"; oId "CUFF.5935.1"; tss_id "TSS5776"; +chr3 Cufflinks exon 117356178 117356213 . + . gene_id "XLOC_005777"; transcript_id "TCONS_00005777"; exon_number "1"; oId "CUFF.5936.1"; tss_id "TSS5777"; +chr3 Cufflinks exon 117985770 117985855 . + . gene_id "XLOC_005778"; transcript_id "TCONS_00005778"; exon_number "1"; oId "CUFF.5938.1"; tss_id "TSS5778"; +chr3 Cufflinks exon 119248243 119248323 . + . gene_id "XLOC_005779"; transcript_id "TCONS_00005779"; exon_number "1"; oId "CUFF.5940.1"; tss_id "TSS5779"; +chr3 Cufflinks exon 119491472 119491506 . + . gene_id "XLOC_005780"; transcript_id "TCONS_00005780"; exon_number "1"; oId "CUFF.5941.1"; tss_id "TSS5780"; +chr3 Cufflinks exon 119840756 119841073 . + . gene_id "XLOC_005781"; transcript_id "TCONS_00005781"; exon_number "1"; oId "CUFF.5943.1"; tss_id "TSS5781"; +chr3 Cufflinks exon 121310140 121310244 . + . gene_id "XLOC_005782"; transcript_id "TCONS_00005782"; exon_number "1"; oId "CUFF.5947.1"; tss_id "TSS5782"; +chr3 Cufflinks exon 121460314 121460355 . + . gene_id "XLOC_005783"; transcript_id "TCONS_00005783"; exon_number "1"; oId "CUFF.5950.1"; tss_id "TSS5783"; +chr3 Cufflinks exon 121809469 121809516 . + . gene_id "XLOC_005784"; transcript_id "TCONS_00005784"; exon_number "1"; oId "CUFF.5952.1"; tss_id "TSS5784"; +chr3 Cufflinks exon 122469218 122469317 . + . gene_id "XLOC_005785"; transcript_id "TCONS_00005785"; exon_number "1"; oId "CUFF.5954.1"; tss_id "TSS5785"; +chr3 Cufflinks exon 122486479 122486555 . + . gene_id "XLOC_005786"; transcript_id "TCONS_00005786"; exon_number "1"; oId "CUFF.5955.1"; tss_id "TSS5786"; +chr3 Cufflinks exon 124126538 124126625 . + . gene_id "XLOC_005787"; transcript_id "TCONS_00005787"; exon_number "1"; oId "CUFF.5959.1"; tss_id "TSS5787"; +chr3 Cufflinks exon 125107778 125107843 . + . gene_id "XLOC_005788"; transcript_id "TCONS_00005788"; exon_number "1"; oId "CUFF.5967.1"; tss_id "TSS5788"; +chr3 Cufflinks exon 125164904 125165006 . + . gene_id "XLOC_005789"; transcript_id "TCONS_00005789"; exon_number "1"; oId "CUFF.5968.1"; tss_id "TSS5789"; +chr3 Cufflinks exon 127682451 127682540 . + . gene_id "XLOC_005790"; transcript_id "TCONS_00005790"; exon_number "1"; oId "CUFF.5973.1"; tss_id "TSS5790"; +chr3 Cufflinks exon 127767619 127767655 . + . gene_id "XLOC_005791"; transcript_id "TCONS_00005791"; exon_number "1"; oId "CUFF.5974.1"; tss_id "TSS5791"; +chr3 Cufflinks exon 128503991 128504312 . + . gene_id "XLOC_005792"; transcript_id "TCONS_00005792"; exon_number "1"; oId "CUFF.5978.1"; tss_id "TSS5792"; +chr3 Cufflinks exon 128792138 128792211 . + . gene_id "XLOC_005793"; transcript_id "TCONS_00005793"; exon_number "1"; oId "CUFF.5979.1"; tss_id "TSS5793"; +chr3 Cufflinks exon 128792937 128793048 . + . gene_id "XLOC_005794"; transcript_id "TCONS_00005794"; exon_number "1"; oId "CUFF.5980.1"; tss_id "TSS5794"; +chr3 Cufflinks exon 128844980 128845017 . + . gene_id "XLOC_005795"; transcript_id "TCONS_00005795"; exon_number "1"; oId "CUFF.5981.1"; tss_id "TSS5795"; +chr3 Cufflinks exon 128863011 128863065 . + . gene_id "XLOC_005796"; transcript_id "TCONS_00005796"; exon_number "1"; oId "CUFF.5982.1"; tss_id "TSS5796"; +chr3 Cufflinks exon 129286898 129286928 . + . gene_id "XLOC_005797"; transcript_id "TCONS_00005797"; exon_number "1"; oId "CUFF.5983.1"; tss_id "TSS5797"; +chr3 Cufflinks exon 129310192 129310407 . + . gene_id "XLOC_005798"; transcript_id "TCONS_00005798"; exon_number "1"; oId "CUFF.5984.1"; tss_id "TSS5798"; +chr3 Cufflinks exon 129538622 129538719 . + . gene_id "XLOC_005799"; transcript_id "TCONS_00005799"; exon_number "1"; oId "CUFF.5985.1"; tss_id "TSS5799"; +chr3 Cufflinks exon 129639059 129639101 . + . gene_id "XLOC_005800"; transcript_id "TCONS_00005800"; exon_number "1"; oId "CUFF.5987.1"; tss_id "TSS5800"; +chr3 Cufflinks exon 130577648 130577685 . + . gene_id "XLOC_005801"; transcript_id "TCONS_00005801"; exon_number "1"; oId "CUFF.5989.1"; tss_id "TSS5801"; +chr3 Cufflinks exon 131912072 131912105 . + . gene_id "XLOC_005802"; transcript_id "TCONS_00005802"; exon_number "1"; oId "CUFF.5993.1"; tss_id "TSS5802"; +chr3 Cufflinks exon 131999461 131999525 . + . gene_id "XLOC_005803"; transcript_id "TCONS_00005803"; exon_number "1"; oId "CUFF.5996.1"; tss_id "TSS5803"; +chr3 Cufflinks exon 131999835 131999884 . + . gene_id "XLOC_005804"; transcript_id "TCONS_00005804"; exon_number "1"; oId "CUFF.5997.1"; tss_id "TSS5804"; +chr3 Cufflinks exon 132340097 132340141 . + . gene_id "XLOC_005805"; transcript_id "TCONS_00005805"; exon_number "1"; oId "CUFF.5998.1"; tss_id "TSS5805"; +chr3 Cufflinks exon 133383770 133383876 . + . gene_id "XLOC_005806"; transcript_id "TCONS_00005806"; exon_number "1"; oId "CUFF.6001.1"; tss_id "TSS5806"; +chr3 Cufflinks exon 136781284 136781357 . + . gene_id "XLOC_005807"; transcript_id "TCONS_00005807"; exon_number "1"; oId "CUFF.6010.1"; tss_id "TSS5807"; +chr3 Cufflinks exon 138331366 138331400 . + . gene_id "XLOC_005808"; transcript_id "TCONS_00005808"; exon_number "1"; oId "CUFF.6012.1"; tss_id "TSS5808"; +chr3 Cufflinks exon 138428413 138428491 . + . gene_id "XLOC_005809"; transcript_id "TCONS_00005809"; exon_number "1"; oId "CUFF.6013.1"; tss_id "TSS5809"; +chr3 Cufflinks exon 139107119 139107206 . + . gene_id "XLOC_005810"; transcript_id "TCONS_00005810"; exon_number "1"; oId "CUFF.6015.1"; tss_id "TSS5810"; +chr3 Cufflinks exon 139610019 139610055 . + . gene_id "XLOC_005811"; transcript_id "TCONS_00005811"; exon_number "1"; oId "CUFF.6018.1"; tss_id "TSS5811"; +chr3 Cufflinks exon 141772470 141772534 . + . gene_id "XLOC_005812"; transcript_id "TCONS_00005812"; exon_number "1"; oId "CUFF.6023.1"; tss_id "TSS5812"; +chr3 Cufflinks exon 141773745 141774230 . + . gene_id "XLOC_005813"; transcript_id "TCONS_00005813"; exon_number "1"; oId "CUFF.6024.1"; tss_id "TSS5813"; +chr3 Cufflinks exon 141864296 141864397 . + . gene_id "XLOC_005814"; transcript_id "TCONS_00005814"; exon_number "1"; oId "CUFF.6025.1"; tss_id "TSS5814"; +chr3 Cufflinks exon 142072854 142072908 . + . gene_id "XLOC_005815"; transcript_id "TCONS_00005815"; exon_number "1"; oId "CUFF.6026.1"; tss_id "TSS5815"; +chr3 Cufflinks exon 142392444 142392684 . + . gene_id "XLOC_005816"; transcript_id "TCONS_00005816"; exon_number "1"; oId "CUFF.6033.1"; tss_id "TSS5816"; +chr3 Cufflinks exon 142520050 142520109 . + . gene_id "XLOC_005817"; transcript_id "TCONS_00005817"; exon_number "1"; oId "CUFF.6034.1"; tss_id "TSS5817"; +chr3 Cufflinks exon 144942634 144942676 . + . gene_id "XLOC_005818"; transcript_id "TCONS_00005818"; exon_number "1"; oId "CUFF.6037.1"; tss_id "TSS5818"; +chr3 Cufflinks exon 146289264 146289356 . + . gene_id "XLOC_005819"; transcript_id "TCONS_00005819"; exon_number "1"; oId "CUFF.6042.1"; tss_id "TSS5819"; +chr3 Cufflinks exon 148368425 148368544 . + . gene_id "XLOC_005820"; transcript_id "TCONS_00005820"; exon_number "1"; oId "CUFF.6048.1"; tss_id "TSS5820"; +chr3 Cufflinks exon 148394630 148394667 . + . gene_id "XLOC_005821"; transcript_id "TCONS_00005821"; exon_number "1"; oId "CUFF.6049.1"; tss_id "TSS5821"; +chr3 Cufflinks exon 149243418 149243513 . + . gene_id "XLOC_005822"; transcript_id "TCONS_00005822"; exon_number "1"; oId "CUFF.6052.1"; tss_id "TSS5822"; +chr3 Cufflinks exon 149458711 149458746 . + . gene_id "XLOC_005823"; transcript_id "TCONS_00005823"; exon_number "1"; oId "CUFF.6053.1"; tss_id "TSS5823"; +chr3 Cufflinks exon 149959564 149959620 . + . gene_id "XLOC_005824"; transcript_id "TCONS_00005824"; exon_number "1"; oId "CUFF.6057.1"; tss_id "TSS5824"; +chr3 Cufflinks exon 150905886 150905971 . + . gene_id "XLOC_005825"; transcript_id "TCONS_00005825"; exon_number "1"; oId "CUFF.6058.1"; tss_id "TSS5825"; +chr3 Cufflinks exon 151657141 151657178 . + . gene_id "XLOC_005826"; transcript_id "TCONS_00005826"; exon_number "1"; oId "CUFF.6059.1"; tss_id "TSS5826"; +chr3 Cufflinks exon 151964613 151964689 . + . gene_id "XLOC_005827"; transcript_id "TCONS_00005827"; exon_number "1"; oId "CUFF.6060.1"; tss_id "TSS5827"; +chr3 Cufflinks exon 152072670 152072718 . + . gene_id "XLOC_005828"; transcript_id "TCONS_00005828"; exon_number "1"; oId "CUFF.6061.1"; tss_id "TSS5828"; +chr3 Cufflinks exon 153376718 153376776 . + . gene_id "XLOC_005829"; transcript_id "TCONS_00005829"; exon_number "1"; oId "CUFF.6065.1"; tss_id "TSS5829"; +chr3 Cufflinks exon 153447990 153448080 . + . gene_id "XLOC_005830"; transcript_id "TCONS_00005830"; exon_number "1"; oId "CUFF.6066.1"; tss_id "TSS5830"; +chr3 Cufflinks exon 154047504 154047607 . + . gene_id "XLOC_005831"; transcript_id "TCONS_00005831"; exon_number "1"; oId "CUFF.6068.1"; tss_id "TSS5831"; +chr3 Cufflinks exon 155080892 155080956 . + . gene_id "XLOC_005832"; transcript_id "TCONS_00005832"; exon_number "1"; oId "CUFF.6072.1"; tss_id "TSS5832"; +chr3 Cufflinks exon 155378882 155378918 . + . gene_id "XLOC_005833"; transcript_id "TCONS_00005833"; exon_number "1"; oId "CUFF.6075.1"; tss_id "TSS5833"; +chr3 Cufflinks exon 156735131 156735378 . + . gene_id "XLOC_005834"; transcript_id "TCONS_00005834"; exon_number "1"; oId "CUFF.6078.1"; tss_id "TSS5834"; +chr3 Cufflinks exon 156885176 156885206 . + . gene_id "XLOC_005835"; transcript_id "TCONS_00005835"; exon_number "1"; oId "CUFF.6079.1"; tss_id "TSS5835"; +chr3 Cufflinks exon 158700752 158700798 . + . gene_id "XLOC_005836"; transcript_id "TCONS_00005836"; exon_number "1"; oId "CUFF.6085.1"; tss_id "TSS5836"; +chr3 Cufflinks exon 159586297 159586331 . + . gene_id "XLOC_005837"; transcript_id "TCONS_00005837"; exon_number "1"; oId "CUFF.6087.1"; tss_id "TSS5837"; +chr3 Cufflinks exon 160130518 160130571 . + . gene_id "XLOC_005838"; transcript_id "TCONS_00005838"; exon_number "1"; oId "CUFF.6088.1"; tss_id "TSS5838"; +chr3 Cufflinks exon 160146211 160146313 . + . gene_id "XLOC_005839"; transcript_id "TCONS_00005839"; exon_number "1"; oId "CUFF.6089.1"; tss_id "TSS5839"; +chr3 Cufflinks exon 160436227 160436311 . + . gene_id "XLOC_005840"; transcript_id "TCONS_00005840"; exon_number "1"; oId "CUFF.6091.1"; tss_id "TSS5840"; +chr3 Cufflinks exon 166019987 166020055 . + . gene_id "XLOC_005841"; transcript_id "TCONS_00005841"; exon_number "1"; oId "CUFF.6099.1"; tss_id "TSS5841"; +chr3 Cufflinks exon 166748286 166748358 . + . gene_id "XLOC_005842"; transcript_id "TCONS_00005842"; exon_number "1"; oId "CUFF.6102.1"; tss_id "TSS5842"; +chr3 Cufflinks exon 168192986 168193164 . + . gene_id "XLOC_005843"; transcript_id "TCONS_00005843"; exon_number "1"; oId "CUFF.6103.1"; tss_id "TSS5843"; +chr3 Cufflinks exon 169341334 169341375 . + . gene_id "XLOC_005844"; transcript_id "TCONS_00005844"; exon_number "1"; oId "CUFF.6104.1"; tss_id "TSS5844"; +chr3 Cufflinks exon 169430765 169430809 . + . gene_id "XLOC_005845"; transcript_id "TCONS_00005845"; exon_number "1"; oId "CUFF.6105.1"; tss_id "TSS5845"; +chr3 Cufflinks exon 169490018 169490091 . + . gene_id "XLOC_005846"; transcript_id "TCONS_00005846"; exon_number "1"; oId "CUFF.6107.1"; tss_id "TSS5846"; +chr3 Cufflinks exon 169775089 169775220 . + . gene_id "XLOC_005847"; transcript_id "TCONS_00005847"; exon_number "1"; oId "CUFF.6108.1"; tss_id "TSS5847"; +chr3 Cufflinks exon 169867633 169867726 . + . gene_id "XLOC_005848"; transcript_id "TCONS_00005848"; exon_number "1"; oId "CUFF.6109.1"; tss_id "TSS5848"; +chr3 Cufflinks exon 169878724 169878782 . + . gene_id "XLOC_005849"; transcript_id "TCONS_00005849"; exon_number "1"; oId "CUFF.6110.1"; tss_id "TSS5849"; +chr3 Cufflinks exon 169976424 169976510 . + . gene_id "XLOC_005850"; transcript_id "TCONS_00005850"; exon_number "1"; oId "CUFF.6111.1"; tss_id "TSS5850"; +chr3 Cufflinks exon 170512921 170512960 . + . gene_id "XLOC_005851"; transcript_id "TCONS_00005851"; exon_number "1"; oId "CUFF.6112.1"; tss_id "TSS5851"; +chr3 Cufflinks exon 171411001 171411107 . + . gene_id "XLOC_005852"; transcript_id "TCONS_00005852"; exon_number "1"; oId "CUFF.6115.1"; tss_id "TSS5852"; +chr3 Cufflinks exon 171955137 171955404 . + . gene_id "XLOC_005853"; transcript_id "TCONS_00005853"; exon_number "1"; oId "CUFF.6116.1"; tss_id "TSS5853"; +chr3 Cufflinks exon 172420914 172421014 . + . gene_id "XLOC_005854"; transcript_id "TCONS_00005854"; exon_number "1"; oId "CUFF.6118.1"; tss_id "TSS5854"; +chr3 Cufflinks exon 172472738 172472827 . + . gene_id "XLOC_005855"; transcript_id "TCONS_00005855"; exon_number "1"; oId "CUFF.6119.1"; tss_id "TSS5855"; +chr3 Cufflinks exon 173131764 173131824 . + . gene_id "XLOC_005856"; transcript_id "TCONS_00005856"; exon_number "1"; oId "CUFF.6123.1"; tss_id "TSS5856"; +chr3 Cufflinks exon 173775431 173775546 . + . gene_id "XLOC_005857"; transcript_id "TCONS_00005857"; exon_number "1"; oId "CUFF.6125.1"; tss_id "TSS5857"; +chr3 Cufflinks exon 173846979 173847080 . + . gene_id "XLOC_005858"; transcript_id "TCONS_00005858"; exon_number "1"; oId "CUFF.6126.1"; tss_id "TSS5858"; +chr3 Cufflinks exon 174349613 174349769 . + . gene_id "XLOC_005859"; transcript_id "TCONS_00005859"; exon_number "1"; oId "CUFF.6127.1"; tss_id "TSS5859"; +chr3 Cufflinks exon 175245458 175245491 . + . gene_id "XLOC_005860"; transcript_id "TCONS_00005860"; exon_number "1"; oId "CUFF.6130.1"; tss_id "TSS5860"; +chr3 Cufflinks exon 175327267 175327336 . + . gene_id "XLOC_005861"; transcript_id "TCONS_00005861"; exon_number "1"; oId "CUFF.6131.1"; tss_id "TSS5861"; +chr3 Cufflinks exon 175457058 175457167 . + . gene_id "XLOC_005862"; transcript_id "TCONS_00005862"; exon_number "1"; oId "CUFF.6132.1"; tss_id "TSS5862"; +chr3 Cufflinks exon 175485347 175485446 . + . gene_id "XLOC_005863"; transcript_id "TCONS_00005863"; exon_number "1"; oId "CUFF.6133.1"; tss_id "TSS5863"; +chr3 Cufflinks exon 176481017 176481101 . + . gene_id "XLOC_005864"; transcript_id "TCONS_00005864"; exon_number "1"; oId "CUFF.6134.1"; tss_id "TSS5864"; +chr3 Cufflinks exon 176601683 176601734 . + . gene_id "XLOC_005865"; transcript_id "TCONS_00005865"; exon_number "1"; oId "CUFF.6135.1"; tss_id "TSS5865"; +chr3 Cufflinks exon 176795938 176795976 . + . gene_id "XLOC_005866"; transcript_id "TCONS_00005866"; exon_number "1"; oId "CUFF.6136.1"; tss_id "TSS5866"; +chr3 Cufflinks exon 178717085 178717156 . + . gene_id "XLOC_005867"; transcript_id "TCONS_00005867"; exon_number "1"; oId "CUFF.6142.1"; tss_id "TSS5867"; +chr3 Cufflinks exon 178811691 178811732 . + . gene_id "XLOC_005868"; transcript_id "TCONS_00005868"; exon_number "1"; oId "CUFF.6143.1"; tss_id "TSS5868"; +chr3 Cufflinks exon 178901805 178901915 . + . gene_id "XLOC_005869"; transcript_id "TCONS_00005869"; exon_number "1"; oId "CUFF.6144.1"; tss_id "TSS5869"; +chr3 Cufflinks exon 179497344 179497506 . + . gene_id "XLOC_005870"; transcript_id "TCONS_00005870"; exon_number "1"; oId "CUFF.6148.1"; tss_id "TSS5870"; +chr3 Cufflinks exon 179772545 179772586 . + . gene_id "XLOC_005871"; transcript_id "TCONS_00005871"; exon_number "1"; oId "CUFF.6150.1"; tss_id "TSS5871"; +chr3 Cufflinks exon 180260488 180260625 . + . gene_id "XLOC_005872"; transcript_id "TCONS_00005872"; exon_number "1"; oId "CUFF.6153.1"; tss_id "TSS5872"; +chr3 Cufflinks exon 180298845 180298948 . + . gene_id "XLOC_005873"; transcript_id "TCONS_00005873"; exon_number "1"; oId "CUFF.6154.1"; tss_id "TSS5873"; +chr3 Cufflinks exon 180696392 180696472 . + . gene_id "XLOC_005874"; transcript_id "TCONS_00005874"; exon_number "1"; oId "CUFF.6156.1"; tss_id "TSS5874"; +chr3 Cufflinks exon 180949525 180949631 . + . gene_id "XLOC_005875"; transcript_id "TCONS_00005875"; exon_number "1"; oId "CUFF.6157.1"; tss_id "TSS5875"; +chr3 Cufflinks exon 181496820 181496849 . + . gene_id "XLOC_005876"; transcript_id "TCONS_00005876"; exon_number "1"; oId "CUFF.6158.1"; tss_id "TSS5876"; +chr3 Cufflinks exon 181531202 181531504 . + . gene_id "XLOC_005877"; transcript_id "TCONS_00005877"; exon_number "1"; oId "CUFF.6159.1"; tss_id "TSS5877"; +chr3 Cufflinks exon 181686259 181686362 . + . gene_id "XLOC_005878"; transcript_id "TCONS_00005878"; exon_number "1"; oId "CUFF.6161.1"; tss_id "TSS5878"; +chr3 Cufflinks exon 182082298 182082431 . + . gene_id "XLOC_005879"; transcript_id "TCONS_00005879"; exon_number "1"; oId "CUFF.6162.1"; tss_id "TSS5879"; +chr3 Cufflinks exon 182494524 182494568 . + . gene_id "XLOC_005880"; transcript_id "TCONS_00005880"; exon_number "1"; oId "CUFF.6164.1"; tss_id "TSS5880"; +chr3 Cufflinks exon 185160007 185160110 . + . gene_id "XLOC_005881"; transcript_id "TCONS_00005881"; exon_number "1"; oId "CUFF.6170.1"; tss_id "TSS5881"; +chr3 Cufflinks exon 185691018 185691078 . + . gene_id "XLOC_005882"; transcript_id "TCONS_00005882"; exon_number "1"; oId "CUFF.6172.1"; tss_id "TSS5882"; +chr3 Cufflinks exon 185971409 185971489 . + . gene_id "XLOC_005883"; transcript_id "TCONS_00005883"; exon_number "1"; oId "CUFF.6175.1"; tss_id "TSS5883"; +chr3 Cufflinks exon 186271051 186271086 . + . gene_id "XLOC_005884"; transcript_id "TCONS_00005884"; exon_number "1"; oId "CUFF.6176.1"; tss_id "TSS5884"; +chr3 Cufflinks exon 186585126 186585179 . + . gene_id "XLOC_005885"; transcript_id "TCONS_00005885"; exon_number "1"; oId "CUFF.6179.1"; tss_id "TSS5885"; +chr3 Cufflinks exon 186665063 186665119 . + . gene_id "XLOC_005886"; transcript_id "TCONS_00005886"; exon_number "1"; oId "CUFF.6180.1"; tss_id "TSS5886"; +chr3 Cufflinks exon 187141102 187141210 . + . gene_id "XLOC_005887"; transcript_id "TCONS_00005887"; exon_number "1"; oId "CUFF.6181.1"; tss_id "TSS5887"; +chr3 Cufflinks exon 187181458 187181676 . + . gene_id "XLOC_005888"; transcript_id "TCONS_00005888"; exon_number "1"; oId "CUFF.6182.1"; tss_id "TSS5888"; +chr3 Cufflinks exon 188386619 188386664 . + . gene_id "XLOC_005889"; transcript_id "TCONS_00005889"; exon_number "1"; oId "CUFF.6184.1"; tss_id "TSS5889"; +chr3 Cufflinks exon 189376628 189376663 . + . gene_id "XLOC_005890"; transcript_id "TCONS_00005890"; exon_number "1"; oId "CUFF.6188.1"; tss_id "TSS5890"; +chr3 Cufflinks exon 190359952 190360197 . + . gene_id "XLOC_005891"; transcript_id "TCONS_00005891"; exon_number "1"; oId "CUFF.6190.1"; tss_id "TSS5891"; +chr3 Cufflinks exon 190477504 190477552 . + . gene_id "XLOC_005892"; transcript_id "TCONS_00005892"; exon_number "1"; oId "CUFF.6191.1"; tss_id "TSS5892"; +chr3 Cufflinks exon 190540415 190540595 . + . gene_id "XLOC_005893"; transcript_id "TCONS_00005893"; exon_number "1"; oId "CUFF.6192.1"; tss_id "TSS5893"; +chr3 Cufflinks exon 190540952 190541021 . + . gene_id "XLOC_005894"; transcript_id "TCONS_00005894"; exon_number "1"; oId "CUFF.6193.1"; tss_id "TSS5894"; +chr3 Cufflinks exon 190943835 190943873 . + . gene_id "XLOC_005895"; transcript_id "TCONS_00005895"; exon_number "1"; oId "CUFF.6194.1"; tss_id "TSS5895"; +chr3 Cufflinks exon 191810911 191811149 . + . gene_id "XLOC_005896"; transcript_id "TCONS_00005896"; exon_number "1"; oId "CUFF.6197.1"; tss_id "TSS5896"; +chr3 Cufflinks exon 192406339 192406389 . + . gene_id "XLOC_005897"; transcript_id "TCONS_00005897"; exon_number "1"; oId "CUFF.6200.1"; tss_id "TSS5897"; +chr3 Cufflinks exon 192876655 192876687 . + . gene_id "XLOC_005898"; transcript_id "TCONS_00005898"; exon_number "1"; oId "CUFF.6203.1"; tss_id "TSS5898"; +chr3 Cufflinks exon 193863467 193863774 . + . gene_id "XLOC_005899"; transcript_id "TCONS_00005899"; exon_number "1"; oId "CUFF.6205.1"; tss_id "TSS5899"; +chr3 Cufflinks exon 193882241 193882442 . + . gene_id "XLOC_005900"; transcript_id "TCONS_00005900"; exon_number "1"; oId "CUFF.6206.1"; tss_id "TSS5900"; +chr3 Cufflinks exon 194194316 194194368 . + . gene_id "XLOC_005901"; transcript_id "TCONS_00005901"; exon_number "1"; oId "CUFF.6207.1"; tss_id "TSS5901"; +chr3 Cufflinks exon 194935516 194935622 . + . gene_id "XLOC_005902"; transcript_id "TCONS_00005902"; exon_number "1"; oId "CUFF.6211.1"; tss_id "TSS5902"; +chr3 Cufflinks exon 195180142 195180197 . + . gene_id "XLOC_005903"; transcript_id "TCONS_00005903"; exon_number "1"; oId "CUFF.6213.1"; tss_id "TSS5903"; +chr3 Cufflinks exon 195290909 195290945 . + . gene_id "XLOC_005904"; transcript_id "TCONS_00005904"; exon_number "1"; oId "CUFF.6215.1"; tss_id "TSS5904"; +chr3 Cufflinks exon 195581911 195581953 . + . gene_id "XLOC_005905"; transcript_id "TCONS_00005905"; exon_number "1"; oId "CUFF.6216.1"; tss_id "TSS5905"; +chr3 Cufflinks exon 195799690 195799749 . + . gene_id "XLOC_005906"; transcript_id "TCONS_00005906"; exon_number "1"; oId "CUFF.6219.1"; tss_id "TSS5906"; +chr3 Cufflinks exon 196126793 196127093 . + . gene_id "XLOC_005907"; transcript_id "TCONS_00005907"; exon_number "1"; oId "CUFF.6224.1"; tss_id "TSS5907"; +chr3 Cufflinks exon 196154174 196154206 . + . gene_id "XLOC_005908"; transcript_id "TCONS_00005908"; exon_number "1"; oId "CUFF.6225.1"; tss_id "TSS5908"; +chr3 Cufflinks exon 197621378 197621482 . + . gene_id "XLOC_005909"; transcript_id "TCONS_00005909"; exon_number "1"; oId "CUFF.6232.1"; tss_id "TSS5909"; +chr3 Cufflinks exon 197721477 197721579 . + . gene_id "XLOC_005910"; transcript_id "TCONS_00005910"; exon_number "1"; oId "CUFF.6233.1"; tss_id "TSS5910"; +chr3 Cufflinks exon 197923618 197923720 . + . gene_id "XLOC_005911"; transcript_id "TCONS_00005911"; exon_number "1"; oId "CUFF.6235.1"; tss_id "TSS5911"; +chr3 Cufflinks exon 324372 324475 . - . gene_id "XLOC_005912"; transcript_id "TCONS_00005912"; exon_number "1"; oId "CUFF.5602.1"; tss_id "TSS5912"; +chr3 Cufflinks exon 1107256 1107559 . - . gene_id "XLOC_005913"; transcript_id "TCONS_00005913"; exon_number "1"; oId "CUFF.5603.1"; tss_id "TSS5913"; +chr3 Cufflinks exon 1235676 1235728 . - . gene_id "XLOC_005914"; transcript_id "TCONS_00005914"; exon_number "1"; oId "CUFF.5604.1"; tss_id "TSS5914"; +chr3 Cufflinks exon 1769359 1769425 . - . gene_id "XLOC_005915"; transcript_id "TCONS_00005915"; exon_number "1"; oId "CUFF.5605.1"; tss_id "TSS5915"; +chr3 Cufflinks exon 2130661 2130895 . - . gene_id "XLOC_005916"; transcript_id "TCONS_00005916"; exon_number "1"; oId "CUFF.5607.1"; tss_id "TSS5916"; +chr3 Cufflinks exon 4376371 4376442 . - . gene_id "XLOC_005917"; transcript_id "TCONS_00005917"; exon_number "1"; oId "CUFF.5610.1"; tss_id "TSS5917"; +chr3 Cufflinks exon 4606538 4606582 . - . gene_id "XLOC_005918"; transcript_id "TCONS_00005918"; exon_number "1"; oId "CUFF.5611.1"; tss_id "TSS5918"; +chr3 Cufflinks exon 4920284 4920387 . - . gene_id "XLOC_005919"; transcript_id "TCONS_00005919"; exon_number "1"; oId "CUFF.5612.1"; tss_id "TSS5919"; +chr3 Cufflinks exon 5294597 5294908 . - . gene_id "XLOC_005920"; transcript_id "TCONS_00005920"; exon_number "1"; oId "CUFF.5614.1"; tss_id "TSS5920"; +chr3 Cufflinks exon 9175953 9176057 . - . gene_id "XLOC_005921"; transcript_id "TCONS_00005921"; exon_number "1"; oId "CUFF.5618.1"; tss_id "TSS5921"; +chr3 Cufflinks exon 9259898 9259982 . - . gene_id "XLOC_005922"; transcript_id "TCONS_00005922"; exon_number "1"; oId "CUFF.5619.1"; tss_id "TSS5922"; +chr3 Cufflinks exon 9960735 9960840 . - . gene_id "XLOC_005923"; transcript_id "TCONS_00005923"; exon_number "1"; oId "CUFF.5622.1"; tss_id "TSS5923"; +chr3 Cufflinks exon 11994241 11994559 . - . gene_id "XLOC_005924"; transcript_id "TCONS_00005924"; exon_number "1"; oId "CUFF.5627.1"; tss_id "TSS5924"; +chr3 Cufflinks exon 12196531 12196571 . - . gene_id "XLOC_005925"; transcript_id "TCONS_00005925"; exon_number "1"; oId "CUFF.5628.1"; tss_id "TSS5925"; +chr3 Cufflinks exon 12368311 12368352 . - . gene_id "XLOC_005926"; transcript_id "TCONS_00005926"; exon_number "1"; oId "CUFF.5630.1"; tss_id "TSS5926"; +chr3 Cufflinks exon 12543129 12543203 . - . gene_id "XLOC_005927"; transcript_id "TCONS_00005927"; exon_number "1"; oId "CUFF.5631.1"; tss_id "TSS5927"; +chr3 Cufflinks exon 12552593 12552710 . - . gene_id "XLOC_005928"; transcript_id "TCONS_00005928"; exon_number "1"; oId "CUFF.5632.1"; tss_id "TSS5928"; +chr3 Cufflinks exon 14572489 14572595 . - . gene_id "XLOC_005929"; transcript_id "TCONS_00005929"; exon_number "1"; oId "CUFF.5636.1"; tss_id "TSS5929"; +chr3 Cufflinks exon 15046348 15046378 . - . gene_id "XLOC_005930"; transcript_id "TCONS_00005930"; exon_number "1"; oId "CUFF.5637.1"; tss_id "TSS5930"; +chr3 Cufflinks exon 15350845 15350877 . - . gene_id "XLOC_005931"; transcript_id "TCONS_00005931"; exon_number "1"; oId "CUFF.5641.1"; tss_id "TSS5931"; +chr3 Cufflinks exon 15474617 15474723 . - . gene_id "XLOC_005932"; transcript_id "TCONS_00005932"; exon_number "1"; oId "CUFF.5644.1"; tss_id "TSS5932"; +chr3 Cufflinks exon 15490740 15490813 . - . gene_id "XLOC_005933"; transcript_id "TCONS_00005933"; exon_number "1"; oId "CUFF.5645.1"; tss_id "TSS5933"; +chr3 Cufflinks exon 15548120 15548412 . - . gene_id "XLOC_005934"; transcript_id "TCONS_00005934"; exon_number "1"; oId "CUFF.5646.1"; tss_id "TSS5934"; +chr3 Cufflinks exon 15780027 15780227 . - . gene_id "XLOC_005934"; transcript_id "TCONS_00005934"; exon_number "2"; oId "CUFF.5646.1"; tss_id "TSS5934"; +chr3 Cufflinks exon 15847980 15848018 . - . gene_id "XLOC_005935"; transcript_id "TCONS_00005935"; exon_number "1"; oId "CUFF.5649.1"; tss_id "TSS5935"; +chr3 Cufflinks exon 16644695 16644730 . - . gene_id "XLOC_005936"; transcript_id "TCONS_00005936"; exon_number "1"; oId "CUFF.5650.1"; tss_id "TSS5936"; +chr3 Cufflinks exon 16738279 16738339 . - . gene_id "XLOC_005937"; transcript_id "TCONS_00005937"; exon_number "1"; oId "CUFF.5651.1"; tss_id "TSS5937"; +chr3 Cufflinks exon 17438373 17438412 . - . gene_id "XLOC_005938"; transcript_id "TCONS_00005938"; exon_number "1"; oId "CUFF.5652.1"; tss_id "TSS5938"; +chr3 Cufflinks exon 17697309 17697343 . - . gene_id "XLOC_005939"; transcript_id "TCONS_00005939"; exon_number "1"; oId "CUFF.5653.1"; tss_id "TSS5939"; +chr3 Cufflinks exon 17741397 17741464 . - . gene_id "XLOC_005940"; transcript_id "TCONS_00005940"; exon_number "1"; oId "CUFF.5655.1"; tss_id "TSS5940"; +chr3 Cufflinks exon 18419192 18419239 . - . gene_id "XLOC_005941"; transcript_id "TCONS_00005941"; exon_number "1"; oId "CUFF.5658.1"; tss_id "TSS5941"; +chr3 Cufflinks exon 18996436 18996541 . - . gene_id "XLOC_005942"; transcript_id "TCONS_00005942"; exon_number "1"; oId "CUFF.5659.1"; tss_id "TSS5942"; +chr3 Cufflinks exon 20310458 20310562 . - . gene_id "XLOC_005943"; transcript_id "TCONS_00005943"; exon_number "1"; oId "CUFF.5663.1"; tss_id "TSS5943"; +chr3 Cufflinks exon 20549136 20549248 . - . gene_id "XLOC_005944"; transcript_id "TCONS_00005944"; exon_number "1"; oId "CUFF.5664.1"; tss_id "TSS5944"; +chr3 Cufflinks exon 21591504 21591540 . - . gene_id "XLOC_005945"; transcript_id "TCONS_00005945"; exon_number "1"; oId "CUFF.5666.1"; tss_id "TSS5945"; +chr3 Cufflinks exon 21625961 21625995 . - . gene_id "XLOC_005946"; transcript_id "TCONS_00005946"; exon_number "1"; oId "CUFF.5667.1"; tss_id "TSS5946"; +chr3 Cufflinks exon 22904997 22905109 . - . gene_id "XLOC_005947"; transcript_id "TCONS_00005947"; exon_number "1"; oId "CUFF.5668.1"; tss_id "TSS5947"; +chr3 Cufflinks exon 23655155 23655252 . - . gene_id "XLOC_005948"; transcript_id "TCONS_00005948"; exon_number "1"; oId "CUFF.5670.1"; tss_id "TSS5948"; +chr3 Cufflinks exon 23682982 23683083 . - . gene_id "XLOC_005949"; transcript_id "TCONS_00005949"; exon_number "1"; oId "CUFF.5671.1"; tss_id "TSS5949"; +chr3 Cufflinks exon 25061657 25061938 . - . gene_id "XLOC_005950"; transcript_id "TCONS_00005950"; exon_number "1"; oId "CUFF.5674.1"; tss_id "TSS5950"; +chr3 Cufflinks exon 25393784 25393883 . - . gene_id "XLOC_005951"; transcript_id "TCONS_00005951"; exon_number "1"; oId "CUFF.5677.1"; tss_id "TSS5951"; +chr3 Cufflinks exon 26131401 26131437 . - . gene_id "XLOC_005952"; transcript_id "TCONS_00005952"; exon_number "1"; oId "CUFF.5679.1"; tss_id "TSS5952"; +chr3 Cufflinks exon 27307071 27307174 . - . gene_id "XLOC_005953"; transcript_id "TCONS_00005953"; exon_number "1"; oId "CUFF.5681.1"; tss_id "TSS5953"; +chr3 Cufflinks exon 27334356 27334390 . - . gene_id "XLOC_005954"; transcript_id "TCONS_00005954"; exon_number "1"; oId "CUFF.5682.1"; tss_id "TSS5954"; +chr3 Cufflinks exon 27512521 27512553 . - . gene_id "XLOC_005955"; transcript_id "TCONS_00005955"; exon_number "1"; oId "CUFF.5683.1"; tss_id "TSS5955"; +chr3 Cufflinks exon 27889217 27889362 . - . gene_id "XLOC_005956"; transcript_id "TCONS_00005956"; exon_number "1"; oId "CUFF.5687.1"; tss_id "TSS5956"; +chr3 Cufflinks exon 28124761 28124802 . - . gene_id "XLOC_005957"; transcript_id "TCONS_00005957"; exon_number "1"; oId "CUFF.5689.1"; tss_id "TSS5957"; +chr3 Cufflinks exon 29899237 29899297 . - . gene_id "XLOC_005958"; transcript_id "TCONS_00005958"; exon_number "1"; oId "CUFF.5691.1"; tss_id "TSS5958"; +chr3 Cufflinks exon 30072743 30072787 . - . gene_id "XLOC_005959"; transcript_id "TCONS_00005959"; exon_number "1"; oId "CUFF.5692.1"; tss_id "TSS5959"; +chr3 Cufflinks exon 30229698 30229732 . - . gene_id "XLOC_005960"; transcript_id "TCONS_00005960"; exon_number "1"; oId "CUFF.5693.1"; tss_id "TSS5960"; +chr3 Cufflinks exon 30345812 30346027 . - . gene_id "XLOC_005961"; transcript_id "TCONS_00005961"; exon_number "1"; oId "CUFF.5694.1"; tss_id "TSS5961"; +chr3 Cufflinks exon 32026978 32027191 . - . gene_id "XLOC_005962"; transcript_id "TCONS_00005962"; exon_number "1"; oId "CUFF.5699.1"; tss_id "TSS5962"; +chr3 Cufflinks exon 32735657 32735732 . - . gene_id "XLOC_005963"; transcript_id "TCONS_00005963"; exon_number "1"; oId "CUFF.5703.1"; tss_id "TSS5963"; +chr3 Cufflinks exon 33046567 33046621 . - . gene_id "XLOC_005964"; transcript_id "TCONS_00005964"; exon_number "1"; oId "CUFF.5704.1"; tss_id "TSS5964"; +chr3 Cufflinks exon 33071771 33071811 . - . gene_id "XLOC_005965"; transcript_id "TCONS_00005965"; exon_number "1"; oId "CUFF.5705.1"; tss_id "TSS5965"; +chr3 Cufflinks exon 33533501 33533590 . - . gene_id "XLOC_005966"; transcript_id "TCONS_00005966"; exon_number "1"; oId "CUFF.5708.1"; tss_id "TSS5966"; +chr3 Cufflinks exon 33835186 33835249 . - . gene_id "XLOC_005967"; transcript_id "TCONS_00005967"; exon_number "1"; oId "CUFF.5710.1"; tss_id "TSS5967"; +chr3 Cufflinks exon 35298332 35298436 . - . gene_id "XLOC_005968"; transcript_id "TCONS_00005968"; exon_number "1"; oId "CUFF.5711.1"; tss_id "TSS5968"; +chr3 Cufflinks exon 37614649 37614703 . - . gene_id "XLOC_005969"; transcript_id "TCONS_00005969"; exon_number "1"; oId "CUFF.5717.1"; tss_id "TSS5969"; +chr3 Cufflinks exon 38345266 38345370 . - . gene_id "XLOC_005970"; transcript_id "TCONS_00005970"; exon_number "1"; oId "CUFF.5718.1"; tss_id "TSS5970"; +chr3 Cufflinks exon 39077034 39077138 . - . gene_id "XLOC_005971"; transcript_id "TCONS_00005971"; exon_number "1"; oId "CUFF.5720.1"; tss_id "TSS5971"; +chr3 Cufflinks exon 39077429 39077621 . - . gene_id "XLOC_005972"; transcript_id "TCONS_00005972"; exon_number "1"; oId "CUFF.5721.1"; tss_id "TSS5972"; +chr3 Cufflinks exon 40540412 40540494 . - . gene_id "XLOC_005973"; transcript_id "TCONS_00005973"; exon_number "1"; oId "CUFF.5726.1"; tss_id "TSS5973"; +chr3 Cufflinks exon 41076147 41076184 . - . gene_id "XLOC_005974"; transcript_id "TCONS_00005974"; exon_number "1"; oId "CUFF.5727.1"; tss_id "TSS5974"; +chr3 Cufflinks exon 41426020 41426069 . - . gene_id "XLOC_005975"; transcript_id "TCONS_00005975"; exon_number "1"; oId "CUFF.5729.1"; tss_id "TSS5975"; +chr3 Cufflinks exon 41619331 41619365 . - . gene_id "XLOC_005976"; transcript_id "TCONS_00005976"; exon_number "1"; oId "CUFF.5730.1"; tss_id "TSS5976"; +chr3 Cufflinks exon 41808180 41808411 . - . gene_id "XLOC_005977"; transcript_id "TCONS_00005977"; exon_number "1"; oId "CUFF.5731.1"; tss_id "TSS5977"; +chr3 Cufflinks exon 41940662 41940743 . - . gene_id "XLOC_005978"; transcript_id "TCONS_00005978"; exon_number "1"; oId "CUFF.5732.1"; tss_id "TSS5978"; +chr3 Cufflinks exon 42717659 42717983 . - . gene_id "XLOC_005979"; transcript_id "TCONS_00005979"; exon_number "1"; oId "CUFF.5735.1"; tss_id "TSS5979"; +chr3 Cufflinks exon 44364161 44364196 . - . gene_id "XLOC_005980"; transcript_id "TCONS_00005980"; exon_number "1"; oId "CUFF.5739.1"; tss_id "TSS5980"; +chr3 Cufflinks exon 45076010 45076081 . - . gene_id "XLOC_005981"; transcript_id "TCONS_00005981"; exon_number "1"; oId "CUFF.5742.1"; tss_id "TSS5981"; +chr3 Cufflinks exon 45296901 45297107 . - . gene_id "XLOC_005982"; transcript_id "TCONS_00005982"; exon_number "1"; oId "CUFF.5743.1"; tss_id "TSS5982"; +chr3 Cufflinks exon 45338311 45338353 . - . gene_id "XLOC_005983"; transcript_id "TCONS_00005983"; exon_number "1"; oId "CUFF.5744.1"; tss_id "TSS5983"; +chr3 Cufflinks exon 45494768 45494852 . - . gene_id "XLOC_005984"; transcript_id "TCONS_00005984"; exon_number "1"; oId "CUFF.5745.1"; tss_id "TSS5984"; +chr3 Cufflinks exon 45730490 45730563 . - . gene_id "XLOC_005985"; transcript_id "TCONS_00005985"; exon_number "1"; oId "CUFF.5746.1"; tss_id "TSS5985"; +chr3 Cufflinks exon 46499884 46499939 . - . gene_id "XLOC_005986"; transcript_id "TCONS_00005986"; exon_number "1"; oId "CUFF.5748.1"; tss_id "TSS5986"; +chr3 Cufflinks exon 46776976 46777012 . - . gene_id "XLOC_005987"; transcript_id "TCONS_00005987"; exon_number "1"; oId "CUFF.5750.1"; tss_id "TSS5987"; +chr3 Cufflinks exon 47292010 47292117 . - . gene_id "XLOC_005988"; transcript_id "TCONS_00005988"; exon_number "1"; oId "CUFF.5752.1"; tss_id "TSS5988"; +chr3 Cufflinks exon 47601705 47602018 . - . gene_id "XLOC_005989"; transcript_id "TCONS_00005989"; exon_number "1"; oId "CUFF.5755.1"; tss_id "TSS5989"; +chr3 Cufflinks exon 48136274 48136595 . - . gene_id "XLOC_005990"; transcript_id "TCONS_00005990"; exon_number "1"; oId "CUFF.5756.1"; tss_id "TSS5990"; +chr3 Cufflinks exon 48706510 48706570 . - . gene_id "XLOC_005991"; transcript_id "TCONS_00005991"; exon_number "1"; oId "CUFF.5760.1"; tss_id "TSS5991"; +chr3 Cufflinks exon 48862745 48862834 . - . gene_id "XLOC_005992"; transcript_id "TCONS_00005992"; exon_number "1"; oId "CUFF.5762.1"; tss_id "TSS5992"; +chr3 Cufflinks exon 49448637 49448677 . - . gene_id "XLOC_005993"; transcript_id "TCONS_00005993"; exon_number "1"; oId "CUFF.5767.1"; tss_id "TSS5993"; +chr3 Cufflinks exon 49504578 49504664 . - . gene_id "XLOC_005994"; transcript_id "TCONS_00005994"; exon_number "1"; oId "CUFF.5770.1"; tss_id "TSS5994"; +chr3 Cufflinks exon 49766335 49766385 . - . gene_id "XLOC_005995"; transcript_id "TCONS_00005995"; exon_number "1"; oId "CUFF.5771.1"; tss_id "TSS5995"; +chr3 Cufflinks exon 49900787 49901093 . - . gene_id "XLOC_005996"; transcript_id "TCONS_00005996"; exon_number "1"; oId "CUFF.5772.1"; tss_id "TSS5996"; +chr3 Cufflinks exon 50881423 50881460 . - . gene_id "XLOC_005997"; transcript_id "TCONS_00005997"; exon_number "1"; oId "CUFF.5777.1"; tss_id "TSS5997"; +chr3 Cufflinks exon 51728479 51728598 . - . gene_id "XLOC_005998"; transcript_id "TCONS_00005998"; exon_number "1"; oId "CUFF.5779.1"; tss_id "TSS5998"; +chr3 Cufflinks exon 52585862 52585959 . - . gene_id "XLOC_005999"; transcript_id "TCONS_00005999"; exon_number "1"; oId "CUFF.5781.1"; tss_id "TSS5999"; +chr3 Cufflinks exon 53317217 53317320 . - . gene_id "XLOC_006000"; transcript_id "TCONS_00006000"; exon_number "1"; oId "CUFF.5783.1"; tss_id "TSS6000"; +chr3 Cufflinks exon 54100863 54101014 . - . gene_id "XLOC_006001"; transcript_id "TCONS_00006001"; exon_number "1"; oId "CUFF.5784.1"; tss_id "TSS6001"; +chr3 Cufflinks exon 57455869 57455978 . - . gene_id "XLOC_006002"; transcript_id "TCONS_00006002"; exon_number "1"; oId "CUFF.5790.1"; tss_id "TSS6002"; +chr3 Cufflinks exon 57521983 57522085 . - . gene_id "XLOC_006003"; transcript_id "TCONS_00006003"; exon_number "1"; oId "CUFF.5792.1"; tss_id "TSS6003"; +chr3 Cufflinks exon 57799851 57799910 . - . gene_id "XLOC_006004"; transcript_id "TCONS_00006004"; exon_number "1"; oId "CUFF.5794.1"; tss_id "TSS6004"; +chr3 Cufflinks exon 60842061 60842277 . - . gene_id "XLOC_006005"; transcript_id "TCONS_00006005"; exon_number "1"; oId "CUFF.5798.1"; tss_id "TSS6005"; +chr3 Cufflinks exon 61068548 61068637 . - . gene_id "XLOC_006006"; transcript_id "TCONS_00006006"; exon_number "1"; oId "CUFF.5799.1"; tss_id "TSS6006"; +chr3 Cufflinks exon 61618206 61618247 . - . gene_id "XLOC_006007"; transcript_id "TCONS_00006007"; exon_number "1"; oId "CUFF.5801.1"; tss_id "TSS6007"; +chr3 Cufflinks exon 62104128 62104182 . - . gene_id "XLOC_006008"; transcript_id "TCONS_00006008"; exon_number "1"; oId "CUFF.5802.1"; tss_id "TSS6008"; +chr3 Cufflinks exon 62781789 62782088 . - . gene_id "XLOC_006009"; transcript_id "TCONS_00006009"; exon_number "1"; oId "CUFF.5805.1"; tss_id "TSS6009"; +chr3 Cufflinks exon 63076649 63076686 . - . gene_id "XLOC_006010"; transcript_id "TCONS_00006010"; exon_number "1"; oId "CUFF.5807.1"; tss_id "TSS6010"; +chr3 Cufflinks exon 63097353 63097381 . - . gene_id "XLOC_006011"; transcript_id "TCONS_00006011"; exon_number "1"; oId "CUFF.5808.1"; tss_id "TSS6011"; +chr3 Cufflinks exon 64057483 64057695 . - . gene_id "XLOC_006012"; transcript_id "TCONS_00006012"; exon_number "1"; oId "CUFF.5810.1"; tss_id "TSS6012"; +chr3 Cufflinks exon 64356486 64356637 . - . gene_id "XLOC_006013"; transcript_id "TCONS_00006013"; exon_number "1"; oId "CUFF.5811.1"; tss_id "TSS6013"; +chr3 Cufflinks exon 64389730 64389782 . - . gene_id "XLOC_006014"; transcript_id "TCONS_00006014"; exon_number "1"; oId "CUFF.5812.1"; tss_id "TSS6014"; +chr3 Cufflinks exon 66343538 66343644 . - . gene_id "XLOC_006015"; transcript_id "TCONS_00006015"; exon_number "1"; oId "CUFF.5815.1"; tss_id "TSS6015"; +chr3 Cufflinks exon 67884830 67884960 . - . gene_id "XLOC_006016"; transcript_id "TCONS_00006016"; exon_number "1"; oId "CUFF.5817.1"; tss_id "TSS6016"; +chr3 Cufflinks exon 68319311 68319347 . - . gene_id "XLOC_006017"; transcript_id "TCONS_00006017"; exon_number "1"; oId "CUFF.5818.1"; tss_id "TSS6017"; +chr3 Cufflinks exon 68357662 68357700 . - . gene_id "XLOC_006018"; transcript_id "TCONS_00006018"; exon_number "1"; oId "CUFF.5819.1"; tss_id "TSS6018"; +chr3 Cufflinks exon 68670886 68670950 . - . gene_id "XLOC_006019"; transcript_id "TCONS_00006019"; exon_number "1"; oId "CUFF.5820.1"; tss_id "TSS6019"; +chr3 Cufflinks exon 68708203 68708253 . - . gene_id "XLOC_006020"; transcript_id "TCONS_00006020"; exon_number "1"; oId "CUFF.5821.1"; tss_id "TSS6020"; +chr3 Cufflinks exon 69044515 69044581 . - . gene_id "XLOC_006021"; transcript_id "TCONS_00006021"; exon_number "1"; oId "CUFF.5825.1"; tss_id "TSS6021"; +chr3 Cufflinks exon 69415612 69415650 . - . gene_id "XLOC_006022"; transcript_id "TCONS_00006022"; exon_number "1"; oId "CUFF.5827.1"; tss_id "TSS6022"; +chr3 Cufflinks exon 69679150 69679182 . - . gene_id "XLOC_006023"; transcript_id "TCONS_00006023"; exon_number "1"; oId "CUFF.5828.1"; tss_id "TSS6023"; +chr3 Cufflinks exon 69818619 69818919 . - . gene_id "XLOC_006024"; transcript_id "TCONS_00006024"; exon_number "1"; oId "CUFF.5830.1"; tss_id "TSS6024"; +chr3 Cufflinks exon 72740874 72740962 . - . gene_id "XLOC_006025"; transcript_id "TCONS_00006025"; exon_number "1"; oId "CUFF.5837.1"; tss_id "TSS6025"; +chr3 Cufflinks exon 72783915 72783950 . - . gene_id "XLOC_006026"; transcript_id "TCONS_00006026"; exon_number "1"; oId "CUFF.5838.1"; tss_id "TSS6026"; +chr3 Cufflinks exon 73141343 73141407 . - . gene_id "XLOC_006027"; transcript_id "TCONS_00006027"; exon_number "1"; oId "CUFF.5843.1"; tss_id "TSS6027"; +chr3 Cufflinks exon 73290940 73291047 . - . gene_id "XLOC_006028"; transcript_id "TCONS_00006028"; exon_number "1"; oId "CUFF.5845.1"; tss_id "TSS6028"; +chr3 Cufflinks exon 73308557 73308668 . - . gene_id "XLOC_006029"; transcript_id "TCONS_00006029"; exon_number "1"; oId "CUFF.5846.1"; tss_id "TSS6029"; +chr3 Cufflinks exon 73643094 73643152 . - . gene_id "XLOC_006030"; transcript_id "TCONS_00006030"; exon_number "1"; oId "CUFF.5848.1"; tss_id "TSS6030"; +chr3 Cufflinks exon 74008848 74009078 . - . gene_id "XLOC_006031"; transcript_id "TCONS_00006031"; exon_number "1"; oId "CUFF.5849.1"; tss_id "TSS6031"; +chr3 Cufflinks exon 75231894 75232198 . - . gene_id "XLOC_006032"; transcript_id "TCONS_00006032"; exon_number "1"; oId "CUFF.5850.1"; tss_id "TSS6032"; +chr3 Cufflinks exon 77860894 77860995 . - . gene_id "XLOC_006033"; transcript_id "TCONS_00006033"; exon_number "1"; oId "CUFF.5852.1"; tss_id "TSS6033"; +chr3 Cufflinks exon 78987189 78987429 . - . gene_id "XLOC_006034"; transcript_id "TCONS_00006034"; exon_number "1"; oId "CUFF.5855.1"; tss_id "TSS6034"; +chr3 Cufflinks exon 80677129 80677228 . - . gene_id "XLOC_006035"; transcript_id "TCONS_00006035"; exon_number "1"; oId "CUFF.5858.1"; tss_id "TSS6035"; +chr3 Cufflinks exon 80841873 80842046 . - . gene_id "XLOC_006036"; transcript_id "TCONS_00006036"; exon_number "1"; oId "CUFF.5859.1"; tss_id "TSS6036"; +chr3 Cufflinks exon 83737524 83737760 . - . gene_id "XLOC_006037"; transcript_id "TCONS_00006037"; exon_number "1"; oId "CUFF.5862.1"; tss_id "TSS6037"; +chr3 Cufflinks exon 85440965 85441034 . - . gene_id "XLOC_006038"; transcript_id "TCONS_00006038"; exon_number "1"; oId "CUFF.5864.1"; tss_id "TSS6038"; +chr3 Cufflinks exon 85807850 85807904 . - . gene_id "XLOC_006039"; transcript_id "TCONS_00006039"; exon_number "1"; oId "CUFF.5865.1"; tss_id "TSS6039"; +chr3 Cufflinks exon 87339937 87339975 . - . gene_id "XLOC_006040"; transcript_id "TCONS_00006040"; exon_number "1"; oId "CUFF.5868.1"; tss_id "TSS6040"; +chr3 Cufflinks exon 87414843 87414881 . - . gene_id "XLOC_006041"; transcript_id "TCONS_00006041"; exon_number "1"; oId "CUFF.5869.1"; tss_id "TSS6041"; +chr3 Cufflinks exon 87791693 87791798 . - . gene_id "XLOC_006042"; transcript_id "TCONS_00006042"; exon_number "1"; oId "CUFF.5871.1"; tss_id "TSS6042"; +chr3 Cufflinks exon 88550916 88550979 . - . gene_id "XLOC_006043"; transcript_id "TCONS_00006043"; exon_number "1"; oId "CUFF.5872.1"; tss_id "TSS6043"; +chr3 Cufflinks exon 89957336 89957372 . - . gene_id "XLOC_006044"; transcript_id "TCONS_00006044"; exon_number "1"; oId "CUFF.5874.1"; tss_id "TSS6044"; +chr3 Cufflinks exon 93817352 93817410 . - . gene_id "XLOC_006045"; transcript_id "TCONS_00006045"; exon_number "1"; oId "CUFF.5880.1"; tss_id "TSS6045"; +chr3 Cufflinks exon 94237958 94237999 . - . gene_id "XLOC_006046"; transcript_id "TCONS_00006046"; exon_number "1"; oId "CUFF.5881.1"; tss_id "TSS6046"; +chr3 Cufflinks exon 96327664 96327761 . - . gene_id "XLOC_006047"; transcript_id "TCONS_00006047"; exon_number "1"; oId "CUFF.5883.1"; tss_id "TSS6047"; +chr3 Cufflinks exon 98523822 98523928 . - . gene_id "XLOC_006048"; transcript_id "TCONS_00006048"; exon_number "1"; oId "CUFF.5887.1"; tss_id "TSS6048"; +chr3 Cufflinks exon 98590951 98591024 . - . gene_id "XLOC_006049"; transcript_id "TCONS_00006049"; exon_number "1"; oId "CUFF.5888.1"; tss_id "TSS6049"; +chr3 Cufflinks exon 100139012 100139065 . - . gene_id "XLOC_006050"; transcript_id "TCONS_00006050"; exon_number "1"; oId "CUFF.5892.1"; tss_id "TSS6050"; +chr3 Cufflinks exon 100504555 100504592 . - . gene_id "XLOC_006051"; transcript_id "TCONS_00006051"; exon_number "1"; oId "CUFF.5893.1"; tss_id "TSS6051"; +chr3 Cufflinks exon 100885218 100885251 . - . gene_id "XLOC_006052"; transcript_id "TCONS_00006052"; exon_number "1"; oId "CUFF.5896.1"; tss_id "TSS6052"; +chr3 Cufflinks exon 101886173 101886227 . - . gene_id "XLOC_006053"; transcript_id "TCONS_00006053"; exon_number "1"; oId "CUFF.5900.1"; tss_id "TSS6053"; +chr3 Cufflinks exon 102413436 102413502 . - . gene_id "XLOC_006054"; transcript_id "TCONS_00006054"; exon_number "1"; oId "CUFF.5901.1"; tss_id "TSS6054"; +chr3 Cufflinks exon 102473912 102474017 . - . gene_id "XLOC_006055"; transcript_id "TCONS_00006055"; exon_number "1"; oId "CUFF.5903.1"; tss_id "TSS6055"; +chr3 Cufflinks exon 103879521 103879581 . - . gene_id "XLOC_006056"; transcript_id "TCONS_00006056"; exon_number "1"; oId "CUFF.5905.1"; tss_id "TSS6056"; +chr3 Cufflinks exon 104529778 104529986 . - . gene_id "XLOC_006057"; transcript_id "TCONS_00006057"; exon_number "1"; oId "CUFF.5906.1"; tss_id "TSS6057"; +chr3 Cufflinks exon 104974905 104974943 . - . gene_id "XLOC_006058"; transcript_id "TCONS_00006058"; exon_number "1"; oId "CUFF.5907.1"; tss_id "TSS6058"; +chr3 Cufflinks exon 106556113 106556158 . - . gene_id "XLOC_006059"; transcript_id "TCONS_00006059"; exon_number "1"; oId "CUFF.5908.1"; tss_id "TSS6059"; +chr3 Cufflinks exon 106620879 106620949 . - . gene_id "XLOC_006060"; transcript_id "TCONS_00006060"; exon_number "1"; oId "CUFF.5909.1"; tss_id "TSS6060"; +chr3 Cufflinks exon 108737761 108737963 . - . gene_id "XLOC_006061"; transcript_id "TCONS_00006061"; exon_number "1"; oId "CUFF.5914.1"; tss_id "TSS6061"; +chr3 Cufflinks exon 110281910 110281979 . - . gene_id "XLOC_006062"; transcript_id "TCONS_00006062"; exon_number "1"; oId "CUFF.5918.1"; tss_id "TSS6062"; +chr3 Cufflinks exon 111372623 111372657 . - . gene_id "XLOC_006063"; transcript_id "TCONS_00006063"; exon_number "1"; oId "CUFF.5921.1"; tss_id "TSS6063"; +chr3 Cufflinks exon 111598191 111598262 . - . gene_id "XLOC_006064"; transcript_id "TCONS_00006064"; exon_number "1"; oId "CUFF.5924.1"; tss_id "TSS6064"; +chr3 Cufflinks exon 111673767 111673838 . - . gene_id "XLOC_006065"; transcript_id "TCONS_00006065"; exon_number "1"; oId "CUFF.5925.1"; tss_id "TSS6065"; +chr3 Cufflinks exon 114168592 114168643 . - . gene_id "XLOC_006066"; transcript_id "TCONS_00006066"; exon_number "1"; oId "CUFF.5929.1"; tss_id "TSS6066"; +chr3 Cufflinks exon 116301459 116301677 . - . gene_id "XLOC_006067"; transcript_id "TCONS_00006067"; exon_number "1"; oId "CUFF.5931.1"; tss_id "TSS6067"; +chr3 Cufflinks exon 116683958 116684072 . - . gene_id "XLOC_006068"; transcript_id "TCONS_00006068"; exon_number "1"; oId "CUFF.5932.1"; tss_id "TSS6068"; +chr3 Cufflinks exon 117154009 117154090 . - . gene_id "XLOC_006069"; transcript_id "TCONS_00006069"; exon_number "1"; oId "CUFF.5934.1"; tss_id "TSS6069"; +chr3 Cufflinks exon 117527099 117527163 . - . gene_id "XLOC_006070"; transcript_id "TCONS_00006070"; exon_number "1"; oId "CUFF.5937.1"; tss_id "TSS6070"; +chr3 Cufflinks exon 119060684 119060787 . - . gene_id "XLOC_006071"; transcript_id "TCONS_00006071"; exon_number "1"; oId "CUFF.5939.1"; tss_id "TSS6071"; +chr3 Cufflinks exon 119829324 119829633 . - . gene_id "XLOC_006072"; transcript_id "TCONS_00006072"; exon_number "1"; oId "CUFF.5942.1"; tss_id "TSS6072"; +chr3 Cufflinks exon 120441166 120441233 . - . gene_id "XLOC_006073"; transcript_id "TCONS_00006073"; exon_number "1"; oId "CUFF.5944.1"; tss_id "TSS6073"; +chr3 Cufflinks exon 120502101 120502135 . - . gene_id "XLOC_006074"; transcript_id "TCONS_00006074"; exon_number "1"; oId "CUFF.5945.1"; tss_id "TSS6074"; +chr3 Cufflinks exon 121306397 121306443 . - . gene_id "XLOC_006075"; transcript_id "TCONS_00006075"; exon_number "1"; oId "CUFF.5946.1"; tss_id "TSS6075"; +chr3 Cufflinks exon 121372820 121373143 . - . gene_id "XLOC_006076"; transcript_id "TCONS_00006076"; exon_number "1"; oId "CUFF.5948.1"; tss_id "TSS6076"; +chr3 Cufflinks exon 121374334 121374438 . - . gene_id "XLOC_006077"; transcript_id "TCONS_00006077"; exon_number "1"; oId "CUFF.5949.1"; tss_id "TSS6077"; +chr3 Cufflinks exon 121529754 121529826 . - . gene_id "XLOC_006078"; transcript_id "TCONS_00006078"; exon_number "1"; oId "CUFF.5951.1"; tss_id "TSS6078"; +chr3 Cufflinks exon 122261631 122261671 . - . gene_id "XLOC_006079"; transcript_id "TCONS_00006079"; exon_number "1"; oId "CUFF.5953.1"; tss_id "TSS6079"; +chr3 Cufflinks exon 122624897 122624945 . - . gene_id "XLOC_006080"; transcript_id "TCONS_00006080"; exon_number "1"; oId "CUFF.5956.1"; tss_id "TSS6080"; +chr3 Cufflinks exon 122734689 122734816 . - . gene_id "XLOC_006081"; transcript_id "TCONS_00006081"; exon_number "1"; oId "CUFF.5957.1"; tss_id "TSS6081"; +chr3 Cufflinks exon 123701893 123701938 . - . gene_id "XLOC_006082"; transcript_id "TCONS_00006082"; exon_number "1"; oId "CUFF.5958.1"; tss_id "TSS6082"; +chr3 Cufflinks exon 124309472 124309506 . - . gene_id "XLOC_006083"; transcript_id "TCONS_00006083"; exon_number "1"; oId "CUFF.5960.1"; tss_id "TSS6083"; +chr3 Cufflinks exon 124511227 124511386 . - . gene_id "XLOC_006084"; transcript_id "TCONS_00006084"; exon_number "1"; oId "CUFF.5961.1"; tss_id "TSS6084"; +chr3 Cufflinks exon 124739343 124739400 . - . gene_id "XLOC_006085"; transcript_id "TCONS_00006085"; exon_number "1"; oId "CUFF.5962.1"; tss_id "TSS6085"; +chr3 Cufflinks exon 124777193 124777282 . - . gene_id "XLOC_006086"; transcript_id "TCONS_00006086"; exon_number "1"; oId "CUFF.5963.1"; tss_id "TSS6086"; +chr3 Cufflinks exon 124837941 124838043 . - . gene_id "XLOC_006087"; transcript_id "TCONS_00006087"; exon_number "1"; oId "CUFF.5964.1"; tss_id "TSS6087"; +chr3 Cufflinks exon 124953807 124953859 . - . gene_id "XLOC_006088"; transcript_id "TCONS_00006088"; exon_number "1"; oId "CUFF.5965.1"; tss_id "TSS6088"; +chr3 Cufflinks exon 125058701 125058742 . - . gene_id "XLOC_006089"; transcript_id "TCONS_00006089"; exon_number "1"; oId "CUFF.5966.1"; tss_id "TSS6089"; +chr3 Cufflinks exon 125413174 125413248 . - . gene_id "XLOC_006090"; transcript_id "TCONS_00006090"; exon_number "1"; oId "CUFF.5969.1"; tss_id "TSS6090"; +chr3 Cufflinks exon 125879124 125879287 . - . gene_id "XLOC_006091"; transcript_id "TCONS_00006091"; exon_number "1"; oId "CUFF.5970.1"; tss_id "TSS6091"; +chr3 Cufflinks exon 126283432 126283520 . - . gene_id "XLOC_006092"; transcript_id "TCONS_00006092"; exon_number "1"; oId "CUFF.5971.1"; tss_id "TSS6092"; +chr3 Cufflinks exon 127681530 127681700 . - . gene_id "XLOC_006093"; transcript_id "TCONS_00006093"; exon_number "1"; oId "CUFF.5972.1"; tss_id "TSS6093"; +chr3 Cufflinks exon 127793920 127794092 . - . gene_id "XLOC_006094"; transcript_id "TCONS_00006094"; exon_number "1"; oId "CUFF.5975.1"; tss_id "TSS6094"; +chr3 Cufflinks exon 127860741 127860820 . - . gene_id "XLOC_006095"; transcript_id "TCONS_00006095"; exon_number "1"; oId "CUFF.5976.1"; tss_id "TSS6095"; +chr3 Cufflinks exon 128392516 128392689 . - . gene_id "XLOC_006096"; transcript_id "TCONS_00006096"; exon_number "1"; oId "CUFF.5977.1"; tss_id "TSS6096"; +chr3 Cufflinks exon 129630086 129630119 . - . gene_id "XLOC_006097"; transcript_id "TCONS_00006097"; exon_number "1"; oId "CUFF.5986.1"; tss_id "TSS6097"; +chr3 Cufflinks exon 130530695 130530939 . - . gene_id "XLOC_006098"; transcript_id "TCONS_00006098"; exon_number "1"; oId "CUFF.5988.1"; tss_id "TSS6098"; +chr3 Cufflinks exon 130811667 130811771 . - . gene_id "XLOC_006099"; transcript_id "TCONS_00006099"; exon_number "1"; oId "CUFF.5990.1"; tss_id "TSS6099"; +chr3 Cufflinks exon 131057241 131057274 . - . gene_id "XLOC_006100"; transcript_id "TCONS_00006100"; exon_number "1"; oId "CUFF.5991.1"; tss_id "TSS6100"; +chr3 Cufflinks exon 131136688 131136842 . - . gene_id "XLOC_006101"; transcript_id "TCONS_00006101"; exon_number "1"; oId "CUFF.5992.1"; tss_id "TSS6101"; +chr3 Cufflinks exon 131947944 131948015 . - . gene_id "XLOC_006102"; transcript_id "TCONS_00006102"; exon_number "1"; oId "CUFF.5994.1"; tss_id "TSS6102"; +chr3 Cufflinks exon 131950642 131950713 . - . gene_id "XLOC_006103"; transcript_id "TCONS_00006103"; exon_number "1"; oId "CUFF.5995.1"; tss_id "TSS6103"; +chr3 Cufflinks exon 133204695 133204762 . - . gene_id "XLOC_006104"; transcript_id "TCONS_00006104"; exon_number "1"; oId "CUFF.5999.1"; tss_id "TSS6104"; +chr3 Cufflinks exon 133205074 133205106 . - . gene_id "XLOC_006105"; transcript_id "TCONS_00006105"; exon_number "1"; oId "CUFF.6000.1"; tss_id "TSS6105"; +chr3 Cufflinks exon 133428930 133429019 . - . gene_id "XLOC_006106"; transcript_id "TCONS_00006106"; exon_number "1"; oId "CUFF.6002.1"; tss_id "TSS6106"; +chr3 Cufflinks exon 133522094 133522129 . - . gene_id "XLOC_006107"; transcript_id "TCONS_00006107"; exon_number "1"; oId "CUFF.6003.1"; tss_id "TSS6107"; +chr3 Cufflinks exon 134499369 134499469 . - . gene_id "XLOC_006108"; transcript_id "TCONS_00006108"; exon_number "1"; oId "CUFF.6004.1"; tss_id "TSS6108"; +chr3 Cufflinks exon 134502308 134502397 . - . gene_id "XLOC_006109"; transcript_id "TCONS_00006109"; exon_number "1"; oId "CUFF.6005.1"; tss_id "TSS6109"; +chr3 Cufflinks exon 136008812 136008848 . - . gene_id "XLOC_006110"; transcript_id "TCONS_00006110"; exon_number "1"; oId "CUFF.6006.1"; tss_id "TSS6110"; +chr3 Cufflinks exon 136148926 136149025 . - . gene_id "XLOC_006111"; transcript_id "TCONS_00006111"; exon_number "1"; oId "CUFF.6007.1"; tss_id "TSS6111"; +chr3 Cufflinks exon 136249262 136249310 . - . gene_id "XLOC_006112"; transcript_id "TCONS_00006112"; exon_number "1"; oId "CUFF.6008.1"; tss_id "TSS6112"; +chr3 Cufflinks exon 136440268 136440337 . - . gene_id "XLOC_006113"; transcript_id "TCONS_00006113"; exon_number "1"; oId "CUFF.6009.1"; tss_id "TSS6113"; +chr3 Cufflinks exon 137237008 137237097 . - . gene_id "XLOC_006114"; transcript_id "TCONS_00006114"; exon_number "1"; oId "CUFF.6011.1"; tss_id "TSS6114"; +chr3 Cufflinks exon 138801288 138801365 . - . gene_id "XLOC_006115"; transcript_id "TCONS_00006115"; exon_number "1"; oId "CUFF.6014.1"; tss_id "TSS6115"; +chr3 Cufflinks exon 139303048 139303287 . - . gene_id "XLOC_006116"; transcript_id "TCONS_00006116"; exon_number "1"; oId "CUFF.6016.1"; tss_id "TSS6116"; +chr3 Cufflinks exon 139328500 139328787 . - . gene_id "XLOC_006117"; transcript_id "TCONS_00006117"; exon_number "1"; oId "CUFF.6017.1"; tss_id "TSS6117"; +chr3 Cufflinks exon 139876814 139876847 . - . gene_id "XLOC_006118"; transcript_id "TCONS_00006118"; exon_number "1"; oId "CUFF.6019.1"; tss_id "TSS6118"; +chr3 Cufflinks exon 140086036 140086082 . - . gene_id "XLOC_006119"; transcript_id "TCONS_00006119"; exon_number "1"; oId "CUFF.6020.1"; tss_id "TSS6119"; +chr3 Cufflinks exon 141621768 141621872 . - . gene_id "XLOC_006120"; transcript_id "TCONS_00006120"; exon_number "1"; oId "CUFF.6021.1"; tss_id "TSS6120"; +chr3 Cufflinks exon 141747751 141747784 . - . gene_id "XLOC_006121"; transcript_id "TCONS_00006121"; exon_number "1"; oId "CUFF.6022.1"; tss_id "TSS6121"; +chr3 Cufflinks exon 142099317 142099354 . - . gene_id "XLOC_006122"; transcript_id "TCONS_00006122"; exon_number "1"; oId "CUFF.6027.1"; tss_id "TSS6122"; +chr3 Cufflinks exon 142126505 142126612 . - . gene_id "XLOC_006123"; transcript_id "TCONS_00006123"; exon_number "1"; oId "CUFF.6028.1"; tss_id "TSS6123"; +chr3 Cufflinks exon 142139046 142139205 . - . gene_id "XLOC_006124"; transcript_id "TCONS_00006124"; exon_number "1"; oId "CUFF.6029.1"; tss_id "TSS6124"; +chr3 Cufflinks exon 142310544 142310633 . - . gene_id "XLOC_006125"; transcript_id "TCONS_00006125"; exon_number "1"; oId "CUFF.6030.1"; tss_id "TSS6125"; +chr3 Cufflinks exon 142370389 142370467 . - . gene_id "XLOC_006126"; transcript_id "TCONS_00006126"; exon_number "1"; oId "CUFF.6031.1"; tss_id "TSS6126"; +chr3 Cufflinks exon 142384659 142384747 . - . gene_id "XLOC_006127"; transcript_id "TCONS_00006127"; exon_number "1"; oId "CUFF.6032.1"; tss_id "TSS6127"; +chr3 Cufflinks exon 142677677 142677834 . - . gene_id "XLOC_006128"; transcript_id "TCONS_00006128"; exon_number "1"; oId "CUFF.6035.1"; tss_id "TSS6128"; +chr3 Cufflinks exon 143905746 143905862 . - . gene_id "XLOC_006129"; transcript_id "TCONS_00006129"; exon_number "1"; oId "CUFF.6036.1"; tss_id "TSS6129"; +chr3 Cufflinks exon 144979417 144979451 . - . gene_id "XLOC_006130"; transcript_id "TCONS_00006130"; exon_number "1"; oId "CUFF.6038.1"; tss_id "TSS6130"; +chr3 Cufflinks exon 145741167 145741199 . - . gene_id "XLOC_006131"; transcript_id "TCONS_00006131"; exon_number "1"; oId "CUFF.6039.1"; tss_id "TSS6131"; +chr3 Cufflinks exon 146030892 146030964 . - . gene_id "XLOC_006132"; transcript_id "TCONS_00006132"; exon_number "1"; oId "CUFF.6040.1"; tss_id "TSS6132"; +chr3 Cufflinks exon 146041406 146041451 . - . gene_id "XLOC_006133"; transcript_id "TCONS_00006133"; exon_number "1"; oId "CUFF.6041.1"; tss_id "TSS6133"; +chr3 Cufflinks exon 146714394 146714500 . - . gene_id "XLOC_006134"; transcript_id "TCONS_00006134"; exon_number "1"; oId "CUFF.6043.1"; tss_id "TSS6134"; +chr3 Cufflinks exon 146936910 146937042 . - . gene_id "XLOC_006135"; transcript_id "TCONS_00006135"; exon_number "1"; oId "CUFF.6044.1"; tss_id "TSS6135"; +chr3 Cufflinks exon 147902962 147903138 . - . gene_id "XLOC_006136"; transcript_id "TCONS_00006136"; exon_number "1"; oId "CUFF.6045.1"; tss_id "TSS6136"; +chr3 Cufflinks exon 148221228 148221309 . - . gene_id "XLOC_006137"; transcript_id "TCONS_00006137"; exon_number "1"; oId "CUFF.6046.1"; tss_id "TSS6137"; +chr3 Cufflinks exon 148316563 148316634 . - . gene_id "XLOC_006138"; transcript_id "TCONS_00006138"; exon_number "1"; oId "CUFF.6047.1"; tss_id "TSS6138"; +chr3 Cufflinks exon 149036456 149036551 . - . gene_id "XLOC_006139"; transcript_id "TCONS_00006139"; exon_number "1"; oId "CUFF.6050.1"; tss_id "TSS6139"; +chr3 Cufflinks exon 149121772 149121827 . - . gene_id "XLOC_006140"; transcript_id "TCONS_00006140"; exon_number "1"; oId "CUFF.6051.1"; tss_id "TSS6140"; +chr3 Cufflinks exon 149496796 149496885 . - . gene_id "XLOC_006141"; transcript_id "TCONS_00006141"; exon_number "1"; oId "CUFF.6054.1"; tss_id "TSS6141"; +chr3 Cufflinks exon 149635168 149635236 . - . gene_id "XLOC_006142"; transcript_id "TCONS_00006142"; exon_number "1"; oId "CUFF.6055.1"; tss_id "TSS6142"; +chr3 Cufflinks exon 149795511 149795619 . - . gene_id "XLOC_006143"; transcript_id "TCONS_00006143"; exon_number "1"; oId "CUFF.6056.1"; tss_id "TSS6143"; +chr3 Cufflinks exon 152780999 152781073 . - . gene_id "XLOC_006144"; transcript_id "TCONS_00006144"; exon_number "1"; oId "CUFF.6062.1"; tss_id "TSS6144"; +chr3 Cufflinks exon 152852128 152852310 . - . gene_id "XLOC_006145"; transcript_id "TCONS_00006145"; exon_number "1"; oId "CUFF.6063.1"; tss_id "TSS6145"; +chr3 Cufflinks exon 152917469 152917806 . - . gene_id "XLOC_006146"; transcript_id "TCONS_00006146"; exon_number "1"; oId "CUFF.6064.1"; tss_id "TSS6146"; +chr3 Cufflinks exon 153725157 153725292 . - . gene_id "XLOC_006147"; transcript_id "TCONS_00006147"; exon_number "1"; oId "CUFF.6067.1"; tss_id "TSS6147"; +chr3 Cufflinks exon 154247090 154247132 . - . gene_id "XLOC_006148"; transcript_id "TCONS_00006148"; exon_number "1"; oId "CUFF.6069.1"; tss_id "TSS6148"; +chr3 Cufflinks exon 154748751 154748815 . - . gene_id "XLOC_006149"; transcript_id "TCONS_00006149"; exon_number "1"; oId "CUFF.6070.1"; tss_id "TSS6149"; +chr3 Cufflinks exon 155047308 155047360 . - . gene_id "XLOC_006150"; transcript_id "TCONS_00006150"; exon_number "1"; oId "CUFF.6071.1"; tss_id "TSS6150"; +chr3 Cufflinks exon 155093796 155093838 . - . gene_id "XLOC_006151"; transcript_id "TCONS_00006151"; exon_number "1"; oId "CUFF.6073.1"; tss_id "TSS6151"; +chr3 Cufflinks exon 155155308 155155611 . - . gene_id "XLOC_006152"; transcript_id "TCONS_00006152"; exon_number "1"; oId "CUFF.6074.1"; tss_id "TSS6152"; +chr3 Cufflinks exon 155726594 155726668 . - . gene_id "XLOC_006153"; transcript_id "TCONS_00006153"; exon_number "1"; oId "CUFF.6076.1"; tss_id "TSS6153"; +chr3 Cufflinks exon 155824013 155824051 . - . gene_id "XLOC_006154"; transcript_id "TCONS_00006154"; exon_number "1"; oId "CUFF.6077.1"; tss_id "TSS6154"; +chr3 Cufflinks exon 156891705 156891829 . - . gene_id "XLOC_006155"; transcript_id "TCONS_00006155"; exon_number "1"; oId "CUFF.6080.1"; tss_id "TSS6155"; +chr3 Cufflinks exon 157138767 157138831 . - . gene_id "XLOC_006156"; transcript_id "TCONS_00006156"; exon_number "1"; oId "CUFF.6081.1"; tss_id "TSS6156"; +chr3 Cufflinks exon 157648329 157648514 . - . gene_id "XLOC_006157"; transcript_id "TCONS_00006157"; exon_number "1"; oId "CUFF.6082.1"; tss_id "TSS6157"; +chr3 Cufflinks exon 157950226 157950262 . - . gene_id "XLOC_006158"; transcript_id "TCONS_00006158"; exon_number "1"; oId "CUFF.6083.1"; tss_id "TSS6158"; +chr3 Cufflinks exon 158564367 158564446 . - . gene_id "XLOC_006159"; transcript_id "TCONS_00006159"; exon_number "1"; oId "CUFF.6084.1"; tss_id "TSS6159"; +chr3 Cufflinks exon 159526283 159526359 . - . gene_id "XLOC_006160"; transcript_id "TCONS_00006160"; exon_number "1"; oId "CUFF.6086.1"; tss_id "TSS6160"; +chr3 Cufflinks exon 160190160 160190204 . - . gene_id "XLOC_006161"; transcript_id "TCONS_00006161"; exon_number "1"; oId "CUFF.6090.1"; tss_id "TSS6161"; +chr3 Cufflinks exon 160814714 160814745 . - . gene_id "XLOC_006162"; transcript_id "TCONS_00006162"; exon_number "1"; oId "CUFF.6092.1"; tss_id "TSS6162"; +chr3 Cufflinks exon 160893299 160893407 . - . gene_id "XLOC_006163"; transcript_id "TCONS_00006163"; exon_number "1"; oId "CUFF.6093.1"; tss_id "TSS6163"; +chr3 Cufflinks exon 160914222 160914258 . - . gene_id "XLOC_006164"; transcript_id "TCONS_00006164"; exon_number "1"; oId "CUFF.6094.1"; tss_id "TSS6164"; +chr3 Cufflinks exon 161186955 161187053 . - . gene_id "XLOC_006165"; transcript_id "TCONS_00006165"; exon_number "1"; oId "CUFF.6095.1"; tss_id "TSS6165"; +chr3 Cufflinks exon 162754288 162754321 . - . gene_id "XLOC_006166"; transcript_id "TCONS_00006166"; exon_number "1"; oId "CUFF.6096.1"; tss_id "TSS6166"; +chr3 Cufflinks exon 162896672 162896760 . - . gene_id "XLOC_006167"; transcript_id "TCONS_00006167"; exon_number "1"; oId "CUFF.6097.1"; tss_id "TSS6167"; +chr3 Cufflinks exon 163187994 163188054 . - . gene_id "XLOC_006168"; transcript_id "TCONS_00006168"; exon_number "1"; oId "CUFF.6098.1"; tss_id "TSS6168"; +chr3 Cufflinks exon 166226614 166226675 . - . gene_id "XLOC_006169"; transcript_id "TCONS_00006169"; exon_number "1"; oId "CUFF.6100.1"; tss_id "TSS6169"; +chr3 Cufflinks exon 166387791 166387906 . - . gene_id "XLOC_006170"; transcript_id "TCONS_00006170"; exon_number "1"; oId "CUFF.6101.1"; tss_id "TSS6170"; +chr3 Cufflinks exon 169437975 169438081 . - . gene_id "XLOC_006171"; transcript_id "TCONS_00006171"; exon_number "1"; oId "CUFF.6106.1"; tss_id "TSS6171"; +chr3 Cufflinks exon 170712659 170712821 . - . gene_id "XLOC_006172"; transcript_id "TCONS_00006172"; exon_number "1"; oId "CUFF.6113.1"; tss_id "TSS6172"; +chr3 Cufflinks exon 171222034 171222140 . - . gene_id "XLOC_006173"; transcript_id "TCONS_00006173"; exon_number "1"; oId "CUFF.6114.1"; tss_id "TSS6173"; +chr3 Cufflinks exon 172347106 172347199 . - . gene_id "XLOC_006174"; transcript_id "TCONS_00006174"; exon_number "1"; oId "CUFF.6117.1"; tss_id "TSS6174"; +chr3 Cufflinks exon 172514281 172514348 . - . gene_id "XLOC_006175"; transcript_id "TCONS_00006175"; exon_number "1"; oId "CUFF.6120.1"; tss_id "TSS6175"; +chr3 Cufflinks exon 172692929 172693033 . - . gene_id "XLOC_006176"; transcript_id "TCONS_00006176"; exon_number "1"; oId "CUFF.6121.1"; tss_id "TSS6176"; +chr3 Cufflinks exon 172729251 172729288 . - . gene_id "XLOC_006177"; transcript_id "TCONS_00006177"; exon_number "1"; oId "CUFF.6122.1"; tss_id "TSS6177"; +chr3 Cufflinks exon 173598072 173598107 . - . gene_id "XLOC_006178"; transcript_id "TCONS_00006178"; exon_number "1"; oId "CUFF.6124.1"; tss_id "TSS6178"; +chr3 Cufflinks exon 174433950 174434069 . - . gene_id "XLOC_006179"; transcript_id "TCONS_00006179"; exon_number "1"; oId "CUFF.6128.1"; tss_id "TSS6179"; +chr3 Cufflinks exon 175115036 175115136 . - . gene_id "XLOC_006180"; transcript_id "TCONS_00006180"; exon_number "1"; oId "CUFF.6129.1"; tss_id "TSS6180"; +chr3 Cufflinks exon 176843805 176843907 . - . gene_id "XLOC_006181"; transcript_id "TCONS_00006181"; exon_number "1"; oId "CUFF.6137.1"; tss_id "TSS6181"; +chr3 Cufflinks exon 177029543 177029583 . - . gene_id "XLOC_006182"; transcript_id "TCONS_00006182"; exon_number "1"; oId "CUFF.6138.1"; tss_id "TSS6182"; +chr3 Cufflinks exon 177221172 177221340 . - . gene_id "XLOC_006183"; transcript_id "TCONS_00006183"; exon_number "1"; oId "CUFF.6139.1"; tss_id "TSS6183"; +chr3 Cufflinks exon 177725461 177725560 . - . gene_id "XLOC_006184"; transcript_id "TCONS_00006184"; exon_number "1"; oId "CUFF.6140.1"; tss_id "TSS6184"; +chr3 Cufflinks exon 178146988 178147077 . - . gene_id "XLOC_006185"; transcript_id "TCONS_00006185"; exon_number "1"; oId "CUFF.6141.1"; tss_id "TSS6185"; +chr3 Cufflinks exon 179049115 179049149 . - . gene_id "XLOC_006186"; transcript_id "TCONS_00006186"; exon_number "1"; oId "CUFF.6145.1"; tss_id "TSS6186"; +chr3 Cufflinks exon 179069097 179069138 . - . gene_id "XLOC_006187"; transcript_id "TCONS_00006187"; exon_number "1"; oId "CUFF.6146.1"; tss_id "TSS6187"; +chr3 Cufflinks exon 179332560 179332667 . - . gene_id "XLOC_006188"; transcript_id "TCONS_00006188"; exon_number "1"; oId "CUFF.6147.1"; tss_id "TSS6188"; +chr3 Cufflinks exon 179651801 179651902 . - . gene_id "XLOC_006189"; transcript_id "TCONS_00006189"; exon_number "1"; oId "CUFF.6149.1"; tss_id "TSS6189"; +chr3 Cufflinks exon 179879675 179879765 . - . gene_id "XLOC_006190"; transcript_id "TCONS_00006190"; exon_number "1"; oId "CUFF.6151.1"; tss_id "TSS6190"; +chr3 Cufflinks exon 180213941 180213979 . - . gene_id "XLOC_006191"; transcript_id "TCONS_00006191"; exon_number "1"; oId "CUFF.6152.1"; tss_id "TSS6191"; +chr3 Cufflinks exon 180454175 180454491 . - . gene_id "XLOC_006192"; transcript_id "TCONS_00006192"; exon_number "1"; oId "CUFF.6155.1"; tss_id "TSS6192"; +chr3 Cufflinks exon 181540659 181540778 . - . gene_id "XLOC_006193"; transcript_id "TCONS_00006193"; exon_number "1"; oId "CUFF.6160.1"; tss_id "TSS6193"; +chr3 Cufflinks exon 182366343 182366382 . - . gene_id "XLOC_006194"; transcript_id "TCONS_00006194"; exon_number "1"; oId "CUFF.6163.1"; tss_id "TSS6194"; +chr3 Cufflinks exon 182892724 182892795 . - . gene_id "XLOC_006195"; transcript_id "TCONS_00006195"; exon_number "1"; oId "CUFF.6165.1"; tss_id "TSS6195"; +chr3 Cufflinks exon 182976115 182976204 . - . gene_id "XLOC_006196"; transcript_id "TCONS_00006196"; exon_number "1"; oId "CUFF.6166.1"; tss_id "TSS6196"; +chr3 Cufflinks exon 183069042 183069135 . - . gene_id "XLOC_006197"; transcript_id "TCONS_00006197"; exon_number "1"; oId "CUFF.6167.1"; tss_id "TSS6197"; +chr3 Cufflinks exon 184366095 184366165 . - . gene_id "XLOC_006198"; transcript_id "TCONS_00006198"; exon_number "1"; oId "CUFF.6168.1"; tss_id "TSS6198"; +chr3 Cufflinks exon 185155649 185155764 . - . gene_id "XLOC_006199"; transcript_id "TCONS_00006199"; exon_number "1"; oId "CUFF.6169.1"; tss_id "TSS6199"; +chr3 Cufflinks exon 185178988 185179029 . - . gene_id "XLOC_006200"; transcript_id "TCONS_00006200"; exon_number "1"; oId "CUFF.6171.1"; tss_id "TSS6200"; +chr3 Cufflinks exon 185794072 185794380 . - . gene_id "XLOC_006201"; transcript_id "TCONS_00006201"; exon_number "1"; oId "CUFF.6173.1"; tss_id "TSS6201"; +chr3 Cufflinks exon 185841108 185841148 . - . gene_id "XLOC_006202"; transcript_id "TCONS_00006202"; exon_number "1"; oId "CUFF.6174.1"; tss_id "TSS6202"; +chr3 Cufflinks exon 186489630 186489736 . - . gene_id "XLOC_006203"; transcript_id "TCONS_00006203"; exon_number "1"; oId "CUFF.6177.1"; tss_id "TSS6203"; +chr3 Cufflinks exon 186512346 186512386 . - . gene_id "XLOC_006204"; transcript_id "TCONS_00006204"; exon_number "1"; oId "CUFF.6178.1"; tss_id "TSS6204"; +chr3 Cufflinks exon 188187711 188187759 . - . gene_id "XLOC_006205"; transcript_id "TCONS_00006205"; exon_number "1"; oId "CUFF.6183.1"; tss_id "TSS6205"; +chr3 Cufflinks exon 188637948 188637989 . - . gene_id "XLOC_006206"; transcript_id "TCONS_00006206"; exon_number "1"; oId "CUFF.6185.1"; tss_id "TSS6206"; +chr3 Cufflinks exon 189265666 189265708 . - . gene_id "XLOC_006207"; transcript_id "TCONS_00006207"; exon_number "1"; oId "CUFF.6186.1"; tss_id "TSS6207"; +chr3 Cufflinks exon 189302043 189302102 . - . gene_id "XLOC_006208"; transcript_id "TCONS_00006208"; exon_number "1"; oId "CUFF.6187.1"; tss_id "TSS6208"; +chr3 Cufflinks exon 189883206 189883312 . - . gene_id "XLOC_006209"; transcript_id "TCONS_00006209"; exon_number "1"; oId "CUFF.6189.1"; tss_id "TSS6209"; +chr3 Cufflinks exon 190977437 190977508 . - . gene_id "XLOC_006210"; transcript_id "TCONS_00006210"; exon_number "1"; oId "CUFF.6195.1"; tss_id "TSS6210"; +chr3 Cufflinks exon 191450313 191450362 . - . gene_id "XLOC_006211"; transcript_id "TCONS_00006211"; exon_number "1"; oId "CUFF.6196.1"; tss_id "TSS6211"; +chr3 Cufflinks exon 192225505 192225576 . - . gene_id "XLOC_006212"; transcript_id "TCONS_00006212"; exon_number "1"; oId "CUFF.6198.1"; tss_id "TSS6212"; +chr3 Cufflinks exon 192251795 192251902 . - . gene_id "XLOC_006213"; transcript_id "TCONS_00006213"; exon_number "1"; oId "CUFF.6199.1"; tss_id "TSS6213"; +chr3 Cufflinks exon 192447343 192447499 . - . gene_id "XLOC_006214"; transcript_id "TCONS_00006214"; exon_number "1"; oId "CUFF.6201.1"; tss_id "TSS6214"; +chr3 Cufflinks exon 192734057 192734087 . - . gene_id "XLOC_006215"; transcript_id "TCONS_00006215"; exon_number "1"; oId "CUFF.6202.1"; tss_id "TSS6215"; +chr3 Cufflinks exon 193458242 193458475 . - . gene_id "XLOC_006216"; transcript_id "TCONS_00006216"; exon_number "1"; oId "CUFF.6204.1"; tss_id "TSS6216"; +chr3 Cufflinks exon 194254232 194254305 . - . gene_id "XLOC_006217"; transcript_id "TCONS_00006217"; exon_number "1"; oId "CUFF.6208.1"; tss_id "TSS6217"; +chr3 Cufflinks exon 194254623 194254662 . - . gene_id "XLOC_006218"; transcript_id "TCONS_00006218"; exon_number "1"; oId "CUFF.6209.1"; tss_id "TSS6218"; +chr3 Cufflinks exon 194867437 194867732 . - . gene_id "XLOC_006219"; transcript_id "TCONS_00006219"; exon_number "1"; oId "CUFF.6210.1"; tss_id "TSS6219"; +chr3 Cufflinks exon 195119015 195119048 . - . gene_id "XLOC_006220"; transcript_id "TCONS_00006220"; exon_number "1"; oId "CUFF.6212.1"; tss_id "TSS6220"; +chr3 Cufflinks exon 195258476 195258530 . - . gene_id "XLOC_006221"; transcript_id "TCONS_00006221"; exon_number "1"; oId "CUFF.6214.1"; tss_id "TSS6221"; +chr3 Cufflinks exon 195647706 195648000 . - . gene_id "XLOC_006222"; transcript_id "TCONS_00006222"; exon_number "1"; oId "CUFF.6217.1"; tss_id "TSS6222"; +chr3 Cufflinks exon 195655479 195655641 . - . gene_id "XLOC_006223"; transcript_id "TCONS_00006223"; exon_number "1"; oId "CUFF.6218.1"; tss_id "TSS6223"; +chr3 Cufflinks exon 195903750 195903797 . - . gene_id "XLOC_006224"; transcript_id "TCONS_00006224"; exon_number "1"; oId "CUFF.6220.1"; tss_id "TSS6224"; +chr3 Cufflinks exon 196068476 196068586 . - . gene_id "XLOC_006225"; transcript_id "TCONS_00006225"; exon_number "1"; oId "CUFF.6221.1"; tss_id "TSS6225"; +chr3 Cufflinks exon 196120581 196120683 . - . gene_id "XLOC_006226"; transcript_id "TCONS_00006226"; exon_number "1"; oId "CUFF.6222.1"; tss_id "TSS6226"; +chr3 Cufflinks exon 196124368 196124649 . - . gene_id "XLOC_006227"; transcript_id "TCONS_00006227"; exon_number "1"; oId "CUFF.6223.1"; tss_id "TSS6227"; +chr3 Cufflinks exon 196435731 196435835 . - . gene_id "XLOC_006228"; transcript_id "TCONS_00006228"; exon_number "1"; oId "CUFF.6226.1"; tss_id "TSS6228"; +chr3 Cufflinks exon 196442096 196442147 . - . gene_id "XLOC_006229"; transcript_id "TCONS_00006229"; exon_number "1"; oId "CUFF.6227.1"; tss_id "TSS6229"; +chr3 Cufflinks exon 196474127 196474195 . - . gene_id "XLOC_006230"; transcript_id "TCONS_00006230"; exon_number "1"; oId "CUFF.6228.1"; tss_id "TSS6230"; +chr3 Cufflinks exon 196511851 196511957 . - . gene_id "XLOC_006231"; transcript_id "TCONS_00006231"; exon_number "1"; oId "CUFF.6229.1"; tss_id "TSS6231"; +chr3 Cufflinks exon 197066325 197066419 . - . gene_id "XLOC_006232"; transcript_id "TCONS_00006232"; exon_number "1"; oId "CUFF.6230.1"; tss_id "TSS6232"; +chr3 Cufflinks exon 197084628 197084679 . - . gene_id "XLOC_006233"; transcript_id "TCONS_00006233"; exon_number "1"; oId "CUFF.6231.1"; tss_id "TSS6233"; +chr3 Cufflinks exon 197798183 197798287 . - . gene_id "XLOC_006234"; transcript_id "TCONS_00006234"; exon_number "1"; oId "CUFF.6234.1"; tss_id "TSS6234"; +chr4 Cufflinks exon 1997632 1997682 . + . gene_id "XLOC_006235"; transcript_id "TCONS_00006235"; exon_number "1"; oId "CUFF.6237.1"; tss_id "TSS6235"; +chr4 Cufflinks exon 3045828 3045929 . + . gene_id "XLOC_006236"; transcript_id "TCONS_00006236"; exon_number "1"; oId "CUFF.6241.1"; tss_id "TSS6236"; +chr4 Cufflinks exon 5490049 5490091 . + . gene_id "XLOC_006237"; transcript_id "TCONS_00006237"; exon_number "1"; oId "CUFF.6247.1"; tss_id "TSS6237"; +chr4 Cufflinks exon 6998739 6999053 . + . gene_id "XLOC_006238"; transcript_id "TCONS_00006238"; exon_number "1"; oId "CUFF.6248.1"; tss_id "TSS6238"; +chr4 Cufflinks exon 7584187 7584364 . + . gene_id "XLOC_006239"; transcript_id "TCONS_00006239"; exon_number "1"; oId "CUFF.6250.1"; tss_id "TSS6239"; +chr4 Cufflinks exon 8394742 8394853 . + . gene_id "XLOC_006240"; transcript_id "TCONS_00006240"; exon_number "1"; oId "CUFF.6251.1"; tss_id "TSS6240"; +chr4 Cufflinks exon 10563336 10563458 . + . gene_id "XLOC_006241"; transcript_id "TCONS_00006241"; exon_number "1"; oId "CUFF.6255.1"; tss_id "TSS6241"; +chr4 Cufflinks exon 12314238 12314314 . + . gene_id "XLOC_006242"; transcript_id "TCONS_00006242"; exon_number "1"; oId "CUFF.6258.1"; tss_id "TSS6242"; +chr4 Cufflinks exon 12798370 12798414 . + . gene_id "XLOC_006243"; transcript_id "TCONS_00006243"; exon_number "1"; oId "CUFF.6259.1"; tss_id "TSS6243"; +chr4 Cufflinks exon 13052967 13053115 . + . gene_id "XLOC_006244"; transcript_id "TCONS_00006244"; exon_number "1"; oId "CUFF.6260.1"; tss_id "TSS6244"; +chr4 Cufflinks exon 13726258 13726295 . + . gene_id "XLOC_006245"; transcript_id "TCONS_00006245"; exon_number "1"; oId "CUFF.6261.1"; tss_id "TSS6245"; +chr4 Cufflinks exon 15467585 15467632 . + . gene_id "XLOC_006246"; transcript_id "TCONS_00006246"; exon_number "1"; oId "CUFF.6264.1"; tss_id "TSS6246"; +chr4 Cufflinks exon 17530559 17530666 . + . gene_id "XLOC_006247"; transcript_id "TCONS_00006247"; exon_number "1"; oId "CUFF.6267.1"; tss_id "TSS6247"; +chr4 Cufflinks exon 19059105 19059144 . + . gene_id "XLOC_006248"; transcript_id "TCONS_00006248"; exon_number "1"; oId "CUFF.6270.1"; tss_id "TSS6248"; +chr4 Cufflinks exon 20657719 20657762 . + . gene_id "XLOC_006249"; transcript_id "TCONS_00006249"; exon_number "1"; oId "CUFF.6273.1"; tss_id "TSS6249"; +chr4 Cufflinks exon 21720159 21720194 . + . gene_id "XLOC_006250"; transcript_id "TCONS_00006250"; exon_number "1"; oId "CUFF.6274.1"; tss_id "TSS6250"; +chr4 Cufflinks exon 22120607 22120712 . + . gene_id "XLOC_006251"; transcript_id "TCONS_00006251"; exon_number "1"; oId "CUFF.6275.1"; tss_id "TSS6251"; +chr4 Cufflinks exon 22351072 22351180 . + . gene_id "XLOC_006252"; transcript_id "TCONS_00006252"; exon_number "1"; oId "CUFF.6276.1"; tss_id "TSS6252"; +chr4 Cufflinks exon 22377557 22377612 . + . gene_id "XLOC_006253"; transcript_id "TCONS_00006253"; exon_number "1"; oId "CUFF.6277.1"; tss_id "TSS6253"; +chr4 Cufflinks exon 25252167 25252228 . + . gene_id "XLOC_006254"; transcript_id "TCONS_00006254"; exon_number "1"; oId "CUFF.6281.1"; tss_id "TSS6254"; +chr4 Cufflinks exon 26337975 26338022 . + . gene_id "XLOC_006255"; transcript_id "TCONS_00006255"; exon_number "1"; oId "CUFF.6283.1"; tss_id "TSS6255"; +chr4 Cufflinks exon 28712821 28713108 . + . gene_id "XLOC_006256"; transcript_id "TCONS_00006256"; exon_number "1"; oId "CUFF.6286.1"; tss_id "TSS6256"; +chr4 Cufflinks exon 29512257 29512353 . + . gene_id "XLOC_006257"; transcript_id "TCONS_00006257"; exon_number "1"; oId "CUFF.6287.1"; tss_id "TSS6257"; +chr4 Cufflinks exon 31924298 31924344 . + . gene_id "XLOC_006258"; transcript_id "TCONS_00006258"; exon_number "1"; oId "CUFF.6291.1"; tss_id "TSS6258"; +chr4 Cufflinks exon 32237723 32237758 . + . gene_id "XLOC_006259"; transcript_id "TCONS_00006259"; exon_number "1"; oId "CUFF.6292.1"; tss_id "TSS6259"; +chr4 Cufflinks exon 33786563 33786609 . + . gene_id "XLOC_006260"; transcript_id "TCONS_00006260"; exon_number "1"; oId "CUFF.6293.1"; tss_id "TSS6260"; +chr4 Cufflinks exon 35497520 35497625 . + . gene_id "XLOC_006261"; transcript_id "TCONS_00006261"; exon_number "1"; oId "CUFF.6296.1"; tss_id "TSS6261"; +chr4 Cufflinks exon 38411171 38411226 . + . gene_id "XLOC_006262"; transcript_id "TCONS_00006262"; exon_number "1"; oId "CUFF.6303.1"; tss_id "TSS6262"; +chr4 Cufflinks exon 39400769 39400864 . + . gene_id "XLOC_006263"; transcript_id "TCONS_00006263"; exon_number "1"; oId "CUFF.6306.1"; tss_id "TSS6263"; +chr4 Cufflinks exon 39622633 39622692 . + . gene_id "XLOC_006264"; transcript_id "TCONS_00006264"; exon_number "1"; oId "CUFF.6307.1"; tss_id "TSS6264"; +chr4 Cufflinks exon 39645672 39645758 . + . gene_id "XLOC_006265"; transcript_id "TCONS_00006265"; exon_number "1"; oId "CUFF.6308.1"; tss_id "TSS6265"; +chr4 Cufflinks exon 39762620 39762931 . + . gene_id "XLOC_006266"; transcript_id "TCONS_00006266"; exon_number "1"; oId "CUFF.6309.1"; tss_id "TSS6266"; +chr4 Cufflinks exon 39938400 39938475 . + . gene_id "XLOC_006267"; transcript_id "TCONS_00006267"; exon_number "1"; oId "CUFF.6310.1"; tss_id "TSS6267"; +chr4 Cufflinks exon 40079506 40079602 . + . gene_id "XLOC_006268"; transcript_id "TCONS_00006268"; exon_number "1"; oId "CUFF.6312.1"; tss_id "TSS6268"; +chr4 Cufflinks exon 40992171 40992292 . + . gene_id "XLOC_006269"; transcript_id "TCONS_00006269"; exon_number "1"; oId "CUFF.6317.1"; tss_id "TSS6269"; +chr4 Cufflinks exon 41086625 41086730 . + . gene_id "XLOC_006270"; transcript_id "TCONS_00006270"; exon_number "1"; oId "CUFF.6318.1"; tss_id "TSS6270"; +chr4 Cufflinks exon 41115959 41116062 . + . gene_id "XLOC_006271"; transcript_id "TCONS_00006271"; exon_number "1"; oId "CUFF.6319.1"; tss_id "TSS6271"; +chr4 Cufflinks exon 41184469 41184506 . + . gene_id "XLOC_006272"; transcript_id "TCONS_00006272"; exon_number "1"; oId "CUFF.6320.1"; tss_id "TSS6272"; +chr4 Cufflinks exon 41617975 41618033 . + . gene_id "XLOC_006273"; transcript_id "TCONS_00006273"; exon_number "1"; oId "CUFF.6321.1"; tss_id "TSS6273"; +chr4 Cufflinks exon 41854497 41854573 . + . gene_id "XLOC_006274"; transcript_id "TCONS_00006274"; exon_number "1"; oId "CUFF.6323.1"; tss_id "TSS6274"; +chr4 Cufflinks exon 42894418 42894559 . + . gene_id "XLOC_006275"; transcript_id "TCONS_00006275"; exon_number "1"; oId "CUFF.6325.1"; tss_id "TSS6275"; +chr4 Cufflinks exon 43243915 43243982 . + . gene_id "XLOC_006276"; transcript_id "TCONS_00006276"; exon_number "1"; oId "CUFF.6326.1"; tss_id "TSS6276"; +chr4 Cufflinks exon 43865335 43865583 . + . gene_id "XLOC_006277"; transcript_id "TCONS_00006277"; exon_number "1"; oId "CUFF.6328.1"; tss_id "TSS6277"; +chr4 Cufflinks exon 44766119 44766154 . + . gene_id "XLOC_006278"; transcript_id "TCONS_00006278"; exon_number "1"; oId "CUFF.6329.1"; tss_id "TSS6278"; +chr4 Cufflinks exon 45482051 45482147 . + . gene_id "XLOC_006279"; transcript_id "TCONS_00006279"; exon_number "1"; oId "CUFF.6331.1"; tss_id "TSS6279"; +chr4 Cufflinks exon 45997136 45997375 . + . gene_id "XLOC_006280"; transcript_id "TCONS_00006280"; exon_number "1"; oId "CUFF.6332.1"; tss_id "TSS6280"; +chr4 Cufflinks exon 47753290 47753327 . + . gene_id "XLOC_006281"; transcript_id "TCONS_00006281"; exon_number "1"; oId "CUFF.6337.1"; tss_id "TSS6281"; +chr4 Cufflinks exon 48481216 48481269 . + . gene_id "XLOC_006282"; transcript_id "TCONS_00006282"; exon_number "1"; oId "CUFF.6341.1"; tss_id "TSS6282"; +chr4 Cufflinks exon 48952950 48953025 . + . gene_id "XLOC_006283"; transcript_id "TCONS_00006283"; exon_number "1"; oId "CUFF.6345.1"; tss_id "TSS6283"; +chr4 Cufflinks exon 53361015 53361117 . + . gene_id "XLOC_006284"; transcript_id "TCONS_00006284"; exon_number "1"; oId "CUFF.6347.1"; tss_id "TSS6284"; +chr4 Cufflinks exon 53376178 53376285 . + . gene_id "XLOC_006285"; transcript_id "TCONS_00006285"; exon_number "1"; oId "CUFF.6348.1"; tss_id "TSS6285"; +chr4 Cufflinks exon 53582262 53582304 . + . gene_id "XLOC_006286"; transcript_id "TCONS_00006286"; exon_number "1"; oId "CUFF.6349.1"; tss_id "TSS6286"; +chr4 Cufflinks exon 55013431 55013578 . + . gene_id "XLOC_006287"; transcript_id "TCONS_00006287"; exon_number "1"; oId "CUFF.6353.1"; tss_id "TSS6287"; +chr4 Cufflinks exon 55013972 55014043 . + . gene_id "XLOC_006288"; transcript_id "TCONS_00006288"; exon_number "1"; oId "CUFF.6354.1"; tss_id "TSS6288"; +chr4 Cufflinks exon 55895029 55895081 . + . gene_id "XLOC_006289"; transcript_id "TCONS_00006289"; exon_number "1"; oId "CUFF.6356.1"; tss_id "TSS6289"; +chr4 Cufflinks exon 55929908 55930194 . + . gene_id "XLOC_006290"; transcript_id "TCONS_00006290"; exon_number "1"; oId "CUFF.6358.1"; tss_id "TSS6290"; +chr4 Cufflinks exon 56160657 56160765 . + . gene_id "XLOC_006291"; transcript_id "TCONS_00006291"; exon_number "1"; oId "CUFF.6360.1"; tss_id "TSS6291"; +chr4 Cufflinks exon 56409670 56409703 . + . gene_id "XLOC_006292"; transcript_id "TCONS_00006292"; exon_number "1"; oId "CUFF.6362.1"; tss_id "TSS6292"; +chr4 Cufflinks exon 56664804 56664894 . + . gene_id "XLOC_006293"; transcript_id "TCONS_00006293"; exon_number "1"; oId "CUFF.6363.1"; tss_id "TSS6293"; +chr4 Cufflinks exon 56751761 56751862 . + . gene_id "XLOC_006294"; transcript_id "TCONS_00006294"; exon_number "1"; oId "CUFF.6364.1"; tss_id "TSS6294"; +chr4 Cufflinks exon 56963557 56963645 . + . gene_id "XLOC_006295"; transcript_id "TCONS_00006295"; exon_number "1"; oId "CUFF.6365.1"; tss_id "TSS6295"; +chr4 Cufflinks exon 57048646 57048686 . + . gene_id "XLOC_006296"; transcript_id "TCONS_00006296"; exon_number "1"; oId "CUFF.6366.1"; tss_id "TSS6296"; +chr4 Cufflinks exon 57672000 57672309 . + . gene_id "XLOC_006297"; transcript_id "TCONS_00006297"; exon_number "1"; oId "CUFF.6370.1"; tss_id "TSS6297"; +chr4 Cufflinks exon 57860240 57860339 . + . gene_id "XLOC_006298"; transcript_id "TCONS_00006298"; exon_number "1"; oId "CUFF.6371.1"; tss_id "TSS6298"; +chr4 Cufflinks exon 57868858 57868958 . + . gene_id "XLOC_006299"; transcript_id "TCONS_00006299"; exon_number "1"; oId "CUFF.6372.1"; tss_id "TSS6299"; +chr4 Cufflinks exon 58736062 58736135 . + . gene_id "XLOC_006300"; transcript_id "TCONS_00006300"; exon_number "1"; oId "CUFF.6376.1"; tss_id "TSS6300"; +chr4 Cufflinks exon 60699781 60699885 . + . gene_id "XLOC_006301"; transcript_id "TCONS_00006301"; exon_number "1"; oId "CUFF.6377.1"; tss_id "TSS6301"; +chr4 Cufflinks exon 61825046 61825096 . + . gene_id "XLOC_006302"; transcript_id "TCONS_00006302"; exon_number "1"; oId "CUFF.6378.1"; tss_id "TSS6302"; +chr4 Cufflinks exon 63816443 63816490 . + . gene_id "XLOC_006303"; transcript_id "TCONS_00006303"; exon_number "1"; oId "CUFF.6380.1"; tss_id "TSS6303"; +chr4 Cufflinks exon 65244514 65244557 . + . gene_id "XLOC_006304"; transcript_id "TCONS_00006304"; exon_number "1"; oId "CUFF.6382.1"; tss_id "TSS6304"; +chr4 Cufflinks exon 65649246 65649316 . + . gene_id "XLOC_006305"; transcript_id "TCONS_00006305"; exon_number "1"; oId "CUFF.6385.1"; tss_id "TSS6305"; +chr4 Cufflinks exon 67762980 67763089 . + . gene_id "XLOC_006306"; transcript_id "TCONS_00006306"; exon_number "1"; oId "CUFF.6387.1"; tss_id "TSS6306"; +chr4 Cufflinks exon 68305711 68305769 . + . gene_id "XLOC_006307"; transcript_id "TCONS_00006307"; exon_number "1"; oId "CUFF.6389.1"; tss_id "TSS6307"; +chr4 Cufflinks exon 68307766 68307832 . + . gene_id "XLOC_006308"; transcript_id "TCONS_00006308"; exon_number "1"; oId "CUFF.6390.1"; tss_id "TSS6308"; +chr4 Cufflinks exon 68869613 68869714 . + . gene_id "XLOC_006309"; transcript_id "TCONS_00006309"; exon_number "1"; oId "CUFF.6391.1"; tss_id "TSS6309"; +chr4 Cufflinks exon 69155712 69155762 . + . gene_id "XLOC_006310"; transcript_id "TCONS_00006310"; exon_number "1"; oId "CUFF.6392.1"; tss_id "TSS6310"; +chr4 Cufflinks exon 70656424 70656503 . + . gene_id "XLOC_006311"; transcript_id "TCONS_00006311"; exon_number "1"; oId "CUFF.6395.1"; tss_id "TSS6311"; +chr4 Cufflinks exon 71567472 71567575 . + . gene_id "XLOC_006312"; transcript_id "TCONS_00006312"; exon_number "1"; oId "CUFF.6397.1"; tss_id "TSS6312"; +chr4 Cufflinks exon 71677962 71678066 . + . gene_id "XLOC_006313"; transcript_id "TCONS_00006313"; exon_number "1"; oId "CUFF.6399.1"; tss_id "TSS6313"; +chr4 Cufflinks exon 71717847 71717957 . + . gene_id "XLOC_006314"; transcript_id "TCONS_00006314"; exon_number "1"; oId "CUFF.6401.1"; tss_id "TSS6314"; +chr4 Cufflinks exon 74315373 74315408 . + . gene_id "XLOC_006315"; transcript_id "TCONS_00006315"; exon_number "1"; oId "CUFF.6406.1"; tss_id "TSS6315"; +chr4 Cufflinks exon 74424951 74424991 . + . gene_id "XLOC_006316"; transcript_id "TCONS_00006316"; exon_number "1"; oId "CUFF.6407.1"; tss_id "TSS6316"; +chr4 Cufflinks exon 74877299 74877611 . + . gene_id "XLOC_006317"; transcript_id "TCONS_00006317"; exon_number "1"; oId "CUFF.6412.1"; tss_id "TSS6317"; +chr4 Cufflinks exon 75541642 75541676 . + . gene_id "XLOC_006318"; transcript_id "TCONS_00006318"; exon_number "1"; oId "CUFF.6413.1"; tss_id "TSS6318"; +chr4 Cufflinks exon 76807176 76807697 . + . gene_id "XLOC_006319"; transcript_id "TCONS_00006319"; exon_number "1"; oId "CUFF.6415.1"; tss_id "TSS6319"; +chr4 Cufflinks exon 77437021 77437175 . + . gene_id "XLOC_006320"; transcript_id "TCONS_00006320"; exon_number "1"; oId "CUFF.6417.1"; tss_id "TSS6320"; +chr4 Cufflinks exon 77657403 77657553 . + . gene_id "XLOC_006321"; transcript_id "TCONS_00006321"; exon_number "1"; oId "CUFF.6419.1"; tss_id "TSS6321"; +chr4 Cufflinks exon 77683160 77683241 . + . gene_id "XLOC_006322"; transcript_id "TCONS_00006322"; exon_number "1"; oId "CUFF.6420.1"; tss_id "TSS6322"; +chr4 Cufflinks exon 79561253 79561359 . + . gene_id "XLOC_006323"; transcript_id "TCONS_00006323"; exon_number "1"; oId "CUFF.6427.1"; tss_id "TSS6323"; +chr4 Cufflinks exon 79820012 79820312 . + . gene_id "XLOC_006324"; transcript_id "TCONS_00006324"; exon_number "1"; oId "CUFF.6429.1"; tss_id "TSS6324"; +chr4 Cufflinks exon 82255460 82255569 . + . gene_id "XLOC_006325"; transcript_id "TCONS_00006325"; exon_number "1"; oId "CUFF.6433.1"; tss_id "TSS6325"; +chr4 Cufflinks exon 82372223 82372258 . + . gene_id "XLOC_006326"; transcript_id "TCONS_00006326"; exon_number "1"; oId "CUFF.6434.1"; tss_id "TSS6326"; +chr4 Cufflinks exon 83095700 83095776 . + . gene_id "XLOC_006327"; transcript_id "TCONS_00006327"; exon_number "1"; oId "CUFF.6435.1"; tss_id "TSS6327"; +chr4 Cufflinks exon 83924605 83924664 . + . gene_id "XLOC_006328"; transcript_id "TCONS_00006328"; exon_number "1"; oId "CUFF.6436.1"; tss_id "TSS6328"; +chr4 Cufflinks exon 84505415 84505451 . + . gene_id "XLOC_006329"; transcript_id "TCONS_00006329"; exon_number "1"; oId "CUFF.6437.1"; tss_id "TSS6329"; +chr4 Cufflinks exon 84662816 84662868 . + . gene_id "XLOC_006330"; transcript_id "TCONS_00006330"; exon_number "1"; oId "CUFF.6438.1"; tss_id "TSS6330"; +chr4 Cufflinks exon 85154810 85154912 . + . gene_id "XLOC_006331"; transcript_id "TCONS_00006331"; exon_number "1"; oId "CUFF.6439.1"; tss_id "TSS6331"; +chr4 Cufflinks exon 86021649 86021976 . + . gene_id "XLOC_006332"; transcript_id "TCONS_00006332"; exon_number "1"; oId "CUFF.6442.1"; tss_id "TSS6332"; +chr4 Cufflinks exon 86243640 86243674 . + . gene_id "XLOC_006333"; transcript_id "TCONS_00006333"; exon_number "1"; oId "CUFF.6443.1"; tss_id "TSS6333"; +chr4 Cufflinks exon 86875724 86875831 . + . gene_id "XLOC_006334"; transcript_id "TCONS_00006334"; exon_number "1"; oId "CUFF.6444.1"; tss_id "TSS6334"; +chr4 Cufflinks exon 88383514 88383580 . + . gene_id "XLOC_006335"; transcript_id "TCONS_00006335"; exon_number "1"; oId "CUFF.6448.1"; tss_id "TSS6335"; +chr4 Cufflinks exon 88921391 88921551 . + . gene_id "XLOC_006336"; transcript_id "TCONS_00006336"; exon_number "1"; oId "CUFF.6451.1"; tss_id "TSS6336"; +chr4 Cufflinks exon 89122855 89122960 . + . gene_id "XLOC_006337"; transcript_id "TCONS_00006337"; exon_number "1"; oId "CUFF.6452.1"; tss_id "TSS6337"; +chr4 Cufflinks exon 89147879 89147979 . + . gene_id "XLOC_006338"; transcript_id "TCONS_00006338"; exon_number "1"; oId "CUFF.6453.1"; tss_id "TSS6338"; +chr4 Cufflinks exon 90052003 90052064 . + . gene_id "XLOC_006339"; transcript_id "TCONS_00006339"; exon_number "1"; oId "CUFF.6459.1"; tss_id "TSS6339"; +chr4 Cufflinks exon 90656947 90657059 . + . gene_id "XLOC_006340"; transcript_id "TCONS_00006340"; exon_number "1"; oId "CUFF.6462.1"; tss_id "TSS6340"; +chr4 Cufflinks exon 91291275 91291511 . + . gene_id "XLOC_006341"; transcript_id "TCONS_00006341"; exon_number "1"; oId "CUFF.6463.1"; tss_id "TSS6341"; +chr4 Cufflinks exon 92394556 92394607 . + . gene_id "XLOC_006342"; transcript_id "TCONS_00006342"; exon_number "1"; oId "CUFF.6467.1"; tss_id "TSS6342"; +chr4 Cufflinks exon 93623418 93623496 . + . gene_id "XLOC_006343"; transcript_id "TCONS_00006343"; exon_number "1"; oId "CUFF.6469.1"; tss_id "TSS6343"; +chr4 Cufflinks exon 94076199 94076257 . + . gene_id "XLOC_006344"; transcript_id "TCONS_00006344"; exon_number "1"; oId "CUFF.6470.1"; tss_id "TSS6344"; +chr4 Cufflinks exon 94741341 94741412 . + . gene_id "XLOC_006345"; transcript_id "TCONS_00006345"; exon_number "1"; oId "CUFF.6471.1"; tss_id "TSS6345"; +chr4 Cufflinks exon 95332172 95332223 . + . gene_id "XLOC_006346"; transcript_id "TCONS_00006346"; exon_number "1"; oId "CUFF.6473.1"; tss_id "TSS6346"; +chr4 Cufflinks exon 96975249 96975281 . + . gene_id "XLOC_006347"; transcript_id "TCONS_00006347"; exon_number "1"; oId "CUFF.6478.1"; tss_id "TSS6347"; +chr4 Cufflinks exon 99068722 99068751 . + . gene_id "XLOC_006348"; transcript_id "TCONS_00006348"; exon_number "1"; oId "CUFF.6481.1"; tss_id "TSS6348"; +chr4 Cufflinks exon 99276661 99276696 . + . gene_id "XLOC_006349"; transcript_id "TCONS_00006349"; exon_number "1"; oId "CUFF.6484.1"; tss_id "TSS6349"; +chr4 Cufflinks exon 99590248 99590282 . + . gene_id "XLOC_006350"; transcript_id "TCONS_00006350"; exon_number "1"; oId "CUFF.6485.1"; tss_id "TSS6350"; +chr4 Cufflinks exon 99590472 99590506 . + . gene_id "XLOC_006351"; transcript_id "TCONS_00006351"; exon_number "1"; oId "CUFF.6486.1"; tss_id "TSS6351"; +chr4 Cufflinks exon 100566178 100566241 . + . gene_id "XLOC_006352"; transcript_id "TCONS_00006352"; exon_number "1"; oId "CUFF.6492.1"; tss_id "TSS6352"; +chr4 Cufflinks exon 101236319 101236361 . + . gene_id "XLOC_006353"; transcript_id "TCONS_00006353"; exon_number "1"; oId "CUFF.6493.1"; tss_id "TSS6353"; +chr4 Cufflinks exon 101689729 101689785 . + . gene_id "XLOC_006354"; transcript_id "TCONS_00006354"; exon_number "1"; oId "CUFF.6494.1"; tss_id "TSS6354"; +chr4 Cufflinks exon 102645057 102645137 . + . gene_id "XLOC_006355"; transcript_id "TCONS_00006355"; exon_number "1"; oId "CUFF.6495.1"; tss_id "TSS6355"; +chr4 Cufflinks exon 102995940 102995978 . + . gene_id "XLOC_006356"; transcript_id "TCONS_00006356"; exon_number "1"; oId "CUFF.6496.1"; tss_id "TSS6356"; +chr4 Cufflinks exon 103323606 103323638 . + . gene_id "XLOC_006357"; transcript_id "TCONS_00006357"; exon_number "1"; oId "CUFF.6498.1"; tss_id "TSS6357"; +chr4 Cufflinks exon 103654049 103654197 . + . gene_id "XLOC_006358"; transcript_id "TCONS_00006358"; exon_number "1"; oId "CUFF.6499.1"; tss_id "TSS6358"; +chr4 Cufflinks exon 103865125 103865167 . + . gene_id "XLOC_006359"; transcript_id "TCONS_00006359"; exon_number "1"; oId "CUFF.6502.1"; tss_id "TSS6359"; +chr4 Cufflinks exon 103967511 103967566 . + . gene_id "XLOC_006360"; transcript_id "TCONS_00006360"; exon_number "1"; oId "CUFF.6503.1"; tss_id "TSS6360"; +chr4 Cufflinks exon 104665736 104665780 . + . gene_id "XLOC_006361"; transcript_id "TCONS_00006361"; exon_number "1"; oId "CUFF.6505.1"; tss_id "TSS6361"; +chr4 Cufflinks exon 105895837 105895922 . + . gene_id "XLOC_006362"; transcript_id "TCONS_00006362"; exon_number "1"; oId "CUFF.6506.1"; tss_id "TSS6362"; +chr4 Cufflinks exon 106214820 106215095 . + . gene_id "XLOC_006363"; transcript_id "TCONS_00006363"; exon_number "1"; oId "CUFF.6507.1"; tss_id "TSS6363"; +chr4 Cufflinks exon 106328160 106328246 . + . gene_id "XLOC_006364"; transcript_id "TCONS_00006364"; exon_number "1"; oId "CUFF.6508.1"; tss_id "TSS6364"; +chr4 Cufflinks exon 106356487 106356527 . + . gene_id "XLOC_006365"; transcript_id "TCONS_00006365"; exon_number "1"; oId "CUFF.6509.1"; tss_id "TSS6365"; +chr4 Cufflinks exon 106404301 106404339 . + . gene_id "XLOC_006366"; transcript_id "TCONS_00006366"; exon_number "1"; oId "CUFF.6510.1"; tss_id "TSS6366"; +chr4 Cufflinks exon 107282924 107282959 . + . gene_id "XLOC_006367"; transcript_id "TCONS_00006367"; exon_number "1"; oId "CUFF.6511.1"; tss_id "TSS6367"; +chr4 Cufflinks exon 107452372 107452418 . + . gene_id "XLOC_006368"; transcript_id "TCONS_00006368"; exon_number "1"; oId "CUFF.6512.1"; tss_id "TSS6368"; +chr4 Cufflinks exon 107907417 107907529 . + . gene_id "XLOC_006369"; transcript_id "TCONS_00006369"; exon_number "1"; oId "CUFF.6513.1"; tss_id "TSS6369"; +chr4 Cufflinks exon 108356275 108356369 . + . gene_id "XLOC_006370"; transcript_id "TCONS_00006370"; exon_number "1"; oId "CUFF.6515.1"; tss_id "TSS6370"; +chr4 Cufflinks exon 109218449 109218481 . + . gene_id "XLOC_006371"; transcript_id "TCONS_00006371"; exon_number "1"; oId "CUFF.6517.1"; tss_id "TSS6371"; +chr4 Cufflinks exon 109573306 109573412 . + . gene_id "XLOC_006372"; transcript_id "TCONS_00006372"; exon_number "1"; oId "CUFF.6518.1"; tss_id "TSS6372"; +chr4 Cufflinks exon 110913481 110913587 . + . gene_id "XLOC_006373"; transcript_id "TCONS_00006373"; exon_number "1"; oId "CUFF.6523.1"; tss_id "TSS6373"; +chr4 Cufflinks exon 111199341 111199433 . + . gene_id "XLOC_006374"; transcript_id "TCONS_00006374"; exon_number "1"; oId "CUFF.6524.1"; tss_id "TSS6374"; +chr4 Cufflinks exon 112252569 112252674 . + . gene_id "XLOC_006375"; transcript_id "TCONS_00006375"; exon_number "1"; oId "CUFF.6526.1"; tss_id "TSS6375"; +chr4 Cufflinks exon 112996043 112996086 . + . gene_id "XLOC_006376"; transcript_id "TCONS_00006376"; exon_number "1"; oId "CUFF.6527.1"; tss_id "TSS6376"; +chr4 Cufflinks exon 113161176 113161219 . + . gene_id "XLOC_006377"; transcript_id "TCONS_00006377"; exon_number "1"; oId "CUFF.6528.1"; tss_id "TSS6377"; +chr4 Cufflinks exon 113491414 113491448 . + . gene_id "XLOC_006378"; transcript_id "TCONS_00006378"; exon_number "1"; oId "CUFF.6530.1"; tss_id "TSS6378"; +chr4 Cufflinks exon 113575852 113575930 . + . gene_id "XLOC_006379"; transcript_id "TCONS_00006379"; exon_number "1"; oId "CUFF.6532.1"; tss_id "TSS6379"; +chr4 Cufflinks exon 113611605 113611856 . + . gene_id "XLOC_006380"; transcript_id "TCONS_00006380"; exon_number "1"; oId "CUFF.6534.1"; tss_id "TSS6380"; +chr4 Cufflinks exon 113708349 113708384 . + . gene_id "XLOC_006381"; transcript_id "TCONS_00006381"; exon_number "1"; oId "CUFF.6535.1"; tss_id "TSS6381"; +chr4 Cufflinks exon 114261205 114261309 . + . gene_id "XLOC_006382"; transcript_id "TCONS_00006382"; exon_number "1"; oId "CUFF.6537.1"; tss_id "TSS6382"; +chr4 Cufflinks exon 114340996 114341312 . + . gene_id "XLOC_006383"; transcript_id "TCONS_00006383"; exon_number "1"; oId "CUFF.6538.1"; tss_id "TSS6383"; +chr4 Cufflinks exon 114341479 114341643 . + . gene_id "XLOC_006384"; transcript_id "TCONS_00006384"; exon_number "1"; oId "CUFF.6539.1"; tss_id "TSS6384"; +chr4 Cufflinks exon 115302575 115302766 . + . gene_id "XLOC_006385"; transcript_id "TCONS_00006385"; exon_number "1"; oId "CUFF.6541.1"; tss_id "TSS6385"; +chr4 Cufflinks exon 115720487 115720784 . + . gene_id "XLOC_006386"; transcript_id "TCONS_00006386"; exon_number "1"; oId "CUFF.6542.1"; tss_id "TSS6386"; +chr4 Cufflinks exon 116882297 116882339 . + . gene_id "XLOC_006387"; transcript_id "TCONS_00006387"; exon_number "1"; oId "CUFF.6545.1"; tss_id "TSS6387"; +chr4 Cufflinks exon 116954722 116954754 . + . gene_id "XLOC_006388"; transcript_id "TCONS_00006388"; exon_number "1"; oId "CUFF.6546.1"; tss_id "TSS6388"; +chr4 Cufflinks exon 116976744 116976780 . + . gene_id "XLOC_006389"; transcript_id "TCONS_00006389"; exon_number "1"; oId "CUFF.6547.1"; tss_id "TSS6389"; +chr4 Cufflinks exon 117220914 117221002 . + . gene_id "XLOC_006390"; transcript_id "TCONS_00006390"; exon_number "1"; oId "CUFF.6548.1"; tss_id "TSS6390"; +chr4 Cufflinks exon 117568646 117568684 . + . gene_id "XLOC_006391"; transcript_id "TCONS_00006391"; exon_number "1"; oId "CUFF.6549.1"; tss_id "TSS6391"; +chr4 Cufflinks exon 117760435 117760540 . + . gene_id "XLOC_006392"; transcript_id "TCONS_00006392"; exon_number "1"; oId "CUFF.6550.1"; tss_id "TSS6392"; +chr4 Cufflinks exon 119509442 119509478 . + . gene_id "XLOC_006393"; transcript_id "TCONS_00006393"; exon_number "1"; oId "CUFF.6551.1"; tss_id "TSS6393"; +chr4 Cufflinks exon 119527606 119527708 . + . gene_id "XLOC_006394"; transcript_id "TCONS_00006394"; exon_number "1"; oId "CUFF.6552.1"; tss_id "TSS6394"; +chr4 Cufflinks exon 120158525 120158690 . + . gene_id "XLOC_006395"; transcript_id "TCONS_00006395"; exon_number "1"; oId "CUFF.6554.1"; tss_id "TSS6395"; +chr4 Cufflinks exon 120288717 120288788 . + . gene_id "XLOC_006396"; transcript_id "TCONS_00006396"; exon_number "1"; oId "CUFF.6555.1"; tss_id "TSS6396"; +chr4 Cufflinks exon 120615004 120615042 . + . gene_id "XLOC_006397"; transcript_id "TCONS_00006397"; exon_number "1"; oId "CUFF.6557.1"; tss_id "TSS6397"; +chr4 Cufflinks exon 121731624 121731720 . + . gene_id "XLOC_006398"; transcript_id "TCONS_00006398"; exon_number "1"; oId "CUFF.6559.1"; tss_id "TSS6398"; +chr4 Cufflinks exon 122852946 122853019 . + . gene_id "XLOC_006399"; transcript_id "TCONS_00006399"; exon_number "1"; oId "CUFF.6563.1"; tss_id "TSS6399"; +chr4 Cufflinks exon 126671579 126671636 . + . gene_id "XLOC_006400"; transcript_id "TCONS_00006400"; exon_number "1"; oId "CUFF.6570.1"; tss_id "TSS6400"; +chr4 Cufflinks exon 128736561 128736627 . + . gene_id "XLOC_006401"; transcript_id "TCONS_00006401"; exon_number "1"; oId "CUFF.6572.1"; tss_id "TSS6401"; +chr4 Cufflinks exon 128776380 128776428 . + . gene_id "XLOC_006402"; transcript_id "TCONS_00006402"; exon_number "1"; oId "CUFF.6573.1"; tss_id "TSS6402"; +chr4 Cufflinks exon 128813146 128813235 . + . gene_id "XLOC_006403"; transcript_id "TCONS_00006403"; exon_number "1"; oId "CUFF.6574.1"; tss_id "TSS6403"; +chr4 Cufflinks exon 129204598 129204641 . + . gene_id "XLOC_006404"; transcript_id "TCONS_00006404"; exon_number "1"; oId "CUFF.6575.1"; tss_id "TSS6404"; +chr4 Cufflinks exon 129677180 129677287 . + . gene_id "XLOC_006405"; transcript_id "TCONS_00006405"; exon_number "1"; oId "CUFF.6576.1"; tss_id "TSS6405"; +chr4 Cufflinks exon 132194397 132194503 . + . gene_id "XLOC_006406"; transcript_id "TCONS_00006406"; exon_number "1"; oId "CUFF.6580.1"; tss_id "TSS6406"; +chr4 Cufflinks exon 133585386 133585431 . + . gene_id "XLOC_006407"; transcript_id "TCONS_00006407"; exon_number "1"; oId "CUFF.6582.1"; tss_id "TSS6407"; +chr4 Cufflinks exon 134124721 134124783 . + . gene_id "XLOC_006408"; transcript_id "TCONS_00006408"; exon_number "1"; oId "CUFF.6584.1"; tss_id "TSS6408"; +chr4 Cufflinks exon 134189605 134189649 . + . gene_id "XLOC_006409"; transcript_id "TCONS_00006409"; exon_number "1"; oId "CUFF.6585.1"; tss_id "TSS6409"; +chr4 Cufflinks exon 134709998 134710456 . + . gene_id "XLOC_006410"; transcript_id "TCONS_00006410"; exon_number "1"; oId "CUFF.6587.1"; tss_id "TSS6410"; +chr4 Cufflinks exon 139258689 139258741 . + . gene_id "XLOC_006411"; transcript_id "TCONS_00006411"; exon_number "1"; oId "CUFF.6593.1"; tss_id "TSS6411"; +chr4 Cufflinks exon 139749112 139749142 . + . gene_id "XLOC_006412"; transcript_id "TCONS_00006412"; exon_number "1"; oId "CUFF.6595.1"; tss_id "TSS6412"; +chr4 Cufflinks exon 139947214 139947239 . + . gene_id "XLOC_006413"; transcript_id "TCONS_00006413"; exon_number "1"; oId "CUFF.6596.1"; tss_id "TSS6413"; +chr4 Cufflinks exon 139976629 139976725 . + . gene_id "XLOC_006414"; transcript_id "TCONS_00006414"; exon_number "1"; oId "CUFF.6597.1"; tss_id "TSS6414"; +chr4 Cufflinks exon 140021531 140021822 . + . gene_id "XLOC_006415"; transcript_id "TCONS_00006415"; exon_number "1"; oId "CUFF.6598.1"; tss_id "TSS6415"; +chr4 Cufflinks exon 140076301 140076606 . + . gene_id "XLOC_006416"; transcript_id "TCONS_00006416"; exon_number "1"; oId "CUFF.6599.1"; tss_id "TSS6416"; +chr4 Cufflinks exon 140079043 140079093 . + . gene_id "XLOC_006417"; transcript_id "TCONS_00006417"; exon_number "1"; oId "CUFF.6600.1"; tss_id "TSS6417"; +chr4 Cufflinks exon 140106600 140106890 . + . gene_id "XLOC_006418"; transcript_id "TCONS_00006418"; exon_number "1"; oId "CUFF.6601.1"; tss_id "TSS6418"; +chr4 Cufflinks exon 140163950 140163989 . + . gene_id "XLOC_006419"; transcript_id "TCONS_00006419"; exon_number "1"; oId "CUFF.6603.1"; tss_id "TSS6419"; +chr4 Cufflinks exon 140239532 140239639 . + . gene_id "XLOC_006420"; transcript_id "TCONS_00006420"; exon_number "1"; oId "CUFF.6605.1"; tss_id "TSS6420"; +chr4 Cufflinks exon 140331510 140331592 . + . gene_id "XLOC_006421"; transcript_id "TCONS_00006421"; exon_number "1"; oId "CUFF.6606.1"; tss_id "TSS6421"; +chr4 Cufflinks exon 140532988 140533024 . + . gene_id "XLOC_006422"; transcript_id "TCONS_00006422"; exon_number "1"; oId "CUFF.6608.1"; tss_id "TSS6422"; +chr4 Cufflinks exon 140814258 140814299 . + . gene_id "XLOC_006423"; transcript_id "TCONS_00006423"; exon_number "1"; oId "CUFF.6612.1"; tss_id "TSS6423"; +chr4 Cufflinks exon 141198021 141198069 . + . gene_id "XLOC_006424"; transcript_id "TCONS_00006424"; exon_number "1"; oId "CUFF.6613.1"; tss_id "TSS6424"; +chr4 Cufflinks exon 141499079 141499396 . + . gene_id "XLOC_006425"; transcript_id "TCONS_00006425"; exon_number "1"; oId "CUFF.6614.1"; tss_id "TSS6425"; +chr4 Cufflinks exon 142170088 142170224 . + . gene_id "XLOC_006426"; transcript_id "TCONS_00006426"; exon_number "1"; oId "CUFF.6617.1"; tss_id "TSS6426"; +chr4 Cufflinks exon 143613856 143613919 . + . gene_id "XLOC_006427"; transcript_id "TCONS_00006427"; exon_number "1"; oId "CUFF.6619.1"; tss_id "TSS6427"; +chr4 Cufflinks exon 145956284 145956526 . + . gene_id "XLOC_006428"; transcript_id "TCONS_00006428"; exon_number "1"; oId "CUFF.6620.1"; tss_id "TSS6428"; +chr4 Cufflinks exon 147501200 147501360 . + . gene_id "XLOC_006429"; transcript_id "TCONS_00006429"; exon_number "1"; oId "CUFF.6622.1"; tss_id "TSS6429"; +chr4 Cufflinks exon 148376249 148376288 . + . gene_id "XLOC_006430"; transcript_id "TCONS_00006430"; exon_number "1"; oId "CUFF.6624.1"; tss_id "TSS6430"; +chr4 Cufflinks exon 148730089 148730373 . + . gene_id "XLOC_006431"; transcript_id "TCONS_00006431"; exon_number "1"; oId "CUFF.6626.1"; tss_id "TSS6431"; +chr4 Cufflinks exon 149479099 149479189 . + . gene_id "XLOC_006432"; transcript_id "TCONS_00006432"; exon_number "1"; oId "CUFF.6627.1"; tss_id "TSS6432"; +chr4 Cufflinks exon 149731565 149731600 . + . gene_id "XLOC_006433"; transcript_id "TCONS_00006433"; exon_number "1"; oId "CUFF.6628.1"; tss_id "TSS6433"; +chr4 Cufflinks exon 150417017 150417184 . + . gene_id "XLOC_006434"; transcript_id "TCONS_00006434"; exon_number "1"; oId "CUFF.6630.1"; tss_id "TSS6434"; +chr4 Cufflinks exon 150657526 150657561 . + . gene_id "XLOC_006435"; transcript_id "TCONS_00006435"; exon_number "1"; oId "CUFF.6631.1"; tss_id "TSS6435"; +chr4 Cufflinks exon 150769070 150769301 . + . gene_id "XLOC_006436"; transcript_id "TCONS_00006436"; exon_number "1"; oId "CUFF.6632.1"; tss_id "TSS6436"; +chr4 Cufflinks exon 150828712 150828801 . + . gene_id "XLOC_006437"; transcript_id "TCONS_00006437"; exon_number "1"; oId "CUFF.6633.1"; tss_id "TSS6437"; +chr4 Cufflinks exon 150855528 150855635 . + . gene_id "XLOC_006438"; transcript_id "TCONS_00006438"; exon_number "1"; oId "CUFF.6634.1"; tss_id "TSS6438"; +chr4 Cufflinks exon 151130858 151130900 . + . gene_id "XLOC_006439"; transcript_id "TCONS_00006439"; exon_number "1"; oId "CUFF.6636.1"; tss_id "TSS6439"; +chr4 Cufflinks exon 151393710 151393745 . + . gene_id "XLOC_006440"; transcript_id "TCONS_00006440"; exon_number "1"; oId "CUFF.6639.1"; tss_id "TSS6440"; +chr4 Cufflinks exon 151694075 151694116 . + . gene_id "XLOC_006441"; transcript_id "TCONS_00006441"; exon_number "1"; oId "CUFF.6640.1"; tss_id "TSS6441"; +chr4 Cufflinks exon 152221670 152221765 . + . gene_id "XLOC_006442"; transcript_id "TCONS_00006442"; exon_number "1"; oId "CUFF.6643.1"; tss_id "TSS6442"; +chr4 Cufflinks exon 152497929 152498072 . + . gene_id "XLOC_006443"; transcript_id "TCONS_00006443"; exon_number "1"; oId "CUFF.6644.1"; tss_id "TSS6443"; +chr4 Cufflinks exon 154159755 154159919 . + . gene_id "XLOC_006444"; transcript_id "TCONS_00006444"; exon_number "1"; oId "CUFF.6649.1"; tss_id "TSS6444"; +chr4 Cufflinks exon 155350336 155350399 . + . gene_id "XLOC_006445"; transcript_id "TCONS_00006445"; exon_number "1"; oId "CUFF.6652.1"; tss_id "TSS6445"; +chr4 Cufflinks exon 155708274 155708355 . + . gene_id "XLOC_006446"; transcript_id "TCONS_00006446"; exon_number "1"; oId "CUFF.6654.1"; tss_id "TSS6446"; +chr4 Cufflinks exon 155711509 155711630 . + . gene_id "XLOC_006447"; transcript_id "TCONS_00006447"; exon_number "1"; oId "CUFF.6655.1"; tss_id "TSS6447"; +chr4 Cufflinks exon 155728723 155728802 . + . gene_id "XLOC_006448"; transcript_id "TCONS_00006448"; exon_number "1"; oId "CUFF.6656.1"; tss_id "TSS6448"; +chr4 Cufflinks exon 156380787 156380854 . + . gene_id "XLOC_006449"; transcript_id "TCONS_00006449"; exon_number "1"; oId "CUFF.6657.1"; tss_id "TSS6449"; +chr4 Cufflinks exon 156383888 156383959 . + . gene_id "XLOC_006450"; transcript_id "TCONS_00006450"; exon_number "1"; oId "CUFF.6658.1"; tss_id "TSS6450"; +chr4 Cufflinks exon 156522102 156522139 . + . gene_id "XLOC_006451"; transcript_id "TCONS_00006451"; exon_number "1"; oId "CUFF.6660.1"; tss_id "TSS6451"; +chr4 Cufflinks exon 157624085 157624117 . + . gene_id "XLOC_006452"; transcript_id "TCONS_00006452"; exon_number "1"; oId "CUFF.6662.1"; tss_id "TSS6452"; +chr4 Cufflinks exon 158934271 158934310 . + . gene_id "XLOC_006453"; transcript_id "TCONS_00006453"; exon_number "1"; oId "CUFF.6665.1"; tss_id "TSS6453"; +chr4 Cufflinks exon 159316546 159316688 . + . gene_id "XLOC_006454"; transcript_id "TCONS_00006454"; exon_number "1"; oId "CUFF.6666.1"; tss_id "TSS6454"; +chr4 Cufflinks exon 159621843 159622060 . + . gene_id "XLOC_006455"; transcript_id "TCONS_00006455"; exon_number "1"; oId "CUFF.6667.1"; tss_id "TSS6455"; +chr4 Cufflinks exon 159936847 159936881 . + . gene_id "XLOC_006456"; transcript_id "TCONS_00006456"; exon_number "1"; oId "CUFF.6669.1"; tss_id "TSS6456"; +chr4 Cufflinks exon 165351408 165351497 . + . gene_id "XLOC_006457"; transcript_id "TCONS_00006457"; exon_number "1"; oId "CUFF.6676.1"; tss_id "TSS6457"; +chr4 Cufflinks exon 165541888 165541989 . + . gene_id "XLOC_006458"; transcript_id "TCONS_00006458"; exon_number "1"; oId "CUFF.6677.1"; tss_id "TSS6458"; +chr4 Cufflinks exon 165708442 165708542 . + . gene_id "XLOC_006459"; transcript_id "TCONS_00006459"; exon_number "1"; oId "CUFF.6678.1"; tss_id "TSS6459"; +chr4 Cufflinks exon 166173732 166173803 . + . gene_id "XLOC_006460"; transcript_id "TCONS_00006460"; exon_number "1"; oId "CUFF.6679.1"; tss_id "TSS6460"; +chr4 Cufflinks exon 167063725 167063863 . + . gene_id "XLOC_006461"; transcript_id "TCONS_00006461"; exon_number "1"; oId "CUFF.6682.1"; tss_id "TSS6461"; +chr4 Cufflinks exon 167064323 167064663 . + . gene_id "XLOC_006462"; transcript_id "TCONS_00006462"; exon_number "1"; oId "CUFF.6683.1"; tss_id "TSS6462"; +chr4 Cufflinks exon 168584137 168584305 . + . gene_id "XLOC_006463"; transcript_id "TCONS_00006463"; exon_number "1"; oId "CUFF.6688.1"; tss_id "TSS6463"; +chr4 Cufflinks exon 169231843 169231949 . + . gene_id "XLOC_006464"; transcript_id "TCONS_00006464"; exon_number "1"; oId "CUFF.6689.1"; tss_id "TSS6464"; +chr4 Cufflinks exon 169248230 169248262 . + . gene_id "XLOC_006465"; transcript_id "TCONS_00006465"; exon_number "1"; oId "CUFF.6690.1"; tss_id "TSS6465"; +chr4 Cufflinks exon 169303517 169303553 . + . gene_id "XLOC_006466"; transcript_id "TCONS_00006466"; exon_number "1"; oId "CUFF.6691.1"; tss_id "TSS6466"; +chr4 Cufflinks exon 169806506 169806612 . + . gene_id "XLOC_006467"; transcript_id "TCONS_00006467"; exon_number "1"; oId "CUFF.6693.1"; tss_id "TSS6467"; +chr4 Cufflinks exon 171030792 171030868 . + . gene_id "XLOC_006468"; transcript_id "TCONS_00006468"; exon_number "1"; oId "CUFF.6697.1"; tss_id "TSS6468"; +chr4 Cufflinks exon 171194457 171194507 . + . gene_id "XLOC_006469"; transcript_id "TCONS_00006469"; exon_number "1"; oId "CUFF.6698.1"; tss_id "TSS6469"; +chr4 Cufflinks exon 172952290 172952321 . + . gene_id "XLOC_006470"; transcript_id "TCONS_00006470"; exon_number "1"; oId "CUFF.6699.1"; tss_id "TSS6470"; +chr4 Cufflinks exon 173887183 173887225 . + . gene_id "XLOC_006471"; transcript_id "TCONS_00006471"; exon_number "1"; oId "CUFF.6700.1"; tss_id "TSS6471"; +chr4 Cufflinks exon 174062801 174063068 . + . gene_id "XLOC_006472"; transcript_id "TCONS_00006472"; exon_number "1"; oId "CUFF.6701.1"; tss_id "TSS6472"; +chr4 Cufflinks exon 174063439 174063473 . + . gene_id "XLOC_006473"; transcript_id "TCONS_00006473"; exon_number "1"; oId "CUFF.6702.1"; tss_id "TSS6473"; +chr4 Cufflinks exon 178102588 178102791 . + . gene_id "XLOC_006474"; transcript_id "TCONS_00006474"; exon_number "1"; oId "CUFF.6707.1"; tss_id "TSS6474"; +chr4 Cufflinks exon 178502014 178502068 . + . gene_id "XLOC_006475"; transcript_id "TCONS_00006475"; exon_number "1"; oId "CUFF.6709.1"; tss_id "TSS6475"; +chr4 Cufflinks exon 178752504 178752579 . + . gene_id "XLOC_006476"; transcript_id "TCONS_00006476"; exon_number "1"; oId "CUFF.6712.1"; tss_id "TSS6476"; +chr4 Cufflinks exon 178986374 178986407 . + . gene_id "XLOC_006477"; transcript_id "TCONS_00006477"; exon_number "1"; oId "CUFF.6713.1"; tss_id "TSS6477"; +chr4 Cufflinks exon 179327849 179327951 . + . gene_id "XLOC_006478"; transcript_id "TCONS_00006478"; exon_number "1"; oId "CUFF.6715.1"; tss_id "TSS6478"; +chr4 Cufflinks exon 183469812 183469870 . + . gene_id "XLOC_006479"; transcript_id "TCONS_00006479"; exon_number "1"; oId "CUFF.6721.1"; tss_id "TSS6479"; +chr4 Cufflinks exon 184250450 184250557 . + . gene_id "XLOC_006480"; transcript_id "TCONS_00006480"; exon_number "1"; oId "CUFF.6726.1"; tss_id "TSS6480"; +chr4 Cufflinks exon 184627084 184627184 . + . gene_id "XLOC_006481"; transcript_id "TCONS_00006481"; exon_number "1"; oId "CUFF.6730.1"; tss_id "TSS6481"; +chr4 Cufflinks exon 185200089 185200407 . + . gene_id "XLOC_006482"; transcript_id "TCONS_00006482"; exon_number "1"; oId "CUFF.6731.1"; tss_id "TSS6482"; +chr4 Cufflinks exon 186117074 186117107 . + . gene_id "XLOC_006483"; transcript_id "TCONS_00006483"; exon_number "1"; oId "CUFF.6732.1"; tss_id "TSS6483"; +chr4 Cufflinks exon 186867236 186867341 . + . gene_id "XLOC_006484"; transcript_id "TCONS_00006484"; exon_number "1"; oId "CUFF.6733.1"; tss_id "TSS6484"; +chr4 Cufflinks exon 187422263 187422365 . + . gene_id "XLOC_006485"; transcript_id "TCONS_00006485"; exon_number "1"; oId "CUFF.6736.1"; tss_id "TSS6485"; +chr4 Cufflinks exon 190205399 190205464 . + . gene_id "XLOC_006486"; transcript_id "TCONS_00006486"; exon_number "1"; oId "CUFF.6740.1"; tss_id "TSS6486"; +chr4 Cufflinks exon 190814875 190815063 . + . gene_id "XLOC_006487"; transcript_id "TCONS_00006487"; exon_number "1"; oId "CUFF.6742.1"; tss_id "TSS6487"; +chr4 Cufflinks exon 190815221 190815301 . + . gene_id "XLOC_006488"; transcript_id "TCONS_00006488"; exon_number "1"; oId "CUFF.6743.1"; tss_id "TSS6488"; +chr4 Cufflinks exon 190936293 190936412 . + . gene_id "XLOC_006489"; transcript_id "TCONS_00006489"; exon_number "1"; oId "CUFF.6745.1"; tss_id "TSS6489"; +chr4 Cufflinks exon 190938852 190938972 . + . gene_id "XLOC_006490"; transcript_id "TCONS_00006490"; exon_number "1"; oId "CUFF.6746.1"; tss_id "TSS6490"; +chr4 Cufflinks exon 1870770 1871064 . - . gene_id "XLOC_006491"; transcript_id "TCONS_00006491"; exon_number "1"; oId "CUFF.6236.1"; tss_id "TSS6491"; +chr4 Cufflinks exon 2198806 2198838 . - . gene_id "XLOC_006492"; transcript_id "TCONS_00006492"; exon_number "1"; oId "CUFF.6238.1"; tss_id "TSS6492"; +chr4 Cufflinks exon 2317909 2318232 . - . gene_id "XLOC_006493"; transcript_id "TCONS_00006493"; exon_number "1"; oId "CUFF.6239.1"; tss_id "TSS6493"; +chr4 Cufflinks exon 3023704 3023767 . - . gene_id "XLOC_006494"; transcript_id "TCONS_00006494"; exon_number "1"; oId "CUFF.6240.1"; tss_id "TSS6494"; +chr4 Cufflinks exon 3080209 3080269 . - . gene_id "XLOC_006495"; transcript_id "TCONS_00006495"; exon_number "1"; oId "CUFF.6242.1"; tss_id "TSS6495"; +chr4 Cufflinks exon 3180476 3180511 . - . gene_id "XLOC_006496"; transcript_id "TCONS_00006496"; exon_number "1"; oId "CUFF.6243.1"; tss_id "TSS6496"; +chr4 Cufflinks exon 4346866 4346907 . - . gene_id "XLOC_006497"; transcript_id "TCONS_00006497"; exon_number "1"; oId "CUFF.6244.1"; tss_id "TSS6497"; +chr4 Cufflinks exon 4922563 4922791 . - . gene_id "XLOC_006498"; transcript_id "TCONS_00006498"; exon_number "1"; oId "CUFF.6245.1"; tss_id "TSS6498"; +chr4 Cufflinks exon 5460364 5460608 . - . gene_id "XLOC_006499"; transcript_id "TCONS_00006499"; exon_number "1"; oId "CUFF.6246.1"; tss_id "TSS6499"; +chr4 Cufflinks exon 7113891 7114126 . - . gene_id "XLOC_006500"; transcript_id "TCONS_00006500"; exon_number "1"; oId "CUFF.6249.1"; tss_id "TSS6500"; +chr4 Cufflinks exon 9412929 9412979 . - . gene_id "XLOC_006501"; transcript_id "TCONS_00006501"; exon_number "1"; oId "CUFF.6252.1"; tss_id "TSS6501"; +chr4 Cufflinks exon 9794396 9794483 . - . gene_id "XLOC_006502"; transcript_id "TCONS_00006502"; exon_number "1"; oId "CUFF.6253.1"; tss_id "TSS6502"; +chr4 Cufflinks exon 10117419 10117508 . - . gene_id "XLOC_006503"; transcript_id "TCONS_00006503"; exon_number "1"; oId "CUFF.6254.1"; tss_id "TSS6503"; +chr4 Cufflinks exon 10932119 10932167 . - . gene_id "XLOC_006504"; transcript_id "TCONS_00006504"; exon_number "1"; oId "CUFF.6256.1"; tss_id "TSS6504"; +chr4 Cufflinks exon 11415673 11415784 . - . gene_id "XLOC_006505"; transcript_id "TCONS_00006505"; exon_number "1"; oId "CUFF.6257.1"; tss_id "TSS6505"; +chr4 Cufflinks exon 14351650 14351679 . - . gene_id "XLOC_006506"; transcript_id "TCONS_00006506"; exon_number "1"; oId "CUFF.6262.1"; tss_id "TSS6506"; +chr4 Cufflinks exon 15095471 15095717 . - . gene_id "XLOC_006507"; transcript_id "TCONS_00006507"; exon_number "1"; oId "CUFF.6263.1"; tss_id "TSS6507"; +chr4 Cufflinks exon 16010295 16010410 . - . gene_id "XLOC_006508"; transcript_id "TCONS_00006508"; exon_number "1"; oId "CUFF.6265.1"; tss_id "TSS6508"; +chr4 Cufflinks exon 16932333 16932397 . - . gene_id "XLOC_006509"; transcript_id "TCONS_00006509"; exon_number "1"; oId "CUFF.6266.1"; tss_id "TSS6509"; +chr4 Cufflinks exon 17560656 17560691 . - . gene_id "XLOC_006510"; transcript_id "TCONS_00006510"; exon_number "1"; oId "CUFF.6268.1"; tss_id "TSS6510"; +chr4 Cufflinks exon 18576734 18576815 . - . gene_id "XLOC_006511"; transcript_id "TCONS_00006511"; exon_number "1"; oId "CUFF.6269.1"; tss_id "TSS6511"; +chr4 Cufflinks exon 19183405 19183492 . - . gene_id "XLOC_006512"; transcript_id "TCONS_00006512"; exon_number "1"; oId "CUFF.6271.1"; tss_id "TSS6512"; +chr4 Cufflinks exon 19382529 19382564 . - . gene_id "XLOC_006513"; transcript_id "TCONS_00006513"; exon_number "1"; oId "CUFF.6272.1"; tss_id "TSS6513"; +chr4 Cufflinks exon 23510607 23510672 . - . gene_id "XLOC_006514"; transcript_id "TCONS_00006514"; exon_number "1"; oId "CUFF.6278.1"; tss_id "TSS6514"; +chr4 Cufflinks exon 24242352 24242414 . - . gene_id "XLOC_006515"; transcript_id "TCONS_00006515"; exon_number "1"; oId "CUFF.6279.1"; tss_id "TSS6515"; +chr4 Cufflinks exon 24564810 24565083 . - . gene_id "XLOC_006516"; transcript_id "TCONS_00006516"; exon_number "1"; oId "CUFF.6280.1"; tss_id "TSS6516"; +chr4 Cufflinks exon 25600188 25600238 . - . gene_id "XLOC_006517"; transcript_id "TCONS_00006517"; exon_number "1"; oId "CUFF.6282.1"; tss_id "TSS6517"; +chr4 Cufflinks exon 26883979 26884014 . - . gene_id "XLOC_006518"; transcript_id "TCONS_00006518"; exon_number "1"; oId "CUFF.6284.1"; tss_id "TSS6518"; +chr4 Cufflinks exon 27940602 27940637 . - . gene_id "XLOC_006519"; transcript_id "TCONS_00006519"; exon_number "1"; oId "CUFF.6285.1"; tss_id "TSS6519"; +chr4 Cufflinks exon 29529288 29529327 . - . gene_id "XLOC_006520"; transcript_id "TCONS_00006520"; exon_number "1"; oId "CUFF.6288.1"; tss_id "TSS6520"; +chr4 Cufflinks exon 29989614 29989691 . - . gene_id "XLOC_006521"; transcript_id "TCONS_00006521"; exon_number "1"; oId "CUFF.6289.1"; tss_id "TSS6521"; +chr4 Cufflinks exon 31868353 31868390 . - . gene_id "XLOC_006522"; transcript_id "TCONS_00006522"; exon_number "1"; oId "CUFF.6290.1"; tss_id "TSS6522"; +chr4 Cufflinks exon 34853989 34854041 . - . gene_id "XLOC_006523"; transcript_id "TCONS_00006523"; exon_number "1"; oId "CUFF.6294.1"; tss_id "TSS6523"; +chr4 Cufflinks exon 34967860 34967967 . - . gene_id "XLOC_006524"; transcript_id "TCONS_00006524"; exon_number "1"; oId "CUFF.6295.1"; tss_id "TSS6524"; +chr4 Cufflinks exon 36743772 36743884 . - . gene_id "XLOC_006525"; transcript_id "TCONS_00006525"; exon_number "1"; oId "CUFF.6297.1"; tss_id "TSS6525"; +chr4 Cufflinks exon 38258874 38258993 . - . gene_id "XLOC_006526"; transcript_id "TCONS_00006526"; exon_number "1"; oId "CUFF.6298.1"; tss_id "TSS6526"; +chr4 Cufflinks exon 38259300 38259446 . - . gene_id "XLOC_006527"; transcript_id "TCONS_00006527"; exon_number "1"; oId "CUFF.6299.1"; tss_id "TSS6527"; +chr4 Cufflinks exon 38268751 38269049 . - . gene_id "XLOC_006528"; transcript_id "TCONS_00006528"; exon_number "1"; oId "CUFF.6300.1"; tss_id "TSS6528"; +chr4 Cufflinks exon 38310281 38310318 . - . gene_id "XLOC_006529"; transcript_id "TCONS_00006529"; exon_number "1"; oId "CUFF.6301.1"; tss_id "TSS6529"; +chr4 Cufflinks exon 38330491 38330521 . - . gene_id "XLOC_006530"; transcript_id "TCONS_00006530"; exon_number "1"; oId "CUFF.6302.1"; tss_id "TSS6530"; +chr4 Cufflinks exon 38760422 38760513 . - . gene_id "XLOC_006531"; transcript_id "TCONS_00006531"; exon_number "1"; oId "CUFF.6304.1"; tss_id "TSS6531"; +chr4 Cufflinks exon 39299225 39299331 . - . gene_id "XLOC_006532"; transcript_id "TCONS_00006532"; exon_number "1"; oId "CUFF.6305.1"; tss_id "TSS6532"; +chr4 Cufflinks exon 39962786 39962825 . - . gene_id "XLOC_006533"; transcript_id "TCONS_00006533"; exon_number "1"; oId "CUFF.6311.1"; tss_id "TSS6533"; +chr4 Cufflinks exon 40379470 40379528 . - . gene_id "XLOC_006534"; transcript_id "TCONS_00006534"; exon_number "1"; oId "CUFF.6313.1"; tss_id "TSS6534"; +chr4 Cufflinks exon 40533260 40533301 . - . gene_id "XLOC_006535"; transcript_id "TCONS_00006535"; exon_number "1"; oId "CUFF.6314.1"; tss_id "TSS6535"; +chr4 Cufflinks exon 40870883 40870988 . - . gene_id "XLOC_006536"; transcript_id "TCONS_00006536"; exon_number "1"; oId "CUFF.6315.1"; tss_id "TSS6536"; +chr4 Cufflinks exon 40908743 40908815 . - . gene_id "XLOC_006537"; transcript_id "TCONS_00006537"; exon_number "1"; oId "CUFF.6316.1"; tss_id "TSS6537"; +chr4 Cufflinks exon 41773962 41774120 . - . gene_id "XLOC_006538"; transcript_id "TCONS_00006538"; exon_number "1"; oId "CUFF.6322.1"; tss_id "TSS6538"; +chr4 Cufflinks exon 42585634 42585726 . - . gene_id "XLOC_006539"; transcript_id "TCONS_00006539"; exon_number "1"; oId "CUFF.6324.1"; tss_id "TSS6539"; +chr4 Cufflinks exon 43600536 43600849 . - . gene_id "XLOC_006540"; transcript_id "TCONS_00006540"; exon_number "1"; oId "CUFF.6327.1"; tss_id "TSS6540"; +chr4 Cufflinks exon 44845562 44845672 . - . gene_id "XLOC_006541"; transcript_id "TCONS_00006541"; exon_number "1"; oId "CUFF.6330.1"; tss_id "TSS6541"; +chr4 Cufflinks exon 46533254 46533358 . - . gene_id "XLOC_006542"; transcript_id "TCONS_00006542"; exon_number "1"; oId "CUFF.6333.1"; tss_id "TSS6542"; +chr4 Cufflinks exon 47307953 47308053 . - . gene_id "XLOC_006543"; transcript_id "TCONS_00006543"; exon_number "1"; oId "CUFF.6334.1"; tss_id "TSS6543"; +chr4 Cufflinks exon 47310881 47310937 . - . gene_id "XLOC_006544"; transcript_id "TCONS_00006544"; exon_number "1"; oId "CUFF.6335.1"; tss_id "TSS6544"; +chr4 Cufflinks exon 47681732 47681973 . - . gene_id "XLOC_006545"; transcript_id "TCONS_00006545"; exon_number "1"; oId "CUFF.6336.1"; tss_id "TSS6545"; +chr4 Cufflinks exon 47813528 47813623 . - . gene_id "XLOC_006546"; transcript_id "TCONS_00006546"; exon_number "1"; oId "CUFF.6338.1"; tss_id "TSS6546"; +chr4 Cufflinks exon 48108108 48108205 . - . gene_id "XLOC_006547"; transcript_id "TCONS_00006547"; exon_number "1"; oId "CUFF.6339.1"; tss_id "TSS6547"; +chr4 Cufflinks exon 48111370 48111429 . - . gene_id "XLOC_006548"; transcript_id "TCONS_00006548"; exon_number "1"; oId "CUFF.6340.1"; tss_id "TSS6548"; +chr4 Cufflinks exon 48576475 48576543 . - . gene_id "XLOC_006549"; transcript_id "TCONS_00006549"; exon_number "1"; oId "CUFF.6342.1"; tss_id "TSS6549"; +chr4 Cufflinks exon 48911274 48911330 . - . gene_id "XLOC_006550"; transcript_id "TCONS_00006550"; exon_number "1"; oId "CUFF.6343.1"; tss_id "TSS6550"; +chr4 Cufflinks exon 48934773 48934862 . - . gene_id "XLOC_006551"; transcript_id "TCONS_00006551"; exon_number "1"; oId "CUFF.6344.1"; tss_id "TSS6551"; +chr4 Cufflinks exon 52899312 52899349 . - . gene_id "XLOC_006552"; transcript_id "TCONS_00006552"; exon_number "1"; oId "CUFF.6346.1"; tss_id "TSS6552"; +chr4 Cufflinks exon 54131628 54131734 . - . gene_id "XLOC_006553"; transcript_id "TCONS_00006553"; exon_number "1"; oId "CUFF.6350.1"; tss_id "TSS6553"; +chr4 Cufflinks exon 54352351 54352550 . - . gene_id "XLOC_006554"; transcript_id "TCONS_00006554"; exon_number "1"; oId "CUFF.6351.1"; tss_id "TSS6554"; +chr4 Cufflinks exon 54989265 54989372 . - . gene_id "XLOC_006555"; transcript_id "TCONS_00006555"; exon_number "1"; oId "CUFF.6352.1"; tss_id "TSS6555"; +chr4 Cufflinks exon 55649698 55649735 . - . gene_id "XLOC_006556"; transcript_id "TCONS_00006556"; exon_number "1"; oId "CUFF.6355.1"; tss_id "TSS6556"; +chr4 Cufflinks exon 55898115 55898238 . - . gene_id "XLOC_006557"; transcript_id "TCONS_00006557"; exon_number "1"; oId "CUFF.6357.1"; tss_id "TSS6557"; +chr4 Cufflinks exon 56081782 56082081 . - . gene_id "XLOC_006558"; transcript_id "TCONS_00006558"; exon_number "1"; oId "CUFF.6359.1"; tss_id "TSS6558"; +chr4 Cufflinks exon 56406754 56407002 . - . gene_id "XLOC_006559"; transcript_id "TCONS_00006559"; exon_number "1"; oId "CUFF.6361.1"; tss_id "TSS6559"; +chr4 Cufflinks exon 57154666 57154749 . - . gene_id "XLOC_006560"; transcript_id "TCONS_00006560"; exon_number "1"; oId "CUFF.6367.1"; tss_id "TSS6560"; +chr4 Cufflinks exon 57197331 57197402 . - . gene_id "XLOC_006561"; transcript_id "TCONS_00006561"; exon_number "1"; oId "CUFF.6368.1"; tss_id "TSS6561"; +chr4 Cufflinks exon 57660505 57660808 . - . gene_id "XLOC_006562"; transcript_id "TCONS_00006562"; exon_number "1"; oId "CUFF.6369.1"; tss_id "TSS6562"; +chr4 Cufflinks exon 57972406 57972512 . - . gene_id "XLOC_006563"; transcript_id "TCONS_00006563"; exon_number "1"; oId "CUFF.6373.1"; tss_id "TSS6563"; +chr4 Cufflinks exon 58010259 58010330 . - . gene_id "XLOC_006564"; transcript_id "TCONS_00006564"; exon_number "1"; oId "CUFF.6374.1"; tss_id "TSS6564"; +chr4 Cufflinks exon 58358432 58358539 . - . gene_id "XLOC_006565"; transcript_id "TCONS_00006565"; exon_number "1"; oId "CUFF.6375.1"; tss_id "TSS6565"; +chr4 Cufflinks exon 63240740 63240774 . - . gene_id "XLOC_006566"; transcript_id "TCONS_00006566"; exon_number "1"; oId "CUFF.6379.1"; tss_id "TSS6566"; +chr4 Cufflinks exon 64509411 64509446 . - . gene_id "XLOC_006567"; transcript_id "TCONS_00006567"; exon_number "1"; oId "CUFF.6381.1"; tss_id "TSS6567"; +chr4 Cufflinks exon 65263412 65263505 . - . gene_id "XLOC_006568"; transcript_id "TCONS_00006568"; exon_number "1"; oId "CUFF.6383.1"; tss_id "TSS6568"; +chr4 Cufflinks exon 65625755 65625809 . - . gene_id "XLOC_006569"; transcript_id "TCONS_00006569"; exon_number "1"; oId "CUFF.6384.1"; tss_id "TSS6569"; +chr4 Cufflinks exon 66672974 66673153 . - . gene_id "XLOC_006570"; transcript_id "TCONS_00006570"; exon_number "1"; oId "CUFF.6386.1"; tss_id "TSS6570"; +chr4 Cufflinks exon 68295310 68295472 . - . gene_id "XLOC_006571"; transcript_id "TCONS_00006571"; exon_number "1"; oId "CUFF.6388.1"; tss_id "TSS6571"; +chr4 Cufflinks exon 69248537 69248568 . - . gene_id "XLOC_006572"; transcript_id "TCONS_00006572"; exon_number "1"; oId "CUFF.6393.1"; tss_id "TSS6572"; +chr4 Cufflinks exon 70296582 70296753 . - . gene_id "XLOC_006573"; transcript_id "TCONS_00006573"; exon_number "1"; oId "CUFF.6394.1"; tss_id "TSS6573"; +chr4 Cufflinks exon 70990364 70990405 . - . gene_id "XLOC_006574"; transcript_id "TCONS_00006574"; exon_number "1"; oId "CUFF.6396.1"; tss_id "TSS6574"; +chr4 Cufflinks exon 71568738 71568840 . - . gene_id "XLOC_006575"; transcript_id "TCONS_00006575"; exon_number "1"; oId "CUFF.6398.1"; tss_id "TSS6575"; +chr4 Cufflinks exon 71713856 71713930 . - . gene_id "XLOC_006576"; transcript_id "TCONS_00006576"; exon_number "1"; oId "CUFF.6400.1"; tss_id "TSS6576"; +chr4 Cufflinks exon 71915826 71915859 . - . gene_id "XLOC_006577"; transcript_id "TCONS_00006577"; exon_number "1"; oId "CUFF.6402.1"; tss_id "TSS6577"; +chr4 Cufflinks exon 72625243 72625333 . - . gene_id "XLOC_006578"; transcript_id "TCONS_00006578"; exon_number "1"; oId "CUFF.6403.1"; tss_id "TSS6578"; +chr4 Cufflinks exon 72766263 72766312 . - . gene_id "XLOC_006579"; transcript_id "TCONS_00006579"; exon_number "1"; oId "CUFF.6404.1"; tss_id "TSS6579"; +chr4 Cufflinks exon 74010744 74010775 . - . gene_id "XLOC_006580"; transcript_id "TCONS_00006580"; exon_number "1"; oId "CUFF.6405.1"; tss_id "TSS6580"; +chr4 Cufflinks exon 74589673 74589775 . - . gene_id "XLOC_006581"; transcript_id "TCONS_00006581"; exon_number "1"; oId "CUFF.6408.1"; tss_id "TSS6581"; +chr4 Cufflinks exon 74589937 74590127 . - . gene_id "XLOC_006582"; transcript_id "TCONS_00006582"; exon_number "1"; oId "CUFF.6409.1"; tss_id "TSS6582"; +chr4 Cufflinks exon 74637233 74637276 . - . gene_id "XLOC_006583"; transcript_id "TCONS_00006583"; exon_number "1"; oId "CUFF.6410.1"; tss_id "TSS6583"; +chr4 Cufflinks exon 74770163 74770252 . - . gene_id "XLOC_006584"; transcript_id "TCONS_00006584"; exon_number "1"; oId "CUFF.6411.1"; tss_id "TSS6584"; +chr4 Cufflinks exon 76750691 76750739 . - . gene_id "XLOC_006585"; transcript_id "TCONS_00006585"; exon_number "1"; oId "CUFF.6414.1"; tss_id "TSS6585"; +chr4 Cufflinks exon 77277764 77277868 . - . gene_id "XLOC_006586"; transcript_id "TCONS_00006586"; exon_number "1"; oId "CUFF.6416.1"; tss_id "TSS6586"; +chr4 Cufflinks exon 77453375 77453480 . - . gene_id "XLOC_006587"; transcript_id "TCONS_00006587"; exon_number "1"; oId "CUFF.6418.1"; tss_id "TSS6587"; +chr4 Cufflinks exon 78071481 78071570 . - . gene_id "XLOC_006588"; transcript_id "TCONS_00006588"; exon_number "1"; oId "CUFF.6421.1"; tss_id "TSS6588"; +chr4 Cufflinks exon 78129558 78129888 . - . gene_id "XLOC_006589"; transcript_id "TCONS_00006589"; exon_number "1"; oId "CUFF.6422.1"; tss_id "TSS6589"; +chr4 Cufflinks exon 78133451 78133550 . - . gene_id "XLOC_006590"; transcript_id "TCONS_00006590"; exon_number "1"; oId "CUFF.6423.1"; tss_id "TSS6590"; +chr4 Cufflinks exon 78227462 78227493 . - . gene_id "XLOC_006591"; transcript_id "TCONS_00006591"; exon_number "1"; oId "CUFF.6424.1"; tss_id "TSS6591"; +chr4 Cufflinks exon 78877797 78877831 . - . gene_id "XLOC_006592"; transcript_id "TCONS_00006592"; exon_number "1"; oId "CUFF.6425.1"; tss_id "TSS6592"; +chr4 Cufflinks exon 79108290 79108424 . - . gene_id "XLOC_006593"; transcript_id "TCONS_00006593"; exon_number "1"; oId "CUFF.6426.1"; tss_id "TSS6593"; +chr4 Cufflinks exon 79629343 79629377 . - . gene_id "XLOC_006594"; transcript_id "TCONS_00006594"; exon_number "1"; oId "CUFF.6428.1"; tss_id "TSS6594"; +chr4 Cufflinks exon 80796960 80797039 . - . gene_id "XLOC_006595"; transcript_id "TCONS_00006595"; exon_number "1"; oId "CUFF.6430.1"; tss_id "TSS6595"; +chr4 Cufflinks exon 80978203 80978259 . - . gene_id "XLOC_006596"; transcript_id "TCONS_00006596"; exon_number "1"; oId "CUFF.6431.1"; tss_id "TSS6596"; +chr4 Cufflinks exon 81557320 81557379 . - . gene_id "XLOC_006597"; transcript_id "TCONS_00006597"; exon_number "1"; oId "CUFF.6432.1"; tss_id "TSS6597"; +chr4 Cufflinks exon 85608863 85609168 . - . gene_id "XLOC_006598"; transcript_id "TCONS_00006598"; exon_number "1"; oId "CUFF.6440.1"; tss_id "TSS6598"; +chr4 Cufflinks exon 85807545 85807605 . - . gene_id "XLOC_006599"; transcript_id "TCONS_00006599"; exon_number "1"; oId "CUFF.6441.1"; tss_id "TSS6599"; +chr4 Cufflinks exon 86968242 86968396 . - . gene_id "XLOC_006600"; transcript_id "TCONS_00006600"; exon_number "1"; oId "CUFF.6445.1"; tss_id "TSS6600"; +chr4 Cufflinks exon 87257515 87257708 . - . gene_id "XLOC_006601"; transcript_id "TCONS_00006601"; exon_number "1"; oId "CUFF.6446.1"; tss_id "TSS6601"; +chr4 Cufflinks exon 88308031 88308326 . - . gene_id "XLOC_006602"; transcript_id "TCONS_00006602"; exon_number "1"; oId "CUFF.6447.1"; tss_id "TSS6602"; +chr4 Cufflinks exon 88527422 88527457 . - . gene_id "XLOC_006603"; transcript_id "TCONS_00006603"; exon_number "1"; oId "CUFF.6449.1"; tss_id "TSS6603"; +chr4 Cufflinks exon 88689634 88689734 . - . gene_id "XLOC_006604"; transcript_id "TCONS_00006604"; exon_number "1"; oId "CUFF.6450.1"; tss_id "TSS6604"; +chr4 Cufflinks exon 89196357 89196459 . - . gene_id "XLOC_006605"; transcript_id "TCONS_00006605"; exon_number "1"; oId "CUFF.6454.1"; tss_id "TSS6605"; +chr4 Cufflinks exon 89277568 89277609 . - . gene_id "XLOC_006606"; transcript_id "TCONS_00006606"; exon_number "1"; oId "CUFF.6455.1"; tss_id "TSS6606"; +chr4 Cufflinks exon 89504858 89505108 . - . gene_id "XLOC_006607"; transcript_id "TCONS_00006607"; exon_number "1"; oId "CUFF.6456.1"; tss_id "TSS6607"; +chr4 Cufflinks exon 89536963 89537009 . - . gene_id "XLOC_006608"; transcript_id "TCONS_00006608"; exon_number "1"; oId "CUFF.6457.1"; tss_id "TSS6608"; +chr4 Cufflinks exon 89605999 89606105 . - . gene_id "XLOC_006609"; transcript_id "TCONS_00006609"; exon_number "1"; oId "CUFF.6458.1"; tss_id "TSS6609"; +chr4 Cufflinks exon 90090930 90090991 . - . gene_id "XLOC_006610"; transcript_id "TCONS_00006610"; exon_number "1"; oId "CUFF.6460.1"; tss_id "TSS6610"; +chr4 Cufflinks exon 90423091 90423128 . - . gene_id "XLOC_006611"; transcript_id "TCONS_00006611"; exon_number "1"; oId "CUFF.6461.1"; tss_id "TSS6611"; +chr4 Cufflinks exon 91432820 91432866 . - . gene_id "XLOC_006612"; transcript_id "TCONS_00006612"; exon_number "1"; oId "CUFF.6464.1"; tss_id "TSS6612"; +chr4 Cufflinks exon 91956881 91956915 . - . gene_id "XLOC_006613"; transcript_id "TCONS_00006613"; exon_number "1"; oId "CUFF.6465.1"; tss_id "TSS6613"; +chr4 Cufflinks exon 92185833 92185920 . - . gene_id "XLOC_006614"; transcript_id "TCONS_00006614"; exon_number "1"; oId "CUFF.6466.1"; tss_id "TSS6614"; +chr4 Cufflinks exon 93257580 93257615 . - . gene_id "XLOC_006615"; transcript_id "TCONS_00006615"; exon_number "1"; oId "CUFF.6468.1"; tss_id "TSS6615"; +chr4 Cufflinks exon 95144296 95144338 . - . gene_id "XLOC_006616"; transcript_id "TCONS_00006616"; exon_number "1"; oId "CUFF.6472.1"; tss_id "TSS6616"; +chr4 Cufflinks exon 95495782 95495824 . - . gene_id "XLOC_006617"; transcript_id "TCONS_00006617"; exon_number "1"; oId "CUFF.6474.1"; tss_id "TSS6617"; +chr4 Cufflinks exon 95939157 95939187 . - . gene_id "XLOC_006618"; transcript_id "TCONS_00006618"; exon_number "1"; oId "CUFF.6475.1"; tss_id "TSS6618"; +chr4 Cufflinks exon 96171895 96171929 . - . gene_id "XLOC_006619"; transcript_id "TCONS_00006619"; exon_number "1"; oId "CUFF.6476.1"; tss_id "TSS6619"; +chr4 Cufflinks exon 96789818 96789908 . - . gene_id "XLOC_006620"; transcript_id "TCONS_00006620"; exon_number "1"; oId "CUFF.6477.1"; tss_id "TSS6620"; +chr4 Cufflinks exon 97073450 97073554 . - . gene_id "XLOC_006621"; transcript_id "TCONS_00006621"; exon_number "1"; oId "CUFF.6479.1"; tss_id "TSS6621"; +chr4 Cufflinks exon 97269945 97270188 . - . gene_id "XLOC_006622"; transcript_id "TCONS_00006622"; exon_number "1"; oId "CUFF.6480.1"; tss_id "TSS6622"; +chr4 Cufflinks exon 99072521 99072730 . - . gene_id "XLOC_006623"; transcript_id "TCONS_00006623"; exon_number "1"; oId "CUFF.6482.1"; tss_id "TSS6623"; +chr4 Cufflinks exon 99231495 99231530 . - . gene_id "XLOC_006624"; transcript_id "TCONS_00006624"; exon_number "1"; oId "CUFF.6483.1"; tss_id "TSS6624"; +chr4 Cufflinks exon 99854725 99854761 . - . gene_id "XLOC_006625"; transcript_id "TCONS_00006625"; exon_number "1"; oId "CUFF.6487.1"; tss_id "TSS6625"; +chr4 Cufflinks exon 99866898 99866934 . - . gene_id "XLOC_006626"; transcript_id "TCONS_00006626"; exon_number "1"; oId "CUFF.6488.1"; tss_id "TSS6626"; +chr4 Cufflinks exon 99887973 99888023 . - . gene_id "XLOC_006627"; transcript_id "TCONS_00006627"; exon_number "1"; oId "CUFF.6489.1"; tss_id "TSS6627"; +chr4 Cufflinks exon 100427684 100427699 . - . gene_id "XLOC_006628"; transcript_id "TCONS_00006628"; exon_number "1"; oId "CUFF.6490.1"; tss_id "TSS6628"; +chr4 Cufflinks exon 100427883 100427938 . - . gene_id "XLOC_006629"; transcript_id "TCONS_00006629"; exon_number "1"; oId "CUFF.6491.1"; tss_id "TSS6629"; +chr4 Cufflinks exon 103269545 103269848 . - . gene_id "XLOC_006630"; transcript_id "TCONS_00006630"; exon_number "1"; oId "CUFF.6497.1"; tss_id "TSS6630"; +chr4 Cufflinks exon 103758206 103758255 . - . gene_id "XLOC_006631"; transcript_id "TCONS_00006631"; exon_number "1"; oId "CUFF.6500.1"; tss_id "TSS6631"; +chr4 Cufflinks exon 103780547 103780654 . - . gene_id "XLOC_006632"; transcript_id "TCONS_00006632"; exon_number "1"; oId "CUFF.6501.1"; tss_id "TSS6632"; +chr4 Cufflinks exon 104086078 104086136 . - . gene_id "XLOC_006633"; transcript_id "TCONS_00006633"; exon_number "1"; oId "CUFF.6504.1"; tss_id "TSS6633"; +chr4 Cufflinks exon 107924383 107924904 . - . gene_id "XLOC_006634"; transcript_id "TCONS_00006634"; exon_number "1"; oId "CUFF.6514.1"; tss_id "TSS6634"; +chr4 Cufflinks exon 108788967 108789066 . - . gene_id "XLOC_006635"; transcript_id "TCONS_00006635"; exon_number "1"; oId "CUFF.6516.1"; tss_id "TSS6635"; +chr4 Cufflinks exon 110371908 110372221 . - . gene_id "XLOC_006636"; transcript_id "TCONS_00006636"; exon_number "1"; oId "CUFF.6519.1"; tss_id "TSS6636"; +chr4 Cufflinks exon 110389076 110389109 . - . gene_id "XLOC_006637"; transcript_id "TCONS_00006637"; exon_number "1"; oId "CUFF.6520.1"; tss_id "TSS6637"; +chr4 Cufflinks exon 110440296 110440423 . - . gene_id "XLOC_006638"; transcript_id "TCONS_00006638"; exon_number "1"; oId "CUFF.6521.1"; tss_id "TSS6638"; +chr4 Cufflinks exon 110536958 110537103 . - . gene_id "XLOC_006639"; transcript_id "TCONS_00006639"; exon_number "1"; oId "CUFF.6522.1"; tss_id "TSS6639"; +chr4 Cufflinks exon 111336352 111336397 . - . gene_id "XLOC_006640"; transcript_id "TCONS_00006640"; exon_number "1"; oId "CUFF.6525.1"; tss_id "TSS6640"; +chr4 Cufflinks exon 113176951 113176981 . - . gene_id "XLOC_006641"; transcript_id "TCONS_00006641"; exon_number "1"; oId "CUFF.6529.1"; tss_id "TSS6641"; +chr4 Cufflinks exon 113554027 113554060 . - . gene_id "XLOC_006642"; transcript_id "TCONS_00006642"; exon_number "1"; oId "CUFF.6531.1"; tss_id "TSS6642"; +chr4 Cufflinks exon 113596696 113596794 . - . gene_id "XLOC_006643"; transcript_id "TCONS_00006643"; exon_number "1"; oId "CUFF.6533.1"; tss_id "TSS6643"; +chr4 Cufflinks exon 113910239 113910274 . - . gene_id "XLOC_006644"; transcript_id "TCONS_00006644"; exon_number "1"; oId "CUFF.6536.1"; tss_id "TSS6644"; +chr4 Cufflinks exon 114546172 114546261 . - . gene_id "XLOC_006645"; transcript_id "TCONS_00006645"; exon_number "1"; oId "CUFF.6540.1"; tss_id "TSS6645"; +chr4 Cufflinks exon 116066153 116066182 . - . gene_id "XLOC_006646"; transcript_id "TCONS_00006646"; exon_number "1"; oId "CUFF.6543.1"; tss_id "TSS6646"; +chr4 Cufflinks exon 116557791 116557825 . - . gene_id "XLOC_006647"; transcript_id "TCONS_00006647"; exon_number "1"; oId "CUFF.6544.1"; tss_id "TSS6647"; +chr4 Cufflinks exon 119725868 119725898 . - . gene_id "XLOC_006648"; transcript_id "TCONS_00006648"; exon_number "1"; oId "CUFF.6553.1"; tss_id "TSS6648"; +chr4 Cufflinks exon 120355160 120355262 . - . gene_id "XLOC_006649"; transcript_id "TCONS_00006649"; exon_number "1"; oId "CUFF.6556.1"; tss_id "TSS6649"; +chr4 Cufflinks exon 121332541 121332576 . - . gene_id "XLOC_006650"; transcript_id "TCONS_00006650"; exon_number "1"; oId "CUFF.6558.1"; tss_id "TSS6650"; +chr4 Cufflinks exon 121941965 121942179 . - . gene_id "XLOC_006651"; transcript_id "TCONS_00006651"; exon_number "1"; oId "CUFF.6560.1"; tss_id "TSS6651"; +chr4 Cufflinks exon 121982395 121982633 . - . gene_id "XLOC_006652"; transcript_id "TCONS_00006652"; exon_number "1"; oId "CUFF.6561.1"; tss_id "TSS6652"; +chr4 Cufflinks exon 122113952 122114058 . - . gene_id "XLOC_006653"; transcript_id "TCONS_00006653"; exon_number "1"; oId "CUFF.6562.1"; tss_id "TSS6653"; +chr4 Cufflinks exon 123008640 123008966 . - . gene_id "XLOC_006654"; transcript_id "TCONS_00006654"; exon_number "1"; oId "CUFF.6564.1"; tss_id "TSS6654"; +chr4 Cufflinks exon 123519826 123519876 . - . gene_id "XLOC_006655"; transcript_id "TCONS_00006655"; exon_number "1"; oId "CUFF.6565.1"; tss_id "TSS6655"; +chr4 Cufflinks exon 124078771 124078821 . - . gene_id "XLOC_006656"; transcript_id "TCONS_00006656"; exon_number "1"; oId "CUFF.6566.1"; tss_id "TSS6656"; +chr4 Cufflinks exon 124400643 124400674 . - . gene_id "XLOC_006657"; transcript_id "TCONS_00006657"; exon_number "1"; oId "CUFF.6567.1"; tss_id "TSS6657"; +chr4 Cufflinks exon 124430004 124430076 . - . gene_id "XLOC_006658"; transcript_id "TCONS_00006658"; exon_number "1"; oId "CUFF.6568.1"; tss_id "TSS6658"; +chr4 Cufflinks exon 126548245 126548345 . - . gene_id "XLOC_006659"; transcript_id "TCONS_00006659"; exon_number "1"; oId "CUFF.6569.1"; tss_id "TSS6659"; +chr4 Cufflinks exon 126917540 126917575 . - . gene_id "XLOC_006660"; transcript_id "TCONS_00006660"; exon_number "1"; oId "CUFF.6571.1"; tss_id "TSS6660"; +chr4 Cufflinks exon 130805206 130805278 . - . gene_id "XLOC_006661"; transcript_id "TCONS_00006661"; exon_number "1"; oId "CUFF.6577.1"; tss_id "TSS6661"; +chr4 Cufflinks exon 131427824 131427930 . - . gene_id "XLOC_006662"; transcript_id "TCONS_00006662"; exon_number "1"; oId "CUFF.6578.1"; tss_id "TSS6662"; +chr4 Cufflinks exon 131826473 131826524 . - . gene_id "XLOC_006663"; transcript_id "TCONS_00006663"; exon_number "1"; oId "CUFF.6579.1"; tss_id "TSS6663"; +chr4 Cufflinks exon 132641394 132641694 . - . gene_id "XLOC_006664"; transcript_id "TCONS_00006664"; exon_number "1"; oId "CUFF.6581.1"; tss_id "TSS6664"; +chr4 Cufflinks exon 134082915 134083021 . - . gene_id "XLOC_006665"; transcript_id "TCONS_00006665"; exon_number "1"; oId "CUFF.6583.1"; tss_id "TSS6665"; +chr4 Cufflinks exon 134313812 134313845 . - . gene_id "XLOC_006666"; transcript_id "TCONS_00006666"; exon_number "1"; oId "CUFF.6586.1"; tss_id "TSS6666"; +chr4 Cufflinks exon 136236575 136236677 . - . gene_id "XLOC_006667"; transcript_id "TCONS_00006667"; exon_number "1"; oId "CUFF.6588.1"; tss_id "TSS6667"; +chr4 Cufflinks exon 136917084 136917247 . - . gene_id "XLOC_006668"; transcript_id "TCONS_00006668"; exon_number "1"; oId "CUFF.6589.1"; tss_id "TSS6668"; +chr4 Cufflinks exon 137762690 137762732 . - . gene_id "XLOC_006669"; transcript_id "TCONS_00006669"; exon_number "1"; oId "CUFF.6590.1"; tss_id "TSS6669"; +chr4 Cufflinks exon 138414394 138414467 . - . gene_id "XLOC_006670"; transcript_id "TCONS_00006670"; exon_number "1"; oId "CUFF.6591.1"; tss_id "TSS6670"; +chr4 Cufflinks exon 138852410 138852444 . - . gene_id "XLOC_006671"; transcript_id "TCONS_00006671"; exon_number "1"; oId "CUFF.6592.1"; tss_id "TSS6671"; +chr4 Cufflinks exon 139501159 139501189 . - . gene_id "XLOC_006672"; transcript_id "TCONS_00006672"; exon_number "1"; oId "CUFF.6594.1"; tss_id "TSS6672"; +chr4 Cufflinks exon 140152181 140152273 . - . gene_id "XLOC_006673"; transcript_id "TCONS_00006673"; exon_number "1"; oId "CUFF.6602.1"; tss_id "TSS6673"; +chr4 Cufflinks exon 140177811 140177912 . - . gene_id "XLOC_006674"; transcript_id "TCONS_00006674"; exon_number "1"; oId "CUFF.6604.1"; tss_id "TSS6674"; +chr4 Cufflinks exon 140388472 140388525 . - . gene_id "XLOC_006675"; transcript_id "TCONS_00006675"; exon_number "1"; oId "CUFF.6607.1"; tss_id "TSS6675"; +chr4 Cufflinks exon 140606342 140606581 . - . gene_id "XLOC_006676"; transcript_id "TCONS_00006676"; exon_number "1"; oId "CUFF.6609.1"; tss_id "TSS6676"; +chr4 Cufflinks exon 140711154 140711369 . - . gene_id "XLOC_006677"; transcript_id "TCONS_00006677"; exon_number "1"; oId "CUFF.6610.1"; tss_id "TSS6677"; +chr4 Cufflinks exon 140715427 140715579 . - . gene_id "XLOC_006678"; transcript_id "TCONS_00006678"; exon_number "1"; oId "CUFF.6611.1"; tss_id "TSS6678"; +chr4 Cufflinks exon 142062548 142062685 . - . gene_id "XLOC_006679"; transcript_id "TCONS_00006679"; exon_number "1"; oId "CUFF.6615.1"; tss_id "TSS6679"; +chr4 Cufflinks exon 142063000 142063075 . - . gene_id "XLOC_006680"; transcript_id "TCONS_00006680"; exon_number "1"; oId "CUFF.6616.1"; tss_id "TSS6680"; +chr4 Cufflinks exon 142218925 142219033 . - . gene_id "XLOC_006681"; transcript_id "TCONS_00006681"; exon_number "1"; oId "CUFF.6618.1"; tss_id "TSS6681"; +chr4 Cufflinks exon 147368338 147368387 . - . gene_id "XLOC_006682"; transcript_id "TCONS_00006682"; exon_number "1"; oId "CUFF.6621.1"; tss_id "TSS6682"; +chr4 Cufflinks exon 147689320 147689529 . - . gene_id "XLOC_006683"; transcript_id "TCONS_00006683"; exon_number "1"; oId "CUFF.6623.1"; tss_id "TSS6683"; +chr4 Cufflinks exon 148666496 148666568 . - . gene_id "XLOC_006684"; transcript_id "TCONS_00006684"; exon_number "1"; oId "CUFF.6625.1"; tss_id "TSS6684"; +chr4 Cufflinks exon 149912727 149912785 . - . gene_id "XLOC_006685"; transcript_id "TCONS_00006685"; exon_number "1"; oId "CUFF.6629.1"; tss_id "TSS6685"; +chr4 Cufflinks exon 151027514 151027544 . - . gene_id "XLOC_006686"; transcript_id "TCONS_00006686"; exon_number "1"; oId "CUFF.6635.1"; tss_id "TSS6686"; +chr4 Cufflinks exon 151220623 151220665 . - . gene_id "XLOC_006687"; transcript_id "TCONS_00006687"; exon_number "1"; oId "CUFF.6637.1"; tss_id "TSS6687"; +chr4 Cufflinks exon 151323378 151323419 . - . gene_id "XLOC_006688"; transcript_id "TCONS_00006688"; exon_number "1"; oId "CUFF.6638.1"; tss_id "TSS6688"; +chr4 Cufflinks exon 151888682 151888697 . - . gene_id "XLOC_006689"; transcript_id "TCONS_00006689"; exon_number "1"; oId "CUFF.6641.1"; tss_id "TSS6689"; +chr4 Cufflinks exon 151891858 151891930 . - . gene_id "XLOC_006690"; transcript_id "TCONS_00006690"; exon_number "1"; oId "CUFF.6642.1"; tss_id "TSS6690"; +chr4 Cufflinks exon 152892681 152892751 . - . gene_id "XLOC_006691"; transcript_id "TCONS_00006691"; exon_number "1"; oId "CUFF.6645.1"; tss_id "TSS6691"; +chr4 Cufflinks exon 152893177 152893195 . - . gene_id "XLOC_006692"; transcript_id "TCONS_00006692"; exon_number "1"; oId "CUFF.6646.1"; tss_id "TSS6692"; +chr4 Cufflinks exon 153176444 153176494 . - . gene_id "XLOC_006693"; transcript_id "TCONS_00006693"; exon_number "1"; oId "CUFF.6647.1"; tss_id "TSS6693"; +chr4 Cufflinks exon 153185301 153185597 . - . gene_id "XLOC_006694"; transcript_id "TCONS_00006694"; exon_number "1"; oId "CUFF.6648.1"; tss_id "TSS6694"; +chr4 Cufflinks exon 154186815 154186907 . - . gene_id "XLOC_006695"; transcript_id "TCONS_00006695"; exon_number "1"; oId "CUFF.6650.1"; tss_id "TSS6695"; +chr4 Cufflinks exon 154302856 154303167 . - . gene_id "XLOC_006696"; transcript_id "TCONS_00006696"; exon_number "1"; oId "CUFF.6651.1"; tss_id "TSS6696"; +chr4 Cufflinks exon 155465096 155465188 . - . gene_id "XLOC_006697"; transcript_id "TCONS_00006697"; exon_number "1"; oId "CUFF.6653.1"; tss_id "TSS6697"; +chr4 Cufflinks exon 156384978 156385052 . - . gene_id "XLOC_006698"; transcript_id "TCONS_00006698"; exon_number "1"; oId "CUFF.6659.1"; tss_id "TSS6698"; +chr4 Cufflinks exon 157366965 157367006 . - . gene_id "XLOC_006699"; transcript_id "TCONS_00006699"; exon_number "1"; oId "CUFF.6661.1"; tss_id "TSS6699"; +chr4 Cufflinks exon 158122714 158122819 . - . gene_id "XLOC_006700"; transcript_id "TCONS_00006700"; exon_number "1"; oId "CUFF.6663.1"; tss_id "TSS6700"; +chr4 Cufflinks exon 158344214 158344332 . - . gene_id "XLOC_006701"; transcript_id "TCONS_00006701"; exon_number "1"; oId "CUFF.6664.1"; tss_id "TSS6701"; +chr4 Cufflinks exon 159715742 159715848 . - . gene_id "XLOC_006702"; transcript_id "TCONS_00006702"; exon_number "1"; oId "CUFF.6668.1"; tss_id "TSS6702"; +chr4 Cufflinks exon 160428043 160428207 . - . gene_id "XLOC_006703"; transcript_id "TCONS_00006703"; exon_number "1"; oId "CUFF.6670.1"; tss_id "TSS6703"; +chr4 Cufflinks exon 160428545 160428610 . - . gene_id "XLOC_006704"; transcript_id "TCONS_00006704"; exon_number "1"; oId "CUFF.6671.1"; tss_id "TSS6704"; +chr4 Cufflinks exon 161486171 161486290 . - . gene_id "XLOC_006705"; transcript_id "TCONS_00006705"; exon_number "1"; oId "CUFF.6672.1"; tss_id "TSS6705"; +chr4 Cufflinks exon 161999471 161999534 . - . gene_id "XLOC_006706"; transcript_id "TCONS_00006706"; exon_number "1"; oId "CUFF.6673.1"; tss_id "TSS6706"; +chr4 Cufflinks exon 162202916 162202997 . - . gene_id "XLOC_006707"; transcript_id "TCONS_00006707"; exon_number "1"; oId "CUFF.6674.1"; tss_id "TSS6707"; +chr4 Cufflinks exon 164750038 164750265 . - . gene_id "XLOC_006708"; transcript_id "TCONS_00006708"; exon_number "1"; oId "CUFF.6675.1"; tss_id "TSS6708"; +chr4 Cufflinks exon 166214380 166214461 . - . gene_id "XLOC_006709"; transcript_id "TCONS_00006709"; exon_number "1"; oId "CUFF.6680.1"; tss_id "TSS6709"; +chr4 Cufflinks exon 166974340 166974445 . - . gene_id "XLOC_006710"; transcript_id "TCONS_00006710"; exon_number "1"; oId "CUFF.6681.1"; tss_id "TSS6710"; +chr4 Cufflinks exon 167187034 167187073 . - . gene_id "XLOC_006711"; transcript_id "TCONS_00006711"; exon_number "1"; oId "CUFF.6684.1"; tss_id "TSS6711"; +chr4 Cufflinks exon 167323100 167323137 . - . gene_id "XLOC_006712"; transcript_id "TCONS_00006712"; exon_number "1"; oId "CUFF.6685.1"; tss_id "TSS6712"; +chr4 Cufflinks exon 167839534 167839642 . - . gene_id "XLOC_006713"; transcript_id "TCONS_00006713"; exon_number "1"; oId "CUFF.6686.1"; tss_id "TSS6713"; +chr4 Cufflinks exon 168321627 168321908 . - . gene_id "XLOC_006714"; transcript_id "TCONS_00006714"; exon_number "1"; oId "CUFF.6687.1"; tss_id "TSS6714"; +chr4 Cufflinks exon 169607759 169607867 . - . gene_id "XLOC_006715"; transcript_id "TCONS_00006715"; exon_number "1"; oId "CUFF.6692.1"; tss_id "TSS6715"; +chr4 Cufflinks exon 169946949 169947033 . - . gene_id "XLOC_006716"; transcript_id "TCONS_00006716"; exon_number "1"; oId "CUFF.6694.1"; tss_id "TSS6716"; +chr4 Cufflinks exon 170997536 170997570 . - . gene_id "XLOC_006717"; transcript_id "TCONS_00006717"; exon_number "1"; oId "CUFF.6695.1"; tss_id "TSS6717"; +chr4 Cufflinks exon 171003006 171003040 . - . gene_id "XLOC_006718"; transcript_id "TCONS_00006718"; exon_number "1"; oId "CUFF.6696.1"; tss_id "TSS6718"; +chr4 Cufflinks exon 174367755 174367855 . - . gene_id "XLOC_006719"; transcript_id "TCONS_00006719"; exon_number "1"; oId "CUFF.6703.1"; tss_id "TSS6719"; +chr4 Cufflinks exon 174368836 174368871 . - . gene_id "XLOC_006720"; transcript_id "TCONS_00006720"; exon_number "1"; oId "CUFF.6704.1"; tss_id "TSS6720"; +chr4 Cufflinks exon 174875537 174875571 . - . gene_id "XLOC_006721"; transcript_id "TCONS_00006721"; exon_number "1"; oId "CUFF.6705.1"; tss_id "TSS6721"; +chr4 Cufflinks exon 174883118 174883153 . - . gene_id "XLOC_006722"; transcript_id "TCONS_00006722"; exon_number "1"; oId "CUFF.6706.1"; tss_id "TSS6722"; +chr4 Cufflinks exon 178378293 178378382 . - . gene_id "XLOC_006723"; transcript_id "TCONS_00006723"; exon_number "1"; oId "CUFF.6708.1"; tss_id "TSS6723"; +chr4 Cufflinks exon 178545870 178545905 . - . gene_id "XLOC_006724"; transcript_id "TCONS_00006724"; exon_number "1"; oId "CUFF.6710.1"; tss_id "TSS6724"; +chr4 Cufflinks exon 178593579 178593613 . - . gene_id "XLOC_006725"; transcript_id "TCONS_00006725"; exon_number "1"; oId "CUFF.6711.1"; tss_id "TSS6725"; +chr4 Cufflinks exon 179037930 179038013 . - . gene_id "XLOC_006726"; transcript_id "TCONS_00006726"; exon_number "1"; oId "CUFF.6714.1"; tss_id "TSS6726"; +chr4 Cufflinks exon 181150321 181150452 . - . gene_id "XLOC_006727"; transcript_id "TCONS_00006727"; exon_number "1"; oId "CUFF.6716.1"; tss_id "TSS6727"; +chr4 Cufflinks exon 181405960 181406042 . - . gene_id "XLOC_006728"; transcript_id "TCONS_00006728"; exon_number "1"; oId "CUFF.6717.1"; tss_id "TSS6728"; +chr4 Cufflinks exon 182756115 182756261 . - . gene_id "XLOC_006729"; transcript_id "TCONS_00006729"; exon_number "1"; oId "CUFF.6718.1"; tss_id "TSS6729"; +chr4 Cufflinks exon 183102116 183102165 . - . gene_id "XLOC_006730"; transcript_id "TCONS_00006730"; exon_number "1"; oId "CUFF.6719.1"; tss_id "TSS6730"; +chr4 Cufflinks exon 183408707 183408763 . - . gene_id "XLOC_006731"; transcript_id "TCONS_00006731"; exon_number "1"; oId "CUFF.6720.1"; tss_id "TSS6731"; +chr4 Cufflinks exon 183552666 183552841 . - . gene_id "XLOC_006732"; transcript_id "TCONS_00006732"; exon_number "1"; oId "CUFF.6722.1"; tss_id "TSS6732"; +chr4 Cufflinks exon 184090524 184090568 . - . gene_id "XLOC_006733"; transcript_id "TCONS_00006733"; exon_number "1"; oId "CUFF.6723.1"; tss_id "TSS6733"; +chr4 Cufflinks exon 184097913 184098041 . - . gene_id "XLOC_006734"; transcript_id "TCONS_00006734"; exon_number "1"; oId "CUFF.6724.1"; tss_id "TSS6734"; +chr4 Cufflinks exon 184195611 184195718 . - . gene_id "XLOC_006735"; transcript_id "TCONS_00006735"; exon_number "1"; oId "CUFF.6725.1"; tss_id "TSS6735"; +chr4 Cufflinks exon 184503345 184503454 . - . gene_id "XLOC_006736"; transcript_id "TCONS_00006736"; exon_number "1"; oId "CUFF.6727.1"; tss_id "TSS6736"; +chr4 Cufflinks exon 184574732 184574796 . - . gene_id "XLOC_006737"; transcript_id "TCONS_00006737"; exon_number "1"; oId "CUFF.6728.1"; tss_id "TSS6737"; +chr4 Cufflinks exon 184596776 184596868 . - . gene_id "XLOC_006738"; transcript_id "TCONS_00006738"; exon_number "1"; oId "CUFF.6729.1"; tss_id "TSS6738"; +chr4 Cufflinks exon 186947673 186947740 . - . gene_id "XLOC_006739"; transcript_id "TCONS_00006739"; exon_number "1"; oId "CUFF.6734.1"; tss_id "TSS6739"; +chr4 Cufflinks exon 186963764 186963798 . - . gene_id "XLOC_006740"; transcript_id "TCONS_00006740"; exon_number "1"; oId "CUFF.6735.1"; tss_id "TSS6740"; +chr4 Cufflinks exon 189042686 189042787 . - . gene_id "XLOC_006741"; transcript_id "TCONS_00006741"; exon_number "1"; oId "CUFF.6737.1"; tss_id "TSS6741"; +chr4 Cufflinks exon 189112324 189112355 . - . gene_id "XLOC_006742"; transcript_id "TCONS_00006742"; exon_number "1"; oId "CUFF.6738.1"; tss_id "TSS6742"; +chr4 Cufflinks exon 189637825 189637878 . - . gene_id "XLOC_006743"; transcript_id "TCONS_00006743"; exon_number "1"; oId "CUFF.6739.1"; tss_id "TSS6743"; +chr4 Cufflinks exon 190630706 190630868 . - . gene_id "XLOC_006744"; transcript_id "TCONS_00006744"; exon_number "1"; oId "CUFF.6741.1"; tss_id "TSS6744"; +chr4 Cufflinks exon 190879738 190879784 . - . gene_id "XLOC_006745"; transcript_id "TCONS_00006745"; exon_number "1"; oId "CUFF.6744.1"; tss_id "TSS6745"; +chr4_ctg9_hap1 Cufflinks exon 78459 78490 . - . gene_id "XLOC_006746"; transcript_id "TCONS_00006746"; exon_number "1"; oId "CUFF.6747.1"; tss_id "TSS6746"; +chr4_gl000193_random Cufflinks exon 169638 169937 . - . gene_id "XLOC_006747"; transcript_id "TCONS_00006747"; exon_number "1"; oId "CUFF.6748.1"; tss_id "TSS6747"; +chr5 Cufflinks exon 2455462 2455498 . + . gene_id "XLOC_006748"; transcript_id "TCONS_00006748"; exon_number "1"; oId "CUFF.6750.1"; tss_id "TSS6748"; +chr5 Cufflinks exon 5126159 5126388 . + . gene_id "XLOC_006749"; transcript_id "TCONS_00006749"; exon_number "1"; oId "CUFF.6753.1"; tss_id "TSS6749"; +chr5 Cufflinks exon 5396520 5396588 . + . gene_id "XLOC_006750"; transcript_id "TCONS_00006750"; exon_number "1"; oId "CUFF.6754.1"; tss_id "TSS6750"; +chr5 Cufflinks exon 7047340 7047450 . + . gene_id "XLOC_006751"; transcript_id "TCONS_00006751"; exon_number "1"; oId "CUFF.6760.1"; tss_id "TSS6751"; +chr5 Cufflinks exon 7980261 7980420 . + . gene_id "XLOC_006752"; transcript_id "TCONS_00006752"; exon_number "1"; oId "CUFF.6762.1"; tss_id "TSS6752"; +chr5 Cufflinks exon 9626034 9626099 . + . gene_id "XLOC_006753"; transcript_id "TCONS_00006753"; exon_number "1"; oId "CUFF.6764.1"; tss_id "TSS6753"; +chr5 Cufflinks exon 9761019 9761107 . + . gene_id "XLOC_006754"; transcript_id "TCONS_00006754"; exon_number "1"; oId "CUFF.6765.1"; tss_id "TSS6754"; +chr5 Cufflinks exon 10231231 10231268 . + . gene_id "XLOC_006755"; transcript_id "TCONS_00006755"; exon_number "1"; oId "CUFF.6766.1"; tss_id "TSS6755"; +chr5 Cufflinks exon 10374042 10375088 . + . gene_id "XLOC_006756"; transcript_id "TCONS_00006756"; exon_number "1"; oId "CUFF.6767.1"; tss_id "TSS6756"; +chr5 Cufflinks exon 10376636 10376766 . + . gene_id "XLOC_006757"; transcript_id "TCONS_00006757"; exon_number "1"; oId "CUFF.6768.1"; tss_id "TSS6757"; +chr5 Cufflinks exon 10376832 10377147 . + . gene_id "XLOC_006758"; transcript_id "TCONS_00006758"; exon_number "1"; oId "CUFF.6769.1"; tss_id "TSS6758"; +chr5 Cufflinks exon 11027312 11027418 . + . gene_id "XLOC_006759"; transcript_id "TCONS_00006759"; exon_number "1"; oId "CUFF.6770.1"; tss_id "TSS6759"; +chr5 Cufflinks exon 12314420 12314463 . + . gene_id "XLOC_006760"; transcript_id "TCONS_00006760"; exon_number "1"; oId "CUFF.6772.1"; tss_id "TSS6760"; +chr5 Cufflinks exon 15346895 15346946 . + . gene_id "XLOC_006761"; transcript_id "TCONS_00006761"; exon_number "1"; oId "CUFF.6777.1"; tss_id "TSS6761"; +chr5 Cufflinks exon 16854103 16854196 . + . gene_id "XLOC_006762"; transcript_id "TCONS_00006762"; exon_number "1"; oId "CUFF.6781.1"; tss_id "TSS6762"; +chr5 Cufflinks exon 17240720 17240824 . + . gene_id "XLOC_006763"; transcript_id "TCONS_00006763"; exon_number "1"; oId "CUFF.6784.1"; tss_id "TSS6763"; +chr5 Cufflinks exon 17345725 17345964 . + . gene_id "XLOC_006764"; transcript_id "TCONS_00006764"; exon_number "1"; oId "CUFF.6785.1"; tss_id "TSS6764"; +chr5 Cufflinks exon 18547421 18547720 . + . gene_id "XLOC_006765"; transcript_id "TCONS_00006765"; exon_number "1"; oId "CUFF.6786.1"; tss_id "TSS6765"; +chr5 Cufflinks exon 18550187 18550251 . + . gene_id "XLOC_006766"; transcript_id "TCONS_00006766"; exon_number "1"; oId "CUFF.6787.1"; tss_id "TSS6766"; +chr5 Cufflinks exon 18844017 18844112 . + . gene_id "XLOC_006767"; transcript_id "TCONS_00006767"; exon_number "1"; oId "CUFF.6788.1"; tss_id "TSS6767"; +chr5 Cufflinks exon 20194810 20194938 . + . gene_id "XLOC_006768"; transcript_id "TCONS_00006768"; exon_number "1"; oId "CUFF.6790.1"; tss_id "TSS6768"; +chr5 Cufflinks exon 20702965 20703030 . + . gene_id "XLOC_006769"; transcript_id "TCONS_00006769"; exon_number "1"; oId "CUFF.6792.1"; tss_id "TSS6769"; +chr5 Cufflinks exon 22944286 22944317 . + . gene_id "XLOC_006770"; transcript_id "TCONS_00006770"; exon_number "1"; oId "CUFF.6793.1"; tss_id "TSS6770"; +chr5 Cufflinks exon 22971901 22971966 . + . gene_id "XLOC_006771"; transcript_id "TCONS_00006771"; exon_number "1"; oId "CUFF.6794.1"; tss_id "TSS6771"; +chr5 Cufflinks exon 23243507 23243542 . + . gene_id "XLOC_006772"; transcript_id "TCONS_00006772"; exon_number "1"; oId "CUFF.6795.1"; tss_id "TSS6772"; +chr5 Cufflinks exon 24337199 24337263 . + . gene_id "XLOC_006773"; transcript_id "TCONS_00006773"; exon_number "1"; oId "CUFF.6796.1"; tss_id "TSS6773"; +chr5 Cufflinks exon 26012998 26013137 . + . gene_id "XLOC_006774"; transcript_id "TCONS_00006774"; exon_number "1"; oId "CUFF.6800.1"; tss_id "TSS6774"; +chr5 Cufflinks exon 27111676 27111779 . + . gene_id "XLOC_006775"; transcript_id "TCONS_00006775"; exon_number "1"; oId "CUFF.6802.1"; tss_id "TSS6775"; +chr5 Cufflinks exon 28282396 28282436 . + . gene_id "XLOC_006776"; transcript_id "TCONS_00006776"; exon_number "1"; oId "CUFF.6803.1"; tss_id "TSS6776"; +chr5 Cufflinks exon 28624764 28624856 . + . gene_id "XLOC_006777"; transcript_id "TCONS_00006777"; exon_number "1"; oId "CUFF.6804.1"; tss_id "TSS6777"; +chr5 Cufflinks exon 28689364 28689397 . + . gene_id "XLOC_006778"; transcript_id "TCONS_00006778"; exon_number "1"; oId "CUFF.6805.1"; tss_id "TSS6778"; +chr5 Cufflinks exon 29053861 29053928 . + . gene_id "XLOC_006779"; transcript_id "TCONS_00006779"; exon_number "1"; oId "CUFF.6806.1"; tss_id "TSS6779"; +chr5 Cufflinks exon 29948935 29949169 . + . gene_id "XLOC_006780"; transcript_id "TCONS_00006780"; exon_number "1"; oId "CUFF.6808.1"; tss_id "TSS6780"; +chr5 Cufflinks exon 30228995 30229039 . + . gene_id "XLOC_006781"; transcript_id "TCONS_00006781"; exon_number "1"; oId "CUFF.6809.1"; tss_id "TSS6781"; +chr5 Cufflinks exon 31597613 31597642 . + . gene_id "XLOC_006782"; transcript_id "TCONS_00006782"; exon_number "1"; oId "CUFF.6811.1"; tss_id "TSS6782"; +chr5 Cufflinks exon 31824685 31824792 . + . gene_id "XLOC_006783"; transcript_id "TCONS_00006783"; exon_number "1"; oId "CUFF.6813.1"; tss_id "TSS6783"; +chr5 Cufflinks exon 31832546 31832619 . + . gene_id "XLOC_006784"; transcript_id "TCONS_00006784"; exon_number "1"; oId "CUFF.6814.1"; tss_id "TSS6784"; +chr5 Cufflinks exon 32309768 32309874 . + . gene_id "XLOC_006785"; transcript_id "TCONS_00006785"; exon_number "1"; oId "CUFF.6817.1"; tss_id "TSS6785"; +chr5 Cufflinks exon 32452300 32452367 . + . gene_id "XLOC_006786"; transcript_id "TCONS_00006786"; exon_number "1"; oId "CUFF.6818.1"; tss_id "TSS6786"; +chr5 Cufflinks exon 33921774 33921802 . + . gene_id "XLOC_006787"; transcript_id "TCONS_00006787"; exon_number "1"; oId "CUFF.6823.1"; tss_id "TSS6787"; +chr5 Cufflinks exon 34038378 34038545 . + . gene_id "XLOC_006788"; transcript_id "TCONS_00006788"; exon_number "1"; oId "CUFF.6824.1"; tss_id "TSS6788"; +chr5 Cufflinks exon 34802385 34802473 . + . gene_id "XLOC_006789"; transcript_id "TCONS_00006789"; exon_number "1"; oId "CUFF.6826.1"; tss_id "TSS6789"; +chr5 Cufflinks exon 34862060 34862232 . + . gene_id "XLOC_006790"; transcript_id "TCONS_00006790"; exon_number "1"; oId "CUFF.6827.1"; tss_id "TSS6790"; +chr5 Cufflinks exon 35429166 35429379 . + . gene_id "XLOC_006791"; transcript_id "TCONS_00006791"; exon_number "1"; oId "CUFF.6829.1"; tss_id "TSS6791"; +chr5 Cufflinks exon 36155222 36155317 . + . gene_id "XLOC_006792"; transcript_id "TCONS_00006792"; exon_number "1"; oId "CUFF.6832.1"; tss_id "TSS6792"; +chr5 Cufflinks exon 36485447 36485534 . + . gene_id "XLOC_006793"; transcript_id "TCONS_00006793"; exon_number "1"; oId "CUFF.6833.1"; tss_id "TSS6793"; +chr5 Cufflinks exon 37327238 37327284 . + . gene_id "XLOC_006794"; transcript_id "TCONS_00006794"; exon_number "1"; oId "CUFF.6835.1"; tss_id "TSS6794"; +chr5 Cufflinks exon 38074927 38074969 . + . gene_id "XLOC_006795"; transcript_id "TCONS_00006795"; exon_number "1"; oId "CUFF.6838.1"; tss_id "TSS6795"; +chr5 Cufflinks exon 39397630 39397706 . + . gene_id "XLOC_006796"; transcript_id "TCONS_00006796"; exon_number "1"; oId "CUFF.6839.1"; tss_id "TSS6796"; +chr5 Cufflinks exon 40269660 40269820 . + . gene_id "XLOC_006797"; transcript_id "TCONS_00006797"; exon_number "1"; oId "CUFF.6840.1"; tss_id "TSS6797"; +chr5 Cufflinks exon 40662262 40662299 . + . gene_id "XLOC_006798"; transcript_id "TCONS_00006798"; exon_number "1"; oId "CUFF.6841.1"; tss_id "TSS6798"; +chr5 Cufflinks exon 44638026 44638076 . + . gene_id "XLOC_006799"; transcript_id "TCONS_00006799"; exon_number "1"; oId "CUFF.6852.1"; tss_id "TSS6799"; +chr5 Cufflinks exon 44716293 44716604 . + . gene_id "XLOC_006800"; transcript_id "TCONS_00006800"; exon_number "1"; oId "CUFF.6853.1"; tss_id "TSS6800"; +chr5 Cufflinks exon 50617816 50617922 . + . gene_id "XLOC_006801"; transcript_id "TCONS_00006801"; exon_number "1"; oId "CUFF.6857.1"; tss_id "TSS6801"; +chr5 Cufflinks exon 51182522 51182595 . + . gene_id "XLOC_006802"; transcript_id "TCONS_00006802"; exon_number "1"; oId "CUFF.6858.1"; tss_id "TSS6802"; +chr5 Cufflinks exon 52158127 52158163 . + . gene_id "XLOC_006803"; transcript_id "TCONS_00006803"; exon_number "1"; oId "CUFF.6860.1"; tss_id "TSS6803"; +chr5 Cufflinks exon 52297074 52297137 . + . gene_id "XLOC_006804"; transcript_id "TCONS_00006804"; exon_number "1"; oId "CUFF.6861.1"; tss_id "TSS6804"; +chr5 Cufflinks exon 52768690 52768745 . + . gene_id "XLOC_006805"; transcript_id "TCONS_00006805"; exon_number "1"; oId "CUFF.6862.1"; tss_id "TSS6805"; +chr5 Cufflinks exon 54275852 54275953 . + . gene_id "XLOC_006806"; transcript_id "TCONS_00006806"; exon_number "1"; oId "CUFF.6867.1"; tss_id "TSS6806"; +chr5 Cufflinks exon 54611605 54611655 . + . gene_id "XLOC_006807"; transcript_id "TCONS_00006807"; exon_number "1"; oId "CUFF.6870.1"; tss_id "TSS6807"; +chr5 Cufflinks exon 55073299 55073413 . + . gene_id "XLOC_006808"; transcript_id "TCONS_00006808"; exon_number "1"; oId "CUFF.6871.1"; tss_id "TSS6808"; +chr5 Cufflinks exon 55421531 55421596 . + . gene_id "XLOC_006809"; transcript_id "TCONS_00006809"; exon_number "1"; oId "CUFF.6873.1"; tss_id "TSS6809"; +chr5 Cufflinks exon 55939231 55939327 . + . gene_id "XLOC_006810"; transcript_id "TCONS_00006810"; exon_number "1"; oId "CUFF.6876.1"; tss_id "TSS6810"; +chr5 Cufflinks exon 56152981 56153081 . + . gene_id "XLOC_006811"; transcript_id "TCONS_00006811"; exon_number "1"; oId "CUFF.6877.1"; tss_id "TSS6811"; +chr5 Cufflinks exon 57016989 57017095 . + . gene_id "XLOC_006812"; transcript_id "TCONS_00006812"; exon_number "1"; oId "CUFF.6879.1"; tss_id "TSS6812"; +chr5 Cufflinks exon 57366014 57366121 . + . gene_id "XLOC_006813"; transcript_id "TCONS_00006813"; exon_number "1"; oId "CUFF.6880.1"; tss_id "TSS6813"; +chr5 Cufflinks exon 57738369 57738403 . + . gene_id "XLOC_006814"; transcript_id "TCONS_00006814"; exon_number "1"; oId "CUFF.6881.1"; tss_id "TSS6814"; +chr5 Cufflinks exon 58322328 58322360 . + . gene_id "XLOC_006815"; transcript_id "TCONS_00006815"; exon_number "1"; oId "CUFF.6882.1"; tss_id "TSS6815"; +chr5 Cufflinks exon 60004778 60004834 . + . gene_id "XLOC_006816"; transcript_id "TCONS_00006816"; exon_number "1"; oId "CUFF.6886.1"; tss_id "TSS6816"; +chr5 Cufflinks exon 61442539 61442660 . + . gene_id "XLOC_006817"; transcript_id "TCONS_00006817"; exon_number "1"; oId "CUFF.6888.1"; tss_id "TSS6817"; +chr5 Cufflinks exon 61739003 61739107 . + . gene_id "XLOC_006818"; transcript_id "TCONS_00006818"; exon_number "1"; oId "CUFF.6889.1"; tss_id "TSS6818"; +chr5 Cufflinks exon 62780084 62780130 . + . gene_id "XLOC_006819"; transcript_id "TCONS_00006819"; exon_number "1"; oId "CUFF.6892.1"; tss_id "TSS6819"; +chr5 Cufflinks exon 63835332 63835630 . + . gene_id "XLOC_006820"; transcript_id "TCONS_00006820"; exon_number "1"; oId "CUFF.6895.1"; tss_id "TSS6820"; +chr5 Cufflinks exon 63869399 63869493 . + . gene_id "XLOC_006821"; transcript_id "TCONS_00006821"; exon_number "1"; oId "CUFF.6896.1"; tss_id "TSS6821"; +chr5 Cufflinks exon 64722216 64722272 . + . gene_id "XLOC_006822"; transcript_id "TCONS_00006822"; exon_number "1"; oId "CUFF.6898.1"; tss_id "TSS6822"; +chr5 Cufflinks exon 64885219 64885287 . + . gene_id "XLOC_006823"; transcript_id "TCONS_00006823"; exon_number "1"; oId "CUFF.6899.1"; tss_id "TSS6823"; +chr5 Cufflinks exon 64895144 64895209 . + . gene_id "XLOC_006824"; transcript_id "TCONS_00006824"; exon_number "1"; oId "CUFF.6900.1"; tss_id "TSS6824"; +chr5 Cufflinks exon 65866434 65866555 . + . gene_id "XLOC_006825"; transcript_id "TCONS_00006825"; exon_number "1"; oId "CUFF.6907.1"; tss_id "TSS6825"; +chr5 Cufflinks exon 65925673 65925708 . + . gene_id "XLOC_006826"; transcript_id "TCONS_00006826"; exon_number "1"; oId "CUFF.6908.1"; tss_id "TSS6826"; +chr5 Cufflinks exon 68169797 68169894 . + . gene_id "XLOC_006827"; transcript_id "TCONS_00006827"; exon_number "1"; oId "CUFF.6911.1"; tss_id "TSS6827"; +chr5 Cufflinks exon 70384458 70384565 . + . gene_id "XLOC_006828"; transcript_id "TCONS_00006828"; exon_number "1"; oId "CUFF.6917.1"; tss_id "TSS6828"; +chr5 Cufflinks exon 71146745 71146942 . + . gene_id "XLOC_006829"; transcript_id "TCONS_00006829"; exon_number "1"; oId "CUFF.6919.1"; tss_id "TSS6829"; +chr5 Cufflinks exon 73613811 73614123 . + . gene_id "XLOC_006830"; transcript_id "TCONS_00006830"; exon_number "1"; oId "CUFF.6925.1"; tss_id "TSS6830"; +chr5 Cufflinks exon 74075134 74075237 . + . gene_id "XLOC_006831"; transcript_id "TCONS_00006831"; exon_number "1"; oId "CUFF.6927.1"; tss_id "TSS6831"; +chr5 Cufflinks exon 74688050 74688094 . + . gene_id "XLOC_006832"; transcript_id "TCONS_00006832"; exon_number "1"; oId "CUFF.6928.1"; tss_id "TSS6832"; +chr5 Cufflinks exon 74822035 74822072 . + . gene_id "XLOC_006833"; transcript_id "TCONS_00006833"; exon_number "1"; oId "CUFF.6929.1"; tss_id "TSS6833"; +chr5 Cufflinks exon 75337594 75337693 . + . gene_id "XLOC_006834"; transcript_id "TCONS_00006834"; exon_number "1"; oId "CUFF.6932.1"; tss_id "TSS6834"; +chr5 Cufflinks exon 76079920 76080027 . + . gene_id "XLOC_006835"; transcript_id "TCONS_00006835"; exon_number "1"; oId "CUFF.6934.1"; tss_id "TSS6835"; +chr5 Cufflinks exon 77501127 77501174 . + . gene_id "XLOC_006836"; transcript_id "TCONS_00006836"; exon_number "1"; oId "CUFF.6937.1"; tss_id "TSS6836"; +chr5 Cufflinks exon 78523273 78523372 . + . gene_id "XLOC_006837"; transcript_id "TCONS_00006837"; exon_number "1"; oId "CUFF.6940.1"; tss_id "TSS6837"; +chr5 Cufflinks exon 79823895 79823967 . + . gene_id "XLOC_006838"; transcript_id "TCONS_00006838"; exon_number "1"; oId "CUFF.6944.1"; tss_id "TSS6838"; +chr5 Cufflinks exon 80501461 80501508 . + . gene_id "XLOC_006839"; transcript_id "TCONS_00006839"; exon_number "1"; oId "CUFF.6947.1"; tss_id "TSS6839"; +chr5 Cufflinks exon 80999154 80999280 . + . gene_id "XLOC_006840"; transcript_id "TCONS_00006840"; exon_number "1"; oId "CUFF.6949.1"; tss_id "TSS6840"; +chr5 Cufflinks exon 81124268 81124301 . + . gene_id "XLOC_006841"; transcript_id "TCONS_00006841"; exon_number "1"; oId "CUFF.6951.1"; tss_id "TSS6841"; +chr5 Cufflinks exon 81374246 81374560 . + . gene_id "XLOC_006842"; transcript_id "TCONS_00006842"; exon_number "1"; oId "CUFF.6952.1"; tss_id "TSS6842"; +chr5 Cufflinks exon 81820076 81820160 . + . gene_id "XLOC_006843"; transcript_id "TCONS_00006843"; exon_number "1"; oId "CUFF.6953.1"; tss_id "TSS6843"; +chr5 Cufflinks exon 82096159 82096189 . + . gene_id "XLOC_006844"; transcript_id "TCONS_00006844"; exon_number "1"; oId "CUFF.6954.1"; tss_id "TSS6844"; +chr5 Cufflinks exon 82356866 82356903 . + . gene_id "XLOC_006845"; transcript_id "TCONS_00006845"; exon_number "1"; oId "CUFF.6955.1"; tss_id "TSS6845"; +chr5 Cufflinks exon 82981686 82981833 . + . gene_id "XLOC_006846"; transcript_id "TCONS_00006846"; exon_number "1"; oId "CUFF.6956.1"; tss_id "TSS6846"; +chr5 Cufflinks exon 82999267 82999362 . + . gene_id "XLOC_006847"; transcript_id "TCONS_00006847"; exon_number "1"; oId "CUFF.6957.1"; tss_id "TSS6847"; +chr5 Cufflinks exon 83099373 83099507 . + . gene_id "XLOC_006848"; transcript_id "TCONS_00006848"; exon_number "1"; oId "CUFF.6958.1"; tss_id "TSS6848"; +chr5 Cufflinks exon 83492701 83492773 . + . gene_id "XLOC_006849"; transcript_id "TCONS_00006849"; exon_number "1"; oId "CUFF.6960.1"; tss_id "TSS6849"; +chr5 Cufflinks exon 83611423 83611498 . + . gene_id "XLOC_006850"; transcript_id "TCONS_00006850"; exon_number "1"; oId "CUFF.6961.1"; tss_id "TSS6850"; +chr5 Cufflinks exon 84142030 84142070 . + . gene_id "XLOC_006851"; transcript_id "TCONS_00006851"; exon_number "1"; oId "CUFF.6962.1"; tss_id "TSS6851"; +chr5 Cufflinks exon 85193123 85193170 . + . gene_id "XLOC_006852"; transcript_id "TCONS_00006852"; exon_number "1"; oId "CUFF.6965.1"; tss_id "TSS6852"; +chr5 Cufflinks exon 86803014 86803091 . + . gene_id "XLOC_006853"; transcript_id "TCONS_00006853"; exon_number "1"; oId "CUFF.6977.1"; tss_id "TSS6853"; +chr5 Cufflinks exon 87375856 87375893 . + . gene_id "XLOC_006854"; transcript_id "TCONS_00006854"; exon_number "1"; oId "CUFF.6978.1"; tss_id "TSS6854"; +chr5 Cufflinks exon 87923521 87923547 . + . gene_id "XLOC_006855"; transcript_id "TCONS_00006855"; exon_number "1"; oId "CUFF.6981.1"; tss_id "TSS6855"; +chr5 Cufflinks exon 89417789 89417830 . + . gene_id "XLOC_006856"; transcript_id "TCONS_00006856"; exon_number "1"; oId "CUFF.6986.1"; tss_id "TSS6856"; +chr5 Cufflinks exon 89761906 89761940 . + . gene_id "XLOC_006857"; transcript_id "TCONS_00006857"; exon_number "1"; oId "CUFF.6987.1"; tss_id "TSS6857"; +chr5 Cufflinks exon 90168332 90168370 . + . gene_id "XLOC_006858"; transcript_id "TCONS_00006858"; exon_number "1"; oId "CUFF.6989.1"; tss_id "TSS6858"; +chr5 Cufflinks exon 90566544 90566662 . + . gene_id "XLOC_006859"; transcript_id "TCONS_00006859"; exon_number "1"; oId "CUFF.6990.1"; tss_id "TSS6859"; +chr5 Cufflinks exon 90566960 90567000 . + . gene_id "XLOC_006860"; transcript_id "TCONS_00006860"; exon_number "1"; oId "CUFF.6991.1"; tss_id "TSS6860"; +chr5 Cufflinks exon 90584749 90585023 . + . gene_id "XLOC_006861"; transcript_id "TCONS_00006861"; exon_number "1"; oId "CUFF.6992.1"; tss_id "TSS6861"; +chr5 Cufflinks exon 90636573 90636645 . + . gene_id "XLOC_006862"; transcript_id "TCONS_00006862"; exon_number "1"; oId "CUFF.6993.1"; tss_id "TSS6862"; +chr5 Cufflinks exon 91188669 91188702 . + . gene_id "XLOC_006863"; transcript_id "TCONS_00006863"; exon_number "1"; oId "CUFF.6995.1"; tss_id "TSS6863"; +chr5 Cufflinks exon 92115281 92115349 . + . gene_id "XLOC_006864"; transcript_id "TCONS_00006864"; exon_number "1"; oId "CUFF.6997.1"; tss_id "TSS6864"; +chr5 Cufflinks exon 93081236 93081382 . + . gene_id "XLOC_006865"; transcript_id "TCONS_00006865"; exon_number "1"; oId "CUFF.6998.1"; tss_id "TSS6865"; +chr5 Cufflinks exon 93841585 93841639 . + . gene_id "XLOC_006866"; transcript_id "TCONS_00006866"; exon_number "1"; oId "CUFF.6999.1"; tss_id "TSS6866"; +chr5 Cufflinks exon 94857073 94857171 . + . gene_id "XLOC_006867"; transcript_id "TCONS_00006867"; exon_number "1"; oId "CUFF.7000.1"; tss_id "TSS6867"; +chr5 Cufflinks exon 97319898 97319919 . + . gene_id "XLOC_006868"; transcript_id "TCONS_00006868"; exon_number "1"; oId "CUFF.7005.1"; tss_id "TSS6868"; +chr5 Cufflinks exon 97320247 97320319 . + . gene_id "XLOC_006869"; transcript_id "TCONS_00006869"; exon_number "1"; oId "CUFF.7006.1"; tss_id "TSS6869"; +chr5 Cufflinks exon 97626410 97626460 . + . gene_id "XLOC_006870"; transcript_id "TCONS_00006870"; exon_number "1"; oId "CUFF.7008.1"; tss_id "TSS6870"; +chr5 Cufflinks exon 97745877 97745944 . + . gene_id "XLOC_006871"; transcript_id "TCONS_00006871"; exon_number "1"; oId "CUFF.7009.1"; tss_id "TSS6871"; +chr5 Cufflinks exon 97782906 97783071 . + . gene_id "XLOC_006872"; transcript_id "TCONS_00006872"; exon_number "1"; oId "CUFF.7010.1"; tss_id "TSS6872"; +chr5 Cufflinks exon 98225435 98225537 . + . gene_id "XLOC_006873"; transcript_id "TCONS_00006873"; exon_number "1"; oId "CUFF.7011.1"; tss_id "TSS6873"; +chr5 Cufflinks exon 98520441 98520474 . + . gene_id "XLOC_006874"; transcript_id "TCONS_00006874"; exon_number "1"; oId "CUFF.7012.1"; tss_id "TSS6874"; +chr5 Cufflinks exon 99389315 99389382 . + . gene_id "XLOC_006875"; transcript_id "TCONS_00006875"; exon_number "1"; oId "CUFF.7013.1"; tss_id "TSS6875"; +chr5 Cufflinks exon 99489376 99489483 . + . gene_id "XLOC_006876"; transcript_id "TCONS_00006876"; exon_number "1"; oId "CUFF.7014.1"; tss_id "TSS6876"; +chr5 Cufflinks exon 99629460 99629502 . + . gene_id "XLOC_006877"; transcript_id "TCONS_00006877"; exon_number "1"; oId "CUFF.7015.1"; tss_id "TSS6877"; +chr5 Cufflinks exon 100068762 100069090 . + . gene_id "XLOC_006878"; transcript_id "TCONS_00006878"; exon_number "1"; oId "CUFF.7016.1"; tss_id "TSS6878"; +chr5 Cufflinks exon 100917534 100917840 . + . gene_id "XLOC_006879"; transcript_id "TCONS_00006879"; exon_number "1"; oId "CUFF.7017.1"; tss_id "TSS6879"; +chr5 Cufflinks exon 101638208 101638448 . + . gene_id "XLOC_006880"; transcript_id "TCONS_00006880"; exon_number "1"; oId "CUFF.7019.1"; tss_id "TSS6880"; +chr5 Cufflinks exon 103012706 103012741 . + . gene_id "XLOC_006881"; transcript_id "TCONS_00006881"; exon_number "1"; oId "CUFF.7021.1"; tss_id "TSS6881"; +chr5 Cufflinks exon 103062074 103062216 . + . gene_id "XLOC_006882"; transcript_id "TCONS_00006882"; exon_number "1"; oId "CUFF.7022.1"; tss_id "TSS6882"; +chr5 Cufflinks exon 103434578 103434735 . + . gene_id "XLOC_006883"; transcript_id "TCONS_00006883"; exon_number "1"; oId "CUFF.7023.1"; tss_id "TSS6883"; +chr5 Cufflinks exon 104705836 104705881 . + . gene_id "XLOC_006884"; transcript_id "TCONS_00006884"; exon_number "1"; oId "CUFF.7026.1"; tss_id "TSS6884"; +chr5 Cufflinks exon 104910381 104910415 . + . gene_id "XLOC_006885"; transcript_id "TCONS_00006885"; exon_number "1"; oId "CUFF.7027.1"; tss_id "TSS6885"; +chr5 Cufflinks exon 107146327 107146573 . + . gene_id "XLOC_006886"; transcript_id "TCONS_00006886"; exon_number "1"; oId "CUFF.7031.1"; tss_id "TSS6886"; +chr5 Cufflinks exon 107719501 107719649 . + . gene_id "XLOC_006887"; transcript_id "TCONS_00006887"; exon_number "1"; oId "CUFF.7034.1"; tss_id "TSS6887"; +chr5 Cufflinks exon 111738206 111738265 . + . gene_id "XLOC_006888"; transcript_id "TCONS_00006888"; exon_number "1"; oId "CUFF.7044.1"; tss_id "TSS6888"; +chr5 Cufflinks exon 112114060 112114164 . + . gene_id "XLOC_006889"; transcript_id "TCONS_00006889"; exon_number "1"; oId "CUFF.7045.1"; tss_id "TSS6889"; +chr5 Cufflinks exon 112163192 112163252 . + . gene_id "XLOC_006890"; transcript_id "TCONS_00006890"; exon_number "1"; oId "CUFF.7046.1"; tss_id "TSS6890"; +chr5 Cufflinks exon 112267775 112267815 . + . gene_id "XLOC_006891"; transcript_id "TCONS_00006891"; exon_number "1"; oId "CUFF.7048.1"; tss_id "TSS6891"; +chr5 Cufflinks exon 113572216 113572265 . + . gene_id "XLOC_006892"; transcript_id "TCONS_00006892"; exon_number "1"; oId "CUFF.7050.1"; tss_id "TSS6892"; +chr5 Cufflinks exon 113589210 113589422 . + . gene_id "XLOC_006893"; transcript_id "TCONS_00006893"; exon_number "1"; oId "CUFF.7051.1"; tss_id "TSS6893"; +chr5 Cufflinks exon 114480661 114480699 . + . gene_id "XLOC_006894"; transcript_id "TCONS_00006894"; exon_number "1"; oId "CUFF.7053.1"; tss_id "TSS6894"; +chr5 Cufflinks exon 116153784 116153826 . + . gene_id "XLOC_006895"; transcript_id "TCONS_00006895"; exon_number "1"; oId "CUFF.7058.1"; tss_id "TSS6895"; +chr5 Cufflinks exon 116397603 116397632 . + . gene_id "XLOC_006896"; transcript_id "TCONS_00006896"; exon_number "1"; oId "CUFF.7059.1"; tss_id "TSS6896"; +chr5 Cufflinks exon 117169851 117169886 . + . gene_id "XLOC_006897"; transcript_id "TCONS_00006897"; exon_number "1"; oId "CUFF.7061.1"; tss_id "TSS6897"; +chr5 Cufflinks exon 118093907 118093968 . + . gene_id "XLOC_006898"; transcript_id "TCONS_00006898"; exon_number "1"; oId "CUFF.7063.1"; tss_id "TSS6898"; +chr5 Cufflinks exon 118112926 118112974 . + . gene_id "XLOC_006899"; transcript_id "TCONS_00006899"; exon_number "1"; oId "CUFF.7064.1"; tss_id "TSS6899"; +chr5 Cufflinks exon 118250379 118250444 . + . gene_id "XLOC_006900"; transcript_id "TCONS_00006900"; exon_number "1"; oId "CUFF.7066.1"; tss_id "TSS6900"; +chr5 Cufflinks exon 118343266 118343345 . + . gene_id "XLOC_006901"; transcript_id "TCONS_00006901"; exon_number "1"; oId "CUFF.7067.1"; tss_id "TSS6901"; +chr5 Cufflinks exon 118408195 118408226 . + . gene_id "XLOC_006902"; transcript_id "TCONS_00006902"; exon_number "1"; oId "CUFF.7070.1"; tss_id "TSS6902"; +chr5 Cufflinks exon 118474554 118474658 . + . gene_id "XLOC_006903"; transcript_id "TCONS_00006903"; exon_number "1"; oId "CUFF.7071.1"; tss_id "TSS6903"; +chr5 Cufflinks exon 118781416 118781530 . + . gene_id "XLOC_006904"; transcript_id "TCONS_00006904"; exon_number "1"; oId "CUFF.7073.1"; tss_id "TSS6904"; +chr5 Cufflinks exon 118824428 118824463 . + . gene_id "XLOC_006905"; transcript_id "TCONS_00006905"; exon_number "1"; oId "CUFF.7075.1"; tss_id "TSS6905"; +chr5 Cufflinks exon 120949525 120949559 . + . gene_id "XLOC_006906"; transcript_id "TCONS_00006906"; exon_number "1"; oId "CUFF.7080.1"; tss_id "TSS6906"; +chr5 Cufflinks exon 122131834 122131925 . + . gene_id "XLOC_006907"; transcript_id "TCONS_00006907"; exon_number "1"; oId "CUFF.7082.1"; tss_id "TSS6907"; +chr5 Cufflinks exon 122406478 122406796 . + . gene_id "XLOC_006908"; transcript_id "TCONS_00006908"; exon_number "1"; oId "CUFF.7086.1"; tss_id "TSS6908"; +chr5 Cufflinks exon 122990602 122991048 . + . gene_id "XLOC_006909"; transcript_id "TCONS_00006909"; exon_number "1"; oId "CUFF.7087.1"; tss_id "TSS6909"; +chr5 Cufflinks exon 126555979 126556021 . + . gene_id "XLOC_006910"; transcript_id "TCONS_00006910"; exon_number "1"; oId "CUFF.7093.1"; tss_id "TSS6910"; +chr5 Cufflinks exon 126838962 126839044 . + . gene_id "XLOC_006911"; transcript_id "TCONS_00006911"; exon_number "1"; oId "CUFF.7095.1"; tss_id "TSS6911"; +chr5 Cufflinks exon 127497639 127497675 . + . gene_id "XLOC_006912"; transcript_id "TCONS_00006912"; exon_number "1"; oId "CUFF.7096.1"; tss_id "TSS6912"; +chr5 Cufflinks exon 128770398 128770432 . + . gene_id "XLOC_006913"; transcript_id "TCONS_00006913"; exon_number "1"; oId "CUFF.7099.1"; tss_id "TSS6913"; +chr5 Cufflinks exon 129450096 129450185 . + . gene_id "XLOC_006914"; transcript_id "TCONS_00006914"; exon_number "1"; oId "CUFF.7100.1"; tss_id "TSS6914"; +chr5 Cufflinks exon 131112340 131112374 . + . gene_id "XLOC_006915"; transcript_id "TCONS_00006915"; exon_number "1"; oId "CUFF.7104.1"; tss_id "TSS6915"; +chr5 Cufflinks exon 131516473 131516514 . + . gene_id "XLOC_006916"; transcript_id "TCONS_00006916"; exon_number "1"; oId "CUFF.7105.1"; tss_id "TSS6916"; +chr5 Cufflinks exon 132076635 132076676 . + . gene_id "XLOC_006917"; transcript_id "TCONS_00006917"; exon_number "1"; oId "CUFF.7106.1"; tss_id "TSS6917"; +chr5 Cufflinks exon 132184269 132184358 . + . gene_id "XLOC_006918"; transcript_id "TCONS_00006918"; exon_number "1"; oId "CUFF.7108.1"; tss_id "TSS6918"; +chr5 Cufflinks exon 133288825 133288862 . + . gene_id "XLOC_006919"; transcript_id "TCONS_00006919"; exon_number "1"; oId "CUFF.7112.1"; tss_id "TSS6919"; +chr5 Cufflinks exon 133853501 133853701 . + . gene_id "XLOC_006920"; transcript_id "TCONS_00006920"; exon_number "1"; oId "CUFF.7114.1"; tss_id "TSS6920"; +chr5 Cufflinks exon 134051174 134051269 . + . gene_id "XLOC_006921"; transcript_id "TCONS_00006921"; exon_number "1"; oId "CUFF.7119.1"; tss_id "TSS6921"; +chr5 Cufflinks exon 134130921 134131200 . + . gene_id "XLOC_006922"; transcript_id "TCONS_00006922"; exon_number "1"; oId "CUFF.7120.1"; tss_id "TSS6922"; +chr5 Cufflinks exon 137402964 137402998 . + . gene_id "XLOC_006923"; transcript_id "TCONS_00006923"; exon_number "1"; oId "CUFF.7126.1"; tss_id "TSS6923"; +chr5 Cufflinks exon 137452262 137452368 . + . gene_id "XLOC_006924"; transcript_id "TCONS_00006924"; exon_number "1"; oId "CUFF.7129.1"; tss_id "TSS6924"; +chr5 Cufflinks exon 137469193 137469234 . + . gene_id "XLOC_006925"; transcript_id "TCONS_00006925"; exon_number "1"; oId "CUFF.7131.1"; tss_id "TSS6925"; +chr5 Cufflinks exon 137959167 137959274 . + . gene_id "XLOC_006926"; transcript_id "TCONS_00006926"; exon_number "1"; oId "CUFF.7133.1"; tss_id "TSS6926"; +chr5 Cufflinks exon 138348019 138348109 . + . gene_id "XLOC_006927"; transcript_id "TCONS_00006927"; exon_number "1"; oId "CUFF.7134.1"; tss_id "TSS6927"; +chr5 Cufflinks exon 138557452 138557526 . + . gene_id "XLOC_006928"; transcript_id "TCONS_00006928"; exon_number "1"; oId "CUFF.7135.1"; tss_id "TSS6928"; +chr5 Cufflinks exon 138635542 138635650 . + . gene_id "XLOC_006929"; transcript_id "TCONS_00006929"; exon_number "1"; oId "CUFF.7136.1"; tss_id "TSS6929"; +chr5 Cufflinks exon 138783596 138783707 . + . gene_id "XLOC_006930"; transcript_id "TCONS_00006930"; exon_number "1"; oId "CUFF.7138.1"; tss_id "TSS6930"; +chr5 Cufflinks exon 139886781 139886830 . + . gene_id "XLOC_006931"; transcript_id "TCONS_00006931"; exon_number "1"; oId "CUFF.7142.1"; tss_id "TSS6931"; +chr5 Cufflinks exon 140858883 140859193 . + . gene_id "XLOC_006932"; transcript_id "TCONS_00006932"; exon_number "1"; oId "CUFF.7146.1"; tss_id "TSS6932"; +chr5 Cufflinks exon 141499848 141499888 . + . gene_id "XLOC_006933"; transcript_id "TCONS_00006933"; exon_number "1"; oId "CUFF.7147.1"; tss_id "TSS6933"; +chr5 Cufflinks exon 142029512 142029548 . + . gene_id "XLOC_006934"; transcript_id "TCONS_00006934"; exon_number "1"; oId "CUFF.7149.1"; tss_id "TSS6934"; +chr5 Cufflinks exon 143520444 143520678 . + . gene_id "XLOC_006935"; transcript_id "TCONS_00006935"; exon_number "1"; oId "CUFF.7152.1"; tss_id "TSS6935"; +chr5 Cufflinks exon 145813324 145813353 . + . gene_id "XLOC_006936"; transcript_id "TCONS_00006936"; exon_number "1"; oId "CUFF.7156.1"; tss_id "TSS6936"; +chr5 Cufflinks exon 145935546 145935667 . + . gene_id "XLOC_006937"; transcript_id "TCONS_00006937"; exon_number "1"; oId "CUFF.7157.1"; tss_id "TSS6937"; +chr5 Cufflinks exon 146092184 146092414 . + . gene_id "XLOC_006938"; transcript_id "TCONS_00006938"; exon_number "1"; oId "CUFF.7160.1"; tss_id "TSS6938"; +chr5 Cufflinks exon 148430266 148430304 . + . gene_id "XLOC_006939"; transcript_id "TCONS_00006939"; exon_number "1"; oId "CUFF.7163.1"; tss_id "TSS6939"; +chr5 Cufflinks exon 148562204 148562235 . + . gene_id "XLOC_006940"; transcript_id "TCONS_00006940"; exon_number "1"; oId "CUFF.7166.1"; tss_id "TSS6940"; +chr5 Cufflinks exon 148853022 148853062 . + . gene_id "XLOC_006941"; transcript_id "TCONS_00006941"; exon_number "1"; oId "CUFF.7167.1"; tss_id "TSS6941"; +chr5 Cufflinks exon 149101637 149101950 . + . gene_id "XLOC_006942"; transcript_id "TCONS_00006942"; exon_number "1"; oId "CUFF.7170.1"; tss_id "TSS6942"; +chr5 Cufflinks exon 149834759 149834791 . + . gene_id "XLOC_006943"; transcript_id "TCONS_00006943"; exon_number "1"; oId "CUFF.7176.1"; tss_id "TSS6943"; +chr5 Cufflinks exon 149976817 149976872 . + . gene_id "XLOC_006944"; transcript_id "TCONS_00006944"; exon_number "1"; oId "CUFF.7178.1"; tss_id "TSS6944"; +chr5 Cufflinks exon 149977498 149977655 . + . gene_id "XLOC_006945"; transcript_id "TCONS_00006945"; exon_number "1"; oId "CUFF.7179.1"; tss_id "TSS6945"; +chr5 Cufflinks exon 150306499 150306549 . + . gene_id "XLOC_006946"; transcript_id "TCONS_00006946"; exon_number "1"; oId "CUFF.7180.1"; tss_id "TSS6946"; +chr5 Cufflinks exon 150817029 150817066 . + . gene_id "XLOC_006947"; transcript_id "TCONS_00006947"; exon_number "1"; oId "CUFF.7182.1"; tss_id "TSS6947"; +chr5 Cufflinks exon 151988594 151988632 . + . gene_id "XLOC_006948"; transcript_id "TCONS_00006948"; exon_number "1"; oId "CUFF.7188.1"; tss_id "TSS6948"; +chr5 Cufflinks exon 153134942 153135261 . + . gene_id "XLOC_006949"; transcript_id "TCONS_00006949"; exon_number "1"; oId "CUFF.7189.1"; tss_id "TSS6949"; +chr5 Cufflinks exon 153715263 153715304 . + . gene_id "XLOC_006950"; transcript_id "TCONS_00006950"; exon_number "1"; oId "CUFF.7190.1"; tss_id "TSS6950"; +chr5 Cufflinks exon 153728989 153729297 . + . gene_id "XLOC_006951"; transcript_id "TCONS_00006951"; exon_number "1"; oId "CUFF.7191.1"; tss_id "TSS6951"; +chr5 Cufflinks exon 154788123 154788360 . + . gene_id "XLOC_006952"; transcript_id "TCONS_00006952"; exon_number "1"; oId "CUFF.7194.1"; tss_id "TSS6952"; +chr5 Cufflinks exon 154857003 154857038 . + . gene_id "XLOC_006953"; transcript_id "TCONS_00006953"; exon_number "1"; oId "CUFF.7195.1"; tss_id "TSS6953"; +chr5 Cufflinks exon 155272447 155272537 . + . gene_id "XLOC_006954"; transcript_id "TCONS_00006954"; exon_number "1"; oId "CUFF.7196.1"; tss_id "TSS6954"; +chr5 Cufflinks exon 155564766 155564801 . + . gene_id "XLOC_006955"; transcript_id "TCONS_00006955"; exon_number "1"; oId "CUFF.7198.1"; tss_id "TSS6955"; +chr5 Cufflinks exon 156241141 156241244 . + . gene_id "XLOC_006956"; transcript_id "TCONS_00006956"; exon_number "1"; oId "CUFF.7199.1"; tss_id "TSS6956"; +chr5 Cufflinks exon 156626892 156627060 . + . gene_id "XLOC_006957"; transcript_id "TCONS_00006957"; exon_number "1"; oId "CUFF.7200.1"; tss_id "TSS6957"; +chr5 Cufflinks exon 157006507 157006606 . + . gene_id "XLOC_006958"; transcript_id "TCONS_00006958"; exon_number "1"; oId "CUFF.7201.1"; tss_id "TSS6958"; +chr5 Cufflinks exon 157236106 157236210 . + . gene_id "XLOC_006959"; transcript_id "TCONS_00006959"; exon_number "1"; oId "CUFF.7202.1"; tss_id "TSS6959"; +chr5 Cufflinks exon 159186094 159186250 . + . gene_id "XLOC_006960"; transcript_id "TCONS_00006960"; exon_number "1"; oId "CUFF.7206.1"; tss_id "TSS6960"; +chr5 Cufflinks exon 159499275 159499335 . + . gene_id "XLOC_006961"; transcript_id "TCONS_00006961"; exon_number "1"; oId "CUFF.7207.1"; tss_id "TSS6961"; +chr5 Cufflinks exon 159718900 159719090 . + . gene_id "XLOC_006962"; transcript_id "TCONS_00006962"; exon_number "1"; oId "CUFF.7209.1"; tss_id "TSS6962"; +chr5 Cufflinks exon 160096909 160096938 . + . gene_id "XLOC_006963"; transcript_id "TCONS_00006963"; exon_number "1"; oId "CUFF.7210.1"; tss_id "TSS6963"; +chr5 Cufflinks exon 161227316 161227437 . + . gene_id "XLOC_006964"; transcript_id "TCONS_00006964"; exon_number "1"; oId "CUFF.7211.1"; tss_id "TSS6964"; +chr5 Cufflinks exon 161904923 161904999 . + . gene_id "XLOC_006965"; transcript_id "TCONS_00006965"; exon_number "1"; oId "CUFF.7213.1"; tss_id "TSS6965"; +chr5 Cufflinks exon 162210450 162210682 . + . gene_id "XLOC_006966"; transcript_id "TCONS_00006966"; exon_number "1"; oId "CUFF.7214.1"; tss_id "TSS6966"; +chr5 Cufflinks exon 162211001 162211107 . + . gene_id "XLOC_006967"; transcript_id "TCONS_00006967"; exon_number "1"; oId "CUFF.7215.1"; tss_id "TSS6967"; +chr5 Cufflinks exon 162906049 162906109 . + . gene_id "XLOC_006968"; transcript_id "TCONS_00006968"; exon_number "1"; oId "CUFF.7217.1"; tss_id "TSS6968"; +chr5 Cufflinks exon 165036454 165036683 . + . gene_id "XLOC_006969"; transcript_id "TCONS_00006969"; exon_number "1"; oId "CUFF.7221.1"; tss_id "TSS6969"; +chr5 Cufflinks exon 165037001 165037090 . + . gene_id "XLOC_006970"; transcript_id "TCONS_00006970"; exon_number "1"; oId "CUFF.7222.1"; tss_id "TSS6970"; +chr5 Cufflinks exon 166232506 166232557 . + . gene_id "XLOC_006971"; transcript_id "TCONS_00006971"; exon_number "1"; oId "CUFF.7224.1"; tss_id "TSS6971"; +chr5 Cufflinks exon 167988020 167988057 . + . gene_id "XLOC_006972"; transcript_id "TCONS_00006972"; exon_number "1"; oId "CUFF.7227.1"; tss_id "TSS6972"; +chr5 Cufflinks exon 168979453 168979559 . + . gene_id "XLOC_006973"; transcript_id "TCONS_00006973"; exon_number "1"; oId "CUFF.7229.1"; tss_id "TSS6973"; +chr5 Cufflinks exon 169146880 169146940 . + . gene_id "XLOC_006974"; transcript_id "TCONS_00006974"; exon_number "1"; oId "CUFF.7230.1"; tss_id "TSS6974"; +chr5 Cufflinks exon 169918044 169918111 . + . gene_id "XLOC_006975"; transcript_id "TCONS_00006975"; exon_number "1"; oId "CUFF.7231.1"; tss_id "TSS6975"; +chr5 Cufflinks exon 170293839 170294152 . + . gene_id "XLOC_006976"; transcript_id "TCONS_00006976"; exon_number "1"; oId "CUFF.7232.1"; tss_id "TSS6976"; +chr5 Cufflinks exon 170710662 170710714 . + . gene_id "XLOC_006977"; transcript_id "TCONS_00006977"; exon_number "1"; oId "CUFF.7233.1"; tss_id "TSS6977"; +chr5 Cufflinks exon 171732939 171733009 . + . gene_id "XLOC_006978"; transcript_id "TCONS_00006978"; exon_number "1"; oId "CUFF.7235.1"; tss_id "TSS6978"; +chr5 Cufflinks exon 171813998 171814048 . + . gene_id "XLOC_006979"; transcript_id "TCONS_00006979"; exon_number "1"; oId "CUFF.7236.1"; tss_id "TSS6979"; +chr5 Cufflinks exon 175055192 175055430 . + . gene_id "XLOC_006980"; transcript_id "TCONS_00006980"; exon_number "1"; oId "CUFF.7243.1"; tss_id "TSS6980"; +chr5 Cufflinks exon 175130903 175131005 . + . gene_id "XLOC_006981"; transcript_id "TCONS_00006981"; exon_number "1"; oId "CUFF.7244.1"; tss_id "TSS6981"; +chr5 Cufflinks exon 177506997 177507086 . + . gene_id "XLOC_006982"; transcript_id "TCONS_00006982"; exon_number "1"; oId "CUFF.7246.1"; tss_id "TSS6982"; +chr5 Cufflinks exon 177562690 177562727 . + . gene_id "XLOC_006983"; transcript_id "TCONS_00006983"; exon_number "1"; oId "CUFF.7247.1"; tss_id "TSS6983"; +chr5 Cufflinks exon 177804925 177805236 . + . gene_id "XLOC_006984"; transcript_id "TCONS_00006984"; exon_number "1"; oId "CUFF.7249.1"; tss_id "TSS6984"; +chr5 Cufflinks exon 178311716 178311880 . + . gene_id "XLOC_006985"; transcript_id "TCONS_00006985"; exon_number "1"; oId "CUFF.7252.1"; tss_id "TSS6985"; +chr5 Cufflinks exon 179272832 179273068 . + . gene_id "XLOC_006986"; transcript_id "TCONS_00006986"; exon_number "1"; oId "CUFF.7254.1"; tss_id "TSS6986"; +chr5 Cufflinks exon 179574898 179574935 . + . gene_id "XLOC_006987"; transcript_id "TCONS_00006987"; exon_number "1"; oId "CUFF.7255.1"; tss_id "TSS6987"; +chr5 Cufflinks exon 179871508 179871608 . + . gene_id "XLOC_006988"; transcript_id "TCONS_00006988"; exon_number "1"; oId "CUFF.7257.1"; tss_id "TSS6988"; +chr5 Cufflinks exon 179912425 179912481 . + . gene_id "XLOC_006989"; transcript_id "TCONS_00006989"; exon_number "1"; oId "CUFF.7258.1"; tss_id "TSS6989"; +chr5 Cufflinks exon 180156590 180156739 . + . gene_id "XLOC_006990"; transcript_id "TCONS_00006990"; exon_number "1"; oId "CUFF.7260.1"; tss_id "TSS6990"; +chr5 Cufflinks exon 180434281 180434383 . + . gene_id "XLOC_006991"; transcript_id "TCONS_00006991"; exon_number "1"; oId "CUFF.7261.1"; tss_id "TSS6991"; +chr5 Cufflinks exon 180467952 180468000 . + . gene_id "XLOC_006992"; transcript_id "TCONS_00006992"; exon_number "1"; oId "CUFF.7262.1"; tss_id "TSS6992"; +chr5 Cufflinks exon 180524070 180524142 . + . gene_id "XLOC_006993"; transcript_id "TCONS_00006993"; exon_number "1"; oId "CUFF.7263.1"; tss_id "TSS6993"; +chr5 Cufflinks exon 180528840 180528921 . + . gene_id "XLOC_006994"; transcript_id "TCONS_00006994"; exon_number "1"; oId "CUFF.7265.1"; tss_id "TSS6994"; +chr5 Cufflinks exon 180591154 180591226 . + . gene_id "XLOC_006995"; transcript_id "TCONS_00006995"; exon_number "1"; oId "CUFF.7268.1"; tss_id "TSS6995"; +chr5 Cufflinks exon 180596610 180596682 . + . gene_id "XLOC_006996"; transcript_id "TCONS_00006996"; exon_number "1"; oId "CUFF.7270.1"; tss_id "TSS6996"; +chr5 Cufflinks exon 180600650 180600724 . + . gene_id "XLOC_006997"; transcript_id "TCONS_00006997"; exon_number "1"; oId "CUFF.7271.1"; tss_id "TSS6997"; +chr5 Cufflinks exon 180614701 180614782 . + . gene_id "XLOC_006998"; transcript_id "TCONS_00006998"; exon_number "1"; oId "CUFF.7273.1"; tss_id "TSS6998"; +chr5 Cufflinks exon 180633868 180633939 . + . gene_id "XLOC_006999"; transcript_id "TCONS_00006999"; exon_number "1"; oId "CUFF.7277.1"; tss_id "TSS6999"; +chr5 Cufflinks exon 180634755 180634830 . + . gene_id "XLOC_007000"; transcript_id "TCONS_00007000"; exon_number "1"; oId "CUFF.7278.1"; tss_id "TSS7000"; +chr5 Cufflinks exon 180728969 180729071 . + . gene_id "XLOC_007001"; transcript_id "TCONS_00007001"; exon_number "1"; oId "CUFF.7283.1"; tss_id "TSS7001"; +chr5 Cufflinks exon 378549 378612 . - . gene_id "XLOC_007002"; transcript_id "TCONS_00007002"; exon_number "1"; oId "CUFF.6749.1"; tss_id "TSS7002"; +chr5 Cufflinks exon 3353030 3353158 . - . gene_id "XLOC_007003"; transcript_id "TCONS_00007003"; exon_number "1"; oId "CUFF.6751.1"; tss_id "TSS7003"; +chr5 Cufflinks exon 4139709 4139764 . - . gene_id "XLOC_007004"; transcript_id "TCONS_00007004"; exon_number "1"; oId "CUFF.6752.1"; tss_id "TSS7004"; +chr5 Cufflinks exon 6347720 6347754 . - . gene_id "XLOC_007005"; transcript_id "TCONS_00007005"; exon_number "1"; oId "CUFF.6755.1"; tss_id "TSS7005"; +chr5 Cufflinks exon 6658791 6658850 . - . gene_id "XLOC_007006"; transcript_id "TCONS_00007006"; exon_number "1"; oId "CUFF.6756.1"; tss_id "TSS7006"; +chr5 Cufflinks exon 6848337 6848575 . - . gene_id "XLOC_007007"; transcript_id "TCONS_00007007"; exon_number "1"; oId "CUFF.6757.1"; tss_id "TSS7007"; +chr5 Cufflinks exon 6981948 6982079 . - . gene_id "XLOC_007008"; transcript_id "TCONS_00007008"; exon_number "1"; oId "CUFF.6758.1"; tss_id "TSS7008"; +chr5 Cufflinks exon 6982183 6982224 . - . gene_id "XLOC_007009"; transcript_id "TCONS_00007009"; exon_number "1"; oId "CUFF.6759.1"; tss_id "TSS7009"; +chr5 Cufflinks exon 7924365 7924436 . - . gene_id "XLOC_007010"; transcript_id "TCONS_00007010"; exon_number "1"; oId "CUFF.6761.1"; tss_id "TSS7010"; +chr5 Cufflinks exon 9593897 9593994 . - . gene_id "XLOC_007011"; transcript_id "TCONS_00007011"; exon_number "1"; oId "CUFF.6763.1"; tss_id "TSS7011"; +chr5 Cufflinks exon 12297511 12297615 . - . gene_id "XLOC_007012"; transcript_id "TCONS_00007012"; exon_number "1"; oId "CUFF.6771.1"; tss_id "TSS7012"; +chr5 Cufflinks exon 14693593 14693652 . - . gene_id "XLOC_007013"; transcript_id "TCONS_00007013"; exon_number "1"; oId "CUFF.6773.1"; tss_id "TSS7013"; +chr5 Cufflinks exon 14903461 14903502 . - . gene_id "XLOC_007014"; transcript_id "TCONS_00007014"; exon_number "1"; oId "CUFF.6774.1"; tss_id "TSS7014"; +chr5 Cufflinks exon 15097233 15097288 . - . gene_id "XLOC_007015"; transcript_id "TCONS_00007015"; exon_number "1"; oId "CUFF.6775.1"; tss_id "TSS7015"; +chr5 Cufflinks exon 15110894 15111030 . - . gene_id "XLOC_007016"; transcript_id "TCONS_00007016"; exon_number "1"; oId "CUFF.6776.1"; tss_id "TSS7016"; +chr5 Cufflinks exon 15671662 15671696 . - . gene_id "XLOC_007017"; transcript_id "TCONS_00007017"; exon_number "1"; oId "CUFF.6778.1"; tss_id "TSS7017"; +chr5 Cufflinks exon 16033377 16033464 . - . gene_id "XLOC_007018"; transcript_id "TCONS_00007018"; exon_number "1"; oId "CUFF.6779.1"; tss_id "TSS7018"; +chr5 Cufflinks exon 16166039 16166074 . - . gene_id "XLOC_007019"; transcript_id "TCONS_00007019"; exon_number "1"; oId "CUFF.6780.1"; tss_id "TSS7019"; +chr5 Cufflinks exon 16941954 16942060 . - . gene_id "XLOC_007020"; transcript_id "TCONS_00007020"; exon_number "1"; oId "CUFF.6782.1"; tss_id "TSS7020"; +chr5 Cufflinks exon 17157101 17157182 . - . gene_id "XLOC_007021"; transcript_id "TCONS_00007021"; exon_number "1"; oId "CUFF.6783.1"; tss_id "TSS7021"; +chr5 Cufflinks exon 18958244 18958522 . - . gene_id "XLOC_007022"; transcript_id "TCONS_00007022"; exon_number "1"; oId "CUFF.6789.1"; tss_id "TSS7022"; +chr5 Cufflinks exon 20308324 20308369 . - . gene_id "XLOC_007023"; transcript_id "TCONS_00007023"; exon_number "1"; oId "CUFF.6791.1"; tss_id "TSS7023"; +chr5 Cufflinks exon 25493347 25493376 . - . gene_id "XLOC_007024"; transcript_id "TCONS_00007024"; exon_number "1"; oId "CUFF.6797.1"; tss_id "TSS7024"; +chr5 Cufflinks exon 25503106 25503142 . - . gene_id "XLOC_007025"; transcript_id "TCONS_00007025"; exon_number "1"; oId "CUFF.6798.1"; tss_id "TSS7025"; +chr5 Cufflinks exon 25701326 25701432 . - . gene_id "XLOC_007026"; transcript_id "TCONS_00007026"; exon_number "1"; oId "CUFF.6799.1"; tss_id "TSS7026"; +chr5 Cufflinks exon 26198536 26198611 . - . gene_id "XLOC_007027"; transcript_id "TCONS_00007027"; exon_number "1"; oId "CUFF.6801.1"; tss_id "TSS7027"; +chr5 Cufflinks exon 29937108 29937178 . - . gene_id "XLOC_007028"; transcript_id "TCONS_00007028"; exon_number "1"; oId "CUFF.6807.1"; tss_id "TSS7028"; +chr5 Cufflinks exon 31595673 31595776 . - . gene_id "XLOC_007029"; transcript_id "TCONS_00007029"; exon_number "1"; oId "CUFF.6810.1"; tss_id "TSS7029"; +chr5 Cufflinks exon 31820673 31820736 . - . gene_id "XLOC_007030"; transcript_id "TCONS_00007030"; exon_number "1"; oId "CUFF.6812.1"; tss_id "TSS7030"; +chr5 Cufflinks exon 32033138 32033175 . - . gene_id "XLOC_007031"; transcript_id "TCONS_00007031"; exon_number "1"; oId "CUFF.6815.1"; tss_id "TSS7031"; +chr5 Cufflinks exon 32234873 32234981 . - . gene_id "XLOC_007032"; transcript_id "TCONS_00007032"; exon_number "1"; oId "CUFF.6816.1"; tss_id "TSS7032"; +chr5 Cufflinks exon 32890412 32890490 . - . gene_id "XLOC_007033"; transcript_id "TCONS_00007033"; exon_number "1"; oId "CUFF.6819.1"; tss_id "TSS7033"; +chr5 Cufflinks exon 33134901 33134950 . - . gene_id "XLOC_007034"; transcript_id "TCONS_00007034"; exon_number "1"; oId "CUFF.6820.1"; tss_id "TSS7034"; +chr5 Cufflinks exon 33277967 33278059 . - . gene_id "XLOC_007035"; transcript_id "TCONS_00007035"; exon_number "1"; oId "CUFF.6821.1"; tss_id "TSS7035"; +chr5 Cufflinks exon 33888167 33888266 . - . gene_id "XLOC_007036"; transcript_id "TCONS_00007036"; exon_number "1"; oId "CUFF.6822.1"; tss_id "TSS7036"; +chr5 Cufflinks exon 34166079 34166142 . - . gene_id "XLOC_007037"; transcript_id "TCONS_00007037"; exon_number "1"; oId "CUFF.6825.1"; tss_id "TSS7037"; +chr5 Cufflinks exon 34869613 34869687 . - . gene_id "XLOC_007038"; transcript_id "TCONS_00007038"; exon_number "1"; oId "CUFF.6828.1"; tss_id "TSS7038"; +chr5 Cufflinks exon 35633066 35633126 . - . gene_id "XLOC_007039"; transcript_id "TCONS_00007039"; exon_number "1"; oId "CUFF.6830.1"; tss_id "TSS7039"; +chr5 Cufflinks exon 35763127 35763168 . - . gene_id "XLOC_007040"; transcript_id "TCONS_00007040"; exon_number "1"; oId "CUFF.6831.1"; tss_id "TSS7040"; +chr5 Cufflinks exon 37246255 37246581 . - . gene_id "XLOC_007041"; transcript_id "TCONS_00007041"; exon_number "1"; oId "CUFF.6834.1"; tss_id "TSS7041"; +chr5 Cufflinks exon 37620087 37620190 . - . gene_id "XLOC_007042"; transcript_id "TCONS_00007042"; exon_number "1"; oId "CUFF.6836.1"; tss_id "TSS7042"; +chr5 Cufflinks exon 37700437 37700539 . - . gene_id "XLOC_007043"; transcript_id "TCONS_00007043"; exon_number "1"; oId "CUFF.6837.1"; tss_id "TSS7043"; +chr5 Cufflinks exon 40911169 40911229 . - . gene_id "XLOC_007044"; transcript_id "TCONS_00007044"; exon_number "1"; oId "CUFF.6842.1"; tss_id "TSS7044"; +chr5 Cufflinks exon 41064923 41064969 . - . gene_id "XLOC_007045"; transcript_id "TCONS_00007045"; exon_number "1"; oId "CUFF.6843.1"; tss_id "TSS7045"; +chr5 Cufflinks exon 41107470 41107498 . - . gene_id "XLOC_007046"; transcript_id "TCONS_00007046"; exon_number "1"; oId "CUFF.6844.1"; tss_id "TSS7046"; +chr5 Cufflinks exon 41120021 41120055 . - . gene_id "XLOC_007047"; transcript_id "TCONS_00007047"; exon_number "1"; oId "CUFF.6845.1"; tss_id "TSS7047"; +chr5 Cufflinks exon 41175140 41175376 . - . gene_id "XLOC_007048"; transcript_id "TCONS_00007048"; exon_number "1"; oId "CUFF.6846.1"; tss_id "TSS7048"; +chr5 Cufflinks exon 41357104 41357192 . - . gene_id "XLOC_007049"; transcript_id "TCONS_00007049"; exon_number "1"; oId "CUFF.6847.1"; tss_id "TSS7049"; +chr5 Cufflinks exon 43091353 43091422 . - . gene_id "XLOC_007050"; transcript_id "TCONS_00007050"; exon_number "1"; oId "CUFF.6848.1"; tss_id "TSS7050"; +chr5 Cufflinks exon 43580427 43580492 . - . gene_id "XLOC_007051"; transcript_id "TCONS_00007051"; exon_number "1"; oId "CUFF.6849.1"; tss_id "TSS7051"; +chr5 Cufflinks exon 44066726 44066833 . - . gene_id "XLOC_007052"; transcript_id "TCONS_00007052"; exon_number "1"; oId "CUFF.6850.1"; tss_id "TSS7052"; +chr5 Cufflinks exon 44477773 44477838 . - . gene_id "XLOC_007053"; transcript_id "TCONS_00007053"; exon_number "1"; oId "CUFF.6851.1"; tss_id "TSS7053"; +chr5 Cufflinks exon 50293586 50293621 . - . gene_id "XLOC_007054"; transcript_id "TCONS_00007054"; exon_number "1"; oId "CUFF.6854.1"; tss_id "TSS7054"; +chr5 Cufflinks exon 50351187 50351293 . - . gene_id "XLOC_007055"; transcript_id "TCONS_00007055"; exon_number "1"; oId "CUFF.6855.1"; tss_id "TSS7055"; +chr5 Cufflinks exon 50463375 50463481 . - . gene_id "XLOC_007056"; transcript_id "TCONS_00007056"; exon_number "1"; oId "CUFF.6856.1"; tss_id "TSS7056"; +chr5 Cufflinks exon 51813680 51813758 . - . gene_id "XLOC_007057"; transcript_id "TCONS_00007057"; exon_number "1"; oId "CUFF.6859.1"; tss_id "TSS7057"; +chr5 Cufflinks exon 53110503 53110537 . - . gene_id "XLOC_007058"; transcript_id "TCONS_00007058"; exon_number "1"; oId "CUFF.6863.1"; tss_id "TSS7058"; +chr5 Cufflinks exon 53207856 53207953 . - . gene_id "XLOC_007059"; transcript_id "TCONS_00007059"; exon_number "1"; oId "CUFF.6864.1"; tss_id "TSS7059"; +chr5 Cufflinks exon 53343822 53344138 . - . gene_id "XLOC_007060"; transcript_id "TCONS_00007060"; exon_number "1"; oId "CUFF.6865.1"; tss_id "TSS7060"; +chr5 Cufflinks exon 54080799 54080835 . - . gene_id "XLOC_007061"; transcript_id "TCONS_00007061"; exon_number "1"; oId "CUFF.6866.1"; tss_id "TSS7061"; +chr5 Cufflinks exon 54480766 54480855 . - . gene_id "XLOC_007062"; transcript_id "TCONS_00007062"; exon_number "1"; oId "CUFF.6868.1"; tss_id "TSS7062"; +chr5 Cufflinks exon 54539751 54539781 . - . gene_id "XLOC_007063"; transcript_id "TCONS_00007063"; exon_number "1"; oId "CUFF.6869.1"; tss_id "TSS7063"; +chr5 Cufflinks exon 55296343 55296450 . - . gene_id "XLOC_007064"; transcript_id "TCONS_00007064"; exon_number "1"; oId "CUFF.6872.1"; tss_id "TSS7064"; +chr5 Cufflinks exon 55442593 55442673 . - . gene_id "XLOC_007065"; transcript_id "TCONS_00007065"; exon_number "1"; oId "CUFF.6874.1"; tss_id "TSS7065"; +chr5 Cufflinks exon 55556184 55556271 . - . gene_id "XLOC_007066"; transcript_id "TCONS_00007066"; exon_number "1"; oId "CUFF.6875.1"; tss_id "TSS7066"; +chr5 Cufflinks exon 56557283 56557364 . - . gene_id "XLOC_007067"; transcript_id "TCONS_00007067"; exon_number "1"; oId "CUFF.6878.1"; tss_id "TSS7067"; +chr5 Cufflinks exon 58518806 58518947 . - . gene_id "XLOC_007068"; transcript_id "TCONS_00007068"; exon_number "1"; oId "CUFF.6883.1"; tss_id "TSS7068"; +chr5 Cufflinks exon 59087061 59087152 . - . gene_id "XLOC_007069"; transcript_id "TCONS_00007069"; exon_number "1"; oId "CUFF.6884.1"; tss_id "TSS7069"; +chr5 Cufflinks exon 59599875 59599980 . - . gene_id "XLOC_007070"; transcript_id "TCONS_00007070"; exon_number "1"; oId "CUFF.6885.1"; tss_id "TSS7070"; +chr5 Cufflinks exon 60959972 60960066 . - . gene_id "XLOC_007071"; transcript_id "TCONS_00007071"; exon_number "1"; oId "CUFF.6887.1"; tss_id "TSS7071"; +chr5 Cufflinks exon 62110348 62110389 . - . gene_id "XLOC_007072"; transcript_id "TCONS_00007072"; exon_number "1"; oId "CUFF.6890.1"; tss_id "TSS7072"; +chr5 Cufflinks exon 62399602 62399664 . - . gene_id "XLOC_007073"; transcript_id "TCONS_00007073"; exon_number "1"; oId "CUFF.6891.1"; tss_id "TSS7073"; +chr5 Cufflinks exon 63082398 63082464 . - . gene_id "XLOC_007074"; transcript_id "TCONS_00007074"; exon_number "1"; oId "CUFF.6893.1"; tss_id "TSS7074"; +chr5 Cufflinks exon 63691038 63691127 . - . gene_id "XLOC_007075"; transcript_id "TCONS_00007075"; exon_number "1"; oId "CUFF.6894.1"; tss_id "TSS7075"; +chr5 Cufflinks exon 64014706 64014745 . - . gene_id "XLOC_007076"; transcript_id "TCONS_00007076"; exon_number "1"; oId "CUFF.6897.1"; tss_id "TSS7076"; +chr5 Cufflinks exon 64900488 64900588 . - . gene_id "XLOC_007077"; transcript_id "TCONS_00007077"; exon_number "1"; oId "CUFF.6901.1"; tss_id "TSS7077"; +chr5 Cufflinks exon 64955031 64955081 . - . gene_id "XLOC_007078"; transcript_id "TCONS_00007078"; exon_number "1"; oId "CUFF.6902.1"; tss_id "TSS7078"; +chr5 Cufflinks exon 65424884 65425229 . - . gene_id "XLOC_007079"; transcript_id "TCONS_00007079"; exon_number "1"; oId "CUFF.6903.1"; tss_id "TSS7079"; +chr5 Cufflinks exon 65472413 65472455 . - . gene_id "XLOC_007080"; transcript_id "TCONS_00007080"; exon_number "1"; oId "CUFF.6904.1"; tss_id "TSS7080"; +chr5 Cufflinks exon 65521693 65521752 . - . gene_id "XLOC_007081"; transcript_id "TCONS_00007081"; exon_number "1"; oId "CUFF.6905.1"; tss_id "TSS7081"; +chr5 Cufflinks exon 65526954 65527061 . - . gene_id "XLOC_007082"; transcript_id "TCONS_00007082"; exon_number "1"; oId "CUFF.6906.1"; tss_id "TSS7082"; +chr5 Cufflinks exon 66283290 66283362 . - . gene_id "XLOC_007083"; transcript_id "TCONS_00007083"; exon_number "1"; oId "CUFF.6909.1"; tss_id "TSS7083"; +chr5 Cufflinks exon 67454889 67454974 . - . gene_id "XLOC_007084"; transcript_id "TCONS_00007084"; exon_number "1"; oId "CUFF.6910.1"; tss_id "TSS7084"; +chr5 Cufflinks exon 68266335 68266577 . - . gene_id "XLOC_007085"; transcript_id "TCONS_00007085"; exon_number "1"; oId "CUFF.6912.1"; tss_id "TSS7085"; +chr5 Cufflinks exon 68471648 68471755 . - . gene_id "XLOC_007086"; transcript_id "TCONS_00007086"; exon_number "1"; oId "CUFF.6913.1"; tss_id "TSS7086"; +chr5 Cufflinks exon 68774760 68775097 . - . gene_id "XLOC_007087"; transcript_id "TCONS_00007087"; exon_number "1"; oId "CUFF.6914.1"; tss_id "TSS7087"; +chr5 Cufflinks exon 68826440 68826544 . - . gene_id "XLOC_007088"; transcript_id "TCONS_00007088"; exon_number "1"; oId "CUFF.6915.1"; tss_id "TSS7088"; +chr5 Cufflinks exon 68834985 68835092 . - . gene_id "XLOC_007089"; transcript_id "TCONS_00007089"; exon_number "1"; oId "CUFF.6916.1"; tss_id "TSS7089"; +chr5 Cufflinks exon 70788830 70788913 . - . gene_id "XLOC_007090"; transcript_id "TCONS_00007090"; exon_number "1"; oId "CUFF.6918.1"; tss_id "TSS7090"; +chr5 Cufflinks exon 71610226 71610510 . - . gene_id "XLOC_007091"; transcript_id "TCONS_00007091"; exon_number "1"; oId "CUFF.6920.1"; tss_id "TSS7091"; +chr5 Cufflinks exon 72345880 72345914 . - . gene_id "XLOC_007092"; transcript_id "TCONS_00007092"; exon_number "1"; oId "CUFF.6921.1"; tss_id "TSS7092"; +chr5 Cufflinks exon 72379014 72379044 . - . gene_id "XLOC_007093"; transcript_id "TCONS_00007093"; exon_number "1"; oId "CUFF.6922.1"; tss_id "TSS7093"; +chr5 Cufflinks exon 73123838 73123898 . - . gene_id "XLOC_007094"; transcript_id "TCONS_00007094"; exon_number "1"; oId "CUFF.6923.1"; tss_id "TSS7094"; +chr5 Cufflinks exon 73471276 73471482 . - . gene_id "XLOC_007095"; transcript_id "TCONS_00007095"; exon_number "1"; oId "CUFF.6924.1"; tss_id "TSS7095"; +chr5 Cufflinks exon 74020924 74021029 . - . gene_id "XLOC_007096"; transcript_id "TCONS_00007096"; exon_number "1"; oId "CUFF.6926.1"; tss_id "TSS7096"; +chr5 Cufflinks exon 74834424 74834482 . - . gene_id "XLOC_007097"; transcript_id "TCONS_00007097"; exon_number "1"; oId "CUFF.6930.1"; tss_id "TSS7097"; +chr5 Cufflinks exon 75005320 75005424 . - . gene_id "XLOC_007098"; transcript_id "TCONS_00007098"; exon_number "1"; oId "CUFF.6931.1"; tss_id "TSS7098"; +chr5 Cufflinks exon 75387536 75387622 . - . gene_id "XLOC_007099"; transcript_id "TCONS_00007099"; exon_number "1"; oId "CUFF.6933.1"; tss_id "TSS7099"; +chr5 Cufflinks exon 76132693 76133020 . - . gene_id "XLOC_007100"; transcript_id "TCONS_00007100"; exon_number "1"; oId "CUFF.6935.1"; tss_id "TSS7100"; +chr5 Cufflinks exon 76900188 76900276 . - . gene_id "XLOC_007101"; transcript_id "TCONS_00007101"; exon_number "1"; oId "CUFF.6936.1"; tss_id "TSS7101"; +chr5 Cufflinks exon 77610745 77610849 . - . gene_id "XLOC_007102"; transcript_id "TCONS_00007102"; exon_number "1"; oId "CUFF.6938.1"; tss_id "TSS7102"; +chr5 Cufflinks exon 78512587 78512636 . - . gene_id "XLOC_007103"; transcript_id "TCONS_00007103"; exon_number "1"; oId "CUFF.6939.1"; tss_id "TSS7103"; +chr5 Cufflinks exon 78667781 78667813 . - . gene_id "XLOC_007104"; transcript_id "TCONS_00007104"; exon_number "1"; oId "CUFF.6941.1"; tss_id "TSS7104"; +chr5 Cufflinks exon 79535303 79535407 . - . gene_id "XLOC_007105"; transcript_id "TCONS_00007105"; exon_number "1"; oId "CUFF.6942.1"; tss_id "TSS7105"; +chr5 Cufflinks exon 79661545 79661651 . - . gene_id "XLOC_007106"; transcript_id "TCONS_00007106"; exon_number "1"; oId "CUFF.6943.1"; tss_id "TSS7106"; +chr5 Cufflinks exon 79945819 79946854 . - . gene_id "XLOC_007107"; transcript_id "TCONS_00007107"; exon_number "1"; oId "CUFF.6945.1"; tss_id "TSS7107"; +chr5 Cufflinks exon 80081121 80081164 . - . gene_id "XLOC_007108"; transcript_id "TCONS_00007108"; exon_number "1"; oId "CUFF.6946.1"; tss_id "TSS7108"; +chr5 Cufflinks exon 80743488 80743529 . - . gene_id "XLOC_007109"; transcript_id "TCONS_00007109"; exon_number "1"; oId "CUFF.6948.1"; tss_id "TSS7109"; +chr5 Cufflinks exon 81058036 81058078 . - . gene_id "XLOC_007110"; transcript_id "TCONS_00007110"; exon_number "1"; oId "CUFF.6950.1"; tss_id "TSS7110"; +chr5 Cufflinks exon 83124867 83124910 . - . gene_id "XLOC_007111"; transcript_id "TCONS_00007111"; exon_number "1"; oId "CUFF.6959.1"; tss_id "TSS7111"; +chr5 Cufflinks exon 84311072 84311180 . - . gene_id "XLOC_007112"; transcript_id "TCONS_00007112"; exon_number "1"; oId "CUFF.6963.1"; tss_id "TSS7112"; +chr5 Cufflinks exon 84746810 84746843 . - . gene_id "XLOC_007113"; transcript_id "TCONS_00007113"; exon_number "1"; oId "CUFF.6964.1"; tss_id "TSS7113"; +chr5 Cufflinks exon 85668668 85668703 . - . gene_id "XLOC_007114"; transcript_id "TCONS_00007114"; exon_number "1"; oId "CUFF.6966.1"; tss_id "TSS7114"; +chr5 Cufflinks exon 85958961 85959067 . - . gene_id "XLOC_007115"; transcript_id "TCONS_00007115"; exon_number "1"; oId "CUFF.6967.1"; tss_id "TSS7115"; +chr5 Cufflinks exon 86258964 86259005 . - . gene_id "XLOC_007116"; transcript_id "TCONS_00007116"; exon_number "1"; oId "CUFF.6968.1"; tss_id "TSS7116"; +chr5 Cufflinks exon 86259386 86259428 . - . gene_id "XLOC_007117"; transcript_id "TCONS_00007117"; exon_number "1"; oId "CUFF.6969.1"; tss_id "TSS7117"; +chr5 Cufflinks exon 86398560 86398662 . - . gene_id "XLOC_007118"; transcript_id "TCONS_00007118"; exon_number "1"; oId "CUFF.6970.1"; tss_id "TSS7118"; +chr5 Cufflinks exon 86464764 86464948 . - . gene_id "XLOC_007119"; transcript_id "TCONS_00007119"; exon_number "1"; oId "CUFF.6971.1"; tss_id "TSS7119"; +chr5 Cufflinks exon 86502883 86502927 . - . gene_id "XLOC_007120"; transcript_id "TCONS_00007120"; exon_number "1"; oId "CUFF.6972.1"; tss_id "TSS7120"; +chr5 Cufflinks exon 86589997 86590290 . - . gene_id "XLOC_007121"; transcript_id "TCONS_00007121"; exon_number "1"; oId "CUFF.6973.1"; tss_id "TSS7121"; +chr5 Cufflinks exon 86595504 86595614 . - . gene_id "XLOC_007122"; transcript_id "TCONS_00007122"; exon_number "1"; oId "CUFF.6974.1"; tss_id "TSS7122"; +chr5 Cufflinks exon 86716164 86716264 . - . gene_id "XLOC_007123"; transcript_id "TCONS_00007123"; exon_number "1"; oId "CUFF.6975.1"; tss_id "TSS7123"; +chr5 Cufflinks exon 86725786 86725818 . - . gene_id "XLOC_007124"; transcript_id "TCONS_00007124"; exon_number "1"; oId "CUFF.6976.1"; tss_id "TSS7124"; +chr5 Cufflinks exon 87514082 87514123 . - . gene_id "XLOC_007125"; transcript_id "TCONS_00007125"; exon_number "1"; oId "CUFF.6979.1"; tss_id "TSS7125"; +chr5 Cufflinks exon 87570075 87570193 . - . gene_id "XLOC_007126"; transcript_id "TCONS_00007126"; exon_number "1"; oId "CUFF.6980.1"; tss_id "TSS7126"; +chr5 Cufflinks exon 87950204 87950332 . - . gene_id "XLOC_007127"; transcript_id "TCONS_00007127"; exon_number "1"; oId "CUFF.6982.1"; tss_id "TSS7127"; +chr5 Cufflinks exon 88269642 88269672 . - . gene_id "XLOC_007128"; transcript_id "TCONS_00007128"; exon_number "1"; oId "CUFF.6983.1"; tss_id "TSS7128"; +chr5 Cufflinks exon 88367111 88367194 . - . gene_id "XLOC_007129"; transcript_id "TCONS_00007129"; exon_number "1"; oId "CUFF.6984.1"; tss_id "TSS7129"; +chr5 Cufflinks exon 88914789 88914826 . - . gene_id "XLOC_007130"; transcript_id "TCONS_00007130"; exon_number "1"; oId "CUFF.6985.1"; tss_id "TSS7130"; +chr5 Cufflinks exon 90122064 90122155 . - . gene_id "XLOC_007131"; transcript_id "TCONS_00007131"; exon_number "1"; oId "CUFF.6988.1"; tss_id "TSS7131"; +chr5 Cufflinks exon 91014721 91014928 . - . gene_id "XLOC_007132"; transcript_id "TCONS_00007132"; exon_number "1"; oId "CUFF.6994.1"; tss_id "TSS7132"; +chr5 Cufflinks exon 91196810 91196851 . - . gene_id "XLOC_007133"; transcript_id "TCONS_00007133"; exon_number "1"; oId "CUFF.6996.1"; tss_id "TSS7133"; +chr5 Cufflinks exon 95545825 95545931 . - . gene_id "XLOC_007134"; transcript_id "TCONS_00007134"; exon_number "1"; oId "CUFF.7001.1"; tss_id "TSS7134"; +chr5 Cufflinks exon 95628426 95628466 . - . gene_id "XLOC_007135"; transcript_id "TCONS_00007135"; exon_number "1"; oId "CUFF.7002.1"; tss_id "TSS7135"; +chr5 Cufflinks exon 96511654 96511817 . - . gene_id "XLOC_007136"; transcript_id "TCONS_00007136"; exon_number "1"; oId "CUFF.7003.1"; tss_id "TSS7136"; +chr5 Cufflinks exon 96724875 96725068 . - . gene_id "XLOC_007137"; transcript_id "TCONS_00007137"; exon_number "1"; oId "CUFF.7004.1"; tss_id "TSS7137"; +chr5 Cufflinks exon 97326427 97326479 . - . gene_id "XLOC_007138"; transcript_id "TCONS_00007138"; exon_number "1"; oId "CUFF.7007.1"; tss_id "TSS7138"; +chr5 Cufflinks exon 101466756 101466845 . - . gene_id "XLOC_007139"; transcript_id "TCONS_00007139"; exon_number "1"; oId "CUFF.7018.1"; tss_id "TSS7139"; +chr5 Cufflinks exon 101990784 101990849 . - . gene_id "XLOC_007140"; transcript_id "TCONS_00007140"; exon_number "1"; oId "CUFF.7020.1"; tss_id "TSS7140"; +chr5 Cufflinks exon 103596231 103596527 . - . gene_id "XLOC_007141"; transcript_id "TCONS_00007141"; exon_number "1"; oId "CUFF.7024.1"; tss_id "TSS7141"; +chr5 Cufflinks exon 104115989 104116087 . - . gene_id "XLOC_007142"; transcript_id "TCONS_00007142"; exon_number "1"; oId "CUFF.7025.1"; tss_id "TSS7142"; +chr5 Cufflinks exon 105258722 105258815 . - . gene_id "XLOC_007143"; transcript_id "TCONS_00007143"; exon_number "1"; oId "CUFF.7028.1"; tss_id "TSS7143"; +chr5 Cufflinks exon 106542119 106542153 . - . gene_id "XLOC_007144"; transcript_id "TCONS_00007144"; exon_number "1"; oId "CUFF.7029.1"; tss_id "TSS7144"; +chr5 Cufflinks exon 107070473 107070763 . - . gene_id "XLOC_007145"; transcript_id "TCONS_00007145"; exon_number "1"; oId "CUFF.7030.1"; tss_id "TSS7145"; +chr5 Cufflinks exon 107175621 107175655 . - . gene_id "XLOC_007146"; transcript_id "TCONS_00007146"; exon_number "1"; oId "CUFF.7032.1"; tss_id "TSS7146"; +chr5 Cufflinks exon 107361823 107361860 . - . gene_id "XLOC_007147"; transcript_id "TCONS_00007147"; exon_number "1"; oId "CUFF.7033.1"; tss_id "TSS7147"; +chr5 Cufflinks exon 108287110 108287146 . - . gene_id "XLOC_007148"; transcript_id "TCONS_00007148"; exon_number "1"; oId "CUFF.7035.1"; tss_id "TSS7148"; +chr5 Cufflinks exon 108350535 108350641 . - . gene_id "XLOC_007149"; transcript_id "TCONS_00007149"; exon_number "1"; oId "CUFF.7036.1"; tss_id "TSS7149"; +chr5 Cufflinks exon 109035303 109035535 . - . gene_id "XLOC_007150"; transcript_id "TCONS_00007150"; exon_number "1"; oId "CUFF.7037.1"; tss_id "TSS7150"; +chr5 Cufflinks exon 109166141 109166176 . - . gene_id "XLOC_007151"; transcript_id "TCONS_00007151"; exon_number "1"; oId "CUFF.7038.1"; tss_id "TSS7151"; +chr5 Cufflinks exon 109713928 109714073 . - . gene_id "XLOC_007152"; transcript_id "TCONS_00007152"; exon_number "1"; oId "CUFF.7039.1"; tss_id "TSS7152"; +chr5 Cufflinks exon 110356657 110356696 . - . gene_id "XLOC_007153"; transcript_id "TCONS_00007153"; exon_number "1"; oId "CUFF.7040.1"; tss_id "TSS7153"; +chr5 Cufflinks exon 110520321 110520377 . - . gene_id "XLOC_007154"; transcript_id "TCONS_00007154"; exon_number "1"; oId "CUFF.7041.1"; tss_id "TSS7154"; +chr5 Cufflinks exon 111055589 111055758 . - . gene_id "XLOC_007155"; transcript_id "TCONS_00007155"; exon_number "1"; oId "CUFF.7042.1"; tss_id "TSS7155"; +chr5 Cufflinks exon 111058181 111058217 . - . gene_id "XLOC_007156"; transcript_id "TCONS_00007156"; exon_number "1"; oId "CUFF.7043.1"; tss_id "TSS7156"; +chr5 Cufflinks exon 112205005 112205067 . - . gene_id "XLOC_007157"; transcript_id "TCONS_00007157"; exon_number "1"; oId "CUFF.7047.1"; tss_id "TSS7157"; +chr5 Cufflinks exon 113453522 113453567 . - . gene_id "XLOC_007158"; transcript_id "TCONS_00007158"; exon_number "1"; oId "CUFF.7049.1"; tss_id "TSS7158"; +chr5 Cufflinks exon 113734993 113735028 . - . gene_id "XLOC_007159"; transcript_id "TCONS_00007159"; exon_number "1"; oId "CUFF.7052.1"; tss_id "TSS7159"; +chr5 Cufflinks exon 115110020 115110197 . - . gene_id "XLOC_007160"; transcript_id "TCONS_00007160"; exon_number "1"; oId "CUFF.7054.1"; tss_id "TSS7160"; +chr5 Cufflinks exon 115187933 115187981 . - . gene_id "XLOC_007161"; transcript_id "TCONS_00007161"; exon_number "1"; oId "CUFF.7055.1"; tss_id "TSS7161"; +chr5 Cufflinks exon 115395701 115395739 . - . gene_id "XLOC_007162"; transcript_id "TCONS_00007162"; exon_number "1"; oId "CUFF.7056.1"; tss_id "TSS7162"; +chr5 Cufflinks exon 115524152 115524242 . - . gene_id "XLOC_007163"; transcript_id "TCONS_00007163"; exon_number "1"; oId "CUFF.7057.1"; tss_id "TSS7163"; +chr5 Cufflinks exon 116404602 116404648 . - . gene_id "XLOC_007164"; transcript_id "TCONS_00007164"; exon_number "1"; oId "CUFF.7060.1"; tss_id "TSS7164"; +chr5 Cufflinks exon 117323607 117323650 . - . gene_id "XLOC_007165"; transcript_id "TCONS_00007165"; exon_number "1"; oId "CUFF.7062.1"; tss_id "TSS7165"; +chr5 Cufflinks exon 118246884 118246921 . - . gene_id "XLOC_007166"; transcript_id "TCONS_00007166"; exon_number "1"; oId "CUFF.7065.1"; tss_id "TSS7166"; +chr5 Cufflinks exon 118393377 118393440 . - . gene_id "XLOC_007167"; transcript_id "TCONS_00007167"; exon_number "1"; oId "CUFF.7068.1"; tss_id "TSS7167"; +chr5 Cufflinks exon 118404990 118405096 . - . gene_id "XLOC_007168"; transcript_id "TCONS_00007168"; exon_number "1"; oId "CUFF.7069.1"; tss_id "TSS7168"; +chr5 Cufflinks exon 118642016 118642326 . - . gene_id "XLOC_007169"; transcript_id "TCONS_00007169"; exon_number "1"; oId "CUFF.7072.1"; tss_id "TSS7169"; +chr5 Cufflinks exon 118804656 118804738 . - . gene_id "XLOC_007170"; transcript_id "TCONS_00007170"; exon_number "1"; oId "CUFF.7074.1"; tss_id "TSS7170"; +chr5 Cufflinks exon 118945894 118946001 . - . gene_id "XLOC_007171"; transcript_id "TCONS_00007171"; exon_number "1"; oId "CUFF.7076.1"; tss_id "TSS7171"; +chr5 Cufflinks exon 119673244 119673348 . - . gene_id "XLOC_007172"; transcript_id "TCONS_00007172"; exon_number "1"; oId "CUFF.7077.1"; tss_id "TSS7172"; +chr5 Cufflinks exon 120046390 120046535 . - . gene_id "XLOC_007173"; transcript_id "TCONS_00007173"; exon_number "1"; oId "CUFF.7078.1"; tss_id "TSS7173"; +chr5 Cufflinks exon 120755906 120755940 . - . gene_id "XLOC_007174"; transcript_id "TCONS_00007174"; exon_number "1"; oId "CUFF.7079.1"; tss_id "TSS7174"; +chr5 Cufflinks exon 122013417 122013460 . - . gene_id "XLOC_007175"; transcript_id "TCONS_00007175"; exon_number "1"; oId "CUFF.7081.1"; tss_id "TSS7175"; +chr5 Cufflinks exon 122140549 122140600 . - . gene_id "XLOC_007176"; transcript_id "TCONS_00007176"; exon_number "1"; oId "CUFF.7083.1"; tss_id "TSS7176"; +chr5 Cufflinks exon 122345235 122345336 . - . gene_id "XLOC_007177"; transcript_id "TCONS_00007177"; exon_number "1"; oId "CUFF.7084.1"; tss_id "TSS7177"; +chr5 Cufflinks exon 122358167 122358478 . - . gene_id "XLOC_007178"; transcript_id "TCONS_00007178"; exon_number "1"; oId "CUFF.7085.1"; tss_id "TSS7178"; +chr5 Cufflinks exon 124686588 124686824 . - . gene_id "XLOC_007179"; transcript_id "TCONS_00007179"; exon_number "1"; oId "CUFF.7088.1"; tss_id "TSS7179"; +chr5 Cufflinks exon 125516448 125516494 . - . gene_id "XLOC_007180"; transcript_id "TCONS_00007180"; exon_number "1"; oId "CUFF.7089.1"; tss_id "TSS7180"; +chr5 Cufflinks exon 125888976 125889093 . - . gene_id "XLOC_007181"; transcript_id "TCONS_00007181"; exon_number "1"; oId "CUFF.7090.1"; tss_id "TSS7181"; +chr5 Cufflinks exon 125975300 125975395 . - . gene_id "XLOC_007182"; transcript_id "TCONS_00007182"; exon_number "1"; oId "CUFF.7091.1"; tss_id "TSS7182"; +chr5 Cufflinks exon 126091015 126091109 . - . gene_id "XLOC_007183"; transcript_id "TCONS_00007183"; exon_number "1"; oId "CUFF.7092.1"; tss_id "TSS7183"; +chr5 Cufflinks exon 126562592 126562629 . - . gene_id "XLOC_007184"; transcript_id "TCONS_00007184"; exon_number "1"; oId "CUFF.7094.1"; tss_id "TSS7184"; +chr5 Cufflinks exon 128528933 128528976 . - . gene_id "XLOC_007185"; transcript_id "TCONS_00007185"; exon_number "1"; oId "CUFF.7097.1"; tss_id "TSS7185"; +chr5 Cufflinks exon 128530214 128530282 . - . gene_id "XLOC_007186"; transcript_id "TCONS_00007186"; exon_number "1"; oId "CUFF.7098.1"; tss_id "TSS7186"; +chr5 Cufflinks exon 129722315 129722372 . - . gene_id "XLOC_007187"; transcript_id "TCONS_00007187"; exon_number "1"; oId "CUFF.7101.1"; tss_id "TSS7187"; +chr5 Cufflinks exon 130695499 130695602 . - . gene_id "XLOC_007188"; transcript_id "TCONS_00007188"; exon_number "1"; oId "CUFF.7102.1"; tss_id "TSS7188"; +chr5 Cufflinks exon 130892652 130892720 . - . gene_id "XLOC_007189"; transcript_id "TCONS_00007189"; exon_number "1"; oId "CUFF.7103.1"; tss_id "TSS7189"; +chr5 Cufflinks exon 132176941 132176998 . - . gene_id "XLOC_007190"; transcript_id "TCONS_00007190"; exon_number "1"; oId "CUFF.7107.1"; tss_id "TSS7190"; +chr5 Cufflinks exon 132352085 132352120 . - . gene_id "XLOC_007191"; transcript_id "TCONS_00007191"; exon_number "1"; oId "CUFF.7109.1"; tss_id "TSS7191"; +chr5 Cufflinks exon 132445922 132446011 . - . gene_id "XLOC_007192"; transcript_id "TCONS_00007192"; exon_number "1"; oId "CUFF.7110.1"; tss_id "TSS7192"; +chr5 Cufflinks exon 133186547 133186646 . - . gene_id "XLOC_007193"; transcript_id "TCONS_00007193"; exon_number "1"; oId "CUFF.7111.1"; tss_id "TSS7193"; +chr5 Cufflinks exon 133835869 133835975 . - . gene_id "XLOC_007194"; transcript_id "TCONS_00007194"; exon_number "1"; oId "CUFF.7113.1"; tss_id "TSS7194"; +chr5 Cufflinks exon 133913824 133913879 . - . gene_id "XLOC_007195"; transcript_id "TCONS_00007195"; exon_number "1"; oId "CUFF.7115.1"; tss_id "TSS7195"; +chr5 Cufflinks exon 133970534 133970635 . - . gene_id "XLOC_007196"; transcript_id "TCONS_00007196"; exon_number "1"; oId "CUFF.7116.1"; tss_id "TSS7196"; +chr5 Cufflinks exon 133997423 133997478 . - . gene_id "XLOC_007197"; transcript_id "TCONS_00007197"; exon_number "1"; oId "CUFF.7117.1"; tss_id "TSS7197"; +chr5 Cufflinks exon 134036863 134036968 . - . gene_id "XLOC_007198"; transcript_id "TCONS_00007198"; exon_number "1"; oId "CUFF.7118.1"; tss_id "TSS7198"; +chr5 Cufflinks exon 134189969 134190000 . - . gene_id "XLOC_007199"; transcript_id "TCONS_00007199"; exon_number "1"; oId "CUFF.7121.1"; tss_id "TSS7199"; +chr5 Cufflinks exon 135989367 135989401 . - . gene_id "XLOC_007200"; transcript_id "TCONS_00007200"; exon_number "1"; oId "CUFF.7122.1"; tss_id "TSS7200"; +chr5 Cufflinks exon 136304904 136304993 . - . gene_id "XLOC_007201"; transcript_id "TCONS_00007201"; exon_number "1"; oId "CUFF.7123.1"; tss_id "TSS7201"; +chr5 Cufflinks exon 136574522 136574561 . - . gene_id "XLOC_007202"; transcript_id "TCONS_00007202"; exon_number "1"; oId "CUFF.7124.1"; tss_id "TSS7202"; +chr5 Cufflinks exon 136668415 136668454 . - . gene_id "XLOC_007203"; transcript_id "TCONS_00007203"; exon_number "1"; oId "CUFF.7125.1"; tss_id "TSS7203"; +chr5 Cufflinks exon 137405057 137405147 . - . gene_id "XLOC_007204"; transcript_id "TCONS_00007204"; exon_number "1"; oId "CUFF.7127.1"; tss_id "TSS7204"; +chr5 Cufflinks exon 137450888 137450994 . - . gene_id "XLOC_007205"; transcript_id "TCONS_00007205"; exon_number "1"; oId "CUFF.7128.1"; tss_id "TSS7205"; +chr5 Cufflinks exon 137458723 137458800 . - . gene_id "XLOC_007206"; transcript_id "TCONS_00007206"; exon_number "1"; oId "CUFF.7130.1"; tss_id "TSS7206"; +chr5 Cufflinks exon 137556192 137556233 . - . gene_id "XLOC_007207"; transcript_id "TCONS_00007207"; exon_number "1"; oId "CUFF.7132.1"; tss_id "TSS7207"; +chr5 Cufflinks exon 138668798 138668982 . - . gene_id "XLOC_007208"; transcript_id "TCONS_00007208"; exon_number "1"; oId "CUFF.7137.1"; tss_id "TSS7208"; +chr5 Cufflinks exon 139097570 139097674 . - . gene_id "XLOC_007209"; transcript_id "TCONS_00007209"; exon_number "1"; oId "CUFF.7139.1"; tss_id "TSS7209"; +chr5 Cufflinks exon 139364060 139364102 . - . gene_id "XLOC_007210"; transcript_id "TCONS_00007210"; exon_number "1"; oId "CUFF.7140.1"; tss_id "TSS7210"; +chr5 Cufflinks exon 139776909 139777029 . - . gene_id "XLOC_007211"; transcript_id "TCONS_00007211"; exon_number "1"; oId "CUFF.7141.1"; tss_id "TSS7211"; +chr5 Cufflinks exon 140037507 140037565 . - . gene_id "XLOC_007212"; transcript_id "TCONS_00007212"; exon_number "1"; oId "CUFF.7143.1"; tss_id "TSS7212"; +chr5 Cufflinks exon 140111672 140111759 . - . gene_id "XLOC_007213"; transcript_id "TCONS_00007213"; exon_number "1"; oId "CUFF.7144.1"; tss_id "TSS7213"; +chr5 Cufflinks exon 140273388 140273424 . - . gene_id "XLOC_007214"; transcript_id "TCONS_00007214"; exon_number "1"; oId "CUFF.7145.1"; tss_id "TSS7214"; +chr5 Cufflinks exon 141773985 141774059 . - . gene_id "XLOC_007215"; transcript_id "TCONS_00007215"; exon_number "1"; oId "CUFF.7148.1"; tss_id "TSS7215"; +chr5 Cufflinks exon 142355138 142355175 . - . gene_id "XLOC_007216"; transcript_id "TCONS_00007216"; exon_number "1"; oId "CUFF.7150.1"; tss_id "TSS7216"; +chr5 Cufflinks exon 142922105 142922151 . - . gene_id "XLOC_007217"; transcript_id "TCONS_00007217"; exon_number "1"; oId "CUFF.7151.1"; tss_id "TSS7217"; +chr5 Cufflinks exon 143914988 143915224 . - . gene_id "XLOC_007218"; transcript_id "TCONS_00007218"; exon_number "1"; oId "CUFF.7153.1"; tss_id "TSS7218"; +chr5 Cufflinks exon 144883979 144884011 . - . gene_id "XLOC_007219"; transcript_id "TCONS_00007219"; exon_number "1"; oId "CUFF.7154.1"; tss_id "TSS7219"; +chr5 Cufflinks exon 145624755 145624815 . - . gene_id "XLOC_007220"; transcript_id "TCONS_00007220"; exon_number "1"; oId "CUFF.7155.1"; tss_id "TSS7220"; +chr5 Cufflinks exon 145965674 145965763 . - . gene_id "XLOC_007221"; transcript_id "TCONS_00007221"; exon_number "1"; oId "CUFF.7158.1"; tss_id "TSS7221"; +chr5 Cufflinks exon 146035946 146036248 . - . gene_id "XLOC_007222"; transcript_id "TCONS_00007222"; exon_number "1"; oId "CUFF.7159.1"; tss_id "TSS7222"; +chr5 Cufflinks exon 146676980 146677046 . - . gene_id "XLOC_007223"; transcript_id "TCONS_00007223"; exon_number "1"; oId "CUFF.7161.1"; tss_id "TSS7223"; +chr5 Cufflinks exon 146800490 146800537 . - . gene_id "XLOC_007224"; transcript_id "TCONS_00007224"; exon_number "1"; oId "CUFF.7162.1"; tss_id "TSS7224"; +chr5 Cufflinks exon 148437117 148437221 . - . gene_id "XLOC_007225"; transcript_id "TCONS_00007225"; exon_number "1"; oId "CUFF.7164.1"; tss_id "TSS7225"; +chr5 Cufflinks exon 148495807 148496042 . - . gene_id "XLOC_007226"; transcript_id "TCONS_00007226"; exon_number "1"; oId "CUFF.7165.1"; tss_id "TSS7226"; +chr5 Cufflinks exon 148986201 148986304 . - . gene_id "XLOC_007227"; transcript_id "TCONS_00007227"; exon_number "1"; oId "CUFF.7168.1"; tss_id "TSS7227"; +chr5 Cufflinks exon 149075311 149075522 . - . gene_id "XLOC_007228"; transcript_id "TCONS_00007228"; exon_number "1"; oId "CUFF.7169.1"; tss_id "TSS7228"; +chr5 Cufflinks exon 149321852 149322035 . - . gene_id "XLOC_007229"; transcript_id "TCONS_00007229"; exon_number "1"; oId "CUFF.7171.1"; tss_id "TSS7229"; +chr5 Cufflinks exon 149323028 149323182 . - . gene_id "XLOC_007230"; transcript_id "TCONS_00007230"; exon_number "1"; oId "CUFF.7172.1"; tss_id "TSS7230"; +chr5 Cufflinks exon 149327052 149327142 . - . gene_id "XLOC_007231"; transcript_id "TCONS_00007231"; exon_number "1"; oId "CUFF.7173.1"; tss_id "TSS7231"; +chr5 Cufflinks exon 149359370 149359401 . - . gene_id "XLOC_007232"; transcript_id "TCONS_00007232"; exon_number "1"; oId "CUFF.7174.1"; tss_id "TSS7232"; +chr5 Cufflinks exon 149408909 149409016 . - . gene_id "XLOC_007233"; transcript_id "TCONS_00007233"; exon_number "1"; oId "CUFF.7175.1"; tss_id "TSS7233"; +chr5 Cufflinks exon 149923149 149923248 . - . gene_id "XLOC_007234"; transcript_id "TCONS_00007234"; exon_number "1"; oId "CUFF.7177.1"; tss_id "TSS7234"; +chr5 Cufflinks exon 150661751 150661781 . - . gene_id "XLOC_007235"; transcript_id "TCONS_00007235"; exon_number "1"; oId "CUFF.7181.1"; tss_id "TSS7235"; +chr5 Cufflinks exon 150857019 150857138 . - . gene_id "XLOC_007236"; transcript_id "TCONS_00007236"; exon_number "1"; oId "CUFF.7183.1"; tss_id "TSS7236"; +chr5 Cufflinks exon 151076888 151076944 . - . gene_id "XLOC_007237"; transcript_id "TCONS_00007237"; exon_number "1"; oId "CUFF.7184.1"; tss_id "TSS7237"; +chr5 Cufflinks exon 151083899 151084139 . - . gene_id "XLOC_007238"; transcript_id "TCONS_00007238"; exon_number "1"; oId "CUFF.7185.1"; tss_id "TSS7238"; +chr5 Cufflinks exon 151255165 151255253 . - . gene_id "XLOC_007239"; transcript_id "TCONS_00007239"; exon_number "1"; oId "CUFF.7186.1"; tss_id "TSS7239"; +chr5 Cufflinks exon 151517968 151518010 . - . gene_id "XLOC_007240"; transcript_id "TCONS_00007240"; exon_number "1"; oId "CUFF.7187.1"; tss_id "TSS7240"; +chr5 Cufflinks exon 154097918 154098249 . - . gene_id "XLOC_007241"; transcript_id "TCONS_00007241"; exon_number "1"; oId "CUFF.7192.1"; tss_id "TSS7241"; +chr5 Cufflinks exon 154140618 154140652 . - . gene_id "XLOC_007242"; transcript_id "TCONS_00007242"; exon_number "1"; oId "CUFF.7193.1"; tss_id "TSS7242"; +chr5 Cufflinks exon 155511457 155511545 . - . gene_id "XLOC_007243"; transcript_id "TCONS_00007243"; exon_number "1"; oId "CUFF.7197.1"; tss_id "TSS7243"; +chr5 Cufflinks exon 157364499 157364527 . - . gene_id "XLOC_007244"; transcript_id "TCONS_00007244"; exon_number "1"; oId "CUFF.7203.1"; tss_id "TSS7244"; +chr5 Cufflinks exon 157403780 157403964 . - . gene_id "XLOC_007245"; transcript_id "TCONS_00007245"; exon_number "1"; oId "CUFF.7204.1"; tss_id "TSS7245"; +chr5 Cufflinks exon 157460234 157460281 . - . gene_id "XLOC_007246"; transcript_id "TCONS_00007246"; exon_number "1"; oId "CUFF.7205.1"; tss_id "TSS7246"; +chr5 Cufflinks exon 159699648 159699684 . - . gene_id "XLOC_007247"; transcript_id "TCONS_00007247"; exon_number "1"; oId "CUFF.7208.1"; tss_id "TSS7247"; +chr5 Cufflinks exon 161840577 161840612 . - . gene_id "XLOC_007248"; transcript_id "TCONS_00007248"; exon_number "1"; oId "CUFF.7212.1"; tss_id "TSS7248"; +chr5 Cufflinks exon 162306976 162307001 . - . gene_id "XLOC_007249"; transcript_id "TCONS_00007249"; exon_number "1"; oId "CUFF.7216.1"; tss_id "TSS7249"; +chr5 Cufflinks exon 162912213 162912253 . - . gene_id "XLOC_007250"; transcript_id "TCONS_00007250"; exon_number "1"; oId "CUFF.7218.1"; tss_id "TSS7250"; +chr5 Cufflinks exon 163223075 163223171 . - . gene_id "XLOC_007251"; transcript_id "TCONS_00007251"; exon_number "1"; oId "CUFF.7219.1"; tss_id "TSS7251"; +chr5 Cufflinks exon 164362168 164362274 . - . gene_id "XLOC_007252"; transcript_id "TCONS_00007252"; exon_number "1"; oId "CUFF.7220.1"; tss_id "TSS7252"; +chr5 Cufflinks exon 165883986 165884017 . - . gene_id "XLOC_007253"; transcript_id "TCONS_00007253"; exon_number "1"; oId "CUFF.7223.1"; tss_id "TSS7253"; +chr5 Cufflinks exon 167666589 167666651 . - . gene_id "XLOC_007254"; transcript_id "TCONS_00007254"; exon_number "1"; oId "CUFF.7225.1"; tss_id "TSS7254"; +chr5 Cufflinks exon 167816641 167816715 . - . gene_id "XLOC_007255"; transcript_id "TCONS_00007255"; exon_number "1"; oId "CUFF.7226.1"; tss_id "TSS7255"; +chr5 Cufflinks exon 168769280 168769309 . - . gene_id "XLOC_007256"; transcript_id "TCONS_00007256"; exon_number "1"; oId "CUFF.7228.1"; tss_id "TSS7256"; +chr5 Cufflinks exon 170937892 170937928 . - . gene_id "XLOC_007257"; transcript_id "TCONS_00007257"; exon_number "1"; oId "CUFF.7234.1"; tss_id "TSS7257"; +chr5 Cufflinks exon 171920589 171920625 . - . gene_id "XLOC_007258"; transcript_id "TCONS_00007258"; exon_number "1"; oId "CUFF.7237.1"; tss_id "TSS7258"; +chr5 Cufflinks exon 172643261 172643310 . - . gene_id "XLOC_007259"; transcript_id "TCONS_00007259"; exon_number "1"; oId "CUFF.7238.1"; tss_id "TSS7259"; +chr5 Cufflinks exon 172719537 172719626 . - . gene_id "XLOC_007260"; transcript_id "TCONS_00007260"; exon_number "1"; oId "CUFF.7239.1"; tss_id "TSS7260"; +chr5 Cufflinks exon 172789148 172789243 . - . gene_id "XLOC_007261"; transcript_id "TCONS_00007261"; exon_number "1"; oId "CUFF.7240.1"; tss_id "TSS7261"; +chr5 Cufflinks exon 174541743 174542177 . - . gene_id "XLOC_007262"; transcript_id "TCONS_00007262"; exon_number "1"; oId "CUFF.7241.1"; tss_id "TSS7262"; +chr5 Cufflinks exon 174877816 174877921 . - . gene_id "XLOC_007263"; transcript_id "TCONS_00007263"; exon_number "1"; oId "CUFF.7242.1"; tss_id "TSS7263"; +chr5 Cufflinks exon 175974419 175974727 . - . gene_id "XLOC_007264"; transcript_id "TCONS_00007264"; exon_number "1"; oId "CUFF.7245.1"; tss_id "TSS7264"; +chr5 Cufflinks exon 177711803 177711846 . - . gene_id "XLOC_007265"; transcript_id "TCONS_00007265"; exon_number "1"; oId "CUFF.7248.1"; tss_id "TSS7265"; +chr5 Cufflinks exon 178046822 178046993 . - . gene_id "XLOC_007266"; transcript_id "TCONS_00007266"; exon_number "1"; oId "CUFF.7250.1"; tss_id "TSS7266"; +chr5 Cufflinks exon 178164173 178164202 . - . gene_id "XLOC_007267"; transcript_id "TCONS_00007267"; exon_number "1"; oId "CUFF.7251.1"; tss_id "TSS7267"; +chr5 Cufflinks exon 178919088 178919158 . - . gene_id "XLOC_007268"; transcript_id "TCONS_00007268"; exon_number "1"; oId "CUFF.7253.1"; tss_id "TSS7268"; +chr5 Cufflinks exon 179654690 179654740 . - . gene_id "XLOC_007269"; transcript_id "TCONS_00007269"; exon_number "1"; oId "CUFF.7256.1"; tss_id "TSS7269"; +chr5 Cufflinks exon 179985858 179985957 . - . gene_id "XLOC_007270"; transcript_id "TCONS_00007270"; exon_number "1"; oId "CUFF.7259.1"; tss_id "TSS7270"; +chr5 Cufflinks exon 180524474 180524555 . - . gene_id "XLOC_007271"; transcript_id "TCONS_00007271"; exon_number "1"; oId "CUFF.7264.1"; tss_id "TSS7271"; +chr5 Cufflinks exon 180529253 180529325 . - . gene_id "XLOC_007272"; transcript_id "TCONS_00007272"; exon_number "1"; oId "CUFF.7266.1"; tss_id "TSS7272"; +chr5 Cufflinks exon 180546492 180546536 . - . gene_id "XLOC_007273"; transcript_id "TCONS_00007273"; exon_number "1"; oId "CUFF.7267.1"; tss_id "TSS7273"; +chr5 Cufflinks exon 180591564 180591645 . - . gene_id "XLOC_007274"; transcript_id "TCONS_00007274"; exon_number "1"; oId "CUFF.7269.1"; tss_id "TSS7274"; +chr5 Cufflinks exon 180601044 180601125 . - . gene_id "XLOC_007275"; transcript_id "TCONS_00007275"; exon_number "1"; oId "CUFF.7272.1"; tss_id "TSS7275"; +chr5 Cufflinks exon 180615416 180615488 . - . gene_id "XLOC_007276"; transcript_id "TCONS_00007276"; exon_number "1"; oId "CUFF.7274.1"; tss_id "TSS7276"; +chr5 Cufflinks exon 180615854 180615925 . - . gene_id "XLOC_007277"; transcript_id "TCONS_00007277"; exon_number "1"; oId "CUFF.7275.1"; tss_id "TSS7277"; +chr5 Cufflinks exon 180618687 180618758 . - . gene_id "XLOC_007278"; transcript_id "TCONS_00007278"; exon_number "1"; oId "CUFF.7276.1"; tss_id "TSS7278"; +chr5 Cufflinks exon 180645270 180645342 . - . gene_id "XLOC_007279"; transcript_id "TCONS_00007279"; exon_number "1"; oId "CUFF.7279.1"; tss_id "TSS7279"; +chr5 Cufflinks exon 180648443 180648509 . - . gene_id "XLOC_007280"; transcript_id "TCONS_00007280"; exon_number "1"; oId "CUFF.7280.1"; tss_id "TSS7280"; +chr5 Cufflinks exon 180648979 180649051 . - . gene_id "XLOC_007281"; transcript_id "TCONS_00007281"; exon_number "1"; oId "CUFF.7281.1"; tss_id "TSS7281"; +chr5 Cufflinks exon 180649394 180649467 . - . gene_id "XLOC_007282"; transcript_id "TCONS_00007282"; exon_number "1"; oId "CUFF.7282.1"; tss_id "TSS7282"; +chr6 Cufflinks exon 1186752 1186857 . + . gene_id "XLOC_007283"; transcript_id "TCONS_00007283"; exon_number "1"; oId "CUFF.7286.1"; tss_id "TSS7283"; +chr6 Cufflinks exon 1455522 1455593 . + . gene_id "XLOC_007284"; transcript_id "TCONS_00007284"; exon_number "1"; oId "CUFF.7287.1"; tss_id "TSS7284"; +chr6 Cufflinks exon 1507557 1507859 . + . gene_id "XLOC_007285"; transcript_id "TCONS_00007285"; exon_number "1"; oId "CUFF.7288.1"; tss_id "TSS7285"; +chr6 Cufflinks exon 1523146 1523246 . + . gene_id "XLOC_007286"; transcript_id "TCONS_00007286"; exon_number "1"; oId "CUFF.7289.1"; tss_id "TSS7286"; +chr6 Cufflinks exon 4076622 4076704 . + . gene_id "XLOC_007287"; transcript_id "TCONS_00007287"; exon_number "1"; oId "CUFF.7292.1"; tss_id "TSS7287"; +chr6 Cufflinks exon 4428197 4428316 . + . gene_id "XLOC_007288"; transcript_id "TCONS_00007288"; exon_number "1"; oId "CUFF.7295.1"; tss_id "TSS7288"; +chr6 Cufflinks exon 4643996 4644091 . + . gene_id "XLOC_007289"; transcript_id "TCONS_00007289"; exon_number "1"; oId "CUFF.7297.1"; tss_id "TSS7289"; +chr6 Cufflinks exon 4693335 4693401 . + . gene_id "XLOC_007290"; transcript_id "TCONS_00007290"; exon_number "1"; oId "CUFF.7298.1"; tss_id "TSS7290"; +chr6 Cufflinks exon 5923135 5923173 . + . gene_id "XLOC_007291"; transcript_id "TCONS_00007291"; exon_number "1"; oId "CUFF.7304.1"; tss_id "TSS7291"; +chr6 Cufflinks exon 6377483 6377521 . + . gene_id "XLOC_007292"; transcript_id "TCONS_00007292"; exon_number "1"; oId "CUFF.7305.1"; tss_id "TSS7292"; +chr6 Cufflinks exon 7776203 7776239 . + . gene_id "XLOC_007293"; transcript_id "TCONS_00007293"; exon_number "1"; oId "CUFF.7309.1"; tss_id "TSS7293"; +chr6 Cufflinks exon 9895848 9895885 . + . gene_id "XLOC_007294"; transcript_id "TCONS_00007294"; exon_number "1"; oId "CUFF.7311.1"; tss_id "TSS7294"; +chr6 Cufflinks exon 10508828 10508865 . + . gene_id "XLOC_007295"; transcript_id "TCONS_00007295"; exon_number "1"; oId "CUFF.7312.1"; tss_id "TSS7295"; +chr6 Cufflinks exon 10673908 10673945 . + . gene_id "XLOC_007296"; transcript_id "TCONS_00007296"; exon_number "1"; oId "CUFF.7313.1"; tss_id "TSS7296"; +chr6 Cufflinks exon 11079247 11079349 . + . gene_id "XLOC_007297"; transcript_id "TCONS_00007297"; exon_number "1"; oId "CUFF.7315.1"; tss_id "TSS7297"; +chr6 Cufflinks exon 11644300 11644594 . + . gene_id "XLOC_007298"; transcript_id "TCONS_00007298"; exon_number "1"; oId "CUFF.7317.1"; tss_id "TSS7298"; +chr6 Cufflinks exon 12390275 12390323 . + . gene_id "XLOC_007299"; transcript_id "TCONS_00007299"; exon_number "1"; oId "CUFF.7319.1"; tss_id "TSS7299"; +chr6 Cufflinks exon 12737032 12737067 . + . gene_id "XLOC_007300"; transcript_id "TCONS_00007300"; exon_number "1"; oId "CUFF.7321.1"; tss_id "TSS7300"; +chr6 Cufflinks exon 13214288 13214451 . + . gene_id "XLOC_007301"; transcript_id "TCONS_00007301"; exon_number "1"; oId "CUFF.7322.1"; tss_id "TSS7301"; +chr6 Cufflinks exon 13254681 13254813 . + . gene_id "XLOC_007302"; transcript_id "TCONS_00007302"; exon_number "1"; oId "CUFF.7323.1"; tss_id "TSS7302"; +chr6 Cufflinks exon 13547936 13548188 . + . gene_id "XLOC_007303"; transcript_id "TCONS_00007303"; exon_number "1"; oId "CUFF.7324.1"; tss_id "TSS7303"; +chr6 Cufflinks exon 13680312 13680373 . + . gene_id "XLOC_007304"; transcript_id "TCONS_00007304"; exon_number "1"; oId "CUFF.7325.1"; tss_id "TSS7304"; +chr6 Cufflinks exon 13988996 13989035 . + . gene_id "XLOC_007305"; transcript_id "TCONS_00007305"; exon_number "1"; oId "CUFF.7326.1"; tss_id "TSS7305"; +chr6 Cufflinks exon 14156694 14156744 . + . gene_id "XLOC_007306"; transcript_id "TCONS_00007306"; exon_number "1"; oId "CUFF.7327.1"; tss_id "TSS7306"; +chr6 Cufflinks exon 14328881 14328913 . + . gene_id "XLOC_007307"; transcript_id "TCONS_00007307"; exon_number "1"; oId "CUFF.7328.1"; tss_id "TSS7307"; +chr6 Cufflinks exon 14646766 14646869 . + . gene_id "XLOC_007308"; transcript_id "TCONS_00007308"; exon_number "1"; oId "CUFF.7331.1"; tss_id "TSS7308"; +chr6 Cufflinks exon 15005764 15005798 . + . gene_id "XLOC_007309"; transcript_id "TCONS_00007309"; exon_number "1"; oId "CUFF.7332.1"; tss_id "TSS7309"; +chr6 Cufflinks exon 15113194 15113466 . + . gene_id "XLOC_007310"; transcript_id "TCONS_00007310"; exon_number "1"; oId "CUFF.7334.1"; tss_id "TSS7310"; +chr6 Cufflinks exon 15315151 15315257 . + . gene_id "XLOC_007311"; transcript_id "TCONS_00007311"; exon_number "1"; oId "CUFF.7336.1"; tss_id "TSS7311"; +chr6 Cufflinks exon 16019509 16019585 . + . gene_id "XLOC_007312"; transcript_id "TCONS_00007312"; exon_number "1"; oId "CUFF.7340.1"; tss_id "TSS7312"; +chr6 Cufflinks exon 16205245 16205332 . + . gene_id "XLOC_007313"; transcript_id "TCONS_00007313"; exon_number "1"; oId "CUFF.7343.1"; tss_id "TSS7313"; +chr6 Cufflinks exon 16988497 16988573 . + . gene_id "XLOC_007314"; transcript_id "TCONS_00007314"; exon_number "1"; oId "CUFF.7345.1"; tss_id "TSS7314"; +chr6 Cufflinks exon 17619764 17619865 . + . gene_id "XLOC_007315"; transcript_id "TCONS_00007315"; exon_number "1"; oId "CUFF.7348.1"; tss_id "TSS7315"; +chr6 Cufflinks exon 17993150 17993185 . + . gene_id "XLOC_007316"; transcript_id "TCONS_00007316"; exon_number "1"; oId "CUFF.7351.1"; tss_id "TSS7316"; +chr6 Cufflinks exon 18053617 18053668 . + . gene_id "XLOC_007317"; transcript_id "TCONS_00007317"; exon_number "1"; oId "CUFF.7352.1"; tss_id "TSS7317"; +chr6 Cufflinks exon 18571318 18571445 . + . gene_id "XLOC_007318"; transcript_id "TCONS_00007318"; exon_number "1"; oId "CUFF.7356.1"; tss_id "TSS7318"; +chr6 Cufflinks exon 18836402 18836473 . + . gene_id "XLOC_007319"; transcript_id "TCONS_00007319"; exon_number "1"; oId "CUFF.7357.1"; tss_id "TSS7319"; +chr6 Cufflinks exon 19438514 19438604 . + . gene_id "XLOC_007320"; transcript_id "TCONS_00007320"; exon_number "1"; oId "CUFF.7358.1"; tss_id "TSS7320"; +chr6 Cufflinks exon 19973658 19973712 . + . gene_id "XLOC_007321"; transcript_id "TCONS_00007321"; exon_number "1"; oId "CUFF.7360.1"; tss_id "TSS7321"; +chr6 Cufflinks exon 20282260 20282331 . + . gene_id "XLOC_007322"; transcript_id "TCONS_00007322"; exon_number "1"; oId "CUFF.7361.1"; tss_id "TSS7322"; +chr6 Cufflinks exon 20381283 20381487 . + . gene_id "XLOC_007323"; transcript_id "TCONS_00007323"; exon_number "1"; oId "CUFF.7362.1"; tss_id "TSS7323"; +chr6 Cufflinks exon 22085774 22086020 . + . gene_id "XLOC_007324"; transcript_id "TCONS_00007324"; exon_number "1"; oId "CUFF.7368.1"; tss_id "TSS7324"; +chr6 Cufflinks exon 22628862 22628893 . + . gene_id "XLOC_007325"; transcript_id "TCONS_00007325"; exon_number "1"; oId "CUFF.7369.1"; tss_id "TSS7325"; +chr6 Cufflinks exon 23009069 23009147 . + . gene_id "XLOC_007326"; transcript_id "TCONS_00007326"; exon_number "1"; oId "CUFF.7373.1"; tss_id "TSS7326"; +chr6 Cufflinks exon 24365877 24365982 . + . gene_id "XLOC_007327"; transcript_id "TCONS_00007327"; exon_number "1"; oId "CUFF.7376.1"; tss_id "TSS7327"; +chr6 Cufflinks exon 24485621 24485676 . + . gene_id "XLOC_007328"; transcript_id "TCONS_00007328"; exon_number "1"; oId "CUFF.7378.1"; tss_id "TSS7328"; +chr6 Cufflinks exon 25383827 25383930 . + . gene_id "XLOC_007329"; transcript_id "TCONS_00007329"; exon_number "1"; oId "CUFF.7382.1"; tss_id "TSS7329"; +chr6 Cufflinks exon 25435507 25435584 . + . gene_id "XLOC_007330"; transcript_id "TCONS_00007330"; exon_number "1"; oId "CUFF.7383.1"; tss_id "TSS7330"; +chr6 Cufflinks exon 26065699 26065736 . + . gene_id "XLOC_007331"; transcript_id "TCONS_00007331"; exon_number "1"; oId "CUFF.7384.1"; tss_id "TSS7331"; +chr6 Cufflinks exon 26263864 26263995 . + . gene_id "XLOC_007332"; transcript_id "TCONS_00007332"; exon_number "1"; oId "CUFF.7385.1"; tss_id "TSS7332"; +chr6 Cufflinks exon 26264600 26264681 . + . gene_id "XLOC_007333"; transcript_id "TCONS_00007333"; exon_number "1"; oId "CUFF.7386.1"; tss_id "TSS7333"; +chr6 Cufflinks exon 26286282 26286339 . + . gene_id "XLOC_007334"; transcript_id "TCONS_00007334"; exon_number "1"; oId "CUFF.7387.1"; tss_id "TSS7334"; +chr6 Cufflinks exon 26286754 26286825 . + . gene_id "XLOC_007335"; transcript_id "TCONS_00007335"; exon_number "1"; oId "CUFF.7388.1"; tss_id "TSS7335"; +chr6 Cufflinks exon 26299905 26299977 . + . gene_id "XLOC_007336"; transcript_id "TCONS_00007336"; exon_number "1"; oId "CUFF.7389.1"; tss_id "TSS7336"; +chr6 Cufflinks exon 26323046 26323118 . + . gene_id "XLOC_007337"; transcript_id "TCONS_00007337"; exon_number "1"; oId "CUFF.7399.1"; tss_id "TSS7337"; +chr6 Cufflinks exon 26327817 26327901 . + . gene_id "XLOC_007338"; transcript_id "TCONS_00007338"; exon_number "1"; oId "CUFF.7400.1"; tss_id "TSS7338"; +chr6 Cufflinks exon 26328368 26328440 . + . gene_id "XLOC_007339"; transcript_id "TCONS_00007339"; exon_number "1"; oId "CUFF.7401.1"; tss_id "TSS7339"; +chr6 Cufflinks exon 26359269 26359329 . + . gene_id "XLOC_007340"; transcript_id "TCONS_00007340"; exon_number "1"; oId "CUFF.7406.1"; tss_id "TSS7340"; +chr6 Cufflinks exon 26521436 26521518 . + . gene_id "XLOC_007341"; transcript_id "TCONS_00007341"; exon_number "1"; oId "CUFF.7408.1"; tss_id "TSS7341"; +chr6 Cufflinks exon 26537726 26537798 . + . gene_id "XLOC_007342"; transcript_id "TCONS_00007342"; exon_number "1"; oId "CUFF.7410.1"; tss_id "TSS7342"; +chr6 Cufflinks exon 26538282 26538355 . + . gene_id "XLOC_007343"; transcript_id "TCONS_00007343"; exon_number "1"; oId "CUFF.7411.1"; tss_id "TSS7343"; +chr6 Cufflinks exon 26553731 26553802 . + . gene_id "XLOC_007344"; transcript_id "TCONS_00007344"; exon_number "1"; oId "CUFF.7413.1"; tss_id "TSS7344"; +chr6 Cufflinks exon 26554350 26554423 . + . gene_id "XLOC_007345"; transcript_id "TCONS_00007345"; exon_number "1"; oId "CUFF.7414.1"; tss_id "TSS7345"; +chr6 Cufflinks exon 26555498 26555569 . + . gene_id "XLOC_007346"; transcript_id "TCONS_00007346"; exon_number "1"; oId "CUFF.7415.1"; tss_id "TSS7346"; +chr6 Cufflinks exon 26556774 26556847 . + . gene_id "XLOC_007347"; transcript_id "TCONS_00007347"; exon_number "1"; oId "CUFF.7416.1"; tss_id "TSS7347"; +chr6 Cufflinks exon 26559181 26559252 . + . gene_id "XLOC_007348"; transcript_id "TCONS_00007348"; exon_number "1"; oId "CUFF.7417.1"; tss_id "TSS7348"; +chr6 Cufflinks exon 26569086 26569176 . + . gene_id "XLOC_007349"; transcript_id "TCONS_00007349"; exon_number "1"; oId "CUFF.7418.1"; tss_id "TSS7349"; +chr6 Cufflinks exon 26575798 26575888 . + . gene_id "XLOC_007350"; transcript_id "TCONS_00007350"; exon_number "1"; oId "CUFF.7420.1"; tss_id "TSS7350"; +chr6 Cufflinks exon 26577332 26577421 . + . gene_id "XLOC_007351"; transcript_id "TCONS_00007351"; exon_number "1"; oId "CUFF.7421.1"; tss_id "TSS7351"; +chr6 Cufflinks exon 26595102 26595190 . + . gene_id "XLOC_007352"; transcript_id "TCONS_00007352"; exon_number "1"; oId "CUFF.7422.1"; tss_id "TSS7352"; +chr6 Cufflinks exon 26605094 26605166 . + . gene_id "XLOC_007353"; transcript_id "TCONS_00007353"; exon_number "1"; oId "CUFF.7424.1"; tss_id "TSS7353"; +chr6 Cufflinks exon 26673590 26673662 . + . gene_id "XLOC_007354"; transcript_id "TCONS_00007354"; exon_number "1"; oId "CUFF.7426.1"; tss_id "TSS7354"; +chr6 Cufflinks exon 26678161 26678234 . + . gene_id "XLOC_007355"; transcript_id "TCONS_00007355"; exon_number "1"; oId "CUFF.7427.1"; tss_id "TSS7355"; +chr6 Cufflinks exon 26682715 26682787 . + . gene_id "XLOC_007356"; transcript_id "TCONS_00007356"; exon_number "1"; oId "CUFF.7428.1"; tss_id "TSS7356"; +chr6 Cufflinks exon 26687485 26687557 . + . gene_id "XLOC_007357"; transcript_id "TCONS_00007357"; exon_number "1"; oId "CUFF.7429.1"; tss_id "TSS7357"; +chr6 Cufflinks exon 26697756 26697831 . + . gene_id "XLOC_007358"; transcript_id "TCONS_00007358"; exon_number "1"; oId "CUFF.7431.1"; tss_id "TSS7358"; +chr6 Cufflinks exon 26698284 26698340 . + . gene_id "XLOC_007359"; transcript_id "TCONS_00007359"; exon_number "1"; oId "CUFF.7432.1"; tss_id "TSS7359"; +chr6 Cufflinks exon 26701712 26701787 . + . gene_id "XLOC_007360"; transcript_id "TCONS_00007360"; exon_number "1"; oId "CUFF.7433.1"; tss_id "TSS7360"; +chr6 Cufflinks exon 26705606 26705678 . + . gene_id "XLOC_007361"; transcript_id "TCONS_00007361"; exon_number "1"; oId "CUFF.7434.1"; tss_id "TSS7361"; +chr6 Cufflinks exon 26710607 26710680 . + . gene_id "XLOC_007362"; transcript_id "TCONS_00007362"; exon_number "1"; oId "CUFF.7435.1"; tss_id "TSS7362"; +chr6 Cufflinks exon 26713898 26713970 . + . gene_id "XLOC_007363"; transcript_id "TCONS_00007363"; exon_number "1"; oId "CUFF.7436.1"; tss_id "TSS7363"; +chr6 Cufflinks exon 26718125 26718198 . + . gene_id "XLOC_007364"; transcript_id "TCONS_00007364"; exon_number "1"; oId "CUFF.7437.1"; tss_id "TSS7364"; +chr6 Cufflinks exon 26728256 26728328 . + . gene_id "XLOC_007365"; transcript_id "TCONS_00007365"; exon_number "1"; oId "CUFF.7440.1"; tss_id "TSS7365"; +chr6 Cufflinks exon 26730737 26730809 . + . gene_id "XLOC_007366"; transcript_id "TCONS_00007366"; exon_number "1"; oId "CUFF.7441.1"; tss_id "TSS7366"; +chr6 Cufflinks exon 26751918 26751990 . + . gene_id "XLOC_007367"; transcript_id "TCONS_00007367"; exon_number "1"; oId "CUFF.7445.1"; tss_id "TSS7367"; +chr6 Cufflinks exon 26752630 26752703 . + . gene_id "XLOC_007368"; transcript_id "TCONS_00007368"; exon_number "1"; oId "CUFF.7446.1"; tss_id "TSS7368"; +chr6 Cufflinks exon 26766444 26766516 . + . gene_id "XLOC_007369"; transcript_id "TCONS_00007369"; exon_number "1"; oId "CUFF.7448.1"; tss_id "TSS7369"; +chr6 Cufflinks exon 26779381 26779423 . + . gene_id "XLOC_007370"; transcript_id "TCONS_00007370"; exon_number "1"; oId "CUFF.7451.1"; tss_id "TSS7370"; +chr6 Cufflinks exon 26780832 26780906 . + . gene_id "XLOC_007371"; transcript_id "TCONS_00007371"; exon_number "1"; oId "CUFF.7452.1"; tss_id "TSS7371"; +chr6 Cufflinks exon 26988125 26988218 . + . gene_id "XLOC_007372"; transcript_id "TCONS_00007372"; exon_number "1"; oId "CUFF.7458.1"; tss_id "TSS7372"; +chr6 Cufflinks exon 27059521 27059592 . + . gene_id "XLOC_007373"; transcript_id "TCONS_00007373"; exon_number "1"; oId "CUFF.7459.1"; tss_id "TSS7373"; +chr6 Cufflinks exon 27065085 27065166 . + . gene_id "XLOC_007374"; transcript_id "TCONS_00007374"; exon_number "1"; oId "CUFF.7460.1"; tss_id "TSS7374"; +chr6 Cufflinks exon 27118022 27118095 . + . gene_id "XLOC_007375"; transcript_id "TCONS_00007375"; exon_number "1"; oId "CUFF.7462.1"; tss_id "TSS7375"; +chr6 Cufflinks exon 27120000 27120075 . + . gene_id "XLOC_007376"; transcript_id "TCONS_00007376"; exon_number "1"; oId "CUFF.7463.1"; tss_id "TSS7376"; +chr6 Cufflinks exon 27125906 27125977 . + . gene_id "XLOC_007377"; transcript_id "TCONS_00007377"; exon_number "1"; oId "CUFF.7464.1"; tss_id "TSS7377"; +chr6 Cufflinks exon 27130050 27130123 . + . gene_id "XLOC_007378"; transcript_id "TCONS_00007378"; exon_number "1"; oId "CUFF.7465.1"; tss_id "TSS7378"; +chr6 Cufflinks exon 27177628 27177710 . + . gene_id "XLOC_007379"; transcript_id "TCONS_00007379"; exon_number "1"; oId "CUFF.7468.1"; tss_id "TSS7379"; +chr6 Cufflinks exon 27182952 27183024 . + . gene_id "XLOC_007380"; transcript_id "TCONS_00007380"; exon_number "1"; oId "CUFF.7470.1"; tss_id "TSS7380"; +chr6 Cufflinks exon 27188313 27188361 . + . gene_id "XLOC_007381"; transcript_id "TCONS_00007381"; exon_number "1"; oId "CUFF.7471.1"; tss_id "TSS7381"; +chr6 Cufflinks exon 27203288 27203360 . + . gene_id "XLOC_007382"; transcript_id "TCONS_00007382"; exon_number "1"; oId "CUFF.7474.1"; tss_id "TSS7382"; +chr6 Cufflinks exon 27228710 27228785 . + . gene_id "XLOC_007383"; transcript_id "TCONS_00007383"; exon_number "1"; oId "CUFF.7476.1"; tss_id "TSS7383"; +chr6 Cufflinks exon 27241739 27241813 . + . gene_id "XLOC_007384"; transcript_id "TCONS_00007384"; exon_number "1"; oId "CUFF.7477.1"; tss_id "TSS7384"; +chr6 Cufflinks exon 27251864 27251938 . + . gene_id "XLOC_007385"; transcript_id "TCONS_00007385"; exon_number "1"; oId "CUFF.7480.1"; tss_id "TSS7385"; +chr6 Cufflinks exon 27255283 27255357 . + . gene_id "XLOC_007386"; transcript_id "TCONS_00007386"; exon_number "1"; oId "CUFF.7481.1"; tss_id "TSS7386"; +chr6 Cufflinks exon 27258405 27258477 . + . gene_id "XLOC_007387"; transcript_id "TCONS_00007387"; exon_number "1"; oId "CUFF.7482.1"; tss_id "TSS7387"; +chr6 Cufflinks exon 27261671 27261743 . + . gene_id "XLOC_007388"; transcript_id "TCONS_00007388"; exon_number "1"; oId "CUFF.7483.1"; tss_id "TSS7388"; +chr6 Cufflinks exon 27263212 27263283 . + . gene_id "XLOC_007389"; transcript_id "TCONS_00007389"; exon_number "1"; oId "CUFF.7484.1"; tss_id "TSS7389"; +chr6 Cufflinks exon 27265775 27265856 . + . gene_id "XLOC_007390"; transcript_id "TCONS_00007390"; exon_number "1"; oId "CUFF.7485.1"; tss_id "TSS7390"; +chr6 Cufflinks exon 27446591 27446672 . + . gene_id "XLOC_007391"; transcript_id "TCONS_00007391"; exon_number "1"; oId "CUFF.7490.1"; tss_id "TSS7391"; +chr6 Cufflinks exon 27447453 27447524 . + . gene_id "XLOC_007392"; transcript_id "TCONS_00007392"; exon_number "1"; oId "CUFF.7491.1"; tss_id "TSS7392"; +chr6 Cufflinks exon 27463593 27463674 . + . gene_id "XLOC_007393"; transcript_id "TCONS_00007393"; exon_number "1"; oId "CUFF.7492.1"; tss_id "TSS7393"; +chr6 Cufflinks exon 27470818 27470899 . + . gene_id "XLOC_007394"; transcript_id "TCONS_00007394"; exon_number "1"; oId "CUFF.7493.1"; tss_id "TSS7394"; +chr6 Cufflinks exon 27471523 27471594 . + . gene_id "XLOC_007395"; transcript_id "TCONS_00007395"; exon_number "1"; oId "CUFF.7494.1"; tss_id "TSS7395"; +chr6 Cufflinks exon 27487308 27487379 . + . gene_id "XLOC_007396"; transcript_id "TCONS_00007396"; exon_number "1"; oId "CUFF.7496.1"; tss_id "TSS7396"; +chr6 Cufflinks exon 27500001 27500068 . + . gene_id "XLOC_007397"; transcript_id "TCONS_00007397"; exon_number "1"; oId "CUFF.7498.1"; tss_id "TSS7397"; +chr6 Cufflinks exon 27513468 27513549 . + . gene_id "XLOC_007398"; transcript_id "TCONS_00007398"; exon_number "1"; oId "CUFF.7500.1"; tss_id "TSS7398"; +chr6 Cufflinks exon 27515367 27515406 . + . gene_id "XLOC_007399"; transcript_id "TCONS_00007399"; exon_number "1"; oId "CUFF.7501.1"; tss_id "TSS7399"; +chr6 Cufflinks exon 27529963 27530050 . + . gene_id "XLOC_007400"; transcript_id "TCONS_00007400"; exon_number "1"; oId "CUFF.7504.1"; tss_id "TSS7400"; +chr6 Cufflinks exon 27543847 27543918 . + . gene_id "XLOC_007401"; transcript_id "TCONS_00007401"; exon_number "1"; oId "CUFF.7505.1"; tss_id "TSS7401"; +chr6 Cufflinks exon 27564191 27564296 . + . gene_id "XLOC_007402"; transcript_id "TCONS_00007402"; exon_number "1"; oId "CUFF.7510.1"; tss_id "TSS7402"; +chr6 Cufflinks exon 27586135 27586208 . + . gene_id "XLOC_007403"; transcript_id "TCONS_00007403"; exon_number "1"; oId "CUFF.7513.1"; tss_id "TSS7403"; +chr6 Cufflinks exon 27599200 27599293 . + . gene_id "XLOC_007404"; transcript_id "TCONS_00007404"; exon_number "1"; oId "CUFF.7514.1"; tss_id "TSS7404"; +chr6 Cufflinks exon 27632545 27632620 . + . gene_id "XLOC_007405"; transcript_id "TCONS_00007405"; exon_number "1"; oId "CUFF.7517.1"; tss_id "TSS7405"; +chr6 Cufflinks exon 27636362 27636436 . + . gene_id "XLOC_007406"; transcript_id "TCONS_00007406"; exon_number "1"; oId "CUFF.7518.1"; tss_id "TSS7406"; +chr6 Cufflinks exon 27648406 27648451 . + . gene_id "XLOC_007407"; transcript_id "TCONS_00007407"; exon_number "1"; oId "CUFF.7521.1"; tss_id "TSS7407"; +chr6 Cufflinks exon 27650489 27650563 . + . gene_id "XLOC_007408"; transcript_id "TCONS_00007408"; exon_number "1"; oId "CUFF.7523.1"; tss_id "TSS7408"; +chr6 Cufflinks exon 27653343 27653378 . + . gene_id "XLOC_007409"; transcript_id "TCONS_00007409"; exon_number "1"; oId "CUFF.7525.1"; tss_id "TSS7409"; +chr6 Cufflinks exon 27655967 27656040 . + . gene_id "XLOC_007410"; transcript_id "TCONS_00007410"; exon_number "1"; oId "CUFF.7526.1"; tss_id "TSS7410"; +chr6 Cufflinks exon 27694473 27694547 . + . gene_id "XLOC_007411"; transcript_id "TCONS_00007411"; exon_number "1"; oId "CUFF.7529.1"; tss_id "TSS7411"; +chr6 Cufflinks exon 27711535 27711609 . + . gene_id "XLOC_007412"; transcript_id "TCONS_00007412"; exon_number "1"; oId "CUFF.7531.1"; tss_id "TSS7412"; +chr6 Cufflinks exon 27729307 27729371 . + . gene_id "XLOC_007413"; transcript_id "TCONS_00007413"; exon_number "1"; oId "CUFF.7534.1"; tss_id "TSS7413"; +chr6 Cufflinks exon 27745664 27745735 . + . gene_id "XLOC_007414"; transcript_id "TCONS_00007414"; exon_number "1"; oId "CUFF.7536.1"; tss_id "TSS7414"; +chr6 Cufflinks exon 27763136 27763181 . + . gene_id "XLOC_007415"; transcript_id "TCONS_00007415"; exon_number "1"; oId "CUFF.7538.1"; tss_id "TSS7415"; +chr6 Cufflinks exon 27983346 27983551 . + . gene_id "XLOC_007416"; transcript_id "TCONS_00007416"; exon_number "1"; oId "CUFF.7543.1"; tss_id "TSS7416"; +chr6 Cufflinks exon 28111272 28111354 . + . gene_id "XLOC_007417"; transcript_id "TCONS_00007417"; exon_number "1"; oId "CUFF.7544.1"; tss_id "TSS7417"; +chr6 Cufflinks exon 28169812 28169873 . + . gene_id "XLOC_007418"; transcript_id "TCONS_00007418"; exon_number "1"; oId "CUFF.7546.1"; tss_id "TSS7418"; +chr6 Cufflinks exon 28180815 28180896 . + . gene_id "XLOC_007419"; transcript_id "TCONS_00007419"; exon_number "1"; oId "CUFF.7547.1"; tss_id "TSS7419"; +chr6 Cufflinks exon 28378047 28378081 . + . gene_id "XLOC_007420"; transcript_id "TCONS_00007420"; exon_number "1"; oId "CUFF.7548.1"; tss_id "TSS7420"; +chr6 Cufflinks exon 28448503 28448575 . + . gene_id "XLOC_007421"; transcript_id "TCONS_00007421"; exon_number "1"; oId "CUFF.7551.1"; tss_id "TSS7421"; +chr6 Cufflinks exon 28458604 28458668 . + . gene_id "XLOC_007422"; transcript_id "TCONS_00007422"; exon_number "1"; oId "CUFF.7554.1"; tss_id "TSS7422"; +chr6 Cufflinks exon 28505367 28505460 . + . gene_id "XLOC_007423"; transcript_id "TCONS_00007423"; exon_number "1"; oId "CUFF.7555.1"; tss_id "TSS7423"; +chr6 Cufflinks exon 28557156 28557227 . + . gene_id "XLOC_007424"; transcript_id "TCONS_00007424"; exon_number "1"; oId "CUFF.7557.1"; tss_id "TSS7424"; +chr6 Cufflinks exon 28574933 28575007 . + . gene_id "XLOC_007425"; transcript_id "TCONS_00007425"; exon_number "1"; oId "CUFF.7559.1"; tss_id "TSS7425"; +chr6 Cufflinks exon 28611222 28611293 . + . gene_id "XLOC_007426"; transcript_id "TCONS_00007426"; exon_number "1"; oId "CUFF.7562.1"; tss_id "TSS7426"; +chr6 Cufflinks exon 28678366 28678437 . + . gene_id "XLOC_007427"; transcript_id "TCONS_00007427"; exon_number "1"; oId "CUFF.7569.1"; tss_id "TSS7427"; +chr6 Cufflinks exon 28687481 28687552 . + . gene_id "XLOC_007428"; transcript_id "TCONS_00007428"; exon_number "1"; oId "CUFF.7570.1"; tss_id "TSS7428"; +chr6 Cufflinks exon 28693795 28693868 . + . gene_id "XLOC_007429"; transcript_id "TCONS_00007429"; exon_number "1"; oId "CUFF.7571.1"; tss_id "TSS7429"; +chr6 Cufflinks exon 28697092 28697163 . + . gene_id "XLOC_007430"; transcript_id "TCONS_00007430"; exon_number "1"; oId "CUFF.7573.1"; tss_id "TSS7430"; +chr6 Cufflinks exon 28715521 28715593 . + . gene_id "XLOC_007431"; transcript_id "TCONS_00007431"; exon_number "1"; oId "CUFF.7576.1"; tss_id "TSS7431"; +chr6 Cufflinks exon 28732164 28732232 . + . gene_id "XLOC_007432"; transcript_id "TCONS_00007432"; exon_number "1"; oId "CUFF.7579.1"; tss_id "TSS7432"; +chr6 Cufflinks exon 28764655 28764689 . + . gene_id "XLOC_007433"; transcript_id "TCONS_00007433"; exon_number "1"; oId "CUFF.7584.1"; tss_id "TSS7433"; +chr6 Cufflinks exon 28849165 28849239 . + . gene_id "XLOC_007434"; transcript_id "TCONS_00007434"; exon_number "1"; oId "CUFF.7594.1"; tss_id "TSS7434"; +chr6 Cufflinks exon 28883418 28883521 . + . gene_id "XLOC_007435"; transcript_id "TCONS_00007435"; exon_number "1"; oId "CUFF.7596.1"; tss_id "TSS7435"; +chr6 Cufflinks exon 28908830 28908935 . + . gene_id "XLOC_007436"; transcript_id "TCONS_00007436"; exon_number "1"; oId "CUFF.7597.1"; tss_id "TSS7436"; +chr6 Cufflinks exon 28912352 28912424 . + . gene_id "XLOC_007437"; transcript_id "TCONS_00007437"; exon_number "1"; oId "CUFF.7600.1"; tss_id "TSS7437"; +chr6 Cufflinks exon 28918806 28918878 . + . gene_id "XLOC_007438"; transcript_id "TCONS_00007438"; exon_number "1"; oId "CUFF.7601.1"; tss_id "TSS7438"; +chr6 Cufflinks exon 28945252 28945550 . + . gene_id "XLOC_007439"; transcript_id "TCONS_00007439"; exon_number "1"; oId "CUFF.7603.1"; tss_id "TSS7439"; +chr6 Cufflinks exon 28949976 28950047 . + . gene_id "XLOC_007440"; transcript_id "TCONS_00007440"; exon_number "1"; oId "CUFF.7605.1"; tss_id "TSS7440"; +chr6 Cufflinks exon 28956779 28956860 . + . gene_id "XLOC_007441"; transcript_id "TCONS_00007441"; exon_number "1"; oId "CUFF.7606.1"; tss_id "TSS7441"; +chr6 Cufflinks exon 29070525 29070568 . + . gene_id "XLOC_007442"; transcript_id "TCONS_00007442"; exon_number "1"; oId "CUFF.7607.1"; tss_id "TSS7442"; +chr6 Cufflinks exon 29422679 29422713 . + . gene_id "XLOC_007443"; transcript_id "TCONS_00007443"; exon_number "1"; oId "CUFF.7608.1"; tss_id "TSS7443"; +chr6 Cufflinks exon 30832027 30832270 . + . gene_id "XLOC_007444"; transcript_id "TCONS_00007444"; exon_number "1"; oId "CUFF.7611.1"; tss_id "TSS7444"; +chr6 Cufflinks exon 31050817 31050880 . + . gene_id "XLOC_007445"; transcript_id "TCONS_00007445"; exon_number "1"; oId "CUFF.7612.1"; tss_id "TSS7445"; +chr6 Cufflinks exon 31091985 31092027 . + . gene_id "XLOC_007446"; transcript_id "TCONS_00007446"; exon_number "1"; oId "CUFF.7613.1"; tss_id "TSS7446"; +chr6 Cufflinks exon 31193057 31193095 . + . gene_id "XLOC_007447"; transcript_id "TCONS_00007447"; exon_number "1"; oId "CUFF.7614.1"; tss_id "TSS7447"; +chr6 Cufflinks exon 31337911 31338017 . + . gene_id "XLOC_007448"; transcript_id "TCONS_00007448"; exon_number "1"; oId "CUFF.7615.1"; tss_id "TSS7448"; +chr6 Cufflinks exon 31443155 31443337 . + . gene_id "XLOC_007449"; transcript_id "TCONS_00007449"; exon_number "1"; oId "CUFF.7616.1"; tss_id "TSS7449"; +chr6 Cufflinks exon 32320654 32320754 . + . gene_id "XLOC_007450"; transcript_id "TCONS_00007450"; exon_number "1"; oId "CUFF.7619.1"; tss_id "TSS7450"; +chr6 Cufflinks exon 33439514 33439548 . + . gene_id "XLOC_007451"; transcript_id "TCONS_00007451"; exon_number "1"; oId "CUFF.7624.1"; tss_id "TSS7451"; +chr6 Cufflinks exon 33508471 33508787 . + . gene_id "XLOC_007452"; transcript_id "TCONS_00007452"; exon_number "1"; oId "CUFF.7625.1"; tss_id "TSS7452"; +chr6 Cufflinks exon 34650574 34650682 . + . gene_id "XLOC_007453"; transcript_id "TCONS_00007453"; exon_number "1"; oId "CUFF.7626.1"; tss_id "TSS7453"; +chr6 Cufflinks exon 34660556 34660663 . + . gene_id "XLOC_007454"; transcript_id "TCONS_00007454"; exon_number "1"; oId "CUFF.7628.1"; tss_id "TSS7454"; +chr6 Cufflinks exon 36461586 36461644 . + . gene_id "XLOC_007455"; transcript_id "TCONS_00007455"; exon_number "1"; oId "CUFF.7633.1"; tss_id "TSS7455"; +chr6 Cufflinks exon 36489968 36490281 . + . gene_id "XLOC_007456"; transcript_id "TCONS_00007456"; exon_number "1"; oId "CUFF.7634.1"; tss_id "TSS7456"; +chr6 Cufflinks exon 36532460 36532538 . + . gene_id "XLOC_007457"; transcript_id "TCONS_00007457"; exon_number "1"; oId "CUFF.7635.1"; tss_id "TSS7457"; +chr6 Cufflinks exon 37122217 37122244 . + . gene_id "XLOC_007458"; transcript_id "TCONS_00007458"; exon_number "1"; oId "CUFF.7638.1"; tss_id "TSS7458"; +chr6 Cufflinks exon 37222145 37222315 . + . gene_id "XLOC_007459"; transcript_id "TCONS_00007459"; exon_number "1"; oId "CUFF.7640.1"; tss_id "TSS7459"; +chr6 Cufflinks exon 37328961 37329277 . + . gene_id "XLOC_007460"; transcript_id "TCONS_00007460"; exon_number "1"; oId "CUFF.7642.1"; tss_id "TSS7460"; +chr6 Cufflinks exon 37354367 37354568 . + . gene_id "XLOC_007461"; transcript_id "TCONS_00007461"; exon_number "1"; oId "CUFF.7643.1"; tss_id "TSS7461"; +chr6 Cufflinks exon 37796923 37797021 . + . gene_id "XLOC_007462"; transcript_id "TCONS_00007462"; exon_number "1"; oId "CUFF.7644.1"; tss_id "TSS7462"; +chr6 Cufflinks exon 38113880 38113990 . + . gene_id "XLOC_007463"; transcript_id "TCONS_00007463"; exon_number "1"; oId "CUFF.7646.1"; tss_id "TSS7463"; +chr6 Cufflinks exon 38584259 38584304 . + . gene_id "XLOC_007464"; transcript_id "TCONS_00007464"; exon_number "1"; oId "CUFF.7647.1"; tss_id "TSS7464"; +chr6 Cufflinks exon 38592340 38592377 . + . gene_id "XLOC_007465"; transcript_id "TCONS_00007465"; exon_number "1"; oId "CUFF.7648.1"; tss_id "TSS7465"; +chr6 Cufflinks exon 38711862 38712181 . + . gene_id "XLOC_007466"; transcript_id "TCONS_00007466"; exon_number "1"; oId "CUFF.7649.1"; tss_id "TSS7466"; +chr6 Cufflinks exon 39049032 39049067 . + . gene_id "XLOC_007467"; transcript_id "TCONS_00007467"; exon_number "1"; oId "CUFF.7650.1"; tss_id "TSS7467"; +chr6 Cufflinks exon 40375593 40375690 . + . gene_id "XLOC_007468"; transcript_id "TCONS_00007468"; exon_number "1"; oId "CUFF.7653.1"; tss_id "TSS7468"; +chr6 Cufflinks exon 40753485 40753627 . + . gene_id "XLOC_007469"; transcript_id "TCONS_00007469"; exon_number "1"; oId "CUFF.7654.1"; tss_id "TSS7469"; +chr6 Cufflinks exon 42513330 42513369 . + . gene_id "XLOC_007470"; transcript_id "TCONS_00007470"; exon_number "1"; oId "CUFF.7661.1"; tss_id "TSS7470"; +chr6 Cufflinks exon 42555543 42555584 . + . gene_id "XLOC_007471"; transcript_id "TCONS_00007471"; exon_number "1"; oId "CUFF.7662.1"; tss_id "TSS7471"; +chr6 Cufflinks exon 42631900 42632034 . + . gene_id "XLOC_007472"; transcript_id "TCONS_00007472"; exon_number "1"; oId "CUFF.7664.1"; tss_id "TSS7472"; +chr6 Cufflinks exon 43070575 43070641 . + . gene_id "XLOC_007473"; transcript_id "TCONS_00007473"; exon_number "1"; oId "CUFF.7667.1"; tss_id "TSS7473"; +chr6 Cufflinks exon 43385832 43385918 . + . gene_id "XLOC_007474"; transcript_id "TCONS_00007474"; exon_number "1"; oId "CUFF.7668.1"; tss_id "TSS7474"; +chr6 Cufflinks exon 43441924 43442027 . + . gene_id "XLOC_007475"; transcript_id "TCONS_00007475"; exon_number "1"; oId "CUFF.7669.1"; tss_id "TSS7475"; +chr6 Cufflinks exon 43625576 43625663 . + . gene_id "XLOC_007476"; transcript_id "TCONS_00007476"; exon_number "1"; oId "CUFF.7671.1"; tss_id "TSS7476"; +chr6 Cufflinks exon 43720580 43720688 . + . gene_id "XLOC_007477"; transcript_id "TCONS_00007477"; exon_number "1"; oId "CUFF.7672.1"; tss_id "TSS7477"; +chr6 Cufflinks exon 44461413 44461445 . + . gene_id "XLOC_007478"; transcript_id "TCONS_00007478"; exon_number "1"; oId "CUFF.7674.1"; tss_id "TSS7478"; +chr6 Cufflinks exon 44911727 44911786 . + . gene_id "XLOC_007479"; transcript_id "TCONS_00007479"; exon_number "1"; oId "CUFF.7676.1"; tss_id "TSS7479"; +chr6 Cufflinks exon 44945281 44945356 . + . gene_id "XLOC_007480"; transcript_id "TCONS_00007480"; exon_number "1"; oId "CUFF.7677.1"; tss_id "TSS7480"; +chr6 Cufflinks exon 45117609 45117641 . + . gene_id "XLOC_007481"; transcript_id "TCONS_00007481"; exon_number "1"; oId "CUFF.7678.1"; tss_id "TSS7481"; +chr6 Cufflinks exon 45613841 45613907 . + . gene_id "XLOC_007482"; transcript_id "TCONS_00007482"; exon_number "1"; oId "CUFF.7679.1"; tss_id "TSS7482"; +chr6 Cufflinks exon 45745136 45745242 . + . gene_id "XLOC_007483"; transcript_id "TCONS_00007483"; exon_number "1"; oId "CUFF.7680.1"; tss_id "TSS7483"; +chr6 Cufflinks exon 45986482 45986587 . + . gene_id "XLOC_007484"; transcript_id "TCONS_00007484"; exon_number "1"; oId "CUFF.7681.1"; tss_id "TSS7484"; +chr6 Cufflinks exon 46072653 46072710 . + . gene_id "XLOC_007485"; transcript_id "TCONS_00007485"; exon_number "1"; oId "CUFF.7682.1"; tss_id "TSS7485"; +chr6 Cufflinks exon 46400552 46400588 . + . gene_id "XLOC_007486"; transcript_id "TCONS_00007486"; exon_number "1"; oId "CUFF.7683.1"; tss_id "TSS7486"; +chr6 Cufflinks exon 47683028 47683240 . + . gene_id "XLOC_007487"; transcript_id "TCONS_00007487"; exon_number "1"; oId "CUFF.7685.1"; tss_id "TSS7487"; +chr6 Cufflinks exon 47791126 47791289 . + . gene_id "XLOC_007488"; transcript_id "TCONS_00007488"; exon_number "1"; oId "CUFF.7686.1"; tss_id "TSS7488"; +chr6 Cufflinks exon 49305012 49305061 . + . gene_id "XLOC_007489"; transcript_id "TCONS_00007489"; exon_number "1"; oId "CUFF.7687.1"; tss_id "TSS7489"; +chr6 Cufflinks exon 49922922 49922958 . + . gene_id "XLOC_007490"; transcript_id "TCONS_00007490"; exon_number "1"; oId "CUFF.7689.1"; tss_id "TSS7490"; +chr6 Cufflinks exon 50086390 50086463 . + . gene_id "XLOC_007491"; transcript_id "TCONS_00007491"; exon_number "1"; oId "CUFF.7690.1"; tss_id "TSS7491"; +chr6 Cufflinks exon 51840470 51840781 . + . gene_id "XLOC_007492"; transcript_id "TCONS_00007492"; exon_number "1"; oId "CUFF.7693.1"; tss_id "TSS7492"; +chr6 Cufflinks exon 52860418 52860749 . + . gene_id "XLOC_007493"; transcript_id "TCONS_00007493"; exon_number "1"; oId "CUFF.7696.1"; tss_id "TSS7493"; +chr6 Cufflinks exon 52955759 52956073 . + . gene_id "XLOC_007494"; transcript_id "TCONS_00007494"; exon_number "1"; oId "CUFF.7697.1"; tss_id "TSS7494"; +chr6 Cufflinks exon 53084059 53084223 . + . gene_id "XLOC_007495"; transcript_id "TCONS_00007495"; exon_number "1"; oId "CUFF.7700.1"; tss_id "TSS7495"; +chr6 Cufflinks exon 54651185 54651289 . + . gene_id "XLOC_007496"; transcript_id "TCONS_00007496"; exon_number "1"; oId "CUFF.7703.1"; tss_id "TSS7496"; +chr6 Cufflinks exon 56187642 56187683 . + . gene_id "XLOC_007497"; transcript_id "TCONS_00007497"; exon_number "1"; oId "CUFF.7704.1"; tss_id "TSS7497"; +chr6 Cufflinks exon 56508573 56508606 . + . gene_id "XLOC_007498"; transcript_id "TCONS_00007498"; exon_number "1"; oId "CUFF.7705.1"; tss_id "TSS7498"; +chr6 Cufflinks exon 56810528 56810640 . + . gene_id "XLOC_007499"; transcript_id "TCONS_00007499"; exon_number "1"; oId "CUFF.7708.1"; tss_id "TSS7499"; +chr6 Cufflinks exon 57903066 57903286 . + . gene_id "XLOC_007500"; transcript_id "TCONS_00007500"; exon_number "1"; oId "CUFF.7711.1"; tss_id "TSS7500"; +chr6 Cufflinks exon 58149254 58149328 . + . gene_id "XLOC_007501"; transcript_id "TCONS_00007501"; exon_number "1"; oId "CUFF.7714.1"; tss_id "TSS7501"; +chr6 Cufflinks exon 58179285 58179346 . + . gene_id "XLOC_007502"; transcript_id "TCONS_00007502"; exon_number "1"; oId "CUFF.7722.1"; tss_id "TSS7502"; +chr6 Cufflinks exon 58507279 58507498 . + . gene_id "XLOC_007503"; transcript_id "TCONS_00007503"; exon_number "1"; oId "CUFF.7729.1"; tss_id "TSS7503"; +chr6 Cufflinks exon 58627657 58627768 . + . gene_id "XLOC_007504"; transcript_id "TCONS_00007504"; exon_number "1"; oId "CUFF.7730.1"; tss_id "TSS7504"; +chr6 Cufflinks exon 62088511 62088622 . + . gene_id "XLOC_007505"; transcript_id "TCONS_00007505"; exon_number "1"; oId "CUFF.7731.1"; tss_id "TSS7505"; +chr6 Cufflinks exon 66774990 66775079 . + . gene_id "XLOC_007506"; transcript_id "TCONS_00007506"; exon_number "1"; oId "CUFF.7733.1"; tss_id "TSS7506"; +chr6 Cufflinks exon 68256544 68256647 . + . gene_id "XLOC_007507"; transcript_id "TCONS_00007507"; exon_number "1"; oId "CUFF.7738.1"; tss_id "TSS7507"; +chr6 Cufflinks exon 69693255 69693298 . + . gene_id "XLOC_007508"; transcript_id "TCONS_00007508"; exon_number "1"; oId "CUFF.7741.1"; tss_id "TSS7508"; +chr6 Cufflinks exon 69914385 69914460 . + . gene_id "XLOC_007509"; transcript_id "TCONS_00007509"; exon_number "1"; oId "CUFF.7742.1"; tss_id "TSS7509"; +chr6 Cufflinks exon 71222997 71223056 . + . gene_id "XLOC_007510"; transcript_id "TCONS_00007510"; exon_number "1"; oId "CUFF.7745.1"; tss_id "TSS7510"; +chr6 Cufflinks exon 71892315 71892421 . + . gene_id "XLOC_007511"; transcript_id "TCONS_00007511"; exon_number "1"; oId "CUFF.7747.1"; tss_id "TSS7511"; +chr6 Cufflinks exon 73264878 73264998 . + . gene_id "XLOC_007512"; transcript_id "TCONS_00007512"; exon_number "1"; oId "CUFF.7750.1"; tss_id "TSS7512"; +chr6 Cufflinks exon 73549633 73549668 . + . gene_id "XLOC_007513"; transcript_id "TCONS_00007513"; exon_number "1"; oId "CUFF.7751.1"; tss_id "TSS7513"; +chr6 Cufflinks exon 74173796 74173900 . + . gene_id "XLOC_007514"; transcript_id "TCONS_00007514"; exon_number "1"; oId "CUFF.7754.1"; tss_id "TSS7514"; +chr6 Cufflinks exon 74185647 74185803 . + . gene_id "XLOC_007515"; transcript_id "TCONS_00007515"; exon_number "1"; oId "CUFF.7755.1"; tss_id "TSS7515"; +chr6 Cufflinks exon 74877802 74877856 . + . gene_id "XLOC_007516"; transcript_id "TCONS_00007516"; exon_number "1"; oId "CUFF.7757.1"; tss_id "TSS7516"; +chr6 Cufflinks exon 75698612 75698659 . + . gene_id "XLOC_007517"; transcript_id "TCONS_00007517"; exon_number "1"; oId "CUFF.7758.1"; tss_id "TSS7517"; +chr6 Cufflinks exon 76302771 76302831 . + . gene_id "XLOC_007518"; transcript_id "TCONS_00007518"; exon_number "1"; oId "CUFF.7762.1"; tss_id "TSS7518"; +chr6 Cufflinks exon 76353800 76353893 . + . gene_id "XLOC_007519"; transcript_id "TCONS_00007519"; exon_number "1"; oId "CUFF.7763.1"; tss_id "TSS7519"; +chr6 Cufflinks exon 76575680 76575786 . + . gene_id "XLOC_007520"; transcript_id "TCONS_00007520"; exon_number "1"; oId "CUFF.7767.1"; tss_id "TSS7520"; +chr6 Cufflinks exon 76802551 76802657 . + . gene_id "XLOC_007521"; transcript_id "TCONS_00007521"; exon_number "1"; oId "CUFF.7769.1"; tss_id "TSS7521"; +chr6 Cufflinks exon 80781685 80781777 . + . gene_id "XLOC_007522"; transcript_id "TCONS_00007522"; exon_number "1"; oId "CUFF.7774.1"; tss_id "TSS7522"; +chr6 Cufflinks exon 82260696 82260757 . + . gene_id "XLOC_007523"; transcript_id "TCONS_00007523"; exon_number "1"; oId "CUFF.7779.1"; tss_id "TSS7523"; +chr6 Cufflinks exon 82331918 82332016 . + . gene_id "XLOC_007524"; transcript_id "TCONS_00007524"; exon_number "1"; oId "CUFF.7780.1"; tss_id "TSS7524"; +chr6 Cufflinks exon 82641155 82641190 . + . gene_id "XLOC_007525"; transcript_id "TCONS_00007525"; exon_number "1"; oId "CUFF.7781.1"; tss_id "TSS7525"; +chr6 Cufflinks exon 83669394 83669437 . + . gene_id "XLOC_007526"; transcript_id "TCONS_00007526"; exon_number "1"; oId "CUFF.7784.1"; tss_id "TSS7526"; +chr6 Cufflinks exon 84992859 84992930 . + . gene_id "XLOC_007527"; transcript_id "TCONS_00007527"; exon_number "1"; oId "CUFF.7786.1"; tss_id "TSS7527"; +chr6 Cufflinks exon 85456432 85456492 . + . gene_id "XLOC_007528"; transcript_id "TCONS_00007528"; exon_number "1"; oId "CUFF.7787.1"; tss_id "TSS7528"; +chr6 Cufflinks exon 85822904 85822973 . + . gene_id "XLOC_007529"; transcript_id "TCONS_00007529"; exon_number "1"; oId "CUFF.7788.1"; tss_id "TSS7529"; +chr6 Cufflinks exon 86461299 86461371 . + . gene_id "XLOC_007530"; transcript_id "TCONS_00007530"; exon_number "1"; oId "CUFF.7790.1"; tss_id "TSS7530"; +chr6 Cufflinks exon 86844760 86844905 . + . gene_id "XLOC_007531"; transcript_id "TCONS_00007531"; exon_number "1"; oId "CUFF.7793.1"; tss_id "TSS7531"; +chr6 Cufflinks exon 87145567 87145862 . + . gene_id "XLOC_007532"; transcript_id "TCONS_00007532"; exon_number "1"; oId "CUFF.7794.1"; tss_id "TSS7532"; +chr6 Cufflinks exon 87792957 87793180 . + . gene_id "XLOC_007533"; transcript_id "TCONS_00007533"; exon_number "1"; oId "CUFF.7796.1"; tss_id "TSS7533"; +chr6 Cufflinks exon 88198163 88198267 . + . gene_id "XLOC_007534"; transcript_id "TCONS_00007534"; exon_number "1"; oId "CUFF.7797.1"; tss_id "TSS7534"; +chr6 Cufflinks exon 88400130 88400166 . + . gene_id "XLOC_007535"; transcript_id "TCONS_00007535"; exon_number "1"; oId "CUFF.7799.1"; tss_id "TSS7535"; +chr6 Cufflinks exon 88430632 88430739 . + . gene_id "XLOC_007536"; transcript_id "TCONS_00007536"; exon_number "1"; oId "CUFF.7800.1"; tss_id "TSS7536"; +chr6 Cufflinks exon 88555368 88555682 . + . gene_id "XLOC_007537"; transcript_id "TCONS_00007537"; exon_number "1"; oId "CUFF.7801.1"; tss_id "TSS7537"; +chr6 Cufflinks exon 89800665 89800981 . + . gene_id "XLOC_007538"; transcript_id "TCONS_00007538"; exon_number "1"; oId "CUFF.7806.1"; tss_id "TSS7538"; +chr6 Cufflinks exon 90066221 90066256 . + . gene_id "XLOC_007539"; transcript_id "TCONS_00007539"; exon_number "1"; oId "CUFF.7808.1"; tss_id "TSS7539"; +chr6 Cufflinks exon 90110252 90110304 . + . gene_id "XLOC_007540"; transcript_id "TCONS_00007540"; exon_number "1"; oId "CUFF.7809.1"; tss_id "TSS7540"; +chr6 Cufflinks exon 90187860 90188162 . + . gene_id "XLOC_007541"; transcript_id "TCONS_00007541"; exon_number "1"; oId "CUFF.7810.1"; tss_id "TSS7541"; +chr6 Cufflinks exon 90533013 90533118 . + . gene_id "XLOC_007542"; transcript_id "TCONS_00007542"; exon_number "1"; oId "CUFF.7811.1"; tss_id "TSS7542"; +chr6 Cufflinks exon 92449327 92449630 . + . gene_id "XLOC_007543"; transcript_id "TCONS_00007543"; exon_number "1"; oId "CUFF.7815.1"; tss_id "TSS7543"; +chr6 Cufflinks exon 92829141 92829349 . + . gene_id "XLOC_007544"; transcript_id "TCONS_00007544"; exon_number "1"; oId "CUFF.7816.1"; tss_id "TSS7544"; +chr6 Cufflinks exon 93500171 93500371 . + . gene_id "XLOC_007545"; transcript_id "TCONS_00007545"; exon_number "1"; oId "CUFF.7818.1"; tss_id "TSS7545"; +chr6 Cufflinks exon 95156910 95156981 . + . gene_id "XLOC_007546"; transcript_id "TCONS_00007546"; exon_number "1"; oId "CUFF.7820.1"; tss_id "TSS7546"; +chr6 Cufflinks exon 95166934 95166966 . + . gene_id "XLOC_007547"; transcript_id "TCONS_00007547"; exon_number "1"; oId "CUFF.7821.1"; tss_id "TSS7547"; +chr6 Cufflinks exon 96730447 96730752 . + . gene_id "XLOC_007548"; transcript_id "TCONS_00007548"; exon_number "1"; oId "CUFF.7823.1"; tss_id "TSS7548"; +chr6 Cufflinks exon 101272380 101272410 . + . gene_id "XLOC_007549"; transcript_id "TCONS_00007549"; exon_number "1"; oId "CUFF.7829.1"; tss_id "TSS7549"; +chr6 Cufflinks exon 101405035 101405141 . + . gene_id "XLOC_007550"; transcript_id "TCONS_00007550"; exon_number "1"; oId "CUFF.7830.1"; tss_id "TSS7550"; +chr6 Cufflinks exon 101959533 101959565 . + . gene_id "XLOC_007551"; transcript_id "TCONS_00007551"; exon_number "1"; oId "CUFF.7831.1"; tss_id "TSS7551"; +chr6 Cufflinks exon 101965266 101965303 . + . gene_id "XLOC_007552"; transcript_id "TCONS_00007552"; exon_number "1"; oId "CUFF.7832.1"; tss_id "TSS7552"; +chr6 Cufflinks exon 104289824 104289867 . + . gene_id "XLOC_007553"; transcript_id "TCONS_00007553"; exon_number "1"; oId "CUFF.7834.1"; tss_id "TSS7553"; +chr6 Cufflinks exon 104878750 104878783 . + . gene_id "XLOC_007554"; transcript_id "TCONS_00007554"; exon_number "1"; oId "CUFF.7836.1"; tss_id "TSS7554"; +chr6 Cufflinks exon 104991146 104991189 . + . gene_id "XLOC_007555"; transcript_id "TCONS_00007555"; exon_number "1"; oId "CUFF.7837.1"; tss_id "TSS7555"; +chr6 Cufflinks exon 105214697 105214766 . + . gene_id "XLOC_007556"; transcript_id "TCONS_00007556"; exon_number "1"; oId "CUFF.7838.1"; tss_id "TSS7556"; +chr6 Cufflinks exon 105771977 105772035 . + . gene_id "XLOC_007557"; transcript_id "TCONS_00007557"; exon_number "1"; oId "CUFF.7842.1"; tss_id "TSS7557"; +chr6 Cufflinks exon 105967764 105967826 . + . gene_id "XLOC_007558"; transcript_id "TCONS_00007558"; exon_number "1"; oId "CUFF.7845.1"; tss_id "TSS7558"; +chr6 Cufflinks exon 106352248 106352495 . + . gene_id "XLOC_007559"; transcript_id "TCONS_00007559"; exon_number "1"; oId "CUFF.7846.1"; tss_id "TSS7559"; +chr6 Cufflinks exon 106719509 106719577 . + . gene_id "XLOC_007560"; transcript_id "TCONS_00007560"; exon_number "1"; oId "CUFF.7848.1"; tss_id "TSS7560"; +chr6 Cufflinks exon 106752053 106752148 . + . gene_id "XLOC_007561"; transcript_id "TCONS_00007561"; exon_number "1"; oId "CUFF.7850.1"; tss_id "TSS7561"; +chr6 Cufflinks exon 106755686 106755716 . + . gene_id "XLOC_007562"; transcript_id "TCONS_00007562"; exon_number "1"; oId "CUFF.7851.1"; tss_id "TSS7562"; +chr6 Cufflinks exon 106897254 106897338 . + . gene_id "XLOC_007563"; transcript_id "TCONS_00007563"; exon_number "1"; oId "CUFF.7852.1"; tss_id "TSS7563"; +chr6 Cufflinks exon 107055593 107055690 . + . gene_id "XLOC_007564"; transcript_id "TCONS_00007564"; exon_number "1"; oId "CUFF.7853.1"; tss_id "TSS7564"; +chr6 Cufflinks exon 107398633 107398668 . + . gene_id "XLOC_007565"; transcript_id "TCONS_00007565"; exon_number "1"; oId "CUFF.7856.1"; tss_id "TSS7565"; +chr6 Cufflinks exon 107454276 107454350 . + . gene_id "XLOC_007566"; transcript_id "TCONS_00007566"; exon_number "1"; oId "CUFF.7857.1"; tss_id "TSS7566"; +chr6 Cufflinks exon 108251257 108251377 . + . gene_id "XLOC_007567"; transcript_id "TCONS_00007567"; exon_number "1"; oId "CUFF.7858.1"; tss_id "TSS7567"; +chr6 Cufflinks exon 108564659 108564765 . + . gene_id "XLOC_007568"; transcript_id "TCONS_00007568"; exon_number "1"; oId "CUFF.7860.1"; tss_id "TSS7568"; +chr6 Cufflinks exon 108573605 108573692 . + . gene_id "XLOC_007569"; transcript_id "TCONS_00007569"; exon_number "1"; oId "CUFF.7861.1"; tss_id "TSS7569"; +chr6 Cufflinks exon 108613970 108614073 . + . gene_id "XLOC_007570"; transcript_id "TCONS_00007570"; exon_number "1"; oId "CUFF.7863.1"; tss_id "TSS7570"; +chr6 Cufflinks exon 108614370 108614426 . + . gene_id "XLOC_007571"; transcript_id "TCONS_00007571"; exon_number "1"; oId "CUFF.7864.1"; tss_id "TSS7571"; +chr6 Cufflinks exon 108713277 108713352 . + . gene_id "XLOC_007572"; transcript_id "TCONS_00007572"; exon_number "1"; oId "CUFF.7865.1"; tss_id "TSS7572"; +chr6 Cufflinks exon 108720903 108720956 . + . gene_id "XLOC_007573"; transcript_id "TCONS_00007573"; exon_number "1"; oId "CUFF.7866.1"; tss_id "TSS7573"; +chr6 Cufflinks exon 108778293 108778351 . + . gene_id "XLOC_007574"; transcript_id "TCONS_00007574"; exon_number "1"; oId "CUFF.7867.1"; tss_id "TSS7574"; +chr6 Cufflinks exon 109339997 109340065 . + . gene_id "XLOC_007575"; transcript_id "TCONS_00007575"; exon_number "1"; oId "CUFF.7868.1"; tss_id "TSS7575"; +chr6 Cufflinks exon 110189889 110189975 . + . gene_id "XLOC_007576"; transcript_id "TCONS_00007576"; exon_number "1"; oId "CUFF.7875.1"; tss_id "TSS7576"; +chr6 Cufflinks exon 110456980 110457016 . + . gene_id "XLOC_007577"; transcript_id "TCONS_00007577"; exon_number "1"; oId "CUFF.7876.1"; tss_id "TSS7577"; +chr6 Cufflinks exon 110953403 110953437 . + . gene_id "XLOC_007578"; transcript_id "TCONS_00007578"; exon_number "1"; oId "CUFF.7878.1"; tss_id "TSS7578"; +chr6 Cufflinks exon 111045045 111045091 . + . gene_id "XLOC_007579"; transcript_id "TCONS_00007579"; exon_number "1"; oId "CUFF.7880.1"; tss_id "TSS7579"; +chr6 Cufflinks exon 111177634 111177722 . + . gene_id "XLOC_007580"; transcript_id "TCONS_00007580"; exon_number "1"; oId "CUFF.7881.1"; tss_id "TSS7580"; +chr6 Cufflinks exon 111284669 111284774 . + . gene_id "XLOC_007581"; transcript_id "TCONS_00007581"; exon_number "1"; oId "CUFF.7883.1"; tss_id "TSS7581"; +chr6 Cufflinks exon 111517865 111517940 . + . gene_id "XLOC_007582"; transcript_id "TCONS_00007582"; exon_number "1"; oId "CUFF.7886.1"; tss_id "TSS7582"; +chr6 Cufflinks exon 112797927 112798032 . + . gene_id "XLOC_007583"; transcript_id "TCONS_00007583"; exon_number "1"; oId "CUFF.7890.1"; tss_id "TSS7583"; +chr6 Cufflinks exon 112975200 112975364 . + . gene_id "XLOC_007584"; transcript_id "TCONS_00007584"; exon_number "1"; oId "CUFF.7891.1"; tss_id "TSS7584"; +chr6 Cufflinks exon 113292695 113292793 . + . gene_id "XLOC_007585"; transcript_id "TCONS_00007585"; exon_number "1"; oId "CUFF.7892.1"; tss_id "TSS7585"; +chr6 Cufflinks exon 113750026 113750061 . + . gene_id "XLOC_007586"; transcript_id "TCONS_00007586"; exon_number "1"; oId "CUFF.7893.1"; tss_id "TSS7586"; +chr6 Cufflinks exon 114162002 114162092 . + . gene_id "XLOC_007587"; transcript_id "TCONS_00007587"; exon_number "1"; oId "CUFF.7895.1"; tss_id "TSS7587"; +chr6 Cufflinks exon 114472447 114472714 . + . gene_id "XLOC_007588"; transcript_id "TCONS_00007588"; exon_number "1"; oId "CUFF.7896.1"; tss_id "TSS7588"; +chr6 Cufflinks exon 115934100 115934285 . + . gene_id "XLOC_007589"; transcript_id "TCONS_00007589"; exon_number "1"; oId "CUFF.7900.1"; tss_id "TSS7589"; +chr6 Cufflinks exon 117033545 117033586 . + . gene_id "XLOC_007590"; transcript_id "TCONS_00007590"; exon_number "1"; oId "CUFF.7902.1"; tss_id "TSS7590"; +chr6 Cufflinks exon 117381850 117381959 . + . gene_id "XLOC_007591"; transcript_id "TCONS_00007591"; exon_number "1"; oId "CUFF.7903.1"; tss_id "TSS7591"; +chr6 Cufflinks exon 117620529 117620726 . + . gene_id "XLOC_007592"; transcript_id "TCONS_00007592"; exon_number "1"; oId "CUFF.7904.1"; tss_id "TSS7592"; +chr6 Cufflinks exon 117622613 117622806 . + . gene_id "XLOC_007593"; transcript_id "TCONS_00007593"; exon_number "1"; oId "CUFF.7905.1"; tss_id "TSS7593"; +chr6 Cufflinks exon 119040000 119040034 . + . gene_id "XLOC_007594"; transcript_id "TCONS_00007594"; exon_number "1"; oId "CUFF.7908.1"; tss_id "TSS7594"; +chr6 Cufflinks exon 119648446 119648542 . + . gene_id "XLOC_007595"; transcript_id "TCONS_00007595"; exon_number "1"; oId "CUFF.7909.1"; tss_id "TSS7595"; +chr6 Cufflinks exon 120100901 120100939 . + . gene_id "XLOC_007596"; transcript_id "TCONS_00007596"; exon_number "1"; oId "CUFF.7910.1"; tss_id "TSS7596"; +chr6 Cufflinks exon 120583442 120583547 . + . gene_id "XLOC_007597"; transcript_id "TCONS_00007597"; exon_number "1"; oId "CUFF.7911.1"; tss_id "TSS7597"; +chr6 Cufflinks exon 121007767 121007858 . + . gene_id "XLOC_007598"; transcript_id "TCONS_00007598"; exon_number "1"; oId "CUFF.7913.1"; tss_id "TSS7598"; +chr6 Cufflinks exon 121675500 121675600 . + . gene_id "XLOC_007599"; transcript_id "TCONS_00007599"; exon_number "1"; oId "CUFF.7914.1"; tss_id "TSS7599"; +chr6 Cufflinks exon 121764763 121764805 . + . gene_id "XLOC_007600"; transcript_id "TCONS_00007600"; exon_number "1"; oId "CUFF.7915.1"; tss_id "TSS7600"; +chr6 Cufflinks exon 122532794 122532948 . + . gene_id "XLOC_007601"; transcript_id "TCONS_00007601"; exon_number "1"; oId "CUFF.7920.1"; tss_id "TSS7601"; +chr6 Cufflinks exon 123021704 123021777 . + . gene_id "XLOC_007602"; transcript_id "TCONS_00007602"; exon_number "1"; oId "CUFF.7922.1"; tss_id "TSS7602"; +chr6 Cufflinks exon 123066485 123066653 . + . gene_id "XLOC_007603"; transcript_id "TCONS_00007603"; exon_number "1"; oId "CUFF.7923.1"; tss_id "TSS7603"; +chr6 Cufflinks exon 124693527 124693611 . + . gene_id "XLOC_007604"; transcript_id "TCONS_00007604"; exon_number "1"; oId "CUFF.7924.1"; tss_id "TSS7604"; +chr6 Cufflinks exon 126196314 126196534 . + . gene_id "XLOC_007605"; transcript_id "TCONS_00007605"; exon_number "1"; oId "CUFF.7928.1"; tss_id "TSS7605"; +chr6 Cufflinks exon 128934345 128934455 . + . gene_id "XLOC_007606"; transcript_id "TCONS_00007606"; exon_number "1"; oId "CUFF.7933.1"; tss_id "TSS7606"; +chr6 Cufflinks exon 129011952 129012089 . + . gene_id "XLOC_007607"; transcript_id "TCONS_00007607"; exon_number "1"; oId "CUFF.7934.1"; tss_id "TSS7607"; +chr6 Cufflinks exon 129019784 129019870 . + . gene_id "XLOC_007608"; transcript_id "TCONS_00007608"; exon_number "1"; oId "CUFF.7935.1"; tss_id "TSS7608"; +chr6 Cufflinks exon 131178059 131178106 . + . gene_id "XLOC_007609"; transcript_id "TCONS_00007609"; exon_number "1"; oId "CUFF.7939.1"; tss_id "TSS7609"; +chr6 Cufflinks exon 131954665 131954700 . + . gene_id "XLOC_007610"; transcript_id "TCONS_00007610"; exon_number "1"; oId "CUFF.7941.1"; tss_id "TSS7610"; +chr6 Cufflinks exon 132055242 132055294 . + . gene_id "XLOC_007611"; transcript_id "TCONS_00007611"; exon_number "1"; oId "CUFF.7944.1"; tss_id "TSS7611"; +chr6 Cufflinks exon 132141474 132141712 . + . gene_id "XLOC_007612"; transcript_id "TCONS_00007612"; exon_number "1"; oId "CUFF.7945.1"; tss_id "TSS7612"; +chr6 Cufflinks exon 133593945 133594166 . + . gene_id "XLOC_007613"; transcript_id "TCONS_00007613"; exon_number "1"; oId "CUFF.7948.1"; tss_id "TSS7613"; +chr6 Cufflinks exon 134454711 134455027 . + . gene_id "XLOC_007614"; transcript_id "TCONS_00007614"; exon_number "1"; oId "CUFF.7950.1"; tss_id "TSS7614"; +chr6 Cufflinks exon 134578173 134578282 . + . gene_id "XLOC_007615"; transcript_id "TCONS_00007615"; exon_number "1"; oId "CUFF.7953.1"; tss_id "TSS7615"; +chr6 Cufflinks exon 134705878 134705942 . + . gene_id "XLOC_007616"; transcript_id "TCONS_00007616"; exon_number "1"; oId "CUFF.7954.1"; tss_id "TSS7616"; +chr6 Cufflinks exon 134995781 134996047 . + . gene_id "XLOC_007617"; transcript_id "TCONS_00007617"; exon_number "1"; oId "CUFF.7956.1"; tss_id "TSS7617"; +chr6 Cufflinks exon 136205453 136205517 . + . gene_id "XLOC_007618"; transcript_id "TCONS_00007618"; exon_number "1"; oId "CUFF.7960.1"; tss_id "TSS7618"; +chr6 Cufflinks exon 136866361 136866576 . + . gene_id "XLOC_007619"; transcript_id "TCONS_00007619"; exon_number "1"; oId "CUFF.7961.1"; tss_id "TSS7619"; +chr6 Cufflinks exon 136951378 136951466 . + . gene_id "XLOC_007620"; transcript_id "TCONS_00007620"; exon_number "1"; oId "CUFF.7962.1"; tss_id "TSS7620"; +chr6 Cufflinks exon 137358723 137358834 . + . gene_id "XLOC_007621"; transcript_id "TCONS_00007621"; exon_number "1"; oId "CUFF.7964.1"; tss_id "TSS7621"; +chr6 Cufflinks exon 137613662 137613712 . + . gene_id "XLOC_007622"; transcript_id "TCONS_00007622"; exon_number "1"; oId "CUFF.7965.1"; tss_id "TSS7622"; +chr6 Cufflinks exon 137627146 137627187 . + . gene_id "XLOC_007623"; transcript_id "TCONS_00007623"; exon_number "1"; oId "CUFF.7966.1"; tss_id "TSS7623"; +chr6 Cufflinks exon 138473464 138473499 . + . gene_id "XLOC_007624"; transcript_id "TCONS_00007624"; exon_number "1"; oId "CUFF.7968.1"; tss_id "TSS7624"; +chr6 Cufflinks exon 138698053 138698094 . + . gene_id "XLOC_007625"; transcript_id "TCONS_00007625"; exon_number "1"; oId "CUFF.7969.1"; tss_id "TSS7625"; +chr6 Cufflinks exon 142578776 142578849 . + . gene_id "XLOC_007626"; transcript_id "TCONS_00007626"; exon_number "1"; oId "CUFF.7979.1"; tss_id "TSS7626"; +chr6 Cufflinks exon 143770946 143771024 . + . gene_id "XLOC_007627"; transcript_id "TCONS_00007627"; exon_number "1"; oId "CUFF.7982.1"; tss_id "TSS7627"; +chr6 Cufflinks exon 143814230 143814264 . + . gene_id "XLOC_007628"; transcript_id "TCONS_00007628"; exon_number "1"; oId "CUFF.7983.1"; tss_id "TSS7628"; +chr6 Cufflinks exon 144202883 144202941 . + . gene_id "XLOC_007629"; transcript_id "TCONS_00007629"; exon_number "1"; oId "CUFF.7984.1"; tss_id "TSS7629"; +chr6 Cufflinks exon 144537684 144537766 . + . gene_id "XLOC_007630"; transcript_id "TCONS_00007630"; exon_number "1"; oId "CUFF.7985.1"; tss_id "TSS7630"; +chr6 Cufflinks exon 145503859 145503930 . + . gene_id "XLOC_007631"; transcript_id "TCONS_00007631"; exon_number "1"; oId "CUFF.7987.1"; tss_id "TSS7631"; +chr6 Cufflinks exon 146661562 146661645 . + . gene_id "XLOC_007632"; transcript_id "TCONS_00007632"; exon_number "1"; oId "CUFF.7989.1"; tss_id "TSS7632"; +chr6 Cufflinks exon 146960836 146960959 . + . gene_id "XLOC_007633"; transcript_id "TCONS_00007633"; exon_number "1"; oId "CUFF.7990.1"; tss_id "TSS7633"; +chr6 Cufflinks exon 147965879 147965923 . + . gene_id "XLOC_007634"; transcript_id "TCONS_00007634"; exon_number "1"; oId "CUFF.7991.1"; tss_id "TSS7634"; +chr6 Cufflinks exon 148207845 148207911 . + . gene_id "XLOC_007635"; transcript_id "TCONS_00007635"; exon_number "1"; oId "CUFF.7992.1"; tss_id "TSS7635"; +chr6 Cufflinks exon 148599810 148599914 . + . gene_id "XLOC_007636"; transcript_id "TCONS_00007636"; exon_number "1"; oId "CUFF.7993.1"; tss_id "TSS7636"; +chr6 Cufflinks exon 149295870 149295906 . + . gene_id "XLOC_007637"; transcript_id "TCONS_00007637"; exon_number "1"; oId "CUFF.7994.1"; tss_id "TSS7637"; +chr6 Cufflinks exon 149612488 149612705 . + . gene_id "XLOC_007638"; transcript_id "TCONS_00007638"; exon_number "1"; oId "CUFF.7996.1"; tss_id "TSS7638"; +chr6 Cufflinks exon 149838093 149838152 . + . gene_id "XLOC_007639"; transcript_id "TCONS_00007639"; exon_number "1"; oId "CUFF.7997.1"; tss_id "TSS7639"; +chr6 Cufflinks exon 150485719 150485825 . + . gene_id "XLOC_007640"; transcript_id "TCONS_00007640"; exon_number "1"; oId "CUFF.7998.1"; tss_id "TSS7640"; +chr6 Cufflinks exon 150665154 150665281 . + . gene_id "XLOC_007641"; transcript_id "TCONS_00007641"; exon_number "1"; oId "CUFF.8000.1"; tss_id "TSS7641"; +chr6 Cufflinks exon 151260358 151260458 . + . gene_id "XLOC_007642"; transcript_id "TCONS_00007642"; exon_number "1"; oId "CUFF.8001.1"; tss_id "TSS7642"; +chr6 Cufflinks exon 151522476 151522580 . + . gene_id "XLOC_007643"; transcript_id "TCONS_00007643"; exon_number "1"; oId "CUFF.8002.1"; tss_id "TSS7643"; +chr6 Cufflinks exon 151640798 151641021 . + . gene_id "XLOC_007644"; transcript_id "TCONS_00007644"; exon_number "1"; oId "CUFF.8004.1"; tss_id "TSS7644"; +chr6 Cufflinks exon 152230275 152230345 . + . gene_id "XLOC_007645"; transcript_id "TCONS_00007645"; exon_number "1"; oId "CUFF.8008.1"; tss_id "TSS7645"; +chr6 Cufflinks exon 152731410 152731531 . + . gene_id "XLOC_007646"; transcript_id "TCONS_00007646"; exon_number "1"; oId "CUFF.8010.1"; tss_id "TSS7646"; +chr6 Cufflinks exon 153590378 153590419 . + . gene_id "XLOC_007647"; transcript_id "TCONS_00007647"; exon_number "1"; oId "CUFF.8015.1"; tss_id "TSS7647"; +chr6 Cufflinks exon 153741576 153741661 . + . gene_id "XLOC_007648"; transcript_id "TCONS_00007648"; exon_number "1"; oId "CUFF.8016.1"; tss_id "TSS7648"; +chr6 Cufflinks exon 154002585 154002688 . + . gene_id "XLOC_007649"; transcript_id "TCONS_00007649"; exon_number "1"; oId "CUFF.8019.1"; tss_id "TSS7649"; +chr6 Cufflinks exon 158034698 158034741 . + . gene_id "XLOC_007650"; transcript_id "TCONS_00007650"; exon_number "1"; oId "CUFF.8029.1"; tss_id "TSS7650"; +chr6 Cufflinks exon 158355200 158355289 . + . gene_id "XLOC_007651"; transcript_id "TCONS_00007651"; exon_number "1"; oId "CUFF.8032.1"; tss_id "TSS7651"; +chr6 Cufflinks exon 158858829 158859139 . + . gene_id "XLOC_007652"; transcript_id "TCONS_00007652"; exon_number "1"; oId "CUFF.8034.1"; tss_id "TSS7652"; +chr6 Cufflinks exon 159889221 159889257 . + . gene_id "XLOC_007653"; transcript_id "TCONS_00007653"; exon_number "1"; oId "CUFF.8035.1"; tss_id "TSS7653"; +chr6 Cufflinks exon 163647941 163648034 . + . gene_id "XLOC_007654"; transcript_id "TCONS_00007654"; exon_number "1"; oId "CUFF.8042.1"; tss_id "TSS7654"; +chr6 Cufflinks exon 164261593 164261893 . + . gene_id "XLOC_007655"; transcript_id "TCONS_00007655"; exon_number "1"; oId "CUFF.8045.1"; tss_id "TSS7655"; +chr6 Cufflinks exon 165032493 165032571 . + . gene_id "XLOC_007656"; transcript_id "TCONS_00007656"; exon_number "1"; oId "CUFF.8047.1"; tss_id "TSS7656"; +chr6 Cufflinks exon 165823051 165823140 . + . gene_id "XLOC_007657"; transcript_id "TCONS_00007657"; exon_number "1"; oId "CUFF.8048.1"; tss_id "TSS7657"; +chr6 Cufflinks exon 166622895 166622994 . + . gene_id "XLOC_007658"; transcript_id "TCONS_00007658"; exon_number "1"; oId "CUFF.8051.1"; tss_id "TSS7658"; +chr6 Cufflinks exon 168820071 168820104 . + . gene_id "XLOC_007659"; transcript_id "TCONS_00007659"; exon_number "1"; oId "CUFF.8053.1"; tss_id "TSS7659"; +chr6 Cufflinks exon 170709406 170709518 . + . gene_id "XLOC_007660"; transcript_id "TCONS_00007660"; exon_number "1"; oId "CUFF.8055.1"; tss_id "TSS7660"; +chr6 Cufflinks exon 480547 480584 . - . gene_id "XLOC_007661"; transcript_id "TCONS_00007661"; exon_number "1"; oId "CUFF.7284.1"; tss_id "TSS7661"; +chr6 Cufflinks exon 897046 897102 . - . gene_id "XLOC_007662"; transcript_id "TCONS_00007662"; exon_number "1"; oId "CUFF.7285.1"; tss_id "TSS7662"; +chr6 Cufflinks exon 3080073 3080131 . - . gene_id "XLOC_007663"; transcript_id "TCONS_00007663"; exon_number "1"; oId "CUFF.7290.1"; tss_id "TSS7663"; +chr6 Cufflinks exon 3088954 3089043 . - . gene_id "XLOC_007664"; transcript_id "TCONS_00007664"; exon_number "1"; oId "CUFF.7291.1"; tss_id "TSS7664"; +chr6 Cufflinks exon 4228700 4228756 . - . gene_id "XLOC_007665"; transcript_id "TCONS_00007665"; exon_number "1"; oId "CUFF.7293.1"; tss_id "TSS7665"; +chr6 Cufflinks exon 4272825 4272896 . - . gene_id "XLOC_007666"; transcript_id "TCONS_00007666"; exon_number "1"; oId "CUFF.7294.1"; tss_id "TSS7666"; +chr6 Cufflinks exon 4436501 4436541 . - . gene_id "XLOC_007667"; transcript_id "TCONS_00007667"; exon_number "1"; oId "CUFF.7296.1"; tss_id "TSS7667"; +chr6 Cufflinks exon 4721529 4721584 . - . gene_id "XLOC_007668"; transcript_id "TCONS_00007668"; exon_number "1"; oId "CUFF.7299.1"; tss_id "TSS7668"; +chr6 Cufflinks exon 4901099 4901162 . - . gene_id "XLOC_007669"; transcript_id "TCONS_00007669"; exon_number "1"; oId "CUFF.7300.1"; tss_id "TSS7669"; +chr6 Cufflinks exon 5394428 5394465 . - . gene_id "XLOC_007670"; transcript_id "TCONS_00007670"; exon_number "1"; oId "CUFF.7301.1"; tss_id "TSS7670"; +chr6 Cufflinks exon 5830714 5830755 . - . gene_id "XLOC_007671"; transcript_id "TCONS_00007671"; exon_number "1"; oId "CUFF.7302.1"; tss_id "TSS7671"; +chr6 Cufflinks exon 5918778 5919075 . - . gene_id "XLOC_007672"; transcript_id "TCONS_00007672"; exon_number "1"; oId "CUFF.7303.1"; tss_id "TSS7672"; +chr6 Cufflinks exon 6938821 6939126 . - . gene_id "XLOC_007673"; transcript_id "TCONS_00007673"; exon_number "1"; oId "CUFF.7306.1"; tss_id "TSS7673"; +chr6 Cufflinks exon 7040690 7040777 . - . gene_id "XLOC_007674"; transcript_id "TCONS_00007674"; exon_number "1"; oId "CUFF.7307.1"; tss_id "TSS7674"; +chr6 Cufflinks exon 7055485 7055535 . - . gene_id "XLOC_007675"; transcript_id "TCONS_00007675"; exon_number "1"; oId "CUFF.7308.1"; tss_id "TSS7675"; +chr6 Cufflinks exon 9012613 9012662 . - . gene_id "XLOC_007676"; transcript_id "TCONS_00007676"; exon_number "1"; oId "CUFF.7310.1"; tss_id "TSS7676"; +chr6 Cufflinks exon 10753022 10753159 . - . gene_id "XLOC_007677"; transcript_id "TCONS_00007677"; exon_number "1"; oId "CUFF.7314.1"; tss_id "TSS7677"; +chr6 Cufflinks exon 11503741 11503904 . - . gene_id "XLOC_007678"; transcript_id "TCONS_00007678"; exon_number "1"; oId "CUFF.7316.1"; tss_id "TSS7678"; +chr6 Cufflinks exon 11800656 11800737 . - . gene_id "XLOC_007679"; transcript_id "TCONS_00007679"; exon_number "1"; oId "CUFF.7318.1"; tss_id "TSS7679"; +chr6 Cufflinks exon 12406718 12407013 . - . gene_id "XLOC_007680"; transcript_id "TCONS_00007680"; exon_number "1"; oId "CUFF.7320.1"; tss_id "TSS7680"; +chr6 Cufflinks exon 14404513 14404554 . - . gene_id "XLOC_007681"; transcript_id "TCONS_00007681"; exon_number "1"; oId "CUFF.7329.1"; tss_id "TSS7681"; +chr6 Cufflinks exon 14583745 14583809 . - . gene_id "XLOC_007682"; transcript_id "TCONS_00007682"; exon_number "1"; oId "CUFF.7330.1"; tss_id "TSS7682"; +chr6 Cufflinks exon 15035319 15035391 . - . gene_id "XLOC_007683"; transcript_id "TCONS_00007683"; exon_number "1"; oId "CUFF.7333.1"; tss_id "TSS7683"; +chr6 Cufflinks exon 15147316 15147397 . - . gene_id "XLOC_007684"; transcript_id "TCONS_00007684"; exon_number "1"; oId "CUFF.7335.1"; tss_id "TSS7684"; +chr6 Cufflinks exon 15324601 15324703 . - . gene_id "XLOC_007685"; transcript_id "TCONS_00007685"; exon_number "1"; oId "CUFF.7337.1"; tss_id "TSS7685"; +chr6 Cufflinks exon 15522463 15522531 . - . gene_id "XLOC_007686"; transcript_id "TCONS_00007686"; exon_number "1"; oId "CUFF.7338.1"; tss_id "TSS7686"; +chr6 Cufflinks exon 15847723 15847792 . - . gene_id "XLOC_007687"; transcript_id "TCONS_00007687"; exon_number "1"; oId "CUFF.7339.1"; tss_id "TSS7687"; +chr6 Cufflinks exon 16148603 16148676 . - . gene_id "XLOC_007688"; transcript_id "TCONS_00007688"; exon_number "1"; oId "CUFF.7341.1"; tss_id "TSS7688"; +chr6 Cufflinks exon 16154429 16154489 . - . gene_id "XLOC_007689"; transcript_id "TCONS_00007689"; exon_number "1"; oId "CUFF.7342.1"; tss_id "TSS7689"; +chr6 Cufflinks exon 16425489 16425551 . - . gene_id "XLOC_007690"; transcript_id "TCONS_00007690"; exon_number "1"; oId "CUFF.7344.1"; tss_id "TSS7690"; +chr6 Cufflinks exon 17225236 17225346 . - . gene_id "XLOC_007691"; transcript_id "TCONS_00007691"; exon_number "1"; oId "CUFF.7346.1"; tss_id "TSS7691"; +chr6 Cufflinks exon 17501505 17501540 . - . gene_id "XLOC_007692"; transcript_id "TCONS_00007692"; exon_number "1"; oId "CUFF.7347.1"; tss_id "TSS7692"; +chr6 Cufflinks exon 17722016 17722129 . - . gene_id "XLOC_007693"; transcript_id "TCONS_00007693"; exon_number "1"; oId "CUFF.7349.1"; tss_id "TSS7693"; +chr6 Cufflinks exon 17731091 17731153 . - . gene_id "XLOC_007694"; transcript_id "TCONS_00007694"; exon_number "1"; oId "CUFF.7350.1"; tss_id "TSS7694"; +chr6 Cufflinks exon 18096080 18096140 . - . gene_id "XLOC_007695"; transcript_id "TCONS_00007695"; exon_number "1"; oId "CUFF.7353.1"; tss_id "TSS7695"; +chr6 Cufflinks exon 18307206 18307309 . - . gene_id "XLOC_007696"; transcript_id "TCONS_00007696"; exon_number "1"; oId "CUFF.7354.1"; tss_id "TSS7696"; +chr6 Cufflinks exon 18402179 18402284 . - . gene_id "XLOC_007697"; transcript_id "TCONS_00007697"; exon_number "1"; oId "CUFF.7355.1"; tss_id "TSS7697"; +chr6 Cufflinks exon 19642657 19642760 . - . gene_id "XLOC_007698"; transcript_id "TCONS_00007698"; exon_number "1"; oId "CUFF.7359.1"; tss_id "TSS7698"; +chr6 Cufflinks exon 20421918 20422118 . - . gene_id "XLOC_007699"; transcript_id "TCONS_00007699"; exon_number "1"; oId "CUFF.7363.1"; tss_id "TSS7699"; +chr6 Cufflinks exon 20452606 20452704 . - . gene_id "XLOC_007700"; transcript_id "TCONS_00007700"; exon_number "1"; oId "CUFF.7364.1"; tss_id "TSS7700"; +chr6 Cufflinks exon 20484646 20484680 . - . gene_id "XLOC_007701"; transcript_id "TCONS_00007701"; exon_number "1"; oId "CUFF.7365.1"; tss_id "TSS7701"; +chr6 Cufflinks exon 20622923 20622957 . - . gene_id "XLOC_007702"; transcript_id "TCONS_00007702"; exon_number "1"; oId "CUFF.7366.1"; tss_id "TSS7702"; +chr6 Cufflinks exon 20993739 20993799 . - . gene_id "XLOC_007703"; transcript_id "TCONS_00007703"; exon_number "1"; oId "CUFF.7367.1"; tss_id "TSS7703"; +chr6 Cufflinks exon 22691317 22691455 . - . gene_id "XLOC_007704"; transcript_id "TCONS_00007704"; exon_number "1"; oId "CUFF.7370.1"; tss_id "TSS7704"; +chr6 Cufflinks exon 22948194 22948350 . - . gene_id "XLOC_007705"; transcript_id "TCONS_00007705"; exon_number "1"; oId "CUFF.7371.1"; tss_id "TSS7705"; +chr6 Cufflinks exon 23008012 23008100 . - . gene_id "XLOC_007706"; transcript_id "TCONS_00007706"; exon_number "1"; oId "CUFF.7372.1"; tss_id "TSS7706"; +chr6 Cufflinks exon 23125209 23125315 . - . gene_id "XLOC_007707"; transcript_id "TCONS_00007707"; exon_number "1"; oId "CUFF.7374.1"; tss_id "TSS7707"; +chr6 Cufflinks exon 24110377 24110412 . - . gene_id "XLOC_007708"; transcript_id "TCONS_00007708"; exon_number "1"; oId "CUFF.7375.1"; tss_id "TSS7708"; +chr6 Cufflinks exon 24468955 24469019 . - . gene_id "XLOC_007709"; transcript_id "TCONS_00007709"; exon_number "1"; oId "CUFF.7377.1"; tss_id "TSS7709"; +chr6 Cufflinks exon 24581380 24581441 . - . gene_id "XLOC_007710"; transcript_id "TCONS_00007710"; exon_number "1"; oId "CUFF.7379.1"; tss_id "TSS7710"; +chr6 Cufflinks exon 25031226 25031510 . - . gene_id "XLOC_007711"; transcript_id "TCONS_00007711"; exon_number "1"; oId "CUFF.7380.1"; tss_id "TSS7711"; +chr6 Cufflinks exon 25116829 25116864 . - . gene_id "XLOC_007712"; transcript_id "TCONS_00007712"; exon_number "1"; oId "CUFF.7381.1"; tss_id "TSS7712"; +chr6 Cufflinks exon 26305717 26305798 . - . gene_id "XLOC_007713"; transcript_id "TCONS_00007713"; exon_number "1"; oId "CUFF.7390.1"; tss_id "TSS7713"; +chr6 Cufflinks exon 26309866 26309926 . - . gene_id "XLOC_007714"; transcript_id "TCONS_00007714"; exon_number "1"; oId "CUFF.7391.1"; tss_id "TSS7714"; +chr6 Cufflinks exon 26311000 26311071 . - . gene_id "XLOC_007715"; transcript_id "TCONS_00007715"; exon_number "1"; oId "CUFF.7392.1"; tss_id "TSS7715"; +chr6 Cufflinks exon 26311424 26311495 . - . gene_id "XLOC_007716"; transcript_id "TCONS_00007716"; exon_number "1"; oId "CUFF.7393.1"; tss_id "TSS7716"; +chr6 Cufflinks exon 26311975 26312046 . - . gene_id "XLOC_007717"; transcript_id "TCONS_00007717"; exon_number "1"; oId "CUFF.7394.1"; tss_id "TSS7717"; +chr6 Cufflinks exon 26312824 26312905 . - . gene_id "XLOC_007718"; transcript_id "TCONS_00007718"; exon_number "1"; oId "CUFF.7395.1"; tss_id "TSS7718"; +chr6 Cufflinks exon 26313352 26313423 . - . gene_id "XLOC_007719"; transcript_id "TCONS_00007719"; exon_number "1"; oId "CUFF.7396.1"; tss_id "TSS7719"; +chr6 Cufflinks exon 26313873 26313925 . - . gene_id "XLOC_007720"; transcript_id "TCONS_00007720"; exon_number "1"; oId "CUFF.7397.1"; tss_id "TSS7720"; +chr6 Cufflinks exon 26319330 26319401 . - . gene_id "XLOC_007721"; transcript_id "TCONS_00007721"; exon_number "1"; oId "CUFF.7398.1"; tss_id "TSS7721"; +chr6 Cufflinks exon 26330529 26330600 . - . gene_id "XLOC_007722"; transcript_id "TCONS_00007722"; exon_number "1"; oId "CUFF.7402.1"; tss_id "TSS7722"; +chr6 Cufflinks exon 26331669 26331743 . - . gene_id "XLOC_007723"; transcript_id "TCONS_00007723"; exon_number "1"; oId "CUFF.7403.1"; tss_id "TSS7723"; +chr6 Cufflinks exon 26353199 26353263 . - . gene_id "XLOC_007724"; transcript_id "TCONS_00007724"; exon_number "1"; oId "CUFF.7404.1"; tss_id "TSS7724"; +chr6 Cufflinks exon 26359031 26359086 . - . gene_id "XLOC_007725"; transcript_id "TCONS_00007725"; exon_number "1"; oId "CUFF.7405.1"; tss_id "TSS7725"; +chr6 Cufflinks exon 26519587 26519686 . - . gene_id "XLOC_007726"; transcript_id "TCONS_00007726"; exon_number "1"; oId "CUFF.7407.1"; tss_id "TSS7726"; +chr6 Cufflinks exon 26533145 26533218 . - . gene_id "XLOC_007727"; transcript_id "TCONS_00007727"; exon_number "1"; oId "CUFF.7409.1"; tss_id "TSS7727"; +chr6 Cufflinks exon 26552704 26552773 . - . gene_id "XLOC_007728"; transcript_id "TCONS_00007728"; exon_number "1"; oId "CUFF.7412.1"; tss_id "TSS7728"; +chr6 Cufflinks exon 26572092 26572164 . - . gene_id "XLOC_007729"; transcript_id "TCONS_00007729"; exon_number "1"; oId "CUFF.7419.1"; tss_id "TSS7729"; +chr6 Cufflinks exon 26603277 26603337 . - . gene_id "XLOC_007730"; transcript_id "TCONS_00007730"; exon_number "1"; oId "CUFF.7423.1"; tss_id "TSS7730"; +chr6 Cufflinks exon 26622777 26622817 . - . gene_id "XLOC_007731"; transcript_id "TCONS_00007731"; exon_number "1"; oId "CUFF.7425.1"; tss_id "TSS7731"; +chr6 Cufflinks exon 26690911 26690978 . - . gene_id "XLOC_007732"; transcript_id "TCONS_00007732"; exon_number "1"; oId "CUFF.7430.1"; tss_id "TSS7732"; +chr6 Cufflinks exon 26721220 26721294 . - . gene_id "XLOC_007733"; transcript_id "TCONS_00007733"; exon_number "1"; oId "CUFF.7438.1"; tss_id "TSS7733"; +chr6 Cufflinks exon 26722703 26722745 . - . gene_id "XLOC_007734"; transcript_id "TCONS_00007734"; exon_number "1"; oId "CUFF.7439.1"; tss_id "TSS7734"; +chr6 Cufflinks exon 26735574 26735646 . - . gene_id "XLOC_007735"; transcript_id "TCONS_00007735"; exon_number "1"; oId "CUFF.7442.1"; tss_id "TSS7735"; +chr6 Cufflinks exon 26745255 26745328 . - . gene_id "XLOC_007736"; transcript_id "TCONS_00007736"; exon_number "1"; oId "CUFF.7443.1"; tss_id "TSS7736"; +chr6 Cufflinks exon 26746729 26746764 . - . gene_id "XLOC_007737"; transcript_id "TCONS_00007737"; exon_number "1"; oId "CUFF.7444.1"; tss_id "TSS7737"; +chr6 Cufflinks exon 26758550 26758622 . - . gene_id "XLOC_007738"; transcript_id "TCONS_00007738"; exon_number "1"; oId "CUFF.7447.1"; tss_id "TSS7738"; +chr6 Cufflinks exon 26771290 26771362 . - . gene_id "XLOC_007739"; transcript_id "TCONS_00007739"; exon_number "1"; oId "CUFF.7449.1"; tss_id "TSS7739"; +chr6 Cufflinks exon 26773771 26773843 . - . gene_id "XLOC_007740"; transcript_id "TCONS_00007740"; exon_number "1"; oId "CUFF.7450.1"; tss_id "TSS7740"; +chr6 Cufflinks exon 26783928 26784001 . - . gene_id "XLOC_007741"; transcript_id "TCONS_00007741"; exon_number "1"; oId "CUFF.7453.1"; tss_id "TSS7741"; +chr6 Cufflinks exon 26788156 26788228 . - . gene_id "XLOC_007742"; transcript_id "TCONS_00007742"; exon_number "1"; oId "CUFF.7454.1"; tss_id "TSS7742"; +chr6 Cufflinks exon 26791419 26791492 . - . gene_id "XLOC_007743"; transcript_id "TCONS_00007743"; exon_number "1"; oId "CUFF.7455.1"; tss_id "TSS7743"; +chr6 Cufflinks exon 26796006 26796078 . - . gene_id "XLOC_007744"; transcript_id "TCONS_00007744"; exon_number "1"; oId "CUFF.7456.1"; tss_id "TSS7744"; +chr6 Cufflinks exon 26836862 26836927 . - . gene_id "XLOC_007745"; transcript_id "TCONS_00007745"; exon_number "1"; oId "CUFF.7457.1"; tss_id "TSS7745"; +chr6 Cufflinks exon 27077573 27077759 . - . gene_id "XLOC_007746"; transcript_id "TCONS_00007746"; exon_number "1"; oId "CUFF.7461.1"; tss_id "TSS7746"; +chr6 Cufflinks exon 27144993 27145067 . - . gene_id "XLOC_007747"; transcript_id "TCONS_00007747"; exon_number "1"; oId "CUFF.7466.1"; tss_id "TSS7747"; +chr6 Cufflinks exon 27173867 27173939 . - . gene_id "XLOC_007748"; transcript_id "TCONS_00007748"; exon_number "1"; oId "CUFF.7467.1"; tss_id "TSS7748"; +chr6 Cufflinks exon 27181623 27181695 . - . gene_id "XLOC_007749"; transcript_id "TCONS_00007749"; exon_number "1"; oId "CUFF.7469.1"; tss_id "TSS7749"; +chr6 Cufflinks exon 27198334 27198416 . - . gene_id "XLOC_007750"; transcript_id "TCONS_00007750"; exon_number "1"; oId "CUFF.7472.1"; tss_id "TSS7750"; +chr6 Cufflinks exon 27202001 27202065 . - . gene_id "XLOC_007751"; transcript_id "TCONS_00007751"; exon_number "1"; oId "CUFF.7473.1"; tss_id "TSS7751"; +chr6 Cufflinks exon 27205349 27205423 . - . gene_id "XLOC_007752"; transcript_id "TCONS_00007752"; exon_number "1"; oId "CUFF.7475.1"; tss_id "TSS7752"; +chr6 Cufflinks exon 27242989 27243063 . - . gene_id "XLOC_007753"; transcript_id "TCONS_00007753"; exon_number "1"; oId "CUFF.7478.1"; tss_id "TSS7753"; +chr6 Cufflinks exon 27248049 27248121 . - . gene_id "XLOC_007754"; transcript_id "TCONS_00007754"; exon_number "1"; oId "CUFF.7479.1"; tss_id "TSS7754"; +chr6 Cufflinks exon 27271568 27271638 . - . gene_id "XLOC_007755"; transcript_id "TCONS_00007755"; exon_number "1"; oId "CUFF.7486.1"; tss_id "TSS7755"; +chr6 Cufflinks exon 27300764 27300835 . - . gene_id "XLOC_007756"; transcript_id "TCONS_00007756"; exon_number "1"; oId "CUFF.7487.1"; tss_id "TSS7756"; +chr6 Cufflinks exon 27302766 27302841 . - . gene_id "XLOC_007757"; transcript_id "TCONS_00007757"; exon_number "1"; oId "CUFF.7488.1"; tss_id "TSS7757"; +chr6 Cufflinks exon 27304478 27304544 . - . gene_id "XLOC_007758"; transcript_id "TCONS_00007758"; exon_number "1"; oId "CUFF.7489.1"; tss_id "TSS7758"; +chr6 Cufflinks exon 27473607 27473688 . - . gene_id "XLOC_007759"; transcript_id "TCONS_00007759"; exon_number "1"; oId "CUFF.7495.1"; tss_id "TSS7759"; +chr6 Cufflinks exon 27496625 27496702 . - . gene_id "XLOC_007760"; transcript_id "TCONS_00007760"; exon_number "1"; oId "CUFF.7497.1"; tss_id "TSS7760"; +chr6 Cufflinks exon 27509554 27509635 . - . gene_id "XLOC_007761"; transcript_id "TCONS_00007761"; exon_number "1"; oId "CUFF.7499.1"; tss_id "TSS7761"; +chr6 Cufflinks exon 27515531 27515602 . - . gene_id "XLOC_007762"; transcript_id "TCONS_00007762"; exon_number "1"; oId "CUFF.7502.1"; tss_id "TSS7762"; +chr6 Cufflinks exon 27521192 27521273 . - . gene_id "XLOC_007763"; transcript_id "TCONS_00007763"; exon_number "1"; oId "CUFF.7503.1"; tss_id "TSS7763"; +chr6 Cufflinks exon 27546471 27546532 . - . gene_id "XLOC_007764"; transcript_id "TCONS_00007764"; exon_number "1"; oId "CUFF.7506.1"; tss_id "TSS7764"; +chr6 Cufflinks exon 27551236 27551307 . - . gene_id "XLOC_007765"; transcript_id "TCONS_00007765"; exon_number "1"; oId "CUFF.7507.1"; tss_id "TSS7765"; +chr6 Cufflinks exon 27559593 27559665 . - . gene_id "XLOC_007766"; transcript_id "TCONS_00007766"; exon_number "1"; oId "CUFF.7508.1"; tss_id "TSS7766"; +chr6 Cufflinks exon 27560600 27560671 . - . gene_id "XLOC_007767"; transcript_id "TCONS_00007767"; exon_number "1"; oId "CUFF.7509.1"; tss_id "TSS7767"; +chr6 Cufflinks exon 27570347 27570454 . - . gene_id "XLOC_007768"; transcript_id "TCONS_00007768"; exon_number "1"; oId "CUFF.7511.1"; tss_id "TSS7768"; +chr6 Cufflinks exon 27573416 27573524 . - . gene_id "XLOC_007769"; transcript_id "TCONS_00007769"; exon_number "1"; oId "CUFF.7512.1"; tss_id "TSS7769"; +chr6 Cufflinks exon 27614226 27614297 . - . gene_id "XLOC_007770"; transcript_id "TCONS_00007770"; exon_number "1"; oId "CUFF.7515.1"; tss_id "TSS7770"; +chr6 Cufflinks exon 27618707 27618779 . - . gene_id "XLOC_007771"; transcript_id "TCONS_00007771"; exon_number "1"; oId "CUFF.7516.1"; tss_id "TSS7771"; +chr6 Cufflinks exon 27638343 27638416 . - . gene_id "XLOC_007772"; transcript_id "TCONS_00007772"; exon_number "1"; oId "CUFF.7519.1"; tss_id "TSS7772"; +chr6 Cufflinks exon 27640227 27640310 . - . gene_id "XLOC_007773"; transcript_id "TCONS_00007773"; exon_number "1"; oId "CUFF.7520.1"; tss_id "TSS7773"; +chr6 Cufflinks exon 27648885 27648957 . - . gene_id "XLOC_007774"; transcript_id "TCONS_00007774"; exon_number "1"; oId "CUFF.7522.1"; tss_id "TSS7774"; +chr6 Cufflinks exon 27652474 27652547 . - . gene_id "XLOC_007775"; transcript_id "TCONS_00007775"; exon_number "1"; oId "CUFF.7524.1"; tss_id "TSS7775"; +chr6 Cufflinks exon 27686667 27686728 . - . gene_id "XLOC_007776"; transcript_id "TCONS_00007776"; exon_number "1"; oId "CUFF.7527.1"; tss_id "TSS7776"; +chr6 Cufflinks exon 27688898 27688980 . - . gene_id "XLOC_007777"; transcript_id "TCONS_00007777"; exon_number "1"; oId "CUFF.7528.1"; tss_id "TSS7777"; +chr6 Cufflinks exon 27696327 27696399 . - . gene_id "XLOC_007778"; transcript_id "TCONS_00007778"; exon_number "1"; oId "CUFF.7530.1"; tss_id "TSS7778"; +chr6 Cufflinks exon 27721179 27721251 . - . gene_id "XLOC_007779"; transcript_id "TCONS_00007779"; exon_number "1"; oId "CUFF.7532.1"; tss_id "TSS7779"; +chr6 Cufflinks exon 27722194 27722254 . - . gene_id "XLOC_007780"; transcript_id "TCONS_00007780"; exon_number "1"; oId "CUFF.7533.1"; tss_id "TSS7780"; +chr6 Cufflinks exon 27740109 27740150 . - . gene_id "XLOC_007781"; transcript_id "TCONS_00007781"; exon_number "1"; oId "CUFF.7535.1"; tss_id "TSS7781"; +chr6 Cufflinks exon 27759136 27759206 . - . gene_id "XLOC_007782"; transcript_id "TCONS_00007782"; exon_number "1"; oId "CUFF.7537.1"; tss_id "TSS7782"; +chr6 Cufflinks exon 27763638 27763711 . - . gene_id "XLOC_007783"; transcript_id "TCONS_00007783"; exon_number "1"; oId "CUFF.7539.1"; tss_id "TSS7783"; +chr6 Cufflinks exon 27865284 27865343 . - . gene_id "XLOC_007784"; transcript_id "TCONS_00007784"; exon_number "1"; oId "CUFF.7540.1"; tss_id "TSS7784"; +chr6 Cufflinks exon 27870271 27870342 . - . gene_id "XLOC_007785"; transcript_id "TCONS_00007785"; exon_number "1"; oId "CUFF.7541.1"; tss_id "TSS7785"; +chr6 Cufflinks exon 27870686 27870756 . - . gene_id "XLOC_007786"; transcript_id "TCONS_00007786"; exon_number "1"; oId "CUFF.7542.1"; tss_id "TSS7786"; +chr6 Cufflinks exon 28124040 28124077 . - . gene_id "XLOC_007787"; transcript_id "TCONS_00007787"; exon_number "1"; oId "CUFF.7545.1"; tss_id "TSS7787"; +chr6 Cufflinks exon 28442329 28442402 . - . gene_id "XLOC_007788"; transcript_id "TCONS_00007788"; exon_number "1"; oId "CUFF.7549.1"; tss_id "TSS7788"; +chr6 Cufflinks exon 28446400 28446481 . - . gene_id "XLOC_007789"; transcript_id "TCONS_00007789"; exon_number "1"; oId "CUFF.7550.1"; tss_id "TSS7789"; +chr6 Cufflinks exon 28451583 28451630 . - . gene_id "XLOC_007790"; transcript_id "TCONS_00007790"; exon_number "1"; oId "CUFF.7552.1"; tss_id "TSS7790"; +chr6 Cufflinks exon 28456770 28456843 . - . gene_id "XLOC_007791"; transcript_id "TCONS_00007791"; exon_number "1"; oId "CUFF.7553.1"; tss_id "TSS7791"; +chr6 Cufflinks exon 28510892 28510963 . - . gene_id "XLOC_007792"; transcript_id "TCONS_00007792"; exon_number "1"; oId "CUFF.7556.1"; tss_id "TSS7792"; +chr6 Cufflinks exon 28565117 28565198 . - . gene_id "XLOC_007793"; transcript_id "TCONS_00007793"; exon_number "1"; oId "CUFF.7558.1"; tss_id "TSS7793"; +chr6 Cufflinks exon 28600484 28600549 . - . gene_id "XLOC_007794"; transcript_id "TCONS_00007794"; exon_number "1"; oId "CUFF.7560.1"; tss_id "TSS7794"; +chr6 Cufflinks exon 28601858 28601928 . - . gene_id "XLOC_007795"; transcript_id "TCONS_00007795"; exon_number "1"; oId "CUFF.7561.1"; tss_id "TSS7795"; +chr6 Cufflinks exon 28615984 28616057 . - . gene_id "XLOC_007796"; transcript_id "TCONS_00007796"; exon_number "1"; oId "CUFF.7563.1"; tss_id "TSS7796"; +chr6 Cufflinks exon 28626014 28626085 . - . gene_id "XLOC_007797"; transcript_id "TCONS_00007797"; exon_number "1"; oId "CUFF.7564.1"; tss_id "TSS7797"; +chr6 Cufflinks exon 28641613 28641684 . - . gene_id "XLOC_007798"; transcript_id "TCONS_00007798"; exon_number "1"; oId "CUFF.7565.1"; tss_id "TSS7798"; +chr6 Cufflinks exon 28660987 28661060 . - . gene_id "XLOC_007799"; transcript_id "TCONS_00007799"; exon_number "1"; oId "CUFF.7566.1"; tss_id "TSS7799"; +chr6 Cufflinks exon 28663709 28663780 . - . gene_id "XLOC_007800"; transcript_id "TCONS_00007800"; exon_number "1"; oId "CUFF.7567.1"; tss_id "TSS7800"; +chr6 Cufflinks exon 28664944 28664993 . - . gene_id "XLOC_007801"; transcript_id "TCONS_00007801"; exon_number "1"; oId "CUFF.7568.1"; tss_id "TSS7801"; +chr6 Cufflinks exon 28694855 28694927 . - . gene_id "XLOC_007802"; transcript_id "TCONS_00007802"; exon_number "1"; oId "CUFF.7572.1"; tss_id "TSS7802"; +chr6 Cufflinks exon 28703205 28703277 . - . gene_id "XLOC_007803"; transcript_id "TCONS_00007803"; exon_number "1"; oId "CUFF.7574.1"; tss_id "TSS7803"; +chr6 Cufflinks exon 28710729 28710801 . - . gene_id "XLOC_007804"; transcript_id "TCONS_00007804"; exon_number "1"; oId "CUFF.7575.1"; tss_id "TSS7804"; +chr6 Cufflinks exon 28726141 28726212 . - . gene_id "XLOC_007805"; transcript_id "TCONS_00007805"; exon_number "1"; oId "CUFF.7577.1"; tss_id "TSS7805"; +chr6 Cufflinks exon 28731375 28731447 . - . gene_id "XLOC_007806"; transcript_id "TCONS_00007806"; exon_number "1"; oId "CUFF.7578.1"; tss_id "TSS7806"; +chr6 Cufflinks exon 28746543 28746615 . - . gene_id "XLOC_007807"; transcript_id "TCONS_00007807"; exon_number "1"; oId "CUFF.7580.1"; tss_id "TSS7807"; +chr6 Cufflinks exon 28757547 28757618 . - . gene_id "XLOC_007808"; transcript_id "TCONS_00007808"; exon_number "1"; oId "CUFF.7581.1"; tss_id "TSS7808"; +chr6 Cufflinks exon 28758499 28758571 . - . gene_id "XLOC_007809"; transcript_id "TCONS_00007809"; exon_number "1"; oId "CUFF.7582.1"; tss_id "TSS7809"; +chr6 Cufflinks exon 28763741 28763812 . - . gene_id "XLOC_007810"; transcript_id "TCONS_00007810"; exon_number "1"; oId "CUFF.7583.1"; tss_id "TSS7810"; +chr6 Cufflinks exon 28770577 28770647 . - . gene_id "XLOC_007811"; transcript_id "TCONS_00007811"; exon_number "1"; oId "CUFF.7585.1"; tss_id "TSS7811"; +chr6 Cufflinks exon 28775610 28775682 . - . gene_id "XLOC_007812"; transcript_id "TCONS_00007812"; exon_number "1"; oId "CUFF.7586.1"; tss_id "TSS7812"; +chr6 Cufflinks exon 28779849 28779920 . - . gene_id "XLOC_007813"; transcript_id "TCONS_00007813"; exon_number "1"; oId "CUFF.7587.1"; tss_id "TSS7813"; +chr6 Cufflinks exon 28785012 28785083 . - . gene_id "XLOC_007814"; transcript_id "TCONS_00007814"; exon_number "1"; oId "CUFF.7588.1"; tss_id "TSS7814"; +chr6 Cufflinks exon 28791093 28791166 . - . gene_id "XLOC_007815"; transcript_id "TCONS_00007815"; exon_number "1"; oId "CUFF.7589.1"; tss_id "TSS7815"; +chr6 Cufflinks exon 28795190 28795261 . - . gene_id "XLOC_007816"; transcript_id "TCONS_00007816"; exon_number "1"; oId "CUFF.7590.1"; tss_id "TSS7816"; +chr6 Cufflinks exon 28806221 28806292 . - . gene_id "XLOC_007817"; transcript_id "TCONS_00007817"; exon_number "1"; oId "CUFF.7591.1"; tss_id "TSS7817"; +chr6 Cufflinks exon 28831462 28831533 . - . gene_id "XLOC_007818"; transcript_id "TCONS_00007818"; exon_number "1"; oId "CUFF.7592.1"; tss_id "TSS7818"; +chr6 Cufflinks exon 28835864 28835902 . - . gene_id "XLOC_007819"; transcript_id "TCONS_00007819"; exon_number "1"; oId "CUFF.7593.1"; tss_id "TSS7819"; +chr6 Cufflinks exon 28863999 28864105 . - . gene_id "XLOC_007820"; transcript_id "TCONS_00007820"; exon_number "1"; oId "CUFF.7595.1"; tss_id "TSS7820"; +chr6 Cufflinks exon 28909378 28909449 . - . gene_id "XLOC_007821"; transcript_id "TCONS_00007821"; exon_number "1"; oId "CUFF.7598.1"; tss_id "TSS7821"; +chr6 Cufflinks exon 28911399 28911480 . - . gene_id "XLOC_007822"; transcript_id "TCONS_00007822"; exon_number "1"; oId "CUFF.7599.1"; tss_id "TSS7822"; +chr6 Cufflinks exon 28921042 28921114 . - . gene_id "XLOC_007823"; transcript_id "TCONS_00007823"; exon_number "1"; oId "CUFF.7602.1"; tss_id "TSS7823"; +chr6 Cufflinks exon 28949449 28949521 . - . gene_id "XLOC_007824"; transcript_id "TCONS_00007824"; exon_number "1"; oId "CUFF.7604.1"; tss_id "TSS7824"; +chr6 Cufflinks exon 29729917 29730463 . - . gene_id "XLOC_007825"; transcript_id "TCONS_00007825"; exon_number "1"; oId "CUFF.7609.1"; tss_id "TSS7825"; +chr6 Cufflinks exon 30586030 30586095 . - . gene_id "XLOC_007826"; transcript_id "TCONS_00007826"; exon_number "1"; oId "CUFF.7610.1"; tss_id "TSS7826"; +chr6 Cufflinks exon 31724731 31724830 . - . gene_id "XLOC_007827"; transcript_id "TCONS_00007827"; exon_number "1"; oId "CUFF.7617.1"; tss_id "TSS7827"; +chr6 Cufflinks exon 32046313 32046404 . - . gene_id "XLOC_007828"; transcript_id "TCONS_00007828"; exon_number "1"; oId "CUFF.7618.1"; tss_id "TSS7828"; +chr6 Cufflinks exon 32482028 32482105 . - . gene_id "XLOC_007829"; transcript_id "TCONS_00007829"; exon_number "1"; oId "CUFF.7620.1"; tss_id "TSS7829"; +chr6 Cufflinks exon 32517790 32517865 . - . gene_id "XLOC_007830"; transcript_id "TCONS_00007830"; exon_number "1"; oId "CUFF.7621.1"; tss_id "TSS7830"; +chr6 Cufflinks exon 32544122 32544198 . - . gene_id "XLOC_007831"; transcript_id "TCONS_00007831"; exon_number "1"; oId "CUFF.7622.1"; tss_id "TSS7831"; +chr6 Cufflinks exon 32926059 32926088 . - . gene_id "XLOC_007832"; transcript_id "TCONS_00007832"; exon_number "1"; oId "CUFF.7623.1"; tss_id "TSS7832"; +chr6 Cufflinks exon 34653110 34653419 . - . gene_id "XLOC_007833"; transcript_id "TCONS_00007833"; exon_number "1"; oId "CUFF.7627.1"; tss_id "TSS7833"; +chr6 Cufflinks exon 35237520 35237618 . - . gene_id "XLOC_007834"; transcript_id "TCONS_00007834"; exon_number "1"; oId "CUFF.7629.1"; tss_id "TSS7834"; +chr6 Cufflinks exon 35368206 35368246 . - . gene_id "XLOC_007835"; transcript_id "TCONS_00007835"; exon_number "1"; oId "CUFF.7630.1"; tss_id "TSS7835"; +chr6 Cufflinks exon 35567272 35567328 . - . gene_id "XLOC_007836"; transcript_id "TCONS_00007836"; exon_number "1"; oId "CUFF.7631.1"; tss_id "TSS7836"; +chr6 Cufflinks exon 36418668 36418963 . - . gene_id "XLOC_007837"; transcript_id "TCONS_00007837"; exon_number "1"; oId "CUFF.7632.1"; tss_id "TSS7837"; +chr6 Cufflinks exon 36607344 36607449 . - . gene_id "XLOC_007838"; transcript_id "TCONS_00007838"; exon_number "1"; oId "CUFF.7636.1"; tss_id "TSS7838"; +chr6 Cufflinks exon 37067372 37067418 . - . gene_id "XLOC_007839"; transcript_id "TCONS_00007839"; exon_number "1"; oId "CUFF.7637.1"; tss_id "TSS7839"; +chr6 Cufflinks exon 37218977 37219081 . - . gene_id "XLOC_007840"; transcript_id "TCONS_00007840"; exon_number "1"; oId "CUFF.7639.1"; tss_id "TSS7840"; +chr6 Cufflinks exon 37312722 37312759 . - . gene_id "XLOC_007841"; transcript_id "TCONS_00007841"; exon_number "1"; oId "CUFF.7641.1"; tss_id "TSS7841"; +chr6 Cufflinks exon 37800735 37800965 . - . gene_id "XLOC_007842"; transcript_id "TCONS_00007842"; exon_number "1"; oId "CUFF.7645.1"; tss_id "TSS7842"; +chr6 Cufflinks exon 39508388 39508517 . - . gene_id "XLOC_007843"; transcript_id "TCONS_00007843"; exon_number "1"; oId "CUFF.7651.1"; tss_id "TSS7843"; +chr6 Cufflinks exon 39588122 39588239 . - . gene_id "XLOC_007844"; transcript_id "TCONS_00007844"; exon_number "1"; oId "CUFF.7652.1"; tss_id "TSS7844"; +chr6 Cufflinks exon 41207256 41207363 . - . gene_id "XLOC_007845"; transcript_id "TCONS_00007845"; exon_number "1"; oId "CUFF.7655.1"; tss_id "TSS7845"; +chr6 Cufflinks exon 41270208 41270310 . - . gene_id "XLOC_007846"; transcript_id "TCONS_00007846"; exon_number "1"; oId "CUFF.7656.1"; tss_id "TSS7846"; +chr6 Cufflinks exon 41892169 41892210 . - . gene_id "XLOC_007847"; transcript_id "TCONS_00007847"; exon_number "1"; oId "CUFF.7657.1"; tss_id "TSS7847"; +chr6 Cufflinks exon 41986146 41986252 . - . gene_id "XLOC_007848"; transcript_id "TCONS_00007848"; exon_number "1"; oId "CUFF.7658.1"; tss_id "TSS7848"; +chr6 Cufflinks exon 42380059 42380134 . - . gene_id "XLOC_007849"; transcript_id "TCONS_00007849"; exon_number "1"; oId "CUFF.7659.1"; tss_id "TSS7849"; +chr6 Cufflinks exon 42473235 42473345 . - . gene_id "XLOC_007850"; transcript_id "TCONS_00007850"; exon_number "1"; oId "CUFF.7660.1"; tss_id "TSS7850"; +chr6 Cufflinks exon 42609815 42609864 . - . gene_id "XLOC_007851"; transcript_id "TCONS_00007851"; exon_number "1"; oId "CUFF.7663.1"; tss_id "TSS7851"; +chr6 Cufflinks exon 43003916 43004055 . - . gene_id "XLOC_007852"; transcript_id "TCONS_00007852"; exon_number "1"; oId "CUFF.7665.1"; tss_id "TSS7852"; +chr6 Cufflinks exon 43004373 43004560 . - . gene_id "XLOC_007853"; transcript_id "TCONS_00007853"; exon_number "1"; oId "CUFF.7666.1"; tss_id "TSS7853"; +chr6 Cufflinks exon 43509912 43509973 . - . gene_id "XLOC_007854"; transcript_id "TCONS_00007854"; exon_number "1"; oId "CUFF.7670.1"; tss_id "TSS7854"; +chr6 Cufflinks exon 44415748 44415780 . - . gene_id "XLOC_007855"; transcript_id "TCONS_00007855"; exon_number "1"; oId "CUFF.7673.1"; tss_id "TSS7855"; +chr6 Cufflinks exon 44805916 44805950 . - . gene_id "XLOC_007856"; transcript_id "TCONS_00007856"; exon_number "1"; oId "CUFF.7675.1"; tss_id "TSS7856"; +chr6 Cufflinks exon 47074873 47074911 . - . gene_id "XLOC_007857"; transcript_id "TCONS_00007857"; exon_number "1"; oId "CUFF.7684.1"; tss_id "TSS7857"; +chr6 Cufflinks exon 49312462 49312520 . - . gene_id "XLOC_007858"; transcript_id "TCONS_00007858"; exon_number "1"; oId "CUFF.7688.1"; tss_id "TSS7858"; +chr6 Cufflinks exon 50852189 50852256 . - . gene_id "XLOC_007859"; transcript_id "TCONS_00007859"; exon_number "1"; oId "CUFF.7691.1"; tss_id "TSS7859"; +chr6 Cufflinks exon 50980612 50980737 . - . gene_id "XLOC_007860"; transcript_id "TCONS_00007860"; exon_number "1"; oId "CUFF.7692.1"; tss_id "TSS7860"; +chr6 Cufflinks exon 52598329 52598364 . - . gene_id "XLOC_007861"; transcript_id "TCONS_00007861"; exon_number "1"; oId "CUFF.7694.1"; tss_id "TSS7861"; +chr6 Cufflinks exon 52797772 52797812 . - . gene_id "XLOC_007862"; transcript_id "TCONS_00007862"; exon_number "1"; oId "CUFF.7695.1"; tss_id "TSS7862"; +chr6 Cufflinks exon 53012640 53012727 . - . gene_id "XLOC_007863"; transcript_id "TCONS_00007863"; exon_number "1"; oId "CUFF.7698.1"; tss_id "TSS7863"; +chr6 Cufflinks exon 53018593 53018696 . - . gene_id "XLOC_007864"; transcript_id "TCONS_00007864"; exon_number "1"; oId "CUFF.7699.1"; tss_id "TSS7864"; +chr6 Cufflinks exon 53280264 53280395 . - . gene_id "XLOC_007865"; transcript_id "TCONS_00007865"; exon_number "1"; oId "CUFF.7701.1"; tss_id "TSS7865"; +chr6 Cufflinks exon 53280639 53280726 . - . gene_id "XLOC_007866"; transcript_id "TCONS_00007866"; exon_number "1"; oId "CUFF.7702.1"; tss_id "TSS7866"; +chr6 Cufflinks exon 56596096 56596174 . - . gene_id "XLOC_007867"; transcript_id "TCONS_00007867"; exon_number "1"; oId "CUFF.7706.1"; tss_id "TSS7867"; +chr6 Cufflinks exon 56615104 56615150 . - . gene_id "XLOC_007868"; transcript_id "TCONS_00007868"; exon_number "1"; oId "CUFF.7707.1"; tss_id "TSS7868"; +chr6 Cufflinks exon 57019473 57019509 . - . gene_id "XLOC_007869"; transcript_id "TCONS_00007869"; exon_number "1"; oId "CUFF.7709.1"; tss_id "TSS7869"; +chr6 Cufflinks exon 57791271 57791343 . - . gene_id "XLOC_007870"; transcript_id "TCONS_00007870"; exon_number "1"; oId "CUFF.7710.1"; tss_id "TSS7870"; +chr6 Cufflinks exon 58141877 58141949 . - . gene_id "XLOC_007871"; transcript_id "TCONS_00007871"; exon_number "1"; oId "CUFF.7712.1"; tss_id "TSS7871"; +chr6 Cufflinks exon 58142589 58142661 . - . gene_id "XLOC_007872"; transcript_id "TCONS_00007872"; exon_number "1"; oId "CUFF.7713.1"; tss_id "TSS7872"; +chr6 Cufflinks exon 58152241 58152314 . - . gene_id "XLOC_007873"; transcript_id "TCONS_00007873"; exon_number "1"; oId "CUFF.7715.1"; tss_id "TSS7873"; +chr6 Cufflinks exon 58156450 58156522 . - . gene_id "XLOC_007874"; transcript_id "TCONS_00007874"; exon_number "1"; oId "CUFF.7716.1"; tss_id "TSS7874"; +chr6 Cufflinks exon 58159664 58159737 . - . gene_id "XLOC_007875"; transcript_id "TCONS_00007875"; exon_number "1"; oId "CUFF.7717.1"; tss_id "TSS7875"; +chr6 Cufflinks exon 58164628 58164700 . - . gene_id "XLOC_007876"; transcript_id "TCONS_00007876"; exon_number "1"; oId "CUFF.7718.1"; tss_id "TSS7876"; +chr6 Cufflinks exon 58168489 58168564 . - . gene_id "XLOC_007877"; transcript_id "TCONS_00007877"; exon_number "1"; oId "CUFF.7719.1"; tss_id "TSS7877"; +chr6 Cufflinks exon 58171933 58171989 . - . gene_id "XLOC_007878"; transcript_id "TCONS_00007878"; exon_number "1"; oId "CUFF.7720.1"; tss_id "TSS7878"; +chr6 Cufflinks exon 58172441 58172516 . - . gene_id "XLOC_007879"; transcript_id "TCONS_00007879"; exon_number "1"; oId "CUFF.7721.1"; tss_id "TSS7879"; +chr6 Cufflinks exon 58182679 58182751 . - . gene_id "XLOC_007880"; transcript_id "TCONS_00007880"; exon_number "1"; oId "CUFF.7723.1"; tss_id "TSS7880"; +chr6 Cufflinks exon 58187444 58187516 . - . gene_id "XLOC_007881"; transcript_id "TCONS_00007881"; exon_number "1"; oId "CUFF.7724.1"; tss_id "TSS7881"; +chr6 Cufflinks exon 58192022 58192095 . - . gene_id "XLOC_007882"; transcript_id "TCONS_00007882"; exon_number "1"; oId "CUFF.7725.1"; tss_id "TSS7882"; +chr6 Cufflinks exon 58196623 58196695 . - . gene_id "XLOC_007883"; transcript_id "TCONS_00007883"; exon_number "1"; oId "CUFF.7726.1"; tss_id "TSS7883"; +chr6 Cufflinks exon 58236141 58236206 . - . gene_id "XLOC_007884"; transcript_id "TCONS_00007884"; exon_number "1"; oId "CUFF.7727.1"; tss_id "TSS7884"; +chr6 Cufflinks exon 58395351 58395423 . - . gene_id "XLOC_007885"; transcript_id "TCONS_00007885"; exon_number "1"; oId "CUFF.7728.1"; tss_id "TSS7885"; +chr6 Cufflinks exon 66020996 66021038 . - . gene_id "XLOC_007886"; transcript_id "TCONS_00007886"; exon_number "1"; oId "CUFF.7732.1"; tss_id "TSS7886"; +chr6 Cufflinks exon 67438737 67438796 . - . gene_id "XLOC_007887"; transcript_id "TCONS_00007887"; exon_number "1"; oId "CUFF.7734.1"; tss_id "TSS7887"; +chr6 Cufflinks exon 67654500 67654585 . - . gene_id "XLOC_007888"; transcript_id "TCONS_00007888"; exon_number "1"; oId "CUFF.7735.1"; tss_id "TSS7888"; +chr6 Cufflinks exon 67658873 67658906 . - . gene_id "XLOC_007889"; transcript_id "TCONS_00007889"; exon_number "1"; oId "CUFF.7736.1"; tss_id "TSS7889"; +chr6 Cufflinks exon 68177112 68177199 . - . gene_id "XLOC_007890"; transcript_id "TCONS_00007890"; exon_number "1"; oId "CUFF.7737.1"; tss_id "TSS7890"; +chr6 Cufflinks exon 69375061 69375137 . - . gene_id "XLOC_007891"; transcript_id "TCONS_00007891"; exon_number "1"; oId "CUFF.7739.1"; tss_id "TSS7891"; +chr6 Cufflinks exon 69494195 69494228 . - . gene_id "XLOC_007892"; transcript_id "TCONS_00007892"; exon_number "1"; oId "CUFF.7740.1"; tss_id "TSS7892"; +chr6 Cufflinks exon 70183072 70183129 . - . gene_id "XLOC_007893"; transcript_id "TCONS_00007893"; exon_number "1"; oId "CUFF.7743.1"; tss_id "TSS7893"; +chr6 Cufflinks exon 70661354 70661387 . - . gene_id "XLOC_007894"; transcript_id "TCONS_00007894"; exon_number "1"; oId "CUFF.7744.1"; tss_id "TSS7894"; +chr6 Cufflinks exon 71836596 71836808 . - . gene_id "XLOC_007895"; transcript_id "TCONS_00007895"; exon_number "1"; oId "CUFF.7746.1"; tss_id "TSS7895"; +chr6 Cufflinks exon 72073643 72073712 . - . gene_id "XLOC_007896"; transcript_id "TCONS_00007896"; exon_number "1"; oId "CUFF.7748.1"; tss_id "TSS7896"; +chr6 Cufflinks exon 72362174 72362314 . - . gene_id "XLOC_007897"; transcript_id "TCONS_00007897"; exon_number "1"; oId "CUFF.7749.1"; tss_id "TSS7897"; +chr6 Cufflinks exon 74016138 74016190 . - . gene_id "XLOC_007898"; transcript_id "TCONS_00007898"; exon_number "1"; oId "CUFF.7752.1"; tss_id "TSS7898"; +chr6 Cufflinks exon 74103633 74103737 . - . gene_id "XLOC_007899"; transcript_id "TCONS_00007899"; exon_number "1"; oId "CUFF.7753.1"; tss_id "TSS7899"; +chr6 Cufflinks exon 74197290 74197600 . - . gene_id "XLOC_007900"; transcript_id "TCONS_00007900"; exon_number "1"; oId "CUFF.7756.1"; tss_id "TSS7900"; +chr6 Cufflinks exon 75926348 75926429 . - . gene_id "XLOC_007901"; transcript_id "TCONS_00007901"; exon_number "1"; oId "CUFF.7759.1"; tss_id "TSS7901"; +chr6 Cufflinks exon 76108576 76108779 . - . gene_id "XLOC_007902"; transcript_id "TCONS_00007902"; exon_number "1"; oId "CUFF.7760.1"; tss_id "TSS7902"; +chr6 Cufflinks exon 76183455 76183595 . - . gene_id "XLOC_007903"; transcript_id "TCONS_00007903"; exon_number "1"; oId "CUFF.7761.1"; tss_id "TSS7903"; +chr6 Cufflinks exon 76364777 76365015 . - . gene_id "XLOC_007904"; transcript_id "TCONS_00007904"; exon_number "1"; oId "CUFF.7764.1"; tss_id "TSS7904"; +chr6 Cufflinks exon 76477783 76477875 . - . gene_id "XLOC_007905"; transcript_id "TCONS_00007905"; exon_number "1"; oId "CUFF.7765.1"; tss_id "TSS7905"; +chr6 Cufflinks exon 76574974 76575052 . - . gene_id "XLOC_007906"; transcript_id "TCONS_00007906"; exon_number "1"; oId "CUFF.7766.1"; tss_id "TSS7906"; +chr6 Cufflinks exon 76747075 76747211 . - . gene_id "XLOC_007907"; transcript_id "TCONS_00007907"; exon_number "1"; oId "CUFF.7768.1"; tss_id "TSS7907"; +chr6 Cufflinks exon 77156705 77156785 . - . gene_id "XLOC_007908"; transcript_id "TCONS_00007908"; exon_number "1"; oId "CUFF.7770.1"; tss_id "TSS7908"; +chr6 Cufflinks exon 77267370 77267473 . - . gene_id "XLOC_007909"; transcript_id "TCONS_00007909"; exon_number "1"; oId "CUFF.7771.1"; tss_id "TSS7909"; +chr6 Cufflinks exon 77441990 77442035 . - . gene_id "XLOC_007910"; transcript_id "TCONS_00007910"; exon_number "1"; oId "CUFF.7772.1"; tss_id "TSS7910"; +chr6 Cufflinks exon 79668012 79668082 . - . gene_id "XLOC_007911"; transcript_id "TCONS_00007911"; exon_number "1"; oId "CUFF.7773.1"; tss_id "TSS7911"; +chr6 Cufflinks exon 81371454 81371497 . - . gene_id "XLOC_007912"; transcript_id "TCONS_00007912"; exon_number "1"; oId "CUFF.7775.1"; tss_id "TSS7912"; +chr6 Cufflinks exon 81940607 81940647 . - . gene_id "XLOC_007913"; transcript_id "TCONS_00007913"; exon_number "1"; oId "CUFF.7776.1"; tss_id "TSS7913"; +chr6 Cufflinks exon 82026639 82026694 . - . gene_id "XLOC_007914"; transcript_id "TCONS_00007914"; exon_number "1"; oId "CUFF.7777.1"; tss_id "TSS7914"; +chr6 Cufflinks exon 82082167 82082236 . - . gene_id "XLOC_007915"; transcript_id "TCONS_00007915"; exon_number "1"; oId "CUFF.7778.1"; tss_id "TSS7915"; +chr6 Cufflinks exon 82660003 82660038 . - . gene_id "XLOC_007916"; transcript_id "TCONS_00007916"; exon_number "1"; oId "CUFF.7782.1"; tss_id "TSS7916"; +chr6 Cufflinks exon 82920061 82920157 . - . gene_id "XLOC_007917"; transcript_id "TCONS_00007917"; exon_number "1"; oId "CUFF.7783.1"; tss_id "TSS7917"; +chr6 Cufflinks exon 84348286 84348323 . - . gene_id "XLOC_007918"; transcript_id "TCONS_00007918"; exon_number "1"; oId "CUFF.7785.1"; tss_id "TSS7918"; +chr6 Cufflinks exon 86122874 86123014 . - . gene_id "XLOC_007919"; transcript_id "TCONS_00007919"; exon_number "1"; oId "CUFF.7789.1"; tss_id "TSS7919"; +chr6 Cufflinks exon 86523200 86523253 . - . gene_id "XLOC_007920"; transcript_id "TCONS_00007920"; exon_number "1"; oId "CUFF.7791.1"; tss_id "TSS7920"; +chr6 Cufflinks exon 86702728 86702877 . - . gene_id "XLOC_007921"; transcript_id "TCONS_00007921"; exon_number "1"; oId "CUFF.7792.1"; tss_id "TSS7921"; +chr6 Cufflinks exon 87556868 87556970 . - . gene_id "XLOC_007922"; transcript_id "TCONS_00007922"; exon_number "1"; oId "CUFF.7795.1"; tss_id "TSS7922"; +chr6 Cufflinks exon 88348968 88349012 . - . gene_id "XLOC_007923"; transcript_id "TCONS_00007923"; exon_number "1"; oId "CUFF.7798.1"; tss_id "TSS7923"; +chr6 Cufflinks exon 89423964 89424140 . - . gene_id "XLOC_007924"; transcript_id "TCONS_00007924"; exon_number "1"; oId "CUFF.7802.1"; tss_id "TSS7924"; +chr6 Cufflinks exon 89670027 89670069 . - . gene_id "XLOC_007925"; transcript_id "TCONS_00007925"; exon_number "1"; oId "CUFF.7803.1"; tss_id "TSS7925"; +chr6 Cufflinks exon 89770515 89770597 . - . gene_id "XLOC_007926"; transcript_id "TCONS_00007926"; exon_number "1"; oId "CUFF.7804.1"; tss_id "TSS7926"; +chr6 Cufflinks exon 89773226 89773409 . - . gene_id "XLOC_007927"; transcript_id "TCONS_00007927"; exon_number "1"; oId "CUFF.7805.1"; tss_id "TSS7927"; +chr6 Cufflinks exon 90030115 90030150 . - . gene_id "XLOC_007928"; transcript_id "TCONS_00007928"; exon_number "1"; oId "CUFF.7807.1"; tss_id "TSS7928"; +chr6 Cufflinks exon 90710987 90711225 . - . gene_id "XLOC_007929"; transcript_id "TCONS_00007929"; exon_number "1"; oId "CUFF.7812.1"; tss_id "TSS7929"; +chr6 Cufflinks exon 90961046 90961087 . - . gene_id "XLOC_007930"; transcript_id "TCONS_00007930"; exon_number "1"; oId "CUFF.7813.1"; tss_id "TSS7930"; +chr6 Cufflinks exon 91653907 91653948 . - . gene_id "XLOC_007931"; transcript_id "TCONS_00007931"; exon_number "1"; oId "CUFF.7814.1"; tss_id "TSS7931"; +chr6 Cufflinks exon 92940912 92940965 . - . gene_id "XLOC_007932"; transcript_id "TCONS_00007932"; exon_number "1"; oId "CUFF.7817.1"; tss_id "TSS7932"; +chr6 Cufflinks exon 94774623 94774664 . - . gene_id "XLOC_007933"; transcript_id "TCONS_00007933"; exon_number "1"; oId "CUFF.7819.1"; tss_id "TSS7933"; +chr6 Cufflinks exon 96386005 96386295 . - . gene_id "XLOC_007934"; transcript_id "TCONS_00007934"; exon_number "1"; oId "CUFF.7822.1"; tss_id "TSS7934"; +chr6 Cufflinks exon 97097333 97097467 . - . gene_id "XLOC_007935"; transcript_id "TCONS_00007935"; exon_number "1"; oId "CUFF.7824.1"; tss_id "TSS7935"; +chr6 Cufflinks exon 97362554 97362871 . - . gene_id "XLOC_007936"; transcript_id "TCONS_00007936"; exon_number "1"; oId "CUFF.7825.1"; tss_id "TSS7936"; +chr6 Cufflinks exon 97799955 97799993 . - . gene_id "XLOC_007937"; transcript_id "TCONS_00007937"; exon_number "1"; oId "CUFF.7826.1"; tss_id "TSS7937"; +chr6 Cufflinks exon 99074660 99074698 . - . gene_id "XLOC_007938"; transcript_id "TCONS_00007938"; exon_number "1"; oId "CUFF.7827.1"; tss_id "TSS7938"; +chr6 Cufflinks exon 100029096 100029165 . - . gene_id "XLOC_007939"; transcript_id "TCONS_00007939"; exon_number "1"; oId "CUFF.7828.1"; tss_id "TSS7939"; +chr6 Cufflinks exon 102331490 102331526 . - . gene_id "XLOC_007940"; transcript_id "TCONS_00007940"; exon_number "1"; oId "CUFF.7833.1"; tss_id "TSS7940"; +chr6 Cufflinks exon 104332150 104332186 . - . gene_id "XLOC_007941"; transcript_id "TCONS_00007941"; exon_number "1"; oId "CUFF.7835.1"; tss_id "TSS7941"; +chr6 Cufflinks exon 105278634 105278922 . - . gene_id "XLOC_007942"; transcript_id "TCONS_00007942"; exon_number "1"; oId "CUFF.7839.1"; tss_id "TSS7942"; +chr6 Cufflinks exon 105493124 105493159 . - . gene_id "XLOC_007943"; transcript_id "TCONS_00007943"; exon_number "1"; oId "CUFF.7840.1"; tss_id "TSS7943"; +chr6 Cufflinks exon 105493461 105493543 . - . gene_id "XLOC_007944"; transcript_id "TCONS_00007944"; exon_number "1"; oId "CUFF.7841.1"; tss_id "TSS7944"; +chr6 Cufflinks exon 105813508 105813597 . - . gene_id "XLOC_007945"; transcript_id "TCONS_00007945"; exon_number "1"; oId "CUFF.7843.1"; tss_id "TSS7945"; +chr6 Cufflinks exon 105852092 105852225 . - . gene_id "XLOC_007946"; transcript_id "TCONS_00007946"; exon_number "1"; oId "CUFF.7844.1"; tss_id "TSS7946"; +chr6 Cufflinks exon 106643800 106643855 . - . gene_id "XLOC_007947"; transcript_id "TCONS_00007947"; exon_number "1"; oId "CUFF.7847.1"; tss_id "TSS7947"; +chr6 Cufflinks exon 106731267 106731586 . - . gene_id "XLOC_007948"; transcript_id "TCONS_00007948"; exon_number "1"; oId "CUFF.7849.1"; tss_id "TSS7948"; +chr6 Cufflinks exon 107186824 107186929 . - . gene_id "XLOC_007949"; transcript_id "TCONS_00007949"; exon_number "1"; oId "CUFF.7854.1"; tss_id "TSS7949"; +chr6 Cufflinks exon 107398482 107398631 . - . gene_id "XLOC_007950"; transcript_id "TCONS_00007950"; exon_number "1"; oId "CUFF.7855.1"; tss_id "TSS7950"; +chr6 Cufflinks exon 108306897 108306984 . - . gene_id "XLOC_007951"; transcript_id "TCONS_00007951"; exon_number "1"; oId "CUFF.7859.1"; tss_id "TSS7951"; +chr6 Cufflinks exon 108587285 108587323 . - . gene_id "XLOC_007952"; transcript_id "TCONS_00007952"; exon_number "1"; oId "CUFF.7862.1"; tss_id "TSS7952"; +chr6 Cufflinks exon 109380713 109380817 . - . gene_id "XLOC_007953"; transcript_id "TCONS_00007953"; exon_number "1"; oId "CUFF.7869.1"; tss_id "TSS7953"; +chr6 Cufflinks exon 109429951 109429993 . - . gene_id "XLOC_007954"; transcript_id "TCONS_00007954"; exon_number "1"; oId "CUFF.7870.1"; tss_id "TSS7954"; +chr6 Cufflinks exon 109612459 109612562 . - . gene_id "XLOC_007955"; transcript_id "TCONS_00007955"; exon_number "1"; oId "CUFF.7871.1"; tss_id "TSS7955"; +chr6 Cufflinks exon 110010048 110010091 . - . gene_id "XLOC_007956"; transcript_id "TCONS_00007956"; exon_number "1"; oId "CUFF.7872.1"; tss_id "TSS7956"; +chr6 Cufflinks exon 110068297 110068332 . - . gene_id "XLOC_007957"; transcript_id "TCONS_00007957"; exon_number "1"; oId "CUFF.7873.1"; tss_id "TSS7957"; +chr6 Cufflinks exon 110074369 110074458 . - . gene_id "XLOC_007958"; transcript_id "TCONS_00007958"; exon_number "1"; oId "CUFF.7874.1"; tss_id "TSS7958"; +chr6 Cufflinks exon 110761275 110761506 . - . gene_id "XLOC_007959"; transcript_id "TCONS_00007959"; exon_number "1"; oId "CUFF.7877.1"; tss_id "TSS7959"; +chr6 Cufflinks exon 111043455 111043549 . - . gene_id "XLOC_007960"; transcript_id "TCONS_00007960"; exon_number "1"; oId "CUFF.7879.1"; tss_id "TSS7960"; +chr6 Cufflinks exon 111193833 111193863 . - . gene_id "XLOC_007961"; transcript_id "TCONS_00007961"; exon_number "1"; oId "CUFF.7882.1"; tss_id "TSS7961"; +chr6 Cufflinks exon 111329473 111329579 . - . gene_id "XLOC_007962"; transcript_id "TCONS_00007962"; exon_number "1"; oId "CUFF.7884.1"; tss_id "TSS7962"; +chr6 Cufflinks exon 111412417 111412533 . - . gene_id "XLOC_007963"; transcript_id "TCONS_00007963"; exon_number "1"; oId "CUFF.7885.1"; tss_id "TSS7963"; +chr6 Cufflinks exon 111719385 111719452 . - . gene_id "XLOC_007964"; transcript_id "TCONS_00007964"; exon_number "1"; oId "CUFF.7887.1"; tss_id "TSS7964"; +chr6 Cufflinks exon 111967527 111967631 . - . gene_id "XLOC_007965"; transcript_id "TCONS_00007965"; exon_number "1"; oId "CUFF.7888.1"; tss_id "TSS7965"; +chr6 Cufflinks exon 112517642 112517748 . - . gene_id "XLOC_007966"; transcript_id "TCONS_00007966"; exon_number "1"; oId "CUFF.7889.1"; tss_id "TSS7966"; +chr6 Cufflinks exon 114102545 114102667 . - . gene_id "XLOC_007967"; transcript_id "TCONS_00007967"; exon_number "1"; oId "CUFF.7894.1"; tss_id "TSS7967"; +chr6 Cufflinks exon 114541861 114541949 . - . gene_id "XLOC_007968"; transcript_id "TCONS_00007968"; exon_number "1"; oId "CUFF.7897.1"; tss_id "TSS7968"; +chr6 Cufflinks exon 115188071 115188140 . - . gene_id "XLOC_007969"; transcript_id "TCONS_00007969"; exon_number "1"; oId "CUFF.7898.1"; tss_id "TSS7969"; +chr6 Cufflinks exon 115273213 115273263 . - . gene_id "XLOC_007970"; transcript_id "TCONS_00007970"; exon_number "1"; oId "CUFF.7899.1"; tss_id "TSS7970"; +chr6 Cufflinks exon 116499410 116499496 . - . gene_id "XLOC_007971"; transcript_id "TCONS_00007971"; exon_number "1"; oId "CUFF.7901.1"; tss_id "TSS7971"; +chr6 Cufflinks exon 117778897 117779005 . - . gene_id "XLOC_007972"; transcript_id "TCONS_00007972"; exon_number "1"; oId "CUFF.7906.1"; tss_id "TSS7972"; +chr6 Cufflinks exon 118349016 118349055 . - . gene_id "XLOC_007973"; transcript_id "TCONS_00007973"; exon_number "1"; oId "CUFF.7907.1"; tss_id "TSS7973"; +chr6 Cufflinks exon 120847440 120847546 . - . gene_id "XLOC_007974"; transcript_id "TCONS_00007974"; exon_number "1"; oId "CUFF.7912.1"; tss_id "TSS7974"; +chr6 Cufflinks exon 121775124 121775266 . - . gene_id "XLOC_007975"; transcript_id "TCONS_00007975"; exon_number "1"; oId "CUFF.7916.1"; tss_id "TSS7975"; +chr6 Cufflinks exon 121863629 121863770 . - . gene_id "XLOC_007976"; transcript_id "TCONS_00007976"; exon_number "1"; oId "CUFF.7917.1"; tss_id "TSS7976"; +chr6 Cufflinks exon 121901483 121901663 . - . gene_id "XLOC_007977"; transcript_id "TCONS_00007977"; exon_number "1"; oId "CUFF.7918.1"; tss_id "TSS7977"; +chr6 Cufflinks exon 122326675 122326724 . - . gene_id "XLOC_007978"; transcript_id "TCONS_00007978"; exon_number "1"; oId "CUFF.7919.1"; tss_id "TSS7978"; +chr6 Cufflinks exon 122964534 122964570 . - . gene_id "XLOC_007979"; transcript_id "TCONS_00007979"; exon_number "1"; oId "CUFF.7921.1"; tss_id "TSS7979"; +chr6 Cufflinks exon 125515784 125515826 . - . gene_id "XLOC_007980"; transcript_id "TCONS_00007980"; exon_number "1"; oId "CUFF.7925.1"; tss_id "TSS7980"; +chr6 Cufflinks exon 125701631 125701673 . - . gene_id "XLOC_007981"; transcript_id "TCONS_00007981"; exon_number "1"; oId "CUFF.7926.1"; tss_id "TSS7981"; +chr6 Cufflinks exon 126101393 126101464 . - . gene_id "XLOC_007982"; transcript_id "TCONS_00007982"; exon_number "1"; oId "CUFF.7927.1"; tss_id "TSS7982"; +chr6 Cufflinks exon 126301022 126301080 . - . gene_id "XLOC_007983"; transcript_id "TCONS_00007983"; exon_number "1"; oId "CUFF.7929.1"; tss_id "TSS7983"; +chr6 Cufflinks exon 126386952 126386993 . - . gene_id "XLOC_007984"; transcript_id "TCONS_00007984"; exon_number "1"; oId "CUFF.7930.1"; tss_id "TSS7984"; +chr6 Cufflinks exon 126911433 126911538 . - . gene_id "XLOC_007985"; transcript_id "TCONS_00007985"; exon_number "1"; oId "CUFF.7931.1"; tss_id "TSS7985"; +chr6 Cufflinks exon 127639030 127639118 . - . gene_id "XLOC_007986"; transcript_id "TCONS_00007986"; exon_number "1"; oId "CUFF.7932.1"; tss_id "TSS7986"; +chr6 Cufflinks exon 129758020 129758123 . - . gene_id "XLOC_007987"; transcript_id "TCONS_00007987"; exon_number "1"; oId "CUFF.7936.1"; tss_id "TSS7987"; +chr6 Cufflinks exon 129814542 129814634 . - . gene_id "XLOC_007988"; transcript_id "TCONS_00007988"; exon_number "1"; oId "CUFF.7937.1"; tss_id "TSS7988"; +chr6 Cufflinks exon 130967382 130967458 . - . gene_id "XLOC_007989"; transcript_id "TCONS_00007989"; exon_number "1"; oId "CUFF.7938.1"; tss_id "TSS7989"; +chr6 Cufflinks exon 131927207 131927265 . - . gene_id "XLOC_007990"; transcript_id "TCONS_00007990"; exon_number "1"; oId "CUFF.7940.1"; tss_id "TSS7990"; +chr6 Cufflinks exon 131964036 131964106 . - . gene_id "XLOC_007991"; transcript_id "TCONS_00007991"; exon_number "1"; oId "CUFF.7942.1"; tss_id "TSS7991"; +chr6 Cufflinks exon 132029129 132029233 . - . gene_id "XLOC_007992"; transcript_id "TCONS_00007992"; exon_number "1"; oId "CUFF.7943.1"; tss_id "TSS7992"; +chr6 Cufflinks exon 132401298 132401347 . - . gene_id "XLOC_007993"; transcript_id "TCONS_00007993"; exon_number "1"; oId "CUFF.7946.1"; tss_id "TSS7993"; +chr6 Cufflinks exon 133157175 133157216 . - . gene_id "XLOC_007994"; transcript_id "TCONS_00007994"; exon_number "1"; oId "CUFF.7947.1"; tss_id "TSS7994"; +chr6 Cufflinks exon 134085174 134085319 . - . gene_id "XLOC_007995"; transcript_id "TCONS_00007995"; exon_number "1"; oId "CUFF.7949.1"; tss_id "TSS7995"; +chr6 Cufflinks exon 134514581 134514639 . - . gene_id "XLOC_007996"; transcript_id "TCONS_00007996"; exon_number "1"; oId "CUFF.7951.1"; tss_id "TSS7996"; +chr6 Cufflinks exon 134527552 134527653 . - . gene_id "XLOC_007997"; transcript_id "TCONS_00007997"; exon_number "1"; oId "CUFF.7952.1"; tss_id "TSS7997"; +chr6 Cufflinks exon 134976033 134976066 . - . gene_id "XLOC_007998"; transcript_id "TCONS_00007998"; exon_number "1"; oId "CUFF.7955.1"; tss_id "TSS7998"; +chr6 Cufflinks exon 135596960 135597001 . - . gene_id "XLOC_007999"; transcript_id "TCONS_00007999"; exon_number "1"; oId "CUFF.7957.1"; tss_id "TSS7999"; +chr6 Cufflinks exon 135598055 135598092 . - . gene_id "XLOC_008000"; transcript_id "TCONS_00008000"; exon_number "1"; oId "CUFF.7958.1"; tss_id "TSS8000"; +chr6 Cufflinks exon 135872516 135872584 . - . gene_id "XLOC_008001"; transcript_id "TCONS_00008001"; exon_number "1"; oId "CUFF.7959.1"; tss_id "TSS8001"; +chr6 Cufflinks exon 137059143 137059226 . - . gene_id "XLOC_008002"; transcript_id "TCONS_00008002"; exon_number "1"; oId "CUFF.7963.1"; tss_id "TSS8002"; +chr6 Cufflinks exon 137898893 137899149 . - . gene_id "XLOC_008003"; transcript_id "TCONS_00008003"; exon_number "1"; oId "CUFF.7967.1"; tss_id "TSS8003"; +chr6 Cufflinks exon 138724246 138724281 . - . gene_id "XLOC_008004"; transcript_id "TCONS_00008004"; exon_number "1"; oId "CUFF.7970.1"; tss_id "TSS8004"; +chr6 Cufflinks exon 139180167 139180270 . - . gene_id "XLOC_008005"; transcript_id "TCONS_00008005"; exon_number "1"; oId "CUFF.7971.1"; tss_id "TSS8005"; +chr6 Cufflinks exon 139363025 139363165 . - . gene_id "XLOC_008006"; transcript_id "TCONS_00008006"; exon_number "1"; oId "CUFF.7972.1"; tss_id "TSS8006"; +chr6 Cufflinks exon 139784134 139784164 . - . gene_id "XLOC_008007"; transcript_id "TCONS_00008007"; exon_number "1"; oId "CUFF.7973.1"; tss_id "TSS8007"; +chr6 Cufflinks exon 140197943 140198077 . - . gene_id "XLOC_008008"; transcript_id "TCONS_00008008"; exon_number "1"; oId "CUFF.7974.1"; tss_id "TSS8008"; +chr6 Cufflinks exon 140479752 140479831 . - . gene_id "XLOC_008009"; transcript_id "TCONS_00008009"; exon_number "1"; oId "CUFF.7975.1"; tss_id "TSS8009"; +chr6 Cufflinks exon 141757969 141758034 . - . gene_id "XLOC_008010"; transcript_id "TCONS_00008010"; exon_number "1"; oId "CUFF.7976.1"; tss_id "TSS8010"; +chr6 Cufflinks exon 141807310 141807549 . - . gene_id "XLOC_008011"; transcript_id "TCONS_00008011"; exon_number "1"; oId "CUFF.7977.1"; tss_id "TSS8011"; +chr6 Cufflinks exon 142301214 142301315 . - . gene_id "XLOC_008012"; transcript_id "TCONS_00008012"; exon_number "1"; oId "CUFF.7978.1"; tss_id "TSS8012"; +chr6 Cufflinks exon 142683558 142683745 . - . gene_id "XLOC_008013"; transcript_id "TCONS_00008013"; exon_number "1"; oId "CUFF.7980.1"; tss_id "TSS8013"; +chr6 Cufflinks exon 143491549 143491590 . - . gene_id "XLOC_008014"; transcript_id "TCONS_00008014"; exon_number "1"; oId "CUFF.7981.1"; tss_id "TSS8014"; +chr6 Cufflinks exon 144692028 144692284 . - . gene_id "XLOC_008015"; transcript_id "TCONS_00008015"; exon_number "1"; oId "CUFF.7986.1"; tss_id "TSS8015"; +chr6 Cufflinks exon 145784377 145784535 . - . gene_id "XLOC_008016"; transcript_id "TCONS_00008016"; exon_number "1"; oId "CUFF.7988.1"; tss_id "TSS8016"; +chr6 Cufflinks exon 149348942 149348976 . - . gene_id "XLOC_008017"; transcript_id "TCONS_00008017"; exon_number "1"; oId "CUFF.7995.1"; tss_id "TSS8017"; +chr6 Cufflinks exon 150647756 150647899 . - . gene_id "XLOC_008018"; transcript_id "TCONS_00008018"; exon_number "1"; oId "CUFF.7999.1"; tss_id "TSS8018"; +chr6 Cufflinks exon 151601650 151601741 . - . gene_id "XLOC_008019"; transcript_id "TCONS_00008019"; exon_number "1"; oId "CUFF.8003.1"; tss_id "TSS8019"; +chr6 Cufflinks exon 151668159 151668248 . - . gene_id "XLOC_008020"; transcript_id "TCONS_00008020"; exon_number "1"; oId "CUFF.8005.1"; tss_id "TSS8020"; +chr6 Cufflinks exon 151936908 151937014 . - . gene_id "XLOC_008021"; transcript_id "TCONS_00008021"; exon_number "1"; oId "CUFF.8006.1"; tss_id "TSS8021"; +chr6 Cufflinks exon 152157981 152158256 . - . gene_id "XLOC_008022"; transcript_id "TCONS_00008022"; exon_number "1"; oId "CUFF.8007.1"; tss_id "TSS8022"; +chr6 Cufflinks exon 152611081 152611168 . - . gene_id "XLOC_008023"; transcript_id "TCONS_00008023"; exon_number "1"; oId "CUFF.8009.1"; tss_id "TSS8023"; +chr6 Cufflinks exon 152826814 152826850 . - . gene_id "XLOC_008024"; transcript_id "TCONS_00008024"; exon_number "1"; oId "CUFF.8011.1"; tss_id "TSS8024"; +chr6 Cufflinks exon 152946324 152946558 . - . gene_id "XLOC_008025"; transcript_id "TCONS_00008025"; exon_number "1"; oId "CUFF.8012.1"; tss_id "TSS8025"; +chr6 Cufflinks exon 153056935 153056972 . - . gene_id "XLOC_008026"; transcript_id "TCONS_00008026"; exon_number "1"; oId "CUFF.8013.1"; tss_id "TSS8026"; +chr6 Cufflinks exon 153480391 153480480 . - . gene_id "XLOC_008027"; transcript_id "TCONS_00008027"; exon_number "1"; oId "CUFF.8014.1"; tss_id "TSS8027"; +chr6 Cufflinks exon 153981472 153981508 . - . gene_id "XLOC_008028"; transcript_id "TCONS_00008028"; exon_number "1"; oId "CUFF.8017.1"; tss_id "TSS8028"; +chr6 Cufflinks exon 153986703 153986769 . - . gene_id "XLOC_008029"; transcript_id "TCONS_00008029"; exon_number "1"; oId "CUFF.8018.1"; tss_id "TSS8029"; +chr6 Cufflinks exon 154243779 154243864 . - . gene_id "XLOC_008030"; transcript_id "TCONS_00008030"; exon_number "1"; oId "CUFF.8020.1"; tss_id "TSS8030"; +chr6 Cufflinks exon 155086342 155086380 . - . gene_id "XLOC_008031"; transcript_id "TCONS_00008031"; exon_number "1"; oId "CUFF.8021.1"; tss_id "TSS8031"; +chr6 Cufflinks exon 155146312 155146413 . - . gene_id "XLOC_008032"; transcript_id "TCONS_00008032"; exon_number "1"; oId "CUFF.8022.1"; tss_id "TSS8032"; +chr6 Cufflinks exon 155226227 155226293 . - . gene_id "XLOC_008033"; transcript_id "TCONS_00008033"; exon_number "1"; oId "CUFF.8023.1"; tss_id "TSS8033"; +chr6 Cufflinks exon 155478758 155478795 . - . gene_id "XLOC_008034"; transcript_id "TCONS_00008034"; exon_number "1"; oId "CUFF.8024.1"; tss_id "TSS8034"; +chr6 Cufflinks exon 155976097 155976159 . - . gene_id "XLOC_008035"; transcript_id "TCONS_00008035"; exon_number "1"; oId "CUFF.8025.1"; tss_id "TSS8035"; +chr6 Cufflinks exon 156768505 156768545 . - . gene_id "XLOC_008036"; transcript_id "TCONS_00008036"; exon_number "1"; oId "CUFF.8026.1"; tss_id "TSS8036"; +chr6 Cufflinks exon 156869046 156869120 . - . gene_id "XLOC_008037"; transcript_id "TCONS_00008037"; exon_number "1"; oId "CUFF.8027.1"; tss_id "TSS8037"; +chr6 Cufflinks exon 157712341 157712432 . - . gene_id "XLOC_008038"; transcript_id "TCONS_00008038"; exon_number "1"; oId "CUFF.8028.1"; tss_id "TSS8038"; +chr6 Cufflinks exon 158132985 158133096 . - . gene_id "XLOC_008039"; transcript_id "TCONS_00008039"; exon_number "1"; oId "CUFF.8030.1"; tss_id "TSS8039"; +chr6 Cufflinks exon 158133708 158133768 . - . gene_id "XLOC_008040"; transcript_id "TCONS_00008040"; exon_number "1"; oId "CUFF.8031.1"; tss_id "TSS8040"; +chr6 Cufflinks exon 158824648 158824720 . - . gene_id "XLOC_008041"; transcript_id "TCONS_00008041"; exon_number "1"; oId "CUFF.8033.1"; tss_id "TSS8041"; +chr6 Cufflinks exon 161207529 161207613 . - . gene_id "XLOC_008042"; transcript_id "TCONS_00008042"; exon_number "1"; oId "CUFF.8036.1"; tss_id "TSS8042"; +chr6 Cufflinks exon 161494740 161494798 . - . gene_id "XLOC_008043"; transcript_id "TCONS_00008043"; exon_number "1"; oId "CUFF.8037.1"; tss_id "TSS8043"; +chr6 Cufflinks exon 162104398 162104433 . - . gene_id "XLOC_008044"; transcript_id "TCONS_00008044"; exon_number "1"; oId "CUFF.8038.1"; tss_id "TSS8044"; +chr6 Cufflinks exon 162291118 162291207 . - . gene_id "XLOC_008045"; transcript_id "TCONS_00008045"; exon_number "1"; oId "CUFF.8039.1"; tss_id "TSS8045"; +chr6 Cufflinks exon 162473066 162473108 . - . gene_id "XLOC_008046"; transcript_id "TCONS_00008046"; exon_number "1"; oId "CUFF.8040.1"; tss_id "TSS8046"; +chr6 Cufflinks exon 163210014 163210082 . - . gene_id "XLOC_008047"; transcript_id "TCONS_00008047"; exon_number "1"; oId "CUFF.8041.1"; tss_id "TSS8047"; +chr6 Cufflinks exon 163879217 163879256 . - . gene_id "XLOC_008048"; transcript_id "TCONS_00008048"; exon_number "1"; oId "CUFF.8043.1"; tss_id "TSS8048"; +chr6 Cufflinks exon 163906225 163906265 . - . gene_id "XLOC_008049"; transcript_id "TCONS_00008049"; exon_number "1"; oId "CUFF.8044.1"; tss_id "TSS8049"; +chr6 Cufflinks exon 164509826 164509858 . - . gene_id "XLOC_008050"; transcript_id "TCONS_00008050"; exon_number "1"; oId "CUFF.8046.1"; tss_id "TSS8050"; +chr6 Cufflinks exon 166131723 166131826 . - . gene_id "XLOC_008051"; transcript_id "TCONS_00008051"; exon_number "1"; oId "CUFF.8049.1"; tss_id "TSS8051"; +chr6 Cufflinks exon 166293876 166293917 . - . gene_id "XLOC_008052"; transcript_id "TCONS_00008052"; exon_number "1"; oId "CUFF.8050.1"; tss_id "TSS8052"; +chr6 Cufflinks exon 167297415 167297452 . - . gene_id "XLOC_008053"; transcript_id "TCONS_00008053"; exon_number "1"; oId "CUFF.8052.1"; tss_id "TSS8053"; +chr6 Cufflinks exon 169456020 169456055 . - . gene_id "XLOC_008054"; transcript_id "TCONS_00008054"; exon_number "1"; oId "CUFF.8054.1"; tss_id "TSS8054"; +chr6_apd_hap1 Cufflinks exon 489 560 . + . gene_id "XLOC_008055"; transcript_id "TCONS_00008055"; exon_number "1"; oId "CUFF.8056.1"; tss_id "TSS8055"; +chr6_apd_hap1 Cufflinks exon 18922 18994 . + . gene_id "XLOC_008056"; transcript_id "TCONS_00008056"; exon_number "1"; oId "CUFF.8059.1"; tss_id "TSS8056"; +chr6_apd_hap1 Cufflinks exon 35565 35633 . + . gene_id "XLOC_008057"; transcript_id "TCONS_00008057"; exon_number "1"; oId "CUFF.8062.1"; tss_id "TSS8057"; +chr6_apd_hap1 Cufflinks exon 68056 68090 . + . gene_id "XLOC_008058"; transcript_id "TCONS_00008058"; exon_number "1"; oId "CUFF.8067.1"; tss_id "TSS8058"; +chr6_apd_hap1 Cufflinks exon 152566 152640 . + . gene_id "XLOC_008059"; transcript_id "TCONS_00008059"; exon_number "1"; oId "CUFF.8077.1"; tss_id "TSS8059"; +chr6_apd_hap1 Cufflinks exon 186820 186923 . + . gene_id "XLOC_008060"; transcript_id "TCONS_00008060"; exon_number "1"; oId "CUFF.8079.1"; tss_id "TSS8060"; +chr6_apd_hap1 Cufflinks exon 253378 253449 . + . gene_id "XLOC_008061"; transcript_id "TCONS_00008061"; exon_number "1"; oId "CUFF.8081.1"; tss_id "TSS8061"; +chr6_apd_hap1 Cufflinks exon 260220 260301 . + . gene_id "XLOC_008062"; transcript_id "TCONS_00008062"; exon_number "1"; oId "CUFF.8082.1"; tss_id "TSS8062"; +chr6_apd_hap1 Cufflinks exon 373972 374015 . + . gene_id "XLOC_008063"; transcript_id "TCONS_00008063"; exon_number "1"; oId "CUFF.8083.1"; tss_id "TSS8063"; +chr6_apd_hap1 Cufflinks exon 446658 446699 . + . gene_id "XLOC_008064"; transcript_id "TCONS_00008064"; exon_number "1"; oId "CUFF.8084.1"; tss_id "TSS8064"; +chr6_apd_hap1 Cufflinks exon 726161 726195 . + . gene_id "XLOC_008065"; transcript_id "TCONS_00008065"; exon_number "1"; oId "CUFF.8085.1"; tss_id "TSS8065"; +chr6_apd_hap1 Cufflinks exon 3635031 3635131 . + . gene_id "XLOC_008066"; transcript_id "TCONS_00008066"; exon_number "1"; oId "CUFF.8089.1"; tss_id "TSS8066"; +chr6_apd_hap1 Cufflinks exon 6606 6678 . - . gene_id "XLOC_008067"; transcript_id "TCONS_00008067"; exon_number "1"; oId "CUFF.8057.1"; tss_id "TSS8067"; +chr6_apd_hap1 Cufflinks exon 14130 14202 . - . gene_id "XLOC_008068"; transcript_id "TCONS_00008068"; exon_number "1"; oId "CUFF.8058.1"; tss_id "TSS8068"; +chr6_apd_hap1 Cufflinks exon 29542 29613 . - . gene_id "XLOC_008069"; transcript_id "TCONS_00008069"; exon_number "1"; oId "CUFF.8060.1"; tss_id "TSS8069"; +chr6_apd_hap1 Cufflinks exon 34776 34848 . - . gene_id "XLOC_008070"; transcript_id "TCONS_00008070"; exon_number "1"; oId "CUFF.8061.1"; tss_id "TSS8070"; +chr6_apd_hap1 Cufflinks exon 49944 50016 . - . gene_id "XLOC_008071"; transcript_id "TCONS_00008071"; exon_number "1"; oId "CUFF.8063.1"; tss_id "TSS8071"; +chr6_apd_hap1 Cufflinks exon 60948 61019 . - . gene_id "XLOC_008072"; transcript_id "TCONS_00008072"; exon_number "1"; oId "CUFF.8064.1"; tss_id "TSS8072"; +chr6_apd_hap1 Cufflinks exon 61900 61972 . - . gene_id "XLOC_008073"; transcript_id "TCONS_00008073"; exon_number "1"; oId "CUFF.8065.1"; tss_id "TSS8073"; +chr6_apd_hap1 Cufflinks exon 67142 67213 . - . gene_id "XLOC_008074"; transcript_id "TCONS_00008074"; exon_number "1"; oId "CUFF.8066.1"; tss_id "TSS8074"; +chr6_apd_hap1 Cufflinks exon 73978 74048 . - . gene_id "XLOC_008075"; transcript_id "TCONS_00008075"; exon_number "1"; oId "CUFF.8068.1"; tss_id "TSS8075"; +chr6_apd_hap1 Cufflinks exon 79011 79083 . - . gene_id "XLOC_008076"; transcript_id "TCONS_00008076"; exon_number "1"; oId "CUFF.8069.1"; tss_id "TSS8076"; +chr6_apd_hap1 Cufflinks exon 83250 83321 . - . gene_id "XLOC_008077"; transcript_id "TCONS_00008077"; exon_number "1"; oId "CUFF.8070.1"; tss_id "TSS8077"; +chr6_apd_hap1 Cufflinks exon 88413 88484 . - . gene_id "XLOC_008078"; transcript_id "TCONS_00008078"; exon_number "1"; oId "CUFF.8071.1"; tss_id "TSS8078"; +chr6_apd_hap1 Cufflinks exon 94494 94567 . - . gene_id "XLOC_008079"; transcript_id "TCONS_00008079"; exon_number "1"; oId "CUFF.8072.1"; tss_id "TSS8079"; +chr6_apd_hap1 Cufflinks exon 98591 98662 . - . gene_id "XLOC_008080"; transcript_id "TCONS_00008080"; exon_number "1"; oId "CUFF.8073.1"; tss_id "TSS8080"; +chr6_apd_hap1 Cufflinks exon 109622 109693 . - . gene_id "XLOC_008081"; transcript_id "TCONS_00008081"; exon_number "1"; oId "CUFF.8074.1"; tss_id "TSS8081"; +chr6_apd_hap1 Cufflinks exon 134863 134934 . - . gene_id "XLOC_008082"; transcript_id "TCONS_00008082"; exon_number "1"; oId "CUFF.8075.1"; tss_id "TSS8082"; +chr6_apd_hap1 Cufflinks exon 139265 139303 . - . gene_id "XLOC_008083"; transcript_id "TCONS_00008083"; exon_number "1"; oId "CUFF.8076.1"; tss_id "TSS8083"; +chr6_apd_hap1 Cufflinks exon 167400 167506 . - . gene_id "XLOC_008084"; transcript_id "TCONS_00008084"; exon_number "1"; oId "CUFF.8078.1"; tss_id "TSS8084"; +chr6_apd_hap1 Cufflinks exon 252851 252923 . - . gene_id "XLOC_008085"; transcript_id "TCONS_00008085"; exon_number "1"; oId "CUFF.8080.1"; tss_id "TSS8085"; +chr6_apd_hap1 Cufflinks exon 1033561 1034108 . - . gene_id "XLOC_008086"; transcript_id "TCONS_00008086"; exon_number "1"; oId "CUFF.8086.1"; tss_id "TSS8086"; +chr6_apd_hap1 Cufflinks exon 3039482 3039581 . - . gene_id "XLOC_008087"; transcript_id "TCONS_00008087"; exon_number "1"; oId "CUFF.8087.1"; tss_id "TSS8087"; +chr6_apd_hap1 Cufflinks exon 3361053 3361144 . - . gene_id "XLOC_008088"; transcript_id "TCONS_00008088"; exon_number "1"; oId "CUFF.8088.1"; tss_id "TSS8088"; +chr6_apd_hap1 Cufflinks exon 3771928 3772003 . - . gene_id "XLOC_008089"; transcript_id "TCONS_00008089"; exon_number "1"; oId "CUFF.8090.1"; tss_id "TSS8089"; +chr6_apd_hap1 Cufflinks exon 4213055 4213084 . - . gene_id "XLOC_008090"; transcript_id "TCONS_00008090"; exon_number "1"; oId "CUFF.8091.1"; tss_id "TSS8090"; +chr6_cox_hap2 Cufflinks exon 27571 27664 . + . gene_id "XLOC_008091"; transcript_id "TCONS_00008091"; exon_number "1"; oId "CUFF.8092.1"; tss_id "TSS8091"; +chr6_cox_hap2 Cufflinks exon 79360 79431 . + . gene_id "XLOC_008092"; transcript_id "TCONS_00008092"; exon_number "1"; oId "CUFF.8094.1"; tss_id "TSS8092"; +chr6_cox_hap2 Cufflinks exon 97138 97212 . + . gene_id "XLOC_008093"; transcript_id "TCONS_00008093"; exon_number "1"; oId "CUFF.8096.1"; tss_id "TSS8093"; +chr6_cox_hap2 Cufflinks exon 133388 133459 . + . gene_id "XLOC_008094"; transcript_id "TCONS_00008094"; exon_number "1"; oId "CUFF.8099.1"; tss_id "TSS8094"; +chr6_cox_hap2 Cufflinks exon 200488 200559 . + . gene_id "XLOC_008095"; transcript_id "TCONS_00008095"; exon_number "1"; oId "CUFF.8105.1"; tss_id "TSS8095"; +chr6_cox_hap2 Cufflinks exon 210489 210560 . + . gene_id "XLOC_008096"; transcript_id "TCONS_00008096"; exon_number "1"; oId "CUFF.8106.1"; tss_id "TSS8096"; +chr6_cox_hap2 Cufflinks exon 216805 216878 . + . gene_id "XLOC_008097"; transcript_id "TCONS_00008097"; exon_number "1"; oId "CUFF.8107.1"; tss_id "TSS8097"; +chr6_cox_hap2 Cufflinks exon 220097 220168 . + . gene_id "XLOC_008098"; transcript_id "TCONS_00008098"; exon_number "1"; oId "CUFF.8109.1"; tss_id "TSS8098"; +chr6_cox_hap2 Cufflinks exon 238518 238590 . + . gene_id "XLOC_008099"; transcript_id "TCONS_00008099"; exon_number "1"; oId "CUFF.8112.1"; tss_id "TSS8099"; +chr6_cox_hap2 Cufflinks exon 255187 255255 . + . gene_id "XLOC_008100"; transcript_id "TCONS_00008100"; exon_number "1"; oId "CUFF.8115.1"; tss_id "TSS8100"; +chr6_cox_hap2 Cufflinks exon 287651 287685 . + . gene_id "XLOC_008101"; transcript_id "TCONS_00008101"; exon_number "1"; oId "CUFF.8120.1"; tss_id "TSS8101"; +chr6_cox_hap2 Cufflinks exon 372190 372264 . + . gene_id "XLOC_008102"; transcript_id "TCONS_00008102"; exon_number "1"; oId "CUFF.8130.1"; tss_id "TSS8102"; +chr6_cox_hap2 Cufflinks exon 406444 406547 . + . gene_id "XLOC_008103"; transcript_id "TCONS_00008103"; exon_number "1"; oId "CUFF.8132.1"; tss_id "TSS8103"; +chr6_cox_hap2 Cufflinks exon 427565 427670 . + . gene_id "XLOC_008104"; transcript_id "TCONS_00008104"; exon_number "1"; oId "CUFF.8133.1"; tss_id "TSS8104"; +chr6_cox_hap2 Cufflinks exon 431086 431158 . + . gene_id "XLOC_008105"; transcript_id "TCONS_00008105"; exon_number "1"; oId "CUFF.8136.1"; tss_id "TSS8105"; +chr6_cox_hap2 Cufflinks exon 437542 437614 . + . gene_id "XLOC_008106"; transcript_id "TCONS_00008106"; exon_number "1"; oId "CUFF.8137.1"; tss_id "TSS8106"; +chr6_cox_hap2 Cufflinks exon 464055 464353 . + . gene_id "XLOC_008107"; transcript_id "TCONS_00008107"; exon_number "1"; oId "CUFF.8139.1"; tss_id "TSS8107"; +chr6_cox_hap2 Cufflinks exon 468779 468850 . + . gene_id "XLOC_008108"; transcript_id "TCONS_00008108"; exon_number "1"; oId "CUFF.8141.1"; tss_id "TSS8108"; +chr6_cox_hap2 Cufflinks exon 475582 475663 . + . gene_id "XLOC_008109"; transcript_id "TCONS_00008109"; exon_number "1"; oId "CUFF.8142.1"; tss_id "TSS8109"; +chr6_cox_hap2 Cufflinks exon 589400 589443 . + . gene_id "XLOC_008110"; transcript_id "TCONS_00008110"; exon_number "1"; oId "CUFF.8143.1"; tss_id "TSS8110"; +chr6_cox_hap2 Cufflinks exon 941459 941493 . + . gene_id "XLOC_008111"; transcript_id "TCONS_00008111"; exon_number "1"; oId "CUFF.8144.1"; tss_id "TSS8111"; +chr6_cox_hap2 Cufflinks exon 2344104 2344347 . + . gene_id "XLOC_008112"; transcript_id "TCONS_00008112"; exon_number "1"; oId "CUFF.8147.1"; tss_id "TSS8112"; +chr6_cox_hap2 Cufflinks exon 2565521 2565584 . + . gene_id "XLOC_008113"; transcript_id "TCONS_00008113"; exon_number "1"; oId "CUFF.8148.1"; tss_id "TSS8113"; +chr6_cox_hap2 Cufflinks exon 2606691 2606733 . + . gene_id "XLOC_008114"; transcript_id "TCONS_00008114"; exon_number "1"; oId "CUFF.8149.1"; tss_id "TSS8114"; +chr6_cox_hap2 Cufflinks exon 2707817 2707855 . + . gene_id "XLOC_008115"; transcript_id "TCONS_00008115"; exon_number "1"; oId "CUFF.8151.1"; tss_id "TSS8115"; +chr6_cox_hap2 Cufflinks exon 2850576 2850682 . + . gene_id "XLOC_008116"; transcript_id "TCONS_00008116"; exon_number "1"; oId "CUFF.8152.1"; tss_id "TSS8116"; +chr6_cox_hap2 Cufflinks exon 3791105 3791205 . + . gene_id "XLOC_008117"; transcript_id "TCONS_00008117"; exon_number "1"; oId "CUFF.8155.1"; tss_id "TSS8117"; +chr6_cox_hap2 Cufflinks exon 33096 33167 . - . gene_id "XLOC_008118"; transcript_id "TCONS_00008118"; exon_number "1"; oId "CUFF.8093.1"; tss_id "TSS8118"; +chr6_cox_hap2 Cufflinks exon 87321 87402 . - . gene_id "XLOC_008119"; transcript_id "TCONS_00008119"; exon_number "1"; oId "CUFF.8095.1"; tss_id "TSS8119"; +chr6_cox_hap2 Cufflinks exon 122679 122744 . - . gene_id "XLOC_008120"; transcript_id "TCONS_00008120"; exon_number "1"; oId "CUFF.8097.1"; tss_id "TSS8120"; +chr6_cox_hap2 Cufflinks exon 124053 124123 . - . gene_id "XLOC_008121"; transcript_id "TCONS_00008121"; exon_number "1"; oId "CUFF.8098.1"; tss_id "TSS8121"; +chr6_cox_hap2 Cufflinks exon 138151 138224 . - . gene_id "XLOC_008122"; transcript_id "TCONS_00008122"; exon_number "1"; oId "CUFF.8100.1"; tss_id "TSS8122"; +chr6_cox_hap2 Cufflinks exon 148184 148255 . - . gene_id "XLOC_008123"; transcript_id "TCONS_00008123"; exon_number "1"; oId "CUFF.8101.1"; tss_id "TSS8123"; +chr6_cox_hap2 Cufflinks exon 163778 163849 . - . gene_id "XLOC_008124"; transcript_id "TCONS_00008124"; exon_number "1"; oId "CUFF.8102.1"; tss_id "TSS8124"; +chr6_cox_hap2 Cufflinks exon 183137 183210 . - . gene_id "XLOC_008125"; transcript_id "TCONS_00008125"; exon_number "1"; oId "CUFF.8103.1"; tss_id "TSS8125"; +chr6_cox_hap2 Cufflinks exon 185849 185920 . - . gene_id "XLOC_008126"; transcript_id "TCONS_00008126"; exon_number "1"; oId "CUFF.8104.1"; tss_id "TSS8126"; +chr6_cox_hap2 Cufflinks exon 217865 217937 . - . gene_id "XLOC_008127"; transcript_id "TCONS_00008127"; exon_number "1"; oId "CUFF.8108.1"; tss_id "TSS8127"; +chr6_cox_hap2 Cufflinks exon 226215 226287 . - . gene_id "XLOC_008128"; transcript_id "TCONS_00008128"; exon_number "1"; oId "CUFF.8110.1"; tss_id "TSS8128"; +chr6_cox_hap2 Cufflinks exon 233737 233809 . - . gene_id "XLOC_008129"; transcript_id "TCONS_00008129"; exon_number "1"; oId "CUFF.8111.1"; tss_id "TSS8129"; +chr6_cox_hap2 Cufflinks exon 249171 249242 . - . gene_id "XLOC_008130"; transcript_id "TCONS_00008130"; exon_number "1"; oId "CUFF.8113.1"; tss_id "TSS8130"; +chr6_cox_hap2 Cufflinks exon 254398 254470 . - . gene_id "XLOC_008131"; transcript_id "TCONS_00008131"; exon_number "1"; oId "CUFF.8114.1"; tss_id "TSS8131"; +chr6_cox_hap2 Cufflinks exon 269558 269630 . - . gene_id "XLOC_008132"; transcript_id "TCONS_00008132"; exon_number "1"; oId "CUFF.8116.1"; tss_id "TSS8132"; +chr6_cox_hap2 Cufflinks exon 280565 280636 . - . gene_id "XLOC_008133"; transcript_id "TCONS_00008133"; exon_number "1"; oId "CUFF.8117.1"; tss_id "TSS8133"; +chr6_cox_hap2 Cufflinks exon 281518 281590 . - . gene_id "XLOC_008134"; transcript_id "TCONS_00008134"; exon_number "1"; oId "CUFF.8118.1"; tss_id "TSS8134"; +chr6_cox_hap2 Cufflinks exon 286741 286812 . - . gene_id "XLOC_008135"; transcript_id "TCONS_00008135"; exon_number "1"; oId "CUFF.8119.1"; tss_id "TSS8135"; +chr6_cox_hap2 Cufflinks exon 293451 293522 . - . gene_id "XLOC_008136"; transcript_id "TCONS_00008136"; exon_number "1"; oId "CUFF.8121.1"; tss_id "TSS8136"; +chr6_cox_hap2 Cufflinks exon 298485 298557 . - . gene_id "XLOC_008137"; transcript_id "TCONS_00008137"; exon_number "1"; oId "CUFF.8122.1"; tss_id "TSS8137"; +chr6_cox_hap2 Cufflinks exon 302729 302800 . - . gene_id "XLOC_008138"; transcript_id "TCONS_00008138"; exon_number "1"; oId "CUFF.8123.1"; tss_id "TSS8138"; +chr6_cox_hap2 Cufflinks exon 307892 307963 . - . gene_id "XLOC_008139"; transcript_id "TCONS_00008139"; exon_number "1"; oId "CUFF.8124.1"; tss_id "TSS8139"; +chr6_cox_hap2 Cufflinks exon 313969 314042 . - . gene_id "XLOC_008140"; transcript_id "TCONS_00008140"; exon_number "1"; oId "CUFF.8125.1"; tss_id "TSS8140"; +chr6_cox_hap2 Cufflinks exon 318039 318110 . - . gene_id "XLOC_008141"; transcript_id "TCONS_00008141"; exon_number "1"; oId "CUFF.8126.1"; tss_id "TSS8141"; +chr6_cox_hap2 Cufflinks exon 329069 329140 . - . gene_id "XLOC_008142"; transcript_id "TCONS_00008142"; exon_number "1"; oId "CUFF.8127.1"; tss_id "TSS8142"; +chr6_cox_hap2 Cufflinks exon 354331 354402 . - . gene_id "XLOC_008143"; transcript_id "TCONS_00008143"; exon_number "1"; oId "CUFF.8128.1"; tss_id "TSS8143"; +chr6_cox_hap2 Cufflinks exon 358728 358766 . - . gene_id "XLOC_008144"; transcript_id "TCONS_00008144"; exon_number "1"; oId "CUFF.8129.1"; tss_id "TSS8144"; +chr6_cox_hap2 Cufflinks exon 387027 387133 . - . gene_id "XLOC_008145"; transcript_id "TCONS_00008145"; exon_number "1"; oId "CUFF.8131.1"; tss_id "TSS8145"; +chr6_cox_hap2 Cufflinks exon 428113 428184 . - . gene_id "XLOC_008146"; transcript_id "TCONS_00008146"; exon_number "1"; oId "CUFF.8134.1"; tss_id "TSS8146"; +chr6_cox_hap2 Cufflinks exon 430133 430214 . - . gene_id "XLOC_008147"; transcript_id "TCONS_00008147"; exon_number "1"; oId "CUFF.8135.1"; tss_id "TSS8147"; +chr6_cox_hap2 Cufflinks exon 439778 439850 . - . gene_id "XLOC_008148"; transcript_id "TCONS_00008148"; exon_number "1"; oId "CUFF.8138.1"; tss_id "TSS8148"; +chr6_cox_hap2 Cufflinks exon 468252 468324 . - . gene_id "XLOC_008149"; transcript_id "TCONS_00008149"; exon_number "1"; oId "CUFF.8140.1"; tss_id "TSS8149"; +chr6_cox_hap2 Cufflinks exon 1246023 1246134 . - . gene_id "XLOC_008150"; transcript_id "TCONS_00008150"; exon_number "1"; oId "CUFF.8145.1"; tss_id "TSS8150"; +chr6_cox_hap2 Cufflinks exon 2098083 2098148 . - . gene_id "XLOC_008151"; transcript_id "TCONS_00008151"; exon_number "1"; oId "CUFF.8146.1"; tss_id "TSS8151"; +chr6_cox_hap2 Cufflinks exon 2613491 2613546 . - . gene_id "XLOC_008152"; transcript_id "TCONS_00008152"; exon_number "1"; oId "CUFF.8150.1"; tss_id "TSS8152"; +chr6_cox_hap2 Cufflinks exon 3234317 3234416 . - . gene_id "XLOC_008153"; transcript_id "TCONS_00008153"; exon_number "1"; oId "CUFF.8153.1"; tss_id "TSS8153"; +chr6_cox_hap2 Cufflinks exon 3516980 3517071 . - . gene_id "XLOC_008154"; transcript_id "TCONS_00008154"; exon_number "1"; oId "CUFF.8154.1"; tss_id "TSS8154"; +chr6_cox_hap2 Cufflinks exon 3931609 3931684 . - . gene_id "XLOC_008155"; transcript_id "TCONS_00008155"; exon_number "1"; oId "CUFF.8156.1"; tss_id "TSS8155"; +chr6_cox_hap2 Cufflinks exon 3969797 3969872 . - . gene_id "XLOC_008156"; transcript_id "TCONS_00008156"; exon_number "1"; oId "CUFF.8157.1"; tss_id "TSS8156"; +chr6_cox_hap2 Cufflinks exon 3995762 3995832 . - . gene_id "XLOC_008157"; transcript_id "TCONS_00008157"; exon_number "1"; oId "CUFF.8158.1"; tss_id "TSS8157"; +chr6_cox_hap2 Cufflinks exon 4370596 4370625 . - . gene_id "XLOC_008158"; transcript_id "TCONS_00008158"; exon_number "1"; oId "CUFF.8159.1"; tss_id "TSS8158"; +chr6_dbb_hap3 Cufflinks exon 489 560 . + . gene_id "XLOC_008159"; transcript_id "TCONS_00008159"; exon_number "1"; oId "CUFF.8160.1"; tss_id "TSS8159"; +chr6_dbb_hap3 Cufflinks exon 18927 18999 . + . gene_id "XLOC_008160"; transcript_id "TCONS_00008160"; exon_number "1"; oId "CUFF.8163.1"; tss_id "TSS8160"; +chr6_dbb_hap3 Cufflinks exon 35572 35640 . + . gene_id "XLOC_008161"; transcript_id "TCONS_00008161"; exon_number "1"; oId "CUFF.8166.1"; tss_id "TSS8161"; +chr6_dbb_hap3 Cufflinks exon 68052 68086 . + . gene_id "XLOC_008162"; transcript_id "TCONS_00008162"; exon_number "1"; oId "CUFF.8171.1"; tss_id "TSS8162"; +chr6_dbb_hap3 Cufflinks exon 248663 248961 . + . gene_id "XLOC_008163"; transcript_id "TCONS_00008163"; exon_number "1"; oId "CUFF.8180.1"; tss_id "TSS8163"; +chr6_dbb_hap3 Cufflinks exon 253387 253458 . + . gene_id "XLOC_008164"; transcript_id "TCONS_00008164"; exon_number "1"; oId "CUFF.8182.1"; tss_id "TSS8164"; +chr6_dbb_hap3 Cufflinks exon 260190 260271 . + . gene_id "XLOC_008165"; transcript_id "TCONS_00008165"; exon_number "1"; oId "CUFF.8183.1"; tss_id "TSS8165"; +chr6_dbb_hap3 Cufflinks exon 373941 373984 . + . gene_id "XLOC_008166"; transcript_id "TCONS_00008166"; exon_number "1"; oId "CUFF.8184.1"; tss_id "TSS8166"; +chr6_dbb_hap3 Cufflinks exon 446630 446671 . + . gene_id "XLOC_008167"; transcript_id "TCONS_00008167"; exon_number "1"; oId "CUFF.8185.1"; tss_id "TSS8167"; +chr6_dbb_hap3 Cufflinks exon 726009 726043 . + . gene_id "XLOC_008168"; transcript_id "TCONS_00008168"; exon_number "1"; oId "CUFF.8186.1"; tss_id "TSS8168"; +chr6_dbb_hap3 Cufflinks exon 2126108 2126351 . + . gene_id "XLOC_008169"; transcript_id "TCONS_00008169"; exon_number "1"; oId "CUFF.8189.1"; tss_id "TSS8169"; +chr6_dbb_hap3 Cufflinks exon 2347996 2348059 . + . gene_id "XLOC_008170"; transcript_id "TCONS_00008170"; exon_number "1"; oId "CUFF.8190.1"; tss_id "TSS8170"; +chr6_dbb_hap3 Cufflinks exon 2389154 2389196 . + . gene_id "XLOC_008171"; transcript_id "TCONS_00008171"; exon_number "1"; oId "CUFF.8191.1"; tss_id "TSS8171"; +chr6_dbb_hap3 Cufflinks exon 2490184 2490222 . + . gene_id "XLOC_008172"; transcript_id "TCONS_00008172"; exon_number "1"; oId "CUFF.8193.1"; tss_id "TSS8172"; +chr6_dbb_hap3 Cufflinks exon 3599575 3599675 . + . gene_id "XLOC_008173"; transcript_id "TCONS_00008173"; exon_number "1"; oId "CUFF.8196.1"; tss_id "TSS8173"; +chr6_dbb_hap3 Cufflinks exon 6606 6678 . - . gene_id "XLOC_008174"; transcript_id "TCONS_00008174"; exon_number "1"; oId "CUFF.8161.1"; tss_id "TSS8174"; +chr6_dbb_hap3 Cufflinks exon 14129 14201 . - . gene_id "XLOC_008175"; transcript_id "TCONS_00008175"; exon_number "1"; oId "CUFF.8162.1"; tss_id "TSS8175"; +chr6_dbb_hap3 Cufflinks exon 29553 29624 . - . gene_id "XLOC_008176"; transcript_id "TCONS_00008176"; exon_number "1"; oId "CUFF.8164.1"; tss_id "TSS8176"; +chr6_dbb_hap3 Cufflinks exon 34783 34855 . - . gene_id "XLOC_008177"; transcript_id "TCONS_00008177"; exon_number "1"; oId "CUFF.8165.1"; tss_id "TSS8177"; +chr6_dbb_hap3 Cufflinks exon 49952 50024 . - . gene_id "XLOC_008178"; transcript_id "TCONS_00008178"; exon_number "1"; oId "CUFF.8167.1"; tss_id "TSS8178"; +chr6_dbb_hap3 Cufflinks exon 60948 61019 . - . gene_id "XLOC_008179"; transcript_id "TCONS_00008179"; exon_number "1"; oId "CUFF.8168.1"; tss_id "TSS8179"; +chr6_dbb_hap3 Cufflinks exon 61900 61972 . - . gene_id "XLOC_008180"; transcript_id "TCONS_00008180"; exon_number "1"; oId "CUFF.8169.1"; tss_id "TSS8180"; +chr6_dbb_hap3 Cufflinks exon 67140 67211 . - . gene_id "XLOC_008181"; transcript_id "TCONS_00008181"; exon_number "1"; oId "CUFF.8170.1"; tss_id "TSS8181"; +chr6_dbb_hap3 Cufflinks exon 73991 74061 . - . gene_id "XLOC_008182"; transcript_id "TCONS_00008182"; exon_number "1"; oId "CUFF.8172.1"; tss_id "TSS8182"; +chr6_dbb_hap3 Cufflinks exon 79020 79092 . - . gene_id "XLOC_008183"; transcript_id "TCONS_00008183"; exon_number "1"; oId "CUFF.8173.1"; tss_id "TSS8183"; +chr6_dbb_hap3 Cufflinks exon 83259 83330 . - . gene_id "XLOC_008184"; transcript_id "TCONS_00008184"; exon_number "1"; oId "CUFF.8174.1"; tss_id "TSS8184"; +chr6_dbb_hap3 Cufflinks exon 88422 88493 . - . gene_id "XLOC_008185"; transcript_id "TCONS_00008185"; exon_number "1"; oId "CUFF.8175.1"; tss_id "TSS8185"; +chr6_dbb_hap3 Cufflinks exon 94503 94576 . - . gene_id "XLOC_008186"; transcript_id "TCONS_00008186"; exon_number "1"; oId "CUFF.8176.1"; tss_id "TSS8186"; +chr6_dbb_hap3 Cufflinks exon 98600 98671 . - . gene_id "XLOC_008187"; transcript_id "TCONS_00008187"; exon_number "1"; oId "CUFF.8177.1"; tss_id "TSS8187"; +chr6_dbb_hap3 Cufflinks exon 109631 109702 . - . gene_id "XLOC_008188"; transcript_id "TCONS_00008188"; exon_number "1"; oId "CUFF.8178.1"; tss_id "TSS8188"; +chr6_dbb_hap3 Cufflinks exon 134872 134943 . - . gene_id "XLOC_008189"; transcript_id "TCONS_00008189"; exon_number "1"; oId "CUFF.8179.1"; tss_id "TSS8189"; +chr6_dbb_hap3 Cufflinks exon 252860 252932 . - . gene_id "XLOC_008190"; transcript_id "TCONS_00008190"; exon_number "1"; oId "CUFF.8181.1"; tss_id "TSS8190"; +chr6_dbb_hap3 Cufflinks exon 1030729 1031276 . - . gene_id "XLOC_008191"; transcript_id "TCONS_00008191"; exon_number "1"; oId "CUFF.8187.1"; tss_id "TSS8191"; +chr6_dbb_hap3 Cufflinks exon 1879668 1879733 . - . gene_id "XLOC_008192"; transcript_id "TCONS_00008192"; exon_number "1"; oId "CUFF.8188.1"; tss_id "TSS8192"; +chr6_dbb_hap3 Cufflinks exon 2395937 2395992 . - . gene_id "XLOC_008193"; transcript_id "TCONS_00008193"; exon_number "1"; oId "CUFF.8192.1"; tss_id "TSS8193"; +chr6_dbb_hap3 Cufflinks exon 3010313 3010412 . - . gene_id "XLOC_008194"; transcript_id "TCONS_00008194"; exon_number "1"; oId "CUFF.8194.1"; tss_id "TSS8194"; +chr6_dbb_hap3 Cufflinks exon 3325528 3325619 . - . gene_id "XLOC_008195"; transcript_id "TCONS_00008195"; exon_number "1"; oId "CUFF.8195.1"; tss_id "TSS8195"; +chr6_dbb_hap3 Cufflinks exon 3817657 3817733 . - . gene_id "XLOC_008196"; transcript_id "TCONS_00008196"; exon_number "1"; oId "CUFF.8197.1"; tss_id "TSS8196"; +chr6_mann_hap4 Cufflinks exon 489 560 . + . gene_id "XLOC_008197"; transcript_id "TCONS_00008197"; exon_number "1"; oId "CUFF.8198.1"; tss_id "TSS8197"; +chr6_mann_hap4 Cufflinks exon 18922 18994 . + . gene_id "XLOC_008198"; transcript_id "TCONS_00008198"; exon_number "1"; oId "CUFF.8201.1"; tss_id "TSS8198"; +chr6_mann_hap4 Cufflinks exon 35565 35633 . + . gene_id "XLOC_008199"; transcript_id "TCONS_00008199"; exon_number "1"; oId "CUFF.8204.1"; tss_id "TSS8199"; +chr6_mann_hap4 Cufflinks exon 68056 68090 . + . gene_id "XLOC_008200"; transcript_id "TCONS_00008200"; exon_number "1"; oId "CUFF.8209.1"; tss_id "TSS8200"; +chr6_mann_hap4 Cufflinks exon 186820 186923 . + . gene_id "XLOC_008201"; transcript_id "TCONS_00008201"; exon_number "1"; oId "CUFF.8219.1"; tss_id "TSS8201"; +chr6_mann_hap4 Cufflinks exon 212236 212341 . + . gene_id "XLOC_008202"; transcript_id "TCONS_00008202"; exon_number "1"; oId "CUFF.8220.1"; tss_id "TSS8202"; +chr6_mann_hap4 Cufflinks exon 215757 215829 . + . gene_id "XLOC_008203"; transcript_id "TCONS_00008203"; exon_number "1"; oId "CUFF.8223.1"; tss_id "TSS8203"; +chr6_mann_hap4 Cufflinks exon 222211 222283 . + . gene_id "XLOC_008204"; transcript_id "TCONS_00008204"; exon_number "1"; oId "CUFF.8224.1"; tss_id "TSS8204"; +chr6_mann_hap4 Cufflinks exon 248655 248953 . + . gene_id "XLOC_008205"; transcript_id "TCONS_00008205"; exon_number "1"; oId "CUFF.8226.1"; tss_id "TSS8205"; +chr6_mann_hap4 Cufflinks exon 253379 253450 . + . gene_id "XLOC_008206"; transcript_id "TCONS_00008206"; exon_number "1"; oId "CUFF.8228.1"; tss_id "TSS8206"; +chr6_mann_hap4 Cufflinks exon 260181 260262 . + . gene_id "XLOC_008207"; transcript_id "TCONS_00008207"; exon_number "1"; oId "CUFF.8229.1"; tss_id "TSS8207"; +chr6_mann_hap4 Cufflinks exon 373933 373976 . + . gene_id "XLOC_008208"; transcript_id "TCONS_00008208"; exon_number "1"; oId "CUFF.8230.1"; tss_id "TSS8208"; +chr6_mann_hap4 Cufflinks exon 446621 446662 . + . gene_id "XLOC_008209"; transcript_id "TCONS_00008209"; exon_number "1"; oId "CUFF.8231.1"; tss_id "TSS8209"; +chr6_mann_hap4 Cufflinks exon 725651 725685 . + . gene_id "XLOC_008210"; transcript_id "TCONS_00008210"; exon_number "1"; oId "CUFF.8232.1"; tss_id "TSS8210"; +chr6_mann_hap4 Cufflinks exon 2180115 2180358 . + . gene_id "XLOC_008211"; transcript_id "TCONS_00008211"; exon_number "1"; oId "CUFF.8235.1"; tss_id "TSS8211"; +chr6_mann_hap4 Cufflinks exon 2399163 2399226 . + . gene_id "XLOC_008212"; transcript_id "TCONS_00008212"; exon_number "1"; oId "CUFF.8236.1"; tss_id "TSS8212"; +chr6_mann_hap4 Cufflinks exon 2440339 2440381 . + . gene_id "XLOC_008213"; transcript_id "TCONS_00008213"; exon_number "1"; oId "CUFF.8237.1"; tss_id "TSS8213"; +chr6_mann_hap4 Cufflinks exon 2541449 2541487 . + . gene_id "XLOC_008214"; transcript_id "TCONS_00008214"; exon_number "1"; oId "CUFF.8239.1"; tss_id "TSS8214"; +chr6_mann_hap4 Cufflinks exon 2684363 2684469 . + . gene_id "XLOC_008215"; transcript_id "TCONS_00008215"; exon_number "1"; oId "CUFF.8240.1"; tss_id "TSS8215"; +chr6_mann_hap4 Cufflinks exon 3663501 3663601 . + . gene_id "XLOC_008216"; transcript_id "TCONS_00008216"; exon_number "1"; oId "CUFF.8242.1"; tss_id "TSS8216"; +chr6_mann_hap4 Cufflinks exon 6606 6678 . - . gene_id "XLOC_008217"; transcript_id "TCONS_00008217"; exon_number "1"; oId "CUFF.8199.1"; tss_id "TSS8217"; +chr6_mann_hap4 Cufflinks exon 14130 14202 . - . gene_id "XLOC_008218"; transcript_id "TCONS_00008218"; exon_number "1"; oId "CUFF.8200.1"; tss_id "TSS8218"; +chr6_mann_hap4 Cufflinks exon 29542 29613 . - . gene_id "XLOC_008219"; transcript_id "TCONS_00008219"; exon_number "1"; oId "CUFF.8202.1"; tss_id "TSS8219"; +chr6_mann_hap4 Cufflinks exon 34776 34848 . - . gene_id "XLOC_008220"; transcript_id "TCONS_00008220"; exon_number "1"; oId "CUFF.8203.1"; tss_id "TSS8220"; +chr6_mann_hap4 Cufflinks exon 49944 50016 . - . gene_id "XLOC_008221"; transcript_id "TCONS_00008221"; exon_number "1"; oId "CUFF.8205.1"; tss_id "TSS8221"; +chr6_mann_hap4 Cufflinks exon 60948 61019 . - . gene_id "XLOC_008222"; transcript_id "TCONS_00008222"; exon_number "1"; oId "CUFF.8206.1"; tss_id "TSS8222"; +chr6_mann_hap4 Cufflinks exon 61900 61972 . - . gene_id "XLOC_008223"; transcript_id "TCONS_00008223"; exon_number "1"; oId "CUFF.8207.1"; tss_id "TSS8223"; +chr6_mann_hap4 Cufflinks exon 67142 67213 . - . gene_id "XLOC_008224"; transcript_id "TCONS_00008224"; exon_number "1"; oId "CUFF.8208.1"; tss_id "TSS8224"; +chr6_mann_hap4 Cufflinks exon 73978 74048 . - . gene_id "XLOC_008225"; transcript_id "TCONS_00008225"; exon_number "1"; oId "CUFF.8210.1"; tss_id "TSS8225"; +chr6_mann_hap4 Cufflinks exon 79011 79083 . - . gene_id "XLOC_008226"; transcript_id "TCONS_00008226"; exon_number "1"; oId "CUFF.8211.1"; tss_id "TSS8226"; +chr6_mann_hap4 Cufflinks exon 83250 83321 . - . gene_id "XLOC_008227"; transcript_id "TCONS_00008227"; exon_number "1"; oId "CUFF.8212.1"; tss_id "TSS8227"; +chr6_mann_hap4 Cufflinks exon 88413 88484 . - . gene_id "XLOC_008228"; transcript_id "TCONS_00008228"; exon_number "1"; oId "CUFF.8213.1"; tss_id "TSS8228"; +chr6_mann_hap4 Cufflinks exon 94494 94567 . - . gene_id "XLOC_008229"; transcript_id "TCONS_00008229"; exon_number "1"; oId "CUFF.8214.1"; tss_id "TSS8229"; +chr6_mann_hap4 Cufflinks exon 98591 98662 . - . gene_id "XLOC_008230"; transcript_id "TCONS_00008230"; exon_number "1"; oId "CUFF.8215.1"; tss_id "TSS8230"; +chr6_mann_hap4 Cufflinks exon 109622 109693 . - . gene_id "XLOC_008231"; transcript_id "TCONS_00008231"; exon_number "1"; oId "CUFF.8216.1"; tss_id "TSS8231"; +chr6_mann_hap4 Cufflinks exon 134863 134934 . - . gene_id "XLOC_008232"; transcript_id "TCONS_00008232"; exon_number "1"; oId "CUFF.8217.1"; tss_id "TSS8232"; +chr6_mann_hap4 Cufflinks exon 139265 139303 . - . gene_id "XLOC_008233"; transcript_id "TCONS_00008233"; exon_number "1"; oId "CUFF.8218.1"; tss_id "TSS8233"; +chr6_mann_hap4 Cufflinks exon 212784 212855 . - . gene_id "XLOC_008234"; transcript_id "TCONS_00008234"; exon_number "1"; oId "CUFF.8221.1"; tss_id "TSS8234"; +chr6_mann_hap4 Cufflinks exon 214804 214885 . - . gene_id "XLOC_008235"; transcript_id "TCONS_00008235"; exon_number "1"; oId "CUFF.8222.1"; tss_id "TSS8235"; +chr6_mann_hap4 Cufflinks exon 224447 224519 . - . gene_id "XLOC_008236"; transcript_id "TCONS_00008236"; exon_number "1"; oId "CUFF.8225.1"; tss_id "TSS8236"; +chr6_mann_hap4 Cufflinks exon 252852 252924 . - . gene_id "XLOC_008237"; transcript_id "TCONS_00008237"; exon_number "1"; oId "CUFF.8227.1"; tss_id "TSS8237"; +chr6_mann_hap4 Cufflinks exon 1030359 1030906 . - . gene_id "XLOC_008238"; transcript_id "TCONS_00008238"; exon_number "1"; oId "CUFF.8233.1"; tss_id "TSS8238"; +chr6_mann_hap4 Cufflinks exon 1934102 1934167 . - . gene_id "XLOC_008239"; transcript_id "TCONS_00008239"; exon_number "1"; oId "CUFF.8234.1"; tss_id "TSS8239"; +chr6_mann_hap4 Cufflinks exon 2447139 2447194 . - . gene_id "XLOC_008240"; transcript_id "TCONS_00008240"; exon_number "1"; oId "CUFF.8238.1"; tss_id "TSS8240"; +chr6_mann_hap4 Cufflinks exon 3389162 3389253 . - . gene_id "XLOC_008241"; transcript_id "TCONS_00008241"; exon_number "1"; oId "CUFF.8241.1"; tss_id "TSS8241"; +chr6_mann_hap4 Cufflinks exon 3821225 3821301 . - . gene_id "XLOC_008242"; transcript_id "TCONS_00008242"; exon_number "1"; oId "CUFF.8243.1"; tss_id "TSS8242"; +chr6_mann_hap4 Cufflinks exon 3843343 3843418 . - . gene_id "XLOC_008243"; transcript_id "TCONS_00008243"; exon_number "1"; oId "CUFF.8244.1"; tss_id "TSS8243"; +chr6_mann_hap4 Cufflinks exon 3882773 3882849 . - . gene_id "XLOC_008244"; transcript_id "TCONS_00008244"; exon_number "1"; oId "CUFF.8245.1"; tss_id "TSS8244"; +chr6_mann_hap4 Cufflinks exon 3943750 3943826 . - . gene_id "XLOC_008245"; transcript_id "TCONS_00008245"; exon_number "1"; oId "CUFF.8246.1"; tss_id "TSS8245"; +chr6_mann_hap4 Cufflinks exon 3992101 3992176 . - . gene_id "XLOC_008246"; transcript_id "TCONS_00008246"; exon_number "1"; oId "CUFF.8247.1"; tss_id "TSS8246"; +chr6_mann_hap4 Cufflinks exon 4383277 4383306 . - . gene_id "XLOC_008247"; transcript_id "TCONS_00008247"; exon_number "1"; oId "CUFF.8248.1"; tss_id "TSS8247"; +chr6_mcf_hap5 Cufflinks exon 489 560 . + . gene_id "XLOC_008248"; transcript_id "TCONS_00008248"; exon_number "1"; oId "CUFF.8249.1"; tss_id "TSS8248"; +chr6_mcf_hap5 Cufflinks exon 18922 18994 . + . gene_id "XLOC_008249"; transcript_id "TCONS_00008249"; exon_number "1"; oId "CUFF.8252.1"; tss_id "TSS8249"; +chr6_mcf_hap5 Cufflinks exon 35565 35633 . + . gene_id "XLOC_008250"; transcript_id "TCONS_00008250"; exon_number "1"; oId "CUFF.8255.1"; tss_id "TSS8250"; +chr6_mcf_hap5 Cufflinks exon 68056 68090 . + . gene_id "XLOC_008251"; transcript_id "TCONS_00008251"; exon_number "1"; oId "CUFF.8260.1"; tss_id "TSS8251"; +chr6_mcf_hap5 Cufflinks exon 152723 152797 . + . gene_id "XLOC_008252"; transcript_id "TCONS_00008252"; exon_number "1"; oId "CUFF.8270.1"; tss_id "TSS8252"; +chr6_mcf_hap5 Cufflinks exon 186981 187084 . + . gene_id "XLOC_008253"; transcript_id "TCONS_00008253"; exon_number "1"; oId "CUFF.8272.1"; tss_id "TSS8253"; +chr6_mcf_hap5 Cufflinks exon 212391 212496 . + . gene_id "XLOC_008254"; transcript_id "TCONS_00008254"; exon_number "1"; oId "CUFF.8273.1"; tss_id "TSS8254"; +chr6_mcf_hap5 Cufflinks exon 215915 215987 . + . gene_id "XLOC_008255"; transcript_id "TCONS_00008255"; exon_number "1"; oId "CUFF.8276.1"; tss_id "TSS8255"; +chr6_mcf_hap5 Cufflinks exon 222359 222431 . + . gene_id "XLOC_008256"; transcript_id "TCONS_00008256"; exon_number "1"; oId "CUFF.8277.1"; tss_id "TSS8256"; +chr6_mcf_hap5 Cufflinks exon 374070 374113 . + . gene_id "XLOC_008257"; transcript_id "TCONS_00008257"; exon_number "1"; oId "CUFF.8279.1"; tss_id "TSS8257"; +chr6_mcf_hap5 Cufflinks exon 725858 725892 . + . gene_id "XLOC_008258"; transcript_id "TCONS_00008258"; exon_number "1"; oId "CUFF.8280.1"; tss_id "TSS8258"; +chr6_mcf_hap5 Cufflinks exon 2213993 2214236 . + . gene_id "XLOC_008259"; transcript_id "TCONS_00008259"; exon_number "1"; oId "CUFF.8283.1"; tss_id "TSS8259"; +chr6_mcf_hap5 Cufflinks exon 2432742 2432805 . + . gene_id "XLOC_008260"; transcript_id "TCONS_00008260"; exon_number "1"; oId "CUFF.8284.1"; tss_id "TSS8260"; +chr6_mcf_hap5 Cufflinks exon 2473907 2473949 . + . gene_id "XLOC_008261"; transcript_id "TCONS_00008261"; exon_number "1"; oId "CUFF.8285.1"; tss_id "TSS8261"; +chr6_mcf_hap5 Cufflinks exon 2575099 2575137 . + . gene_id "XLOC_008262"; transcript_id "TCONS_00008262"; exon_number "1"; oId "CUFF.8287.1"; tss_id "TSS8262"; +chr6_mcf_hap5 Cufflinks exon 3700216 3700316 . + . gene_id "XLOC_008263"; transcript_id "TCONS_00008263"; exon_number "1"; oId "CUFF.8290.1"; tss_id "TSS8263"; +chr6_mcf_hap5 Cufflinks exon 6606 6678 . - . gene_id "XLOC_008264"; transcript_id "TCONS_00008264"; exon_number "1"; oId "CUFF.8250.1"; tss_id "TSS8264"; +chr6_mcf_hap5 Cufflinks exon 14130 14202 . - . gene_id "XLOC_008265"; transcript_id "TCONS_00008265"; exon_number "1"; oId "CUFF.8251.1"; tss_id "TSS8265"; +chr6_mcf_hap5 Cufflinks exon 29542 29613 . - . gene_id "XLOC_008266"; transcript_id "TCONS_00008266"; exon_number "1"; oId "CUFF.8253.1"; tss_id "TSS8266"; +chr6_mcf_hap5 Cufflinks exon 34776 34848 . - . gene_id "XLOC_008267"; transcript_id "TCONS_00008267"; exon_number "1"; oId "CUFF.8254.1"; tss_id "TSS8267"; +chr6_mcf_hap5 Cufflinks exon 49944 50016 . - . gene_id "XLOC_008268"; transcript_id "TCONS_00008268"; exon_number "1"; oId "CUFF.8256.1"; tss_id "TSS8268"; +chr6_mcf_hap5 Cufflinks exon 60948 61019 . - . gene_id "XLOC_008269"; transcript_id "TCONS_00008269"; exon_number "1"; oId "CUFF.8257.1"; tss_id "TSS8269"; +chr6_mcf_hap5 Cufflinks exon 61900 61972 . - . gene_id "XLOC_008270"; transcript_id "TCONS_00008270"; exon_number "1"; oId "CUFF.8258.1"; tss_id "TSS8270"; +chr6_mcf_hap5 Cufflinks exon 67142 67213 . - . gene_id "XLOC_008271"; transcript_id "TCONS_00008271"; exon_number "1"; oId "CUFF.8259.1"; tss_id "TSS8271"; +chr6_mcf_hap5 Cufflinks exon 73978 74048 . - . gene_id "XLOC_008272"; transcript_id "TCONS_00008272"; exon_number "1"; oId "CUFF.8261.1"; tss_id "TSS8272"; +chr6_mcf_hap5 Cufflinks exon 79011 79083 . - . gene_id "XLOC_008273"; transcript_id "TCONS_00008273"; exon_number "1"; oId "CUFF.8262.1"; tss_id "TSS8273"; +chr6_mcf_hap5 Cufflinks exon 83250 83321 . - . gene_id "XLOC_008274"; transcript_id "TCONS_00008274"; exon_number "1"; oId "CUFF.8263.1"; tss_id "TSS8274"; +chr6_mcf_hap5 Cufflinks exon 88413 88484 . - . gene_id "XLOC_008275"; transcript_id "TCONS_00008275"; exon_number "1"; oId "CUFF.8264.1"; tss_id "TSS8275"; +chr6_mcf_hap5 Cufflinks exon 94488 94561 . - . gene_id "XLOC_008276"; transcript_id "TCONS_00008276"; exon_number "1"; oId "CUFF.8265.1"; tss_id "TSS8276"; +chr6_mcf_hap5 Cufflinks exon 98595 98666 . - . gene_id "XLOC_008277"; transcript_id "TCONS_00008277"; exon_number "1"; oId "CUFF.8266.1"; tss_id "TSS8277"; +chr6_mcf_hap5 Cufflinks exon 109627 109698 . - . gene_id "XLOC_008278"; transcript_id "TCONS_00008278"; exon_number "1"; oId "CUFF.8267.1"; tss_id "TSS8278"; +chr6_mcf_hap5 Cufflinks exon 134864 134935 . - . gene_id "XLOC_008279"; transcript_id "TCONS_00008279"; exon_number "1"; oId "CUFF.8268.1"; tss_id "TSS8279"; +chr6_mcf_hap5 Cufflinks exon 139267 139305 . - . gene_id "XLOC_008280"; transcript_id "TCONS_00008280"; exon_number "1"; oId "CUFF.8269.1"; tss_id "TSS8280"; +chr6_mcf_hap5 Cufflinks exon 167563 167669 . - . gene_id "XLOC_008281"; transcript_id "TCONS_00008281"; exon_number "1"; oId "CUFF.8271.1"; tss_id "TSS8281"; +chr6_mcf_hap5 Cufflinks exon 212939 213010 . - . gene_id "XLOC_008282"; transcript_id "TCONS_00008282"; exon_number "1"; oId "CUFF.8274.1"; tss_id "TSS8282"; +chr6_mcf_hap5 Cufflinks exon 214962 215043 . - . gene_id "XLOC_008283"; transcript_id "TCONS_00008283"; exon_number "1"; oId "CUFF.8275.1"; tss_id "TSS8283"; +chr6_mcf_hap5 Cufflinks exon 224595 224667 . - . gene_id "XLOC_008284"; transcript_id "TCONS_00008284"; exon_number "1"; oId "CUFF.8278.1"; tss_id "TSS8284"; +chr6_mcf_hap5 Cufflinks exon 1030395 1030506 . - . gene_id "XLOC_008285"; transcript_id "TCONS_00008285"; exon_number "1"; oId "CUFF.8281.1"; tss_id "TSS8285"; +chr6_mcf_hap5 Cufflinks exon 1967886 1967951 . - . gene_id "XLOC_008286"; transcript_id "TCONS_00008286"; exon_number "1"; oId "CUFF.8282.1"; tss_id "TSS8286"; +chr6_mcf_hap5 Cufflinks exon 2480716 2480771 . - . gene_id "XLOC_008287"; transcript_id "TCONS_00008287"; exon_number "1"; oId "CUFF.8286.1"; tss_id "TSS8287"; +chr6_mcf_hap5 Cufflinks exon 3104428 3104527 . - . gene_id "XLOC_008288"; transcript_id "TCONS_00008288"; exon_number "1"; oId "CUFF.8288.1"; tss_id "TSS8288"; +chr6_mcf_hap5 Cufflinks exon 3426153 3426244 . - . gene_id "XLOC_008289"; transcript_id "TCONS_00008289"; exon_number "1"; oId "CUFF.8289.1"; tss_id "TSS8289"; +chr6_mcf_hap5 Cufflinks exon 3857818 3857894 . - . gene_id "XLOC_008290"; transcript_id "TCONS_00008290"; exon_number "1"; oId "CUFF.8291.1"; tss_id "TSS8290"; +chr6_mcf_hap5 Cufflinks exon 3879617 3879692 . - . gene_id "XLOC_008291"; transcript_id "TCONS_00008291"; exon_number "1"; oId "CUFF.8292.1"; tss_id "TSS8291"; +chr6_mcf_hap5 Cufflinks exon 4262923 4262952 . - . gene_id "XLOC_008292"; transcript_id "TCONS_00008292"; exon_number "1"; oId "CUFF.8293.1"; tss_id "TSS8292"; +chr6_qbl_hap6 Cufflinks exon 489 560 . + . gene_id "XLOC_008293"; transcript_id "TCONS_00008293"; exon_number "1"; oId "CUFF.8294.1"; tss_id "TSS8293"; +chr6_qbl_hap6 Cufflinks exon 18922 18994 . + . gene_id "XLOC_008294"; transcript_id "TCONS_00008294"; exon_number "1"; oId "CUFF.8297.1"; tss_id "TSS8294"; +chr6_qbl_hap6 Cufflinks exon 35565 35633 . + . gene_id "XLOC_008295"; transcript_id "TCONS_00008295"; exon_number "1"; oId "CUFF.8300.1"; tss_id "TSS8295"; +chr6_qbl_hap6 Cufflinks exon 68056 68090 . + . gene_id "XLOC_008296"; transcript_id "TCONS_00008296"; exon_number "1"; oId "CUFF.8305.1"; tss_id "TSS8296"; +chr6_qbl_hap6 Cufflinks exon 152566 152640 . + . gene_id "XLOC_008297"; transcript_id "TCONS_00008297"; exon_number "1"; oId "CUFF.8315.1"; tss_id "TSS8297"; +chr6_qbl_hap6 Cufflinks exon 186819 186922 . + . gene_id "XLOC_008298"; transcript_id "TCONS_00008298"; exon_number "1"; oId "CUFF.8317.1"; tss_id "TSS8298"; +chr6_qbl_hap6 Cufflinks exon 212231 212336 . + . gene_id "XLOC_008299"; transcript_id "TCONS_00008299"; exon_number "1"; oId "CUFF.8318.1"; tss_id "TSS8299"; +chr6_qbl_hap6 Cufflinks exon 215752 215824 . + . gene_id "XLOC_008300"; transcript_id "TCONS_00008300"; exon_number "1"; oId "CUFF.8321.1"; tss_id "TSS8300"; +chr6_qbl_hap6 Cufflinks exon 222206 222278 . + . gene_id "XLOC_008301"; transcript_id "TCONS_00008301"; exon_number "1"; oId "CUFF.8322.1"; tss_id "TSS8301"; +chr6_qbl_hap6 Cufflinks exon 248650 248948 . + . gene_id "XLOC_008302"; transcript_id "TCONS_00008302"; exon_number "1"; oId "CUFF.8324.1"; tss_id "TSS8302"; +chr6_qbl_hap6 Cufflinks exon 253373 253444 . + . gene_id "XLOC_008303"; transcript_id "TCONS_00008303"; exon_number "1"; oId "CUFF.8326.1"; tss_id "TSS8303"; +chr6_qbl_hap6 Cufflinks exon 260176 260257 . + . gene_id "XLOC_008304"; transcript_id "TCONS_00008304"; exon_number "1"; oId "CUFF.8327.1"; tss_id "TSS8304"; +chr6_qbl_hap6 Cufflinks exon 373931 373974 . + . gene_id "XLOC_008305"; transcript_id "TCONS_00008305"; exon_number "1"; oId "CUFF.8328.1"; tss_id "TSS8305"; +chr6_qbl_hap6 Cufflinks exon 446624 446665 . + . gene_id "XLOC_008306"; transcript_id "TCONS_00008306"; exon_number "1"; oId "CUFF.8329.1"; tss_id "TSS8306"; +chr6_qbl_hap6 Cufflinks exon 725968 726002 . + . gene_id "XLOC_008307"; transcript_id "TCONS_00008307"; exon_number "1"; oId "CUFF.8330.1"; tss_id "TSS8307"; +chr6_qbl_hap6 Cufflinks exon 2125022 2125265 . + . gene_id "XLOC_008308"; transcript_id "TCONS_00008308"; exon_number "1"; oId "CUFF.8333.1"; tss_id "TSS8308"; +chr6_qbl_hap6 Cufflinks exon 2346643 2346706 . + . gene_id "XLOC_008309"; transcript_id "TCONS_00008309"; exon_number "1"; oId "CUFF.8334.1"; tss_id "TSS8309"; +chr6_qbl_hap6 Cufflinks exon 2387807 2387849 . + . gene_id "XLOC_008310"; transcript_id "TCONS_00008310"; exon_number "1"; oId "CUFF.8335.1"; tss_id "TSS8310"; +chr6_qbl_hap6 Cufflinks exon 2488967 2489005 . + . gene_id "XLOC_008311"; transcript_id "TCONS_00008311"; exon_number "1"; oId "CUFF.8337.1"; tss_id "TSS8311"; +chr6_qbl_hap6 Cufflinks exon 2631423 2631529 . + . gene_id "XLOC_008312"; transcript_id "TCONS_00008312"; exon_number "1"; oId "CUFF.8338.1"; tss_id "TSS8312"; +chr6_qbl_hap6 Cufflinks exon 3581516 3581616 . + . gene_id "XLOC_008313"; transcript_id "TCONS_00008313"; exon_number "1"; oId "CUFF.8341.1"; tss_id "TSS8313"; +chr6_qbl_hap6 Cufflinks exon 6606 6678 . - . gene_id "XLOC_008314"; transcript_id "TCONS_00008314"; exon_number "1"; oId "CUFF.8295.1"; tss_id "TSS8314"; +chr6_qbl_hap6 Cufflinks exon 14130 14202 . - . gene_id "XLOC_008315"; transcript_id "TCONS_00008315"; exon_number "1"; oId "CUFF.8296.1"; tss_id "TSS8315"; +chr6_qbl_hap6 Cufflinks exon 29542 29613 . - . gene_id "XLOC_008316"; transcript_id "TCONS_00008316"; exon_number "1"; oId "CUFF.8298.1"; tss_id "TSS8316"; +chr6_qbl_hap6 Cufflinks exon 34776 34848 . - . gene_id "XLOC_008317"; transcript_id "TCONS_00008317"; exon_number "1"; oId "CUFF.8299.1"; tss_id "TSS8317"; +chr6_qbl_hap6 Cufflinks exon 49944 50016 . - . gene_id "XLOC_008318"; transcript_id "TCONS_00008318"; exon_number "1"; oId "CUFF.8301.1"; tss_id "TSS8318"; +chr6_qbl_hap6 Cufflinks exon 60948 61019 . - . gene_id "XLOC_008319"; transcript_id "TCONS_00008319"; exon_number "1"; oId "CUFF.8302.1"; tss_id "TSS8319"; +chr6_qbl_hap6 Cufflinks exon 61900 61972 . - . gene_id "XLOC_008320"; transcript_id "TCONS_00008320"; exon_number "1"; oId "CUFF.8303.1"; tss_id "TSS8320"; +chr6_qbl_hap6 Cufflinks exon 67142 67213 . - . gene_id "XLOC_008321"; transcript_id "TCONS_00008321"; exon_number "1"; oId "CUFF.8304.1"; tss_id "TSS8321"; +chr6_qbl_hap6 Cufflinks exon 73978 74048 . - . gene_id "XLOC_008322"; transcript_id "TCONS_00008322"; exon_number "1"; oId "CUFF.8306.1"; tss_id "TSS8322"; +chr6_qbl_hap6 Cufflinks exon 79011 79083 . - . gene_id "XLOC_008323"; transcript_id "TCONS_00008323"; exon_number "1"; oId "CUFF.8307.1"; tss_id "TSS8323"; +chr6_qbl_hap6 Cufflinks exon 83250 83321 . - . gene_id "XLOC_008324"; transcript_id "TCONS_00008324"; exon_number "1"; oId "CUFF.8308.1"; tss_id "TSS8324"; +chr6_qbl_hap6 Cufflinks exon 88413 88484 . - . gene_id "XLOC_008325"; transcript_id "TCONS_00008325"; exon_number "1"; oId "CUFF.8309.1"; tss_id "TSS8325"; +chr6_qbl_hap6 Cufflinks exon 94494 94567 . - . gene_id "XLOC_008326"; transcript_id "TCONS_00008326"; exon_number "1"; oId "CUFF.8310.1"; tss_id "TSS8326"; +chr6_qbl_hap6 Cufflinks exon 98591 98662 . - . gene_id "XLOC_008327"; transcript_id "TCONS_00008327"; exon_number "1"; oId "CUFF.8311.1"; tss_id "TSS8327"; +chr6_qbl_hap6 Cufflinks exon 109622 109693 . - . gene_id "XLOC_008328"; transcript_id "TCONS_00008328"; exon_number "1"; oId "CUFF.8312.1"; tss_id "TSS8328"; +chr6_qbl_hap6 Cufflinks exon 134863 134934 . - . gene_id "XLOC_008329"; transcript_id "TCONS_00008329"; exon_number "1"; oId "CUFF.8313.1"; tss_id "TSS8329"; +chr6_qbl_hap6 Cufflinks exon 139265 139303 . - . gene_id "XLOC_008330"; transcript_id "TCONS_00008330"; exon_number "1"; oId "CUFF.8314.1"; tss_id "TSS8330"; +chr6_qbl_hap6 Cufflinks exon 167400 167506 . - . gene_id "XLOC_008331"; transcript_id "TCONS_00008331"; exon_number "1"; oId "CUFF.8316.1"; tss_id "TSS8331"; +chr6_qbl_hap6 Cufflinks exon 212779 212850 . - . gene_id "XLOC_008332"; transcript_id "TCONS_00008332"; exon_number "1"; oId "CUFF.8319.1"; tss_id "TSS8332"; +chr6_qbl_hap6 Cufflinks exon 214799 214880 . - . gene_id "XLOC_008333"; transcript_id "TCONS_00008333"; exon_number "1"; oId "CUFF.8320.1"; tss_id "TSS8333"; +chr6_qbl_hap6 Cufflinks exon 224442 224514 . - . gene_id "XLOC_008334"; transcript_id "TCONS_00008334"; exon_number "1"; oId "CUFF.8323.1"; tss_id "TSS8334"; +chr6_qbl_hap6 Cufflinks exon 252846 252918 . - . gene_id "XLOC_008335"; transcript_id "TCONS_00008335"; exon_number "1"; oId "CUFF.8325.1"; tss_id "TSS8335"; +chr6_qbl_hap6 Cufflinks exon 1030714 1031261 . - . gene_id "XLOC_008336"; transcript_id "TCONS_00008336"; exon_number "1"; oId "CUFF.8331.1"; tss_id "TSS8336"; +chr6_qbl_hap6 Cufflinks exon 1878937 1879002 . - . gene_id "XLOC_008337"; transcript_id "TCONS_00008337"; exon_number "1"; oId "CUFF.8332.1"; tss_id "TSS8337"; +chr6_qbl_hap6 Cufflinks exon 2394617 2394672 . - . gene_id "XLOC_008338"; transcript_id "TCONS_00008338"; exon_number "1"; oId "CUFF.8336.1"; tss_id "TSS8338"; +chr6_qbl_hap6 Cufflinks exon 3018372 3018471 . - . gene_id "XLOC_008339"; transcript_id "TCONS_00008339"; exon_number "1"; oId "CUFF.8339.1"; tss_id "TSS8339"; +chr6_qbl_hap6 Cufflinks exon 3307337 3307428 . - . gene_id "XLOC_008340"; transcript_id "TCONS_00008340"; exon_number "1"; oId "CUFF.8340.1"; tss_id "TSS8340"; +chr6_qbl_hap6 Cufflinks exon 3718452 3718527 . - . gene_id "XLOC_008341"; transcript_id "TCONS_00008341"; exon_number "1"; oId "CUFF.8342.1"; tss_id "TSS8341"; +chr6_qbl_hap6 Cufflinks exon 3756300 3756375 . - . gene_id "XLOC_008342"; transcript_id "TCONS_00008342"; exon_number "1"; oId "CUFF.8343.1"; tss_id "TSS8342"; +chr6_qbl_hap6 Cufflinks exon 3782211 3782281 . - . gene_id "XLOC_008343"; transcript_id "TCONS_00008343"; exon_number "1"; oId "CUFF.8344.1"; tss_id "TSS8343"; +chr6_qbl_hap6 Cufflinks exon 4158195 4158224 . - . gene_id "XLOC_008344"; transcript_id "TCONS_00008344"; exon_number "1"; oId "CUFF.8345.1"; tss_id "TSS8344"; +chr6_ssto_hap7 Cufflinks exon 19224 19295 . + . gene_id "XLOC_008345"; transcript_id "TCONS_00008345"; exon_number "1"; oId "CUFF.8349.1"; tss_id "TSS8345"; +chr6_ssto_hap7 Cufflinks exon 27538 27588 . + . gene_id "XLOC_008346"; transcript_id "TCONS_00008346"; exon_number "1"; oId "CUFF.8350.1"; tss_id "TSS8346"; +chr6_ssto_hap7 Cufflinks exon 28339 28410 . + . gene_id "XLOC_008347"; transcript_id "TCONS_00008347"; exon_number "1"; oId "CUFF.8351.1"; tss_id "TSS8347"; +chr6_ssto_hap7 Cufflinks exon 34653 34726 . + . gene_id "XLOC_008348"; transcript_id "TCONS_00008348"; exon_number "1"; oId "CUFF.8352.1"; tss_id "TSS8348"; +chr6_ssto_hap7 Cufflinks exon 37950 38021 . + . gene_id "XLOC_008349"; transcript_id "TCONS_00008349"; exon_number "1"; oId "CUFF.8354.1"; tss_id "TSS8349"; +chr6_ssto_hap7 Cufflinks exon 56370 56442 . + . gene_id "XLOC_008350"; transcript_id "TCONS_00008350"; exon_number "1"; oId "CUFF.8357.1"; tss_id "TSS8350"; +chr6_ssto_hap7 Cufflinks exon 73049 73117 . + . gene_id "XLOC_008351"; transcript_id "TCONS_00008351"; exon_number "1"; oId "CUFF.8360.1"; tss_id "TSS8351"; +chr6_ssto_hap7 Cufflinks exon 105497 105531 . + . gene_id "XLOC_008352"; transcript_id "TCONS_00008352"; exon_number "1"; oId "CUFF.8365.1"; tss_id "TSS8352"; +chr6_ssto_hap7 Cufflinks exon 190087 190161 . + . gene_id "XLOC_008353"; transcript_id "TCONS_00008353"; exon_number "1"; oId "CUFF.8375.1"; tss_id "TSS8353"; +chr6_ssto_hap7 Cufflinks exon 224332 224435 . + . gene_id "XLOC_008354"; transcript_id "TCONS_00008354"; exon_number "1"; oId "CUFF.8377.1"; tss_id "TSS8354"; +chr6_ssto_hap7 Cufflinks exon 249745 249850 . + . gene_id "XLOC_008355"; transcript_id "TCONS_00008355"; exon_number "1"; oId "CUFF.8378.1"; tss_id "TSS8355"; +chr6_ssto_hap7 Cufflinks exon 253269 253341 . + . gene_id "XLOC_008356"; transcript_id "TCONS_00008356"; exon_number "1"; oId "CUFF.8381.1"; tss_id "TSS8356"; +chr6_ssto_hap7 Cufflinks exon 259713 259785 . + . gene_id "XLOC_008357"; transcript_id "TCONS_00008357"; exon_number "1"; oId "CUFF.8382.1"; tss_id "TSS8357"; +chr6_ssto_hap7 Cufflinks exon 286224 286522 . + . gene_id "XLOC_008358"; transcript_id "TCONS_00008358"; exon_number "1"; oId "CUFF.8384.1"; tss_id "TSS8358"; +chr6_ssto_hap7 Cufflinks exon 290947 291018 . + . gene_id "XLOC_008359"; transcript_id "TCONS_00008359"; exon_number "1"; oId "CUFF.8386.1"; tss_id "TSS8359"; +chr6_ssto_hap7 Cufflinks exon 297761 297842 . + . gene_id "XLOC_008360"; transcript_id "TCONS_00008360"; exon_number "1"; oId "CUFF.8387.1"; tss_id "TSS8360"; +chr6_ssto_hap7 Cufflinks exon 411416 411459 . + . gene_id "XLOC_008361"; transcript_id "TCONS_00008361"; exon_number "1"; oId "CUFF.8388.1"; tss_id "TSS8361"; +chr6_ssto_hap7 Cufflinks exon 484104 484145 . + . gene_id "XLOC_008362"; transcript_id "TCONS_00008362"; exon_number "1"; oId "CUFF.8389.1"; tss_id "TSS8362"; +chr6_ssto_hap7 Cufflinks exon 763212 763246 . + . gene_id "XLOC_008363"; transcript_id "TCONS_00008363"; exon_number "1"; oId "CUFF.8390.1"; tss_id "TSS8363"; +chr6_ssto_hap7 Cufflinks exon 2385828 2385891 . + . gene_id "XLOC_008364"; transcript_id "TCONS_00008364"; exon_number "1"; oId "CUFF.8393.1"; tss_id "TSS8364"; +chr6_ssto_hap7 Cufflinks exon 2528010 2528048 . + . gene_id "XLOC_008365"; transcript_id "TCONS_00008365"; exon_number "1"; oId "CUFF.8394.1"; tss_id "TSS8365"; +chr6_ssto_hap7 Cufflinks exon 2671649 2671755 . + . gene_id "XLOC_008366"; transcript_id "TCONS_00008366"; exon_number "1"; oId "CUFF.8395.1"; tss_id "TSS8366"; +chr6_ssto_hap7 Cufflinks exon 2773922 2774104 . + . gene_id "XLOC_008367"; transcript_id "TCONS_00008367"; exon_number "1"; oId "CUFF.8396.1"; tss_id "TSS8367"; +chr6_ssto_hap7 Cufflinks exon 3668100 3668200 . + . gene_id "XLOC_008368"; transcript_id "TCONS_00008368"; exon_number "1"; oId "CUFF.8398.1"; tss_id "TSS8368"; +chr6_ssto_hap7 Cufflinks exon 4919754 4919788 . + . gene_id "XLOC_008369"; transcript_id "TCONS_00008369"; exon_number "1"; oId "CUFF.8405.1"; tss_id "TSS8369"; +chr6_ssto_hap7 Cufflinks exon 1845 1918 . - . gene_id "XLOC_008370"; transcript_id "TCONS_00008370"; exon_number "1"; oId "CUFF.8346.1"; tss_id "TSS8370"; +chr6_ssto_hap7 Cufflinks exon 4567 4638 . - . gene_id "XLOC_008371"; transcript_id "TCONS_00008371"; exon_number "1"; oId "CUFF.8347.1"; tss_id "TSS8371"; +chr6_ssto_hap7 Cufflinks exon 5802 5851 . - . gene_id "XLOC_008372"; transcript_id "TCONS_00008372"; exon_number "1"; oId "CUFF.8348.1"; tss_id "TSS8372"; +chr6_ssto_hap7 Cufflinks exon 35713 35785 . - . gene_id "XLOC_008373"; transcript_id "TCONS_00008373"; exon_number "1"; oId "CUFF.8353.1"; tss_id "TSS8373"; +chr6_ssto_hap7 Cufflinks exon 44066 44138 . - . gene_id "XLOC_008374"; transcript_id "TCONS_00008374"; exon_number "1"; oId "CUFF.8355.1"; tss_id "TSS8374"; +chr6_ssto_hap7 Cufflinks exon 51591 51663 . - . gene_id "XLOC_008375"; transcript_id "TCONS_00008375"; exon_number "1"; oId "CUFF.8356.1"; tss_id "TSS8375"; +chr6_ssto_hap7 Cufflinks exon 67003 67074 . - . gene_id "XLOC_008376"; transcript_id "TCONS_00008376"; exon_number "1"; oId "CUFF.8358.1"; tss_id "TSS8376"; +chr6_ssto_hap7 Cufflinks exon 72260 72332 . - . gene_id "XLOC_008377"; transcript_id "TCONS_00008377"; exon_number "1"; oId "CUFF.8359.1"; tss_id "TSS8377"; +chr6_ssto_hap7 Cufflinks exon 87424 87496 . - . gene_id "XLOC_008378"; transcript_id "TCONS_00008378"; exon_number "1"; oId "CUFF.8361.1"; tss_id "TSS8378"; +chr6_ssto_hap7 Cufflinks exon 98397 98468 . - . gene_id "XLOC_008379"; transcript_id "TCONS_00008379"; exon_number "1"; oId "CUFF.8362.1"; tss_id "TSS8379"; +chr6_ssto_hap7 Cufflinks exon 99350 99422 . - . gene_id "XLOC_008380"; transcript_id "TCONS_00008380"; exon_number "1"; oId "CUFF.8363.1"; tss_id "TSS8380"; +chr6_ssto_hap7 Cufflinks exon 104591 104662 . - . gene_id "XLOC_008381"; transcript_id "TCONS_00008381"; exon_number "1"; oId "CUFF.8364.1"; tss_id "TSS8381"; +chr6_ssto_hap7 Cufflinks exon 111345 111416 . - . gene_id "XLOC_008382"; transcript_id "TCONS_00008382"; exon_number "1"; oId "CUFF.8366.1"; tss_id "TSS8382"; +chr6_ssto_hap7 Cufflinks exon 116373 116445 . - . gene_id "XLOC_008383"; transcript_id "TCONS_00008383"; exon_number "1"; oId "CUFF.8367.1"; tss_id "TSS8383"; +chr6_ssto_hap7 Cufflinks exon 120616 120687 . - . gene_id "XLOC_008384"; transcript_id "TCONS_00008384"; exon_number "1"; oId "CUFF.8368.1"; tss_id "TSS8384"; +chr6_ssto_hap7 Cufflinks exon 125779 125850 . - . gene_id "XLOC_008385"; transcript_id "TCONS_00008385"; exon_number "1"; oId "CUFF.8369.1"; tss_id "TSS8385"; +chr6_ssto_hap7 Cufflinks exon 131854 131927 . - . gene_id "XLOC_008386"; transcript_id "TCONS_00008386"; exon_number "1"; oId "CUFF.8370.1"; tss_id "TSS8386"; +chr6_ssto_hap7 Cufflinks exon 135957 136028 . - . gene_id "XLOC_008387"; transcript_id "TCONS_00008387"; exon_number "1"; oId "CUFF.8371.1"; tss_id "TSS8387"; +chr6_ssto_hap7 Cufflinks exon 146990 147061 . - . gene_id "XLOC_008388"; transcript_id "TCONS_00008388"; exon_number "1"; oId "CUFF.8372.1"; tss_id "TSS8388"; +chr6_ssto_hap7 Cufflinks exon 172228 172299 . - . gene_id "XLOC_008389"; transcript_id "TCONS_00008389"; exon_number "1"; oId "CUFF.8373.1"; tss_id "TSS8389"; +chr6_ssto_hap7 Cufflinks exon 176632 176670 . - . gene_id "XLOC_008390"; transcript_id "TCONS_00008390"; exon_number "1"; oId "CUFF.8374.1"; tss_id "TSS8390"; +chr6_ssto_hap7 Cufflinks exon 204923 205029 . - . gene_id "XLOC_008391"; transcript_id "TCONS_00008391"; exon_number "1"; oId "CUFF.8376.1"; tss_id "TSS8391"; +chr6_ssto_hap7 Cufflinks exon 250293 250364 . - . gene_id "XLOC_008392"; transcript_id "TCONS_00008392"; exon_number "1"; oId "CUFF.8379.1"; tss_id "TSS8392"; +chr6_ssto_hap7 Cufflinks exon 252316 252397 . - . gene_id "XLOC_008393"; transcript_id "TCONS_00008393"; exon_number "1"; oId "CUFF.8380.1"; tss_id "TSS8393"; +chr6_ssto_hap7 Cufflinks exon 261949 262021 . - . gene_id "XLOC_008394"; transcript_id "TCONS_00008394"; exon_number "1"; oId "CUFF.8383.1"; tss_id "TSS8394"; +chr6_ssto_hap7 Cufflinks exon 290420 290492 . - . gene_id "XLOC_008395"; transcript_id "TCONS_00008395"; exon_number "1"; oId "CUFF.8385.1"; tss_id "TSS8395"; +chr6_ssto_hap7 Cufflinks exon 1067593 1068140 . - . gene_id "XLOC_008396"; transcript_id "TCONS_00008396"; exon_number "1"; oId "CUFF.8391.1"; tss_id "TSS8396"; +chr6_ssto_hap7 Cufflinks exon 1918309 1918374 . - . gene_id "XLOC_008397"; transcript_id "TCONS_00008397"; exon_number "1"; oId "CUFF.8392.1"; tss_id "TSS8397"; +chr6_ssto_hap7 Cufflinks exon 3055544 3055643 . - . gene_id "XLOC_008398"; transcript_id "TCONS_00008398"; exon_number "1"; oId "CUFF.8397.1"; tss_id "TSS8398"; +chr6_ssto_hap7 Cufflinks exon 3825929 3826005 . - . gene_id "XLOC_008399"; transcript_id "TCONS_00008399"; exon_number "1"; oId "CUFF.8399.1"; tss_id "TSS8399"; +chr6_ssto_hap7 Cufflinks exon 3847726 3847802 . - . gene_id "XLOC_008400"; transcript_id "TCONS_00008400"; exon_number "1"; oId "CUFF.8400.1"; tss_id "TSS8400"; +chr6_ssto_hap7 Cufflinks exon 3887150 3887226 . - . gene_id "XLOC_008401"; transcript_id "TCONS_00008401"; exon_number "1"; oId "CUFF.8401.1"; tss_id "TSS8401"; +chr6_ssto_hap7 Cufflinks exon 3927729 3927805 . - . gene_id "XLOC_008402"; transcript_id "TCONS_00008402"; exon_number "1"; oId "CUFF.8402.1"; tss_id "TSS8402"; +chr6_ssto_hap7 Cufflinks exon 3975967 3976043 . - . gene_id "XLOC_008403"; transcript_id "TCONS_00008403"; exon_number "1"; oId "CUFF.8403.1"; tss_id "TSS8403"; +chr6_ssto_hap7 Cufflinks exon 4356826 4356855 . - . gene_id "XLOC_008404"; transcript_id "TCONS_00008404"; exon_number "1"; oId "CUFF.8404.1"; tss_id "TSS8404"; +chr7 Cufflinks exon 2624552 2624588 . + . gene_id "XLOC_008405"; transcript_id "TCONS_00008405"; exon_number "1"; oId "CUFF.8408.1"; tss_id "TSS8405"; +chr7 Cufflinks exon 3038728 3038973 . + . gene_id "XLOC_008406"; transcript_id "TCONS_00008406"; exon_number "1"; oId "CUFF.8410.1"; tss_id "TSS8406"; +chr7 Cufflinks exon 3769468 3769502 . + . gene_id "XLOC_008407"; transcript_id "TCONS_00008407"; exon_number "1"; oId "CUFF.8411.1"; tss_id "TSS8407"; +chr7 Cufflinks exon 4729110 4729217 . + . gene_id "XLOC_008408"; transcript_id "TCONS_00008408"; exon_number "1"; oId "CUFF.8413.1"; tss_id "TSS8408"; +chr7 Cufflinks exon 5219689 5219793 . + . gene_id "XLOC_008409"; transcript_id "TCONS_00008409"; exon_number "1"; oId "CUFF.8415.1"; tss_id "TSS8409"; +chr7 Cufflinks exon 5525025 5525134 . + . gene_id "XLOC_008410"; transcript_id "TCONS_00008410"; exon_number "1"; oId "CUFF.8416.1"; tss_id "TSS8410"; +chr7 Cufflinks exon 5874407 5874448 . + . gene_id "XLOC_008411"; transcript_id "TCONS_00008411"; exon_number "1"; oId "CUFF.8417.1"; tss_id "TSS8411"; +chr7 Cufflinks exon 5933063 5933116 . + . gene_id "XLOC_008412"; transcript_id "TCONS_00008412"; exon_number "1"; oId "CUFF.8419.1"; tss_id "TSS8412"; +chr7 Cufflinks exon 6097131 6097230 . + . gene_id "XLOC_008413"; transcript_id "TCONS_00008413"; exon_number "1"; oId "CUFF.8422.1"; tss_id "TSS8413"; +chr7 Cufflinks exon 6247714 6247749 . + . gene_id "XLOC_008414"; transcript_id "TCONS_00008414"; exon_number "1"; oId "CUFF.8423.1"; tss_id "TSS8414"; +chr7 Cufflinks exon 7946147 7946250 . + . gene_id "XLOC_008415"; transcript_id "TCONS_00008415"; exon_number "1"; oId "CUFF.8425.1"; tss_id "TSS8415"; +chr7 Cufflinks exon 8577664 8577700 . + . gene_id "XLOC_008416"; transcript_id "TCONS_00008416"; exon_number "1"; oId "CUFF.8427.1"; tss_id "TSS8416"; +chr7 Cufflinks exon 9462750 9462788 . + . gene_id "XLOC_008417"; transcript_id "TCONS_00008417"; exon_number "1"; oId "CUFF.8428.1"; tss_id "TSS8417"; +chr7 Cufflinks exon 10254375 10254419 . + . gene_id "XLOC_008418"; transcript_id "TCONS_00008418"; exon_number "1"; oId "CUFF.8429.1"; tss_id "TSS8418"; +chr7 Cufflinks exon 10262424 10262638 . + . gene_id "XLOC_008419"; transcript_id "TCONS_00008419"; exon_number "1"; oId "CUFF.8430.1"; tss_id "TSS8419"; +chr7 Cufflinks exon 10888452 10888495 . + . gene_id "XLOC_008420"; transcript_id "TCONS_00008420"; exon_number "1"; oId "CUFF.8431.1"; tss_id "TSS8420"; +chr7 Cufflinks exon 11349228 11349261 . + . gene_id "XLOC_008421"; transcript_id "TCONS_00008421"; exon_number "1"; oId "CUFF.8432.1"; tss_id "TSS8421"; +chr7 Cufflinks exon 11994348 11994389 . + . gene_id "XLOC_008422"; transcript_id "TCONS_00008422"; exon_number "1"; oId "CUFF.8434.1"; tss_id "TSS8422"; +chr7 Cufflinks exon 12366591 12366657 . + . gene_id "XLOC_008423"; transcript_id "TCONS_00008423"; exon_number "1"; oId "CUFF.8436.1"; tss_id "TSS8423"; +chr7 Cufflinks exon 12641610 12641672 . + . gene_id "XLOC_008424"; transcript_id "TCONS_00008424"; exon_number "1"; oId "CUFF.8437.1"; tss_id "TSS8424"; +chr7 Cufflinks exon 12916309 12916507 . + . gene_id "XLOC_008425"; transcript_id "TCONS_00008425"; exon_number "1"; oId "CUFF.8438.1"; tss_id "TSS8425"; +chr7 Cufflinks exon 15646155 15646203 . + . gene_id "XLOC_008426"; transcript_id "TCONS_00008426"; exon_number "1"; oId "CUFF.8442.1"; tss_id "TSS8426"; +chr7 Cufflinks exon 16508027 16508065 . + . gene_id "XLOC_008427"; transcript_id "TCONS_00008427"; exon_number "1"; oId "CUFF.8444.1"; tss_id "TSS8427"; +chr7 Cufflinks exon 17245276 17245557 . + . gene_id "XLOC_008428"; transcript_id "TCONS_00008428"; exon_number "1"; oId "CUFF.8445.1"; tss_id "TSS8428"; +chr7 Cufflinks exon 17245610 17245702 . + . gene_id "XLOC_008429"; transcript_id "TCONS_00008429"; exon_number "1"; oId "CUFF.8446.1"; tss_id "TSS8429"; +chr7 Cufflinks exon 20686966 20687012 . + . gene_id "XLOC_008430"; transcript_id "TCONS_00008430"; exon_number "1"; oId "CUFF.8448.1"; tss_id "TSS8430"; +chr7 Cufflinks exon 20746335 20746457 . + . gene_id "XLOC_008431"; transcript_id "TCONS_00008431"; exon_number "1"; oId "CUFF.8449.1"; tss_id "TSS8431"; +chr7 Cufflinks exon 21086258 21086292 . + . gene_id "XLOC_008432"; transcript_id "TCONS_00008432"; exon_number "1"; oId "CUFF.8450.1"; tss_id "TSS8432"; +chr7 Cufflinks exon 21420981 21421112 . + . gene_id "XLOC_008433"; transcript_id "TCONS_00008433"; exon_number "1"; oId "CUFF.8452.1"; tss_id "TSS8433"; +chr7 Cufflinks exon 22325729 22325770 . + . gene_id "XLOC_008434"; transcript_id "TCONS_00008434"; exon_number "1"; oId "CUFF.8453.1"; tss_id "TSS8434"; +chr7 Cufflinks exon 22338213 22338302 . + . gene_id "XLOC_008435"; transcript_id "TCONS_00008435"; exon_number "1"; oId "CUFF.8454.1"; tss_id "TSS8435"; +chr7 Cufflinks exon 22704226 22704281 . + . gene_id "XLOC_008436"; transcript_id "TCONS_00008436"; exon_number "1"; oId "CUFF.8456.1"; tss_id "TSS8436"; +chr7 Cufflinks exon 22977537 22977573 . + . gene_id "XLOC_008437"; transcript_id "TCONS_00008437"; exon_number "1"; oId "CUFF.8457.1"; tss_id "TSS8437"; +chr7 Cufflinks exon 23152209 23152244 . + . gene_id "XLOC_008438"; transcript_id "TCONS_00008438"; exon_number "1"; oId "CUFF.8459.1"; tss_id "TSS8438"; +chr7 Cufflinks exon 23186459 23186495 . + . gene_id "XLOC_008439"; transcript_id "TCONS_00008439"; exon_number "1"; oId "CUFF.8460.1"; tss_id "TSS8439"; +chr7 Cufflinks exon 23490279 23490340 . + . gene_id "XLOC_008440"; transcript_id "TCONS_00008440"; exon_number "1"; oId "CUFF.8461.1"; tss_id "TSS8440"; +chr7 Cufflinks exon 23579562 23579610 . + . gene_id "XLOC_008441"; transcript_id "TCONS_00008441"; exon_number "1"; oId "CUFF.8462.1"; tss_id "TSS8441"; +chr7 Cufflinks exon 24172328 24172413 . + . gene_id "XLOC_008442"; transcript_id "TCONS_00008442"; exon_number "1"; oId "CUFF.8465.1"; tss_id "TSS8442"; +chr7 Cufflinks exon 24396547 24396589 . + . gene_id "XLOC_008443"; transcript_id "TCONS_00008443"; exon_number "1"; oId "CUFF.8467.1"; tss_id "TSS8443"; +chr7 Cufflinks exon 24576951 24577057 . + . gene_id "XLOC_008444"; transcript_id "TCONS_00008444"; exon_number "1"; oId "CUFF.8468.1"; tss_id "TSS8444"; +chr7 Cufflinks exon 25304276 25304501 . + . gene_id "XLOC_008445"; transcript_id "TCONS_00008445"; exon_number "1"; oId "CUFF.8469.1"; tss_id "TSS8445"; +chr7 Cufflinks exon 25329519 25329586 . + . gene_id "XLOC_008446"; transcript_id "TCONS_00008446"; exon_number "1"; oId "CUFF.8470.1"; tss_id "TSS8446"; +chr7 Cufflinks exon 25649912 25649953 . + . gene_id "XLOC_008447"; transcript_id "TCONS_00008447"; exon_number "1"; oId "CUFF.8471.1"; tss_id "TSS8447"; +chr7 Cufflinks exon 26093483 26093524 . + . gene_id "XLOC_008448"; transcript_id "TCONS_00008448"; exon_number "1"; oId "CUFF.8472.1"; tss_id "TSS8448"; +chr7 Cufflinks exon 29305538 29305652 . + . gene_id "XLOC_008449"; transcript_id "TCONS_00008449"; exon_number "1"; oId "CUFF.8479.1"; tss_id "TSS8449"; +chr7 Cufflinks exon 29545833 29545870 . + . gene_id "XLOC_008450"; transcript_id "TCONS_00008450"; exon_number "1"; oId "CUFF.8480.1"; tss_id "TSS8450"; +chr7 Cufflinks exon 29952143 29952251 . + . gene_id "XLOC_008451"; transcript_id "TCONS_00008451"; exon_number "1"; oId "CUFF.8481.1"; tss_id "TSS8451"; +chr7 Cufflinks exon 33122436 33122498 . + . gene_id "XLOC_008452"; transcript_id "TCONS_00008452"; exon_number "1"; oId "CUFF.8485.1"; tss_id "TSS8452"; +chr7 Cufflinks exon 33123224 33123327 . + . gene_id "XLOC_008453"; transcript_id "TCONS_00008453"; exon_number "1"; oId "CUFF.8486.1"; tss_id "TSS8453"; +chr7 Cufflinks exon 33217352 33217443 . + . gene_id "XLOC_008454"; transcript_id "TCONS_00008454"; exon_number "1"; oId "CUFF.8488.1"; tss_id "TSS8454"; +chr7 Cufflinks exon 34793036 34793352 . + . gene_id "XLOC_008455"; transcript_id "TCONS_00008455"; exon_number "1"; oId "CUFF.8493.1"; tss_id "TSS8455"; +chr7 Cufflinks exon 35060765 35060802 . + . gene_id "XLOC_008456"; transcript_id "TCONS_00008456"; exon_number "1"; oId "CUFF.8494.1"; tss_id "TSS8456"; +chr7 Cufflinks exon 35816400 35816433 . + . gene_id "XLOC_008457"; transcript_id "TCONS_00008457"; exon_number "1"; oId "CUFF.8496.1"; tss_id "TSS8457"; +chr7 Cufflinks exon 36606005 36606101 . + . gene_id "XLOC_008458"; transcript_id "TCONS_00008458"; exon_number "1"; oId "CUFF.8499.1"; tss_id "TSS8458"; +chr7 Cufflinks exon 37390747 37390816 . + . gene_id "XLOC_008459"; transcript_id "TCONS_00008459"; exon_number "1"; oId "CUFF.8503.1"; tss_id "TSS8459"; +chr7 Cufflinks exon 37665447 37665484 . + . gene_id "XLOC_008460"; transcript_id "TCONS_00008460"; exon_number "1"; oId "CUFF.8504.1"; tss_id "TSS8460"; +chr7 Cufflinks exon 39807941 39808043 . + . gene_id "XLOC_008461"; transcript_id "TCONS_00008461"; exon_number "1"; oId "CUFF.8506.1"; tss_id "TSS8461"; +chr7 Cufflinks exon 39927975 39928263 . + . gene_id "XLOC_008462"; transcript_id "TCONS_00008462"; exon_number "1"; oId "CUFF.8507.1"; tss_id "TSS8462"; +chr7 Cufflinks exon 40301845 40301891 . + . gene_id "XLOC_008463"; transcript_id "TCONS_00008463"; exon_number "1"; oId "CUFF.8508.1"; tss_id "TSS8463"; +chr7 Cufflinks exon 40865328 40865431 . + . gene_id "XLOC_008464"; transcript_id "TCONS_00008464"; exon_number "1"; oId "CUFF.8510.1"; tss_id "TSS8464"; +chr7 Cufflinks exon 42613457 42613491 . + . gene_id "XLOC_008465"; transcript_id "TCONS_00008465"; exon_number "1"; oId "CUFF.8511.1"; tss_id "TSS8465"; +chr7 Cufflinks exon 43234021 43234081 . + . gene_id "XLOC_008466"; transcript_id "TCONS_00008466"; exon_number "1"; oId "CUFF.8512.1"; tss_id "TSS8466"; +chr7 Cufflinks exon 43590959 43591015 . + . gene_id "XLOC_008467"; transcript_id "TCONS_00008467"; exon_number "1"; oId "CUFF.8514.1"; tss_id "TSS8467"; +chr7 Cufflinks exon 44406795 44406829 . + . gene_id "XLOC_008468"; transcript_id "TCONS_00008468"; exon_number "1"; oId "CUFF.8516.1"; tss_id "TSS8468"; +chr7 Cufflinks exon 44465584 44465621 . + . gene_id "XLOC_008469"; transcript_id "TCONS_00008469"; exon_number "1"; oId "CUFF.8518.1"; tss_id "TSS8469"; +chr7 Cufflinks exon 44639918 44639962 . + . gene_id "XLOC_008470"; transcript_id "TCONS_00008470"; exon_number "1"; oId "CUFF.8520.1"; tss_id "TSS8470"; +chr7 Cufflinks exon 44730048 44730079 . + . gene_id "XLOC_008471"; transcript_id "TCONS_00008471"; exon_number "1"; oId "CUFF.8521.1"; tss_id "TSS8471"; +chr7 Cufflinks exon 45094241 45094373 . + . gene_id "XLOC_008472"; transcript_id "TCONS_00008472"; exon_number "1"; oId "CUFF.8522.1"; tss_id "TSS8472"; +chr7 Cufflinks exon 45789996 45790052 . + . gene_id "XLOC_008473"; transcript_id "TCONS_00008473"; exon_number "1"; oId "CUFF.8523.1"; tss_id "TSS8473"; +chr7 Cufflinks exon 45829185 45829287 . + . gene_id "XLOC_008474"; transcript_id "TCONS_00008474"; exon_number "1"; oId "CUFF.8524.1"; tss_id "TSS8474"; +chr7 Cufflinks exon 46120151 46120190 . + . gene_id "XLOC_008475"; transcript_id "TCONS_00008475"; exon_number "1"; oId "CUFF.8527.1"; tss_id "TSS8475"; +chr7 Cufflinks exon 48121540 48121577 . + . gene_id "XLOC_008476"; transcript_id "TCONS_00008476"; exon_number "1"; oId "CUFF.8530.1"; tss_id "TSS8476"; +chr7 Cufflinks exon 50503078 50503180 . + . gene_id "XLOC_008477"; transcript_id "TCONS_00008477"; exon_number "1"; oId "CUFF.8532.1"; tss_id "TSS8477"; +chr7 Cufflinks exon 51784354 51784635 . + . gene_id "XLOC_008478"; transcript_id "TCONS_00008478"; exon_number "1"; oId "CUFF.8533.1"; tss_id "TSS8478"; +chr7 Cufflinks exon 53433751 53433904 . + . gene_id "XLOC_008479"; transcript_id "TCONS_00008479"; exon_number "1"; oId "CUFF.8536.1"; tss_id "TSS8479"; +chr7 Cufflinks exon 53843829 53843947 . + . gene_id "XLOC_008480"; transcript_id "TCONS_00008480"; exon_number "1"; oId "CUFF.8538.1"; tss_id "TSS8480"; +chr7 Cufflinks exon 53863656 53863693 . + . gene_id "XLOC_008481"; transcript_id "TCONS_00008481"; exon_number "1"; oId "CUFF.8539.1"; tss_id "TSS8481"; +chr7 Cufflinks exon 54427584 54427691 . + . gene_id "XLOC_008482"; transcript_id "TCONS_00008482"; exon_number "1"; oId "CUFF.8540.1"; tss_id "TSS8482"; +chr7 Cufflinks exon 54688718 54688823 . + . gene_id "XLOC_008483"; transcript_id "TCONS_00008483"; exon_number "1"; oId "CUFF.8541.1"; tss_id "TSS8483"; +chr7 Cufflinks exon 54933508 54933594 . + . gene_id "XLOC_008484"; transcript_id "TCONS_00008484"; exon_number "1"; oId "CUFF.8542.1"; tss_id "TSS8484"; +chr7 Cufflinks exon 55691500 55691572 . + . gene_id "XLOC_008485"; transcript_id "TCONS_00008485"; exon_number "1"; oId "CUFF.8544.1"; tss_id "TSS8485"; +chr7 Cufflinks exon 55753671 55753764 . + . gene_id "XLOC_008486"; transcript_id "TCONS_00008486"; exon_number "1"; oId "CUFF.8545.1"; tss_id "TSS8486"; +chr7 Cufflinks exon 55857061 55857167 . + . gene_id "XLOC_008487"; transcript_id "TCONS_00008487"; exon_number "1"; oId "CUFF.8546.1"; tss_id "TSS8487"; +chr7 Cufflinks exon 56048062 56048099 . + . gene_id "XLOC_008488"; transcript_id "TCONS_00008488"; exon_number "1"; oId "CUFF.8547.1"; tss_id "TSS8488"; +chr7 Cufflinks exon 56168351 56168448 . + . gene_id "XLOC_008489"; transcript_id "TCONS_00008489"; exon_number "1"; oId "CUFF.8548.1"; tss_id "TSS8489"; +chr7 Cufflinks exon 57294708 57294757 . + . gene_id "XLOC_008490"; transcript_id "TCONS_00008490"; exon_number "1"; oId "CUFF.8552.1"; tss_id "TSS8490"; +chr7 Cufflinks exon 63568931 63568999 . + . gene_id "XLOC_008491"; transcript_id "TCONS_00008491"; exon_number "1"; oId "CUFF.8555.1"; tss_id "TSS8491"; +chr7 Cufflinks exon 63571998 63572068 . + . gene_id "XLOC_008492"; transcript_id "TCONS_00008492"; exon_number "1"; oId "CUFF.8556.1"; tss_id "TSS8492"; +chr7 Cufflinks exon 63944739 63944795 . + . gene_id "XLOC_008493"; transcript_id "TCONS_00008493"; exon_number "1"; oId "CUFF.8557.1"; tss_id "TSS8493"; +chr7 Cufflinks exon 64325169 64325201 . + . gene_id "XLOC_008494"; transcript_id "TCONS_00008494"; exon_number "1"; oId "CUFF.8558.1"; tss_id "TSS8494"; +chr7 Cufflinks exon 65279660 65279762 . + . gene_id "XLOC_008495"; transcript_id "TCONS_00008495"; exon_number "1"; oId "CUFF.8560.1"; tss_id "TSS8495"; +chr7 Cufflinks exon 65568117 65568209 . + . gene_id "XLOC_008496"; transcript_id "TCONS_00008496"; exon_number "1"; oId "CUFF.8562.1"; tss_id "TSS8496"; +chr7 Cufflinks exon 65809291 65809390 . + . gene_id "XLOC_008497"; transcript_id "TCONS_00008497"; exon_number "1"; oId "CUFF.8563.1"; tss_id "TSS8497"; +chr7 Cufflinks exon 65860175 65860273 . + . gene_id "XLOC_008498"; transcript_id "TCONS_00008498"; exon_number "1"; oId "CUFF.8564.1"; tss_id "TSS8498"; +chr7 Cufflinks exon 65899514 65899608 . + . gene_id "XLOC_008499"; transcript_id "TCONS_00008499"; exon_number "1"; oId "CUFF.8565.1"; tss_id "TSS8499"; +chr7 Cufflinks exon 66117398 66117473 . + . gene_id "XLOC_008500"; transcript_id "TCONS_00008500"; exon_number "1"; oId "CUFF.8567.1"; tss_id "TSS8500"; +chr7 Cufflinks exon 66152519 66152595 . + . gene_id "XLOC_008501"; transcript_id "TCONS_00008501"; exon_number "1"; oId "CUFF.8568.1"; tss_id "TSS8501"; +chr7 Cufflinks exon 66356176 66356278 . + . gene_id "XLOC_008502"; transcript_id "TCONS_00008502"; exon_number "1"; oId "CUFF.8570.1"; tss_id "TSS8502"; +chr7 Cufflinks exon 66445107 66445416 . + . gene_id "XLOC_008503"; transcript_id "TCONS_00008503"; exon_number "1"; oId "CUFF.8571.1"; tss_id "TSS8503"; +chr7 Cufflinks exon 66666172 66666253 . + . gene_id "XLOC_008504"; transcript_id "TCONS_00008504"; exon_number "1"; oId "CUFF.8572.1"; tss_id "TSS8504"; +chr7 Cufflinks exon 68235078 68235108 . + . gene_id "XLOC_008505"; transcript_id "TCONS_00008505"; exon_number "1"; oId "CUFF.8579.1"; tss_id "TSS8505"; +chr7 Cufflinks exon 68527371 68527788 . + . gene_id "XLOC_008506"; transcript_id "TCONS_00008506"; exon_number "1"; oId "CUFF.8580.1"; tss_id "TSS8506"; +chr7 Cufflinks exon 68590257 68590361 . + . gene_id "XLOC_008507"; transcript_id "TCONS_00008507"; exon_number "1"; oId "CUFF.8582.1"; tss_id "TSS8507"; +chr7 Cufflinks exon 68601780 68601817 . + . gene_id "XLOC_008508"; transcript_id "TCONS_00008508"; exon_number "1"; oId "CUFF.8583.1"; tss_id "TSS8508"; +chr7 Cufflinks exon 68657145 68657207 . + . gene_id "XLOC_008509"; transcript_id "TCONS_00008509"; exon_number "1"; oId "CUFF.8584.1"; tss_id "TSS8509"; +chr7 Cufflinks exon 68796745 68796812 . + . gene_id "XLOC_008510"; transcript_id "TCONS_00008510"; exon_number "1"; oId "CUFF.8586.1"; tss_id "TSS8510"; +chr7 Cufflinks exon 69433530 69433572 . + . gene_id "XLOC_008511"; transcript_id "TCONS_00008511"; exon_number "1"; oId "CUFF.8588.1"; tss_id "TSS8511"; +chr7 Cufflinks exon 69617924 69617971 . + . gene_id "XLOC_008512"; transcript_id "TCONS_00008512"; exon_number "1"; oId "CUFF.8589.1"; tss_id "TSS8512"; +chr7 Cufflinks exon 69968406 69968501 . + . gene_id "XLOC_008513"; transcript_id "TCONS_00008513"; exon_number "1"; oId "CUFF.8590.1"; tss_id "TSS8513"; +chr7 Cufflinks exon 71595436 71595471 . + . gene_id "XLOC_008514"; transcript_id "TCONS_00008514"; exon_number "1"; oId "CUFF.8594.1"; tss_id "TSS8514"; +chr7 Cufflinks exon 72062544 72062588 . + . gene_id "XLOC_008515"; transcript_id "TCONS_00008515"; exon_number "1"; oId "CUFF.8595.1"; tss_id "TSS8515"; +chr7 Cufflinks exon 72921538 72921603 . + . gene_id "XLOC_008516"; transcript_id "TCONS_00008516"; exon_number "1"; oId "CUFF.8599.1"; tss_id "TSS8516"; +chr7 Cufflinks exon 73944885 73944936 . + . gene_id "XLOC_008517"; transcript_id "TCONS_00008517"; exon_number "1"; oId "CUFF.8603.1"; tss_id "TSS8517"; +chr7 Cufflinks exon 74021216 74021280 . + . gene_id "XLOC_008518"; transcript_id "TCONS_00008518"; exon_number "1"; oId "CUFF.8605.1"; tss_id "TSS8518"; +chr7 Cufflinks exon 74044574 74044608 . + . gene_id "XLOC_008519"; transcript_id "TCONS_00008519"; exon_number "1"; oId "CUFF.8606.1"; tss_id "TSS8519"; +chr7 Cufflinks exon 74483475 74483540 . + . gene_id "XLOC_008520"; transcript_id "TCONS_00008520"; exon_number "1"; oId "CUFF.8608.1"; tss_id "TSS8520"; +chr7 Cufflinks exon 75716763 75716865 . + . gene_id "XLOC_008521"; transcript_id "TCONS_00008521"; exon_number "1"; oId "CUFF.8609.1"; tss_id "TSS8521"; +chr7 Cufflinks exon 75742136 75742217 . + . gene_id "XLOC_008522"; transcript_id "TCONS_00008522"; exon_number "1"; oId "CUFF.8610.1"; tss_id "TSS8522"; +chr7 Cufflinks exon 78659556 78659656 . + . gene_id "XLOC_008523"; transcript_id "TCONS_00008523"; exon_number "1"; oId "CUFF.8614.1"; tss_id "TSS8523"; +chr7 Cufflinks exon 79283427 79283514 . + . gene_id "XLOC_008524"; transcript_id "TCONS_00008524"; exon_number "1"; oId "CUFF.8617.1"; tss_id "TSS8524"; +chr7 Cufflinks exon 79875242 79875533 . + . gene_id "XLOC_008525"; transcript_id "TCONS_00008525"; exon_number "1"; oId "CUFF.8619.1"; tss_id "TSS8525"; +chr7 Cufflinks exon 79947569 79947791 . + . gene_id "XLOC_008526"; transcript_id "TCONS_00008526"; exon_number "1"; oId "CUFF.8620.1"; tss_id "TSS8526"; +chr7 Cufflinks exon 80787191 80787226 . + . gene_id "XLOC_008527"; transcript_id "TCONS_00008527"; exon_number "1"; oId "CUFF.8621.1"; tss_id "TSS8527"; +chr7 Cufflinks exon 80905340 80905409 . + . gene_id "XLOC_008528"; transcript_id "TCONS_00008528"; exon_number "1"; oId "CUFF.8622.1"; tss_id "TSS8528"; +chr7 Cufflinks exon 80962908 80963147 . + . gene_id "XLOC_008529"; transcript_id "TCONS_00008529"; exon_number "1"; oId "CUFF.8624.1"; tss_id "TSS8529"; +chr7 Cufflinks exon 81768831 81768868 . + . gene_id "XLOC_008530"; transcript_id "TCONS_00008530"; exon_number "1"; oId "CUFF.8625.1"; tss_id "TSS8530"; +chr7 Cufflinks exon 81936340 81936398 . + . gene_id "XLOC_008531"; transcript_id "TCONS_00008531"; exon_number "1"; oId "CUFF.8626.1"; tss_id "TSS8531"; +chr7 Cufflinks exon 82647215 82647328 . + . gene_id "XLOC_008532"; transcript_id "TCONS_00008532"; exon_number "1"; oId "CUFF.8629.1"; tss_id "TSS8532"; +chr7 Cufflinks exon 83733502 83733531 . + . gene_id "XLOC_008533"; transcript_id "TCONS_00008533"; exon_number "1"; oId "CUFF.8630.1"; tss_id "TSS8533"; +chr7 Cufflinks exon 84721275 84721315 . + . gene_id "XLOC_008534"; transcript_id "TCONS_00008534"; exon_number "1"; oId "CUFF.8631.1"; tss_id "TSS8534"; +chr7 Cufflinks exon 85281288 85281325 . + . gene_id "XLOC_008535"; transcript_id "TCONS_00008535"; exon_number "1"; oId "CUFF.8632.1"; tss_id "TSS8535"; +chr7 Cufflinks exon 87253473 87253575 . + . gene_id "XLOC_008536"; transcript_id "TCONS_00008536"; exon_number "1"; oId "CUFF.8636.1"; tss_id "TSS8536"; +chr7 Cufflinks exon 88597215 88597324 . + . gene_id "XLOC_008537"; transcript_id "TCONS_00008537"; exon_number "1"; oId "CUFF.8638.1"; tss_id "TSS8537"; +chr7 Cufflinks exon 89406200 89406239 . + . gene_id "XLOC_008538"; transcript_id "TCONS_00008538"; exon_number "1"; oId "CUFF.8640.1"; tss_id "TSS8538"; +chr7 Cufflinks exon 89872114 89872150 . + . gene_id "XLOC_008539"; transcript_id "TCONS_00008539"; exon_number "1"; oId "CUFF.8642.1"; tss_id "TSS8539"; +chr7 Cufflinks exon 89903945 89903981 . + . gene_id "XLOC_008540"; transcript_id "TCONS_00008540"; exon_number "1"; oId "CUFF.8643.1"; tss_id "TSS8540"; +chr7 Cufflinks exon 92043498 92043539 . + . gene_id "XLOC_008541"; transcript_id "TCONS_00008541"; exon_number "1"; oId "CUFF.8647.1"; tss_id "TSS8541"; +chr7 Cufflinks exon 94124612 94124710 . + . gene_id "XLOC_008542"; transcript_id "TCONS_00008542"; exon_number "1"; oId "CUFF.8653.1"; tss_id "TSS8542"; +chr7 Cufflinks exon 94341719 94341823 . + . gene_id "XLOC_008543"; transcript_id "TCONS_00008543"; exon_number "1"; oId "CUFF.8654.1"; tss_id "TSS8543"; +chr7 Cufflinks exon 94430826 94431070 . + . gene_id "XLOC_008544"; transcript_id "TCONS_00008544"; exon_number "1"; oId "CUFF.8656.1"; tss_id "TSS8544"; +chr7 Cufflinks exon 94727539 94727682 . + . gene_id "XLOC_008545"; transcript_id "TCONS_00008545"; exon_number "1"; oId "CUFF.8657.1"; tss_id "TSS8545"; +chr7 Cufflinks exon 94872504 94872587 . + . gene_id "XLOC_008546"; transcript_id "TCONS_00008546"; exon_number "1"; oId "CUFF.8659.1"; tss_id "TSS8546"; +chr7 Cufflinks exon 94905900 94905988 . + . gene_id "XLOC_008547"; transcript_id "TCONS_00008547"; exon_number "1"; oId "CUFF.8660.1"; tss_id "TSS8547"; +chr7 Cufflinks exon 95959950 95960055 . + . gene_id "XLOC_008548"; transcript_id "TCONS_00008548"; exon_number "1"; oId "CUFF.8662.1"; tss_id "TSS8548"; +chr7 Cufflinks exon 95970452 95970558 . + . gene_id "XLOC_008549"; transcript_id "TCONS_00008549"; exon_number "1"; oId "CUFF.8663.1"; tss_id "TSS8549"; +chr7 Cufflinks exon 96007170 96007224 . + . gene_id "XLOC_008550"; transcript_id "TCONS_00008550"; exon_number "1"; oId "CUFF.8664.1"; tss_id "TSS8550"; +chr7 Cufflinks exon 96952238 96952281 . + . gene_id "XLOC_008551"; transcript_id "TCONS_00008551"; exon_number "1"; oId "CUFF.8668.1"; tss_id "TSS8551"; +chr7 Cufflinks exon 97627637 97627955 . + . gene_id "XLOC_008552"; transcript_id "TCONS_00008552"; exon_number "1"; oId "CUFF.8671.1"; tss_id "TSS8552"; +chr7 Cufflinks exon 97653041 97653279 . + . gene_id "XLOC_008553"; transcript_id "TCONS_00008553"; exon_number "1"; oId "CUFF.8672.1"; tss_id "TSS8553"; +chr7 Cufflinks exon 97889658 97889713 . + . gene_id "XLOC_008554"; transcript_id "TCONS_00008554"; exon_number "1"; oId "CUFF.8673.1"; tss_id "TSS8554"; +chr7 Cufflinks exon 97890295 97890357 . + . gene_id "XLOC_008555"; transcript_id "TCONS_00008555"; exon_number "1"; oId "CUFF.8674.1"; tss_id "TSS8555"; +chr7 Cufflinks exon 98522041 98522079 . + . gene_id "XLOC_008556"; transcript_id "TCONS_00008556"; exon_number "1"; oId "CUFF.8678.1"; tss_id "TSS8556"; +chr7 Cufflinks exon 99067307 99067378 . + . gene_id "XLOC_008557"; transcript_id "TCONS_00008557"; exon_number "1"; oId "CUFF.8682.1"; tss_id "TSS8557"; +chr7 Cufflinks exon 99470530 99470562 . + . gene_id "XLOC_008558"; transcript_id "TCONS_00008558"; exon_number "1"; oId "CUFF.8684.1"; tss_id "TSS8558"; +chr7 Cufflinks exon 100136277 100136317 . + . gene_id "XLOC_008559"; transcript_id "TCONS_00008559"; exon_number "1"; oId "CUFF.8688.1"; tss_id "TSS8559"; +chr7 Cufflinks exon 100701581 100701826 . + . gene_id "XLOC_008560"; transcript_id "TCONS_00008560"; exon_number "1"; oId "CUFF.8690.1"; tss_id "TSS8560"; +chr7 Cufflinks exon 100733572 100733605 . + . gene_id "XLOC_008561"; transcript_id "TCONS_00008561"; exon_number "1"; oId "CUFF.8691.1"; tss_id "TSS8561"; +chr7 Cufflinks exon 102452673 102452702 . + . gene_id "XLOC_008562"; transcript_id "TCONS_00008562"; exon_number "1"; oId "CUFF.8694.1"; tss_id "TSS8562"; +chr7 Cufflinks exon 102475052 102475147 . + . gene_id "XLOC_008563"; transcript_id "TCONS_00008563"; exon_number "1"; oId "CUFF.8695.1"; tss_id "TSS8563"; +chr7 Cufflinks exon 102497899 102498132 . + . gene_id "XLOC_008564"; transcript_id "TCONS_00008564"; exon_number "1"; oId "CUFF.8696.1"; tss_id "TSS8564"; +chr7 Cufflinks exon 104536769 104536858 . + . gene_id "XLOC_008565"; transcript_id "TCONS_00008565"; exon_number "1"; oId "CUFF.8700.1"; tss_id "TSS8565"; +chr7 Cufflinks exon 104552368 104552584 . + . gene_id "XLOC_008566"; transcript_id "TCONS_00008566"; exon_number "1"; oId "CUFF.8701.1"; tss_id "TSS8566"; +chr7 Cufflinks exon 104630545 104630760 . + . gene_id "XLOC_008567"; transcript_id "TCONS_00008567"; exon_number "1"; oId "CUFF.8702.1"; tss_id "TSS8567"; +chr7 Cufflinks exon 104865493 104865574 . + . gene_id "XLOC_008568"; transcript_id "TCONS_00008568"; exon_number "1"; oId "CUFF.8704.1"; tss_id "TSS8568"; +chr7 Cufflinks exon 104966298 104966532 . + . gene_id "XLOC_008569"; transcript_id "TCONS_00008569"; exon_number "1"; oId "CUFF.8705.1"; tss_id "TSS8569"; +chr7 Cufflinks exon 104973237 104973344 . + . gene_id "XLOC_008570"; transcript_id "TCONS_00008570"; exon_number "1"; oId "CUFF.8706.1"; tss_id "TSS8570"; +chr7 Cufflinks exon 105848612 105848713 . + . gene_id "XLOC_008571"; transcript_id "TCONS_00008571"; exon_number "1"; oId "CUFF.8709.1"; tss_id "TSS8571"; +chr7 Cufflinks exon 107351150 107351186 . + . gene_id "XLOC_008572"; transcript_id "TCONS_00008572"; exon_number "1"; oId "CUFF.8712.1"; tss_id "TSS8572"; +chr7 Cufflinks exon 107911444 107911504 . + . gene_id "XLOC_008573"; transcript_id "TCONS_00008573"; exon_number "1"; oId "CUFF.8714.1"; tss_id "TSS8573"; +chr7 Cufflinks exon 109340751 109340797 . + . gene_id "XLOC_008574"; transcript_id "TCONS_00008574"; exon_number "1"; oId "CUFF.8717.1"; tss_id "TSS8574"; +chr7 Cufflinks exon 111928678 111929006 . + . gene_id "XLOC_008575"; transcript_id "TCONS_00008575"; exon_number "1"; oId "CUFF.8721.1"; tss_id "TSS8575"; +chr7 Cufflinks exon 115293351 115293389 . + . gene_id "XLOC_008576"; transcript_id "TCONS_00008576"; exon_number "1"; oId "CUFF.8725.1"; tss_id "TSS8576"; +chr7 Cufflinks exon 115294787 115294879 . + . gene_id "XLOC_008577"; transcript_id "TCONS_00008577"; exon_number "1"; oId "CUFF.8726.1"; tss_id "TSS8577"; +chr7 Cufflinks exon 116543373 116543409 . + . gene_id "XLOC_008578"; transcript_id "TCONS_00008578"; exon_number "1"; oId "CUFF.8728.1"; tss_id "TSS8578"; +chr7 Cufflinks exon 119465966 119466003 . + . gene_id "XLOC_008579"; transcript_id "TCONS_00008579"; exon_number "1"; oId "CUFF.8730.1"; tss_id "TSS8579"; +chr7 Cufflinks exon 120312921 120313026 . + . gene_id "XLOC_008580"; transcript_id "TCONS_00008580"; exon_number "1"; oId "CUFF.8732.1"; tss_id "TSS8580"; +chr7 Cufflinks exon 121376497 121376616 . + . gene_id "XLOC_008581"; transcript_id "TCONS_00008581"; exon_number "1"; oId "CUFF.8737.1"; tss_id "TSS8581"; +chr7 Cufflinks exon 121721775 121721834 . + . gene_id "XLOC_008582"; transcript_id "TCONS_00008582"; exon_number "1"; oId "CUFF.8739.1"; tss_id "TSS8582"; +chr7 Cufflinks exon 123529298 123529365 . + . gene_id "XLOC_008583"; transcript_id "TCONS_00008583"; exon_number "1"; oId "CUFF.8744.1"; tss_id "TSS8583"; +chr7 Cufflinks exon 123910245 123910288 . + . gene_id "XLOC_008584"; transcript_id "TCONS_00008584"; exon_number "1"; oId "CUFF.8745.1"; tss_id "TSS8584"; +chr7 Cufflinks exon 124287773 124287876 . + . gene_id "XLOC_008585"; transcript_id "TCONS_00008585"; exon_number "1"; oId "CUFF.8746.1"; tss_id "TSS8585"; +chr7 Cufflinks exon 125923152 125923193 . + . gene_id "XLOC_008586"; transcript_id "TCONS_00008586"; exon_number "1"; oId "CUFF.8747.1"; tss_id "TSS8586"; +chr7 Cufflinks exon 126159708 126159749 . + . gene_id "XLOC_008587"; transcript_id "TCONS_00008587"; exon_number "1"; oId "CUFF.8748.1"; tss_id "TSS8587"; +chr7 Cufflinks exon 126813740 126813915 . + . gene_id "XLOC_008588"; transcript_id "TCONS_00008588"; exon_number "1"; oId "CUFF.8749.1"; tss_id "TSS8588"; +chr7 Cufflinks exon 127984136 127984195 . + . gene_id "XLOC_008589"; transcript_id "TCONS_00008589"; exon_number "1"; oId "CUFF.8750.1"; tss_id "TSS8589"; +chr7 Cufflinks exon 128074994 128075034 . + . gene_id "XLOC_008590"; transcript_id "TCONS_00008590"; exon_number "1"; oId "CUFF.8751.1"; tss_id "TSS8590"; +chr7 Cufflinks exon 128267227 128267329 . + . gene_id "XLOC_008591"; transcript_id "TCONS_00008591"; exon_number "1"; oId "CUFF.8754.1"; tss_id "TSS8591"; +chr7 Cufflinks exon 128337506 128337612 . + . gene_id "XLOC_008592"; transcript_id "TCONS_00008592"; exon_number "1"; oId "CUFF.8755.1"; tss_id "TSS8592"; +chr7 Cufflinks exon 128337745 128337798 . + . gene_id "XLOC_008593"; transcript_id "TCONS_00008593"; exon_number "1"; oId "CUFF.8756.1"; tss_id "TSS8593"; +chr7 Cufflinks exon 128401392 128401660 . + . gene_id "XLOC_008594"; transcript_id "TCONS_00008594"; exon_number "1"; oId "CUFF.8759.1"; tss_id "TSS8594"; +chr7 Cufflinks exon 128423504 128423575 . + . gene_id "XLOC_008595"; transcript_id "TCONS_00008595"; exon_number "1"; oId "CUFF.8760.1"; tss_id "TSS8595"; +chr7 Cufflinks exon 128610788 128611083 . + . gene_id "XLOC_008596"; transcript_id "TCONS_00008596"; exon_number "1"; oId "CUFF.8761.1"; tss_id "TSS8596"; +chr7 Cufflinks exon 128701584 128701691 . + . gene_id "XLOC_008597"; transcript_id "TCONS_00008597"; exon_number "1"; oId "CUFF.8763.1"; tss_id "TSS8597"; +chr7 Cufflinks exon 129045477 129045537 . + . gene_id "XLOC_008598"; transcript_id "TCONS_00008598"; exon_number "1"; oId "CUFF.8767.1"; tss_id "TSS8598"; +chr7 Cufflinks exon 129124346 129124500 . + . gene_id "XLOC_008599"; transcript_id "TCONS_00008599"; exon_number "1"; oId "CUFF.8768.1"; tss_id "TSS8599"; +chr7 Cufflinks exon 129396106 129396193 . + . gene_id "XLOC_008600"; transcript_id "TCONS_00008600"; exon_number "1"; oId "CUFF.8769.1"; tss_id "TSS8600"; +chr7 Cufflinks exon 129667117 129667204 . + . gene_id "XLOC_008601"; transcript_id "TCONS_00008601"; exon_number "1"; oId "CUFF.8770.1"; tss_id "TSS8601"; +chr7 Cufflinks exon 129959121 129959224 . + . gene_id "XLOC_008602"; transcript_id "TCONS_00008602"; exon_number "1"; oId "CUFF.8772.1"; tss_id "TSS8602"; +chr7 Cufflinks exon 129984259 129984361 . + . gene_id "XLOC_008603"; transcript_id "TCONS_00008603"; exon_number "1"; oId "CUFF.8773.1"; tss_id "TSS8603"; +chr7 Cufflinks exon 133672675 133672756 . + . gene_id "XLOC_008604"; transcript_id "TCONS_00008604"; exon_number "1"; oId "CUFF.8782.1"; tss_id "TSS8604"; +chr7 Cufflinks exon 134625348 134625525 . + . gene_id "XLOC_008605"; transcript_id "TCONS_00008605"; exon_number "1"; oId "CUFF.8783.1"; tss_id "TSS8605"; +chr7 Cufflinks exon 135043118 135043153 . + . gene_id "XLOC_008606"; transcript_id "TCONS_00008606"; exon_number "1"; oId "CUFF.8785.1"; tss_id "TSS8606"; +chr7 Cufflinks exon 135645451 135645557 . + . gene_id "XLOC_008607"; transcript_id "TCONS_00008607"; exon_number "1"; oId "CUFF.8788.1"; tss_id "TSS8607"; +chr7 Cufflinks exon 136973392 136973427 . + . gene_id "XLOC_008608"; transcript_id "TCONS_00008608"; exon_number "1"; oId "CUFF.8792.1"; tss_id "TSS8608"; +chr7 Cufflinks exon 137299882 137300022 . + . gene_id "XLOC_008609"; transcript_id "TCONS_00008609"; exon_number "1"; oId "CUFF.8793.1"; tss_id "TSS8609"; +chr7 Cufflinks exon 137775977 137776185 . + . gene_id "XLOC_008610"; transcript_id "TCONS_00008610"; exon_number "1"; oId "CUFF.8794.1"; tss_id "TSS8610"; +chr7 Cufflinks exon 137805833 137805940 . + . gene_id "XLOC_008611"; transcript_id "TCONS_00008611"; exon_number "1"; oId "CUFF.8795.1"; tss_id "TSS8611"; +chr7 Cufflinks exon 137860947 137861031 . + . gene_id "XLOC_008612"; transcript_id "TCONS_00008612"; exon_number "1"; oId "CUFF.8796.1"; tss_id "TSS8612"; +chr7 Cufflinks exon 137982697 137982731 . + . gene_id "XLOC_008613"; transcript_id "TCONS_00008613"; exon_number "1"; oId "CUFF.8797.1"; tss_id "TSS8613"; +chr7 Cufflinks exon 138551981 138552031 . + . gene_id "XLOC_008614"; transcript_id "TCONS_00008614"; exon_number "1"; oId "CUFF.8799.1"; tss_id "TSS8614"; +chr7 Cufflinks exon 139025446 139025517 . + . gene_id "XLOC_008615"; transcript_id "TCONS_00008615"; exon_number "1"; oId "CUFF.8802.1"; tss_id "TSS8615"; +chr7 Cufflinks exon 139090714 139090795 . + . gene_id "XLOC_008616"; transcript_id "TCONS_00008616"; exon_number "1"; oId "CUFF.8803.1"; tss_id "TSS8616"; +chr7 Cufflinks exon 139133486 139133556 . + . gene_id "XLOC_008617"; transcript_id "TCONS_00008617"; exon_number "1"; oId "CUFF.8804.1"; tss_id "TSS8617"; +chr7 Cufflinks exon 139941670 139941831 . + . gene_id "XLOC_008618"; transcript_id "TCONS_00008618"; exon_number "1"; oId "CUFF.8807.1"; tss_id "TSS8618"; +chr7 Cufflinks exon 140070239 140070327 . + . gene_id "XLOC_008619"; transcript_id "TCONS_00008619"; exon_number "1"; oId "CUFF.8808.1"; tss_id "TSS8619"; +chr7 Cufflinks exon 140345667 140345936 . + . gene_id "XLOC_008620"; transcript_id "TCONS_00008620"; exon_number "1"; oId "CUFF.8811.1"; tss_id "TSS8620"; +chr7 Cufflinks exon 140486727 140486777 . + . gene_id "XLOC_008621"; transcript_id "TCONS_00008621"; exon_number "1"; oId "CUFF.8813.1"; tss_id "TSS8621"; +chr7 Cufflinks exon 140583872 140583978 . + . gene_id "XLOC_008622"; transcript_id "TCONS_00008622"; exon_number "1"; oId "CUFF.8814.1"; tss_id "TSS8622"; +chr7 Cufflinks exon 140752049 140752115 . + . gene_id "XLOC_008623"; transcript_id "TCONS_00008623"; exon_number "1"; oId "CUFF.8815.1"; tss_id "TSS8623"; +chr7 Cufflinks exon 141107343 141107384 . + . gene_id "XLOC_008624"; transcript_id "TCONS_00008624"; exon_number "1"; oId "CUFF.8816.1"; tss_id "TSS8624"; +chr7 Cufflinks exon 141427784 141427948 . + . gene_id "XLOC_008625"; transcript_id "TCONS_00008625"; exon_number "1"; oId "CUFF.8817.1"; tss_id "TSS8625"; +chr7 Cufflinks exon 141503357 141503428 . + . gene_id "XLOC_008626"; transcript_id "TCONS_00008626"; exon_number "1"; oId "CUFF.8818.1"; tss_id "TSS8626"; +chr7 Cufflinks exon 142987708 142988019 . + . gene_id "XLOC_008627"; transcript_id "TCONS_00008627"; exon_number "1"; oId "CUFF.8820.1"; tss_id "TSS8627"; +chr7 Cufflinks exon 142995610 142995923 . + . gene_id "XLOC_008628"; transcript_id "TCONS_00008628"; exon_number "1"; oId "CUFF.8821.1"; tss_id "TSS8628"; +chr7 Cufflinks exon 143151114 143151226 . + . gene_id "XLOC_008629"; transcript_id "TCONS_00008629"; exon_number "1"; oId "CUFF.8822.1"; tss_id "TSS8629"; +chr7 Cufflinks exon 143271837 143271940 . + . gene_id "XLOC_008630"; transcript_id "TCONS_00008630"; exon_number "1"; oId "CUFF.8823.1"; tss_id "TSS8630"; +chr7 Cufflinks exon 143883522 143883626 . + . gene_id "XLOC_008631"; transcript_id "TCONS_00008631"; exon_number "1"; oId "CUFF.8826.1"; tss_id "TSS8631"; +chr7 Cufflinks exon 143899637 143899681 . + . gene_id "XLOC_008632"; transcript_id "TCONS_00008632"; exon_number "1"; oId "CUFF.8827.1"; tss_id "TSS8632"; +chr7 Cufflinks exon 144066529 144066572 . + . gene_id "XLOC_008633"; transcript_id "TCONS_00008633"; exon_number "1"; oId "CUFF.8831.1"; tss_id "TSS8633"; +chr7 Cufflinks exon 144600565 144600616 . + . gene_id "XLOC_008634"; transcript_id "TCONS_00008634"; exon_number "1"; oId "CUFF.8833.1"; tss_id "TSS8634"; +chr7 Cufflinks exon 147528862 147528967 . + . gene_id "XLOC_008635"; transcript_id "TCONS_00008635"; exon_number "1"; oId "CUFF.8837.1"; tss_id "TSS8635"; +chr7 Cufflinks exon 147546976 147547054 . + . gene_id "XLOC_008636"; transcript_id "TCONS_00008636"; exon_number "1"; oId "CUFF.8838.1"; tss_id "TSS8636"; +chr7 Cufflinks exon 147637096 147637414 . + . gene_id "XLOC_008637"; transcript_id "TCONS_00008637"; exon_number "1"; oId "CUFF.8839.1"; tss_id "TSS8637"; +chr7 Cufflinks exon 148086745 148086951 . + . gene_id "XLOC_008638"; transcript_id "TCONS_00008638"; exon_number "1"; oId "CUFF.8840.1"; tss_id "TSS8638"; +chr7 Cufflinks exon 148135436 148135693 . + . gene_id "XLOC_008639"; transcript_id "TCONS_00008639"; exon_number "1"; oId "CUFF.8841.1"; tss_id "TSS8639"; +chr7 Cufflinks exon 148518108 148518164 . + . gene_id "XLOC_008640"; transcript_id "TCONS_00008640"; exon_number "1"; oId "CUFF.8845.1"; tss_id "TSS8640"; +chr7 Cufflinks exon 148587359 148587605 . + . gene_id "XLOC_008641"; transcript_id "TCONS_00008641"; exon_number "1"; oId "CUFF.8846.1"; tss_id "TSS8641"; +chr7 Cufflinks exon 148730144 148730258 . + . gene_id "XLOC_008642"; transcript_id "TCONS_00008642"; exon_number "1"; oId "CUFF.8847.1"; tss_id "TSS8642"; +chr7 Cufflinks exon 149007281 149007352 . + . gene_id "XLOC_008643"; transcript_id "TCONS_00008643"; exon_number "1"; oId "CUFF.8850.1"; tss_id "TSS8643"; +chr7 Cufflinks exon 149028220 149028291 . + . gene_id "XLOC_008644"; transcript_id "TCONS_00008644"; exon_number "1"; oId "CUFF.8851.1"; tss_id "TSS8644"; +chr7 Cufflinks exon 149092972 149093023 . + . gene_id "XLOC_008645"; transcript_id "TCONS_00008645"; exon_number "1"; oId "CUFF.8857.1"; tss_id "TSS8645"; +chr7 Cufflinks exon 149102670 149102734 . + . gene_id "XLOC_008646"; transcript_id "TCONS_00008646"; exon_number "1"; oId "CUFF.8859.1"; tss_id "TSS8646"; +chr7 Cufflinks exon 149243631 149243702 . + . gene_id "XLOC_008647"; transcript_id "TCONS_00008647"; exon_number "1"; oId "CUFF.8862.1"; tss_id "TSS8647"; +chr7 Cufflinks exon 149244881 149244949 . + . gene_id "XLOC_008648"; transcript_id "TCONS_00008648"; exon_number "1"; oId "CUFF.8863.1"; tss_id "TSS8648"; +chr7 Cufflinks exon 149253802 149253876 . + . gene_id "XLOC_008649"; transcript_id "TCONS_00008649"; exon_number "1"; oId "CUFF.8864.1"; tss_id "TSS8649"; +chr7 Cufflinks exon 149255133 149255207 . + . gene_id "XLOC_008650"; transcript_id "TCONS_00008650"; exon_number "1"; oId "CUFF.8865.1"; tss_id "TSS8650"; +chr7 Cufflinks exon 149265736 149265809 . + . gene_id "XLOC_008651"; transcript_id "TCONS_00008651"; exon_number "1"; oId "CUFF.8866.1"; tss_id "TSS8651"; +chr7 Cufflinks exon 149281816 149281890 . + . gene_id "XLOC_008652"; transcript_id "TCONS_00008652"; exon_number "1"; oId "CUFF.8867.1"; tss_id "TSS8652"; +chr7 Cufflinks exon 149295046 149295117 . + . gene_id "XLOC_008653"; transcript_id "TCONS_00008653"; exon_number "1"; oId "CUFF.8872.1"; tss_id "TSS8653"; +chr7 Cufflinks exon 149296363 149296432 . + . gene_id "XLOC_008654"; transcript_id "TCONS_00008654"; exon_number "1"; oId "CUFF.8873.1"; tss_id "TSS8654"; +chr7 Cufflinks exon 149300737 149300809 . + . gene_id "XLOC_008655"; transcript_id "TCONS_00008655"; exon_number "1"; oId "CUFF.8874.1"; tss_id "TSS8655"; +chr7 Cufflinks exon 149305467 149305538 . + . gene_id "XLOC_008656"; transcript_id "TCONS_00008656"; exon_number "1"; oId "CUFF.8875.1"; tss_id "TSS8656"; +chr7 Cufflinks exon 149325244 149325313 . + . gene_id "XLOC_008657"; transcript_id "TCONS_00008657"; exon_number "1"; oId "CUFF.8877.1"; tss_id "TSS8657"; +chr7 Cufflinks exon 149332778 149332849 . + . gene_id "XLOC_008658"; transcript_id "TCONS_00008658"; exon_number "1"; oId "CUFF.8878.1"; tss_id "TSS8658"; +chr7 Cufflinks exon 149361915 149361986 . + . gene_id "XLOC_008659"; transcript_id "TCONS_00008659"; exon_number "1"; oId "CUFF.8883.1"; tss_id "TSS8659"; +chr7 Cufflinks exon 149362715 149362771 . + . gene_id "XLOC_008660"; transcript_id "TCONS_00008660"; exon_number "1"; oId "CUFF.8884.1"; tss_id "TSS8660"; +chr7 Cufflinks exon 149401210 149401250 . + . gene_id "XLOC_008661"; transcript_id "TCONS_00008661"; exon_number "1"; oId "CUFF.8887.1"; tss_id "TSS8661"; +chr7 Cufflinks exon 149404760 149404831 . + . gene_id "XLOC_008662"; transcript_id "TCONS_00008662"; exon_number "1"; oId "CUFF.8888.1"; tss_id "TSS8662"; +chr7 Cufflinks exon 149701384 149701491 . + . gene_id "XLOC_008663"; transcript_id "TCONS_00008663"; exon_number "1"; oId "CUFF.8889.1"; tss_id "TSS8663"; +chr7 Cufflinks exon 149811829 149811867 . + . gene_id "XLOC_008664"; transcript_id "TCONS_00008664"; exon_number "1"; oId "CUFF.8890.1"; tss_id "TSS8664"; +chr7 Cufflinks exon 150721872 150721987 . + . gene_id "XLOC_008665"; transcript_id "TCONS_00008665"; exon_number "1"; oId "CUFF.8891.1"; tss_id "TSS8665"; +chr7 Cufflinks exon 151597353 151597448 . + . gene_id "XLOC_008666"; transcript_id "TCONS_00008666"; exon_number "1"; oId "CUFF.8895.1"; tss_id "TSS8666"; +chr7 Cufflinks exon 152062921 152062991 . + . gene_id "XLOC_008667"; transcript_id "TCONS_00008667"; exon_number "1"; oId "CUFF.8898.1"; tss_id "TSS8667"; +chr7 Cufflinks exon 152293015 152293104 . + . gene_id "XLOC_008668"; transcript_id "TCONS_00008668"; exon_number "1"; oId "CUFF.8900.1"; tss_id "TSS8668"; +chr7 Cufflinks exon 152454747 152455057 . + . gene_id "XLOC_008669"; transcript_id "TCONS_00008669"; exon_number "1"; oId "CUFF.8901.1"; tss_id "TSS8669"; +chr7 Cufflinks exon 154973591 154973826 . + . gene_id "XLOC_008670"; transcript_id "TCONS_00008670"; exon_number "1"; oId "CUFF.8904.1"; tss_id "TSS8670"; +chr7 Cufflinks exon 155416809 155416844 . + . gene_id "XLOC_008671"; transcript_id "TCONS_00008671"; exon_number "1"; oId "CUFF.8905.1"; tss_id "TSS8671"; +chr7 Cufflinks exon 155723810 155723847 . + . gene_id "XLOC_008672"; transcript_id "TCONS_00008672"; exon_number "1"; oId "CUFF.8906.1"; tss_id "TSS8672"; +chr7 Cufflinks exon 156664772 156664915 . + . gene_id "XLOC_008673"; transcript_id "TCONS_00008673"; exon_number "1"; oId "CUFF.8907.1"; tss_id "TSS8673"; +chr7 Cufflinks exon 2590501 2590591 . - . gene_id "XLOC_008674"; transcript_id "TCONS_00008674"; exon_number "1"; oId "CUFF.8406.1"; tss_id "TSS8674"; +chr7 Cufflinks exon 2590929 2590955 . - . gene_id "XLOC_008675"; transcript_id "TCONS_00008675"; exon_number "1"; oId "CUFF.8407.1"; tss_id "TSS8675"; +chr7 Cufflinks exon 3025177 3025266 . - . gene_id "XLOC_008676"; transcript_id "TCONS_00008676"; exon_number "1"; oId "CUFF.8409.1"; tss_id "TSS8676"; +chr7 Cufflinks exon 4678816 4678853 . - . gene_id "XLOC_008677"; transcript_id "TCONS_00008677"; exon_number "1"; oId "CUFF.8412.1"; tss_id "TSS8677"; +chr7 Cufflinks exon 5170829 5170870 . - . gene_id "XLOC_008678"; transcript_id "TCONS_00008678"; exon_number "1"; oId "CUFF.8414.1"; tss_id "TSS8678"; +chr7 Cufflinks exon 5911363 5911681 . - . gene_id "XLOC_008679"; transcript_id "TCONS_00008679"; exon_number "1"; oId "CUFF.8418.1"; tss_id "TSS8679"; +chr7 Cufflinks exon 6087333 6087645 . - . gene_id "XLOC_008680"; transcript_id "TCONS_00008680"; exon_number "1"; oId "CUFF.8420.1"; tss_id "TSS8680"; +chr7 Cufflinks exon 6092266 6092347 . - . gene_id "XLOC_008681"; transcript_id "TCONS_00008681"; exon_number "1"; oId "CUFF.8421.1"; tss_id "TSS8681"; +chr7 Cufflinks exon 6589570 6589604 . - . gene_id "XLOC_008682"; transcript_id "TCONS_00008682"; exon_number "1"; oId "CUFF.8424.1"; tss_id "TSS8682"; +chr7 Cufflinks exon 8424243 8424366 . - . gene_id "XLOC_008683"; transcript_id "TCONS_00008683"; exon_number "1"; oId "CUFF.8426.1"; tss_id "TSS8683"; +chr7 Cufflinks exon 11510602 11510636 . - . gene_id "XLOC_008684"; transcript_id "TCONS_00008684"; exon_number "1"; oId "CUFF.8433.1"; tss_id "TSS8684"; +chr7 Cufflinks exon 12004059 12004128 . - . gene_id "XLOC_008685"; transcript_id "TCONS_00008685"; exon_number "1"; oId "CUFF.8435.1"; tss_id "TSS8685"; +chr7 Cufflinks exon 14339943 14340017 . - . gene_id "XLOC_008686"; transcript_id "TCONS_00008686"; exon_number "1"; oId "CUFF.8439.1"; tss_id "TSS8686"; +chr7 Cufflinks exon 14615741 14615782 . - . gene_id "XLOC_008687"; transcript_id "TCONS_00008687"; exon_number "1"; oId "CUFF.8440.1"; tss_id "TSS8687"; +chr7 Cufflinks exon 15086875 15086944 . - . gene_id "XLOC_008688"; transcript_id "TCONS_00008688"; exon_number "1"; oId "CUFF.8441.1"; tss_id "TSS8688"; +chr7 Cufflinks exon 16095131 16095174 . - . gene_id "XLOC_008689"; transcript_id "TCONS_00008689"; exon_number "1"; oId "CUFF.8443.1"; tss_id "TSS8689"; +chr7 Cufflinks exon 18847665 18847900 . - . gene_id "XLOC_008690"; transcript_id "TCONS_00008690"; exon_number "1"; oId "CUFF.8447.1"; tss_id "TSS8690"; +chr7 Cufflinks exon 21255155 21255431 . - . gene_id "XLOC_008691"; transcript_id "TCONS_00008691"; exon_number "1"; oId "CUFF.8451.1"; tss_id "TSS8691"; +chr7 Cufflinks exon 22578664 22578795 . - . gene_id "XLOC_008692"; transcript_id "TCONS_00008692"; exon_number "1"; oId "CUFF.8455.1"; tss_id "TSS8692"; +chr7 Cufflinks exon 23037679 23037720 . - . gene_id "XLOC_008693"; transcript_id "TCONS_00008693"; exon_number "1"; oId "CUFF.8458.1"; tss_id "TSS8693"; +chr7 Cufflinks exon 23629047 23629080 . - . gene_id "XLOC_008694"; transcript_id "TCONS_00008694"; exon_number "1"; oId "CUFF.8463.1"; tss_id "TSS8694"; +chr7 Cufflinks exon 23934644 23934753 . - . gene_id "XLOC_008695"; transcript_id "TCONS_00008695"; exon_number "1"; oId "CUFF.8464.1"; tss_id "TSS8695"; +chr7 Cufflinks exon 24301229 24301334 . - . gene_id "XLOC_008696"; transcript_id "TCONS_00008696"; exon_number "1"; oId "CUFF.8466.1"; tss_id "TSS8696"; +chr7 Cufflinks exon 26208675 26208713 . - . gene_id "XLOC_008697"; transcript_id "TCONS_00008697"; exon_number "1"; oId "CUFF.8473.1"; tss_id "TSS8697"; +chr7 Cufflinks exon 27553379 27553502 . - . gene_id "XLOC_008698"; transcript_id "TCONS_00008698"; exon_number "1"; oId "CUFF.8474.1"; tss_id "TSS8698"; +chr7 Cufflinks exon 28157732 28157838 . - . gene_id "XLOC_008699"; transcript_id "TCONS_00008699"; exon_number "1"; oId "CUFF.8475.1"; tss_id "TSS8699"; +chr7 Cufflinks exon 28659849 28659902 . - . gene_id "XLOC_008700"; transcript_id "TCONS_00008700"; exon_number "1"; oId "CUFF.8476.1"; tss_id "TSS8700"; +chr7 Cufflinks exon 28984101 28984154 . - . gene_id "XLOC_008701"; transcript_id "TCONS_00008701"; exon_number "1"; oId "CUFF.8477.1"; tss_id "TSS8701"; +chr7 Cufflinks exon 29211484 29211685 . - . gene_id "XLOC_008702"; transcript_id "TCONS_00008702"; exon_number "1"; oId "CUFF.8478.1"; tss_id "TSS8702"; +chr7 Cufflinks exon 29997643 29997741 . - . gene_id "XLOC_008703"; transcript_id "TCONS_00008703"; exon_number "1"; oId "CUFF.8482.1"; tss_id "TSS8703"; +chr7 Cufflinks exon 33041572 33041665 . - . gene_id "XLOC_008704"; transcript_id "TCONS_00008704"; exon_number "1"; oId "CUFF.8483.1"; tss_id "TSS8704"; +chr7 Cufflinks exon 33085373 33085702 . - . gene_id "XLOC_008705"; transcript_id "TCONS_00008705"; exon_number "1"; oId "CUFF.8484.1"; tss_id "TSS8705"; +chr7 Cufflinks exon 33155185 33155242 . - . gene_id "XLOC_008706"; transcript_id "TCONS_00008706"; exon_number "1"; oId "CUFF.8487.1"; tss_id "TSS8706"; +chr7 Cufflinks exon 33240997 33241046 . - . gene_id "XLOC_008707"; transcript_id "TCONS_00008707"; exon_number "1"; oId "CUFF.8489.1"; tss_id "TSS8707"; +chr7 Cufflinks exon 33624115 33624151 . - . gene_id "XLOC_008708"; transcript_id "TCONS_00008708"; exon_number "1"; oId "CUFF.8490.1"; tss_id "TSS8708"; +chr7 Cufflinks exon 33869258 33869310 . - . gene_id "XLOC_008709"; transcript_id "TCONS_00008709"; exon_number "1"; oId "CUFF.8491.1"; tss_id "TSS8709"; +chr7 Cufflinks exon 34337108 34337208 . - . gene_id "XLOC_008710"; transcript_id "TCONS_00008710"; exon_number "1"; oId "CUFF.8492.1"; tss_id "TSS8710"; +chr7 Cufflinks exon 35329077 35329172 . - . gene_id "XLOC_008711"; transcript_id "TCONS_00008711"; exon_number "1"; oId "CUFF.8495.1"; tss_id "TSS8711"; +chr7 Cufflinks exon 35920346 35920402 . - . gene_id "XLOC_008712"; transcript_id "TCONS_00008712"; exon_number "1"; oId "CUFF.8497.1"; tss_id "TSS8712"; +chr7 Cufflinks exon 36450442 36450483 . - . gene_id "XLOC_008713"; transcript_id "TCONS_00008713"; exon_number "1"; oId "CUFF.8498.1"; tss_id "TSS8713"; +chr7 Cufflinks exon 36633290 36633375 . - . gene_id "XLOC_008714"; transcript_id "TCONS_00008714"; exon_number "1"; oId "CUFF.8500.1"; tss_id "TSS8714"; +chr7 Cufflinks exon 37072599 37072634 . - . gene_id "XLOC_008715"; transcript_id "TCONS_00008715"; exon_number "1"; oId "CUFF.8501.1"; tss_id "TSS8715"; +chr7 Cufflinks exon 37209281 37209383 . - . gene_id "XLOC_008716"; transcript_id "TCONS_00008716"; exon_number "1"; oId "CUFF.8502.1"; tss_id "TSS8716"; +chr7 Cufflinks exon 38570622 38570939 . - . gene_id "XLOC_008717"; transcript_id "TCONS_00008717"; exon_number "1"; oId "CUFF.8505.1"; tss_id "TSS8717"; +chr7 Cufflinks exon 40391878 40391907 . - . gene_id "XLOC_008718"; transcript_id "TCONS_00008718"; exon_number "1"; oId "CUFF.8509.1"; tss_id "TSS8718"; +chr7 Cufflinks exon 43247361 43247465 . - . gene_id "XLOC_008719"; transcript_id "TCONS_00008719"; exon_number "1"; oId "CUFF.8513.1"; tss_id "TSS8719"; +chr7 Cufflinks exon 44165393 44165471 . - . gene_id "XLOC_008720"; transcript_id "TCONS_00008720"; exon_number "1"; oId "CUFF.8515.1"; tss_id "TSS8720"; +chr7 Cufflinks exon 44444746 44444783 . - . gene_id "XLOC_008721"; transcript_id "TCONS_00008721"; exon_number "1"; oId "CUFF.8517.1"; tss_id "TSS8721"; +chr7 Cufflinks exon 44543379 44543478 . - . gene_id "XLOC_008722"; transcript_id "TCONS_00008722"; exon_number "1"; oId "CUFF.8519.1"; tss_id "TSS8722"; +chr7 Cufflinks exon 45953937 45953975 . - . gene_id "XLOC_008723"; transcript_id "TCONS_00008723"; exon_number "1"; oId "CUFF.8525.1"; tss_id "TSS8723"; +chr7 Cufflinks exon 46014980 46015037 . - . gene_id "XLOC_008724"; transcript_id "TCONS_00008724"; exon_number "1"; oId "CUFF.8526.1"; tss_id "TSS8724"; +chr7 Cufflinks exon 46173610 46173643 . - . gene_id "XLOC_008725"; transcript_id "TCONS_00008725"; exon_number "1"; oId "CUFF.8528.1"; tss_id "TSS8725"; +chr7 Cufflinks exon 47012376 47012447 . - . gene_id "XLOC_008726"; transcript_id "TCONS_00008726"; exon_number "1"; oId "CUFF.8529.1"; tss_id "TSS8726"; +chr7 Cufflinks exon 48196328 48196375 . - . gene_id "XLOC_008727"; transcript_id "TCONS_00008727"; exon_number "1"; oId "CUFF.8531.1"; tss_id "TSS8727"; +chr7 Cufflinks exon 52391491 52391586 . - . gene_id "XLOC_008728"; transcript_id "TCONS_00008728"; exon_number "1"; oId "CUFF.8534.1"; tss_id "TSS8728"; +chr7 Cufflinks exon 52549749 52549844 . - . gene_id "XLOC_008729"; transcript_id "TCONS_00008729"; exon_number "1"; oId "CUFF.8535.1"; tss_id "TSS8729"; +chr7 Cufflinks exon 53557909 53558131 . - . gene_id "XLOC_008730"; transcript_id "TCONS_00008730"; exon_number "1"; oId "CUFF.8537.1"; tss_id "TSS8730"; +chr7 Cufflinks exon 55110796 55110834 . - . gene_id "XLOC_008731"; transcript_id "TCONS_00008731"; exon_number "1"; oId "CUFF.8543.1"; tss_id "TSS8731"; +chr7 Cufflinks exon 56469763 56469865 . - . gene_id "XLOC_008732"; transcript_id "TCONS_00008732"; exon_number "1"; oId "CUFF.8549.1"; tss_id "TSS8732"; +chr7 Cufflinks exon 57253980 57254051 . - . gene_id "XLOC_008733"; transcript_id "TCONS_00008733"; exon_number "1"; oId "CUFF.8550.1"; tss_id "TSS8733"; +chr7 Cufflinks exon 57257145 57257213 . - . gene_id "XLOC_008734"; transcript_id "TCONS_00008734"; exon_number "1"; oId "CUFF.8551.1"; tss_id "TSS8734"; +chr7 Cufflinks exon 62471841 62471947 . - . gene_id "XLOC_008735"; transcript_id "TCONS_00008735"; exon_number "1"; oId "CUFF.8553.1"; tss_id "TSS8735"; +chr7 Cufflinks exon 62588844 62588872 . - . gene_id "XLOC_008736"; transcript_id "TCONS_00008736"; exon_number "1"; oId "CUFF.8554.1"; tss_id "TSS8736"; +chr7 Cufflinks exon 64483583 64483688 . - . gene_id "XLOC_008737"; transcript_id "TCONS_00008737"; exon_number "1"; oId "CUFF.8559.1"; tss_id "TSS8737"; +chr7 Cufflinks exon 65324648 65324753 . - . gene_id "XLOC_008738"; transcript_id "TCONS_00008738"; exon_number "1"; oId "CUFF.8561.1"; tss_id "TSS8738"; +chr7 Cufflinks exon 66015592 66015681 . - . gene_id "XLOC_008739"; transcript_id "TCONS_00008739"; exon_number "1"; oId "CUFF.8566.1"; tss_id "TSS8739"; +chr7 Cufflinks exon 66255338 66255452 . - . gene_id "XLOC_008740"; transcript_id "TCONS_00008740"; exon_number "1"; oId "CUFF.8569.1"; tss_id "TSS8740"; +chr7 Cufflinks exon 66681435 66681479 . - . gene_id "XLOC_008741"; transcript_id "TCONS_00008741"; exon_number "1"; oId "CUFF.8573.1"; tss_id "TSS8741"; +chr7 Cufflinks exon 66864547 66864618 . - . gene_id "XLOC_008742"; transcript_id "TCONS_00008742"; exon_number "1"; oId "CUFF.8574.1"; tss_id "TSS8742"; +chr7 Cufflinks exon 67563246 67563313 . - . gene_id "XLOC_008743"; transcript_id "TCONS_00008743"; exon_number "1"; oId "CUFF.8575.1"; tss_id "TSS8743"; +chr7 Cufflinks exon 67567174 67567208 . - . gene_id "XLOC_008744"; transcript_id "TCONS_00008744"; exon_number "1"; oId "CUFF.8576.1"; tss_id "TSS8744"; +chr7 Cufflinks exon 67786742 67786790 . - . gene_id "XLOC_008745"; transcript_id "TCONS_00008745"; exon_number "1"; oId "CUFF.8577.1"; tss_id "TSS8745"; +chr7 Cufflinks exon 68188949 68189038 . - . gene_id "XLOC_008746"; transcript_id "TCONS_00008746"; exon_number "1"; oId "CUFF.8578.1"; tss_id "TSS8746"; +chr7 Cufflinks exon 68579496 68579542 . - . gene_id "XLOC_008747"; transcript_id "TCONS_00008747"; exon_number "1"; oId "CUFF.8581.1"; tss_id "TSS8747"; +chr7 Cufflinks exon 68756155 68756188 . - . gene_id "XLOC_008748"; transcript_id "TCONS_00008748"; exon_number "1"; oId "CUFF.8585.1"; tss_id "TSS8748"; +chr7 Cufflinks exon 68866188 68866289 . - . gene_id "XLOC_008749"; transcript_id "TCONS_00008749"; exon_number "1"; oId "CUFF.8587.1"; tss_id "TSS8749"; +chr7 Cufflinks exon 70463220 70463388 . - . gene_id "XLOC_008750"; transcript_id "TCONS_00008750"; exon_number "1"; oId "CUFF.8591.1"; tss_id "TSS8750"; +chr7 Cufflinks exon 71150491 71150732 . - . gene_id "XLOC_008751"; transcript_id "TCONS_00008751"; exon_number "1"; oId "CUFF.8592.1"; tss_id "TSS8751"; +chr7 Cufflinks exon 71378727 71378840 . - . gene_id "XLOC_008752"; transcript_id "TCONS_00008752"; exon_number "1"; oId "CUFF.8593.1"; tss_id "TSS8752"; +chr7 Cufflinks exon 72075679 72075760 . - . gene_id "XLOC_008753"; transcript_id "TCONS_00008753"; exon_number "1"; oId "CUFF.8596.1"; tss_id "TSS8753"; +chr7 Cufflinks exon 72311996 72312305 . - . gene_id "XLOC_008754"; transcript_id "TCONS_00008754"; exon_number "1"; oId "CUFF.8597.1"; tss_id "TSS8754"; +chr7 Cufflinks exon 72753097 72753203 . - . gene_id "XLOC_008755"; transcript_id "TCONS_00008755"; exon_number "1"; oId "CUFF.8598.1"; tss_id "TSS8755"; +chr7 Cufflinks exon 73146887 73147188 . - . gene_id "XLOC_008756"; transcript_id "TCONS_00008756"; exon_number "1"; oId "CUFF.8600.1"; tss_id "TSS8756"; +chr7 Cufflinks exon 73672883 73672946 . - . gene_id "XLOC_008757"; transcript_id "TCONS_00008757"; exon_number "1"; oId "CUFF.8601.1"; tss_id "TSS8757"; +chr7 Cufflinks exon 73901756 73901870 . - . gene_id "XLOC_008758"; transcript_id "TCONS_00008758"; exon_number "1"; oId "CUFF.8602.1"; tss_id "TSS8758"; +chr7 Cufflinks exon 74011129 74011218 . - . gene_id "XLOC_008759"; transcript_id "TCONS_00008759"; exon_number "1"; oId "CUFF.8604.1"; tss_id "TSS8759"; +chr7 Cufflinks exon 74077261 74077313 . - . gene_id "XLOC_008760"; transcript_id "TCONS_00008760"; exon_number "1"; oId "CUFF.8607.1"; tss_id "TSS8760"; +chr7 Cufflinks exon 77052997 77053106 . - . gene_id "XLOC_008761"; transcript_id "TCONS_00008761"; exon_number "1"; oId "CUFF.8611.1"; tss_id "TSS8761"; +chr7 Cufflinks exon 78218950 78218985 . - . gene_id "XLOC_008762"; transcript_id "TCONS_00008762"; exon_number "1"; oId "CUFF.8612.1"; tss_id "TSS8762"; +chr7 Cufflinks exon 78431779 78431885 . - . gene_id "XLOC_008763"; transcript_id "TCONS_00008763"; exon_number "1"; oId "CUFF.8613.1"; tss_id "TSS8763"; +chr7 Cufflinks exon 78953527 78953588 . - . gene_id "XLOC_008764"; transcript_id "TCONS_00008764"; exon_number "1"; oId "CUFF.8615.1"; tss_id "TSS8764"; +chr7 Cufflinks exon 78972585 78972688 . - . gene_id "XLOC_008765"; transcript_id "TCONS_00008765"; exon_number "1"; oId "CUFF.8616.1"; tss_id "TSS8765"; +chr7 Cufflinks exon 79541420 79541524 . - . gene_id "XLOC_008766"; transcript_id "TCONS_00008766"; exon_number "1"; oId "CUFF.8618.1"; tss_id "TSS8766"; +chr7 Cufflinks exon 80942163 80942245 . - . gene_id "XLOC_008767"; transcript_id "TCONS_00008767"; exon_number "1"; oId "CUFF.8623.1"; tss_id "TSS8767"; +chr7 Cufflinks exon 82296264 82296361 . - . gene_id "XLOC_008768"; transcript_id "TCONS_00008768"; exon_number "1"; oId "CUFF.8627.1"; tss_id "TSS8768"; +chr7 Cufflinks exon 82564998 82565033 . - . gene_id "XLOC_008769"; transcript_id "TCONS_00008769"; exon_number "1"; oId "CUFF.8628.1"; tss_id "TSS8769"; +chr7 Cufflinks exon 85555685 85555805 . - . gene_id "XLOC_008770"; transcript_id "TCONS_00008770"; exon_number "1"; oId "CUFF.8633.1"; tss_id "TSS8770"; +chr7 Cufflinks exon 86800479 86800529 . - . gene_id "XLOC_008771"; transcript_id "TCONS_00008771"; exon_number "1"; oId "CUFF.8634.1"; tss_id "TSS8771"; +chr7 Cufflinks exon 87245910 87245944 . - . gene_id "XLOC_008772"; transcript_id "TCONS_00008772"; exon_number "1"; oId "CUFF.8635.1"; tss_id "TSS8772"; +chr7 Cufflinks exon 87325869 87326000 . - . gene_id "XLOC_008773"; transcript_id "TCONS_00008773"; exon_number "1"; oId "CUFF.8637.1"; tss_id "TSS8773"; +chr7 Cufflinks exon 89383935 89384040 . - . gene_id "XLOC_008774"; transcript_id "TCONS_00008774"; exon_number "1"; oId "CUFF.8639.1"; tss_id "TSS8774"; +chr7 Cufflinks exon 89635198 89635379 . - . gene_id "XLOC_008775"; transcript_id "TCONS_00008775"; exon_number "1"; oId "CUFF.8641.1"; tss_id "TSS8775"; +chr7 Cufflinks exon 89935576 89935612 . - . gene_id "XLOC_008776"; transcript_id "TCONS_00008776"; exon_number "1"; oId "CUFF.8644.1"; tss_id "TSS8776"; +chr7 Cufflinks exon 90131558 90131621 . - . gene_id "XLOC_008777"; transcript_id "TCONS_00008777"; exon_number "1"; oId "CUFF.8645.1"; tss_id "TSS8777"; +chr7 Cufflinks exon 90236315 90236423 . - . gene_id "XLOC_008778"; transcript_id "TCONS_00008778"; exon_number "1"; oId "CUFF.8646.1"; tss_id "TSS8778"; +chr7 Cufflinks exon 92331022 92331128 . - . gene_id "XLOC_008779"; transcript_id "TCONS_00008779"; exon_number "1"; oId "CUFF.8648.1"; tss_id "TSS8779"; +chr7 Cufflinks exon 92436068 92436103 . - . gene_id "XLOC_008780"; transcript_id "TCONS_00008780"; exon_number "1"; oId "CUFF.8649.1"; tss_id "TSS8780"; +chr7 Cufflinks exon 92600280 92600610 . - . gene_id "XLOC_008781"; transcript_id "TCONS_00008781"; exon_number "1"; oId "CUFF.8650.1"; tss_id "TSS8781"; +chr7 Cufflinks exon 92630497 92630532 . - . gene_id "XLOC_008782"; transcript_id "TCONS_00008782"; exon_number "1"; oId "CUFF.8651.1"; tss_id "TSS8782"; +chr7 Cufflinks exon 93896989 93897049 . - . gene_id "XLOC_008783"; transcript_id "TCONS_00008783"; exon_number "1"; oId "CUFF.8652.1"; tss_id "TSS8783"; +chr7 Cufflinks exon 94369731 94369786 . - . gene_id "XLOC_008784"; transcript_id "TCONS_00008784"; exon_number "1"; oId "CUFF.8655.1"; tss_id "TSS8784"; +chr7 Cufflinks exon 94813151 94813169 . - . gene_id "XLOC_008785"; transcript_id "TCONS_00008785"; exon_number "1"; oId "CUFF.8658.1"; tss_id "TSS8785"; +chr7 Cufflinks exon 95509499 95509564 . - . gene_id "XLOC_008786"; transcript_id "TCONS_00008786"; exon_number "1"; oId "CUFF.8661.1"; tss_id "TSS8786"; +chr7 Cufflinks exon 96340730 96340782 . - . gene_id "XLOC_008787"; transcript_id "TCONS_00008787"; exon_number "1"; oId "CUFF.8665.1"; tss_id "TSS8787"; +chr7 Cufflinks exon 96569357 96569675 . - . gene_id "XLOC_008788"; transcript_id "TCONS_00008788"; exon_number "1"; oId "CUFF.8666.1"; tss_id "TSS8788"; +chr7 Cufflinks exon 96770894 96770942 . - . gene_id "XLOC_008789"; transcript_id "TCONS_00008789"; exon_number "1"; oId "CUFF.8667.1"; tss_id "TSS8789"; +chr7 Cufflinks exon 97228245 97228570 . - . gene_id "XLOC_008790"; transcript_id "TCONS_00008790"; exon_number "1"; oId "CUFF.8669.1"; tss_id "TSS8790"; +chr7 Cufflinks exon 97606850 97606903 . - . gene_id "XLOC_008791"; transcript_id "TCONS_00008791"; exon_number "1"; oId "CUFF.8670.1"; tss_id "TSS8791"; +chr7 Cufflinks exon 98019073 98019136 . - . gene_id "XLOC_008792"; transcript_id "TCONS_00008792"; exon_number "1"; oId "CUFF.8675.1"; tss_id "TSS8792"; +chr7 Cufflinks exon 98392341 98392447 . - . gene_id "XLOC_008793"; transcript_id "TCONS_00008793"; exon_number "1"; oId "CUFF.8676.1"; tss_id "TSS8793"; +chr7 Cufflinks exon 98482610 98482714 . - . gene_id "XLOC_008794"; transcript_id "TCONS_00008794"; exon_number "1"; oId "CUFF.8677.1"; tss_id "TSS8794"; +chr7 Cufflinks exon 98863456 98863497 . - . gene_id "XLOC_008795"; transcript_id "TCONS_00008795"; exon_number "1"; oId "CUFF.8679.1"; tss_id "TSS8795"; +chr7 Cufflinks exon 99011598 99011702 . - . gene_id "XLOC_008796"; transcript_id "TCONS_00008796"; exon_number "1"; oId "CUFF.8680.1"; tss_id "TSS8796"; +chr7 Cufflinks exon 99065860 99066207 . - . gene_id "XLOC_008797"; transcript_id "TCONS_00008797"; exon_number "1"; oId "CUFF.8681.1"; tss_id "TSS8797"; +chr7 Cufflinks exon 99212192 99212234 . - . gene_id "XLOC_008798"; transcript_id "TCONS_00008798"; exon_number "1"; oId "CUFF.8683.1"; tss_id "TSS8798"; +chr7 Cufflinks exon 99814742 99814777 . - . gene_id "XLOC_008799"; transcript_id "TCONS_00008799"; exon_number "1"; oId "CUFF.8685.1"; tss_id "TSS8799"; +chr7 Cufflinks exon 99942052 99942087 . - . gene_id "XLOC_008800"; transcript_id "TCONS_00008800"; exon_number "1"; oId "CUFF.8686.1"; tss_id "TSS8800"; +chr7 Cufflinks exon 100127967 100128282 . - . gene_id "XLOC_008801"; transcript_id "TCONS_00008801"; exon_number "1"; oId "CUFF.8687.1"; tss_id "TSS8801"; +chr7 Cufflinks exon 100503890 100504197 . - . gene_id "XLOC_008802"; transcript_id "TCONS_00008802"; exon_number "1"; oId "CUFF.8689.1"; tss_id "TSS8802"; +chr7 Cufflinks exon 100913219 100913322 . - . gene_id "XLOC_008803"; transcript_id "TCONS_00008803"; exon_number "1"; oId "CUFF.8692.1"; tss_id "TSS8803"; +chr7 Cufflinks exon 101965497 101965608 . - . gene_id "XLOC_008804"; transcript_id "TCONS_00008804"; exon_number "1"; oId "CUFF.8693.1"; tss_id "TSS8804"; +chr7 Cufflinks exon 103109443 103109510 . - . gene_id "XLOC_008805"; transcript_id "TCONS_00008805"; exon_number "1"; oId "CUFF.8697.1"; tss_id "TSS8805"; +chr7 Cufflinks exon 103124749 103124985 . - . gene_id "XLOC_008806"; transcript_id "TCONS_00008806"; exon_number "1"; oId "CUFF.8698.1"; tss_id "TSS8806"; +chr7 Cufflinks exon 103222986 103223206 . - . gene_id "XLOC_008807"; transcript_id "TCONS_00008807"; exon_number "1"; oId "CUFF.8699.1"; tss_id "TSS8807"; +chr7 Cufflinks exon 104641783 104641866 . - . gene_id "XLOC_008808"; transcript_id "TCONS_00008808"; exon_number "1"; oId "CUFF.8703.1"; tss_id "TSS8808"; +chr7 Cufflinks exon 105059699 105059732 . - . gene_id "XLOC_008809"; transcript_id "TCONS_00008809"; exon_number "1"; oId "CUFF.8707.1"; tss_id "TSS8809"; +chr7 Cufflinks exon 105060347 105060477 . - . gene_id "XLOC_008810"; transcript_id "TCONS_00008810"; exon_number "1"; oId "CUFF.8708.1"; tss_id "TSS8810"; +chr7 Cufflinks exon 106422062 106422154 . - . gene_id "XLOC_008811"; transcript_id "TCONS_00008811"; exon_number "1"; oId "CUFF.8710.1"; tss_id "TSS8811"; +chr7 Cufflinks exon 106526118 106526169 . - . gene_id "XLOC_008812"; transcript_id "TCONS_00008812"; exon_number "1"; oId "CUFF.8711.1"; tss_id "TSS8812"; +chr7 Cufflinks exon 107640236 107640427 . - . gene_id "XLOC_008813"; transcript_id "TCONS_00008813"; exon_number "1"; oId "CUFF.8713.1"; tss_id "TSS8813"; +chr7 Cufflinks exon 107927137 107927177 . - . gene_id "XLOC_008814"; transcript_id "TCONS_00008814"; exon_number "1"; oId "CUFF.8715.1"; tss_id "TSS8814"; +chr7 Cufflinks exon 108407338 108407379 . - . gene_id "XLOC_008815"; transcript_id "TCONS_00008815"; exon_number "1"; oId "CUFF.8716.1"; tss_id "TSS8815"; +chr7 Cufflinks exon 110263059 110263121 . - . gene_id "XLOC_008816"; transcript_id "TCONS_00008816"; exon_number "1"; oId "CUFF.8718.1"; tss_id "TSS8816"; +chr7 Cufflinks exon 110749340 110749414 . - . gene_id "XLOC_008817"; transcript_id "TCONS_00008817"; exon_number "1"; oId "CUFF.8719.1"; tss_id "TSS8817"; +chr7 Cufflinks exon 111593736 111593820 . - . gene_id "XLOC_008818"; transcript_id "TCONS_00008818"; exon_number "1"; oId "CUFF.8720.1"; tss_id "TSS8818"; +chr7 Cufflinks exon 114253840 114253960 . - . gene_id "XLOC_008819"; transcript_id "TCONS_00008819"; exon_number "1"; oId "CUFF.8722.1"; tss_id "TSS8819"; +chr7 Cufflinks exon 114354315 114354350 . - . gene_id "XLOC_008820"; transcript_id "TCONS_00008820"; exon_number "1"; oId "CUFF.8723.1"; tss_id "TSS8820"; +chr7 Cufflinks exon 115083107 115083194 . - . gene_id "XLOC_008821"; transcript_id "TCONS_00008821"; exon_number "1"; oId "CUFF.8724.1"; tss_id "TSS8821"; +chr7 Cufflinks exon 116370977 116371018 . - . gene_id "XLOC_008822"; transcript_id "TCONS_00008822"; exon_number "1"; oId "CUFF.8727.1"; tss_id "TSS8822"; +chr7 Cufflinks exon 116584379 116584468 . - . gene_id "XLOC_008823"; transcript_id "TCONS_00008823"; exon_number "1"; oId "CUFF.8729.1"; tss_id "TSS8823"; +chr7 Cufflinks exon 119646033 119646155 . - . gene_id "XLOC_008824"; transcript_id "TCONS_00008824"; exon_number "1"; oId "CUFF.8731.1"; tss_id "TSS8824"; +chr7 Cufflinks exon 120537280 120537354 . - . gene_id "XLOC_008825"; transcript_id "TCONS_00008825"; exon_number "1"; oId "CUFF.8733.1"; tss_id "TSS8825"; +chr7 Cufflinks exon 120621509 120621607 . - . gene_id "XLOC_008826"; transcript_id "TCONS_00008826"; exon_number "1"; oId "CUFF.8734.1"; tss_id "TSS8826"; +chr7 Cufflinks exon 120723782 120723871 . - . gene_id "XLOC_008827"; transcript_id "TCONS_00008827"; exon_number "1"; oId "CUFF.8735.1"; tss_id "TSS8827"; +chr7 Cufflinks exon 120835002 120835111 . - . gene_id "XLOC_008828"; transcript_id "TCONS_00008828"; exon_number "1"; oId "CUFF.8736.1"; tss_id "TSS8828"; +chr7 Cufflinks exon 121416164 121416199 . - . gene_id "XLOC_008829"; transcript_id "TCONS_00008829"; exon_number "1"; oId "CUFF.8738.1"; tss_id "TSS8829"; +chr7 Cufflinks exon 122403873 122403922 . - . gene_id "XLOC_008830"; transcript_id "TCONS_00008830"; exon_number "1"; oId "CUFF.8740.1"; tss_id "TSS8830"; +chr7 Cufflinks exon 122532042 122532095 . - . gene_id "XLOC_008831"; transcript_id "TCONS_00008831"; exon_number "1"; oId "CUFF.8741.1"; tss_id "TSS8831"; +chr7 Cufflinks exon 123098045 123098148 . - . gene_id "XLOC_008832"; transcript_id "TCONS_00008832"; exon_number "1"; oId "CUFF.8742.1"; tss_id "TSS8832"; +chr7 Cufflinks exon 123430661 123430765 . - . gene_id "XLOC_008833"; transcript_id "TCONS_00008833"; exon_number "1"; oId "CUFF.8743.1"; tss_id "TSS8833"; +chr7 Cufflinks exon 128083503 128083563 . - . gene_id "XLOC_008834"; transcript_id "TCONS_00008834"; exon_number "1"; oId "CUFF.8752.1"; tss_id "TSS8834"; +chr7 Cufflinks exon 128118088 128118179 . - . gene_id "XLOC_008835"; transcript_id "TCONS_00008835"; exon_number "1"; oId "CUFF.8753.1"; tss_id "TSS8835"; +chr7 Cufflinks exon 128349743 128349782 . - . gene_id "XLOC_008836"; transcript_id "TCONS_00008836"; exon_number "1"; oId "CUFF.8757.1"; tss_id "TSS8836"; +chr7 Cufflinks exon 128350269 128350302 . - . gene_id "XLOC_008837"; transcript_id "TCONS_00008837"; exon_number "1"; oId "CUFF.8758.1"; tss_id "TSS8837"; +chr7 Cufflinks exon 128645359 128645417 . - . gene_id "XLOC_008838"; transcript_id "TCONS_00008838"; exon_number "1"; oId "CUFF.8762.1"; tss_id "TSS8838"; +chr7 Cufflinks exon 128743688 128743754 . - . gene_id "XLOC_008839"; transcript_id "TCONS_00008839"; exon_number "1"; oId "CUFF.8764.1"; tss_id "TSS8839"; +chr7 Cufflinks exon 128771600 128771642 . - . gene_id "XLOC_008840"; transcript_id "TCONS_00008840"; exon_number "1"; oId "CUFF.8765.1"; tss_id "TSS8840"; +chr7 Cufflinks exon 128834076 128834134 . - . gene_id "XLOC_008841"; transcript_id "TCONS_00008841"; exon_number "1"; oId "CUFF.8766.1"; tss_id "TSS8841"; +chr7 Cufflinks exon 129933568 129933611 . - . gene_id "XLOC_008842"; transcript_id "TCONS_00008842"; exon_number "1"; oId "CUFF.8771.1"; tss_id "TSS8842"; +chr7 Cufflinks exon 130287670 130287790 . - . gene_id "XLOC_008843"; transcript_id "TCONS_00008843"; exon_number "1"; oId "CUFF.8774.1"; tss_id "TSS8843"; +chr7 Cufflinks exon 130446281 130446325 . - . gene_id "XLOC_008844"; transcript_id "TCONS_00008844"; exon_number "1"; oId "CUFF.8775.1"; tss_id "TSS8844"; +chr7 Cufflinks exon 130596195 130596231 . - . gene_id "XLOC_008845"; transcript_id "TCONS_00008845"; exon_number "1"; oId "CUFF.8776.1"; tss_id "TSS8845"; +chr7 Cufflinks exon 130739645 130739750 . - . gene_id "XLOC_008846"; transcript_id "TCONS_00008846"; exon_number "1"; oId "CUFF.8777.1"; tss_id "TSS8846"; +chr7 Cufflinks exon 131006814 131006882 . - . gene_id "XLOC_008847"; transcript_id "TCONS_00008847"; exon_number "1"; oId "CUFF.8778.1"; tss_id "TSS8847"; +chr7 Cufflinks exon 131924564 131924605 . - . gene_id "XLOC_008848"; transcript_id "TCONS_00008848"; exon_number "1"; oId "CUFF.8779.1"; tss_id "TSS8848"; +chr7 Cufflinks exon 132492413 132492456 . - . gene_id "XLOC_008849"; transcript_id "TCONS_00008849"; exon_number "1"; oId "CUFF.8780.1"; tss_id "TSS8849"; +chr7 Cufflinks exon 133182496 133182566 . - . gene_id "XLOC_008850"; transcript_id "TCONS_00008850"; exon_number "1"; oId "CUFF.8781.1"; tss_id "TSS8850"; +chr7 Cufflinks exon 134660533 134660582 . - . gene_id "XLOC_008851"; transcript_id "TCONS_00008851"; exon_number "1"; oId "CUFF.8784.1"; tss_id "TSS8851"; +chr7 Cufflinks exon 135160949 135161082 . - . gene_id "XLOC_008852"; transcript_id "TCONS_00008852"; exon_number "1"; oId "CUFF.8786.1"; tss_id "TSS8852"; +chr7 Cufflinks exon 135350353 135350450 . - . gene_id "XLOC_008853"; transcript_id "TCONS_00008853"; exon_number "1"; oId "CUFF.8787.1"; tss_id "TSS8853"; +chr7 Cufflinks exon 135862194 135862300 . - . gene_id "XLOC_008854"; transcript_id "TCONS_00008854"; exon_number "1"; oId "CUFF.8789.1"; tss_id "TSS8854"; +chr7 Cufflinks exon 136116070 136116100 . - . gene_id "XLOC_008855"; transcript_id "TCONS_00008855"; exon_number "1"; oId "CUFF.8790.1"; tss_id "TSS8855"; +chr7 Cufflinks exon 136525837 136525944 . - . gene_id "XLOC_008856"; transcript_id "TCONS_00008856"; exon_number "1"; oId "CUFF.8791.1"; tss_id "TSS8856"; +chr7 Cufflinks exon 138167226 138167329 . - . gene_id "XLOC_008857"; transcript_id "TCONS_00008857"; exon_number "1"; oId "CUFF.8798.1"; tss_id "TSS8857"; +chr7 Cufflinks exon 138561106 138561211 . - . gene_id "XLOC_008858"; transcript_id "TCONS_00008858"; exon_number "1"; oId "CUFF.8800.1"; tss_id "TSS8858"; +chr7 Cufflinks exon 139000037 139000140 . - . gene_id "XLOC_008859"; transcript_id "TCONS_00008859"; exon_number "1"; oId "CUFF.8801.1"; tss_id "TSS8859"; +chr7 Cufflinks exon 139409584 139409645 . - . gene_id "XLOC_008860"; transcript_id "TCONS_00008860"; exon_number "1"; oId "CUFF.8805.1"; tss_id "TSS8860"; +chr7 Cufflinks exon 139909369 139909471 . - . gene_id "XLOC_008861"; transcript_id "TCONS_00008861"; exon_number "1"; oId "CUFF.8806.1"; tss_id "TSS8861"; +chr7 Cufflinks exon 140075361 140075467 . - . gene_id "XLOC_008862"; transcript_id "TCONS_00008862"; exon_number "1"; oId "CUFF.8809.1"; tss_id "TSS8862"; +chr7 Cufflinks exon 140086579 140086690 . - . gene_id "XLOC_008863"; transcript_id "TCONS_00008863"; exon_number "1"; oId "CUFF.8810.1"; tss_id "TSS8863"; +chr7 Cufflinks exon 140387677 140387798 . - . gene_id "XLOC_008864"; transcript_id "TCONS_00008864"; exon_number "1"; oId "CUFF.8812.1"; tss_id "TSS8864"; +chr7 Cufflinks exon 141504774 141504839 . - . gene_id "XLOC_008865"; transcript_id "TCONS_00008865"; exon_number "1"; oId "CUFF.8819.1"; tss_id "TSS8865"; +chr7 Cufflinks exon 143451722 143451825 . - . gene_id "XLOC_008866"; transcript_id "TCONS_00008866"; exon_number "1"; oId "CUFF.8824.1"; tss_id "TSS8866"; +chr7 Cufflinks exon 143613693 143613725 . - . gene_id "XLOC_008867"; transcript_id "TCONS_00008867"; exon_number "1"; oId "CUFF.8825.1"; tss_id "TSS8867"; +chr7 Cufflinks exon 143963315 143963419 . - . gene_id "XLOC_008868"; transcript_id "TCONS_00008868"; exon_number "1"; oId "CUFF.8828.1"; tss_id "TSS8868"; +chr7 Cufflinks exon 143977250 143977293 . - . gene_id "XLOC_008869"; transcript_id "TCONS_00008869"; exon_number "1"; oId "CUFF.8829.1"; tss_id "TSS8869"; +chr7 Cufflinks exon 144045500 144045544 . - . gene_id "XLOC_008870"; transcript_id "TCONS_00008870"; exon_number "1"; oId "CUFF.8830.1"; tss_id "TSS8870"; +chr7 Cufflinks exon 144546847 144547176 . - . gene_id "XLOC_008871"; transcript_id "TCONS_00008871"; exon_number "1"; oId "CUFF.8832.1"; tss_id "TSS8871"; +chr7 Cufflinks exon 145556748 145556783 . - . gene_id "XLOC_008872"; transcript_id "TCONS_00008872"; exon_number "1"; oId "CUFF.8834.1"; tss_id "TSS8872"; +chr7 Cufflinks exon 146113435 146113645 . - . gene_id "XLOC_008873"; transcript_id "TCONS_00008873"; exon_number "1"; oId "CUFF.8835.1"; tss_id "TSS8873"; +chr7 Cufflinks exon 146799259 146799326 . - . gene_id "XLOC_008874"; transcript_id "TCONS_00008874"; exon_number "1"; oId "CUFF.8836.1"; tss_id "TSS8874"; +chr7 Cufflinks exon 148164721 148164776 . - . gene_id "XLOC_008875"; transcript_id "TCONS_00008875"; exon_number "1"; oId "CUFF.8842.1"; tss_id "TSS8875"; +chr7 Cufflinks exon 148274634 148274672 . - . gene_id "XLOC_008876"; transcript_id "TCONS_00008876"; exon_number "1"; oId "CUFF.8843.1"; tss_id "TSS8876"; +chr7 Cufflinks exon 148481397 148481485 . - . gene_id "XLOC_008877"; transcript_id "TCONS_00008877"; exon_number "1"; oId "CUFF.8844.1"; tss_id "TSS8877"; +chr7 Cufflinks exon 148822766 148823078 . - . gene_id "XLOC_008878"; transcript_id "TCONS_00008878"; exon_number "1"; oId "CUFF.8848.1"; tss_id "TSS8878"; +chr7 Cufflinks exon 149006064 149006130 . - . gene_id "XLOC_008879"; transcript_id "TCONS_00008879"; exon_number "1"; oId "CUFF.8849.1"; tss_id "TSS8879"; +chr7 Cufflinks exon 149052766 149052837 . - . gene_id "XLOC_008880"; transcript_id "TCONS_00008880"; exon_number "1"; oId "CUFF.8852.1"; tss_id "TSS8880"; +chr7 Cufflinks exon 149053749 149053815 . - . gene_id "XLOC_008881"; transcript_id "TCONS_00008881"; exon_number "1"; oId "CUFF.8853.1"; tss_id "TSS8881"; +chr7 Cufflinks exon 149060298 149060348 . - . gene_id "XLOC_008882"; transcript_id "TCONS_00008882"; exon_number "1"; oId "CUFF.8854.1"; tss_id "TSS8882"; +chr7 Cufflinks exon 149072850 149072921 . - . gene_id "XLOC_008883"; transcript_id "TCONS_00008883"; exon_number "1"; oId "CUFF.8855.1"; tss_id "TSS8883"; +chr7 Cufflinks exon 149074600 149074672 . - . gene_id "XLOC_008884"; transcript_id "TCONS_00008884"; exon_number "1"; oId "CUFF.8856.1"; tss_id "TSS8884"; +chr7 Cufflinks exon 149095391 149095462 . - . gene_id "XLOC_008885"; transcript_id "TCONS_00008885"; exon_number "1"; oId "CUFF.8858.1"; tss_id "TSS8885"; +chr7 Cufflinks exon 149103155 149103226 . - . gene_id "XLOC_008886"; transcript_id "TCONS_00008886"; exon_number "1"; oId "CUFF.8860.1"; tss_id "TSS8886"; +chr7 Cufflinks exon 149112229 149112300 . - . gene_id "XLOC_008887"; transcript_id "TCONS_00008887"; exon_number "1"; oId "CUFF.8861.1"; tss_id "TSS8887"; +chr7 Cufflinks exon 149286162 149286235 . - . gene_id "XLOC_008888"; transcript_id "TCONS_00008888"; exon_number "1"; oId "CUFF.8868.1"; tss_id "TSS8888"; +chr7 Cufflinks exon 149287032 149287088 . - . gene_id "XLOC_008889"; transcript_id "TCONS_00008889"; exon_number "1"; oId "CUFF.8869.1"; tss_id "TSS8889"; +chr7 Cufflinks exon 149291522 149291578 . - . gene_id "XLOC_008890"; transcript_id "TCONS_00008890"; exon_number "1"; oId "CUFF.8870.1"; tss_id "TSS8890"; +chr7 Cufflinks exon 149292305 149292376 . - . gene_id "XLOC_008891"; transcript_id "TCONS_00008891"; exon_number "1"; oId "CUFF.8871.1"; tss_id "TSS8891"; +chr7 Cufflinks exon 149310154 149310227 . - . gene_id "XLOC_008892"; transcript_id "TCONS_00008892"; exon_number "1"; oId "CUFF.8876.1"; tss_id "TSS8892"; +chr7 Cufflinks exon 149333084 149333147 . - . gene_id "XLOC_008893"; transcript_id "TCONS_00008893"; exon_number "1"; oId "CUFF.8879.1"; tss_id "TSS8893"; +chr7 Cufflinks exon 149335514 149335580 . - . gene_id "XLOC_008894"; transcript_id "TCONS_00008894"; exon_number "1"; oId "CUFF.8880.1"; tss_id "TSS8894"; +chr7 Cufflinks exon 149344045 149344117 . - . gene_id "XLOC_008895"; transcript_id "TCONS_00008895"; exon_number "1"; oId "CUFF.8881.1"; tss_id "TSS8895"; +chr7 Cufflinks exon 149344899 149344941 . - . gene_id "XLOC_008896"; transcript_id "TCONS_00008896"; exon_number "1"; oId "CUFF.8882.1"; tss_id "TSS8896"; +chr7 Cufflinks exon 149387418 149387483 . - . gene_id "XLOC_008897"; transcript_id "TCONS_00008897"; exon_number "1"; oId "CUFF.8885.1"; tss_id "TSS8897"; +chr7 Cufflinks exon 149388271 149388343 . - . gene_id "XLOC_008898"; transcript_id "TCONS_00008898"; exon_number "1"; oId "CUFF.8886.1"; tss_id "TSS8898"; +chr7 Cufflinks exon 151161719 151162023 . - . gene_id "XLOC_008899"; transcript_id "TCONS_00008899"; exon_number "1"; oId "CUFF.8892.1"; tss_id "TSS8899"; +chr7 Cufflinks exon 151349624 151349679 . - . gene_id "XLOC_008900"; transcript_id "TCONS_00008900"; exon_number "1"; oId "CUFF.8893.1"; tss_id "TSS8900"; +chr7 Cufflinks exon 151431093 151431133 . - . gene_id "XLOC_008901"; transcript_id "TCONS_00008901"; exon_number "1"; oId "CUFF.8894.1"; tss_id "TSS8901"; +chr7 Cufflinks exon 151722259 151722558 . - . gene_id "XLOC_008902"; transcript_id "TCONS_00008902"; exon_number "1"; oId "CUFF.8896.1"; tss_id "TSS8902"; +chr7 Cufflinks exon 151765982 151766091 . - . gene_id "XLOC_008903"; transcript_id "TCONS_00008903"; exon_number "1"; oId "CUFF.8897.1"; tss_id "TSS8903"; +chr7 Cufflinks exon 152290060 152290175 . - . gene_id "XLOC_008904"; transcript_id "TCONS_00008904"; exon_number "1"; oId "CUFF.8899.1"; tss_id "TSS8904"; +chr7 Cufflinks exon 153683126 153683164 . - . gene_id "XLOC_008905"; transcript_id "TCONS_00008905"; exon_number "1"; oId "CUFF.8902.1"; tss_id "TSS8905"; +chr7 Cufflinks exon 153790007 153790115 . - . gene_id "XLOC_008906"; transcript_id "TCONS_00008906"; exon_number "1"; oId "CUFF.8903.1"; tss_id "TSS8906"; +chr7 Cufflinks exon 156756967 156757011 . - . gene_id "XLOC_008907"; transcript_id "TCONS_00008907"; exon_number "1"; oId "CUFF.8908.1"; tss_id "TSS8907"; +chr7 Cufflinks exon 157097070 157097312 . - . gene_id "XLOC_008908"; transcript_id "TCONS_00008908"; exon_number "1"; oId "CUFF.8909.1"; tss_id "TSS8908"; +chr7 Cufflinks exon 158026215 158026258 . - . gene_id "XLOC_008909"; transcript_id "TCONS_00008909"; exon_number "1"; oId "CUFF.8910.1"; tss_id "TSS8909"; +chr8 Cufflinks exon 547043 547094 . + . gene_id "XLOC_008910"; transcript_id "TCONS_00008910"; exon_number "1"; oId "CUFF.8911.1"; tss_id "TSS8910"; +chr8 Cufflinks exon 3558014 3558093 . + . gene_id "XLOC_008911"; transcript_id "TCONS_00008911"; exon_number "1"; oId "CUFF.8913.1"; tss_id "TSS8911"; +chr8 Cufflinks exon 4038757 4038797 . + . gene_id "XLOC_008912"; transcript_id "TCONS_00008912"; exon_number "1"; oId "CUFF.8914.1"; tss_id "TSS8912"; +chr8 Cufflinks exon 4969322 4969359 . + . gene_id "XLOC_008913"; transcript_id "TCONS_00008913"; exon_number "1"; oId "CUFF.8915.1"; tss_id "TSS8913"; +chr8 Cufflinks exon 7249944 7250033 . + . gene_id "XLOC_008914"; transcript_id "TCONS_00008914"; exon_number "1"; oId "CUFF.8923.1"; tss_id "TSS8914"; +chr8 Cufflinks exon 8480310 8480342 . + . gene_id "XLOC_008915"; transcript_id "TCONS_00008915"; exon_number "1"; oId "CUFF.8926.1"; tss_id "TSS8915"; +chr8 Cufflinks exon 8688929 8688997 . + . gene_id "XLOC_008916"; transcript_id "TCONS_00008916"; exon_number "1"; oId "CUFF.8927.1"; tss_id "TSS8916"; +chr8 Cufflinks exon 8753323 8753417 . + . gene_id "XLOC_008917"; transcript_id "TCONS_00008917"; exon_number "1"; oId "CUFF.8928.1"; tss_id "TSS8917"; +chr8 Cufflinks exon 8941084 8941144 . + . gene_id "XLOC_008918"; transcript_id "TCONS_00008918"; exon_number "1"; oId "CUFF.8932.1"; tss_id "TSS8918"; +chr8 Cufflinks exon 9166220 9166255 . + . gene_id "XLOC_008919"; transcript_id "TCONS_00008919"; exon_number "1"; oId "CUFF.8934.1"; tss_id "TSS8919"; +chr8 Cufflinks exon 10333733 10333839 . + . gene_id "XLOC_008920"; transcript_id "TCONS_00008920"; exon_number "1"; oId "CUFF.8942.1"; tss_id "TSS8920"; +chr8 Cufflinks exon 10544079 10544191 . + . gene_id "XLOC_008921"; transcript_id "TCONS_00008921"; exon_number "1"; oId "CUFF.8943.1"; tss_id "TSS8921"; +chr8 Cufflinks exon 10962279 10962312 . + . gene_id "XLOC_008922"; transcript_id "TCONS_00008922"; exon_number "1"; oId "CUFF.8944.1"; tss_id "TSS8922"; +chr8 Cufflinks exon 11000760 11000873 . + . gene_id "XLOC_008923"; transcript_id "TCONS_00008923"; exon_number "1"; oId "CUFF.8945.1"; tss_id "TSS8923"; +chr8 Cufflinks exon 11236904 11237141 . + . gene_id "XLOC_008924"; transcript_id "TCONS_00008924"; exon_number "1"; oId "CUFF.8946.1"; tss_id "TSS8924"; +chr8 Cufflinks exon 11237504 11237567 . + . gene_id "XLOC_008925"; transcript_id "TCONS_00008925"; exon_number "1"; oId "CUFF.8947.1"; tss_id "TSS8925"; +chr8 Cufflinks exon 11770801 11770874 . + . gene_id "XLOC_008926"; transcript_id "TCONS_00008926"; exon_number "1"; oId "CUFF.8949.1"; tss_id "TSS8926"; +chr8 Cufflinks exon 11793381 11793455 . + . gene_id "XLOC_008927"; transcript_id "TCONS_00008927"; exon_number "1"; oId "CUFF.8950.1"; tss_id "TSS8927"; +chr8 Cufflinks exon 12570074 12570148 . + . gene_id "XLOC_008928"; transcript_id "TCONS_00008928"; exon_number "1"; oId "CUFF.8953.1"; tss_id "TSS8928"; +chr8 Cufflinks exon 12901859 12901965 . + . gene_id "XLOC_008929"; transcript_id "TCONS_00008929"; exon_number "1"; oId "CUFF.8954.1"; tss_id "TSS8929"; +chr8 Cufflinks exon 13393538 13393617 . + . gene_id "XLOC_008930"; transcript_id "TCONS_00008930"; exon_number "1"; oId "CUFF.8955.1"; tss_id "TSS8930"; +chr8 Cufflinks exon 13579499 13579544 . + . gene_id "XLOC_008931"; transcript_id "TCONS_00008931"; exon_number "1"; oId "CUFF.8957.1"; tss_id "TSS8931"; +chr8 Cufflinks exon 13720746 13720790 . + . gene_id "XLOC_008932"; transcript_id "TCONS_00008932"; exon_number "1"; oId "CUFF.8958.1"; tss_id "TSS8932"; +chr8 Cufflinks exon 14176967 14177024 . + . gene_id "XLOC_008933"; transcript_id "TCONS_00008933"; exon_number "1"; oId "CUFF.8959.1"; tss_id "TSS8933"; +chr8 Cufflinks exon 15400410 15400447 . + . gene_id "XLOC_008934"; transcript_id "TCONS_00008934"; exon_number "1"; oId "CUFF.8961.1"; tss_id "TSS8934"; +chr8 Cufflinks exon 15585233 15585262 . + . gene_id "XLOC_008935"; transcript_id "TCONS_00008935"; exon_number "1"; oId "CUFF.8962.1"; tss_id "TSS8935"; +chr8 Cufflinks exon 15997738 15997806 . + . gene_id "XLOC_008936"; transcript_id "TCONS_00008936"; exon_number "1"; oId "CUFF.8963.1"; tss_id "TSS8936"; +chr8 Cufflinks exon 17196326 17196395 . + . gene_id "XLOC_008937"; transcript_id "TCONS_00008937"; exon_number "1"; oId "CUFF.8966.1"; tss_id "TSS8937"; +chr8 Cufflinks exon 17605627 17605717 . + . gene_id "XLOC_008938"; transcript_id "TCONS_00008938"; exon_number "1"; oId "CUFF.8968.1"; tss_id "TSS8938"; +chr8 Cufflinks exon 17931095 17931315 . + . gene_id "XLOC_008939"; transcript_id "TCONS_00008939"; exon_number "1"; oId "CUFF.8969.1"; tss_id "TSS8939"; +chr8 Cufflinks exon 18120208 18120275 . + . gene_id "XLOC_008940"; transcript_id "TCONS_00008940"; exon_number "1"; oId "CUFF.8970.1"; tss_id "TSS8940"; +chr8 Cufflinks exon 18597333 18597387 . + . gene_id "XLOC_008941"; transcript_id "TCONS_00008941"; exon_number "1"; oId "CUFF.8971.1"; tss_id "TSS8941"; +chr8 Cufflinks exon 19191734 19191777 . + . gene_id "XLOC_008942"; transcript_id "TCONS_00008942"; exon_number "1"; oId "CUFF.8972.1"; tss_id "TSS8942"; +chr8 Cufflinks exon 19712055 19712530 . + . gene_id "XLOC_008943"; transcript_id "TCONS_00008943"; exon_number "1"; oId "CUFF.8974.1"; tss_id "TSS8943"; +chr8 Cufflinks exon 19934641 19934742 . + . gene_id "XLOC_008944"; transcript_id "TCONS_00008944"; exon_number "1"; oId "CUFF.8975.1"; tss_id "TSS8944"; +chr8 Cufflinks exon 20087290 20087369 . + . gene_id "XLOC_008945"; transcript_id "TCONS_00008945"; exon_number "1"; oId "CUFF.8976.1"; tss_id "TSS8945"; +chr8 Cufflinks exon 20147685 20147774 . + . gene_id "XLOC_008946"; transcript_id "TCONS_00008946"; exon_number "1"; oId "CUFF.8977.1"; tss_id "TSS8946"; +chr8 Cufflinks exon 21455972 21456306 . + . gene_id "XLOC_008947"; transcript_id "TCONS_00008947"; exon_number "1"; oId "CUFF.8981.1"; tss_id "TSS8947"; +chr8 Cufflinks exon 21889864 21889966 . + . gene_id "XLOC_008948"; transcript_id "TCONS_00008948"; exon_number "1"; oId "CUFF.8982.1"; tss_id "TSS8948"; +chr8 Cufflinks exon 22214597 22214653 . + . gene_id "XLOC_008949"; transcript_id "TCONS_00008949"; exon_number "1"; oId "CUFF.8983.1"; tss_id "TSS8949"; +chr8 Cufflinks exon 22291904 22292000 . + . gene_id "XLOC_008950"; transcript_id "TCONS_00008950"; exon_number "1"; oId "CUFF.8984.1"; tss_id "TSS8950"; +chr8 Cufflinks exon 22835390 22835653 . + . gene_id "XLOC_008951"; transcript_id "TCONS_00008951"; exon_number "1"; oId "CUFF.8986.1"; tss_id "TSS8951"; +chr8 Cufflinks exon 24809496 24809533 . + . gene_id "XLOC_008952"; transcript_id "TCONS_00008952"; exon_number "1"; oId "CUFF.8990.1"; tss_id "TSS8952"; +chr8 Cufflinks exon 24923103 24923132 . + . gene_id "XLOC_008953"; transcript_id "TCONS_00008953"; exon_number "1"; oId "CUFF.8991.1"; tss_id "TSS8953"; +chr8 Cufflinks exon 25994397 25994515 . + . gene_id "XLOC_008954"; transcript_id "TCONS_00008954"; exon_number "1"; oId "CUFF.8994.1"; tss_id "TSS8954"; +chr8 Cufflinks exon 27537349 27537452 . + . gene_id "XLOC_008955"; transcript_id "TCONS_00008955"; exon_number "1"; oId "CUFF.8997.1"; tss_id "TSS8955"; +chr8 Cufflinks exon 27631163 27631253 . + . gene_id "XLOC_008956"; transcript_id "TCONS_00008956"; exon_number "1"; oId "CUFF.8999.1"; tss_id "TSS8956"; +chr8 Cufflinks exon 28273965 28274068 . + . gene_id "XLOC_008957"; transcript_id "TCONS_00008957"; exon_number "1"; oId "CUFF.9000.1"; tss_id "TSS8957"; +chr8 Cufflinks exon 28387928 28388016 . + . gene_id "XLOC_008958"; transcript_id "TCONS_00008958"; exon_number "1"; oId "CUFF.9002.1"; tss_id "TSS8958"; +chr8 Cufflinks exon 28639967 28640034 . + . gene_id "XLOC_008959"; transcript_id "TCONS_00008959"; exon_number "1"; oId "CUFF.9003.1"; tss_id "TSS8959"; +chr8 Cufflinks exon 29061949 29062031 . + . gene_id "XLOC_008960"; transcript_id "TCONS_00008960"; exon_number "1"; oId "CUFF.9007.1"; tss_id "TSS8960"; +chr8 Cufflinks exon 29360847 29360883 . + . gene_id "XLOC_008961"; transcript_id "TCONS_00008961"; exon_number "1"; oId "CUFF.9009.1"; tss_id "TSS8961"; +chr8 Cufflinks exon 29571962 29572043 . + . gene_id "XLOC_008962"; transcript_id "TCONS_00008962"; exon_number "1"; oId "CUFF.9010.1"; tss_id "TSS8962"; +chr8 Cufflinks exon 29636751 29636785 . + . gene_id "XLOC_008963"; transcript_id "TCONS_00008963"; exon_number "1"; oId "CUFF.9011.1"; tss_id "TSS8963"; +chr8 Cufflinks exon 30501206 30501321 . + . gene_id "XLOC_008964"; transcript_id "TCONS_00008964"; exon_number "1"; oId "CUFF.9014.1"; tss_id "TSS8964"; +chr8 Cufflinks exon 32011093 32011135 . + . gene_id "XLOC_008965"; transcript_id "TCONS_00008965"; exon_number "1"; oId "CUFF.9018.1"; tss_id "TSS8965"; +chr8 Cufflinks exon 32114012 32114124 . + . gene_id "XLOC_008966"; transcript_id "TCONS_00008966"; exon_number "1"; oId "CUFF.9020.1"; tss_id "TSS8966"; +chr8 Cufflinks exon 32870878 32871051 . + . gene_id "XLOC_008967"; transcript_id "TCONS_00008967"; exon_number "1"; oId "CUFF.9022.1"; tss_id "TSS8967"; +chr8 Cufflinks exon 32871530 32871596 . + . gene_id "XLOC_008968"; transcript_id "TCONS_00008968"; exon_number "1"; oId "CUFF.9023.1"; tss_id "TSS8968"; +chr8 Cufflinks exon 32873684 32873719 . + . gene_id "XLOC_008969"; transcript_id "TCONS_00008969"; exon_number "1"; oId "CUFF.9025.1"; tss_id "TSS8969"; +chr8 Cufflinks exon 33196384 33196468 . + . gene_id "XLOC_008970"; transcript_id "TCONS_00008970"; exon_number "1"; oId "CUFF.9026.1"; tss_id "TSS8970"; +chr8 Cufflinks exon 33370992 33371099 . + . gene_id "XLOC_008971"; transcript_id "TCONS_00008971"; exon_number "1"; oId "CUFF.9027.1"; tss_id "TSS8971"; +chr8 Cufflinks exon 33375854 33375892 . + . gene_id "XLOC_008972"; transcript_id "TCONS_00008972"; exon_number "1"; oId "CUFF.9028.1"; tss_id "TSS8972"; +chr8 Cufflinks exon 33573302 33573580 . + . gene_id "XLOC_008973"; transcript_id "TCONS_00008973"; exon_number "1"; oId "CUFF.9030.1"; tss_id "TSS8973"; +chr8 Cufflinks exon 36621963 36622036 . + . gene_id "XLOC_008974"; transcript_id "TCONS_00008974"; exon_number "1"; oId "CUFF.9033.1"; tss_id "TSS8974"; +chr8 Cufflinks exon 37526416 37526503 . + . gene_id "XLOC_008975"; transcript_id "TCONS_00008975"; exon_number "1"; oId "CUFF.9035.1"; tss_id "TSS8975"; +chr8 Cufflinks exon 37766260 37766567 . + . gene_id "XLOC_008976"; transcript_id "TCONS_00008976"; exon_number "1"; oId "CUFF.9036.1"; tss_id "TSS8976"; +chr8 Cufflinks exon 37979892 37979998 . + . gene_id "XLOC_008977"; transcript_id "TCONS_00008977"; exon_number "1"; oId "CUFF.9037.1"; tss_id "TSS8977"; +chr8 Cufflinks exon 38586959 38587024 . + . gene_id "XLOC_008978"; transcript_id "TCONS_00008978"; exon_number "1"; oId "CUFF.9039.1"; tss_id "TSS8978"; +chr8 Cufflinks exon 39113655 39113694 . + . gene_id "XLOC_008979"; transcript_id "TCONS_00008979"; exon_number "1"; oId "CUFF.9040.1"; tss_id "TSS8979"; +chr8 Cufflinks exon 39761159 39761230 . + . gene_id "XLOC_008980"; transcript_id "TCONS_00008980"; exon_number "1"; oId "CUFF.9041.1"; tss_id "TSS8980"; +chr8 Cufflinks exon 39822660 39822698 . + . gene_id "XLOC_008981"; transcript_id "TCONS_00008981"; exon_number "1"; oId "CUFF.9042.1"; tss_id "TSS8981"; +chr8 Cufflinks exon 40890411 40890517 . + . gene_id "XLOC_008982"; transcript_id "TCONS_00008982"; exon_number "1"; oId "CUFF.9045.1"; tss_id "TSS8982"; +chr8 Cufflinks exon 41155680 41155784 . + . gene_id "XLOC_008983"; transcript_id "TCONS_00008983"; exon_number "1"; oId "CUFF.9046.1"; tss_id "TSS8983"; +chr8 Cufflinks exon 42562600 42562694 . + . gene_id "XLOC_008984"; transcript_id "TCONS_00008984"; exon_number "1"; oId "CUFF.9050.1"; tss_id "TSS8984"; +chr8 Cufflinks exon 42736379 42736605 . + . gene_id "XLOC_008985"; transcript_id "TCONS_00008985"; exon_number "1"; oId "CUFF.9051.1"; tss_id "TSS8985"; +chr8 Cufflinks exon 42928618 42928763 . + . gene_id "XLOC_008986"; transcript_id "TCONS_00008986"; exon_number "1"; oId "CUFF.9052.1"; tss_id "TSS8986"; +chr8 Cufflinks exon 43158519 43158624 . + . gene_id "XLOC_008987"; transcript_id "TCONS_00008987"; exon_number "1"; oId "CUFF.9055.1"; tss_id "TSS8987"; +chr8 Cufflinks exon 43233445 43233653 . + . gene_id "XLOC_008988"; transcript_id "TCONS_00008988"; exon_number "1"; oId "CUFF.9056.1"; tss_id "TSS8988"; +chr8 Cufflinks exon 43236788 43237026 . + . gene_id "XLOC_008989"; transcript_id "TCONS_00008989"; exon_number "1"; oId "CUFF.9057.1"; tss_id "TSS8989"; +chr8 Cufflinks exon 47739587 47739658 . + . gene_id "XLOC_008990"; transcript_id "TCONS_00008990"; exon_number "1"; oId "CUFF.9060.1"; tss_id "TSS8990"; +chr8 Cufflinks exon 47742673 47742777 . + . gene_id "XLOC_008991"; transcript_id "TCONS_00008991"; exon_number "1"; oId "CUFF.9062.1"; tss_id "TSS8991"; +chr8 Cufflinks exon 47975491 47975556 . + . gene_id "XLOC_008992"; transcript_id "TCONS_00008992"; exon_number "1"; oId "CUFF.9063.1"; tss_id "TSS8992"; +chr8 Cufflinks exon 48580333 48580439 . + . gene_id "XLOC_008993"; transcript_id "TCONS_00008993"; exon_number "1"; oId "CUFF.9067.1"; tss_id "TSS8993"; +chr8 Cufflinks exon 48891974 48892080 . + . gene_id "XLOC_008994"; transcript_id "TCONS_00008994"; exon_number "1"; oId "CUFF.9068.1"; tss_id "TSS8994"; +chr8 Cufflinks exon 50242769 50243008 . + . gene_id "XLOC_008995"; transcript_id "TCONS_00008995"; exon_number "1"; oId "CUFF.9072.1"; tss_id "TSS8995"; +chr8 Cufflinks exon 51646818 51646860 . + . gene_id "XLOC_008996"; transcript_id "TCONS_00008996"; exon_number "1"; oId "CUFF.9073.1"; tss_id "TSS8996"; +chr8 Cufflinks exon 52458866 52458953 . + . gene_id "XLOC_008997"; transcript_id "TCONS_00008997"; exon_number "1"; oId "CUFF.9074.1"; tss_id "TSS8997"; +chr8 Cufflinks exon 53355255 53355327 . + . gene_id "XLOC_008998"; transcript_id "TCONS_00008998"; exon_number "1"; oId "CUFF.9076.1"; tss_id "TSS8998"; +chr8 Cufflinks exon 53504010 53504058 . + . gene_id "XLOC_008999"; transcript_id "TCONS_00008999"; exon_number "1"; oId "CUFF.9077.1"; tss_id "TSS8999"; +chr8 Cufflinks exon 53656953 53656986 . + . gene_id "XLOC_009000"; transcript_id "TCONS_00009000"; exon_number "1"; oId "CUFF.9078.1"; tss_id "TSS9000"; +chr8 Cufflinks exon 54827279 54827379 . + . gene_id "XLOC_009001"; transcript_id "TCONS_00009001"; exon_number "1"; oId "CUFF.9079.1"; tss_id "TSS9001"; +chr8 Cufflinks exon 54928366 54928415 . + . gene_id "XLOC_009002"; transcript_id "TCONS_00009002"; exon_number "1"; oId "CUFF.9080.1"; tss_id "TSS9002"; +chr8 Cufflinks exon 55243246 55243452 . + . gene_id "XLOC_009003"; transcript_id "TCONS_00009003"; exon_number "1"; oId "CUFF.9082.1"; tss_id "TSS9003"; +chr8 Cufflinks exon 55333028 55333253 . + . gene_id "XLOC_009004"; transcript_id "TCONS_00009004"; exon_number "1"; oId "CUFF.9083.1"; tss_id "TSS9004"; +chr8 Cufflinks exon 55333480 55333567 . + . gene_id "XLOC_009005"; transcript_id "TCONS_00009005"; exon_number "1"; oId "CUFF.9084.1"; tss_id "TSS9005"; +chr8 Cufflinks exon 55887282 55887323 . + . gene_id "XLOC_009006"; transcript_id "TCONS_00009006"; exon_number "1"; oId "CUFF.9087.1"; tss_id "TSS9006"; +chr8 Cufflinks exon 56657789 56657876 . + . gene_id "XLOC_009007"; transcript_id "TCONS_00009007"; exon_number "1"; oId "CUFF.9088.1"; tss_id "TSS9007"; +chr8 Cufflinks exon 57829643 57829749 . + . gene_id "XLOC_009008"; transcript_id "TCONS_00009008"; exon_number "1"; oId "CUFF.9097.1"; tss_id "TSS9008"; +chr8 Cufflinks exon 58202113 58202208 . + . gene_id "XLOC_009009"; transcript_id "TCONS_00009009"; exon_number "1"; oId "CUFF.9099.1"; tss_id "TSS9009"; +chr8 Cufflinks exon 59504798 59504871 . + . gene_id "XLOC_009010"; transcript_id "TCONS_00009010"; exon_number "1"; oId "CUFF.9101.1"; tss_id "TSS9010"; +chr8 Cufflinks exon 59553831 59553864 . + . gene_id "XLOC_009011"; transcript_id "TCONS_00009011"; exon_number "1"; oId "CUFF.9102.1"; tss_id "TSS9011"; +chr8 Cufflinks exon 60196743 60196777 . + . gene_id "XLOC_009012"; transcript_id "TCONS_00009012"; exon_number "1"; oId "CUFF.9105.1"; tss_id "TSS9012"; +chr8 Cufflinks exon 60368444 60368533 . + . gene_id "XLOC_009013"; transcript_id "TCONS_00009013"; exon_number "1"; oId "CUFF.9106.1"; tss_id "TSS9013"; +chr8 Cufflinks exon 61156162 61156203 . + . gene_id "XLOC_009014"; transcript_id "TCONS_00009014"; exon_number "1"; oId "CUFF.9107.1"; tss_id "TSS9014"; +chr8 Cufflinks exon 61954219 61954251 . + . gene_id "XLOC_009015"; transcript_id "TCONS_00009015"; exon_number "1"; oId "CUFF.9109.1"; tss_id "TSS9015"; +chr8 Cufflinks exon 63367484 63367699 . + . gene_id "XLOC_009016"; transcript_id "TCONS_00009016"; exon_number "1"; oId "CUFF.9113.1"; tss_id "TSS9016"; +chr8 Cufflinks exon 64018654 64018714 . + . gene_id "XLOC_009017"; transcript_id "TCONS_00009017"; exon_number "1"; oId "CUFF.9114.1"; tss_id "TSS9017"; +chr8 Cufflinks exon 64052937 64052969 . + . gene_id "XLOC_009018"; transcript_id "TCONS_00009018"; exon_number "1"; oId "CUFF.9115.1"; tss_id "TSS9018"; +chr8 Cufflinks exon 65942814 65943000 . + . gene_id "XLOC_009019"; transcript_id "TCONS_00009019"; exon_number "1"; oId "CUFF.9118.1"; tss_id "TSS9019"; +chr8 Cufflinks exon 66387834 66387870 . + . gene_id "XLOC_009020"; transcript_id "TCONS_00009020"; exon_number "1"; oId "CUFF.9119.1"; tss_id "TSS9020"; +chr8 Cufflinks exon 67025602 67025694 . + . gene_id "XLOC_009021"; transcript_id "TCONS_00009021"; exon_number "1"; oId "CUFF.9124.1"; tss_id "TSS9021"; +chr8 Cufflinks exon 67026223 67026311 . + . gene_id "XLOC_009022"; transcript_id "TCONS_00009022"; exon_number "1"; oId "CUFF.9125.1"; tss_id "TSS9022"; +chr8 Cufflinks exon 67026424 67026496 . + . gene_id "XLOC_009023"; transcript_id "TCONS_00009023"; exon_number "1"; oId "CUFF.9126.1"; tss_id "TSS9023"; +chr8 Cufflinks exon 67924007 67924063 . + . gene_id "XLOC_009024"; transcript_id "TCONS_00009024"; exon_number "1"; oId "CUFF.9132.1"; tss_id "TSS9024"; +chr8 Cufflinks exon 68011538 68011627 . + . gene_id "XLOC_009025"; transcript_id "TCONS_00009025"; exon_number "1"; oId "CUFF.9133.1"; tss_id "TSS9025"; +chr8 Cufflinks exon 69218795 69218922 . + . gene_id "XLOC_009026"; transcript_id "TCONS_00009026"; exon_number "1"; oId "CUFF.9138.1"; tss_id "TSS9026"; +chr8 Cufflinks exon 69489355 69489422 . + . gene_id "XLOC_009027"; transcript_id "TCONS_00009027"; exon_number "1"; oId "CUFF.9139.1"; tss_id "TSS9027"; +chr8 Cufflinks exon 69607892 69607967 . + . gene_id "XLOC_009028"; transcript_id "TCONS_00009028"; exon_number "1"; oId "CUFF.9140.1"; tss_id "TSS9028"; +chr8 Cufflinks exon 70072339 70072401 . + . gene_id "XLOC_009029"; transcript_id "TCONS_00009029"; exon_number "1"; oId "CUFF.9142.1"; tss_id "TSS9029"; +chr8 Cufflinks exon 70134902 70134945 . + . gene_id "XLOC_009030"; transcript_id "TCONS_00009030"; exon_number "1"; oId "CUFF.9143.1"; tss_id "TSS9030"; +chr8 Cufflinks exon 70202936 70202972 . + . gene_id "XLOC_009031"; transcript_id "TCONS_00009031"; exon_number "1"; oId "CUFF.9144.1"; tss_id "TSS9031"; +chr8 Cufflinks exon 70612459 70612681 . + . gene_id "XLOC_009032"; transcript_id "TCONS_00009032"; exon_number "1"; oId "CUFF.9146.1"; tss_id "TSS9032"; +chr8 Cufflinks exon 70795781 70795816 . + . gene_id "XLOC_009033"; transcript_id "TCONS_00009033"; exon_number "1"; oId "CUFF.9148.1"; tss_id "TSS9033"; +chr8 Cufflinks exon 70842140 70842259 . + . gene_id "XLOC_009034"; transcript_id "TCONS_00009034"; exon_number "1"; oId "CUFF.9150.1"; tss_id "TSS9034"; +chr8 Cufflinks exon 70956237 70956272 . + . gene_id "XLOC_009035"; transcript_id "TCONS_00009035"; exon_number "1"; oId "CUFF.9151.1"; tss_id "TSS9035"; +chr8 Cufflinks exon 71492355 71492390 . + . gene_id "XLOC_009036"; transcript_id "TCONS_00009036"; exon_number "1"; oId "CUFF.9154.1"; tss_id "TSS9036"; +chr8 Cufflinks exon 71516766 71516867 . + . gene_id "XLOC_009037"; transcript_id "TCONS_00009037"; exon_number "1"; oId "CUFF.9155.1"; tss_id "TSS9037"; +chr8 Cufflinks exon 71828710 71828755 . + . gene_id "XLOC_009038"; transcript_id "TCONS_00009038"; exon_number "1"; oId "CUFF.9157.1"; tss_id "TSS9038"; +chr8 Cufflinks exon 73269968 73270040 . + . gene_id "XLOC_009039"; transcript_id "TCONS_00009039"; exon_number "1"; oId "CUFF.9160.1"; tss_id "TSS9039"; +chr8 Cufflinks exon 73918670 73918702 . + . gene_id "XLOC_009040"; transcript_id "TCONS_00009040"; exon_number "1"; oId "CUFF.9162.1"; tss_id "TSS9040"; +chr8 Cufflinks exon 74415892 74415926 . + . gene_id "XLOC_009041"; transcript_id "TCONS_00009041"; exon_number "1"; oId "CUFF.9164.1"; tss_id "TSS9041"; +chr8 Cufflinks exon 74960912 74961015 . + . gene_id "XLOC_009042"; transcript_id "TCONS_00009042"; exon_number "1"; oId "CUFF.9167.1"; tss_id "TSS9042"; +chr8 Cufflinks exon 74991772 74991868 . + . gene_id "XLOC_009043"; transcript_id "TCONS_00009043"; exon_number "1"; oId "CUFF.9168.1"; tss_id "TSS9043"; +chr8 Cufflinks exon 77819699 77819752 . + . gene_id "XLOC_009044"; transcript_id "TCONS_00009044"; exon_number "1"; oId "CUFF.9175.1"; tss_id "TSS9044"; +chr8 Cufflinks exon 80885621 80885693 . + . gene_id "XLOC_009045"; transcript_id "TCONS_00009045"; exon_number "1"; oId "CUFF.9178.1"; tss_id "TSS9045"; +chr8 Cufflinks exon 80998100 80998137 . + . gene_id "XLOC_009046"; transcript_id "TCONS_00009046"; exon_number "1"; oId "CUFF.9179.1"; tss_id "TSS9046"; +chr8 Cufflinks exon 81116841 81117155 . + . gene_id "XLOC_009047"; transcript_id "TCONS_00009047"; exon_number "1"; oId "CUFF.9180.1"; tss_id "TSS9047"; +chr8 Cufflinks exon 81317751 81317836 . + . gene_id "XLOC_009048"; transcript_id "TCONS_00009048"; exon_number "1"; oId "CUFF.9182.1"; tss_id "TSS9048"; +chr8 Cufflinks exon 81472802 81472858 . + . gene_id "XLOC_009049"; transcript_id "TCONS_00009049"; exon_number "1"; oId "CUFF.9183.1"; tss_id "TSS9049"; +chr8 Cufflinks exon 82414536 82414602 . + . gene_id "XLOC_009050"; transcript_id "TCONS_00009050"; exon_number "1"; oId "CUFF.9188.1"; tss_id "TSS9050"; +chr8 Cufflinks exon 84673783 84673824 . + . gene_id "XLOC_009051"; transcript_id "TCONS_00009051"; exon_number "1"; oId "CUFF.9190.1"; tss_id "TSS9051"; +chr8 Cufflinks exon 84729766 84729834 . + . gene_id "XLOC_009052"; transcript_id "TCONS_00009052"; exon_number "1"; oId "CUFF.9191.1"; tss_id "TSS9052"; +chr8 Cufflinks exon 85880335 85880376 . + . gene_id "XLOC_009053"; transcript_id "TCONS_00009053"; exon_number "1"; oId "CUFF.9195.1"; tss_id "TSS9053"; +chr8 Cufflinks exon 88312849 88312908 . + . gene_id "XLOC_009054"; transcript_id "TCONS_00009054"; exon_number "1"; oId "CUFF.9199.1"; tss_id "TSS9054"; +chr8 Cufflinks exon 90280027 90280076 . + . gene_id "XLOC_009055"; transcript_id "TCONS_00009055"; exon_number "1"; oId "CUFF.9204.1"; tss_id "TSS9055"; +chr8 Cufflinks exon 90593963 90593996 . + . gene_id "XLOC_009056"; transcript_id "TCONS_00009056"; exon_number "1"; oId "CUFF.9205.1"; tss_id "TSS9056"; +chr8 Cufflinks exon 90960177 90960211 . + . gene_id "XLOC_009057"; transcript_id "TCONS_00009057"; exon_number "1"; oId "CUFF.9207.1"; tss_id "TSS9057"; +chr8 Cufflinks exon 91523364 91523469 . + . gene_id "XLOC_009058"; transcript_id "TCONS_00009058"; exon_number "1"; oId "CUFF.9209.1"; tss_id "TSS9058"; +chr8 Cufflinks exon 92230230 92230302 . + . gene_id "XLOC_009059"; transcript_id "TCONS_00009059"; exon_number "1"; oId "CUFF.9212.1"; tss_id "TSS9059"; +chr8 Cufflinks exon 92607193 92607430 . + . gene_id "XLOC_009060"; transcript_id "TCONS_00009060"; exon_number "1"; oId "CUFF.9214.1"; tss_id "TSS9060"; +chr8 Cufflinks exon 93105780 93105814 . + . gene_id "XLOC_009061"; transcript_id "TCONS_00009061"; exon_number "1"; oId "CUFF.9215.1"; tss_id "TSS9061"; +chr8 Cufflinks exon 94453505 94453594 . + . gene_id "XLOC_009062"; transcript_id "TCONS_00009062"; exon_number "1"; oId "CUFF.9217.1"; tss_id "TSS9062"; +chr8 Cufflinks exon 94709614 94709688 . + . gene_id "XLOC_009063"; transcript_id "TCONS_00009063"; exon_number "1"; oId "CUFF.9218.1"; tss_id "TSS9063"; +chr8 Cufflinks exon 94812494 94812537 . + . gene_id "XLOC_009064"; transcript_id "TCONS_00009064"; exon_number "1"; oId "CUFF.9219.1"; tss_id "TSS9064"; +chr8 Cufflinks exon 95380439 95380486 . + . gene_id "XLOC_009065"; transcript_id "TCONS_00009065"; exon_number "1"; oId "CUFF.9220.1"; tss_id "TSS9065"; +chr8 Cufflinks exon 95668139 95668455 . + . gene_id "XLOC_009066"; transcript_id "TCONS_00009066"; exon_number "1"; oId "CUFF.9221.1"; tss_id "TSS9066"; +chr8 Cufflinks exon 96067443 96067542 . + . gene_id "XLOC_009067"; transcript_id "TCONS_00009067"; exon_number "1"; oId "CUFF.9223.1"; tss_id "TSS9067"; +chr8 Cufflinks exon 96611342 96611447 . + . gene_id "XLOC_009068"; transcript_id "TCONS_00009068"; exon_number "1"; oId "CUFF.9225.1"; tss_id "TSS9068"; +chr8 Cufflinks exon 97178597 97178687 . + . gene_id "XLOC_009069"; transcript_id "TCONS_00009069"; exon_number "1"; oId "CUFF.9226.1"; tss_id "TSS9069"; +chr8 Cufflinks exon 97701998 97702033 . + . gene_id "XLOC_009070"; transcript_id "TCONS_00009070"; exon_number "1"; oId "CUFF.9228.1"; tss_id "TSS9070"; +chr8 Cufflinks exon 98370493 98370703 . + . gene_id "XLOC_009071"; transcript_id "TCONS_00009071"; exon_number "1"; oId "CUFF.9230.1"; tss_id "TSS9071"; +chr8 Cufflinks exon 98577734 98577938 . + . gene_id "XLOC_009072"; transcript_id "TCONS_00009072"; exon_number "1"; oId "CUFF.9231.1"; tss_id "TSS9072"; +chr8 Cufflinks exon 98722602 98722635 . + . gene_id "XLOC_009073"; transcript_id "TCONS_00009073"; exon_number "1"; oId "CUFF.9232.1"; tss_id "TSS9073"; +chr8 Cufflinks exon 98723239 98723282 . + . gene_id "XLOC_009074"; transcript_id "TCONS_00009074"; exon_number "1"; oId "CUFF.9233.1"; tss_id "TSS9074"; +chr8 Cufflinks exon 98958508 98958555 . + . gene_id "XLOC_009075"; transcript_id "TCONS_00009075"; exon_number "1"; oId "CUFF.9234.1"; tss_id "TSS9075"; +chr8 Cufflinks exon 99061084 99061175 . + . gene_id "XLOC_009076"; transcript_id "TCONS_00009076"; exon_number "1"; oId "CUFF.9235.1"; tss_id "TSS9076"; +chr8 Cufflinks exon 99217967 99217999 . + . gene_id "XLOC_009077"; transcript_id "TCONS_00009077"; exon_number "1"; oId "CUFF.9237.1"; tss_id "TSS9077"; +chr8 Cufflinks exon 99366122 99366167 . + . gene_id "XLOC_009078"; transcript_id "TCONS_00009078"; exon_number "1"; oId "CUFF.9238.1"; tss_id "TSS9078"; +chr8 Cufflinks exon 99823690 99823756 . + . gene_id "XLOC_009079"; transcript_id "TCONS_00009079"; exon_number "1"; oId "CUFF.9240.1"; tss_id "TSS9079"; +chr8 Cufflinks exon 99992637 99992710 . + . gene_id "XLOC_009080"; transcript_id "TCONS_00009080"; exon_number "1"; oId "CUFF.9243.1"; tss_id "TSS9080"; +chr8 Cufflinks exon 100305199 100305268 . + . gene_id "XLOC_009081"; transcript_id "TCONS_00009081"; exon_number "1"; oId "CUFF.9244.1"; tss_id "TSS9081"; +chr8 Cufflinks exon 100635963 100635998 . + . gene_id "XLOC_009082"; transcript_id "TCONS_00009082"; exon_number "1"; oId "CUFF.9246.1"; tss_id "TSS9082"; +chr8 Cufflinks exon 100986336 100986394 . + . gene_id "XLOC_009083"; transcript_id "TCONS_00009083"; exon_number "1"; oId "CUFF.9247.1"; tss_id "TSS9083"; +chr8 Cufflinks exon 101695716 101695805 . + . gene_id "XLOC_009084"; transcript_id "TCONS_00009084"; exon_number "1"; oId "CUFF.9248.1"; tss_id "TSS9084"; +chr8 Cufflinks exon 101970158 101970408 . + . gene_id "XLOC_009085"; transcript_id "TCONS_00009085"; exon_number "1"; oId "CUFF.9250.1"; tss_id "TSS9085"; +chr8 Cufflinks exon 102150187 102150420 . + . gene_id "XLOC_009086"; transcript_id "TCONS_00009086"; exon_number "1"; oId "CUFF.9251.1"; tss_id "TSS9086"; +chr8 Cufflinks exon 102319596 102319655 . + . gene_id "XLOC_009087"; transcript_id "TCONS_00009087"; exon_number "1"; oId "CUFF.9252.1"; tss_id "TSS9087"; +chr8 Cufflinks exon 104097809 104097880 . + . gene_id "XLOC_009088"; transcript_id "TCONS_00009088"; exon_number "1"; oId "CUFF.9260.1"; tss_id "TSS9088"; +chr8 Cufflinks exon 104175962 104176041 . + . gene_id "XLOC_009089"; transcript_id "TCONS_00009089"; exon_number "1"; oId "CUFF.9261.1"; tss_id "TSS9089"; +chr8 Cufflinks exon 104397189 104397295 . + . gene_id "XLOC_009090"; transcript_id "TCONS_00009090"; exon_number "1"; oId "CUFF.9262.1"; tss_id "TSS9090"; +chr8 Cufflinks exon 104677522 104677623 . + . gene_id "XLOC_009091"; transcript_id "TCONS_00009091"; exon_number "1"; oId "CUFF.9263.1"; tss_id "TSS9091"; +chr8 Cufflinks exon 104852018 104852086 . + . gene_id "XLOC_009092"; transcript_id "TCONS_00009092"; exon_number "1"; oId "CUFF.9264.1"; tss_id "TSS9092"; +chr8 Cufflinks exon 104986976 104987044 . + . gene_id "XLOC_009093"; transcript_id "TCONS_00009093"; exon_number "1"; oId "CUFF.9265.1"; tss_id "TSS9093"; +chr8 Cufflinks exon 105794069 105794124 . + . gene_id "XLOC_009094"; transcript_id "TCONS_00009094"; exon_number "1"; oId "CUFF.9267.1"; tss_id "TSS9094"; +chr8 Cufflinks exon 108896722 108896840 . + . gene_id "XLOC_009095"; transcript_id "TCONS_00009095"; exon_number "1"; oId "CUFF.9271.1"; tss_id "TSS9095"; +chr8 Cufflinks exon 112620319 112620369 . + . gene_id "XLOC_009096"; transcript_id "TCONS_00009096"; exon_number "1"; oId "CUFF.9277.1"; tss_id "TSS9096"; +chr8 Cufflinks exon 113494320 113494415 . + . gene_id "XLOC_009097"; transcript_id "TCONS_00009097"; exon_number "1"; oId "CUFF.9280.1"; tss_id "TSS9097"; +chr8 Cufflinks exon 114898509 114898542 . + . gene_id "XLOC_009098"; transcript_id "TCONS_00009098"; exon_number "1"; oId "CUFF.9285.1"; tss_id "TSS9098"; +chr8 Cufflinks exon 117578225 117578270 . + . gene_id "XLOC_009099"; transcript_id "TCONS_00009099"; exon_number "1"; oId "CUFF.9289.1"; tss_id "TSS9099"; +chr8 Cufflinks exon 118030185 118030488 . + . gene_id "XLOC_009100"; transcript_id "TCONS_00009100"; exon_number "1"; oId "CUFF.9291.1"; tss_id "TSS9100"; +chr8 Cufflinks exon 118176270 118176502 . + . gene_id "XLOC_009101"; transcript_id "TCONS_00009101"; exon_number "1"; oId "CUFF.9292.1"; tss_id "TSS9101"; +chr8 Cufflinks exon 118641735 118641768 . + . gene_id "XLOC_009102"; transcript_id "TCONS_00009102"; exon_number "1"; oId "CUFF.9293.1"; tss_id "TSS9102"; +chr8 Cufflinks exon 119988752 119988858 . + . gene_id "XLOC_009103"; transcript_id "TCONS_00009103"; exon_number "1"; oId "CUFF.9295.1"; tss_id "TSS9103"; +chr8 Cufflinks exon 120327014 120327048 . + . gene_id "XLOC_009104"; transcript_id "TCONS_00009104"; exon_number "1"; oId "CUFF.9296.1"; tss_id "TSS9104"; +chr8 Cufflinks exon 120874903 120875100 . + . gene_id "XLOC_009105"; transcript_id "TCONS_00009105"; exon_number "1"; oId "CUFF.9298.1"; tss_id "TSS9105"; +chr8 Cufflinks exon 121563534 121563576 . + . gene_id "XLOC_009106"; transcript_id "TCONS_00009106"; exon_number "1"; oId "CUFF.9301.1"; tss_id "TSS9106"; +chr8 Cufflinks exon 121731773 121731869 . + . gene_id "XLOC_009107"; transcript_id "TCONS_00009107"; exon_number "1"; oId "CUFF.9302.1"; tss_id "TSS9107"; +chr8 Cufflinks exon 122827872 122827909 . + . gene_id "XLOC_009108"; transcript_id "TCONS_00009108"; exon_number "1"; oId "CUFF.9304.1"; tss_id "TSS9108"; +chr8 Cufflinks exon 123127929 123127965 . + . gene_id "XLOC_009109"; transcript_id "TCONS_00009109"; exon_number "1"; oId "CUFF.9305.1"; tss_id "TSS9109"; +chr8 Cufflinks exon 123683529 123683636 . + . gene_id "XLOC_009110"; transcript_id "TCONS_00009110"; exon_number "1"; oId "CUFF.9306.1"; tss_id "TSS9110"; +chr8 Cufflinks exon 123958074 123958115 . + . gene_id "XLOC_009111"; transcript_id "TCONS_00009111"; exon_number "1"; oId "CUFF.9307.1"; tss_id "TSS9111"; +chr8 Cufflinks exon 124232700 124232750 . + . gene_id "XLOC_009112"; transcript_id "TCONS_00009112"; exon_number "1"; oId "CUFF.9310.1"; tss_id "TSS9112"; +chr8 Cufflinks exon 124275083 124275171 . + . gene_id "XLOC_009113"; transcript_id "TCONS_00009113"; exon_number "1"; oId "CUFF.9312.1"; tss_id "TSS9113"; +chr8 Cufflinks exon 124354654 124354722 . + . gene_id "XLOC_009114"; transcript_id "TCONS_00009114"; exon_number "1"; oId "CUFF.9314.1"; tss_id "TSS9114"; +chr8 Cufflinks exon 124494479 124494514 . + . gene_id "XLOC_009115"; transcript_id "TCONS_00009115"; exon_number "1"; oId "CUFF.9316.1"; tss_id "TSS9115"; +chr8 Cufflinks exon 124594477 124594547 . + . gene_id "XLOC_009116"; transcript_id "TCONS_00009116"; exon_number "1"; oId "CUFF.9317.1"; tss_id "TSS9116"; +chr8 Cufflinks exon 124601011 124601215 . + . gene_id "XLOC_009117"; transcript_id "TCONS_00009117"; exon_number "1"; oId "CUFF.9318.1"; tss_id "TSS9117"; +chr8 Cufflinks exon 125272887 125272993 . + . gene_id "XLOC_009118"; transcript_id "TCONS_00009118"; exon_number "1"; oId "CUFF.9319.1"; tss_id "TSS9118"; +chr8 Cufflinks exon 125881225 125881276 . + . gene_id "XLOC_009119"; transcript_id "TCONS_00009119"; exon_number "1"; oId "CUFF.9324.1"; tss_id "TSS9119"; +chr8 Cufflinks exon 126282846 126283165 . + . gene_id "XLOC_009120"; transcript_id "TCONS_00009120"; exon_number "1"; oId "CUFF.9325.1"; tss_id "TSS9120"; +chr8 Cufflinks exon 126631420 126631457 . + . gene_id "XLOC_009121"; transcript_id "TCONS_00009121"; exon_number "1"; oId "CUFF.9326.1"; tss_id "TSS9121"; +chr8 Cufflinks exon 126913195 126913289 . + . gene_id "XLOC_009122"; transcript_id "TCONS_00009122"; exon_number "1"; oId "CUFF.9327.1"; tss_id "TSS9122"; +chr8 Cufflinks exon 127170667 127170740 . + . gene_id "XLOC_009123"; transcript_id "TCONS_00009123"; exon_number "1"; oId "CUFF.9328.1"; tss_id "TSS9123"; +chr8 Cufflinks exon 127517008 127517114 . + . gene_id "XLOC_009124"; transcript_id "TCONS_00009124"; exon_number "1"; oId "CUFF.9329.1"; tss_id "TSS9124"; +chr8 Cufflinks exon 128418410 128418444 . + . gene_id "XLOC_009125"; transcript_id "TCONS_00009125"; exon_number "1"; oId "CUFF.9331.1"; tss_id "TSS9125"; +chr8 Cufflinks exon 129011377 129011540 . + . gene_id "XLOC_009126"; transcript_id "TCONS_00009126"; exon_number "1"; oId "CUFF.9332.1"; tss_id "TSS9126"; +chr8 Cufflinks exon 129232750 129232996 . + . gene_id "XLOC_009127"; transcript_id "TCONS_00009127"; exon_number "1"; oId "CUFF.9334.1"; tss_id "TSS9127"; +chr8 Cufflinks exon 130303229 130303472 . + . gene_id "XLOC_009128"; transcript_id "TCONS_00009128"; exon_number "1"; oId "CUFF.9336.1"; tss_id "TSS9128"; +chr8 Cufflinks exon 131747078 131747148 . + . gene_id "XLOC_009129"; transcript_id "TCONS_00009129"; exon_number "1"; oId "CUFF.9340.1"; tss_id "TSS9129"; +chr8 Cufflinks exon 132084281 132084322 . + . gene_id "XLOC_009130"; transcript_id "TCONS_00009130"; exon_number "1"; oId "CUFF.9341.1"; tss_id "TSS9130"; +chr8 Cufflinks exon 133766520 133766561 . + . gene_id "XLOC_009131"; transcript_id "TCONS_00009131"; exon_number "1"; oId "CUFF.9343.1"; tss_id "TSS9131"; +chr8 Cufflinks exon 135230339 135230391 . + . gene_id "XLOC_009132"; transcript_id "TCONS_00009132"; exon_number "1"; oId "CUFF.9344.1"; tss_id "TSS9132"; +chr8 Cufflinks exon 138117595 138117701 . + . gene_id "XLOC_009133"; transcript_id "TCONS_00009133"; exon_number "1"; oId "CUFF.9349.1"; tss_id "TSS9133"; +chr8 Cufflinks exon 138472199 138472274 . + . gene_id "XLOC_009134"; transcript_id "TCONS_00009134"; exon_number "1"; oId "CUFF.9351.1"; tss_id "TSS9134"; +chr8 Cufflinks exon 141950661 141950763 . + . gene_id "XLOC_009135"; transcript_id "TCONS_00009135"; exon_number "1"; oId "CUFF.9357.1"; tss_id "TSS9135"; +chr8 Cufflinks exon 144432342 144432443 . + . gene_id "XLOC_009136"; transcript_id "TCONS_00009136"; exon_number "1"; oId "CUFF.9359.1"; tss_id "TSS9136"; +chr8 Cufflinks exon 144539510 144539558 . + . gene_id "XLOC_009137"; transcript_id "TCONS_00009137"; exon_number "1"; oId "CUFF.9360.1"; tss_id "TSS9137"; +chr8 Cufflinks exon 144624280 144624568 . + . gene_id "XLOC_009138"; transcript_id "TCONS_00009138"; exon_number "1"; oId "CUFF.9361.1"; tss_id "TSS9138"; +chr8 Cufflinks exon 145525574 145525635 . + . gene_id "XLOC_009139"; transcript_id "TCONS_00009139"; exon_number "1"; oId "CUFF.9363.1"; tss_id "TSS9139"; +chr8 Cufflinks exon 146010693 146010973 . + . gene_id "XLOC_009140"; transcript_id "TCONS_00009140"; exon_number "1"; oId "CUFF.9364.1"; tss_id "TSS9140"; +chr8 Cufflinks exon 3505904 3505941 . - . gene_id "XLOC_009141"; transcript_id "TCONS_00009141"; exon_number "1"; oId "CUFF.8912.1"; tss_id "TSS9141"; +chr8 Cufflinks exon 4999914 5000229 . - . gene_id "XLOC_009142"; transcript_id "TCONS_00009142"; exon_number "1"; oId "CUFF.8916.1"; tss_id "TSS9142"; +chr8 Cufflinks exon 5432237 5432280 . - . gene_id "XLOC_009143"; transcript_id "TCONS_00009143"; exon_number "1"; oId "CUFF.8917.1"; tss_id "TSS9143"; +chr8 Cufflinks exon 5768528 5768758 . - . gene_id "XLOC_009144"; transcript_id "TCONS_00009144"; exon_number "1"; oId "CUFF.8918.1"; tss_id "TSS9144"; +chr8 Cufflinks exon 5941135 5941334 . - . gene_id "XLOC_009145"; transcript_id "TCONS_00009145"; exon_number "1"; oId "CUFF.8919.1"; tss_id "TSS9145"; +chr8 Cufflinks exon 6603640 6603707 . - . gene_id "XLOC_009146"; transcript_id "TCONS_00009146"; exon_number "1"; oId "CUFF.8920.1"; tss_id "TSS9146"; +chr8 Cufflinks exon 6769499 6769541 . - . gene_id "XLOC_009147"; transcript_id "TCONS_00009147"; exon_number "1"; oId "CUFF.8921.1"; tss_id "TSS9147"; +chr8 Cufflinks exon 6926120 6926194 . - . gene_id "XLOC_009148"; transcript_id "TCONS_00009148"; exon_number "1"; oId "CUFF.8922.1"; tss_id "TSS9148"; +chr8 Cufflinks exon 7776916 7777005 . - . gene_id "XLOC_009149"; transcript_id "TCONS_00009149"; exon_number "1"; oId "CUFF.8924.1"; tss_id "TSS9149"; +chr8 Cufflinks exon 8439846 8440165 . - . gene_id "XLOC_009150"; transcript_id "TCONS_00009150"; exon_number "1"; oId "CUFF.8925.1"; tss_id "TSS9150"; +chr8 Cufflinks exon 8754600 8754654 . - . gene_id "XLOC_009151"; transcript_id "TCONS_00009151"; exon_number "1"; oId "CUFF.8929.1"; tss_id "TSS9151"; +chr8 Cufflinks exon 8916075 8916140 . - . gene_id "XLOC_009152"; transcript_id "TCONS_00009152"; exon_number "1"; oId "CUFF.8930.1"; tss_id "TSS9152"; +chr8 Cufflinks exon 8929966 8930024 . - . gene_id "XLOC_009153"; transcript_id "TCONS_00009153"; exon_number "1"; oId "CUFF.8931.1"; tss_id "TSS9153"; +chr8 Cufflinks exon 9144985 9145088 . - . gene_id "XLOC_009154"; transcript_id "TCONS_00009154"; exon_number "1"; oId "CUFF.8933.1"; tss_id "TSS9154"; +chr8 Cufflinks exon 9228600 9228676 . - . gene_id "XLOC_009155"; transcript_id "TCONS_00009155"; exon_number "1"; oId "CUFF.8935.1"; tss_id "TSS9155"; +chr8 Cufflinks exon 9679807 9679875 . - . gene_id "XLOC_009156"; transcript_id "TCONS_00009156"; exon_number "1"; oId "CUFF.8936.1"; tss_id "TSS9156"; +chr8 Cufflinks exon 9718141 9718197 . - . gene_id "XLOC_009157"; transcript_id "TCONS_00009157"; exon_number "1"; oId "CUFF.8937.1"; tss_id "TSS9157"; +chr8 Cufflinks exon 9724414 9724521 . - . gene_id "XLOC_009158"; transcript_id "TCONS_00009158"; exon_number "1"; oId "CUFF.8938.1"; tss_id "TSS9158"; +chr8 Cufflinks exon 9734205 9734274 . - . gene_id "XLOC_009159"; transcript_id "TCONS_00009159"; exon_number "1"; oId "CUFF.8939.1"; tss_id "TSS9159"; +chr8 Cufflinks exon 9789227 9789334 . - . gene_id "XLOC_009160"; transcript_id "TCONS_00009160"; exon_number "1"; oId "CUFF.8940.1"; tss_id "TSS9160"; +chr8 Cufflinks exon 9939322 9939393 . - . gene_id "XLOC_009161"; transcript_id "TCONS_00009161"; exon_number "1"; oId "CUFF.8941.1"; tss_id "TSS9161"; +chr8 Cufflinks exon 11249928 11250026 . - . gene_id "XLOC_009162"; transcript_id "TCONS_00009162"; exon_number "1"; oId "CUFF.8948.1"; tss_id "TSS9162"; +chr8 Cufflinks exon 11944918 11944968 . - . gene_id "XLOC_009163"; transcript_id "TCONS_00009163"; exon_number "1"; oId "CUFF.8951.1"; tss_id "TSS9163"; +chr8 Cufflinks exon 12191166 12191216 . - . gene_id "XLOC_009164"; transcript_id "TCONS_00009164"; exon_number "1"; oId "CUFF.8952.1"; tss_id "TSS9164"; +chr8 Cufflinks exon 13446398 13446488 . - . gene_id "XLOC_009165"; transcript_id "TCONS_00009165"; exon_number "1"; oId "CUFF.8956.1"; tss_id "TSS9165"; +chr8 Cufflinks exon 14345303 14345388 . - . gene_id "XLOC_009166"; transcript_id "TCONS_00009166"; exon_number "1"; oId "CUFF.8960.1"; tss_id "TSS9166"; +chr8 Cufflinks exon 16165926 16166143 . - . gene_id "XLOC_009167"; transcript_id "TCONS_00009167"; exon_number "1"; oId "CUFF.8964.1"; tss_id "TSS9167"; +chr8 Cufflinks exon 16772466 16772588 . - . gene_id "XLOC_009168"; transcript_id "TCONS_00009168"; exon_number "1"; oId "CUFF.8965.1"; tss_id "TSS9168"; +chr8 Cufflinks exon 17574665 17574842 . - . gene_id "XLOC_009169"; transcript_id "TCONS_00009169"; exon_number "1"; oId "CUFF.8967.1"; tss_id "TSS9169"; +chr8 Cufflinks exon 19323816 19323853 . - . gene_id "XLOC_009170"; transcript_id "TCONS_00009170"; exon_number "1"; oId "CUFF.8973.1"; tss_id "TSS9170"; +chr8 Cufflinks exon 20408587 20408706 . - . gene_id "XLOC_009171"; transcript_id "TCONS_00009171"; exon_number "1"; oId "CUFF.8978.1"; tss_id "TSS9171"; +chr8 Cufflinks exon 20408880 20408972 . - . gene_id "XLOC_009172"; transcript_id "TCONS_00009172"; exon_number "1"; oId "CUFF.8979.1"; tss_id "TSS9172"; +chr8 Cufflinks exon 20472365 20472437 . - . gene_id "XLOC_009173"; transcript_id "TCONS_00009173"; exon_number "1"; oId "CUFF.8980.1"; tss_id "TSS9173"; +chr8 Cufflinks exon 22465651 22465710 . - . gene_id "XLOC_009174"; transcript_id "TCONS_00009174"; exon_number "1"; oId "CUFF.8985.1"; tss_id "TSS9174"; +chr8 Cufflinks exon 23457593 23457651 . - . gene_id "XLOC_009175"; transcript_id "TCONS_00009175"; exon_number "1"; oId "CUFF.8987.1"; tss_id "TSS9175"; +chr8 Cufflinks exon 23934509 23934671 . - . gene_id "XLOC_009176"; transcript_id "TCONS_00009176"; exon_number "1"; oId "CUFF.8988.1"; tss_id "TSS9176"; +chr8 Cufflinks exon 24541412 24541446 . - . gene_id "XLOC_009177"; transcript_id "TCONS_00009177"; exon_number "1"; oId "CUFF.8989.1"; tss_id "TSS9177"; +chr8 Cufflinks exon 25038660 25038751 . - . gene_id "XLOC_009178"; transcript_id "TCONS_00009178"; exon_number "1"; oId "CUFF.8992.1"; tss_id "TSS9178"; +chr8 Cufflinks exon 25039023 25039227 . - . gene_id "XLOC_009179"; transcript_id "TCONS_00009179"; exon_number "1"; oId "CUFF.8993.1"; tss_id "TSS9179"; +chr8 Cufflinks exon 26261719 26261754 . - . gene_id "XLOC_009180"; transcript_id "TCONS_00009180"; exon_number "1"; oId "CUFF.8995.1"; tss_id "TSS9180"; +chr8 Cufflinks exon 26529140 26529228 . - . gene_id "XLOC_009181"; transcript_id "TCONS_00009181"; exon_number "1"; oId "CUFF.8996.1"; tss_id "TSS9181"; +chr8 Cufflinks exon 27612561 27612640 . - . gene_id "XLOC_009182"; transcript_id "TCONS_00009182"; exon_number "1"; oId "CUFF.8998.1"; tss_id "TSS9182"; +chr8 Cufflinks exon 28312486 28312566 . - . gene_id "XLOC_009183"; transcript_id "TCONS_00009183"; exon_number "1"; oId "CUFF.9001.1"; tss_id "TSS9183"; +chr8 Cufflinks exon 28772770 28772792 . - . gene_id "XLOC_009184"; transcript_id "TCONS_00009184"; exon_number "1"; oId "CUFF.9004.1"; tss_id "TSS9184"; +chr8 Cufflinks exon 28773097 28773381 . - . gene_id "XLOC_009185"; transcript_id "TCONS_00009185"; exon_number "1"; oId "CUFF.9005.1"; tss_id "TSS9185"; +chr8 Cufflinks exon 28906032 28906120 . - . gene_id "XLOC_009186"; transcript_id "TCONS_00009186"; exon_number "1"; oId "CUFF.9006.1"; tss_id "TSS9186"; +chr8 Cufflinks exon 29236887 29236951 . - . gene_id "XLOC_009187"; transcript_id "TCONS_00009187"; exon_number "1"; oId "CUFF.9008.1"; tss_id "TSS9187"; +chr8 Cufflinks exon 29901331 29901424 . - . gene_id "XLOC_009188"; transcript_id "TCONS_00009188"; exon_number "1"; oId "CUFF.9012.1"; tss_id "TSS9188"; +chr8 Cufflinks exon 29985779 29985885 . - . gene_id "XLOC_009189"; transcript_id "TCONS_00009189"; exon_number "1"; oId "CUFF.9013.1"; tss_id "TSS9189"; +chr8 Cufflinks exon 30917021 30917050 . - . gene_id "XLOC_009190"; transcript_id "TCONS_00009190"; exon_number "1"; oId "CUFF.9015.1"; tss_id "TSS9190"; +chr8 Cufflinks exon 31024125 31024159 . - . gene_id "XLOC_009191"; transcript_id "TCONS_00009191"; exon_number "1"; oId "CUFF.9016.1"; tss_id "TSS9191"; +chr8 Cufflinks exon 31455631 31455720 . - . gene_id "XLOC_009192"; transcript_id "TCONS_00009192"; exon_number "1"; oId "CUFF.9017.1"; tss_id "TSS9192"; +chr8 Cufflinks exon 32049594 32049664 . - . gene_id "XLOC_009193"; transcript_id "TCONS_00009193"; exon_number "1"; oId "CUFF.9019.1"; tss_id "TSS9193"; +chr8 Cufflinks exon 32769011 32769094 . - . gene_id "XLOC_009194"; transcript_id "TCONS_00009194"; exon_number "1"; oId "CUFF.9021.1"; tss_id "TSS9194"; +chr8 Cufflinks exon 32872646 32872717 . - . gene_id "XLOC_009195"; transcript_id "TCONS_00009195"; exon_number "1"; oId "CUFF.9024.1"; tss_id "TSS9195"; +chr8 Cufflinks exon 33437727 33438026 . - . gene_id "XLOC_009196"; transcript_id "TCONS_00009196"; exon_number "1"; oId "CUFF.9029.1"; tss_id "TSS9196"; +chr8 Cufflinks exon 35514511 35514562 . - . gene_id "XLOC_009197"; transcript_id "TCONS_00009197"; exon_number "1"; oId "CUFF.9031.1"; tss_id "TSS9197"; +chr8 Cufflinks exon 36167107 36167208 . - . gene_id "XLOC_009198"; transcript_id "TCONS_00009198"; exon_number "1"; oId "CUFF.9032.1"; tss_id "TSS9198"; +chr8 Cufflinks exon 37466394 37466474 . - . gene_id "XLOC_009199"; transcript_id "TCONS_00009199"; exon_number "1"; oId "CUFF.9034.1"; tss_id "TSS9199"; +chr8 Cufflinks exon 38023530 38023636 . - . gene_id "XLOC_009200"; transcript_id "TCONS_00009200"; exon_number "1"; oId "CUFF.9038.1"; tss_id "TSS9200"; +chr8 Cufflinks exon 40058269 40058340 . - . gene_id "XLOC_009201"; transcript_id "TCONS_00009201"; exon_number "1"; oId "CUFF.9043.1"; tss_id "TSS9201"; +chr8 Cufflinks exon 40197167 40197204 . - . gene_id "XLOC_009202"; transcript_id "TCONS_00009202"; exon_number "1"; oId "CUFF.9044.1"; tss_id "TSS9202"; +chr8 Cufflinks exon 41697561 41697861 . - . gene_id "XLOC_009203"; transcript_id "TCONS_00009203"; exon_number "1"; oId "CUFF.9047.1"; tss_id "TSS9203"; +chr8 Cufflinks exon 42083148 42083253 . - . gene_id "XLOC_009204"; transcript_id "TCONS_00009204"; exon_number "1"; oId "CUFF.9048.1"; tss_id "TSS9204"; +chr8 Cufflinks exon 42164253 42164325 . - . gene_id "XLOC_009205"; transcript_id "TCONS_00009205"; exon_number "1"; oId "CUFF.9049.1"; tss_id "TSS9205"; +chr8 Cufflinks exon 42979610 42979659 . - . gene_id "XLOC_009206"; transcript_id "TCONS_00009206"; exon_number "1"; oId "CUFF.9053.1"; tss_id "TSS9206"; +chr8 Cufflinks exon 43105131 43105182 . - . gene_id "XLOC_009207"; transcript_id "TCONS_00009207"; exon_number "1"; oId "CUFF.9054.1"; tss_id "TSS9207"; +chr8 Cufflinks exon 43240841 43240910 . - . gene_id "XLOC_009208"; transcript_id "TCONS_00009208"; exon_number "1"; oId "CUFF.9058.1"; tss_id "TSS9208"; +chr8 Cufflinks exon 46951571 46952182 . - . gene_id "XLOC_009209"; transcript_id "TCONS_00009209"; exon_number "1"; oId "CUFF.9059.1"; tss_id "TSS9209"; +chr8 Cufflinks exon 47740038 47740112 . - . gene_id "XLOC_009210"; transcript_id "TCONS_00009210"; exon_number "1"; oId "CUFF.9061.1"; tss_id "TSS9210"; +chr8 Cufflinks exon 47979737 47979945 . - . gene_id "XLOC_009211"; transcript_id "TCONS_00009211"; exon_number "1"; oId "CUFF.9064.1"; tss_id "TSS9211"; +chr8 Cufflinks exon 47982945 47983036 . - . gene_id "XLOC_009212"; transcript_id "TCONS_00009212"; exon_number "1"; oId "CUFF.9065.1"; tss_id "TSS9212"; +chr8 Cufflinks exon 48043405 48043510 . - . gene_id "XLOC_009213"; transcript_id "TCONS_00009213"; exon_number "1"; oId "CUFF.9066.1"; tss_id "TSS9213"; +chr8 Cufflinks exon 49220490 49220589 . - . gene_id "XLOC_009214"; transcript_id "TCONS_00009214"; exon_number "1"; oId "CUFF.9069.1"; tss_id "TSS9214"; +chr8 Cufflinks exon 49375957 49376033 . - . gene_id "XLOC_009215"; transcript_id "TCONS_00009215"; exon_number "1"; oId "CUFF.9070.1"; tss_id "TSS9215"; +chr8 Cufflinks exon 50080451 50080498 . - . gene_id "XLOC_009216"; transcript_id "TCONS_00009216"; exon_number "1"; oId "CUFF.9071.1"; tss_id "TSS9216"; +chr8 Cufflinks exon 53003216 53003257 . - . gene_id "XLOC_009217"; transcript_id "TCONS_00009217"; exon_number "1"; oId "CUFF.9075.1"; tss_id "TSS9217"; +chr8 Cufflinks exon 54943699 54943793 . - . gene_id "XLOC_009218"; transcript_id "TCONS_00009218"; exon_number "1"; oId "CUFF.9081.1"; tss_id "TSS9218"; +chr8 Cufflinks exon 55552352 55552384 . - . gene_id "XLOC_009219"; transcript_id "TCONS_00009219"; exon_number "1"; oId "CUFF.9085.1"; tss_id "TSS9219"; +chr8 Cufflinks exon 55698429 55698462 . - . gene_id "XLOC_009220"; transcript_id "TCONS_00009220"; exon_number "1"; oId "CUFF.9086.1"; tss_id "TSS9220"; +chr8 Cufflinks exon 56755033 56755341 . - . gene_id "XLOC_009221"; transcript_id "TCONS_00009221"; exon_number "1"; oId "CUFF.9089.1"; tss_id "TSS9221"; +chr8 Cufflinks exon 56821654 56822036 . - . gene_id "XLOC_009222"; transcript_id "TCONS_00009222"; exon_number "1"; oId "CUFF.9090.1"; tss_id "TSS9222"; +chr8 Cufflinks exon 56892782 56893093 . - . gene_id "XLOC_009223"; transcript_id "TCONS_00009223"; exon_number "1"; oId "CUFF.9091.1"; tss_id "TSS9223"; +chr8 Cufflinks exon 56934578 56934856 . - . gene_id "XLOC_009224"; transcript_id "TCONS_00009224"; exon_number "1"; oId "CUFF.9092.1"; tss_id "TSS9224"; +chr8 Cufflinks exon 56993255 56993295 . - . gene_id "XLOC_009225"; transcript_id "TCONS_00009225"; exon_number "1"; oId "CUFF.9093.1"; tss_id "TSS9225"; +chr8 Cufflinks exon 57201888 57201928 . - . gene_id "XLOC_009226"; transcript_id "TCONS_00009226"; exon_number "1"; oId "CUFF.9094.1"; tss_id "TSS9226"; +chr8 Cufflinks exon 57352558 57352601 . - . gene_id "XLOC_009227"; transcript_id "TCONS_00009227"; exon_number "1"; oId "CUFF.9095.1"; tss_id "TSS9227"; +chr8 Cufflinks exon 57480978 57481028 . - . gene_id "XLOC_009228"; transcript_id "TCONS_00009228"; exon_number "1"; oId "CUFF.9096.1"; tss_id "TSS9228"; +chr8 Cufflinks exon 58039232 58039318 . - . gene_id "XLOC_009229"; transcript_id "TCONS_00009229"; exon_number "1"; oId "CUFF.9098.1"; tss_id "TSS9229"; +chr8 Cufflinks exon 58212912 58212943 . - . gene_id "XLOC_009230"; transcript_id "TCONS_00009230"; exon_number "1"; oId "CUFF.9100.1"; tss_id "TSS9230"; +chr8 Cufflinks exon 59574797 59574904 . - . gene_id "XLOC_009231"; transcript_id "TCONS_00009231"; exon_number "1"; oId "CUFF.9103.1"; tss_id "TSS9231"; +chr8 Cufflinks exon 59726968 59727111 . - . gene_id "XLOC_009232"; transcript_id "TCONS_00009232"; exon_number "1"; oId "CUFF.9104.1"; tss_id "TSS9232"; +chr8 Cufflinks exon 61397742 61397793 . - . gene_id "XLOC_009233"; transcript_id "TCONS_00009233"; exon_number "1"; oId "CUFF.9108.1"; tss_id "TSS9233"; +chr8 Cufflinks exon 62544342 62544571 . - . gene_id "XLOC_009234"; transcript_id "TCONS_00009234"; exon_number "1"; oId "CUFF.9110.1"; tss_id "TSS9234"; +chr8 Cufflinks exon 62730532 62730567 . - . gene_id "XLOC_009235"; transcript_id "TCONS_00009235"; exon_number "1"; oId "CUFF.9111.1"; tss_id "TSS9235"; +chr8 Cufflinks exon 63051551 63051602 . - . gene_id "XLOC_009236"; transcript_id "TCONS_00009236"; exon_number "1"; oId "CUFF.9112.1"; tss_id "TSS9236"; +chr8 Cufflinks exon 64147185 64147468 . - . gene_id "XLOC_009237"; transcript_id "TCONS_00009237"; exon_number "1"; oId "CUFF.9116.1"; tss_id "TSS9237"; +chr8 Cufflinks exon 64522010 64522157 . - . gene_id "XLOC_009238"; transcript_id "TCONS_00009238"; exon_number "1"; oId "CUFF.9117.1"; tss_id "TSS9238"; +chr8 Cufflinks exon 66485811 66485890 . - . gene_id "XLOC_009239"; transcript_id "TCONS_00009239"; exon_number "1"; oId "CUFF.9120.1"; tss_id "TSS9239"; +chr8 Cufflinks exon 66510360 66510401 . - . gene_id "XLOC_009240"; transcript_id "TCONS_00009240"; exon_number "1"; oId "CUFF.9121.1"; tss_id "TSS9240"; +chr8 Cufflinks exon 66609534 66609618 . - . gene_id "XLOC_009241"; transcript_id "TCONS_00009241"; exon_number "1"; oId "CUFF.9122.1"; tss_id "TSS9241"; +chr8 Cufflinks exon 67025173 67025247 . - . gene_id "XLOC_009242"; transcript_id "TCONS_00009242"; exon_number "1"; oId "CUFF.9123.1"; tss_id "TSS9242"; +chr8 Cufflinks exon 67095745 67095781 . - . gene_id "XLOC_009243"; transcript_id "TCONS_00009243"; exon_number "1"; oId "CUFF.9127.1"; tss_id "TSS9243"; +chr8 Cufflinks exon 67328650 67328676 . - . gene_id "XLOC_009244"; transcript_id "TCONS_00009244"; exon_number "1"; oId "CUFF.9128.1"; tss_id "TSS9244"; +chr8 Cufflinks exon 67413440 67413546 . - . gene_id "XLOC_009245"; transcript_id "TCONS_00009245"; exon_number "1"; oId "CUFF.9129.1"; tss_id "TSS9245"; +chr8 Cufflinks exon 67767749 67767779 . - . gene_id "XLOC_009246"; transcript_id "TCONS_00009246"; exon_number "1"; oId "CUFF.9130.1"; tss_id "TSS9246"; +chr8 Cufflinks exon 67860783 67860819 . - . gene_id "XLOC_009247"; transcript_id "TCONS_00009247"; exon_number "1"; oId "CUFF.9131.1"; tss_id "TSS9247"; +chr8 Cufflinks exon 68393926 68394159 . - . gene_id "XLOC_009248"; transcript_id "TCONS_00009248"; exon_number "1"; oId "CUFF.9134.1"; tss_id "TSS9248"; +chr8 Cufflinks exon 68959824 68959920 . - . gene_id "XLOC_009249"; transcript_id "TCONS_00009249"; exon_number "1"; oId "CUFF.9135.1"; tss_id "TSS9249"; +chr8 Cufflinks exon 69077204 69077269 . - . gene_id "XLOC_009250"; transcript_id "TCONS_00009250"; exon_number "1"; oId "CUFF.9136.1"; tss_id "TSS9250"; +chr8 Cufflinks exon 69218441 69218796 . - . gene_id "XLOC_009251"; transcript_id "TCONS_00009251"; exon_number "1"; oId "CUFF.9137.1"; tss_id "TSS9251"; +chr8 Cufflinks exon 70022753 70022809 . - . gene_id "XLOC_009252"; transcript_id "TCONS_00009252"; exon_number "1"; oId "CUFF.9141.1"; tss_id "TSS9252"; +chr8 Cufflinks exon 70602249 70602620 . - . gene_id "XLOC_009253"; transcript_id "TCONS_00009253"; exon_number "1"; oId "CUFF.9145.1"; tss_id "TSS9253"; +chr8 Cufflinks exon 70763383 70763657 . - . gene_id "XLOC_009254"; transcript_id "TCONS_00009254"; exon_number "1"; oId "CUFF.9147.1"; tss_id "TSS9254"; +chr8 Cufflinks exon 70834976 70835278 . - . gene_id "XLOC_009255"; transcript_id "TCONS_00009255"; exon_number "1"; oId "CUFF.9149.1"; tss_id "TSS9255"; +chr8 Cufflinks exon 70990144 70990267 . - . gene_id "XLOC_009256"; transcript_id "TCONS_00009256"; exon_number "1"; oId "CUFF.9152.1"; tss_id "TSS9256"; +chr8 Cufflinks exon 71392423 71392722 . - . gene_id "XLOC_009257"; transcript_id "TCONS_00009257"; exon_number "1"; oId "CUFF.9153.1"; tss_id "TSS9257"; +chr8 Cufflinks exon 71566803 71567118 . - . gene_id "XLOC_009258"; transcript_id "TCONS_00009258"; exon_number "1"; oId "CUFF.9156.1"; tss_id "TSS9258"; +chr8 Cufflinks exon 71986420 71986460 . - . gene_id "XLOC_009259"; transcript_id "TCONS_00009259"; exon_number "1"; oId "CUFF.9158.1"; tss_id "TSS9259"; +chr8 Cufflinks exon 72727728 72727856 . - . gene_id "XLOC_009260"; transcript_id "TCONS_00009260"; exon_number "1"; oId "CUFF.9159.1"; tss_id "TSS9260"; +chr8 Cufflinks exon 73744101 73744139 . - . gene_id "XLOC_009261"; transcript_id "TCONS_00009261"; exon_number "1"; oId "CUFF.9161.1"; tss_id "TSS9261"; +chr8 Cufflinks exon 73931187 73931283 . - . gene_id "XLOC_009262"; transcript_id "TCONS_00009262"; exon_number "1"; oId "CUFF.9163.1"; tss_id "TSS9262"; +chr8 Cufflinks exon 74711616 74711654 . - . gene_id "XLOC_009263"; transcript_id "TCONS_00009263"; exon_number "1"; oId "CUFF.9165.1"; tss_id "TSS9263"; +chr8 Cufflinks exon 74745999 74746277 . - . gene_id "XLOC_009264"; transcript_id "TCONS_00009264"; exon_number "1"; oId "CUFF.9166.1"; tss_id "TSS9264"; +chr8 Cufflinks exon 75836534 75836574 . - . gene_id "XLOC_009265"; transcript_id "TCONS_00009265"; exon_number "1"; oId "CUFF.9169.1"; tss_id "TSS9265"; +chr8 Cufflinks exon 76805045 76805139 . - . gene_id "XLOC_009266"; transcript_id "TCONS_00009266"; exon_number "1"; oId "CUFF.9170.1"; tss_id "TSS9266"; +chr8 Cufflinks exon 76906126 76906176 . - . gene_id "XLOC_009267"; transcript_id "TCONS_00009267"; exon_number "1"; oId "CUFF.9171.1"; tss_id "TSS9267"; +chr8 Cufflinks exon 76955426 76955563 . - . gene_id "XLOC_009268"; transcript_id "TCONS_00009268"; exon_number "1"; oId "CUFF.9172.1"; tss_id "TSS9268"; +chr8 Cufflinks exon 77177785 77177967 . - . gene_id "XLOC_009269"; transcript_id "TCONS_00009269"; exon_number "1"; oId "CUFF.9173.1"; tss_id "TSS9269"; +chr8 Cufflinks exon 77280361 77280468 . - . gene_id "XLOC_009270"; transcript_id "TCONS_00009270"; exon_number "1"; oId "CUFF.9174.1"; tss_id "TSS9270"; +chr8 Cufflinks exon 79310750 79310856 . - . gene_id "XLOC_009271"; transcript_id "TCONS_00009271"; exon_number "1"; oId "CUFF.9176.1"; tss_id "TSS9271"; +chr8 Cufflinks exon 80712369 80712430 . - . gene_id "XLOC_009272"; transcript_id "TCONS_00009272"; exon_number "1"; oId "CUFF.9177.1"; tss_id "TSS9272"; +chr8 Cufflinks exon 81255327 81255372 . - . gene_id "XLOC_009273"; transcript_id "TCONS_00009273"; exon_number "1"; oId "CUFF.9181.1"; tss_id "TSS9273"; +chr8 Cufflinks exon 81497825 81498016 . - . gene_id "XLOC_009274"; transcript_id "TCONS_00009274"; exon_number "1"; oId "CUFF.9184.1"; tss_id "TSS9274"; +chr8 Cufflinks exon 81525757 81526058 . - . gene_id "XLOC_009275"; transcript_id "TCONS_00009275"; exon_number "1"; oId "CUFF.9185.1"; tss_id "TSS9275"; +chr8 Cufflinks exon 81658496 81658548 . - . gene_id "XLOC_009276"; transcript_id "TCONS_00009276"; exon_number "1"; oId "CUFF.9186.1"; tss_id "TSS9276"; +chr8 Cufflinks exon 81688879 81689197 . - . gene_id "XLOC_009277"; transcript_id "TCONS_00009277"; exon_number "1"; oId "CUFF.9187.1"; tss_id "TSS9277"; +chr8 Cufflinks exon 84332342 84332410 . - . gene_id "XLOC_009278"; transcript_id "TCONS_00009278"; exon_number "1"; oId "CUFF.9189.1"; tss_id "TSS9278"; +chr8 Cufflinks exon 85422476 85422510 . - . gene_id "XLOC_009279"; transcript_id "TCONS_00009279"; exon_number "1"; oId "CUFF.9192.1"; tss_id "TSS9279"; +chr8 Cufflinks exon 85577996 85578100 . - . gene_id "XLOC_009280"; transcript_id "TCONS_00009280"; exon_number "1"; oId "CUFF.9193.1"; tss_id "TSS9280"; +chr8 Cufflinks exon 85832050 85832135 . - . gene_id "XLOC_009281"; transcript_id "TCONS_00009281"; exon_number "1"; oId "CUFF.9194.1"; tss_id "TSS9281"; +chr8 Cufflinks exon 87128873 87128918 . - . gene_id "XLOC_009282"; transcript_id "TCONS_00009282"; exon_number "1"; oId "CUFF.9196.1"; tss_id "TSS9282"; +chr8 Cufflinks exon 87720657 87720691 . - . gene_id "XLOC_009283"; transcript_id "TCONS_00009283"; exon_number "1"; oId "CUFF.9197.1"; tss_id "TSS9283"; +chr8 Cufflinks exon 87932680 87932717 . - . gene_id "XLOC_009284"; transcript_id "TCONS_00009284"; exon_number "1"; oId "CUFF.9198.1"; tss_id "TSS9284"; +chr8 Cufflinks exon 88328281 88328323 . - . gene_id "XLOC_009285"; transcript_id "TCONS_00009285"; exon_number "1"; oId "CUFF.9200.1"; tss_id "TSS9285"; +chr8 Cufflinks exon 88476535 88476571 . - . gene_id "XLOC_009286"; transcript_id "TCONS_00009286"; exon_number "1"; oId "CUFF.9201.1"; tss_id "TSS9286"; +chr8 Cufflinks exon 88608166 88608201 . - . gene_id "XLOC_009287"; transcript_id "TCONS_00009287"; exon_number "1"; oId "CUFF.9202.1"; tss_id "TSS9287"; +chr8 Cufflinks exon 89408691 89408776 . - . gene_id "XLOC_009288"; transcript_id "TCONS_00009288"; exon_number "1"; oId "CUFF.9203.1"; tss_id "TSS9288"; +chr8 Cufflinks exon 90912949 90913052 . - . gene_id "XLOC_009289"; transcript_id "TCONS_00009289"; exon_number "1"; oId "CUFF.9206.1"; tss_id "TSS9289"; +chr8 Cufflinks exon 91100534 91100711 . - . gene_id "XLOC_009290"; transcript_id "TCONS_00009290"; exon_number "1"; oId "CUFF.9208.1"; tss_id "TSS9290"; +chr8 Cufflinks exon 91608217 91608387 . - . gene_id "XLOC_009291"; transcript_id "TCONS_00009291"; exon_number "1"; oId "CUFF.9210.1"; tss_id "TSS9291"; +chr8 Cufflinks exon 92036291 92036400 . - . gene_id "XLOC_009292"; transcript_id "TCONS_00009292"; exon_number "1"; oId "CUFF.9211.1"; tss_id "TSS9292"; +chr8 Cufflinks exon 92476260 92476368 . - . gene_id "XLOC_009293"; transcript_id "TCONS_00009293"; exon_number "1"; oId "CUFF.9213.1"; tss_id "TSS9293"; +chr8 Cufflinks exon 93179689 93179778 . - . gene_id "XLOC_009294"; transcript_id "TCONS_00009294"; exon_number "1"; oId "CUFF.9216.1"; tss_id "TSS9294"; +chr8 Cufflinks exon 95918242 95918348 . - . gene_id "XLOC_009295"; transcript_id "TCONS_00009295"; exon_number "1"; oId "CUFF.9222.1"; tss_id "TSS9295"; +chr8 Cufflinks exon 96281885 96281966 . - . gene_id "XLOC_009296"; transcript_id "TCONS_00009296"; exon_number "1"; oId "CUFF.9224.1"; tss_id "TSS9296"; +chr8 Cufflinks exon 97443299 97443387 . - . gene_id "XLOC_009297"; transcript_id "TCONS_00009297"; exon_number "1"; oId "CUFF.9227.1"; tss_id "TSS9297"; +chr8 Cufflinks exon 97857964 97858005 . - . gene_id "XLOC_009298"; transcript_id "TCONS_00009298"; exon_number "1"; oId "CUFF.9229.1"; tss_id "TSS9298"; +chr8 Cufflinks exon 99204443 99204535 . - . gene_id "XLOC_009299"; transcript_id "TCONS_00009299"; exon_number "1"; oId "CUFF.9236.1"; tss_id "TSS9299"; +chr8 Cufflinks exon 99475172 99475278 . - . gene_id "XLOC_009300"; transcript_id "TCONS_00009300"; exon_number "1"; oId "CUFF.9239.1"; tss_id "TSS9300"; +chr8 Cufflinks exon 99933535 99933769 . - . gene_id "XLOC_009301"; transcript_id "TCONS_00009301"; exon_number "1"; oId "CUFF.9241.1"; tss_id "TSS9301"; +chr8 Cufflinks exon 99944090 99944253 . - . gene_id "XLOC_009302"; transcript_id "TCONS_00009302"; exon_number "1"; oId "CUFF.9242.1"; tss_id "TSS9302"; +chr8 Cufflinks exon 100626014 100626298 . - . gene_id "XLOC_009303"; transcript_id "TCONS_00009303"; exon_number "1"; oId "CUFF.9245.1"; tss_id "TSS9303"; +chr8 Cufflinks exon 101843953 101844088 . - . gene_id "XLOC_009304"; transcript_id "TCONS_00009304"; exon_number "1"; oId "CUFF.9249.1"; tss_id "TSS9304"; +chr8 Cufflinks exon 102409849 102410152 . - . gene_id "XLOC_009305"; transcript_id "TCONS_00009305"; exon_number "1"; oId "CUFF.9253.1"; tss_id "TSS9305"; +chr8 Cufflinks exon 102550180 102550322 . - . gene_id "XLOC_009306"; transcript_id "TCONS_00009306"; exon_number "1"; oId "CUFF.9254.1"; tss_id "TSS9306"; +chr8 Cufflinks exon 102859481 102859589 . - . gene_id "XLOC_009307"; transcript_id "TCONS_00009307"; exon_number "1"; oId "CUFF.9255.1"; tss_id "TSS9307"; +chr8 Cufflinks exon 103400751 103400864 . - . gene_id "XLOC_009308"; transcript_id "TCONS_00009308"; exon_number "1"; oId "CUFF.9256.1"; tss_id "TSS9308"; +chr8 Cufflinks exon 103491490 103491536 . - . gene_id "XLOC_009309"; transcript_id "TCONS_00009309"; exon_number "1"; oId "CUFF.9257.1"; tss_id "TSS9309"; +chr8 Cufflinks exon 103533412 103533462 . - . gene_id "XLOC_009310"; transcript_id "TCONS_00009310"; exon_number "1"; oId "CUFF.9258.1"; tss_id "TSS9310"; +chr8 Cufflinks exon 103545473 103545571 . - . gene_id "XLOC_009311"; transcript_id "TCONS_00009311"; exon_number "1"; oId "CUFF.9259.1"; tss_id "TSS9311"; +chr8 Cufflinks exon 105339435 105339482 . - . gene_id "XLOC_009312"; transcript_id "TCONS_00009312"; exon_number "1"; oId "CUFF.9266.1"; tss_id "TSS9312"; +chr8 Cufflinks exon 106206881 106206921 . - . gene_id "XLOC_009313"; transcript_id "TCONS_00009313"; exon_number "1"; oId "CUFF.9268.1"; tss_id "TSS9313"; +chr8 Cufflinks exon 107742023 107742083 . - . gene_id "XLOC_009314"; transcript_id "TCONS_00009314"; exon_number "1"; oId "CUFF.9269.1"; tss_id "TSS9314"; +chr8 Cufflinks exon 108053345 108053373 . - . gene_id "XLOC_009315"; transcript_id "TCONS_00009315"; exon_number "1"; oId "CUFF.9270.1"; tss_id "TSS9315"; +chr8 Cufflinks exon 109304592 109304662 . - . gene_id "XLOC_009316"; transcript_id "TCONS_00009316"; exon_number "1"; oId "CUFF.9272.1"; tss_id "TSS9316"; +chr8 Cufflinks exon 109536848 109536927 . - . gene_id "XLOC_009317"; transcript_id "TCONS_00009317"; exon_number "1"; oId "CUFF.9273.1"; tss_id "TSS9317"; +chr8 Cufflinks exon 110886191 110886247 . - . gene_id "XLOC_009318"; transcript_id "TCONS_00009318"; exon_number "1"; oId "CUFF.9274.1"; tss_id "TSS9318"; +chr8 Cufflinks exon 110937758 110937800 . - . gene_id "XLOC_009319"; transcript_id "TCONS_00009319"; exon_number "1"; oId "CUFF.9275.1"; tss_id "TSS9319"; +chr8 Cufflinks exon 111990681 111990720 . - . gene_id "XLOC_009320"; transcript_id "TCONS_00009320"; exon_number "1"; oId "CUFF.9276.1"; tss_id "TSS9320"; +chr8 Cufflinks exon 113160989 113161054 . - . gene_id "XLOC_009321"; transcript_id "TCONS_00009321"; exon_number "1"; oId "CUFF.9278.1"; tss_id "TSS9321"; +chr8 Cufflinks exon 113346340 113346379 . - . gene_id "XLOC_009322"; transcript_id "TCONS_00009322"; exon_number "1"; oId "CUFF.9279.1"; tss_id "TSS9322"; +chr8 Cufflinks exon 113576102 113576270 . - . gene_id "XLOC_009323"; transcript_id "TCONS_00009323"; exon_number "1"; oId "CUFF.9281.1"; tss_id "TSS9323"; +chr8 Cufflinks exon 113771622 113771669 . - . gene_id "XLOC_009324"; transcript_id "TCONS_00009324"; exon_number "1"; oId "CUFF.9282.1"; tss_id "TSS9324"; +chr8 Cufflinks exon 114025684 114025727 . - . gene_id "XLOC_009325"; transcript_id "TCONS_00009325"; exon_number "1"; oId "CUFF.9283.1"; tss_id "TSS9325"; +chr8 Cufflinks exon 114225198 114225240 . - . gene_id "XLOC_009326"; transcript_id "TCONS_00009326"; exon_number "1"; oId "CUFF.9284.1"; tss_id "TSS9326"; +chr8 Cufflinks exon 116146852 116146969 . - . gene_id "XLOC_009327"; transcript_id "TCONS_00009327"; exon_number "1"; oId "CUFF.9286.1"; tss_id "TSS9327"; +chr8 Cufflinks exon 117034928 117035014 . - . gene_id "XLOC_009328"; transcript_id "TCONS_00009328"; exon_number "1"; oId "CUFF.9287.1"; tss_id "TSS9328"; +chr8 Cufflinks exon 117123550 117123678 . - . gene_id "XLOC_009329"; transcript_id "TCONS_00009329"; exon_number "1"; oId "CUFF.9288.1"; tss_id "TSS9329"; +chr8 Cufflinks exon 117952299 117952336 . - . gene_id "XLOC_009330"; transcript_id "TCONS_00009330"; exon_number "1"; oId "CUFF.9290.1"; tss_id "TSS9330"; +chr8 Cufflinks exon 119632209 119632267 . - . gene_id "XLOC_009331"; transcript_id "TCONS_00009331"; exon_number "1"; oId "CUFF.9294.1"; tss_id "TSS9331"; +chr8 Cufflinks exon 120724144 120724385 . - . gene_id "XLOC_009332"; transcript_id "TCONS_00009332"; exon_number "1"; oId "CUFF.9297.1"; tss_id "TSS9332"; +chr8 Cufflinks exon 120903400 120903469 . - . gene_id "XLOC_009333"; transcript_id "TCONS_00009333"; exon_number "1"; oId "CUFF.9299.1"; tss_id "TSS9333"; +chr8 Cufflinks exon 121386128 121386169 . - . gene_id "XLOC_009334"; transcript_id "TCONS_00009334"; exon_number "1"; oId "CUFF.9300.1"; tss_id "TSS9334"; +chr8 Cufflinks exon 122187144 122187185 . - . gene_id "XLOC_009335"; transcript_id "TCONS_00009335"; exon_number "1"; oId "CUFF.9303.1"; tss_id "TSS9335"; +chr8 Cufflinks exon 124169469 124169542 . - . gene_id "XLOC_009336"; transcript_id "TCONS_00009336"; exon_number "1"; oId "CUFF.9308.1"; tss_id "TSS9336"; +chr8 Cufflinks exon 124192550 124192764 . - . gene_id "XLOC_009337"; transcript_id "TCONS_00009337"; exon_number "1"; oId "CUFF.9309.1"; tss_id "TSS9337"; +chr8 Cufflinks exon 124270727 124270797 . - . gene_id "XLOC_009338"; transcript_id "TCONS_00009338"; exon_number "1"; oId "CUFF.9311.1"; tss_id "TSS9338"; +chr8 Cufflinks exon 124278879 124278986 . - . gene_id "XLOC_009339"; transcript_id "TCONS_00009339"; exon_number "1"; oId "CUFF.9313.1"; tss_id "TSS9339"; +chr8 Cufflinks exon 124467280 124467347 . - . gene_id "XLOC_009340"; transcript_id "TCONS_00009340"; exon_number "1"; oId "CUFF.9315.1"; tss_id "TSS9340"; +chr8 Cufflinks exon 125472889 125472955 . - . gene_id "XLOC_009341"; transcript_id "TCONS_00009341"; exon_number "1"; oId "CUFF.9320.1"; tss_id "TSS9341"; +chr8 Cufflinks exon 125511195 125511251 . - . gene_id "XLOC_009342"; transcript_id "TCONS_00009342"; exon_number "1"; oId "CUFF.9321.1"; tss_id "TSS9342"; +chr8 Cufflinks exon 125629034 125629080 . - . gene_id "XLOC_009343"; transcript_id "TCONS_00009343"; exon_number "1"; oId "CUFF.9322.1"; tss_id "TSS9343"; +chr8 Cufflinks exon 125785385 125785420 . - . gene_id "XLOC_009344"; transcript_id "TCONS_00009344"; exon_number "1"; oId "CUFF.9323.1"; tss_id "TSS9344"; +chr8 Cufflinks exon 127836428 127836508 . - . gene_id "XLOC_009345"; transcript_id "TCONS_00009345"; exon_number "1"; oId "CUFF.9330.1"; tss_id "TSS9345"; +chr8 Cufflinks exon 129022789 129022857 . - . gene_id "XLOC_009346"; transcript_id "TCONS_00009346"; exon_number "1"; oId "CUFF.9333.1"; tss_id "TSS9346"; +chr8 Cufflinks exon 130148362 130148440 . - . gene_id "XLOC_009347"; transcript_id "TCONS_00009347"; exon_number "1"; oId "CUFF.9335.1"; tss_id "TSS9347"; +chr8 Cufflinks exon 131016799 131016846 . - . gene_id "XLOC_009348"; transcript_id "TCONS_00009348"; exon_number "1"; oId "CUFF.9337.1"; tss_id "TSS9348"; +chr8 Cufflinks exon 131081819 131081898 . - . gene_id "XLOC_009349"; transcript_id "TCONS_00009349"; exon_number "1"; oId "CUFF.9338.1"; tss_id "TSS9349"; +chr8 Cufflinks exon 131597094 131597140 . - . gene_id "XLOC_009350"; transcript_id "TCONS_00009350"; exon_number "1"; oId "CUFF.9339.1"; tss_id "TSS9350"; +chr8 Cufflinks exon 132872845 132872961 . - . gene_id "XLOC_009351"; transcript_id "TCONS_00009351"; exon_number "1"; oId "CUFF.9342.1"; tss_id "TSS9351"; +chr8 Cufflinks exon 135847570 135847733 . - . gene_id "XLOC_009352"; transcript_id "TCONS_00009352"; exon_number "1"; oId "CUFF.9345.1"; tss_id "TSS9352"; +chr8 Cufflinks exon 135983025 135983078 . - . gene_id "XLOC_009353"; transcript_id "TCONS_00009353"; exon_number "1"; oId "CUFF.9346.1"; tss_id "TSS9353"; +chr8 Cufflinks exon 135989178 135989214 . - . gene_id "XLOC_009354"; transcript_id "TCONS_00009354"; exon_number "1"; oId "CUFF.9347.1"; tss_id "TSS9354"; +chr8 Cufflinks exon 136754608 136754738 . - . gene_id "XLOC_009355"; transcript_id "TCONS_00009355"; exon_number "1"; oId "CUFF.9348.1"; tss_id "TSS9355"; +chr8 Cufflinks exon 138358226 138358267 . - . gene_id "XLOC_009356"; transcript_id "TCONS_00009356"; exon_number "1"; oId "CUFF.9350.1"; tss_id "TSS9356"; +chr8 Cufflinks exon 139815623 139815693 . - . gene_id "XLOC_009357"; transcript_id "TCONS_00009357"; exon_number "1"; oId "CUFF.9352.1"; tss_id "TSS9357"; +chr8 Cufflinks exon 140690399 140690510 . - . gene_id "XLOC_009358"; transcript_id "TCONS_00009358"; exon_number "1"; oId "CUFF.9353.1"; tss_id "TSS9358"; +chr8 Cufflinks exon 141094073 141094151 . - . gene_id "XLOC_009359"; transcript_id "TCONS_00009359"; exon_number "1"; oId "CUFF.9354.1"; tss_id "TSS9359"; +chr8 Cufflinks exon 141665136 141665189 . - . gene_id "XLOC_009360"; transcript_id "TCONS_00009360"; exon_number "1"; oId "CUFF.9355.1"; tss_id "TSS9360"; +chr8 Cufflinks exon 141692551 141692586 . - . gene_id "XLOC_009361"; transcript_id "TCONS_00009361"; exon_number "1"; oId "CUFF.9356.1"; tss_id "TSS9361"; +chr8 Cufflinks exon 143328941 143329227 . - . gene_id "XLOC_009362"; transcript_id "TCONS_00009362"; exon_number "1"; oId "CUFF.9358.1"; tss_id "TSS9362"; +chr8 Cufflinks exon 144728081 144728136 . - . gene_id "XLOC_009363"; transcript_id "TCONS_00009363"; exon_number "1"; oId "CUFF.9362.1"; tss_id "TSS9363"; +chr8 Cufflinks exon 146129735 146129780 . - . gene_id "XLOC_009364"; transcript_id "TCONS_00009364"; exon_number "1"; oId "CUFF.9365.1"; tss_id "TSS9364"; +chr9 Cufflinks exon 401794 401835 . + . gene_id "XLOC_009365"; transcript_id "TCONS_00009365"; exon_number "1"; oId "CUFF.9367.1"; tss_id "TSS9365"; +chr9 Cufflinks exon 438124 438206 . + . gene_id "XLOC_009366"; transcript_id "TCONS_00009366"; exon_number "1"; oId "CUFF.9368.1"; tss_id "TSS9366"; +chr9 Cufflinks exon 438396 438470 . + . gene_id "XLOC_009367"; transcript_id "TCONS_00009367"; exon_number "1"; oId "CUFF.9369.1"; tss_id "TSS9367"; +chr9 Cufflinks exon 541440 541476 . + . gene_id "XLOC_009368"; transcript_id "TCONS_00009368"; exon_number "1"; oId "CUFF.9370.1"; tss_id "TSS9368"; +chr9 Cufflinks exon 558826 558922 . + . gene_id "XLOC_009369"; transcript_id "TCONS_00009369"; exon_number "1"; oId "CUFF.9371.1"; tss_id "TSS9369"; +chr9 Cufflinks exon 1053961 1054018 . + . gene_id "XLOC_009370"; transcript_id "TCONS_00009370"; exon_number "1"; oId "CUFF.9374.1"; tss_id "TSS9370"; +chr9 Cufflinks exon 1333834 1333923 . + . gene_id "XLOC_009371"; transcript_id "TCONS_00009371"; exon_number "1"; oId "CUFF.9376.1"; tss_id "TSS9371"; +chr9 Cufflinks exon 1482697 1482736 . + . gene_id "XLOC_009372"; transcript_id "TCONS_00009372"; exon_number "1"; oId "CUFF.9377.1"; tss_id "TSS9372"; +chr9 Cufflinks exon 1906157 1906195 . + . gene_id "XLOC_009373"; transcript_id "TCONS_00009373"; exon_number "1"; oId "CUFF.9378.1"; tss_id "TSS9373"; +chr9 Cufflinks exon 2130352 2130390 . + . gene_id "XLOC_009374"; transcript_id "TCONS_00009374"; exon_number "1"; oId "CUFF.9379.1"; tss_id "TSS9374"; +chr9 Cufflinks exon 3994152 3994198 . + . gene_id "XLOC_009375"; transcript_id "TCONS_00009375"; exon_number "1"; oId "CUFF.9382.1"; tss_id "TSS9375"; +chr9 Cufflinks exon 4400167 4400202 . + . gene_id "XLOC_009376"; transcript_id "TCONS_00009376"; exon_number "1"; oId "CUFF.9384.1"; tss_id "TSS9376"; +chr9 Cufflinks exon 5094024 5094097 . + . gene_id "XLOC_009377"; transcript_id "TCONS_00009377"; exon_number "1"; oId "CUFF.9387.1"; tss_id "TSS9377"; +chr9 Cufflinks exon 5890149 5890259 . + . gene_id "XLOC_009378"; transcript_id "TCONS_00009378"; exon_number "1"; oId "CUFF.9391.1"; tss_id "TSS9378"; +chr9 Cufflinks exon 6128580 6128608 . + . gene_id "XLOC_009379"; transcript_id "TCONS_00009379"; exon_number "1"; oId "CUFF.9393.1"; tss_id "TSS9379"; +chr9 Cufflinks exon 7071821 7071862 . + . gene_id "XLOC_009380"; transcript_id "TCONS_00009380"; exon_number "1"; oId "CUFF.9397.1"; tss_id "TSS9380"; +chr9 Cufflinks exon 7622269 7622335 . + . gene_id "XLOC_009381"; transcript_id "TCONS_00009381"; exon_number "1"; oId "CUFF.9398.1"; tss_id "TSS9381"; +chr9 Cufflinks exon 8553658 8553707 . + . gene_id "XLOC_009382"; transcript_id "TCONS_00009382"; exon_number "1"; oId "CUFF.9399.1"; tss_id "TSS9382"; +chr9 Cufflinks exon 8740133 8740176 . + . gene_id "XLOC_009383"; transcript_id "TCONS_00009383"; exon_number "1"; oId "CUFF.9400.1"; tss_id "TSS9383"; +chr9 Cufflinks exon 8797146 8797193 . + . gene_id "XLOC_009384"; transcript_id "TCONS_00009384"; exon_number "1"; oId "CUFF.9401.1"; tss_id "TSS9384"; +chr9 Cufflinks exon 9442060 9442294 . + . gene_id "XLOC_009385"; transcript_id "TCONS_00009385"; exon_number "1"; oId "CUFF.9402.1"; tss_id "TSS9385"; +chr9 Cufflinks exon 10324526 10324623 . + . gene_id "XLOC_009386"; transcript_id "TCONS_00009386"; exon_number "1"; oId "CUFF.9403.1"; tss_id "TSS9386"; +chr9 Cufflinks exon 12286193 12286268 . + . gene_id "XLOC_009387"; transcript_id "TCONS_00009387"; exon_number "1"; oId "CUFF.9405.1"; tss_id "TSS9387"; +chr9 Cufflinks exon 12731979 12732170 . + . gene_id "XLOC_009388"; transcript_id "TCONS_00009388"; exon_number "1"; oId "CUFF.9407.1"; tss_id "TSS9388"; +chr9 Cufflinks exon 12843242 12843282 . + . gene_id "XLOC_009389"; transcript_id "TCONS_00009389"; exon_number "1"; oId "CUFF.9409.1"; tss_id "TSS9389"; +chr9 Cufflinks exon 13928669 13928704 . + . gene_id "XLOC_009390"; transcript_id "TCONS_00009390"; exon_number "1"; oId "CUFF.9410.1"; tss_id "TSS9390"; +chr9 Cufflinks exon 14850427 14850532 . + . gene_id "XLOC_009391"; transcript_id "TCONS_00009391"; exon_number "1"; oId "CUFF.9412.1"; tss_id "TSS9391"; +chr9 Cufflinks exon 15143287 15143383 . + . gene_id "XLOC_009392"; transcript_id "TCONS_00009392"; exon_number "1"; oId "CUFF.9413.1"; tss_id "TSS9392"; +chr9 Cufflinks exon 15220864 15220962 . + . gene_id "XLOC_009393"; transcript_id "TCONS_00009393"; exon_number "1"; oId "CUFF.9414.1"; tss_id "TSS9393"; +chr9 Cufflinks exon 15544186 15544292 . + . gene_id "XLOC_009394"; transcript_id "TCONS_00009394"; exon_number "1"; oId "CUFF.9418.1"; tss_id "TSS9394"; +chr9 Cufflinks exon 16131693 16131773 . + . gene_id "XLOC_009395"; transcript_id "TCONS_00009395"; exon_number "1"; oId "CUFF.9421.1"; tss_id "TSS9395"; +chr9 Cufflinks exon 17053914 17054200 . + . gene_id "XLOC_009396"; transcript_id "TCONS_00009396"; exon_number "1"; oId "CUFF.9423.1"; tss_id "TSS9396"; +chr9 Cufflinks exon 18651145 18651370 . + . gene_id "XLOC_009397"; transcript_id "TCONS_00009397"; exon_number "1"; oId "CUFF.9427.1"; tss_id "TSS9397"; +chr9 Cufflinks exon 18973598 18973765 . + . gene_id "XLOC_009398"; transcript_id "TCONS_00009398"; exon_number "1"; oId "CUFF.9428.1"; tss_id "TSS9398"; +chr9 Cufflinks exon 19073842 19073916 . + . gene_id "XLOC_009399"; transcript_id "TCONS_00009399"; exon_number "1"; oId "CUFF.9430.1"; tss_id "TSS9399"; +chr9 Cufflinks exon 19278553 19278593 . + . gene_id "XLOC_009400"; transcript_id "TCONS_00009400"; exon_number "1"; oId "CUFF.9432.1"; tss_id "TSS9400"; +chr9 Cufflinks exon 19310688 19310789 . + . gene_id "XLOC_009401"; transcript_id "TCONS_00009401"; exon_number "1"; oId "CUFF.9433.1"; tss_id "TSS9401"; +chr9 Cufflinks exon 19403996 19404070 . + . gene_id "XLOC_009402"; transcript_id "TCONS_00009402"; exon_number "1"; oId "CUFF.9434.1"; tss_id "TSS9402"; +chr9 Cufflinks exon 19423059 19423129 . + . gene_id "XLOC_009403"; transcript_id "TCONS_00009403"; exon_number "1"; oId "CUFF.9435.1"; tss_id "TSS9403"; +chr9 Cufflinks exon 20418319 20418385 . + . gene_id "XLOC_009404"; transcript_id "TCONS_00009404"; exon_number "1"; oId "CUFF.9439.1"; tss_id "TSS9404"; +chr9 Cufflinks exon 20846587 20846762 . + . gene_id "XLOC_009405"; transcript_id "TCONS_00009405"; exon_number "1"; oId "CUFF.9440.1"; tss_id "TSS9405"; +chr9 Cufflinks exon 21699311 21699523 . + . gene_id "XLOC_009406"; transcript_id "TCONS_00009406"; exon_number "1"; oId "CUFF.9441.1"; tss_id "TSS9406"; +chr9 Cufflinks exon 25234477 25234513 . + . gene_id "XLOC_009407"; transcript_id "TCONS_00009407"; exon_number "1"; oId "CUFF.9445.1"; tss_id "TSS9407"; +chr9 Cufflinks exon 26182997 26183031 . + . gene_id "XLOC_009408"; transcript_id "TCONS_00009408"; exon_number "1"; oId "CUFF.9448.1"; tss_id "TSS9408"; +chr9 Cufflinks exon 26895676 26895900 . + . gene_id "XLOC_009409"; transcript_id "TCONS_00009409"; exon_number "1"; oId "CUFF.9450.1"; tss_id "TSS9409"; +chr9 Cufflinks exon 26896149 26896242 . + . gene_id "XLOC_009410"; transcript_id "TCONS_00009410"; exon_number "1"; oId "CUFF.9451.1"; tss_id "TSS9410"; +chr9 Cufflinks exon 27198285 27198354 . + . gene_id "XLOC_009411"; transcript_id "TCONS_00009411"; exon_number "1"; oId "CUFF.9452.1"; tss_id "TSS9411"; +chr9 Cufflinks exon 28260563 28260626 . + . gene_id "XLOC_009412"; transcript_id "TCONS_00009412"; exon_number "1"; oId "CUFF.9453.1"; tss_id "TSS9412"; +chr9 Cufflinks exon 29042224 29042265 . + . gene_id "XLOC_009413"; transcript_id "TCONS_00009413"; exon_number "1"; oId "CUFF.9454.1"; tss_id "TSS9413"; +chr9 Cufflinks exon 30996533 30996658 . + . gene_id "XLOC_009414"; transcript_id "TCONS_00009414"; exon_number "1"; oId "CUFF.9456.1"; tss_id "TSS9414"; +chr9 Cufflinks exon 31042969 31043006 . + . gene_id "XLOC_009415"; transcript_id "TCONS_00009415"; exon_number "1"; oId "CUFF.9457.1"; tss_id "TSS9415"; +chr9 Cufflinks exon 31569235 31569272 . + . gene_id "XLOC_009416"; transcript_id "TCONS_00009416"; exon_number "1"; oId "CUFF.9458.1"; tss_id "TSS9416"; +chr9 Cufflinks exon 32537939 32538167 . + . gene_id "XLOC_009417"; transcript_id "TCONS_00009417"; exon_number "1"; oId "CUFF.9460.1"; tss_id "TSS9417"; +chr9 Cufflinks exon 33026715 33026754 . + . gene_id "XLOC_009418"; transcript_id "TCONS_00009418"; exon_number "1"; oId "CUFF.9461.1"; tss_id "TSS9418"; +chr9 Cufflinks exon 33530323 33530390 . + . gene_id "XLOC_009419"; transcript_id "TCONS_00009419"; exon_number "1"; oId "CUFF.9464.1"; tss_id "TSS9419"; +chr9 Cufflinks exon 33658623 33658771 . + . gene_id "XLOC_009420"; transcript_id "TCONS_00009420"; exon_number "1"; oId "CUFF.9465.1"; tss_id "TSS9420"; +chr9 Cufflinks exon 34049964 34050212 . + . gene_id "XLOC_009421"; transcript_id "TCONS_00009421"; exon_number "1"; oId "CUFF.9467.1"; tss_id "TSS9421"; +chr9 Cufflinks exon 34478623 34478779 . + . gene_id "XLOC_009422"; transcript_id "TCONS_00009422"; exon_number "1"; oId "CUFF.9471.1"; tss_id "TSS9422"; +chr9 Cufflinks exon 35049268 35049562 . + . gene_id "XLOC_009423"; transcript_id "TCONS_00009423"; exon_number "1"; oId "CUFF.9472.1"; tss_id "TSS9423"; +chr9 Cufflinks exon 35671773 35672061 . + . gene_id "XLOC_009424"; transcript_id "TCONS_00009424"; exon_number "1"; oId "CUFF.9475.1"; tss_id "TSS9424"; +chr9 Cufflinks exon 36267780 36267846 . + . gene_id "XLOC_009425"; transcript_id "TCONS_00009425"; exon_number "1"; oId "CUFF.9476.1"; tss_id "TSS9425"; +chr9 Cufflinks exon 36284314 36284352 . + . gene_id "XLOC_009426"; transcript_id "TCONS_00009426"; exon_number "1"; oId "CUFF.9477.1"; tss_id "TSS9426"; +chr9 Cufflinks exon 38147424 38147559 . + . gene_id "XLOC_009427"; transcript_id "TCONS_00009427"; exon_number "1"; oId "CUFF.9482.1"; tss_id "TSS9427"; +chr9 Cufflinks exon 38190403 38190505 . + . gene_id "XLOC_009428"; transcript_id "TCONS_00009428"; exon_number "1"; oId "CUFF.9483.1"; tss_id "TSS9428"; +chr9 Cufflinks exon 38680003 38680101 . + . gene_id "XLOC_009429"; transcript_id "TCONS_00009429"; exon_number "1"; oId "CUFF.9485.1"; tss_id "TSS9429"; +chr9 Cufflinks exon 39191102 39191376 . + . gene_id "XLOC_009430"; transcript_id "TCONS_00009430"; exon_number "1"; oId "CUFF.9486.1"; tss_id "TSS9430"; +chr9 Cufflinks exon 39720404 39720678 . + . gene_id "XLOC_009431"; transcript_id "TCONS_00009431"; exon_number "1"; oId "CUFF.9488.1"; tss_id "TSS9431"; +chr9 Cufflinks exon 40516811 40517085 . + . gene_id "XLOC_009432"; transcript_id "TCONS_00009432"; exon_number "1"; oId "CUFF.9490.1"; tss_id "TSS9432"; +chr9 Cufflinks exon 42378941 42379046 . + . gene_id "XLOC_009433"; transcript_id "TCONS_00009433"; exon_number "1"; oId "CUFF.9493.1"; tss_id "TSS9433"; +chr9 Cufflinks exon 42570632 42570669 . + . gene_id "XLOC_009434"; transcript_id "TCONS_00009434"; exon_number "1"; oId "CUFF.9494.1"; tss_id "TSS9434"; +chr9 Cufflinks exon 42674127 42674161 . + . gene_id "XLOC_009435"; transcript_id "TCONS_00009435"; exon_number "1"; oId "CUFF.9495.1"; tss_id "TSS9435"; +chr9 Cufflinks exon 43692795 43692925 . + . gene_id "XLOC_009436"; transcript_id "TCONS_00009436"; exon_number "1"; oId "CUFF.9498.1"; tss_id "TSS9436"; +chr9 Cufflinks exon 45661991 45662290 . + . gene_id "XLOC_009437"; transcript_id "TCONS_00009437"; exon_number "1"; oId "CUFF.9501.1"; tss_id "TSS9437"; +chr9 Cufflinks exon 46048176 46048475 . + . gene_id "XLOC_009438"; transcript_id "TCONS_00009438"; exon_number "1"; oId "CUFF.9502.1"; tss_id "TSS9438"; +chr9 Cufflinks exon 46674886 46675184 . + . gene_id "XLOC_009439"; transcript_id "TCONS_00009439"; exon_number "1"; oId "CUFF.9503.1"; tss_id "TSS9439"; +chr9 Cufflinks exon 67216092 67216129 . + . gene_id "XLOC_009440"; transcript_id "TCONS_00009440"; exon_number "1"; oId "CUFF.9508.1"; tss_id "TSS9440"; +chr9 Cufflinks exon 67937393 67937498 . + . gene_id "XLOC_009441"; transcript_id "TCONS_00009441"; exon_number "1"; oId "CUFF.9510.1"; tss_id "TSS9441"; +chr9 Cufflinks exon 68408924 68409043 . + . gene_id "XLOC_009442"; transcript_id "TCONS_00009442"; exon_number "1"; oId "CUFF.9511.1"; tss_id "TSS9442"; +chr9 Cufflinks exon 68432319 68432365 . + . gene_id "XLOC_009443"; transcript_id "TCONS_00009443"; exon_number "1"; oId "CUFF.9512.1"; tss_id "TSS9443"; +chr9 Cufflinks exon 68685993 68686229 . + . gene_id "XLOC_009444"; transcript_id "TCONS_00009444"; exon_number "1"; oId "CUFF.9515.1"; tss_id "TSS9444"; +chr9 Cufflinks exon 68686484 68686562 . + . gene_id "XLOC_009445"; transcript_id "TCONS_00009445"; exon_number "1"; oId "CUFF.9516.1"; tss_id "TSS9445"; +chr9 Cufflinks exon 69025015 69025251 . + . gene_id "XLOC_009446"; transcript_id "TCONS_00009446"; exon_number "1"; oId "CUFF.9517.1"; tss_id "TSS9446"; +chr9 Cufflinks exon 69025506 69025585 . + . gene_id "XLOC_009447"; transcript_id "TCONS_00009447"; exon_number "1"; oId "CUFF.9518.1"; tss_id "TSS9447"; +chr9 Cufflinks exon 69392612 69392717 . + . gene_id "XLOC_009448"; transcript_id "TCONS_00009448"; exon_number "1"; oId "CUFF.9520.1"; tss_id "TSS9448"; +chr9 Cufflinks exon 69578097 69578134 . + . gene_id "XLOC_009449"; transcript_id "TCONS_00009449"; exon_number "1"; oId "CUFF.9521.1"; tss_id "TSS9449"; +chr9 Cufflinks exon 70874084 70874118 . + . gene_id "XLOC_009450"; transcript_id "TCONS_00009450"; exon_number "1"; oId "CUFF.9524.1"; tss_id "TSS9450"; +chr9 Cufflinks exon 75142151 75142258 . + . gene_id "XLOC_009451"; transcript_id "TCONS_00009451"; exon_number "1"; oId "CUFF.9535.1"; tss_id "TSS9451"; +chr9 Cufflinks exon 76764062 76764192 . + . gene_id "XLOC_009452"; transcript_id "TCONS_00009452"; exon_number "1"; oId "CUFF.9539.1"; tss_id "TSS9452"; +chr9 Cufflinks exon 77414811 77415057 . + . gene_id "XLOC_009453"; transcript_id "TCONS_00009453"; exon_number "1"; oId "CUFF.9541.1"; tss_id "TSS9453"; +chr9 Cufflinks exon 77472591 77472692 . + . gene_id "XLOC_009454"; transcript_id "TCONS_00009454"; exon_number "1"; oId "CUFF.9542.1"; tss_id "TSS9454"; +chr9 Cufflinks exon 77488351 77488386 . + . gene_id "XLOC_009455"; transcript_id "TCONS_00009455"; exon_number "1"; oId "CUFF.9543.1"; tss_id "TSS9455"; +chr9 Cufflinks exon 77812987 77813083 . + . gene_id "XLOC_009456"; transcript_id "TCONS_00009456"; exon_number "1"; oId "CUFF.9545.1"; tss_id "TSS9456"; +chr9 Cufflinks exon 78291823 78291934 . + . gene_id "XLOC_009457"; transcript_id "TCONS_00009457"; exon_number "1"; oId "CUFF.9546.1"; tss_id "TSS9457"; +chr9 Cufflinks exon 78864624 78864675 . + . gene_id "XLOC_009458"; transcript_id "TCONS_00009458"; exon_number "1"; oId "CUFF.9547.1"; tss_id "TSS9458"; +chr9 Cufflinks exon 79186649 79186950 . + . gene_id "XLOC_009459"; transcript_id "TCONS_00009459"; exon_number "1"; oId "CUFF.9548.1"; tss_id "TSS9459"; +chr9 Cufflinks exon 79384093 79384136 . + . gene_id "XLOC_009460"; transcript_id "TCONS_00009460"; exon_number "1"; oId "CUFF.9550.1"; tss_id "TSS9460"; +chr9 Cufflinks exon 80780381 80780612 . + . gene_id "XLOC_009461"; transcript_id "TCONS_00009461"; exon_number "1"; oId "CUFF.9553.1"; tss_id "TSS9461"; +chr9 Cufflinks exon 81161397 81161435 . + . gene_id "XLOC_009462"; transcript_id "TCONS_00009462"; exon_number "1"; oId "CUFF.9554.1"; tss_id "TSS9462"; +chr9 Cufflinks exon 82320576 82320618 . + . gene_id "XLOC_009463"; transcript_id "TCONS_00009463"; exon_number "1"; oId "CUFF.9557.1"; tss_id "TSS9463"; +chr9 Cufflinks exon 83094288 83094328 . + . gene_id "XLOC_009464"; transcript_id "TCONS_00009464"; exon_number "1"; oId "CUFF.9559.1"; tss_id "TSS9464"; +chr9 Cufflinks exon 84036636 84036721 . + . gene_id "XLOC_009465"; transcript_id "TCONS_00009465"; exon_number "1"; oId "CUFF.9560.1"; tss_id "TSS9465"; +chr9 Cufflinks exon 84500412 84500490 . + . gene_id "XLOC_009466"; transcript_id "TCONS_00009466"; exon_number "1"; oId "CUFF.9562.1"; tss_id "TSS9466"; +chr9 Cufflinks exon 85698146 85698184 . + . gene_id "XLOC_009467"; transcript_id "TCONS_00009467"; exon_number "1"; oId "CUFF.9566.1"; tss_id "TSS9467"; +chr9 Cufflinks exon 85890856 85890922 . + . gene_id "XLOC_009468"; transcript_id "TCONS_00009468"; exon_number "1"; oId "CUFF.9568.1"; tss_id "TSS9468"; +chr9 Cufflinks exon 86067187 86067293 . + . gene_id "XLOC_009469"; transcript_id "TCONS_00009469"; exon_number "1"; oId "CUFF.9569.1"; tss_id "TSS9469"; +chr9 Cufflinks exon 86162746 86162780 . + . gene_id "XLOC_009470"; transcript_id "TCONS_00009470"; exon_number "1"; oId "CUFF.9570.1"; tss_id "TSS9470"; +chr9 Cufflinks exon 86618417 86618455 . + . gene_id "XLOC_009471"; transcript_id "TCONS_00009471"; exon_number "1"; oId "CUFF.9572.1"; tss_id "TSS9471"; +chr9 Cufflinks exon 86861415 86861457 . + . gene_id "XLOC_009472"; transcript_id "TCONS_00009472"; exon_number "1"; oId "CUFF.9573.1"; tss_id "TSS9472"; +chr9 Cufflinks exon 88001542 88001571 . + . gene_id "XLOC_009473"; transcript_id "TCONS_00009473"; exon_number "1"; oId "CUFF.9575.1"; tss_id "TSS9473"; +chr9 Cufflinks exon 88086635 88086674 . + . gene_id "XLOC_009474"; transcript_id "TCONS_00009474"; exon_number "1"; oId "CUFF.9577.1"; tss_id "TSS9474"; +chr9 Cufflinks exon 88641343 88641390 . + . gene_id "XLOC_009475"; transcript_id "TCONS_00009475"; exon_number "1"; oId "CUFF.9579.1"; tss_id "TSS9475"; +chr9 Cufflinks exon 89645205 89645242 . + . gene_id "XLOC_009476"; transcript_id "TCONS_00009476"; exon_number "1"; oId "CUFF.9583.1"; tss_id "TSS9476"; +chr9 Cufflinks exon 90606457 90606497 . + . gene_id "XLOC_009477"; transcript_id "TCONS_00009477"; exon_number "1"; oId "CUFF.9584.1"; tss_id "TSS9477"; +chr9 Cufflinks exon 90989184 90989272 . + . gene_id "XLOC_009478"; transcript_id "TCONS_00009478"; exon_number "1"; oId "CUFF.9586.1"; tss_id "TSS9478"; +chr9 Cufflinks exon 90999467 90999573 . + . gene_id "XLOC_009479"; transcript_id "TCONS_00009479"; exon_number "1"; oId "CUFF.9587.1"; tss_id "TSS9479"; +chr9 Cufflinks exon 94093606 94093670 . + . gene_id "XLOC_009480"; transcript_id "TCONS_00009480"; exon_number "1"; oId "CUFF.9590.1"; tss_id "TSS9480"; +chr9 Cufflinks exon 94824501 94824557 . + . gene_id "XLOC_009481"; transcript_id "TCONS_00009481"; exon_number "1"; oId "CUFF.9593.1"; tss_id "TSS9481"; +chr9 Cufflinks exon 95583256 95583360 . + . gene_id "XLOC_009482"; transcript_id "TCONS_00009482"; exon_number "1"; oId "CUFF.9595.1"; tss_id "TSS9482"; +chr9 Cufflinks exon 96137838 96137913 . + . gene_id "XLOC_009483"; transcript_id "TCONS_00009483"; exon_number "1"; oId "CUFF.9596.1"; tss_id "TSS9483"; +chr9 Cufflinks exon 96324149 96324186 . + . gene_id "XLOC_009484"; transcript_id "TCONS_00009484"; exon_number "1"; oId "CUFF.9597.1"; tss_id "TSS9484"; +chr9 Cufflinks exon 96995759 96995866 . + . gene_id "XLOC_009485"; transcript_id "TCONS_00009485"; exon_number "1"; oId "CUFF.9599.1"; tss_id "TSS9485"; +chr9 Cufflinks exon 97007981 97008038 . + . gene_id "XLOC_009486"; transcript_id "TCONS_00009486"; exon_number "1"; oId "CUFF.9600.1"; tss_id "TSS9486"; +chr9 Cufflinks exon 97270020 97270122 . + . gene_id "XLOC_009487"; transcript_id "TCONS_00009487"; exon_number "1"; oId "CUFF.9601.1"; tss_id "TSS9487"; +chr9 Cufflinks exon 98070002 98070035 . + . gene_id "XLOC_009488"; transcript_id "TCONS_00009488"; exon_number "1"; oId "CUFF.9604.1"; tss_id "TSS9488"; +chr9 Cufflinks exon 98622196 98622242 . + . gene_id "XLOC_009489"; transcript_id "TCONS_00009489"; exon_number "1"; oId "CUFF.9606.1"; tss_id "TSS9489"; +chr9 Cufflinks exon 98667287 98667375 . + . gene_id "XLOC_009490"; transcript_id "TCONS_00009490"; exon_number "1"; oId "CUFF.9607.1"; tss_id "TSS9490"; +chr9 Cufflinks exon 99491337 99491372 . + . gene_id "XLOC_009491"; transcript_id "TCONS_00009491"; exon_number "1"; oId "CUFF.9609.1"; tss_id "TSS9491"; +chr9 Cufflinks exon 100404445 100404480 . + . gene_id "XLOC_009492"; transcript_id "TCONS_00009492"; exon_number "1"; oId "CUFF.9611.1"; tss_id "TSS9492"; +chr9 Cufflinks exon 100690273 100690307 . + . gene_id "XLOC_009493"; transcript_id "TCONS_00009493"; exon_number "1"; oId "CUFF.9613.1"; tss_id "TSS9493"; +chr9 Cufflinks exon 100722125 100722183 . + . gene_id "XLOC_009494"; transcript_id "TCONS_00009494"; exon_number "1"; oId "CUFF.9614.1"; tss_id "TSS9494"; +chr9 Cufflinks exon 100794513 100794616 . + . gene_id "XLOC_009495"; transcript_id "TCONS_00009495"; exon_number "1"; oId "CUFF.9615.1"; tss_id "TSS9495"; +chr9 Cufflinks exon 102046305 102046541 . + . gene_id "XLOC_009496"; transcript_id "TCONS_00009496"; exon_number "1"; oId "CUFF.9618.1"; tss_id "TSS9496"; +chr9 Cufflinks exon 102653296 102653361 . + . gene_id "XLOC_009497"; transcript_id "TCONS_00009497"; exon_number "1"; oId "CUFF.9619.1"; tss_id "TSS9497"; +chr9 Cufflinks exon 102864841 102865128 . + . gene_id "XLOC_009498"; transcript_id "TCONS_00009498"; exon_number "1"; oId "CUFF.9620.1"; tss_id "TSS9498"; +chr9 Cufflinks exon 105018886 105018990 . + . gene_id "XLOC_009499"; transcript_id "TCONS_00009499"; exon_number "1"; oId "CUFF.9622.1"; tss_id "TSS9499"; +chr9 Cufflinks exon 106052413 106052732 . + . gene_id "XLOC_009500"; transcript_id "TCONS_00009500"; exon_number "1"; oId "CUFF.9623.1"; tss_id "TSS9500"; +chr9 Cufflinks exon 106694509 106694548 . + . gene_id "XLOC_009501"; transcript_id "TCONS_00009501"; exon_number "1"; oId "CUFF.9626.1"; tss_id "TSS9501"; +chr9 Cufflinks exon 106882823 106882923 . + . gene_id "XLOC_009502"; transcript_id "TCONS_00009502"; exon_number "1"; oId "CUFF.9627.1"; tss_id "TSS9502"; +chr9 Cufflinks exon 107045876 107045950 . + . gene_id "XLOC_009503"; transcript_id "TCONS_00009503"; exon_number "1"; oId "CUFF.9628.1"; tss_id "TSS9503"; +chr9 Cufflinks exon 107859037 107859266 . + . gene_id "XLOC_009504"; transcript_id "TCONS_00009504"; exon_number "1"; oId "CUFF.9633.1"; tss_id "TSS9504"; +chr9 Cufflinks exon 109272989 109273023 . + . gene_id "XLOC_009505"; transcript_id "TCONS_00009505"; exon_number "1"; oId "CUFF.9634.1"; tss_id "TSS9505"; +chr9 Cufflinks exon 109442258 109442501 . + . gene_id "XLOC_009506"; transcript_id "TCONS_00009506"; exon_number "1"; oId "CUFF.9635.1"; tss_id "TSS9506"; +chr9 Cufflinks exon 109963064 109963142 . + . gene_id "XLOC_009507"; transcript_id "TCONS_00009507"; exon_number "1"; oId "CUFF.9639.1"; tss_id "TSS9507"; +chr9 Cufflinks exon 111398598 111398678 . + . gene_id "XLOC_009508"; transcript_id "TCONS_00009508"; exon_number "1"; oId "CUFF.9644.1"; tss_id "TSS9508"; +chr9 Cufflinks exon 112111895 112111940 . + . gene_id "XLOC_009509"; transcript_id "TCONS_00009509"; exon_number "1"; oId "CUFF.9647.1"; tss_id "TSS9509"; +chr9 Cufflinks exon 112366249 112366286 . + . gene_id "XLOC_009510"; transcript_id "TCONS_00009510"; exon_number "1"; oId "CUFF.9648.1"; tss_id "TSS9510"; +chr9 Cufflinks exon 112409526 112409560 . + . gene_id "XLOC_009511"; transcript_id "TCONS_00009511"; exon_number "1"; oId "CUFF.9649.1"; tss_id "TSS9511"; +chr9 Cufflinks exon 112735171 112735218 . + . gene_id "XLOC_009512"; transcript_id "TCONS_00009512"; exon_number "1"; oId "CUFF.9651.1"; tss_id "TSS9512"; +chr9 Cufflinks exon 112778498 112778539 . + . gene_id "XLOC_009513"; transcript_id "TCONS_00009513"; exon_number "1"; oId "CUFF.9652.1"; tss_id "TSS9513"; +chr9 Cufflinks exon 112960803 112960875 . + . gene_id "XLOC_009514"; transcript_id "TCONS_00009514"; exon_number "1"; oId "CUFF.9653.1"; tss_id "TSS9514"; +chr9 Cufflinks exon 113665617 113665725 . + . gene_id "XLOC_009515"; transcript_id "TCONS_00009515"; exon_number "1"; oId "CUFF.9656.1"; tss_id "TSS9515"; +chr9 Cufflinks exon 113823994 113824152 . + . gene_id "XLOC_009516"; transcript_id "TCONS_00009516"; exon_number "1"; oId "CUFF.9657.1"; tss_id "TSS9516"; +chr9 Cufflinks exon 114130408 114130442 . + . gene_id "XLOC_009517"; transcript_id "TCONS_00009517"; exon_number "1"; oId "CUFF.9659.1"; tss_id "TSS9517"; +chr9 Cufflinks exon 114602108 114602214 . + . gene_id "XLOC_009518"; transcript_id "TCONS_00009518"; exon_number "1"; oId "CUFF.9661.1"; tss_id "TSS9518"; +chr9 Cufflinks exon 114733228 114733297 . + . gene_id "XLOC_009519"; transcript_id "TCONS_00009519"; exon_number "1"; oId "CUFF.9662.1"; tss_id "TSS9519"; +chr9 Cufflinks exon 114900078 114900174 . + . gene_id "XLOC_009520"; transcript_id "TCONS_00009520"; exon_number "1"; oId "CUFF.9664.1"; tss_id "TSS9520"; +chr9 Cufflinks exon 115014538 115014627 . + . gene_id "XLOC_009521"; transcript_id "TCONS_00009521"; exon_number "1"; oId "CUFF.9666.1"; tss_id "TSS9521"; +chr9 Cufflinks exon 115032063 115032108 . + . gene_id "XLOC_009522"; transcript_id "TCONS_00009522"; exon_number "1"; oId "CUFF.9667.1"; tss_id "TSS9522"; +chr9 Cufflinks exon 115884921 115884965 . + . gene_id "XLOC_009523"; transcript_id "TCONS_00009523"; exon_number "1"; oId "CUFF.9670.1"; tss_id "TSS9523"; +chr9 Cufflinks exon 116018176 116018339 . + . gene_id "XLOC_009524"; transcript_id "TCONS_00009524"; exon_number "1"; oId "CUFF.9671.1"; tss_id "TSS9524"; +chr9 Cufflinks exon 118496671 118496727 . + . gene_id "XLOC_009525"; transcript_id "TCONS_00009525"; exon_number "1"; oId "CUFF.9678.1"; tss_id "TSS9525"; +chr9 Cufflinks exon 119856832 119856867 . + . gene_id "XLOC_009526"; transcript_id "TCONS_00009526"; exon_number "1"; oId "CUFF.9679.1"; tss_id "TSS9526"; +chr9 Cufflinks exon 119959397 119959638 . + . gene_id "XLOC_009527"; transcript_id "TCONS_00009527"; exon_number "1"; oId "CUFF.9680.1"; tss_id "TSS9527"; +chr9 Cufflinks exon 120039264 120039500 . + . gene_id "XLOC_009528"; transcript_id "TCONS_00009528"; exon_number "1"; oId "CUFF.9681.1"; tss_id "TSS9528"; +chr9 Cufflinks exon 121031519 121031550 . + . gene_id "XLOC_009529"; transcript_id "TCONS_00009529"; exon_number "1"; oId "CUFF.9683.1"; tss_id "TSS9529"; +chr9 Cufflinks exon 121548888 121548938 . + . gene_id "XLOC_009530"; transcript_id "TCONS_00009530"; exon_number "1"; oId "CUFF.9684.1"; tss_id "TSS9530"; +chr9 Cufflinks exon 121902991 121903034 . + . gene_id "XLOC_009531"; transcript_id "TCONS_00009531"; exon_number "1"; oId "CUFF.9685.1"; tss_id "TSS9531"; +chr9 Cufflinks exon 123851330 123851366 . + . gene_id "XLOC_009532"; transcript_id "TCONS_00009532"; exon_number "1"; oId "CUFF.9687.1"; tss_id "TSS9532"; +chr9 Cufflinks exon 123867411 123867491 . + . gene_id "XLOC_009533"; transcript_id "TCONS_00009533"; exon_number "1"; oId "CUFF.9688.1"; tss_id "TSS9533"; +chr9 Cufflinks exon 123965435 123965725 . + . gene_id "XLOC_009534"; transcript_id "TCONS_00009534"; exon_number "1"; oId "CUFF.9690.1"; tss_id "TSS9534"; +chr9 Cufflinks exon 124252617 124252658 . + . gene_id "XLOC_009535"; transcript_id "TCONS_00009535"; exon_number "1"; oId "CUFF.9691.1"; tss_id "TSS9535"; +chr9 Cufflinks exon 124256797 124257120 . + . gene_id "XLOC_009536"; transcript_id "TCONS_00009536"; exon_number "1"; oId "CUFF.9692.1"; tss_id "TSS9536"; +chr9 Cufflinks exon 125707174 125707210 . + . gene_id "XLOC_009537"; transcript_id "TCONS_00009537"; exon_number "1"; oId "CUFF.9693.1"; tss_id "TSS9537"; +chr9 Cufflinks exon 126604702 126604743 . + . gene_id "XLOC_009538"; transcript_id "TCONS_00009538"; exon_number "1"; oId "CUFF.9694.1"; tss_id "TSS9538"; +chr9 Cufflinks exon 127369438 127369743 . + . gene_id "XLOC_009539"; transcript_id "TCONS_00009539"; exon_number "1"; oId "CUFF.9696.1"; tss_id "TSS9539"; +chr9 Cufflinks exon 127460505 127460547 . + . gene_id "XLOC_009540"; transcript_id "TCONS_00009540"; exon_number "1"; oId "CUFF.9697.1"; tss_id "TSS9540"; +chr9 Cufflinks exon 127867711 127867770 . + . gene_id "XLOC_009541"; transcript_id "TCONS_00009541"; exon_number "1"; oId "CUFF.9699.1"; tss_id "TSS9541"; +chr9 Cufflinks exon 128188068 128188158 . + . gene_id "XLOC_009542"; transcript_id "TCONS_00009542"; exon_number "1"; oId "CUFF.9701.1"; tss_id "TSS9542"; +chr9 Cufflinks exon 128331637 128331696 . + . gene_id "XLOC_009543"; transcript_id "TCONS_00009543"; exon_number "1"; oId "CUFF.9703.1"; tss_id "TSS9543"; +chr9 Cufflinks exon 128420635 128420672 . + . gene_id "XLOC_009544"; transcript_id "TCONS_00009544"; exon_number "1"; oId "CUFF.9704.1"; tss_id "TSS9544"; +chr9 Cufflinks exon 130461857 130461930 . + . gene_id "XLOC_009545"; transcript_id "TCONS_00009545"; exon_number "1"; oId "CUFF.9706.1"; tss_id "TSS9545"; +chr9 Cufflinks exon 130769214 130769271 . + . gene_id "XLOC_009546"; transcript_id "TCONS_00009546"; exon_number "1"; oId "CUFF.9708.1"; tss_id "TSS9546"; +chr9 Cufflinks exon 131306196 131306252 . + . gene_id "XLOC_009547"; transcript_id "TCONS_00009547"; exon_number "1"; oId "CUFF.9711.1"; tss_id "TSS9547"; +chr9 Cufflinks exon 131431166 131431227 . + . gene_id "XLOC_009548"; transcript_id "TCONS_00009548"; exon_number "1"; oId "CUFF.9712.1"; tss_id "TSS9548"; +chr9 Cufflinks exon 131511636 131511743 . + . gene_id "XLOC_009549"; transcript_id "TCONS_00009549"; exon_number "1"; oId "CUFF.9713.1"; tss_id "TSS9549"; +chr9 Cufflinks exon 131823900 131824008 . + . gene_id "XLOC_009550"; transcript_id "TCONS_00009550"; exon_number "1"; oId "CUFF.9714.1"; tss_id "TSS9550"; +chr9 Cufflinks exon 133275654 133275959 . + . gene_id "XLOC_009551"; transcript_id "TCONS_00009551"; exon_number "1"; oId "CUFF.9717.1"; tss_id "TSS9551"; +chr9 Cufflinks exon 133325245 133325343 . + . gene_id "XLOC_009552"; transcript_id "TCONS_00009552"; exon_number "1"; oId "CUFF.9718.1"; tss_id "TSS9552"; +chr9 Cufflinks exon 134002378 134002474 . + . gene_id "XLOC_009553"; transcript_id "TCONS_00009553"; exon_number "1"; oId "CUFF.9719.1"; tss_id "TSS9553"; +chr9 Cufflinks exon 135297015 135297077 . + . gene_id "XLOC_009554"; transcript_id "TCONS_00009554"; exon_number "1"; oId "CUFF.9722.1"; tss_id "TSS9554"; +chr9 Cufflinks exon 135729205 135729269 . + . gene_id "XLOC_009555"; transcript_id "TCONS_00009555"; exon_number "1"; oId "CUFF.9723.1"; tss_id "TSS9555"; +chr9 Cufflinks exon 135806884 135806921 . + . gene_id "XLOC_009556"; transcript_id "TCONS_00009556"; exon_number "1"; oId "CUFF.9725.1"; tss_id "TSS9556"; +chr9 Cufflinks exon 135839120 135839180 . + . gene_id "XLOC_009557"; transcript_id "TCONS_00009557"; exon_number "1"; oId "CUFF.9726.1"; tss_id "TSS9557"; +chr9 Cufflinks exon 135968438 135968541 . + . gene_id "XLOC_009558"; transcript_id "TCONS_00009558"; exon_number "1"; oId "CUFF.9727.1"; tss_id "TSS9558"; +chr9 Cufflinks exon 136940174 136940235 . + . gene_id "XLOC_009559"; transcript_id "TCONS_00009559"; exon_number "1"; oId "CUFF.9728.1"; tss_id "TSS9559"; +chr9 Cufflinks exon 138489301 138489372 . + . gene_id "XLOC_009560"; transcript_id "TCONS_00009560"; exon_number "1"; oId "CUFF.9730.1"; tss_id "TSS9560"; +chr9 Cufflinks exon 139496968 139497049 . + . gene_id "XLOC_009561"; transcript_id "TCONS_00009561"; exon_number "1"; oId "CUFF.9731.1"; tss_id "TSS9561"; +chr9 Cufflinks exon 140315595 140315692 . + . gene_id "XLOC_009562"; transcript_id "TCONS_00009562"; exon_number "1"; oId "CUFF.9733.1"; tss_id "TSS9562"; +chr9 Cufflinks exon 140687335 140687522 . + . gene_id "XLOC_009563"; transcript_id "TCONS_00009563"; exon_number "1"; oId "CUFF.9734.1"; tss_id "TSS9563"; +chr9 Cufflinks exon 141150046 141150148 . + . gene_id "XLOC_009564"; transcript_id "TCONS_00009564"; exon_number "1"; oId "CUFF.9735.1"; tss_id "TSS9564"; +chr9 Cufflinks exon 161799 161833 . - . gene_id "XLOC_009565"; transcript_id "TCONS_00009565"; exon_number "1"; oId "CUFF.9366.1"; tss_id "TSS9565"; +chr9 Cufflinks exon 1001863 1001963 . - . gene_id "XLOC_009566"; transcript_id "TCONS_00009566"; exon_number "1"; oId "CUFF.9372.1"; tss_id "TSS9566"; +chr9 Cufflinks exon 1036783 1036817 . - . gene_id "XLOC_009567"; transcript_id "TCONS_00009567"; exon_number "1"; oId "CUFF.9373.1"; tss_id "TSS9567"; +chr9 Cufflinks exon 1212196 1212358 . - . gene_id "XLOC_009568"; transcript_id "TCONS_00009568"; exon_number "1"; oId "CUFF.9375.1"; tss_id "TSS9568"; +chr9 Cufflinks exon 2162767 2162950 . - . gene_id "XLOC_009569"; transcript_id "TCONS_00009569"; exon_number "1"; oId "CUFF.9380.1"; tss_id "TSS9569"; +chr9 Cufflinks exon 2812485 2812516 . - . gene_id "XLOC_009570"; transcript_id "TCONS_00009570"; exon_number "1"; oId "CUFF.9381.1"; tss_id "TSS9570"; +chr9 Cufflinks exon 4386416 4386498 . - . gene_id "XLOC_009571"; transcript_id "TCONS_00009571"; exon_number "1"; oId "CUFF.9383.1"; tss_id "TSS9571"; +chr9 Cufflinks exon 4691652 4691745 . - . gene_id "XLOC_009572"; transcript_id "TCONS_00009572"; exon_number "1"; oId "CUFF.9385.1"; tss_id "TSS9572"; +chr9 Cufflinks exon 4799735 4800000 . - . gene_id "XLOC_009573"; transcript_id "TCONS_00009573"; exon_number "1"; oId "CUFF.9386.1"; tss_id "TSS9573"; +chr9 Cufflinks exon 5095085 5095156 . - . gene_id "XLOC_009574"; transcript_id "TCONS_00009574"; exon_number "1"; oId "CUFF.9388.1"; tss_id "TSS9574"; +chr9 Cufflinks exon 5098203 5098269 . - . gene_id "XLOC_009575"; transcript_id "TCONS_00009575"; exon_number "1"; oId "CUFF.9389.1"; tss_id "TSS9575"; +chr9 Cufflinks exon 5759501 5759535 . - . gene_id "XLOC_009576"; transcript_id "TCONS_00009576"; exon_number "1"; oId "CUFF.9390.1"; tss_id "TSS9576"; +chr9 Cufflinks exon 5934740 5934777 . - . gene_id "XLOC_009577"; transcript_id "TCONS_00009577"; exon_number "1"; oId "CUFF.9392.1"; tss_id "TSS9577"; +chr9 Cufflinks exon 6566334 6566410 . - . gene_id "XLOC_009578"; transcript_id "TCONS_00009578"; exon_number "1"; oId "CUFF.9394.1"; tss_id "TSS9578"; +chr9 Cufflinks exon 6876239 6876273 . - . gene_id "XLOC_009579"; transcript_id "TCONS_00009579"; exon_number "1"; oId "CUFF.9395.1"; tss_id "TSS9579"; +chr9 Cufflinks exon 6906503 6906543 . - . gene_id "XLOC_009580"; transcript_id "TCONS_00009580"; exon_number "1"; oId "CUFF.9396.1"; tss_id "TSS9580"; +chr9 Cufflinks exon 11366441 11366485 . - . gene_id "XLOC_009581"; transcript_id "TCONS_00009581"; exon_number "1"; oId "CUFF.9404.1"; tss_id "TSS9581"; +chr9 Cufflinks exon 12300276 12300451 . - . gene_id "XLOC_009582"; transcript_id "TCONS_00009582"; exon_number "1"; oId "CUFF.9406.1"; tss_id "TSS9582"; +chr9 Cufflinks exon 12764752 12765045 . - . gene_id "XLOC_009583"; transcript_id "TCONS_00009583"; exon_number "1"; oId "CUFF.9408.1"; tss_id "TSS9583"; +chr9 Cufflinks exon 14433938 14434009 . - . gene_id "XLOC_009584"; transcript_id "TCONS_00009584"; exon_number "1"; oId "CUFF.9411.1"; tss_id "TSS9584"; +chr9 Cufflinks exon 15260738 15260776 . - . gene_id "XLOC_009585"; transcript_id "TCONS_00009585"; exon_number "1"; oId "CUFF.9415.1"; tss_id "TSS9585"; +chr9 Cufflinks exon 15431906 15431977 . - . gene_id "XLOC_009586"; transcript_id "TCONS_00009586"; exon_number "1"; oId "CUFF.9416.1"; tss_id "TSS9586"; +chr9 Cufflinks exon 15525765 15526079 . - . gene_id "XLOC_009587"; transcript_id "TCONS_00009587"; exon_number "1"; oId "CUFF.9417.1"; tss_id "TSS9587"; +chr9 Cufflinks exon 15689308 15689360 . - . gene_id "XLOC_009588"; transcript_id "TCONS_00009588"; exon_number "1"; oId "CUFF.9419.1"; tss_id "TSS9588"; +chr9 Cufflinks exon 15776179 15776284 . - . gene_id "XLOC_009589"; transcript_id "TCONS_00009589"; exon_number "1"; oId "CUFF.9420.1"; tss_id "TSS9589"; +chr9 Cufflinks exon 17001118 17001241 . - . gene_id "XLOC_009590"; transcript_id "TCONS_00009590"; exon_number "1"; oId "CUFF.9422.1"; tss_id "TSS9590"; +chr9 Cufflinks exon 17108133 17108177 . - . gene_id "XLOC_009591"; transcript_id "TCONS_00009591"; exon_number "1"; oId "CUFF.9424.1"; tss_id "TSS9591"; +chr9 Cufflinks exon 18540285 18540351 . - . gene_id "XLOC_009592"; transcript_id "TCONS_00009592"; exon_number "1"; oId "CUFF.9425.1"; tss_id "TSS9592"; +chr9 Cufflinks exon 18632040 18632148 . - . gene_id "XLOC_009593"; transcript_id "TCONS_00009593"; exon_number "1"; oId "CUFF.9426.1"; tss_id "TSS9593"; +chr9 Cufflinks exon 19013161 19013195 . - . gene_id "XLOC_009594"; transcript_id "TCONS_00009594"; exon_number "1"; oId "CUFF.9429.1"; tss_id "TSS9594"; +chr9 Cufflinks exon 19217374 19217401 . - . gene_id "XLOC_009595"; transcript_id "TCONS_00009595"; exon_number "1"; oId "CUFF.9431.1"; tss_id "TSS9595"; +chr9 Cufflinks exon 19492826 19492988 . - . gene_id "XLOC_009596"; transcript_id "TCONS_00009596"; exon_number "1"; oId "CUFF.9436.1"; tss_id "TSS9596"; +chr9 Cufflinks exon 19685041 19685078 . - . gene_id "XLOC_009597"; transcript_id "TCONS_00009597"; exon_number "1"; oId "CUFF.9437.1"; tss_id "TSS9597"; +chr9 Cufflinks exon 19728101 19728143 . - . gene_id "XLOC_009598"; transcript_id "TCONS_00009598"; exon_number "1"; oId "CUFF.9438.1"; tss_id "TSS9598"; +chr9 Cufflinks exon 22108405 22108440 . - . gene_id "XLOC_009599"; transcript_id "TCONS_00009599"; exon_number "1"; oId "CUFF.9442.1"; tss_id "TSS9599"; +chr9 Cufflinks exon 22302995 22303052 . - . gene_id "XLOC_009600"; transcript_id "TCONS_00009600"; exon_number "1"; oId "CUFF.9443.1"; tss_id "TSS9600"; +chr9 Cufflinks exon 25088912 25089149 . - . gene_id "XLOC_009601"; transcript_id "TCONS_00009601"; exon_number "1"; oId "CUFF.9444.1"; tss_id "TSS9601"; +chr9 Cufflinks exon 25784861 25784901 . - . gene_id "XLOC_009602"; transcript_id "TCONS_00009602"; exon_number "1"; oId "CUFF.9446.1"; tss_id "TSS9602"; +chr9 Cufflinks exon 26081082 26081194 . - . gene_id "XLOC_009603"; transcript_id "TCONS_00009603"; exon_number "1"; oId "CUFF.9447.1"; tss_id "TSS9603"; +chr9 Cufflinks exon 26676010 26676043 . - . gene_id "XLOC_009604"; transcript_id "TCONS_00009604"; exon_number "1"; oId "CUFF.9449.1"; tss_id "TSS9604"; +chr9 Cufflinks exon 30178470 30178576 . - . gene_id "XLOC_009605"; transcript_id "TCONS_00009605"; exon_number "1"; oId "CUFF.9455.1"; tss_id "TSS9605"; +chr9 Cufflinks exon 32254696 32254732 . - . gene_id "XLOC_009606"; transcript_id "TCONS_00009606"; exon_number "1"; oId "CUFF.9459.1"; tss_id "TSS9606"; +chr9 Cufflinks exon 33219985 33220031 . - . gene_id "XLOC_009607"; transcript_id "TCONS_00009607"; exon_number "1"; oId "CUFF.9462.1"; tss_id "TSS9607"; +chr9 Cufflinks exon 33418915 33418981 . - . gene_id "XLOC_009608"; transcript_id "TCONS_00009608"; exon_number "1"; oId "CUFF.9463.1"; tss_id "TSS9608"; +chr9 Cufflinks exon 34018259 34018318 . - . gene_id "XLOC_009609"; transcript_id "TCONS_00009609"; exon_number "1"; oId "CUFF.9466.1"; tss_id "TSS9609"; +chr9 Cufflinks exon 34206155 34206239 . - . gene_id "XLOC_009610"; transcript_id "TCONS_00009610"; exon_number "1"; oId "CUFF.9468.1"; tss_id "TSS9610"; +chr9 Cufflinks exon 34270865 34270920 . - . gene_id "XLOC_009611"; transcript_id "TCONS_00009611"; exon_number "1"; oId "CUFF.9469.1"; tss_id "TSS9611"; +chr9 Cufflinks exon 34282521 34282744 . - . gene_id "XLOC_009612"; transcript_id "TCONS_00009612"; exon_number "1"; oId "CUFF.9470.1"; tss_id "TSS9612"; +chr9 Cufflinks exon 35136126 35136182 . - . gene_id "XLOC_009613"; transcript_id "TCONS_00009613"; exon_number "1"; oId "CUFF.9473.1"; tss_id "TSS9613"; +chr9 Cufflinks exon 35195831 35195888 . - . gene_id "XLOC_009614"; transcript_id "TCONS_00009614"; exon_number "1"; oId "CUFF.9474.1"; tss_id "TSS9614"; +chr9 Cufflinks exon 37333855 37333921 . - . gene_id "XLOC_009615"; transcript_id "TCONS_00009615"; exon_number "1"; oId "CUFF.9478.1"; tss_id "TSS9615"; +chr9 Cufflinks exon 37421881 37421963 . - . gene_id "XLOC_009616"; transcript_id "TCONS_00009616"; exon_number "1"; oId "CUFF.9479.1"; tss_id "TSS9616"; +chr9 Cufflinks exon 37661813 37662046 . - . gene_id "XLOC_009617"; transcript_id "TCONS_00009617"; exon_number "1"; oId "CUFF.9480.1"; tss_id "TSS9617"; +chr9 Cufflinks exon 37936705 37936765 . - . gene_id "XLOC_009618"; transcript_id "TCONS_00009618"; exon_number "1"; oId "CUFF.9481.1"; tss_id "TSS9618"; +chr9 Cufflinks exon 38614366 38614443 . - . gene_id "XLOC_009619"; transcript_id "TCONS_00009619"; exon_number "1"; oId "CUFF.9484.1"; tss_id "TSS9619"; +chr9 Cufflinks exon 39280430 39280561 . - . gene_id "XLOC_009620"; transcript_id "TCONS_00009620"; exon_number "1"; oId "CUFF.9487.1"; tss_id "TSS9620"; +chr9 Cufflinks exon 39809680 39809811 . - . gene_id "XLOC_009621"; transcript_id "TCONS_00009621"; exon_number "1"; oId "CUFF.9489.1"; tss_id "TSS9621"; +chr9 Cufflinks exon 40626752 40626882 . - . gene_id "XLOC_009622"; transcript_id "TCONS_00009622"; exon_number "1"; oId "CUFF.9491.1"; tss_id "TSS9622"; +chr9 Cufflinks exon 42031860 42032158 . - . gene_id "XLOC_009623"; transcript_id "TCONS_00009623"; exon_number "1"; oId "CUFF.9492.1"; tss_id "TSS9623"; +chr9 Cufflinks exon 42931241 42931278 . - . gene_id "XLOC_009624"; transcript_id "TCONS_00009624"; exon_number "1"; oId "CUFF.9496.1"; tss_id "TSS9624"; +chr9 Cufflinks exon 43122800 43122905 . - . gene_id "XLOC_009625"; transcript_id "TCONS_00009625"; exon_number "1"; oId "CUFF.9497.1"; tss_id "TSS9625"; +chr9 Cufflinks exon 43802760 43803034 . - . gene_id "XLOC_009626"; transcript_id "TCONS_00009626"; exon_number "1"; oId "CUFF.9499.1"; tss_id "TSS9626"; +chr9 Cufflinks exon 44107814 44107919 . - . gene_id "XLOC_009627"; transcript_id "TCONS_00009627"; exon_number "1"; oId "CUFF.9500.1"; tss_id "TSS9627"; +chr9 Cufflinks exon 66266800 66266837 . - . gene_id "XLOC_009628"; transcript_id "TCONS_00009628"; exon_number "1"; oId "CUFF.9504.1"; tss_id "TSS9628"; +chr9 Cufflinks exon 66458142 66458262 . - . gene_id "XLOC_009629"; transcript_id "TCONS_00009629"; exon_number "1"; oId "CUFF.9505.1"; tss_id "TSS9629"; +chr9 Cufflinks exon 66712630 66712734 . - . gene_id "XLOC_009630"; transcript_id "TCONS_00009630"; exon_number "1"; oId "CUFF.9506.1"; tss_id "TSS9630"; +chr9 Cufflinks exon 67104237 67104274 . - . gene_id "XLOC_009631"; transcript_id "TCONS_00009631"; exon_number "1"; oId "CUFF.9507.1"; tss_id "TSS9631"; +chr9 Cufflinks exon 67858925 67859224 . - . gene_id "XLOC_009632"; transcript_id "TCONS_00009632"; exon_number "1"; oId "CUFF.9509.1"; tss_id "TSS9632"; +chr9 Cufflinks exon 68495386 68495472 . - . gene_id "XLOC_009633"; transcript_id "TCONS_00009633"; exon_number "1"; oId "CUFF.9513.1"; tss_id "TSS9633"; +chr9 Cufflinks exon 68495886 68496139 . - . gene_id "XLOC_009634"; transcript_id "TCONS_00009634"; exon_number "1"; oId "CUFF.9514.1"; tss_id "TSS9634"; +chr9 Cufflinks exon 69245308 69245342 . - . gene_id "XLOC_009635"; transcript_id "TCONS_00009635"; exon_number "1"; oId "CUFF.9519.1"; tss_id "TSS9635"; +chr9 Cufflinks exon 69892789 69892893 . - . gene_id "XLOC_009636"; transcript_id "TCONS_00009636"; exon_number "1"; oId "CUFF.9522.1"; tss_id "TSS9636"; +chr9 Cufflinks exon 70472804 70472838 . - . gene_id "XLOC_009637"; transcript_id "TCONS_00009637"; exon_number "1"; oId "CUFF.9523.1"; tss_id "TSS9637"; +chr9 Cufflinks exon 71550789 71550895 . - . gene_id "XLOC_009638"; transcript_id "TCONS_00009638"; exon_number "1"; oId "CUFF.9525.1"; tss_id "TSS9638"; +chr9 Cufflinks exon 71835185 71835226 . - . gene_id "XLOC_009639"; transcript_id "TCONS_00009639"; exon_number "1"; oId "CUFF.9526.1"; tss_id "TSS9639"; +chr9 Cufflinks exon 72470260 72470294 . - . gene_id "XLOC_009640"; transcript_id "TCONS_00009640"; exon_number "1"; oId "CUFF.9527.1"; tss_id "TSS9640"; +chr9 Cufflinks exon 72499318 72499558 . - . gene_id "XLOC_009641"; transcript_id "TCONS_00009641"; exon_number "1"; oId "CUFF.9528.1"; tss_id "TSS9641"; +chr9 Cufflinks exon 72569357 72569427 . - . gene_id "XLOC_009642"; transcript_id "TCONS_00009642"; exon_number "1"; oId "CUFF.9529.1"; tss_id "TSS9642"; +chr9 Cufflinks exon 72803491 72803666 . - . gene_id "XLOC_009643"; transcript_id "TCONS_00009643"; exon_number "1"; oId "CUFF.9530.1"; tss_id "TSS9643"; +chr9 Cufflinks exon 73194060 73194376 . - . gene_id "XLOC_009644"; transcript_id "TCONS_00009644"; exon_number "1"; oId "CUFF.9531.1"; tss_id "TSS9644"; +chr9 Cufflinks exon 74157908 74157937 . - . gene_id "XLOC_009645"; transcript_id "TCONS_00009645"; exon_number "1"; oId "CUFF.9532.1"; tss_id "TSS9645"; +chr9 Cufflinks exon 74901477 74901514 . - . gene_id "XLOC_009646"; transcript_id "TCONS_00009646"; exon_number "1"; oId "CUFF.9533.1"; tss_id "TSS9646"; +chr9 Cufflinks exon 74914669 74914749 . - . gene_id "XLOC_009647"; transcript_id "TCONS_00009647"; exon_number "1"; oId "CUFF.9534.1"; tss_id "TSS9647"; +chr9 Cufflinks exon 75254086 75254120 . - . gene_id "XLOC_009648"; transcript_id "TCONS_00009648"; exon_number "1"; oId "CUFF.9536.1"; tss_id "TSS9648"; +chr9 Cufflinks exon 76045222 76045262 . - . gene_id "XLOC_009649"; transcript_id "TCONS_00009649"; exon_number "1"; oId "CUFF.9537.1"; tss_id "TSS9649"; +chr9 Cufflinks exon 76365847 76365974 . - . gene_id "XLOC_009650"; transcript_id "TCONS_00009650"; exon_number "1"; oId "CUFF.9538.1"; tss_id "TSS9650"; +chr9 Cufflinks exon 77159654 77159765 . - . gene_id "XLOC_009651"; transcript_id "TCONS_00009651"; exon_number "1"; oId "CUFF.9540.1"; tss_id "TSS9651"; +chr9 Cufflinks exon 77517990 77518061 . - . gene_id "XLOC_009652"; transcript_id "TCONS_00009652"; exon_number "1"; oId "CUFF.9544.1"; tss_id "TSS9652"; +chr9 Cufflinks exon 79194900 79194934 . - . gene_id "XLOC_009653"; transcript_id "TCONS_00009653"; exon_number "1"; oId "CUFF.9549.1"; tss_id "TSS9653"; +chr9 Cufflinks exon 80250119 80250222 . - . gene_id "XLOC_009654"; transcript_id "TCONS_00009654"; exon_number "1"; oId "CUFF.9551.1"; tss_id "TSS9654"; +chr9 Cufflinks exon 80338346 80338379 . - . gene_id "XLOC_009655"; transcript_id "TCONS_00009655"; exon_number "1"; oId "CUFF.9552.1"; tss_id "TSS9655"; +chr9 Cufflinks exon 81503777 81503826 . - . gene_id "XLOC_009656"; transcript_id "TCONS_00009656"; exon_number "1"; oId "CUFF.9555.1"; tss_id "TSS9656"; +chr9 Cufflinks exon 82127490 82127526 . - . gene_id "XLOC_009657"; transcript_id "TCONS_00009657"; exon_number "1"; oId "CUFF.9556.1"; tss_id "TSS9657"; +chr9 Cufflinks exon 82887933 82887985 . - . gene_id "XLOC_009658"; transcript_id "TCONS_00009658"; exon_number "1"; oId "CUFF.9558.1"; tss_id "TSS9658"; +chr9 Cufflinks exon 84340165 84340264 . - . gene_id "XLOC_009659"; transcript_id "TCONS_00009659"; exon_number "1"; oId "CUFF.9561.1"; tss_id "TSS9659"; +chr9 Cufflinks exon 85173719 85173791 . - . gene_id "XLOC_009660"; transcript_id "TCONS_00009660"; exon_number "1"; oId "CUFF.9563.1"; tss_id "TSS9660"; +chr9 Cufflinks exon 85300019 85300055 . - . gene_id "XLOC_009661"; transcript_id "TCONS_00009661"; exon_number "1"; oId "CUFF.9564.1"; tss_id "TSS9661"; +chr9 Cufflinks exon 85547077 85547211 . - . gene_id "XLOC_009662"; transcript_id "TCONS_00009662"; exon_number "1"; oId "CUFF.9565.1"; tss_id "TSS9662"; +chr9 Cufflinks exon 85815916 85816134 . - . gene_id "XLOC_009663"; transcript_id "TCONS_00009663"; exon_number "1"; oId "CUFF.9567.1"; tss_id "TSS9663"; +chr9 Cufflinks exon 86211373 86211499 . - . gene_id "XLOC_009664"; transcript_id "TCONS_00009664"; exon_number "1"; oId "CUFF.9571.1"; tss_id "TSS9664"; +chr9 Cufflinks exon 87080203 87080238 . - . gene_id "XLOC_009665"; transcript_id "TCONS_00009665"; exon_number "1"; oId "CUFF.9574.1"; tss_id "TSS9665"; +chr9 Cufflinks exon 88082356 88082405 . - . gene_id "XLOC_009666"; transcript_id "TCONS_00009666"; exon_number "1"; oId "CUFF.9576.1"; tss_id "TSS9666"; +chr9 Cufflinks exon 88590243 88590278 . - . gene_id "XLOC_009667"; transcript_id "TCONS_00009667"; exon_number "1"; oId "CUFF.9578.1"; tss_id "TSS9667"; +chr9 Cufflinks exon 88873340 88873561 . - . gene_id "XLOC_009668"; transcript_id "TCONS_00009668"; exon_number "1"; oId "CUFF.9580.1"; tss_id "TSS9668"; +chr9 Cufflinks exon 89037856 89038043 . - . gene_id "XLOC_009669"; transcript_id "TCONS_00009669"; exon_number "1"; oId "CUFF.9581.1"; tss_id "TSS9669"; +chr9 Cufflinks exon 89315077 89315114 . - . gene_id "XLOC_009670"; transcript_id "TCONS_00009670"; exon_number "1"; oId "CUFF.9582.1"; tss_id "TSS9670"; +chr9 Cufflinks exon 90613146 90613250 . - . gene_id "XLOC_009671"; transcript_id "TCONS_00009671"; exon_number "1"; oId "CUFF.9585.1"; tss_id "TSS9671"; +chr9 Cufflinks exon 92899910 92899958 . - . gene_id "XLOC_009672"; transcript_id "TCONS_00009672"; exon_number "1"; oId "CUFF.9588.1"; tss_id "TSS9672"; +chr9 Cufflinks exon 93909954 93909992 . - . gene_id "XLOC_009673"; transcript_id "TCONS_00009673"; exon_number "1"; oId "CUFF.9589.1"; tss_id "TSS9673"; +chr9 Cufflinks exon 94097022 94097125 . - . gene_id "XLOC_009674"; transcript_id "TCONS_00009674"; exon_number "1"; oId "CUFF.9591.1"; tss_id "TSS9674"; +chr9 Cufflinks exon 94550154 94550192 . - . gene_id "XLOC_009675"; transcript_id "TCONS_00009675"; exon_number "1"; oId "CUFF.9592.1"; tss_id "TSS9675"; +chr9 Cufflinks exon 94907369 94907469 . - . gene_id "XLOC_009676"; transcript_id "TCONS_00009676"; exon_number "1"; oId "CUFF.9594.1"; tss_id "TSS9676"; +chr9 Cufflinks exon 96363082 96363173 . - . gene_id "XLOC_009677"; transcript_id "TCONS_00009677"; exon_number "1"; oId "CUFF.9598.1"; tss_id "TSS9677"; +chr9 Cufflinks exon 97904729 97904823 . - . gene_id "XLOC_009678"; transcript_id "TCONS_00009678"; exon_number "1"; oId "CUFF.9602.1"; tss_id "TSS9678"; +chr9 Cufflinks exon 97934778 97934881 . - . gene_id "XLOC_009679"; transcript_id "TCONS_00009679"; exon_number "1"; oId "CUFF.9603.1"; tss_id "TSS9679"; +chr9 Cufflinks exon 98329059 98329088 . - . gene_id "XLOC_009680"; transcript_id "TCONS_00009680"; exon_number "1"; oId "CUFF.9605.1"; tss_id "TSS9680"; +chr9 Cufflinks exon 99018498 99018601 . - . gene_id "XLOC_009681"; transcript_id "TCONS_00009681"; exon_number "1"; oId "CUFF.9608.1"; tss_id "TSS9681"; +chr9 Cufflinks exon 99955209 99955310 . - . gene_id "XLOC_009682"; transcript_id "TCONS_00009682"; exon_number "1"; oId "CUFF.9610.1"; tss_id "TSS9682"; +chr9 Cufflinks exon 100414945 100414983 . - . gene_id "XLOC_009683"; transcript_id "TCONS_00009683"; exon_number "1"; oId "CUFF.9612.1"; tss_id "TSS9683"; +chr9 Cufflinks exon 101908159 101908247 . - . gene_id "XLOC_009684"; transcript_id "TCONS_00009684"; exon_number "1"; oId "CUFF.9616.1"; tss_id "TSS9684"; +chr9 Cufflinks exon 101947841 101948148 . - . gene_id "XLOC_009685"; transcript_id "TCONS_00009685"; exon_number "1"; oId "CUFF.9617.1"; tss_id "TSS9685"; +chr9 Cufflinks exon 103343423 103343661 . - . gene_id "XLOC_009686"; transcript_id "TCONS_00009686"; exon_number "1"; oId "CUFF.9621.1"; tss_id "TSS9686"; +chr9 Cufflinks exon 106179837 106179876 . - . gene_id "XLOC_009687"; transcript_id "TCONS_00009687"; exon_number "1"; oId "CUFF.9624.1"; tss_id "TSS9687"; +chr9 Cufflinks exon 106451770 106451855 . - . gene_id "XLOC_009688"; transcript_id "TCONS_00009688"; exon_number "1"; oId "CUFF.9625.1"; tss_id "TSS9688"; +chr9 Cufflinks exon 107204099 107204235 . - . gene_id "XLOC_009689"; transcript_id "TCONS_00009689"; exon_number "1"; oId "CUFF.9629.1"; tss_id "TSS9689"; +chr9 Cufflinks exon 107595274 107595329 . - . gene_id "XLOC_009690"; transcript_id "TCONS_00009690"; exon_number "1"; oId "CUFF.9630.1"; tss_id "TSS9690"; +chr9 Cufflinks exon 107639715 107639767 . - . gene_id "XLOC_009691"; transcript_id "TCONS_00009691"; exon_number "1"; oId "CUFF.9631.1"; tss_id "TSS9691"; +chr9 Cufflinks exon 107774697 107774731 . - . gene_id "XLOC_009692"; transcript_id "TCONS_00009692"; exon_number "1"; oId "CUFF.9632.1"; tss_id "TSS9692"; +chr9 Cufflinks exon 109457653 109457688 . - . gene_id "XLOC_009693"; transcript_id "TCONS_00009693"; exon_number "1"; oId "CUFF.9636.1"; tss_id "TSS9693"; +chr9 Cufflinks exon 109548243 109548279 . - . gene_id "XLOC_009694"; transcript_id "TCONS_00009694"; exon_number "1"; oId "CUFF.9637.1"; tss_id "TSS9694"; +chr9 Cufflinks exon 109606058 109606147 . - . gene_id "XLOC_009695"; transcript_id "TCONS_00009695"; exon_number "1"; oId "CUFF.9638.1"; tss_id "TSS9695"; +chr9 Cufflinks exon 110237317 110237419 . - . gene_id "XLOC_009696"; transcript_id "TCONS_00009696"; exon_number "1"; oId "CUFF.9640.1"; tss_id "TSS9696"; +chr9 Cufflinks exon 110425422 110425527 . - . gene_id "XLOC_009697"; transcript_id "TCONS_00009697"; exon_number "1"; oId "CUFF.9641.1"; tss_id "TSS9697"; +chr9 Cufflinks exon 110560026 110560127 . - . gene_id "XLOC_009698"; transcript_id "TCONS_00009698"; exon_number "1"; oId "CUFF.9642.1"; tss_id "TSS9698"; +chr9 Cufflinks exon 110573891 110574195 . - . gene_id "XLOC_009699"; transcript_id "TCONS_00009699"; exon_number "1"; oId "CUFF.9643.1"; tss_id "TSS9699"; +chr9 Cufflinks exon 111958482 111958589 . - . gene_id "XLOC_009700"; transcript_id "TCONS_00009700"; exon_number "1"; oId "CUFF.9645.1"; tss_id "TSS9700"; +chr9 Cufflinks exon 111966511 111966607 . - . gene_id "XLOC_009701"; transcript_id "TCONS_00009701"; exon_number "1"; oId "CUFF.9646.1"; tss_id "TSS9701"; +chr9 Cufflinks exon 112555313 112555349 . - . gene_id "XLOC_009702"; transcript_id "TCONS_00009702"; exon_number "1"; oId "CUFF.9650.1"; tss_id "TSS9702"; +chr9 Cufflinks exon 113131872 113131978 . - . gene_id "XLOC_009703"; transcript_id "TCONS_00009703"; exon_number "1"; oId "CUFF.9654.1"; tss_id "TSS9703"; +chr9 Cufflinks exon 113301972 113302078 . - . gene_id "XLOC_009704"; transcript_id "TCONS_00009704"; exon_number "1"; oId "CUFF.9655.1"; tss_id "TSS9704"; +chr9 Cufflinks exon 113933328 113933409 . - . gene_id "XLOC_009705"; transcript_id "TCONS_00009705"; exon_number "1"; oId "CUFF.9658.1"; tss_id "TSS9705"; +chr9 Cufflinks exon 114173934 114174022 . - . gene_id "XLOC_009706"; transcript_id "TCONS_00009706"; exon_number "1"; oId "CUFF.9660.1"; tss_id "TSS9706"; +chr9 Cufflinks exon 114758916 114759019 . - . gene_id "XLOC_009707"; transcript_id "TCONS_00009707"; exon_number "1"; oId "CUFF.9663.1"; tss_id "TSS9707"; +chr9 Cufflinks exon 115004820 115005119 . - . gene_id "XLOC_009708"; transcript_id "TCONS_00009708"; exon_number "1"; oId "CUFF.9665.1"; tss_id "TSS9708"; +chr9 Cufflinks exon 115034858 115035086 . - . gene_id "XLOC_009709"; transcript_id "TCONS_00009709"; exon_number "1"; oId "CUFF.9668.1"; tss_id "TSS9709"; +chr9 Cufflinks exon 115192403 115192439 . - . gene_id "XLOC_009710"; transcript_id "TCONS_00009710"; exon_number "1"; oId "CUFF.9669.1"; tss_id "TSS9710"; +chr9 Cufflinks exon 116122251 116122311 . - . gene_id "XLOC_009711"; transcript_id "TCONS_00009711"; exon_number "1"; oId "CUFF.9672.1"; tss_id "TSS9711"; +chr9 Cufflinks exon 116140451 116140491 . - . gene_id "XLOC_009712"; transcript_id "TCONS_00009712"; exon_number "1"; oId "CUFF.9673.1"; tss_id "TSS9712"; +chr9 Cufflinks exon 116571898 116571930 . - . gene_id "XLOC_009713"; transcript_id "TCONS_00009713"; exon_number "1"; oId "CUFF.9674.1"; tss_id "TSS9713"; +chr9 Cufflinks exon 117312899 117312983 . - . gene_id "XLOC_009714"; transcript_id "TCONS_00009714"; exon_number "1"; oId "CUFF.9675.1"; tss_id "TSS9714"; +chr9 Cufflinks exon 117327559 117327633 . - . gene_id "XLOC_009715"; transcript_id "TCONS_00009715"; exon_number "1"; oId "CUFF.9676.1"; tss_id "TSS9715"; +chr9 Cufflinks exon 117341275 117341333 . - . gene_id "XLOC_009716"; transcript_id "TCONS_00009716"; exon_number "1"; oId "CUFF.9677.1"; tss_id "TSS9716"; +chr9 Cufflinks exon 120470275 120470380 . - . gene_id "XLOC_009717"; transcript_id "TCONS_00009717"; exon_number "1"; oId "CUFF.9682.1"; tss_id "TSS9717"; +chr9 Cufflinks exon 123117355 123117435 . - . gene_id "XLOC_009718"; transcript_id "TCONS_00009718"; exon_number "1"; oId "CUFF.9686.1"; tss_id "TSS9718"; +chr9 Cufflinks exon 123939073 123939118 . - . gene_id "XLOC_009719"; transcript_id "TCONS_00009719"; exon_number "1"; oId "CUFF.9689.1"; tss_id "TSS9719"; +chr9 Cufflinks exon 126813738 126813813 . - . gene_id "XLOC_009720"; transcript_id "TCONS_00009720"; exon_number "1"; oId "CUFF.9695.1"; tss_id "TSS9720"; +chr9 Cufflinks exon 127649760 127649828 . - . gene_id "XLOC_009721"; transcript_id "TCONS_00009721"; exon_number "1"; oId "CUFF.9698.1"; tss_id "TSS9721"; +chr9 Cufflinks exon 128066202 128066305 . - . gene_id "XLOC_009722"; transcript_id "TCONS_00009722"; exon_number "1"; oId "CUFF.9700.1"; tss_id "TSS9722"; +chr9 Cufflinks exon 128275173 128275485 . - . gene_id "XLOC_009723"; transcript_id "TCONS_00009723"; exon_number "1"; oId "CUFF.9702.1"; tss_id "TSS9723"; +chr9 Cufflinks exon 128437539 128437576 . - . gene_id "XLOC_009724"; transcript_id "TCONS_00009724"; exon_number "1"; oId "CUFF.9705.1"; tss_id "TSS9724"; +chr9 Cufflinks exon 130603429 130603496 . - . gene_id "XLOC_009725"; transcript_id "TCONS_00009725"; exon_number "1"; oId "CUFF.9707.1"; tss_id "TSS9725"; +chr9 Cufflinks exon 131020978 131021178 . - . gene_id "XLOC_009726"; transcript_id "TCONS_00009726"; exon_number "1"; oId "CUFF.9709.1"; tss_id "TSS9726"; +chr9 Cufflinks exon 131102355 131102445 . - . gene_id "XLOC_009727"; transcript_id "TCONS_00009727"; exon_number "1"; oId "CUFF.9710.1"; tss_id "TSS9727"; +chr9 Cufflinks exon 132132428 132132740 . - . gene_id "XLOC_009728"; transcript_id "TCONS_00009728"; exon_number "1"; oId "CUFF.9715.1"; tss_id "TSS9728"; +chr9 Cufflinks exon 132864067 132864240 . - . gene_id "XLOC_009729"; transcript_id "TCONS_00009729"; exon_number "1"; oId "CUFF.9716.1"; tss_id "TSS9729"; +chr9 Cufflinks exon 134064626 134064664 . - . gene_id "XLOC_009730"; transcript_id "TCONS_00009730"; exon_number "1"; oId "CUFF.9720.1"; tss_id "TSS9730"; +chr9 Cufflinks exon 134600560 134600854 . - . gene_id "XLOC_009731"; transcript_id "TCONS_00009731"; exon_number "1"; oId "CUFF.9721.1"; tss_id "TSS9731"; +chr9 Cufflinks exon 135774944 135775027 . - . gene_id "XLOC_009732"; transcript_id "TCONS_00009732"; exon_number "1"; oId "CUFF.9724.1"; tss_id "TSS9732"; +chr9 Cufflinks exon 138362323 138362381 . - . gene_id "XLOC_009733"; transcript_id "TCONS_00009733"; exon_number "1"; oId "CUFF.9729.1"; tss_id "TSS9733"; +chr9 Cufflinks exon 140017962 140018057 . - . gene_id "XLOC_009734"; transcript_id "TCONS_00009734"; exon_number "1"; oId "CUFF.9732.1"; tss_id "TSS9734"; +chr9_gl000198_random Cufflinks exon 85858 86113 . + . gene_id "XLOC_009735"; transcript_id "TCONS_00009735"; exon_number "1"; oId "CUFF.9736.1"; tss_id "TSS9735"; +chr9_gl000198_random Cufflinks exon 86336 86416 . + . gene_id "XLOC_009736"; transcript_id "TCONS_00009736"; exon_number "1"; oId "CUFF.9737.1"; tss_id "TSS9736"; +chrM Cufflinks exon 1 16570 . + . gene_id "XLOC_009737"; transcript_id "TCONS_00009737"; exon_number "1"; oId "CUFF.9738.1"; tss_id "TSS9737"; +chrM Cufflinks exon 1 16570 . - . gene_id "XLOC_009738"; transcript_id "TCONS_00009738"; exon_number "1"; oId "CUFF.9739.1"; tss_id "TSS9738"; +chrUn_gl000211 Cufflinks exon 113990 114086 . + . gene_id "XLOC_009739"; transcript_id "TCONS_00009739"; exon_number "1"; oId "CUFF.9741.1"; tss_id "TSS9739"; +chrUn_gl000211 Cufflinks exon 33447 33481 . - . gene_id "XLOC_009740"; transcript_id "TCONS_00009740"; exon_number "1"; oId "CUFF.9740.1"; tss_id "TSS9740"; +chrUn_gl000213 Cufflinks exon 127841 127946 . - . gene_id "XLOC_009741"; transcript_id "TCONS_00009741"; exon_number "1"; oId "CUFF.9742.1"; tss_id "TSS9741"; +chrUn_gl000216 Cufflinks exon 104119 104186 . + . gene_id "XLOC_009742"; transcript_id "TCONS_00009742"; exon_number "1"; oId "CUFF.9744.1"; tss_id "TSS9742"; +chrUn_gl000216 Cufflinks exon 88930 88995 . - . gene_id "XLOC_009743"; transcript_id "TCONS_00009743"; exon_number "1"; oId "CUFF.9743.1"; tss_id "TSS9743"; +chrUn_gl000219 Cufflinks exon 63649 63714 . + . gene_id "XLOC_009744"; transcript_id "TCONS_00009744"; exon_number "1"; oId "CUFF.9746.1"; tss_id "TSS9744"; +chrUn_gl000219 Cufflinks exon 82080 82126 . + . gene_id "XLOC_009745"; transcript_id "TCONS_00009745"; exon_number "1"; oId "CUFF.9747.1"; tss_id "TSS9745"; +chrUn_gl000219 Cufflinks exon 59489 59525 . - . gene_id "XLOC_009746"; transcript_id "TCONS_00009746"; exon_number "1"; oId "CUFF.9745.1"; tss_id "TSS9746"; +chrUn_gl000219 Cufflinks exon 143658 143741 . - . gene_id "XLOC_009747"; transcript_id "TCONS_00009747"; exon_number "1"; oId "CUFF.9748.1"; tss_id "TSS9747"; +chrUn_gl000219 Cufflinks exon 144122 144375 . - . gene_id "XLOC_009748"; transcript_id "TCONS_00009748"; exon_number "1"; oId "CUFF.9749.1"; tss_id "TSS9748"; +chrUn_gl000220 Cufflinks exon 95181 95223 . + . gene_id "XLOC_009749"; transcript_id "TCONS_00009749"; exon_number "1"; oId "CUFF.9750.1"; tss_id "TSS9749"; +chrUn_gl000220 Cufflinks exon 95531 96145 . + . gene_id "XLOC_009750"; transcript_id "TCONS_00009750"; exon_number "1"; oId "CUFF.9751.1"; tss_id "TSS9750"; +chrUn_gl000220 Cufflinks exon 99159 99197 . + . gene_id "XLOC_009751"; transcript_id "TCONS_00009751"; exon_number "1"; oId "CUFF.9752.1"; tss_id "TSS9751"; +chrUn_gl000220 Cufflinks exon 109078 110946 . + . gene_id "XLOC_009752"; transcript_id "TCONS_00009752"; exon_number "1"; oId "CUFF.9753.1"; tss_id "TSS9752"; +chrUn_gl000220 Cufflinks exon 113348 118417 . + . gene_id "XLOC_009753"; transcript_id "TCONS_00009753"; exon_number "1"; oId "CUFF.9754.1"; tss_id "TSS9753"; +chrUn_gl000220 Cufflinks exon 153050 154918 . + . gene_id "XLOC_009754"; transcript_id "TCONS_00009754"; exon_number "1"; oId "CUFF.9755.1"; tss_id "TSS9754"; +chrUn_gl000220 Cufflinks exon 157320 161802 . + . gene_id "XLOC_009755"; transcript_id "TCONS_00009755"; exon_number "1"; oId "CUFF.9756.1"; tss_id "TSS9755"; +chrUn_gl000223 Cufflinks exon 58454 58538 . + . gene_id "XLOC_009756"; transcript_id "TCONS_00009756"; exon_number "1"; oId "CUFF.9757.1"; tss_id "TSS9756"; +chrUn_gl000225 Cufflinks exon 183252 183317 . + . gene_id "XLOC_009757"; transcript_id "TCONS_00009757"; exon_number "1"; oId "CUFF.9758.1"; tss_id "TSS9757"; +chrUn_gl000228 Cufflinks exon 20113 20232 . + . gene_id "XLOC_009758"; transcript_id "TCONS_00009758"; exon_number "1"; oId "CUFF.9759.1"; tss_id "TSS9758"; +chrUn_gl000228 Cufflinks exon 22674 22794 . + . gene_id "XLOC_009759"; transcript_id "TCONS_00009759"; exon_number "1"; oId "CUFF.9760.1"; tss_id "TSS9759"; +chrUn_gl000229 Cufflinks exon 18171 19913 . + . gene_id "XLOC_009760"; transcript_id "TCONS_00009760"; exon_number "1"; oId "CUFF.9761.1"; tss_id "TSS9760"; +chrUn_gl000241 Cufflinks exon 4204 4267 . + . gene_id "XLOC_009761"; transcript_id "TCONS_00009761"; exon_number "1"; oId "CUFF.9762.1"; tss_id "TSS9761"; +chrUn_gl000241 Cufflinks exon 19260 19306 . + . gene_id "XLOC_009762"; transcript_id "TCONS_00009762"; exon_number "1"; oId "CUFF.9763.1"; tss_id "TSS9762"; +chrUn_gl000242 Cufflinks exon 7 57 . + . gene_id "XLOC_009763"; transcript_id "TCONS_00009763"; exon_number "1"; oId "CUFF.9764.1"; tss_id "TSS9763"; +chrX Cufflinks exon 2729941 2730024 . + . gene_id "XLOC_009764"; transcript_id "TCONS_00009764"; exon_number "1"; oId "CUFF.9768.1"; tss_id "TSS9764"; +chrX Cufflinks exon 3490898 3491001 . + . gene_id "XLOC_009765"; transcript_id "TCONS_00009765"; exon_number "1"; oId "CUFF.9771.1"; tss_id "TSS9765"; +chrX Cufflinks exon 7345128 7345163 . + . gene_id "XLOC_009766"; transcript_id "TCONS_00009766"; exon_number "1"; oId "CUFF.9780.1"; tss_id "TSS9766"; +chrX Cufflinks exon 7954977 7955014 . + . gene_id "XLOC_009767"; transcript_id "TCONS_00009767"; exon_number "1"; oId "CUFF.9782.1"; tss_id "TSS9767"; +chrX Cufflinks exon 9101870 9101989 . + . gene_id "XLOC_009768"; transcript_id "TCONS_00009768"; exon_number "1"; oId "CUFF.9783.1"; tss_id "TSS9768"; +chrX Cufflinks exon 9369857 9370003 . + . gene_id "XLOC_009769"; transcript_id "TCONS_00009769"; exon_number "1"; oId "CUFF.9784.1"; tss_id "TSS9769"; +chrX Cufflinks exon 9370342 9370509 . + . gene_id "XLOC_009770"; transcript_id "TCONS_00009770"; exon_number "1"; oId "CUFF.9785.1"; tss_id "TSS9770"; +chrX Cufflinks exon 9371977 9372053 . + . gene_id "XLOC_009771"; transcript_id "TCONS_00009771"; exon_number "1"; oId "CUFF.9786.1"; tss_id "TSS9771"; +chrX Cufflinks exon 9372224 9372328 . + . gene_id "XLOC_009772"; transcript_id "TCONS_00009772"; exon_number "1"; oId "CUFF.9787.1"; tss_id "TSS9772"; +chrX Cufflinks exon 9373155 9373204 . + . gene_id "XLOC_009773"; transcript_id "TCONS_00009773"; exon_number "1"; oId "CUFF.9788.1"; tss_id "TSS9773"; +chrX Cufflinks exon 9374199 9374278 . + . gene_id "XLOC_009774"; transcript_id "TCONS_00009774"; exon_number "1"; oId "CUFF.9789.1"; tss_id "TSS9774"; +chrX Cufflinks exon 9375131 9375180 . + . gene_id "XLOC_009775"; transcript_id "TCONS_00009775"; exon_number "1"; oId "CUFF.9790.1"; tss_id "TSS9775"; +chrX Cufflinks exon 9376061 9376176 . + . gene_id "XLOC_009776"; transcript_id "TCONS_00009776"; exon_number "1"; oId "CUFF.9791.1"; tss_id "TSS9776"; +chrX Cufflinks exon 9376993 9377108 . + . gene_id "XLOC_009777"; transcript_id "TCONS_00009777"; exon_number "1"; oId "CUFF.9792.1"; tss_id "TSS9777"; +chrX Cufflinks exon 9377924 9378029 . + . gene_id "XLOC_009778"; transcript_id "TCONS_00009778"; exon_number "1"; oId "CUFF.9793.1"; tss_id "TSS9778"; +chrX Cufflinks exon 9378968 9379047 . + . gene_id "XLOC_009779"; transcript_id "TCONS_00009779"; exon_number "1"; oId "CUFF.9794.1"; tss_id "TSS9779"; +chrX Cufflinks exon 9379900 9380015 . + . gene_id "XLOC_009780"; transcript_id "TCONS_00009780"; exon_number "1"; oId "CUFF.9795.1"; tss_id "TSS9780"; +chrX Cufflinks exon 9380946 9381024 . + . gene_id "XLOC_009781"; transcript_id "TCONS_00009781"; exon_number "1"; oId "CUFF.9796.1"; tss_id "TSS9781"; +chrX Cufflinks exon 9381990 9382069 . + . gene_id "XLOC_009782"; transcript_id "TCONS_00009782"; exon_number "1"; oId "CUFF.9797.1"; tss_id "TSS9782"; +chrX Cufflinks exon 9414480 9414554 . + . gene_id "XLOC_009783"; transcript_id "TCONS_00009783"; exon_number "1"; oId "CUFF.9798.1"; tss_id "TSS9783"; +chrX Cufflinks exon 10550857 10550959 . + . gene_id "XLOC_009784"; transcript_id "TCONS_00009784"; exon_number "1"; oId "CUFF.9800.1"; tss_id "TSS9784"; +chrX Cufflinks exon 10905988 10906177 . + . gene_id "XLOC_009785"; transcript_id "TCONS_00009785"; exon_number "1"; oId "CUFF.9801.1"; tss_id "TSS9785"; +chrX Cufflinks exon 12235532 12235584 . + . gene_id "XLOC_009786"; transcript_id "TCONS_00009786"; exon_number "1"; oId "CUFF.9803.1"; tss_id "TSS9786"; +chrX Cufflinks exon 13591997 13592054 . + . gene_id "XLOC_009787"; transcript_id "TCONS_00009787"; exon_number "1"; oId "CUFF.9807.1"; tss_id "TSS9787"; +chrX Cufflinks exon 13593758 13593957 . + . gene_id "XLOC_009788"; transcript_id "TCONS_00009788"; exon_number "1"; oId "CUFF.9808.1"; tss_id "TSS9788"; +chrX Cufflinks exon 13614355 13614593 . + . gene_id "XLOC_009789"; transcript_id "TCONS_00009789"; exon_number "1"; oId "CUFF.9809.1"; tss_id "TSS9789"; +chrX Cufflinks exon 13850239 13850373 . + . gene_id "XLOC_009790"; transcript_id "TCONS_00009790"; exon_number "1"; oId "CUFF.9810.1"; tss_id "TSS9790"; +chrX Cufflinks exon 15489380 15489414 . + . gene_id "XLOC_009791"; transcript_id "TCONS_00009791"; exon_number "1"; oId "CUFF.9813.1"; tss_id "TSS9791"; +chrX Cufflinks exon 15768325 15768380 . + . gene_id "XLOC_009792"; transcript_id "TCONS_00009792"; exon_number "1"; oId "CUFF.9816.1"; tss_id "TSS9792"; +chrX Cufflinks exon 16246659 16246689 . + . gene_id "XLOC_009793"; transcript_id "TCONS_00009793"; exon_number "1"; oId "CUFF.9818.1"; tss_id "TSS9793"; +chrX Cufflinks exon 16352366 16352409 . + . gene_id "XLOC_009794"; transcript_id "TCONS_00009794"; exon_number "1"; oId "CUFF.9819.1"; tss_id "TSS9794"; +chrX Cufflinks exon 16352807 16352903 . + . gene_id "XLOC_009795"; transcript_id "TCONS_00009795"; exon_number "1"; oId "CUFF.9820.1"; tss_id "TSS9795"; +chrX Cufflinks exon 16785968 16786026 . + . gene_id "XLOC_009796"; transcript_id "TCONS_00009796"; exon_number "1"; oId "CUFF.9822.1"; tss_id "TSS9796"; +chrX Cufflinks exon 17376057 17376159 . + . gene_id "XLOC_009797"; transcript_id "TCONS_00009797"; exon_number "1"; oId "CUFF.9824.1"; tss_id "TSS9797"; +chrX Cufflinks exon 17648358 17648399 . + . gene_id "XLOC_009798"; transcript_id "TCONS_00009798"; exon_number "1"; oId "CUFF.9825.1"; tss_id "TSS9798"; +chrX Cufflinks exon 17841806 17841847 . + . gene_id "XLOC_009799"; transcript_id "TCONS_00009799"; exon_number "1"; oId "CUFF.9826.1"; tss_id "TSS9799"; +chrX Cufflinks exon 19328632 19328687 . + . gene_id "XLOC_009800"; transcript_id "TCONS_00009800"; exon_number "1"; oId "CUFF.9832.1"; tss_id "TSS9800"; +chrX Cufflinks exon 20470232 20470341 . + . gene_id "XLOC_009801"; transcript_id "TCONS_00009801"; exon_number "1"; oId "CUFF.9833.1"; tss_id "TSS9801"; +chrX Cufflinks exon 21232755 21232861 . + . gene_id "XLOC_009802"; transcript_id "TCONS_00009802"; exon_number "1"; oId "CUFF.9835.1"; tss_id "TSS9802"; +chrX Cufflinks exon 21850104 21850135 . + . gene_id "XLOC_009803"; transcript_id "TCONS_00009803"; exon_number "1"; oId "CUFF.9836.1"; tss_id "TSS9803"; +chrX Cufflinks exon 21923062 21923094 . + . gene_id "XLOC_009804"; transcript_id "TCONS_00009804"; exon_number "1"; oId "CUFF.9837.1"; tss_id "TSS9804"; +chrX Cufflinks exon 22237297 22237395 . + . gene_id "XLOC_009805"; transcript_id "TCONS_00009805"; exon_number "1"; oId "CUFF.9838.1"; tss_id "TSS9805"; +chrX Cufflinks exon 22545953 22546058 . + . gene_id "XLOC_009806"; transcript_id "TCONS_00009806"; exon_number "1"; oId "CUFF.9839.1"; tss_id "TSS9806"; +chrX Cufflinks exon 22920210 22920248 . + . gene_id "XLOC_009807"; transcript_id "TCONS_00009807"; exon_number "1"; oId "CUFF.9842.1"; tss_id "TSS9807"; +chrX Cufflinks exon 23460829 23460864 . + . gene_id "XLOC_009808"; transcript_id "TCONS_00009808"; exon_number "1"; oId "CUFF.9843.1"; tss_id "TSS9808"; +chrX Cufflinks exon 23465834 23465884 . + . gene_id "XLOC_009809"; transcript_id "TCONS_00009809"; exon_number "1"; oId "CUFF.9844.1"; tss_id "TSS9809"; +chrX Cufflinks exon 23701207 23701278 . + . gene_id "XLOC_009810"; transcript_id "TCONS_00009810"; exon_number "1"; oId "CUFF.9847.1"; tss_id "TSS9810"; +chrX Cufflinks exon 23710434 23710468 . + . gene_id "XLOC_009811"; transcript_id "TCONS_00009811"; exon_number "1"; oId "CUFF.9848.1"; tss_id "TSS9811"; +chrX Cufflinks exon 24685237 24685271 . + . gene_id "XLOC_009812"; transcript_id "TCONS_00009812"; exon_number "1"; oId "CUFF.9853.1"; tss_id "TSS9812"; +chrX Cufflinks exon 26014417 26014547 . + . gene_id "XLOC_009813"; transcript_id "TCONS_00009813"; exon_number "1"; oId "CUFF.9856.1"; tss_id "TSS9813"; +chrX Cufflinks exon 26808262 26808393 . + . gene_id "XLOC_009814"; transcript_id "TCONS_00009814"; exon_number "1"; oId "CUFF.9858.1"; tss_id "TSS9814"; +chrX Cufflinks exon 27302349 27302392 . + . gene_id "XLOC_009815"; transcript_id "TCONS_00009815"; exon_number "1"; oId "CUFF.9859.1"; tss_id "TSS9815"; +chrX Cufflinks exon 27726520 27726605 . + . gene_id "XLOC_009816"; transcript_id "TCONS_00009816"; exon_number "1"; oId "CUFF.9861.1"; tss_id "TSS9816"; +chrX Cufflinks exon 28330835 28330886 . + . gene_id "XLOC_009817"; transcript_id "TCONS_00009817"; exon_number "1"; oId "CUFF.9863.1"; tss_id "TSS9817"; +chrX Cufflinks exon 28345202 28345237 . + . gene_id "XLOC_009818"; transcript_id "TCONS_00009818"; exon_number "1"; oId "CUFF.9864.1"; tss_id "TSS9818"; +chrX Cufflinks exon 28374669 28374877 . + . gene_id "XLOC_009819"; transcript_id "TCONS_00009819"; exon_number "1"; oId "CUFF.9865.1"; tss_id "TSS9819"; +chrX Cufflinks exon 28386797 28386868 . + . gene_id "XLOC_009820"; transcript_id "TCONS_00009820"; exon_number "1"; oId "CUFF.9866.1"; tss_id "TSS9820"; +chrX Cufflinks exon 28988854 28988926 . + . gene_id "XLOC_009821"; transcript_id "TCONS_00009821"; exon_number "1"; oId "CUFF.9867.1"; tss_id "TSS9821"; +chrX Cufflinks exon 29769567 29769623 . + . gene_id "XLOC_009822"; transcript_id "TCONS_00009822"; exon_number "1"; oId "CUFF.9869.1"; tss_id "TSS9822"; +chrX Cufflinks exon 30909186 30909341 . + . gene_id "XLOC_009823"; transcript_id "TCONS_00009823"; exon_number "1"; oId "CUFF.9871.1"; tss_id "TSS9823"; +chrX Cufflinks exon 31366309 31366379 . + . gene_id "XLOC_009824"; transcript_id "TCONS_00009824"; exon_number "1"; oId "CUFF.9873.1"; tss_id "TSS9824"; +chrX Cufflinks exon 32120182 32120271 . + . gene_id "XLOC_009825"; transcript_id "TCONS_00009825"; exon_number "1"; oId "CUFF.9874.1"; tss_id "TSS9825"; +chrX Cufflinks exon 32611589 32611734 . + . gene_id "XLOC_009826"; transcript_id "TCONS_00009826"; exon_number "1"; oId "CUFF.9876.1"; tss_id "TSS9826"; +chrX Cufflinks exon 34234075 34234164 . + . gene_id "XLOC_009827"; transcript_id "TCONS_00009827"; exon_number "1"; oId "CUFF.9879.1"; tss_id "TSS9827"; +chrX Cufflinks exon 34477606 34477644 . + . gene_id "XLOC_009828"; transcript_id "TCONS_00009828"; exon_number "1"; oId "CUFF.9880.1"; tss_id "TSS9828"; +chrX Cufflinks exon 35172411 35172539 . + . gene_id "XLOC_009829"; transcript_id "TCONS_00009829"; exon_number "1"; oId "CUFF.9881.1"; tss_id "TSS9829"; +chrX Cufflinks exon 35612331 35612390 . + . gene_id "XLOC_009830"; transcript_id "TCONS_00009830"; exon_number "1"; oId "CUFF.9883.1"; tss_id "TSS9830"; +chrX Cufflinks exon 37327296 37327345 . + . gene_id "XLOC_009831"; transcript_id "TCONS_00009831"; exon_number "1"; oId "CUFF.9887.1"; tss_id "TSS9831"; +chrX Cufflinks exon 37729362 37729468 . + . gene_id "XLOC_009832"; transcript_id "TCONS_00009832"; exon_number "1"; oId "CUFF.9888.1"; tss_id "TSS9832"; +chrX Cufflinks exon 37912829 37912870 . + . gene_id "XLOC_009833"; transcript_id "TCONS_00009833"; exon_number "1"; oId "CUFF.9889.1"; tss_id "TSS9833"; +chrX Cufflinks exon 38467469 38467528 . + . gene_id "XLOC_009834"; transcript_id "TCONS_00009834"; exon_number "1"; oId "CUFF.9891.1"; tss_id "TSS9834"; +chrX Cufflinks exon 39316300 39316349 . + . gene_id "XLOC_009835"; transcript_id "TCONS_00009835"; exon_number "1"; oId "CUFF.9893.1"; tss_id "TSS9835"; +chrX Cufflinks exon 40144348 40144455 . + . gene_id "XLOC_009836"; transcript_id "TCONS_00009836"; exon_number "1"; oId "CUFF.9895.1"; tss_id "TSS9836"; +chrX Cufflinks exon 40881496 40881530 . + . gene_id "XLOC_009837"; transcript_id "TCONS_00009837"; exon_number "1"; oId "CUFF.9897.1"; tss_id "TSS9837"; +chrX Cufflinks exon 41152051 41152140 . + . gene_id "XLOC_009838"; transcript_id "TCONS_00009838"; exon_number "1"; oId "CUFF.9898.1"; tss_id "TSS9838"; +chrX Cufflinks exon 41205174 41205306 . + . gene_id "XLOC_009839"; transcript_id "TCONS_00009839"; exon_number "1"; oId "CUFF.9900.1"; tss_id "TSS9839"; +chrX Cufflinks exon 42105286 42105326 . + . gene_id "XLOC_009840"; transcript_id "TCONS_00009840"; exon_number "1"; oId "CUFF.9908.1"; tss_id "TSS9840"; +chrX Cufflinks exon 44241312 44241355 . + . gene_id "XLOC_009841"; transcript_id "TCONS_00009841"; exon_number "1"; oId "CUFF.9913.1"; tss_id "TSS9841"; +chrX Cufflinks exon 44744751 44744811 . + . gene_id "XLOC_009842"; transcript_id "TCONS_00009842"; exon_number "1"; oId "CUFF.9917.1"; tss_id "TSS9842"; +chrX Cufflinks exon 45385270 45385307 . + . gene_id "XLOC_009843"; transcript_id "TCONS_00009843"; exon_number "1"; oId "CUFF.9919.1"; tss_id "TSS9843"; +chrX Cufflinks exon 46377214 46377285 . + . gene_id "XLOC_009844"; transcript_id "TCONS_00009844"; exon_number "1"; oId "CUFF.9920.1"; tss_id "TSS9844"; +chrX Cufflinks exon 46415105 46415159 . + . gene_id "XLOC_009845"; transcript_id "TCONS_00009845"; exon_number "1"; oId "CUFF.9921.1"; tss_id "TSS9845"; +chrX Cufflinks exon 46946905 46947011 . + . gene_id "XLOC_009846"; transcript_id "TCONS_00009846"; exon_number "1"; oId "CUFF.9922.1"; tss_id "TSS9846"; +chrX Cufflinks exon 47138526 47138632 . + . gene_id "XLOC_009847"; transcript_id "TCONS_00009847"; exon_number "1"; oId "CUFF.9923.1"; tss_id "TSS9847"; +chrX Cufflinks exon 47941135 47941242 . + . gene_id "XLOC_009848"; transcript_id "TCONS_00009848"; exon_number "1"; oId "CUFF.9928.1"; tss_id "TSS9848"; +chrX Cufflinks exon 48065693 48065783 . + . gene_id "XLOC_009849"; transcript_id "TCONS_00009849"; exon_number "1"; oId "CUFF.9930.1"; tss_id "TSS9849"; +chrX Cufflinks exon 48082887 48082929 . + . gene_id "XLOC_009850"; transcript_id "TCONS_00009850"; exon_number "1"; oId "CUFF.9931.1"; tss_id "TSS9850"; +chrX Cufflinks exon 48137936 48138041 . + . gene_id "XLOC_009851"; transcript_id "TCONS_00009851"; exon_number "1"; oId "CUFF.9933.1"; tss_id "TSS9851"; +chrX Cufflinks exon 48493262 48493303 . + . gene_id "XLOC_009852"; transcript_id "TCONS_00009852"; exon_number "1"; oId "CUFF.9937.1"; tss_id "TSS9852"; +chrX Cufflinks exon 48939687 48939825 . + . gene_id "XLOC_009853"; transcript_id "TCONS_00009853"; exon_number "1"; oId "CUFF.9941.1"; tss_id "TSS9853"; +chrX Cufflinks exon 49009001 49009288 . + . gene_id "XLOC_009854"; transcript_id "TCONS_00009854"; exon_number "1"; oId "CUFF.9942.1"; tss_id "TSS9854"; +chrX Cufflinks exon 50374801 50374837 . + . gene_id "XLOC_009855"; transcript_id "TCONS_00009855"; exon_number "1"; oId "CUFF.9944.1"; tss_id "TSS9855"; +chrX Cufflinks exon 50392639 50392740 . + . gene_id "XLOC_009856"; transcript_id "TCONS_00009856"; exon_number "1"; oId "CUFF.9945.1"; tss_id "TSS9856"; +chrX Cufflinks exon 52328184 52328259 . + . gene_id "XLOC_009857"; transcript_id "TCONS_00009857"; exon_number "1"; oId "CUFF.9953.1"; tss_id "TSS9857"; +chrX Cufflinks exon 52583670 52583748 . + . gene_id "XLOC_009858"; transcript_id "TCONS_00009858"; exon_number "1"; oId "CUFF.9954.1"; tss_id "TSS9858"; +chrX Cufflinks exon 52694281 52694371 . + . gene_id "XLOC_009859"; transcript_id "TCONS_00009859"; exon_number "1"; oId "CUFF.9955.1"; tss_id "TSS9859"; +chrX Cufflinks exon 52879904 52879971 . + . gene_id "XLOC_009860"; transcript_id "TCONS_00009860"; exon_number "1"; oId "CUFF.9956.1"; tss_id "TSS9860"; +chrX Cufflinks exon 53007927 53008002 . + . gene_id "XLOC_009861"; transcript_id "TCONS_00009861"; exon_number "1"; oId "CUFF.9957.1"; tss_id "TSS9861"; +chrX Cufflinks exon 53159664 53159722 . + . gene_id "XLOC_009862"; transcript_id "TCONS_00009862"; exon_number "1"; oId "CUFF.9958.1"; tss_id "TSS9862"; +chrX Cufflinks exon 53935488 53935597 . + . gene_id "XLOC_009863"; transcript_id "TCONS_00009863"; exon_number "1"; oId "CUFF.9960.1"; tss_id "TSS9863"; +chrX Cufflinks exon 54032486 54032525 . + . gene_id "XLOC_009864"; transcript_id "TCONS_00009864"; exon_number "1"; oId "CUFF.9961.1"; tss_id "TSS9864"; +chrX Cufflinks exon 54369979 54370085 . + . gene_id "XLOC_009865"; transcript_id "TCONS_00009865"; exon_number "1"; oId "CUFF.9964.1"; tss_id "TSS9865"; +chrX Cufflinks exon 54403621 54403690 . + . gene_id "XLOC_009866"; transcript_id "TCONS_00009866"; exon_number "1"; oId "CUFF.9965.1"; tss_id "TSS9866"; +chrX Cufflinks exon 54421920 54421954 . + . gene_id "XLOC_009867"; transcript_id "TCONS_00009867"; exon_number "1"; oId "CUFF.9966.1"; tss_id "TSS9867"; +chrX Cufflinks exon 55206666 55206737 . + . gene_id "XLOC_009868"; transcript_id "TCONS_00009868"; exon_number "1"; oId "CUFF.9968.1"; tss_id "TSS9868"; +chrX Cufflinks exon 56650340 56650373 . + . gene_id "XLOC_009869"; transcript_id "TCONS_00009869"; exon_number "1"; oId "CUFF.9971.1"; tss_id "TSS9869"; +chrX Cufflinks exon 57154523 57154687 . + . gene_id "XLOC_009870"; transcript_id "TCONS_00009870"; exon_number "1"; oId "CUFF.9972.1"; tss_id "TSS9870"; +chrX Cufflinks exon 57534511 57534574 . + . gene_id "XLOC_009871"; transcript_id "TCONS_00009871"; exon_number "1"; oId "CUFF.9973.1"; tss_id "TSS9871"; +chrX Cufflinks exon 62061914 62061982 . + . gene_id "XLOC_009872"; transcript_id "TCONS_00009872"; exon_number "1"; oId "CUFF.9976.1"; tss_id "TSS9872"; +chrX Cufflinks exon 63360950 63360991 . + . gene_id "XLOC_009873"; transcript_id "TCONS_00009873"; exon_number "1"; oId "CUFF.9978.1"; tss_id "TSS9873"; +chrX Cufflinks exon 63430571 63430876 . + . gene_id "XLOC_009874"; transcript_id "TCONS_00009874"; exon_number "1"; oId "CUFF.9979.1"; tss_id "TSS9874"; +chrX Cufflinks exon 68892323 68892443 . + . gene_id "XLOC_009875"; transcript_id "TCONS_00009875"; exon_number "1"; oId "CUFF.9988.1"; tss_id "TSS9875"; +chrX Cufflinks exon 68912800 68912998 . + . gene_id "XLOC_009876"; transcript_id "TCONS_00009876"; exon_number "1"; oId "CUFF.9989.1"; tss_id "TSS9876"; +chrX Cufflinks exon 69472893 69472980 . + . gene_id "XLOC_009877"; transcript_id "TCONS_00009877"; exon_number "1"; oId "CUFF.9991.1"; tss_id "TSS9877"; +chrX Cufflinks exon 69670729 69670875 . + . gene_id "XLOC_009878"; transcript_id "TCONS_00009878"; exon_number "1"; oId "CUFF.9992.1"; tss_id "TSS9878"; +chrX Cufflinks exon 69843473 69843516 . + . gene_id "XLOC_009879"; transcript_id "TCONS_00009879"; exon_number "1"; oId "CUFF.9994.1"; tss_id "TSS9879"; +chrX Cufflinks exon 70138186 70138220 . + . gene_id "XLOC_009880"; transcript_id "TCONS_00009880"; exon_number "1"; oId "CUFF.9996.1"; tss_id "TSS9880"; +chrX Cufflinks exon 70165965 70166011 . + . gene_id "XLOC_009881"; transcript_id "TCONS_00009881"; exon_number "1"; oId "CUFF.9997.1"; tss_id "TSS9881"; +chrX Cufflinks exon 70654815 70654855 . + . gene_id "XLOC_009882"; transcript_id "TCONS_00009882"; exon_number "1"; oId "CUFF.9999.1"; tss_id "TSS9882"; +chrX Cufflinks exon 71418418 71418909 . + . gene_id "XLOC_009883"; transcript_id "TCONS_00009883"; exon_number "1"; oId "CUFF.10003.1"; tss_id "TSS9883"; +chrX Cufflinks exon 73610527 73610844 . + . gene_id "XLOC_009884"; transcript_id "TCONS_00009884"; exon_number "1"; oId "CUFF.10011.1"; tss_id "TSS9884"; +chrX Cufflinks exon 73899889 73899994 . + . gene_id "XLOC_009885"; transcript_id "TCONS_00009885"; exon_number "1"; oId "CUFF.10013.1"; tss_id "TSS9885"; +chrX Cufflinks exon 74422538 74422643 . + . gene_id "XLOC_009886"; transcript_id "TCONS_00009886"; exon_number "1"; oId "CUFF.10015.1"; tss_id "TSS9886"; +chrX Cufflinks exon 75465367 75465472 . + . gene_id "XLOC_009887"; transcript_id "TCONS_00009887"; exon_number "1"; oId "CUFF.10017.1"; tss_id "TSS9887"; +chrX Cufflinks exon 76287130 76287250 . + . gene_id "XLOC_009888"; transcript_id "TCONS_00009888"; exon_number "1"; oId "CUFF.10020.1"; tss_id "TSS9888"; +chrX Cufflinks exon 77092697 77092734 . + . gene_id "XLOC_009889"; transcript_id "TCONS_00009889"; exon_number "1"; oId "CUFF.10022.1"; tss_id "TSS9889"; +chrX Cufflinks exon 77092787 77092892 . + . gene_id "XLOC_009890"; transcript_id "TCONS_00009890"; exon_number "1"; oId "CUFF.10023.1"; tss_id "TSS9890"; +chrX Cufflinks exon 77683199 77683234 . + . gene_id "XLOC_009891"; transcript_id "TCONS_00009891"; exon_number "1"; oId "CUFF.10024.1"; tss_id "TSS9891"; +chrX Cufflinks exon 80156285 80156362 . + . gene_id "XLOC_009892"; transcript_id "TCONS_00009892"; exon_number "1"; oId "CUFF.10025.1"; tss_id "TSS9892"; +chrX Cufflinks exon 80191933 80192036 . + . gene_id "XLOC_009893"; transcript_id "TCONS_00009893"; exon_number "1"; oId "CUFF.10026.1"; tss_id "TSS9893"; +chrX Cufflinks exon 81844227 81844319 . + . gene_id "XLOC_009894"; transcript_id "TCONS_00009894"; exon_number "1"; oId "CUFF.10030.1"; tss_id "TSS9894"; +chrX Cufflinks exon 81850266 81850513 . + . gene_id "XLOC_009895"; transcript_id "TCONS_00009895"; exon_number "1"; oId "CUFF.10031.1"; tss_id "TSS9895"; +chrX Cufflinks exon 83508946 83508979 . + . gene_id "XLOC_009896"; transcript_id "TCONS_00009896"; exon_number "1"; oId "CUFF.10033.1"; tss_id "TSS9896"; +chrX Cufflinks exon 85256927 85256960 . + . gene_id "XLOC_009897"; transcript_id "TCONS_00009897"; exon_number "1"; oId "CUFF.10035.1"; tss_id "TSS9897"; +chrX Cufflinks exon 85736038 85736130 . + . gene_id "XLOC_009898"; transcript_id "TCONS_00009898"; exon_number "1"; oId "CUFF.10036.1"; tss_id "TSS9898"; +chrX Cufflinks exon 86465295 86465326 . + . gene_id "XLOC_009899"; transcript_id "TCONS_00009899"; exon_number "1"; oId "CUFF.10037.1"; tss_id "TSS9899"; +chrX Cufflinks exon 88083254 88083341 . + . gene_id "XLOC_009900"; transcript_id "TCONS_00009900"; exon_number "1"; oId "CUFF.10040.1"; tss_id "TSS9900"; +chrX Cufflinks exon 88735758 88735943 . + . gene_id "XLOC_009901"; transcript_id "TCONS_00009901"; exon_number "1"; oId "CUFF.10042.1"; tss_id "TSS9901"; +chrX Cufflinks exon 88961690 88961761 . + . gene_id "XLOC_009902"; transcript_id "TCONS_00009902"; exon_number "1"; oId "CUFF.10043.1"; tss_id "TSS9902"; +chrX Cufflinks exon 90267099 90267178 . + . gene_id "XLOC_009903"; transcript_id "TCONS_00009903"; exon_number "1"; oId "CUFF.10045.1"; tss_id "TSS9903"; +chrX Cufflinks exon 91053092 91053278 . + . gene_id "XLOC_009904"; transcript_id "TCONS_00009904"; exon_number "1"; oId "CUFF.10046.1"; tss_id "TSS9904"; +chrX Cufflinks exon 91057945 91057977 . + . gene_id "XLOC_009905"; transcript_id "TCONS_00009905"; exon_number "1"; oId "CUFF.10047.1"; tss_id "TSS9905"; +chrX Cufflinks exon 93270552 93270587 . + . gene_id "XLOC_009906"; transcript_id "TCONS_00009906"; exon_number "1"; oId "CUFF.10049.1"; tss_id "TSS9906"; +chrX Cufflinks exon 94689373 94689407 . + . gene_id "XLOC_009907"; transcript_id "TCONS_00009907"; exon_number "1"; oId "CUFF.10050.1"; tss_id "TSS9907"; +chrX Cufflinks exon 94837063 94837152 . + . gene_id "XLOC_009908"; transcript_id "TCONS_00009908"; exon_number "1"; oId "CUFF.10051.1"; tss_id "TSS9908"; +chrX Cufflinks exon 95278359 95278669 . + . gene_id "XLOC_009909"; transcript_id "TCONS_00009909"; exon_number "1"; oId "CUFF.10054.1"; tss_id "TSS9909"; +chrX Cufflinks exon 95386857 95386953 . + . gene_id "XLOC_009910"; transcript_id "TCONS_00009910"; exon_number "1"; oId "CUFF.10055.1"; tss_id "TSS9910"; +chrX Cufflinks exon 96403596 96403673 . + . gene_id "XLOC_009911"; transcript_id "TCONS_00009911"; exon_number "1"; oId "CUFF.10062.1"; tss_id "TSS9911"; +chrX Cufflinks exon 96446357 96446392 . + . gene_id "XLOC_009912"; transcript_id "TCONS_00009912"; exon_number "1"; oId "CUFF.10063.1"; tss_id "TSS9912"; +chrX Cufflinks exon 96596046 96596359 . + . gene_id "XLOC_009913"; transcript_id "TCONS_00009913"; exon_number "1"; oId "CUFF.10064.1"; tss_id "TSS9913"; +chrX Cufflinks exon 96772867 96773262 . + . gene_id "XLOC_009914"; transcript_id "TCONS_00009914"; exon_number "1"; oId "CUFF.10065.1"; tss_id "TSS9914"; +chrX Cufflinks exon 98048690 98048766 . + . gene_id "XLOC_009915"; transcript_id "TCONS_00009915"; exon_number "1"; oId "CUFF.10066.1"; tss_id "TSS9915"; +chrX Cufflinks exon 98805095 98805175 . + . gene_id "XLOC_009916"; transcript_id "TCONS_00009916"; exon_number "1"; oId "CUFF.10068.1"; tss_id "TSS9916"; +chrX Cufflinks exon 100580392 100580494 . + . gene_id "XLOC_009917"; transcript_id "TCONS_00009917"; exon_number "1"; oId "CUFF.10074.1"; tss_id "TSS9917"; +chrX Cufflinks exon 100946553 100946655 . + . gene_id "XLOC_009918"; transcript_id "TCONS_00009918"; exon_number "1"; oId "CUFF.10076.1"; tss_id "TSS9918"; +chrX Cufflinks exon 101170563 101170668 . + . gene_id "XLOC_009919"; transcript_id "TCONS_00009919"; exon_number "1"; oId "CUFF.10077.1"; tss_id "TSS9919"; +chrX Cufflinks exon 101558219 101558257 . + . gene_id "XLOC_009920"; transcript_id "TCONS_00009920"; exon_number "1"; oId "CUFF.10078.1"; tss_id "TSS9920"; +chrX Cufflinks exon 102028129 102028199 . + . gene_id "XLOC_009921"; transcript_id "TCONS_00009921"; exon_number "1"; oId "CUFF.10081.1"; tss_id "TSS9921"; +chrX Cufflinks exon 102383347 102383381 . + . gene_id "XLOC_009922"; transcript_id "TCONS_00009922"; exon_number "1"; oId "CUFF.10084.1"; tss_id "TSS9922"; +chrX Cufflinks exon 103430610 103430652 . + . gene_id "XLOC_009923"; transcript_id "TCONS_00009923"; exon_number "1"; oId "CUFF.10087.1"; tss_id "TSS9923"; +chrX Cufflinks exon 105906395 105906432 . + . gene_id "XLOC_009924"; transcript_id "TCONS_00009924"; exon_number "1"; oId "CUFF.10091.1"; tss_id "TSS9924"; +chrX Cufflinks exon 106835550 106835588 . + . gene_id "XLOC_009925"; transcript_id "TCONS_00009925"; exon_number "1"; oId "CUFF.10093.1"; tss_id "TSS9925"; +chrX Cufflinks exon 106962551 106962592 . + . gene_id "XLOC_009926"; transcript_id "TCONS_00009926"; exon_number "1"; oId "CUFF.10095.1"; tss_id "TSS9926"; +chrX Cufflinks exon 108069996 108070097 . + . gene_id "XLOC_009927"; transcript_id "TCONS_00009927"; exon_number "1"; oId "CUFF.10096.1"; tss_id "TSS9927"; +chrX Cufflinks exon 108297349 108297830 . + . gene_id "XLOC_009928"; transcript_id "TCONS_00009928"; exon_number "1"; oId "CUFF.10097.1"; tss_id "TSS9928"; +chrX Cufflinks exon 108806347 108806418 . + . gene_id "XLOC_009929"; transcript_id "TCONS_00009929"; exon_number "1"; oId "CUFF.10098.1"; tss_id "TSS9929"; +chrX Cufflinks exon 109492157 109492192 . + . gene_id "XLOC_009930"; transcript_id "TCONS_00009930"; exon_number "1"; oId "CUFF.10100.1"; tss_id "TSS9930"; +chrX Cufflinks exon 110352300 110352336 . + . gene_id "XLOC_009931"; transcript_id "TCONS_00009931"; exon_number "1"; oId "CUFF.10101.1"; tss_id "TSS9931"; +chrX Cufflinks exon 112099111 112099404 . + . gene_id "XLOC_009932"; transcript_id "TCONS_00009932"; exon_number "1"; oId "CUFF.10109.1"; tss_id "TSS9932"; +chrX Cufflinks exon 112162360 112162454 . + . gene_id "XLOC_009933"; transcript_id "TCONS_00009933"; exon_number "1"; oId "CUFF.10110.1"; tss_id "TSS9933"; +chrX Cufflinks exon 112466301 112466370 . + . gene_id "XLOC_009934"; transcript_id "TCONS_00009934"; exon_number "1"; oId "CUFF.10113.1"; tss_id "TSS9934"; +chrX Cufflinks exon 113193214 113193365 . + . gene_id "XLOC_009935"; transcript_id "TCONS_00009935"; exon_number "1"; oId "CUFF.10117.1"; tss_id "TSS9935"; +chrX Cufflinks exon 114266990 114267090 . + . gene_id "XLOC_009936"; transcript_id "TCONS_00009936"; exon_number "1"; oId "CUFF.10120.1"; tss_id "TSS9936"; +chrX Cufflinks exon 115487797 115487843 . + . gene_id "XLOC_009937"; transcript_id "TCONS_00009937"; exon_number "1"; oId "CUFF.10123.1"; tss_id "TSS9937"; +chrX Cufflinks exon 115521102 115521246 . + . gene_id "XLOC_009938"; transcript_id "TCONS_00009938"; exon_number "1"; oId "CUFF.10124.1"; tss_id "TSS9938"; +chrX Cufflinks exon 116634116 116634153 . + . gene_id "XLOC_009939"; transcript_id "TCONS_00009939"; exon_number "1"; oId "CUFF.10128.1"; tss_id "TSS9939"; +chrX Cufflinks exon 117417496 117417565 . + . gene_id "XLOC_009940"; transcript_id "TCONS_00009940"; exon_number "1"; oId "CUFF.10130.1"; tss_id "TSS9940"; +chrX Cufflinks exon 118181148 118181229 . + . gene_id "XLOC_009941"; transcript_id "TCONS_00009941"; exon_number "1"; oId "CUFF.10131.1"; tss_id "TSS9941"; +chrX Cufflinks exon 118557705 118557868 . + . gene_id "XLOC_009942"; transcript_id "TCONS_00009942"; exon_number "1"; oId "CUFF.10132.1"; tss_id "TSS9942"; +chrX Cufflinks exon 118568482 118568801 . + . gene_id "XLOC_009943"; transcript_id "TCONS_00009943"; exon_number "1"; oId "CUFF.10133.1"; tss_id "TSS9943"; +chrX Cufflinks exon 119678169 119678275 . + . gene_id "XLOC_009944"; transcript_id "TCONS_00009944"; exon_number "1"; oId "CUFF.10136.1"; tss_id "TSS9944"; +chrX Cufflinks exon 119723296 119723361 . + . gene_id "XLOC_009945"; transcript_id "TCONS_00009945"; exon_number "1"; oId "CUFF.10137.1"; tss_id "TSS9945"; +chrX Cufflinks exon 121974279 121974497 . + . gene_id "XLOC_009946"; transcript_id "TCONS_00009946"; exon_number "1"; oId "CUFF.10139.1"; tss_id "TSS9946"; +chrX Cufflinks exon 122189565 122189601 . + . gene_id "XLOC_009947"; transcript_id "TCONS_00009947"; exon_number "1"; oId "CUFF.10140.1"; tss_id "TSS9947"; +chrX Cufflinks exon 122388042 122388084 . + . gene_id "XLOC_009948"; transcript_id "TCONS_00009948"; exon_number "1"; oId "CUFF.10141.1"; tss_id "TSS9948"; +chrX Cufflinks exon 122995845 122995906 . + . gene_id "XLOC_009949"; transcript_id "TCONS_00009949"; exon_number "1"; oId "CUFF.10144.1"; tss_id "TSS9949"; +chrX Cufflinks exon 123008309 123008378 . + . gene_id "XLOC_009950"; transcript_id "TCONS_00009950"; exon_number "1"; oId "CUFF.10145.1"; tss_id "TSS9950"; +chrX Cufflinks exon 123104775 123104805 . + . gene_id "XLOC_009951"; transcript_id "TCONS_00009951"; exon_number "1"; oId "CUFF.10146.1"; tss_id "TSS9951"; +chrX Cufflinks exon 123267143 123267230 . + . gene_id "XLOC_009952"; transcript_id "TCONS_00009952"; exon_number "1"; oId "CUFF.10148.1"; tss_id "TSS9952"; +chrX Cufflinks exon 123309747 123309812 . + . gene_id "XLOC_009953"; transcript_id "TCONS_00009953"; exon_number "1"; oId "CUFF.10149.1"; tss_id "TSS9953"; +chrX Cufflinks exon 124062392 124062469 . + . gene_id "XLOC_009954"; transcript_id "TCONS_00009954"; exon_number "1"; oId "CUFF.10152.1"; tss_id "TSS9954"; +chrX Cufflinks exon 125417731 125417774 . + . gene_id "XLOC_009955"; transcript_id "TCONS_00009955"; exon_number "1"; oId "CUFF.10153.1"; tss_id "TSS9955"; +chrX Cufflinks exon 127256763 127256798 . + . gene_id "XLOC_009956"; transcript_id "TCONS_00009956"; exon_number "1"; oId "CUFF.10154.1"; tss_id "TSS9956"; +chrX Cufflinks exon 128945690 128945745 . + . gene_id "XLOC_009957"; transcript_id "TCONS_00009957"; exon_number "1"; oId "CUFF.10158.1"; tss_id "TSS9957"; +chrX Cufflinks exon 129400678 129400752 . + . gene_id "XLOC_009958"; transcript_id "TCONS_00009958"; exon_number "1"; oId "CUFF.10160.1"; tss_id "TSS9958"; +chrX Cufflinks exon 134346372 134346423 . + . gene_id "XLOC_009959"; transcript_id "TCONS_00009959"; exon_number "1"; oId "CUFF.10176.1"; tss_id "TSS9959"; +chrX Cufflinks exon 135665399 135665498 . + . gene_id "XLOC_009960"; transcript_id "TCONS_00009960"; exon_number "1"; oId "CUFF.10179.1"; tss_id "TSS9960"; +chrX Cufflinks exon 135856158 135856259 . + . gene_id "XLOC_009961"; transcript_id "TCONS_00009961"; exon_number "1"; oId "CUFF.10181.1"; tss_id "TSS9961"; +chrX Cufflinks exon 136677424 136677729 . + . gene_id "XLOC_009962"; transcript_id "TCONS_00009962"; exon_number "1"; oId "CUFF.10183.1"; tss_id "TSS9962"; +chrX Cufflinks exon 137479626 137479716 . + . gene_id "XLOC_009963"; transcript_id "TCONS_00009963"; exon_number "1"; oId "CUFF.10186.1"; tss_id "TSS9963"; +chrX Cufflinks exon 139168017 139168309 . + . gene_id "XLOC_009964"; transcript_id "TCONS_00009964"; exon_number "1"; oId "CUFF.10189.1"; tss_id "TSS9964"; +chrX Cufflinks exon 139533314 139533371 . + . gene_id "XLOC_009965"; transcript_id "TCONS_00009965"; exon_number "1"; oId "CUFF.10190.1"; tss_id "TSS9965"; +chrX Cufflinks exon 139658558 139658607 . + . gene_id "XLOC_009966"; transcript_id "TCONS_00009966"; exon_number "1"; oId "CUFF.10191.1"; tss_id "TSS9966"; +chrX Cufflinks exon 139858393 139858607 . + . gene_id "XLOC_009967"; transcript_id "TCONS_00009967"; exon_number "1"; oId "CUFF.10192.1"; tss_id "TSS9967"; +chrX Cufflinks exon 141498839 141498959 . + . gene_id "XLOC_009968"; transcript_id "TCONS_00009968"; exon_number "1"; oId "CUFF.10194.1"; tss_id "TSS9968"; +chrX Cufflinks exon 142178133 142178461 . + . gene_id "XLOC_009969"; transcript_id "TCONS_00009969"; exon_number "1"; oId "CUFF.10195.1"; tss_id "TSS9969"; +chrX Cufflinks exon 142520759 142520830 . + . gene_id "XLOC_009970"; transcript_id "TCONS_00009970"; exon_number "1"; oId "CUFF.10198.1"; tss_id "TSS9970"; +chrX Cufflinks exon 144138628 144138867 . + . gene_id "XLOC_009971"; transcript_id "TCONS_00009971"; exon_number "1"; oId "CUFF.10200.1"; tss_id "TSS9971"; +chrX Cufflinks exon 146387010 146387050 . + . gene_id "XLOC_009972"; transcript_id "TCONS_00009972"; exon_number "1"; oId "CUFF.10202.1"; tss_id "TSS9972"; +chrX Cufflinks exon 146908801 146908902 . + . gene_id "XLOC_009973"; transcript_id "TCONS_00009973"; exon_number "1"; oId "CUFF.10204.1"; tss_id "TSS9973"; +chrX Cufflinks exon 146958987 146959054 . + . gene_id "XLOC_009974"; transcript_id "TCONS_00009974"; exon_number "1"; oId "CUFF.10205.1"; tss_id "TSS9974"; +chrX Cufflinks exon 147228609 147228673 . + . gene_id "XLOC_009975"; transcript_id "TCONS_00009975"; exon_number "1"; oId "CUFF.10207.1"; tss_id "TSS9975"; +chrX Cufflinks exon 148412435 148412490 . + . gene_id "XLOC_009976"; transcript_id "TCONS_00009976"; exon_number "1"; oId "CUFF.10209.1"; tss_id "TSS9976"; +chrX Cufflinks exon 149487423 149487500 . + . gene_id "XLOC_009977"; transcript_id "TCONS_00009977"; exon_number "1"; oId "CUFF.10210.1"; tss_id "TSS9977"; +chrX Cufflinks exon 149887752 149887898 . + . gene_id "XLOC_009978"; transcript_id "TCONS_00009978"; exon_number "1"; oId "CUFF.10211.1"; tss_id "TSS9978"; +chrX Cufflinks exon 149979747 149979821 . + . gene_id "XLOC_009979"; transcript_id "TCONS_00009979"; exon_number "1"; oId "CUFF.10212.1"; tss_id "TSS9979"; +chrX Cufflinks exon 150070594 150070674 . + . gene_id "XLOC_009980"; transcript_id "TCONS_00009980"; exon_number "1"; oId "CUFF.10213.1"; tss_id "TSS9980"; +chrX Cufflinks exon 152229917 152229962 . + . gene_id "XLOC_009981"; transcript_id "TCONS_00009981"; exon_number "1"; oId "CUFF.10218.1"; tss_id "TSS9981"; +chrX Cufflinks exon 152327380 152327425 . + . gene_id "XLOC_009982"; transcript_id "TCONS_00009982"; exon_number "1"; oId "CUFF.10219.1"; tss_id "TSS9982"; +chrX Cufflinks exon 152616930 152617036 . + . gene_id "XLOC_009983"; transcript_id "TCONS_00009983"; exon_number "1"; oId "CUFF.10220.1"; tss_id "TSS9983"; +chrX Cufflinks exon 152931688 152931990 . + . gene_id "XLOC_009984"; transcript_id "TCONS_00009984"; exon_number "1"; oId "CUFF.10222.1"; tss_id "TSS9984"; +chrX Cufflinks exon 153872077 153872110 . + . gene_id "XLOC_009985"; transcript_id "TCONS_00009985"; exon_number "1"; oId "CUFF.10226.1"; tss_id "TSS9985"; +chrX Cufflinks exon 154038626 154038660 . + . gene_id "XLOC_009986"; transcript_id "TCONS_00009986"; exon_number "1"; oId "CUFF.10227.1"; tss_id "TSS9986"; +chrX Cufflinks exon 155115087 155115130 . + . gene_id "XLOC_009987"; transcript_id "TCONS_00009987"; exon_number "1"; oId "CUFF.10229.1"; tss_id "TSS9987"; +chrX Cufflinks exon 363175 363212 . - . gene_id "XLOC_009988"; transcript_id "TCONS_00009988"; exon_number "1"; oId "CUFF.9765.1"; tss_id "TSS9988"; +chrX Cufflinks exon 1419147 1419257 . - . gene_id "XLOC_009989"; transcript_id "TCONS_00009989"; exon_number "1"; oId "CUFF.9766.1"; tss_id "TSS9989"; +chrX Cufflinks exon 1948797 1948836 . - . gene_id "XLOC_009990"; transcript_id "TCONS_00009990"; exon_number "1"; oId "CUFF.9767.1"; tss_id "TSS9990"; +chrX Cufflinks exon 2976241 2976543 . - . gene_id "XLOC_009991"; transcript_id "TCONS_00009991"; exon_number "1"; oId "CUFF.9769.1"; tss_id "TSS9991"; +chrX Cufflinks exon 3186633 3186665 . - . gene_id "XLOC_009992"; transcript_id "TCONS_00009992"; exon_number "1"; oId "CUFF.9770.1"; tss_id "TSS9992"; +chrX Cufflinks exon 3525299 3525406 . - . gene_id "XLOC_009993"; transcript_id "TCONS_00009993"; exon_number "1"; oId "CUFF.9772.1"; tss_id "TSS9993"; +chrX Cufflinks exon 3756417 3756491 . - . gene_id "XLOC_009994"; transcript_id "TCONS_00009994"; exon_number "1"; oId "CUFF.9773.1"; tss_id "TSS9994"; +chrX Cufflinks exon 3756833 3756905 . - . gene_id "XLOC_009995"; transcript_id "TCONS_00009995"; exon_number "1"; oId "CUFF.9774.1"; tss_id "TSS9995"; +chrX Cufflinks exon 3794841 3794915 . - . gene_id "XLOC_009996"; transcript_id "TCONS_00009996"; exon_number "1"; oId "CUFF.9775.1"; tss_id "TSS9996"; +chrX Cufflinks exon 3795257 3795329 . - . gene_id "XLOC_009997"; transcript_id "TCONS_00009997"; exon_number "1"; oId "CUFF.9776.1"; tss_id "TSS9997"; +chrX Cufflinks exon 3833270 3833344 . - . gene_id "XLOC_009998"; transcript_id "TCONS_00009998"; exon_number "1"; oId "CUFF.9777.1"; tss_id "TSS9998"; +chrX Cufflinks exon 3833686 3833758 . - . gene_id "XLOC_009999"; transcript_id "TCONS_00009999"; exon_number "1"; oId "CUFF.9778.1"; tss_id "TSS9999"; +chrX Cufflinks exon 5232256 5232299 . - . gene_id "XLOC_010000"; transcript_id "TCONS_00010000"; exon_number "1"; oId "CUFF.9779.1"; tss_id "TSS10000"; +chrX Cufflinks exon 7874947 7874981 . - . gene_id "XLOC_010001"; transcript_id "TCONS_00010001"; exon_number "1"; oId "CUFF.9781.1"; tss_id "TSS10001"; +chrX Cufflinks exon 10253784 10253820 . - . gene_id "XLOC_010002"; transcript_id "TCONS_00010002"; exon_number "1"; oId "CUFF.9799.1"; tss_id "TSS10002"; +chrX Cufflinks exon 11708760 11708837 . - . gene_id "XLOC_010003"; transcript_id "TCONS_00010003"; exon_number "1"; oId "CUFF.9802.1"; tss_id "TSS10003"; +chrX Cufflinks exon 12632199 12632316 . - . gene_id "XLOC_010004"; transcript_id "TCONS_00010004"; exon_number "1"; oId "CUFF.9804.1"; tss_id "TSS10004"; +chrX Cufflinks exon 12839747 12839790 . - . gene_id "XLOC_010005"; transcript_id "TCONS_00010005"; exon_number "1"; oId "CUFF.9805.1"; tss_id "TSS10005"; +chrX Cufflinks exon 13259724 13259760 . - . gene_id "XLOC_010006"; transcript_id "TCONS_00010006"; exon_number "1"; oId "CUFF.9806.1"; tss_id "TSS10006"; +chrX Cufflinks exon 14338040 14338075 . - . gene_id "XLOC_010007"; transcript_id "TCONS_00010007"; exon_number "1"; oId "CUFF.9811.1"; tss_id "TSS10007"; +chrX Cufflinks exon 14727843 14727883 . - . gene_id "XLOC_010008"; transcript_id "TCONS_00010008"; exon_number "1"; oId "CUFF.9812.1"; tss_id "TSS10008"; +chrX Cufflinks exon 15651440 15651477 . - . gene_id "XLOC_010009"; transcript_id "TCONS_00010009"; exon_number "1"; oId "CUFF.9814.1"; tss_id "TSS10009"; +chrX Cufflinks exon 15727103 15727139 . - . gene_id "XLOC_010010"; transcript_id "TCONS_00010010"; exon_number "1"; oId "CUFF.9815.1"; tss_id "TSS10010"; +chrX Cufflinks exon 15934312 15934426 . - . gene_id "XLOC_010011"; transcript_id "TCONS_00010011"; exon_number "1"; oId "CUFF.9817.1"; tss_id "TSS10011"; +chrX Cufflinks exon 16557228 16557553 . - . gene_id "XLOC_010012"; transcript_id "TCONS_00010012"; exon_number "1"; oId "CUFF.9821.1"; tss_id "TSS10012"; +chrX Cufflinks exon 16893323 16893390 . - . gene_id "XLOC_010013"; transcript_id "TCONS_00010013"; exon_number "1"; oId "CUFF.9823.1"; tss_id "TSS10013"; +chrX Cufflinks exon 18122279 18122309 . - . gene_id "XLOC_010014"; transcript_id "TCONS_00010014"; exon_number "1"; oId "CUFF.9827.1"; tss_id "TSS10014"; +chrX Cufflinks exon 18575037 18575069 . - . gene_id "XLOC_010015"; transcript_id "TCONS_00010015"; exon_number "1"; oId "CUFF.9828.1"; tss_id "TSS10015"; +chrX Cufflinks exon 18693029 18693101 . - . gene_id "XLOC_010016"; transcript_id "TCONS_00010016"; exon_number "1"; oId "CUFF.9829.1"; tss_id "TSS10016"; +chrX Cufflinks exon 18996335 18996372 . - . gene_id "XLOC_010017"; transcript_id "TCONS_00010017"; exon_number "1"; oId "CUFF.9830.1"; tss_id "TSS10017"; +chrX Cufflinks exon 19087323 19087394 . - . gene_id "XLOC_010018"; transcript_id "TCONS_00010018"; exon_number "1"; oId "CUFF.9831.1"; tss_id "TSS10018"; +chrX Cufflinks exon 20630297 20630333 . - . gene_id "XLOC_010019"; transcript_id "TCONS_00010019"; exon_number "1"; oId "CUFF.9834.1"; tss_id "TSS10019"; +chrX Cufflinks exon 22800343 22800378 . - . gene_id "XLOC_010020"; transcript_id "TCONS_00010020"; exon_number "1"; oId "CUFF.9840.1"; tss_id "TSS10020"; +chrX Cufflinks exon 22806494 22806532 . - . gene_id "XLOC_010021"; transcript_id "TCONS_00010021"; exon_number "1"; oId "CUFF.9841.1"; tss_id "TSS10021"; +chrX Cufflinks exon 23502792 23502831 . - . gene_id "XLOC_010022"; transcript_id "TCONS_00010022"; exon_number "1"; oId "CUFF.9845.1"; tss_id "TSS10022"; +chrX Cufflinks exon 23525325 23525431 . - . gene_id "XLOC_010023"; transcript_id "TCONS_00010023"; exon_number "1"; oId "CUFF.9846.1"; tss_id "TSS10023"; +chrX Cufflinks exon 24142311 24142435 . - . gene_id "XLOC_010024"; transcript_id "TCONS_00010024"; exon_number "1"; oId "CUFF.9849.1"; tss_id "TSS10024"; +chrX Cufflinks exon 24278725 24278805 . - . gene_id "XLOC_010025"; transcript_id "TCONS_00010025"; exon_number "1"; oId "CUFF.9850.1"; tss_id "TSS10025"; +chrX Cufflinks exon 24431522 24431554 . - . gene_id "XLOC_010026"; transcript_id "TCONS_00010026"; exon_number "1"; oId "CUFF.9851.1"; tss_id "TSS10026"; +chrX Cufflinks exon 24619982 24620020 . - . gene_id "XLOC_010027"; transcript_id "TCONS_00010027"; exon_number "1"; oId "CUFF.9852.1"; tss_id "TSS10027"; +chrX Cufflinks exon 25078749 25079056 . - . gene_id "XLOC_010028"; transcript_id "TCONS_00010028"; exon_number "1"; oId "CUFF.9854.1"; tss_id "TSS10028"; +chrX Cufflinks exon 25473572 25473771 . - . gene_id "XLOC_010029"; transcript_id "TCONS_00010029"; exon_number "1"; oId "CUFF.9855.1"; tss_id "TSS10029"; +chrX Cufflinks exon 26320527 26320578 . - . gene_id "XLOC_010030"; transcript_id "TCONS_00010030"; exon_number "1"; oId "CUFF.9857.1"; tss_id "TSS10030"; +chrX Cufflinks exon 27484652 27484686 . - . gene_id "XLOC_010031"; transcript_id "TCONS_00010031"; exon_number "1"; oId "CUFF.9860.1"; tss_id "TSS10031"; +chrX Cufflinks exon 28249052 28249270 . - . gene_id "XLOC_010032"; transcript_id "TCONS_00010032"; exon_number "1"; oId "CUFF.9862.1"; tss_id "TSS10032"; +chrX Cufflinks exon 29000967 29001087 . - . gene_id "XLOC_010033"; transcript_id "TCONS_00010033"; exon_number "1"; oId "CUFF.9868.1"; tss_id "TSS10033"; +chrX Cufflinks exon 30131389 30131417 . - . gene_id "XLOC_010034"; transcript_id "TCONS_00010034"; exon_number "1"; oId "CUFF.9870.1"; tss_id "TSS10034"; +chrX Cufflinks exon 31200594 31200733 . - . gene_id "XLOC_010035"; transcript_id "TCONS_00010035"; exon_number "1"; oId "CUFF.9872.1"; tss_id "TSS10035"; +chrX Cufflinks exon 32405335 32405372 . - . gene_id "XLOC_010036"; transcript_id "TCONS_00010036"; exon_number "1"; oId "CUFF.9875.1"; tss_id "TSS10036"; +chrX Cufflinks exon 32866021 32866123 . - . gene_id "XLOC_010037"; transcript_id "TCONS_00010037"; exon_number "1"; oId "CUFF.9877.1"; tss_id "TSS10037"; +chrX Cufflinks exon 33403824 33403926 . - . gene_id "XLOC_010038"; transcript_id "TCONS_00010038"; exon_number "1"; oId "CUFF.9878.1"; tss_id "TSS10038"; +chrX Cufflinks exon 35530131 35530254 . - . gene_id "XLOC_010039"; transcript_id "TCONS_00010039"; exon_number "1"; oId "CUFF.9882.1"; tss_id "TSS10039"; +chrX Cufflinks exon 35737808 35737843 . - . gene_id "XLOC_010040"; transcript_id "TCONS_00010040"; exon_number "1"; oId "CUFF.9884.1"; tss_id "TSS10040"; +chrX Cufflinks exon 36040056 36040162 . - . gene_id "XLOC_010041"; transcript_id "TCONS_00010041"; exon_number "1"; oId "CUFF.9885.1"; tss_id "TSS10041"; +chrX Cufflinks exon 36968628 36968693 . - . gene_id "XLOC_010042"; transcript_id "TCONS_00010042"; exon_number "1"; oId "CUFF.9886.1"; tss_id "TSS10042"; +chrX Cufflinks exon 38309128 38309164 . - . gene_id "XLOC_010043"; transcript_id "TCONS_00010043"; exon_number "1"; oId "CUFF.9890.1"; tss_id "TSS10043"; +chrX Cufflinks exon 38940433 38940538 . - . gene_id "XLOC_010044"; transcript_id "TCONS_00010044"; exon_number "1"; oId "CUFF.9892.1"; tss_id "TSS10044"; +chrX Cufflinks exon 39645757 39646077 . - . gene_id "XLOC_010045"; transcript_id "TCONS_00010045"; exon_number "1"; oId "CUFF.9894.1"; tss_id "TSS10045"; +chrX Cufflinks exon 40394755 40394814 . - . gene_id "XLOC_010046"; transcript_id "TCONS_00010046"; exon_number "1"; oId "CUFF.9896.1"; tss_id "TSS10046"; +chrX Cufflinks exon 41204815 41205129 . - . gene_id "XLOC_010047"; transcript_id "TCONS_00010047"; exon_number "1"; oId "CUFF.9899.1"; tss_id "TSS10047"; +chrX Cufflinks exon 41430176 41430282 . - . gene_id "XLOC_010048"; transcript_id "TCONS_00010048"; exon_number "1"; oId "CUFF.9901.1"; tss_id "TSS10048"; +chrX Cufflinks exon 41542412 41542719 . - . gene_id "XLOC_010049"; transcript_id "TCONS_00010049"; exon_number "1"; oId "CUFF.9902.1"; tss_id "TSS10049"; +chrX Cufflinks exon 41580091 41580126 . - . gene_id "XLOC_010050"; transcript_id "TCONS_00010050"; exon_number "1"; oId "CUFF.9903.1"; tss_id "TSS10050"; +chrX Cufflinks exon 41778509 41778597 . - . gene_id "XLOC_010051"; transcript_id "TCONS_00010051"; exon_number "1"; oId "CUFF.9904.1"; tss_id "TSS10051"; +chrX Cufflinks exon 41998682 41998783 . - . gene_id "XLOC_010052"; transcript_id "TCONS_00010052"; exon_number "1"; oId "CUFF.9905.1"; tss_id "TSS10052"; +chrX Cufflinks exon 42010011 42010076 . - . gene_id "XLOC_010053"; transcript_id "TCONS_00010053"; exon_number "1"; oId "CUFF.9906.1"; tss_id "TSS10053"; +chrX Cufflinks exon 42033532 42033638 . - . gene_id "XLOC_010054"; transcript_id "TCONS_00010054"; exon_number "1"; oId "CUFF.9907.1"; tss_id "TSS10054"; +chrX Cufflinks exon 42363381 42363484 . - . gene_id "XLOC_010055"; transcript_id "TCONS_00010055"; exon_number "1"; oId "CUFF.9909.1"; tss_id "TSS10055"; +chrX Cufflinks exon 42668301 42668373 . - . gene_id "XLOC_010056"; transcript_id "TCONS_00010056"; exon_number "1"; oId "CUFF.9910.1"; tss_id "TSS10056"; +chrX Cufflinks exon 42812421 42812489 . - . gene_id "XLOC_010057"; transcript_id "TCONS_00010057"; exon_number "1"; oId "CUFF.9911.1"; tss_id "TSS10057"; +chrX Cufflinks exon 43558176 43558207 . - . gene_id "XLOC_010058"; transcript_id "TCONS_00010058"; exon_number "1"; oId "CUFF.9912.1"; tss_id "TSS10058"; +chrX Cufflinks exon 44467495 44467530 . - . gene_id "XLOC_010059"; transcript_id "TCONS_00010059"; exon_number "1"; oId "CUFF.9914.1"; tss_id "TSS10059"; +chrX Cufflinks exon 44564653 44564703 . - . gene_id "XLOC_010060"; transcript_id "TCONS_00010060"; exon_number "1"; oId "CUFF.9915.1"; tss_id "TSS10060"; +chrX Cufflinks exon 44631998 44632308 . - . gene_id "XLOC_010061"; transcript_id "TCONS_00010061"; exon_number "1"; oId "CUFF.9916.1"; tss_id "TSS10061"; +chrX Cufflinks exon 44945044 44945081 . - . gene_id "XLOC_010062"; transcript_id "TCONS_00010062"; exon_number "1"; oId "CUFF.9918.1"; tss_id "TSS10062"; +chrX Cufflinks exon 47175512 47175577 . - . gene_id "XLOC_010063"; transcript_id "TCONS_00010063"; exon_number "1"; oId "CUFF.9924.1"; tss_id "TSS10063"; +chrX Cufflinks exon 47211263 47211348 . - . gene_id "XLOC_010064"; transcript_id "TCONS_00010064"; exon_number "1"; oId "CUFF.9925.1"; tss_id "TSS10064"; +chrX Cufflinks exon 47662114 47662171 . - . gene_id "XLOC_010065"; transcript_id "TCONS_00010065"; exon_number "1"; oId "CUFF.9926.1"; tss_id "TSS10065"; +chrX Cufflinks exon 47749439 47749802 . - . gene_id "XLOC_010066"; transcript_id "TCONS_00010066"; exon_number "1"; oId "CUFF.9927.1"; tss_id "TSS10066"; +chrX Cufflinks exon 48013423 48013502 . - . gene_id "XLOC_010067"; transcript_id "TCONS_00010067"; exon_number "1"; oId "CUFF.9929.1"; tss_id "TSS10067"; +chrX Cufflinks exon 48094788 48094887 . - . gene_id "XLOC_010068"; transcript_id "TCONS_00010068"; exon_number "1"; oId "CUFF.9932.1"; tss_id "TSS10068"; +chrX Cufflinks exon 48420088 48420190 . - . gene_id "XLOC_010069"; transcript_id "TCONS_00010069"; exon_number "1"; oId "CUFF.9934.1"; tss_id "TSS10069"; +chrX Cufflinks exon 48420549 48420630 . - . gene_id "XLOC_010070"; transcript_id "TCONS_00010070"; exon_number "1"; oId "CUFF.9935.1"; tss_id "TSS10070"; +chrX Cufflinks exon 48462960 48462994 . - . gene_id "XLOC_010071"; transcript_id "TCONS_00010071"; exon_number "1"; oId "CUFF.9936.1"; tss_id "TSS10071"; +chrX Cufflinks exon 48582867 48582966 . - . gene_id "XLOC_010072"; transcript_id "TCONS_00010072"; exon_number "1"; oId "CUFF.9938.1"; tss_id "TSS10072"; +chrX Cufflinks exon 48635380 48635485 . - . gene_id "XLOC_010073"; transcript_id "TCONS_00010073"; exon_number "1"; oId "CUFF.9939.1"; tss_id "TSS10073"; +chrX Cufflinks exon 48816445 48816543 . - . gene_id "XLOC_010074"; transcript_id "TCONS_00010074"; exon_number "1"; oId "CUFF.9940.1"; tss_id "TSS10074"; +chrX Cufflinks exon 49709962 49710053 . - . gene_id "XLOC_010075"; transcript_id "TCONS_00010075"; exon_number "1"; oId "CUFF.9943.1"; tss_id "TSS10075"; +chrX Cufflinks exon 50545676 50545733 . - . gene_id "XLOC_010076"; transcript_id "TCONS_00010076"; exon_number "1"; oId "CUFF.9946.1"; tss_id "TSS10076"; +chrX Cufflinks exon 50553205 50553258 . - . gene_id "XLOC_010077"; transcript_id "TCONS_00010077"; exon_number "1"; oId "CUFF.9947.1"; tss_id "TSS10077"; +chrX Cufflinks exon 50765915 50765983 . - . gene_id "XLOC_010078"; transcript_id "TCONS_00010078"; exon_number "1"; oId "CUFF.9948.1"; tss_id "TSS10078"; +chrX Cufflinks exon 51306114 51306183 . - . gene_id "XLOC_010079"; transcript_id "TCONS_00010079"; exon_number "1"; oId "CUFF.9949.1"; tss_id "TSS10079"; +chrX Cufflinks exon 51498586 51498641 . - . gene_id "XLOC_010080"; transcript_id "TCONS_00010080"; exon_number "1"; oId "CUFF.9950.1"; tss_id "TSS10080"; +chrX Cufflinks exon 51613813 51613905 . - . gene_id "XLOC_010081"; transcript_id "TCONS_00010081"; exon_number "1"; oId "CUFF.9951.1"; tss_id "TSS10081"; +chrX Cufflinks exon 52170915 52170990 . - . gene_id "XLOC_010082"; transcript_id "TCONS_00010082"; exon_number "1"; oId "CUFF.9952.1"; tss_id "TSS10082"; +chrX Cufflinks exon 53773055 53773103 . - . gene_id "XLOC_010083"; transcript_id "TCONS_00010083"; exon_number "1"; oId "CUFF.9959.1"; tss_id "TSS10083"; +chrX Cufflinks exon 54053348 54053383 . - . gene_id "XLOC_010084"; transcript_id "TCONS_00010084"; exon_number "1"; oId "CUFF.9962.1"; tss_id "TSS10084"; +chrX Cufflinks exon 54091328 54091399 . - . gene_id "XLOC_010085"; transcript_id "TCONS_00010085"; exon_number "1"; oId "CUFF.9963.1"; tss_id "TSS10085"; +chrX Cufflinks exon 54915959 54915993 . - . gene_id "XLOC_010086"; transcript_id "TCONS_00010086"; exon_number "1"; oId "CUFF.9967.1"; tss_id "TSS10086"; +chrX Cufflinks exon 55207755 55207829 . - . gene_id "XLOC_010087"; transcript_id "TCONS_00010087"; exon_number "1"; oId "CUFF.9969.1"; tss_id "TSS10087"; +chrX Cufflinks exon 55288040 55288080 . - . gene_id "XLOC_010088"; transcript_id "TCONS_00010088"; exon_number "1"; oId "CUFF.9970.1"; tss_id "TSS10088"; +chrX Cufflinks exon 57703137 57703196 . - . gene_id "XLOC_010089"; transcript_id "TCONS_00010089"; exon_number "1"; oId "CUFF.9974.1"; tss_id "TSS10089"; +chrX Cufflinks exon 57789061 57789110 . - . gene_id "XLOC_010090"; transcript_id "TCONS_00010090"; exon_number "1"; oId "CUFF.9975.1"; tss_id "TSS10090"; +chrX Cufflinks exon 63168484 63168528 . - . gene_id "XLOC_010091"; transcript_id "TCONS_00010091"; exon_number "1"; oId "CUFF.9977.1"; tss_id "TSS10091"; +chrX Cufflinks exon 64237839 64237866 . - . gene_id "XLOC_010092"; transcript_id "TCONS_00010092"; exon_number "1"; oId "CUFF.9980.1"; tss_id "TSS10092"; +chrX Cufflinks exon 64749286 64749322 . - . gene_id "XLOC_010093"; transcript_id "TCONS_00010093"; exon_number "1"; oId "CUFF.9981.1"; tss_id "TSS10093"; +chrX Cufflinks exon 65896102 65896205 . - . gene_id "XLOC_010094"; transcript_id "TCONS_00010094"; exon_number "1"; oId "CUFF.9982.1"; tss_id "TSS10094"; +chrX Cufflinks exon 66266919 66266974 . - . gene_id "XLOC_010095"; transcript_id "TCONS_00010095"; exon_number "1"; oId "CUFF.9983.1"; tss_id "TSS10095"; +chrX Cufflinks exon 67293911 67294037 . - . gene_id "XLOC_010096"; transcript_id "TCONS_00010096"; exon_number "1"; oId "CUFF.9984.1"; tss_id "TSS10096"; +chrX Cufflinks exon 67321910 67321972 . - . gene_id "XLOC_010097"; transcript_id "TCONS_00010097"; exon_number "1"; oId "CUFF.9985.1"; tss_id "TSS10097"; +chrX Cufflinks exon 67759285 67759391 . - . gene_id "XLOC_010098"; transcript_id "TCONS_00010098"; exon_number "1"; oId "CUFF.9986.1"; tss_id "TSS10098"; +chrX Cufflinks exon 67877941 67877995 . - . gene_id "XLOC_010099"; transcript_id "TCONS_00010099"; exon_number "1"; oId "CUFF.9987.1"; tss_id "TSS10099"; +chrX Cufflinks exon 69441850 69442166 . - . gene_id "XLOC_010100"; transcript_id "TCONS_00010100"; exon_number "1"; oId "CUFF.9990.1"; tss_id "TSS10100"; +chrX Cufflinks exon 69790569 69790600 . - . gene_id "XLOC_010101"; transcript_id "TCONS_00010101"; exon_number "1"; oId "CUFF.9993.1"; tss_id "TSS10101"; +chrX Cufflinks exon 70065930 70066145 . - . gene_id "XLOC_010102"; transcript_id "TCONS_00010102"; exon_number "1"; oId "CUFF.9995.1"; tss_id "TSS10102"; +chrX Cufflinks exon 70240126 70240283 . - . gene_id "XLOC_010103"; transcript_id "TCONS_00010103"; exon_number "1"; oId "CUFF.9998.1"; tss_id "TSS10103"; +chrX Cufflinks exon 70660385 70660494 . - . gene_id "XLOC_010104"; transcript_id "TCONS_00010104"; exon_number "1"; oId "CUFF.10000.1"; tss_id "TSS10104"; +chrX Cufflinks exon 70687170 70687256 . - . gene_id "XLOC_010105"; transcript_id "TCONS_00010105"; exon_number "1"; oId "CUFF.10001.1"; tss_id "TSS10105"; +chrX Cufflinks exon 71185822 71185927 . - . gene_id "XLOC_010106"; transcript_id "TCONS_00010106"; exon_number "1"; oId "CUFF.10002.1"; tss_id "TSS10106"; +chrX Cufflinks exon 71507419 71507453 . - . gene_id "XLOC_010107"; transcript_id "TCONS_00010107"; exon_number "1"; oId "CUFF.10004.1"; tss_id "TSS10107"; +chrX Cufflinks exon 71596833 71597018 . - . gene_id "XLOC_010108"; transcript_id "TCONS_00010108"; exon_number "1"; oId "CUFF.10005.1"; tss_id "TSS10108"; +chrX Cufflinks exon 71945975 71946188 . - . gene_id "XLOC_010109"; transcript_id "TCONS_00010109"; exon_number "1"; oId "CUFF.10006.1"; tss_id "TSS10109"; +chrX Cufflinks exon 71960533 71960693 . - . gene_id "XLOC_010110"; transcript_id "TCONS_00010110"; exon_number "1"; oId "CUFF.10007.1"; tss_id "TSS10110"; +chrX Cufflinks exon 72617370 72617473 . - . gene_id "XLOC_010111"; transcript_id "TCONS_00010111"; exon_number "1"; oId "CUFF.10008.1"; tss_id "TSS10111"; +chrX Cufflinks exon 73462444 73462739 . - . gene_id "XLOC_010112"; transcript_id "TCONS_00010112"; exon_number "1"; oId "CUFF.10009.1"; tss_id "TSS10112"; +chrX Cufflinks exon 73576007 73576044 . - . gene_id "XLOC_010113"; transcript_id "TCONS_00010113"; exon_number "1"; oId "CUFF.10010.1"; tss_id "TSS10113"; +chrX Cufflinks exon 73673427 73673691 . - . gene_id "XLOC_010114"; transcript_id "TCONS_00010114"; exon_number "1"; oId "CUFF.10012.1"; tss_id "TSS10114"; +chrX Cufflinks exon 74268637 74268728 . - . gene_id "XLOC_010115"; transcript_id "TCONS_00010115"; exon_number "1"; oId "CUFF.10014.1"; tss_id "TSS10115"; +chrX Cufflinks exon 74774452 74774487 . - . gene_id "XLOC_010116"; transcript_id "TCONS_00010116"; exon_number "1"; oId "CUFF.10016.1"; tss_id "TSS10116"; +chrX Cufflinks exon 75663776 75663807 . - . gene_id "XLOC_010117"; transcript_id "TCONS_00010117"; exon_number "1"; oId "CUFF.10018.1"; tss_id "TSS10117"; +chrX Cufflinks exon 75875439 75875528 . - . gene_id "XLOC_010118"; transcript_id "TCONS_00010118"; exon_number "1"; oId "CUFF.10019.1"; tss_id "TSS10118"; +chrX Cufflinks exon 76851713 76851758 . - . gene_id "XLOC_010119"; transcript_id "TCONS_00010119"; exon_number "1"; oId "CUFF.10021.1"; tss_id "TSS10119"; +chrX Cufflinks exon 80420327 80420363 . - . gene_id "XLOC_010120"; transcript_id "TCONS_00010120"; exon_number "1"; oId "CUFF.10027.1"; tss_id "TSS10120"; +chrX Cufflinks exon 80649908 80649949 . - . gene_id "XLOC_010121"; transcript_id "TCONS_00010121"; exon_number "1"; oId "CUFF.10028.1"; tss_id "TSS10121"; +chrX Cufflinks exon 81256669 81256776 . - . gene_id "XLOC_010122"; transcript_id "TCONS_00010122"; exon_number "1"; oId "CUFF.10029.1"; tss_id "TSS10122"; +chrX Cufflinks exon 82715093 82715129 . - . gene_id "XLOC_010123"; transcript_id "TCONS_00010123"; exon_number "1"; oId "CUFF.10032.1"; tss_id "TSS10123"; +chrX Cufflinks exon 84565080 84565156 . - . gene_id "XLOC_010124"; transcript_id "TCONS_00010124"; exon_number "1"; oId "CUFF.10034.1"; tss_id "TSS10124"; +chrX Cufflinks exon 87991725 87991813 . - . gene_id "XLOC_010125"; transcript_id "TCONS_00010125"; exon_number "1"; oId "CUFF.10038.1"; tss_id "TSS10125"; +chrX Cufflinks exon 88080386 88080423 . - . gene_id "XLOC_010126"; transcript_id "TCONS_00010126"; exon_number "1"; oId "CUFF.10039.1"; tss_id "TSS10126"; +chrX Cufflinks exon 88281804 88281848 . - . gene_id "XLOC_010127"; transcript_id "TCONS_00010127"; exon_number "1"; oId "CUFF.10041.1"; tss_id "TSS10127"; +chrX Cufflinks exon 89852236 89852339 . - . gene_id "XLOC_010128"; transcript_id "TCONS_00010128"; exon_number "1"; oId "CUFF.10044.1"; tss_id "TSS10128"; +chrX Cufflinks exon 93258832 93258921 . - . gene_id "XLOC_010129"; transcript_id "TCONS_00010129"; exon_number "1"; oId "CUFF.10048.1"; tss_id "TSS10129"; +chrX Cufflinks exon 94874889 94874959 . - . gene_id "XLOC_010130"; transcript_id "TCONS_00010130"; exon_number "1"; oId "CUFF.10052.1"; tss_id "TSS10130"; +chrX Cufflinks exon 94971797 94971870 . - . gene_id "XLOC_010131"; transcript_id "TCONS_00010131"; exon_number "1"; oId "CUFF.10053.1"; tss_id "TSS10131"; +chrX Cufflinks exon 95514403 95514453 . - . gene_id "XLOC_010132"; transcript_id "TCONS_00010132"; exon_number "1"; oId "CUFF.10056.1"; tss_id "TSS10132"; +chrX Cufflinks exon 95614490 95614536 . - . gene_id "XLOC_010133"; transcript_id "TCONS_00010133"; exon_number "1"; oId "CUFF.10057.1"; tss_id "TSS10133"; +chrX Cufflinks exon 95665549 95665781 . - . gene_id "XLOC_010134"; transcript_id "TCONS_00010134"; exon_number "1"; oId "CUFF.10058.1"; tss_id "TSS10134"; +chrX Cufflinks exon 95685574 95685609 . - . gene_id "XLOC_010135"; transcript_id "TCONS_00010135"; exon_number "1"; oId "CUFF.10059.1"; tss_id "TSS10135"; +chrX Cufflinks exon 95688528 95688628 . - . gene_id "XLOC_010136"; transcript_id "TCONS_00010136"; exon_number "1"; oId "CUFF.10060.1"; tss_id "TSS10136"; +chrX Cufflinks exon 96138970 96139008 . - . gene_id "XLOC_010137"; transcript_id "TCONS_00010137"; exon_number "1"; oId "CUFF.10061.1"; tss_id "TSS10137"; +chrX Cufflinks exon 98153087 98153123 . - . gene_id "XLOC_010138"; transcript_id "TCONS_00010138"; exon_number "1"; oId "CUFF.10067.1"; tss_id "TSS10138"; +chrX Cufflinks exon 98955370 98955404 . - . gene_id "XLOC_010139"; transcript_id "TCONS_00010139"; exon_number "1"; oId "CUFF.10069.1"; tss_id "TSS10139"; +chrX Cufflinks exon 98955729 98955833 . - . gene_id "XLOC_010140"; transcript_id "TCONS_00010140"; exon_number "1"; oId "CUFF.10070.1"; tss_id "TSS10140"; +chrX Cufflinks exon 99220427 99220464 . - . gene_id "XLOC_010141"; transcript_id "TCONS_00010141"; exon_number "1"; oId "CUFF.10071.1"; tss_id "TSS10141"; +chrX Cufflinks exon 99282426 99282464 . - . gene_id "XLOC_010142"; transcript_id "TCONS_00010142"; exon_number "1"; oId "CUFF.10072.1"; tss_id "TSS10142"; +chrX Cufflinks exon 100323925 100323963 . - . gene_id "XLOC_010143"; transcript_id "TCONS_00010143"; exon_number "1"; oId "CUFF.10073.1"; tss_id "TSS10143"; +chrX Cufflinks exon 100888994 100889100 . - . gene_id "XLOC_010144"; transcript_id "TCONS_00010144"; exon_number "1"; oId "CUFF.10075.1"; tss_id "TSS10144"; +chrX Cufflinks exon 101638740 101638778 . - . gene_id "XLOC_010145"; transcript_id "TCONS_00010145"; exon_number "1"; oId "CUFF.10079.1"; tss_id "TSS10145"; +chrX Cufflinks exon 101933635 101933741 . - . gene_id "XLOC_010146"; transcript_id "TCONS_00010146"; exon_number "1"; oId "CUFF.10080.1"; tss_id "TSS10146"; +chrX Cufflinks exon 102041599 102041670 . - . gene_id "XLOC_010147"; transcript_id "TCONS_00010147"; exon_number "1"; oId "CUFF.10082.1"; tss_id "TSS10147"; +chrX Cufflinks exon 102052020 102052088 . - . gene_id "XLOC_010148"; transcript_id "TCONS_00010148"; exon_number "1"; oId "CUFF.10083.1"; tss_id "TSS10148"; +chrX Cufflinks exon 103105752 103105841 . - . gene_id "XLOC_010149"; transcript_id "TCONS_00010149"; exon_number "1"; oId "CUFF.10085.1"; tss_id "TSS10149"; +chrX Cufflinks exon 103168691 103168742 . - . gene_id "XLOC_010150"; transcript_id "TCONS_00010150"; exon_number "1"; oId "CUFF.10086.1"; tss_id "TSS10150"; +chrX Cufflinks exon 104764860 104764894 . - . gene_id "XLOC_010151"; transcript_id "TCONS_00010151"; exon_number "1"; oId "CUFF.10088.1"; tss_id "TSS10151"; +chrX Cufflinks exon 104920064 104920170 . - . gene_id "XLOC_010152"; transcript_id "TCONS_00010152"; exon_number "1"; oId "CUFF.10089.1"; tss_id "TSS10152"; +chrX Cufflinks exon 105184140 105184180 . - . gene_id "XLOC_010153"; transcript_id "TCONS_00010153"; exon_number "1"; oId "CUFF.10090.1"; tss_id "TSS10153"; +chrX Cufflinks exon 106247101 106247152 . - . gene_id "XLOC_010154"; transcript_id "TCONS_00010154"; exon_number "1"; oId "CUFF.10092.1"; tss_id "TSS10154"; +chrX Cufflinks exon 106938597 106938633 . - . gene_id "XLOC_010155"; transcript_id "TCONS_00010155"; exon_number "1"; oId "CUFF.10094.1"; tss_id "TSS10155"; +chrX Cufflinks exon 109119905 109119963 . - . gene_id "XLOC_010156"; transcript_id "TCONS_00010156"; exon_number "1"; oId "CUFF.10099.1"; tss_id "TSS10156"; +chrX Cufflinks exon 110664764 110664835 . - . gene_id "XLOC_010157"; transcript_id "TCONS_00010157"; exon_number "1"; oId "CUFF.10102.1"; tss_id "TSS10157"; +chrX Cufflinks exon 110703078 110703144 . - . gene_id "XLOC_010158"; transcript_id "TCONS_00010158"; exon_number "1"; oId "CUFF.10103.1"; tss_id "TSS10158"; +chrX Cufflinks exon 110913056 110913176 . - . gene_id "XLOC_010159"; transcript_id "TCONS_00010159"; exon_number "1"; oId "CUFF.10104.1"; tss_id "TSS10159"; +chrX Cufflinks exon 111077476 111077536 . - . gene_id "XLOC_010160"; transcript_id "TCONS_00010160"; exon_number "1"; oId "CUFF.10105.1"; tss_id "TSS10160"; +chrX Cufflinks exon 111077675 111077861 . - . gene_id "XLOC_010161"; transcript_id "TCONS_00010161"; exon_number "1"; oId "CUFF.10106.1"; tss_id "TSS10161"; +chrX Cufflinks exon 111113923 111113959 . - . gene_id "XLOC_010162"; transcript_id "TCONS_00010162"; exon_number "1"; oId "CUFF.10107.1"; tss_id "TSS10162"; +chrX Cufflinks exon 111874881 111874925 . - . gene_id "XLOC_010163"; transcript_id "TCONS_00010163"; exon_number "1"; oId "CUFF.10108.1"; tss_id "TSS10163"; +chrX Cufflinks exon 112244244 112244356 . - . gene_id "XLOC_010164"; transcript_id "TCONS_00010164"; exon_number "1"; oId "CUFF.10111.1"; tss_id "TSS10164"; +chrX Cufflinks exon 112256145 112256182 . - . gene_id "XLOC_010165"; transcript_id "TCONS_00010165"; exon_number "1"; oId "CUFF.10112.1"; tss_id "TSS10165"; +chrX Cufflinks exon 112576667 112576721 . - . gene_id "XLOC_010166"; transcript_id "TCONS_00010166"; exon_number "1"; oId "CUFF.10114.1"; tss_id "TSS10166"; +chrX Cufflinks exon 112708554 112708624 . - . gene_id "XLOC_010167"; transcript_id "TCONS_00010167"; exon_number "1"; oId "CUFF.10115.1"; tss_id "TSS10167"; +chrX Cufflinks exon 113187478 113187691 . - . gene_id "XLOC_010168"; transcript_id "TCONS_00010168"; exon_number "1"; oId "CUFF.10116.1"; tss_id "TSS10168"; +chrX Cufflinks exon 113219591 113219893 . - . gene_id "XLOC_010169"; transcript_id "TCONS_00010169"; exon_number "1"; oId "CUFF.10118.1"; tss_id "TSS10169"; +chrX Cufflinks exon 113377508 113377557 . - . gene_id "XLOC_010170"; transcript_id "TCONS_00010170"; exon_number "1"; oId "CUFF.10119.1"; tss_id "TSS10170"; +chrX Cufflinks exon 115108789 115109095 . - . gene_id "XLOC_010171"; transcript_id "TCONS_00010171"; exon_number "1"; oId "CUFF.10121.1"; tss_id "TSS10171"; +chrX Cufflinks exon 115426989 115427025 . - . gene_id "XLOC_010172"; transcript_id "TCONS_00010172"; exon_number "1"; oId "CUFF.10122.1"; tss_id "TSS10172"; +chrX Cufflinks exon 115532008 115532113 . - . gene_id "XLOC_010173"; transcript_id "TCONS_00010173"; exon_number "1"; oId "CUFF.10125.1"; tss_id "TSS10173"; +chrX Cufflinks exon 115984807 115984913 . - . gene_id "XLOC_010174"; transcript_id "TCONS_00010174"; exon_number "1"; oId "CUFF.10126.1"; tss_id "TSS10174"; +chrX Cufflinks exon 116134850 116134890 . - . gene_id "XLOC_010175"; transcript_id "TCONS_00010175"; exon_number "1"; oId "CUFF.10127.1"; tss_id "TSS10175"; +chrX Cufflinks exon 117333912 117334190 . - . gene_id "XLOC_010176"; transcript_id "TCONS_00010176"; exon_number "1"; oId "CUFF.10129.1"; tss_id "TSS10176"; +chrX Cufflinks exon 119491878 119491918 . - . gene_id "XLOC_010177"; transcript_id "TCONS_00010177"; exon_number "1"; oId "CUFF.10134.1"; tss_id "TSS10177"; +chrX Cufflinks exon 119636893 119636950 . - . gene_id "XLOC_010178"; transcript_id "TCONS_00010178"; exon_number "1"; oId "CUFF.10135.1"; tss_id "TSS10178"; +chrX Cufflinks exon 120302181 120302229 . - . gene_id "XLOC_010179"; transcript_id "TCONS_00010179"; exon_number "1"; oId "CUFF.10138.1"; tss_id "TSS10179"; +chrX Cufflinks exon 122764884 122765043 . - . gene_id "XLOC_010180"; transcript_id "TCONS_00010180"; exon_number "1"; oId "CUFF.10142.1"; tss_id "TSS10180"; +chrX Cufflinks exon 122905930 122905987 . - . gene_id "XLOC_010181"; transcript_id "TCONS_00010181"; exon_number "1"; oId "CUFF.10143.1"; tss_id "TSS10181"; +chrX Cufflinks exon 123197332 123197374 . - . gene_id "XLOC_010182"; transcript_id "TCONS_00010182"; exon_number "1"; oId "CUFF.10147.1"; tss_id "TSS10182"; +chrX Cufflinks exon 123312640 123312705 . - . gene_id "XLOC_010183"; transcript_id "TCONS_00010183"; exon_number "1"; oId "CUFF.10150.1"; tss_id "TSS10183"; +chrX Cufflinks exon 123685043 123685081 . - . gene_id "XLOC_010184"; transcript_id "TCONS_00010184"; exon_number "1"; oId "CUFF.10151.1"; tss_id "TSS10184"; +chrX Cufflinks exon 128570508 128570624 . - . gene_id "XLOC_010185"; transcript_id "TCONS_00010185"; exon_number "1"; oId "CUFF.10155.1"; tss_id "TSS10185"; +chrX Cufflinks exon 128733732 128733773 . - . gene_id "XLOC_010186"; transcript_id "TCONS_00010186"; exon_number "1"; oId "CUFF.10156.1"; tss_id "TSS10186"; +chrX Cufflinks exon 128896279 128896320 . - . gene_id "XLOC_010187"; transcript_id "TCONS_00010187"; exon_number "1"; oId "CUFF.10157.1"; tss_id "TSS10187"; +chrX Cufflinks exon 129094708 129094784 . - . gene_id "XLOC_010188"; transcript_id "TCONS_00010188"; exon_number "1"; oId "CUFF.10159.1"; tss_id "TSS10188"; +chrX Cufflinks exon 129444004 129444152 . - . gene_id "XLOC_010189"; transcript_id "TCONS_00010189"; exon_number "1"; oId "CUFF.10161.1"; tss_id "TSS10189"; +chrX Cufflinks exon 130268048 130268363 . - . gene_id "XLOC_010190"; transcript_id "TCONS_00010190"; exon_number "1"; oId "CUFF.10162.1"; tss_id "TSS10190"; +chrX Cufflinks exon 130511388 130511430 . - . gene_id "XLOC_010191"; transcript_id "TCONS_00010191"; exon_number "1"; oId "CUFF.10163.1"; tss_id "TSS10191"; +chrX Cufflinks exon 131035060 131035121 . - . gene_id "XLOC_010192"; transcript_id "TCONS_00010192"; exon_number "1"; oId "CUFF.10164.1"; tss_id "TSS10192"; +chrX Cufflinks exon 131072895 131072983 . - . gene_id "XLOC_010193"; transcript_id "TCONS_00010193"; exon_number "1"; oId "CUFF.10165.1"; tss_id "TSS10193"; +chrX Cufflinks exon 131714156 131714251 . - . gene_id "XLOC_010194"; transcript_id "TCONS_00010194"; exon_number "1"; oId "CUFF.10166.1"; tss_id "TSS10194"; +chrX Cufflinks exon 132372682 132372844 . - . gene_id "XLOC_010195"; transcript_id "TCONS_00010195"; exon_number "1"; oId "CUFF.10167.1"; tss_id "TSS10195"; +chrX Cufflinks exon 132665751 132665854 . - . gene_id "XLOC_010196"; transcript_id "TCONS_00010196"; exon_number "1"; oId "CUFF.10168.1"; tss_id "TSS10196"; +chrX Cufflinks exon 132709343 132709406 . - . gene_id "XLOC_010197"; transcript_id "TCONS_00010197"; exon_number "1"; oId "CUFF.10169.1"; tss_id "TSS10197"; +chrX Cufflinks exon 133660311 133660450 . - . gene_id "XLOC_010198"; transcript_id "TCONS_00010198"; exon_number "1"; oId "CUFF.10170.1"; tss_id "TSS10198"; +chrX Cufflinks exon 133894236 133894378 . - . gene_id "XLOC_010199"; transcript_id "TCONS_00010199"; exon_number "1"; oId "CUFF.10171.1"; tss_id "TSS10199"; +chrX Cufflinks exon 134052340 134052446 . - . gene_id "XLOC_010200"; transcript_id "TCONS_00010200"; exon_number "1"; oId "CUFF.10172.1"; tss_id "TSS10200"; +chrX Cufflinks exon 134108837 134108891 . - . gene_id "XLOC_010201"; transcript_id "TCONS_00010201"; exon_number "1"; oId "CUFF.10173.1"; tss_id "TSS10201"; +chrX Cufflinks exon 134293945 134294017 . - . gene_id "XLOC_010202"; transcript_id "TCONS_00010202"; exon_number "1"; oId "CUFF.10174.1"; tss_id "TSS10202"; +chrX Cufflinks exon 134317162 134317234 . - . gene_id "XLOC_010203"; transcript_id "TCONS_00010203"; exon_number "1"; oId "CUFF.10175.1"; tss_id "TSS10203"; +chrX Cufflinks exon 134562091 134562209 . - . gene_id "XLOC_010204"; transcript_id "TCONS_00010204"; exon_number "1"; oId "CUFF.10177.1"; tss_id "TSS10204"; +chrX Cufflinks exon 135216473 135216579 . - . gene_id "XLOC_010205"; transcript_id "TCONS_00010205"; exon_number "1"; oId "CUFF.10178.1"; tss_id "TSS10205"; +chrX Cufflinks exon 135845099 135845162 . - . gene_id "XLOC_010206"; transcript_id "TCONS_00010206"; exon_number "1"; oId "CUFF.10180.1"; tss_id "TSS10206"; +chrX Cufflinks exon 136136105 136136142 . - . gene_id "XLOC_010207"; transcript_id "TCONS_00010207"; exon_number "1"; oId "CUFF.10182.1"; tss_id "TSS10207"; +chrX Cufflinks exon 136723256 136723330 . - . gene_id "XLOC_010208"; transcript_id "TCONS_00010208"; exon_number "1"; oId "CUFF.10184.1"; tss_id "TSS10208"; +chrX Cufflinks exon 136770061 136770153 . - . gene_id "XLOC_010209"; transcript_id "TCONS_00010209"; exon_number "1"; oId "CUFF.10185.1"; tss_id "TSS10209"; +chrX Cufflinks exon 137739864 137739899 . - . gene_id "XLOC_010210"; transcript_id "TCONS_00010210"; exon_number "1"; oId "CUFF.10187.1"; tss_id "TSS10210"; +chrX Cufflinks exon 138784443 138784550 . - . gene_id "XLOC_010211"; transcript_id "TCONS_00010211"; exon_number "1"; oId "CUFF.10188.1"; tss_id "TSS10211"; +chrX Cufflinks exon 140212215 140212321 . - . gene_id "XLOC_010212"; transcript_id "TCONS_00010212"; exon_number "1"; oId "CUFF.10193.1"; tss_id "TSS10212"; +chrX Cufflinks exon 142285141 142285377 . - . gene_id "XLOC_010213"; transcript_id "TCONS_00010213"; exon_number "1"; oId "CUFF.10196.1"; tss_id "TSS10213"; +chrX Cufflinks exon 142403854 142403879 . - . gene_id "XLOC_010214"; transcript_id "TCONS_00010214"; exon_number "1"; oId "CUFF.10197.1"; tss_id "TSS10214"; +chrX Cufflinks exon 142521818 142521889 . - . gene_id "XLOC_010215"; transcript_id "TCONS_00010215"; exon_number "1"; oId "CUFF.10199.1"; tss_id "TSS10215"; +chrX Cufflinks exon 145509001 145509090 . - . gene_id "XLOC_010216"; transcript_id "TCONS_00010216"; exon_number "1"; oId "CUFF.10201.1"; tss_id "TSS10216"; +chrX Cufflinks exon 146645766 146645803 . - . gene_id "XLOC_010217"; transcript_id "TCONS_00010217"; exon_number "1"; oId "CUFF.10203.1"; tss_id "TSS10217"; +chrX Cufflinks exon 147089619 147089734 . - . gene_id "XLOC_010218"; transcript_id "TCONS_00010218"; exon_number "1"; oId "CUFF.10206.1"; tss_id "TSS10218"; +chrX Cufflinks exon 147903688 147903972 . - . gene_id "XLOC_010219"; transcript_id "TCONS_00010219"; exon_number "1"; oId "CUFF.10208.1"; tss_id "TSS10219"; +chrX Cufflinks exon 150123971 150124060 . - . gene_id "XLOC_010220"; transcript_id "TCONS_00010220"; exon_number "1"; oId "CUFF.10214.1"; tss_id "TSS10220"; +chrX Cufflinks exon 150194789 150194876 . - . gene_id "XLOC_010221"; transcript_id "TCONS_00010221"; exon_number "1"; oId "CUFF.10215.1"; tss_id "TSS10221"; +chrX Cufflinks exon 151419048 151419147 . - . gene_id "XLOC_010222"; transcript_id "TCONS_00010222"; exon_number "1"; oId "CUFF.10216.1"; tss_id "TSS10222"; +chrX Cufflinks exon 152125931 152125997 . - . gene_id "XLOC_010223"; transcript_id "TCONS_00010223"; exon_number "1"; oId "CUFF.10217.1"; tss_id "TSS10223"; +chrX Cufflinks exon 152716636 152716676 . - . gene_id "XLOC_010224"; transcript_id "TCONS_00010224"; exon_number "1"; oId "CUFF.10221.1"; tss_id "TSS10224"; +chrX Cufflinks exon 153724150 153724463 . - . gene_id "XLOC_010225"; transcript_id "TCONS_00010225"; exon_number "1"; oId "CUFF.10223.1"; tss_id "TSS10225"; +chrX Cufflinks exon 153724602 153724819 . - . gene_id "XLOC_010226"; transcript_id "TCONS_00010226"; exon_number "1"; oId "CUFF.10224.1"; tss_id "TSS10226"; +chrX Cufflinks exon 153788817 153788850 . - . gene_id "XLOC_010227"; transcript_id "TCONS_00010227"; exon_number "1"; oId "CUFF.10225.1"; tss_id "TSS10227"; +chrX Cufflinks exon 154774668 154774708 . - . gene_id "XLOC_010228"; transcript_id "TCONS_00010228"; exon_number "1"; oId "CUFF.10228.1"; tss_id "TSS10228"; +chrX Cufflinks exon 155191073 155191110 . - . gene_id "XLOC_010229"; transcript_id "TCONS_00010229"; exon_number "1"; oId "CUFF.10230.1"; tss_id "TSS10229"; +chrY Cufflinks exon 2652793 2652894 . + . gene_id "XLOC_010230"; transcript_id "TCONS_00010230"; exon_number "1"; oId "CUFF.10234.1"; tss_id "TSS10230"; +chrY Cufflinks exon 3004990 3005175 . + . gene_id "XLOC_010231"; transcript_id "TCONS_00010231"; exon_number "1"; oId "CUFF.10235.1"; tss_id "TSS10231"; +chrY Cufflinks exon 3235817 3235889 . + . gene_id "XLOC_010232"; transcript_id "TCONS_00010232"; exon_number "1"; oId "CUFF.10236.1"; tss_id "TSS10232"; +chrY Cufflinks exon 4887117 4887303 . + . gene_id "XLOC_010233"; transcript_id "TCONS_00010233"; exon_number "1"; oId "CUFF.10238.1"; tss_id "TSS10233"; +chrY Cufflinks exon 4892426 4892458 . + . gene_id "XLOC_010234"; transcript_id "TCONS_00010234"; exon_number "1"; oId "CUFF.10239.1"; tss_id "TSS10234"; +chrY Cufflinks exon 6699967 6700082 . + . gene_id "XLOC_010235"; transcript_id "TCONS_00010235"; exon_number "1"; oId "CUFF.10240.1"; tss_id "TSS10235"; +chrY Cufflinks exon 7246714 7246820 . + . gene_id "XLOC_010236"; transcript_id "TCONS_00010236"; exon_number "1"; oId "CUFF.10242.1"; tss_id "TSS10236"; +chrY Cufflinks exon 8239628 8239704 . + . gene_id "XLOC_010237"; transcript_id "TCONS_00010237"; exon_number "1"; oId "CUFF.10244.1"; tss_id "TSS10237"; +chrY Cufflinks exon 10034865 10036712 . + . gene_id "XLOC_010238"; transcript_id "TCONS_00010238"; exon_number "1"; oId "CUFF.10248.1"; tss_id "TSS10238"; +chrY Cufflinks exon 14394197 14394488 . + . gene_id "XLOC_010239"; transcript_id "TCONS_00010239"; exon_number "1"; oId "CUFF.10249.1"; tss_id "TSS10239"; +chrY Cufflinks exon 14834535 14834577 . + . gene_id "XLOC_010240"; transcript_id "TCONS_00010240"; exon_number "1"; oId "CUFF.10251.1"; tss_id "TSS10240"; +chrY Cufflinks exon 16202689 16202723 . + . gene_id "XLOC_010241"; transcript_id "TCONS_00010241"; exon_number "1"; oId "CUFF.10253.1"; tss_id "TSS10241"; +chrY Cufflinks exon 18360815 18360921 . + . gene_id "XLOC_010242"; transcript_id "TCONS_00010242"; exon_number "1"; oId "CUFF.10254.1"; tss_id "TSS10242"; +chrY Cufflinks exon 19669744 19669858 . + . gene_id "XLOC_010243"; transcript_id "TCONS_00010243"; exon_number "1"; oId "CUFF.10256.1"; tss_id "TSS10243"; +chrY Cufflinks exon 19671654 19671771 . + . gene_id "XLOC_010244"; transcript_id "TCONS_00010244"; exon_number "1"; oId "CUFF.10257.1"; tss_id "TSS10244"; +chrY Cufflinks exon 20278734 20278898 . + . gene_id "XLOC_010245"; transcript_id "TCONS_00010245"; exon_number "1"; oId "CUFF.10260.1"; tss_id "TSS10245"; +chrY Cufflinks exon 20487249 20487859 . + . gene_id "XLOC_010246"; transcript_id "TCONS_00010246"; exon_number "1"; oId "CUFF.10261.1"; tss_id "TSS10246"; +chrY Cufflinks exon 20648397 20648560 . + . gene_id "XLOC_010247"; transcript_id "TCONS_00010247"; exon_number "1"; oId "CUFF.10264.1"; tss_id "TSS10247"; +chrY Cufflinks exon 22682757 22682804 . + . gene_id "XLOC_010248"; transcript_id "TCONS_00010248"; exon_number "1"; oId "CUFF.10267.1"; tss_id "TSS10248"; +chrY Cufflinks exon 25367901 25367935 . + . gene_id "XLOC_010249"; transcript_id "TCONS_00010249"; exon_number "1"; oId "CUFF.10271.1"; tss_id "TSS10249"; +chrY Cufflinks exon 25542161 25542197 . + . gene_id "XLOC_010250"; transcript_id "TCONS_00010250"; exon_number "1"; oId "CUFF.10272.1"; tss_id "TSS10250"; +chrY Cufflinks exon 26982287 26982321 . + . gene_id "XLOC_010251"; transcript_id "TCONS_00010251"; exon_number "1"; oId "CUFF.10277.1"; tss_id "TSS10251"; +chrY Cufflinks exon 26993702 26993738 . + . gene_id "XLOC_010252"; transcript_id "TCONS_00010252"; exon_number "1"; oId "CUFF.10278.1"; tss_id "TSS10252"; +chrY Cufflinks exon 27605129 27605281 . + . gene_id "XLOC_010253"; transcript_id "TCONS_00010253"; exon_number "1"; oId "CUFF.10279.1"; tss_id "TSS10253"; +chrY Cufflinks exon 27869489 27869646 . + . gene_id "XLOC_010254"; transcript_id "TCONS_00010254"; exon_number "1"; oId "CUFF.10280.1"; tss_id "TSS10254"; +chrY Cufflinks exon 28075128 28075284 . + . gene_id "XLOC_010255"; transcript_id "TCONS_00010255"; exon_number "1"; oId "CUFF.10281.1"; tss_id "TSS10255"; +chrY Cufflinks exon 28507137 28507239 . + . gene_id "XLOC_010256"; transcript_id "TCONS_00010256"; exon_number "1"; oId "CUFF.10283.1"; tss_id "TSS10256"; +chrY Cufflinks exon 28567957 28568011 . + . gene_id "XLOC_010257"; transcript_id "TCONS_00010257"; exon_number "1"; oId "CUFF.10284.1"; tss_id "TSS10257"; +chrY Cufflinks exon 28687553 28687618 . + . gene_id "XLOC_010258"; transcript_id "TCONS_00010258"; exon_number "1"; oId "CUFF.10285.1"; tss_id "TSS10258"; +chrY Cufflinks exon 59218093 59218136 . + . gene_id "XLOC_010259"; transcript_id "TCONS_00010259"; exon_number "1"; oId "CUFF.10286.1"; tss_id "TSS10259"; +chrY Cufflinks exon 313175 313212 . - . gene_id "XLOC_010260"; transcript_id "TCONS_00010260"; exon_number "1"; oId "CUFF.10231.1"; tss_id "TSS10260"; +chrY Cufflinks exon 1369147 1369257 . - . gene_id "XLOC_010261"; transcript_id "TCONS_00010261"; exon_number "1"; oId "CUFF.10232.1"; tss_id "TSS10261"; +chrY Cufflinks exon 1898797 1898836 . - . gene_id "XLOC_010262"; transcript_id "TCONS_00010262"; exon_number "1"; oId "CUFF.10233.1"; tss_id "TSS10262"; +chrY Cufflinks exon 4043028 4043131 . - . gene_id "XLOC_010263"; transcript_id "TCONS_00010263"; exon_number "1"; oId "CUFF.10237.1"; tss_id "TSS10263"; +chrY Cufflinks exon 7192393 7192636 . - . gene_id "XLOC_010264"; transcript_id "TCONS_00010264"; exon_number "1"; oId "CUFF.10241.1"; tss_id "TSS10264"; +chrY Cufflinks exon 7291096 7291199 . - . gene_id "XLOC_010265"; transcript_id "TCONS_00010265"; exon_number "1"; oId "CUFF.10243.1"; tss_id "TSS10265"; +chrY Cufflinks exon 8240142 8240212 . - . gene_id "XLOC_010266"; transcript_id "TCONS_00010266"; exon_number "1"; oId "CUFF.10245.1"; tss_id "TSS10266"; +chrY Cufflinks exon 9928017 9928136 . - . gene_id "XLOC_010267"; transcript_id "TCONS_00010267"; exon_number "1"; oId "CUFF.10246.1"; tss_id "TSS10267"; +chrY Cufflinks exon 9930482 9930602 . - . gene_id "XLOC_010268"; transcript_id "TCONS_00010268"; exon_number "1"; oId "CUFF.10247.1"; tss_id "TSS10268"; +chrY Cufflinks exon 14551303 14551389 . - . gene_id "XLOC_010269"; transcript_id "TCONS_00010269"; exon_number "1"; oId "CUFF.10250.1"; tss_id "TSS10269"; +chrY Cufflinks exon 14977169 14977203 . - . gene_id "XLOC_010270"; transcript_id "TCONS_00010270"; exon_number "1"; oId "CUFF.10252.1"; tss_id "TSS10270"; +chrY Cufflinks exon 18448163 18448269 . - . gene_id "XLOC_010271"; transcript_id "TCONS_00010271"; exon_number "1"; oId "CUFF.10255.1"; tss_id "TSS10271"; +chrY Cufflinks exon 19691914 19692524 . - . gene_id "XLOC_010272"; transcript_id "TCONS_00010272"; exon_number "1"; oId "CUFF.10258.1"; tss_id "TSS10272"; +chrY Cufflinks exon 19900878 19901042 . - . gene_id "XLOC_010273"; transcript_id "TCONS_00010273"; exon_number "1"; oId "CUFF.10259.1"; tss_id "TSS10273"; +chrY Cufflinks exon 20508007 20508124 . - . gene_id "XLOC_010274"; transcript_id "TCONS_00010274"; exon_number "1"; oId "CUFF.10262.1"; tss_id "TSS10274"; +chrY Cufflinks exon 20509919 20510033 . - . gene_id "XLOC_010275"; transcript_id "TCONS_00010275"; exon_number "1"; oId "CUFF.10263.1"; tss_id "TSS10275"; +chrY Cufflinks exon 20995613 20995776 . - . gene_id "XLOC_010276"; transcript_id "TCONS_00010276"; exon_number "1"; oId "CUFF.10265.1"; tss_id "TSS10276"; +chrY Cufflinks exon 21180875 21180973 . - . gene_id "XLOC_010277"; transcript_id "TCONS_00010277"; exon_number "1"; oId "CUFF.10266.1"; tss_id "TSS10277"; +chrY Cufflinks exon 25320640 25320676 . - . gene_id "XLOC_010278"; transcript_id "TCONS_00010278"; exon_number "1"; oId "CUFF.10268.1"; tss_id "TSS10278"; +chrY Cufflinks exon 25331485 25331521 . - . gene_id "XLOC_010279"; transcript_id "TCONS_00010279"; exon_number "1"; oId "CUFF.10269.1"; tss_id "TSS10279"; +chrY Cufflinks exon 25342900 25342934 . - . gene_id "XLOC_010280"; transcript_id "TCONS_00010280"; exon_number "1"; oId "CUFF.10270.1"; tss_id "TSS10280"; +chrY Cufflinks exon 25887094 25887250 . - . gene_id "XLOC_010281"; transcript_id "TCONS_00010281"; exon_number "1"; oId "CUFF.10273.1"; tss_id "TSS10281"; +chrY Cufflinks exon 26092761 26092918 . - . gene_id "XLOC_010282"; transcript_id "TCONS_00010282"; exon_number "1"; oId "CUFF.10274.1"; tss_id "TSS10282"; +chrY Cufflinks exon 26357155 26357307 . - . gene_id "XLOC_010283"; transcript_id "TCONS_00010283"; exon_number "1"; oId "CUFF.10275.1"; tss_id "TSS10283"; +chrY Cufflinks exon 26957285 26957319 . - . gene_id "XLOC_010284"; transcript_id "TCONS_00010284"; exon_number "1"; oId "CUFF.10276.1"; tss_id "TSS10284"; +chrY Cufflinks exon 28420717 28420753 . - . gene_id "XLOC_010285"; transcript_id "TCONS_00010285"; exon_number "1"; oId "CUFF.10282.1"; tss_id "TSS10285"; +chrY Cufflinks exon 59294079 59294116 . - . gene_id "XLOC_010286"; transcript_id "TCONS_00010286"; exon_number "1"; oId "CUFF.10287.1"; tss_id "TSS10286"; diff --git a/run.bash b/run.bash new file mode 100755 index 0000000..526ca78 --- /dev/null +++ b/run.bash @@ -0,0 +1,25 @@ +#!/bin/bash + +source code/custom-bashrc + + +if [ "$#" -ne 2 ]; then + printf "\n\n###### Usage\n\n" + printf "$0 \n\n" + exit +fi + +PARAMS=$1 +GROUP_FILE=$2 + +samples=`cut -f1 $GROUP_FILE | code/skipn 1` +code/setup_waiting.bash ${samples[*]} +echo ${samples[*]} | xargs -n1 code/job_submitter.bash 5 code/By_Sample $PARAMS +code/wait_jobs.bash ${samples[*]} + + +GROUP_BYs=`head -1 $GROUP_FILE | cut -f2-` +code/setup_waiting.bash ${GROUP_BYs[*]} +echo ${GROUP_BYs[*]} | xargs -n1 code/job_submitter.bash 6 code/Summarize $PARAMS pipeline/summarize $GROUP_FILE +code/wait_jobs.bash ${GROUP_BYs[*]} +